Exemple #1
0
#!/usr/bin/env python

from serial_rf_spy import SerialRfSpy
import sys
import binascii
import time
from datetime import datetime

if len(sys.argv) < 2:
  print "usage: send.py serialport [channel]"
  sys.exit(2)

channel = 2

if len(sys.argv) == 3:
  channel = int(sys.argv[2])

rl = SerialRfSpy(sys.argv[1])
rl.sync()
rl.do_command(SerialRfSpy.CMD_SET_CHANNEL, chr(channel))

for _ in range(50):
  rl.do_command(SerialRfSpy.CMD_SEND_PACKET, binascii.unhexlify("0000a968e55658e594d555d1a500"))
#!/usr/bin/env python

from serial_rf_spy import SerialRfSpy
import sys
import binascii
import time
from datetime import datetime

if len(sys.argv) < 2:
  print "usage: get_rfspy_version.py serialport"
  sys.exit(2)

channel = 0

rl = SerialRfSpy(sys.argv[1])
rl.sync()
resp = rl.do_command(SerialRfSpy.CMD_GET_VERSION)

print "Response: " + resp
#!/usr/bin/env python

from serial_rf_spy import SerialRfSpy
import sys
import binascii
import time
from datetime import datetime

if len(sys.argv) < 3:
  print "usage: get_rfspy_version.py serialport addr value"
  print "Both addr and value should be specified with hex, starting with 0x*"
  sys.exit(2)

serial_device = sys.argv[1]
address = int(sys.argv[2], 16)
value = int(sys.argv[3], 16)

rl = SerialRfSpy(serial_device)
rl.sync()
resp = rl.do_command(SerialRfSpy.CMD_UPDATE_REGISTER, chr(address) + chr(value))

if ord(resp) == 1:
  print "SUCCESS"
else:
  print "ERROR - %i" % ord(resp)
Exemple #4
0
#!/usr/bin/env python

from serial_rf_spy import SerialRfSpy
import sys
import binascii
import time
from datetime import datetime

if len(sys.argv) < 2:
    print "usage: send.py serialport [channel]"
    sys.exit(2)

channel = 2

if len(sys.argv) == 3:
    channel = int(sys.argv[2])

rl = SerialRfSpy(sys.argv[1])
rl.sync()
rl.do_command(SerialRfSpy.CMD_SET_CHANNEL, chr(channel))

for _ in range(50):
    rl.do_command(SerialRfSpy.CMD_SEND_PACKET,
                  binascii.unhexlify("0000a968e55658e594d555d1a500"))
Exemple #5
0
#!/usr/bin/env python

from serial_rf_spy import SerialRfSpy
import sys
import binascii
import time
from datetime import datetime

if len(sys.argv) < 2:
  print "usage: get_model.py serialport"
  sys.exit(2)

channel = 0

rl = SerialRfSpy(sys.argv[1])
rl.sync()
rl.do_command(SerialRfSpy.CMD_SET_CHANNEL, chr(0))

resp = rl.do_command(SerialRfSpy.CMD_SEND_PACKET, binascii.unhexlify("0000a968e55658e568d555d26500"))
rl.do_command(SerialRfSpy.CMD_SET_CHANNEL, chr(2))
packet = rl.do_command(SerialRfSpy.CMD_GET_PACKET, chr(0))

print "Response: " + packet
#!/usr/bin/env python

from serial_rf_spy import SerialRfSpy
import sys
import binascii
import time
from datetime import datetime

if len(sys.argv) < 2:
    print "usage: get_rfspy_version.py serialport"
    sys.exit(2)

channel = 0

rl = SerialRfSpy(sys.argv[1])
rl.sync()
resp = rl.do_command(SerialRfSpy.CMD_GET_VERSION)

print "Response: " + resp
Exemple #7
0
    packet_number = p[1]

    p = p[2:]
    t = datetime.utcnow().strftime('%Y-%m-%d %H:%M:%S.%f')[:-3]
    print "%s - (%d) (%d) - %s" % (t, rssi, packet_number, binascii.hexlify(p))
    sys.stdout.flush()


if len(sys.argv) < 2:
    print "usage: listen.py serialport [channel]"
    sys.exit(2)

channel = 2

if len(sys.argv) == 3:
    channel = int(sys.argv[2])

rl = SerialRfSpy(sys.argv[1])
rl.sync()
rl.do_command(SerialRfSpy.CMD_SET_CHANNEL, chr(channel))
while 1:
    timeout = 0
    rl.send_command(SerialRfSpy.CMD_GET_PACKET, chr(timeout))
    packet = rl.get_response()
    if len(packet) > 2:
        print_packet(packet)
    else:
        print "Timeout"
        sys.exit(0)
Exemple #8
0
  packet_number = p[1];

  p = p[2:]
  t = datetime.utcnow().strftime('%Y-%m-%d %H:%M:%S.%f')[:-3]
  print "%s - (%d) (%d) - %s" % (t,  rssi, packet_number, binascii.hexlify(p))
  sys.stdout.flush()


if len(sys.argv) < 2:
  print "usage: listen.py serialport [channel]"
  sys.exit(2)

channel = 2

if len(sys.argv) == 3:
  channel = int(sys.argv[2])

rl = SerialRfSpy(sys.argv[1])
rl.sync()
rl.do_command(SerialRfSpy.CMD_SET_CHANNEL, chr(channel))
while 1:
  timeout = 0
  rl.send_command(SerialRfSpy.CMD_GET_PACKET, chr(timeout))
  packet = rl.get_response()
  if len(packet) > 2:
    print_packet(packet)
  else:
    print "Timeout"
    sys.exit(0)