SetBasalProfileCommand: abort if active BR is != 1.

This commit is contained in:
Johannes Mockenhaupt 2017-12-27 11:34:22 +01:00
parent 728abbe224
commit 8089825c4c
No known key found for this signature in database
GPG key ID: 9E1EA6AF7BBBB0D1

View file

@ -13,6 +13,7 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import de.jotomo.ruffy.spi.BasalProfile; import de.jotomo.ruffy.spi.BasalProfile;
import de.jotomo.ruffy.spi.PumpState;
public class SetBasalProfileCommand extends BaseCommand { public class SetBasalProfileCommand extends BaseCommand {
private static final Logger log = LoggerFactory.getLogger(SetBasalProfileCommand.class); private static final Logger log = LoggerFactory.getLogger(SetBasalProfileCommand.class);
@ -26,6 +27,9 @@ public class SetBasalProfileCommand extends BaseCommand {
@Override @Override
public void execute() { public void execute() {
scripter.verifyMenuIsDisplayed(MenuType.MAIN_MENU); scripter.verifyMenuIsDisplayed(MenuType.MAIN_MENU);
if (scripter.readPumpStateInternal().unsafeUsageDetected == PumpState.UNSUPPORTED_BASAL_RATE_PROFILE) {
throw new CommandException("Active basal rate profile != 1");
}
scripter.navigateToMenu(MenuType.BASAL_1_MENU); scripter.navigateToMenu(MenuType.BASAL_1_MENU);
scripter.verifyMenuIsDisplayed(MenuType.BASAL_1_MENU); scripter.verifyMenuIsDisplayed(MenuType.BASAL_1_MENU);
scripter.pressCheckKey(); scripter.pressCheckKey();