Corrected web server mime types to get Garmin display working again. Also added HR alarm standing prameter to /data so network datasource should alarm correctly on HR alarm now.
This commit is contained in:
@@ -4,6 +4,12 @@
|
||||
V3.2.0 - (NEXT VERSION!)
|
||||
- Added neural network based data analysis.
|
||||
|
||||
V3.1.12 - 15feb2019
|
||||
- Updated web server to return correct application/json mime type to get rid of -400
|
||||
errors on garmin watch. Made error messages json strings too.
|
||||
Added hrAlarmStanding value to /data json string, which should get remove
|
||||
heart rate alarms working with network datasource.
|
||||
|
||||
V3.1.11 - 23oct2019
|
||||
- Updated network data source so it displays heart rate data if it is available.
|
||||
|
||||
|
||||
BIN
app/release/app-release-3.1.12.apk
Normal file
BIN
app/release/app-release-3.1.12.apk
Normal file
Binary file not shown.
@@ -1 +1 @@
|
||||
[{"outputType":{"type":"APK"},"apkData":{"type":"MAIN","splits":[],"versionCode":65,"versionName":"3.1.11","enabled":true,"outputFile":"app-release.apk","fullName":"release","baseName":"release"},"path":"app-release.apk","properties":{}}]
|
||||
[{"outputType":{"type":"APK"},"apkData":{"type":"MAIN","splits":[],"versionCode":66,"versionName":"3.1.12","enabled":true,"outputFile":"app-release.apk","fullName":"release","baseName":"release"},"path":"app-release.apk","properties":{}}]
|
||||
@@ -1,8 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="uk.org.openseizuredetector"
|
||||
android:versionCode="65"
|
||||
android:versionName="3.1.11"
|
||||
android:versionCode="66"
|
||||
android:versionName="3.1.12"
|
||||
>
|
||||
<!--android:allowBackup="false"-->
|
||||
|
||||
|
||||
@@ -121,6 +121,7 @@ public class SdData implements Parcelable {
|
||||
alarmThresh = jo.optInt("alarmThresh");
|
||||
alarmRatioThresh = jo.optInt("alarmRatioThresh");
|
||||
mHRAlarmActive=jo.optBoolean("hrAlarmActive");
|
||||
mHRAlarmStanding = jo.optBoolean("hrAlarmStanding");
|
||||
mHRThreshMin = jo.optDouble("hrThreshMin");
|
||||
mHRThreshMax = jo.optDouble("hrThreshMax");
|
||||
mHR = jo.optDouble("hr");
|
||||
@@ -176,6 +177,7 @@ public class SdData implements Parcelable {
|
||||
jsonObj.put("alarmThresh", alarmThresh);
|
||||
jsonObj.put("alarmRatioThresh", alarmRatioThresh);
|
||||
jsonObj.put("hrAlarmActive", mHRAlarmActive);
|
||||
jsonObj.put("hrAlarmStanding", mHRAlarmStanding);
|
||||
jsonObj.put("hrThreshMin",mHRThreshMin);
|
||||
jsonObj.put("hrThreshMax", mHRThreshMax);
|
||||
jsonObj.put("hr",mHR);
|
||||
|
||||
@@ -51,12 +51,20 @@ public class SdWebServer extends NanoHTTPD {
|
||||
Map<String, String> header;
|
||||
Map<String, String> parameters;
|
||||
Map<String, String> files = new HashMap<String, String>();
|
||||
try {
|
||||
session.parseBody(files);
|
||||
} catch (IOException ioe) {
|
||||
return new Response(Response.Status.INTERNAL_ERROR, MIME_PLAINTEXT, "SERVER INTERNAL ERROR: IOException: " + ioe.getMessage());
|
||||
} catch (ResponseException re) {
|
||||
return new Response(re.getStatus(), MIME_PLAINTEXT, re.getMessage());
|
||||
NanoHTTPD.Response res = null;
|
||||
String responseMimeType = "application/json";
|
||||
|
||||
if (session.getMethod() == Method.POST) {
|
||||
// We try to parse the 'files' part of POST requests to get the data
|
||||
try {
|
||||
session.parseBody(files);
|
||||
} catch (IOException ioe) {
|
||||
Log.e(TAG, "IOError parsing body of request");
|
||||
return new Response(Response.Status.INTERNAL_ERROR, MIME_PLAINTEXT, "SERVER INTERNAL ERROR: IOException: " + ioe.getMessage());
|
||||
} catch (ResponseException re) {
|
||||
Log.e(TAG, "ResponseException parsing body of request" + re.getMessage());
|
||||
return new Response(re.getStatus(), MIME_PLAINTEXT, re.getMessage());
|
||||
}
|
||||
}
|
||||
uri = session.getUri();
|
||||
method = session.getMethod();
|
||||
@@ -64,7 +72,7 @@ public class SdWebServer extends NanoHTTPD {
|
||||
parameters = session.getParms();
|
||||
|
||||
Log.v(TAG, "WebServer.serve() - uri=" + uri + " Method=" + method.toString());
|
||||
String answer = "Error - you should not see this message! - Something wrong in WebServer.serve()";
|
||||
String answer = "{'msg': 'Error - you should not see this message! - Something wrong in WebServer.serve()'}";
|
||||
|
||||
Iterator it = parameters.keySet().iterator();
|
||||
while (it.hasNext()) {
|
||||
@@ -80,10 +88,11 @@ public class SdWebServer extends NanoHTTPD {
|
||||
case GET:
|
||||
//Log.v(TAG,"WebServer.serve() - Returning data");
|
||||
try {
|
||||
Log.v(TAG, "WebServer.serve() - GET /data - sending " + mSdData.toString());
|
||||
answer = mSdData.toString();
|
||||
} catch (Exception ex) {
|
||||
Log.v(TAG, "Error Creating Data Object - " + ex.toString());
|
||||
answer = "Error Creating Data Object";
|
||||
answer = "{'msg': 'Error Creating Data Object'}";
|
||||
}
|
||||
break;
|
||||
case POST:
|
||||
@@ -124,7 +133,7 @@ public class SdWebServer extends NanoHTTPD {
|
||||
answer = jsonObj.toString();
|
||||
} catch (Exception ex) {
|
||||
Log.v(TAG, "Error Creating Data Object - " + ex.toString());
|
||||
answer = "Error Creating Data Object";
|
||||
answer = "{'msg': 'Error Creating Data Object'}";
|
||||
}
|
||||
break;
|
||||
case POST:
|
||||
@@ -144,6 +153,7 @@ public class SdWebServer extends NanoHTTPD {
|
||||
default:
|
||||
Log.v(TAG, "WebServer.serve() - Unrecognised method - " + method);
|
||||
}
|
||||
break;
|
||||
case "/spectrum":
|
||||
Log.v(TAG, "WebServer.serve() - Returning spectrum - 1");
|
||||
try {
|
||||
@@ -162,14 +172,14 @@ public class SdWebServer extends NanoHTTPD {
|
||||
Log.v(TAG, "WebServer.serve() - Returning spectrum - 5" + answer);
|
||||
} catch (Exception ex) {
|
||||
Log.v(TAG, "Error Creating Data Object - " + ex.toString());
|
||||
answer = "Error Creating Data Object";
|
||||
answer = "{'msg' : 'Error Creating Data Object'}";
|
||||
}
|
||||
break;
|
||||
|
||||
case "/acceptalarm":
|
||||
Log.v(TAG, "WebServer.serve() - Accepting alarm");
|
||||
mSdServer.acceptAlarm();
|
||||
answer = "Alarm Accepted";
|
||||
answer = "{'msg' : 'Alarm Accepted'}";
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -189,11 +199,13 @@ public class SdWebServer extends NanoHTTPD {
|
||||
} else {
|
||||
Log.v(TAG, "WebServer.serve() - Unknown uri -" +
|
||||
uri);
|
||||
answer = "Unknown URI: ";
|
||||
answer = "{'msg' : 'Unknown URI: '}";
|
||||
}
|
||||
}
|
||||
Log.v(TAG,"WebServer.serve() - returning "+answer);
|
||||
return new NanoHTTPD.Response(answer);
|
||||
res = new NanoHTTPD.Response(answer);
|
||||
res.setMimeType(responseMimeType);
|
||||
Log.v(TAG,"WebServer.serve() - returning "+res.getData()+", mime="+res.getMimeType()+", status="+res.getStatus());
|
||||
return (res);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user