boolean usable() { return calibrationState().usableGlucose(); }
lastGlucosePacket = JoH.tsl(); DexTimeKeeper.updateAge(getTransmitterID(), glucose.timestamp); if (glucose.usable() || (glucose.insufficient() && Pref.getBoolean("ob1_g5_use_insufficiently_calibrated", true))) { UserError.Log.d(TAG, "Got usable glucose data from G5!!"); final BgReading bgReading = BgReading.bgReadingInsertFromG5(glucose.glucose, JoH.tsl()); if (bgReading != null) { try { bgReading.calculated_value_slope = glucose.getTrend() / Constants.MINUTE_IN_MS; // note this is different to the typical calculated slope, (normally delta) if (bgReading.calculated_value_slope == Double.NaN) { bgReading.hide_slope = true; if (glucose.insufficient()) { bgReading.appendSourceInfo("Insufficient").save(); lastUsableGlucosePacket = lastGlucosePacket; parent.lastUsableGlucosePacketTime = lastUsableGlucosePacket; if (glucose.getPredictedGlucose() != null) { Prediction.create(JoH.tsl(), glucose.getPredictedGlucose(), "EGlucoseRx").save(); if (glucose.calibrationState().sensorFailed()) { if (JoH.pratelimit("G5 Sensor Failed", 3600 * 3)) { JoH.showNotification(devName() + " SENSOR FAILED", "Sensor reporting failed", null, Constants.G5_SENSOR_ERROR, true, true, false);
lastGlucosePacket = JoH.tsl(); DexTimeKeeper.updateAge(getTransmitterID(), glucose.timestamp); if (glucose.usable() || (glucose.insufficient() && Pref.getBoolean("ob1_g5_use_insufficiently_calibrated", true))) { UserError.Log.d(TAG, "Got usable glucose data from G5!!"); final BgReading bgReading = BgReading.bgReadingInsertFromG5(glucose.glucose, JoH.tsl()); if (bgReading != null) { try { bgReading.calculated_value_slope = glucose.getTrend() / Constants.MINUTE_IN_MS; // note this is different to the typical calculated slope, (normally delta) if (bgReading.calculated_value_slope == Double.NaN) { bgReading.hide_slope = true; if (glucose.insufficient()) { bgReading.appendSourceInfo("Insufficient").save(); lastUsableGlucosePacket = lastGlucosePacket; parent.lastUsableGlucosePacketTime = lastUsableGlucosePacket; if (glucose.getPredictedGlucose() != null) { Prediction.create(JoH.tsl(), glucose.getPredictedGlucose(), "EGlucoseRx").save(); if (glucose.calibrationState().sensorFailed()) { if (JoH.pratelimit("G5 Sensor Failed", 3600 * 3)) { JoH.showNotification(devName() + " SENSOR FAILED", "Sensor reporting failed", null, Constants.G5_SENSOR_ERROR, true, true, false);
lastGlucosePacket = JoH.tsl(); DexTimeKeeper.updateAge(getTransmitterID(), glucose.timestamp); if (glucose.usable() || (glucose.insufficient() && Pref.getBoolean("ob1_g5_use_insufficiently_calibrated", true))) { UserError.Log.d(TAG, "Got usable glucose data from G5!!"); final BgReading bgReading = BgReading.bgReadingInsertFromG5(glucose.glucose, JoH.tsl()); if (bgReading != null) { try { bgReading.calculated_value_slope = glucose.getTrend() / Constants.MINUTE_IN_MS; // note this is different to the typical calculated slope, (normally delta) if (bgReading.calculated_value_slope == Double.NaN) { bgReading.hide_slope = true; if (glucose.insufficient()) { bgReading.appendSourceInfo("Insufficient").save(); lastUsableGlucosePacket = lastGlucosePacket; parent.lastUsableGlucosePacketTime = lastUsableGlucosePacket; if (glucose.getPredictedGlucose() != null) { Prediction.create(JoH.tsl(), glucose.getPredictedGlucose(), "EGlucoseRx").save(); if (glucose.calibrationState().sensorFailed()) { if (JoH.pratelimit("G5 Sensor Failed", 3600 * 3)) { JoH.showNotification(devName() + " SENSOR FAILED", "Sensor reporting failed", null, Constants.G5_SENSOR_ERROR, true, true, false);
boolean insufficient() { return calibrationState().insufficientCalibration(); }
boolean OkToCalibrate() { return calibrationState().readyForCalibration(); }
boolean insufficient() { return calibrationState().insufficientCalibration(); }
boolean usable() { return calibrationState().usableGlucose(); }
boolean usable() { return calibrationState().usableGlucose(); }
boolean insufficient() { return calibrationState().insufficientCalibration(); }
boolean OkToCalibrate() { return calibrationState().readyForCalibration(); }
boolean OkToCalibrate() { return calibrationState().readyForCalibration(); }
private static void glucoseRxCommon(final BaseGlucoseRxMessage glucose, final Ob1G5CollectionService parent, final RxBleConnection connection) { if (JoH.ratelimit("ob1-g5-also-read-raw", 20)) { enqueueUniqueCommand(new SensorTxMessage(), "Also read raw"); } if (JoH.pratelimit("g5-tx-time-since", 7200) || glucose.calibrationState().warmingUp() || !DexSessionKeeper.isStarted()) { if (JoH.ratelimit("g5-tx-time-governer", 30)) { enqueueUniqueCommand(new TimeTxMessage(), "Periodic Query Time"); } } // TODO check firmware version if (glucose.calibrationState().readyForBackfill() && !parent.getBatteryStatusNow) { backFillIfNeeded(parent, connection); } processGlucoseRxMessage(parent, glucose); parent.updateLast(JoH.tsl()); parent.clearErrors(); }
private static void glucoseRxCommon(final BaseGlucoseRxMessage glucose, final Ob1G5CollectionService parent, final RxBleConnection connection) { if (JoH.ratelimit("ob1-g5-also-read-raw", 20)) { enqueueUniqueCommand(new SensorTxMessage(), "Also read raw"); } if (JoH.pratelimit("g5-tx-time-since", 7200) || glucose.calibrationState().warmingUp() || !DexSessionKeeper.isStarted()) { if (JoH.ratelimit("g5-tx-time-governer", 30)) { enqueueUniqueCommand(new TimeTxMessage(), "Periodic Query Time"); } } // TODO check firmware version if (glucose.calibrationState().readyForBackfill() && !parent.getBatteryStatusNow) { backFillIfNeeded(parent, connection); } processGlucoseRxMessage(parent, glucose); parent.updateLast(JoH.tsl()); parent.clearErrors(); }
private static void glucoseRxCommon(final BaseGlucoseRxMessage glucose, final Ob1G5CollectionService parent, final RxBleConnection connection) { if (JoH.ratelimit("ob1-g5-also-read-raw", 20)) { enqueueUniqueCommand(new SensorTxMessage(), "Also read raw"); } if (JoH.pratelimit("g5-tx-time-since", 7200) || glucose.calibrationState().warmingUp() || !DexSessionKeeper.isStarted()) { if (JoH.ratelimit("g5-tx-time-governer", 30)) { enqueueUniqueCommand(new TimeTxMessage(), "Periodic Query Time"); } } // TODO check firmware version if (glucose.calibrationState().readyForBackfill() && !parent.getBatteryStatusNow) { backFillIfNeeded(parent, connection); } processGlucoseRxMessage(parent, glucose); parent.updateLast(JoH.tsl()); parent.clearErrors(); }