class SerialMgr(): def __init__(self): # Create serial port manager self.serial = SerialPort(self.on_rx_data,self.on_connect_try_callback) self.serial.connect("COM11",115200) def on_rx_data(self,c): print(c.decode('ascii'),end='') def on_connect_try_callback(self,data): print(data)
class SerialMgr(): def __init__(self): # Create protocol and give callback function self.protocol = Protocol(self.on_new_payload) # Create serial port manager self.serial = SerialPort(self.on_rx_data) self.serial.connect("COM5",115200) self.serial.run() def on_rx_data(self,c): print(c) self.protocol.decode(c) def on_new_payload(self,payload): print("decoded :",payload)
class SerialMgr(): def __init__(self): # Create protocol and give callback function self.protocol = Protocol(self.on_new_payload) # Create serial port manager self.serial = SerialPort(self.on_rx_data) self.serial.disconnect() self.serial.connect("COM8", 115200) self.serial.start() def on_rx_data(self, c): print(c) self.protocol.decode(c) def on_new_payload(self, payload): print("decoded :", payload)