From 7d49c34f0c742667e9b7a151478c80de74d6a268 Mon Sep 17 00:00:00 2001 From: Navid Date: Mon, 22 Apr 2024 08:48:08 -0400 Subject: [PATCH 1/8] Broadcast start time from transmitter for G6 as well --- .../utilitymodels/BroadcastGlucose.java | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 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 975eb64085..5fc7afa0f2 100644 --- a/app/src/main/java/com/eveningoutpost/dexdrip/utilitymodels/BroadcastGlucose.java +++ b/app/src/main/java/com/eveningoutpost/dexdrip/utilitymodels/BroadcastGlucose.java @@ -31,6 +31,8 @@ public class BroadcastGlucose { private static final String TAG = "BroadcastGlucose"; private static long lastTimestamp = 0; private static long dexStartedAt = 0; + private static boolean connectedToG7 = false; + private static boolean connectedToG6 = false; public static void sendLocalBroadcast(final BgReading bgReading) { if (SendXdripBroadcast.enabled()) { @@ -152,14 +154,18 @@ 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 - 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); - } + if (getBestCollectorHardwareName().equals("G7") && FirmwareCapability.isDeviceG7(getTransmitterID())) {// If we are using G7 or One+ and there is connectivity + connectedToG7 = true; + } + if (getBestCollectorHardwareName().equals("G6 Native") && FirmwareCapability.isTransmitterRawIncapable(getTransmitterID())) {// If we are using a Firefly (modified or not) and there is connectivity + connectedToG6 = true; + } + if (connectedToG6 || connectedToG7) { // Only if there is connectivity with G6 or G7 + 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+ + } else { // If we are not using G7, One+ or G6, or there is no connectivity yet bundle.putLong(Intents.EXTRA_SENSOR_STARTED_AT, sensor.started_at); } bundle.putLong(Intents.EXTRA_TIMESTAMP, bgReading.timestamp); From 08e5bde9717ec5be7024c8e775576a22ea2d7c7f Mon Sep 17 00:00:00 2001 From: Navid Date: Mon, 22 Apr 2024 09:25:04 -0400 Subject: [PATCH 2/8] Broadcast nothing if not connected --- .../utilitymodels/BroadcastGlucose.java | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 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 5fc7afa0f2..2a184ed30c 100644 --- a/app/src/main/java/com/eveningoutpost/dexdrip/utilitymodels/BroadcastGlucose.java +++ b/app/src/main/java/com/eveningoutpost/dexdrip/utilitymodels/BroadcastGlucose.java @@ -33,6 +33,7 @@ public class BroadcastGlucose { private static long dexStartedAt = 0; private static boolean connectedToG7 = false; private static boolean connectedToG6 = false; + private static boolean usingG6OrG7 = false; public static void sendLocalBroadcast(final BgReading bgReading) { if (SendXdripBroadcast.enabled()) { @@ -154,18 +155,23 @@ public static void sendLocalBroadcast(final BgReading bgReading) { } bundle.putInt(Intents.EXTRA_SENSOR_BATTERY, BridgeBattery.getBestBridgeBattery()); - if (getBestCollectorHardwareName().equals("G7") && FirmwareCapability.isDeviceG7(getTransmitterID())) {// If we are using G7 or One+ and there is connectivity + if (getBestCollectorHardwareName().equals("G7") || getBestCollectorHardwareName().equals("Native G6")) { // If we are using Firefly, G7 or One+ + usingG6OrG7 = true; + } + if (getBestCollectorHardwareName().equals("G7") && FirmwareCapability.isDeviceG7(getTransmitterID())) { // If we are using G7 or One+ and there is connectivity connectedToG7 = true; } - if (getBestCollectorHardwareName().equals("G6 Native") && FirmwareCapability.isTransmitterRawIncapable(getTransmitterID())) {// If we are using a Firefly (modified or not) and there is connectivity + if (getBestCollectorHardwareName().equals("G6 Native") && FirmwareCapability.isTransmitterRawIncapable(getTransmitterID())) { // If we are using a Firefly (modified or not) and there is connectivity connectedToG6 = true; } - if (connectedToG6 || connectedToG7) { // Only if there is connectivity with G6 or G7 - 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); + if (usingG6OrG7) { // If we are using Firefly or G7 + if (connectedToG6 || connectedToG7) { // Only if there is connectivity + 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, One+ or G6, or there is no connectivity yet + } else { // If we are not using G7, One+ or Firefly bundle.putLong(Intents.EXTRA_SENSOR_STARTED_AT, sensor.started_at); } bundle.putLong(Intents.EXTRA_TIMESTAMP, bgReading.timestamp); From 733da1067feb0d1479a2b599c391a487f0dde2a2 Mon Sep 17 00:00:00 2001 From: Navid Date: Mon, 22 Apr 2024 19:56:49 -0400 Subject: [PATCH 3/8] Any G6 in native mode --- .../dexdrip/utilitymodels/BroadcastGlucose.java | 4 ++-- 1 file changed, 2 insertions(+), 2 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 2a184ed30c..7427b5ef9f 100644 --- a/app/src/main/java/com/eveningoutpost/dexdrip/utilitymodels/BroadcastGlucose.java +++ b/app/src/main/java/com/eveningoutpost/dexdrip/utilitymodels/BroadcastGlucose.java @@ -155,13 +155,13 @@ public static void sendLocalBroadcast(final BgReading bgReading) { } bundle.putInt(Intents.EXTRA_SENSOR_BATTERY, BridgeBattery.getBestBridgeBattery()); - if (getBestCollectorHardwareName().equals("G7") || getBestCollectorHardwareName().equals("Native G6")) { // If we are using Firefly, G7 or One+ + if (getBestCollectorHardwareName().equals("G7") || getBestCollectorHardwareName().equals("Native G6")) { // If we are using G7 or One+, or G6 in native mode usingG6OrG7 = true; } if (getBestCollectorHardwareName().equals("G7") && FirmwareCapability.isDeviceG7(getTransmitterID())) { // If we are using G7 or One+ and there is connectivity connectedToG7 = true; } - if (getBestCollectorHardwareName().equals("G6 Native") && FirmwareCapability.isTransmitterRawIncapable(getTransmitterID())) { // If we are using a Firefly (modified or not) and there is connectivity + if (getBestCollectorHardwareName().equals("G6 Native") && FirmwareCapability.isTransmitterG6(getTransmitterID())) { // If we are using a G6 in native mode and there is connectivity connectedToG6 = true; } if (usingG6OrG7) { // If we are using Firefly or G7 From db775653edb51b1e4a50b40071d62bcf7dc9bf15 Mon Sep 17 00:00:00 2001 From: Navid Date: Mon, 22 Apr 2024 19:59:49 -0400 Subject: [PATCH 4/8] Cleanup --- .../dexdrip/utilitymodels/BroadcastGlucose.java | 4 ++-- 1 file changed, 2 insertions(+), 2 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 7427b5ef9f..25d9542b57 100644 --- a/app/src/main/java/com/eveningoutpost/dexdrip/utilitymodels/BroadcastGlucose.java +++ b/app/src/main/java/com/eveningoutpost/dexdrip/utilitymodels/BroadcastGlucose.java @@ -164,14 +164,14 @@ public static void sendLocalBroadcast(final BgReading bgReading) { if (getBestCollectorHardwareName().equals("G6 Native") && FirmwareCapability.isTransmitterG6(getTransmitterID())) { // If we are using a G6 in native mode and there is connectivity connectedToG6 = true; } - if (usingG6OrG7) { // If we are using Firefly or G7 + if (usingG6OrG7) { // If we are using G7 or G6 in native mode if (connectedToG6 || connectedToG7) { // Only if there is connectivity 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, One+ or Firefly + } else { // If we are not using G7, One+ or G6 in native mode bundle.putLong(Intents.EXTRA_SENSOR_STARTED_AT, sensor.started_at); } bundle.putLong(Intents.EXTRA_TIMESTAMP, bgReading.timestamp); From c4002fbb9a2c083763c798a9875c06e703f863b0 Mon Sep 17 00:00:00 2001 From: Navid Date: Wed, 24 Apr 2024 20:54:16 -0400 Subject: [PATCH 5/8] Graph smoothing settings reorganization --- app/src/main/res/values/strings.xml | 3 ++- .../main/res/xml/pref_advanced_settings.xml | 5 ----- app/src/main/res/xml/xdrip_plus_prefs.xml | 22 +++++++++++++------ 3 files changed, 17 insertions(+), 13 deletions(-) diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 31ec97656c..d63193cc35 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1773,8 +1773,9 @@ Special Pairing Workaround Save Power Reduce battery and network overhead by using batch processing and excluding unnecessary data - Simplify graphs by smoothing out irregularities + Simplify graphs by smoothing out irregularities in the previous readings. The current reading, alerts and broadcast value are not affected by this setting. Graph Smoothing + Enable Last Reading Select File for Alert Cannot choose file without storage permission diff --git a/app/src/main/res/xml/pref_advanced_settings.xml b/app/src/main/res/xml/pref_advanced_settings.xml index b7ee5658eb..60563ab746 100644 --- a/app/src/main/res/xml/pref_advanced_settings.xml +++ b/app/src/main/res/xml/pref_advanced_settings.xml @@ -1513,11 +1513,6 @@ android:key="predictive_bg" android:summary="@string/predictive_readings_old" android:title="@string/display_predictive_values" /> - - + + + + Date: Fri, 10 May 2024 19:51:03 -0400 Subject: [PATCH 6/8] Delete alert confirmation --- .../dexdrip/EditAlertActivity.java | 26 ++++++++++--------- app/src/main/res/values/strings.xml | 1 + 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/app/src/main/java/com/eveningoutpost/dexdrip/EditAlertActivity.java b/app/src/main/java/com/eveningoutpost/dexdrip/EditAlertActivity.java index 2781bf027b..5551f78785 100644 --- a/app/src/main/java/com/eveningoutpost/dexdrip/EditAlertActivity.java +++ b/app/src/main/java/com/eveningoutpost/dexdrip/EditAlertActivity.java @@ -40,6 +40,7 @@ import com.eveningoutpost.dexdrip.models.AlertType; import com.eveningoutpost.dexdrip.models.JoH; import com.eveningoutpost.dexdrip.models.UserError.Log; +import com.eveningoutpost.dexdrip.ui.dialog.GenericConfirmDialog; import com.eveningoutpost.dexdrip.utilitymodels.AlertPlayer; import com.eveningoutpost.dexdrip.utilitymodels.BgGraphBuilder; import com.eveningoutpost.dexdrip.utilitymodels.Constants; @@ -565,19 +566,20 @@ public void onClick(View v) { buttonRemove.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { - - - if (uuid == null) { - Log.wtf(TAG, "Error remove pressed, while we were adding an alert"); - } else { - AlertType.remove_alert(uuid); - startWatchUpdaterService(mContext, WatchUpdaterService.ACTION_SYNC_ALERTTYPE, TAG); - } - Intent returnIntent = new Intent(); - setResult(RESULT_OK,returnIntent); - finish(); + GenericConfirmDialog.show(EditAlertActivity.this, gs(R.string.are_you_sure), gs(R.string.you_cannot_undo_delete_alert), + () -> { // This, which deletes the alert, will only be executed after confirmation + if (uuid == null) { + Log.wtf(TAG, "Error remove pressed, while we were adding an alert"); + } else { + AlertType.remove_alert(uuid); + startWatchUpdaterService(mContext, WatchUpdaterService.ACTION_SYNC_ALERTTYPE, TAG); + } + Intent returnIntent = new Intent(); + setResult(RESULT_OK, returnIntent); + finish(); + } + ); } - }); buttonTest.setOnClickListener(new View.OnClickListener() { diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 31ec97656c..4c71389906 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1828,6 +1828,7 @@ Cloud Backup Select Automatic for xDrip to manage files in Google Drive or select an alternate specific file to use if you need to restore from elsewhere. Restoring a backup will erase your current settings and data with that from the backup.\n\nAre you absolutely sure you wish to do this? + You will not be able to undo this!\n\nAre you sure you want to delete this alert? This backup looks like it came from a different device:\n%s\nAre you sure you wish to restore from this backup? %.1f MB You have selected a file from Google Drive, but this is not automatically managed by xDrip so it can only be used for manual backups and restoring.\n\nNo automatic backing up will occur with this file.\n\nContinue? From 625c6d2c7462b061ce9b2273cb40b799988e5b5c Mon Sep 17 00:00:00 2001 From: Navid Date: Fri, 10 May 2024 22:38:32 -0400 Subject: [PATCH 7/8] G6 and G7 persistent authentication logs cleanup --- .../com/eveningoutpost/dexdrip/g5model/Ob1G5StateMachine.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/eveningoutpost/dexdrip/g5model/Ob1G5StateMachine.java b/app/src/main/java/com/eveningoutpost/dexdrip/g5model/Ob1G5StateMachine.java index 69240fde61..adb22b6a81 100644 --- a/app/src/main/java/com/eveningoutpost/dexdrip/g5model/Ob1G5StateMachine.java +++ b/app/src/main/java/com/eveningoutpost/dexdrip/g5model/Ob1G5StateMachine.java @@ -365,7 +365,7 @@ private static void handleAuthenticationThrowable(final Throwable throwable, fin // parent.reset_bond(true); // parent.unBond(); // WARN } else { - UserError.Log.e(TAG, "authentication notification throwable: (" + parent.getState() + ") " + throwable + " " + JoH.dateTimeText(tsl())); + UserError.Log.d(TAG, "authentication notification throwable: (" + parent.getState() + ") " + throwable + " " + JoH.dateTimeText(tsl())); parent.incrementErrors(); if (throwable instanceof BleCannotSetCharacteristicNotificationException || throwable instanceof BleGattCharacteristicException) { @@ -419,7 +419,7 @@ private static void authenticationProcessor(final Ob1G5CollectionService parent, if (throwable instanceof OperationSuccess) { UserError.Log.d(TAG, "Stopping auth challenge listener due to success"); } else { - UserError.Log.e(TAG, "Could not read reply to auth challenge: " + throwable); + UserError.Log.d(TAG, "Could not read reply to auth challenge: " + throwable); parent.incrementErrors(); speakSlowly = true; } From 6b8787c98475239fc81d93c09dcc7c8e8ac3567d Mon Sep 17 00:00:00 2001 From: Richard Dennehy Date: Sat, 11 May 2024 15:02:53 +0100 Subject: [PATCH 8/8] fix bluetooth device disconnection not being correctly detected --- .../eveningoutpost/dexdrip/utils/HeadsetStateReceiver.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/com/eveningoutpost/dexdrip/utils/HeadsetStateReceiver.java b/app/src/main/java/com/eveningoutpost/dexdrip/utils/HeadsetStateReceiver.java index 84eaa0eaca..d735138529 100644 --- a/app/src/main/java/com/eveningoutpost/dexdrip/utils/HeadsetStateReceiver.java +++ b/app/src/main/java/com/eveningoutpost/dexdrip/utils/HeadsetStateReceiver.java @@ -44,18 +44,16 @@ public void onReceive(Context context, Intent intent) { final int state = intent.getIntExtra(BluetoothHeadset.EXTRA_STATE, -1); final int previousState = intent.getIntExtra(BluetoothHeadset.EXTRA_PREVIOUS_STATE, -1); final String deviceInfo = device.getName() + "\n" + device.getAddress() + " " + (device.getBluetoothClass() != null ? device.getBluetoothClass() : ""); - //UserError.Log.uel(TAG, "Bluetooth audio connection state change: " + state + " was " + previousState + " " + device.getAddress() + " " + device.getName()); + // UserError.Log.uel(TAG, "Bluetooth audio connection state change: from " + previousState + " to " + state + " " + device.getAddress() + " " + device.getName()); if (state == BluetoothProfile.STATE_CONNECTED && previousState != BluetoothProfile.STATE_CONNECTED) { PersistentStore.setString(PREF_LAST_CONNECTED_MAC, device.getAddress()); PersistentStore.setString(PREF_LAST_CONNECTED_NAME, device.getName()); UserError.Log.uel(TAG, "Bluetooth Audio connected: " + deviceInfo); processDevice(device.getAddress(), true); - - } else if (state == BluetoothProfile.STATE_DISCONNECTED && previousState == BluetoothProfile.STATE_CONNECTED) { + } else if (state == BluetoothProfile.STATE_DISCONNECTED && previousState != BluetoothProfile.STATE_DISCONNECTED) { UserError.Log.uel(TAG, "Bluetooth Audio disconnected: " + deviceInfo); processDevice(device.getAddress(), false); } - } else { UserError.Log.d(TAG, "Device was null in intent!"); }