refactored

This commit is contained in:
2026-03-16 15:30:10 +01:00
parent 34e56c6291
commit fd0be82719
4 changed files with 96 additions and 68 deletions
+20
View File
@@ -0,0 +1,20 @@
from msg_container import MsgContainer
from msg_sink import MsgSink
from ubx.ubx import frame_parse, frame_parse_hdr
class UbxReceiver(MsgSink):
def __init__(self, name: str, mid: int, mclass: int):
MsgSink.__init__(self)
self.name = name
self.mid = mid
self.mclass = mclass
def on_recv(self, msg: MsgContainer):
data, hdr = frame_parse(msg.data)
print(f"{hdr.mclass}:{hdr.mid}:{data}")
def is_msg(self, msg: MsgContainer):
hdr = frame_parse_hdr(msg.data)
if hdr is not None:
return self.mclass == hdr.mclass and self.mid == hdr.mid
return False