RuffyScripter: read/infer pump time from menu.
This commit is contained in:
parent
cf142a4538
commit
e286b9e3c2
|
@ -2,8 +2,11 @@ package de.jotomo.ruffy.spi;
|
||||||
|
|
||||||
/** State displayed on the main screen of the pump. */
|
/** State displayed on the main screen of the pump. */
|
||||||
public class PumpState {
|
public class PumpState {
|
||||||
/** Time the state was captured. This is NOT the pump's time! */
|
/** Time the state was captured. */
|
||||||
public long timestamp;
|
public long timestamp;
|
||||||
|
/** Pump time. Note that this is derived from the time displayed on the main menu and assumes
|
||||||
|
* the date is set correctly */
|
||||||
|
public long pumpTime;
|
||||||
public String menu = null;
|
public String menu = null;
|
||||||
public boolean suspended;
|
public boolean suspended;
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,7 @@ import org.monkey.d.ruffy.ruffy.driver.display.menu.MenuTime;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
|
@ -509,12 +510,22 @@ public class RuffyScripter implements RuffyCommands {
|
||||||
}
|
}
|
||||||
state.batteryState = ((int) menu.getAttribute(MenuAttribute.BATTERY_STATE));
|
state.batteryState = ((int) menu.getAttribute(MenuAttribute.BATTERY_STATE));
|
||||||
state.insulinState = ((int) menu.getAttribute(MenuAttribute.INSULIN_STATE));
|
state.insulinState = ((int) menu.getAttribute(MenuAttribute.INSULIN_STATE));
|
||||||
|
MenuTime time = (MenuTime) menu.getAttribute(MenuAttribute.TIME);
|
||||||
|
Date date = new Date();
|
||||||
|
date.setHours(time.getHour());
|
||||||
|
date.setMinutes(time.getMinute());
|
||||||
|
state.pumpTime = date.getTime();
|
||||||
} else if (menuType == MenuType.WARNING_OR_ERROR) {
|
} else if (menuType == MenuType.WARNING_OR_ERROR) {
|
||||||
state.activeAlert = readWarningOrErrorCode();
|
state.activeAlert = readWarningOrErrorCode();
|
||||||
} else if (menuType == MenuType.STOP) {
|
} else if (menuType == MenuType.STOP) {
|
||||||
state.suspended = true;
|
state.suspended = true;
|
||||||
state.batteryState = ((int) menu.getAttribute(MenuAttribute.BATTERY_STATE));
|
state.batteryState = ((int) menu.getAttribute(MenuAttribute.BATTERY_STATE));
|
||||||
state.insulinState = ((int) menu.getAttribute(MenuAttribute.INSULIN_STATE));
|
state.insulinState = ((int) menu.getAttribute(MenuAttribute.INSULIN_STATE));
|
||||||
|
MenuTime time = (MenuTime) menu.getAttribute(MenuAttribute.TIME);
|
||||||
|
Date date = new Date();
|
||||||
|
date.setHours(time.getHour());
|
||||||
|
date.setMinutes(time.getMinute());
|
||||||
|
state.pumpTime = date.getTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
return state;
|
return state;
|
||||||
|
|
Loading…
Reference in a new issue