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()"); }
|
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.
|
||||||
|
|||||||
@@ -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);
|
||||||
|
|||||||
Reference in New Issue
Block a user