summaryrefslogtreecommitdiff
path: root/test-runner/src/main/kotlin/org/terst/nav/settings/HardwareSource.kt
blob: b44cb66073d5ff84f2ea7f6de1a4fce480c0348b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
package org.terst.nav.settings

enum class HardwareSource(val prefKey: String, val label: String) {
    AIS_RECEIVER("hw_ais_receiver", "AIS Receiver"),
    NMEA_INSTRUMENTS("hw_nmea_instruments", "NMEA Instruments")
}

/** Minimal in-memory implementation for JVM tests. */
class InMemoryFeatureFlags {
    private val state = mutableMapOf<HardwareSource, Boolean>()

    fun isEnabled(source: HardwareSource): Boolean = state[source] ?: false

    fun setEnabled(source: HardwareSource, enabled: Boolean) {
        state[source] = enabled
    }

    fun toggle(source: HardwareSource): Boolean {
        val next = !isEnabled(source)
        setEnabled(source, next)
        return next
    }
}