- 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:
@@ -0,0 +1,15 @@
|
||||
from abc import ABC
|
||||
from msg_montainer import MsgContainer
|
||||
from msg_sink import MsgSink
|
||||
|
||||
class MsgSource(ABC):
|
||||
def __init__(self):
|
||||
self.sinks = {}
|
||||
|
||||
def register_recv(self, name: str, sink: MsgSink):
|
||||
self.sinks[name] = {'sink': sink}
|
||||
|
||||
def call_sinks(self, msg: MsgContainer):
|
||||
if msg.name in self.sinks:
|
||||
sink = self.sinks[msg.name]['sink']
|
||||
sink.on_recv(msg)
|
||||
Reference in New Issue
Block a user