Skip to content

Commit

Permalink
Verify Dex start time is valid
Browse files Browse the repository at this point in the history
  • Loading branch information
Navid200 committed Apr 7, 2024
1 parent 3a1d445 commit 110d861
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 110d861

Please sign in to comment.