habitat.sensors.stdtelem

Sensor functions for dealing with telemetry.

Functions

coordinate(config, data) Parses ASCII latitude or longitude into a decimal-degrees float.
strptime((string, format) -> struct_time) Parse a string to a time tuple according to a format specification.
time(data) Parse the time, validating it and returning the standard HH:MM:SS.
habitat.sensors.stdtelem.time(data)[source]

Parse the time, validating it and returning the standard HH:MM:SS.

Accepted formats include HH:MM:SS, HHMMSS, HH:MM and HHMM. It uses strptime to ensure the values are sane.

habitat.sensors.stdtelem.coordinate(config, data)[source]

Parses ASCII latitude or longitude into a decimal-degrees float.

Either decimal degrees or degrees with decimal minutes are accepted (degrees, minutes and seconds are not currently supported).

The format is specified in config["format"] and can look like either dd.dddd or ddmm.mmmm, with one to three leading d characters and one to six trailing d or m characters.

habitat.sensors.stdtelem.binary_timestamp(data)[source]

Parse a four byte unsigned integer into a time string in the format “HH:MM:SS”. Date information is thus discarded.

habitat.sensors.stdtelem.binary_bcd_time(data)[source]

Parse two or three bytes (given as a string, format 2s or 3s) into hours, minutes and optionally seconds in the format “HH:MM:SS”.