mirror of
https://github.com/aljazceru/Android-nRF-Toolbox.git
synced 2026-01-04 15:24:19 +01:00
Implement UART module
This commit is contained in:
@@ -60,6 +60,7 @@ dependencies {
|
||||
implementation project(':profile_hts')
|
||||
implementation project(':profile_prx')
|
||||
implementation project(':profile_rscs')
|
||||
implementation project(':profile_uart')
|
||||
|
||||
implementation project(":lib_theme")
|
||||
implementation project(":lib_utils")
|
||||
|
||||
@@ -5,11 +5,9 @@ import android.os.ParcelUuid
|
||||
import androidx.activity.OnBackPressedCallback
|
||||
import androidx.activity.compose.BackHandler
|
||||
import androidx.activity.compose.LocalOnBackPressedDispatcherOwner
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.layout.*
|
||||
import androidx.compose.foundation.rememberScrollState
|
||||
import androidx.compose.foundation.verticalScroll
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.runtime.*
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
@@ -31,6 +29,7 @@ import no.nordicsemi.android.hts.view.HTSScreen
|
||||
import no.nordicsemi.android.prx.view.PRXScreen
|
||||
import no.nordicsemi.android.rscs.view.RSCSScreen
|
||||
import no.nordicsemi.android.theme.view.CloseIconAppBar
|
||||
import no.nordicsemi.android.uart.view.UARTScreen
|
||||
import no.nordicsemi.ui.scanner.navigation.view.FindDeviceScreen
|
||||
|
||||
@Composable
|
||||
@@ -104,6 +103,18 @@ internal fun HomeScreen() {
|
||||
CGMScreen { goHome() }
|
||||
}
|
||||
}
|
||||
composable(NavDestination.CGMS.id) {
|
||||
FindDeviceScreen(ParcelUuid(NavDestination.CGMS.uuid)) {
|
||||
deviceHolder.onDeviceSelected(it)
|
||||
CGMScreen { goHome() }
|
||||
}
|
||||
}
|
||||
composable(NavDestination.UART.id) {
|
||||
FindDeviceScreen(ParcelUuid(NavDestination.UART.uuid)) {
|
||||
deviceHolder.onDeviceSelected(it)
|
||||
UARTScreen { goHome() }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -236,6 +247,21 @@ fun HomeView(callback: (NavDestination) -> Unit) {
|
||||
}
|
||||
|
||||
Spacer(modifier = Modifier.height(16.dp))
|
||||
|
||||
Row(horizontalArrangement = Arrangement.SpaceEvenly) {
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.weight(1f)
|
||||
.fillMaxSize(),
|
||||
contentAlignment = Alignment.Center
|
||||
) {
|
||||
FeatureButton(
|
||||
R.drawable.ic_uart, R.string.uart_module,
|
||||
R.string.uart_module_full
|
||||
) { callback(NavDestination.UART) }
|
||||
}
|
||||
Spacer(modifier = Modifier.width(16.dp))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,12 +2,13 @@ package no.nordicsemi.android.nrftoolbox
|
||||
|
||||
import no.nordicsemi.android.bps.repository.BPS_SERVICE_UUID
|
||||
import no.nordicsemi.android.cgms.repository.CGMS_SERVICE_UUID
|
||||
import no.nordicsemi.android.csc.service.CYCLING_SPEED_AND_CADENCE_SERVICE_UUID
|
||||
import no.nordicsemi.android.csc.repository.CYCLING_SPEED_AND_CADENCE_SERVICE_UUID
|
||||
import no.nordicsemi.android.gls.repository.GLS_SERVICE_UUID
|
||||
import no.nordicsemi.android.hrs.service.HR_SERVICE_UUID
|
||||
import no.nordicsemi.android.hts.service.HT_SERVICE_UUID
|
||||
import no.nordicsemi.android.hts.repository.HT_SERVICE_UUID
|
||||
import no.nordicsemi.android.prx.service.PRX_SERVICE_UUID
|
||||
import no.nordicsemi.android.rscs.service.RSCS_SERVICE_UUID
|
||||
import no.nordicsemi.android.uart.repository.UART_SERVICE_UUID
|
||||
import java.util.*
|
||||
|
||||
const val ARGS_KEY = "args"
|
||||
@@ -21,5 +22,6 @@ enum class NavDestination(val id: String, val uuid: UUID?, val pairingRequired:
|
||||
BPS("bps-screen", BPS_SERVICE_UUID, false),
|
||||
PRX("prx-screen", PRX_SERVICE_UUID, true),
|
||||
RSCS("rscs-screen", RSCS_SERVICE_UUID, false),
|
||||
CGMS("cgms-screen", CGMS_SERVICE_UUID, false);
|
||||
CGMS("cgms-screen", CGMS_SERVICE_UUID, false),
|
||||
UART("uart-screen", UART_SERVICE_UUID, false);
|
||||
}
|
||||
|
||||
@@ -1,9 +1,24 @@
|
||||
<vector android:height="80dp" android:viewportHeight="1024"
|
||||
android:viewportWidth="1024" android:width="80dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="#00B3DC" android:pathData="M236.3,441.9c-77.1,0 -139.8,-61 -139.8,-135.9c0,-20.6 4.6,-40.4 13.8,-58.8c0,0 0,-0.1 0.1,-0.1c3.6,-7.2 7.8,-14.1 12.6,-20.6L212.1,83c5.8,-9.4 16.5,-14.6 27.5,-13.3c9.6,1.1 17.8,7 22.1,15.4c4.3,7.4 39.3,63.6 90,144.2c2.8,4 5.4,8.2 7.8,12.5c0.2,0.4 0.4,0.8 0.6,1.1c10.5,19.4 16,41.2 16,63.1C376.1,380.9 313.4,441.9 236.3,441.9zM161.3,272.6c-5.2,10.5 -7.8,21.7 -7.8,33.4c0,43.5 37.1,78.9 82.8,78.9s82.8,-35.4 82.8,-78.9c0,-12.8 -3.1,-25 -9.3,-36.3c0,0 0,0 0,0c0,0 0,0 0,-0.1c-1.5,-2.7 -3.2,-5.4 -5,-7.9c-0.3,-0.5 -0.6,-0.9 -0.9,-1.4c-11.6,-18.4 -34,-54.1 -53.9,-85.9c-5.3,-8.4 -9.8,-15.7 -13.8,-22.1l-65.4,105.3c-0.5,0.8 -1,1.5 -1.5,2.2c-3,4 -5.6,8.2 -7.8,12.5C161.4,272.4 161.4,272.5 161.3,272.6zM263.3,89C263.3,89 263.3,89 263.3,89C263.3,89 263.3,89 263.3,89zM263.3,88.9C263.3,88.9 263.3,89 263.3,88.9C263.3,89 263.3,88.9 263.3,88.9z"/>
|
||||
<path android:fillColor="#00B3DC" android:pathData="M403.9,1011.3c-22.3,0 -43.8,-7.6 -61.4,-21.9c0,0 0,0 0,0L167.7,847c-41.7,-33.9 -47.9,-95.5 -14,-137.1L679.2,64.7C695.7,44.5 719,32 744.9,29.3c25.9,-2.6 51.3,5 71.5,21.4l174.8,142.4c20.2,16.4 32.8,39.8 35.4,65.7s-5,51.3 -21.4,71.5L479.6,975.4c-16.4,20.2 -39.8,32.8 -65.7,35.4C410.6,1011.2 407.2,1011.3 403.9,1011.3zM378.5,945.2c8.4,6.8 18.9,10 29.7,8.9c10.7,-1.1 20.4,-6.3 27.3,-14.7L961,294.2c6.8,-8.4 10,-18.9 8.9,-29.7c-1.1,-10.7 -6.3,-20.4 -14.7,-27.3L780.3,94.9c-8.4,-6.8 -18.9,-10 -29.7,-8.9c-10.8,1.1 -20.4,6.3 -27.3,14.7L197.9,745.9c-14.1,17.3 -11.5,42.8 5.8,56.9L378.5,945.2L378.5,945.2z"/>
|
||||
<path android:fillColor="#00B3DC" android:pathData="M572,414.3m-41.9,0a41.9,41.9 0,1 1,83.8 0a41.9,41.9 0,1 1,-83.8 0"/>
|
||||
<path android:fillColor="#00B3DC" android:pathData="M684.5,505.9m-41.9,0a41.9,41.9 0,1 1,83.8 0a41.9,41.9 0,1 1,-83.8 0"/>
|
||||
<path android:fillColor="#00B3DC" android:pathData="M474.3,534.2m-41.9,0a41.9,41.9 0,1 1,83.8 0a41.9,41.9 0,1 1,-83.8 0"/>
|
||||
<path android:fillColor="#00B3DC" android:pathData="M586.8,625.8m-41.9,0a41.9,41.9 0,1 1,83.8 0a41.9,41.9 0,1 1,-83.8 0"/>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="80dp"
|
||||
android:height="80dp"
|
||||
android:viewportWidth="1024"
|
||||
android:viewportHeight="1024">
|
||||
<path
|
||||
android:fillColor="#00B3DC"
|
||||
android:pathData="M236.3,441.9c-77.1,0 -139.8,-61 -139.8,-135.9c0,-20.6 4.6,-40.4 13.8,-58.8c0,0 0,-0.1 0.1,-0.1c3.6,-7.2 7.8,-14.1 12.6,-20.6L212.1,83c5.8,-9.4 16.5,-14.6 27.5,-13.3c9.6,1.1 17.8,7 22.1,15.4c4.3,7.4 39.3,63.6 90,144.2c2.8,4 5.4,8.2 7.8,12.5c0.2,0.4 0.4,0.8 0.6,1.1c10.5,19.4 16,41.2 16,63.1C376.1,380.9 313.4,441.9 236.3,441.9zM161.3,272.6c-5.2,10.5 -7.8,21.7 -7.8,33.4c0,43.5 37.1,78.9 82.8,78.9s82.8,-35.4 82.8,-78.9c0,-12.8 -3.1,-25 -9.3,-36.3c0,0 0,0 0,0c0,0 0,0 0,-0.1c-1.5,-2.7 -3.2,-5.4 -5,-7.9c-0.3,-0.5 -0.6,-0.9 -0.9,-1.4c-11.6,-18.4 -34,-54.1 -53.9,-85.9c-5.3,-8.4 -9.8,-15.7 -13.8,-22.1l-65.4,105.3c-0.5,0.8 -1,1.5 -1.5,2.2c-3,4 -5.6,8.2 -7.8,12.5C161.4,272.4 161.4,272.5 161.3,272.6zM263.3,89C263.3,89 263.3,89 263.3,89C263.3,89 263.3,89 263.3,89zM263.3,88.9C263.3,88.9 263.3,89 263.3,88.9C263.3,89 263.3,88.9 263.3,88.9z" />
|
||||
<path
|
||||
android:fillColor="#00B3DC"
|
||||
android:pathData="M403.9,1011.3c-22.3,0 -43.8,-7.6 -61.4,-21.9c0,0 0,0 0,0L167.7,847c-41.7,-33.9 -47.9,-95.5 -14,-137.1L679.2,64.7C695.7,44.5 719,32 744.9,29.3c25.9,-2.6 51.3,5 71.5,21.4l174.8,142.4c20.2,16.4 32.8,39.8 35.4,65.7s-5,51.3 -21.4,71.5L479.6,975.4c-16.4,20.2 -39.8,32.8 -65.7,35.4C410.6,1011.2 407.2,1011.3 403.9,1011.3zM378.5,945.2c8.4,6.8 18.9,10 29.7,8.9c10.7,-1.1 20.4,-6.3 27.3,-14.7L961,294.2c6.8,-8.4 10,-18.9 8.9,-29.7c-1.1,-10.7 -6.3,-20.4 -14.7,-27.3L780.3,94.9c-8.4,-6.8 -18.9,-10 -29.7,-8.9c-10.8,1.1 -20.4,6.3 -27.3,14.7L197.9,745.9c-14.1,17.3 -11.5,42.8 5.8,56.9L378.5,945.2L378.5,945.2z" />
|
||||
<path
|
||||
android:fillColor="#00B3DC"
|
||||
android:pathData="M572,414.3m-41.9,0a41.9,41.9 0,1 1,83.8 0a41.9,41.9 0,1 1,-83.8 0" />
|
||||
<path
|
||||
android:fillColor="#00B3DC"
|
||||
android:pathData="M684.5,505.9m-41.9,0a41.9,41.9 0,1 1,83.8 0a41.9,41.9 0,1 1,-83.8 0" />
|
||||
<path
|
||||
android:fillColor="#00B3DC"
|
||||
android:pathData="M474.3,534.2m-41.9,0a41.9,41.9 0,1 1,83.8 0a41.9,41.9 0,1 1,-83.8 0" />
|
||||
<path
|
||||
android:fillColor="#00B3DC"
|
||||
android:pathData="M586.8,625.8m-41.9,0a41.9,41.9 0,1 1,83.8 0a41.9,41.9 0,1 1,-83.8 0" />
|
||||
</vector>
|
||||
|
||||
@@ -1,7 +1,18 @@
|
||||
<vector android:height="80dp" android:viewportHeight="1024"
|
||||
android:viewportWidth="1024" android:width="80dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="#00B3DC" android:pathData="M982.9,706.2c-10.8,-37.3 -61.8,-59.1 -126.3,-86.7c-26.1,-11.2 -53.1,-22.7 -73.8,-34.3c-26.6,-14.9 -30.8,-23.3 -31.4,-24.8C730,504.6 641.7,260.1 634.7,237.4c-6.8,-22.1 -23.1,-38.5 -43.7,-43.8c-12.9,-3.3 -38.5,-5 -65.7,21.3c-16.6,16 -30.5,38.5 -40.2,57.1c-4.8,-3.8 -9.9,-7.9 -15,-12.3c-37.1,-31.1 -43.9,-44 -44.7,-46c-1.7,-8.8 -0.2,-25.9 1,-41c2.7,-31.8 5.2,-61.8 -11.7,-80.3c-15,-16.5 -41.3,-23.4 -72.2,-19.1c-31.8,4.4 -67.1,19.7 -105,45.4c-19.8,13.4 -36.3,27 -50,39.8c-0.6,0.5 -1.2,1.1 -1.8,1.7c-0.1,0.1 -0.3,0.3 -0.4,0.4c-14.2,13.4 -25.2,26 -33.6,36.8c-36.3,42.6 -64,85 -79.2,109.6c-14.6,23.8 -17.6,52.5 -8.3,78.8c9.5,26.7 30.1,66.5 74.6,103.9c91,76.7 198.5,176.9 227.5,227.9c19.9,35.1 48.2,80.3 90.2,118.7c52.8,48.3 114.7,74.2 184,77c38.5,1.6 77.8,2.8 115,2.8c33,0 64.3,-1 92,-3.7c50.6,-4.9 118.8,-17.4 127.9,-69c2.8,-15.7 4.7,-37.3 6.1,-57.8C984.7,758.2 987.6,722.4 982.9,706.2zM269.4,165.8c58,-39.4 91.9,-38.7 101.4,-35.5c1.1,8.3 -0.4,26.3 -1.4,37.6c-1.7,20.3 -3.5,41.4 0.1,58.3c2.8,13.1 12.3,33.5 61.1,74.9c24.4,20.7 47.7,37.4 48.7,38.1c7.2,5.1 16.3,6.6 24.7,4.1c8.4,-2.5 15.2,-8.8 18.4,-17c5.2,-13.3 22.9,-51.9 42.3,-70.6c6.8,-6.6 11.1,-7.3 11.9,-7.1c0.5,0.1 2.4,1.7 3.5,5.3c3.1,10.2 18.4,53.4 37.2,105.6l-73.1,12.9c-10.3,1.8 -17.2,11.7 -15.4,22c1.6,9.2 9.6,15.7 18.7,15.7c1.1,0 2.2,-0.1 3.3,-0.3l79.6,-14.1c5.3,14.8 10.8,29.9 16.2,44.7l-74.3,13.1c-10.3,1.8 -17.2,11.7 -15.4,22c1.6,9.2 9.6,15.7 18.7,15.7c1.1,0 2.2,-0.1 3.3,-0.3l80.9,-14.3c5.8,15.8 11.3,31 16.4,44.7L600.4,535c-10.3,1.8 -17.2,11.7 -15.4,22c1.6,9.2 9.6,15.7 18.7,15.7c1.1,0 2.2,-0.1 3.3,-0.3l82.6,-14.6c3.5,9.5 6.5,17.3 8.6,22.9c7.4,19.4 25.5,36.6 56.7,54.1c23.4,13.1 51.8,25.3 79.3,37c24.5,10.5 47.7,20.4 66.1,30.4c19.3,10.4 25.5,17 27.4,19.3c-0.1,0.5 -0.1,1.1 -0.2,1.6c-0.1,1.4 -0.2,3.5 -0.4,8.6c-0.3,6.3 -0.7,15.8 -1.3,26.9c-63.1,9.8 -182.8,18.5 -260.2,2.1c-98.2,-20.7 -146.9,-106.7 -179.2,-163.6l-1.5,-2.7C448.5,530.4 305.1,389 239.1,333.4c-40.1,-33.8 -51.7,-67.3 -55.1,-83.3c2.4,-3.9 6,-9.4 11.1,-16.1c9.5,-11.2 19.7,-22.4 30.4,-33.2C237.3,189.7 251.8,177.8 269.4,165.8zM841.8,855.7c-55.5,5.4 -128.5,3.5 -199.2,0.6c-119.9,-4.8 -184.2,-91.7 -226.9,-166.9c-40,-70.4 -181.4,-193.6 -240.3,-243.3c-34.7,-29.2 -50.5,-59.3 -57.6,-79.4c-3.5,-10 -2.4,-20.9 3.1,-29.9c5.6,-9.1 13,-20.7 22,-33.9c13.3,26.9 33.7,52.2 59.5,74c70.8,59.7 203.3,193.6 233,245.7l1.5,2.7c16.9,29.8 40.1,70.7 73.9,107.2c41,44.3 89.2,72.6 143.1,84c35.8,7.6 77.7,10.3 119.1,10.3c55.7,0 110.6,-5 148.4,-10.1c-0.7,6.2 -1.5,11.8 -2.3,16.7C919,833.7 912,848.9 841.8,855.7z"/>
|
||||
<path android:fillColor="#00B3DC" android:pathData="M54.9,666.5h87.5c10.5,0 19,-8.5 19,-19s-8.5,-19 -19,-19H54.9c-10.5,0 -19,8.5 -19,19S44.4,666.5 54.9,666.5z"/>
|
||||
<path android:fillColor="#00B3DC" android:pathData="M54.9,782.2H239c10.5,0 19,-8.5 19,-19s-8.5,-19 -19,-19H54.9c-10.5,0 -19,8.5 -19,19S44.4,782.2 54.9,782.2z"/>
|
||||
<path android:fillColor="#00B3DC" android:pathData="M364.3,859.9H54.9c-10.5,0 -19,8.5 -19,19s8.5,19 19,19h309.4c10.5,0 19,-8.5 19,-19S374.8,859.9 364.3,859.9z"/>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="80dp"
|
||||
android:height="80dp"
|
||||
android:viewportWidth="1024"
|
||||
android:viewportHeight="1024">
|
||||
<path
|
||||
android:fillColor="#00B3DC"
|
||||
android:pathData="M982.9,706.2c-10.8,-37.3 -61.8,-59.1 -126.3,-86.7c-26.1,-11.2 -53.1,-22.7 -73.8,-34.3c-26.6,-14.9 -30.8,-23.3 -31.4,-24.8C730,504.6 641.7,260.1 634.7,237.4c-6.8,-22.1 -23.1,-38.5 -43.7,-43.8c-12.9,-3.3 -38.5,-5 -65.7,21.3c-16.6,16 -30.5,38.5 -40.2,57.1c-4.8,-3.8 -9.9,-7.9 -15,-12.3c-37.1,-31.1 -43.9,-44 -44.7,-46c-1.7,-8.8 -0.2,-25.9 1,-41c2.7,-31.8 5.2,-61.8 -11.7,-80.3c-15,-16.5 -41.3,-23.4 -72.2,-19.1c-31.8,4.4 -67.1,19.7 -105,45.4c-19.8,13.4 -36.3,27 -50,39.8c-0.6,0.5 -1.2,1.1 -1.8,1.7c-0.1,0.1 -0.3,0.3 -0.4,0.4c-14.2,13.4 -25.2,26 -33.6,36.8c-36.3,42.6 -64,85 -79.2,109.6c-14.6,23.8 -17.6,52.5 -8.3,78.8c9.5,26.7 30.1,66.5 74.6,103.9c91,76.7 198.5,176.9 227.5,227.9c19.9,35.1 48.2,80.3 90.2,118.7c52.8,48.3 114.7,74.2 184,77c38.5,1.6 77.8,2.8 115,2.8c33,0 64.3,-1 92,-3.7c50.6,-4.9 118.8,-17.4 127.9,-69c2.8,-15.7 4.7,-37.3 6.1,-57.8C984.7,758.2 987.6,722.4 982.9,706.2zM269.4,165.8c58,-39.4 91.9,-38.7 101.4,-35.5c1.1,8.3 -0.4,26.3 -1.4,37.6c-1.7,20.3 -3.5,41.4 0.1,58.3c2.8,13.1 12.3,33.5 61.1,74.9c24.4,20.7 47.7,37.4 48.7,38.1c7.2,5.1 16.3,6.6 24.7,4.1c8.4,-2.5 15.2,-8.8 18.4,-17c5.2,-13.3 22.9,-51.9 42.3,-70.6c6.8,-6.6 11.1,-7.3 11.9,-7.1c0.5,0.1 2.4,1.7 3.5,5.3c3.1,10.2 18.4,53.4 37.2,105.6l-73.1,12.9c-10.3,1.8 -17.2,11.7 -15.4,22c1.6,9.2 9.6,15.7 18.7,15.7c1.1,0 2.2,-0.1 3.3,-0.3l79.6,-14.1c5.3,14.8 10.8,29.9 16.2,44.7l-74.3,13.1c-10.3,1.8 -17.2,11.7 -15.4,22c1.6,9.2 9.6,15.7 18.7,15.7c1.1,0 2.2,-0.1 3.3,-0.3l80.9,-14.3c5.8,15.8 11.3,31 16.4,44.7L600.4,535c-10.3,1.8 -17.2,11.7 -15.4,22c1.6,9.2 9.6,15.7 18.7,15.7c1.1,0 2.2,-0.1 3.3,-0.3l82.6,-14.6c3.5,9.5 6.5,17.3 8.6,22.9c7.4,19.4 25.5,36.6 56.7,54.1c23.4,13.1 51.8,25.3 79.3,37c24.5,10.5 47.7,20.4 66.1,30.4c19.3,10.4 25.5,17 27.4,19.3c-0.1,0.5 -0.1,1.1 -0.2,1.6c-0.1,1.4 -0.2,3.5 -0.4,8.6c-0.3,6.3 -0.7,15.8 -1.3,26.9c-63.1,9.8 -182.8,18.5 -260.2,2.1c-98.2,-20.7 -146.9,-106.7 -179.2,-163.6l-1.5,-2.7C448.5,530.4 305.1,389 239.1,333.4c-40.1,-33.8 -51.7,-67.3 -55.1,-83.3c2.4,-3.9 6,-9.4 11.1,-16.1c9.5,-11.2 19.7,-22.4 30.4,-33.2C237.3,189.7 251.8,177.8 269.4,165.8zM841.8,855.7c-55.5,5.4 -128.5,3.5 -199.2,0.6c-119.9,-4.8 -184.2,-91.7 -226.9,-166.9c-40,-70.4 -181.4,-193.6 -240.3,-243.3c-34.7,-29.2 -50.5,-59.3 -57.6,-79.4c-3.5,-10 -2.4,-20.9 3.1,-29.9c5.6,-9.1 13,-20.7 22,-33.9c13.3,26.9 33.7,52.2 59.5,74c70.8,59.7 203.3,193.6 233,245.7l1.5,2.7c16.9,29.8 40.1,70.7 73.9,107.2c41,44.3 89.2,72.6 143.1,84c35.8,7.6 77.7,10.3 119.1,10.3c55.7,0 110.6,-5 148.4,-10.1c-0.7,6.2 -1.5,11.8 -2.3,16.7C919,833.7 912,848.9 841.8,855.7z" />
|
||||
<path
|
||||
android:fillColor="#00B3DC"
|
||||
android:pathData="M54.9,666.5h87.5c10.5,0 19,-8.5 19,-19s-8.5,-19 -19,-19H54.9c-10.5,0 -19,8.5 -19,19S44.4,666.5 54.9,666.5z" />
|
||||
<path
|
||||
android:fillColor="#00B3DC"
|
||||
android:pathData="M54.9,782.2H239c10.5,0 19,-8.5 19,-19s-8.5,-19 -19,-19H54.9c-10.5,0 -19,8.5 -19,19S44.4,782.2 54.9,782.2z" />
|
||||
<path
|
||||
android:fillColor="#00B3DC"
|
||||
android:pathData="M364.3,859.9H54.9c-10.5,0 -19,8.5 -19,19s8.5,19 19,19h309.4c10.5,0 19,-8.5 19,-19S374.8,859.9 364.3,859.9z" />
|
||||
</vector>
|
||||
|
||||
51
app/src/main/res/drawable/ic_uart.xml
Normal file
51
app/src/main/res/drawable/ic_uart.xml
Normal file
@@ -0,0 +1,51 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="80dp"
|
||||
android:height="80dp"
|
||||
android:viewportWidth="1024"
|
||||
android:viewportHeight="1024">
|
||||
<path
|
||||
android:fillColor="#00B3DC"
|
||||
android:pathData="M267.4,472.8m-22.3,0a22.3,22.3 0,1 1,44.6 0a22.3,22.3 0,1 1,-44.6 0" />
|
||||
<path
|
||||
android:fillColor="#00B3DC"
|
||||
android:pathData="M349.3,472.8m-22.3,0a22.3,22.3 0,1 1,44.6 0a22.3,22.3 0,1 1,-44.6 0" />
|
||||
<path
|
||||
android:fillColor="#00B3DC"
|
||||
android:pathData="M431.1,472.8m-22.3,0a22.3,22.3 0,1 1,44.6 0a22.3,22.3 0,1 1,-44.6 0" />
|
||||
<path
|
||||
android:fillColor="#00B3DC"
|
||||
android:pathData="M513,472.8m-22.3,0a22.3,22.3 0,1 1,44.6 0a22.3,22.3 0,1 1,-44.6 0" />
|
||||
<path
|
||||
android:fillColor="#00B3DC"
|
||||
android:pathData="M594.9,472.8m-22.3,0a22.3,22.3 0,1 1,44.6 0a22.3,22.3 0,1 1,-44.6 0" />
|
||||
<path
|
||||
android:fillColor="#00B3DC"
|
||||
android:pathData="M676.7,472.8m-22.3,0a22.3,22.3 0,1 1,44.6 0a22.3,22.3 0,1 1,-44.6 0" />
|
||||
<path
|
||||
android:fillColor="#00B3DC"
|
||||
android:pathData="M758.6,472.8m-22.3,0a22.3,22.3 0,1 1,44.6 0a22.3,22.3 0,1 1,-44.6 0" />
|
||||
<path
|
||||
android:fillColor="#00B3DC"
|
||||
android:pathData="M306.5,545m-22.3,0a22.3,22.3 0,1 1,44.6 0a22.3,22.3 0,1 1,-44.6 0" />
|
||||
<path
|
||||
android:fillColor="#00B3DC"
|
||||
android:pathData="M388.4,545m-22.3,0a22.3,22.3 0,1 1,44.6 0a22.3,22.3 0,1 1,-44.6 0" />
|
||||
<path
|
||||
android:fillColor="#00B3DC"
|
||||
android:pathData="M470.2,545m-22.3,0a22.3,22.3 0,1 1,44.6 0a22.3,22.3 0,1 1,-44.6 0" />
|
||||
<path
|
||||
android:fillColor="#00B3DC"
|
||||
android:pathData="M552.1,545m-22.3,0a22.3,22.3 0,1 1,44.6 0a22.3,22.3 0,1 1,-44.6 0" />
|
||||
<path
|
||||
android:fillColor="#00B3DC"
|
||||
android:pathData="M634,545m-22.3,0a22.3,22.3 0,1 1,44.6 0a22.3,22.3 0,1 1,-44.6 0" />
|
||||
<path
|
||||
android:fillColor="#00B3DC"
|
||||
android:pathData="M715.9,545m-22.3,0a22.3,22.3 0,1 1,44.6 0a22.3,22.3 0,1 1,-44.6 0" />
|
||||
<path
|
||||
android:fillColor="#00B3DC"
|
||||
android:pathData="M806.3,759.8H219.7c-30.7,0 -59.9,-9.8 -84.4,-28.2c-24.5,-18.5 -42,-43.8 -50.5,-73.3L6.6,387c-8.9,-30.8 -2.9,-63.1 16.4,-88.7S71.7,258 103.7,258h818.5c32,0 61.5,14.7 80.7,40.3c19.3,25.6 25.2,57.9 16.4,88.7l-78.1,271.3c-8.5,29.5 -26,54.9 -50.5,73.3C866.2,750 837,759.8 806.3,759.8zM103.7,315c-14,0 -26.8,6.4 -35.2,17.6c-8.4,11.2 -11,25.3 -7.1,38.7l78.1,271.3c10.2,35.5 43.2,60.3 80.1,60.3h586.7c37,0 69.9,-24.8 80.1,-60.3l78.1,-271.3c3.9,-13.4 1.3,-27.5 -7.1,-38.7c-8.4,-11.2 -21.2,-17.6 -35.2,-17.6H103.7z" />
|
||||
<path
|
||||
android:fillColor="#00B3DC"
|
||||
android:pathData="M766.2,648.4H259.8c-18.5,0 -36.2,-5.3 -51.1,-15.5c-15.3,-10.4 -26.2,-24.8 -31.6,-41.6c-0.1,-0.4 -0.2,-0.7 -0.3,-1.1l-37.2,-146.5c-5.1,-16.7 -2.1,-34.5 8.4,-48.9c11.7,-16 31,-25.5 51.8,-25.5h626.5c20.8,0 40.1,9.5 51.8,25.5c10.5,14.4 13.6,32.2 8.4,48.9l-37.2,146.5c-0.1,0.4 -0.2,0.7 -0.3,1.1c-5.4,16.8 -16.3,31.2 -31.6,41.6C802.4,643.1 784.7,648.4 766.2,648.4zM213.5,580.3c5.9,17.8 24.9,30.2 46.4,30.2h506.4c21.4,0 40.4,-12.4 46.4,-30.2l37.2,-146.4c0.1,-0.4 0.2,-0.7 0.3,-1.1c2.2,-6.8 -0.3,-12.2 -2.7,-15.5c-4.5,-6.2 -12.4,-9.9 -21.1,-9.9H199.8c-8.7,0 -16.5,3.7 -21.1,9.9c-2.4,3.3 -4.9,8.7 -2.7,15.5c0.1,0.4 0.2,0.7 0.3,1.1L213.5,580.3z" />
|
||||
</vector>
|
||||
@@ -15,4 +15,6 @@
|
||||
<string name="prx_module_full">Proximity</string>
|
||||
<string name="cgm_module">CGMS</string>
|
||||
<string name="cgm_module_full">Continuous Glucose</string>
|
||||
<string name="uart_module">UART</string>
|
||||
<string name="uart_module_full">Serial port over BLE</string>
|
||||
</resources>
|
||||
@@ -7,7 +7,7 @@
|
||||
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
|
||||
|
||||
<application>
|
||||
<service android:name=".service.CSCService" />
|
||||
<service android:name=".repository.CSCService" />
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
|
||||
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package no.nordicsemi.android.csc.service
|
||||
package no.nordicsemi.android.csc.repository
|
||||
|
||||
import android.bluetooth.BluetoothDevice
|
||||
import android.bluetooth.BluetoothGatt
|
||||
@@ -30,7 +30,7 @@ import androidx.annotation.FloatRange
|
||||
import no.nordicsemi.android.ble.common.callback.csc.CyclingSpeedAndCadenceMeasurementDataCallback
|
||||
import no.nordicsemi.android.ble.data.Data
|
||||
import no.nordicsemi.android.csc.data.CSCDataHolder
|
||||
import no.nordicsemi.android.csc.service.CSCMeasurementParser.parse
|
||||
import no.nordicsemi.android.csc.repository.CSCMeasurementParser.parse
|
||||
import no.nordicsemi.android.csc.view.CSCSettings
|
||||
import no.nordicsemi.android.log.LogContract
|
||||
import no.nordicsemi.android.service.BatteryManager
|
||||
@@ -19,7 +19,7 @@
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
|
||||
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package no.nordicsemi.android.csc.service
|
||||
package no.nordicsemi.android.csc.repository
|
||||
|
||||
import no.nordicsemi.android.ble.data.Data
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package no.nordicsemi.android.csc.service
|
||||
package no.nordicsemi.android.csc.repository
|
||||
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
import no.nordicsemi.android.csc.data.CSCDataHolder
|
||||
@@ -10,7 +10,7 @@ import androidx.compose.ui.res.stringResource
|
||||
import androidx.hilt.navigation.compose.hiltViewModel
|
||||
import no.nordicsemi.android.csc.R
|
||||
import no.nordicsemi.android.csc.data.CSCData
|
||||
import no.nordicsemi.android.csc.service.CSCService
|
||||
import no.nordicsemi.android.csc.repository.CSCService
|
||||
import no.nordicsemi.android.csc.viewmodel.CSCViewModel
|
||||
import no.nordicsemi.android.theme.view.BackIconAppBar
|
||||
import no.nordicsemi.android.utils.isServiceRunning
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
package="no.nordicsemi.android.hts">
|
||||
|
||||
<application>
|
||||
<service android:name=".service.HTSService" />
|
||||
<service android:name=".repository.HTSService" />
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
@@ -19,7 +19,7 @@
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
|
||||
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package no.nordicsemi.android.hts.service
|
||||
package no.nordicsemi.android.hts.repository
|
||||
|
||||
import no.nordicsemi.android.ble.common.callback.DateTimeDataCallback
|
||||
import no.nordicsemi.android.ble.data.Data
|
||||
@@ -19,7 +19,7 @@
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
|
||||
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package no.nordicsemi.android.hts.service
|
||||
package no.nordicsemi.android.hts.repository
|
||||
|
||||
import android.bluetooth.BluetoothDevice
|
||||
import android.bluetooth.BluetoothGatt
|
||||
@@ -1,4 +1,4 @@
|
||||
package no.nordicsemi.android.hts.service
|
||||
package no.nordicsemi.android.hts.repository
|
||||
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
import no.nordicsemi.android.hts.data.HTSDataHolder
|
||||
@@ -19,7 +19,7 @@
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
|
||||
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package no.nordicsemi.android.hts.service
|
||||
package no.nordicsemi.android.hts.repository
|
||||
|
||||
import no.nordicsemi.android.ble.data.Data
|
||||
import java.util.*
|
||||
@@ -19,7 +19,7 @@
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
|
||||
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package no.nordicsemi.android.hts.service
|
||||
package no.nordicsemi.android.hts.repository
|
||||
|
||||
import no.nordicsemi.android.ble.data.Data
|
||||
|
||||
@@ -10,7 +10,7 @@ import androidx.compose.ui.res.stringResource
|
||||
import androidx.hilt.navigation.compose.hiltViewModel
|
||||
import no.nordicsemi.android.hts.R
|
||||
import no.nordicsemi.android.hts.data.HTSData
|
||||
import no.nordicsemi.android.hts.service.HTSService
|
||||
import no.nordicsemi.android.hts.repository.HTSService
|
||||
import no.nordicsemi.android.hts.viewmodel.HTSViewModel
|
||||
import no.nordicsemi.android.theme.view.BackIconAppBar
|
||||
import no.nordicsemi.android.utils.isServiceRunning
|
||||
|
||||
21
profile_uart/build.gradle
Normal file
21
profile_uart/build.gradle
Normal file
@@ -0,0 +1,21 @@
|
||||
apply from: rootProject.file("library.gradle")
|
||||
apply plugin: 'kotlin-parcelize'
|
||||
|
||||
dependencies {
|
||||
implementation project(":lib_service")
|
||||
implementation project(":lib_theme")
|
||||
implementation project(":lib_utils")
|
||||
|
||||
implementation libs.nordic.ble.common
|
||||
|
||||
implementation libs.nordic.log
|
||||
implementation libs.nordic.theme
|
||||
|
||||
implementation libs.bundles.compose
|
||||
implementation libs.androidx.core
|
||||
implementation libs.material
|
||||
implementation libs.lifecycle.activity
|
||||
implementation libs.lifecycle.service
|
||||
implementation libs.compose.lifecycle
|
||||
implementation libs.compose.activity
|
||||
}
|
||||
9
profile_uart/src/main/AndroidManifest.xml
Normal file
9
profile_uart/src/main/AndroidManifest.xml
Normal file
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="no.nordicsemi.android.uart">
|
||||
|
||||
<application>
|
||||
<service android:name=".repository.UARTService" />
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
@@ -0,0 +1,8 @@
|
||||
package no.nordicsemi.android.uart.data
|
||||
|
||||
import no.nordicsemi.android.utils.EMPTY
|
||||
|
||||
internal data class UARTData(
|
||||
val text: String = String.EMPTY,
|
||||
val batteryLevel: Int = 0
|
||||
)
|
||||
@@ -0,0 +1,21 @@
|
||||
package no.nordicsemi.android.uart.data
|
||||
|
||||
import kotlinx.coroutines.flow.MutableStateFlow
|
||||
import kotlinx.coroutines.flow.asStateFlow
|
||||
import javax.inject.Inject
|
||||
import javax.inject.Singleton
|
||||
|
||||
@Singleton
|
||||
internal class UARTDataHolder @Inject constructor() {
|
||||
|
||||
private val _data = MutableStateFlow(UARTData())
|
||||
val data = _data.asStateFlow()
|
||||
|
||||
fun emitNewMessage(message: String) {
|
||||
_data.tryEmit(_data.value.copy(text = message))
|
||||
}
|
||||
|
||||
fun emitNewBatteryLevel(batteryLevel: Int) {
|
||||
_data.tryEmit(_data.value.copy(batteryLevel = batteryLevel))
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,141 @@
|
||||
/*
|
||||
* Copyright (c) 2015, Nordic Semiconductor
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
|
||||
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package no.nordicsemi.android.uart.repository
|
||||
|
||||
import android.bluetooth.BluetoothGatt
|
||||
import android.bluetooth.BluetoothGattCharacteristic
|
||||
import android.bluetooth.BluetoothGattService
|
||||
import android.content.Context
|
||||
import android.text.TextUtils
|
||||
import no.nordicsemi.android.ble.WriteRequest
|
||||
import no.nordicsemi.android.log.LogContract
|
||||
import no.nordicsemi.android.service.BatteryManager
|
||||
import no.nordicsemi.android.uart.data.UARTDataHolder
|
||||
import no.nordicsemi.android.utils.EMPTY
|
||||
import java.util.*
|
||||
|
||||
/** Nordic UART Service UUID */
|
||||
val UART_SERVICE_UUID = UUID.fromString("6E400001-B5A3-F393-E0A9-E50E24DCCA9E")
|
||||
|
||||
/** RX characteristic UUID */
|
||||
private val UART_RX_CHARACTERISTIC_UUID = UUID.fromString("6E400002-B5A3-F393-E0A9-E50E24DCCA9E")
|
||||
|
||||
/** TX characteristic UUID */
|
||||
private val UART_TX_CHARACTERISTIC_UUID = UUID.fromString("6E400003-B5A3-F393-E0A9-E50E24DCCA9E")
|
||||
|
||||
internal class UARTManager(context: Context, private val dataHolder: UARTDataHolder) : BatteryManager(context) {
|
||||
|
||||
private var rxCharacteristic: BluetoothGattCharacteristic? = null
|
||||
private var txCharacteristic: BluetoothGattCharacteristic? = null
|
||||
|
||||
/**
|
||||
* A flag indicating whether Long Write can be used. It's set to false if the UART RX
|
||||
* characteristic has only PROPERTY_WRITE_NO_RESPONSE property and no PROPERTY_WRITE.
|
||||
* If you set it to false here, it will never use Long Write.
|
||||
*
|
||||
* TODO change this flag if you don't want to use Long Write even with Write Request.
|
||||
*/
|
||||
private var useLongWrite = true
|
||||
|
||||
/**
|
||||
* BluetoothGatt callbacks for connection/disconnection, service discovery,
|
||||
* receiving indication, etc.
|
||||
*/
|
||||
private inner class UARTManagerGattCallback : BatteryManagerGattCallback() {
|
||||
|
||||
override fun initialize() {
|
||||
setNotificationCallback(txCharacteristic)
|
||||
.with { device, data ->
|
||||
val text: String = data.getStringValue(0) ?: String.EMPTY
|
||||
log(LogContract.Log.Level.APPLICATION, "\"$text\" received")
|
||||
dataHolder.emitNewMessage(text)
|
||||
}
|
||||
requestMtu(260).enqueue()
|
||||
enableNotifications(txCharacteristic).enqueue()
|
||||
}
|
||||
|
||||
override fun isRequiredServiceSupported(gatt: BluetoothGatt): Boolean {
|
||||
val service: BluetoothGattService = gatt.getService(UART_SERVICE_UUID)
|
||||
if (service != null) {
|
||||
rxCharacteristic = service.getCharacteristic(UART_RX_CHARACTERISTIC_UUID)
|
||||
txCharacteristic = service.getCharacteristic(UART_TX_CHARACTERISTIC_UUID)
|
||||
}
|
||||
var writeRequest = false
|
||||
var writeCommand = false
|
||||
|
||||
rxCharacteristic?.let {
|
||||
val rxProperties: Int = it.properties
|
||||
writeRequest = rxProperties and BluetoothGattCharacteristic.PROPERTY_WRITE > 0
|
||||
writeCommand =
|
||||
rxProperties and BluetoothGattCharacteristic.PROPERTY_WRITE_NO_RESPONSE > 0
|
||||
|
||||
// Set the WRITE REQUEST type when the characteristic supports it.
|
||||
// This will allow to send long write (also if the characteristic support it).
|
||||
// In case there is no WRITE REQUEST property, this manager will divide texts
|
||||
// longer then MTU-3 bytes into up to MTU-3 bytes chunks.
|
||||
if (writeRequest) {
|
||||
it.writeType = BluetoothGattCharacteristic.WRITE_TYPE_DEFAULT
|
||||
} else {
|
||||
useLongWrite = false
|
||||
}
|
||||
}
|
||||
return rxCharacteristic != null && txCharacteristic != null && (writeRequest || writeCommand)
|
||||
}
|
||||
|
||||
override fun onDeviceDisconnected() {
|
||||
rxCharacteristic = null
|
||||
txCharacteristic = null
|
||||
useLongWrite = true
|
||||
}
|
||||
|
||||
override fun onServicesInvalidated() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
fun send(text: String) {
|
||||
// Are we connected?
|
||||
if (rxCharacteristic == null) return
|
||||
if (!TextUtils.isEmpty(text)) {
|
||||
val request: WriteRequest = writeCharacteristic(rxCharacteristic, text.toByteArray())
|
||||
.with { device, data ->
|
||||
log(
|
||||
LogContract.Log.Level.APPLICATION,
|
||||
"\"" + data.getStringValue(0).toString() + "\" sent"
|
||||
)
|
||||
}
|
||||
if (!useLongWrite) {
|
||||
// This will automatically split the long data into MTU-3-byte long packets.
|
||||
request.split()
|
||||
}
|
||||
request.enqueue()
|
||||
}
|
||||
}
|
||||
|
||||
override fun onBatteryLevelChanged(batteryLevel: Int) {
|
||||
dataHolder.emitNewBatteryLevel(batteryLevel)
|
||||
}
|
||||
|
||||
override fun getGattCallback(): BatteryManagerGattCallback {
|
||||
return UARTManagerGattCallback()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package no.nordicsemi.android.uart.repository
|
||||
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
import no.nordicsemi.android.service.ForegroundBleService
|
||||
import no.nordicsemi.android.uart.data.UARTDataHolder
|
||||
import javax.inject.Inject
|
||||
|
||||
@AndroidEntryPoint
|
||||
internal class UARTService : ForegroundBleService() {
|
||||
|
||||
@Inject
|
||||
lateinit var dataHolder: UARTDataHolder
|
||||
|
||||
override val manager: UARTManager by lazy { UARTManager(this, dataHolder) }
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
package no.nordicsemi.android.uart.view
|
||||
|
||||
class UARTContentView {
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package no.nordicsemi.android.uart.view
|
||||
|
||||
import androidx.compose.runtime.Composable
|
||||
|
||||
@Composable
|
||||
fun UARTScreen(finishAction: () -> Unit) {
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
package no.nordicsemi.android.uart.viewmodel
|
||||
|
||||
import no.nordicsemi.android.theme.viewmodel.CloseableViewModel
|
||||
|
||||
class UARTViewModel : CloseableViewModel() {
|
||||
}
|
||||
@@ -94,3 +94,4 @@ if (file('../Android-Common-Libraries').exists()) {
|
||||
//if (file('../Android-Scanner-Compat-Library').exists()) {
|
||||
// includeBuild('../Android-Scanner-Compat-Library')
|
||||
//}
|
||||
include ':profile_uart'
|
||||
|
||||
Reference in New Issue
Block a user