Extended SdDataSource to include an update data function that the web server can call

This commit is contained in:
Graham Jones
2017-09-05 05:39:36 +01:00
parent fc1683ad36
commit a79e98c4de
2 changed files with 9 additions and 0 deletions

View File

@@ -87,6 +87,13 @@ public abstract class SdDataSource {
public void acceptAlarm() { Log.v(TAG,"acceptAlarm()"); } public void acceptAlarm() { Log.v(TAG,"acceptAlarm()"); }
// Force the data stored in this datasource to update in line with the JSON string encoded data provided.
// Used by webServer to update the NetworkPassiveDatasource
public void updateFromJSON(String jsonStr) {
Log.v(TAG,"updateFromJSON - "+jsonStr);
}
/** /**
* Display a Toast message on screen. * Display a Toast message on screen.
* @param msg - message to display. * @param msg - message to display.

View File

@@ -92,6 +92,8 @@ public class SdWebServer extends NanoHTTPD {
Log.v(TAG, " files=" + files.toString()); Log.v(TAG, " files=" + files.toString());
String postData = files.get("postData"); String postData = files.get("postData");
Log.v(TAG, " postData=" + postData); Log.v(TAG, " postData=" + postData);
// Send the data to the SdDataSource so the app can pick it up.
mSdServer.mSdDataSource.updateFromJSON(postData);
break; break;
default: default:
Log.v(TAG, "WebServer.serve() - Unrecognised method - " + method); Log.v(TAG, "WebServer.serve() - Unrecognised method - " + method);