Skip to content

Satellite tracker and pass predictor for Android, inspired by Gpredict

Added remote data output sections to SettingsScreen.kt

Arty Bishopa835ac4e0752
diff --git a/app/src/main/java/com/rtbishop/look4sat/presentation/radar/RadarViewModel.kt b/app/src/main/java/com/rtbishop/look4sat/presentation/radar/RadarViewModel.kt
index 27cd7780..54dfe616 100644
--- a/app/src/main/java/com/rtbishop/look4sat/presentation/radar/RadarViewModel.kt
+++ b/app/src/main/java/com/rtbishop/look4sat/presentation/radar/RadarViewModel.kt
@@ -150,10 +150,10 @@ class RadarViewModel(
private fun sendPassDataBT(orbitalPos: OrbitalPos) {
viewModelScope.launch {
- if (settingsRepo.getBluetoothState()) {
- val btDevice = settingsRepo.getBluetoothAddress()
+ if (settingsRepo.rcSettings.value.bluetoothState) {
+ val btDevice = settingsRepo.rcSettings.value.bluetoothAddress
if (bluetoothReporter.isConnected()) {
- val format = settingsRepo.getBluetoothFormat()
+ val format = settingsRepo.rcSettings.value.bluetoothFormat
val azimuth = orbitalPos.azimuth.toDegrees().round(0).toInt()
val elevation = orbitalPos.elevation.toDegrees().round(0).toInt()
bluetoothReporter.reportRotation(format, azimuth, elevation)
diff --git a/app/src/main/java/com/rtbishop/look4sat/presentation/settings/SettingsScreen.kt b/app/src/main/java/com/rtbishop/look4sat/presentation/settings/SettingsScreen.kt
index 2b49fe9a..b81d63b0 100644
--- a/app/src/main/java/com/rtbishop/look4sat/presentation/settings/SettingsScreen.kt
+++ b/app/src/main/java/com/rtbishop/look4sat/presentation/settings/SettingsScreen.kt
@@ -19,6 +19,7 @@ import androidx.compose.material3.ElevatedCard
import androidx.compose.material3.Icon
import androidx.compose.material3.LinearProgressIndicator
import androidx.compose.material3.MaterialTheme
+import androidx.compose.material3.OutlinedTextField
import androidx.compose.material3.Switch
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
@@ -42,6 +43,7 @@ import androidx.navigation.NavGraphBuilder
import androidx.navigation.compose.composable
import com.rtbishop.look4sat.R
import com.rtbishop.look4sat.domain.model.OtherSettings
+import com.rtbishop.look4sat.domain.model.RCSettings
import com.rtbishop.look4sat.domain.predict.GeoPos
import com.rtbishop.look4sat.presentation.MainTheme
import com.rtbishop.look4sat.presentation.Screen
@@ -76,8 +78,10 @@ private fun SettingsScreen(uiState: SettingsState) {
else -> Manifest.permission.BLUETOOTH_CONNECT
}
val bluetoothRequest = rememberLauncherForActivityResult(bluetoothContract) { isGranted ->
- uiState.sendRCAction(RCAction.SetBluetoothState(isGranted))
- if (!isGranted) uiState.sendSystemAction(SystemAction.ShowToast(bluetoothError))
+ if (!isGranted) {
+ uiState.sendRCAction(RCAction.SetBluetoothState(false))
+ uiState.sendSystemAction(SystemAction.ShowToast(bluetoothError))
+ }
}
val locationContract = ActivityResultContracts.RequestMultiplePermissions()
val locationError = stringResource(R.string.location_gps_error)
@@ -123,6 +127,18 @@ private fun SettingsScreen(uiState: SettingsState) {
val updateFromFile = { contentRequest.launch("*/*") }
val clearAllData: () -> Unit = { uiState.sendAction(SettingsAction.ClearAllData) }
+ // RC settings
+ val rcSettings = uiState.rcSettings
+ val setRotatorState = { value: Boolean -> uiState.sendRCAction(RCAction.SetRotatorState(value)) }
+ val setRotatorAddress = { value: String -> uiState.sendRCAction(RCAction.SetRotatorAddress(value)) }
+ val setRotatorPort = { value: String -> uiState.sendRCAction(RCAction.SetRotatorPort(value)) }
+ val setBluetoothState = { value: Boolean ->
+ bluetoothRequest.launch(bluetoothPerm)
+ uiState.sendRCAction(RCAction.SetBluetoothState(value))
+ }
+ val setBluetoothAddress = { value: String -> uiState.sendRCAction(RCAction.SetBluetoothAddress(value)) }
+ val setBluetoothFormat = { value: String -> uiState.sendRCAction(RCAction.SetBluetoothFormat(value)) }
+
// Other settings
val otherSettings = uiState.otherSettings
val toggleUtc = { value: Boolean -> uiState.sendAction(SettingsAction.ToggleUtc(value)) }
@@ -177,6 +193,8 @@ private fun SettingsScreen(uiState: SettingsState) {
)
}
item { DataCard(dataSettings, updateFromWeb, updateFromFile, clearAllData) }
+ item { NetworkOutputCard(rcSettings, setRotatorState, setRotatorAddress, setRotatorPort) }
+ item { BluetoothOutputCard(rcSettings, setBluetoothState, setBluetoothAddress, setBluetoothFormat) }
item {
OtherCard(
otherSettings,
@@ -329,51 +347,132 @@ private fun DataCard(
}
}
-//private fun setupRemoteCard() {
-// binding.run {
-// settingsRemote.remoteSwitch.apply {
-// isChecked = viewModel.getRotatorEnabled()
-// settingsRemote.remoteIp.isEnabled = isChecked
-// settingsRemote.remoteIpEdit.setText(viewModel.getRotatorServer())
-// settingsRemote.remotePort.isEnabled = isChecked
-// settingsRemote.remotePortEdit.setText(viewModel.getRotatorPort())
-// setOnCheckedChangeListener { _, isChecked ->
-// viewModel.setRotatorEnabled(isChecked)
-// settingsRemote.remoteIp.isEnabled = isChecked
-// settingsRemote.remotePort.isEnabled = isChecked
-// }
-// }
-// settingsRemote.remoteIpEdit.doOnTextChanged { text, _, _, _ ->
-// if (text.toString().isValidIPv4()) viewModel.setRotatorServer(text.toString())
-// }
-// settingsRemote.remotePortEdit.doOnTextChanged { text, _, _, _ ->
-// if (text.toString().isValidPort()) viewModel.setRotatorPort(text.toString())
-// }
-// }
-//}
-//
-//private fun setupBTCard() {
-// binding.run {
-// settingsBtremote.BTremoteSwitch.apply {
-// isChecked = viewModel.getBTEnabled()
-// settingsBtremote.BTremoteAddress.isEnabled = isChecked
-// settingsBtremote.BTAddressEdit.setText(viewModel.getBTDeviceAddr())
-// settingsBtremote.BTremoteFormat.isEnabled = isChecked
-// settingsBtremote.BTFormatEdit.setText(viewModel.getBTFormat())
-// setOnCheckedChangeListener { _, isChecked ->
-// toggleBTstate(isChecked)
-// bluetoothRequest.launch(bluetooth)
-// }
-// }
-// settingsBtremote.BTAddressEdit.doOnTextChanged { text, _, _, _ ->
-// viewModel.setBTDeviceAddr(text.toString())
-// }
-// settingsBtremote.BTFormatEdit.doOnTextChanged { text, _, _, _ ->
-// viewModel.setBTFormat(text.toString())
-// }
-// }
-//}
-//
+@Preview(showBackground = true)
+@Composable
+private fun NetworkOutputCardPreview() = MainTheme {
+ val settings = RCSettings(
+ rotatorState = false,
+ rotatorAddress = "127.0.0.1",
+ rotatorPort = "4533",
+ bluetoothState = false,
+ bluetoothFormat = $$"W$AZ $EL",
+ bluetoothName = "Name",
+ bluetoothAddress = "00:0C:BF:13:80:5D"
+ )
+ NetworkOutputCard(settings)
+}
+
+@Composable
+private fun NetworkOutputCard(
+ settings: RCSettings,
+ setRotatorState: (Boolean) -> Unit = {},
+ setRotatorAddress: (String) -> Unit = {},
+ setRotatorPort: (String) -> Unit = {}
+) {
+ ElevatedCard(modifier = Modifier.fillMaxWidth()) {
+ Column(modifier = Modifier.padding(horizontal = 8.dp, vertical = 4.dp)) {
+ Text(
+ text = stringResource(id = R.string.remote_title),
+ color = MaterialTheme.colorScheme.primary
+ )
+ Row(
+ horizontalArrangement = Arrangement.SpaceBetween,
+ verticalAlignment = Alignment.CenterVertically,
+ modifier = Modifier.fillMaxWidth()
+ ) {
+ Text(text = stringResource(R.string.remote_switch))
+ Switch(checked = settings.rotatorState, onCheckedChange = { setRotatorState(it) })
+ }
+ Row(
+ horizontalArrangement = Arrangement.spacedBy(8.dp),
+ verticalAlignment = Alignment.CenterVertically,
+ modifier = Modifier.fillMaxWidth()
+ ) {
+ OutlinedTextField(
+ value = settings.rotatorAddress,
+ singleLine = true,
+ label = { Text(text = stringResource(R.string.remote_ip_hint)) },
+ onValueChange = { setRotatorAddress(it) },
+ modifier = Modifier.weight(1.5f),
+ enabled = settings.rotatorState
+ )
+ OutlinedTextField(
+ value = settings.rotatorPort,
+ onValueChange = { setRotatorPort(it) },
+ label = { Text(text = stringResource(R.string.remote_port_hint)) },
+ singleLine = true,
+ modifier = Modifier.weight(1f),
+ enabled = settings.rotatorState
+ )
+ }
+ Spacer(modifier = Modifier.height(4.dp))
+ }
+ }
+}
+
+@Preview(showBackground = true)
+@Composable
+private fun BluetoothOutputCardPreview() = MainTheme {
+ val settings = RCSettings(
+ rotatorState = false,
+ rotatorAddress = "127.0.0.1",
+ rotatorPort = "4533",
+ bluetoothState = false,
+ bluetoothFormat = $$"W$AZ $EL",
+ bluetoothName = "Name",
+ bluetoothAddress = "00:0C:BF:13:80:5D"
+ )
+ BluetoothOutputCard(settings)
+}
+
+@Composable
+private fun BluetoothOutputCard(
+ settings: RCSettings,
+ setBluetoothState: (Boolean) -> Unit = {},
+ setBluetoothAddress: (String) -> Unit = {},
+ setBluetoothFormat: (String) -> Unit = {}
+) {
+ ElevatedCard(modifier = Modifier.fillMaxWidth()) {
+ Column(modifier = Modifier.padding(horizontal = 8.dp, vertical = 4.dp)) {
+ Text(
+ text = stringResource(id = R.string.BTremote_title),
+ color = MaterialTheme.colorScheme.primary
+ )
+ Row(
+ horizontalArrangement = Arrangement.SpaceBetween,
+ verticalAlignment = Alignment.CenterVertically,
+ modifier = Modifier.fillMaxWidth()
+ ) {
+ Text(text = stringResource(R.string.BTremote_switch))
+ Switch(checked = settings.bluetoothState, onCheckedChange = { setBluetoothState(it) })
+ }
+ Row(
+ horizontalArrangement = Arrangement.spacedBy(8.dp),
+ verticalAlignment = Alignment.CenterVertically,
+ modifier = Modifier.fillMaxWidth()
+ ) {
+ OutlinedTextField(
+ value = settings.bluetoothAddress,
+ singleLine = true,
+ label = { Text(text = stringResource(R.string.BTremote_device_hint)) },
+ onValueChange = { setBluetoothAddress(it) },
+ modifier = Modifier.weight(1.5f),
+ enabled = settings.bluetoothState
+ )
+ OutlinedTextField(
+ value = settings.bluetoothFormat,
+ onValueChange = { setBluetoothFormat(it) },
+ label = { Text(text = stringResource(R.string.BTremote_output_hint)) },
+ singleLine = true,
+ modifier = Modifier.weight(1f),
+ enabled = settings.bluetoothState
+ )
+ }
+ Spacer(modifier = Modifier.height(4.dp))
+ }
+ }
+}
+
@Preview(showBackground = true)
@Composable
private fun OtherCardPreview() = MainTheme {
diff --git a/app/src/main/java/com/rtbishop/look4sat/presentation/settings/SettingsState.kt b/app/src/main/java/com/rtbishop/look4sat/presentation/settings/SettingsState.kt
index 4c730bcc..9ef9b4a3 100644
--- a/app/src/main/java/com/rtbishop/look4sat/presentation/settings/SettingsState.kt
+++ b/app/src/main/java/com/rtbishop/look4sat/presentation/settings/SettingsState.kt
@@ -1,6 +1,7 @@
package com.rtbishop.look4sat.presentation.settings
import com.rtbishop.look4sat.domain.model.OtherSettings
+import com.rtbishop.look4sat.domain.model.RCSettings
import com.rtbishop.look4sat.domain.predict.GeoPos
import com.rtbishop.look4sat.domain.predict.OrbitalPass
@@ -12,16 +13,6 @@ data class DataSettings(
val isUpdating: Boolean, val entriesTotal: Int, val radiosTotal: Int, val timestamp: Long
)
-data class RCSettings(
- val rotatorState: Boolean,
- val rotatorAddress: String,
- val rotatorPort: String,
- val bluetoothState: Boolean,
- val bluetoothFormat: String,
- val bluetoothName: String,
- val bluetoothAddress: String,
-)
-
data class SettingsState(
val nextPass: OrbitalPass,
val nextTime: String,
@@ -52,9 +43,6 @@ sealed class SettingsAction {
}
sealed class SystemAction {
- data object OpenGitHub : SystemAction()
- data object OpenDonate : SystemAction()
- data object OpenFDroid : SystemAction()
data class ShowToast(val message: String) : SystemAction()
}
diff --git a/app/src/main/java/com/rtbishop/look4sat/presentation/settings/SettingsViewModel.kt b/app/src/main/java/com/rtbishop/look4sat/presentation/settings/SettingsViewModel.kt
index 8c43a3e7..fcaf7b9a 100644
--- a/app/src/main/java/com/rtbishop/look4sat/presentation/settings/SettingsViewModel.kt
+++ b/app/src/main/java/com/rtbishop/look4sat/presentation/settings/SettingsViewModel.kt
@@ -51,15 +51,6 @@ class SettingsViewModel(
private val defaultPosSettings = PositionSettings(false, settingsRepo.stationPosition.value, 0)
private val defaultDataSettings = DataSettings(false, 0, 0, 0L)
- private val defaultRCSettings = RCSettings(
- rotatorState = settingsRepo.getRotatorState(),
- rotatorAddress = settingsRepo.getRotatorAddress(),
- rotatorPort = settingsRepo.getRotatorPort(),
- bluetoothState = settingsRepo.getBluetoothState(),
- bluetoothFormat = settingsRepo.getBluetoothFormat(),
- bluetoothName = settingsRepo.getBluetoothName(),
- bluetoothAddress = settingsRepo.getBluetoothAddress()
- )
private val _uiState = MutableStateFlow(
SettingsState(
nextTime = "00:00:00",
@@ -69,7 +60,7 @@ class SettingsViewModel(
positionSettings = defaultPosSettings,
dataSettings = defaultDataSettings,
otherSettings = settingsRepo.otherSettings.value,
- rcSettings = defaultRCSettings,
+ rcSettings = settingsRepo.rcSettings.value,
sendAction = ::handleAction,
sendRCAction = ::handleAction,
sendSystemAction = ::handleAction
@@ -112,6 +103,11 @@ class SettingsViewModel(
_uiState.update { it.copy(dataSettings = newDataSettings) }
}
}
+ viewModelScope.launch {
+ settingsRepo.rcSettings.collect { settings ->
+ _uiState.update { it.copy(rcSettings = settings) }
+ }
+ }
viewModelScope.launch {
settingsRepo.otherSettings.collect { settings ->
_uiState.update { it.copy(otherSettings = settings) }
@@ -151,7 +147,6 @@ class SettingsViewModel(
private fun handleAction(action: SystemAction) {
when (action) {
is SystemAction.ShowToast -> showToast(action.message)
- else -> {}
}
}
diff --git a/data/src/main/java/com/rtbishop/look4sat/data/repository/SettingsRepo.kt b/data/src/main/java/com/rtbishop/look4sat/data/repository/SettingsRepo.kt
index b41f43d2..bea94357 100644
--- a/data/src/main/java/com/rtbishop/look4sat/data/repository/SettingsRepo.kt
+++ b/data/src/main/java/com/rtbishop/look4sat/data/repository/SettingsRepo.kt
@@ -26,6 +26,7 @@ import androidx.core.location.LocationManagerCompat
import com.rtbishop.look4sat.domain.model.DatabaseState
import com.rtbishop.look4sat.domain.model.OtherSettings
import com.rtbishop.look4sat.domain.model.PassesSettings
+import com.rtbishop.look4sat.domain.model.RCSettings
import com.rtbishop.look4sat.domain.predict.GeoPos
import com.rtbishop.look4sat.domain.repository.ISettingsRepo
import com.rtbishop.look4sat.domain.utility.positionToQth
@@ -33,6 +34,7 @@ import com.rtbishop.look4sat.domain.utility.qthToPosition
import com.rtbishop.look4sat.domain.utility.round
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.StateFlow
+import kotlinx.coroutines.flow.update
class SettingsRepo(
private val locationManager: LocationManager,
@@ -126,6 +128,10 @@ class SettingsRepo(
private val providerNet = LocationManager.NETWORK_PROVIDER
override val stationPosition: StateFlow<GeoPos> = _stationPosition
+ override fun onLocationChanged(location: Location) {
+ setStationPosition(location.latitude, location.longitude, location.altitude)
+ }
+
override fun setStationPosition(latitude: Double, longitude: Double, altitude: Double): Boolean {
val newLongitude = if (longitude > 180.0) longitude - 180 else longitude
val locator = positionToQth(latitude, newLongitude) ?: return false
@@ -225,43 +231,93 @@ class SettingsRepo(
}
//endregion
+ //region # RC settings
+ private val _rcSettings = MutableStateFlow(getRCSettings())
+ override val rcSettings: StateFlow<RCSettings> = _rcSettings
+
+ override fun setBluetoothAddress(value: String) {
+ preferences.edit { putString(keyBluetoothAddress, value) }
+ _rcSettings.update { it.copy(bluetoothAddress = value) }
+ }
+
+ override fun setBluetoothFormat(value: String) {
+ preferences.edit { putString(keyBluetoothFormat, value) }
+ _rcSettings.update { it.copy(bluetoothFormat = value) }
+ }
+
+ override fun setBluetoothName(value: String) {
+ preferences.edit { putString(keyBluetoothName, value) }
+ _rcSettings.update { it.copy(bluetoothName = value) }
+ }
+
+ override fun setBluetoothState(value: Boolean) {
+ preferences.edit { putBoolean(keyBluetoothState, value) }
+ _rcSettings.update { it.copy(bluetoothState = value) }
+ }
+
+ override fun setRotatorAddress(value: String) {
+ preferences.edit { putString(keyRotatorAddress, value) }
+ _rcSettings.update { it.copy(rotatorAddress = value) }
+ }
+
+ override fun setRotatorPort(value: String) {
+ preferences.edit { putString(keyRotatorPort, value) }
+ _rcSettings.update { it.copy(rotatorPort = value) }
+ }
+
+ override fun setRotatorState(value: Boolean) {
+ preferences.edit { putBoolean(keyRotatorState, value) }
+ _rcSettings.update { it.copy(rotatorState = value) }
+ }
+
+ private fun getRCSettings(): RCSettings = RCSettings(
+ rotatorState = preferences.getBoolean(keyRotatorState, false),
+ rotatorAddress = preferences.getString(keyRotatorAddress, null) ?: "127.0.0.1",
+ rotatorPort = preferences.getString(keyRotatorPort, null) ?: "4533",
+ bluetoothState = preferences.getBoolean(keyBluetoothState, false),
+ bluetoothFormat = preferences.getString(keyBluetoothFormat, null) ?: $$"W$AZ $EL",
+ bluetoothName = preferences.getString(keyBluetoothName, null) ?: "Default",
+ bluetoothAddress = preferences.getString(keyBluetoothAddress, null) ?: "00:0C:BF:13:80:5D"
+ )
+ //endregion
+
//region # Other settings
private val _otherSettings = MutableStateFlow(getOtherSettings())
override val otherSettings: StateFlow<OtherSettings> = _otherSettings
override fun setStateOfAutoUpdate(value: Boolean) {
preferences.edit { putBoolean(keyStateOfAutoUpdate, value) }
- _otherSettings.value = otherSettings.value.copy(stateOfAutoUpdate = value)
+ _otherSettings.update { it.copy(stateOfAutoUpdate = value) }
}
override fun setStateOfSensors(value: Boolean) {
preferences.edit { putBoolean(keyStateOfSensors, value) }
- _otherSettings.value = otherSettings.value.copy(stateOfSensors = value)
+ _otherSettings.update { it.copy(stateOfSensors = value) }
}
override fun setStateOfSweep(value: Boolean) {
preferences.edit { putBoolean(keyStateOfSweep, value) }
- _otherSettings.value = otherSettings.value.copy(stateOfSweep = value)
+ _otherSettings.update { it.copy(stateOfSweep = value) }
}
override fun setStateOfUtc(value: Boolean) {
preferences.edit { putBoolean(keyStateOfUtc, value) }
- _otherSettings.value = otherSettings.value.copy(stateOfUtc = value)
+ _otherSettings.update { it.copy(stateOfUtc = value) }
}
override fun setStateOfLightTheme(value: Boolean){
preferences.edit { putBoolean(keyStateOfLightTheme, value) }
- _otherSettings.value = otherSettings.value.copy(stateOfLightTheme = value)
+ _otherSettings.update { it.copy(stateOfLightTheme = value) }
}
override fun setWarningDismissed() {
preferences.edit { putBoolean(keyShouldSeeWarning, false) }
- _otherSettings.value = otherSettings.value.copy(shouldSeeWarning = false)
+ _otherSettings.update { it.copy(shouldSeeWarning = false) }
}
override fun setWelcomeDismissed() {
preferences.edit { putBoolean(keyShouldSeeWelcome, false) }
- _otherSettings.value = otherSettings.value.copy(shouldSeeWelcome = false)
+ _otherSettings.update { it.copy(shouldSeeWelcome = false) }
}
private fun getOtherSettings(): OtherSettings = OtherSettings(
@@ -274,30 +330,4 @@ class SettingsRepo(
shouldSeeWelcome = preferences.getBoolean(keyShouldSeeWelcome, true)
)
//endregion
-
- //region # Undefined settings
- override fun getBluetoothAddress(): String = preferences.getString(keyBluetoothAddress, null) ?: "00:0C:BF:13:80:5D"
- override fun setBluetoothAddress(value: String) = preferences.edit { putString(keyBluetoothAddress, value) }
-
- override fun getBluetoothFormat(): String = preferences.getString(keyBluetoothFormat, null) ?: $$"W$AZ $EL"
- override fun setBluetoothFormat(value: String) = preferences.edit { putString(keyBluetoothFormat, value) }
-
- override fun getBluetoothName(): String = preferences.getString(keyBluetoothName, null) ?: "Default"
- override fun setBluetoothName(value: String) = preferences.edit { putString(keyBluetoothName, value) }
-
- override fun getBluetoothState(): Boolean = preferences.getBoolean(keyBluetoothState, false)
- override fun setBluetoothState(value: Boolean) = preferences.edit { putBoolean(keyBluetoothState, value) }
-
- override fun getRotatorAddress(): String = preferences.getString(keyRotatorAddress, null) ?: "127.0.0.1"
- override fun setRotatorAddress(value: String) = preferences.edit { putString(keyRotatorAddress, value) }
-
- override fun getRotatorPort(): String = preferences.getString(keyRotatorPort, null) ?: "4533"
- override fun setRotatorPort(value: String) = preferences.edit { putString(keyRotatorPort, value) }
-
- override fun getRotatorState(): Boolean = preferences.getBoolean(keyRotatorState, false)
- override fun setRotatorState(value: Boolean) = preferences.edit { putBoolean(keyRotatorState, value) }
- override fun onLocationChanged(location: Location) {
- setStationPosition(location.latitude, location.longitude, location.altitude)
- }
- //endregion
}
diff --git a/domain/src/main/java/com/rtbishop/look4sat/domain/model/Settings.kt b/domain/src/main/java/com/rtbishop/look4sat/domain/model/Settings.kt
index 9eddfa60..e0bcedae 100644
--- a/domain/src/main/java/com/rtbishop/look4sat/domain/model/Settings.kt
+++ b/domain/src/main/java/com/rtbishop/look4sat/domain/model/Settings.kt
@@ -12,6 +12,16 @@ data class PassesSettings(
val selectedModes: List<String>
)
+data class RCSettings(
+ val rotatorState: Boolean,
+ val rotatorAddress: String,
+ val rotatorPort: String,
+ val bluetoothState: Boolean,
+ val bluetoothFormat: String,
+ val bluetoothName: String,
+ val bluetoothAddress: String,
+)
+
data class OtherSettings(
val stateOfAutoUpdate: Boolean,
val stateOfSensors: Boolean,
diff --git a/domain/src/main/java/com/rtbishop/look4sat/domain/repository/ISettingsRepo.kt b/domain/src/main/java/com/rtbishop/look4sat/domain/repository/ISettingsRepo.kt
index 99d28010..9d779626 100644
--- a/domain/src/main/java/com/rtbishop/look4sat/domain/repository/ISettingsRepo.kt
+++ b/domain/src/main/java/com/rtbishop/look4sat/domain/repository/ISettingsRepo.kt
@@ -20,6 +20,7 @@ package com.rtbishop.look4sat.domain.repository
import com.rtbishop.look4sat.domain.model.DatabaseState
import com.rtbishop.look4sat.domain.model.OtherSettings
import com.rtbishop.look4sat.domain.model.PassesSettings
+import com.rtbishop.look4sat.domain.model.RCSettings
import com.rtbishop.look4sat.domain.predict.GeoPos
import kotlinx.coroutines.flow.StateFlow
@@ -51,6 +52,17 @@ interface ISettingsRepo {
fun updateDatabaseState(state: DatabaseState)
//endregion
+ //region # RC settings
+ val rcSettings: StateFlow<RCSettings>
+ fun setBluetoothAddress(value: String)
+ fun setBluetoothFormat(value: String)
+ fun setBluetoothName(value: String)
+ fun setBluetoothState(value: Boolean)
+ fun setRotatorAddress(value: String)
+ fun setRotatorPort(value: String)
+ fun setRotatorState(value: Boolean)
+ //endregion
+
//region # Other settings
val otherSettings: StateFlow<OtherSettings>
fun setStateOfAutoUpdate(value: Boolean)
@@ -61,21 +73,4 @@ interface ISettingsRepo {
fun setWarningDismissed()
fun setWelcomeDismissed()
//endregion
-
- //region # Undefined settings
- fun getBluetoothAddress(): String
- fun setBluetoothAddress(value: String)
- fun getBluetoothFormat(): String
- fun setBluetoothFormat(value: String)
- fun getBluetoothName(): String
- fun setBluetoothName(value: String)
- fun getBluetoothState(): Boolean
- fun setBluetoothState(value: Boolean)
- fun getRotatorAddress(): String
- fun setRotatorAddress(value: String)
- fun getRotatorPort(): String
- fun setRotatorPort(value: String)
- fun getRotatorState(): Boolean
- fun setRotatorState(value: Boolean)
- //endregion
}
diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml
index 4ebaac98..5c684e1e 100644
--- a/gradle/libs.versions.toml
+++ b/gradle/libs.versions.toml
@@ -5,16 +5,16 @@ kotlin = "2.2.21"
androidx-core-ktx = "1.17.0"
androidx-core-splashscreen = "1.2.0"
-androidx-room = "2.8.3"
+androidx-room = "2.8.4"
-compose-bom = "2025.11.00"
-compose-activity = "1.11.0"
-compose-lifecycle = "2.9.4"
+compose-bom = "2025.11.01"
+compose-activity = "1.12.0"
+compose-lifecycle = "2.10.0"
compose-navigation = "2.9.6"
other-coroutines = "1.10.2"
other-json = "20250517"
-other-okhttp = "5.3.0"
+other-okhttp = "5.3.2"
other-osmdroid = "6.1.20"
test-junit4 = "4.13.2"