Skip to content

Commit e8d1d18

Browse files
ST BLE Sensor v3.4 source code
add predictive mantenance demos add support for BlueNRG1/2 OTA add support for the opus codec
1 parent ced567e commit e8d1d18

149 files changed

Lines changed: 4197 additions & 1809 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: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[submodule "BlueSTSDK"]
22
path = BlueSTSDK
3-
url = https://github.com/STMicroelectronics-CentralLabs/BlueSTSDK_Android.git
3+
url = https://github.com/STMicroelectronics/BlueSTSDK_Android.git
44
[submodule "BlueSTSDK_Gui_Android"]
55
path = BlueSTSDK_Gui_Android
6-
url = https://github.com/STMicroelectronics-CentralLabs/BlueSTSDK_GUI_Android.git
6+
url = https://github.com/STMicroelectronics/BlueSTSDK_GUI_Android.git

BlueMS/build.gradle

Lines changed: 18 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,10 @@ android {
5858
buildToolsVersion rootProject.ext.buildToolsVersion
5959

6060
defaultConfig {
61-
//19 since we need the setpin api
62-
minSdkVersion 19
63-
versionCode 26
64-
versionName '4.1.2'
61+
62+
minSdkVersion rootProject.ext.minSdkVersion
63+
versionCode 30
64+
versionName '4.3.0'
6565
applicationId "com.st.bluems"
6666
targetSdkVersion rootProject.ext.targetSdkVersion
6767
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
@@ -73,9 +73,8 @@ android {
7373
//signingConfig signingConfigs.config
7474
minifyEnabled true
7575
shrinkResources true
76-
proguardFiles getDefaultProguardFile('proguard-android.txt'),
77-
'proguard-rules.pro',
78-
'../BlueSTSDK/BlueSTSDK/proguard-rules.pro'}
76+
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
77+
}
7978
debug {
8079
applicationIdSuffix ".debug"
8180
versionNameSuffix "-dev" + getDate()
@@ -110,7 +109,9 @@ android {
110109
sourceCompatibility JavaVersion.VERSION_1_8
111110
targetCompatibility JavaVersion.VERSION_1_8
112111
}
113-
112+
packagingOptions {
113+
exclude "thirdpartynotice.txt"
114+
}
114115
}
115116

116117
ext {
@@ -129,6 +130,9 @@ dependencies {
129130
implementation fileTree(include: '*.jar', dir: 'libs')
130131
implementation project(':BlueSTSDK')
131132
implementation project(':BlueSTSDK_Gui_Android')
133+
implementation project(':BlueMSCloud')
134+
135+
implementation 'com.github.PhilJay:MPAndroidChart:v3.0.3'
132136

133137
implementation 'com.github.PhilJay:MPAndroidChart:v3.0.3'
134138

@@ -145,28 +149,15 @@ dependencies {
145149
annotationProcessor "android.arch.persistence.room:compiler:$roomVersion"
146150

147151
// Lifecycle components
148-
implementation "android.arch.lifecycle:extensions:$archLifecycleVersion"
149-
annotationProcessor "android.arch.lifecycle:compiler:$archLifecycleVersion"
150-
151-
//necessary for ProviderInstaller.installIfNeeded for enable tls1.2 on android 4.4@samsung s4
152-
implementation group: 'com.google.android.gms', name: 'play-services-base', version: '16.0.1'
153-
154-
//necessary to cloud demo, for mqtt connection
155-
implementation group: 'org.eclipse.paho', name: 'org.eclipse.paho.client.mqttv3', version: '1.2.0'
156-
implementation group: 'org.eclipse.paho', name: 'org.eclipse.paho.android.service', version: '1.1.1'
157-
158-
//necessary to azure iot
159-
implementation group: 'com.squareup.retrofit2', name: 'retrofit', version: "$retrofitVersion"
160-
implementation group: 'com.squareup.retrofit2', name: 'converter-gson', version: "$retrofitVersion"
161-
162-
//amazon aws iot
163-
implementation group: 'com.amazonaws', name: 'aws-android-sdk-iot', version: "$rootProject.amazonSDKVersion"
152+
implementation "android.arch.lifecycle:extensions:$rootProject.archLifecycleVersion"
153+
annotationProcessor "android.arch.lifecycle:compiler:$rootProject.archLifecycleVersion"
164154

165155
// ibm speech to text
166-
implementation group: 'com.ibm.watson.developer_cloud', name: 'speech-to-text', version: '6.4.0'
156+
implementation group: 'com.ibm.watson.developer_cloud', name: 'speech-to-text', version: '6.12.0'
167157

168158
//generic websocket speech to cloud
169-
implementation group: 'com.squareup.okhttp3', name:'okhttp', version: '3.11.0'
159+
implementation group: 'com.squareup.okhttp3', name: 'okhttp', version: '3.13.1'
160+
170161

171162
//memory leak detector
172163
debugImplementation group: 'com.squareup.leakcanary', name: 'leakcanary-android', version: "$leakcanaryVersion"
@@ -182,3 +173,4 @@ dependencies {
182173
androidTestImplementation "com.android.support.test:rules:$rootProject.rulesVersion"
183174
androidTestImplementation "com.android.support.test.espresso:espresso-core:$rootProject.espressoVersion"
184175
}
176+

BlueMS/proguard-rules.pro

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,14 @@
3939
-dontwarn javax.naming.InitialContext
4040
-dontwarn javax.naming.Context
4141

42-
#need for okhttp
43-
-dontwarn okhttp3.**
44-
-dontwarn okio.**
42+
#need for okhttp (audio websocket)
43+
# https://github.com/square/okhttp/blob/master/okhttp/src/main/resources/META-INF/proguard/okhttp3.pro
44+
# JSR 305 annotations are for embedding nullability information.
4545
-dontwarn javax.annotation.**
46+
47+
# A resource is loaded with a relative path so the package of this class must be preserved.
48+
-keepnames class okhttp3.internal.publicsuffix.PublicSuffixDatabase
49+
# Animal Sniffer compileOnly dependency to ensure APIs are compatible with older versions of Java.
50+
-dontwarn org.codehaus.mojo.animal_sniffer.*
51+
# OkHttp platform used only on JVM and when Conscrypt dependency is available.
52+
-dontwarn okhttp3.internal.platform.ConscryptPlatform

BlueMS/src/main/AndroidManifest.xml

Lines changed: 26 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -38,22 +38,14 @@
3838
package="com.st.BlueMS">
3939

4040
<uses-permission android:name="android.permission.BLUETOOTH" />
41-
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
42-
43-
<!-- needed for the BlueVoice demos -->
41+
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" /> <!-- needed for the BlueVoice demos -->
4442
<uses-permission android:name="android.permission.INTERNET" />
45-
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
46-
<!-- add for paho -->
47-
<uses-permission android:name="android.permission.WAKE_LOCK" />
48-
49-
<!-- Memes Sensor Fusion vibrate when a free fall is detected -->
43+
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <!-- Memes Sensor Fusion vibrate when a free fall is detected -->
5044
<uses-permission android:name="android.permission.VIBRATE" />
5145

5246
<uses-feature
5347
android:glEsVersion="0x00020000"
54-
android:required="true" />
55-
56-
<!-- needed for the BlueVoice demos -->
48+
android:required="true" /> <!-- needed for the BlueVoice demos -->
5749
<uses-feature
5850
android:name="android.hardware.audio.low_latency"
5951
android:required="false" />
@@ -65,6 +57,10 @@
6557
android:label="@string/app_name"
6658
android:logo="@drawable/app_logo"
6759
android:theme="@style/AppTheme">
60+
<service
61+
android:name=".demos.fftAmpitude.FFTExportedService"
62+
android:exported="false"></service>
63+
6864
<activity
6965
android:name=".MainActivity"
7066
android:configChanges="keyboardHidden|screenSize"
@@ -103,20 +99,6 @@
10399
android:name="android.support.PARENT_ACTIVITY"
104100
android:value="com.st.BlueMS.NodeListActivity" />
105101
</activity>
106-
<activity
107-
android:name="com.st.BlueSTSDK.gui.DebugConsoleActivity"
108-
android:parentActivityName=".DemosActivity">
109-
<meta-data
110-
android:name="android.support.PARENT_ACTIVITY"
111-
android:value="com.st.BlueMS.DemosActivity" />
112-
</activity>
113-
<activity
114-
android:name="com.st.BlueSTSDK.gui.AboutActivity"
115-
android:parentActivityName=".MainActivity">
116-
<meta-data
117-
android:name="android.support.PARENT_ACTIVITY"
118-
android:value="com.st.BlueMS.MainActivity" />
119-
</activity>
120102
<activity
121103
android:name=".preference.wesu.SettingsWithWesuRegisters"
122104
android:label="@string/settings"
@@ -144,12 +126,27 @@
144126

145127
<intent-filter>
146128
<action android:name="android.nfc.action.NDEF_DISCOVERED" />
129+
147130
<category android:name="android.intent.category.DEFAULT" />
131+
148132
<data android:mimeType="application/com.st.w2stapp" />
149133
</intent-filter>
134+
</activity> <!-- Start: integrate the BlueSTSDK.gui activity in the app, setting the parent activity -->
135+
<activity
136+
android:name="com.st.BlueSTSDK.gui.DebugConsoleActivity"
137+
android:parentActivityName=".DemosActivity">
138+
<meta-data
139+
android:name="android.support.PARENT_ACTIVITY"
140+
android:value="com.st.BlueMS.DemosActivity" />
150141
</activity>
151-
152-
<!-- Start: integrate the BlueSTSDK.gui activity in the app, setting the parent activity -->
142+
<activity
143+
android:name="com.st.BlueSTSDK.gui.AboutActivity"
144+
android:parentActivityName=".MainActivity">
145+
<meta-data
146+
android:name="android.support.PARENT_ACTIVITY"
147+
android:value="com.st.BlueMS.MainActivity" />
148+
</activity>
149+
<!-- End: integrate the BlueSTSDK.gui activity in the app, setting the parent activity -->
153150
<activity android:name="com.st.BlueSTSDK.gui.fwUpgrade.FwUpgradeActivity">
154151
<meta-data
155152
android:name="android.support.PARENT_ACTIVITY"
@@ -159,8 +156,7 @@
159156
<meta-data
160157
android:name="android.support.PARENT_ACTIVITY"
161158
android:value="com.st.BlueMS.NodeListActivity" />
162-
</activity>
163-
<!-- End: integrate the BlueSTSDK.gui activity in the app, setting the parent activity -->
159+
</activity> <!-- End: integrate the BlueSTSDK.gui activity in the app, setting the parent activity -->
164160

165161
<receiver android:name=".NfcNodeConnection$InsertPairPin">
166162
<intent-filter>
@@ -169,15 +165,12 @@
169165
</intent-filter>
170166
</receiver>
171167

172-
<service
173-
android:name="org.eclipse.paho.android.service.MqttService"
174-
android:enabled="true" />
175168
<service
176169
android:name=".demos.Cloud.DownloadFwFileService"
177170
android:exported="false" />
178171
<service
179172
android:name=".demos.aiDataLog.SessionAnnotationLoggingService"
180-
android:exported="false"/>
173+
android:exported="false" />
181174
</application>
182175

183176
</manifest>

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,10 @@
5353
import com.st.BlueMS.demos.CarryPositionFragment;
5454
import com.st.BlueMS.demos.Cloud.CloudLogFragment;
5555
import com.st.BlueMS.demos.Level.LevelDemoFragment;
56+
import com.st.BlueMS.demos.PredictiveMaintenance.PredictiveMaintenanceFragment;
5657
import com.st.BlueMS.demos.SDLog.SDLogFragment;
5758
import com.st.BlueMS.demos.aiDataLog.AIDataLogDemoFragment;
58-
import com.st.BlueMS.demos.fftAmpitude.FFTAmplitudePlotFragment;
59+
import com.st.BlueMS.demos.fftAmpitude.FFTAmplitudeFragment;
5960
import com.st.BlueMS.demos.memsSensorFusion.CompassFragment;
6061
import com.st.BlueMS.demos.EnvironmentalSensorsFragment;
6162
import com.st.BlueMS.demos.HeartRateFragment;
@@ -126,7 +127,7 @@ public static class LedButtonControlFragment extends com.st.STM32WB.p2pDemo.LedB
126127
private final static Class<? extends DemoFragment> ALL_DEMOS[] = new Class[]{
127128
EnvironmentalSensorsFragment.class,
128129
MemsSensorFusionFragment.class,
129-
FFTAmplitudePlotFragment.class,
130+
FFTAmplitudeFragment.class,
130131
PlotFeatureFragment.class,
131132
SDLogFragment.class,
132133
ActivityRecognitionFragment.class,
@@ -150,6 +151,7 @@ public static class LedButtonControlFragment extends com.st.STM32WB.p2pDemo.LedB
150151
StartOtaRebootFragment.class,
151152
AIDataLogDemoFragment.class,
152153
CloudLogFragment.class,
154+
PredictiveMaintenanceFragment.class,
153155
NodeStatusFragment.class
154156
//FeatureDebugFragment.class
155157
};

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@
5151

5252
import com.st.BlueSTSDK.Manager;
5353
import com.st.BlueSTSDK.Node;
54-
import com.st.BlueSTSDK.Utils.BleAdvertiseParser;
55-
import com.st.BlueSTSDK.Utils.InvalidBleAdvertiseFormat;
54+
import com.st.BlueSTSDK.Utils.BlueSTSDKAdvertiseFilter;
55+
import com.st.BlueSTSDK.Utils.advertise.BleAdvertiseInfo;
5656
import com.st.BlueSTSDK.Utils.NodeScanActivity;
5757
import com.st.BlueSTSDK.Utils.NumberConversion;
5858
import com.st.BlueSTSDK.Utils.SearchSpecificNode;
@@ -174,11 +174,11 @@ protected void onCreate(Bundle savedInstanceState) {
174174
int pin = NumberConversion.LittleEndian.bytesToInt32(messagePayload,
175175
messagePayload.length-4);
176176
sPairingPin=pinToByte(pin);
177-
try {
178-
mNodeTag = new BleAdvertiseParser(messagePayload).getAddress();
179-
Log.d("InsertPin", "nodeTag: "+mNodeTag + "Pin: "+pin);
180-
} catch (InvalidBleAdvertiseFormat invalidBleAdvertiseFormat) {
177+
BleAdvertiseInfo nodeInfo = new BlueSTSDKAdvertiseFilter().filter(messagePayload);
178+
if(nodeInfo==null){
181179
startNodeListActivityAndFinish(R.string.invalidNfc);
180+
}else{
181+
mNodeTag = nodeInfo.getAddress();
182182
}
183183
}else {
184184
startNodeListActivityAndFinish(R.string.invalidNfc);

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

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,19 @@
3737

3838
package com.st.BlueMS;
3939

40+
import com.st.BlueNRG.fwUpgrade.BlueNRGAdvertiseFilter;
41+
import com.st.BlueNRG.fwUpgrade.feature.BlueNRGOTASupport;
4042
import com.st.BlueSTSDK.Features.standardCharacteristics.StdCharToFeatureMap;
4143
import com.st.BlueSTSDK.Node;
4244
import com.st.BlueSTSDK.Utils.ConnectionOption;
45+
import com.st.BlueSTSDK.Utils.advertise.AdvertiseFilter;
46+
import com.st.BlueSTSDK.gui.fwUpgrade.FwUpgradeActivity;
4347
import com.st.STM32WB.fwUpgrade.FwUpgradeSTM32WBActivity;
4448
import com.st.STM32WB.fwUpgrade.feature.STM32OTASupport;
4549
import com.st.STM32WB.p2pDemo.Peer2PeerDemoConfiguration;
4650

51+
import java.util.List;
52+
4753
/**
4854
* Activity that show the list of device found by the manager
4955
*/
@@ -54,13 +60,21 @@ public boolean displayNode(Node n) {
5460
return true;
5561
}
5662

63+
@Override
64+
protected List<AdvertiseFilter> buildAdvertiseFilter() {
65+
List<AdvertiseFilter> defaultList = super.buildAdvertiseFilter();
66+
defaultList.add(new BlueNRGAdvertiseFilter());
67+
return defaultList;
68+
}
69+
5770
@Override
5871
public void onNodeSelected(Node n) {
5972

6073
ConnectionOption.ConnectionOptionBuilder optionsBuilder = ConnectionOption.builder()
6174
.resetCache(clearCacheIsSelected())
6275
.enableAutoConnect(false)
6376
.setFeatureMap(STM32OTASupport.getOTAFeatures())
77+
.setFeatureMap(BlueNRGOTASupport.getOTAFeatures())
6478
.setFeatureMap(new StdCharToFeatureMap());
6579

6680
if(Peer2PeerDemoConfiguration.isValidDeviceNode(n)){
@@ -69,7 +83,9 @@ public void onNodeSelected(Node n) {
6983

7084
ConnectionOption options = optionsBuilder.build();
7185

72-
if(n.getType()== Node.Type.STEVAL_WESU1)
86+
if(n.getAdvertiseInfo() instanceof BlueNRGAdvertiseFilter.BlueNRGAdvertiseInfo)
87+
startActivity(FwUpgradeActivity.getStartIntent(this, n,false,options));
88+
else if(n.getType()== Node.Type.STEVAL_WESU1)
7389
startActivity(DemosActivityWesu.getStartIntent(this,n,options));
7490
else if (STM32OTASupport.isOTANode(n)){
7591
startActivity(FwUpgradeSTM32WBActivity.getStartIntent(this, n,null,null));

0 commit comments

Comments
 (0)