- added Msg frame work with Msg container , Msg sources, Msg sinks

- added filter by message type to nmea receiver
- show case new features in MultiClient.main()
This commit is contained in:
2026-03-08 17:46:25 +01:00
parent 1b9d07db7f
commit c6c1f26f32
7 changed files with 134 additions and 18 deletions
+29
View File
@@ -0,0 +1,29 @@
from msg_montainer import MsgContainer
from msg_sink import MsgSink
from msg_source import MsgSource
from struct import pack
class Packetizer(MsgSink, MsgSource):
def __init__(self):
MsgSink.__init__(self)
MsgSource.__init__(self)
self.packet = b''
self.wait_sync = True
def on_recv(self, msg: MsgContainer):
name = msg.name
data = msg.data
for n in range (len(data)):
d = data[n]
if d == 13 or d == 10:
timestamp = msg.timestamp
self.wait_sync = False
if len(self.packet) > 0:
self.call_sinks(MsgContainer(name, timestamp, self.packet))
self.wait_sync = True
self.packet = b''
elif not self.wait_sync:
self.packet += pack('B', d)