Python client for GEX

__init__.py 2.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #!/usr/bin/env python3
  2. from gex.PayloadBuilder import PayloadBuilder
  3. from gex.PayloadParser import PayloadParser
  4. from gex.TinyFrame import TinyFrame, TF_Msg, TF
  5. from gex.Unit import Unit
  6. from gex.Client import Client
  7. from gex.transport import TrxRawUSB
  8. from gex.transport import TrxSerialSync
  9. from gex.transport import TrxSerialThread
  10. from gex.transport import DongleAdapter
  11. # import all the units
  12. from gex.units.DOut import DOut
  13. from gex.units.DIn import DIn
  14. from gex.units.Neopixel import Neopixel
  15. from gex.units.I2C import I2C
  16. from gex.units.SPI import SPI
  17. from gex.units.USART import USART
  18. from gex.units.OneWire import OneWire
  19. from gex.units.ADC import ADC
  20. from gex.units.SIPO import SIPO
  21. from gex.units.FCAP import FCAP
  22. from gex.units.TOUCH import TOUCH
  23. from gex.units.PWMDim import PWMDim
  24. from gex.units.DAC import DAC
  25. # General, low level
  26. MSG_SUCCESS = 0x00 # Generic success response; used by default in all responses; payload is transaction-specific
  27. MSG_PING = 0x01 # Ping request (or response), used to test connection
  28. MSG_ERROR = 0x02 # Generic failure response (when a request fails to execute)
  29. MSG_BULK_READ_OFFER = 0x03 # Offer of data to read. Payload: u32 total len
  30. MSG_BULK_READ_POLL = 0x04 # Request to read a previously announced chunk. Payload: u32 max chunk
  31. MSG_BULK_WRITE_OFFER = 0x05 # Offer to receive data in a write transaction. Payload: u32 max size, u32 max chunk
  32. MSG_BULK_DATA = 0x06 # Writing a chunk, or sending a chunk to master.
  33. MSG_BULK_END = 0x07 # Bulk transfer is done, no more data to read or write.
  34. # Recipient shall check total len and discard it on mismatch. There could be a checksum ...
  35. MSG_BULK_ABORT = 0x08 # Discard the ongoing transfer
  36. # Unit messages
  37. MSG_UNIT_REQUEST = 0x10 # Command addressed to a particular unit
  38. MSG_UNIT_REPORT = 0x11 # Spontaneous report from a unit
  39. # System messages
  40. MSG_LIST_UNITS = 0x20 # Get all unit call-signs and names
  41. MSG_INI_READ = 0x21 # Read the ini file via bulk
  42. MSG_INI_WRITE = 0x22 # Write the ini file via bulk
  43. MSG_PERSIST_SETTINGS = 0x23 # Write current settings to Flash