From 9e20b3c2ee5197907eca1494b64fbb6d2d0cf25e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Tj=C3=A4der?= <henrik.tjader@gmail.com> Date: Fri, 27 Feb 2015 18:58:19 +0100 Subject: [PATCH] Added locality placeholder function --- UDP-client-server.py | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/UDP-client-server.py b/UDP-client-server.py index cb1a0a1..9b6d1d0 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() -- GitLab