- merge from bart
- added new dialogs (Omnipod Mgmt and InitPodWizard), extended OmnipodFragment code - changes to OmnipodCommunicationManagerInterface
This commit is contained in:
parent
8581b00e8a
commit
c6d94284d7
|
@ -22,9 +22,9 @@ import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLin
|
||||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkServiceState
|
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkServiceState
|
||||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkTargetDevice
|
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkTargetDevice
|
||||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.dialog.RileyLinkStatusActivity
|
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.dialog.RileyLinkStatusActivity
|
||||||
import info.nightscout.androidaps.plugins.pump.medtronic.defs.PumpDeviceState
|
import info.nightscout.androidaps.plugins.pump.omnipod.defs.OmnipodStatusRequest
|
||||||
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.dialogs.PodManagementActivity
|
||||||
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
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.events.EventOmnipodRefreshButtonState
|
import info.nightscout.androidaps.plugins.pump.omnipod.events.EventOmnipodRefreshButtonState
|
||||||
|
@ -77,11 +77,11 @@ class OmnipodFragment : Fragment() {
|
||||||
omnipod_pod_status.text = "{fa-bed}"
|
omnipod_pod_status.text = "{fa-bed}"
|
||||||
|
|
||||||
omnipod_pod_mgmt.setOnClickListener {
|
omnipod_pod_mgmt.setOnClickListener {
|
||||||
// if (OmnipodUtil.getPumpStatus().verifyConfiguration()) {
|
if (OmnipodUtil.getPumpStatus().verifyConfiguration()) {
|
||||||
// startActivity(Intent(context, MedtronicHistoryActivity::class.java))
|
startActivity(Intent(context, PodManagementActivity::class.java))
|
||||||
// } else {
|
} else {
|
||||||
// OmnipodUtil.displayNotConfiguredDialog(context)
|
OmnipodUtil.displayNotConfiguredDialog(context)
|
||||||
// }
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
omnipod_refresh.setOnClickListener {
|
omnipod_refresh.setOnClickListener {
|
||||||
|
@ -89,8 +89,8 @@ class OmnipodFragment : Fragment() {
|
||||||
OmnipodUtil.displayNotConfiguredDialog(context)
|
OmnipodUtil.displayNotConfiguredDialog(context)
|
||||||
} else {
|
} else {
|
||||||
omnipod_refresh.isEnabled = false
|
omnipod_refresh.isEnabled = false
|
||||||
OmnipodUtil.getPlugin().resetStatusState()
|
OmnipodUtil.getPlugin().addPodStatusRequest(OmnipodStatusRequest.ResetState);
|
||||||
ConfigBuilderPlugin.getPlugin().commandQueue.readStatus("Clicked refresh", object : Callback() {
|
ConfigBuilderPlugin.getPlugin().commandQueue.readStatus("Clicked Refresh", object : Callback() {
|
||||||
override fun run() {
|
override fun run() {
|
||||||
activity?.runOnUiThread { omnipod_refresh.isEnabled = true }
|
activity?.runOnUiThread { omnipod_refresh.isEnabled = true }
|
||||||
}
|
}
|
||||||
|
@ -106,6 +106,16 @@ class OmnipodFragment : Fragment() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
omnipod_pod_active_alerts_ack.setOnClickListener {
|
||||||
|
if (!OmnipodUtil.getPumpStatus().verifyConfiguration()) {
|
||||||
|
OmnipodUtil.displayNotConfiguredDialog(context)
|
||||||
|
} else {
|
||||||
|
omnipod_pod_active_alerts_ack.isEnabled = false
|
||||||
|
OmnipodUtil.getPlugin().addPodStatusRequest(OmnipodStatusRequest.AcknowledgeAlerts);
|
||||||
|
ConfigBuilderPlugin.getPlugin().commandQueue.readStatus("Clicked Alert Ack", null)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
updateGUI()
|
updateGUI()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -130,7 +140,7 @@ class OmnipodFragment : Fragment() {
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
.subscribe({ updateGUI() }, { FabricPrivacy.logException(it) })
|
.subscribe({ updateGUI() }, { FabricPrivacy.logException(it) })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
override fun onPause() {
|
override fun onPause() {
|
||||||
super.onPause()
|
super.onPause()
|
||||||
|
@ -184,12 +194,12 @@ class OmnipodFragment : Fragment() {
|
||||||
MainApp.gs(it.getResourceId(RileyLinkTargetDevice.Omnipod))
|
MainApp.gs(it.getResourceId(RileyLinkTargetDevice.Omnipod))
|
||||||
} ?: "-"
|
} ?: "-"
|
||||||
|
|
||||||
if (pumpStatus.podNumber==null) {
|
if (pumpStatus.podNumber == null) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (pumpStatus.podSessionState==null) {
|
if (pumpStatus.podSessionState == null) {
|
||||||
omnipod_pod_address.text = MainApp.gs(R.string.omnipod_pod_name_no_info)
|
omnipod_pod_address.text = MainApp.gs(R.string.omnipod_pod_name_no_info)
|
||||||
omnipod_pod_expiry.text = "-"
|
omnipod_pod_expiry.text = "-"
|
||||||
omnipod_pod_status.text = "{fa-bed} "
|
omnipod_pod_status.text = "{fa-bed} "
|
||||||
|
@ -198,23 +208,23 @@ class OmnipodFragment : Fragment() {
|
||||||
omnipod_pod_address.text = pumpStatus.podSessionState.address.toString()
|
omnipod_pod_address.text = pumpStatus.podSessionState.address.toString()
|
||||||
omnipod_pod_expiry.text = pumpStatus.podSessionState.expiryDateAsString
|
omnipod_pod_expiry.text = pumpStatus.podSessionState.expiryDateAsString
|
||||||
|
|
||||||
pumpStatus.podDeviceState = checkStatusSet(pumpStatus.podDeviceState,
|
pumpStatus.podDeviceState = checkStatusSet(pumpStatus.podDeviceState,
|
||||||
OmnipodUtil.getPodDeviceState()) as PodDeviceState?
|
OmnipodUtil.getPodDeviceState()) as PodDeviceState?
|
||||||
|
|
||||||
var podDeviceState = pumpStatus.podDeviceState
|
var podDeviceState = pumpStatus.podDeviceState
|
||||||
|
|
||||||
when (podDeviceState) {
|
when (podDeviceState) {
|
||||||
null,
|
null,
|
||||||
PumpDeviceState.Sleeping -> omnipod_pod_status.text = "{fa-bed} " // + pumpStatus.pumpDeviceState.name());
|
PodDeviceState.Sleeping -> omnipod_pod_status.text = "{fa-bed} " // + pumpStatus.pumpDeviceState.name());
|
||||||
PumpDeviceState.NeverContacted,
|
PodDeviceState.NeverContacted,
|
||||||
PumpDeviceState.WakingUp,
|
PodDeviceState.WakingUp,
|
||||||
PumpDeviceState.PumpUnreachable,
|
PodDeviceState.PumpUnreachable,
|
||||||
PumpDeviceState.ErrorWhenCommunicating,
|
PodDeviceState.ErrorWhenCommunicating,
|
||||||
PumpDeviceState.TimeoutWhenCommunicating,
|
PodDeviceState.TimeoutWhenCommunicating,
|
||||||
PumpDeviceState.InvalidConfiguration -> omnipod_pod_status.text = " " + MainApp.gs(podDeviceState.resourceId)
|
PodDeviceState.InvalidConfiguration -> omnipod_pod_status.text = " " + MainApp.gs(podDeviceState.resourceId)
|
||||||
PumpDeviceState.Active -> {
|
PodDeviceState.Active -> {
|
||||||
|
|
||||||
omnipod_pod_status.text = "Active";
|
omnipod_pod_status.text = "Active";
|
||||||
// val cmd = OmnipodUtil.getCurrentCommand()
|
// val cmd = OmnipodUtil.getCurrentCommand()
|
||||||
// if (cmd == null)
|
// if (cmd == null)
|
||||||
// omnipod_pod_status.text = " " + MainApp.gs(pumpStatus.pumpDeviceState.resourceId)
|
// omnipod_pod_status.text = " " + MainApp.gs(pumpStatus.pumpDeviceState.resourceId)
|
||||||
|
@ -231,10 +241,9 @@ class OmnipodFragment : Fragment() {
|
||||||
// ?: cmd.getCommandDescription())
|
// ?: cmd.getCommandDescription())
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
}
|
||||||
|
else -> log.warn("Unknown pump state: " + pumpStatus.podDeviceState)
|
||||||
}
|
}
|
||||||
else -> log.warn("Unknown pump state: " + pumpStatus.podDeviceState)
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,6 +34,8 @@ import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.response.pod
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.DeliveryType;
|
import info.nightscout.androidaps.plugins.pump.omnipod.defs.DeliveryType;
|
||||||
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.PodInfoType;
|
import info.nightscout.androidaps.plugins.pump.omnipod.defs.PodInfoType;
|
||||||
|
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.SetupProgress;
|
import info.nightscout.androidaps.plugins.pump.omnipod.defs.SetupProgress;
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.schedule.BasalScheduleMapper;
|
import info.nightscout.androidaps.plugins.pump.omnipod.defs.schedule.BasalScheduleMapper;
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.state.PodSessionState;
|
import info.nightscout.androidaps.plugins.pump.omnipod.defs.state.PodSessionState;
|
||||||
|
@ -59,7 +61,7 @@ public class OmnipodManager implements OmnipodCommunicationManagerInterface {
|
||||||
instance = this;
|
instance = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public PumpEnactResult insertCannula(Profile profile) {
|
public PumpEnactResult insertCannula(Profile profile) {
|
||||||
if (podState == null || podState.getSetupProgress().isBefore(SetupProgress.PRIMING_FINISHED)) {
|
if (podState == null || podState.getSetupProgress().isBefore(SetupProgress.PRIMING_FINISHED)) {
|
||||||
// TODO use string resource
|
// TODO use string resource
|
||||||
|
@ -86,7 +88,7 @@ public class OmnipodManager implements OmnipodCommunicationManagerInterface {
|
||||||
return new PumpEnactResult().success(true).enacted(true);
|
return new PumpEnactResult().success(true).enacted(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public PumpEnactResult pairAndPrime() {
|
public PumpEnactResult pairAndPrime() {
|
||||||
try {
|
try {
|
||||||
if (podState == null) {
|
if (podState == null) {
|
||||||
|
@ -129,6 +131,11 @@ public class OmnipodManager implements OmnipodCommunicationManagerInterface {
|
||||||
return new PumpEnactResult().success(true).enacted(true);
|
return new PumpEnactResult().success(true).enacted(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PumpEnactResult initPod(PodInitActionType podInitActionType, PodInitReceiver podIniReceiver) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PumpEnactResult getPodStatus() {
|
public PumpEnactResult getPodStatus() {
|
||||||
if (podState == null) {
|
if (podState == null) {
|
||||||
|
@ -187,6 +194,17 @@ public class OmnipodManager implements OmnipodCommunicationManagerInterface {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
public PumpEnactResult resetPodStatus() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PumpEnactResult setBolus(Double amount) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// TODO rename back
|
||||||
public PumpEnactResult resetPodState() {
|
public PumpEnactResult resetPodState() {
|
||||||
podState = null;
|
podState = null;
|
||||||
SP.remove(OmnipodConst.Prefs.PodState);
|
SP.remove(OmnipodConst.Prefs.PodState);
|
||||||
|
@ -194,7 +212,7 @@ public class OmnipodManager implements OmnipodCommunicationManagerInterface {
|
||||||
return new PumpEnactResult().success(true).enacted(true);
|
return new PumpEnactResult().success(true).enacted(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
// TODO rename back
|
||||||
public PumpEnactResult bolus(Double units) {
|
public PumpEnactResult bolus(Double units) {
|
||||||
if (!isInitialized()) {
|
if (!isInitialized()) {
|
||||||
return createNotInitializedResult();
|
return createNotInitializedResult();
|
||||||
|
|
|
@ -31,9 +31,9 @@ import info.nightscout.androidaps.db.TemporaryBasal;
|
||||||
import info.nightscout.androidaps.events.EventRefreshOverview;
|
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.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.configBuilder.ConfigBuilderPlugin;
|
||||||
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.general.actions.defs.CustomActionType;
|
||||||
import info.nightscout.androidaps.plugins.pump.common.PumpPluginAbstract;
|
import info.nightscout.androidaps.plugins.pump.common.PumpPluginAbstract;
|
||||||
|
@ -49,6 +49,8 @@ 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.OmnipodPodType;
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.defs.OmnipodPumpPluginInterface;
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.defs.OmnipodStatusRequest;
|
||||||
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;
|
||||||
|
@ -64,7 +66,7 @@ import info.nightscout.androidaps.utils.SP;
|
||||||
*
|
*
|
||||||
* @author Andy Rozman (andy.rozman@gmail.com)
|
* @author Andy Rozman (andy.rozman@gmail.com)
|
||||||
*/
|
*/
|
||||||
public class OmnipodPumpPlugin extends PumpPluginAbstract implements PumpInterface {
|
public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPumpPluginInterface {
|
||||||
|
|
||||||
private static final Logger LOG = LoggerFactory.getLogger(L.PUMP);
|
private static final Logger LOG = LoggerFactory.getLogger(L.PUMP);
|
||||||
|
|
||||||
|
@ -202,6 +204,13 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements PumpInterfa
|
||||||
clearBusyQueue();
|
clearBusyQueue();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!this.omnipodStatusRequestList.isEmpty()) {
|
||||||
|
if (!ConfigBuilderPlugin.getPlugin().getCommandQueue().statusInQueue()) {
|
||||||
|
ConfigBuilderPlugin.getPlugin().getCommandQueue()
|
||||||
|
.readStatus("Status Refresh Requested", null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
} while (serviceRunning);
|
} while (serviceRunning);
|
||||||
|
|
||||||
}).start();
|
}).start();
|
||||||
|
@ -249,9 +258,7 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements PumpInterfa
|
||||||
|
|
||||||
clearBusyQueue();
|
clearBusyQueue();
|
||||||
|
|
||||||
if (busyTimestamps.size() > 0) {
|
return (busyTimestamps.size() > 0);
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -307,13 +314,29 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements PumpInterfa
|
||||||
|
|
||||||
if (firstRun) {
|
if (firstRun) {
|
||||||
initializePump(!isRefresh);
|
initializePump(!isRefresh);
|
||||||
} else {
|
triggerUIChange();
|
||||||
getPodPumpStatus();
|
} else if (!omnipodStatusRequestList.isEmpty()) {
|
||||||
|
|
||||||
|
List<OmnipodStatusRequest> removeList = new ArrayList<>();
|
||||||
|
|
||||||
|
for (OmnipodStatusRequest omnipodStatusRequest : omnipodStatusRequestList) {
|
||||||
|
// TODO when we get more commands this needs to be extended
|
||||||
|
omnipodUIComm.executeCommand(OmnipodCommandType.AcknowledgeAlerts);
|
||||||
|
removeList.add(omnipodStatusRequest);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//getPodPumpStatus();
|
||||||
}
|
}
|
||||||
|
|
||||||
triggerUIChange();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void setIsBusy(boolean isBusy) {
|
||||||
|
this.isBusy = isBusy;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private void getPodPumpStatus() {
|
private void getPodPumpStatus() {
|
||||||
// TODO read pod status
|
// TODO read pod status
|
||||||
LOG.error("getPodPumpStatus() NOT IMPLEMENTED");
|
LOG.error("getPodPumpStatus() NOT IMPLEMENTED");
|
||||||
|
@ -321,8 +344,20 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements PumpInterfa
|
||||||
// we would probably need to read Basal Profile here too
|
// we would probably need to read Basal Profile here too
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//OmnipodStatusRequest pumpStatusRequest = null;
|
||||||
|
|
||||||
void resetStatusState() {
|
List<OmnipodStatusRequest> omnipodStatusRequestList = new ArrayList<>();
|
||||||
|
|
||||||
|
public void addPodStatusRequest(OmnipodStatusRequest pumpStatusRequest) {
|
||||||
|
if (pumpStatusRequest == OmnipodStatusRequest.ResetState) {
|
||||||
|
resetStatusState();
|
||||||
|
} else {
|
||||||
|
omnipodStatusRequestList.add(pumpStatusRequest);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void resetStatusState() {
|
||||||
firstRun = true;
|
firstRun = true;
|
||||||
isRefresh = true;
|
isRefresh = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,10 +8,11 @@ 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;
|
||||||
|
@ -56,7 +57,7 @@ public class OmnipodUITask {
|
||||||
// break;
|
// break;
|
||||||
|
|
||||||
case InitPod:
|
case InitPod:
|
||||||
returnData = communicationManager.initPod();
|
returnData = communicationManager.initPod((PodInitActionType) parameters[0], (PodInitReceiver) parameters[1]);
|
||||||
// TODO returnData = communicationManager.pairAndPrime();
|
// TODO returnData = communicationManager.pairAndPrime();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -98,6 +99,9 @@ public class OmnipodUITask {
|
||||||
returnData = communicationManager.cancelTemporaryBasal();
|
returnData = communicationManager.cancelTemporaryBasal();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case AcknowledgeAlerts:
|
||||||
|
returnData = communicationManager.acknowledgeAlerts();
|
||||||
|
break;
|
||||||
|
|
||||||
default: {
|
default: {
|
||||||
LOG.warn("This commandType is not supported (yet) - {}.", commandType);
|
LOG.warn("This commandType is not supported (yet) - {}.", commandType);
|
||||||
|
@ -133,7 +137,7 @@ public class OmnipodUITask {
|
||||||
|
|
||||||
|
|
||||||
public <T> T getResult() {
|
public <T> T getResult() {
|
||||||
return (T)returnData;
|
return (T) returnData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@ public enum OmnipodCommandType {
|
||||||
CancelBolus, //
|
CancelBolus, //
|
||||||
SetTemporaryBasal,
|
SetTemporaryBasal,
|
||||||
CancelTemporaryBasal,
|
CancelTemporaryBasal,
|
||||||
ResetPodStatus;
|
ResetPodStatus, AcknowledgeAlerts;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,10 +14,10 @@ public interface OmnipodCommunicationManagerInterface {
|
||||||
PumpEnactResult initPod(PodInitActionType podInitActionType, PodInitReceiver podIniReceiver);
|
PumpEnactResult initPod(PodInitActionType podInitActionType, PodInitReceiver podIniReceiver);
|
||||||
|
|
||||||
// TODO remove
|
// TODO remove
|
||||||
PumpEnactResult pairAndPrime();
|
//PumpEnactResult pairAndPrime();
|
||||||
|
|
||||||
// TODO remove
|
// TODO remove
|
||||||
PumpEnactResult insertCannula(Profile basalProfile);
|
//PumpEnactResult insertCannula(Profile basalProfile);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
package info.nightscout.androidaps.plugins.pump.omnipod.defs;
|
||||||
|
|
||||||
|
import info.nightscout.androidaps.interfaces.PumpInterface;
|
||||||
|
|
||||||
|
public interface OmnipodPumpPluginInterface extends PumpInterface {
|
||||||
|
|
||||||
|
void addPodStatusRequest(OmnipodStatusRequest pumpStatusRequest);
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,9 @@
|
||||||
|
package info.nightscout.androidaps.plugins.pump.omnipod.defs;
|
||||||
|
|
||||||
|
public enum OmnipodStatusRequest {
|
||||||
|
ResetState, //
|
||||||
|
AcknowledgeAlerts, //
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -1,13 +1,29 @@
|
||||||
package info.nightscout.androidaps.plugins.pump.omnipod.defs;
|
package info.nightscout.androidaps.plugins.pump.omnipod.defs;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
public enum PodInitActionType {
|
public enum PodInitActionType {
|
||||||
|
|
||||||
PairAndPrime, //
|
PairAndPrimeWizardStep, //
|
||||||
PairPod(PairAndPrime), //
|
PairPod(PairAndPrimeWizardStep), //
|
||||||
PrimePod(PairAndPrime), //
|
PrimePod(PairAndPrimeWizardStep), //
|
||||||
|
|
||||||
|
FillCannulaWizardStep,
|
||||||
|
FillCannula(FillCannulaWizardStep),
|
||||||
|
SetBasalProfile(FillCannulaWizardStep);
|
||||||
|
|
||||||
|
|
||||||
;
|
private PodInitActionType[] parent;
|
||||||
|
|
||||||
|
private static Map<PodInitActionType, List<PodInitActionType>> stepsForWizardStep;
|
||||||
|
|
||||||
|
|
||||||
|
static {
|
||||||
|
// TODO
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
PodInitActionType() {
|
PodInitActionType() {
|
||||||
|
@ -15,8 +31,31 @@ public enum PodInitActionType {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private PodInitActionType(PodInitActionType parent) {
|
private PodInitActionType(PodInitActionType... parent) {
|
||||||
|
this.parent = parent;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static List<PodInitActionType> getAvailableWizardSteps(OmnipodPodType podType) {
|
||||||
|
List<PodInitActionType> outList = new ArrayList<>();
|
||||||
|
|
||||||
|
if (podType == OmnipodPodType.Eros) {
|
||||||
|
outList.add(PodInitActionType.PairAndPrimeWizardStep);
|
||||||
|
outList.add(PodInitActionType.FillCannulaWizardStep);
|
||||||
|
} else {
|
||||||
|
// TODO we might have different wizard steps, with different handling for Dash
|
||||||
|
}
|
||||||
|
|
||||||
|
return outList;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static List<PodInitActionType> getAvailableActionsForWizardSteps(PodInitActionType wizardStep) {
|
||||||
|
if (stepsForWizardStep.containsKey(wizardStep)) {
|
||||||
|
return stepsForWizardStep.get(wizardStep);
|
||||||
|
} else {
|
||||||
|
return new ArrayList<>();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -24,10 +24,10 @@ 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.hw.rileylink.RileyLinkUtil;
|
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkUtil;
|
||||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.data.RLHistoryItem;
|
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.data.RLHistoryItem;
|
||||||
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.OmnipodCommandType;
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.defs.OmnipodCommunicationManagerInterface;
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.OmnipodPodType;
|
import info.nightscout.androidaps.plugins.pump.omnipod.defs.OmnipodPodType;
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.defs.OmnipodPumpPluginInterface;
|
||||||
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,7 +50,7 @@ public class OmnipodUtil extends RileyLinkUtil {
|
||||||
private static Gson gsonInstance = createGson();
|
private static Gson gsonInstance = createGson();
|
||||||
private static PodSessionState podSessionState;
|
private static PodSessionState podSessionState;
|
||||||
private static PodDeviceState podDeviceState;
|
private static PodDeviceState podDeviceState;
|
||||||
private static OmnipodPumpPlugin omnipodPumpPlugin;
|
private static OmnipodPumpPluginInterface omnipodPumpPlugin;
|
||||||
private static OmnipodPodType omnipodPodType;
|
private static OmnipodPodType omnipodPodType;
|
||||||
|
|
||||||
public static Gson getGsonInstance() {
|
public static Gson getGsonInstance() {
|
||||||
|
@ -182,13 +182,13 @@ public class OmnipodUtil extends RileyLinkUtil {
|
||||||
|
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public static OmnipodPumpPlugin getPlugin() {
|
public static OmnipodPumpPluginInterface getPlugin() {
|
||||||
return OmnipodUtil.omnipodPumpPlugin;
|
return OmnipodUtil.omnipodPumpPlugin;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public static void setPlugin(OmnipodPumpPlugin pumpPlugin) {
|
public static void setPlugin(OmnipodPumpPluginInterface pumpPlugin) {
|
||||||
OmnipodUtil.omnipodPumpPlugin = pumpPlugin;
|
OmnipodUtil.omnipodPumpPlugin = pumpPlugin;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,6 @@ import info.nightscout.androidaps.R;
|
||||||
import info.nightscout.androidaps.data.Profile;
|
import info.nightscout.androidaps.data.Profile;
|
||||||
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.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;
|
||||||
|
@ -25,6 +24,7 @@ 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.ui.OmnipodUIComm;
|
import info.nightscout.androidaps.plugins.pump.omnipod.comm.ui.OmnipodUIComm;
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.OmnipodPodType;
|
import info.nightscout.androidaps.plugins.pump.omnipod.defs.OmnipodPodType;
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.defs.OmnipodPumpPluginInterface;
|
||||||
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;
|
||||||
|
@ -37,7 +37,7 @@ import info.nightscout.androidaps.plugins.pump.omnipod_dash.comm.OmnipodDashComm
|
||||||
*
|
*
|
||||||
* @author Andy Rozman (andy.rozman@gmail.com)
|
* @author Andy Rozman (andy.rozman@gmail.com)
|
||||||
*/
|
*/
|
||||||
public class OmnipodDashPumpPlugin extends OmnipodPumpPlugin implements PumpInterface {
|
public class OmnipodDashPumpPlugin extends OmnipodPumpPlugin implements OmnipodPumpPluginInterface {
|
||||||
|
|
||||||
private static final Logger LOG = LoggerFactory.getLogger(L.PUMP);
|
private static final Logger LOG = LoggerFactory.getLogger(L.PUMP);
|
||||||
|
|
||||||
|
@ -192,7 +192,7 @@ public class OmnipodDashPumpPlugin extends OmnipodPumpPlugin implements PumpInte
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void resetStatusState() {
|
public void resetStatusState() {
|
||||||
firstRun = true;
|
firstRun = true;
|
||||||
isRefresh = true;
|
isRefresh = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
tools:context=".plugins.pump.omnipod.dialogs.PodManagementActivity">
|
tools:context="info.nightscout.androidaps.plugins.pump.omnipod.dialogs.PodManagementActivity">
|
||||||
|
|
||||||
<ScrollView
|
<ScrollView
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
@ -15,7 +15,7 @@
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/textView3"
|
android:id="@+id/initpod_space0"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="120dp"
|
android:layout_height="120dp"
|
||||||
android:layout_weight="0.5"
|
android:layout_weight="0.5"
|
||||||
|
@ -35,11 +35,11 @@
|
||||||
android:text="@string/careportal_profileswitch" />
|
android:text="@string/careportal_profileswitch" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/textView4"
|
android:id="@+id/initpod_space1"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="60dp"
|
android:layout_height="60dp"
|
||||||
android:layout_weight="0.5"
|
android:layout_weight="0.5"
|
||||||
android:text=" " />
|
android:text="" />
|
||||||
|
|
||||||
<info.nightscout.androidaps.utils.SingleClickButton
|
<info.nightscout.androidaps.utils.SingleClickButton
|
||||||
android:id="@+id/initpod_remove_pod"
|
android:id="@+id/initpod_remove_pod"
|
||||||
|
@ -55,11 +55,11 @@
|
||||||
android:text="@string/careportal_temporarytarget" />
|
android:text="@string/careportal_temporarytarget" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/textView5"
|
android:id="@+id/initpod_space2"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="60dp"
|
android:layout_height="60dp"
|
||||||
android:layout_weight="0.5"
|
android:layout_weight="0.5"
|
||||||
android:text=" " />
|
android:text="" />
|
||||||
|
|
||||||
<info.nightscout.androidaps.utils.SingleClickButton
|
<info.nightscout.androidaps.utils.SingleClickButton
|
||||||
android:id="@+id/initpod_reset_pod"
|
android:id="@+id/initpod_reset_pod"
|
||||||
|
@ -75,11 +75,11 @@
|
||||||
android:text="@string/primefill" />
|
android:text="@string/primefill" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/textView6"
|
android:id="@+id/initpod_space3"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="60dp"
|
android:layout_height="60dp"
|
||||||
android:layout_weight="0.5"
|
android:layout_weight="0.5"
|
||||||
android:text=" " />
|
android:text="" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue