From 44121358fee5bd934e4b567415cb611d9833a1cc Mon Sep 17 00:00:00 2001 From: Peter Shipley Date: Tue, 4 Mar 2014 17:33:28 -0800 Subject: [PATCH] may cause API to stop responding --- Tests/get_hist.py | 74 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100755 Tests/get_hist.py diff --git a/Tests/get_hist.py b/Tests/get_hist.py new file mode 100755 index 0000000..30ce7ec --- /dev/null +++ b/Tests/get_hist.py @@ -0,0 +1,74 @@ +#!/usr/bin/env python + +""" +based on TalkToEagle.py +""" + + +import socket +import sys +import time + +my_macid = "0xd8d5b90000001296" + + + +# Enter your Eagle's IP below +Eagle_IP = "10.1.1.39" + +## list_devices + +s = socket.create_connection( (Eagle_IP, 5002), 10) +print s +time.sleep(1) + +sendstr = "\nlist_devices\n\n" + +s.sendall(sendstr) +print +print "sending to Eagle: \n\r" +print sendstr +print + +time.sleep(1) + +print "Eagle response: \n\r" + +while 1: + buf = s.recv(1000) + if not buf: + break + sys.stdout.write(buf) + +s.close() + + +## get_history_data + +s = socket.create_connection( (Eagle_IP, 5002), 10) +print s + +time.sleep(1) + +sendstr = "\nget_history_data\n0xd8d5b90000001296\n0x00000000\n\n".format(my_macid) + +s.sendall(sendstr) +print +print "sending to Eagle: \n\r" +print sendstr +print + +time.sleep(1) + +print "Eagle response: \n\r" + +while 1: + buf = s.recv(1000) + if not buf: + break + sys.stdout.write(buf) + +s.close() + + +exit(0)