Added rnstatus utility

This commit is contained in:
Mark Qvist 2021-09-24 20:10:04 +02:00
parent f5510f9777
commit 7991db5c74
11 changed files with 234 additions and 7 deletions

View file

@ -31,6 +31,9 @@ class SerialInterface(Interface):
serial = None
def __init__(self, owner, name, port, speed, databits, parity, stopbits):
self.rxb = 0
self.txb = 0
self.serial = None
self.owner = owner
self.name = name
@ -79,6 +82,7 @@ class SerialInterface(Interface):
def processIncoming(self, data):
self.rxb += len(data)
self.owner.inbound(data, self)
@ -86,6 +90,7 @@ class SerialInterface(Interface):
if self.online:
data = bytes([HDLC.FLAG])+HDLC.escape(data)+bytes([HDLC.FLAG])
written = self.serial.write(data)
self.txb += len(data)
if written != len(data):
raise IOError("Serial interface only wrote "+str(written)+" bytes of "+str(len(data)))