- def rectified(self) -> Dict[str, Any]: # JSON-able dict
- if self.gps_valid:
- return {
- "type": "location",
- "devtime": str(self.devtime),
- "battery_percentage": self.battery_percentage,
- "accuracy": self.positioning_accuracy,
- "altitude": self.altitude,
- "speed": self.speed,
- "direction": self.direction,
- "latitude": self.latitude,
- "longitude": self.longitude,
- }
+ def rectified(self) -> Report:
+ # self.gps_valid is supposed to mean it, but it does not. Perfectly
+ # good looking coordinates, with ten satellites, still get 'V'.
+ # I suspect that in reality, 'A' means "hint data is absent".
+ if self.gps_valid or self.num_of_sats > 3:
+ return CoordReport(
+ devtime=str(self.devtime),
+ battery_percentage=self.battery_percentage,
+ accuracy=self.positioning_accuracy,
+ altitude=self.altitude,
+ speed=self.speed,
+ direction=self.direction,
+ latitude=self.latitude,
+ longitude=self.longitude,
+ )