- saving last error data, when error comes
This commit is contained in:
parent
db117bf736
commit
adf1d892da
2 changed files with 15 additions and 7 deletions
|
@ -1,9 +1,9 @@
|
|||
package info.nightscout.androidaps.plugins.pump.common.data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import org.joda.time.LocalDateTime;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import info.nightscout.androidaps.data.ProfileStore;
|
||||
import info.nightscout.androidaps.interfaces.PumpDescription;
|
||||
import info.nightscout.androidaps.plugins.pump.common.defs.PumpStatusType;
|
||||
|
@ -21,6 +21,8 @@ public abstract class PumpStatus {
|
|||
public long previousConnection = 0L; // here should be stored last connection of previous session (so needs to be
|
||||
// read before lastConnection is modified for first time).
|
||||
|
||||
public long lastErrorConnection = 0L;
|
||||
|
||||
// last bolus
|
||||
public Date lastBolusTime;
|
||||
public Double lastBolusAmount;
|
||||
|
@ -68,6 +70,10 @@ public abstract class PumpStatus {
|
|||
this.lastConnection = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
public void setLastFailedCommunicationToNow() {
|
||||
this.lastErrorConnection = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
|
||||
public abstract String getErrorInfo();
|
||||
|
||||
|
|
|
@ -197,10 +197,12 @@ public class OmnipodUITask {
|
|||
if (responseType == PodResponseType.Invalid) {
|
||||
statusChange = new EventOmnipodDeviceStatusChange(PodDeviceState.ErrorWhenCommunicating,
|
||||
"Unsupported command in OmnipodUITask");
|
||||
OmnipodUtil.getPumpStatus().setLastFailedCommunicationToNow();
|
||||
RxBus.INSTANCE.send(statusChange);
|
||||
} else if (responseType == PodResponseType.Error) {
|
||||
statusChange = new EventOmnipodDeviceStatusChange(PodDeviceState.ErrorWhenCommunicating,
|
||||
errorDescription);
|
||||
OmnipodUtil.getPumpStatus().setLastFailedCommunicationToNow();
|
||||
RxBus.INSTANCE.send(statusChange);
|
||||
} else {
|
||||
OmnipodUtil.getPumpStatus().setLastCommunicationToNow();
|
||||
|
|
Loading…
Reference in a new issue