message: mstarch: initial router for uplink/downlink
diff: @@ -11,37 +11,29 @@ import struct
  import fprime_gds.common.handlers
  -class OutgoingRouter(fprime_gds.common.handlers.DataHandler):
  +class OutgoingRouter(fprime_gds.common.handlers.DataHandler, fprime_gds.common.handlers.HandlerRegistrar):
  """
  Handshake router that inspects the originating caller and notes it in a table. This table can then be consulted when
  the data returns for sending handshakes back to the originating object.
  """
  def __init__(self):
  """
  - Constructor of the outgoing router.
  + Construct the outgoing router with a dictioanry to map IDs
  """
  - self.consumers = []
  -
  - def register(self, consumer):
  - """
  - Register the consumers of the outgoing data.
  - """
  - self.consumers.append(consumer)
  def data_callback(self, data, sender=None):
  """
  Handles incoming data by stamping on a handshake token to be passed back in the handshake packet. This reads
  from the sender parameter to creat this token, otherwise "0000" is sent out.
  :param data: encoded data to be prepended to
  - :param sender: sender id to append to.
  + :param sender: sender to append to.
  """
  if sender is None:
  sender = 0
  elif isinstance(sender, int):
  raise ValueError("Sender expected to integer")
  bytes_data = data + struct.unpack(">I", sender)
  - for consumer in self.consumers:
  - consumer.data_callback(bytes_data)
  + self.send_to_all(bytes_data)
  class IncomingRouter(fprime_gds.common.handlers.DataHandler):
  @@ -49,18 +41,6 @@ class IncomingRouter(fprime_gds.common.handlers.DataHandler):
  Handshake router that inspects the returning handshake packet, and routes back to the originating object found in
  the outgoing router.
  """
  - def __init__(self):
  - """
  - Constructor of the outgoing router.
  - """
  - self.consumers = []
  -
  - def register(self, consumer):
  - """
  - Register the consumers of the outgoing data.
  - """
  - self.consumers.append(consumer)
  -
  def data_callback(self, data, sender=None):
  """
  Handles incoming data by stamping on a handshake token to be passed back in the handshake packet. This reads
  @@ -73,5 +53,4 @@ class IncomingRouter(fprime_gds.common.handlers.DataHandler):
  elif isinstance(sender, int):
  raise ValueError("Sender expected to integer")
  bytes_data = data + struct.unpack(">I", sender)
  - for consumer in self.consumers:
  - consumer.data_callback(bytes_data)
  \ No newline at end of file
  + self.send_to_all(bytes_data)
  