- 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
This commit is contained in:
Andy Rozman 2019-08-30 10:39:40 +01:00
parent 3203ad5cde
commit b7b47970ed
16 changed files with 363 additions and 92 deletions

View file

@ -124,7 +124,7 @@
</receiver> </receiver>
<!-- NSClient --> <!-- NSClient -->
<receiver <receiver
android:name=".plugins.general.nsclient.receivers.DBAccessReceiver" android:name=".plugins.general.nsclient.receivers.DBAccessReceiver"
android:enabled="true" android:enabled="true"
android:exported="true"> android:exported="true">
@ -155,7 +155,7 @@
<service <service
android:name=".services.DataService" android:name=".services.DataService"
android:exported="false" android:exported="false"
android:permission="android.permission.BIND_JOB_SERVICE"/> android:permission="android.permission.BIND_JOB_SERVICE" />
<service <service
android:name=".services.LocationService" android:name=".services.LocationService"
android:exported="false" /> android:exported="false" />
@ -306,6 +306,8 @@
android:enabled="true" android:enabled="true"
android:exported="true" /> android:exported="true" />
<activity android:name=".plugins.pump.omnipod.dialogs.PodManagementActivity" />
<activity android:name=".plugins.pump.omnipod.dialogs.InitPodWizard" />
<uses-library <uses-library
android:name="org.apache.http.legacy" android:name="org.apache.http.legacy"

View file

@ -13,7 +13,7 @@ import info.nightscout.androidaps.utils.Round;
/** /**
* Created by andy on 02/05/2018. * Created by andy on 02/05/2018.
* * <p>
* Most of this defintions is intended for VirtualPump only, but they can be used by other plugins. * 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), // 0.02d, 0.01d, DoseStepSize.InsightBolus, PumpCapability.InsightCapabilities), //
// Animas // 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), // new DoseSettings(0.05d, 30, 12 * 60, 0.05d), //
PumpTempBasalType.Percent, // PumpTempBasalType.Percent, //
new DoseSettings(10, 30, 24 * 60, 0d, 300d), PumpCapability.BasalRate_Duration30minAllowed, // new DoseSettings(10, 30, 24 * 60, 0d, 300d), PumpCapability.BasalRate_Duration30minAllowed, //
@ -91,7 +91,7 @@ public enum PumpType {
// Insulet // 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), // new DoseSettings(0.05d, 30, 8 * 60, 0.05d), //
PumpTempBasalType.Absolute, // PumpTempBasalType.Absolute, //
new DoseSettings(0.05d, 30, 12 * 60, 0d, 30.0d), PumpCapability.BasalRate_Duration30minAllowed, // cannot exceed max basal rate 30u/hr 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), // new DoseSettings(0.05d, 30, 8 * 60, 0.05d), //
PumpTempBasalType.Absolute, // PumpTempBasalType.Absolute, //
new DoseSettings(0.05d, 30, 12 * 60, 0d, 30.0d), PumpCapability.BasalRate_Duration30minAllowed, // cannot exceed max basal rate 30u/hr 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
Medtronic_512_712("Medtronic 512/712", ManufacturerType.Medtronic, "512/712", 0.1d, null, // Medtronic_512_712("Medtronic 512/712", ManufacturerType.Medtronic, "512/712", 0.1d, null, //
new DoseSettings(0.05d, 30, 8 * 60, 0.05d), // new DoseSettings(0.05d, 30, 8 * 60, 0.05d), //
PumpTempBasalType.Absolute, // 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), // 0.05d, 0.05d, null, PumpCapability.MedtronicCapabilities), //
Medtronic_515_715("Medtronic 515/715", "515/715", Medtronic_512_712), 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, // 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), // new DoseSettings(0.05d, 30, 8 * 60, 0.05d), //
PumpTempBasalType.Absolute, // 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), // 0.025d, 0.025d, DoseStepSize.MedtronicVeoBasal, PumpCapability.MedtronicCapabilities), //
Medtronic_554_754_Veo("Medtronic 554/754 (Veo)", "554/754 (Veo)", Medtronic_523_723_Revel), // TODO 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), // TandemTSlimX2("Tandem t:slim X2", "t:slim X2", TandemTSlim), //
// MDI // MDI
MDI("MDI", ManufacturerType.AndroidAPS, "MDI") MDI("MDI", ManufacturerType.AndroidAPS, "MDI");
;
private String description; 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.description = description;
this.parent = parent; this.parent = parent;
this.model = model; this.model = model;
} }
PumpType(String description, ManufacturerType manufacturer, String model) PumpType(String description, ManufacturerType manufacturer, String model) {
{
this.description = description; this.description = description;
this.manufacturer = manufacturer; this.manufacturer = manufacturer;
this.model = model; 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.description = description;
this.parent = parent; this.parent = parent;
this.pumpCapability = pumpCapability; this.pumpCapability = pumpCapability;
@ -196,9 +192,8 @@ public enum PumpType {
PumpType(String description, ManufacturerType manufacturer, String model, double bolusSize, DoseStepSize specialBolusSize, // PumpType(String description, ManufacturerType manufacturer, String model, double bolusSize, DoseStepSize specialBolusSize, //
DoseSettings extendedBolusSettings, // DoseSettings extendedBolusSettings, //
PumpTempBasalType pumpTempBasalType, DoseSettings tbrSettings, PumpCapability specialBasalDurations, // PumpTempBasalType pumpTempBasalType, DoseSettings tbrSettings, PumpCapability specialBasalDurations, //
double baseBasalMinValue, double baseBasalStep, DoseStepSize baseBasalSpecialSteps, PumpCapability pumpCapability) double baseBasalMinValue, double baseBasalStep, DoseStepSize baseBasalSpecialSteps, PumpCapability pumpCapability) {
{
this(description, manufacturer, model, bolusSize, specialBolusSize, extendedBolusSettings, pumpTempBasalType, tbrSettings, specialBasalDurations, baseBasalMinValue, null, baseBasalStep, baseBasalSpecialSteps, pumpCapability); this(description, manufacturer, model, bolusSize, specialBolusSize, extendedBolusSettings, pumpTempBasalType, tbrSettings, specialBasalDurations, baseBasalMinValue, null, baseBasalStep, baseBasalSpecialSteps, pumpCapability);
} }

View file

@ -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.OmnipodCommandType;
import info.nightscout.androidaps.plugins.pump.omnipod.defs.OmnipodCommunicationManagerInterface; 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.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.defs.state.PodSessionState;
import info.nightscout.androidaps.plugins.pump.omnipod.events.EventOmnipodPumpValuesChanged; 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.events.EventOmnipodRefreshButtonState;
@ -104,6 +105,8 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements PumpInterfa
displayConnectionMessages = false; displayConnectionMessages = false;
OmnipodUtil.setOmnipodPodType(OmnipodPodType.Eros);
if (omnipodCommunicationManager == null) { if (omnipodCommunicationManager == null) {
omnipodCommunicationManager = OmnipodCommunicationManager.getInstance(); omnipodCommunicationManager = OmnipodCommunicationManager.getInstance();
} }

View file

@ -6,6 +6,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import info.nightscout.androidaps.data.Profile; import info.nightscout.androidaps.data.Profile;
import info.nightscout.androidaps.data.PumpEnactResult;
import info.nightscout.androidaps.logging.L; import info.nightscout.androidaps.logging.L;
import info.nightscout.androidaps.plugins.pump.common.data.TempBasalPair; import info.nightscout.androidaps.plugins.pump.common.data.TempBasalPair;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkCommunicationManager; 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.data.RLMessage;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.defs.RLMessageType; 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.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.OmnipodCommunicationManagerInterface;
import info.nightscout.androidaps.plugins.pump.omnipod.defs.state.PodSessionState; import info.nightscout.androidaps.plugins.pump.omnipod.defs.state.PodSessionState;
import info.nightscout.androidaps.plugins.pump.omnipod.util.OmnipodUtil; 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 // 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(); omnipodManager.pairAndPrime();
@ -103,41 +103,41 @@ public class OmnipodCommunicationManager extends RileyLinkCommunicationManager i
} }
public PodCommResponse getPodStatus() { public PumpEnactResult getPodStatus() {
return null; return null;
} }
public PodCommResponse deactivatePod() { public PumpEnactResult deactivatePod() {
return null; return null;
} }
public PodCommResponse setBasalProfile(Profile profile) { public PumpEnactResult setBasalProfile(Profile profile) {
return null; return null;
} }
public PodCommResponse resetPodStatus() { public PumpEnactResult resetPodStatus() {
return null; return null;
} }
public PodCommResponse setBolus(Double parameter) { public PumpEnactResult setBolus(Double parameter) {
return null; return null;
} }
public PodCommResponse cancelBolus() { public PumpEnactResult cancelBolus() {
return null; return null;
} }
public PodCommResponse setTemporaryBasal(TempBasalPair tbr) { public PumpEnactResult setTemporaryBasal(TempBasalPair tbr) {
return null; return null;
} }
public PodCommResponse cancelTemporaryBasal() { public PumpEnactResult cancelTemporaryBasal() {
return null; return null;
} }
@Override @Override
public PodCommResponse acknowledgeAlerts() { public PumpEnactResult acknowledgeAlerts() {
return null; return null;
} }

View file

@ -4,13 +4,15 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import info.nightscout.androidaps.data.Profile; import info.nightscout.androidaps.data.Profile;
import info.nightscout.androidaps.data.PumpEnactResult;
import info.nightscout.androidaps.logging.L; import info.nightscout.androidaps.logging.L;
import info.nightscout.androidaps.plugins.bus.RxBus; import info.nightscout.androidaps.plugins.bus.RxBus;
import info.nightscout.androidaps.plugins.pump.common.data.TempBasalPair; 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.OmnipodCommandType;
import info.nightscout.androidaps.plugins.pump.omnipod.defs.OmnipodCommunicationManagerInterface; 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.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.defs.PodResponseType;
import info.nightscout.androidaps.plugins.pump.omnipod.events.EventOmnipodDeviceStatusChange; import info.nightscout.androidaps.plugins.pump.omnipod.events.EventOmnipodDeviceStatusChange;
import info.nightscout.androidaps.plugins.pump.omnipod.events.EventOmnipodPumpValuesChanged; 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); private static final Logger LOG = LoggerFactory.getLogger(L.PUMP);
public OmnipodCommandType commandType; public OmnipodCommandType commandType;
public PodCommResponse returnData; public PumpEnactResult returnData;
private String errorDescription; private String errorDescription;
private Object[] parameters; private Object[] parameters;
private PodResponseType responseType; private PodResponseType responseType;
@ -55,7 +57,7 @@ public class OmnipodUITask {
// break; // break;
case InitPod: case InitPod:
returnData = communicationManager.initPod(); returnData = communicationManager.initPod((PodInitActionType) parameters[0], (PodInitReceiver) parameters[1]);
break; break;
case DeactivatePod: case DeactivatePod:
@ -188,7 +190,7 @@ public class OmnipodUITask {
if (returnData == null) { if (returnData == null) {
return false; return false;
} }
return returnData.isAcknowledged(); return returnData.success;
} }

View file

@ -1,8 +1,8 @@
package info.nightscout.androidaps.plugins.pump.omnipod.defs; package info.nightscout.androidaps.plugins.pump.omnipod.defs;
import info.nightscout.androidaps.data.Profile; 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.common.data.TempBasalPair;
import info.nightscout.androidaps.plugins.pump.omnipod.comm.data.PodCommResponse;
public interface OmnipodCommunicationManagerInterface { public interface OmnipodCommunicationManagerInterface {
@ -11,56 +11,56 @@ public interface OmnipodCommunicationManagerInterface {
/** /**
* Initialize Pod * Initialize Pod
*/ */
PodCommResponse initPod(); PumpEnactResult initPod(PodInitActionType podInitActionType, PodInitReceiver podIniReceiver);
/** /**
* Get Pod Status (is pod running, battery left ?, reservoir, etc) * Get Pod Status (is pod running, battery left ?, reservoir, etc)
*/ */
PodCommResponse getPodStatus(); PumpEnactResult getPodStatus();
/** /**
* Deactivate Pod * Deactivate Pod
*/ */
PodCommResponse deactivatePod(); PumpEnactResult deactivatePod();
/** /**
* Set Basal Profile * 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) * 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 * Set Bolus
* *
* @param amount amount of bolus in U * @param amount amount of bolus in U
*/ */
PodCommResponse setBolus(Double amount); PumpEnactResult setBolus(Double amount);
/** /**
* Cancel Bolus (if bolus is already stopped, return acknowledgment) * Cancel Bolus (if bolus is already stopped, return acknowledgment)
*/ */
PodCommResponse cancelBolus(); PumpEnactResult cancelBolus();
/** /**
* Set Temporary Basal * 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) * Cancel Temporary Basal (if TB is already stopped, return acknowledgment)
*/ */
PodCommResponse cancelTemporaryBasal(); PumpEnactResult cancelTemporaryBasal();
/** /**
* Acknowledge alerts * Acknowledge alerts
*/ */
PodCommResponse acknowledgeAlerts(); PumpEnactResult acknowledgeAlerts();
} }

View file

@ -0,0 +1,6 @@
package info.nightscout.androidaps.plugins.pump.omnipod.defs;
public enum OmnipodPodType {
Eros, //
Dash
}

View file

@ -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) {
}
}

View file

@ -0,0 +1,7 @@
package info.nightscout.androidaps.plugins.pump.omnipod.defs;
public interface PodInitReceiver {
void returnInitTaskStatus(PodInitActionType podInitActionType, boolean isSuccess, String errorMessage);
}

View file

@ -0,0 +1,14 @@
package info.nightscout.androidaps.plugins.pump.omnipod.dialogs
import info.nightscout.androidaps.activities.NoSplashAppCompatActivity
class InitPodWizard : NoSplashAppCompatActivity() {
init {
}
}

View file

@ -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() {
}
}

View file

@ -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.OmnipodPumpPlugin;
import info.nightscout.androidaps.plugins.pump.omnipod.comm.OmnipodCommunicationManager; 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.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.PodDeviceState;
import info.nightscout.androidaps.plugins.pump.omnipod.defs.state.PodSessionState; import info.nightscout.androidaps.plugins.pump.omnipod.defs.state.PodSessionState;
import info.nightscout.androidaps.plugins.pump.omnipod.events.EventOmnipodDeviceStatusChange; import info.nightscout.androidaps.plugins.pump.omnipod.events.EventOmnipodDeviceStatusChange;
@ -50,6 +51,7 @@ public class OmnipodUtil extends RileyLinkUtil {
private static PodSessionState podSessionState; private static PodSessionState podSessionState;
private static PodDeviceState podDeviceState; private static PodDeviceState podDeviceState;
private static OmnipodPumpPlugin omnipodPumpPlugin; private static OmnipodPumpPlugin omnipodPumpPlugin;
private static OmnipodPodType omnipodPodType;
public static Gson getGsonInstance() { public static Gson getGsonInstance() {
return gsonInstance; 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;
}
} }

View file

@ -1,65 +1,36 @@
package info.nightscout.androidaps.plugins.pump.omnipod_dash; package info.nightscout.androidaps.plugins.pump.omnipod_dash;
import android.content.ComponentName;
import android.content.ServiceConnection;
import android.os.Bundle; 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.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Calendar;
import java.util.GregorianCalendar;
import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Set;
import info.nightscout.androidaps.BuildConfig; import info.nightscout.androidaps.BuildConfig;
import info.nightscout.androidaps.MainApp; import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R; import info.nightscout.androidaps.R;
import info.nightscout.androidaps.data.DetailedBolusInfo;
import info.nightscout.androidaps.data.Profile; 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.PluginDescription;
import info.nightscout.androidaps.interfaces.PluginType; import info.nightscout.androidaps.interfaces.PluginType;
import info.nightscout.androidaps.interfaces.PumpInterface; import info.nightscout.androidaps.interfaces.PumpInterface;
import info.nightscout.androidaps.logging.L; import info.nightscout.androidaps.logging.L;
import info.nightscout.androidaps.plugins.bus.RxBus; import info.nightscout.androidaps.plugins.bus.RxBus;
import info.nightscout.androidaps.plugins.general.actions.defs.CustomAction; 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.PumpDriverState;
import info.nightscout.androidaps.plugins.pump.common.defs.PumpType; 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.OmnipodFragment;
import info.nightscout.androidaps.plugins.pump.omnipod.OmnipodPumpPlugin; 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.OmnipodUIComm;
import info.nightscout.androidaps.plugins.pump.omnipod.comm.ui.OmnipodUITask; import info.nightscout.androidaps.plugins.pump.omnipod.defs.OmnipodPodType;
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.events.EventOmnipodPumpValuesChanged; 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.events.EventOmnipodRefreshButtonState;
import info.nightscout.androidaps.plugins.pump.omnipod.service.OmnipodPumpStatus; 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.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.util.OmnipodUtil;
import info.nightscout.androidaps.plugins.pump.omnipod_dash.comm.OmnipodDashCommunicationManager; 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. * Created by andy on 23.04.18.
@ -103,6 +74,8 @@ public class OmnipodDashPumpPlugin extends OmnipodPumpPlugin implements PumpInte
displayConnectionMessages = false; displayConnectionMessages = false;
OmnipodUtil.setOmnipodPodType(OmnipodPodType.Dash);
if (omnipodCommunicationManager == null) { if (omnipodCommunicationManager == null) {
omnipodCommunicationManager = OmnipodDashCommunicationManager.getInstance(); omnipodCommunicationManager = OmnipodDashCommunicationManager.getInstance();
} }
@ -157,7 +130,6 @@ public class OmnipodDashPumpPlugin extends OmnipodPumpPlugin implements PumpInte
} }
// FIXME // FIXME
public Class getServiceClass() { public Class getServiceClass() {
return RileyLinkOmnipodService.class; return RileyLinkOmnipodService.class;
@ -289,9 +261,6 @@ public class OmnipodDashPumpPlugin extends OmnipodPumpPlugin implements PumpInte
} }
// OPERATIONS not supported by Pump or Plugin // OPERATIONS not supported by Pump or Plugin
//private List<CustomAction> customActions = null; //private List<CustomAction> customActions = null;
@ -321,5 +290,4 @@ public class OmnipodDashPumpPlugin extends OmnipodPumpPlugin implements PumpInte
} }
} }

View file

@ -6,12 +6,14 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import info.nightscout.androidaps.data.Profile; import info.nightscout.androidaps.data.Profile;
import info.nightscout.androidaps.data.PumpEnactResult;
import info.nightscout.androidaps.logging.L; import info.nightscout.androidaps.logging.L;
import info.nightscout.androidaps.plugins.pump.common.data.TempBasalPair; 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.RileyLinkConst;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.RFSpy; 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.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.defs.state.PodSessionState;
import info.nightscout.androidaps.plugins.pump.omnipod.util.OmnipodUtil; import info.nightscout.androidaps.plugins.pump.omnipod.util.OmnipodUtil;
import info.nightscout.androidaps.utils.SP; 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 // 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(); //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; return null;
} }
public PodCommResponse deactivatePod() { public PumpEnactResult deactivatePod() {
return null; return null;
} }
public PodCommResponse setBasalProfile(Profile profile) { public PumpEnactResult setBasalProfile(Profile profile) {
return null; return null;
} }
public PodCommResponse resetPodStatus() { public PumpEnactResult resetPodStatus() {
return null; return null;
} }
public PodCommResponse setBolus(Double parameter) { public PumpEnactResult setBolus(Double parameter) {
return null; return null;
} }
public PodCommResponse cancelBolus() { public PumpEnactResult cancelBolus() {
return null; return null;
} }
public PodCommResponse setTemporaryBasal(TempBasalPair tbr) { public PumpEnactResult setTemporaryBasal(TempBasalPair tbr) {
return null; return null;
} }
public PodCommResponse cancelTemporaryBasal() { public PumpEnactResult cancelTemporaryBasal() {
return null; return null;
} }
@Override @Override
public PodCommResponse acknowledgeAlerts() { public PumpEnactResult acknowledgeAlerts() {
return null; return null;
} }

View file

@ -0,0 +1,106 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".plugins.pump.omnipod.dialogs.InitPodWizard">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:layout_weight="1"
android:background="@android:color/transparent"
android:onClick="exitPressed"
app:srcCompat="@drawable/ic_exit_to_app" />
<TextView
android:id="@+id/sw_exit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layout_marginStart="10dp"
android:layout_weight="1"
android:text="@string/exit"
android:textAppearance="@android:style/TextAppearance.Material.Medium"
android:textStyle="bold" />
</LinearLayout>
<TextView
android:id="@+id/sw_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:keepScreenOn="true"
android:textAlignment="center"
android:textColor="#FFFFFF"
android:textSize="32sp"
tools:text="Title" />
<ScrollView
android:id="@+id/sw_scrollview"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
<LinearLayout
android:id="@+id/sw_content_fields"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical|center_horizontal"
android:orientation="vertical"
android:padding="16dp" />
</ScrollView>
<LinearLayout
android:id="@+id/sw_content_controls"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom|center_horizontal"
android:background="@color/black_overlay"
android:orientation="horizontal"
android:paddingLeft="16dp"
android:paddingRight="16dp">
<Button
android:id="@+id/previous_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@android:color/transparent"
android:onClick="showPreviousPage"
android:text="@string/previous_button"
android:textColor="#FFFFFF" />
<View
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1" />
<Button
android:id="@+id/next_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@android:color/transparent"
android:onClick="showNextPage"
android:text="@string/next_button"
android:textColor="#FFFFFF" />
<Button
android:id="@+id/finish_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@android:color/transparent"
android:onClick="finishSetupWizard"
android:text="@string/setupwizard_finish"
android:textColor="#FFFFFF" />
</LinearLayout>
</LinearLayout>

View file

@ -0,0 +1,88 @@
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".plugins.pump.omnipod.dialogs.PodManagementActivity">
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:id="@+id/initpod_buttons_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="@+id/textView3"
android:layout_width="match_parent"
android:layout_height="120dp"
android:layout_weight="0.5"
android:text="Pod Management" />
<info.nightscout.androidaps.utils.SingleClickButton
android:id="@+id/initpod_init_pod"
style="?android:attr/buttonStyle"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="3dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="3dp"
android:layout_weight="0.5"
android:drawableTop="@drawable/icon_cp_pump_canula"
android:text="@string/careportal_profileswitch" />
<TextView
android:id="@+id/textView4"
android:layout_width="match_parent"
android:layout_height="60dp"
android:layout_weight="0.5"
android:text="&nbsp;" />
<info.nightscout.androidaps.utils.SingleClickButton
android:id="@+id/initpod_remove_pod"
style="?android:attr/buttonStyle"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="3dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="3dp"
android:layout_weight="0.5"
android:drawableTop="@drawable/icon_actions_temptarget"
android:text="@string/careportal_temporarytarget" />
<TextView
android:id="@+id/textView5"
android:layout_width="match_parent"
android:layout_height="60dp"
android:layout_weight="0.5"
android:text="&nbsp;" />
<info.nightscout.androidaps.utils.SingleClickButton
android:id="@+id/initpod_reset_pod"
style="?android:attr/buttonStyle"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginTop="3dp"
android:layout_marginRight="10dp"
android:layout_marginBottom="3dp"
android:layout_weight="0.5"
android:drawableTop="@drawable/icon_cp_pump_canula"
android:text="@string/primefill" />
<TextView
android:id="@+id/textView6"
android:layout_width="match_parent"
android:layout_height="60dp"
android:layout_weight="0.5"
android:text="&nbsp;" />
</LinearLayout>
</ScrollView>
</FrameLayout>