private void get_data() { status("Asking for data"); sendTx(new StatusTx()); }
private void get_data() { status("Asking for data"); sendTx(new StatusTx()); }
private void check_calibrate() { final Pair<Long, Integer> calibration = Medtrum.getCalibration(); if (calibration != null) { status("Calibrating"); try { sendTx(new CalibrateTx(serial, calibration.first, calibration.second)); } catch (InvalidAlgorithmParameterException e) { UserError.Log.wtf(TAG, "Cannot calibrate: " + e); } } else { changeState(state.next()); } }
private void check_calibrate() { final Pair<Long, Integer> calibration = Medtrum.getCalibration(); if (calibration != null) { status("Calibrating"); try { sendTx(new CalibrateTx(serial, calibration.first, calibration.second)); } catch (InvalidAlgorithmParameterException e) { UserError.Log.wtf(TAG, "Cannot calibrate: " + e); } } else { changeState(state.next()); } }
private boolean backFillIfNeeded(final AnnexARx annex, int offset) { if (annex == null) return false; if (!annex.isStateOkForBackFill()) return false; final Pair<Long, Long> backfillTimes = BackfillAssessor.check(); if (backfillTimes != null) { int startTick = TimeKeeper.tickCounterFromTimeStamp(serial, backfillTimes.first); int endTick = TimeKeeper.tickCounterFromTimeStamp(serial, backfillTimes.second); if (endTick >= annex.sensorAge) endTick = annex.sensorAge - 1; if (startTick < 62) startTick = 62; // after warmup only if (endTick < 1) endTick = 1; startTick += offset; if ((startTick != endTick) && (endTick > startTick)) { if (endTick - startTick > MAX_BACKFILL_ENTRIES) { endTick = startTick + MAX_BACKFILL_ENTRIES; // only ask this many at once } UserError.Log.d(TAG, "Ask backfill: start: " + startTick + " end: " + endTick); requestedBackfillSize = endTick - startTick; sendTx(new BackFillTx(startTick, endTick)); return true; } else { UserError.Log.d(TAG, "Not backfilling with start and end tick at: " + startTick + " " + endTick); } } return false; }
private boolean backFillIfNeeded(final AnnexARx annex, int offset) { if (annex == null) return false; if (!annex.isStateOkForBackFill()) return false; final Pair<Long, Long> backfillTimes = BackfillAssessor.check(); if (backfillTimes != null) { int startTick = TimeKeeper.tickCounterFromTimeStamp(serial, backfillTimes.first); int endTick = TimeKeeper.tickCounterFromTimeStamp(serial, backfillTimes.second); if (endTick >= annex.sensorAge) endTick = annex.sensorAge - 1; if (startTick < 62) startTick = 62; // after warmup only if (endTick < 1) endTick = 1; startTick += offset; if ((startTick != endTick) && (endTick > startTick)) { if (endTick - startTick > MAX_BACKFILL_ENTRIES) { endTick = startTick + MAX_BACKFILL_ENTRIES; // only ask this many at once } UserError.Log.d(TAG, "Ask backfill: start: " + startTick + " end: " + endTick); requestedBackfillSize = endTick - startTick; sendTx(new BackFillTx(startTick, endTick)); return true; } else { UserError.Log.d(TAG, "Not backfilling with start and end tick at: " + startTick + " " + endTick); } } return false; }
sendTx(new AuthTx(serial));
sendTx(new AuthTx(serial));