summaryrefslogtreecommitdiff
path: root/SESSION_STATE.md
blob: fd7f0e1f6bc8057b3ed30fdfe312fe73a05d21ca (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# SESSION_STATE.md

## Current Task Goal
GPS provider abstraction layer — COMPLETE

## Completed Items

### [APPROVED] GpsPosition data class
- File: `app/src/main/kotlin/org/terst/nav/gps/GpsPosition.kt`
- Package: `org.terst.nav.gps`
- Fields: latitude, longitude, sog (knots), cog (degrees true), timestampMs

### [APPROVED] GpsProvider / GpsListener interfaces
- File: `app/src/main/kotlin/org/terst/nav/gps/GpsProvider.kt`
- `GpsProvider`: start/stop, position property, addListener/removeListener
- `GpsListener`: onPositionUpdate(GpsPosition), onFixLost()

### [APPROVED] DeviceGpsProvider
- File: `app/src/main/kotlin/org/terst/nav/gps/DeviceGpsProvider.kt`
- Wraps `LocationManager` with `GPS_PROVIDER`
- Default interval: 1000ms (1 Hz); configurable via constructor
- SOG: Location.speed (m/s) × 1.94384 → knots
- COG: Location.bearing (degrees true, no conversion)
- Fix-lost timer: fires `onFixLost()` after 10s with no update
- Thread-safe listener list (synchronized)
- Android dependency: Context, LocationManager, Handler — device only

### [APPROVED] FakeGpsProvider + GpsProviderTest (9 tests — all GREEN)
- File: `app/src/test/kotlin/org/terst/nav/gps/GpsProviderTest.kt`
- No Android dependencies — pure JVM
- Tests:
  - `start sets started to true`
  - `stop sets started to false`
  - `listener receives position update`
  - `listener notified of fix lost`
  - `multiple listeners all receive position update`
  - `multiple listeners all notified of fix lost`
  - `removing listener stops notifications`
  - `position property reflects last simulated position`
  - `SOG conversion sanity check - 1 mps is approximately 1_94384 knots`

## Build Notes
- `app/build` and `app/.kotlin/sessions` are root-owned from a prior run.
  Tests were verified via direct `kotlinc` + `JUnitCore` invocation (all 9 pass).
  Full Gradle build requires fixing directory permissions: `chown -R www-data:www-data app/build app/.kotlin`
- Pre-existing XML layout error in `activity_main.xml:300` (unrelated to GPS work)

## Next 3 Specific Steps
1. **UI instrument display** — `MainActivity.kt`: subscribe to `DeviceGpsProvider`, display SOG/COG in instrument panel
2. **NmeaGpsProvider** — `app/src/main/kotlin/org/terst/nav/gps/NmeaGpsProvider.kt`: implement `GpsProvider` parsing NMEA RMC sentences over TCP/UDP
3. **Fix build permissions** — `chown -R www-data:www-data /workspace/nav/android-app/app/build /workspace/nav/android-app/app/.kotlin` to enable full Gradle unit test runs

## Scripts Added
- None (tests run via direct JVM invocation)

## Process Improvements
- Gradle builds blocked by root-owned `app/build` and `app/.kotlin` from prior session; use direct Kotlin compiler invocation as fallback for pure-JVM test verification