Skip to content

Commit 607f000

Browse files
ST BLE Sensor v 4.7.0 Source code
add ST WIN Support fix AWS Dashboard cloud provider
1 parent 3026be0 commit 607f000

389 files changed

Lines changed: 4658 additions & 3199 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitmodules

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1-
[submodule "BlueSTSDK"]
2-
path = BlueSTSDK
3-
url = https://github.com/STMicroelectronics/BlueSTSDK_Android.git
41
[submodule "BlueSTSDK_Gui_Android"]
52
path = BlueSTSDK_Gui_Android
6-
url = https://github.com/STMicroelectronics/BlueSTSDK_GUI_Android.git
3+
url = git@github.com:STMicroelectronics/BlueSTSDK_GUI_Android.git
4+
[submodule "BlueSTSDK"]
5+
path = BlueSTSDK
6+
url = git@github.com:STMicroelectronics/BlueSTSDK_Android.git
7+
[submodule "STWINBoard_GUI_Android"]
8+
path = STWINBoard_GUI_Android
9+
url = git@github.com:STMicroelectronics/STWINBoard_GUI_Android.git

BlueMS/build.gradle

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,9 @@
3636
*/
3737

3838
apply plugin: 'com.android.application'
39-
apply plugin: 'kotlin-android-extensions'
4039
apply plugin: 'kotlin-android'
40+
apply plugin: 'kotlin-android-extensions'
41+
apply plugin: 'com.google.android.gms.oss-licenses-plugin'
4142

4243
static def getDate() {
4344
def date = new Date()
@@ -63,8 +64,8 @@ android {
6364

6465
minSdkVersion rootProject.ext.minSdkVersion
6566
targetSdkVersion rootProject.ext.targetSdkVersion
66-
versionCode 40
67-
versionName '4.6.1'
67+
versionCode 46
68+
versionName '4.7.0'
6869
applicationId "com.st.bluems"
6970
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
7071
vectorDrawables.useSupportLibrary = true
@@ -113,7 +114,7 @@ android {
113114
}
114115

115116
kotlinOptions {
116-
jvmTarget = "1.8"
117+
jvmTarget = JavaVersion.VERSION_1_8.toString()
117118
}
118119

119120
packagingOptions {
@@ -122,7 +123,7 @@ android {
122123
}
123124

124125
ext {
125-
leakcanaryVersion = '1.6.3'
126+
leakcanaryVersion = '2.3'
126127
}
127128

128129
repositories {
@@ -153,6 +154,7 @@ dependencies {
153154
implementation project(':BlueSTSDK')
154155
implementation project(':BlueSTSDK_Gui_Android')
155156
implementation project(':BlueMSCloud')
157+
implementation project(path: ':STWINBoard_GUI_Android')
156158

157159
implementation 'com.github.PhilJay:MPAndroidChart:v3.1.0'
158160

@@ -183,18 +185,13 @@ dependencies {
183185
exclude group: 'com.google.code.findbugs', module: 'annotations'
184186
}
185187

186-
//use the v 3.11 to avoid chrash with ibm
188+
//use the v 3.11 to avoid crash with ibm
187189
implementation group: 'com.squareup.okhttp3', name: 'okhttp', version: '3.11.0'
188190

189-
// crashlytics
190-
implementation group: 'com.crashlytics.sdk.android', name: 'crashlytics', version: '2.10.1'
191-
//keep the 16.x to avoid android x to avoid new support library that will break the plot
192-
implementation group: 'com.google.firebase', name: 'firebase-core', version: '17.2.1'
191+
implementation 'com.google.android.gms:play-services-oss-licenses:17.0.0'
193192

194193
//memory leak detector
195194
debugImplementation group: 'com.squareup.leakcanary', name: 'leakcanary-android', version: "$leakcanaryVersion"
196-
releaseImplementation group: 'com.squareup.leakcanary', name: 'leakcanary-android-no-op', version: "$leakcanaryVersion"
197-
testImplementation group: 'com.squareup.leakcanary', name: 'leakcanary-android-no-op', version: "$leakcanaryVersion"
198195

199196
testImplementation group: 'org.json', name: 'json', version: '20140107'
200197
//since the json lib is inside the android sdk

BlueMS/proguard-rules.pro

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,25 @@
1616
# public *;
1717
#}
1818

19+
<<<<<<< HEAD
20+
-keep class com.androidplot.xy.** { *; }
21+
-keep class com.androidplot.ui.** { *; }
22+
23+
#retrofit proguard rules http://square.github.io/retrofit/
24+
# Platform calls Class.forName on types which do not exist on Android to determine platform.
25+
-dontnote retrofit2.Platform
26+
# Platform used when running on Java 8 VMs. Will not be used at runtime
27+
-dontwarn retrofit2.Platform$Java8
28+
# Retain generic type information for use by reflection by converters and adapters.
29+
-keepattributes Signature
30+
# Retain declared checked exceptions for use by a Proxy instance.
31+
-keepattributes Exceptions
32+
#retrofit 2.3 & co
33+
-dontwarn javax.annotation.**
34+
-dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
35+
=======
36+
>>>>>>> master
37+
1938
#ibm watson
2039
#keep the class member name to avoid problems with json to java objects
2140
-keepclassmembers class com.ibm.watson.speech_to_text.v1.** { <fields>; }
@@ -26,7 +45,12 @@
2645
#need for okhttp (audio websocket)
2746
# https://github.com/square/okhttp/blob/master/okhttp/src/main/resources/META-INF/proguard/okhttp3.pro
2847
# JSR 305 annotations are for embedding nullability information.
48+
<<<<<<< HEAD
49+
-dontwarn javax.annotation.**
50+
51+
=======
2952
#-dontwarn javax.annotation.**
53+
>>>>>>> master
3054
# A resource is loaded with a relative path so the package of this class must be preserved.
3155
#-keepnames class okhttp3.internal.publicsuffix.PublicSuffixDatabase
3256
# Animal Sniffer compileOnly dependency to ensure APIs are compatible with older versions of Java.

BlueMS/src/main/AndroidManifest.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,14 +66,14 @@
6666

6767
<service
6868
android:name=".demos.fftAmpitude.FFTExportedService"
69-
android:exported="false"></service>
69+
android:exported="false"/>
7070

7171
<activity
7272
android:name=".MainActivity"
7373
android:configChanges="keyboardHidden|screenSize"
7474
android:label="@string/app_name"
7575
android:launchMode="singleTop"
76-
android:theme="@style/FullscreenTheme">
76+
android:theme="@style/AppFullscreenTheme">
7777
<intent-filter>
7878
<action android:name="android.intent.action.MAIN" />
7979

18.6 KB
Loading

BlueMS/src/main/java/com/st/BlueMS/BlueMSApplication.java

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -38,24 +38,7 @@
3838

3939
import androidx.multidex.MultiDexApplication;
4040

41-
import com.squareup.leakcanary.LeakCanary;
4241

4342
public class BlueMSApplication extends MultiDexApplication {
4443

45-
private void initMemoryLeakDetector(){
46-
if (LeakCanary.isInAnalyzerProcess(this)) {
47-
// This process is dedicated to LeakCanary for heap analysis.
48-
// You should not init your app in this process.
49-
return;
50-
}
51-
LeakCanary.install(this);
52-
}
53-
54-
55-
@Override
56-
public void onCreate() {
57-
super.onCreate();
58-
initMemoryLeakDetector();
59-
}
60-
6144
}

BlueMS/src/main/java/com/st/BlueMS/DemosActivity.java

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
import com.st.BlueMS.demos.COSensor.COSensorDemoFragment;
5656
import com.st.BlueMS.demos.CarryPositionFragment;
5757
import com.st.BlueMS.demos.Cloud.CloudLogFragment;
58+
import com.st.BlueMS.demos.HighSpeedDataLog.HighSpeedDataLogFragment;
5859
import com.st.BlueMS.demos.Level.LevelDemoFragment;
5960
import com.st.BlueMS.demos.PredictiveMaintenance.PredictiveMaintenanceFragment;
6061
import com.st.BlueMS.demos.SDLog.SDLogFragment;
@@ -78,7 +79,6 @@
7879
import com.st.BlueMS.demos.multiNN.MultiNeuralNetworkFragment;
7980
import com.st.BlueMS.demos.plot.PlotFeatureFragment;
8081
import com.st.BlueMS.preference.nucleo.SettingsWithNucleoConfiguration;
81-
import com.st.BlueSTSDK.Debug;
8282
import com.st.BlueSTSDK.ExportedFeature;
8383
import com.st.BlueSTSDK.Features.Audio.Opus.ExportedFeatureAudioOpus;
8484
import com.st.BlueSTSDK.Node;
@@ -142,6 +142,7 @@ public static class LedButtonControlFragment extends com.st.STM32WB.p2pDemo.LedB
142142
*/
143143
@SuppressWarnings("unchecked")
144144
private final static Class<? extends DemoFragment>[] ALL_DEMOS = new Class[]{
145+
HighSpeedDataLogFragment.class,
145146
EnvironmentalSensorsFragment.class,
146147
MemsSensorFusionFragment.class,
147148
FFTAmplitudeFragment.class,
@@ -237,18 +238,22 @@ protected void onStart() {
237238
@Override
238239
public void onNotificationDisabled(@NonNull ExportedFeature onFeature) {
239240
Log.d("DEmoActivity","reload demos");
240-
reloadDemoList();
241+
runOnUiThread(()->{reloadDemoList();});
242+
241243
}
242244

243245
@Override
244246
public void onNotificationEnabled(@NonNull ExportedFeature onFeature) {
245247
Log.d("DEmoActivity","reload demos");
246-
reloadDemoList();
248+
runOnUiThread(()->{reloadDemoList();});
247249
}
248250
};
249251

250252
private void enableServerSideDemo() {
251-
NodeServer server = getNode().getNodeServer();
253+
Node node = getNode();
254+
if(node == null)
255+
return;
256+
NodeServer server = node.getNodeServer();
252257
if(server == null)
253258
return;
254259
ExportedFeature f = server.getExportedFeature(ExportedFeatureAudioOpus.class);
@@ -263,7 +268,10 @@ protected void onStop() {
263268
}
264269

265270
private void disableServerSideDemo() {
266-
NodeServer server = getNode().getNodeServer();
271+
Node node = getNode();
272+
if(node == null)
273+
return;
274+
NodeServer server = node.getNodeServer();
267275
if(server == null)
268276
return;
269277
ExportedFeature f = server.getExportedFeature(ExportedFeatureAudioOpus.class);

BlueMS/src/main/java/com/st/BlueMS/DemosActivityWesu.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737

3838
package com.st.BlueMS;
3939

40-
import android.app.AlertDialog;
40+
import androidx.appcompat.app.AlertDialog;
4141
import android.app.Dialog;
4242
import android.app.DialogFragment;
4343
import android.content.Context;

BlueMS/src/main/java/com/st/BlueMS/MainActivity.java

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
import android.view.ViewGroup;
5151
import android.widget.TextView;
5252

53+
import com.google.android.gms.oss.licenses.OssLicensesMenuActivity;
5354
import com.st.BlueSTSDK.gui.AboutActivity;
5455
import com.st.BlueSTSDK.gui.thirdPartyLibLicense.LibLicense;
5556

@@ -62,24 +63,6 @@
6263
*/
6364
public class MainActivity extends com.st.BlueSTSDK.gui.MainActivity {
6465

65-
private static final ArrayList<LibLicense> LIB_LICENSES = new ArrayList<>();
66-
static {
67-
LIB_LICENSES.add(new LibLicense("Android Design Support Library",R.raw.lic_android_support));
68-
LIB_LICENSES.add(new LibLicense("Android Support Library v13",R.raw.lic_android_support));
69-
LIB_LICENSES.add(new LibLicense("Android Annotations Support Library",R.raw.lic_android_support));
70-
LIB_LICENSES.add(new LibLicense("Android Support Card View Library",R.raw.lic_android_support));
71-
LIB_LICENSES.add(new LibLicense("Android Support Constraint Layout Library",R.raw.lic_android_support));
72-
LIB_LICENSES.add(new LibLicense("Android Support AppCompat Library",R.raw.lic_android_support));
73-
LIB_LICENSES.add(new LibLicense("Android Support GridLayout Library",R.raw.lic_android_support));
74-
LIB_LICENSES.add(new LibLicense("Android Support RecyclerView Library",R.raw.lic_android_support));
75-
LIB_LICENSES.add(new LibLicense("BlueSTSDK",R.raw.lic_bluestsdk));
76-
LIB_LICENSES.add(new LibLicense("BlueSTSDK Gui",R.raw.lic_bluestsdk_gui));
77-
LIB_LICENSES.add(new LibLicense("IBM Watson Cloud",R.raw.lic_ibm_watson_cloud));
78-
LIB_LICENSES.add(new LibLicense("Paho",R.raw.lic_paho));
79-
LIB_LICENSES.add(new LibLicense("Play Services Base",R.raw.lic_android_support));
80-
}
81-
82-
8366
private static final String ABOUT_PAGE_URL = "file:///android_asset/about.html";
8467

8568
@Override
@@ -90,7 +73,8 @@ public void startScanBleActivity(View view) {
9073
@Override
9174
public void startAboutActivity(View view) {
9275
URL privacyPage = getPrivacyPolicyUrl();
93-
AboutActivity.startActivityWithAboutPage(this,ABOUT_PAGE_URL,privacyPage,LIB_LICENSES);
76+
Intent licenseIntent = new Intent(this, OssLicensesMenuActivity.class);
77+
AboutActivity.startActivityWithAboutPage(this,ABOUT_PAGE_URL,privacyPage,licenseIntent);
9478
}
9579

9680
@Override

BlueMS/src/main/java/com/st/BlueMS/NodeListActivity.java

Lines changed: 48 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@
3838
package com.st.BlueMS;
3939

4040

41+
import android.content.SharedPreferences;
42+
import android.preference.PreferenceManager;
43+
import android.widget.Toast;
44+
4145
import androidx.annotation.NonNull;
4246

4347
import com.st.BlueNRG.fwUpgrade.BlueNRGAdvertiseFilter;
@@ -48,6 +52,7 @@
4852
import com.st.BlueSTSDK.Utils.ConnectionOption;
4953
import com.st.BlueSTSDK.Utils.advertise.AdvertiseFilter;
5054
import com.st.BlueSTSDK.gui.fwUpgrade.FwUpgradeActivity;
55+
import com.st.BlueSTSDK.gui.util.SimpleFragmentDialog;
5156
import com.st.STM32WB.fwUpgrade.FwUpgradeSTM32WBActivity;
5257
import com.st.STM32WB.fwUpgrade.feature.STM32OTASupport;
5358
import com.st.STM32WB.p2pDemo.Peer2PeerDemoConfiguration;
@@ -87,18 +92,58 @@ public void onNodeSelected(@NonNull Node n) {
8792

8893
ConnectionOption options = optionsBuilder.build();
8994

90-
n.enableNodeServer(BLENodeDefines.FeatureCharacteristics.getDefaultExportedFeature());
95+
//disable the ble server for sensor tile box, to improve stability for the fw upgrade.
96+
// it is not clear why.. and probably is not the root cause
97+
if(n.getType() != Node.Type.SENSOR_TILE_BOX) {
98+
try {
99+
n.enableNodeServer(BLENodeDefines.FeatureCharacteristics.getDefaultExportedFeature());
100+
} catch (IllegalStateException e) {
101+
Toast.makeText(this, R.string.nodeList_serverNotStarted, Toast.LENGTH_SHORT).show();
102+
}
103+
}
104+
105+
91106

92107
if(n.getAdvertiseInfo() instanceof BlueNRGAdvertiseFilter.BlueNRGAdvertiseInfo)
93108
startActivity(FwUpgradeActivity.getStartIntent(this, n,false,options));
94109
else if(n.getType()== Node.Type.STEVAL_WESU1)
95110
startActivity(DemosActivityWesu.getStartIntent(this,n,options));
96-
else if (STM32OTASupport.isOTANode(n)){
97-
startActivity(FwUpgradeSTM32WBActivity.getStartIntent(this, n,null,null,null));
111+
else if (STM32OTASupport.isOTANode(n)) {
112+
startActivity(FwUpgradeSTM32WBActivity.getStartIntent(this, n, null, null, null));
113+
}else if (n.getType() == Node.Type.SENSOR_TILE_BOX){
114+
displayPinWarningsAndConnect(n,options);
98115
}else {
99116
startActivity(DemosActivity.getStartIntent(this, n, options));
100117
}
101118

102119
}
103120

121+
122+
private void displayPinWarningsAndConnect(Node node, ConnectionOption options){
123+
if(stBoxPinDialogNeedToBeShown()){
124+
displayPinWarnings(node,options);
125+
}else{
126+
startActivity(DemosActivity.getStartIntent(this, node, options));
127+
}
128+
}
129+
130+
private static final String STBOX_PIN_DIALOG_SHOWN = NodeListActivity.class.getCanonicalName()+".STBOX_PIN_DIALOG_SHOWN";
131+
private static final String STBOX_PIN_DIALOG_SHOWN_TAG = NodeListActivity.class.getCanonicalName()+".STBOX_PIN_DIALOG_SHOWN_TAG";
132+
133+
private boolean stBoxPinDialogNeedToBeShown(){
134+
final SharedPreferences prefs= PreferenceManager.getDefaultSharedPreferences(this);
135+
return !prefs.contains(STBOX_PIN_DIALOG_SHOWN);
136+
}
137+
138+
private void displayPinWarnings(Node node, ConnectionOption options) {
139+
SimpleFragmentDialog dialog = SimpleFragmentDialog.newInstance(R.string.nodeList_stbox_pinTitle,R.string.nodeList_stbox_pinDesc);
140+
dialog.show(getSupportFragmentManager(),STBOX_PIN_DIALOG_SHOWN_TAG);
141+
dialog.setOnclickListener((dialogInterface, i) -> {
142+
PreferenceManager.getDefaultSharedPreferences(this).edit()
143+
.putBoolean(STBOX_PIN_DIALOG_SHOWN,true)
144+
.apply();
145+
startActivity(DemosActivity.getStartIntent(dialog.getContext(), node, options));
146+
});
147+
}
148+
104149
}//NodeListActivity

0 commit comments

Comments
 (0)