habitat.parser_modules.ukhas_parser

This module contains the parser for the UKHAS telemetry protocol format.

The protocol is most succinctly described as:

$$<callsign>,<data>,<data>,...,<data>*<checksum>

The typical minimum telemetry string is:

$$<callsign>,<message number>,<time>,<latitude>,<longitude>,<altitude>,<data>,...,<data>*<checksum>

The number of custom data fields and their types are configurable.

Data fields are typically human readable (or at the least ASCII) readings of sensors or other system information. See the habitat.sensors module for more information on supported formats.

Checksums work on the message content between the $$ and the *, non-inclusive, and are given as hexadecimal (upper or lower case) after the * in the message.

Supported checksums are CRC16-CCITT with polynomial 0x1021 and start 0xFFFF, Fletcher-16 and an 8bit XOR over the characters. The corresponding values for configuration are crc16-ccitt, fletcher-16 and xor. For compatibility, a varient of Fletcher16 using modulus 256 is also provided, as fletcher-16-256. Don’t use it for new payloads. none may also be specified as a checksum type if no checksum is used; in this case the message should not include a terminating *.

Classes

ParserModule(parser) Base class for real ParserModules to inherit from.
UKHASParser(parser) The UKHAS Parser Module
class habitat.parser_modules.ukhas_parser.UKHASParser(parser)[source]

The UKHAS Parser Module

pre_parse(string)[source]

Check if string is parsable by this module.

If it is, pre_parse() extracts the payload name and return it. Otherwise, a ValueError is raised.

parse(string, config)[source]

Parse string, extracting processed field data.

config is a dictionary containing the sentence dictionary from the payload’s configuration document.

Returns a dictionary of the parsed data, with field names as keys and the result as the value. Also inserts a payload field containing the payload name, and an _sentence field containing the ASCII sentence that data was parsed from.

ValueError is raised on invalid messages.