Exemplo n.º 1
0
 def __init__(self, serial, config, sleepPin=[]):
     Radio.__init__(self, serial, config)
     self.sleepPin = sleepPin
     # Setup sleep pin
     if self.sleepPin:
         GPIO.setup(self.sleepPin, "out")
         self.setOff()  # default to off mode
     pass
Exemplo n.º 2
0
    def __init__(self, config):
        Radio.__init__(self, [], config)

        # Read port
        self.sockRead = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
        self.sockRead.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
        self.sockRead.bind((config['ipAddr'], config['readPort']))
        self.sockRead.setblocking(0)  # non-blocking to prevent hanging thread

        # Write port
        self.sockWrite = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
        self.sockWrite.setblocking(0)
        self.sockWriteIp = config['ipAddr']
        self.sockWritePort = config['writePort']
Exemplo n.º 3
0
    def __init__(self, serial, config):
        Radio.__init__(self, serial, config)

        self.crc16 = crcmod.predefined.mkCrcFun('crc16')
Exemplo n.º 4
0
 def __init__(self, serial, config):
     Radio.__init__(self, serial, config)
     self.cmdRxBuffer = bytearray()