Add method RuffyCommands.isConnected().
This commit is contained in:
parent
7c662345ae
commit
51d242a3fb
|
@ -23,6 +23,9 @@ public interface RuffyCommands {
|
|||
/** Indicate of the pump is busy processing a command. */
|
||||
boolean isPumpBusy();
|
||||
|
||||
/** Whether there's an active BT connection to the pump. */
|
||||
boolean isConnected();
|
||||
|
||||
/** Read the state of the pump, which encompasses all information displayed on the main menu. */
|
||||
CommandResult readPumpState();
|
||||
|
||||
|
|
|
@ -68,6 +68,11 @@ public class RuffyCommandsV1Impl implements RuffyCommands {
|
|||
return delegate.isPumpBusy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isConnected() {
|
||||
return delegate.isConnected();
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandResult readPumpState() {
|
||||
return delegate.readPumpState();
|
||||
|
|
|
@ -203,6 +203,15 @@ public class RuffyScripter implements RuffyCommands {
|
|||
return activeCmd != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isConnected() {
|
||||
try {
|
||||
return ruffyService.isConnected();
|
||||
} catch (RemoteException e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandResult readPumpState() {
|
||||
return runCommand(new ReadPumpStateCommand());
|
||||
|
@ -485,7 +494,7 @@ public class RuffyScripter implements RuffyCommands {
|
|||
state.batteryState = ((int) menu.getAttribute(MenuAttribute.BATTERY_STATE));
|
||||
state.insulinState = ((int) menu.getAttribute(MenuAttribute.INSULIN_STATE));
|
||||
} else if (menuType == MenuType.WARNING_OR_ERROR) {
|
||||
state.alertCodes = readWarningOrErrorCode();
|
||||
state.activeAlert = readWarningOrErrorCode();
|
||||
} else if (menuType == MenuType.STOP) {
|
||||
state.suspended = true;
|
||||
state.batteryState = ((int) menu.getAttribute(MenuAttribute.BATTERY_STATE));
|
||||
|
|
Loading…
Reference in a new issue