DynAIkonTrap.ursense.parser#
Classes
|
Parse the textual response from a UrSense board |
- class UrSenseParser(obfuscation_distance_km: float = 2)#
Parse the textual response from a UrSense board
Some of the returned results may be sensitive information, such as the GPS location. Functionality is provided to provide a quantised version of the GPS position so exact position cannot be determined. It is the user’s responsibility not to publish raw sensor data that may lead to leakage of sensitive information.
- Parameters:
obfuscation_distance_km (float) – Dimension of squares for quantising GPS location
- parse(data: str) Union[Dict[str, Reading], Type[None]] #
Parse the serial results output by a urSense 1.28 board as specified in the user documentation v1.21.
The methodology is to start with a list of fields. Then process the first element of the list to figure out what type of reading it is and how many fields to consume. Format this appropriately and return it as a
Reading
. Repeat the process with the processed fields removed from the front of the list. Once the list reaches a length of zero, precessing the line is complete. For eachReading
an attribute – specified by theursense_map
– of the finalSensorLog
is set.