2016-12-22 17:50:02 +01:00
|
|
|
#!/usr/bin/env python2
|
|
|
|
|
|
|
|
from time import sleep
|
|
|
|
|
|
|
|
from sss7 import SSS7
|
|
|
|
|
2016-12-28 15:18:19 +01:00
|
|
|
packets = [[1, 0, 33, 2],
|
|
|
|
[1, 0, 22, 2]]
|
|
|
|
|
2016-12-22 17:50:02 +01:00
|
|
|
def to_byte_list(data):
|
|
|
|
return [ord(c) for c in data]
|
|
|
|
|
|
|
|
def to_string(data):
|
|
|
|
data = [chr(c) for c in data]
|
|
|
|
return "".join(data)
|
|
|
|
|
|
|
|
def main():
|
|
|
|
SSS7.start("/dev/ttyUSB0")
|
|
|
|
|
2016-12-28 15:18:19 +01:00
|
|
|
for packet in packets:
|
|
|
|
while not SSS7.can_send():
|
|
|
|
sleep(0.1)
|
|
|
|
|
|
|
|
print "Paket: %s" % packet
|
|
|
|
SSS7.send(packet);
|
|
|
|
|
|
|
|
#while(not SSS7.has_received()):
|
|
|
|
# sleep(0.01)
|
|
|
|
|
|
|
|
#SSS7.get_received()
|
|
|
|
raw_input("Next ?")
|
2016-12-22 17:50:02 +01:00
|
|
|
|
|
|
|
|
2016-12-28 15:18:19 +01:00
|
|
|
#for i in [1,2,0]:
|
|
|
|
#while not SSS7.can_send():
|
|
|
|
# sleep(0.1)
|
2016-12-22 17:50:02 +01:00
|
|
|
|
2016-12-28 15:18:19 +01:00
|
|
|
#print "Moving to %d" % i
|
|
|
|
#SSS7.send([8, 0, 255, i]);
|
2016-12-22 17:50:02 +01:00
|
|
|
|
2016-12-28 15:18:19 +01:00
|
|
|
#while(not SSS7.has_received()):
|
|
|
|
# sleep(0.01)
|
2016-12-23 02:08:57 +01:00
|
|
|
|
2016-12-28 15:18:19 +01:00
|
|
|
#SSS7.get_received()
|
|
|
|
raw_input("Next ?")
|
2016-12-23 02:08:57 +01:00
|
|
|
|
2016-12-22 17:50:02 +01:00
|
|
|
|
|
|
|
|
|
|
|
SSS7.stop()
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
main()
|