Merge branch 'omnipod_eros_dev' into omnipod_eros_dev_upstream_merge
This commit is contained in:
commit
1a688260e6
8 changed files with 33 additions and 10 deletions
|
@ -49,14 +49,14 @@ class TimeDateOrTZChangeReceiver : DaggerBroadcastReceiver() {
|
||||||
|
|
||||||
Intent.ACTION_TIMEZONE_CHANGED == action -> {
|
Intent.ACTION_TIMEZONE_CHANGED == action -> {
|
||||||
aapsLogger.info(LTag.PUMP, "TimeDateOrTZChangeReceiver::Timezone changed. Notifying pump driver.")
|
aapsLogger.info(LTag.PUMP, "TimeDateOrTZChangeReceiver::Timezone changed. Notifying pump driver.")
|
||||||
activePump.timezoneOrDSTChanged(TimeChangeType.TimezoneChange)
|
activePump.timezoneOrDSTChanged(TimeChangeType.TimezoneChanged)
|
||||||
}
|
}
|
||||||
|
|
||||||
Intent.ACTION_TIME_CHANGED == action -> {
|
Intent.ACTION_TIME_CHANGED == action -> {
|
||||||
val currentDst = calculateDST()
|
val currentDst = calculateDST()
|
||||||
if (currentDst == isDST) {
|
if (currentDst == isDST) {
|
||||||
aapsLogger.info(LTag.PUMP, "TimeDateOrTZChangeReceiver::Time changed (manual). Notifying pump driver.")
|
aapsLogger.info(LTag.PUMP, "TimeDateOrTZChangeReceiver::Time changed (manual). Notifying pump driver.")
|
||||||
activePump.timezoneOrDSTChanged(TimeChangeType.ManualTimeChange)
|
activePump.timezoneOrDSTChanged(TimeChangeType.TimeChanged)
|
||||||
} else {
|
} else {
|
||||||
if (currentDst) {
|
if (currentDst) {
|
||||||
aapsLogger.info(LTag.PUMP, "TimeDateOrTZChangeReceiver::DST started. Notifying pump driver.")
|
aapsLogger.info(LTag.PUMP, "TimeDateOrTZChangeReceiver::DST started. Notifying pump driver.")
|
||||||
|
|
|
@ -78,6 +78,7 @@ public class Notification {
|
||||||
public static final int OMNIPOD_UNCERTAIN_SMB = 67;
|
public static final int OMNIPOD_UNCERTAIN_SMB = 67;
|
||||||
public static final int OMNIPOD_UNKNOWN_TBR = 68;
|
public static final int OMNIPOD_UNKNOWN_TBR = 68;
|
||||||
public static final int OMNIPOD_STARTUP_STATUS_REFRESH_FAILED = 69;
|
public static final int OMNIPOD_STARTUP_STATUS_REFRESH_FAILED = 69;
|
||||||
|
public static final int OMNIPOD_TIME_OUT_OF_SYNC = 70;
|
||||||
|
|
||||||
public static final int IMPORTANCE_HIGH = 2;
|
public static final int IMPORTANCE_HIGH = 2;
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
package info.nightscout.androidaps.utils;
|
package info.nightscout.androidaps.utils;
|
||||||
|
|
||||||
public enum TimeChangeType {
|
public enum TimeChangeType {
|
||||||
TimezoneChange,
|
TimezoneChanged,
|
||||||
DST_Started,
|
DST_Started,
|
||||||
DST_Ended,
|
DST_Ended,
|
||||||
ManualTimeChange
|
TimeChanged
|
||||||
}
|
}
|
||||||
|
|
|
@ -256,7 +256,7 @@ public class OmnipodPumpPlugin extends PumpPluginBase implements PumpInterface,
|
||||||
queueAcknowledgeAlertsCommand();
|
queueAcknowledgeAlertsCommand();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "Skipping Pod status check because command queue is not empty");
|
aapsLogger.debug(LTag.PUMP, "Skipping Pod status check because command queue is not empty");
|
||||||
}
|
}
|
||||||
|
|
||||||
updatePodWarningNotifications();
|
updatePodWarningNotifications();
|
||||||
|
@ -457,6 +457,13 @@ public class OmnipodPumpPlugin extends PumpPluginBase implements PumpInterface,
|
||||||
rxBus.send(new EventNewNotification(notification));
|
rxBus.send(new EventNewNotification(notification));
|
||||||
} else {
|
} else {
|
||||||
rxBus.send(new EventDismissNotification(Notification.OMNIPOD_POD_SUSPENDED));
|
rxBus.send(new EventDismissNotification(Notification.OMNIPOD_POD_SUSPENDED));
|
||||||
|
|
||||||
|
if (podStateManager.timeDeviatesMoreThan(OmnipodConstants.TIME_DEVIATION_THRESHOLD)) {
|
||||||
|
Notification notification = new Notification(Notification.OMNIPOD_TIME_OUT_OF_SYNC, resourceHelper.gs(R.string.omnipod_error_time_out_of_sync), Notification.NORMAL);
|
||||||
|
rxBus.send(new EventNewNotification(notification));
|
||||||
|
} else {
|
||||||
|
rxBus.send(new EventDismissNotification(Notification.OMNIPOD_TIME_OUT_OF_SYNC));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -955,12 +962,18 @@ public class OmnipodPumpPlugin extends PumpPluginBase implements PumpInterface,
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void timezoneOrDSTChanged(TimeChangeType timeChangeType) {
|
public void timezoneOrDSTChanged(TimeChangeType timeChangeType) {
|
||||||
aapsLogger.warn(LTag.PUMP, "Time, Date and/or TimeZone changed. [changeType=" + timeChangeType.name() + ", eventHandlingEnabled=" + aapsOmnipodManager.isTimeChangeEventEnabled() + "]");
|
aapsLogger.info(LTag.PUMP, "Time, Date and/or TimeZone changed. [changeType=" + timeChangeType.name() + ", eventHandlingEnabled=" + aapsOmnipodManager.isTimeChangeEventEnabled() + "]");
|
||||||
|
|
||||||
if (podStateManager.isPodRunning()) {
|
if (timeChangeType == TimeChangeType.TimeChanged) {
|
||||||
aapsLogger.info(LTag.PUMP, "Time, Date and/or TimeZone changed event received and will be consumed by driver.");
|
aapsLogger.info(LTag.PUMP, "Ignoring time change because it is not a DST or TZ change");
|
||||||
hasTimeDateOrTimeZoneChanged = true;
|
return;
|
||||||
|
} else if (!podStateManager.isPodRunning()) {
|
||||||
|
aapsLogger.info(LTag.PUMP, "Ignoring time change because no Pod is active");
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
aapsLogger.info(LTag.PUMP, "DST and/or TimeZone changed event will be consumed by driver");
|
||||||
|
hasTimeDateOrTimeZoneChanged = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -30,4 +30,7 @@ public class OmnipodConstants {
|
||||||
public static final double POD_SETUP_UNITS = POD_PRIME_BOLUS_UNITS + POD_CANNULA_INSERTION_BOLUS_UNITS;
|
public static final double POD_SETUP_UNITS = POD_PRIME_BOLUS_UNITS + POD_CANNULA_INSERTION_BOLUS_UNITS;
|
||||||
|
|
||||||
public static final int DEFAULT_MAX_RESERVOIR_ALERT_THRESHOLD = 20;
|
public static final int DEFAULT_MAX_RESERVOIR_ALERT_THRESHOLD = 20;
|
||||||
|
|
||||||
|
// when the time deviates more than the threshold, the user will get warned and will get the option to change the time
|
||||||
|
public static final Duration TIME_DEVIATION_THRESHOLD = Duration.standardMinutes(5);
|
||||||
}
|
}
|
||||||
|
|
|
@ -347,6 +347,7 @@ public class AapsOmnipodManager {
|
||||||
|
|
||||||
dismissNotification(Notification.FAILED_UDPATE_PROFILE);
|
dismissNotification(Notification.FAILED_UDPATE_PROFILE);
|
||||||
dismissNotification(Notification.OMNIPOD_POD_SUSPENDED);
|
dismissNotification(Notification.OMNIPOD_POD_SUSPENDED);
|
||||||
|
dismissNotification(Notification.OMNIPOD_TIME_OUT_OF_SYNC);
|
||||||
|
|
||||||
return new PumpEnactResult(injector).success(true).enacted(true);
|
return new PumpEnactResult(injector).success(true).enacted(true);
|
||||||
}
|
}
|
||||||
|
@ -584,6 +585,9 @@ public class AapsOmnipodManager {
|
||||||
addSuccessToHistory(PodHistoryEntryType.SUSPEND_DELIVERY, null);
|
addSuccessToHistory(PodHistoryEntryType.SUSPEND_DELIVERY, null);
|
||||||
createSuspendedFakeTbrIfNotExists();
|
createSuspendedFakeTbrIfNotExists();
|
||||||
|
|
||||||
|
dismissNotification(Notification.FAILED_UDPATE_PROFILE);
|
||||||
|
dismissNotification(Notification.OMNIPOD_TIME_OUT_OF_SYNC);
|
||||||
|
|
||||||
return new PumpEnactResult(injector).success(true).enacted(true);
|
return new PumpEnactResult(injector).success(true).enacted(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -619,6 +623,7 @@ public class AapsOmnipodManager {
|
||||||
|
|
||||||
dismissNotification(Notification.FAILED_UDPATE_PROFILE);
|
dismissNotification(Notification.FAILED_UDPATE_PROFILE);
|
||||||
dismissNotification(Notification.OMNIPOD_POD_SUSPENDED);
|
dismissNotification(Notification.OMNIPOD_POD_SUSPENDED);
|
||||||
|
dismissNotification(Notification.OMNIPOD_TIME_OUT_OF_SYNC);
|
||||||
|
|
||||||
return new PumpEnactResult(injector).success(true).enacted(true);
|
return new PumpEnactResult(injector).success(true).enacted(true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -251,7 +251,7 @@ class OmnipodOverviewFragment : DaggerFragment() {
|
||||||
omnipod_overview_firmware_version.text = resourceHelper.gs(R.string.omnipod_firmware_version_value, podStateManager.pmVersion.toString(), podStateManager.piVersion.toString())
|
omnipod_overview_firmware_version.text = resourceHelper.gs(R.string.omnipod_firmware_version_value, podStateManager.pmVersion.toString(), podStateManager.piVersion.toString())
|
||||||
|
|
||||||
omnipod_overview_time_on_pod.text = readableZonedTime(podStateManager.time)
|
omnipod_overview_time_on_pod.text = readableZonedTime(podStateManager.time)
|
||||||
omnipod_overview_time_on_pod.setTextColor(if (podStateManager.timeDeviatesMoreThan(Duration.standardMinutes(5))) {
|
omnipod_overview_time_on_pod.setTextColor(if (podStateManager.timeDeviatesMoreThan(OmnipodConstants.TIME_DEVIATION_THRESHOLD)) {
|
||||||
Color.RED
|
Color.RED
|
||||||
} else {
|
} else {
|
||||||
Color.WHITE
|
Color.WHITE
|
||||||
|
|
|
@ -106,6 +106,7 @@
|
||||||
<string name="omnipod_error_rileylink_address_invalid">RileyLink address invalid.</string>
|
<string name="omnipod_error_rileylink_address_invalid">RileyLink address invalid.</string>
|
||||||
<string name="omnipod_error_operation_not_possible_no_configuration">Operation is not possible.\n\nYou need to configure Omnipod first, before you can use this operation.</string>
|
<string name="omnipod_error_operation_not_possible_no_configuration">Operation is not possible.\n\nYou need to configure Omnipod first, before you can use this operation.</string>
|
||||||
<string name="omnipod_error_pod_not_attached">No active Pod</string>
|
<string name="omnipod_error_pod_not_attached">No active Pod</string>
|
||||||
|
<string name="omnipod_error_time_out_of_sync">The time on the Pod is out of sync. Please update the time in the Omnipod tab.</string>
|
||||||
<string name="omnipod_error_unexpected_exception">An unexpected error occurred. Please report! (%1$s: %2$s).</string>
|
<string name="omnipod_error_unexpected_exception">An unexpected error occurred. Please report! (%1$s: %2$s).</string>
|
||||||
<string name="omnipod_error_crc_mismatch">Communication failed: message integrity verification failed</string>
|
<string name="omnipod_error_crc_mismatch">Communication failed: message integrity verification failed</string>
|
||||||
<string name="omnipod_error_invalid_packet_type">Communication failed: received an invalid packet from the Pod</string>
|
<string name="omnipod_error_invalid_packet_type">Communication failed: received an invalid packet from the Pod</string>
|
||||||
|
|
Loading…
Reference in a new issue