- added code for time/timezone change
This commit is contained in:
parent
837392f30b
commit
be8a2fab75
4 changed files with 29 additions and 6 deletions
|
@ -97,6 +97,7 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPump
|
||||||
protected List<Long> busyTimestamps = new ArrayList<>();
|
protected List<Long> busyTimestamps = new ArrayList<>();
|
||||||
protected boolean sentIdToFirebase = false;
|
protected boolean sentIdToFirebase = false;
|
||||||
protected boolean hasTimeDateOrTimeZoneChanged = false;
|
protected boolean hasTimeDateOrTimeZoneChanged = false;
|
||||||
|
private int timeChangeRetries = 0;
|
||||||
|
|
||||||
private Profile currentProfile;
|
private Profile currentProfile;
|
||||||
|
|
||||||
|
@ -247,7 +248,7 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPump
|
||||||
clearBusyQueue();
|
clearBusyQueue();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this.omnipodStatusRequestList.isEmpty()) {
|
if (!this.omnipodStatusRequestList.isEmpty() || this.hasTimeDateOrTimeZoneChanged) {
|
||||||
if (!ConfigBuilderPlugin.getPlugin().getCommandQueue().statusInQueue()) {
|
if (!ConfigBuilderPlugin.getPlugin().getCommandQueue().statusInQueue()) {
|
||||||
ConfigBuilderPlugin.getPlugin().getCommandQueue()
|
ConfigBuilderPlugin.getPlugin().getCommandQueue()
|
||||||
.readStatus("Status Refresh Requested", null);
|
.readStatus("Status Refresh Requested", null);
|
||||||
|
@ -376,6 +377,20 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPump
|
||||||
omnipodStatusRequestList.removeAll(removeList);
|
omnipodStatusRequestList.removeAll(removeList);
|
||||||
|
|
||||||
//getPodPumpStatus();
|
//getPodPumpStatus();
|
||||||
|
} else if (this.hasTimeDateOrTimeZoneChanged) {
|
||||||
|
OmnipodUITask omnipodUITask = omnipodUIComm.executeCommand(OmnipodCommandType.SetTime);
|
||||||
|
|
||||||
|
if (omnipodUITask.wasCommandSuccessful()) {
|
||||||
|
this.hasTimeDateOrTimeZoneChanged = false;
|
||||||
|
timeChangeRetries = 0;
|
||||||
|
} else {
|
||||||
|
timeChangeRetries++;
|
||||||
|
|
||||||
|
if (timeChangeRetries > 3) {
|
||||||
|
this.hasTimeDateOrTimeZoneChanged = false;
|
||||||
|
timeChangeRetries = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -890,12 +905,10 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPump
|
||||||
@Override
|
@Override
|
||||||
public void timeDateOrTimeZoneChanged() {
|
public void timeDateOrTimeZoneChanged() {
|
||||||
|
|
||||||
// if (isLoggingEnabled())
|
if (isLoggingEnabled())
|
||||||
// LOG.warn(getLogPrefix() + "Time, Date and/or TimeZone changed. ");
|
LOG.warn(getLogPrefix() + "Time, Date and/or TimeZone changed. ");
|
||||||
//
|
|
||||||
// this.hasTimeDateOrTimeZoneChanged = true;
|
|
||||||
|
|
||||||
// TODO
|
this.hasTimeDateOrTimeZoneChanged = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,7 @@ public enum OmnipodCommandType {
|
||||||
CancelTemporaryBasal, //
|
CancelTemporaryBasal, //
|
||||||
ResetPodStatus, //
|
ResetPodStatus, //
|
||||||
GetPodStatus, //
|
GetPodStatus, //
|
||||||
|
SetTime, //
|
||||||
AcknowledgeAlerts;
|
AcknowledgeAlerts;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -64,6 +64,11 @@ public interface OmnipodCommunicationManagerInterface {
|
||||||
*/
|
*/
|
||||||
PumpEnactResult acknowledgeAlerts();
|
PumpEnactResult acknowledgeAlerts();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set Time on Pod
|
||||||
|
*/
|
||||||
|
PumpEnactResult setTime();
|
||||||
|
|
||||||
|
|
||||||
void setPumpStatus(OmnipodPumpStatus pumpStatusLocal);
|
void setPumpStatus(OmnipodPumpStatus pumpStatusLocal);
|
||||||
}
|
}
|
||||||
|
|
|
@ -112,6 +112,10 @@ public class OmnipodUITask {
|
||||||
returnData = communicationManager.acknowledgeAlerts();
|
returnData = communicationManager.acknowledgeAlerts();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case SetTime:
|
||||||
|
returnData = communicationManager.setTime();
|
||||||
|
break;
|
||||||
|
|
||||||
default: {
|
default: {
|
||||||
LOG.warn("This commandType is not supported (yet) - {}.", commandType);
|
LOG.warn("This commandType is not supported (yet) - {}.", commandType);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue