# index. This field is what the pull request fill filter on. The data message # emulates the JSON encoding of the private contacts data format. while n <= 5: time.sleep(0.5) data = "{\"first_name\":\"" + firstName + "\", " data += "\"middle_initial\":\"" + middleInitial + "\", " data += "\"last_name\":\"" + lastName + "\", " data += "\"rank\":\"E" + str(n) + "\", " data += "\"call_sign\":\"\", " data += "\"branch\":\"\", " data += "\"unit\":\"\", " data += "\"email\":\"\", " data += "\"phone\":\"\" }" output_msg = "Sending data message " + str(n) print output_msg connector.push(uri, mimeType, data) n += 1 # Send a single pull request. # Only 1 of the 5 messages sent will match this, so we'll get 1 match # for every time this test has been run on a given gateway. rank = "E4" call_sign = "" branch = "" unit = "" email = "" phone = "" query = userName + ","
if len(sys.argv) != 3: print "Usage: ", sys.argv[0], "host port" exit(-1) deviceName = "device:test/" + uuid.uuid1().hex userName = "******" + uuid.uuid1().hex connector = AndroidConnector(sys.argv[1], int(sys.argv[2]), deviceName, userName, "") try: connector.start() connector.waitForAuthentication() print "Subscribing to type text/plain" connector.push("someUri", "blah_asdf", "directed message from user " + userName) connector.pullRequest("blah", ",,1302228081,,stuff", "", 0, 0, False) while True: while(connector.isDataAvailable()): result = connector.dequeueMessage() if(result != None): (msg, receivedTime) = result print "Message received at:", receivedTime print msg time.sleep(0.5) except KeyboardInterrupt: print "Got ^C... Closing" reactor.callFromThread(reactor.stop) # re-raising the exception so we get a traceback (useful for debugging,