Extended SdDataSource to include an update data function that the web server can call
This commit is contained in:
@@ -87,6 +87,13 @@ public abstract class SdDataSource {
|
||||
|
||||
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.
|
||||
* @param msg - message to display.
|
||||
|
||||
@@ -92,6 +92,8 @@ 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.
|
||||
mSdServer.mSdDataSource.updateFromJSON(postData);
|
||||
break;
|
||||
default:
|
||||
Log.v(TAG, "WebServer.serve() - Unrecognised method - " + method);
|
||||
|
||||
Reference in New Issue
Block a user