+ def rectified(self) -> SimpleNamespace: # JSON-able dict
+ if self.gps_valid:
+ return SimpleNamespace(
+ 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,
+ )
+ else:
+ return SimpleNamespace(
+ type="approximate_location",
+ devtime=str(self.devtime),
+ battery_percentage=self.battery_percentage,
+ mcc=self.mcc,
+ mnc=self.mnc,
+ base_stations=self.base_stations,
+ wifi_aps=self.wifi_aps,
+ )