From eb5fb334c96ee41907c7bbc4e82fc6ec5640629b Mon Sep 17 00:00:00 2001 From: Bart Sopers Date: Sat, 17 Oct 2020 20:20:48 +0200 Subject: [PATCH] Small fixes --- .../message/response/podinfo/PodInfoDetailedStatus.java | 4 +--- .../exception/IllegalActivationProgressException.java | 2 +- .../ui/wizard/activation/PodActivationWizardActivity.kt | 2 +- .../pump/common/events/EventRileyLinkDeviceStatusChange.kt | 7 +++++-- .../common/hw/rileylink/service/RileyLinkServiceData.java | 7 +++---- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/omnipod/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/driver/communication/message/response/podinfo/PodInfoDetailedStatus.java b/omnipod/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/driver/communication/message/response/podinfo/PodInfoDetailedStatus.java index 123a352f03..0db5ed2b53 100644 --- a/omnipod/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/driver/communication/message/response/podinfo/PodInfoDetailedStatus.java +++ b/omnipod/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/driver/communication/message/response/podinfo/PodInfoDetailedStatus.java @@ -2,8 +2,6 @@ package info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.mes import org.joda.time.Duration; -import java.util.Arrays; - import info.nightscout.androidaps.plugins.pump.common.utils.ByteUtil; import info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.message.response.StatusUpdatableResponse; import info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.AlertSet; @@ -185,7 +183,7 @@ public class PodInfoDetailedStatus extends PodInfo implements StatusUpdatableRes ", receiverLowGain=" + receiverLowGain + ", radioRSSI=" + radioRSSI + ", previousPodProgressStatus=" + previousPodProgressStatus + - ", unknownValue=" + Arrays.toString(unknownValue) + + ", unknownValue=" + ByteUtil.shortHexString(unknownValue) + '}'; } } diff --git a/omnipod/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/driver/exception/IllegalActivationProgressException.java b/omnipod/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/driver/exception/IllegalActivationProgressException.java index e202ceefd8..0dffb93517 100644 --- a/omnipod/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/driver/exception/IllegalActivationProgressException.java +++ b/omnipod/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/driver/exception/IllegalActivationProgressException.java @@ -9,7 +9,7 @@ public class IllegalActivationProgressException extends OmnipodException { private final ActivationProgress actual; public IllegalActivationProgressException(ActivationProgress expected, ActivationProgress actual) { - super(String.format(Locale.getDefault(), "Illegal setup progress: %s, expected: %s", actual, expected), true); + super(String.format(Locale.getDefault(), "Illegal activation progress: %s, expected: %s", actual, expected), true); this.expected = expected; this.actual = actual; } diff --git a/omnipod/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/ui/wizard/activation/PodActivationWizardActivity.kt b/omnipod/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/ui/wizard/activation/PodActivationWizardActivity.kt index 0d67bf2709..eccc00eb94 100644 --- a/omnipod/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/ui/wizard/activation/PodActivationWizardActivity.kt +++ b/omnipod/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/ui/wizard/activation/PodActivationWizardActivity.kt @@ -25,7 +25,7 @@ class PodActivationWizardActivity : OmnipodWizardActivityBase() { setContentView(R.layout.omnipod_pod_activation_wizard_activity) startDestination = savedInstanceState?.getInt(KEY_START_DESTINATION, R.id.fillPodInfoFragment) - ?: if (!podStateManager.isPodInitialized || podStateManager.activationProgress.isBefore(ActivationProgress.PRIMING_COMPLETED)) { + ?: if (podStateManager.activationProgress.isBefore(ActivationProgress.PRIMING_COMPLETED)) { R.id.fillPodInfoFragment } else { R.id.attachPodInfoFragment diff --git a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/events/EventRileyLinkDeviceStatusChange.kt b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/events/EventRileyLinkDeviceStatusChange.kt index 59c084eb1f..b2ece2d419 100644 --- a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/events/EventRileyLinkDeviceStatusChange.kt +++ b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/events/EventRileyLinkDeviceStatusChange.kt @@ -9,6 +9,7 @@ import info.nightscout.androidaps.utils.resources.ResourceHelper open class EventRileyLinkDeviceStatusChange : EventStatus { + var rileyLinkTargetDevice: RileyLinkTargetDevice? = null var rileyLinkServiceState: RileyLinkServiceState? = null var rileyLinkError: RileyLinkError? = null @@ -18,7 +19,8 @@ open class EventRileyLinkDeviceStatusChange : EventStatus { constructor() { } - constructor(rileyLinkServiceState: RileyLinkServiceState?, rileyLinkError: RileyLinkError?) { + constructor(rileyLinkTargetDevice: RileyLinkTargetDevice, rileyLinkServiceState: RileyLinkServiceState?, rileyLinkError: RileyLinkError?) { + this.rileyLinkTargetDevice = rileyLinkTargetDevice this.rileyLinkServiceState = rileyLinkServiceState this.rileyLinkError = rileyLinkError } @@ -38,7 +40,8 @@ open class EventRileyLinkDeviceStatusChange : EventStatus { val rileyLinkError = this.rileyLinkError if (rileyLinkServiceState.isError && rileyLinkError != null) { - return resourceHelper.gs(rileyLinkError.getResourceId(RileyLinkTargetDevice.Omnipod)) + val rileyLinkTargetDevice = this.rileyLinkTargetDevice ?: return "" + return resourceHelper.gs(rileyLinkError.getResourceId(rileyLinkTargetDevice)) } return resourceHelper.gs(resourceId) diff --git a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/RileyLinkServiceData.java b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/RileyLinkServiceData.java index 13bebc22b8..02b27846bc 100644 --- a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/RileyLinkServiceData.java +++ b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/RileyLinkServiceData.java @@ -33,8 +33,7 @@ public class RileyLinkServiceData { public RileyLinkServiceState rileyLinkServiceState = RileyLinkServiceState.NotStarted; private long lastServiceStateChange = 0L; public RileyLinkFirmwareVersion firmwareVersion; - public RileyLinkTargetFrequency rileyLinkTargetFrequency; // TODO this might not be correct place - + public RileyLinkTargetFrequency rileyLinkTargetFrequency; public String rileylinkAddress; long lastTuneUpTime = 0L; public Double lastGoodFrequency; @@ -44,7 +43,7 @@ public class RileyLinkServiceData { // radio version public RileyLinkFirmwareVersion versionCC110; - public RileyLinkTargetDevice targetDevice; // TODO this might not be correct place + public RileyLinkTargetDevice targetDevice; // Medtronic Pump public String pumpID; @@ -86,7 +85,7 @@ public class RileyLinkServiceData { aapsLogger.info(LTag.PUMP, "RileyLink State Changed: {} {}", newState, errorCode == null ? "" : " - Error State: " + errorCode.name()); rileyLinkUtil.getRileyLinkHistory().add(new RLHistoryItem(rileyLinkServiceState, errorCode, targetDevice)); - rxBus.send(new EventRileyLinkDeviceStatusChange(newState, errorCode)); + rxBus.send(new EventRileyLinkDeviceStatusChange(targetDevice, newState, errorCode)); return null; } else {