From 5bd873cd0ee0989d5ed05a4929e8eab4edceb7e8 Mon Sep 17 00:00:00 2001 From: Bart Sopers Date: Sun, 16 Aug 2020 13:22:31 +0200 Subject: [PATCH] Remove unused Dash code --- .../pump/omnipod/OmnipodPumpPlugin.java | 4 +- .../comm/OmnipodCommunicationManager.java | 2 +- ...gerInterface.java => IOmnipodManager.java} | 6 +- .../pump/omnipod/defs/OmnipodPodType.java | 6 - .../pump/omnipod/defs/PodInitActionType.java | 36 +- .../driver/comm/AapsOmnipodManager.java | 4 +- .../pump/omnipod/driver/ui/OmnipodUIComm.java | 6 +- .../pump/omnipod/driver/ui/OmnipodUITask.java | 4 +- .../pump/omnipod/util/OmnipodUtil.java | 18 - .../omnipod_dash/OmnipodDashPumpPlugin.java | 314 ------------------ .../comm/OmnipodDashCommunicationManager.java | 124 ------- .../driver/OmnipodDashPumpStatus.java | 24 -- app/src/main/res/values/strings.xml | 2 - .../plugins/pump/common/defs/PumpType.java | 6 - .../dialog/RileyLinkBLEScanActivity.java | 10 +- .../RileyLinkStatusGeneralFragment.java | 35 +- .../tasks/DiscoverGattServicesTask.java | 7 - 17 files changed, 31 insertions(+), 577 deletions(-) rename app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/defs/{OmnipodCommunicationManagerInterface.java => IOmnipodManager.java} (93%) delete mode 100644 app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/defs/OmnipodPodType.java delete mode 100644 app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod_dash/OmnipodDashPumpPlugin.java delete mode 100644 app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod_dash/comm/OmnipodDashCommunicationManager.java delete mode 100644 app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod_dash/driver/OmnipodDashPumpStatus.java diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/OmnipodPumpPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/OmnipodPumpPlugin.java index 0b8adf1235..c05ea34a75 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/OmnipodPumpPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/OmnipodPumpPlugin.java @@ -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.omnipod.comm.message.response.podinfo.PodInfoRecentPulseLog; 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.OmnipodPumpPluginInterface; 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 basalProfileChanged = false; private boolean isInitialized = false; - protected OmnipodCommunicationManagerInterface omnipodCommunicationManager; + protected IOmnipodManager omnipodCommunicationManager; // TODO make non-static just inject the Singleton and use a getter) public static boolean isBusy = false; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/OmnipodCommunicationManager.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/OmnipodCommunicationManager.java index db56ed905b..625ce5433f 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/OmnipodCommunicationManager.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/OmnipodCommunicationManager.java @@ -50,7 +50,7 @@ import info.nightscout.androidaps.plugins.pump.omnipod.util.OmnipodConst; /** * Created by andy on 6/29/18. */ -// TODO make singleton +// TODO make singleton and rename to OmnipodRileyLinkCommunicationManager public class OmnipodCommunicationManager extends RileyLinkCommunicationManager { @Inject public AAPSLogger aapsLogger; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/defs/OmnipodCommunicationManagerInterface.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/defs/IOmnipodManager.java similarity index 93% rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/defs/OmnipodCommunicationManagerInterface.java rename to app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/defs/IOmnipodManager.java index 7ad3b58799..649154f655 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/defs/OmnipodCommunicationManagerInterface.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/defs/IOmnipodManager.java @@ -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.omnipod.comm.message.response.podinfo.PodInfoRecentPulseLog; -public interface OmnipodCommunicationManagerInterface { - - // TODO add methods that can be used by OmniPod Eros and Omnipod Dash +// TODO remove? +// We only have this interface for possible Omnipod Dash implementation +public interface IOmnipodManager { /** * Initialize Pod diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/defs/OmnipodPodType.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/defs/OmnipodPodType.java deleted file mode 100644 index 849a22e5b0..0000000000 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/defs/OmnipodPodType.java +++ /dev/null @@ -1,6 +0,0 @@ -package info.nightscout.androidaps.plugins.pump.omnipod.defs; - -public enum OmnipodPodType { - Eros, // - Dash -} diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/defs/PodInitActionType.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/defs/PodInitActionType.java index c0a92ed2d7..6543bcc84f 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/defs/PodInitActionType.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/defs/PodInitActionType.java @@ -2,7 +2,6 @@ package info.nightscout.androidaps.plugins.pump.omnipod.defs; import java.util.ArrayList; import java.util.List; -import java.util.Map; import info.nightscout.androidaps.R; @@ -18,32 +17,23 @@ public enum PodInitActionType { 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 PodInitActionType parent; - private static Map> stepsForWizardStep; - - PodInitActionType(int resourceId, PodInitActionType parent) { this.resourceId = resourceId; this.parent = parent; } - PodInitActionType() { } - public boolean isParent() { return this.parent == null; } - public List getChildren() { List outList = new ArrayList<>(); @@ -57,30 +47,6 @@ public enum PodInitActionType { return outList; } - - public static List getAvailableWizardSteps(OmnipodPodType podType) { - List 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 getAvailableActionsForWizardSteps(PodInitActionType wizardStep) { - if (stepsForWizardStep.containsKey(wizardStep)) { - return stepsForWizardStep.get(wizardStep); - } else { - return new ArrayList<>(); - } - } - - public int getResourceId() { return resourceId; } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/driver/comm/AapsOmnipodManager.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/driver/comm/AapsOmnipodManager.java index a0c1034a1a..74177d79be 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/driver/comm/AapsOmnipodManager.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/driver/comm/AapsOmnipodManager.java @@ -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.PodInfoResponse; 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.PodInitActionType; 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; // TODO make singleton -public class AapsOmnipodManager implements OmnipodCommunicationManagerInterface { +public class AapsOmnipodManager implements IOmnipodManager { private final PodStateManager podStateManager; private final OmnipodUtil omnipodUtil; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/driver/ui/OmnipodUIComm.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/driver/ui/OmnipodUIComm.java index 8ccaae27e6..e906e82893 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/driver/ui/OmnipodUIComm.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/driver/ui/OmnipodUIComm.java @@ -5,7 +5,7 @@ import info.nightscout.androidaps.logging.AAPSLogger; import info.nightscout.androidaps.logging.LTag; 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.OmnipodCommunicationManagerInterface; +import info.nightscout.androidaps.plugins.pump.omnipod.defs.IOmnipodManager; import info.nightscout.androidaps.plugins.pump.omnipod.util.OmnipodUtil; /** @@ -16,7 +16,7 @@ public class OmnipodUIComm implements DeviceCommandExecutor { private final HasAndroidInjector injector; private final AAPSLogger aapsLogger; private final OmnipodUtil omnipodUtil; - private final OmnipodCommunicationManagerInterface omnipodCommunicationManager; + private final IOmnipodManager omnipodCommunicationManager; private final OmnipodUIPostprocessor omnipodUIPostprocessor; public OmnipodUIComm( @@ -24,7 +24,7 @@ public class OmnipodUIComm implements DeviceCommandExecutor { AAPSLogger aapsLogger, OmnipodUtil omnipodUtil, OmnipodUIPostprocessor omnipodUIPostprocessor, - OmnipodCommunicationManagerInterface omnipodCommunicationManager + IOmnipodManager omnipodCommunicationManager ) { this.injector = injector; this.aapsLogger = aapsLogger; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/driver/ui/OmnipodUITask.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/driver/ui/OmnipodUITask.java index e44bb1c8ab..cca3b4db4e 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/driver/ui/OmnipodUITask.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/driver/ui/OmnipodUITask.java @@ -11,7 +11,7 @@ import info.nightscout.androidaps.logging.LTag; import info.nightscout.androidaps.plugins.bus.RxBusWrapper; 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.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.PodInitActionType; 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); diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/util/OmnipodUtil.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/util/OmnipodUtil.java index de791fe65b..2f8a3712c7 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/util/OmnipodUtil.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/util/OmnipodUtil.java @@ -27,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.AlertType; import info.nightscout.androidaps.plugins.pump.omnipod.defs.OmnipodCommandType; -import info.nightscout.androidaps.plugins.pump.omnipod.defs.OmnipodPodType; import info.nightscout.androidaps.plugins.pump.omnipod.defs.PodDeviceState; import info.nightscout.androidaps.plugins.pump.omnipod.defs.state.PodStateManager; import info.nightscout.androidaps.plugins.pump.omnipod.driver.OmnipodDriverState; @@ -51,7 +50,6 @@ public class OmnipodUtil { private boolean lowLevelDebug = true; private OmnipodCommandType currentCommand; private Gson gsonInstance = createGson(); - private OmnipodPodType omnipodPodType; private OmnipodDriverState driverState = OmnipodDriverState.NotInitalized; @Inject @@ -131,26 +129,10 @@ public class OmnipodUtil { omnipodPumpStatus.podDeviceState = podDeviceState; } - public void setOmnipodPodType(OmnipodPodType omnipodPodType) { - this.omnipodPodType = omnipodPodType; - } - - public OmnipodPodType getOmnipodPodType() { - return this.omnipodPodType; - } - public PodDeviceState getPodDeviceState() { 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_) { omnipodPumpStatus.pumpType = pumpType_; } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod_dash/OmnipodDashPumpPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod_dash/OmnipodDashPumpPlugin.java deleted file mode 100644 index 546e3febcd..0000000000 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod_dash/OmnipodDashPumpPlugin.java +++ /dev/null @@ -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 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 customActions = null; - - - @Override - public List 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; - } - - -} diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod_dash/comm/OmnipodDashCommunicationManager.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod_dash/comm/OmnipodDashCommunicationManager.java deleted file mode 100644 index 023992d730..0000000000 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod_dash/comm/OmnipodDashCommunicationManager.java +++ /dev/null @@ -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; - } - -} diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod_dash/driver/OmnipodDashPumpStatus.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod_dash/driver/OmnipodDashPumpStatus.java deleted file mode 100644 index 617322af00..0000000000 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod_dash/driver/OmnipodDashPumpStatus.java +++ /dev/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; - } -} diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index d2e4d26274..1daa8393b2 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1543,8 +1543,6 @@ Deactivate Pod - - Omnipod Dash DASH diff --git a/core/src/main/java/info/nightscout/androidaps/plugins/pump/common/defs/PumpType.java b/core/src/main/java/info/nightscout/androidaps/plugins/pump/common/defs/PumpType.java index 0ff5ac3688..82912012af 100644 --- a/core/src/main/java/info/nightscout/androidaps/plugins/pump/common/defs/PumpType.java +++ b/core/src/main/java/info/nightscout/androidaps/plugins/pump/common/defs/PumpType.java @@ -104,12 +104,6 @@ public enum PumpType { new DoseSettings(0.05d, 30, 12 * 60, 0d, 30.0d), PumpCapability.BasalRate_Duration30minAllowed, // 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_512_712("Medtronic 512/712", ManufacturerType.Medtronic, "512/712", 0.1d, null, // new DoseSettings(0.05d, 30, 8 * 60, 0.05d), // diff --git a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/dialog/RileyLinkBLEScanActivity.java b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/dialog/RileyLinkBLEScanActivity.java index 78db788350..fc7c868fc7 100644 --- a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/dialog/RileyLinkBLEScanActivity.java +++ b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/dialog/RileyLinkBLEScanActivity.java @@ -119,14 +119,10 @@ public class RileyLinkBLEScanActivity extends NoSplashAppCompatActivity { rileyLinkPump.triggerPumpConfigurationChangedEvent(); } 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; - rileyLinkPump.getRileyLinkService().verifyConfiguration(); // force reloading of address + RileyLinkPumpDevice rileyLinkPump = (RileyLinkPumpDevice) activePump; + rileyLinkPump.getRileyLinkService().verifyConfiguration(); // force reloading of address - rileyLinkPump.triggerPumpConfigurationChangedEvent(); - } + rileyLinkPump.triggerPumpConfigurationChangedEvent(); } finish(); diff --git a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/dialog/RileyLinkStatusGeneralFragment.java b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/dialog/RileyLinkStatusGeneralFragment.java index 9db6394715..f48dfe95de 100644 --- a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/dialog/RileyLinkStatusGeneralFragment.java +++ b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/dialog/RileyLinkStatusGeneralFragment.java @@ -122,9 +122,9 @@ public class RileyLinkStatusGeneralFragment extends DaggerFragment implements Re } - PumpPluginAbstract pumpPlugin = (PumpPluginAbstract)activePlugin.getActivePump(); + PumpPluginAbstract pumpPlugin = (PumpPluginAbstract) activePlugin.getActivePump(); - if (pumpPlugin.manufacturer()== ManufacturerType.Medtronic) { + if (pumpPlugin.manufacturer() == ManufacturerType.Medtronic) { //MedtronicPumpStatus medtronicPumpStatus = (MedtronicPumpStatus)pumpPlugin.getPumpStatusData(); PumpStatus pumpStatusData = pumpPlugin.getPumpStatusData(); @@ -154,19 +154,13 @@ public class RileyLinkStatusGeneralFragment extends DaggerFragment implements Re PumpStatus pumpStatusData = pumpPlugin.getPumpStatusData(); 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(resourceHelper.gs(R.string.omnipod_frequency)); - this.pumpFrequency.setText("-"); - } else { + if (pumpStatusData != null) { - this.pumpFrequency.setText(resourceHelper.gs(R.string.omnipod_frequency)); - - if (pumpStatusData != null) { - - // TODO show info about active Pod + // TODO show info about active Pod /* if (pumpStatusData.getCustomData("POD_AVAILABLE", Boolean.class)) { this.serialNumber.setText(pumpStatusData.getCustomDataAsString("POD_LOT_NUMBER")); @@ -177,16 +171,15 @@ public class RileyLinkStatusGeneralFragment extends DaggerFragment implements Re } */ - if (rileyLinkServiceData.lastGoodFrequency != null) - this.lastUsedFrequency.setText(String.format(Locale.ENGLISH, "%.2f MHz", - rileyLinkServiceData.lastGoodFrequency)); + if (rileyLinkServiceData.lastGoodFrequency != null) + this.lastUsedFrequency.setText(String.format(Locale.ENGLISH, "%.2f MHz", + rileyLinkServiceData.lastGoodFrequency)); - if (pumpStatusData.lastConnection != 0) - this.lastDeviceContact.setText(StringUtil.toDateTimeString(dateUtil, new LocalDateTime( - pumpStatusData.lastDataTime))); - else - this.lastDeviceContact.setText(resourceHelper.gs(R.string.common_never)); - } + if (pumpStatusData.lastConnection != 0) + this.lastDeviceContact.setText(StringUtil.toDateTimeString(dateUtil, new LocalDateTime( + pumpStatusData.lastDataTime))); + else + this.lastDeviceContact.setText(resourceHelper.gs(R.string.common_never)); } } } diff --git a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/DiscoverGattServicesTask.java b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/DiscoverGattServicesTask.java index a9d84d63d5..b958ad9a1f 100644 --- a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/DiscoverGattServicesTask.java +++ b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/DiscoverGattServicesTask.java @@ -33,13 +33,6 @@ public class DiscoverGattServicesTask extends ServiceTask { @Override 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(); if (needToConnect) {