Applied Android Studio code formatting to all java files
This commit is contained in:
@@ -66,8 +66,8 @@ public class AuthenticateActivity extends AppCompatActivity {
|
|||||||
logoutBtn.setOnClickListener(onLogout);
|
logoutBtn.setOnClickListener(onLogout);
|
||||||
|
|
||||||
// Components required only for osdapi backend
|
// Components required only for osdapi backend
|
||||||
if (LogManager.USE_FIREBASE_BACKEND) { }
|
if (LogManager.USE_FIREBASE_BACKEND) {
|
||||||
else {
|
} else {
|
||||||
mConnection = new SdServiceConnection(getApplicationContext());
|
mConnection = new SdServiceConnection(getApplicationContext());
|
||||||
|
|
||||||
Button registerBtn = (Button) findViewById(R.id.RegisterBtn);
|
Button registerBtn = (Button) findViewById(R.id.RegisterBtn);
|
||||||
@@ -157,7 +157,6 @@ public class AuthenticateActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Called after the Firebase Auth UI has completed
|
// Called after the Firebase Auth UI has completed
|
||||||
private ActivityResultLauncher<Intent> signInLauncher = registerForActivityResult(
|
private ActivityResultLauncher<Intent> signInLauncher = registerForActivityResult(
|
||||||
new FirebaseAuthUIActivityResultContract(),
|
new FirebaseAuthUIActivityResultContract(),
|
||||||
|
|||||||
@@ -68,6 +68,7 @@ public class CircBuf {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a double array of buffer items in order of their insertion time
|
* Returns a double array of buffer items in order of their insertion time
|
||||||
|
*
|
||||||
* @return double[] of buffer items
|
* @return double[] of buffer items
|
||||||
*/
|
*/
|
||||||
public double[] getVals() {
|
public double[] getVals() {
|
||||||
|
|||||||
@@ -3,7 +3,9 @@ package uk.org.openseizuredetector;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
|
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
@@ -269,7 +271,6 @@ public class EditEventActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
} // updateUi()
|
} // updateUi()
|
||||||
|
|
||||||
View.OnClickListener onCancel =
|
View.OnClickListener onCancel =
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import android.widget.TextView;
|
|||||||
|
|
||||||
public class FragmentDataSharing extends FragmentOsdBaseClass {
|
public class FragmentDataSharing extends FragmentOsdBaseClass {
|
||||||
String TAG = "FragmentDataSharing";
|
String TAG = "FragmentDataSharing";
|
||||||
|
|
||||||
public FragmentDataSharing() {
|
public FragmentDataSharing() {
|
||||||
// Required empty public constructor
|
// Required empty public constructor
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -99,6 +99,7 @@ public class FragmentHrAlg extends FragmentOsdBaseClass {
|
|||||||
yAxis2.setDrawGridLines(false);
|
yAxis2.setDrawGridLines(false);
|
||||||
yAxis2.setEnabled(false);
|
yAxis2.setEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||||
Bundle savedInstanceState) {
|
Bundle savedInstanceState) {
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import android.widget.TextView;
|
|||||||
|
|
||||||
public class FragmentMlAlg extends FragmentOsdBaseClass {
|
public class FragmentMlAlg extends FragmentOsdBaseClass {
|
||||||
String TAG = "FragmentMlAlg";
|
String TAG = "FragmentMlAlg";
|
||||||
|
|
||||||
public FragmentMlAlg() {
|
public FragmentMlAlg() {
|
||||||
// Required empty public constructor
|
// Required empty public constructor
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ import java.util.ArrayList;
|
|||||||
|
|
||||||
public class FragmentOsdAlg extends FragmentOsdBaseClass {
|
public class FragmentOsdAlg extends FragmentOsdBaseClass {
|
||||||
String TAG = "FragmentOsdAlg";
|
String TAG = "FragmentOsdAlg";
|
||||||
|
|
||||||
public FragmentOsdAlg() {
|
public FragmentOsdAlg() {
|
||||||
// Required empty public constructor
|
// Required empty public constructor
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,7 +34,6 @@ public class FragmentOsdBaseClass extends Fragment {
|
|||||||
protected int alarmTextColour = Color.BLACK;
|
protected int alarmTextColour = Color.BLACK;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public FragmentOsdBaseClass() {
|
public FragmentOsdBaseClass() {
|
||||||
// Required empty public constructor
|
// Required empty public constructor
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import androidx.appcompat.widget.LinearLayoutCompat;
|
|||||||
|
|
||||||
public class FragmentSystem extends FragmentOsdBaseClass {
|
public class FragmentSystem extends FragmentOsdBaseClass {
|
||||||
String TAG = "FragmentSystem";
|
String TAG = "FragmentSystem";
|
||||||
|
|
||||||
public FragmentSystem() {
|
public FragmentSystem() {
|
||||||
// Required empty public constructor
|
// Required empty public constructor
|
||||||
}
|
}
|
||||||
@@ -51,7 +52,6 @@ public class FragmentSystem extends FragmentOsdBaseClass {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void updateUi() {
|
protected void updateUi() {
|
||||||
//Log.d(TAG,"updateUi()");
|
//Log.d(TAG,"updateUi()");
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import android.widget.TextView;
|
|||||||
|
|
||||||
public class FragmentWebServer extends FragmentOsdBaseClass {
|
public class FragmentWebServer extends FragmentOsdBaseClass {
|
||||||
String TAG = "FragmentWebServer";
|
String TAG = "FragmentWebServer";
|
||||||
|
|
||||||
public FragmentWebServer() {
|
public FragmentWebServer() {
|
||||||
// Required empty public constructor
|
// Required empty public constructor
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package uk.org.openseizuredetector;
|
package uk.org.openseizuredetector;
|
||||||
// Defines the servies and characteristics we need to subscribe to.
|
// Defines the servies and characteristics we need to subscribe to.
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
public class GattAttributes {
|
public class GattAttributes {
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package uk.org.openseizuredetector;
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
@@ -21,8 +22,7 @@ interface SdLocationReceiver {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public class LocationFinder implements LocationListener
|
public class LocationFinder implements LocationListener {
|
||||||
{
|
|
||||||
SdLocationReceiver mSdLocationReceiver = null;
|
SdLocationReceiver mSdLocationReceiver = null;
|
||||||
Location mLastLocation = null;
|
Location mLastLocation = null;
|
||||||
OsdUtil mUtil;
|
OsdUtil mUtil;
|
||||||
@@ -56,7 +56,6 @@ public class LocationFinder implements LocationListener
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public Location getLastLocation() {
|
public Location getLastLocation() {
|
||||||
return mLastLocation;
|
return mLastLocation;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -510,8 +510,6 @@ public class LogManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return an array list of objects representing the events in the database by calling the specified callback function.
|
* Return an array list of objects representing the events in the database by calling the specified callback function.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ public class MainActivity2 extends AppCompatActivity {
|
|||||||
private OsdUtil mUtil;
|
private OsdUtil mUtil;
|
||||||
private SdServiceConnection mConnection;
|
private SdServiceConnection mConnection;
|
||||||
final Handler serverStatusHandler = new Handler();
|
final Handler serverStatusHandler = new Handler();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
@@ -127,8 +128,6 @@ public class MainActivity2 extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onPause() {
|
protected void onPause() {
|
||||||
super.onPause();
|
super.onPause();
|
||||||
@@ -151,7 +150,6 @@ public class MainActivity2 extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBackPressed() {
|
public void onBackPressed() {
|
||||||
if (Objects.isNull(mFragmentPager) || mFragmentPager.getCurrentItem() == 0) {
|
if (Objects.isNull(mFragmentPager) || mFragmentPager.getCurrentItem() == 0) {
|
||||||
@@ -278,14 +276,13 @@ public class MainActivity2 extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A simple pager adapter that represents 5 ScreenSlidePageFragment objects, in
|
* A simple pager adapter that represents 5 ScreenSlidePageFragment objects, in
|
||||||
* sequence.
|
* sequence.
|
||||||
*/
|
*/
|
||||||
private class ScreenSlideFragmentPagerAdapter extends FragmentStateAdapter {
|
private class ScreenSlideFragmentPagerAdapter extends FragmentStateAdapter {
|
||||||
private String TAG = "ScreenSlideFragmentPagerAdapter";
|
private String TAG = "ScreenSlideFragmentPagerAdapter";
|
||||||
|
|
||||||
public ScreenSlideFragmentPagerAdapter(FragmentActivity fa) {
|
public ScreenSlideFragmentPagerAdapter(FragmentActivity fa) {
|
||||||
super(fa);
|
super(fa);
|
||||||
}
|
}
|
||||||
@@ -329,7 +326,6 @@ public class MainActivity2 extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private void showAbout() {
|
private void showAbout() {
|
||||||
mUtil.writeToSysLogFile("MainActivity.showAbout()");
|
mUtil.writeToSysLogFile("MainActivity.showAbout()");
|
||||||
View aboutView = getLayoutInflater().inflate(R.layout.about_layout, null, false);
|
View aboutView = getLayoutInflater().inflate(R.layout.about_layout, null, false);
|
||||||
|
|||||||
@@ -55,7 +55,6 @@ public class MlModelManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieve the file containing the list of available ML models from the server.
|
* Retrieve the file containing the list of available ML models from the server.
|
||||||
* Calls the specified callback function, passing a JSONObject as a parameter when the data has been received and parsed.
|
* Calls the specified callback function, passing a JSONObject as a parameter when the data has been received and parsed.
|
||||||
|
|||||||
@@ -328,12 +328,12 @@ public class OsdUtil {
|
|||||||
public void writeToSysLogFile(String msgStr, String logType) {
|
public void writeToSysLogFile(String msgStr, String logType) {
|
||||||
writeLogEntryToLocalDb(msgStr, logType);
|
writeLogEntryToLocalDb(msgStr, logType);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void writeToSysLogFile(String msgStr) {
|
public void writeToSysLogFile(String msgStr) {
|
||||||
writeLogEntryToLocalDb(msgStr, "v");
|
writeLogEntryToLocalDb(msgStr, "v");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Write a message to the alarm log file, provided mLogAlarms is true.
|
* Write a message to the alarm log file, provided mLogAlarms is true.
|
||||||
*
|
*
|
||||||
@@ -404,8 +404,7 @@ public class OsdUtil {
|
|||||||
public File[] getDataFilesList() {
|
public File[] getDataFilesList() {
|
||||||
File[] files = getDataStorageDir().listFiles();
|
File[] files = getDataStorageDir().listFiles();
|
||||||
Log.d("Files", "Size: " + files.length);
|
Log.d("Files", "Size: " + files.length);
|
||||||
for (int i = 0; i < files.length; i++)
|
for (int i = 0; i < files.length; i++) {
|
||||||
{
|
|
||||||
Log.d("Files", "FileName:" + files[i].getName());
|
Log.d("Files", "FileName:" + files[i].getName());
|
||||||
}
|
}
|
||||||
return (files);
|
return (files);
|
||||||
@@ -459,6 +458,7 @@ public class OsdUtil {
|
|||||||
* It first attempts to parse it as a long integer, in which case it is assumed to
|
* It first attempts to parse it as a long integer, in which case it is assumed to
|
||||||
* be a unix timestamp.
|
* be a unix timestamp.
|
||||||
* If that fails it attempts to parse it as yyyy-MM-dd'T'HH:mm:ss'Z' format.
|
* If that fails it attempts to parse it as yyyy-MM-dd'T'HH:mm:ss'Z' format.
|
||||||
|
*
|
||||||
* @param dateStr String reprenting a date
|
* @param dateStr String reprenting a date
|
||||||
* @return Date object or null if parsing fails.
|
* @return Date object or null if parsing fails.
|
||||||
*/
|
*/
|
||||||
@@ -612,7 +612,6 @@ public class OsdUtil {
|
|||||||
/**
|
/**
|
||||||
* Executes the sqlite query (=SELECT statement)
|
* Executes the sqlite query (=SELECT statement)
|
||||||
* Use as new SelectQueryTask(xxx,xxx,xx,xxxx).execute()
|
* Use as new SelectQueryTask(xxx,xxx,xx,xxxx).execute()
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
static private class SelectQueryTask extends AsyncTask<Void, Void, Cursor> {
|
static private class SelectQueryTask extends AsyncTask<Void, Void, Cursor> {
|
||||||
// Based on https://stackoverflow.com/a/21120199/2104584
|
// Based on https://stackoverflow.com/a/21120199/2104584
|
||||||
@@ -669,7 +668,6 @@ public class OsdUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* pruneSysLogDb() removes data that is older than 7 days
|
* pruneSysLogDb() removes data that is older than 7 days
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -9,7 +9,9 @@ import android.os.Bundle;
|
|||||||
import android.os.CountDownTimer;
|
import android.os.CountDownTimer;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
|
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.webkit.WebSettings;
|
import android.webkit.WebSettings;
|
||||||
@@ -137,7 +139,6 @@ public class RemoteDbActivity extends AppCompatActivity {
|
|||||||
//tv.setText(String.format("%d",datapointsCount));
|
//tv.setText(String.format("%d",datapointsCount));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Remote Database Information
|
// Remote Database Information
|
||||||
tv = (TextView) findViewById(R.id.authStatusTv);
|
tv = (TextView) findViewById(R.id.authStatusTv);
|
||||||
btn = (Button) findViewById(R.id.auth_button);
|
btn = (Button) findViewById(R.id.auth_button);
|
||||||
|
|||||||
@@ -209,7 +209,6 @@ public class ReportSeizureActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private void updateUi() {
|
private void updateUi() {
|
||||||
//Log.v(TAG,"updateUi()");
|
//Log.v(TAG,"updateUi()");
|
||||||
TextView tv;
|
TextView tv;
|
||||||
|
|||||||
@@ -99,7 +99,6 @@ public class SdAlgHr {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private boolean checkSimpleHr(double hrVal) {
|
private boolean checkSimpleHr(double hrVal) {
|
||||||
/**
|
/**
|
||||||
* Check heart rate value against simple thresholds
|
* Check heart rate value against simple thresholds
|
||||||
@@ -116,6 +115,7 @@ public class SdAlgHr {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the average heart rate being used by the Adaptive heart rate algorithm
|
* Returns the average heart rate being used by the Adaptive heart rate algorithm
|
||||||
|
*
|
||||||
* @return Average Heart reate in bpm.
|
* @return Average Heart reate in bpm.
|
||||||
*/
|
*/
|
||||||
public double getAdaptiveHrAverage() {
|
public double getAdaptiveHrAverage() {
|
||||||
@@ -130,10 +130,13 @@ public class SdAlgHr {
|
|||||||
return mAdaptiveHrBuff;
|
return mAdaptiveHrBuff;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CircBuf getHrHistBuff() { return mHrHist; }
|
public CircBuf getHrHistBuff() {
|
||||||
|
return mHrHist;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the average heart rate being used by the Average heart rate algorithm
|
* Returns the average heart rate being used by the Average heart rate algorithm
|
||||||
|
*
|
||||||
* @return Average Heart rate in bpm.
|
* @return Average Heart rate in bpm.
|
||||||
*/
|
*/
|
||||||
public double getAverageHrAverage() {
|
public double getAverageHrAverage() {
|
||||||
@@ -177,7 +180,6 @@ public class SdAlgHr {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public ArrayList<Boolean> checkHr(double hrVal) {
|
public ArrayList<Boolean> checkHr(double hrVal) {
|
||||||
/**
|
/**
|
||||||
* Checks the current Heart Rate reading hrVal against the
|
* Checks the current Heart Rate reading hrVal against the
|
||||||
|
|||||||
@@ -99,6 +99,7 @@ public class SdAlgNn {
|
|||||||
* getPseizureFmt1 - calculate probability of sdData representing seizure-like movement
|
* getPseizureFmt1 - calculate probability of sdData representing seizure-like movement
|
||||||
* using a model with input format #1, which is a simple vector of 125 accelerometer vector
|
* using a model with input format #1, which is a simple vector of 125 accelerometer vector
|
||||||
* magnitude readings.
|
* magnitude readings.
|
||||||
|
*
|
||||||
* @param sdData - seizure detector data as input to the model
|
* @param sdData - seizure detector data as input to the model
|
||||||
* @return probability of data representing seizure-like movement.
|
* @return probability of data representing seizure-like movement.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -154,7 +154,6 @@ public abstract class SdDataSource {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Start timer to check status of watch regularly.
|
// Start timer to check status of watch regularly.
|
||||||
mDataStatusTime = new Time(Time.getCurrentTimezone());
|
mDataStatusTime = new Time(Time.getCurrentTimezone());
|
||||||
// use a timer to check the status of the pebble app on the same frequency
|
// use a timer to check the status of the pebble app on the same frequency
|
||||||
@@ -825,7 +824,8 @@ public abstract class SdDataSource {
|
|||||||
|
|
||||||
// Check we have seen a fidget within the required period, or else assume a fault because watch is not being worn
|
// Check we have seen a fidget within the required period, or else assume a fault because watch is not being worn
|
||||||
if (mFidgetDetectorEnabled) {
|
if (mFidgetDetectorEnabled) {
|
||||||
if (mLastFidget == null) mLastFidget = tnow; // Initialise last fidget time on startup.
|
if (mLastFidget == null)
|
||||||
|
mLastFidget = tnow; // Initialise last fidget time on startup.
|
||||||
|
|
||||||
double accStd = calcRawDataStd(mSdData);
|
double accStd = calcRawDataStd(mSdData);
|
||||||
if (accStd > mFidgetThreshold) {
|
if (accStd > mFidgetThreshold) {
|
||||||
|
|||||||
@@ -40,11 +40,11 @@ import java.nio.IntBuffer;
|
|||||||
import java.util.Timer;
|
import java.util.Timer;
|
||||||
import java.util.TimerTask;
|
import java.util.TimerTask;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import com.google.android.gms.wearable.MessageEvent;
|
import com.google.android.gms.wearable.MessageEvent;
|
||||||
import com.google.android.gms.wearable.WearableListenerService;
|
import com.google.android.gms.wearable.WearableListenerService;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Abstract class for a seizure detector data source. Subclasses include a pebble smart watch data source and a
|
* Abstract class for a seizure detector data source. Subclasses include a pebble smart watch data source and a
|
||||||
* network data source.
|
* network data source.
|
||||||
@@ -744,9 +744,6 @@ public class SdDataSourceAw extends SdDataSource {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -368,6 +368,7 @@ public class SdDataSourceBLE extends SdDataSource {
|
|||||||
}, 100);
|
}, 100);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean permissionsOK() {
|
private boolean permissionsOK() {
|
||||||
if (ActivityCompat.checkSelfPermission(mContext, Manifest.permission.BLUETOOTH_CONNECT) != PackageManager.PERMISSION_GRANTED) {
|
if (ActivityCompat.checkSelfPermission(mContext, Manifest.permission.BLUETOOTH_CONNECT) != PackageManager.PERMISSION_GRANTED) {
|
||||||
// TODO: Consider calling
|
// TODO: Consider calling
|
||||||
@@ -413,8 +414,7 @@ public class SdDataSourceBLE extends SdDataSource {
|
|||||||
mSdData.mHR = (double) heartRate;
|
mSdData.mHR = (double) heartRate;
|
||||||
}
|
}
|
||||||
Log.d(TAG, String.format("onDataReceived(): CHAR_HEART_RATE_MEASUREMENT: %d", heartRate));
|
Log.d(TAG, String.format("onDataReceived(): CHAR_HEART_RATE_MEASUREMENT: %d", heartRate));
|
||||||
}
|
} else if (characteristic.getUuid().toString().equals(CHAR_OSD_ACC_DATA)
|
||||||
else if (characteristic.getUuid().toString().equals(CHAR_OSD_ACC_DATA)
|
|
||||||
|| characteristic.getUuid().toString().equals(CHAR_INFINITIME_ACC_DATA)) {
|
|| characteristic.getUuid().toString().equals(CHAR_INFINITIME_ACC_DATA)) {
|
||||||
//Log.v(TAG,"Received OSD ACC DATA"+characteristic.getValue());
|
//Log.v(TAG,"Received OSD ACC DATA"+characteristic.getValue());
|
||||||
byte[] rawDataBytes = characteristic.getValue();
|
byte[] rawDataBytes = characteristic.getValue();
|
||||||
@@ -473,36 +473,30 @@ public class SdDataSourceBLE extends SdDataSource {
|
|||||||
nRawData = 0;
|
nRawData = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} else if (characteristic.getUuid().toString().equals(CHAR_OSD_BATT_DATA)) {
|
||||||
else if (characteristic.getUuid().toString().equals(CHAR_OSD_BATT_DATA)) {
|
|
||||||
byte batteryPc = characteristic.getValue()[0];
|
byte batteryPc = characteristic.getValue()[0];
|
||||||
mSdData.batteryPc = batteryPc;
|
mSdData.batteryPc = batteryPc;
|
||||||
Log.v(TAG, "onDataReceived(): CHAR_OSD_BATT_DATA: " + String.format("%d", batteryPc));
|
Log.v(TAG, "onDataReceived(): CHAR_OSD_BATT_DATA: " + String.format("%d", batteryPc));
|
||||||
mSdData.haveSettings = true;
|
mSdData.haveSettings = true;
|
||||||
}
|
} else if (characteristic.getUuid().toString().equals(CHAR_BATT_DATA)) {
|
||||||
else if (characteristic.getUuid().toString().equals(CHAR_BATT_DATA)) {
|
|
||||||
byte batteryPc = characteristic.getValue()[0];
|
byte batteryPc = characteristic.getValue()[0];
|
||||||
mSdData.batteryPc = batteryPc;
|
mSdData.batteryPc = batteryPc;
|
||||||
Log.v(TAG, "onDataReceived(): CHAR_BATT_DATA: " + String.format("%d", batteryPc));
|
Log.v(TAG, "onDataReceived(): CHAR_BATT_DATA: " + String.format("%d", batteryPc));
|
||||||
mSdData.haveSettings = true;
|
mSdData.haveSettings = true;
|
||||||
}
|
} else if (characteristic.getUuid().toString().equals(CHAR_OSD_WATCH_ID)) {
|
||||||
else if (characteristic.getUuid().toString().equals(CHAR_OSD_WATCH_ID)) {
|
|
||||||
byte[] rawDataBytes = characteristic.getValue();
|
byte[] rawDataBytes = characteristic.getValue();
|
||||||
String watchId = new String(rawDataBytes, StandardCharsets.UTF_8);
|
String watchId = new String(rawDataBytes, StandardCharsets.UTF_8);
|
||||||
Log.v(TAG, "Received Watch ID: " + watchId);
|
Log.v(TAG, "Received Watch ID: " + watchId);
|
||||||
mSdData.watchSdName = watchId;
|
mSdData.watchSdName = watchId;
|
||||||
}
|
} else if (characteristic.getUuid().toString().equals(CHAR_OSD_WATCH_FW)) {
|
||||||
else if (characteristic.getUuid().toString().equals(CHAR_OSD_WATCH_FW)) {
|
|
||||||
byte[] rawDataBytes = characteristic.getValue();
|
byte[] rawDataBytes = characteristic.getValue();
|
||||||
String watchFwVer = new String(rawDataBytes, StandardCharsets.UTF_8);
|
String watchFwVer = new String(rawDataBytes, StandardCharsets.UTF_8);
|
||||||
Log.v(TAG, "Received Watch Firmware Version: " + watchFwVer);
|
Log.v(TAG, "Received Watch Firmware Version: " + watchFwVer);
|
||||||
mSdData.watchSdVersion = watchFwVer;
|
mSdData.watchSdVersion = watchFwVer;
|
||||||
}
|
} else if (characteristic.getUuid().toString().equals(CHAR_OSD_ACC_FMT)) {
|
||||||
else if (characteristic.getUuid().toString().equals(CHAR_OSD_ACC_FMT)) {
|
|
||||||
mAccFmt = characteristic.getValue()[0];
|
mAccFmt = characteristic.getValue()[0];
|
||||||
Log.v(TAG, "Received Acceleration format code: " + mAccFmt);
|
Log.v(TAG, "Received Acceleration format code: " + mAccFmt);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
Log.v(TAG, "Unrecognised Characteristic Updated " +
|
Log.v(TAG, "Unrecognised Characteristic Updated " +
|
||||||
characteristic.getUuid().toString());
|
characteristic.getUuid().toString());
|
||||||
}
|
}
|
||||||
@@ -534,6 +528,7 @@ public class SdDataSourceBLE extends SdDataSource {
|
|||||||
}
|
}
|
||||||
return (retArr);
|
return (retArr);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCharacteristicRead(BluetoothGatt gatt,
|
public void onCharacteristicRead(BluetoothGatt gatt,
|
||||||
BluetoothGattCharacteristic characteristic,
|
BluetoothGattCharacteristic characteristic,
|
||||||
|
|||||||
@@ -38,7 +38,8 @@ public class SdDataSourceNetwork extends SdDataSource {
|
|||||||
mName = "Network";
|
mName = "Network";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public void start() {
|
@Override
|
||||||
|
public void start() {
|
||||||
// Update preferences.
|
// Update preferences.
|
||||||
Log.v(TAG, "start(): calling updatePrefs()");
|
Log.v(TAG, "start(): calling updatePrefs()");
|
||||||
mUtil.writeToSysLogFile("SdDataSourceNetwork().start()");
|
mUtil.writeToSysLogFile("SdDataSourceNetwork().start()");
|
||||||
@@ -63,7 +64,8 @@ public class SdDataSourceNetwork extends SdDataSource {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public void stop() {
|
@Override
|
||||||
|
public void stop() {
|
||||||
mUtil.writeToSysLogFile("SdDataSourceNetwork().stop()");
|
mUtil.writeToSysLogFile("SdDataSourceNetwork().stop()");
|
||||||
// Stop the data update timer
|
// Stop the data update timer
|
||||||
if (mDataUpdateTimer != null) {
|
if (mDataUpdateTimer != null) {
|
||||||
@@ -76,7 +78,6 @@ public class SdDataSourceNetwork extends SdDataSource {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* updatePrefs() - update basic settings from the SharedPreferences
|
* updatePrefs() - update basic settings from the SharedPreferences
|
||||||
* - defined in res/xml/prefs.xml
|
* - defined in res/xml/prefs.xml
|
||||||
@@ -117,6 +118,7 @@ public class SdDataSourceNetwork extends SdDataSource {
|
|||||||
|
|
||||||
private class DownloadSdDataTask extends AsyncTask<String, Void, SdData> {
|
private class DownloadSdDataTask extends AsyncTask<String, Void, SdData> {
|
||||||
private SdData sdData;
|
private SdData sdData;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected SdData doInBackground(String... urls) {
|
protected SdData doInBackground(String... urls) {
|
||||||
// params comes from the execute() call: params[0] is the url.
|
// params comes from the execute() call: params[0] is the url.
|
||||||
@@ -154,6 +156,7 @@ public class SdDataSourceNetwork extends SdDataSource {
|
|||||||
return sdData;
|
return sdData;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// onPostExecute displays the results of the AsyncTask.
|
// onPostExecute displays the results of the AsyncTask.
|
||||||
@Override
|
@Override
|
||||||
protected void onPostExecute(SdData sdData) {
|
protected void onPostExecute(SdData sdData) {
|
||||||
@@ -187,6 +190,7 @@ public class SdDataSourceNetwork extends SdDataSource {
|
|||||||
}
|
}
|
||||||
return "Done";
|
return "Done";
|
||||||
}
|
}
|
||||||
|
|
||||||
// onPostExecute displays the results of the AsyncTask.
|
// onPostExecute displays the results of the AsyncTask.
|
||||||
@Override
|
@Override
|
||||||
protected void onPostExecute(String s) {
|
protected void onPostExecute(String s) {
|
||||||
@@ -195,7 +199,6 @@ public class SdDataSourceNetwork extends SdDataSource {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Given a URL, establishes an HttpUrlConnection and retrieves
|
// Given a URL, establishes an HttpUrlConnection and retrieves
|
||||||
// the web page content as a InputStream, which it returns as
|
// the web page content as a InputStream, which it returns as
|
||||||
// a string.
|
// a string.
|
||||||
@@ -241,6 +244,4 @@ public class SdDataSourceNetwork extends SdDataSource {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,7 +45,6 @@ import java.util.TimerTask;
|
|||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Abstract class for a seizure detector data source. Subclasses include a pebble smart watch data source and a
|
* Abstract class for a seizure detector data source. Subclasses include a pebble smart watch data source and a
|
||||||
* network data source.
|
* network data source.
|
||||||
@@ -774,7 +773,6 @@ public class SdDataSourcePebble extends SdDataSource {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -95,9 +95,6 @@ public class SdDataSourcePhone extends SdDataSource implements SensorEventListen
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSensorChanged(SensorEvent event) {
|
public void onSensorChanged(SensorEvent event) {
|
||||||
if (event.sensor.getType() == Sensor.TYPE_ACCELEROMETER) {
|
if (event.sensor.getType() == Sensor.TYPE_ACCELEROMETER) {
|
||||||
@@ -183,8 +180,6 @@ public class SdDataSourcePhone extends SdDataSource implements SensorEventListen
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -316,7 +316,6 @@ public class SdServer extends Service implements SdDataReceiver {
|
|||||||
mSdDataSource.start();
|
mSdDataSource.start();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Record last time we sent an SMS so we can limit rate of SMS
|
// Record last time we sent an SMS so we can limit rate of SMS
|
||||||
// sending to one per minute. We set it to one minute ago (60000 milliseconds)
|
// sending to one per minute. We set it to one minute ago (60000 milliseconds)
|
||||||
mSMSTime = new Time(Time.getCurrentTimezone());
|
mSMSTime = new Time(Time.getCurrentTimezone());
|
||||||
@@ -1373,7 +1372,6 @@ public class SdServer extends Service implements SdDataReceiver {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* onSdLocationReceived - called with the best estimate location after mLocationReceiver times out.
|
* onSdLocationReceived - called with the best estimate location after mLocationReceiver times out.
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
private void sendSMS(String phoneNo, String msgStr) {
|
private void sendSMS(String phoneNo, String msgStr) {
|
||||||
Log.i(TAG, "sendSMS() - Sending to " + phoneNo);
|
Log.i(TAG, "sendSMS() - Sending to " + phoneNo);
|
||||||
@@ -1781,6 +1779,7 @@ public class SdServer extends Service implements SdDataReceiver {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* isNotificationShown - returns true if the specified notificationID is shown, otherwise returns false.
|
* isNotificationShown - returns true if the specified notificationID is shown, otherwise returns false.
|
||||||
|
*
|
||||||
* @param notificationId - Notification ID to check
|
* @param notificationId - Notification ID to check
|
||||||
* @return true if the specified notification is displayed, otherwise false.
|
* @return true if the specified notification is displayed, otherwise false.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -31,7 +31,6 @@ import android.os.IBinder;
|
|||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Defines callbacks for service binding, passed to bindService()
|
* Defines callbacks for service binding, passed to bindService()
|
||||||
*/
|
*/
|
||||||
@@ -68,6 +67,7 @@ public class SdServiceConnection implements ServiceConnection {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if the service has received seizure detector data.
|
* Check if the service has received seizure detector data.
|
||||||
|
*
|
||||||
* @return true if data has been received.
|
* @return true if data has been received.
|
||||||
*/
|
*/
|
||||||
public boolean hasSdData() {
|
public boolean hasSdData() {
|
||||||
@@ -81,6 +81,7 @@ public class SdServiceConnection implements ServiceConnection {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if the service has received seizure detector settings.
|
* Check if the service has received seizure detector settings.
|
||||||
|
*
|
||||||
* @return true if settings have been received.
|
* @return true if settings have been received.
|
||||||
*/
|
*/
|
||||||
public boolean hasSdSettings() {
|
public boolean hasSdSettings() {
|
||||||
@@ -96,6 +97,7 @@ public class SdServiceConnection implements ServiceConnection {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if the pebble watch is connected to the server device via bluetooth.
|
* Check if the pebble watch is connected to the server device via bluetooth.
|
||||||
|
*
|
||||||
* @return true if watch connected.
|
* @return true if watch connected.
|
||||||
*/
|
*/
|
||||||
public boolean watchConnected() {
|
public boolean watchConnected() {
|
||||||
@@ -111,6 +113,7 @@ public class SdServiceConnection implements ServiceConnection {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if the openseizuredetector pebble watch app is running..
|
* Check if the openseizuredetector pebble watch app is running..
|
||||||
|
*
|
||||||
* @return true if watch app running.
|
* @return true if watch app running.
|
||||||
*/
|
*/
|
||||||
public boolean pebbleAppRunning() {
|
public boolean pebbleAppRunning() {
|
||||||
|
|||||||
@@ -113,8 +113,6 @@ public class StartupActivity extends AppCompatActivity {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|||||||
@@ -139,6 +139,7 @@ public abstract class WebApiConnection {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Mark all of the events with IDs contained in eventList as the specified type and subtype.
|
* Mark all of the events with IDs contained in eventList as the specified type and subtype.
|
||||||
|
*
|
||||||
* @param eventList list of String IDs of the events to mark as unknown.
|
* @param eventList list of String IDs of the events to mark as unknown.
|
||||||
* @param typeStr
|
* @param typeStr
|
||||||
* @param subTypeStr
|
* @param subTypeStr
|
||||||
@@ -240,6 +241,7 @@ public abstract class WebApiConnection {
|
|||||||
markUnverifiedEventsAsTypeSubtype("Unknown", "");
|
markUnverifiedEventsAsTypeSubtype("Unknown", "");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean markUnverifiedEventsAsFalseAlarm() {
|
public boolean markUnverifiedEventsAsFalseAlarm() {
|
||||||
markUnverifiedEventsAsTypeSubtype("False Alarm", "");
|
markUnverifiedEventsAsTypeSubtype("False Alarm", "");
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -110,8 +110,6 @@ public class WebApiConnection_osdapi extends WebApiConnection {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public boolean isLoggedIn() {
|
public boolean isLoggedIn() {
|
||||||
String authToken = getStoredToken();
|
String authToken = getStoredToken();
|
||||||
Log.v(TAG, "isLoggedIn(): token=" + authToken);
|
Log.v(TAG, "isLoggedIn(): token=" + authToken);
|
||||||
@@ -517,6 +515,7 @@ public class WebApiConnection_osdapi extends WebApiConnection {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Retieve the user profile of the authenticated user from the server, and return it to the callback function.
|
* Retieve the user profile of the authenticated user from the server, and return it to the callback function.
|
||||||
|
*
|
||||||
* @param callback - function to be called with a JSONObject as a parameter that contains the user profile data.
|
* @param callback - function to be called with a JSONObject as a parameter that contains the user profile data.
|
||||||
* @return true if request sent successfully, or else false.
|
* @return true if request sent successfully, or else false.
|
||||||
*/
|
*/
|
||||||
@@ -572,8 +571,6 @@ public class WebApiConnection_osdapi extends WebApiConnection {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieve the file containing the standard event types from the server.
|
* Retrieve the file containing the standard event types from the server.
|
||||||
* Calls the specified callback function, passing a JSONObject as a parameter when the data has been received and parsed.
|
* Calls the specified callback function, passing a JSONObject as a parameter when the data has been received and parsed.
|
||||||
@@ -680,11 +677,10 @@ public class WebApiConnection_osdapi extends WebApiConnection {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieve a trivial file from the server to check we have a good server connection.
|
* Retrieve a trivial file from the server to check we have a good server connection.
|
||||||
* sets mServerConnectionOk.
|
* sets mServerConnectionOk.
|
||||||
|
*
|
||||||
* @return true if request sent successfully or else false.
|
* @return true if request sent successfully or else false.
|
||||||
*/
|
*/
|
||||||
public boolean checkServerConnection() {
|
public boolean checkServerConnection() {
|
||||||
|
|||||||
Reference in New Issue
Block a user