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
@@ -0,0 +1,94 @@
package com.evsuite.hardware.probe
import org.junit.Assert.assertEquals
import org.junit.Test
/**
* What the survey has to get right off the car: the three verdicts stay distinct, and the
* harvested transaction table has no collisions.
*
* And the one thing that must never be true: no transaction the survey calls may be one that
* changes something. The power interface carries a shutdown request two codes away from a
* getter, and a survey is run on a car with a driver in it.
*
* None of this can be checked on the vehicle, because on the vehicle a wrong answer looks like a
* finding. A silent binder reported as ANSWERED would put an empty row in the survey that reads
* like "this interface has nothing to say", and two option getters sharing a code would put a
* value under the wrong name — both would survive the drive and mislead whoever reads the
* capture afterwards.
*/
class RuntimeInterfaceProbeTest {
@Test
fun `no binder is absent, not denied`() {
assertEquals(
BindVerdict.ABSENT,
RuntimeInterfaceProbe.verdictFor(reached = false, answers = listOf(null)),
)
}
@Test
fun `a binder that answers nothing is denied, not answered empty`() {
assertEquals(
BindVerdict.DENIED,
RuntimeInterfaceProbe.verdictFor(reached = true, answers = listOf(null, null, null)),
)
}
@Test
fun `one answer among many is enough to call it alive`() {
assertEquals(
BindVerdict.ANSWERED,
RuntimeInterfaceProbe.verdictFor(reached = true, answers = listOf(null, "0", null)),
)
}
@Test
fun `a reached binder with nothing asked of it is denied`() {
assertEquals(
BindVerdict.DENIED,
RuntimeInterfaceProbe.verdictFor(reached = true, answers = emptyList()),
)
}
@Test
fun `the survey never names a transaction that changes something`() {
val calls = RuntimeInterfaceProbe.POWER_CALLS
val writes = calls.filterValues { it.code in RuntimeInterfaceProbe.POWER_WRITES }
assertEquals(emptyMap<String, RuntimeInterfaceProbe.Call>(), writes)
}
@Test
fun `the property survey names no setter`() {
val writes = RuntimeInterfaceProbe.VEHICLE_PROPERTY_CALLS
.filterValues { it.code in RuntimeInterfaceProbe.PROPERTY_WRITES }
assertEquals(emptyMap<String, RuntimeInterfaceProbe.Call>(), writes)
}
@Test
fun `the charging survey never starts, stops or limits a charge`() {
val writes = RuntimeInterfaceProbe.CHARGING_CALLS
.filterValues { it.code in RuntimeInterfaceProbe.CHARGING_WRITES }
assertEquals(emptyMap<String, RuntimeInterfaceProbe.Call>(), writes)
}
@Test
fun `every property read carries the id it is asking for`() {
val idless = RuntimeInterfaceProbe.VEHICLE_PROPERTY_CALLS.filterValues { it.args.size != 1 }
assertEquals(emptyMap<String, RuntimeInterfaceProbe.Call>(), idless)
}
@Test
fun `vehicle speed is read as a float`() {
assertEquals(
RuntimeInterfaceProbe.ReadAs.FLOAT,
RuntimeInterfaceProbe.EVS_CALLS.getValue("getVehicleSpeed").readAs,
)
}
@Test
fun `each config getter has its own transaction code`() {
val calls = RuntimeInterfaceProbe.CONFIG_CALLS
assertEquals(calls.size, calls.values.map { it.code }.toSet().size)
}
}