From 2370e8b596c5f6f0c2d0edc80a57565eb73b190d Mon Sep 17 00:00:00 2001 From: andrekir Date: Sat, 28 Sep 2024 08:54:19 -0300 Subject: [PATCH] feat: add `DeviceConfig` Role descriptions closes #848 --- .../components/config/DeviceConfigItemList.kt | 19 +++++++++++++++++++ app/src/main/res/values/strings.xml | 12 ++++++++++++ 2 files changed, 31 insertions(+) diff --git a/app/src/main/java/com/geeksville/mesh/ui/components/config/DeviceConfigItemList.kt b/app/src/main/java/com/geeksville/mesh/ui/components/config/DeviceConfigItemList.kt index 52b87cde..233766ca 100644 --- a/app/src/main/java/com/geeksville/mesh/ui/components/config/DeviceConfigItemList.kt +++ b/app/src/main/java/com/geeksville/mesh/ui/components/config/DeviceConfigItemList.kt @@ -12,10 +12,12 @@ import androidx.compose.runtime.saveable.rememberSaveable import androidx.compose.runtime.setValue import androidx.compose.ui.Modifier import androidx.compose.ui.platform.LocalFocusManager +import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.input.ImeAction import androidx.compose.ui.text.input.KeyboardType import androidx.compose.ui.tooling.preview.Preview import com.geeksville.mesh.ConfigProtos.Config.DeviceConfig +import com.geeksville.mesh.R import com.geeksville.mesh.copy import com.geeksville.mesh.ui.components.DropDownPreference import com.geeksville.mesh.ui.components.EditTextPreference @@ -23,6 +25,22 @@ import com.geeksville.mesh.ui.components.PreferenceCategory import com.geeksville.mesh.ui.components.PreferenceFooter import com.geeksville.mesh.ui.components.SwitchPreference +private val DeviceConfig.Role.stringRes: Int + get() = when (this) { + DeviceConfig.Role.CLIENT -> R.string.role_client + DeviceConfig.Role.CLIENT_MUTE -> R.string.role_client_mute + DeviceConfig.Role.ROUTER -> R.string.role_router + DeviceConfig.Role.ROUTER_CLIENT -> R.string.role_router_client + DeviceConfig.Role.REPEATER -> R.string.role_repeater + DeviceConfig.Role.TRACKER -> R.string.role_tracker + DeviceConfig.Role.SENSOR -> R.string.role_sensor + DeviceConfig.Role.TAK -> R.string.role_tak + DeviceConfig.Role.CLIENT_HIDDEN -> R.string.role_client_hidden + DeviceConfig.Role.LOST_AND_FOUND -> R.string.role_lost_and_found + DeviceConfig.Role.TAK_TRACKER -> R.string.role_tak_tracker + else -> R.string.unrecognized + } + @Composable fun DeviceConfigItemList( deviceConfig: DeviceConfig, @@ -39,6 +57,7 @@ fun DeviceConfigItemList( item { DropDownPreference(title = "Role", + summary = stringResource(id = deviceInput.role.stringRes), enabled = enabled, items = DeviceConfig.Role.entries .filter { it != DeviceConfig.Role.UNRECOGNIZED } diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 31d4e851..fa2fd477 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -43,6 +43,18 @@ Encrypted Send Failed Unknown Public Key + App connected or standalone messaging device. + Device that does not forward packets from other devices. + Infrastructure node for extending network coverage by relaying messages. Visible in nodes list. + Combination of both ROUTER and CLIENT. Not for mobile devices. + Infrastructure node for extending network coverage by relaying messages with minimal overhead. Not visible in nodes list. + Broadcasts GPS position packets as priority. + Broadcasts telemetry packets as priority. + Optimized for ATAK system communication, reduces routine broadcasts. + Device that only broadcasts as needed for stealth or power savings. + Broadcasts location as message to default channel regularly for to assist with device recovery. + Enables automatic TAK PLI broadcasts and reduces routine broadcasts. + MSL ChUtil %.1f%% AirUtilTX %.1f%%