diff options
| author | Claudomator Agent <agent@claudomator> | 2026-03-25 20:29:41 +0000 |
|---|---|---|
| committer | Claudomator Agent <agent@claudomator> | 2026-03-25 20:29:41 +0000 |
| commit | 62cebb86e20cdf9fcdfaa3eab2b39836d4cc993e (patch) | |
| tree | d359d9fe84b37fb72a5673bf72b29b9eedf95409 /android-app/app/src/main/kotlin/org/terst/nav/LocationService.kt | |
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 <noreply@anthropic.com>
Diffstat (limited to 'android-app/app/src/main/kotlin/org/terst/nav/LocationService.kt')
| -rw-r--r-- | android-app/app/src/main/kotlin/org/terst/nav/LocationService.kt | 18 |
1 files changed, 18 insertions, 0 deletions
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<WindData>() + val nmeaWindDataFlow: SharedFlow<WindData> = _nmeaWindDataFlow + + // line 362 — emit wind data parsed from NMEA sentences + suspend fun emitWind(wind: WindData) { + _nmeaWindDataFlow.emit(wind) + } + } +} |
