diff --git a/core/src/main/java/info/nightscout/androidaps/plugins/pump/common/data/TempBasalPair.java b/core/src/main/java/info/nightscout/androidaps/plugins/pump/common/data/TempBasalPair.java deleted file mode 100644 index 5a1e0b4249..0000000000 --- a/core/src/main/java/info/nightscout/androidaps/plugins/pump/common/data/TempBasalPair.java +++ /dev/null @@ -1,72 +0,0 @@ -package info.nightscout.androidaps.plugins.pump.common.data; - -import com.google.gson.annotations.Expose; - -public class TempBasalPair { - - @Expose - protected double insulinRate = 0.0d; - @Expose - protected int durationMinutes = 0; - @Expose - protected boolean isPercent = false; - - private Long start; - private Long end; - - public TempBasalPair() { - } - - - public TempBasalPair(double insulinRate, boolean isPercent, int durationMinutes) { - this.insulinRate = insulinRate; - this.isPercent = isPercent; - this.durationMinutes = durationMinutes; - } - - - public double getInsulinRate() { - return insulinRate; - } - - - public void setInsulinRate(double insulinRate) { - this.insulinRate = insulinRate; - } - - - public int getDurationMinutes() { - return durationMinutes; - } - - - public void setDurationMinutes(int durationMinutes) { - this.durationMinutes = durationMinutes; - } - - - public boolean isPercent() { - return isPercent; - } - - - public void setIsPercent(boolean yesIsPercent) { - this.isPercent = yesIsPercent; - } - - public void setStartTime(Long startTime) { - this.start = startTime; - } - - - public void setEndTime(Long endTime) { - this.end = endTime; - } - - - @Override - public String toString() { - return "TempBasalPair [" + "Rate=" + insulinRate + ", DurationMinutes=" + durationMinutes + ", IsPercent=" - + isPercent + "]"; - } -} diff --git a/core/src/main/java/info/nightscout/androidaps/plugins/pump/common/data/DoseSettings.kt b/core/src/main/java/info/nightscout/androidaps/plugins/pump/common/defs/DoseSettings.kt similarity index 72% rename from core/src/main/java/info/nightscout/androidaps/plugins/pump/common/data/DoseSettings.kt rename to core/src/main/java/info/nightscout/androidaps/plugins/pump/common/defs/DoseSettings.kt index 90e25a7e37..c1a9b18167 100644 --- a/core/src/main/java/info/nightscout/androidaps/plugins/pump/common/data/DoseSettings.kt +++ b/core/src/main/java/info/nightscout/androidaps/plugins/pump/common/defs/DoseSettings.kt @@ -1,3 +1,3 @@ -package info.nightscout.androidaps.plugins.pump.common.data +package info.nightscout.androidaps.plugins.pump.common.defs class DoseSettings constructor(val step: Double, val durationStep: Int, val maxDuration: Int, val minDose: Double, val maxDose: Double = Double.MAX_VALUE) \ No newline at end of file diff --git a/core/src/main/java/info/nightscout/androidaps/plugins/pump/common/defs/DoseStepSize.java b/core/src/main/java/info/nightscout/androidaps/plugins/pump/common/defs/DoseStepSize.java deleted file mode 100644 index 095c11de65..0000000000 --- a/core/src/main/java/info/nightscout/androidaps/plugins/pump/common/defs/DoseStepSize.java +++ /dev/null @@ -1,100 +0,0 @@ -package info.nightscout.androidaps.plugins.pump.common.defs; - -import java.util.Locale; - -/** - * Created by andy on 02/05/2018. - */ - -public enum DoseStepSize { - - ComboBasal( // - new DoseStepSizeEntry(0f, 1f, 0.01f), // - new DoseStepSizeEntry(1f, 10f, 0.05f), // - new DoseStepSizeEntry(10f, Double.MAX_VALUE, 0.1f)), // - - InsightBolus( - new DoseStepSizeEntry(0f, 2f, 0.05f), // - new DoseStepSizeEntry(2f, 5f, 0.1f), // - new DoseStepSizeEntry(5f, 10f, 0.2f), // - new DoseStepSizeEntry(10f, Double.MAX_VALUE, 0.5f)), - - InsightBasal( - new DoseStepSizeEntry(0f, 5f, 0.01f), - new DoseStepSizeEntry(5f, Double.MAX_VALUE, 0.1f)), - - MedtronicVeoBasal( // - new DoseStepSizeEntry(0f, 1f, 0.025f), // - new DoseStepSizeEntry(1f, 10f, 0.05f), // - new DoseStepSizeEntry(10f, Double.MAX_VALUE, 0.1f)), // - - YpsopumpBasal( // - new DoseStepSizeEntry(0.0f, 1f, 0.01f), // - new DoseStepSizeEntry(1f, 2f, 0.02f), // - new DoseStepSizeEntry(2f, 15f, 0.1f), // - new DoseStepSizeEntry(15f, 40f, 0.5f) - ) - ; - - - DoseStepSizeEntry[] entries; - - - DoseStepSize(DoseStepSizeEntry... entries) { - this.entries = entries; - } - - - public double getStepSizeForAmount(double amount) { - for (DoseStepSizeEntry entry : entries) { - if (entry.from <= amount && entry.to > amount) - return entry.value; - } - - // should never come to this - return entries[entries.length - 1].value; - } - - - public String getDescription() { - StringBuilder sb = new StringBuilder(); - boolean first = true; - for (DoseStepSizeEntry entry : entries) { - - if (first) { - first = false; - } else { - sb.append(", "); - } - - sb.append(String.format(Locale.ENGLISH, "%.3f", entry.value)); - sb.append(" {"); - sb.append(String.format(Locale.ENGLISH,"%.3f", entry.from)); - sb.append("-"); - - if (entry.to == Double.MAX_VALUE) { - sb.append("~}"); - } else { - sb.append(String.format(Locale.ENGLISH, "%.3f", entry.to)); - sb.append("}"); - } - } - - return sb.toString(); - } - - - static class DoseStepSizeEntry { - double from; - double to; - double value; - - // to = this value is not included, but would actually mean <, so for rates between 0.025-0.975 u/h, we would have [from=0, to=10] - DoseStepSizeEntry(double from, double to, double value) { - this.from = from; - this.to = to; - this.value = value; - } - } - -} diff --git a/core/src/main/java/info/nightscout/androidaps/plugins/pump/common/defs/DoseStepSize.kt b/core/src/main/java/info/nightscout/androidaps/plugins/pump/common/defs/DoseStepSize.kt new file mode 100644 index 0000000000..179be45dc8 --- /dev/null +++ b/core/src/main/java/info/nightscout/androidaps/plugins/pump/common/defs/DoseStepSize.kt @@ -0,0 +1,56 @@ +package info.nightscout.androidaps.plugins.pump.common.defs + +import java.util.* + +enum class DoseStepSize(private val entries: Array) { + + ComboBasal(arrayOf( + DoseStepSizeEntry(0.0, 1.0, 0.01), + DoseStepSizeEntry(1.0, 10.0, 0.05), + DoseStepSizeEntry(10.0, Double.MAX_VALUE, 0.1))), + InsightBolus(arrayOf( + DoseStepSizeEntry(0.0, 2.0, 0.05), + DoseStepSizeEntry(2.0, 5.0, 0.1), + DoseStepSizeEntry(5.0, 10.0, 0.2), + DoseStepSizeEntry(10.0, Double.MAX_VALUE, 0.5))), + InsightBasal(arrayOf( + DoseStepSizeEntry(0.0, 5.0, 0.01), + DoseStepSizeEntry(5.0, Double.MAX_VALUE, 0.1))), + MedtronicVeoBasal(arrayOf( + DoseStepSizeEntry(0.0, 1.0, 0.025), + DoseStepSizeEntry(1.0, 10.0, 0.05), + DoseStepSizeEntry(10.0, Double.MAX_VALUE, 0.1))), + YpsopumpBasal(arrayOf( + DoseStepSizeEntry(0.0, 1.0, 0.01), + DoseStepSizeEntry(1.0, 2.0, 0.02), + DoseStepSizeEntry(2.0, 15.0, 0.1), + DoseStepSizeEntry(15.0, 40.0, 0.5)) + ); + + fun getStepSizeForAmount(amount: Double): Double { + for (entry in entries) + if (entry.from <= amount && entry.to > amount) return entry.value + + // should never come to this + return entries[entries.size - 1].value + } + + val description: String + get() = StringBuilder().also { sb -> + var first = true + for (entry in entries) { + if (first) first = false else sb.append(", ") + + sb.append(String.format(Locale.ENGLISH, "%.3f", entry.value)) + .append(" {") + .append(String.format(Locale.ENGLISH, "%.3f", entry.from)) + .append("-") + if (entry.to == Double.MAX_VALUE) sb.append("~}") + else sb.append(String.format(Locale.ENGLISH, "%.3f", entry.to)).append("}") + } + }.toString() + + // to = this value is not included, but would actually mean <, so for rates between 0.025-0.975 u/h, we would have [from=0, to=10] + internal class DoseStepSizeEntry(var from: Double, var to: Double, var value: Double) + +} \ No newline at end of file diff --git a/core/src/main/java/info/nightscout/androidaps/plugins/pump/common/defs/PumpCapability.kt b/core/src/main/java/info/nightscout/androidaps/plugins/pump/common/defs/PumpCapability.kt index 5276dbabb6..b8e74bb0a6 100644 --- a/core/src/main/java/info/nightscout/androidaps/plugins/pump/common/defs/PumpCapability.kt +++ b/core/src/main/java/info/nightscout/androidaps/plugins/pump/common/defs/PumpCapability.kt @@ -1,10 +1,5 @@ package info.nightscout.androidaps.plugins.pump.common.defs -import info.nightscout.androidaps.plugins.pump.common.defs.PumpCapability - -/** - * Created by andy on 03/05/2018. - */ enum class PumpCapability { Bolus, // isBolusCapable @@ -35,7 +30,10 @@ enum class PumpCapability { var children: ArrayList = ArrayList() - constructor() { children.add(this)} + constructor() { + children.add(this) + } + constructor(list: Array) { children.addAll(list) } diff --git a/core/src/main/java/info/nightscout/androidaps/plugins/pump/common/defs/PumpDeviceState.java b/core/src/main/java/info/nightscout/androidaps/plugins/pump/common/defs/PumpDeviceState.java deleted file mode 100644 index 4a9814c490..0000000000 --- a/core/src/main/java/info/nightscout/androidaps/plugins/pump/common/defs/PumpDeviceState.java +++ /dev/null @@ -1,29 +0,0 @@ -package info.nightscout.androidaps.plugins.pump.common.defs; - -import info.nightscout.androidaps.core.R; - -/** - * Created by andy on 6/11/18. - */ -public enum PumpDeviceState { - - NeverContacted(R.string.pump_status_never_contacted), // - Sleeping(R.string.pump_status_sleeping), // - WakingUp(R.string.pump_status_waking_up), // - Active(R.string.pump_status_active), // - ErrorWhenCommunicating(R.string.pump_status_error_comm), // - TimeoutWhenCommunicating(R.string.pump_status_timeout_comm), // - // ProblemContacting(R.string.medtronic_pump_status_problem_contacting), // - PumpUnreachable(R.string.pump_status_pump_unreachable), // - InvalidConfiguration(R.string.pump_status_invalid_config); - - Integer resourceId; - - PumpDeviceState(int resourceId) { - this.resourceId = resourceId; - } - - public Integer getResourceId() { - return resourceId; - } -} diff --git a/core/src/main/java/info/nightscout/androidaps/plugins/pump/common/defs/PumpDriverState.java b/core/src/main/java/info/nightscout/androidaps/plugins/pump/common/defs/PumpDriverState.java deleted file mode 100644 index 460c8dd3db..0000000000 --- a/core/src/main/java/info/nightscout/androidaps/plugins/pump/common/defs/PumpDriverState.java +++ /dev/null @@ -1,26 +0,0 @@ -package info.nightscout.androidaps.plugins.pump.common.defs; - -/** - * Created by andy on 10/15/18. - */ - -public enum PumpDriverState { - - NotInitialized, // - Connecting, // - Connected, // - Initialized, // - Ready, - Busy, // - Suspended, // - ; - - public static boolean isConnected(PumpDriverState pumpState) { - return pumpState == Connected || pumpState == Initialized || pumpState == Busy || pumpState == Suspended; - } - - - public static boolean isInitialized(PumpDriverState pumpState) { - return pumpState == Initialized || pumpState == Busy || pumpState == Suspended; - } -} diff --git a/core/src/main/java/info/nightscout/androidaps/plugins/pump/common/defs/PumpStatusType.java b/core/src/main/java/info/nightscout/androidaps/plugins/pump/common/defs/PumpStatusType.java deleted file mode 100644 index d32d6bb57f..0000000000 --- a/core/src/main/java/info/nightscout/androidaps/plugins/pump/common/defs/PumpStatusType.java +++ /dev/null @@ -1,23 +0,0 @@ -package info.nightscout.androidaps.plugins.pump.common.defs; - -/** - * Created by andy on 5/12/18. - */ - -public enum PumpStatusType { - Running("normal"), // - Suspended("suspended") // - ; - - private final String statusString; - - - PumpStatusType(String statusString) { - this.statusString = statusString; - } - - - public String getStatus() { - return statusString; - } -} diff --git a/core/src/main/java/info/nightscout/androidaps/plugins/pump/common/defs/PumpTempBasalType.java b/core/src/main/java/info/nightscout/androidaps/plugins/pump/common/defs/PumpTempBasalType.java deleted file mode 100644 index 90304ca45f..0000000000 --- a/core/src/main/java/info/nightscout/androidaps/plugins/pump/common/defs/PumpTempBasalType.java +++ /dev/null @@ -1,10 +0,0 @@ -package info.nightscout.androidaps.plugins.pump.common.defs; - -/** - * Created by andy on 02/05/2018. - */ - -public enum PumpTempBasalType { - Percent, // - Absolute, -} diff --git a/core/src/main/java/info/nightscout/androidaps/plugins/pump/common/defs/PumpTempBasalType.kt b/core/src/main/java/info/nightscout/androidaps/plugins/pump/common/defs/PumpTempBasalType.kt new file mode 100644 index 0000000000..20003df6ef --- /dev/null +++ b/core/src/main/java/info/nightscout/androidaps/plugins/pump/common/defs/PumpTempBasalType.kt @@ -0,0 +1,7 @@ +package info.nightscout.androidaps.plugins.pump.common.defs + +enum class PumpTempBasalType { + + Percent, + Absolute +} \ No newline at end of file diff --git a/core/src/main/java/info/nightscout/androidaps/plugins/pump/common/defs/PumpType.kt b/core/src/main/java/info/nightscout/androidaps/plugins/pump/common/defs/PumpType.kt index b00427a8fe..d372c84c6b 100644 --- a/core/src/main/java/info/nightscout/androidaps/plugins/pump/common/defs/PumpType.kt +++ b/core/src/main/java/info/nightscout/androidaps/plugins/pump/common/defs/PumpType.kt @@ -3,7 +3,6 @@ package info.nightscout.androidaps.plugins.pump.common.defs import info.nightscout.androidaps.core.R import info.nightscout.androidaps.database.embedments.InterfaceIDs import info.nightscout.androidaps.plugins.common.ManufacturerType -import info.nightscout.androidaps.plugins.pump.common.data.DoseSettings import info.nightscout.androidaps.utils.Round import info.nightscout.androidaps.utils.resources.ResourceHelper import kotlin.math.min diff --git a/core/src/main/java/info/nightscout/androidaps/plugins/pump/common/PumpPluginAbstract.java b/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/common/PumpPluginAbstract.java similarity index 99% rename from core/src/main/java/info/nightscout/androidaps/plugins/pump/common/PumpPluginAbstract.java rename to medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/common/PumpPluginAbstract.java index ad817d39f6..4245533ede 100644 --- a/core/src/main/java/info/nightscout/androidaps/plugins/pump/common/PumpPluginAbstract.java +++ b/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/common/PumpPluginAbstract.java @@ -157,7 +157,7 @@ public abstract class PumpPluginAbstract extends PumpPluginBase implements PumpI public boolean isInitialized() { - return PumpDriverState.isInitialized(pumpState); + return pumpState.isInitialized(); } @@ -174,7 +174,7 @@ public abstract class PumpPluginAbstract extends PumpPluginBase implements PumpI public boolean isConnected() { if (displayConnectionMessages) aapsLogger.debug(LTag.PUMP, "isConnected [PumpPluginAbstract]."); - return PumpDriverState.isConnected(pumpState); + return pumpState.isConnected(); } diff --git a/core/src/main/java/info/nightscout/androidaps/plugins/pump/common/data/PumpStatus.java b/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/common/data/PumpStatus.java similarity index 100% rename from core/src/main/java/info/nightscout/androidaps/plugins/pump/common/data/PumpStatus.java rename to medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/common/data/PumpStatus.java diff --git a/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/common/defs/PumpDriverState.kt b/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/common/defs/PumpDriverState.kt new file mode 100644 index 0000000000..f72163ce92 --- /dev/null +++ b/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/common/defs/PumpDriverState.kt @@ -0,0 +1,14 @@ +package info.nightscout.androidaps.plugins.pump.common.defs + +enum class PumpDriverState { + + NotInitialized, + Connecting, + Connected, + Initialized, + Ready, Busy, + Suspended; + + fun isConnected(): Boolean = this == Connected || this == Initialized || this == Busy || this == Suspended + fun isInitialized(): Boolean = this == Initialized || this == Busy || this == Suspended +} \ No newline at end of file diff --git a/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/common/defs/PumpStatusType.kt b/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/common/defs/PumpStatusType.kt new file mode 100644 index 0000000000..8a6c1a6a9a --- /dev/null +++ b/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/common/defs/PumpStatusType.kt @@ -0,0 +1,7 @@ +package info.nightscout.androidaps.plugins.pump.common.defs + +enum class PumpStatusType(val status: String) { + + Running("normal"), + Suspended("suspended"); +} \ No newline at end of file diff --git a/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/data/dto/TempBasalPair.java b/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/data/dto/TempBasalPair.java index d6399beafd..418770d4b6 100644 --- a/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/data/dto/TempBasalPair.java +++ b/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/data/dto/TempBasalPair.java @@ -16,7 +16,7 @@ import info.nightscout.androidaps.plugins.pump.medtronic.util.MedtronicUtil; *

* Just need a class to keep the pair together, for parcel transport. */ -public class TempBasalPair extends info.nightscout.androidaps.plugins.pump.common.data.TempBasalPair { +public class TempBasalPair extends info.nightscout.androidaps.plugins.pump.common.defs.TempBasalPair { /** * This constructor is for use with PumpHistoryDecoder @@ -30,11 +30,11 @@ public class TempBasalPair extends info.nightscout.androidaps.plugins.pump.commo int rateInt = ByteUtil.asUINT8(rateByte); if (isPercent) - this.insulinRate = rateByte; + this.setInsulinRate(rateByte); else - this.insulinRate = rateInt * 0.025; - this.durationMinutes = startTimeByte * 30; - this.isPercent = isPercent; + this.setInsulinRate(rateInt * 0.025); + this.setDurationMinutes(startTimeByte * 30); + this.setPercent(isPercent); } @@ -47,12 +47,12 @@ public class TempBasalPair extends info.nightscout.androidaps.plugins.pump.commo */ public TempBasalPair(byte rateByte0, byte rateByte1, int startTimeByte, boolean isPercent) { if (isPercent) { - this.insulinRate = rateByte0; + this.setInsulinRate(rateByte0); } else { - this.insulinRate = ByteUtil.toInt(rateByte1, rateByte0) * 0.025; + this.setInsulinRate(ByteUtil.toInt(rateByte1, rateByte0) * 0.025); } - this.durationMinutes = startTimeByte * 30; - this.isPercent = isPercent; + this.setDurationMinutes(startTimeByte * 30); + this.setPercent(isPercent); } public TempBasalPair(AAPSLogger aapsLogger, byte[] response) { @@ -60,20 +60,20 @@ public class TempBasalPair extends info.nightscout.androidaps.plugins.pump.commo aapsLogger.debug(LTag.PUMPBTCOMM, "Received TempBasal response: " + ByteUtil.getHex(response)); - isPercent = response[0] == 1; + setPercent(response[0] == 1); - if (isPercent) { - insulinRate = response[1]; + if (isPercent()) { + setInsulinRate(response[1]); } else { int strokes = MedtronicUtil.makeUnsignedShort(response[2], response[3]); - insulinRate = strokes / 40.0d; + setInsulinRate(strokes / 40.0d); } if (response.length < 6) { - durationMinutes = ByteUtil.asUINT8(response[4]); + setDurationMinutes(ByteUtil.asUINT8(response[4])); } else { - durationMinutes = MedtronicUtil.makeUnsignedShort(response[4], response[5]); + setDurationMinutes(MedtronicUtil.makeUnsignedShort(response[4], response[5])); } aapsLogger.warn(LTag.PUMPBTCOMM, String.format(Locale.ENGLISH, "TempBasalPair (with %d byte response): %s", response.length, toString())); @@ -92,8 +92,8 @@ public class TempBasalPair extends info.nightscout.androidaps.plugins.pump.commo list.add((byte) 5); - byte[] insulinRate = MedtronicUtil.getBasalStrokes(this.insulinRate, true); - byte timeMin = (byte) MedtronicUtil.getIntervalFromMinutes(durationMinutes); + byte[] insulinRate = MedtronicUtil.getBasalStrokes(this.getInsulinRate(), true); + byte timeMin = (byte) MedtronicUtil.getIntervalFromMinutes(getDurationMinutes()); // list.add((byte) 0); // ? @@ -120,7 +120,7 @@ public class TempBasalPair extends info.nightscout.androidaps.plugins.pump.commo } public boolean isCancelTBR() { - return (MedtronicUtil.isSame(insulinRate, 0.0d) && durationMinutes == 0); + return (MedtronicUtil.isSame(getInsulinRate(), 0.0d) && getDurationMinutes() == 0); } @@ -129,17 +129,17 @@ public class TempBasalPair extends info.nightscout.androidaps.plugins.pump.commo return "Cancel TBR"; } - if (isPercent) { - return String.format(Locale.ENGLISH, "Rate: %.0f%%, Duration: %d min", insulinRate, durationMinutes); + if (isPercent()) { + return String.format(Locale.ENGLISH, "Rate: %.0f%%, Duration: %d min", getInsulinRate(), getDurationMinutes()); } else { - return String.format(Locale.ENGLISH, "Rate: %.3f U, Duration: %d min", insulinRate, durationMinutes); + return String.format(Locale.ENGLISH, "Rate: %.3f U, Duration: %d min", getInsulinRate(), getDurationMinutes()); } } @NonNull @Override public String toString() { - return "TempBasalPair [" + "Rate=" + insulinRate + ", DurationMinutes=" + durationMinutes + ", IsPercent=" - + isPercent + "]"; + return "TempBasalPair [" + "Rate=" + getInsulinRate() + ", DurationMinutes=" + getDurationMinutes() + ", IsPercent=" + + isPercent() + "]"; } } diff --git a/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/OmnipodErosPumpPlugin.java b/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/OmnipodErosPumpPlugin.java index 9792bc74ff..76e8237589 100644 --- a/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/OmnipodErosPumpPlugin.java +++ b/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/OmnipodErosPumpPlugin.java @@ -57,7 +57,7 @@ import info.nightscout.androidaps.plugins.general.actions.defs.CustomActionType; import info.nightscout.androidaps.plugins.general.overview.events.EventDismissNotification; import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification; import info.nightscout.androidaps.plugins.general.overview.notifications.Notification; -import info.nightscout.androidaps.plugins.pump.common.data.TempBasalPair; +import info.nightscout.androidaps.plugins.pump.common.defs.TempBasalPair; import info.nightscout.androidaps.plugins.pump.common.defs.PumpType; import info.nightscout.androidaps.plugins.pump.common.events.EventRileyLinkDeviceStatusChange; import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkConst; diff --git a/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/manager/AapsOmnipodErosManager.java b/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/manager/AapsOmnipodErosManager.java index e797b78551..da38299c6c 100644 --- a/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/manager/AapsOmnipodErosManager.java +++ b/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/manager/AapsOmnipodErosManager.java @@ -33,7 +33,7 @@ import info.nightscout.androidaps.plugins.general.overview.events.EventDismissNo import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification; import info.nightscout.androidaps.plugins.general.overview.events.EventOverviewBolusProgress; import info.nightscout.androidaps.plugins.general.overview.notifications.Notification; -import info.nightscout.androidaps.plugins.pump.common.data.TempBasalPair; +import info.nightscout.androidaps.plugins.pump.common.defs.TempBasalPair; import info.nightscout.androidaps.plugins.pump.common.defs.PumpType; import info.nightscout.androidaps.plugins.pump.common.utils.ByteUtil; import info.nightscout.androidaps.plugins.pump.omnipod.common.definition.OmnipodCommandType; @@ -476,7 +476,7 @@ public class AapsOmnipodErosManager { return new PumpEnactResult(injector).success(false).enacted(false).comment(comment); } - public PumpEnactResult setTemporaryBasal(TempBasalPair tempBasalPair) { + public PumpEnactResult setTemporaryBasal(TempBasalPair tempBasalPair) { boolean beepsEnabled = isTbrBeepsEnabled(); try { executeCommand(() -> delegate.setTemporaryBasal(PumpType.OMNIPOD_EROS.determineCorrectBasalSize(tempBasalPair.getInsulinRate()), Duration.standardMinutes(tempBasalPair.getDurationMinutes()), beepsEnabled, beepsEnabled)); diff --git a/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/ui/ErosPodHistoryActivity.java b/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/ui/ErosPodHistoryActivity.java index 3e55a2bf12..9ec2a3685a 100644 --- a/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/ui/ErosPodHistoryActivity.java +++ b/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/ui/ErosPodHistoryActivity.java @@ -29,7 +29,7 @@ import info.nightscout.androidaps.db.OmnipodHistoryRecord; import info.nightscout.androidaps.interfaces.DatabaseHelperInterface; import info.nightscout.androidaps.logging.AAPSLogger; import info.nightscout.androidaps.logging.LTag; -import info.nightscout.androidaps.plugins.pump.common.data.TempBasalPair; +import info.nightscout.androidaps.plugins.pump.common.defs.TempBasalPair; import info.nightscout.androidaps.plugins.pump.common.defs.PumpHistoryEntryGroup; import info.nightscout.androidaps.plugins.pump.common.defs.PumpType; import info.nightscout.androidaps.plugins.pump.common.utils.ProfileUtil; diff --git a/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/OmnipodErosPumpPluginTest.java b/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/OmnipodErosPumpPluginTest.java index ffe2160f06..4ee2afab5e 100644 --- a/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/OmnipodErosPumpPluginTest.java +++ b/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/OmnipodErosPumpPluginTest.java @@ -23,7 +23,7 @@ import info.nightscout.androidaps.interfaces.CommandQueueProvider; import info.nightscout.androidaps.logging.AAPSLogger; import info.nightscout.androidaps.logging.AAPSLoggerTest; import info.nightscout.androidaps.plugins.bus.RxBusWrapper; -import info.nightscout.androidaps.plugins.pump.common.data.TempBasalPair; +import info.nightscout.androidaps.plugins.pump.common.defs.TempBasalPair; import info.nightscout.androidaps.plugins.pump.common.defs.PumpType; import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkUtil; import info.nightscout.androidaps.plugins.pump.omnipod.eros.manager.AapsOmnipodErosManager; diff --git a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/defs/PumpDeviceState.kt b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/defs/PumpDeviceState.kt new file mode 100644 index 0000000000..b41a6bd4c1 --- /dev/null +++ b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/defs/PumpDeviceState.kt @@ -0,0 +1,17 @@ +package info.nightscout.androidaps.plugins.pump.common.defs + +import info.nightscout.androidaps.core.R + +enum class PumpDeviceState(var resourceId: Int) { + + NeverContacted(R.string.pump_status_never_contacted), + Sleeping(R.string.pump_status_sleeping), + WakingUp(R.string.pump_status_waking_up), + Active(R.string.pump_status_active), + ErrorWhenCommunicating(R.string.pump_status_error_comm), + TimeoutWhenCommunicating(R.string.pump_status_timeout_comm), + + // ProblemContacting(R.string.medtronic_pump_status_problem_contacting), + PumpUnreachable(R.string.pump_status_pump_unreachable), + InvalidConfiguration(R.string.pump_status_invalid_config); +} \ No newline at end of file diff --git a/core/src/main/java/info/nightscout/androidaps/plugins/pump/common/defs/PumpHistoryEntryGroup.java b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/defs/PumpHistoryEntryGroup.java similarity index 100% rename from core/src/main/java/info/nightscout/androidaps/plugins/pump/common/defs/PumpHistoryEntryGroup.java rename to rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/defs/PumpHistoryEntryGroup.java diff --git a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/defs/TempBasalPair.kt b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/defs/TempBasalPair.kt new file mode 100644 index 0000000000..320be53927 --- /dev/null +++ b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/defs/TempBasalPair.kt @@ -0,0 +1,32 @@ +package info.nightscout.androidaps.plugins.pump.common.defs + +import com.google.gson.annotations.Expose + +open class TempBasalPair { + + @Expose var insulinRate = 0.0 + @Expose var durationMinutes = 0 + @Expose var isPercent = false + private var start: Long? = null + private var end: Long? = null + + constructor() + constructor(insulinRate: Double, isPercent: Boolean, durationMinutes: Int) { + this.insulinRate = insulinRate + this.isPercent = isPercent + this.durationMinutes = durationMinutes + } + + fun setStartTime(startTime: Long?) { + start = startTime + } + + fun setEndTime(endTime: Long?) { + end = endTime + } + + override fun toString(): String { + return ("TempBasalPair [" + "Rate=" + insulinRate + ", DurationMinutes=" + durationMinutes + ", IsPercent=" + + isPercent + "]") + } +} \ No newline at end of file diff --git a/core/src/main/java/info/nightscout/androidaps/plugins/pump/common/dialog/RefreshableInterface.java b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/dialog/RefreshableInterface.java similarity index 100% rename from core/src/main/java/info/nightscout/androidaps/plugins/pump/common/dialog/RefreshableInterface.java rename to rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/dialog/RefreshableInterface.java diff --git a/core/src/main/java/info/nightscout/androidaps/plugins/pump/common/events/EventRefreshButtonState.kt b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/events/EventRefreshButtonState.kt similarity index 100% rename from core/src/main/java/info/nightscout/androidaps/plugins/pump/common/events/EventRefreshButtonState.kt rename to rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/events/EventRefreshButtonState.kt diff --git a/core/src/main/java/info/nightscout/androidaps/plugins/pump/common/utils/ByteUtil.java b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/utils/ByteUtil.java similarity index 100% rename from core/src/main/java/info/nightscout/androidaps/plugins/pump/common/utils/ByteUtil.java rename to rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/utils/ByteUtil.java diff --git a/core/src/main/java/info/nightscout/androidaps/plugins/pump/common/utils/CRC.java b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/utils/CRC.java similarity index 100% rename from core/src/main/java/info/nightscout/androidaps/plugins/pump/common/utils/CRC.java rename to rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/utils/CRC.java diff --git a/core/src/main/java/info/nightscout/androidaps/plugins/pump/common/utils/ProfileUtil.java b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/utils/ProfileUtil.java similarity index 100% rename from core/src/main/java/info/nightscout/androidaps/plugins/pump/common/utils/ProfileUtil.java rename to rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/utils/ProfileUtil.java diff --git a/core/src/main/java/info/nightscout/androidaps/plugins/pump/common/utils/StringUtil.java b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/utils/StringUtil.java similarity index 100% rename from core/src/main/java/info/nightscout/androidaps/plugins/pump/common/utils/StringUtil.java rename to rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/utils/StringUtil.java diff --git a/core/src/main/java/info/nightscout/androidaps/plugins/pump/common/utils/ThreadUtil.java b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/utils/ThreadUtil.java similarity index 100% rename from core/src/main/java/info/nightscout/androidaps/plugins/pump/common/utils/ThreadUtil.java rename to rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/utils/ThreadUtil.java