A clone of: https://github.com/nutechsoftware/alarmdecoder This is requires as they dropped support for older firmware releases w/o building in backward compatibility code, and they had previously hardcoded pyserial to a python2 only version.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

40 lines
655 B

  1. import pyad2usb.ad2usb
  2. import time
  3. import signal
  4. running = True
  5. def signal_handler(signal, frame):
  6. global running
  7. running = False
  8. def handle_open(sender, args):
  9. print 'opened', args
  10. def handle_close(sender, args):
  11. print 'closed', args
  12. def handle_read(sender, args):
  13. print 'read', args
  14. def handle_write(sender, args):
  15. print 'write', args
  16. signal.signal(signal.SIGINT, signal_handler)
  17. #pyad2usb.ad2usb.AD2USB.find_all()
  18. wut = pyad2usb.ad2usb.AD2USB()
  19. wut.on_open += handle_open
  20. wut.on_close += handle_close
  21. wut.on_read += handle_read
  22. wut.on_write += handle_write
  23. wut.open()
  24. while running:
  25. time.sleep(0.1)
  26. wut.close()