From 110d8619f7b088e556429a3b08252aa2f3b76618 Mon Sep 17 00:00:00 2001 From: Navid Date: Sun, 7 Apr 2024 14:05:41 -0400 Subject: [PATCH] Verify Dex start time is valid --- .../dexdrip/utilitymodels/BroadcastGlucose.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/eveningoutpost/dexdrip/utilitymodels/BroadcastGlucose.java b/app/src/main/java/com/eveningoutpost/dexdrip/utilitymodels/BroadcastGlucose.java index 6eb15ee8fa..975eb64085 100644 --- a/app/src/main/java/com/eveningoutpost/dexdrip/utilitymodels/BroadcastGlucose.java +++ b/app/src/main/java/com/eveningoutpost/dexdrip/utilitymodels/BroadcastGlucose.java @@ -30,6 +30,7 @@ public class BroadcastGlucose { private static final String TAG = "BroadcastGlucose"; private static long lastTimestamp = 0; + private static long dexStartedAt = 0; public static void sendLocalBroadcast(final BgReading bgReading) { if (SendXdripBroadcast.enabled()) { @@ -153,7 +154,10 @@ public static void sendLocalBroadcast(final BgReading bgReading) { bundle.putInt(Intents.EXTRA_SENSOR_BATTERY, BridgeBattery.getBestBridgeBattery()); if (getBestCollectorHardwareName().equals("G7")) {// If we are using G7 or One+ if (FirmwareCapability.isDeviceG7(getTransmitterID())) { // Only if there is connectivity - bundle.putLong(Intents.EXTRA_SENSOR_STARTED_AT, DexSessionKeeper.getStart()); + dexStartedAt = DexSessionKeeper.getStart(); // Session start time reported by the Dexcom transmitter + if (dexStartedAt > 0) { // Only if dexStartedAt is valid + bundle.putLong(Intents.EXTRA_SENSOR_STARTED_AT, dexStartedAt); + } } } else { // If we are not using G7 or One+ bundle.putLong(Intents.EXTRA_SENSOR_STARTED_AT, sensor.started_at);