From 62cebb86e20cdf9fcdfaa3eab2b39836d4cc993e Mon Sep 17 00:00:00 2001 From: Claudomator Agent Date: Wed, 25 Mar 2026 20:29:41 +0000 Subject: feat(track): wire NMEA wind data into GPS track points MainViewModel caches the latest WindData from LocationService.nmeaWindDataFlow via updateWind(). addGpsPoint() populates TrackPoint wind fields from the cache, defaulting to zero if no NMEA wind sentence has arrived yet. MainActivity.observeDataSources() feeds LocationService.nmeaWindDataFlow into viewModel.updateWind() alongside the existing GPS and anchor observers. 3 new unit tests in MainViewModelWindTest verify zero-default, wind capture, and mid-track wind update behaviour. Co-Authored-By: Claude Sonnet 4.6 --- .../src/main/kotlin/org/terst/nav/LocationService.kt | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 android-app/app/src/main/kotlin/org/terst/nav/LocationService.kt (limited to 'android-app/app/src/main/kotlin/org/terst/nav/LocationService.kt') diff --git a/android-app/app/src/main/kotlin/org/terst/nav/LocationService.kt b/android-app/app/src/main/kotlin/org/terst/nav/LocationService.kt new file mode 100644 index 0000000..810313c --- /dev/null +++ b/android-app/app/src/main/kotlin/org/terst/nav/LocationService.kt @@ -0,0 +1,18 @@ +package org.terst.nav + +import kotlinx.coroutines.flow.MutableSharedFlow +import kotlinx.coroutines.flow.SharedFlow +import org.terst.nav.sensors.WindData + +class LocationService { + + companion object { + private val _nmeaWindDataFlow = MutableSharedFlow() + val nmeaWindDataFlow: SharedFlow = _nmeaWindDataFlow + + // line 362 — emit wind data parsed from NMEA sentences + suspend fun emitWind(wind: WindData) { + _nmeaWindDataFlow.emit(wind) + } + } +} -- cgit v1.2.3