From 3a1d4452225cf54cdfba044bc280fe3f25477cc9 Mon Sep 17 00:00:00 2001 From: Navid Date: Sun, 7 Apr 2024 10:58:17 -0400 Subject: [PATCH] Verify collection type --- .../dexdrip/utilitymodels/BroadcastGlucose.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) 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 04b3b7fddd..6eb15ee8fa 100644 --- a/app/src/main/java/com/eveningoutpost/dexdrip/utilitymodels/BroadcastGlucose.java +++ b/app/src/main/java/com/eveningoutpost/dexdrip/utilitymodels/BroadcastGlucose.java @@ -5,6 +5,7 @@ import static com.eveningoutpost.dexdrip.services.Ob1G5CollectionService.getTransmitterID; import static com.eveningoutpost.dexdrip.utilitymodels.Constants.MINUTE_IN_MS; import static com.eveningoutpost.dexdrip.utilitymodels.Unitized.usingMgDl; +import static com.eveningoutpost.dexdrip.utils.DexCollectionType.getBestCollectorHardwareName; import android.content.Intent; import android.os.Bundle; @@ -66,7 +67,7 @@ public static void sendLocalBroadcast(final BgReading bgReading) { UserError.Log.i("SENSOR QUEUE:", "Broadcast data"); - String collectorName = DexCollectionType.getBestCollectorHardwareName(); + String collectorName = getBestCollectorHardwareName(); if (collectorName.equals("G6 Native") || collectorName.equals("G7")) { if (collectorName.equals("G7")) { collectorName = "G6 Native"; // compatibility for older AAPS @@ -150,9 +151,11 @@ public static void sendLocalBroadcast(final BgReading bgReading) { } bundle.putInt(Intents.EXTRA_SENSOR_BATTERY, BridgeBattery.getBestBridgeBattery()); - if (FirmwareCapability.isDeviceG7(getTransmitterID())) { // If there is connectivity and firmware is known and it is either G7 or One+ - bundle.putLong(Intents.EXTRA_SENSOR_STARTED_AT, DexSessionKeeper.getStart()); - } else { // If there is no connectivity yet or if we are not using G7 ot One+ + 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()); + } + } else { // If we are not using G7 or One+ bundle.putLong(Intents.EXTRA_SENSOR_STARTED_AT, sensor.started_at); } bundle.putLong(Intents.EXTRA_TIMESTAMP, bgReading.timestamp);