Skip to content

Commit dd2fdde

Browse files
committed
Aligin with BlueST-SDK-V1.2.8
Signed-off-by: Luca Pezzoni <[email protected]>
1 parent a63af45 commit dd2fdde

File tree

23 files changed

+114
-61
lines changed

23 files changed

+114
-61
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Module for creating the BlueST-SDK library
44

55
## For using it
66

7-
Code compiled using gradle 8.7 and JDK 17.0.11
7+
Code compiled using gradle 8.9
88

99
set on Gradle properties the Github Login name and SSO authentication
1010
Example:

app/build.gradle.kts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,18 @@ plugins {
1717

1818
android {
1919
namespace = "com.st.demo"
20-
compileSdk = 34
20+
compileSdk = 35
2121

2222
defaultConfig {
2323
applicationId = "com.st.demo"
2424
minSdk = 26
25-
targetSdk = 34
26-
versionCode = 7
27-
versionName = "5.2.5"
25+
targetSdk = 35
26+
versionCode = 8
27+
versionName = "5.2.6"
2828

2929
vectorDrawables { useSupportLibrary = true }
3030

31-
manifestPlaceholders["appAuthRedirectScheme"] = "stdemo"
31+
manifestPlaceholders["appAuthRedirectScheme"] = "com.st.demo"
3232
}
3333

3434
hilt {
@@ -47,8 +47,8 @@ android {
4747
}
4848

4949
compileOptions {
50-
sourceCompatibility = JavaVersion.VERSION_17
51-
targetCompatibility = JavaVersion.VERSION_17
50+
sourceCompatibility = JavaVersion.VERSION_21
51+
targetCompatibility = JavaVersion.VERSION_21
5252
}
5353

5454
buildFeatures {

app/src/main/AndroidManifest.xml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
~ the root directory of this software component.
66
~ If no LICENSE file comes with this software, it is provided AS-IS.
77
-->
8-
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
8+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
9+
xmlns:tools="http://schemas.android.com/tools">
910

1011
<uses-permission android:name="android.permission.RECORD_AUDIO" />
1112

@@ -16,6 +17,7 @@
1617
android:label="@string/app_name"
1718
android:roundIcon="@mipmap/ic_launcher_round"
1819
android:supportsRtl="true"
20+
tools:targetApi="35"
1921
android:theme="@style/Theme.StDemo">
2022
<activity
2123
android:name="com.st.demo.MainActivity"

app/src/main/java/com/st/demo/MainActivity.kt

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,18 @@
77
*/
88
package com.st.demo
99

10+
import android.graphics.Color
11+
import android.os.Build
1012
import android.os.Bundle
1113
import androidx.activity.ComponentActivity
14+
import androidx.activity.SystemBarStyle
1215
import androidx.activity.compose.setContent
16+
import androidx.activity.enableEdgeToEdge
17+
import androidx.compose.foundation.layout.Box
18+
import androidx.compose.foundation.layout.consumeWindowInsets
19+
import androidx.compose.foundation.layout.safeDrawingPadding
1320
import androidx.compose.runtime.Composable
21+
import androidx.compose.ui.Modifier
1422
import androidx.hilt.navigation.compose.hiltViewModel
1523
import androidx.navigation.NavType
1624
import androidx.navigation.compose.NavHost
@@ -27,19 +35,31 @@ import dagger.hilt.android.AndroidEntryPoint
2735
@AndroidEntryPoint
2836
class MainActivity : ComponentActivity() {
2937
override fun onCreate(savedInstanceState: Bundle?) {
38+
39+
enableEdgeToEdge(statusBarStyle = SystemBarStyle.light(Color.TRANSPARENT,Color.TRANSPARENT),
40+
navigationBarStyle = SystemBarStyle.light(Color.TRANSPARENT,Color.TRANSPARENT))
41+
42+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
43+
window.isNavigationBarContrastEnforced = false
44+
}
45+
3046
super.onCreate(savedInstanceState)
47+
3148
setContent {
49+
Box(Modifier.safeDrawingPadding()) {
3250
MainScreen()
3351
}
3452
}
3553
}
54+
}
3655

3756
@Composable
3857
private fun MainScreen() {
3958
val navController = rememberNavController()
4059

4160
StDemoTheme {
42-
NavHost(navController = navController, startDestination = "list") {
61+
NavHost(
62+
navController = navController, startDestination = "list") {
4363

4464
composable(route = "list") {
4565
BleDeviceList(

app/src/main/java/com/st/demo/ui/theme/Theme.kt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,14 @@ private val LightColorScheme = lightColorScheme(
2323

2424
@Composable
2525
fun StDemoTheme(content: @Composable () -> Unit) {
26-
val view = LocalView.current
26+
// val view = LocalView.current
2727

28-
if (!view.isInEditMode) {
29-
SideEffect {
30-
(view.context as Activity).window.statusBarColor = LightColorScheme.primary.toArgb()
31-
ViewCompat.getWindowInsetsController(view)?.isAppearanceLightStatusBars = false
32-
}
33-
}
28+
// if (!view.isInEditMode) {
29+
// SideEffect {
30+
// (view.context as Activity).window.statusBarColor = LightColorScheme.primary.toArgb()
31+
// ViewCompat.getWindowInsetsController(view)?.isAppearanceLightStatusBars = false
32+
// }
33+
// }
3434

3535
MaterialTheme(
3636
colorScheme = LightColorScheme,

app/src/main/res/values/themes.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@
77
-->
88
<resources>
99
<!-- Base application theme. -->
10-
<style name="Theme.StDemo" parent="Theme.MaterialComponents.DayNight.DarkActionBar"/>
10+
<style name="Theme.StDemo" parent="Theme.Material3.Light"/>
1111

1212
<style name="Theme.StDemo.NoActionBar">
1313
<item name="windowActionBar">false</item>
1414
<item name="windowNoTitle">true</item>
1515
</style>
1616

17-
<style name="Theme.StDemo.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
17+
<style name="Theme.StDemo.AppBarOverlay" parent="ThemeOverlay.AppCompat.Light" />
1818

1919
<style name="Theme.StDemo.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
2020
</resources>

gradle.properties

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ kotlin.code.style=official
3030
# resources declared in the library itself and none from the library's dependencies,
3131
# thereby reducing the size of the R class for that library
3232
android.nonTransitiveRClass=true
33-
android.defaults.buildfeatures.buildconfig=true
3433
android.nonFinalResIds=false
3534

3635
GPR_USER=UserName

gradle/libs.versions.toml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,26 +8,26 @@
88
[versions]
99
# @pin https://github.com/google/accompanist#compose-versions
1010
accompanist = "0.36.0"
11-
androidGradlePlugin = "8.5.2"
11+
androidGradlePlugin = "8.7.3"
1212
# @pin https://developer.android.com/jetpack/androidx/releases/compose#versions
13-
androidxComposeBom = "2024.09.01"
13+
androidxComposeBom = "2024.11.00"
1414
androidxEspresso = "3.6.0-rc01"
1515
androidxHiltNavigationCompose = "1.2.0"
1616
# https://issuetracker.google.com/issues/336842920
1717
# @pin
18-
androidxLifecycle = "2.8.5"
19-
androidxNavigation = "2.8.0"
18+
androidxLifecycle = "2.8.7"
19+
androidxNavigation = "2.8.4"
2020
androidxRoom = "2.6.1"
2121
apacheCommons = "3.11.1"
2222
appauth = "0.11.1"
2323
benManes = "0.51.0"
24-
hilt = "2.52"
24+
hilt = "2.53"
2525
jwt = "2.0.2"
2626
# @pin https://developer.android.com/jetpack/androidx/releases/compose-kotlin
27-
kotlin = "2.0.10"
28-
kotlinxSerializationJson = "1.7.2"
27+
kotlin = "2.0.20"
28+
kotlinxSerializationJson = "1.7.3"
2929
# @pin
30-
ksp = "2.0.10-1.0.24"
30+
ksp = "2.0.20-1.0.25"
3131
littlerobots = "0.8.4"
3232
material2 = "1.12.0"
3333
okhttp = "4.12.0"
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#Thu Aug 03 14:09:11 CEST 2023
22
distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
4-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
4+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
55
zipStoreBase=GRADLE_USER_HOME
66
zipStorePath=wrapper/dists

st_blue_sdk/build.gradle.kts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ apply {
2020

2121
android {
2222
namespace = "com.st.blue_sdk"
23-
compileSdk = 34
23+
compileSdk = 35
2424

2525
defaultConfig {
2626
minSdk = 26
@@ -94,8 +94,8 @@ android {
9494
}
9595

9696
compileOptions {
97-
sourceCompatibility = JavaVersion.VERSION_17
98-
targetCompatibility = JavaVersion.VERSION_17
97+
sourceCompatibility = JavaVersion.VERSION_21
98+
targetCompatibility = JavaVersion.VERSION_21
9999
}
100100

101101
buildFeatures {

st_blue_sdk/publish.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ apply plugin: 'maven-publish'
1010

1111
def LIB_GROUP_ID = 'com.st.blue.sdk'
1212
def LIB_ARTIFACT_ID = 'st-blue-sdk'
13-
def LIB_VERSION = '1.2.4'
13+
def LIB_VERSION = '1.2.8'
1414

1515
tasks.register('sourceJar', Jar) {
1616
from android.sourceSets.main.java.srcDirs

st_blue_sdk/src/main/java/com/st/blue_sdk/BlueManager.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,8 @@ interface BlueManager {
9191
timeout: Long = 2000
9292
): List<FeatureUpdate<*>>
9393

94+
fun hasBleDebugService(nodeId: String) : Boolean
95+
9496
suspend fun writeDebugMessage(nodeId: String, msg: String): Boolean
9597

9698
fun getConfigControlUpdates(nodeId: String): Flow<FeatureResponse>

st_blue_sdk/src/main/java/com/st/blue_sdk/BlueManagerImpl.kt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -426,6 +426,12 @@ class BlueManagerImpl @Inject constructor(
426426
return service.writeDebugMessage(msg)
427427
}
428428

429+
override fun hasBleDebugService(nodeId: String): Boolean {
430+
val service = nodeServiceConsumer.getNodeService(nodeId)
431+
?: throw IllegalStateException("Unable to find NodeService for $nodeId")
432+
return service.debugService.hasBleDebugService()
433+
}
434+
429435
override fun getConfigControlUpdates(nodeId: String): Flow<FeatureResponse> {
430436

431437
val service = nodeServiceConsumer.getNodeService(nodeId)

st_blue_sdk/src/main/java/com/st/blue_sdk/board_catalog/BoardCatalogRepoImpl.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ class BoardCatalogRepoImpl @Inject constructor(
173173
else
174174
api.getFirmwares()
175175

176-
if(url != null) {
176+
if (url != null && url?.contains("SW-Platforms") == true) {
177177
//We need to change the fw_url... for pointing to Pre-Production
178178
firmwares.bleListBoardFirmwareV1?.forEach { firmware ->
179179
if(firmware.fota.fwUrl!=null) {

st_blue_sdk/src/main/java/com/st/blue_sdk/board_catalog/api/di/ApiModule.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ object ApiModule {
5252
applicationContext.packageName,
5353
0
5454
)
55-
}.versionName.replaceAfterLast('.',"0")
55+
}.versionName?.replaceAfterLast('.',"0") ?: "1.0.0"
5656

5757
@RetrofitBasePath
5858
@Provides

st_blue_sdk/src/main/java/com/st/blue_sdk/features/extended/raw_controlled/RawControlled.kt

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,10 @@ fun readRawPnPLFormat(
140140
} else {
141141
val customString =
142142
(singleEntry.value as JsonPrimitive).content
143-
val jsonDec = Json { encodeDefaults = true }
143+
val jsonDec = Json {
144+
encodeDefaults = true
145+
ignoreUnknownKeys = true
146+
}
144147
customFormat =
145148
try {
146149
jsonDec.decodeFromString<RawCustom>(customString)
@@ -158,8 +161,14 @@ fun readRawPnPLFormat(
158161
propertyName = RawControlled.PROPERTY_NAME_ST_BLE_STREAM,
159162
fieldName = name
160163
)
164+
165+
val jsonDec = Json {
166+
encodeDefaults = true
167+
ignoreUnknownKeys = true
168+
}
169+
161170
val format =
162-
Json.decodeFromJsonElement<RawPnPLEntryFormat>(
171+
jsonDec.decodeFromJsonElement<RawPnPLEntryFormat>(
163172
singleEntry.value
164173
)
165174

@@ -169,7 +178,10 @@ fun readRawPnPLFormat(
169178
val customString =
170179
(singleEntry.value as JsonObject)["labels"]?.jsonPrimitive?.content
171180
customString?.let {
172-
val jsonDec = Json { encodeDefaults = true }
181+
val jsonDec = Json {
182+
encodeDefaults = true
183+
ignoreUnknownKeys = true
184+
}
173185
val labelsParsed =
174186
//try {
175187
jsonDec.decodeFromString<List<RawPnPLEntryEnumLabel>>(

st_blue_sdk/src/main/java/com/st/blue_sdk/features/extended/scene_description/SceneDescription.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class SceneDescription(
1818
) {
1919
companion object {
2020

21-
const val NAME = "Navigation Control"
21+
const val NAME = "Scene Description"
2222
const val NUMBER_BYTES = 2
2323
}
2424

st_blue_sdk/src/main/java/com/st/blue_sdk/models/Boards.kt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,10 @@ object Boards {
7575
WB1M_DISCOVERY_BOARD, //0x85
7676
WBA5X_NUCLEO_BOARD, //0x8B
7777
WBA_DISCOVERY_BOARD, //0x8C
78+
WBA6_NUCLEO_BOARD, //0x8E
7879

7980
/** Nucleo with STM32WB0X */
80-
WB0X_NUCLEO_BOARD,
81+
WB0X_NUCLEO_BOARD, //0x8D
8182

8283
/** NUCLEO boards */
8384
NUCLEO, NUCLEO_F401RE, NUCLEO_L476RG, NUCLEO_L053R8, NUCLEO_F446RE,NUCLEO_U575ZIQ,NUCLEO_U5A5ZJQ
@@ -136,6 +137,7 @@ object Boards {
136137

137138
Model.WBA5X_NUCLEO_BOARD,
138139
Model.WBA_DISCOVERY_BOARD,
140+
Model.WBA6_NUCLEO_BOARD,
139141
-> Family.WBA_FAMILY
140142

141143
Model.WB0X_NUCLEO_BOARD,
@@ -176,6 +178,7 @@ object Boards {
176178
0x7B -> Model.NUCLEO_U575ZIQ
177179
0x7A -> Model.NUCLEO_U5A5ZJQ
178180
0x8D -> Model.WB0X_NUCLEO_BOARD
181+
0x8E -> Model.WBA6_NUCLEO_BOARD
179182
else -> {
180183
if (temp in 0x81..0x8A) {
181184
Model.WB55_NUCLEO_BOARD
@@ -224,9 +227,8 @@ object Boards {
224227
0x85 -> Model.WB1M_DISCOVERY_BOARD
225228
0x8B -> Model.WBA5X_NUCLEO_BOARD
226229
0x8C -> Model.WBA_DISCOVERY_BOARD
227-
228230
0x8D -> Model.WB0X_NUCLEO_BOARD
229-
231+
0x8E -> Model.WBA6_NUCLEO_BOARD
230232

231233
else -> Model.GENERIC
232234
}

st_blue_sdk/src/main/java/com/st/blue_sdk/models/OTAMemoryLayout.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
package com.st.blue_sdk.models
99

1010
data class OTAMemoryLayout(
11-
val fistSector: Short,
11+
val firstSector: Short,
1212
val nSector: Short,
1313
val sectorSize: Short
1414
)

st_blue_sdk/src/main/java/com/st/blue_sdk/services/ota/OtaServiceImpl.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,8 @@ class OtaServiceImpl @Inject constructor(
178178
Boards.Model.WB1M_DISCOVERY_BOARD -> STM32WB_NEW_FW_UPGRADE_PROTOCOL
179179

180180
Boards.Model.WBA5X_NUCLEO_BOARD,
181-
Boards.Model.WBA_DISCOVERY_BOARD-> STM32WBA_NEW_FW_UPGRADE_PROTOCOL
181+
Boards.Model.WBA_DISCOVERY_BOARD,
182+
Boards.Model.WBA6_NUCLEO_BOARD-> STM32WBA_NEW_FW_UPGRADE_PROTOCOL
182183

183184
Boards.Model.WB0X_NUCLEO_BOARD -> STM32WB0X_NEW_FW_UPGRADE_PROTOCOL
184185

st_blue_sdk/src/main/java/com/st/blue_sdk/services/ota/characteristic/CharacteristicFwUpgrade.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,9 @@ class CharacteristicFwUpgrade(
323323
maxPacketLength = 244
324324
}
325325

326+
Log.d(TAG, "maxPacketLength = $maxPacketLength")
327+
328+
326329
while (uploadedData < fileSize) {
327330

328331
val writtenDataCount = transferFwFile(

0 commit comments

Comments
 (0)