App 2.3.0: Server tab, live telemetry to the car server
- New Server tab: server URL, ingest token and installation id, with
Save, Test connection (health, then a read-only token check) and the
config-file import that upstream removed (app folder / USB stick first,
document picker as fallback). Settings are kept encrypted and read on
every use, so the service picks up a change without a restart. Each
installation generates its own id; the inherited upstream UUID and
the baked-in CONSUMPTION_API_* build fields are gone.
- Live telemetry restored from before ea8032a (TelemetryPayload,
UploadCadence, UploadSettings, GPS) and sent in batches to
POST /v1/telemetry instead of ABRP; the server forwards to ABRP. Adds
ext_temp, voltage and current. Unsent samples queue in memory (about
8 h) while offline.
- Upload tab: the live-telemetry switch and cadence controls work again;
the dead service and autostart switches are removed.
- Manifest: location permissions and foreground service types.
- Unit tests compile again: 114 (stable) / 136 (unstable) pass. Tests
for the deleted AbrpApi and HeadUnitWeather removed; new tests for
ServerConfig and TelemetryQueue. Lint passes.
Not yet tried on the car.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
package com.evsuite.abrp;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
/** The offline buffer for live samples — pure JVM. */
|
||||
public class TelemetryQueueTest {
|
||||
|
||||
@Test
|
||||
public void batchesOldestFirstAndKeepsThemUntilConfirmed() {
|
||||
TelemetryQueue queue = new TelemetryQueue();
|
||||
queue.add("a");
|
||||
queue.add("b");
|
||||
assertEquals(List.of("a", "b"), queue.peekBatch());
|
||||
// Not confirmed yet: a failed request must not lose them.
|
||||
assertEquals(2, queue.size());
|
||||
queue.remove(2);
|
||||
assertEquals(0, queue.size());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void aBatchNeverExceedsWhatTheServerAccepts() {
|
||||
TelemetryQueue queue = new TelemetryQueue();
|
||||
for (int i = 0; i < 1200; i++) queue.add(String.valueOf(i));
|
||||
List<String> batch = queue.peekBatch();
|
||||
assertEquals(TelemetryQueue.MAX_BATCH, batch.size());
|
||||
assertEquals("0", batch.get(0));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenFullTheOldestSamplesAreDropped() {
|
||||
TelemetryQueue queue = new TelemetryQueue(3);
|
||||
for (String s : new String[]{"a", "b", "c", "d", "e"}) queue.add(s);
|
||||
assertEquals(List.of("c", "d", "e"), queue.peekBatch());
|
||||
assertEquals(2, queue.dropped());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user