From b7b47970eda6df473e471a86d0535526143bae19 Mon Sep 17 00:00:00 2001 From: Andy Rozman Date: Fri, 30 Aug 2019 10:39:40 +0100 Subject: [PATCH] - started working on PodInitWizard - changed OmnipodCommunicationManagerInterface a little to include operation Type and Receiver Interface (not fully done yet, but what is there can be used) - started working on PodManagamentActivity.kt --- app/src/main/AndroidManifest.xml | 6 +- .../plugins/pump/common/defs/PumpType.java | 29 ++--- .../pump/omnipod/OmnipodPumpPlugin.java | 3 + .../comm/OmnipodCommunicationManager.java | 22 ++-- .../pump/omnipod/comm/ui/OmnipodUITask.java | 10 +- .../OmnipodCommunicationManagerInterface.java | 24 ++-- .../pump/omnipod/defs/OmnipodPodType.java | 6 + .../pump/omnipod/defs/PodInitActionType.java | 23 ++++ .../pump/omnipod/defs/PodInitReceiver.java | 7 ++ .../pump/omnipod/dialogs/InitPodWizard.kt | 14 +++ .../omnipod/dialogs/PodManagementActivity.kt | 41 +++++++ .../pump/omnipod/util/OmnipodUtil.java | 9 ++ .../omnipod_dash/OmnipodDashPumpPlugin.java | 38 +------ .../comm/OmnipodDashCommunicationManager.java | 29 +++-- app/src/main/res/layout/omnipod_initpod.xml | 106 ++++++++++++++++++ app/src/main/res/layout/omnipod_pod_mgmt.xml | 88 +++++++++++++++ 16 files changed, 363 insertions(+), 92 deletions(-) create mode 100644 app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/defs/OmnipodPodType.java create mode 100644 app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/defs/PodInitActionType.java create mode 100644 app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/defs/PodInitReceiver.java create mode 100644 app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dialogs/InitPodWizard.kt create mode 100644 app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dialogs/PodManagementActivity.kt create mode 100644 app/src/main/res/layout/omnipod_initpod.xml create mode 100644 app/src/main/res/layout/omnipod_pod_mgmt.xml diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index e2dd5da974..8b6173e5eb 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -124,7 +124,7 @@ - @@ -155,7 +155,7 @@ + android:permission="android.permission.BIND_JOB_SERVICE" /> @@ -306,6 +306,8 @@ android:enabled="true" android:exported="true" /> + + * Most of this defintions is intended for VirtualPump only, but they can be used by other plugins. */ @@ -60,7 +60,7 @@ public enum PumpType { 0.02d, 0.01d, DoseStepSize.InsightBolus, PumpCapability.InsightCapabilities), // // Animas - AnimasVibe("Animas Vibe",ManufacturerType.Animas, "Vibe", 0.05d, null, // AnimasBolus? + AnimasVibe("Animas Vibe", ManufacturerType.Animas, "Vibe", 0.05d, null, // AnimasBolus? new DoseSettings(0.05d, 30, 12 * 60, 0.05d), // PumpTempBasalType.Percent, // new DoseSettings(10, 30, 24 * 60, 0d, 300d), PumpCapability.BasalRate_Duration30minAllowed, // @@ -91,7 +91,7 @@ public enum PumpType { // Insulet - Insulet_Omnipod("Insulet Omnipod", ManufacturerType.Insulet, "Omnipod", 0.05d, null, // + Insulet_Omnipod("Insulet Omnipod", ManufacturerType.Insulet, "Omnipod (Eros)", 0.05d, null, // new DoseSettings(0.05d, 30, 8 * 60, 0.05d), // PumpTempBasalType.Absolute, // new DoseSettings(0.05d, 30, 12 * 60, 0d, 30.0d), PumpCapability.BasalRate_Duration30minAllowed, // cannot exceed max basal rate 30u/hr @@ -101,13 +101,13 @@ public enum PumpType { new DoseSettings(0.05d, 30, 8 * 60, 0.05d), // PumpTempBasalType.Absolute, // new DoseSettings(0.05d, 30, 12 * 60, 0d, 30.0d), PumpCapability.BasalRate_Duration30minAllowed, // cannot exceed max basal rate 30u/hr - 0.05d, 0.05d, null, PumpCapability.VirtualPumpCapabilities), + 0.05d, 0.05d, null, PumpCapability.VirtualPumpCapabilities), // TODO just copied OmniPod for now // Medtronic Medtronic_512_712("Medtronic 512/712", ManufacturerType.Medtronic, "512/712", 0.1d, null, // new DoseSettings(0.05d, 30, 8 * 60, 0.05d), // PumpTempBasalType.Absolute, // - new DoseSettings(0.05d, 30, 24*60, 0d, 35d), PumpCapability.BasalRate_Duration30minAllowed, // + new DoseSettings(0.05d, 30, 24 * 60, 0d, 35d), PumpCapability.BasalRate_Duration30minAllowed, // 0.05d, 0.05d, null, PumpCapability.MedtronicCapabilities), // Medtronic_515_715("Medtronic 515/715", "515/715", Medtronic_512_712), @@ -116,7 +116,7 @@ public enum PumpType { Medtronic_523_723_Revel("Medtronic 523/723 (Revel)", ManufacturerType.Medtronic, "523/723 (Revel)", 0.05d, null, // new DoseSettings(0.05d, 30, 8 * 60, 0.05d), // PumpTempBasalType.Absolute, // - new DoseSettings(0.05d, 30, 24*60, 0d, 35d), PumpCapability.BasalRate_Duration30minAllowed, // + new DoseSettings(0.05d, 30, 24 * 60, 0d, 35d), PumpCapability.BasalRate_Duration30minAllowed, // 0.025d, 0.025d, DoseStepSize.MedtronicVeoBasal, PumpCapability.MedtronicCapabilities), // Medtronic_554_754_Veo("Medtronic 554/754 (Veo)", "554/754 (Veo)", Medtronic_523_723_Revel), // TODO @@ -139,8 +139,7 @@ public enum PumpType { TandemTSlimX2("Tandem t:slim X2", "t:slim X2", TandemTSlim), // // MDI - MDI("MDI", ManufacturerType.AndroidAPS, "MDI") - ; + MDI("MDI", ManufacturerType.AndroidAPS, "MDI"); private String description; @@ -170,24 +169,21 @@ public enum PumpType { } - PumpType(String description, String model, PumpType parent) - { + PumpType(String description, String model, PumpType parent) { this.description = description; this.parent = parent; this.model = model; } - PumpType(String description, ManufacturerType manufacturer, String model) - { + PumpType(String description, ManufacturerType manufacturer, String model) { this.description = description; this.manufacturer = manufacturer; this.model = model; } - PumpType(String description, String model, PumpType parent, PumpCapability pumpCapability) - { + PumpType(String description, String model, PumpType parent, PumpCapability pumpCapability) { this.description = description; this.parent = parent; this.pumpCapability = pumpCapability; @@ -196,9 +192,8 @@ public enum PumpType { PumpType(String description, ManufacturerType manufacturer, String model, double bolusSize, DoseStepSize specialBolusSize, // DoseSettings extendedBolusSettings, // - PumpTempBasalType pumpTempBasalType, DoseSettings tbrSettings, PumpCapability specialBasalDurations, // - double baseBasalMinValue, double baseBasalStep, DoseStepSize baseBasalSpecialSteps, PumpCapability pumpCapability) - { + PumpTempBasalType pumpTempBasalType, DoseSettings tbrSettings, PumpCapability specialBasalDurations, // + double baseBasalMinValue, double baseBasalStep, DoseStepSize baseBasalSpecialSteps, PumpCapability pumpCapability) { this(description, manufacturer, model, bolusSize, specialBolusSize, extendedBolusSettings, pumpTempBasalType, tbrSettings, specialBasalDurations, baseBasalMinValue, null, baseBasalStep, baseBasalSpecialSteps, pumpCapability); } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/OmnipodPumpPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/OmnipodPumpPlugin.java index e601a7ab59..9282cd91eb 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/OmnipodPumpPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/OmnipodPumpPlugin.java @@ -49,6 +49,7 @@ import info.nightscout.androidaps.plugins.pump.omnipod.comm.ui.OmnipodUITask; import info.nightscout.androidaps.plugins.pump.omnipod.defs.OmnipodCommandType; import info.nightscout.androidaps.plugins.pump.omnipod.defs.OmnipodCommunicationManagerInterface; import info.nightscout.androidaps.plugins.pump.omnipod.defs.OmnipodCustomActionType; +import info.nightscout.androidaps.plugins.pump.omnipod.defs.OmnipodPodType; import info.nightscout.androidaps.plugins.pump.omnipod.defs.state.PodSessionState; import info.nightscout.androidaps.plugins.pump.omnipod.events.EventOmnipodPumpValuesChanged; import info.nightscout.androidaps.plugins.pump.omnipod.events.EventOmnipodRefreshButtonState; @@ -104,6 +105,8 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements PumpInterfa displayConnectionMessages = false; + OmnipodUtil.setOmnipodPodType(OmnipodPodType.Eros); + if (omnipodCommunicationManager == null) { omnipodCommunicationManager = OmnipodCommunicationManager.getInstance(); } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/OmnipodCommunicationManager.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/OmnipodCommunicationManager.java index e08a399090..f6285b8a87 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/OmnipodCommunicationManager.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/OmnipodCommunicationManager.java @@ -6,6 +6,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import info.nightscout.androidaps.data.Profile; +import info.nightscout.androidaps.data.PumpEnactResult; import info.nightscout.androidaps.logging.L; import info.nightscout.androidaps.plugins.pump.common.data.TempBasalPair; import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkCommunicationManager; @@ -14,7 +15,6 @@ import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.RFSpy; import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.data.RLMessage; import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.defs.RLMessageType; import info.nightscout.androidaps.plugins.pump.omnipod.OmnipodManager; -import info.nightscout.androidaps.plugins.pump.omnipod.comm.data.PodCommResponse; import info.nightscout.androidaps.plugins.pump.omnipod.defs.OmnipodCommunicationManagerInterface; import info.nightscout.androidaps.plugins.pump.omnipod.defs.state.PodSessionState; import info.nightscout.androidaps.plugins.pump.omnipod.util.OmnipodUtil; @@ -95,7 +95,7 @@ public class OmnipodCommunicationManager extends RileyLinkCommunicationManager i // This are just skeleton methods, we need to see what we can get returned and act accordingly - public PodCommResponse initPod() { + public PumpEnactResult initPod() { omnipodManager.pairAndPrime(); @@ -103,41 +103,41 @@ public class OmnipodCommunicationManager extends RileyLinkCommunicationManager i } - public PodCommResponse getPodStatus() { + public PumpEnactResult getPodStatus() { return null; } - public PodCommResponse deactivatePod() { + public PumpEnactResult deactivatePod() { return null; } - public PodCommResponse setBasalProfile(Profile profile) { + public PumpEnactResult setBasalProfile(Profile profile) { return null; } - public PodCommResponse resetPodStatus() { + public PumpEnactResult resetPodStatus() { return null; } - public PodCommResponse setBolus(Double parameter) { + public PumpEnactResult setBolus(Double parameter) { return null; } - public PodCommResponse cancelBolus() { + public PumpEnactResult cancelBolus() { return null; } - public PodCommResponse setTemporaryBasal(TempBasalPair tbr) { + public PumpEnactResult setTemporaryBasal(TempBasalPair tbr) { return null; } - public PodCommResponse cancelTemporaryBasal() { + public PumpEnactResult cancelTemporaryBasal() { return null; } @Override - public PodCommResponse acknowledgeAlerts() { + public PumpEnactResult acknowledgeAlerts() { return null; } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/ui/OmnipodUITask.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/ui/OmnipodUITask.java index 5a831e1e19..6e88f95f67 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/ui/OmnipodUITask.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/ui/OmnipodUITask.java @@ -4,13 +4,15 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import info.nightscout.androidaps.data.Profile; +import info.nightscout.androidaps.data.PumpEnactResult; import info.nightscout.androidaps.logging.L; import info.nightscout.androidaps.plugins.bus.RxBus; import info.nightscout.androidaps.plugins.pump.common.data.TempBasalPair; -import info.nightscout.androidaps.plugins.pump.omnipod.comm.data.PodCommResponse; import info.nightscout.androidaps.plugins.pump.omnipod.defs.OmnipodCommandType; import info.nightscout.androidaps.plugins.pump.omnipod.defs.OmnipodCommunicationManagerInterface; import info.nightscout.androidaps.plugins.pump.omnipod.defs.PodDeviceState; +import info.nightscout.androidaps.plugins.pump.omnipod.defs.PodInitActionType; +import info.nightscout.androidaps.plugins.pump.omnipod.defs.PodInitReceiver; import info.nightscout.androidaps.plugins.pump.omnipod.defs.PodResponseType; import info.nightscout.androidaps.plugins.pump.omnipod.events.EventOmnipodDeviceStatusChange; import info.nightscout.androidaps.plugins.pump.omnipod.events.EventOmnipodPumpValuesChanged; @@ -25,7 +27,7 @@ public class OmnipodUITask { private static final Logger LOG = LoggerFactory.getLogger(L.PUMP); public OmnipodCommandType commandType; - public PodCommResponse returnData; + public PumpEnactResult returnData; private String errorDescription; private Object[] parameters; private PodResponseType responseType; @@ -55,7 +57,7 @@ public class OmnipodUITask { // break; case InitPod: - returnData = communicationManager.initPod(); + returnData = communicationManager.initPod((PodInitActionType) parameters[0], (PodInitReceiver) parameters[1]); break; case DeactivatePod: @@ -188,7 +190,7 @@ public class OmnipodUITask { if (returnData == null) { return false; } - return returnData.isAcknowledged(); + return returnData.success; } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/defs/OmnipodCommunicationManagerInterface.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/defs/OmnipodCommunicationManagerInterface.java index 48baf9e815..aabaaed6e5 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/defs/OmnipodCommunicationManagerInterface.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/defs/OmnipodCommunicationManagerInterface.java @@ -1,8 +1,8 @@ package info.nightscout.androidaps.plugins.pump.omnipod.defs; import info.nightscout.androidaps.data.Profile; +import info.nightscout.androidaps.data.PumpEnactResult; import info.nightscout.androidaps.plugins.pump.common.data.TempBasalPair; -import info.nightscout.androidaps.plugins.pump.omnipod.comm.data.PodCommResponse; public interface OmnipodCommunicationManagerInterface { @@ -11,56 +11,56 @@ public interface OmnipodCommunicationManagerInterface { /** * Initialize Pod */ - PodCommResponse initPod(); + PumpEnactResult initPod(PodInitActionType podInitActionType, PodInitReceiver podIniReceiver); /** * Get Pod Status (is pod running, battery left ?, reservoir, etc) */ - PodCommResponse getPodStatus(); + PumpEnactResult getPodStatus(); /** * Deactivate Pod */ - PodCommResponse deactivatePod(); + PumpEnactResult deactivatePod(); /** * Set Basal Profile */ - PodCommResponse setBasalProfile(Profile profile); + PumpEnactResult setBasalProfile(Profile profile); /** * Reset Pod status (if we forget to disconnect Pod and want to init new pod, and want to forget current pod) */ - PodCommResponse resetPodStatus(); + PumpEnactResult resetPodStatus(); /** * Set Bolus * * @param amount amount of bolus in U */ - PodCommResponse setBolus(Double amount); + PumpEnactResult setBolus(Double amount); /** * Cancel Bolus (if bolus is already stopped, return acknowledgment) */ - PodCommResponse cancelBolus(); + PumpEnactResult cancelBolus(); /** * Set Temporary Basal * - * @param tbr TempBasalPair object containg amount and duration in minutes + * @param tbr TempBasalPair object containing amount and duration in minutes */ - PodCommResponse setTemporaryBasal(TempBasalPair tbr); + PumpEnactResult setTemporaryBasal(TempBasalPair tbr); /** * Cancel Temporary Basal (if TB is already stopped, return acknowledgment) */ - PodCommResponse cancelTemporaryBasal(); + PumpEnactResult cancelTemporaryBasal(); /** * Acknowledge alerts */ - PodCommResponse acknowledgeAlerts(); + PumpEnactResult acknowledgeAlerts(); } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/defs/OmnipodPodType.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/defs/OmnipodPodType.java new file mode 100644 index 0000000000..849a22e5b0 --- /dev/null +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/defs/OmnipodPodType.java @@ -0,0 +1,6 @@ +package info.nightscout.androidaps.plugins.pump.omnipod.defs; + +public enum OmnipodPodType { + Eros, // + Dash +} diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/defs/PodInitActionType.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/defs/PodInitActionType.java new file mode 100644 index 0000000000..063eceaab0 --- /dev/null +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/defs/PodInitActionType.java @@ -0,0 +1,23 @@ +package info.nightscout.androidaps.plugins.pump.omnipod.defs; + +public enum PodInitActionType { + + PairAndPrime, // + PairPod(PairAndPrime), // + PrimePod(PairAndPrime), // + + + ; + + + PodInitActionType() { + + } + + + private PodInitActionType(PodInitActionType parent) { + + } + + +} diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/defs/PodInitReceiver.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/defs/PodInitReceiver.java new file mode 100644 index 0000000000..789da1add2 --- /dev/null +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/defs/PodInitReceiver.java @@ -0,0 +1,7 @@ +package info.nightscout.androidaps.plugins.pump.omnipod.defs; + +public interface PodInitReceiver { + + void returnInitTaskStatus(PodInitActionType podInitActionType, boolean isSuccess, String errorMessage); + +} diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dialogs/InitPodWizard.kt b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dialogs/InitPodWizard.kt new file mode 100644 index 0000000000..6089bcc389 --- /dev/null +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dialogs/InitPodWizard.kt @@ -0,0 +1,14 @@ +package info.nightscout.androidaps.plugins.pump.omnipod.dialogs + +import info.nightscout.androidaps.activities.NoSplashAppCompatActivity + +class InitPodWizard : NoSplashAppCompatActivity() { + + + init { + + + } + + +} \ No newline at end of file diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dialogs/PodManagementActivity.kt b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dialogs/PodManagementActivity.kt new file mode 100644 index 0000000000..be2101147b --- /dev/null +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dialogs/PodManagementActivity.kt @@ -0,0 +1,41 @@ +package info.nightscout.androidaps.plugins.pump.omnipod.dialogs + +import android.os.Bundle +import info.nightscout.androidaps.R +import info.nightscout.androidaps.activities.NoSplashActivity +import kotlinx.android.synthetic.main.omnipod_pod_mgmt.* + +class PodManagementActivity : NoSplashActivity() { + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + setContentView(R.layout.omnipod_pod_mgmt) + + initpod_init_pod.setOnClickListener { + initPodAction() + } + + initpod_remove_pod.setOnClickListener { + removePodAction() + } + + initpod_reset_pod.setOnClickListener { + resetPodAction() + } + + } + + + fun initPodAction() { + + } + + fun removePodAction() { + + } + + fun resetPodAction() { + + } + +} \ No newline at end of file diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/util/OmnipodUtil.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/util/OmnipodUtil.java index eb3921a8f2..3bd137fb83 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/util/OmnipodUtil.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/util/OmnipodUtil.java @@ -27,6 +27,7 @@ import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.data.RLHistor import info.nightscout.androidaps.plugins.pump.omnipod.OmnipodPumpPlugin; import info.nightscout.androidaps.plugins.pump.omnipod.comm.OmnipodCommunicationManager; import info.nightscout.androidaps.plugins.pump.omnipod.defs.OmnipodCommandType; +import info.nightscout.androidaps.plugins.pump.omnipod.defs.OmnipodPodType; import info.nightscout.androidaps.plugins.pump.omnipod.defs.PodDeviceState; import info.nightscout.androidaps.plugins.pump.omnipod.defs.state.PodSessionState; import info.nightscout.androidaps.plugins.pump.omnipod.events.EventOmnipodDeviceStatusChange; @@ -50,6 +51,7 @@ public class OmnipodUtil extends RileyLinkUtil { private static PodSessionState podSessionState; private static PodDeviceState podDeviceState; private static OmnipodPumpPlugin omnipodPumpPlugin; + private static OmnipodPodType omnipodPodType; public static Gson getGsonInstance() { return gsonInstance; @@ -191,4 +193,11 @@ public class OmnipodUtil extends RileyLinkUtil { } + public static void setOmnipodPodType(OmnipodPodType omnipodPodType) { + OmnipodUtil.omnipodPodType = omnipodPodType; + } + + public static OmnipodPodType getOmnipodPodType() { + return omnipodPodType; + } } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod_dash/OmnipodDashPumpPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod_dash/OmnipodDashPumpPlugin.java index 59a7a3baff..029e97b639 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod_dash/OmnipodDashPumpPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod_dash/OmnipodDashPumpPlugin.java @@ -1,65 +1,36 @@ package info.nightscout.androidaps.plugins.pump.omnipod_dash; -import android.content.ComponentName; -import android.content.ServiceConnection; import android.os.Bundle; -import android.os.IBinder; -import android.os.SystemClock; -import androidx.annotation.NonNull; - -import org.joda.time.LocalDateTime; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.util.ArrayList; import java.util.Arrays; -import java.util.Calendar; -import java.util.GregorianCalendar; -import java.util.HashSet; import java.util.List; -import java.util.Set; import info.nightscout.androidaps.BuildConfig; import info.nightscout.androidaps.MainApp; import info.nightscout.androidaps.R; -import info.nightscout.androidaps.data.DetailedBolusInfo; import info.nightscout.androidaps.data.Profile; -import info.nightscout.androidaps.data.PumpEnactResult; -import info.nightscout.androidaps.db.Source; -import info.nightscout.androidaps.db.TemporaryBasal; -import info.nightscout.androidaps.events.EventRefreshOverview; import info.nightscout.androidaps.interfaces.PluginDescription; import info.nightscout.androidaps.interfaces.PluginType; import info.nightscout.androidaps.interfaces.PumpInterface; import info.nightscout.androidaps.logging.L; import info.nightscout.androidaps.plugins.bus.RxBus; import info.nightscout.androidaps.plugins.general.actions.defs.CustomAction; -import info.nightscout.androidaps.plugins.general.actions.defs.CustomActionType; -import info.nightscout.androidaps.plugins.pump.common.PumpPluginAbstract; -import info.nightscout.androidaps.plugins.pump.common.data.TempBasalPair; import info.nightscout.androidaps.plugins.pump.common.defs.PumpDriverState; import info.nightscout.androidaps.plugins.pump.common.defs.PumpType; -import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkConst; -import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.tasks.ResetRileyLinkConfigurationTask; -import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.tasks.ServiceTaskExecutor; import info.nightscout.androidaps.plugins.pump.omnipod.OmnipodFragment; import info.nightscout.androidaps.plugins.pump.omnipod.OmnipodPumpPlugin; -import info.nightscout.androidaps.plugins.pump.omnipod.comm.OmnipodCommunicationManager; import info.nightscout.androidaps.plugins.pump.omnipod.comm.ui.OmnipodUIComm; -import info.nightscout.androidaps.plugins.pump.omnipod.comm.ui.OmnipodUITask; -import info.nightscout.androidaps.plugins.pump.omnipod.defs.OmnipodCommandType; -import info.nightscout.androidaps.plugins.pump.omnipod.defs.OmnipodCommunicationManagerInterface; -import info.nightscout.androidaps.plugins.pump.omnipod.defs.OmnipodCustomActionType; +import info.nightscout.androidaps.plugins.pump.omnipod.defs.OmnipodPodType; import info.nightscout.androidaps.plugins.pump.omnipod.events.EventOmnipodPumpValuesChanged; import info.nightscout.androidaps.plugins.pump.omnipod.events.EventOmnipodRefreshButtonState; import info.nightscout.androidaps.plugins.pump.omnipod.service.OmnipodPumpStatus; import info.nightscout.androidaps.plugins.pump.omnipod.service.RileyLinkOmnipodService; -import info.nightscout.androidaps.plugins.pump.omnipod.util.OmnipodConst; import info.nightscout.androidaps.plugins.pump.omnipod.util.OmnipodUtil; import info.nightscout.androidaps.plugins.pump.omnipod_dash.comm.OmnipodDashCommunicationManager; -import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin; -import info.nightscout.androidaps.utils.SP; /** * Created by andy on 23.04.18. @@ -103,6 +74,8 @@ public class OmnipodDashPumpPlugin extends OmnipodPumpPlugin implements PumpInte displayConnectionMessages = false; + OmnipodUtil.setOmnipodPodType(OmnipodPodType.Dash); + if (omnipodCommunicationManager == null) { omnipodCommunicationManager = OmnipodDashCommunicationManager.getInstance(); } @@ -157,7 +130,6 @@ public class OmnipodDashPumpPlugin extends OmnipodPumpPlugin implements PumpInte } - // FIXME public Class getServiceClass() { return RileyLinkOmnipodService.class; @@ -289,9 +261,6 @@ public class OmnipodDashPumpPlugin extends OmnipodPumpPlugin implements PumpInte } - - - // OPERATIONS not supported by Pump or Plugin //private List customActions = null; @@ -321,5 +290,4 @@ public class OmnipodDashPumpPlugin extends OmnipodPumpPlugin implements PumpInte } - } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod_dash/comm/OmnipodDashCommunicationManager.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod_dash/comm/OmnipodDashCommunicationManager.java index c0593759a4..4f58ba38a0 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod_dash/comm/OmnipodDashCommunicationManager.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod_dash/comm/OmnipodDashCommunicationManager.java @@ -6,12 +6,14 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import info.nightscout.androidaps.data.Profile; +import info.nightscout.androidaps.data.PumpEnactResult; import info.nightscout.androidaps.logging.L; import info.nightscout.androidaps.plugins.pump.common.data.TempBasalPair; import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkConst; import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.RFSpy; -import info.nightscout.androidaps.plugins.pump.omnipod.comm.data.PodCommResponse; import info.nightscout.androidaps.plugins.pump.omnipod.defs.OmnipodCommunicationManagerInterface; +import info.nightscout.androidaps.plugins.pump.omnipod.defs.PodInitActionType; +import info.nightscout.androidaps.plugins.pump.omnipod.defs.PodInitReceiver; import info.nightscout.androidaps.plugins.pump.omnipod.defs.state.PodSessionState; import info.nightscout.androidaps.plugins.pump.omnipod.util.OmnipodUtil; import info.nightscout.androidaps.utils.SP; @@ -64,7 +66,7 @@ public class OmnipodDashCommunicationManager implements OmnipodCommunicationMana // This are just skeleton methods, we need to see what we can get returned and act accordingly - public PodCommResponse initPod() { + public PumpEnactResult initPod() { //omnipodManager.pairAndPrime(); @@ -72,41 +74,46 @@ public class OmnipodDashCommunicationManager implements OmnipodCommunicationMana } - public PodCommResponse getPodStatus() { + @Override + public PumpEnactResult initPod(PodInitActionType podInitActionType, PodInitReceiver podInitReceiver) { + return null; + } + + public PumpEnactResult getPodStatus() { return null; } - public PodCommResponse deactivatePod() { + public PumpEnactResult deactivatePod() { return null; } - public PodCommResponse setBasalProfile(Profile profile) { + public PumpEnactResult setBasalProfile(Profile profile) { return null; } - public PodCommResponse resetPodStatus() { + public PumpEnactResult resetPodStatus() { return null; } - public PodCommResponse setBolus(Double parameter) { + public PumpEnactResult setBolus(Double parameter) { return null; } - public PodCommResponse cancelBolus() { + public PumpEnactResult cancelBolus() { return null; } - public PodCommResponse setTemporaryBasal(TempBasalPair tbr) { + public PumpEnactResult setTemporaryBasal(TempBasalPair tbr) { return null; } - public PodCommResponse cancelTemporaryBasal() { + public PumpEnactResult cancelTemporaryBasal() { return null; } @Override - public PodCommResponse acknowledgeAlerts() { + public PumpEnactResult acknowledgeAlerts() { return null; } diff --git a/app/src/main/res/layout/omnipod_initpod.xml b/app/src/main/res/layout/omnipod_initpod.xml new file mode 100644 index 0000000000..160f668963 --- /dev/null +++ b/app/src/main/res/layout/omnipod_initpod.xml @@ -0,0 +1,106 @@ + + + + + + + + + + + + + + + + + + + +