Esempio n. 1
0
def queryHandler(msgRef, t1, clientData):
    print "queryHandler: Receiving %s [%s]",  \
   (IPC.IPC_msgInstanceName(msgRef), clientData)
    IPC.IPC_printData(IPC.IPC_msgInstanceFormatter(msgRef), sys.stdout, t1)

    # Publish this message -- all subscribers get it
    str1 = "Hello, world"
    print '\n  IPC.IPC_publishData(%s, "%s")' % (MSG2, str1)
    IPC.IPC_publishData(MSG2, str1)

    t2 = T2()
    t2.str1 = str1
    # Variable length array of one element
    t2.t1 = [T1()]
    t2.t1[0] = t1
    t2.count = 1
    t2.status = ReceiveVal

    # Respond with this message -- only the query handler gets it
    print "\n  IPC.IPC_respondData(%s, %s, %s)" % (msgRef, RESPONSE1, t2)
    IPC.IPC_respondData(msgRef, RESPONSE1, t2)