Fatih'sMG4 — ABRP telemetry for an MG4 EH32 on SWI69

A fork of malys/EVABRPUploader (itself a fork of Leon Kernan's ABRP_Uploader)
carrying the changes that make it work on this car. History starts here: the
tree is what matters, and the upstream projects are where the earlier work
belongs.

EVHardware is vendored rather than tracked as a submodule, so one clone
builds.

Telemetry. SOC, battery power and range read as unavailable on SWI69 because
the vendor fallbacks were gated to SWI68 alone, while the property ids they
use are the ones this car publishes — the gates now admit SWI69. Tyre
pressure, the odometer and charge status come from the vendor block too,
since the generic properties for all three are declared here and never
publish. Tyre pressure is confirmed on the vehicle; the other two are not
yet.

Vehicle page. Every signal the car answers, in a table. One that it does not
publish shows a dash: an unimplemented VHAL property returns zero, and
"0 °C" would read as a measurement.

Wi-Fi page. Joins a network the unit already has saved, so a phone hotspot
does not need a trip into Settings on every drive. Tried on the upload tick
and from a button, skipped while already associated. This leans on the unit
being API 28 and the build being platform-signed — getConfiguredNetworks and
enableNetwork are closed to ordinary apps from API 29 — and fails quietly
where that does not hold.

The OTA updater points at this repository. An APK from upstream is signed
with a different key, which Android will not install over a platform-signed
build.

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
TCFDONMEZ
2026-09-22 10:45:00 +03:00
co-authored by Claude
commit 2fd7b2dde1
245 changed files with 35594 additions and 0 deletions
+65
View File
@@ -0,0 +1,65 @@
# AGENTS.md — EVHardware
Shared vehicle-access library for the SAIC MG4 (AAOS 9, MT2712), consumed by EVProfile,
EVTasker, EVABRPUploader and EVChargePilot via git submodule + Gradle subproject.
EVHardware is the shared vehicle layer for **EVSuite**. The workspace `AGENTS.md` and
normative workspace `DESIGN.md` apply; this file defines library-specific invariants.
Commit author: malys.training@gmail.com
License exception: EVHardware's own sources use PolyForm Noncommercial 1.0.0, not the
workspace MIT default.
## Why this exists
One implementation of the reflection hardware layer, the 0 km/h gate, the models, and the
condition/action catalogue — so the apps do not each re-derive vehicle access and drift.
The apps are thin; the vehicle lives here.
## Non-negotiables
- **The 0 km/h gate is here.** `VehicleWriteGate` decides every vehicle-setting write inside
the low-level write primitives. Every setter carries `@RequiresStandstill`; coverage keeps
the set honest. Unknown or negative speed fails closed, and a moving reading is never
rescued by anything.
The threshold is fixed at a *readable* 0 km/h, with no caller override and no park rescue.
- **Per-firmware routing, never universal.** SWI68/69/131/132/133/165 differ; dispatch
through `FirmwareInfo`. Any new vehicle call must branch per generation.
- **Unreadable ≠ a value.** Getters return null / -1 when the layer is not ready or the
property is absent; callers must treat that as "unknown", never as 0/false.
- **Energy semantics are shared.** Property ids, units, sign convention, physical validation,
fallback order, trip integration and charging-session integration belong in `telemetry/`.
Consumers own their UI, sampling cadence and network payload only.
- **`@SupportedOn` is the source of truth** for `docs/firmware-matrix.md` (generated, never
hand-edited) and for consumers' runtime filters. A vehicle catalogue entry without it
fails the tests.
- **Never write an unverified AOSP id.** The climate and window ids currently known are
used for reads only. Writes go through `saic.*`, with every constant documented and
validated per supported firmware generation.
- **English only** — code, comments, commits, docs. User strings in `values/` (English) +
`values-fr/`.
## Consuming it
Submodule at `./EVHardware`; `settings.gradle.kts` includes `EVHardware/lib` as
`:evhardware`; app depends on `project(":evhardware")`. The library declares no
permissions and no `sharedUserId` — vehicle-write capability is the app's platform-signing
decision, not the library's.
**Every consuming app tracks the HEAD of `master`.** Never pin an older commit, and never
commit on a detached submodule HEAD: the catalogue is shared, so an entry removed here must
disappear from every app at once, and two apps on two lines of this library means the same
change written twice and reconciled by hand afterwards. Land library work in the standalone
checkout, push it, then move each app's pointer forward and run that app's tests.
## Reflection + R8
All vehicle access reflects `android.car` (absent from the compile SDK). `consumer-rules.pro`
keeps the reflected names (android.car / SAIC / models / catalogue enums / `@SupportedOn`)
so a consumer's R8 does not strip them. Verify a minified consumer on a vehicle.
## Build
`mise run test | build | check`. JDK 17. Tests are JVM-only (no emulator): gate decision,
firmware annotations, catalogue consistency, matrix generation.