Remove unused Dash code
This commit is contained in:
parent
a3cb8ff648
commit
5bd873cd0e
17 changed files with 31 additions and 577 deletions
|
@ -59,7 +59,7 @@ import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.tasks
|
||||||
import info.nightscout.androidaps.plugins.pump.common.utils.DateTimeUtil;
|
import info.nightscout.androidaps.plugins.pump.common.utils.DateTimeUtil;
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.response.podinfo.PodInfoRecentPulseLog;
|
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.response.podinfo.PodInfoRecentPulseLog;
|
||||||
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.IOmnipodManager;
|
||||||
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.OmnipodPumpPluginInterface;
|
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.OmnipodStatusRequest;
|
||||||
|
@ -107,7 +107,7 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPump
|
||||||
private boolean isBasalProfileInvalid = false;
|
private boolean isBasalProfileInvalid = false;
|
||||||
private boolean basalProfileChanged = false;
|
private boolean basalProfileChanged = false;
|
||||||
private boolean isInitialized = false;
|
private boolean isInitialized = false;
|
||||||
protected OmnipodCommunicationManagerInterface omnipodCommunicationManager;
|
protected IOmnipodManager omnipodCommunicationManager;
|
||||||
|
|
||||||
// TODO make non-static just inject the Singleton and use a getter)
|
// TODO make non-static just inject the Singleton and use a getter)
|
||||||
public static boolean isBusy = false;
|
public static boolean isBusy = false;
|
||||||
|
|
|
@ -50,7 +50,7 @@ import info.nightscout.androidaps.plugins.pump.omnipod.util.OmnipodConst;
|
||||||
/**
|
/**
|
||||||
* Created by andy on 6/29/18.
|
* Created by andy on 6/29/18.
|
||||||
*/
|
*/
|
||||||
// TODO make singleton
|
// TODO make singleton and rename to OmnipodRileyLinkCommunicationManager
|
||||||
public class OmnipodCommunicationManager extends RileyLinkCommunicationManager {
|
public class OmnipodCommunicationManager extends RileyLinkCommunicationManager {
|
||||||
|
|
||||||
@Inject public AAPSLogger aapsLogger;
|
@Inject public AAPSLogger aapsLogger;
|
||||||
|
|
|
@ -6,9 +6,9 @@ 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.message.response.podinfo.PodInfoRecentPulseLog;
|
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.response.podinfo.PodInfoRecentPulseLog;
|
||||||
|
|
||||||
public interface OmnipodCommunicationManagerInterface {
|
// TODO remove?
|
||||||
|
// We only have this interface for possible Omnipod Dash implementation
|
||||||
// TODO add methods that can be used by OmniPod Eros and Omnipod Dash
|
public interface IOmnipodManager {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize Pod
|
* Initialize Pod
|
|
@ -1,6 +0,0 @@
|
||||||
package info.nightscout.androidaps.plugins.pump.omnipod.defs;
|
|
||||||
|
|
||||||
public enum OmnipodPodType {
|
|
||||||
Eros, //
|
|
||||||
Dash
|
|
||||||
}
|
|
|
@ -2,7 +2,6 @@ package info.nightscout.androidaps.plugins.pump.omnipod.defs;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import info.nightscout.androidaps.R;
|
import info.nightscout.androidaps.R;
|
||||||
|
|
||||||
|
@ -18,32 +17,23 @@ public enum PodInitActionType {
|
||||||
|
|
||||||
DeactivatePodWizardStep(), //
|
DeactivatePodWizardStep(), //
|
||||||
CancelDelivery(R.string.omnipod_deactivate_pod_cancel_delivery, DeactivatePodWizardStep), //
|
CancelDelivery(R.string.omnipod_deactivate_pod_cancel_delivery, DeactivatePodWizardStep), //
|
||||||
DeactivatePod(R.string.omnipod_deactivate_pod_deactivate_pod, DeactivatePodWizardStep) //
|
DeactivatePod(R.string.omnipod_deactivate_pod_deactivate_pod, DeactivatePodWizardStep);
|
||||||
;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private int resourceId;
|
private int resourceId;
|
||||||
private PodInitActionType parent;
|
private PodInitActionType parent;
|
||||||
|
|
||||||
private static Map<PodInitActionType, List<PodInitActionType>> stepsForWizardStep;
|
|
||||||
|
|
||||||
|
|
||||||
PodInitActionType(int resourceId, PodInitActionType parent) {
|
PodInitActionType(int resourceId, PodInitActionType parent) {
|
||||||
this.resourceId = resourceId;
|
this.resourceId = resourceId;
|
||||||
this.parent = parent;
|
this.parent = parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
PodInitActionType() {
|
PodInitActionType() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public boolean isParent() {
|
public boolean isParent() {
|
||||||
return this.parent == null;
|
return this.parent == null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public List<PodInitActionType> getChildren() {
|
public List<PodInitActionType> getChildren() {
|
||||||
|
|
||||||
List<PodInitActionType> outList = new ArrayList<>();
|
List<PodInitActionType> outList = new ArrayList<>();
|
||||||
|
@ -57,30 +47,6 @@ public enum PodInitActionType {
|
||||||
return outList;
|
return outList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static List<PodInitActionType> getAvailableWizardSteps(OmnipodPodType podType) {
|
|
||||||
List<PodInitActionType> outList = new ArrayList<>();
|
|
||||||
|
|
||||||
if (podType == OmnipodPodType.Eros) {
|
|
||||||
outList.add(PodInitActionType.PairAndPrimeWizardStep);
|
|
||||||
outList.add(PodInitActionType.FillCannulaSetBasalProfileWizardStep);
|
|
||||||
} 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<>();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public int getResourceId() {
|
public int getResourceId() {
|
||||||
return resourceId;
|
return resourceId;
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,7 +56,7 @@ import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.response.Sta
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.response.podinfo.PodInfoRecentPulseLog;
|
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.response.podinfo.PodInfoRecentPulseLog;
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.response.podinfo.PodInfoResponse;
|
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.response.podinfo.PodInfoResponse;
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.FaultEventCode;
|
import info.nightscout.androidaps.plugins.pump.omnipod.defs.FaultEventCode;
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.OmnipodCommunicationManagerInterface;
|
import info.nightscout.androidaps.plugins.pump.omnipod.defs.IOmnipodManager;
|
||||||
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.PodInitActionType;
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.PodInitReceiver;
|
import info.nightscout.androidaps.plugins.pump.omnipod.defs.PodInitReceiver;
|
||||||
|
@ -73,7 +73,7 @@ import info.nightscout.androidaps.utils.sharedPreferences.SP;
|
||||||
import io.reactivex.disposables.Disposable;
|
import io.reactivex.disposables.Disposable;
|
||||||
|
|
||||||
// TODO make singleton
|
// TODO make singleton
|
||||||
public class AapsOmnipodManager implements OmnipodCommunicationManagerInterface {
|
public class AapsOmnipodManager implements IOmnipodManager {
|
||||||
|
|
||||||
private final PodStateManager podStateManager;
|
private final PodStateManager podStateManager;
|
||||||
private final OmnipodUtil omnipodUtil;
|
private final OmnipodUtil omnipodUtil;
|
||||||
|
|
|
@ -5,7 +5,7 @@ import info.nightscout.androidaps.logging.AAPSLogger;
|
||||||
import info.nightscout.androidaps.logging.LTag;
|
import info.nightscout.androidaps.logging.LTag;
|
||||||
import info.nightscout.androidaps.plugins.pump.common.defs.DeviceCommandExecutor;
|
import info.nightscout.androidaps.plugins.pump.common.defs.DeviceCommandExecutor;
|
||||||
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.IOmnipodManager;
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.util.OmnipodUtil;
|
import info.nightscout.androidaps.plugins.pump.omnipod.util.OmnipodUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -16,7 +16,7 @@ public class OmnipodUIComm implements DeviceCommandExecutor {
|
||||||
private final HasAndroidInjector injector;
|
private final HasAndroidInjector injector;
|
||||||
private final AAPSLogger aapsLogger;
|
private final AAPSLogger aapsLogger;
|
||||||
private final OmnipodUtil omnipodUtil;
|
private final OmnipodUtil omnipodUtil;
|
||||||
private final OmnipodCommunicationManagerInterface omnipodCommunicationManager;
|
private final IOmnipodManager omnipodCommunicationManager;
|
||||||
private final OmnipodUIPostprocessor omnipodUIPostprocessor;
|
private final OmnipodUIPostprocessor omnipodUIPostprocessor;
|
||||||
|
|
||||||
public OmnipodUIComm(
|
public OmnipodUIComm(
|
||||||
|
@ -24,7 +24,7 @@ public class OmnipodUIComm implements DeviceCommandExecutor {
|
||||||
AAPSLogger aapsLogger,
|
AAPSLogger aapsLogger,
|
||||||
OmnipodUtil omnipodUtil,
|
OmnipodUtil omnipodUtil,
|
||||||
OmnipodUIPostprocessor omnipodUIPostprocessor,
|
OmnipodUIPostprocessor omnipodUIPostprocessor,
|
||||||
OmnipodCommunicationManagerInterface omnipodCommunicationManager
|
IOmnipodManager omnipodCommunicationManager
|
||||||
) {
|
) {
|
||||||
this.injector = injector;
|
this.injector = injector;
|
||||||
this.aapsLogger = aapsLogger;
|
this.aapsLogger = aapsLogger;
|
||||||
|
|
|
@ -11,7 +11,7 @@ import info.nightscout.androidaps.logging.LTag;
|
||||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper;
|
import info.nightscout.androidaps.plugins.bus.RxBusWrapper;
|
||||||
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.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.IOmnipodManager;
|
||||||
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.PodInitActionType;
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.PodInitReceiver;
|
import info.nightscout.androidaps.plugins.pump.omnipod.defs.PodInitReceiver;
|
||||||
|
@ -57,7 +57,7 @@ public class OmnipodUITask {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void execute(OmnipodCommunicationManagerInterface communicationManager) {
|
public void execute(IOmnipodManager communicationManager) {
|
||||||
|
|
||||||
|
|
||||||
aapsLogger.debug(LTag.PUMP, "OmnipodUITask: @@@ In execute. {}", commandType);
|
aapsLogger.debug(LTag.PUMP, "OmnipodUITask: @@@ In execute. {}", commandType);
|
||||||
|
|
|
@ -27,7 +27,6 @@ import info.nightscout.androidaps.plugins.pump.omnipod.defs.AlertSet;
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.AlertSlot;
|
import info.nightscout.androidaps.plugins.pump.omnipod.defs.AlertSlot;
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.AlertType;
|
import info.nightscout.androidaps.plugins.pump.omnipod.defs.AlertType;
|
||||||
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.PodStateManager;
|
import info.nightscout.androidaps.plugins.pump.omnipod.defs.state.PodStateManager;
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.OmnipodDriverState;
|
import info.nightscout.androidaps.plugins.pump.omnipod.driver.OmnipodDriverState;
|
||||||
|
@ -51,7 +50,6 @@ public class OmnipodUtil {
|
||||||
private boolean lowLevelDebug = true;
|
private boolean lowLevelDebug = true;
|
||||||
private OmnipodCommandType currentCommand;
|
private OmnipodCommandType currentCommand;
|
||||||
private Gson gsonInstance = createGson();
|
private Gson gsonInstance = createGson();
|
||||||
private OmnipodPodType omnipodPodType;
|
|
||||||
private OmnipodDriverState driverState = OmnipodDriverState.NotInitalized;
|
private OmnipodDriverState driverState = OmnipodDriverState.NotInitalized;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
|
@ -131,26 +129,10 @@ public class OmnipodUtil {
|
||||||
omnipodPumpStatus.podDeviceState = podDeviceState;
|
omnipodPumpStatus.podDeviceState = podDeviceState;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setOmnipodPodType(OmnipodPodType omnipodPodType) {
|
|
||||||
this.omnipodPodType = omnipodPodType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public OmnipodPodType getOmnipodPodType() {
|
|
||||||
return this.omnipodPodType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public PodDeviceState getPodDeviceState() {
|
public PodDeviceState getPodDeviceState() {
|
||||||
return omnipodPumpStatus.podDeviceState;
|
return omnipodPumpStatus.podDeviceState;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isOmnipodEros() {
|
|
||||||
return this.activePlugins.getActivePump().model() == PumpType.Insulet_Omnipod;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isOmnipodDash() {
|
|
||||||
return this.activePlugins.getActivePump().model() == PumpType.Insulet_Omnipod_Dash;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPumpType(PumpType pumpType_) {
|
public void setPumpType(PumpType pumpType_) {
|
||||||
omnipodPumpStatus.pumpType = pumpType_;
|
omnipodPumpStatus.pumpType = pumpType_;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,314 +0,0 @@
|
||||||
package info.nightscout.androidaps.plugins.pump.omnipod_dash;
|
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.os.Bundle;
|
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import javax.inject.Inject;
|
|
||||||
|
|
||||||
import dagger.android.HasAndroidInjector;
|
|
||||||
import info.nightscout.androidaps.BuildConfig;
|
|
||||||
import info.nightscout.androidaps.R;
|
|
||||||
import info.nightscout.androidaps.data.Profile;
|
|
||||||
import info.nightscout.androidaps.interfaces.ActivePluginProvider;
|
|
||||||
import info.nightscout.androidaps.interfaces.CommandQueueProvider;
|
|
||||||
import info.nightscout.androidaps.interfaces.PluginDescription;
|
|
||||||
import info.nightscout.androidaps.interfaces.PluginType;
|
|
||||||
import info.nightscout.androidaps.logging.AAPSLogger;
|
|
||||||
import info.nightscout.androidaps.logging.L;
|
|
||||||
import info.nightscout.androidaps.logging.LTag;
|
|
||||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper;
|
|
||||||
import info.nightscout.androidaps.plugins.general.actions.defs.CustomAction;
|
|
||||||
import info.nightscout.androidaps.plugins.pump.common.defs.PumpDriverState;
|
|
||||||
import info.nightscout.androidaps.plugins.pump.common.defs.PumpType;
|
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.OmnipodFragment;
|
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.OmnipodPumpPlugin;
|
|
||||||
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.EventOmnipodRefreshButtonState;
|
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.service.RileyLinkOmnipodService;
|
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod_dash.comm.OmnipodDashCommunicationManager;
|
|
||||||
import info.nightscout.androidaps.utils.DateUtil;
|
|
||||||
import info.nightscout.androidaps.utils.FabricPrivacy;
|
|
||||||
import info.nightscout.androidaps.utils.TimeChangeType;
|
|
||||||
import info.nightscout.androidaps.utils.resources.ResourceHelper;
|
|
||||||
import info.nightscout.androidaps.utils.sharedPreferences.SP;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by andy on 23.04.18.
|
|
||||||
*
|
|
||||||
* @author Andy Rozman (andy.rozman@gmail.com)
|
|
||||||
*/
|
|
||||||
// FIXME this is just placeholder for now, but this should use most of OmnipodPumpPlugin implementation
|
|
||||||
public class OmnipodDashPumpPlugin extends OmnipodPumpPlugin implements OmnipodPumpPluginInterface {
|
|
||||||
|
|
||||||
// TODO Dagger
|
|
||||||
//private static final Logger LOG = LoggerFactory.getLogger(L.PUMP);
|
|
||||||
|
|
||||||
//private RileyLinkOmnipodService omnipodService;
|
|
||||||
//private OmnipodPumpStatus pumpStatusLocal = null;
|
|
||||||
|
|
||||||
// variables for handling statuses and history
|
|
||||||
private boolean firstRun = true;
|
|
||||||
private boolean isRefresh = false;
|
|
||||||
private boolean isBasalProfileInvalid = false;
|
|
||||||
private boolean basalProfileChanged = false;
|
|
||||||
private boolean isInitialized = false;
|
|
||||||
|
|
||||||
public static boolean isBusy = false;
|
|
||||||
//private List<Long> busyTimestamps = new ArrayList<>();
|
|
||||||
//private boolean sentIdToFirebase = false;
|
|
||||||
//private boolean hasTimeDateOrTimeZoneChanged = false;
|
|
||||||
|
|
||||||
private Profile currentProfile;
|
|
||||||
|
|
||||||
//@Inject
|
|
||||||
public OmnipodDashPumpPlugin(HasAndroidInjector injector,
|
|
||||||
AAPSLogger aapsLogger,
|
|
||||||
RxBusWrapper rxBus,
|
|
||||||
Context context,
|
|
||||||
ResourceHelper resourceHelper,
|
|
||||||
ActivePluginProvider activePlugin,
|
|
||||||
SP sp,
|
|
||||||
CommandQueueProvider commandQueue,
|
|
||||||
FabricPrivacy fabricPrivacy,
|
|
||||||
DateUtil dateUtil
|
|
||||||
) {
|
|
||||||
super(new PluginDescription() //
|
|
||||||
.mainType(PluginType.PUMP) //
|
|
||||||
.fragmentClass(OmnipodFragment.class.getName()) //
|
|
||||||
.pluginName(R.string.omnipod_dash_name) //
|
|
||||||
.shortName(R.string.omnipod_dash_name_short) //
|
|
||||||
.preferencesId(R.xml.pref_omnipod) //
|
|
||||||
.description(R.string.description_pump_omnipod_dash), //
|
|
||||||
PumpType.Insulet_Omnipod_Dash,
|
|
||||||
injector, aapsLogger, rxBus, context, resourceHelper, activePlugin, sp, commandQueue, fabricPrivacy, dateUtil
|
|
||||||
);
|
|
||||||
|
|
||||||
displayConnectionMessages = false;
|
|
||||||
|
|
||||||
//OmnipodUtil.setOmnipodPodType(OmnipodPodType.Dash);
|
|
||||||
|
|
||||||
if (omnipodCommunicationManager == null) {
|
|
||||||
omnipodCommunicationManager = OmnipodDashCommunicationManager.getInstance();
|
|
||||||
}
|
|
||||||
|
|
||||||
// DG omnipodUIComm = new OmnipodUIComm(omnipodCommunicationManager, this, this.omnipodPumpStatus);
|
|
||||||
|
|
||||||
//OmnipodUtil.setPlugin(this);
|
|
||||||
|
|
||||||
// FIXME
|
|
||||||
// serviceConnection = new ServiceConnection() {
|
|
||||||
//
|
|
||||||
// public void onServiceDisconnected(ComponentName name) {
|
|
||||||
// if (isLoggingEnabled())
|
|
||||||
// aapsLogger.debug(LTag.PUMP, "RileyLinkOmnipodService is disconnected");
|
|
||||||
// omnipodService = null;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// public void onServiceConnected(ComponentName name, IBinder service) {
|
|
||||||
// if (isLoggingEnabled())
|
|
||||||
// aapsLogger.debug(LTag.PUMP, "RileyLinkOmnipodService is connected");
|
|
||||||
// RileyLinkOmnipodService.LocalBinder mLocalBinder = (RileyLinkOmnipodService.LocalBinder) service;
|
|
||||||
// omnipodService = mLocalBinder.getServiceInstance();
|
|
||||||
//
|
|
||||||
// new Thread(() -> {
|
|
||||||
//
|
|
||||||
// for (int i = 0; i < 20; i++) {
|
|
||||||
// SystemClock.sleep(5000);
|
|
||||||
//
|
|
||||||
// if (OmnipodUtil.getPumpStatus() != null) {
|
|
||||||
// if (isLoggingEnabled())
|
|
||||||
// aapsLogger.debug(LTag.PUMP, "Starting OmniPod-RileyLink service");
|
|
||||||
// if (OmnipodUtil.getPumpStatus().setNotInPreInit()) {
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }).start();
|
|
||||||
// }
|
|
||||||
// };
|
|
||||||
}
|
|
||||||
|
|
||||||
private String getLogPrefix() {
|
|
||||||
return "OmnipodPlugin::";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// FIXME
|
|
||||||
public Class getServiceClass() {
|
|
||||||
return RileyLinkOmnipodService.class;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onStart() {
|
|
||||||
super.onStart();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String deviceID() {
|
|
||||||
return "Omnipod Dash";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Pump Plugin
|
|
||||||
|
|
||||||
private boolean isServiceSet() {
|
|
||||||
return true; //omnipodService != null;
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean isServiceInitialized() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isInitialized() {
|
|
||||||
if (displayConnectionMessages)
|
|
||||||
aapsLogger.debug(LTag.PUMP, getLogPrefix() + "isInitialized");
|
|
||||||
return isServiceSet() && isInitialized;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isConnected() {
|
|
||||||
if (displayConnectionMessages)
|
|
||||||
aapsLogger.debug(LTag.PUMP, getLogPrefix() + "isConnected");
|
|
||||||
return isServiceSet() && isServiceInitialized();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isConnecting() {
|
|
||||||
if (displayConnectionMessages)
|
|
||||||
aapsLogger.debug(LTag.PUMP, getLogPrefix() + "isConnecting");
|
|
||||||
return !isServiceSet() || !isServiceInitialized();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void getPumpStatus() {
|
|
||||||
|
|
||||||
if (firstRun) {
|
|
||||||
initializePump(!isRefresh);
|
|
||||||
}
|
|
||||||
|
|
||||||
// getPodPumpStatus();
|
|
||||||
//
|
|
||||||
// if (firstRun) {
|
|
||||||
// initializePump(!isRefresh);
|
|
||||||
// } else {
|
|
||||||
// refreshAnyStatusThatNeedsToBeRefreshed();
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// MainApp.bus().post(new EventMedtronicPumpValuesChanged());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public void resetStatusState() {
|
|
||||||
firstRun = true;
|
|
||||||
isRefresh = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private void setRefreshButtonEnabled(boolean enabled) {
|
|
||||||
rxBus.send(new EventOmnipodRefreshButtonState(enabled));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private void initializePump(boolean realInit) {
|
|
||||||
|
|
||||||
aapsLogger.info(LTag.PUMP, getLogPrefix() + "initializePump - start");
|
|
||||||
|
|
||||||
if (omnipodCommunicationManager == null) {
|
|
||||||
omnipodCommunicationManager = OmnipodDashCommunicationManager.getInstance();
|
|
||||||
}
|
|
||||||
|
|
||||||
// setRefreshButtonEnabled(false);
|
|
||||||
//
|
|
||||||
// getPodPumpStatus();
|
|
||||||
//
|
|
||||||
// if (isRefresh) {
|
|
||||||
// if (isPumpNotReachable()) {
|
|
||||||
// if (isLoggingEnabled())
|
|
||||||
// LOG.error(getLogPrefix() + "initializePump::Pump unreachable.");
|
|
||||||
// MedtronicUtil.sendNotification(MedtronicNotificationType.PumpUnreachable);
|
|
||||||
//
|
|
||||||
// setRefreshButtonEnabled(true);
|
|
||||||
//
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// MedtronicUtil.dismissNotification(MedtronicNotificationType.PumpUnreachable);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// this.pumpState = PumpDriverState.Connected;
|
|
||||||
//
|
|
||||||
// pumpStatusLocal.setLastCommunicationToNow();
|
|
||||||
// setRefreshButtonEnabled(true);
|
|
||||||
|
|
||||||
// TODO need to read status and BasalProfile if pod inited and pod status and set correct commands enabled
|
|
||||||
|
|
||||||
if (!isRefresh) {
|
|
||||||
pumpState = PumpDriverState.Initialized;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!sentIdToFirebase) {
|
|
||||||
Bundle params = new Bundle();
|
|
||||||
params.putString("version", BuildConfig.VERSION);
|
|
||||||
//fabricPrivacy.logCustom().logEvent("OmnipodPumpInit", params);
|
|
||||||
|
|
||||||
sentIdToFirebase = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
isInitialized = true;
|
|
||||||
// this.pumpState = PumpDriverState.Initialized;
|
|
||||||
|
|
||||||
this.firstRun = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
protected void triggerUIChange() {
|
|
||||||
rxBus.send(new EventOmnipodPumpValuesChanged());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// OPERATIONS not supported by Pump or Plugin
|
|
||||||
|
|
||||||
//private List<CustomAction> customActions = null;
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<CustomAction> getCustomActions() {
|
|
||||||
|
|
||||||
if (customActions == null) {
|
|
||||||
this.customActions = Arrays.asList(
|
|
||||||
// customActionPairAndPrime, //
|
|
||||||
// customActionFillCanullaSetBasalProfile, //
|
|
||||||
// customActionDeactivatePod, //
|
|
||||||
// customActionResetPod
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return this.customActions;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void timezoneOrDSTChanged(TimeChangeType timeChangeType) {
|
|
||||||
|
|
||||||
// if (isLoggingEnabled())
|
|
||||||
// LOG.warn(getLogPrefix() + "Time, Date and/or TimeZone changed. ");
|
|
||||||
//
|
|
||||||
// this.hasTimeDateOrTimeZoneChanged = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,124 +0,0 @@
|
||||||
package info.nightscout.androidaps.plugins.pump.omnipod_dash.comm;
|
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
|
|
||||||
import info.nightscout.androidaps.data.DetailedBolusInfo;
|
|
||||||
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.hw.rileylink.ble.RFSpy;
|
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.response.podinfo.PodInfoRecentPulseLog;
|
|
||||||
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.PodStateManager;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by andy on 4.8.2019
|
|
||||||
*/
|
|
||||||
// TODO refactor to use dagger, just commented out errors
|
|
||||||
// TODO is this class used? remove if not
|
|
||||||
public class OmnipodDashCommunicationManager implements OmnipodCommunicationManagerInterface {
|
|
||||||
|
|
||||||
// TODO Dagger
|
|
||||||
|
|
||||||
// private static final Logger LOG = LoggerFactory.getLogger(L.PUMPCOMM);
|
|
||||||
|
|
||||||
// i didn't find where you instantiate this
|
|
||||||
private static OmnipodDashCommunicationManager omnipodCommunicationManager;
|
|
||||||
private String errorMessage;
|
|
||||||
|
|
||||||
|
|
||||||
public OmnipodDashCommunicationManager(Context context, RFSpy rfspy) {
|
|
||||||
omnipodCommunicationManager = this;
|
|
||||||
// OmnipodUtil.getPumpStatus().previousConnection = SP.getLong(
|
|
||||||
// RileyLinkConst.Prefs.LastGoodDeviceCommunicationTime, 0L);
|
|
||||||
}
|
|
||||||
|
|
||||||
private PodStateManager getPodStateManager() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
public static OmnipodDashCommunicationManager getInstance() {
|
|
||||||
return omnipodCommunicationManager;
|
|
||||||
}
|
|
||||||
|
|
||||||
//@Override
|
|
||||||
protected void configurePumpSpecificSettings() {
|
|
||||||
//pumpStatus = OmnipodUtil.getPumpStatus();
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getErrorResponse() {
|
|
||||||
return this.errorMessage;
|
|
||||||
}
|
|
||||||
|
|
||||||
// private boolean isLogEnabled() {
|
|
||||||
// return L.isEnabled(L.PUMPCOMM);
|
|
||||||
// }
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public PumpEnactResult initPod(PodInitActionType podInitActionType, PodInitReceiver podInitReceiver, Profile profile) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public PumpEnactResult getPodStatus() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public PumpEnactResult deactivatePod(PodInitReceiver podInitReceiver) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public PumpEnactResult setBasalProfile(Profile profile) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public PumpEnactResult resetPodStatus() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public PumpEnactResult setBolus(DetailedBolusInfo detailedBolusInfo) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public PumpEnactResult setBolus(Double parameter, boolean isSmb) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public PumpEnactResult cancelBolus() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public PumpEnactResult setTemporaryBasal(TempBasalPair tbr) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public PumpEnactResult cancelTemporaryBasal() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public PumpEnactResult acknowledgeAlerts() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public PumpEnactResult setTime() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public PodInfoRecentPulseLog readPulseLog() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,24 +0,0 @@
|
||||||
package info.nightscout.androidaps.plugins.pump.omnipod_dash.driver;
|
|
||||||
|
|
||||||
import javax.inject.Inject;
|
|
||||||
import javax.inject.Singleton;
|
|
||||||
|
|
||||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper;
|
|
||||||
import info.nightscout.androidaps.plugins.pump.common.defs.PumpType;
|
|
||||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkUtil;
|
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.OmnipodPumpStatus;
|
|
||||||
import info.nightscout.androidaps.utils.resources.ResourceHelper;
|
|
||||||
import info.nightscout.androidaps.utils.sharedPreferences.SP;
|
|
||||||
|
|
||||||
@Singleton
|
|
||||||
public class OmnipodDashPumpStatus extends OmnipodPumpStatus {
|
|
||||||
|
|
||||||
@Inject
|
|
||||||
public OmnipodDashPumpStatus(ResourceHelper resourceHelper,
|
|
||||||
SP sp,
|
|
||||||
RxBusWrapper rxBus,
|
|
||||||
RileyLinkUtil rileyLinkUtil) {
|
|
||||||
super(resourceHelper, sp, rxBus, rileyLinkUtil);
|
|
||||||
this.pumpType = PumpType.Insulet_Omnipod_Dash;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1543,8 +1543,6 @@
|
||||||
<string name="omnipod_deactivate_pod_deactivate_pod">Deactivate Pod</string>
|
<string name="omnipod_deactivate_pod_deactivate_pod">Deactivate Pod</string>
|
||||||
|
|
||||||
|
|
||||||
<!-- Omnipod Dash -->
|
|
||||||
|
|
||||||
<!-- Omnipod - Base -->
|
<!-- Omnipod - Base -->
|
||||||
<string name="omnipod_dash_name" translatable="false">Omnipod Dash</string>
|
<string name="omnipod_dash_name" translatable="false">Omnipod Dash</string>
|
||||||
<string name="omnipod_dash_name_short" translatable="false">DASH</string>
|
<string name="omnipod_dash_name_short" translatable="false">DASH</string>
|
||||||
|
|
|
@ -104,12 +104,6 @@ public enum PumpType {
|
||||||
new DoseSettings(0.05d, 30, 12 * 60, 0d, 30.0d), PumpCapability.BasalRate_Duration30minAllowed, //
|
new DoseSettings(0.05d, 30, 12 * 60, 0d, 30.0d), PumpCapability.BasalRate_Duration30minAllowed, //
|
||||||
0.05d, null, 0.05d, null, PumpCapability.OmnipodCapabilities, true),
|
0.05d, null, 0.05d, null, PumpCapability.OmnipodCapabilities, true),
|
||||||
|
|
||||||
Insulet_Omnipod_Dash("Insulet Omnipod Dash", ManufacturerType.Insulet, "Omnipod Dash", 0.05d, null, //
|
|
||||||
new DoseSettings(0.05d, 30, 8 * 60, 0.05d), //
|
|
||||||
PumpTempBasalType.Absolute, //
|
|
||||||
new DoseSettings(0.05d, 30, 12 * 60, 0d, 30.0d), PumpCapability.BasalRate_Duration30minAllowed, //
|
|
||||||
0.05d, null, 0.05d, null, PumpCapability.OmnipodCapabilities, true), // 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), //
|
||||||
|
|
|
@ -119,15 +119,11 @@ public class RileyLinkBLEScanActivity extends NoSplashAppCompatActivity {
|
||||||
rileyLinkPump.triggerPumpConfigurationChangedEvent();
|
rileyLinkPump.triggerPumpConfigurationChangedEvent();
|
||||||
|
|
||||||
} else if (activePlugin.getActivePump().manufacturer() == ManufacturerType.Insulet) {
|
} else if (activePlugin.getActivePump().manufacturer() == ManufacturerType.Insulet) {
|
||||||
if (activePump.model() == PumpType.Insulet_Omnipod_Dash) {
|
|
||||||
aapsLogger.error("Omnipod Dash not yet implemented.");
|
|
||||||
} else {
|
|
||||||
RileyLinkPumpDevice rileyLinkPump = (RileyLinkPumpDevice) activePump;
|
RileyLinkPumpDevice rileyLinkPump = (RileyLinkPumpDevice) activePump;
|
||||||
rileyLinkPump.getRileyLinkService().verifyConfiguration(); // force reloading of address
|
rileyLinkPump.getRileyLinkService().verifyConfiguration(); // force reloading of address
|
||||||
|
|
||||||
rileyLinkPump.triggerPumpConfigurationChangedEvent();
|
rileyLinkPump.triggerPumpConfigurationChangedEvent();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
finish();
|
finish();
|
||||||
});
|
});
|
||||||
|
|
|
@ -154,13 +154,7 @@ public class RileyLinkStatusGeneralFragment extends DaggerFragment implements Re
|
||||||
PumpStatus pumpStatusData = pumpPlugin.getPumpStatusData();
|
PumpStatus pumpStatusData = pumpPlugin.getPumpStatusData();
|
||||||
|
|
||||||
this.deviceType.setText(resourceHelper.gs(RileyLinkTargetDevice.Omnipod.getResourceId()));
|
this.deviceType.setText(resourceHelper.gs(RileyLinkTargetDevice.Omnipod.getResourceId()));
|
||||||
this.deviceModel.setText(pumpPlugin.getPumpType() == PumpType.Insulet_Omnipod ? "Eros" : "Dash");
|
this.deviceModel.setText("Eros");
|
||||||
|
|
||||||
if (pumpPlugin.getPumpType()== PumpType.Insulet_Omnipod_Dash) {
|
|
||||||
aapsLogger.error("Omnipod Dash not yet supported !!!");
|
|
||||||
|
|
||||||
this.pumpFrequency.setText("-");
|
|
||||||
} else {
|
|
||||||
|
|
||||||
this.pumpFrequency.setText(resourceHelper.gs(R.string.omnipod_frequency));
|
this.pumpFrequency.setText(resourceHelper.gs(R.string.omnipod_frequency));
|
||||||
|
|
||||||
|
@ -189,6 +183,5 @@ public class RileyLinkStatusGeneralFragment extends DaggerFragment implements Re
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,13 +33,6 @@ public class DiscoverGattServicesTask extends ServiceTask {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
|
||||||
if (activePlugin.getActivePump().model() == PumpType.Insulet_Omnipod_Dash) {
|
|
||||||
// TODO different init classes, this can be probably removed later
|
|
||||||
aapsLogger.warn(LTag.PUMPCOMM, "Discovery Gatt Services not implemeneted for Dash.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
RileyLinkPumpDevice pumpDevice = (RileyLinkPumpDevice) activePlugin.getActivePump();
|
RileyLinkPumpDevice pumpDevice = (RileyLinkPumpDevice) activePlugin.getActivePump();
|
||||||
|
|
||||||
if (needToConnect) {
|
if (needToConnect) {
|
||||||
|
|
Loading…
Reference in a new issue