TMP: DFU service

This commit is contained in:
hiar
2025-09-09 13:19:39 +02:00
committed by Himali Aryal
parent 04e9a7f233
commit 56ba823591
4 changed files with 78 additions and 0 deletions

View File

@@ -6,6 +6,7 @@ enum class Profile {
CHANNEL_SOUNDING,
CSC,
DFS,
DFU,
GLS,
HRS,
HTS,
@@ -32,6 +33,7 @@ enum class Profile {
BATTERY -> "Battery Service"
THROUGHPUT -> "Throughput Service"
UART -> "UART Service"
DFU -> "Device Firmware Update"
}
}

View File

@@ -16,3 +16,6 @@ val BATTERY_SERVICE_UUID: UUID = UUID.fromString("0000180F-0000-1000-8000-00805f
val THROUGHPUT_SERVICE_UUID: UUID = UUID.fromString("0483DADD-6C9D-6CA9-5D41-03AD4FFF4ABB")
val CHANNEL_SOUND_SERVICE_UUID: UUID = UUID.fromString("0000185B-0000-1000-8000-00805F9B34FB")
val LBS_SERVICE_UUID: UUID = UUID.fromString("00001523-1212-EFDE-1523-785FEABCD123")
val DFU_SERVICE_UUID: UUID = UUID.fromString("0000FE59-0000-1000-8000-00805F9B34FB")
val SMP_SERVICE_UUID: UUID = UUID.fromString("00001848-0000-1000-8000-00805F9B34FB")
val MDS_SERVICE_UUID: UUID = UUID.fromString("0000FFF6-0000-1000-8000-00805F9B34FB")

View File

@@ -7,12 +7,20 @@ import androidx.compose.foundation.layout.WindowInsets
import androidx.compose.foundation.layout.WindowInsetsSides
import androidx.compose.foundation.layout.displayCutout
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.imePadding
import androidx.compose.foundation.layout.only
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.widthIn
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.verticalScroll
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.DeveloperBoardOff
import androidx.compose.material3.Button
import androidx.compose.material3.Icon
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.OutlinedCard
import androidx.compose.material3.Scaffold
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
@@ -21,6 +29,7 @@ import androidx.compose.runtime.getValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp
import androidx.hilt.navigation.compose.hiltViewModel
import androidx.lifecycle.compose.collectAsStateWithLifecycle
@@ -204,9 +213,54 @@ internal fun DeviceConnectedView(
Profile.BATTERY -> BatteryScreen()
Profile.THROUGHPUT -> ThroughputScreen(state.maxValueLength)
Profile.UART -> UARTScreen(state.maxValueLength)
Profile.DFU -> DFUScreen(modifier = Modifier.padding(16.dp))
}
}
}
}
}
}
@Composable
internal fun DFUScreen(
modifier: Modifier = Modifier
) {
Column(
modifier = Modifier
.fillMaxSize()
.then(modifier),
horizontalAlignment = Alignment.CenterHorizontally
) {
OutlinedCard(
modifier = Modifier
.widthIn(max = 460.dp),
) {
Column(
modifier = Modifier
.fillMaxWidth()
.padding(16.dp),
verticalArrangement = Arrangement.spacedBy(16.dp),
horizontalAlignment = Alignment.CenterHorizontally,
) {
Icon(
imageVector = Icons.Default.DeveloperBoardOff,
contentDescription = null,
tint = MaterialTheme.colorScheme.secondary,
modifier = Modifier.size(48.dp)
)
Text(
text = "DFU is not supported",
style = MaterialTheme.typography.titleMedium
)
Text(
text = "DFU is not implemented in the current version of the app." +
" Please use the Nordic Semiconductor app for firmware updates.",
textAlign = TextAlign.Center,
style = MaterialTheme.typography.bodyMedium
)
}
}
}
}

View File

@@ -0,0 +1,19 @@
package no.nordicsemi.android.toolbox.profile.manager
import kotlinx.coroutines.CoroutineScope
import no.nordicsemi.android.toolbox.lib.utils.Profile
import no.nordicsemi.kotlin.ble.client.RemoteService
internal class DFUManager :ServiceManager{
override val profile: Profile
get() = Profile.DFU
override suspend fun observeServiceInteractions(
deviceId: String,
remoteService: RemoteService,
scope: CoroutineScope
) {
TODO("Not yet implemented")
}
}