use of com.eveningoutpost.dexdrip.cgm.medtrum.messages.BackFillTx in project xDrip by NightscoutFoundation.
the class MedtrumCollectionService method backFillIfNeeded.
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;
// after warmup only
if (startTick < 62)
startTick = 62;
if (endTick < 1)
endTick = 1;
startTick += offset;
if ((startTick != endTick) && (endTick > startTick)) {
if (endTick - startTick > MAX_BACKFILL_ENTRIES) {
// only ask this many at once
endTick = startTick + MAX_BACKFILL_ENTRIES;
}
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;
}
use of com.eveningoutpost.dexdrip.cgm.medtrum.messages.BackFillTx in project xDrip-plus by jamorham.
the class MedtrumCollectionService method backFillIfNeeded.
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;
// after warmup only
if (startTick < 62)
startTick = 62;
if (endTick < 1)
endTick = 1;
startTick += offset;
if ((startTick != endTick) && (endTick > startTick)) {
if (endTick - startTick > MAX_BACKFILL_ENTRIES) {
// only ask this many at once
endTick = startTick + MAX_BACKFILL_ENTRIES;
}
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;
}
Aggregations