From fa9486f2d25942cf62982b7c3f447b18bddad00e Mon Sep 17 00:00:00 2001 From: Tzachi Dar Date: Mon, 3 Jun 2024 11:08:29 +0300 Subject: [PATCH 1/6] Add one more libre sn: 0xc60931 --- .../com/eveningoutpost/dexdrip/models/LibreOOPAlgorithm.java | 1 + .../com/eveningoutpost/dexdrip/models/LibreOOPAlgorithm.java | 1 + 2 files changed, 2 insertions(+) diff --git a/app/src/main/java/com/eveningoutpost/dexdrip/models/LibreOOPAlgorithm.java b/app/src/main/java/com/eveningoutpost/dexdrip/models/LibreOOPAlgorithm.java index c6ed86d0fa..f5d51c8cab 100644 --- a/app/src/main/java/com/eveningoutpost/dexdrip/models/LibreOOPAlgorithm.java +++ b/app/src/main/java/com/eveningoutpost/dexdrip/models/LibreOOPAlgorithm.java @@ -303,6 +303,7 @@ public static SensorType getSensorType(byte[] SensorInfo) { return SensorType.LibreUS14Day; case 0x9d0830: case 0xc50930: + case 0xc60931: return SensorType.Libre2; case 0x700010: return SensorType.LibreProH; diff --git a/wear/src/main/java/com/eveningoutpost/dexdrip/models/LibreOOPAlgorithm.java b/wear/src/main/java/com/eveningoutpost/dexdrip/models/LibreOOPAlgorithm.java index 7dd3210cea..8be8e11265 100644 --- a/wear/src/main/java/com/eveningoutpost/dexdrip/models/LibreOOPAlgorithm.java +++ b/wear/src/main/java/com/eveningoutpost/dexdrip/models/LibreOOPAlgorithm.java @@ -303,6 +303,7 @@ public static SensorType getSensorType(byte[] SensorInfo) { return SensorType.LibreUS14Day; case 0x9d0830: case 0xc50930: + case 0xc60931: return SensorType.Libre2; case 0x700010: return SensorType.LibreProH; From 4c1c5dc4bd3a3ec42265dca7b7cca0e1f8e42ba9 Mon Sep 17 00:00:00 2001 From: tolot27 Date: Thu, 6 Jun 2024 22:11:07 +0200 Subject: [PATCH 2/6] ProGuard rule to ignore kotlinx.serialization.Serializable missing class warning --- app/proguard-rules.pro | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro index ebbec48de7..58b0e325fe 100644 --- a/app/proguard-rules.pro +++ b/app/proguard-rules.pro @@ -64,6 +64,16 @@ -keep class android.support.v7.widget.SearchView { *; } -keep class kotlinx.serialization.Serializable { *; } +# As long as we only deserialize (from a JSON string into an `NSDeviceStatus` +# object in the class `AAPSStatusHandler`) we can simply ignore warnings related +# to kotlinx serialization. +# These rule should not cause problems: if a project actually relies on +# serialization, then much more than just this class will be required, +# so telling Proguard not to worry if this is missing will not prevent it +# from emitting errors for code that does use serialization but somehow forgot +# to depend on it. +-dontwarn kotlinx.serialization.Serializable + -dontwarn java.util.concurrent.** -keep class rx.schedulers.Schedulers { From 2cd66671ea5c909e6a24910e36e5ed38540e5e69 Mon Sep 17 00:00:00 2001 From: Navid Date: Sat, 8 Jun 2024 22:33:45 -0400 Subject: [PATCH 3/6] Session stop notification for G7 --- .../dexdrip/services/Ob1G5CollectionService.java | 11 +++++++++++ .../dexdrip/utilitymodels/Constants.java | 1 + 2 files changed, 12 insertions(+) diff --git a/app/src/main/java/com/eveningoutpost/dexdrip/services/Ob1G5CollectionService.java b/app/src/main/java/com/eveningoutpost/dexdrip/services/Ob1G5CollectionService.java index 70a6702cd9..2db2a32586 100644 --- a/app/src/main/java/com/eveningoutpost/dexdrip/services/Ob1G5CollectionService.java +++ b/app/src/main/java/com/eveningoutpost/dexdrip/services/Ob1G5CollectionService.java @@ -20,6 +20,7 @@ import static com.eveningoutpost.dexdrip.models.JoH.joinBytes; import static com.eveningoutpost.dexdrip.models.JoH.msSince; import static com.eveningoutpost.dexdrip.models.JoH.niceTimeScalar; +import static com.eveningoutpost.dexdrip.models.JoH.niceTimeScalarNatural; import static com.eveningoutpost.dexdrip.models.JoH.tolerantHexStringToByteArray; import static com.eveningoutpost.dexdrip.models.JoH.tsl; import static com.eveningoutpost.dexdrip.models.JoH.upForAtLeastMins; @@ -39,6 +40,7 @@ import static com.eveningoutpost.dexdrip.utilitymodels.Constants.G5_SENSOR_FAILED; import static com.eveningoutpost.dexdrip.utilitymodels.Constants.G5_SENSOR_RESTARTED; import static com.eveningoutpost.dexdrip.utilitymodels.Constants.G5_SENSOR_STARTED; +import static com.eveningoutpost.dexdrip.utilitymodels.Constants.G7_SESSION_EXPIRED; import static com.eveningoutpost.dexdrip.utilitymodels.Constants.HOUR_IN_MS; import static com.eveningoutpost.dexdrip.utilitymodels.Constants.MINUTE_IN_MS; import static com.eveningoutpost.dexdrip.utilitymodels.Constants.SECOND_IN_MS; @@ -47,6 +49,7 @@ import static com.eveningoutpost.dexdrip.utilitymodels.StatusItem.Highlight.NORMAL; import static com.eveningoutpost.dexdrip.utilitymodels.StatusItem.Highlight.NOTICE; import static com.eveningoutpost.dexdrip.utils.DexCollectionType.DexcomG5; +import static com.eveningoutpost.dexdrip.utils.DexCollectionType.getBestCollectorHardwareName; import static com.eveningoutpost.dexdrip.utils.bt.Subscription.addErrorHandler; import static com.eveningoutpost.dexdrip.watch.thinjam.BlueJayEntry.isNative; import static com.eveningoutpost.dexdrip.xdrip.gs; @@ -91,6 +94,7 @@ import com.eveningoutpost.dexdrip.g5model.FirmwareCapability; import com.eveningoutpost.dexdrip.g5model.Ob1DexTransmitterBattery; import com.eveningoutpost.dexdrip.g5model.Ob1G5StateMachine; +import com.eveningoutpost.dexdrip.g5model.SensorDays; import com.eveningoutpost.dexdrip.g5model.TransmitterStatus; import com.eveningoutpost.dexdrip.g5model.VersionRequest1RxMessage; import com.eveningoutpost.dexdrip.g5model.VersionRequest2RxMessage; @@ -1931,6 +1935,13 @@ public static void processCalibrationState(final CalibrationState state) { JoH.showNotification(state.getText(), "Sensor FAILED", pi, G5_SENSOR_FAILED, true, true, false); UserError.Log.ueh(TAG, "Native Sensor is now marked FAILED: " + state.getExtendedText()); } + + if (is_started && getBestCollectorHardwareName().equals("G7") && SensorDays.get().getRemainingSensorPeriodInMs() == 0) { // If we have an active G7 session and sensor has expired + Sensor.stopSensor(); // We might as well stop the xDrip session + final PendingIntent pi = PendingIntent.getActivity(xdrip.getAppContext(), G7_SESSION_EXPIRED, JoH.getStartActivityIntent(Home.class), PendingIntent.FLAG_UPDATE_CURRENT); + JoH.showNotification(state.getText(), "Session ended", pi, G7_SESSION_EXPIRED, true, true, false); // Let's notify the user that the session has ended. + UserError.Log.ueh(TAG, "Native Session has now ended: " + state.getExtendedText()); + } // we can't easily auto-cancel a failed notice as auto-restart may mean the user is not aware of it? diff --git a/app/src/main/java/com/eveningoutpost/dexdrip/utilitymodels/Constants.java b/app/src/main/java/com/eveningoutpost/dexdrip/utilitymodels/Constants.java index 160d9e8346..56f0686aac 100644 --- a/app/src/main/java/com/eveningoutpost/dexdrip/utilitymodels/Constants.java +++ b/app/src/main/java/com/eveningoutpost/dexdrip/utilitymodels/Constants.java @@ -55,6 +55,7 @@ public class Constants { public static final int WEBFOLLOW_SERVICE_FAILOVER_ID = 1028; public static final int BACKUP_ACTIVITY_ID = 1029; public static final int CARELINK_SERVICE_FAILOVER_ID = 1030; + public static final int G7_SESSION_EXPIRED = 1031; static final int NIGHTSCOUT_ERROR_NOTIFICATION_ID = 2001; public static final int HEALTH_CONNECT_RESPONSE_ID = 2002; From bfd025a33acf3fdcf61a5933d7f85270ea8676cc Mon Sep 17 00:00:00 2001 From: Navid Date: Sat, 8 Jun 2024 23:22:07 -0400 Subject: [PATCH 4/6] Cleanup --- .../eveningoutpost/dexdrip/services/Ob1G5CollectionService.java | 1 - 1 file changed, 1 deletion(-) diff --git a/app/src/main/java/com/eveningoutpost/dexdrip/services/Ob1G5CollectionService.java b/app/src/main/java/com/eveningoutpost/dexdrip/services/Ob1G5CollectionService.java index 2db2a32586..e7ba537f92 100644 --- a/app/src/main/java/com/eveningoutpost/dexdrip/services/Ob1G5CollectionService.java +++ b/app/src/main/java/com/eveningoutpost/dexdrip/services/Ob1G5CollectionService.java @@ -20,7 +20,6 @@ import static com.eveningoutpost.dexdrip.models.JoH.joinBytes; import static com.eveningoutpost.dexdrip.models.JoH.msSince; import static com.eveningoutpost.dexdrip.models.JoH.niceTimeScalar; -import static com.eveningoutpost.dexdrip.models.JoH.niceTimeScalarNatural; import static com.eveningoutpost.dexdrip.models.JoH.tolerantHexStringToByteArray; import static com.eveningoutpost.dexdrip.models.JoH.tsl; import static com.eveningoutpost.dexdrip.models.JoH.upForAtLeastMins; From 39e1c5e6f61463a56ffcfa4b6050af7b533f15b0 Mon Sep 17 00:00:00 2001 From: Navid Date: Sun, 9 Jun 2024 13:22:30 -0400 Subject: [PATCH 5/6] Expired is also stopped --- .../dexdrip/g5model/CalibrationState.java | 2 +- .../dexdrip/services/Ob1G5CollectionService.java | 12 +----------- .../dexdrip/utilitymodels/Constants.java | 1 - 3 files changed, 2 insertions(+), 13 deletions(-) diff --git a/app/src/main/java/com/eveningoutpost/dexdrip/g5model/CalibrationState.java b/app/src/main/java/com/eveningoutpost/dexdrip/g5model/CalibrationState.java index fb5a960f5b..15a125edf1 100644 --- a/app/src/main/java/com/eveningoutpost/dexdrip/g5model/CalibrationState.java +++ b/app/src/main/java/com/eveningoutpost/dexdrip/g5model/CalibrationState.java @@ -58,7 +58,7 @@ public enum CalibrationState { private static final SparseArray lookup = new SparseArray<>(); private static final ImmutableSet failed = ImmutableSet.of(SensorFailed, SensorFailed2, SensorFailed3, SensorFailed4, SensorFailed5, SensorFailed6, SensorFailedStart); - private static final ImmutableSet stopped = ImmutableSet.of(Stopped, Ended, SensorFailed, SensorFailed2, SensorFailed3, SensorFailed4, SensorFailed5, SensorFailed6, SensorFailedStart, SensorStopped); + private static final ImmutableSet stopped = ImmutableSet.of(Stopped, Ended, SensorExpired, SensorFailed, SensorFailed2, SensorFailed3, SensorFailed4, SensorFailed5, SensorFailed6, SensorFailedStart, SensorStopped); private static final ImmutableSet transitional = ImmutableSet.of(WarmingUp, SensorStarted, SensorStopped, CalibrationSent); diff --git a/app/src/main/java/com/eveningoutpost/dexdrip/services/Ob1G5CollectionService.java b/app/src/main/java/com/eveningoutpost/dexdrip/services/Ob1G5CollectionService.java index e7ba537f92..2c843592e4 100644 --- a/app/src/main/java/com/eveningoutpost/dexdrip/services/Ob1G5CollectionService.java +++ b/app/src/main/java/com/eveningoutpost/dexdrip/services/Ob1G5CollectionService.java @@ -39,7 +39,6 @@ import static com.eveningoutpost.dexdrip.utilitymodels.Constants.G5_SENSOR_FAILED; import static com.eveningoutpost.dexdrip.utilitymodels.Constants.G5_SENSOR_RESTARTED; import static com.eveningoutpost.dexdrip.utilitymodels.Constants.G5_SENSOR_STARTED; -import static com.eveningoutpost.dexdrip.utilitymodels.Constants.G7_SESSION_EXPIRED; import static com.eveningoutpost.dexdrip.utilitymodels.Constants.HOUR_IN_MS; import static com.eveningoutpost.dexdrip.utilitymodels.Constants.MINUTE_IN_MS; import static com.eveningoutpost.dexdrip.utilitymodels.Constants.SECOND_IN_MS; @@ -48,7 +47,6 @@ import static com.eveningoutpost.dexdrip.utilitymodels.StatusItem.Highlight.NORMAL; import static com.eveningoutpost.dexdrip.utilitymodels.StatusItem.Highlight.NOTICE; import static com.eveningoutpost.dexdrip.utils.DexCollectionType.DexcomG5; -import static com.eveningoutpost.dexdrip.utils.DexCollectionType.getBestCollectorHardwareName; import static com.eveningoutpost.dexdrip.utils.bt.Subscription.addErrorHandler; import static com.eveningoutpost.dexdrip.watch.thinjam.BlueJayEntry.isNative; import static com.eveningoutpost.dexdrip.xdrip.gs; @@ -93,7 +91,6 @@ import com.eveningoutpost.dexdrip.g5model.FirmwareCapability; import com.eveningoutpost.dexdrip.g5model.Ob1DexTransmitterBattery; import com.eveningoutpost.dexdrip.g5model.Ob1G5StateMachine; -import com.eveningoutpost.dexdrip.g5model.SensorDays; import com.eveningoutpost.dexdrip.g5model.TransmitterStatus; import com.eveningoutpost.dexdrip.g5model.VersionRequest1RxMessage; import com.eveningoutpost.dexdrip.g5model.VersionRequest2RxMessage; @@ -1156,7 +1153,7 @@ public int onStartCommand(Intent intent, int flags, int startId) { } minimize_scanning = Pref.getBooleanDefaultFalse("ob1_minimize_scanning"); - // allow_scan_by_mac = Build.VERSION.SDK_INT >= 32 && shortTxId(); + // allow_scan_by_mac = Build.VERSION.SDK_INT >= 32 && shortTxId(); automata(); // sequence logic UserError.Log.d(TAG, "Releasing service start"); @@ -1934,13 +1931,6 @@ public static void processCalibrationState(final CalibrationState state) { JoH.showNotification(state.getText(), "Sensor FAILED", pi, G5_SENSOR_FAILED, true, true, false); UserError.Log.ueh(TAG, "Native Sensor is now marked FAILED: " + state.getExtendedText()); } - - if (is_started && getBestCollectorHardwareName().equals("G7") && SensorDays.get().getRemainingSensorPeriodInMs() == 0) { // If we have an active G7 session and sensor has expired - Sensor.stopSensor(); // We might as well stop the xDrip session - final PendingIntent pi = PendingIntent.getActivity(xdrip.getAppContext(), G7_SESSION_EXPIRED, JoH.getStartActivityIntent(Home.class), PendingIntent.FLAG_UPDATE_CURRENT); - JoH.showNotification(state.getText(), "Session ended", pi, G7_SESSION_EXPIRED, true, true, false); // Let's notify the user that the session has ended. - UserError.Log.ueh(TAG, "Native Session has now ended: " + state.getExtendedText()); - } // we can't easily auto-cancel a failed notice as auto-restart may mean the user is not aware of it? diff --git a/app/src/main/java/com/eveningoutpost/dexdrip/utilitymodels/Constants.java b/app/src/main/java/com/eveningoutpost/dexdrip/utilitymodels/Constants.java index 56f0686aac..160d9e8346 100644 --- a/app/src/main/java/com/eveningoutpost/dexdrip/utilitymodels/Constants.java +++ b/app/src/main/java/com/eveningoutpost/dexdrip/utilitymodels/Constants.java @@ -55,7 +55,6 @@ public class Constants { public static final int WEBFOLLOW_SERVICE_FAILOVER_ID = 1028; public static final int BACKUP_ACTIVITY_ID = 1029; public static final int CARELINK_SERVICE_FAILOVER_ID = 1030; - public static final int G7_SESSION_EXPIRED = 1031; static final int NIGHTSCOUT_ERROR_NOTIFICATION_ID = 2001; public static final int HEALTH_CONNECT_RESPONSE_ID = 2002; From 8309dae06c18df8a6c7baca8bf04aff9d9d9a00c Mon Sep 17 00:00:00 2001 From: Navid <51497406+Navid200@users.noreply.github.com> Date: Tue, 11 Jun 2024 12:43:24 -0400 Subject: [PATCH 6/6] Sensor expiry note on home screen wrap (#3499) * Sensor expiry note on home screen wrap * Replaced 0dp with wrap_content and removed weight --------- Co-authored-by: Navid --- app/src/main/res/layout/activity_home.xml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/app/src/main/res/layout/activity_home.xml b/app/src/main/res/layout/activity_home.xml index db62d1e60b..6a91459da7 100644 --- a/app/src/main/res/layout/activity_home.xml +++ b/app/src/main/res/layout/activity_home.xml @@ -540,21 +540,19 @@