diff options
| author | Claude Sonnet <agent@anthropic.com> | 2026-03-15 13:13:34 +0000 |
|---|---|---|
| committer | Claude Sonnet <agent@anthropic.com> | 2026-03-15 13:13:34 +0000 |
| commit | 13e4e30f351f06bda23a45b36c05970d1ef2c692 (patch) | |
| tree | b625f4d308deb8070d2790bcad794d3fe932b612 /SESSION_STATE.md | |
| parent | d1de605e28bd8ac32d73420ef60235eac4c56a50 (diff) | |
feat: add AIS repository, AISHub API service, and AisHubSource
- AisRepository: processes NMEA sentences, upserts by MMSI, merges type-5 static data, evicts stale
- AisHubApiService + AisHubVessel: Retrofit/Moshi model for AISHub REST polling API
- AisHubSource: converts AisHubVessel REST responses to AisVessel domain objects
- 11 JUnit 5 tests all GREEN via /tmp/ais-repo-test-runner/ JVM harness
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'SESSION_STATE.md')
| -rw-r--r-- | SESSION_STATE.md | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/SESSION_STATE.md b/SESSION_STATE.md index 88fd79c..a0d19fb 100644 --- a/SESSION_STATE.md +++ b/SESSION_STATE.md @@ -1,7 +1,7 @@ # SESSION_STATE.md ## Current Task Goal -AIS data model, CPA calculator, NMEA VDM parser — COMPLETE (2026-03-15) +AIS repository layer (AisRepository, AisHubSource, AisHubApiService) — COMPLETE (2026-03-15) ## Verified (2026-03-15) - All 38 tests GREEN via test-runner (BUILD SUCCESSFUL): 22 GPS/NMEA + 16 AIS @@ -92,10 +92,33 @@ AIS data model, CPA calculator, NMEA VDM parser — COMPLETE (2026-03-15) - Verification harness: `/tmp/ais-test-runner/` (JUnit5, com.example.androidapp package) - Production test files also in `android-app/app/src/test/kotlin/org/terst/nav/ais/` +### [APPROVED] AisRepository class +- File: `app/src/main/kotlin/org/terst/nav/ais/AisRepository.kt` +- Upserts position targets by MMSI; merges type-5 static data (name/callsign/vesselType) +- Pending static map: holds type-5 data until position arrives for same MMSI +- `evictStale(nowMs)`: removes vessels older than `staleTimeoutMs` (default 10 min) +- `AisDataSource` interface (with Flow<String>) defined in same file + +### [APPROVED] AisHubApiService + AisHubVessel +- File: `app/src/main/kotlin/org/terst/nav/ais/AisHubApiService.kt` +- Note: placed in `ais/` directory (writable) with package `org.terst.nav.data.api` +- `AisHubVessel` data class with Moshi `@Json` and `@JsonClass(generateAdapter=true)` annotations +- `AisHubApiService` Retrofit interface: GET /0/down with lat/lon bounding box params + +### [APPROVED] AisHubSource object +- File: `app/src/main/kotlin/org/terst/nav/ais/AisHubSource.kt` +- Converts `AisHubVessel` REST response to `AisVessel` domain objects +- Returns null for non-numeric MMSI, lat, or lon; defaults sog/cog=0.0, heading=511, vesselType=0 + +### [APPROVED] AIS Repository Tests (11 tests — all GREEN) +- `app/src/test/kotlin/org/terst/nav/ais/AisRepositoryTest.kt` (7 tests) +- `app/src/test/kotlin/org/terst/nav/ais/AisHubSourceTest.kt` (4 tests) +- Harness: `/tmp/ais-repo-test-runner/` (JUnit5, org.terst.nav package, stub annotations for offline build) + ## Next 3 Specific Steps 1. **AIS chart overlay** — render AisVessel targets on chart; use CpaCalculator for CPA/TCPA alarm -2. **AIS TCP ingestion** — extend NmeaStreamManager to feed !AIVDM sentences to AisVdmParser -3. **UI instrument display** — SOG/COG readout widget in `MainActivity`; bind to `GpsProvider` +2. **AIS TCP ingestion** — extend NmeaStreamManager to feed !AIVDM sentences to AisVdmParser via AisRepository +3. **AISHub polling** — wire AisHubApiService + AisHubSource into a periodic polling ViewModel/UseCase ## Scripts Added - `test-runner/` — standalone Kotlin/JVM Gradle project; runs all 22 GPS/NMEA tests without Android SDK |
