Skip to content

Commit

Permalink
Align with ST BLE Sensor V5.2.1
Browse files Browse the repository at this point in the history
Signed-off-by: Luca Pezzoni <luca.pezzoni@st.com>
  • Loading branch information
PezzoniL committed Mar 1, 2024
1 parent b76b16e commit 10eb1a6
Show file tree
Hide file tree
Showing 245 changed files with 8,991 additions and 1,178 deletions.
4 changes: 2 additions & 2 deletions README.md
Expand Up @@ -5,7 +5,7 @@ Application ST BLE Sensors

# Compilation

Code compiled using gradle 8.2.1 and JDK jbr-17
Code compiled using gradle 8.2.1 and JDK 17.0.7

set on Gradle properties the Github Login name and SSO authentication
Example:
Expand All @@ -16,7 +16,7 @@ GPR_API_KEY=XXXXXXXXXXXXXXXXXXXXXXXX
For using this application is necessary to downlaod the Android BlueST-SDK from:
https://github.com/STMicroelectronics/BlueSTSDK_Android

tag BlueST-SDK_V1.1.0
tag BlueST-SDK_V1.1.3

and follow the instruction for compiling and publish on local maven repository the 2 libraries necessary for this application:
* st-blue-sdk
Expand Down
16 changes: 14 additions & 2 deletions app/build.gradle
Expand Up @@ -25,17 +25,26 @@ android {
applicationId "com.st.bluems"
minSdk rootProject.minSdk
targetSdk rootProject.targetSdk
versionCode 180
versionName "5.2.0"
versionCode 191
versionName "5.2.1"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables {
useSupportLibrary true
}


manifestPlaceholders = [
'appAuthRedirectScheme': 'stblesensor'
]

buildConfigField(
"String",
"VESPUCCI_ENVIRONMENT",
// "\"DEV\""
// "\"PRE_PROD\""
"\"PROD\""
)
}

buildTypes {
Expand All @@ -45,6 +54,7 @@ android {
}
}
compileOptions {
coreLibraryDesugaringEnabled true
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}
Expand Down Expand Up @@ -108,6 +118,8 @@ dependencies {
// Blue ST SDK
implementation "com.st.blue.sdk:st-blue-sdk:$st_version"

coreLibraryDesugaring "com.android.tools:desugar_jdk_libs:$desugaring_version"

// Hilt
implementation "androidx.hilt:hilt-navigation-fragment:$hilt_navigation_fragment_version"
implementation "com.google.dagger:hilt-android:$hilt_version"
Expand Down
Binary file removed app/src/.DS_Store
Binary file not shown.
24 changes: 20 additions & 4 deletions app/src/main/java/com/st/bluems/di/BlueMsModule.kt
@@ -1,12 +1,15 @@
package com.st.bluems.di

import android.net.Uri
import com.st.bluems.BuildConfig
import com.st.bluems.util.ENVIRONMENT
import com.st.login.STLoginConfig
import dagger.Module
import dagger.Provides
import dagger.hilt.InstallIn
import dagger.hilt.components.SingletonComponent
import dagger.multibindings.IntKey
import dagger.multibindings.IntoMap
import dagger.multibindings.StringKey

@InstallIn(SingletonComponent::class)
@Module(includes = [BlueMsModule.WithProvides::class])
Expand All @@ -18,9 +21,22 @@ abstract class BlueMsModule {

@Provides
@IntoMap
@IntKey(0)
fun provideRedirectUri(): Uri {
return Uri.parse("stblesensor://callback")
@StringKey("stLoginConfig")
fun provideSTLoginConfig(): STLoginConfig {
return STLoginConfig(
Uri.parse("stblesensor://callback"),
if (BuildConfig.VESPUCCI_ENVIRONMENT != ENVIRONMENT.DEV.name) {
com.st.login.R.raw.prod_auth_config_vespucci
} else {
com.st.login.R.raw.dev_auth_config_vespucci
},
if (BuildConfig.VESPUCCI_ENVIRONMENT != ENVIRONMENT.DEV.name) {
Uri.parse("https://www.st.com/cas/logout?service=https%3A%2F%2Fvespucci.st.com%2Fsvc%2Fwebtomobile%2Fstblesensor")
} else {
Uri.parse("")
},
BuildConfig.VESPUCCI_ENVIRONMENT == ENVIRONMENT.PROD.name
)
}
}
}
Expand Up @@ -21,17 +21,20 @@ import androidx.compose.ui.window.Dialog
import com.st.blue_sdk.models.ConnectionStatus
import com.st.blue_sdk.models.NodeState
import com.st.bluems.R
import com.st.ui.theme.BlueMSTheme
import com.st.ui.theme.LocalDimensions
import com.st.ui.theme.PreviewBlueMSTheme
import com.st.ui.theme.Grey6
import com.st.ui.theme.WarningText

@Composable
fun ConnectionStatusDialog(
isPairingRequest: Boolean = false,
connectionStatus: ConnectionStatus,
boardName: String
) {
when (connectionStatus.current) {
NodeState.Connecting -> NodeConnectingDialog(boardName)
NodeState.Connecting -> NodeConnectingDialog(boardName, isPairingRequest)
NodeState.Connected -> NodeConnectedDialog(boardName)
NodeState.Disconnecting -> NodeDisconnectingDialog(boardName)
NodeState.ServicesDiscovered -> Unit
Expand All @@ -41,7 +44,7 @@ fun ConnectionStatusDialog(
}

@Composable
fun NodeConnectingDialog(boardName: String) {
fun NodeConnectingDialog(boardName: String, isPairingRequest: Boolean = false) {
Dialog(onDismissRequest = { /** NOOP **/ }) {
Surface(modifier = Modifier.fillMaxWidth()) {
Column(
Expand All @@ -57,6 +60,18 @@ fun NodeConnectingDialog(boardName: String) {

Spacer(modifier = Modifier.height(height = LocalDimensions.current.paddingLarge))

if (isPairingRequest) {
Text(
modifier = Modifier
.padding(bottom = LocalDimensions.current.paddingMedium)
.fillMaxWidth(),
textAlign = TextAlign.Center,
style = MaterialTheme.typography.titleMedium,
color = WarningText,
text = "Default PIN 123456"
)
}

LinearProgressIndicator(modifier = Modifier.fillMaxWidth(1f))

Spacer(modifier = Modifier.height(height = LocalDimensions.current.paddingLarge))
Expand All @@ -65,7 +80,10 @@ fun NodeConnectingDialog(boardName: String) {
textAlign = TextAlign.Center,
style = MaterialTheme.typography.bodyMedium,
color = Grey6,
text = stringResource(id = R.string.st_home_connectionStatus_connectingDescription,boardName)
text = stringResource(
id = R.string.st_home_connectionStatus_connectingDescription,
boardName
)
)
}
}
Expand Down Expand Up @@ -97,7 +115,10 @@ fun NodeConnectedDialog(boardName: String) {
textAlign = TextAlign.Center,
style = MaterialTheme.typography.bodyMedium,
color = Grey6,
text = stringResource(id = R.string.st_home_connectionStatus_connectedDescription,boardName)
text = stringResource(
id = R.string.st_home_connectionStatus_connectedDescription,
boardName
)
)
}
}
Expand Down Expand Up @@ -129,7 +150,10 @@ fun NodeDisconnectingDialog(boardName: String) {
textAlign = TextAlign.Center,
style = MaterialTheme.typography.bodyMedium,
color = Grey6,
text = stringResource(id = R.string.st_home_connectionStatus_disconnectingDescription,boardName)
text = stringResource(
id = R.string.st_home_connectionStatus_disconnectingDescription,
boardName
)
)
}
}
Expand Down
13 changes: 13 additions & 0 deletions app/src/main/java/com/st/bluems/ui/composable/DeviceList.kt
Expand Up @@ -70,6 +70,7 @@ fun DeviceListScreen(
val isServerForced by viewModel.isServerForced.collectAsStateWithLifecycle()
val pinnedDevices by viewModel.pinnedDevices.collectAsStateWithLifecycle(emptyList())
val boardsDescription by viewModel.boardsDescription.collectAsStateWithLifecycle()
val disableHiddenDemos by viewModel.disableHiddenDemos.collectAsStateWithLifecycle()


val nfcNodeId by nfcViewModel.nfcNodeId.collectAsStateWithLifecycle()
Expand All @@ -95,6 +96,10 @@ fun DeviceListScreen(
isExpert = isExpert,
isServerForced = isServerForced,
isBetaRelease = isBetaRelease,
disableHiddenDemos = disableHiddenDemos,
enableDisableHiddenDemos = {
viewModel.enableDisableHiddenDemos()
},
login = {
viewModel.login()
},
Expand Down Expand Up @@ -206,6 +211,8 @@ fun DeviceListWithPermissionsCheck(
isExpert: Boolean = false,
isServerForced: Boolean = false,
isBetaRelease: Boolean = false,
disableHiddenDemos: Boolean = false,
enableDisableHiddenDemos: () -> Unit = { /** NOOP **/ },
devices: List<Node>,
pinnedDevices: List<String>,
onPinChange: (String, Boolean) -> Unit,
Expand Down Expand Up @@ -270,6 +277,8 @@ fun DeviceListWithPermissionsCheck(
isExpert = isExpert,
isServerForced = isServerForced,
isBetaRelease = isBetaRelease,
disableHiddenDemos = disableHiddenDemos,
enableDisableHiddenDemos = enableDisableHiddenDemos,
login = login,
logout = logout,
goToProfile = goToProfile,
Expand Down Expand Up @@ -439,6 +448,8 @@ fun DeviceList(
isExpert: Boolean = false,
isServerForced: Boolean = false,
isBetaRelease: Boolean = false,
disableHiddenDemos: Boolean = false,
enableDisableHiddenDemos: () -> Unit = { /** NOOP **/ },
isLoading: Boolean = false,
pinnedDevices: List<String>,
onPinChange: (String, Boolean) -> Unit,
Expand Down Expand Up @@ -504,6 +515,8 @@ fun DeviceList(
isExpert = isExpert,
isServerForced = isServerForced,
isBetaRelease = isBetaRelease,
disableHiddenDemos = disableHiddenDemos,
enableDisableHiddenDemos = enableDisableHiddenDemos,
login = login,
logout = logout,
goToProfile = goToProfile,
Expand Down
Expand Up @@ -158,12 +158,12 @@ fun DeviceListItem(
text = stringResource(id = com.st.bluems.R.string.st_home_deviceListItem_fwCustomLabel)
)
} else {
catalogInfo?.maturity?.let { maturity ->
if(maturity!=FirmwareMaturity.RELEASE) {
if (catalogInfo != null) {
if(catalogInfo.maturity!=FirmwareMaturity.RELEASE) {
Text(
modifier = Modifier.padding(all = LocalDimensions.current.paddingNormal),
color = ErrorText,
text = "$maturity FW"
text = "${catalogInfo.maturity} FW"
)
}
}
Expand Down
14 changes: 14 additions & 0 deletions app/src/main/java/com/st/bluems/ui/composable/MainTopBar.kt
Expand Up @@ -46,6 +46,8 @@ fun MainTopBar(
isExpert: Boolean = false,
isServerForced: Boolean = false,
isBetaRelease: Boolean = false,
disableHiddenDemos: Boolean = false,
enableDisableHiddenDemos: () -> Unit = { /** NOOP **/ },
login: () -> Unit = { /** NOOP **/ },
logout: () -> Unit = { /** NOOP **/ },
onAddCatalogEntryFromFile: () -> Unit = { /** NOOP **/ }
Expand Down Expand Up @@ -104,6 +106,18 @@ fun MainTopBar(
Text(text = "Read Release Catalog", modifier = Modifier.clickable {
readReleaseCatalog()
})

Spacer(modifier = Modifier.height(height = LocalDimensions.current.paddingNormal))

if (disableHiddenDemos) {
Text(text = "Hide Removed Demos", modifier = Modifier.clickable {
enableDisableHiddenDemos()
})
} else {
Text(text = "Show Removed Demos", modifier = Modifier.clickable {
enableDisableHiddenDemos()
})
}
} else {
Text(
text = "v${BuildConfig.VERSION_NAME} [Stable]",
Expand Down

0 comments on commit 10eb1a6

Please sign in to comment.