Merge branch 'omnipod_eros' of https://github.com/AAPS-Omnipod/AndroidAPS into omnipod_eros

This commit is contained in:
Andy Rozman 2019-11-27 22:36:48 +00:00
commit bea4bde8cb
2 changed files with 6 additions and 9 deletions

View file

@ -15,7 +15,7 @@ public enum PodProgressStatus {
TWO_NOT_USED_BUT_IN_33((byte) 0x0b), TWO_NOT_USED_BUT_IN_33((byte) 0x0b),
THREE_NOT_USED_BUT_IN_33((byte) 0x0c), THREE_NOT_USED_BUT_IN_33((byte) 0x0c),
ERROR_EVENT_LOGGED_SHUTTING_DOWN((byte) 0x0d), ERROR_EVENT_LOGGED_SHUTTING_DOWN((byte) 0x0d),
a((byte) 0x0e), DELAYED_PRIME((byte) 0x0e),
INACTIVE((byte) 0x0f); INACTIVE((byte) 0x0f);
private byte value; private byte value;

View file

@ -1,6 +1,5 @@
package info.nightscout.androidaps.plugins.pump.omnipod.driver.comm; package info.nightscout.androidaps.plugins.pump.omnipod.driver.comm;
import org.jetbrains.annotations.Nullable;
import org.joda.time.DateTime; import org.joda.time.DateTime;
import org.joda.time.Duration; import org.joda.time.Duration;
@ -47,7 +46,7 @@ public class AapsOmnipodManager implements OmnipodCommunicationManagerInterface
if (PodInitActionType.PairAndPrimeWizardStep.equals(podInitActionType)) { if (PodInitActionType.PairAndPrimeWizardStep.equals(podInitActionType)) {
PumpEnactResult result = delegate.pairAndPrime(res -> // PumpEnactResult result = delegate.pairAndPrime(res -> //
podInitReceiver.returnInitTaskStatus(podInitActionType, res.getResultType().isSuccess(), createCommentForSetupActionResult(res))); podInitReceiver.returnInitTaskStatus(podInitActionType, res.getResultType().isSuccess(), createCommentForSetupActionResult(res)));
if(!result.success) { if (!result.success) {
podInitReceiver.returnInitTaskStatus(podInitActionType, false, result.comment); podInitReceiver.returnInitTaskStatus(podInitActionType, false, result.comment);
} }
return result; return result;
@ -175,20 +174,18 @@ public class AapsOmnipodManager implements OmnipodCommunicationManagerInterface
//PodDbEntry entry = new PodDbEntry(requestTime, entryType); //PodDbEntry entry = new PodDbEntry(requestTime, entryType);
} }
@Nullable
private String createCommentForSetupActionResult(SetupActionResult res) { private String createCommentForSetupActionResult(SetupActionResult res) {
String comment = null; String comment = null;
switch(res.getResultType()) { switch (res.getResultType()) {
case FAILURE: case FAILURE:
// TODO use string resource // TODO use string resource
comment = "Unexpected setup progress: "+ res.getSetupProgress(); comment = "Unexpected setup progress: " + res.getSetupProgress();
break; break;
case VERIFICATION_FAILURE: case VERIFICATION_FAILURE:
// TODO use string resource // TODO use string resource
comment = "Verification failed: "+ res.getException().getClass().getSimpleName() +": "+ res.getException().getMessage(); comment = "Verification failed: " + res.getException().getClass().getSimpleName() + ": " + res.getException().getMessage();
break; break;
} }
return comment; return comment;
@ -198,7 +195,7 @@ public class AapsOmnipodManager implements OmnipodCommunicationManagerInterface
static BasalSchedule mapProfileToBasalSchedule(Profile profile) { static BasalSchedule mapProfileToBasalSchedule(Profile profile) {
Profile.ProfileValue[] basalValues = profile.getBasalValues(); Profile.ProfileValue[] basalValues = profile.getBasalValues();
List<BasalScheduleEntry> entries = new ArrayList<>(); List<BasalScheduleEntry> entries = new ArrayList<>();
for(Profile.ProfileValue basalValue : basalValues) { for (Profile.ProfileValue basalValue : basalValues) {
entries.add(new BasalScheduleEntry(basalValue.value, Duration.standardSeconds(basalValue.timeAsSeconds))); entries.add(new BasalScheduleEntry(basalValue.value, Duration.standardSeconds(basalValue.timeAsSeconds)));
} }