2020-06-14 00:11:08 -04:00
|
|
|
package com.geeksville.mesh.model
|
|
|
|
|
|
|
|
|
|
import com.geeksville.mesh.MeshProtos
|
|
|
|
|
import com.geeksville.mesh.R
|
|
|
|
|
|
2021-02-12 19:07:14 -08:00
|
|
|
enum class ChannelOption(val modemConfig: MeshProtos.ChannelSettings.ModemConfig, val configRes: Int, val minBroadcastPeriodSecs: Int) {
|
|
|
|
|
SHORT(MeshProtos.ChannelSettings.ModemConfig.Bw500Cr45Sf128, R.string.modem_config_short, 3),
|
|
|
|
|
MEDIUM(MeshProtos.ChannelSettings.ModemConfig.Bw125Cr45Sf128, R.string.modem_config_medium, 12),
|
|
|
|
|
LONG(MeshProtos.ChannelSettings.ModemConfig.Bw31_25Cr48Sf512, R.string.modem_config_long, 240),
|
|
|
|
|
VERY_LONG(MeshProtos.ChannelSettings.ModemConfig.Bw125Cr48Sf4096, R.string.modem_config_very_long, 375);
|
2020-09-04 07:59:07 -04:00
|
|
|
|
|
|
|
|
companion object {
|
|
|
|
|
fun fromConfig(modemConfig: MeshProtos.ChannelSettings.ModemConfig?): ChannelOption? {
|
|
|
|
|
for (option in values()) {
|
|
|
|
|
if (option.modemConfig == modemConfig)
|
|
|
|
|
return option
|
|
|
|
|
}
|
|
|
|
|
return null
|
|
|
|
|
}
|
2021-02-13 22:02:24 -08:00
|
|
|
val defaultMinBroadcastPeriod = VERY_LONG.minBroadcastPeriodSecs
|
2020-09-04 07:59:07 -04:00
|
|
|
}
|
2020-06-14 00:11:08 -04:00
|
|
|
}
|