# Car telemetry and retention

The Pi samples the MG4 every 10 seconds while ADB is enabled. Gear and steering angle
come from the verified ArcSoft properties. Battery values, range, and speed are read
directly from the factory SAIC vehicle Binder service by a bundled read-only DEX probe:

```bash
adb push server/assets/car-telemetry-probe.dex /data/local/tmp/pi-car-telemetry-probe.dex
adb shell CLASSPATH=/data/local/tmp/pi-car-telemetry-probe.dex \
  app_process /system/bin cloud.molberg.picarprobe.CarTelemetryProbe
```

The helper is not installed and has no dependency on MG Utility. It performs only known
getter transactions. If the factory service is unavailable, battery fields remain
unavailable while the ArcSoft signals and their history continue working.

## Storage limits

- Raw 10-second samples are retained for 90 days and capped at 800,000 rows.
- Hourly rollups are retained for 10 years and capped at 88,000 rows.
- Lifetime counters and observed records survive raw-data pruning.
- Graph endpoints use indexed time buckets and return compact aggregates rather than
  every raw sample.

At the configured interval the raw cap is approximately 90 days. Expected storage is
well below 150 MB, although SQLite page allocation and filesystem details can vary.

## Derived statistics

- Tracked distance integrates consecutive speed samples no more than 60 seconds apart.
- The dashboard's range estimate uses tracked distance per observed SOC consumed. It
  waits for at least 10 km and 5 percentage points of discharge before showing a value.
- Charging power is an estimate based on SOC gain over a 2-10 minute window and the
  MG4 Luxury 2022 usable-capacity assumption of 61.7 kWh. It is deliberately labeled as
  estimated and is capped at 350 kW to reject corrupt samples.
- Peak values mean the highest value observed at a 10-second sampling point. They are
  not guaranteed to capture a shorter event between samples.

The collector sends no vehicle-control calls. Enabling and authorizing ADB remains a
parked-vehicle administration task.
