Fixed issue where web server would send data to the analysis routines even if data source is not set to Garmin, causing conflicts with the selected data source.

This commit is contained in:
Graham Jones
2022-02-21 12:23:31 +00:00
parent 3656b74733
commit 39ea02020f
3 changed files with 25 additions and 7 deletions

View File

@@ -3,7 +3,7 @@
xmlns:tools="http://schemas.android.com/tools"
package="uk.org.openseizuredetector"
android:versionCode="92"
android:versionName="4.0.0i">
android:versionName="4.0.0j">
<!-- android:allowBackup="false" -->
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />

View File

@@ -104,13 +104,18 @@ public class SdWebServer extends NanoHTTPD {
Log.v(TAG, " files=" + files.toString());
String postData = files.get("postData");
Log.v(TAG, " postData=" + postData);
// Send the data to the SdDataSource so the app can pick it up.
if (parameters.get("dataObj") != null) {
Log.v(TAG,"passing parameters to data source");
answer = mSdServer.mSdDataSource.updateFromJSON(parameters.get("dataObj").toString());
if (mSdServer.mSdDataSourceName.equals("Garmin")) {
// Send the data to the SdDataSource so the app can pick it up.
if (parameters.get("dataObj") != null) {
Log.v(TAG, "passing parameters to data source");
answer = mSdServer.mSdDataSource.updateFromJSON(parameters.get("dataObj").toString());
} else {
Log.v(TAG, "Passing postData to data source");
answer = mSdServer.mSdDataSource.updateFromJSON(files.get("postData"));
}
} else {
Log.v(TAG,"Passing postData to data source");
answer = mSdServer.mSdDataSource.updateFromJSON(files.get("postData"));
Log.i(TAG,"Web server received data, but datasource is not set to 'Garmin' - Ignoring");
mUtil.showToast("Web server received data, but datasource is not set to 'Garmin' - Ignoring");
}
break;
default: