Init pod integration is finished.
This commit is contained in:
parent
b13fbcf8f4
commit
3a1e5f5741
|
@ -23,7 +23,7 @@ import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.Riley
|
||||||
import info.nightscout.androidaps.plugins.pump.common.utils.StringUtil;
|
import info.nightscout.androidaps.plugins.pump.common.utils.StringUtil;
|
||||||
import info.nightscout.androidaps.plugins.pump.medtronic.driver.MedtronicPumpStatus;
|
import info.nightscout.androidaps.plugins.pump.medtronic.driver.MedtronicPumpStatus;
|
||||||
import info.nightscout.androidaps.plugins.pump.medtronic.util.MedtronicUtil;
|
import info.nightscout.androidaps.plugins.pump.medtronic.util.MedtronicUtil;
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.service.OmnipodPumpStatus;
|
import info.nightscout.androidaps.plugins.pump.omnipod.driver.OmnipodPumpStatus;
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.util.OmnipodUtil;
|
import info.nightscout.androidaps.plugins.pump.omnipod.util.OmnipodUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -10,9 +10,6 @@ import android.view.ViewGroup
|
||||||
import androidx.fragment.app.Fragment
|
import androidx.fragment.app.Fragment
|
||||||
import info.nightscout.androidaps.MainApp
|
import info.nightscout.androidaps.MainApp
|
||||||
import info.nightscout.androidaps.R
|
import info.nightscout.androidaps.R
|
||||||
import info.nightscout.androidaps.events.EventExtendedBolusChange
|
|
||||||
import info.nightscout.androidaps.events.EventPumpStatusChanged
|
|
||||||
import info.nightscout.androidaps.events.EventTempBasalChange
|
|
||||||
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.configBuilder.ConfigBuilderPlugin
|
||||||
|
@ -23,15 +20,15 @@ import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLin
|
||||||
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.omnipod.defs.OmnipodStatusRequest
|
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.defs.state.PodSessionState
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.dialogs.PodManagementActivity
|
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
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.service.OmnipodPumpStatus
|
import info.nightscout.androidaps.plugins.pump.omnipod.driver.OmnipodPumpStatus
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.util.OmnipodUtil
|
import info.nightscout.androidaps.plugins.pump.omnipod.util.OmnipodUtil
|
||||||
import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin
|
import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin
|
||||||
import info.nightscout.androidaps.queue.Callback
|
import info.nightscout.androidaps.queue.Callback
|
||||||
import info.nightscout.androidaps.queue.events.EventQueueChanged
|
|
||||||
import info.nightscout.androidaps.utils.DateUtil
|
import info.nightscout.androidaps.utils.DateUtil
|
||||||
import info.nightscout.androidaps.utils.FabricPrivacy
|
import info.nightscout.androidaps.utils.FabricPrivacy
|
||||||
import info.nightscout.androidaps.utils.SetWarnColor
|
import info.nightscout.androidaps.utils.SetWarnColor
|
||||||
|
@ -208,8 +205,8 @@ 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.podSessionState = checkStatusSet(pumpStatus.podSessionState,
|
||||||
OmnipodUtil.getPodDeviceState()) as PodDeviceState?
|
// OmnipodUtil.getPodSessionState()) as PodSessionState?
|
||||||
|
|
||||||
var podDeviceState = pumpStatus.podDeviceState
|
var podDeviceState = pumpStatus.podDeviceState
|
||||||
|
|
||||||
|
|
|
@ -56,7 +56,7 @@ import info.nightscout.androidaps.plugins.pump.omnipod.defs.PodInitActionType;
|
||||||
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;
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.service.OmnipodPumpStatus;
|
import info.nightscout.androidaps.plugins.pump.omnipod.driver.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.LogReceiver;
|
import info.nightscout.androidaps.plugins.pump.omnipod.util.LogReceiver;
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.util.OmnipodConst;
|
import info.nightscout.androidaps.plugins.pump.omnipod.util.OmnipodConst;
|
||||||
|
|
|
@ -10,21 +10,22 @@ 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.PodInitActionType;
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.PodInitReceiver;
|
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.service.OmnipodPumpStatus;
|
import info.nightscout.androidaps.plugins.pump.omnipod.driver.OmnipodPumpStatus;
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.driver.comm.OmnipodManagerAAPS;
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.util.OmnipodUtil;
|
||||||
|
|
||||||
public class AapsOmnipodManager implements OmnipodCommunicationManagerInterface {
|
public class AapsOmnipodManager implements OmnipodCommunicationManagerInterface {
|
||||||
private final OmnipodManager delegate;
|
private final OmnipodManagerAAPS delegate;
|
||||||
|
|
||||||
private static AapsOmnipodManager instance;
|
private static AapsOmnipodManager instance;
|
||||||
private OmnipodPumpStatus pumpStatus;
|
private OmnipodPumpStatus pumpStatus;
|
||||||
|
|
||||||
// FIXME this is dirty
|
|
||||||
public static AapsOmnipodManager getInstance() {
|
public static AapsOmnipodManager getInstance() {
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
public AapsOmnipodManager(OmnipodCommunicationService communicationService, PodSessionState podState) {
|
public AapsOmnipodManager(OmnipodCommunicationService communicationService, PodSessionState podState) {
|
||||||
delegate = new OmnipodManager(communicationService, podState);
|
delegate = new OmnipodManagerAAPS(communicationService, podState);
|
||||||
instance = this;
|
instance = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,6 +40,7 @@ public class AapsOmnipodManager implements OmnipodCommunicationManagerInterface
|
||||||
// FIXME we need a basal profile here
|
// FIXME we need a basal profile here
|
||||||
PumpEnactResult result = delegate.insertCannula(profile);
|
PumpEnactResult result = delegate.insertCannula(profile);
|
||||||
podInitReceiver.returnInitTaskStatus(podInitActionType, result.success, (result.success ? null : result.comment));
|
podInitReceiver.returnInitTaskStatus(podInitActionType, result.success, (result.success ? null : result.comment));
|
||||||
|
OmnipodUtil.setPodSessionState(delegate.podState);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
return new PumpEnactResult().success(false).enacted(false).comment("Illegal PodInitActionType: " + podInitActionType.name());
|
return new PumpEnactResult().success(false).enacted(false).comment("Illegal PodInitActionType: " + podInitActionType.name());
|
||||||
|
@ -50,8 +52,8 @@ public class AapsOmnipodManager implements OmnipodCommunicationManagerInterface
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PumpEnactResult deactivatePod() {
|
public PumpEnactResult deactivatePod(PodInitReceiver podInitReceiver) {
|
||||||
return delegate.deactivatePod();
|
return delegate.deactivatePod(podInitReceiver);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -61,7 +63,6 @@ public class AapsOmnipodManager implements OmnipodCommunicationManagerInterface
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PumpEnactResult resetPodStatus() {
|
public PumpEnactResult resetPodStatus() {
|
||||||
pumpStatus.podDeviceState = null;
|
|
||||||
return delegate.resetPodState();
|
return delegate.resetPodState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -100,12 +101,10 @@ public class AapsOmnipodManager implements OmnipodCommunicationManagerInterface
|
||||||
return delegate.getPodInfo(podInfoType);
|
return delegate.getPodInfo(podInfoType);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO should we add this to the OmnipodCommunicationManager interface?
|
|
||||||
public PumpEnactResult suspendDelivery() {
|
public PumpEnactResult suspendDelivery() {
|
||||||
return delegate.suspendDelivery();
|
return delegate.suspendDelivery();
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO should we add this to the OmnipodCommunicationManager interface?
|
|
||||||
public PumpEnactResult resumeDelivery() {
|
public PumpEnactResult resumeDelivery() {
|
||||||
return delegate.resumeDelivery();
|
return delegate.resumeDelivery();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package info.nightscout.androidaps.plugins.pump.omnipod.comm;
|
package info.nightscout.androidaps.plugins.pump.omnipod.comm;
|
||||||
|
|
||||||
|
import android.os.SystemClock;
|
||||||
|
|
||||||
import org.joda.time.DateTime;
|
import org.joda.time.DateTime;
|
||||||
import org.joda.time.DateTimeZone;
|
import org.joda.time.DateTimeZone;
|
||||||
import org.joda.time.Duration;
|
import org.joda.time.Duration;
|
||||||
|
@ -37,12 +39,15 @@ import info.nightscout.androidaps.plugins.pump.omnipod.defs.PodInfoType;
|
||||||
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;
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.driver.db.PodDbEntry;
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.driver.db.PodDbEntryType;
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.util.OmnipodConst;
|
import info.nightscout.androidaps.plugins.pump.omnipod.util.OmnipodConst;
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.util.OmnipodUtil;
|
||||||
import info.nightscout.androidaps.utils.SP;
|
import info.nightscout.androidaps.utils.SP;
|
||||||
|
|
||||||
public class OmnipodManager {
|
public class OmnipodManager {
|
||||||
private final OmnipodCommunicationService communicationService;
|
protected final OmnipodCommunicationService communicationService;
|
||||||
private PodSessionState podState;
|
protected PodSessionState podState;
|
||||||
|
|
||||||
public OmnipodManager(OmnipodCommunicationService communicationService, PodSessionState podState) {
|
public OmnipodManager(OmnipodCommunicationService communicationService, PodSessionState podState) {
|
||||||
if (communicationService == null) {
|
if (communicationService == null) {
|
||||||
|
@ -181,6 +186,10 @@ public class OmnipodManager {
|
||||||
podState = null;
|
podState = null;
|
||||||
SP.remove(OmnipodConst.Prefs.PodState);
|
SP.remove(OmnipodConst.Prefs.PodState);
|
||||||
|
|
||||||
|
addToHistory(System.currentTimeMillis(), PodDbEntryType.ResetPodState, null, null, null, null);
|
||||||
|
|
||||||
|
OmnipodUtil.setPodSessionState(null);
|
||||||
|
|
||||||
return new PumpEnactResult().success(true).enacted(true);
|
return new PumpEnactResult().success(true).enacted(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -352,8 +361,27 @@ public class OmnipodManager {
|
||||||
return new PumpEnactResult().success(false).enacted(false).comment("Pod should be initialized first");
|
return new PumpEnactResult().success(false).enacted(false).comment("Pod should be initialized first");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addToHistory(long requestTime, OmnipodAction omnipodAction, long responseTime) {
|
private void addToHistory(long requestTime, PodDbEntryType entryType, String shortDescription, OmnipodAction omnipodAction, Long responseTime, Object response) {
|
||||||
// TODO andy
|
// TODO andy
|
||||||
|
|
||||||
|
PodDbEntry entry = new PodDbEntry(requestTime, entryType);
|
||||||
|
|
||||||
|
if (shortDescription!=null) {
|
||||||
|
entry.setShortDescription(shortDescription);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (omnipodAction!=null) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if (responseTime!=null) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if (response!=null) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -3,7 +3,7 @@ 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.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.service.OmnipodPumpStatus;
|
import info.nightscout.androidaps.plugins.pump.omnipod.driver.OmnipodPumpStatus;
|
||||||
|
|
||||||
public interface OmnipodCommunicationManagerInterface {
|
public interface OmnipodCommunicationManagerInterface {
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ public interface OmnipodCommunicationManagerInterface {
|
||||||
/**
|
/**
|
||||||
* Deactivate Pod
|
* Deactivate Pod
|
||||||
*/
|
*/
|
||||||
PumpEnactResult deactivatePod();
|
PumpEnactResult deactivatePod(PodInitReceiver podInitReceiver);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set Basal Profile
|
* Set Basal Profile
|
||||||
|
|
|
@ -12,9 +12,16 @@ public enum PodInitActionType {
|
||||||
PairPod(R.string.omnipod_init_pod_pair_pod, PairAndPrimeWizardStep), //
|
PairPod(R.string.omnipod_init_pod_pair_pod, PairAndPrimeWizardStep), //
|
||||||
PrimePod(R.string.omnipod_init_pod_prime_pod, PairAndPrimeWizardStep), //
|
PrimePod(R.string.omnipod_init_pod_prime_pod, PairAndPrimeWizardStep), //
|
||||||
|
|
||||||
FillCannulaSetBasalProfileWizardStep(),
|
FillCannulaSetBasalProfileWizardStep(), //
|
||||||
FillCannula(R.string.omnipod_init_pod_fill_cannula, FillCannulaSetBasalProfileWizardStep),
|
FillCannula(R.string.omnipod_init_pod_fill_cannula, FillCannulaSetBasalProfileWizardStep), //
|
||||||
SetBasalProfile(R.string.omnipod_init_pod_set_basal_profile, FillCannulaSetBasalProfileWizardStep);
|
SetBasalProfile(R.string.omnipod_init_pod_set_basal_profile, FillCannulaSetBasalProfileWizardStep), //
|
||||||
|
|
||||||
|
DeactivatePodWizardStep(), //
|
||||||
|
CancelDelivery(R.string.omnipod_deactivate_pod_cancel_delivery, DeactivatePodWizardStep), //
|
||||||
|
DeactivatePod(R.string.omnipod_deactivate_pod_deactivate_pod, DeactivatePodWizardStep) //
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private int resourceId;
|
private int resourceId;
|
||||||
private PodInitActionType parent;
|
private PodInitActionType parent;
|
||||||
|
@ -22,12 +29,6 @@ public enum PodInitActionType {
|
||||||
private static Map<PodInitActionType, List<PodInitActionType>> stepsForWizardStep;
|
private static Map<PodInitActionType, List<PodInitActionType>> stepsForWizardStep;
|
||||||
|
|
||||||
|
|
||||||
static {
|
|
||||||
// TODO
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
PodInitActionType(int resourceId, PodInitActionType parent) {
|
PodInitActionType(int resourceId, PodInitActionType parent) {
|
||||||
this.resourceId = resourceId;
|
this.resourceId = resourceId;
|
||||||
this.parent = parent;
|
this.parent = parent;
|
||||||
|
@ -38,6 +39,11 @@ public enum PodInitActionType {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public boolean isParent() {
|
||||||
|
return this.parent == null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public List<PodInitActionType> getChildren() {
|
public List<PodInitActionType> getChildren() {
|
||||||
|
|
||||||
List<PodInitActionType> outList = new ArrayList<>();
|
List<PodInitActionType> outList = new ArrayList<>();
|
||||||
|
|
|
@ -2,6 +2,7 @@ package info.nightscout.androidaps.plugins.pump.omnipod.dialogs
|
||||||
|
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
|
import android.os.SystemClock
|
||||||
import com.atech.android.library.wizardpager.WizardPagerActivity
|
import com.atech.android.library.wizardpager.WizardPagerActivity
|
||||||
import com.atech.android.library.wizardpager.WizardPagerContext
|
import com.atech.android.library.wizardpager.WizardPagerContext
|
||||||
import com.atech.android.library.wizardpager.data.WizardPagerSettings
|
import com.atech.android.library.wizardpager.data.WizardPagerSettings
|
||||||
|
@ -9,8 +10,14 @@ import com.atech.android.library.wizardpager.defs.WizardStepsWayType
|
||||||
import info.nightscout.androidaps.MainApp
|
import info.nightscout.androidaps.MainApp
|
||||||
import info.nightscout.androidaps.R
|
import info.nightscout.androidaps.R
|
||||||
import info.nightscout.androidaps.activities.NoSplashActivity
|
import info.nightscout.androidaps.activities.NoSplashActivity
|
||||||
|
import info.nightscout.androidaps.plugins.bus.RxBus
|
||||||
|
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.comm.AapsOmnipodManager
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.dialogs.wizard.initpod.InitPodCancelAction
|
import info.nightscout.androidaps.plugins.pump.omnipod.dialogs.wizard.initpod.InitPodCancelAction
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.dialogs.wizard.initpod.InitPodWizardModel
|
import info.nightscout.androidaps.plugins.pump.omnipod.dialogs.wizard.initpod.InitPodWizardModel
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.driver.comm.OmnipodManagerAAPS
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.events.EventOmnipodPumpValuesChanged
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.events.EventOmnipodRefreshButtonState
|
||||||
import info.nightscout.androidaps.utils.OKDialog
|
import info.nightscout.androidaps.utils.OKDialog
|
||||||
import kotlinx.android.synthetic.main.omnipod_pod_mgmt.*
|
import kotlinx.android.synthetic.main.omnipod_pod_mgmt.*
|
||||||
|
|
||||||
|
@ -77,8 +84,9 @@ class PodManagementActivity : NoSplashActivity() {
|
||||||
|
|
||||||
fun resetPodAction() {
|
fun resetPodAction() {
|
||||||
OKDialog.showConfirmation(this,
|
OKDialog.showConfirmation(this,
|
||||||
MainApp.gs(R.string.omnipod_cmd_reset_pod_na), null)
|
MainApp.gs(R.string.omnipod_cmd_reset_pod_desc), Thread {
|
||||||
|
AapsOmnipodManager.getInstance().resetPodStatus()
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
fun showPodHistory() {
|
fun showPodHistory() {
|
||||||
|
|
|
@ -25,24 +25,29 @@ import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import info.nightscout.androidaps.R;
|
import info.nightscout.androidaps.R;
|
||||||
|
import info.nightscout.androidaps.data.PumpEnactResult;
|
||||||
|
import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctions;
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.comm.AapsOmnipodManager;
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.PodInitActionType;
|
import info.nightscout.androidaps.plugins.pump.omnipod.defs.PodInitActionType;
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.defs.PodInitReceiver;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by TechFreak on 04/09/2014.
|
* Created by TechFreak on 04/09/2014.
|
||||||
*/
|
*/
|
||||||
public class InitActionFragment extends Fragment {
|
public class InitActionFragment extends Fragment implements PodInitReceiver {
|
||||||
private static final String ARG_KEY = "key";
|
private static final String ARG_KEY = "key";
|
||||||
|
|
||||||
private PageFragmentCallbacks mCallbacks;
|
private PageFragmentCallbacks mCallbacks;
|
||||||
private String mKey;
|
private String mKey;
|
||||||
private InitActionPage mPage;
|
private InitActionPage mPage;
|
||||||
|
|
||||||
ProgressBar progressBar;
|
private ProgressBar progressBar;
|
||||||
TextView errorView;
|
private TextView errorView;
|
||||||
|
|
||||||
PodInitActionType podInitActionType;
|
private PodInitActionType podInitActionType;
|
||||||
List<PodInitActionType> children;
|
//private List<PodInitActionType> children;
|
||||||
Map<PodInitActionType, CheckBox> mapCheckBoxes;
|
private Map<PodInitActionType, CheckBox> mapCheckBoxes;
|
||||||
|
private InitActionFragment instance;
|
||||||
|
|
||||||
public static InitActionFragment create(String key, PodInitActionType podInitActionType) {
|
public static InitActionFragment create(String key, PodInitActionType podInitActionType) {
|
||||||
Bundle args = new Bundle();
|
Bundle args = new Bundle();
|
||||||
|
@ -55,7 +60,7 @@ public class InitActionFragment extends Fragment {
|
||||||
}
|
}
|
||||||
|
|
||||||
public InitActionFragment() {
|
public InitActionFragment() {
|
||||||
|
this.instance = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -80,7 +85,7 @@ public class InitActionFragment extends Fragment {
|
||||||
|
|
||||||
LinearLayout linearLayout = rootView.findViewById(R.id.initAction_ItemsHolder);
|
LinearLayout linearLayout = rootView.findViewById(R.id.initAction_ItemsHolder);
|
||||||
|
|
||||||
children = podInitActionType.getChildren();
|
List<PodInitActionType> children = podInitActionType.getChildren();
|
||||||
mapCheckBoxes = new HashMap<>();
|
mapCheckBoxes = new HashMap<>();
|
||||||
|
|
||||||
for (PodInitActionType child : children) {
|
for (PodInitActionType child : children) {
|
||||||
|
@ -118,20 +123,20 @@ public class InitActionFragment extends Fragment {
|
||||||
mCallbacks = null;
|
mCallbacks = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
// @Override
|
||||||
public void onViewCreated(View view, Bundle savedInstanceState) {
|
// public void onViewCreated(View view, Bundle savedInstanceState) {
|
||||||
super.onViewCreated(view, savedInstanceState);
|
// super.onViewCreated(view, savedInstanceState);
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
|
||||||
}
|
// @Override
|
||||||
|
// public void setMenuVisibility(boolean menuVisible) {
|
||||||
@Override
|
// super.setMenuVisibility(menuVisible);
|
||||||
public void setMenuVisibility(boolean menuVisible) {
|
//
|
||||||
super.setMenuVisibility(menuVisible);
|
// // In a future update to the support library, this should override setUserVisibleHint
|
||||||
|
// // instead of setMenuVisibility.
|
||||||
// In a future update to the support library, this should override setUserVisibleHint
|
//
|
||||||
// instead of setMenuVisibility.
|
// }
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public PodInitActionType getPodInitActionType() {
|
public PodInitActionType getPodInitActionType() {
|
||||||
return podInitActionType;
|
return podInitActionType;
|
||||||
|
@ -152,22 +157,31 @@ public class InitActionFragment extends Fragment {
|
||||||
|
|
||||||
new AsyncTask<Void, Void, String>() {
|
new AsyncTask<Void, Void, String>() {
|
||||||
|
|
||||||
protected void onPreExecute() {
|
PumpEnactResult callResult;
|
||||||
//progressBar.setVisibility(View.VISIBLE);
|
|
||||||
}
|
|
||||||
|
|
||||||
;
|
protected void onPreExecute() {
|
||||||
|
progressBar.setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String doInBackground(Void... params) {
|
protected String doInBackground(Void... params) {
|
||||||
System.out.println("ACTION: doInBackground Started: ");
|
if (podInitActionType == PodInitActionType.PairAndPrimeWizardStep) {
|
||||||
SystemClock.sleep(5000);
|
this.callResult = AapsOmnipodManager.getInstance().initPod(
|
||||||
mPage.setActionCompleted(true);
|
podInitActionType,
|
||||||
|
instance,
|
||||||
|
null
|
||||||
|
);
|
||||||
|
} else if (podInitActionType == PodInitActionType.FillCannulaSetBasalProfileWizardStep) {
|
||||||
|
this.callResult = AapsOmnipodManager.getInstance().initPod(
|
||||||
|
podInitActionType,
|
||||||
|
instance,
|
||||||
|
ProfileFunctions.getInstance().getProfile()
|
||||||
|
);
|
||||||
|
} else if (podInitActionType == PodInitActionType.DeactivatePodWizardStep) {
|
||||||
|
this.callResult = AapsOmnipodManager.getInstance().deactivatePod(instance);
|
||||||
|
}
|
||||||
|
|
||||||
System.out.println("ACTION: doInBackground Finished: ");
|
return "OK";
|
||||||
|
|
||||||
|
|
||||||
return "Test";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -176,20 +190,17 @@ public class InitActionFragment extends Fragment {
|
||||||
|
|
||||||
System.out.println("ACTION: onPostExecute: " + result);
|
System.out.println("ACTION: onPostExecute: " + result);
|
||||||
|
|
||||||
boolean isOk = false;
|
boolean isOk = callResult.success;
|
||||||
|
|
||||||
for (PodInitActionType actionType : mapCheckBoxes.keySet()) {
|
|
||||||
mapCheckBoxes.get(actionType).setChecked(true);
|
|
||||||
mapCheckBoxes.get(actionType).setTextColor(isOk ? Color.rgb(34, 135, 91) : Color.rgb(168, 36, 15));
|
|
||||||
}
|
|
||||||
|
|
||||||
progressBar.setVisibility(View.GONE);
|
progressBar.setVisibility(View.GONE);
|
||||||
|
|
||||||
if (!isOk) {
|
if (!isOk) {
|
||||||
errorView.setVisibility(View.VISIBLE);
|
errorView.setVisibility(View.VISIBLE);
|
||||||
errorView.setText("Error containg pod.");
|
errorView.setText(callResult.comment);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mPage.setActionCompleted(isOk);
|
||||||
|
|
||||||
mPage.getData().putString(Page.SIMPLE_DATA_KEY, "ddd");
|
mPage.getData().putString(Page.SIMPLE_DATA_KEY, "ddd");
|
||||||
mPage.notifyDataChanged();
|
mPage.notifyDataChanged();
|
||||||
}
|
}
|
||||||
|
@ -199,4 +210,28 @@ public class InitActionFragment extends Fragment {
|
||||||
System.out.println("ACTION: Not visible");
|
System.out.println("ACTION: Not visible");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void returnInitTaskStatus(PodInitActionType podInitActionType, boolean isSuccess, String errorMessage) {
|
||||||
|
if (podInitActionType.isParent()) {
|
||||||
|
for (PodInitActionType actionType : mapCheckBoxes.keySet()) {
|
||||||
|
setCheckBox(actionType, isSuccess);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
setCheckBox(podInitActionType, isSuccess);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void setCheckBox(PodInitActionType podInitActionType, boolean isSuccess) {
|
||||||
|
getActivity().runOnUiThread(() -> {
|
||||||
|
mapCheckBoxes.get(podInitActionType).setChecked(true);
|
||||||
|
mapCheckBoxes.get(podInitActionType).setTextColor(isSuccess ? Color.rgb(34, 135, 91) :
|
||||||
|
Color.rgb(168, 36, 15));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,6 +32,7 @@ import java.util.List;
|
||||||
import info.nightscout.androidaps.R;
|
import info.nightscout.androidaps.R;
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.FirmwareVersion;
|
import info.nightscout.androidaps.plugins.pump.omnipod.defs.FirmwareVersion;
|
||||||
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;
|
||||||
|
|
||||||
|
|
||||||
public class PodInfoFragment extends Fragment {
|
public class PodInfoFragment extends Fragment {
|
||||||
|
@ -77,31 +78,35 @@ public class PodInfoFragment extends Fragment {
|
||||||
|
|
||||||
|
|
||||||
if (isInitPod) {
|
if (isInitPod) {
|
||||||
createDataOfPod();
|
if (createDataOfPod()) {
|
||||||
|
|
||||||
ListView listView = (ListView) rootView.findViewById(R.id.podInfoList);
|
ListView listView = (ListView) rootView.findViewById(R.id.podInfoList);
|
||||||
listView.setAdapter(new PodInfoAdapter(mCurrentReviewItems, getContext()));
|
listView.setAdapter(new PodInfoAdapter(mCurrentReviewItems, getContext()));
|
||||||
listView.setChoiceMode(ListView.CHOICE_MODE_NONE);
|
listView.setChoiceMode(ListView.CHOICE_MODE_NONE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return rootView;
|
return rootView;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createDataOfPod() {
|
private boolean createDataOfPod() {
|
||||||
|
|
||||||
// TODO
|
PodSessionState podSessionState = OmnipodUtil.getPodSessionState();
|
||||||
|
|
||||||
PodSessionState podSessionState = new PodSessionState(DateTimeZone.UTC,
|
// PodSessionState podSessionState = new PodSessionState(DateTimeZone.UTC,
|
||||||
483748738,
|
// 483748738,
|
||||||
new DateTime(),
|
// new DateTime(),
|
||||||
new FirmwareVersion(1,0,0),
|
// new FirmwareVersion(1,0,0),
|
||||||
new FirmwareVersion(1,0,0),
|
// new FirmwareVersion(1,0,0),
|
||||||
574875,
|
// 574875,
|
||||||
5487584,
|
// 5487584,
|
||||||
1,
|
// 1,
|
||||||
1
|
// 1
|
||||||
);
|
// );
|
||||||
|
|
||||||
|
if (podSessionState==null)
|
||||||
|
return false;
|
||||||
|
|
||||||
mCurrentReviewItems = new ArrayList<>();
|
mCurrentReviewItems = new ArrayList<>();
|
||||||
mCurrentReviewItems.add(new ReviewItem("Pod Address", "" + podSessionState.getAddress(), "33"));
|
mCurrentReviewItems.add(new ReviewItem("Pod Address", "" + podSessionState.getAddress(), "33"));
|
||||||
|
@ -109,6 +114,7 @@ public class PodInfoFragment extends Fragment {
|
||||||
mCurrentReviewItems.add(new ReviewItem("Firmware Version", podSessionState.getPiVersion().toString(), "35"));
|
mCurrentReviewItems.add(new ReviewItem("Firmware Version", podSessionState.getPiVersion().toString(), "35"));
|
||||||
mCurrentReviewItems.add(new ReviewItem("LOT", "" + podSessionState.getLot(), "36"));
|
mCurrentReviewItems.add(new ReviewItem("LOT", "" + podSessionState.getLot(), "36"));
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package info.nightscout.androidaps.plugins.pump.omnipod.service;
|
package info.nightscout.androidaps.plugins.pump.omnipod.driver;
|
||||||
|
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import org.joda.time.LocalDateTime;
|
import org.joda.time.LocalDateTime;
|
|
@ -0,0 +1,95 @@
|
||||||
|
package info.nightscout.androidaps.plugins.pump.omnipod.driver.comm;
|
||||||
|
|
||||||
|
|
||||||
|
import info.nightscout.androidaps.data.PumpEnactResult;
|
||||||
|
import info.nightscout.androidaps.plugins.bus.RxBus;
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.comm.OmnipodCommunicationService;
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.comm.OmnipodManager;
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.comm.action.DeactivatePodAction;
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.comm.action.OmnipodAction;
|
||||||
|
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.driver.db.PodDbEntry;
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.driver.db.PodDbEntryType;
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.events.EventOmnipodPumpValuesChanged;
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.util.OmnipodConst;
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.util.OmnipodUtil;
|
||||||
|
import info.nightscout.androidaps.utils.SP;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by andy on 24.11.2019
|
||||||
|
*/
|
||||||
|
|
||||||
|
// TODO this should be used instead of AapsOmnipodManager
|
||||||
|
public class OmnipodManagerAAPS extends OmnipodManager //implements OmnipodCommunicationManagerInterface
|
||||||
|
{
|
||||||
|
|
||||||
|
public OmnipodManagerAAPS(OmnipodCommunicationService communicationService, PodSessionState podState) {
|
||||||
|
super(communicationService, podState);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public PumpEnactResult deactivatePod(PodInitReceiver podInitReceiver) {
|
||||||
|
|
||||||
|
if (podState == null) {
|
||||||
|
// TODO use string resource
|
||||||
|
podInitReceiver.returnInitTaskStatus(PodInitActionType.DeactivatePodWizardStep, false, "Pod should be paired and primed first");
|
||||||
|
|
||||||
|
return new PumpEnactResult().success(false).enacted(false).comment("Pod should be paired and primed first");
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
communicationService.executeAction(new DeactivatePodAction(podState, true));
|
||||||
|
resetPodStateInternal();
|
||||||
|
podInitReceiver.returnInitTaskStatus(PodInitActionType.DeactivatePodWizardStep, true, null);
|
||||||
|
|
||||||
|
} catch (Exception ex) {
|
||||||
|
// TODO distinguish between certain and uncertain failures
|
||||||
|
// TODO user friendly error messages (string resources)
|
||||||
|
podInitReceiver.returnInitTaskStatus(PodInitActionType.DeactivatePodWizardStep, false, "Error communicating with Pod [msg=" + ex.getMessage() + "]");
|
||||||
|
|
||||||
|
return new PumpEnactResult().success(false).enacted(false).comment(ex.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
return new PumpEnactResult().success(true).enacted(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public PumpEnactResult resetPodState() {
|
||||||
|
resetPodStateInternal();
|
||||||
|
|
||||||
|
addToHistory(System.currentTimeMillis(), PodDbEntryType.ResetPodState, null, null, null, true);
|
||||||
|
|
||||||
|
return new PumpEnactResult().success(true).enacted(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void resetPodStateInternal() {
|
||||||
|
podState = null;
|
||||||
|
SP.remove(OmnipodConst.Prefs.PodState);
|
||||||
|
|
||||||
|
OmnipodUtil.setPodSessionState(null);
|
||||||
|
RxBus.INSTANCE.send(new EventOmnipodPumpValuesChanged());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void addToHistory(long requestTime, PodDbEntryType entryType, OmnipodAction omnipodAction, Long responseTime, Object response, boolean success) {
|
||||||
|
// TODO andy
|
||||||
|
|
||||||
|
PodDbEntry entry = new PodDbEntry(requestTime, entryType);
|
||||||
|
|
||||||
|
if (omnipodAction!=null) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if (responseTime!=null) {
|
||||||
|
entry.setDateTimeResponse(responseTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (response!=null) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,104 @@
|
||||||
|
package info.nightscout.androidaps.plugins.pump.omnipod.driver.db;
|
||||||
|
|
||||||
|
import info.nightscout.androidaps.db.DbObjectBase;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by andy on 24.11.2019
|
||||||
|
*/
|
||||||
|
public class PodDbEntry implements DbObjectBase {
|
||||||
|
|
||||||
|
private long dateTime;
|
||||||
|
private PodDbEntryType podDbEntryType;
|
||||||
|
private String shortDescription;
|
||||||
|
private String request;
|
||||||
|
private long dateTimeResponse;
|
||||||
|
private String response;
|
||||||
|
private boolean success;
|
||||||
|
private long pumpId;
|
||||||
|
|
||||||
|
public PodDbEntry(PodDbEntryType podDbEntryType) {
|
||||||
|
this.dateTime = System.currentTimeMillis();
|
||||||
|
this.podDbEntryType = podDbEntryType;
|
||||||
|
generatePumpId();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public PodDbEntry(long requestTime, PodDbEntryType podDbEntryType) {
|
||||||
|
this.dateTime = requestTime;
|
||||||
|
this.podDbEntryType = podDbEntryType;
|
||||||
|
generatePumpId();
|
||||||
|
}
|
||||||
|
|
||||||
|
public PodDbEntry(long requestTime, PodDbEntryType podDbEntryType, String shortDescription, String request, Long dateTimeResponse, String response) {
|
||||||
|
this.dateTime = requestTime;
|
||||||
|
this.podDbEntryType = podDbEntryType;
|
||||||
|
this.shortDescription = shortDescription;
|
||||||
|
this.request = request;
|
||||||
|
this.dateTimeResponse = dateTimeResponse;
|
||||||
|
this.response = response;
|
||||||
|
generatePumpId();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public long getDateTime() {
|
||||||
|
return dateTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDateTime(long dateTime) {
|
||||||
|
this.dateTime = dateTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PodDbEntryType getPodDbEntryType() {
|
||||||
|
return podDbEntryType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPodDbEntryType(PodDbEntryType podDbEntryType) {
|
||||||
|
this.podDbEntryType = podDbEntryType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRequest() {
|
||||||
|
return request;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRequest(String request) {
|
||||||
|
this.request = request;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getDateTimeResponse() {
|
||||||
|
return dateTimeResponse;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDateTimeResponse(long dateTimeResponse) {
|
||||||
|
this.dateTimeResponse = dateTimeResponse;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getResponse() {
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setResponse(String response) {
|
||||||
|
this.response = response;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long getDate() {
|
||||||
|
return this.dateTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long getPumpId() {
|
||||||
|
return pumpId;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void generatePumpId() {
|
||||||
|
// TODO
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getShortDescription() {
|
||||||
|
return shortDescription;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setShortDescription(String shortDescription) {
|
||||||
|
this.shortDescription = shortDescription;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,41 @@
|
||||||
|
package info.nightscout.androidaps.plugins.pump.omnipod.driver.db;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by andy on 24.11.2019
|
||||||
|
*/
|
||||||
|
public enum PodDbEntryType {
|
||||||
|
|
||||||
|
PairAndPrime(1),
|
||||||
|
InsertCannula(2),
|
||||||
|
DeactivatePod(3),
|
||||||
|
ResetPodState(4),
|
||||||
|
|
||||||
|
SetTemporaryBasal(10),
|
||||||
|
CancelTemporaryBasal(11),
|
||||||
|
|
||||||
|
SetBasalSchedule(20),
|
||||||
|
|
||||||
|
GetPodStatus(30),
|
||||||
|
GetPodInfo(31),
|
||||||
|
|
||||||
|
SetBolus(40),
|
||||||
|
CancelBolus(41),
|
||||||
|
|
||||||
|
ConfigureAlerts(50),
|
||||||
|
AcknowledgeAlerts(51),
|
||||||
|
|
||||||
|
SuspendDelivery(60),
|
||||||
|
ResumeDelivery(61)
|
||||||
|
;
|
||||||
|
|
||||||
|
private int code;
|
||||||
|
|
||||||
|
PodDbEntryType(int code) {
|
||||||
|
|
||||||
|
this.code = code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getCode() {
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
}
|
|
@ -7,7 +7,7 @@ import info.nightscout.androidaps.logging.L;
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.OmnipodPumpPlugin;
|
import info.nightscout.androidaps.plugins.pump.omnipod.OmnipodPumpPlugin;
|
||||||
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.OmnipodCommandType;
|
import info.nightscout.androidaps.plugins.pump.omnipod.defs.OmnipodCommandType;
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.service.OmnipodPumpStatus;
|
import info.nightscout.androidaps.plugins.pump.omnipod.driver.OmnipodPumpStatus;
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.util.OmnipodUtil;
|
import info.nightscout.androidaps.plugins.pump.omnipod.util.OmnipodUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -6,7 +6,7 @@ import org.slf4j.LoggerFactory;
|
||||||
import info.nightscout.androidaps.logging.L;
|
import info.nightscout.androidaps.logging.L;
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.OmnipodPumpPlugin;
|
import info.nightscout.androidaps.plugins.pump.omnipod.OmnipodPumpPlugin;
|
||||||
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.service.OmnipodPumpStatus;
|
import info.nightscout.androidaps.plugins.pump.omnipod.driver.OmnipodPumpStatus;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by andy on 4.8.2019
|
* Created by andy on 4.8.2019
|
||||||
|
|
|
@ -66,7 +66,7 @@ public class OmnipodUITask {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DeactivatePod:
|
case DeactivatePod:
|
||||||
returnData = communicationManager.deactivatePod();
|
returnData = communicationManager.deactivatePod((PodInitReceiver) parameters[0]);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ResetPodStatus:
|
case ResetPodStatus:
|
||||||
|
|
|
@ -28,6 +28,7 @@ import info.nightscout.androidaps.plugins.pump.omnipod.OmnipodPumpPlugin;
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.OmnipodCommunicationService;
|
import info.nightscout.androidaps.plugins.pump.omnipod.comm.OmnipodCommunicationService;
|
||||||
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.driver.OmnipodPumpStatus;
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.util.OmnipodConst;
|
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.utils.SP;
|
import info.nightscout.androidaps.utils.SP;
|
||||||
|
|
|
@ -31,7 +31,7 @@ import info.nightscout.androidaps.plugins.pump.omnipod.defs.OmnipodPumpPluginInt
|
||||||
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;
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.service.OmnipodPumpStatus;
|
import info.nightscout.androidaps.plugins.pump.omnipod.driver.OmnipodPumpStatus;
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.service.RileyLinkOmnipodService;
|
import info.nightscout.androidaps.plugins.pump.omnipod.service.RileyLinkOmnipodService;
|
||||||
import info.nightscout.androidaps.utils.OKDialog;
|
import info.nightscout.androidaps.utils.OKDialog;
|
||||||
|
|
||||||
|
@ -48,8 +48,8 @@ public class OmnipodUtil extends RileyLinkUtil {
|
||||||
private static OmnipodPumpStatus omnipodPumpStatus;
|
private static OmnipodPumpStatus omnipodPumpStatus;
|
||||||
private static OmnipodCommandType currentCommand;
|
private static OmnipodCommandType currentCommand;
|
||||||
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 OmnipodPumpPluginInterface omnipodPumpPlugin;
|
private static OmnipodPumpPluginInterface omnipodPumpPlugin;
|
||||||
private static OmnipodPodType omnipodPodType;
|
private static OmnipodPodType omnipodPodType;
|
||||||
|
|
||||||
|
@ -170,14 +170,9 @@ public class OmnipodUtil extends RileyLinkUtil {
|
||||||
RxBus.INSTANCE.send(new EventOmnipodDeviceStatusChange(podSessionState));
|
RxBus.INSTANCE.send(new EventOmnipodDeviceStatusChange(podSessionState));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
|
||||||
public static PodDeviceState getPodDeviceState() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
public static void setPodDeviceState(PodDeviceState podSessionState) {
|
||||||
public static void setPodDeviceState(PodDeviceState podDeviceState) {
|
omnipodPumpStatus.podDeviceState = podSessionState;
|
||||||
OmnipodUtil.podDeviceState = podDeviceState;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -200,4 +195,13 @@ public class OmnipodUtil extends RileyLinkUtil {
|
||||||
public static OmnipodPodType getOmnipodPodType() {
|
public static OmnipodPodType getOmnipodPodType() {
|
||||||
return omnipodPodType;
|
return omnipodPodType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static PodDeviceState getPodDeviceState() {
|
||||||
|
return omnipodPumpStatus.podDeviceState;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static PodSessionState getPodSessionState() {
|
||||||
|
return omnipodPumpStatus.podSessionState;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,7 @@ import info.nightscout.androidaps.plugins.pump.omnipod.defs.OmnipodCommunication
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.PodInitActionType;
|
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.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.service.OmnipodPumpStatus;
|
import info.nightscout.androidaps.plugins.pump.omnipod.driver.OmnipodPumpStatus;
|
||||||
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;
|
||||||
|
|
||||||
|
@ -73,7 +73,7 @@ public class OmnipodDashCommunicationManager implements OmnipodCommunicationMana
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public PumpEnactResult deactivatePod() {
|
public PumpEnactResult deactivatePod(PodInitReceiver podInitReceiver) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1654,6 +1654,7 @@
|
||||||
<string name="omnipod_cmd_init_pod_na">Init Pod not available at the moment.</string>
|
<string name="omnipod_cmd_init_pod_na">Init Pod not available at the moment.</string>
|
||||||
<string name="omnipod_cmd_deactivate_pod_na">Deactivate Pod not available at the moment.</string>
|
<string name="omnipod_cmd_deactivate_pod_na">Deactivate Pod not available at the moment.</string>
|
||||||
<string name="omnipod_cmd_reset_pod_na">Reset Pod not available at the moment.</string>
|
<string name="omnipod_cmd_reset_pod_na">Reset Pod not available at the moment.</string>
|
||||||
|
<string name="omnipod_cmd_reset_pod_desc">If you press "OK" Pod will be forcefully removed. Do this only if Deactivate Pod fails.</string>
|
||||||
<string name="omnipod_cmd_pod_history_na">Pod History not available at the moment.</string>
|
<string name="omnipod_cmd_pod_history_na">Pod History not available at the moment.</string>
|
||||||
|
|
||||||
<string name="omnipod_namex" translatable="false">Omnipod</string>
|
<string name="omnipod_namex" translatable="false">Omnipod</string>
|
||||||
|
@ -1676,6 +1677,8 @@
|
||||||
<string name="omnipod_init_pod_prime_pod">Prime Pod</string>
|
<string name="omnipod_init_pod_prime_pod">Prime Pod</string>
|
||||||
<string name="omnipod_init_pod_fill_cannula">Fill Cannula</string>
|
<string name="omnipod_init_pod_fill_cannula">Fill Cannula</string>
|
||||||
<string name="omnipod_init_pod_set_basal_profile">Set Basal Profile</string>
|
<string name="omnipod_init_pod_set_basal_profile">Set Basal Profile</string>
|
||||||
|
<string name="omnipod_deactivate_pod_cancel_delivery">Cancel Delivery</string>
|
||||||
|
<string name="omnipod_deactivate_pod_deactivate_pod">Deactivate Pod</string>
|
||||||
|
|
||||||
|
|
||||||
<!-- Omnipod Dash -->
|
<!-- Omnipod Dash -->
|
||||||
|
|
Loading…
Reference in a new issue