Get NetworkPassive data source working with Garmin watch - but raw data analysis still not working.

This commit is contained in:
Graham Jones
2019-01-02 20:44:11 +00:00
parent c8a240c84b
commit fa9ad87985
2 changed files with 16 additions and 6 deletions

View File

@@ -54,8 +54,10 @@ import static java.lang.Math.sqrt;
/** /**
* Abstract class for a seizure detector data source. Subclasses include a pebble smart watch data source and a * A Passive data source that expects a device to send it data periodically by sending a POST request.
* network data source. * The POST network request is handled in the SDWebServer class, which calls the 'updateFrom JSON()'
* function to send the data to this datasource.
* SdWebServer expects POST requests to /data and /settings URLs to send data or watch settings.
*/ */
public class SdDataSourceNetworkPassive extends SdDataSource { public class SdDataSourceNetworkPassive extends SdDataSource {
private Handler mHandler = new Handler(); private Handler mHandler = new Handler();
@@ -378,6 +380,8 @@ public class SdDataSourceNetworkPassive extends SdDataSource {
// ******* POPULATE WITH DUMMY DATA ***** // ******* POPULATE WITH DUMMY DATA *****
//makeTestData(); //makeTestData();
// ************************************** // **************************************
// FIXME - Use specified sampleFreq, not this hard coded one
mSampleFreq = 25;
double freqRes = 1.0*mSampleFreq/mNSamp; double freqRes = 1.0*mSampleFreq/mNSamp;
Log.v(TAG,"doAnalysis(): mSampleFreq="+mSampleFreq+" mNSamp="+mNSamp+": freqRes="+freqRes); Log.v(TAG,"doAnalysis(): mSampleFreq="+mSampleFreq+" mNSamp="+mNSamp+": freqRes="+freqRes);
// Set the frequency bounds for the analysis in fft output bin numbers. // Set the frequency bounds for the analysis in fft output bin numbers.

View File

@@ -40,7 +40,7 @@ public class SdWebServer extends NanoHTTPD {
} }
public void setSdData(SdData sdData) { public void setSdData(SdData sdData) {
Log.v(TAG, "setSdData()"); // Log.v(TAG, "setSdData()");
mSdData = sdData; mSdData = sdData;
} }
@@ -90,10 +90,16 @@ public class SdWebServer extends NanoHTTPD {
Log.v(TAG, "WebServer.serve() - POST /data - receiving data from device: parameters=" + parameters.toString()); Log.v(TAG, "WebServer.serve() - POST /data - receiving data from device: parameters=" + parameters.toString());
Log.v(TAG, " header=" + header.toString()); Log.v(TAG, " header=" + header.toString());
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. // Send the data to the SdDataSource so the app can pick it up.
mSdServer.mSdDataSource.updateFromJSON(parameters.toString()); if (parameters != null) {
Log.v(TAG,"passing parameters to data source");
mSdServer.mSdDataSource.updateFromJSON(parameters.get("dataObj").toString());
} else {
Log.v(TAG,"Passing postData to data source");
mSdServer.mSdDataSource.updateFromJSON(files.get("postData"));
}
if (mSdData.haveSettings) { if (mSdData.haveSettings) {
answer = "OK"; answer = "OK";
} else { } else {