fprime_gds.common.handlers

handlers.py:

Defines a set of base classes that allow for the system to handle various functions of the system. Primarily this defines the “DataHandler” base class for handling data.

@author mstarch

Module Contents

Classes

DataHandler()

Defines the necessary functions required to handle data as part of the F prime project. This allows any implementor

HandlerRegistrar()

Defines a class that will take in registrants and remember them for calling back later. These objects should be of

class fprime_gds.common.handlers.DataHandler[source]

Bases: abc.ABC

Defines the necessary functions required to handle data as part of the F prime project. This allows any implementor to be used to handle data.

abstract data_callback(self, data, sender=None)[source]

Callback function used to handle data being produced elsewhere in the system and processed by the given object. Data supplied should be of a known type for the given object, and sender is an id of the sender. If not supplied sender will be None.

Parameters
  • data – data to be handled by this class

  • sender – (optional) id of sender, otherwise None

class fprime_gds.common.handlers.HandlerRegistrar[source]

Bases: abc.ABC

Defines a class that will take in registrants and remember them for calling back later. These objects should be of the type “DataHandler” as this handler will send data back to these handlers when asked to do so.

register(self, registrant)[source]

Register a registrant with this registrar. Will be stored and called back when asked to send data to all the handlers registered.

Parameters

registrant – handler to register

deregister(self, registrant)[source]

Remove a registrant from the registrar such that it will not be called back later. Note: ignores invalid removals by trapping the error, as the desired effect is already satisfied.

Parameters

registrant – registrant to remove

Returns

True if found, False if not. May safely be ignored.

send_to_all(self, data, sender=None)[source]

Sends the given data to all registrants.

Parameters
  • data – data to send back to registrants

  • sender – (optional) sender to pass to data_callback

Build: 1.4.1