Esempio n. 1
0
def stdinHnd(fd, clientData):
    global done
    input = sys.stdin.readline()

    if (input[0] == 'q' or input[0] == 'Q'):
        IPC.IPC_disconnect()
        done = True
    elif (input[0] == 'm' or input[0] == 'M'):
        i1 = 42
        print "\n  IPC_publishData(%s, %d)" % (MSG1, i1)
        IPC.IPC_publishData(MSG1, i1)
    elif (input[0] == 'r' or input[0] == 'R'):
        t1 = T1()
        t1.i1 = 666
        t1.status = SendVal
        t1.matrix = ((0.0, 1.0, 2.0), (1.0, 2.0, 3.0))
        t1.d1 = 3.14159
        print "\n  IPC_queryResponseData(%s, %s, IPC_WAIT_FOREVER, %s)" % \
              (QUERY1, t1, T1.__name__)
        (r1, ret) = IPC.IPC_queryResponseData(QUERY1, t1, IPC.IPC_WAIT_FOREVER,
                                              T1)
        print "\n  Received response"
        IPC.IPC_printData(IPC.IPC_msgFormatter(RESPONSE1), sys.stdout, r1)
    else:
        print "stdinHnd [%s]: Received %s" % (clientData, input),