diff --git a/UDP-client-server.py b/UDP-client-server.py index cb1a0a14116e2bfadcf2b62163d77d96e1ed56d2..9b6d1d073721e9724db89355c8a54929a79f4b33 100755 --- a/UDP-client-server.py +++ b/UDP-client-server.py @@ -6,6 +6,11 @@ from threading import Thread, Timer import numpy as np from array import * +# pymongo for MongoDB support +import pymongo +# For timestamping in MongoDB +import datetime + #DEFINE INPUTS HERE #CLIENT - SENDER @@ -86,7 +91,7 @@ def udp_client_receive(UDP_RECEIVE_IP, UDP_RECEIVE_PORT): outfile.close() -#CALLBACK FUNCTION +#DATA SUBSCRIPTION (callback) def cb_event(recipient, threshold): # TODO @@ -98,6 +103,15 @@ def cb_event(recipient, threshold): # any of the thresholds are exceeded. Notify recpient as needed. print("TODO") + +#GET LOCALITY +def get_loc(): + # Query locality group, return the bounding box for current loc + #TODO + loc = 0 + + return loc + #CLIENT SERVER SIDE def udp_client_send(UDP_DEST_IP, UDP_DEST_PORT, PACKET_SIZE, NR_OF_PACKETS, PACKETS_PER_SEC): @@ -232,6 +246,9 @@ if __name__ == "__main__": while sender_thread.is_alive(): time.sleep(1) + # Measurement done, store data and then move on + + # While testing, end after one iteration sys.exit()