def __init__(self, portnum=None, callbacks=[]): self.portnum = portnum self.exit = False try: self.uart = UART.Uart(portnum) except serial.SerialException as e: logging.exception("Error opening UART.") self.uart = UART.Uart() self.packetCounter = 0 self.lastReceivedPacketCounter = 0 self.lastReceivedPacket = None