Example #1
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_pressure_monitor);
    sensorManager = (SensorManager) getSystemService(SENSOR_SERVICE);
    pressuremeter = sensorManager.getDefaultSensor(Sensor.TYPE_PRESSURE);
    textViewPressure = (TextView) findViewById(R.id.textViewPressure);
    radioGroup = (RadioGroup) findViewById(R.id.radioGroup1);
    radioGroup.setOnCheckedChangeListener(
        new OnCheckedChangeListener() {

          @Override
          public void onCheckedChanged(RadioGroup group, int checkedId) {
            if (checkedId == R.id.preasure) sensorId = 0;
            else if (checkedId == R.id.altitude) sensorId = 1;
            else sensorId = 2;
            plotLongHistory();
          }
        });
    setTitle("Pressure");

    // setup the APR History plot:
    preHistoryPlot = (XYPlot) findViewById(R.id.pressurePlot);
    preHistoryPlot.setRangeBoundaries(900, 1300, BoundaryMode.AUTO);
    preHistoryPlot.setDomainBoundaries(0, 100, BoundaryMode.AUTO); // FIXED);
    preHistoryPlot.addSeries(
        pressureHistorySeries,
        new LineAndPointFormatter(
            Color.BLACK, Color.RED, null, new PointLabelFormatter(Color.TRANSPARENT)));
    preHistoryPlot.setDomainStepValue(5);
    preHistoryPlot.setTicksPerRangeLabel(3);
    // preHistoryPlot.setDomainLabel("Sample Index");
    preHistoryPlot.getDomainLabelWidget().pack();
    preHistoryPlot.setRangeLabel("Temperature (ºC)");
    preHistoryPlot.getRangeLabelWidget().pack();
    preHistoryPlot.setRangeLabel("Pressure (hPa)");

    longHistoryPlot = (XYPlot) findViewById(R.id.longHistoryPlot);
    longHistoryPlot.setRangeBoundaries(900, 1300, BoundaryMode.AUTO);
    longHistoryPlot.setDomainBoundaries(0, 100, BoundaryMode.AUTO); // FIXED);
    longHistoryPlot.addSeries(
        longHistorySeries,
        new LineAndPointFormatter(
            Color.BLACK, Color.BLUE, null, new PointLabelFormatter(Color.TRANSPARENT)));
    longHistoryPlot.setDomainStepValue(5);
    longHistoryPlot.setTicksPerRangeLabel(3);
    longHistoryPlot.getDomainLabelWidget().pack();
    longHistoryPlot.setRangeLabel("Temperature (ºC)");
    longHistoryPlot.getRangeLabelWidget().pack();
    longHistoryPlot.setRangeLabel("Pressure (hPa)");

    // TEST
    if (!SamplingService.isRunning(this)) {
      SamplingAlarm.SetAlarm(this);
    }
  }
Example #2
0
 private void startSamplingService() {
   Session.setCurrentSamplingMode(selectedMode);
   boolean success = samplingService.startSampling();
   if (success) {
     Session.resetSummary();
     Session.setSamplingStartTime(System.currentTimeMillis());
     clearSummaryTable();
     rg.setEnabled(false);
   } else {
     startStop.toggle();
   }
 }
Example #3
0
 private void stopSamplingService() {
   samplingService.stopSampling();
   Session.setSamplingStopTime(System.currentTimeMillis());
   rg.setEnabled(true);
   populateSummaryTable();
 }