Commit dd6fed9d authored by Craig Earley's avatar Craig Earley Committed by Charlie Peck (CCG)
Browse files

reads and displays the battery level

parent 3066afdd
......@@ -197,6 +197,9 @@ public class ReadingsDatabase extends SQLiteOpenHelper {
" satellites int not null," +
" value_2 decimal," +
" value_3 decimal," +
" value_4 decimal," +
" value_5 decimal," +
" value_6 decimal," +
//check if these keys are correct (e.g. recordtime sensible for a stream?)
" primary key(tripID, siteID, sectorID, hostID, sensorID, recordTime)," +
" foreign key(tripID, siteID, sectorID) references fieldday_sector(tripID, siteID, sectorID)," +
......@@ -224,6 +227,9 @@ public class ReadingsDatabase extends SQLiteOpenHelper {
" imageFilename text," +
" value_2 decimal," +
" value_3 decimal," +
" value_4 decimal," +
" value_5 decimal," +
" value_6 decimal," +
" primary key(tripID, siteID, sectorID, spotID, hostID, sensorID, recordTime)," +
" foreign key(tripID, siteID, sectorID, spotID) references fieldday_spot(tripID, siteID, sectorID, spotID)," +
" foreign key(hostID) references fieldday_host(hostID)," +
......
......@@ -62,6 +62,7 @@ public class SensorSampleActivity extends AppCompatActivity {
public LocationManager locationManager;
public LocationListener locationListener;
public static TextView longAndLat, satellites, accuracy, elevation;
public static TextView batteryStatus;
public static Resources res;
public static Spinner siteSpinner, sectorSpinner;
public static EditText spotET;
......@@ -128,11 +129,15 @@ public class SensorSampleActivity extends AppCompatActivity {
adapter.notifyDataSetChanged();
progress.dismiss();
calibrateButton.setVisibility(View.VISIBLE);
Log.d("BATT_TEST_CONN", adapter.toString());
batteryStatus.setText("battery");
} else if (SensorSampleService.ACTION_UPDATED_LIST.equals(intent.getAction())) {
sensors = intent.getParcelableArrayListExtra(SensorSampleService.SENSOR_LIST);
adapter.clear();
adapter.addAll(sensors);
adapter.notifyDataSetChanged();
Log.d("BATT_TEST_UP", adapter.toString());
batteryStatus.setText("new batt level");
} else if (SensorSampleService.ACTION_DISCONNECTED.equals(intent.getAction())) {
buttonHandler.removeMessages(0);
buttonHandler.removeCallbacksAndMessages(buttonRunner);
......@@ -427,6 +432,7 @@ public class SensorSampleActivity extends AppCompatActivity {
siteSpinner = findViewById(R.id.site);
sectorSpinner = findViewById(R.id.sector);
spotET = findViewById(R.id.spotNumber);
batteryStatus = findViewById(R.id.battery_status);
streamButton = findViewById(R.id.streamButton);
sampleButton = findViewById(R.id.sampleButton);
streamOn = res.getDrawable(R.drawable.stream_pushed, null);
......
......@@ -251,7 +251,7 @@ public class SensorSampleService extends Service implements SensorEventListener
PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
mWakeLock = Objects.requireNonNull(pm).newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "fieldday:samplingwakelock");
mWakeLock.acquire(100*60*1000L /*100 minutes*/);
mWakeLock.acquire();
if (sampleOnce) {
Log.d(TAG, "writeToDB.");
......
......@@ -2,5 +2,5 @@
<!-- Default screen margins, per the Android Design guidelines. -->
<dimen name="activity_horizontal_margin">16dp</dimen>
<dimen name="activity_vertical_margin">16dp</dimen>
<dimen name="sample_button_font_size">25sp</dimen>
<dimen name="sample_button_font_size">30sp</dimen>
</resources>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment