The parser interprets incoming telemetry strings into useful telemetry data.
The Parser Sink
The parser sink is the interface between the message server and the parser modules. It is responsible for receiving raw telemetry from the message server, giving it to modules which turn it into beautiful telemetry data, and then sending that back to the message server.
Initialises the sink, adding the types of telemetry we care about to our types list and setting up lists of modules
Scans the certs/ca directory to find CA certificates and loads them.
Handles a new message from the server, hopefully turning it into parsed telemetry data.
This function attempts to determine which of the loaded parser modules should be used to parse the message, and which config file it should be given to do so.
For the priority ordered list self.modules, resolution proceeds as:
for module in modules:
module.pre_parse to find a callsign
if a callsign is found:
look up the configuration document for that callsign
if a configuration document is found:
check it specifies that this module should be used
if it does:
module.parse to get the data
return
if all modules were attempted but no config docs were found:
for module in modules:
if this module has a default configuration:
module.pre_parse to find a callsign
if a callsign is found:
use this module's default configuration
module.parse to get the data
return
if we still can't get any data:
error
Note that in the loops below, the pre_parse, _find_config_doc and parse methods will all raise a ValueError if failure occurs, continuing the loop.
The output is a new message of type Message.TELEM, with message.data being the parsed data as well as any special fields, identified by a leading underscore in the key.
These fields may include:
Parser modules should be wary when outputting field names with leading underscores.
ParserModules are classes which turn radio strings into useful data.
ParserModules
Store the parser reference for later use.
Go though a string and attempt to extract a callsign, returning it as a string. If no callsign could be extracted, a ValueError is raised.