diff --git a/app/build.gradle b/app/build.gradle
index dcbdde7f9b..58c4d73eac 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -242,6 +242,8 @@ dependencies {
implementation project(':dana')
implementation project(':danars')
implementation project(':danar')
+ implementation project(':rileylink')
+ implementation project(':medtronic')
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.google.android.gms:play-services-wearable:17.0.0'
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 93f89e91ca..8f3db8e179 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -258,16 +258,7 @@
android:name=".plugins.pump.medtronic.service.RileyLinkMedtronicService"
android:enabled="true"
android:exported="true" />
-
-
-
-
-
-
-
+
diff --git a/app/src/main/java/info/nightscout/androidaps/db/DatabaseHelperProvider.java b/app/src/main/java/info/nightscout/androidaps/db/DatabaseHelperProvider.java
index 2b8b79db2c..0e9f9d82b2 100644
--- a/app/src/main/java/info/nightscout/androidaps/db/DatabaseHelperProvider.java
+++ b/app/src/main/java/info/nightscout/androidaps/db/DatabaseHelperProvider.java
@@ -70,7 +70,32 @@ public class DatabaseHelperProvider implements DatabaseHelperInterface {
return MainApp.getDbHelper().roundDateToSec(date);
}
+ @Override public void createOrUpdateTDD(@NotNull TDD record) {
+ MainApp.getDbHelper().createOrUpdateTDD(record);
+ }
+
+ @Override public void createOrUpdate(@NotNull TemporaryBasal tempBasal) {
+ MainApp.getDbHelper().createOrUpdate(tempBasal);
+ }
+
+ @NotNull @Override public TemporaryBasal findTempBasalByPumpId(long id) {
+ return MainApp.getDbHelper().findTempBasalByPumpId(id);
+ }
+
+ @NotNull @Override public List getTemporaryBasalsDataFromTime(long mills, boolean ascending) {
+ return MainApp.getDbHelper().getTemporaryBasalsDataFromTime(mills, ascending);
+ }
+
+ @NotNull @Override public CareportalEvent getCareportalEventFromTimestamp(long timestamp) {
+ return MainApp.getDbHelper().getCareportalEventFromTimestamp(timestamp);
+ }
+
+ @NotNull @Override public List getTDDsForLastXDays(int days) {
+ return MainApp.getDbHelper().getTDDsForLastXDays(days);
+ }
+
@NotNull @Override public List getProfileSwitchData(long from, boolean ascending) {
return MainApp.getDbHelper().getProfileSwitchData(from, ascending);
}
+
}
diff --git a/app/src/main/java/info/nightscout/androidaps/dependencyInjection/FragmentsModule.kt b/app/src/main/java/info/nightscout/androidaps/dependencyInjection/FragmentsModule.kt
index 3fb97d8a32..cde5137ac9 100644
--- a/app/src/main/java/info/nightscout/androidaps/dependencyInjection/FragmentsModule.kt
+++ b/app/src/main/java/info/nightscout/androidaps/dependencyInjection/FragmentsModule.kt
@@ -10,7 +10,6 @@ import info.nightscout.androidaps.plugins.aps.openAPSSMB.OpenAPSSMBFragment
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderFragment
import info.nightscout.androidaps.plugins.constraints.objectives.ObjectivesFragment
import info.nightscout.androidaps.plugins.constraints.objectives.activities.ObjectivesExamDialog
-import info.nightscout.androidaps.dialogs.NtpProgressDialog
import info.nightscout.androidaps.plugins.general.actions.ActionsFragment
import info.nightscout.androidaps.plugins.general.automation.AutomationFragment
import info.nightscout.androidaps.plugins.general.automation.dialogs.ChooseActionDialog
@@ -32,7 +31,6 @@ import info.nightscout.androidaps.plugins.profile.ns.NSProfileFragment
import info.nightscout.androidaps.plugins.pump.combo.ComboFragment
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.dialog.RileyLinkStatusGeneralFragment
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.dialog.RileyLinkStatusHistoryFragment
-import info.nightscout.androidaps.danars.dialogs.PairingProgressDialog
import info.nightscout.androidaps.plugins.pump.insight.LocalInsightFragment
import info.nightscout.androidaps.plugins.pump.medtronic.MedtronicFragment
import info.nightscout.androidaps.plugins.pump.medtronic.dialog.RileyLinkStatusDeviceMedtronic
diff --git a/app/src/main/java/info/nightscout/androidaps/dependencyInjection/MedtronicModule.kt b/app/src/main/java/info/nightscout/androidaps/dependencyInjection/MedtronicModule.kt
index 7166906611..f813a6d49d 100644
--- a/app/src/main/java/info/nightscout/androidaps/dependencyInjection/MedtronicModule.kt
+++ b/app/src/main/java/info/nightscout/androidaps/dependencyInjection/MedtronicModule.kt
@@ -2,10 +2,6 @@ package info.nightscout.androidaps.dependencyInjection
import dagger.Module
import dagger.android.ContributesAndroidInjector
-import info.nightscout.androidaps.plugins.general.automation.AutomationEvent
-import info.nightscout.androidaps.plugins.general.automation.actions.*
-import info.nightscout.androidaps.plugins.general.automation.elements.*
-import info.nightscout.androidaps.plugins.general.automation.triggers.*
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkCommunicationManager
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.RFSpy
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.RileyLinkBLE
@@ -16,8 +12,6 @@ import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.data.Radi
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.tasks.*
import info.nightscout.androidaps.plugins.pump.medtronic.comm.MedtronicCommunicationManager
import info.nightscout.androidaps.plugins.pump.medtronic.comm.ui.MedtronicUITask
-import info.nightscout.androidaps.queue.CommandQueue
-import info.nightscout.androidaps.queue.commands.*
@Module
@Suppress("unused")
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/actions/ActionLoopResume.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/actions/ActionLoopResume.kt
index 4e155bcdcc..051e1c8bb0 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/actions/ActionLoopResume.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/actions/ActionLoopResume.kt
@@ -8,7 +8,6 @@ import info.nightscout.androidaps.events.EventRefreshOverview
import info.nightscout.androidaps.plugins.aps.loop.LoopPlugin
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin
-import info.nightscout.androidaps.plugins.general.nsclient.NSUpload
import info.nightscout.androidaps.queue.Callback
import info.nightscout.androidaps.utils.resources.ResourceHelper
import javax.inject.Inject
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ComboPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ComboPlugin.java
index 50f40318d9..e443ac4657 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ComboPlugin.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ComboPlugin.java
@@ -20,7 +20,6 @@ import javax.inject.Inject;
import javax.inject.Singleton;
import dagger.android.HasAndroidInjector;
-import info.nightscout.androidaps.BuildConfig;
import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R;
import info.nightscout.androidaps.data.DetailedBolusInfo;
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/defs/PumpDeviceState.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/defs/PumpDeviceState.java
deleted file mode 100644
index ba86963869..0000000000
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/defs/PumpDeviceState.java
+++ /dev/null
@@ -1,30 +0,0 @@
-package info.nightscout.androidaps.plugins.pump.medtronic.defs;
-
-import info.nightscout.androidaps.R;
-
-/**
- * Created by andy on 6/11/18.
- */
-
-public enum PumpDeviceState {
-
- NeverContacted(R.string.medtronic_pump_status_never_contacted), //
- Sleeping(R.string.medtronic_pump_status_sleeping), //
- WakingUp(R.string.medtronic_pump_status_waking_up), //
- Active(R.string.medtronic_pump_status_active), //
- ErrorWhenCommunicating(R.string.medtronic_pump_status_error_comm), //
- TimeoutWhenCommunicating(R.string.medtronic_pump_status_timeout_comm), //
- // ProblemContacting(R.string.medtronic_pump_status_problem_contacting), //
- PumpUnreachable(R.string.medtronic_pump_status_pump_unreachable), //
- InvalidConfiguration(R.string.medtronic_pump_status_invalid_config);
-
- Integer resourceId;
-
- PumpDeviceState(int resourceId) {
- this.resourceId = resourceId;
- }
-
- public Integer getResourceId() {
- return resourceId;
- }
-}
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/OmnipodFragment.kt b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/OmnipodFragment.kt
index 843beed61f..09e80f50d5 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/OmnipodFragment.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/OmnipodFragment.kt
@@ -217,10 +217,10 @@ class OmnipodFragment : DaggerFragment() {
omnipod_rl_status.text =
when {
omnipodPumpStatus.rileyLinkServiceState == RileyLinkServiceState.NotStarted -> resourceHelper.gs(resourceId)
- omnipodPumpStatus.rileyLinkServiceState.isConnecting -> "{fa-bluetooth-b spin} " + resourceHelper.gs(resourceId)
- omnipodPumpStatus.rileyLinkServiceState.isError && rileyLinkError == null -> "{fa-bluetooth-b} " + resourceHelper.gs(resourceId)
- omnipodPumpStatus.rileyLinkServiceState.isError && rileyLinkError != null -> "{fa-bluetooth-b} " + resourceHelper.gs(rileyLinkError.getResourceId(RileyLinkTargetDevice.MedtronicPump))
- else -> "{fa-bluetooth-b} " + resourceHelper.gs(resourceId)
+ omnipodPumpStatus.rileyLinkServiceState.isConnecting -> "{fa-bluetooth-b spin} " + resourceHelper.gs(resourceId)
+ omnipodPumpStatus.rileyLinkServiceState.isError && rileyLinkError == null -> "{fa-bluetooth-b} " + resourceHelper.gs(resourceId)
+ omnipodPumpStatus.rileyLinkServiceState.isError && rileyLinkError != null -> "{fa-bluetooth-b} " + resourceHelper.gs(rileyLinkError.getResourceId(RileyLinkTargetDevice.MedtronicPump))
+ else -> "{fa-bluetooth-b} " + resourceHelper.gs(resourceId)
}
omnipod_rl_status.setTextColor(if (rileyLinkError != null) Color.RED else Color.WHITE)
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 76d39f7318..236d084ca8 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
@@ -418,6 +418,11 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPump
rileyLinkOmnipodService.doTuneUpDevice();
}
+ @Override
+ public void triggerPumpConfigurationChangedEvent() {
+ rxBus.send(new EventOmnipodPumpValuesChanged());
+ }
+
@Override
public RileyLinkOmnipodService getRileyLinkService() {
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 89b6a43559..31d3fbd531 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
@@ -9,6 +9,7 @@ import dagger.android.HasAndroidInjector;
import info.nightscout.androidaps.logging.AAPSLogger;
import info.nightscout.androidaps.logging.LTag;
import info.nightscout.androidaps.plugins.pump.common.data.PumpStatus;
+import info.nightscout.androidaps.plugins.pump.common.defs.PumpDeviceState;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkCommunicationManager;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkConst;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.RFSpy;
@@ -17,7 +18,6 @@ import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.data.RLMe
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.defs.RLMessageType;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.defs.RileyLinkBLEError;
import info.nightscout.androidaps.plugins.pump.common.utils.ByteUtil;
-import info.nightscout.androidaps.plugins.pump.medtronic.defs.PumpDeviceState;
import info.nightscout.androidaps.plugins.pump.omnipod.comm.action.OmnipodAction;
import info.nightscout.androidaps.plugins.pump.omnipod.comm.exception.CommunicationException;
import info.nightscout.androidaps.plugins.pump.omnipod.comm.exception.IllegalMessageAddressException;
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/message/OmnipodPacket.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/message/OmnipodPacket.java
index 157e72e51b..3764cf7b60 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/message/OmnipodPacket.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/message/OmnipodPacket.java
@@ -1,7 +1,5 @@
package info.nightscout.androidaps.plugins.pump.omnipod.comm.message;
-import java.util.Arrays;
-
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.data.RLMessage;
import info.nightscout.androidaps.plugins.pump.common.utils.ByteUtil;
import info.nightscout.androidaps.plugins.pump.omnipod.defs.PacketType;
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/data/RLHistoryItemOmnipod.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/data/RLHistoryItemOmnipod.java
new file mode 100644
index 0000000000..ed4dcb6255
--- /dev/null
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/data/RLHistoryItemOmnipod.java
@@ -0,0 +1,40 @@
+package info.nightscout.androidaps.plugins.pump.omnipod.data;
+
+import org.joda.time.LocalDateTime;
+
+import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.data.RLHistoryItem;
+import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkTargetDevice;
+import info.nightscout.androidaps.plugins.pump.medtronic.defs.MedtronicCommandType;
+import info.nightscout.androidaps.plugins.pump.omnipod.defs.OmnipodCommandType;
+import info.nightscout.androidaps.utils.resources.ResourceHelper;
+
+public class RLHistoryItemOmnipod extends RLHistoryItem {
+
+ private OmnipodCommandType omnipodCommandType;
+
+ public RLHistoryItemOmnipod(OmnipodCommandType omnipodCommandType) {
+ super(new LocalDateTime(), RLHistoryItemSource.OmnipodCommand, RileyLinkTargetDevice.Omnipod);
+ this.omnipodCommandType = omnipodCommandType;
+ }
+
+ public String getDescription(ResourceHelper resourceHelper) {
+
+ switch (this.source) {
+ case RileyLink:
+ return "State: " + resourceHelper.gs(serviceState.getResourceId(targetDevice))
+ + (this.errorCode == null ? "" : ", Error Code: " + errorCode);
+
+ case MedtronicPump:
+ return resourceHelper.gs(pumpDeviceState.getResourceId());
+
+ case OmnipodCommand:
+ return omnipodCommandType.name();
+
+ default:
+ return "Unknown Description";
+ }
+ }
+
+
+
+}
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/OmnipodCommunicationManagerInterface.java
index d345a3c385..7ad3b58799 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/OmnipodCommunicationManagerInterface.java
@@ -5,7 +5,6 @@ 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.omnipod.comm.message.response.podinfo.PodInfoRecentPulseLog;
-import info.nightscout.androidaps.plugins.pump.omnipod.driver.OmnipodPumpStatus;
public interface OmnipodCommunicationManagerInterface {
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/defs/PodDeviceState.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/defs/PodDeviceState.java
index 5e903b5ae4..2670f63295 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/defs/PodDeviceState.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/defs/PodDeviceState.java
@@ -5,7 +5,7 @@ import info.nightscout.androidaps.R;
/**
* Created by andy on 4.8.2019
*/
-
+// TODO remove this class and use PumpDeviceState instead
public enum PodDeviceState {
// FIXME
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/driver/OmnipodPumpStatus.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/driver/OmnipodPumpStatus.java
index 1262304203..67fae56e08 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/driver/OmnipodPumpStatus.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/driver/OmnipodPumpStatus.java
@@ -8,14 +8,14 @@ import javax.inject.Singleton;
import info.nightscout.androidaps.plugins.bus.RxBusWrapper;
import info.nightscout.androidaps.plugins.pump.common.data.PumpStatus;
import info.nightscout.androidaps.plugins.pump.common.data.TempBasalPair;
+import info.nightscout.androidaps.plugins.pump.common.defs.PumpDeviceState;
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.common.hw.rileylink.data.RLHistoryItem;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkError;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkServiceState;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkTargetDevice;
-import info.nightscout.androidaps.plugins.pump.medtronic.defs.PumpDeviceState;
-import info.nightscout.androidaps.plugins.pump.medtronic.events.EventMedtronicDeviceStatusChange;
+import info.nightscout.androidaps.plugins.pump.common.events.EventRileyLinkDeviceStatusChange;
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.util.OmnipodConst;
@@ -53,7 +53,7 @@ public class OmnipodPumpStatus extends PumpStatus {
public String podNumber;
public PodDeviceState podDeviceState = PodDeviceState.NeverContacted;
- public boolean podAvailable = false;
+ public Boolean podAvailable = false;
public boolean podAvailibityChecked = false;
public boolean ackAlertsAvailable = false;
public String ackAlertsText = null;
@@ -101,6 +101,21 @@ public class OmnipodPumpStatus extends PumpStatus {
return (this.errorDescription == null) ? "-" : this.errorDescription;
}
+ @Override
+ public E getCustomData(String key, Class clazz) {
+ switch(key) {
+ case "POD_LOT_NUMBER":
+ return (E)podLotNumber;
+
+ case "POD_AVAILABLE":
+ return (E)podAvailable;
+
+ default:
+ return null;
+ }
+
+ }
+
// public boolean setNotInPreInit() {
// this.inPreInit = false;
@@ -187,7 +202,7 @@ public class OmnipodPumpStatus extends PumpStatus {
rileyLinkUtil.getRileyLinkHistory().add(new RLHistoryItem(pumpDeviceState, RileyLinkTargetDevice.Omnipod));
- rxBus.send(new EventMedtronicDeviceStatusChange(pumpDeviceState));
+ rxBus.send(new EventRileyLinkDeviceStatusChange(pumpDeviceState));
}
}
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/driver/db/PodHistoryEntryType.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/driver/db/PodHistoryEntryType.java
index e776de681f..981796b497 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/driver/db/PodHistoryEntryType.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/driver/db/PodHistoryEntryType.java
@@ -1,6 +1,5 @@
package info.nightscout.androidaps.plugins.pump.omnipod.driver.db;
-import androidx.annotation.IdRes;
import androidx.annotation.StringRes;
import java.util.HashMap;
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/events/EventOmnipodDeviceStatusChange.kt b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/events/EventOmnipodDeviceStatusChange.kt
index db46550a05..b87dbdb08c 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/events/EventOmnipodDeviceStatusChange.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/events/EventOmnipodDeviceStatusChange.kt
@@ -1,6 +1,7 @@
package info.nightscout.androidaps.plugins.pump.omnipod.events
import info.nightscout.androidaps.events.Event
+import info.nightscout.androidaps.plugins.pump.common.events.EventRileyLinkDeviceStatusChange
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkError
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkServiceState
import info.nightscout.androidaps.plugins.pump.omnipod.defs.PodDeviceState
@@ -9,18 +10,13 @@ import info.nightscout.androidaps.plugins.pump.omnipod.defs.state.PodSessionStat
/**
* Created by andy on 4.8.2019
*/
-class EventOmnipodDeviceStatusChange : Event {
+class EventOmnipodDeviceStatusChange : EventRileyLinkDeviceStatusChange {
- var rileyLinkServiceState: RileyLinkServiceState? = null
- var rileyLinkError: RileyLinkError? = null
var podSessionState: PodSessionState? = null
- var errorDescription: String? = null
var podDeviceState: PodDeviceState? = null
@JvmOverloads
- constructor(rileyLinkServiceState: RileyLinkServiceState?, rileyLinkError: RileyLinkError? = null) {
- this.rileyLinkServiceState = rileyLinkServiceState
- this.rileyLinkError = rileyLinkError
+ constructor(rileyLinkServiceState: RileyLinkServiceState?, rileyLinkError: RileyLinkError? = null) : super(rileyLinkServiceState, rileyLinkError) {
}
constructor(podSessionState: PodSessionState?) {
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/service/RileyLinkOmnipodService.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/service/RileyLinkOmnipodService.java
index 908748b991..61fd548f7b 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/service/RileyLinkOmnipodService.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/service/RileyLinkOmnipodService.java
@@ -14,6 +14,7 @@ import javax.inject.Inject;
import info.nightscout.androidaps.R;
import info.nightscout.androidaps.logging.LTag;
+import info.nightscout.androidaps.plugins.pump.common.defs.PumpDeviceState;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkCommunicationManager;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkConst;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.RFSpy;
@@ -23,7 +24,6 @@ import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.defs.Rile
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkServiceState;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkTargetDevice;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.RileyLinkService;
-import info.nightscout.androidaps.plugins.pump.medtronic.defs.PumpDeviceState;
import info.nightscout.androidaps.plugins.pump.omnipod.OmnipodPumpPlugin;
import info.nightscout.androidaps.plugins.pump.omnipod.comm.OmnipodCommunicationManager;
import info.nightscout.androidaps.plugins.pump.omnipod.defs.state.PodSessionState;
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 dfaa18bcaa..c79aa9fdb6 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
@@ -1,7 +1,5 @@
package info.nightscout.androidaps.plugins.pump.omnipod.util;
-import android.content.Context;
-
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonDeserializer;
@@ -17,8 +15,6 @@ import javax.inject.Inject;
import javax.inject.Singleton;
import dagger.android.HasAndroidInjector;
-import info.nightscout.androidaps.MainApp;
-import info.nightscout.androidaps.R;
import info.nightscout.androidaps.interfaces.ActivePluginProvider;
import info.nightscout.androidaps.logging.AAPSLogger;
import info.nightscout.androidaps.logging.LTag;
@@ -27,14 +23,15 @@ 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.common.hw.rileylink.data.RLHistoryItem;
import info.nightscout.androidaps.plugins.pump.omnipod.comm.OmnipodManager;
+import info.nightscout.androidaps.plugins.pump.omnipod.data.RLHistoryItemOmnipod;
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.PodSessionState;
import info.nightscout.androidaps.plugins.pump.omnipod.driver.OmnipodDriverState;
import info.nightscout.androidaps.plugins.pump.omnipod.driver.OmnipodPumpStatus;
import info.nightscout.androidaps.plugins.pump.omnipod.events.EventOmnipodDeviceStatusChange;
-import info.nightscout.androidaps.utils.alertDialogs.OKDialog;
import info.nightscout.androidaps.utils.resources.ResourceHelper;
import info.nightscout.androidaps.utils.sharedPreferences.SP;
@@ -103,7 +100,7 @@ public class OmnipodUtil {
this.currentCommand = currentCommand;
if (currentCommand != null)
- rileyLinkUtil.getRileyLinkHistory().add(new RLHistoryItem(currentCommand));
+ rileyLinkUtil.getRileyLinkHistory().add(new RLHistoryItemOmnipod(currentCommand));
}
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
index 39ccadd308..3247f02c8d 100644
--- 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
@@ -12,7 +12,6 @@ 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.PodInitReceiver;
import info.nightscout.androidaps.plugins.pump.omnipod.defs.state.PodSessionState;
-import info.nightscout.androidaps.plugins.pump.omnipod.driver.OmnipodPumpStatus;
/**
* Created by andy on 4.8.2019
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/sensitivity/AbstractSensitivityPlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/sensitivity/AbstractSensitivityPlugin.kt
index 420451050b..9e826156ee 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/sensitivity/AbstractSensitivityPlugin.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/sensitivity/AbstractSensitivityPlugin.kt
@@ -64,4 +64,4 @@ abstract class AbstractSensitivityPlugin(
output.sensResult = sensResult
return output
}
-}
\ No newline at end of file
+}
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/treatments/TreatmentsPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/treatments/TreatmentsPlugin.java
index 68d1be2f23..3b49779bd3 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/treatments/TreatmentsPlugin.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/treatments/TreatmentsPlugin.java
@@ -8,7 +8,6 @@ import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.google.firebase.analytics.FirebaseAnalytics;
-import com.google.gson.GsonBuilder;
import org.jetbrains.annotations.NotNull;
@@ -605,6 +604,12 @@ public class TreatmentsPlugin extends PluginBase implements TreatmentsInterface
return newRecordCreated;
}
+ public TreatmentUpdateReturn createOrUpdateMedtronic(Treatment treatment, boolean fromNightScout) {
+ TreatmentService.UpdateReturn resultRecord = getService().createOrUpdateMedtronic(treatment, fromNightScout);
+
+ return new TreatmentUpdateReturn(resultRecord.success, resultRecord.newRecord);
+ }
+
// return true if new record is created
@Override
public boolean addToHistoryTreatment(DetailedBolusInfo detailedBolusInfo, boolean allowUpdate) {
diff --git a/app/src/main/jniLibs/README.md b/app/src/main/jniLibs/README.md
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/app/src/main/jniLibs/arm64-v8a/libBleCommandUtil.so b/app/src/main/jniLibs/arm64-v8a/libBleCommandUtil.so
new file mode 100644
index 0000000000..69e283b5fe
Binary files /dev/null and b/app/src/main/jniLibs/arm64-v8a/libBleCommandUtil.so differ
diff --git a/app/src/main/jniLibs/armeabi-v7a/libBleCommandUtil.so b/app/src/main/jniLibs/armeabi-v7a/libBleCommandUtil.so
new file mode 100644
index 0000000000..0c717bc3e8
Binary files /dev/null and b/app/src/main/jniLibs/armeabi-v7a/libBleCommandUtil.so differ
diff --git a/app/src/main/jniLibs/armeabi/libBleCommandUtil.so b/app/src/main/jniLibs/armeabi/libBleCommandUtil.so
new file mode 100644
index 0000000000..a51a8c7d9a
Binary files /dev/null and b/app/src/main/jniLibs/armeabi/libBleCommandUtil.so differ
diff --git a/app/src/main/jniLibs/mips/libBleCommandUtil.so b/app/src/main/jniLibs/mips/libBleCommandUtil.so
new file mode 100644
index 0000000000..fcff5eb6b2
Binary files /dev/null and b/app/src/main/jniLibs/mips/libBleCommandUtil.so differ
diff --git a/app/src/main/jniLibs/mips64/libBleCommandUtil.so b/app/src/main/jniLibs/mips64/libBleCommandUtil.so
new file mode 100644
index 0000000000..a8a292ea13
Binary files /dev/null and b/app/src/main/jniLibs/mips64/libBleCommandUtil.so differ
diff --git a/app/src/main/jniLibs/x86/libBleCommandUtil.so b/app/src/main/jniLibs/x86/libBleCommandUtil.so
new file mode 100644
index 0000000000..638a9def95
Binary files /dev/null and b/app/src/main/jniLibs/x86/libBleCommandUtil.so differ
diff --git a/app/src/main/jniLibs/x86_64/libBleCommandUtil.so b/app/src/main/jniLibs/x86_64/libBleCommandUtil.so
new file mode 100644
index 0000000000..94873d3732
Binary files /dev/null and b/app/src/main/jniLibs/x86_64/libBleCommandUtil.so differ
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 055194017d..fe902fd74b 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -1244,175 +1244,8 @@
Preconditions:
-
- Operation not supported by pump and/or driver.
- Operation not YET supported by pump.
-
-
- Medtronic
- MDT
- Pump integration for Medtronic, requires RileyLink device and specific Pump Model
-
-
- pref_medtronic_serial
- pref_medtronic_pump_type
- pref_medtronic_frequency
- pref_medtronic_max_bolus
- pref_medtronic_max_basal
- pref_medtronic_bolus_delay
- pref_medtronic_encoding
- pref_medtronic_battery_type
- pref_medtronic_bolus_debug
- pref_rileylink_mac_address
- medtronic_pump_frequency_us_ca
- medtronic_pump_frequency_worldwide
- medtronic_pump_encoding_4b6b_local
- medtronic_pump_encoding_4b6b_rileylink
- medtronic_pump_battery_no
- medtronic_pump_battery_alkaline
- medtronic_pump_battery_lithium
- medtronic_pump_battery_nizn
- medtronic_pump_battery_nimh
-
- Pump Serial Number
- Pump Type
- Pump Frequency
- Delay before Bolus is started (s)
- Max Bolus on Pump (U)
- Max Basal on Pump (U/h)
- Medtronic Encoding
- US & Canada (916 MHz)
- Worldwide (868 Mhz)
- Software 4b6b Encoding
- Hardware 4b6b Encoding
- Wake and Tune Up
- Clear Bolus Block
- Reset RileyLink Config
- Battery Type (Power View)
- Not selected (Simple view)
- Alkaline (Extended view)
- Lithium (Extended view)
- NiZn (Extended view)
- NiMH (Extended view)
- Bolus/Treatments Debugging
-
-
- SCAN
- STOP
- Selected
- RileyLink Scan
- Enable
- No
- Scanning
- Scanning finished
- Scanning error: %1$d
- Never
-
-
- Settings
- History
- RileyLink Status
- Pump Status
- RileyLink Settings
- RileyLink
- Configured Address
- Connected Device
- Connection Status
- Connection Error
- Device
- Device Type
- Device Model
- Last used frequency
- Last device contact
- RL Firmware
-
- Bluetooth Initializing…
- Bluetooth Error
- Bluetooth Ready
- Not Started
- RileyLink Initialization…
- RileyLink Error
- Tuning up RileyLink and Pump
- Problem connecting to Pump
- Connected
-
-
- Device is not RileyLink
- RileyLink unreachable
- Bluetooth disabled
- No Bluetooth Adapter
- TuneUp Failed
- Pump unreachable
- Pod unreachable
-
-
- Medtronic Pump
- Omnipod
-
-
-
- Errors
- Serial # not set.
- Serial # invalid.
- Pump Type not set.
- Pump Type unsupported.
- Pump Frequency not set.
- Pump Frequency unsupported.
- RileyLink Address invalid.
- Pump type detected is not the same as configured type.
-
- Basal profiles/patterns setting is not enabled on pump. Enable it on the pump.
- Basal profile set on pump is incorrect (must be STD).
- Wrong TBR type set on pump (must be Absolute).
- Wrong Max Bolus set on Pump (must be %1$.2f).
- Wrong Max Basal set on Pump (must be %1$.2f).
- Operation is not possible.\n\n You need to configure Medtronic Pump first, before you can use this operation.
- Over 24h Time change was requested.
-
-
- Basals
- Configurations
- Notifications
- Statistics
- Unknowns
- All
- Medtronic Pump History
-
-
-
- Never contacted
- Waking up
- Error with communication
- Timeout on communication
- Pump unreachable
- Invalid configuration
- Active
- Sleeping
-
-
- You cancelled Bolus, after it was already set on Pump. Since Medtronic Pump doesn\'t support cancel, you will need to manually cancel it. Put the Pump into Suspend mode and then do Resume (if you still want to cancel). Application will pick up changes, on next update (in less than 5 minutes).
- Could not read current TBR.
- Could not cancel current TBR. Stopping operation.
- Profile set failed, because following patterns, have too big basal rate: %1$s
- Bolus could not be delivered.
- Bolus could not be delivered, because available insulin amount (%1$.2f) is less than bolus required (%2$.2f).
- TBR could not be set.
- Could not cancel current TBR.
- Basal profile could not be set.
- Basal profile is the same, so it will not be set again.
-
- Get History - Page %1$d (%2$d/16)
- Get History - Page %1$d
- Get Pump Time
- Get Settings
- Get Pump Model
- Get Basal Profile
- Set Basal Profile
- Get Temporary Basal
- Set Temporary Basal
- Set Bolus
Change profile to
Change profile to %1$s
Last connection to pump
@@ -1568,6 +1401,17 @@
Skin
+
+ Never contacted
+ Waking up
+ Error with communication
+ Timeout on communication
+ Pump unreachable
+ Invalid configuration
+ Active
+ Sleeping
+
+
diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/common/utils/DateTimeUtilUTest.java b/app/src/test/java/info/nightscout/androidaps/plugins/pump/common/utils/DateTimeUtilUTest.java
index 5d069f0345..7b79c62e82 100644
--- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/common/utils/DateTimeUtilUTest.java
+++ b/app/src/test/java/info/nightscout/androidaps/plugins/pump/common/utils/DateTimeUtilUTest.java
@@ -6,8 +6,6 @@ import junit.framework.Assert;
import org.junit.Test;
-import static org.junit.Assert.*;
-
public class DateTimeUtilUTest {
@Test
diff --git a/core/build.gradle b/core/build.gradle
index 1362716c47..b79909271a 100644
--- a/core/build.gradle
+++ b/core/build.gradle
@@ -75,6 +75,9 @@ dependencies {
implementation "com.j256.ormlite:ormlite-core:${ormLiteVersion}"
implementation "com.j256.ormlite:ormlite-android:${ormLiteVersion}"
+ // pumpCommon
+ implementation "com.google.code.gson:gson:2.8.6"
+
testImplementation 'junit:junit:4.13'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
diff --git a/app/src/main/java/info/nightscout/androidaps/events/EventCustomActionsChanged.kt b/core/src/main/java/info/nightscout/androidaps/events/EventCustomActionsChanged.kt
similarity index 100%
rename from app/src/main/java/info/nightscout/androidaps/events/EventCustomActionsChanged.kt
rename to core/src/main/java/info/nightscout/androidaps/events/EventCustomActionsChanged.kt
diff --git a/app/src/main/java/info/nightscout/androidaps/events/EventRefreshOverview.kt b/core/src/main/java/info/nightscout/androidaps/events/EventRefreshOverview.kt
similarity index 100%
rename from app/src/main/java/info/nightscout/androidaps/events/EventRefreshOverview.kt
rename to core/src/main/java/info/nightscout/androidaps/events/EventRefreshOverview.kt
diff --git a/core/src/main/java/info/nightscout/androidaps/interfaces/DatabaseHelperInterface.kt b/core/src/main/java/info/nightscout/androidaps/interfaces/DatabaseHelperInterface.kt
index 66cf3e3d2f..df90e03586 100644
--- a/core/src/main/java/info/nightscout/androidaps/interfaces/DatabaseHelperInterface.kt
+++ b/core/src/main/java/info/nightscout/androidaps/interfaces/DatabaseHelperInterface.kt
@@ -17,5 +17,11 @@ interface DatabaseHelperInterface {
fun deleteDbRequestbyMongoId(action: String, _id: String)
fun getDbRequestInterator(): CloseableIterator
fun roundDateToSec(date: Long): Long
+ fun createOrUpdateTDD(record: TDD)
+ fun createOrUpdate(tempBasal: TemporaryBasal)
+ fun findTempBasalByPumpId(id: Long) : TemporaryBasal
+ fun getTemporaryBasalsDataFromTime(mills: Long, ascending: Boolean) : List
+ fun getCareportalEventFromTimestamp(timestamp: Long): CareportalEvent
+ fun getTDDsForLastXDays(days: Int): List
fun getProfileSwitchData(from: Long, ascending: Boolean): List
-}
\ No newline at end of file
+}
diff --git a/core/src/main/java/info/nightscout/androidaps/interfaces/TreatmentsInterface.java b/core/src/main/java/info/nightscout/androidaps/interfaces/TreatmentsInterface.java
index 8856f8a74e..8c8d7f026f 100644
--- a/core/src/main/java/info/nightscout/androidaps/interfaces/TreatmentsInterface.java
+++ b/core/src/main/java/info/nightscout/androidaps/interfaces/TreatmentsInterface.java
@@ -14,6 +14,7 @@ import info.nightscout.androidaps.db.ProfileSwitch;
import info.nightscout.androidaps.db.TempTarget;
import info.nightscout.androidaps.db.TemporaryBasal;
import info.nightscout.androidaps.db.Treatment;
+import info.nightscout.androidaps.plugins.treatments.TreatmentUpdateReturn;
/**
* Created by mike on 14.06.2016.
@@ -84,4 +85,6 @@ public interface TreatmentsInterface {
long oldestDataAvailable();
+ TreatmentUpdateReturn createOrUpdateMedtronic(Treatment treatment, boolean fromNightScout);
+
}
\ No newline at end of file
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/PumpPluginAbstract.java b/core/src/main/java/info/nightscout/androidaps/plugins/pump/common/PumpPluginAbstract.java
similarity index 97%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/common/PumpPluginAbstract.java
rename to core/src/main/java/info/nightscout/androidaps/plugins/pump/common/PumpPluginAbstract.java
index b16031a14f..c82ecba37d 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/PumpPluginAbstract.java
+++ b/core/src/main/java/info/nightscout/androidaps/plugins/pump/common/PumpPluginAbstract.java
@@ -13,8 +13,7 @@ import org.json.JSONObject;
import java.util.Date;
import dagger.android.HasAndroidInjector;
-import info.nightscout.androidaps.BuildConfig;
-import info.nightscout.androidaps.R;
+import info.nightscout.androidaps.core.R;
import info.nightscout.androidaps.data.DetailedBolusInfo;
import info.nightscout.androidaps.data.Profile;
import info.nightscout.androidaps.data.PumpEnactResult;
@@ -37,7 +36,6 @@ import info.nightscout.androidaps.plugins.general.overview.events.EventOverviewB
import info.nightscout.androidaps.plugins.pump.common.data.PumpStatus;
import info.nightscout.androidaps.plugins.pump.common.defs.PumpDriverState;
import info.nightscout.androidaps.plugins.pump.common.defs.PumpType;
-import info.nightscout.androidaps.plugins.pump.medtronic.data.MedtronicHistoryData;
import info.nightscout.androidaps.db.Treatment;
import info.nightscout.androidaps.utils.DateUtil;
import info.nightscout.androidaps.utils.DecimalFormatter;
@@ -118,7 +116,7 @@ public abstract class PumpPluginAbstract extends PumpPluginBase implements PumpI
@Override
protected void onStart() {
super.onStart();
- // TODO: moved from constructor .... test if it works
+
initPumpStatusData();
Intent intent = new Intent(context, getServiceClass());
@@ -418,8 +416,8 @@ public abstract class PumpPluginAbstract extends PumpPluginBase implements PumpI
// bolus needed, ask pump to deliver it
return deliverBolus(detailedBolusInfo);
} else {
- if (MedtronicHistoryData.doubleBolusDebug)
- aapsLogger.debug("DoubleBolusDebug: deliverTreatment::(carb only entry)");
+ //if (MedtronicHistoryData.doubleBolusDebug)
+ // aapsLogger.debug("DoubleBolusDebug: deliverTreatment::(carb only entry)");
// no bolus required, carb only treatment
activePlugin.getActiveTreatments().addToHistoryTreatment(detailedBolusInfo, true);
@@ -433,7 +431,7 @@ public abstract class PumpPluginAbstract extends PumpPluginBase implements PumpI
aapsLogger.debug(LTag.PUMP, "deliverTreatment: Carb only treatment.");
return new PumpEnactResult(getInjector()).success(true).enacted(true).bolusDelivered(0d)
- .carbsDelivered(detailedBolusInfo.carbs).comment(getResourceHelper().gs(R.string.virtualpump_resultok));
+ .carbsDelivered(detailedBolusInfo.carbs).comment(getResourceHelper().gs(R.string.common_resultok));
}
} finally {
triggerUIChange();
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/data/PumpStatus.java b/core/src/main/java/info/nightscout/androidaps/plugins/pump/common/data/PumpStatus.java
similarity index 91%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/common/data/PumpStatus.java
rename to core/src/main/java/info/nightscout/androidaps/plugins/pump/common/data/PumpStatus.java
index 3c51b484e8..08c8e60d56 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/data/PumpStatus.java
+++ b/core/src/main/java/info/nightscout/androidaps/plugins/pump/common/data/PumpStatus.java
@@ -49,7 +49,7 @@ public abstract class PumpStatus {
public int tempBasalRatio = 0;
public int tempBasalRemainMin = 0;
public Date tempBasalStart;
- private PumpType pumpType;
+ public PumpType pumpType;
//protected PumpDescription pumpDescription;
@@ -69,9 +69,20 @@ public abstract class PumpStatus {
this.lastConnection = System.currentTimeMillis();
}
+
public void setLastFailedCommunicationToNow() {
this.lastErrorConnection = System.currentTimeMillis();
}
+
public abstract String getErrorInfo();
+
+
+ public abstract E getCustomData(String key, Class clazz);
+
+ public String getCustomDataAsString(String key) {
+ return getCustomData(key, String.class);
+ }
+
+
}
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/data/TempBasalPair.java b/core/src/main/java/info/nightscout/androidaps/plugins/pump/common/data/TempBasalPair.java
similarity index 93%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/common/data/TempBasalPair.java
rename to core/src/main/java/info/nightscout/androidaps/plugins/pump/common/data/TempBasalPair.java
index 08ff0c3b49..5a1e0b4249 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/data/TempBasalPair.java
+++ b/core/src/main/java/info/nightscout/androidaps/plugins/pump/common/data/TempBasalPair.java
@@ -2,11 +2,6 @@ package info.nightscout.androidaps.plugins.pump.common.data;
import com.google.gson.annotations.Expose;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import info.nightscout.androidaps.logging.L;
-
public class TempBasalPair {
@Expose
diff --git a/core/src/main/java/info/nightscout/androidaps/plugins/pump/common/defs/PumpDeviceState.java b/core/src/main/java/info/nightscout/androidaps/plugins/pump/common/defs/PumpDeviceState.java
new file mode 100644
index 0000000000..4a9814c490
--- /dev/null
+++ b/core/src/main/java/info/nightscout/androidaps/plugins/pump/common/defs/PumpDeviceState.java
@@ -0,0 +1,29 @@
+package info.nightscout.androidaps.plugins.pump.common.defs;
+
+import info.nightscout.androidaps.core.R;
+
+/**
+ * Created by andy on 6/11/18.
+ */
+public enum PumpDeviceState {
+
+ NeverContacted(R.string.pump_status_never_contacted), //
+ Sleeping(R.string.pump_status_sleeping), //
+ WakingUp(R.string.pump_status_waking_up), //
+ Active(R.string.pump_status_active), //
+ ErrorWhenCommunicating(R.string.pump_status_error_comm), //
+ TimeoutWhenCommunicating(R.string.pump_status_timeout_comm), //
+ // ProblemContacting(R.string.medtronic_pump_status_problem_contacting), //
+ PumpUnreachable(R.string.pump_status_pump_unreachable), //
+ InvalidConfiguration(R.string.pump_status_invalid_config);
+
+ Integer resourceId;
+
+ PumpDeviceState(int resourceId) {
+ this.resourceId = resourceId;
+ }
+
+ public Integer getResourceId() {
+ return resourceId;
+ }
+}
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/defs/PumpHistoryEntryGroup.java b/core/src/main/java/info/nightscout/androidaps/plugins/pump/common/defs/PumpHistoryEntryGroup.java
similarity index 72%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/common/defs/PumpHistoryEntryGroup.java
rename to core/src/main/java/info/nightscout/androidaps/plugins/pump/common/defs/PumpHistoryEntryGroup.java
index 9958d290e4..d17244615f 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/defs/PumpHistoryEntryGroup.java
+++ b/core/src/main/java/info/nightscout/androidaps/plugins/pump/common/defs/PumpHistoryEntryGroup.java
@@ -3,7 +3,8 @@ package info.nightscout.androidaps.plugins.pump.common.defs;
import java.util.ArrayList;
import java.util.List;
-import info.nightscout.androidaps.R;
+
+import info.nightscout.androidaps.core.R;
import info.nightscout.androidaps.utils.resources.ResourceHelper;
@@ -16,16 +17,16 @@ import info.nightscout.androidaps.utils.resources.ResourceHelper;
public enum PumpHistoryEntryGroup {
- All(R.string.medtronic_history_group_all),
- Bolus(R.string.danar_history_bolus),
- Basal(R.string.medtronic_history_group_basal),
- Prime(R.string.danar_history_prime),
- Configuration(R.string.medtronic_history_group_configuration),
- Alarm(R.string.danar_history_alarm),
- Glucose(R.string.danar_history_glucose),
- Notification(R.string.medtronic_history_group_notification),
- Statistic(R.string.medtronic_history_group_statistic),
- Unknown(R.string.medtronic_history_group_unknown),
+ All(R.string.history_group_all),
+ Bolus(R.string.history_group_bolus),
+ Basal(R.string.history_group_basal),
+ Prime(R.string.history_group_prime),
+ Configuration(R.string.history_group_configuration),
+ Alarm(R.string.history_group_alarm),
+ Glucose(R.string.history_group_glucose),
+ Notification(R.string.history_group_notification),
+ Statistic(R.string.history_group_statistic),
+ Unknown(R.string.history_group_unknown),
;
private int resourceId;
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/dialog/RefreshableInterface.java b/core/src/main/java/info/nightscout/androidaps/plugins/pump/common/dialog/RefreshableInterface.java
similarity index 100%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/common/dialog/RefreshableInterface.java
rename to core/src/main/java/info/nightscout/androidaps/plugins/pump/common/dialog/RefreshableInterface.java
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/events/EventRefreshButtonState.kt b/core/src/main/java/info/nightscout/androidaps/plugins/pump/common/events/EventRefreshButtonState.kt
similarity index 63%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/events/EventRefreshButtonState.kt
rename to core/src/main/java/info/nightscout/androidaps/plugins/pump/common/events/EventRefreshButtonState.kt
index 81b9af4ff3..54f4773141 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/events/EventRefreshButtonState.kt
+++ b/core/src/main/java/info/nightscout/androidaps/plugins/pump/common/events/EventRefreshButtonState.kt
@@ -1,4 +1,4 @@
-package info.nightscout.androidaps.plugins.pump.medtronic.events
+package info.nightscout.androidaps.plugins.pump.common.events
import info.nightscout.androidaps.events.Event
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/utils/ByteUtil.java b/core/src/main/java/info/nightscout/androidaps/plugins/pump/common/utils/ByteUtil.java
similarity index 100%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/common/utils/ByteUtil.java
rename to core/src/main/java/info/nightscout/androidaps/plugins/pump/common/utils/ByteUtil.java
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/utils/CRC.java b/core/src/main/java/info/nightscout/androidaps/plugins/pump/common/utils/CRC.java
similarity index 100%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/common/utils/CRC.java
rename to core/src/main/java/info/nightscout/androidaps/plugins/pump/common/utils/CRC.java
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/utils/DateTimeUtil.java b/core/src/main/java/info/nightscout/androidaps/plugins/pump/common/utils/DateTimeUtil.java
similarity index 97%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/common/utils/DateTimeUtil.java
rename to core/src/main/java/info/nightscout/androidaps/plugins/pump/common/utils/DateTimeUtil.java
index 20c19c644c..32c1d36488 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/utils/DateTimeUtil.java
+++ b/core/src/main/java/info/nightscout/androidaps/plugins/pump/common/utils/DateTimeUtil.java
@@ -6,15 +6,10 @@ package info.nightscout.androidaps.plugins.pump.common.utils;
import org.joda.time.LocalDateTime;
import org.joda.time.Minutes;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import java.util.Calendar;
import java.util.GregorianCalendar;
-import info.nightscout.androidaps.logging.L;
-import info.nightscout.androidaps.logging.StacktraceLoggerWrapper;
-
/**
* This is simple version of ATechDate, limited only to one format (yyyymmddHHMIss)
*/
@@ -26,7 +21,6 @@ public class DateTimeUtil {
* @param atechDateTime
* @return
*/
- @Deprecated // use joda instead
public static LocalDateTime toLocalDateTime(long atechDateTime) {
int year = (int) (atechDateTime / 10000000000L);
atechDateTime -= year * 10000000000L;
@@ -61,7 +55,6 @@ public class DateTimeUtil {
* @param atechDateTime
* @return
*/
- @Deprecated // use joda instead
public static GregorianCalendar toGregorianCalendar(long atechDateTime) {
int year = (int) (atechDateTime / 10000000000L);
atechDateTime -= year * 10000000000L;
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/utils/ProfileUtil.java b/core/src/main/java/info/nightscout/androidaps/plugins/pump/common/utils/ProfileUtil.java
similarity index 100%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/common/utils/ProfileUtil.java
rename to core/src/main/java/info/nightscout/androidaps/plugins/pump/common/utils/ProfileUtil.java
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/utils/StringUtil.java b/core/src/main/java/info/nightscout/androidaps/plugins/pump/common/utils/StringUtil.java
similarity index 100%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/common/utils/StringUtil.java
rename to core/src/main/java/info/nightscout/androidaps/plugins/pump/common/utils/StringUtil.java
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/utils/ThreadUtil.java b/core/src/main/java/info/nightscout/androidaps/plugins/pump/common/utils/ThreadUtil.java
similarity index 100%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/common/utils/ThreadUtil.java
rename to core/src/main/java/info/nightscout/androidaps/plugins/pump/common/utils/ThreadUtil.java
diff --git a/core/src/main/java/info/nightscout/androidaps/plugins/treatments/TreatmentUpdateReturn.java b/core/src/main/java/info/nightscout/androidaps/plugins/treatments/TreatmentUpdateReturn.java
new file mode 100644
index 0000000000..42b71b0217
--- /dev/null
+++ b/core/src/main/java/info/nightscout/androidaps/plugins/treatments/TreatmentUpdateReturn.java
@@ -0,0 +1,27 @@
+package info.nightscout.androidaps.plugins.treatments;
+
+import info.nightscout.androidaps.db.Treatment;
+
+public class TreatmentUpdateReturn {
+
+ public TreatmentUpdateReturn(boolean success, boolean newRecord) {
+ this.success = success;
+ this.newRecord = newRecord;
+ }
+
+ boolean newRecord;
+ boolean success;
+
+ @Override
+ public String toString() {
+ return "UpdateReturn [" +
+ "newRecord=" + newRecord +
+ ", success=" + success +
+ ']';
+ }
+
+}
+
+
+
+
diff --git a/core/src/main/res/values/strings.xml b/core/src/main/res/values/strings.xml
index f07d0d2129..af37bbf430 100644
--- a/core/src/main/res/values/strings.xml
+++ b/core/src/main/res/values/strings.xml
@@ -222,4 +222,57 @@
Time detection
%1$dh %2$dm
+
+ Operation not supported by pump and/or driver.
+ Operation not YET supported by pump.
+ OK
+
+
+ Never contacted
+ Waking up
+ Error with communication
+ Timeout on communication
+ Pump unreachable
+ Invalid configuration
+ Active
+ Sleeping
+
+
+ Basals
+ Configurations
+ Notifications
+ Statistics
+ Unknowns
+ All
+ Boluses
+ Prime
+ Alarms
+ Glucose
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/medtronic/.gitignore b/medtronic/.gitignore
new file mode 100644
index 0000000000..796b96d1c4
--- /dev/null
+++ b/medtronic/.gitignore
@@ -0,0 +1 @@
+/build
diff --git a/medtronic/build.gradle b/medtronic/build.gradle
new file mode 100644
index 0000000000..9551210275
--- /dev/null
+++ b/medtronic/build.gradle
@@ -0,0 +1,83 @@
+apply plugin: 'com.android.library'
+apply plugin: 'kotlin-android'
+apply plugin: 'kotlin-android-extensions'
+apply plugin: 'kotlin-kapt'
+
+android {
+ compileSdkVersion 28
+
+ defaultConfig {
+ minSdkVersion 24
+ targetSdkVersion 28
+ versionCode 1
+ versionName "1.0"
+
+ testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
+ consumerProguardFiles 'consumer-rules.pro'
+ }
+
+ kotlinOptions {
+ jvmTarget = '1.8'
+ }
+
+ buildTypes {
+ release {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
+ }
+ debug {
+ testCoverageEnabled(project.hasProperty('coverage'))
+ }
+ firebaseDisable {
+ System.setProperty("disableFirebase", "true")
+ ext.enableCrashlytics = false
+ }
+ }
+ compileOptions {
+ sourceCompatibility JavaVersion.VERSION_1_8
+ targetCompatibility JavaVersion.VERSION_1_8
+ }
+}
+
+dependencies {
+ implementation project(':core')
+ implementation project(':rileylink')
+
+ implementation fileTree(dir: 'libs', include: ['*.jar'])
+ implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
+ implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
+ implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutinesVersion"
+ implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutinesVersion"
+
+ implementation 'androidx.appcompat:appcompat:1.1.0'
+ implementation 'androidx.legacy:legacy-support-v13:1.0.0'
+ implementation 'androidx.core:core-ktx:1.2.0'
+ implementation "androidx.preference:preference-ktx:1.1.1"
+ implementation "androidx.activity:activity-ktx:${activityVersion}"
+ implementation 'com.google.android.material:material:1.1.0'
+
+ implementation "io.reactivex.rxjava2:rxandroid:${rxandroid_version}"
+
+ // Graphview cannot be upgraded
+ implementation "com.jjoe64:graphview:4.0.1"
+
+ implementation "com.joanzapata.iconify:android-iconify-fontawesome:2.2.2"
+
+ // medtronic - start
+ implementation 'org.apache.commons:commons-lang3:3.10'
+ implementation 'net.danlew:android.joda:2.10.6'
+ implementation 'org.slf4j:slf4j-api:1.7.30'
+ implementation "com.google.code.gson:gson:2.8.6"
+ // medtronic - end
+
+ implementation "com.google.dagger:dagger-android:$dagger_version"
+ implementation "com.google.dagger:dagger-android-support:$dagger_version"
+ annotationProcessor "com.google.dagger:dagger-compiler:$dagger_version"
+ annotationProcessor "com.google.dagger:dagger-android-processor:$dagger_version"
+ kapt "com.google.dagger:dagger-android-processor:$dagger_version"
+ kapt "com.google.dagger:dagger-compiler:$dagger_version"
+
+ testImplementation 'junit:junit:4.13'
+ androidTestImplementation 'androidx.test.ext:junit:1.1.1'
+ androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
+}
diff --git a/medtronic/consumer-rules.pro b/medtronic/consumer-rules.pro
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/medtronic/proguard-rules.pro b/medtronic/proguard-rules.pro
new file mode 100644
index 0000000000..f1b424510d
--- /dev/null
+++ b/medtronic/proguard-rules.pro
@@ -0,0 +1,21 @@
+# Add project specific ProGuard rules here.
+# You can control the set of applied configuration files using the
+# proguardFiles setting in build.gradle.
+#
+# For more details, see
+# http://developer.android.com/guide/developing/tools/proguard.html
+
+# If your project uses WebView with JS, uncomment the following
+# and specify the fully qualified class name to the JavaScript interface
+# class:
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
+# public *;
+#}
+
+# Uncomment this to preserve the line number information for
+# debugging stack traces.
+#-keepattributes SourceFile,LineNumberTable
+
+# If you keep the line number information, uncomment this to
+# hide the original source file name.
+#-renamesourcefileattribute SourceFile
diff --git a/medtronic/src/androidTest/java/info/nightscout/androidaps/plugins/pump/medtronic/ExampleInstrumentedTest.java b/medtronic/src/androidTest/java/info/nightscout/androidaps/plugins/pump/medtronic/ExampleInstrumentedTest.java
new file mode 100644
index 0000000000..63cded8fe7
--- /dev/null
+++ b/medtronic/src/androidTest/java/info/nightscout/androidaps/plugins/pump/medtronic/ExampleInstrumentedTest.java
@@ -0,0 +1,27 @@
+package info.nightscout.androidaps.plugins.pump.medtronic;
+
+import android.content.Context;
+
+import androidx.test.platform.app.InstrumentationRegistry;
+import androidx.test.ext.junit.runners.AndroidJUnit4;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import static org.junit.Assert.*;
+
+/**
+ * Instrumented test, which will execute on an Android device.
+ *
+ * @see Testing documentation
+ */
+@RunWith(AndroidJUnit4.class)
+public class ExampleInstrumentedTest {
+ @Test
+ public void useAppContext() {
+ // Context of the app under test.
+ Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
+
+ assertEquals("info.nightscout.androidaps.plugins.pump.medtronic.test", appContext.getPackageName());
+ }
+}
diff --git a/medtronic/src/main/AndroidManifest.xml b/medtronic/src/main/AndroidManifest.xml
new file mode 100644
index 0000000000..ef3ab38a46
--- /dev/null
+++ b/medtronic/src/main/AndroidManifest.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/MedtronicFragment.kt b/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/MedtronicFragment.kt
similarity index 91%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/MedtronicFragment.kt
rename to medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/MedtronicFragment.kt
index da9a2321f6..cb1e246e0e 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/MedtronicFragment.kt
+++ b/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/MedtronicFragment.kt
@@ -8,8 +8,6 @@ import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import dagger.android.support.DaggerFragment
-import info.nightscout.androidaps.MainApp
-import info.nightscout.androidaps.R
import info.nightscout.androidaps.events.EventExtendedBolusChange
import info.nightscout.androidaps.events.EventPumpStatusChanged
import info.nightscout.androidaps.events.EventTempBasalChange
@@ -18,20 +16,20 @@ import info.nightscout.androidaps.interfaces.CommandQueueProvider
import info.nightscout.androidaps.logging.AAPSLogger
import info.nightscout.androidaps.logging.LTag
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
+import info.nightscout.androidaps.plugins.pump.common.defs.PumpDeviceState
+import info.nightscout.androidaps.plugins.pump.medtronic.defs.BatteryType
+import info.nightscout.androidaps.plugins.pump.medtronic.defs.MedtronicCommandType
+import info.nightscout.androidaps.plugins.pump.medtronic.dialog.MedtronicHistoryActivity
+import info.nightscout.androidaps.plugins.pump.medtronic.driver.MedtronicPumpStatus
+import info.nightscout.androidaps.plugins.pump.common.events.EventRileyLinkDeviceStatusChange
+import info.nightscout.androidaps.plugins.pump.medtronic.events.EventMedtronicPumpConfigurationChanged
+import info.nightscout.androidaps.plugins.pump.medtronic.events.EventMedtronicPumpValuesChanged
+import info.nightscout.androidaps.plugins.pump.common.events.EventRefreshButtonState
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkUtil
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkServiceState
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkTargetDevice
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.dialog.RileyLinkStatusActivity
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.RileyLinkServiceData
-import info.nightscout.androidaps.plugins.pump.medtronic.defs.BatteryType
-import info.nightscout.androidaps.plugins.pump.medtronic.defs.MedtronicCommandType
-import info.nightscout.androidaps.plugins.pump.medtronic.defs.PumpDeviceState
-import info.nightscout.androidaps.plugins.pump.medtronic.dialog.MedtronicHistoryActivity
-import info.nightscout.androidaps.plugins.pump.medtronic.driver.MedtronicPumpStatus
-import info.nightscout.androidaps.plugins.pump.medtronic.events.EventMedtronicDeviceStatusChange
-import info.nightscout.androidaps.plugins.pump.medtronic.events.EventMedtronicPumpConfigurationChanged
-import info.nightscout.androidaps.plugins.pump.medtronic.events.EventMedtronicPumpValuesChanged
-import info.nightscout.androidaps.plugins.pump.medtronic.events.EventRefreshButtonState
import info.nightscout.androidaps.plugins.pump.medtronic.util.MedtronicUtil
import info.nightscout.androidaps.queue.Callback
import info.nightscout.androidaps.queue.events.EventQueueChanged
@@ -49,7 +47,6 @@ import javax.inject.Inject
class MedtronicFragment : DaggerFragment() {
@Inject lateinit var aapsLogger: AAPSLogger
- @Inject lateinit var mainApp: MainApp
@Inject lateinit var fabricPrivacy: FabricPrivacy
@Inject lateinit var resourceHelper: ResourceHelper
@Inject lateinit var rxBus: RxBusWrapper
@@ -128,10 +125,10 @@ class MedtronicFragment : DaggerFragment() {
.observeOn(AndroidSchedulers.mainThread())
.subscribe({ medtronic_refresh.isEnabled = it.newState }, { fabricPrivacy.logException(it) })
disposable += rxBus
- .toObservable(EventMedtronicDeviceStatusChange::class.java)
+ .toObservable(EventRileyLinkDeviceStatusChange::class.java)
.observeOn(AndroidSchedulers.mainThread())
.subscribe({
- aapsLogger.debug(LTag.PUMP, "onStatusEvent(EventMedtronicDeviceStatusChange): $it")
+ aapsLogger.debug(LTag.PUMP, "onStatusEvent(EventRileyLinkDeviceStatusChange): $it")
setDeviceStatus()
}, { fabricPrivacy.logException(it) })
disposable += rxBus
@@ -179,11 +176,11 @@ class MedtronicFragment : DaggerFragment() {
val rileyLinkError = medtronicPumpPlugin.rileyLinkService?.error
medtronic_rl_status.text =
when {
- rileyLinkServiceData.rileyLinkServiceState == RileyLinkServiceState.NotStarted -> resourceHelper.gs(resourceId)
- rileyLinkServiceData.rileyLinkServiceState.isConnecting -> "{fa-bluetooth-b spin} " + resourceHelper.gs(resourceId)
- rileyLinkServiceData.rileyLinkServiceState.isError && rileyLinkError == null -> "{fa-bluetooth-b} " + resourceHelper.gs(resourceId)
- rileyLinkServiceData.rileyLinkServiceState.isError && rileyLinkError != null -> "{fa-bluetooth-b} " + resourceHelper.gs(rileyLinkError.getResourceId(RileyLinkTargetDevice.MedtronicPump))
- else -> "{fa-bluetooth-b} " + resourceHelper.gs(resourceId)
+ rileyLinkServiceData.rileyLinkServiceState == RileyLinkServiceState.NotStarted -> resourceHelper.gs(resourceId)
+ rileyLinkServiceData.rileyLinkServiceState.isConnecting -> "{fa-bluetooth-b spin} " + resourceHelper.gs(resourceId)
+ rileyLinkServiceData.rileyLinkServiceState.isError && rileyLinkError == null -> "{fa-bluetooth-b} " + resourceHelper.gs(resourceId)
+ rileyLinkServiceData.rileyLinkServiceState.isError && rileyLinkError != null -> "{fa-bluetooth-b} " + resourceHelper.gs(rileyLinkError.getResourceId(RileyLinkTargetDevice.MedtronicPump))
+ else -> "{fa-bluetooth-b} " + resourceHelper.gs(resourceId)
}
medtronic_rl_status.setTextColor(if (rileyLinkError != null) Color.RED else Color.WHITE)
@@ -221,7 +218,7 @@ class MedtronicFragment : DaggerFragment() {
}
}
- else -> aapsLogger.warn(LTag.PUMP, "Unknown pump state: " + medtronicPumpStatus.pumpDeviceState)
+ else -> aapsLogger.warn(LTag.PUMP, "Unknown pump state: " + medtronicPumpStatus.pumpDeviceState)
}
val status = commandQueue.spannedStatus()
@@ -235,7 +232,7 @@ class MedtronicFragment : DaggerFragment() {
private fun displayNotConfiguredDialog() {
context?.let {
- OKDialog.show(it, resourceHelper.gs(R.string.combo_warning),
+ OKDialog.show(it, resourceHelper.gs(R.string.medtronic_warning),
resourceHelper.gs(R.string.medtronic_error_operation_not_possible_no_configuration), null)
}
}
@@ -252,7 +249,7 @@ class MedtronicFragment : DaggerFragment() {
val minAgo = DateUtil.minAgo(resourceHelper, medtronicPumpStatus.lastConnection)
val min = (System.currentTimeMillis() - medtronicPumpStatus.lastConnection) / 1000 / 60
if (medtronicPumpStatus.lastConnection + 60 * 1000 > System.currentTimeMillis()) {
- medtronic_lastconnection.setText(R.string.combo_pump_connected_now)
+ medtronic_lastconnection.setText(R.string.medtronic_pump_connected_now)
medtronic_lastconnection.setTextColor(Color.WHITE)
} else if (medtronicPumpStatus.lastConnection + 30 * 60 * 1000 < System.currentTimeMillis()) {
@@ -260,13 +257,13 @@ class MedtronicFragment : DaggerFragment() {
medtronic_lastconnection.text = resourceHelper.gs(R.string.minago, min)
} else if (min < 1440) {
val h = (min / 60).toInt()
- medtronic_lastconnection.text = (resourceHelper.gq(R.plurals.objective_hours, h, h) + " "
+ medtronic_lastconnection.text = (resourceHelper.gq(R.plurals.duration_hours, h, h) + " "
+ resourceHelper.gs(R.string.ago))
} else {
val h = (min / 60).toInt()
val d = h / 24
// h = h - (d * 24);
- medtronic_lastconnection.text = (resourceHelper.gq(R.plurals.objective_days, d, d) + " "
+ medtronic_lastconnection.text = (resourceHelper.gq(R.plurals.duration_days, d, d) + " "
+ resourceHelper.gs(R.string.ago))
}
medtronic_lastconnection.setTextColor(Color.RED)
@@ -285,13 +282,13 @@ class MedtronicFragment : DaggerFragment() {
val unit = resourceHelper.gs(R.string.insulin_unit_shortname)
val ago: String
if (agoMsc < 60 * 1000) {
- ago = resourceHelper.gs(R.string.combo_pump_connected_now)
+ ago = resourceHelper.gs(R.string.medtronic_pump_connected_now)
} else if (bolusMinAgo < 60) {
ago = DateUtil.minAgo(resourceHelper, medtronicPumpStatus.lastBolusTime.time)
} else {
ago = DateUtil.hourAgo(medtronicPumpStatus.lastBolusTime.time, resourceHelper)
}
- medtronic_lastbolus.text = resourceHelper.gs(R.string.combo_last_bolus, bolus, unit, ago)
+ medtronic_lastbolus.text = resourceHelper.gs(R.string.mdt_last_bolus, bolus, unit, ago)
} else {
medtronic_lastbolus.text = ""
}
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/MedtronicPumpPlugin.java b/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/MedtronicPumpPlugin.java
similarity index 96%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/MedtronicPumpPlugin.java
rename to medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/MedtronicPumpPlugin.java
index 89480fcdf3..38fa9f1365 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/MedtronicPumpPlugin.java
+++ b/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/MedtronicPumpPlugin.java
@@ -30,13 +30,13 @@ import javax.inject.Inject;
import javax.inject.Singleton;
import dagger.android.HasAndroidInjector;
-import info.nightscout.androidaps.R;
import info.nightscout.androidaps.activities.ErrorHelperActivity;
import info.nightscout.androidaps.data.DetailedBolusInfo;
import info.nightscout.androidaps.data.Profile;
import info.nightscout.androidaps.data.PumpEnactResult;
import info.nightscout.androidaps.db.Source;
import info.nightscout.androidaps.db.TemporaryBasal;
+
import info.nightscout.androidaps.events.EventRefreshOverview;
import info.nightscout.androidaps.interfaces.ActivePluginProvider;
import info.nightscout.androidaps.interfaces.CommandQueueProvider;
@@ -79,8 +79,9 @@ import info.nightscout.androidaps.plugins.pump.medtronic.defs.MedtronicNotificat
import info.nightscout.androidaps.plugins.pump.medtronic.defs.MedtronicStatusRefreshType;
import info.nightscout.androidaps.plugins.pump.medtronic.defs.MedtronicUIResponseType;
import info.nightscout.androidaps.plugins.pump.medtronic.driver.MedtronicPumpStatus;
+import info.nightscout.androidaps.plugins.pump.medtronic.events.EventMedtronicPumpConfigurationChanged;
import info.nightscout.androidaps.plugins.pump.medtronic.events.EventMedtronicPumpValuesChanged;
-import info.nightscout.androidaps.plugins.pump.medtronic.events.EventRefreshButtonState;
+import info.nightscout.androidaps.plugins.pump.common.events.EventRefreshButtonState;
import info.nightscout.androidaps.plugins.pump.medtronic.service.RileyLinkMedtronicService;
import info.nightscout.androidaps.plugins.pump.medtronic.util.MedtronicConst;
import info.nightscout.androidaps.plugins.pump.medtronic.util.MedtronicUtil;
@@ -173,6 +174,7 @@ public class MedtronicPumpPlugin extends PumpPluginAbstract implements PumpInter
aapsLogger.debug(LTag.PUMP, "RileyLinkMedtronicService is connected");
RileyLinkMedtronicService.LocalBinder mLocalBinder = (RileyLinkMedtronicService.LocalBinder) service;
rileyLinkMedtronicService = mLocalBinder.getServiceInstance();
+ rileyLinkMedtronicService.verifyConfiguration();
new Thread(() -> {
@@ -216,7 +218,7 @@ public class MedtronicPumpPlugin extends PumpPluginAbstract implements PumpInter
medtronicPumpStatus.lastDataTime = medtronicPumpStatus.lastConnection;
medtronicPumpStatus.previousConnection = medtronicPumpStatus.lastConnection;
- if (rileyLinkMedtronicService != null) rileyLinkMedtronicService.verifyConfiguration();
+ //if (rileyLinkMedtronicService != null) rileyLinkMedtronicService.verifyConfiguration();
aapsLogger.debug(LTag.PUMP, "initPumpStatusData: " + this.medtronicPumpStatus);
@@ -242,10 +244,16 @@ public class MedtronicPumpPlugin extends PumpPluginAbstract implements PumpInter
return true;
}
- @Override public void doTuneUpDevice() {
+ @Override
+ public void doTuneUpDevice() {
rileyLinkMedtronicService.doTuneUpDevice();
}
+ @Override
+ public void triggerPumpConfigurationChangedEvent() {
+ rxBus.send(new EventMedtronicPumpConfigurationChanged());
+ }
+
private void migrateSettings() {
if ("US (916 MHz)".equals(sp.getString(MedtronicConst.Prefs.PumpFrequency, "US (916 MHz)"))) {
@@ -764,7 +772,7 @@ public class MedtronicPumpPlugin extends PumpPluginAbstract implements PumpInter
if ((clock.localDeviceTime.getYear() <= 2015) || (timeDiff <= 24 * 60 * 60)) {
- aapsLogger.info(LTag.PUMP, "MedtronicPumpPlugin::checkTimeAndOptionallySetTime - Time difference is {} s. Set time on pump." + timeDiff);
+ aapsLogger.info(LTag.PUMP, "MedtronicPumpPlugin::checkTimeAndOptionallySetTime - Time difference is {} s. Set time on pump." , timeDiff);
rileyLinkMedtronicService.getMedtronicUIComm().executeCommand(MedtronicCommandType.SetRealTimeClock);
@@ -774,13 +782,13 @@ public class MedtronicPumpPlugin extends PumpPluginAbstract implements PumpInter
}
} else {
if ((clock.localDeviceTime.getYear() > 2015)) {
- aapsLogger.error("MedtronicPumpPlugin::checkTimeAndOptionallySetTime - Time difference over 24h requested [diff={}]. Doing nothing." + timeDiff);
+ aapsLogger.error("MedtronicPumpPlugin::checkTimeAndOptionallySetTime - Time difference over 24h requested [diff={} s]. Doing nothing.", timeDiff);
medtronicUtil.sendNotification(MedtronicNotificationType.TimeChangeOver24h, getResourceHelper(), rxBus);
}
}
} else {
- aapsLogger.info(LTag.PUMP, "MedtronicPumpPlugin::checkTimeAndOptionallySetTime - Time difference is {} s. Do nothing." + timeDiff);
+ aapsLogger.info(LTag.PUMP, "MedtronicPumpPlugin::checkTimeAndOptionallySetTime - Time difference is {} s. Do nothing.", timeDiff);
}
scheduleNextRefresh(MedtronicStatusRefreshType.PumpTime, 0);
@@ -860,7 +868,7 @@ public class MedtronicPumpPlugin extends PumpPluginAbstract implements PumpInter
Intent i = new Intent(context, ErrorHelperActivity.class);
i.putExtra("soundid", R.raw.boluserror);
i.putExtra("status", getResourceHelper().gs(R.string.medtronic_cmd_cancel_bolus_not_supported));
- i.putExtra("title", getResourceHelper().gs(R.string.combo_warning));
+ i.putExtra("title", getResourceHelper().gs(R.string.medtronic_warning));
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(i);
@@ -1126,11 +1134,14 @@ public class MedtronicPumpPlugin extends PumpPluginAbstract implements PumpInter
private void readPumpHistoryLogic() {
+ boolean debugHistory = false;
+
LocalDateTime targetDate = null;
if (lastPumpHistoryEntry == null) {
- aapsLogger.debug(LTag.PUMP, getLogPrefix() + "readPumpHistoryLogic(): lastPumpHistoryEntry: null");
+ if (debugHistory)
+ aapsLogger.debug(LTag.PUMP, getLogPrefix() + "readPumpHistoryLogic(): lastPumpHistoryEntry: null");
Long lastPumpHistoryEntryTime = getLastPumpEntryTime();
@@ -1139,13 +1150,15 @@ public class MedtronicPumpPlugin extends PumpPluginAbstract implements PumpInter
medtronicHistoryData.setIsInInit(true);
if (lastPumpHistoryEntryTime == 0L) {
- aapsLogger.debug(LTag.PUMP, getLogPrefix() + "readPumpHistoryLogic(): lastPumpHistoryEntryTime: 0L - targetDate: "
- + targetDate);
+ if (debugHistory)
+ aapsLogger.debug(LTag.PUMP, getLogPrefix() + "readPumpHistoryLogic(): lastPumpHistoryEntryTime: 0L - targetDate: "
+ + targetDate);
targetDate = timeMinus36h;
} else {
// LocalDateTime lastHistoryRecordTime = DateTimeUtil.toLocalDateTime(lastPumpHistoryEntryTime);
- aapsLogger.debug(LTag.PUMP, getLogPrefix() + "readPumpHistoryLogic(): lastPumpHistoryEntryTime: " + lastPumpHistoryEntryTime + " - targetDate: " + targetDate);
+ if (debugHistory)
+ aapsLogger.debug(LTag.PUMP, getLogPrefix() + "readPumpHistoryLogic(): lastPumpHistoryEntryTime: " + lastPumpHistoryEntryTime + " - targetDate: " + targetDate);
medtronicHistoryData.setLastHistoryRecordTime(lastPumpHistoryEntryTime);
@@ -1161,30 +1174,35 @@ public class MedtronicPumpPlugin extends PumpPluginAbstract implements PumpInter
targetDate = (timeMinus36h.isAfter(lastHistoryRecordTime) ? timeMinus36h : lastHistoryRecordTime);
- aapsLogger.debug(LTag.PUMP, getLogPrefix() + "readPumpHistoryLogic(): targetDate: " + targetDate);
+ if (debugHistory)
+ aapsLogger.debug(LTag.PUMP, getLogPrefix() + "readPumpHistoryLogic(): targetDate: " + targetDate);
}
} else {
- aapsLogger.debug(LTag.PUMP, getLogPrefix() + "readPumpHistoryLogic(): lastPumpHistoryEntry: not null - " + medtronicUtil.gsonInstance.toJson(lastPumpHistoryEntry));
+ if (debugHistory)
+ aapsLogger.debug(LTag.PUMP, getLogPrefix() + "readPumpHistoryLogic(): lastPumpHistoryEntry: not null - " + medtronicUtil.gsonInstance.toJson(lastPumpHistoryEntry));
medtronicHistoryData.setIsInInit(false);
// medtronicHistoryData.setLastHistoryRecordTime(lastPumpHistoryEntry.atechDateTime);
// targetDate = lastPumpHistoryEntry.atechDateTime;
}
- aapsLogger.debug(LTag.PUMP, "HST: Target Date: " + targetDate);
+ //aapsLogger.debug(LTag.PUMP, "HST: Target Date: " + targetDate);
MedtronicUITask responseTask2 = rileyLinkMedtronicService.getMedtronicUIComm().executeCommand(MedtronicCommandType.GetHistoryData,
lastPumpHistoryEntry, targetDate);
- aapsLogger.debug(LTag.PUMP, "HST: After task");
+ if (debugHistory)
+ aapsLogger.debug(LTag.PUMP, "HST: After task");
PumpHistoryResult historyResult = (PumpHistoryResult) responseTask2.returnData;
- aapsLogger.debug(LTag.PUMP, "HST: History Result: " + historyResult.toString());
+ if (debugHistory)
+ aapsLogger.debug(LTag.PUMP, "HST: History Result: " + historyResult.toString());
PumpHistoryEntry latestEntry = historyResult.getLatestEntry();
- aapsLogger.debug(LTag.PUMP, getLogPrefix() + "Last entry: " + latestEntry);
+ if (debugHistory)
+ aapsLogger.debug(LTag.PUMP, getLogPrefix() + "Last entry: " + latestEntry);
if (latestEntry == null) // no new history to read
return;
@@ -1192,7 +1210,8 @@ public class MedtronicPumpPlugin extends PumpPluginAbstract implements PumpInter
this.lastPumpHistoryEntry = latestEntry;
sp.putLong(MedtronicConst.Statistics.LastPumpHistoryEntry, latestEntry.atechDateTime);
- aapsLogger.debug(LTag.PUMP, "HST: History: valid=" + historyResult.validEntries.size() + ", unprocessed=" + historyResult.unprocessedEntries.size());
+ if (debugHistory)
+ aapsLogger.debug(LTag.PUMP, "HST: History: valid=" + historyResult.validEntries.size() + ", unprocessed=" + historyResult.unprocessedEntries.size());
this.medtronicHistoryData.addNewHistory(historyResult);
this.medtronicHistoryData.filterNewEntries();
@@ -1214,11 +1233,9 @@ public class MedtronicPumpPlugin extends PumpPluginAbstract implements PumpInter
// update to last entry
// - save
// - determine pump status
-
- //
-
}
+
private Long getLastPumpEntryTime() {
Long lastPumpEntryTime = sp.getLong(MedtronicConst.Statistics.LastPumpHistoryEntry, 0L);
@@ -1538,7 +1555,7 @@ public class MedtronicPumpPlugin extends PumpPluginAbstract implements PumpInter
Intent i = new Intent(context, ErrorHelperActivity.class);
i.putExtra("soundid", R.raw.boluserror);
i.putExtra("status", getResourceHelper().gs(R.string.medtronic_error_operation_not_possible_no_configuration));
- i.putExtra("title", getResourceHelper().gs(R.string.combo_warning));
+ i.putExtra("title", getResourceHelper().gs(R.string.medtronic_warning));
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(i);
}
@@ -1571,7 +1588,8 @@ public class MedtronicPumpPlugin extends PumpPluginAbstract implements PumpInter
this.hasTimeDateOrTimeZoneChanged = true;
}
- @Override public boolean setNeutralTempAtFullHour() {
+ @Override
+ public boolean setNeutralTempAtFullHour() {
return sp.getBoolean(R.string.key_set_neutral_temps, true);
}
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/MedtronicCommunicationManager.java b/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/MedtronicCommunicationManager.java
similarity index 99%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/MedtronicCommunicationManager.java
rename to medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/MedtronicCommunicationManager.java
index 3737dd0226..b71dec4621 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/MedtronicCommunicationManager.java
+++ b/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/MedtronicCommunicationManager.java
@@ -12,9 +12,9 @@ import java.util.Map;
import javax.inject.Inject;
import dagger.android.HasAndroidInjector;
-import info.nightscout.androidaps.logging.AAPSLogger;
import info.nightscout.androidaps.logging.LTag;
import info.nightscout.androidaps.plugins.pump.common.data.PumpStatus;
+import info.nightscout.androidaps.plugins.pump.common.defs.PumpDeviceState;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkCommunicationManager;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkConst;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.RFSpy;
@@ -24,8 +24,6 @@ import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.data.RLMe
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.data.RadioPacket;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.data.RadioResponse;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.defs.RLMessageType;
-import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.RileyLinkServiceData;
-import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.tasks.ServiceTaskExecutor;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.tasks.WakeAndTuneTask;
import info.nightscout.androidaps.plugins.pump.common.utils.ByteUtil;
import info.nightscout.androidaps.plugins.pump.common.utils.DateTimeUtil;
@@ -48,7 +46,6 @@ import info.nightscout.androidaps.plugins.pump.medtronic.data.dto.PumpSettingDTO
import info.nightscout.androidaps.plugins.pump.medtronic.data.dto.TempBasalPair;
import info.nightscout.androidaps.plugins.pump.medtronic.defs.MedtronicCommandType;
import info.nightscout.androidaps.plugins.pump.medtronic.defs.MedtronicDeviceType;
-import info.nightscout.androidaps.plugins.pump.medtronic.defs.PumpDeviceState;
import info.nightscout.androidaps.plugins.pump.medtronic.driver.MedtronicPumpStatus;
import info.nightscout.androidaps.plugins.pump.medtronic.util.MedtronicUtil;
@@ -151,6 +148,8 @@ public class MedtronicCommunicationManager extends RileyLinkCommunicationManager
PumpDeviceState state = medtronicPumpStatus.getPumpDeviceState();
+ // check connection
+
byte[] pumpMsgContent = createPumpMessageContent(RLMessageType.ReadSimpleData); // simple
RFSpyResponse rfSpyResponse = rfspy.transmitThenReceive(new RadioPacket(injector, pumpMsgContent), (byte) 0, (byte) 200,
(byte) 0, (byte) 0, 25000, (byte) 0);
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/MedtronicConverter.java b/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/MedtronicConverter.java
similarity index 100%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/MedtronicConverter.java
rename to medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/MedtronicConverter.java
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/history/MedtronicHistoryDecoder.java b/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/history/MedtronicHistoryDecoder.java
similarity index 93%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/history/MedtronicHistoryDecoder.java
rename to medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/history/MedtronicHistoryDecoder.java
index 450425b26c..a4335583a2 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/history/MedtronicHistoryDecoder.java
+++ b/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/history/MedtronicHistoryDecoder.java
@@ -118,7 +118,7 @@ public abstract class MedtronicHistoryDecoder i
StringUtil.appendToStringBuilder(sb, "" + unknownEntry.getKey(), ", ");
}
- aapsLogger.error(LTag.PUMPCOMM, "STATISTICS OF PUMP DECODE");
+ aapsLogger.info(LTag.PUMPCOMM, "STATISTICS OF PUMP DECODE");
if (unknownOpCodes.size() > 0) {
aapsLogger.warn(LTag.PUMPCOMM, "Unknown Op Codes: {}", sb.toString());
@@ -137,9 +137,9 @@ public abstract class MedtronicHistoryDecoder i
String spaces = StringUtils.repeat(" ", 14 - entry.getKey().name().length());
- aapsLogger.error(LTag.PUMPCOMM, " {}{} - {}. Elements: {}", entry.getKey().name(), spaces, entry.getValue().size(), sb.toString());
+ aapsLogger.info(LTag.PUMPCOMM, " {}{} - {}. Elements: {}", entry.getKey().name(), spaces, entry.getValue().size(), sb.toString());
} else {
- aapsLogger.error(LTag.PUMPCOMM, " {} - {}", entry.getKey().name(), entry.getValue().size());
+ aapsLogger.info(LTag.PUMPCOMM, " {} - {}", entry.getKey().name(), entry.getValue().size());
}
}
}
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/history/MedtronicHistoryDecoderInterface.java b/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/history/MedtronicHistoryDecoderInterface.java
similarity index 100%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/history/MedtronicHistoryDecoderInterface.java
rename to medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/history/MedtronicHistoryDecoderInterface.java
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/history/MedtronicHistoryEntry.java b/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/history/MedtronicHistoryEntry.java
similarity index 99%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/history/MedtronicHistoryEntry.java
rename to medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/history/MedtronicHistoryEntry.java
index fb42eca31c..b59dce7113 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/history/MedtronicHistoryEntry.java
+++ b/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/history/MedtronicHistoryEntry.java
@@ -3,7 +3,6 @@ package info.nightscout.androidaps.plugins.pump.medtronic.comm.history;
import com.google.gson.annotations.Expose;
import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import java.util.HashMap;
import java.util.List;
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/history/MedtronicHistoryEntryInterface.java b/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/history/MedtronicHistoryEntryInterface.java
similarity index 100%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/history/MedtronicHistoryEntryInterface.java
rename to medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/history/MedtronicHistoryEntryInterface.java
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/history/RawHistoryPage.java b/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/history/RawHistoryPage.java
similarity index 100%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/history/RawHistoryPage.java
rename to medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/history/RawHistoryPage.java
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/history/RecordDecodeStatus.java b/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/history/RecordDecodeStatus.java
similarity index 100%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/history/RecordDecodeStatus.java
rename to medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/history/RecordDecodeStatus.java
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/history/cgms/CGMSHistoryEntry.java b/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/history/cgms/CGMSHistoryEntry.java
similarity index 100%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/history/cgms/CGMSHistoryEntry.java
rename to medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/history/cgms/CGMSHistoryEntry.java
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/history/cgms/CGMSHistoryEntryType.java b/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/history/cgms/CGMSHistoryEntryType.java
similarity index 100%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/history/cgms/CGMSHistoryEntryType.java
rename to medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/history/cgms/CGMSHistoryEntryType.java
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/history/cgms/MedtronicCGMSHistoryDecoder.java b/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/history/cgms/MedtronicCGMSHistoryDecoder.java
similarity index 100%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/history/cgms/MedtronicCGMSHistoryDecoder.java
rename to medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/history/cgms/MedtronicCGMSHistoryDecoder.java
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/history/pump/MedtronicPumpHistoryDecoder.java b/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/history/pump/MedtronicPumpHistoryDecoder.java
similarity index 100%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/history/pump/MedtronicPumpHistoryDecoder.java
rename to medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/history/pump/MedtronicPumpHistoryDecoder.java
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/history/pump/PumpHistoryEntry.java b/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/history/pump/PumpHistoryEntry.java
similarity index 100%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/history/pump/PumpHistoryEntry.java
rename to medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/history/pump/PumpHistoryEntry.java
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/history/pump/PumpHistoryEntryType.java b/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/history/pump/PumpHistoryEntryType.java
similarity index 100%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/history/pump/PumpHistoryEntryType.java
rename to medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/history/pump/PumpHistoryEntryType.java
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/history/pump/PumpHistoryResult.java b/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/history/pump/PumpHistoryResult.java
similarity index 100%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/history/pump/PumpHistoryResult.java
rename to medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/history/pump/PumpHistoryResult.java
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/message/CarelinkLongMessageBody.java b/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/message/CarelinkLongMessageBody.java
similarity index 100%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/message/CarelinkLongMessageBody.java
rename to medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/message/CarelinkLongMessageBody.java
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/message/CarelinkShortMessageBody.java b/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/message/CarelinkShortMessageBody.java
similarity index 100%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/message/CarelinkShortMessageBody.java
rename to medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/message/CarelinkShortMessageBody.java
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/message/GetHistoryPageCarelinkMessageBody.java b/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/message/GetHistoryPageCarelinkMessageBody.java
similarity index 100%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/message/GetHistoryPageCarelinkMessageBody.java
rename to medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/message/GetHistoryPageCarelinkMessageBody.java
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/message/MessageBody.java b/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/message/MessageBody.java
similarity index 100%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/message/MessageBody.java
rename to medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/message/MessageBody.java
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/message/PacketType.java b/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/message/PacketType.java
similarity index 100%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/message/PacketType.java
rename to medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/message/PacketType.java
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/message/PumpAckMessageBody.java b/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/message/PumpAckMessageBody.java
similarity index 100%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/message/PumpAckMessageBody.java
rename to medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/message/PumpAckMessageBody.java
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/message/PumpMessage.java b/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/message/PumpMessage.java
similarity index 100%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/message/PumpMessage.java
rename to medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/message/PumpMessage.java
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/message/UnknownMessageBody.java b/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/message/UnknownMessageBody.java
similarity index 100%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/message/UnknownMessageBody.java
rename to medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/message/UnknownMessageBody.java
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/ui/MedtronicUIComm.java b/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/ui/MedtronicUIComm.java
similarity index 96%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/ui/MedtronicUIComm.java
rename to medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/ui/MedtronicUIComm.java
index f0731d2d8a..11fb6f849f 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/ui/MedtronicUIComm.java
+++ b/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/ui/MedtronicUIComm.java
@@ -34,7 +34,7 @@ public class MedtronicUIComm {
public synchronized MedtronicUITask executeCommand(MedtronicCommandType commandType, Object... parameters) {
- aapsLogger.warn(LTag.PUMP, "Execute Command: " + commandType.name());
+ aapsLogger.info(LTag.PUMP, "Execute Command: " + commandType.name());
MedtronicUITask task = new MedtronicUITask(injector, commandType, parameters);
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/ui/MedtronicUIPostprocessor.java b/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/ui/MedtronicUIPostprocessor.java
similarity index 98%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/ui/MedtronicUIPostprocessor.java
rename to medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/ui/MedtronicUIPostprocessor.java
index 364337d019..6d71633bea 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/ui/MedtronicUIPostprocessor.java
+++ b/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/ui/MedtronicUIPostprocessor.java
@@ -161,7 +161,8 @@ public class MedtronicUIPostprocessor {
// no postprocessing
default:
- aapsLogger.error(LTag.PUMP, "Post-processing not implemented for {}.", uiTask.commandType.name());
+ break;
+ //aapsLogger.error(LTag.PUMP, "Post-processing not implemented for {}.", uiTask.commandType.name());
}
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/ui/MedtronicUITask.java b/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/ui/MedtronicUITask.java
similarity index 95%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/ui/MedtronicUITask.java
rename to medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/ui/MedtronicUITask.java
index 51a8020fcd..fedacfd117 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/ui/MedtronicUITask.java
+++ b/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/ui/MedtronicUITask.java
@@ -8,15 +8,15 @@ import dagger.android.HasAndroidInjector;
import info.nightscout.androidaps.logging.AAPSLogger;
import info.nightscout.androidaps.logging.LTag;
import info.nightscout.androidaps.plugins.bus.RxBusWrapper;
+import info.nightscout.androidaps.plugins.pump.common.defs.PumpDeviceState;
import info.nightscout.androidaps.plugins.pump.medtronic.comm.MedtronicCommunicationManager;
import info.nightscout.androidaps.plugins.pump.medtronic.comm.history.pump.PumpHistoryEntry;
import info.nightscout.androidaps.plugins.pump.medtronic.data.dto.BasalProfile;
import info.nightscout.androidaps.plugins.pump.medtronic.data.dto.TempBasalPair;
import info.nightscout.androidaps.plugins.pump.medtronic.defs.MedtronicCommandType;
import info.nightscout.androidaps.plugins.pump.medtronic.defs.MedtronicUIResponseType;
-import info.nightscout.androidaps.plugins.pump.medtronic.defs.PumpDeviceState;
import info.nightscout.androidaps.plugins.pump.medtronic.driver.MedtronicPumpStatus;
-import info.nightscout.androidaps.plugins.pump.medtronic.events.EventMedtronicDeviceStatusChange;
+import info.nightscout.androidaps.plugins.pump.common.events.EventRileyLinkDeviceStatusChange;
import info.nightscout.androidaps.plugins.pump.medtronic.events.EventMedtronicPumpValuesChanged;
import info.nightscout.androidaps.plugins.pump.medtronic.util.MedtronicUtil;
@@ -201,10 +201,10 @@ public class MedtronicUITask {
}
if (responseType == MedtronicUIResponseType.Invalid) {
- rxBus.send(new EventMedtronicDeviceStatusChange(PumpDeviceState.ErrorWhenCommunicating,
+ rxBus.send(new EventRileyLinkDeviceStatusChange(PumpDeviceState.ErrorWhenCommunicating,
"Unsupported command in MedtronicUITask"));
} else if (responseType == MedtronicUIResponseType.Error) {
- rxBus.send(new EventMedtronicDeviceStatusChange(PumpDeviceState.ErrorWhenCommunicating,
+ rxBus.send(new EventRileyLinkDeviceStatusChange(PumpDeviceState.ErrorWhenCommunicating,
errorDescription));
} else {
rxBus.send(new EventMedtronicPumpValuesChanged());
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/data/MedtronicHistoryData.java b/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/data/MedtronicHistoryData.java
similarity index 97%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/data/MedtronicHistoryData.java
rename to medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/data/MedtronicHistoryData.java
index 76f011da16..5c2489a5ef 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/data/MedtronicHistoryData.java
+++ b/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/data/MedtronicHistoryData.java
@@ -22,7 +22,6 @@ import javax.inject.Inject;
import javax.inject.Singleton;
import dagger.android.HasAndroidInjector;
-import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.data.DetailedBolusInfo;
import info.nightscout.androidaps.db.CareportalEvent;
import info.nightscout.androidaps.db.DbObjectBase;
@@ -31,6 +30,7 @@ import info.nightscout.androidaps.db.Source;
import info.nightscout.androidaps.db.TDD;
import info.nightscout.androidaps.db.TemporaryBasal;
import info.nightscout.androidaps.interfaces.ActivePluginProvider;
+import info.nightscout.androidaps.interfaces.DatabaseHelperInterface;
import info.nightscout.androidaps.logging.AAPSLogger;
import info.nightscout.androidaps.logging.LTag;
import info.nightscout.androidaps.plugins.general.nsclient.NSUpload;
@@ -52,8 +52,7 @@ import info.nightscout.androidaps.plugins.pump.medtronic.driver.MedtronicPumpSta
import info.nightscout.androidaps.plugins.pump.medtronic.util.MedtronicConst;
import info.nightscout.androidaps.plugins.pump.medtronic.util.MedtronicUtil;
import info.nightscout.androidaps.db.Treatment;
-import info.nightscout.androidaps.plugins.treatments.TreatmentService;
-import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin;
+import info.nightscout.androidaps.plugins.treatments.TreatmentUpdateReturn;
import info.nightscout.androidaps.utils.DateUtil;
import info.nightscout.androidaps.utils.Round;
import info.nightscout.androidaps.utils.sharedPreferences.SP;
@@ -81,6 +80,7 @@ public class MedtronicHistoryData {
private final NSUpload nsUpload;
private final MedtronicUtil medtronicUtil;
private final MedtronicPumpHistoryDecoder medtronicPumpHistoryDecoder;
+ private final DatabaseHelperInterface databaseHelper;
private List allHistory;
private List newHistory = null;
@@ -98,8 +98,10 @@ public class MedtronicHistoryData {
* Double bolus debug. We seem to have small problem with double Boluses (or sometimes also missing boluses
* from history. This flag turns on debugging for that (default is off=false)... Debuging is pretty detailed,
* so log files will get bigger.
+ * Note: June 2020. Since this seems to be fixed, I am disabling this per default. I will leave code inside
+ * in case we need it again. Code that turns this on is commented out RileyLinkMedtronicService#verifyConfiguration()
*/
- public static boolean doubleBolusDebug = false;
+ public static final boolean doubleBolusDebug = false;
@Inject
public MedtronicHistoryData(
@@ -109,7 +111,8 @@ public class MedtronicHistoryData {
ActivePluginProvider activePlugin,
NSUpload nsUpload,
MedtronicUtil medtronicUtil,
- MedtronicPumpHistoryDecoder medtronicPumpHistoryDecoder
+ MedtronicPumpHistoryDecoder medtronicPumpHistoryDecoder,
+ DatabaseHelperInterface databaseHelperInterface
) {
this.allHistory = new ArrayList<>();
@@ -120,6 +123,7 @@ public class MedtronicHistoryData {
this.nsUpload = nsUpload;
this.medtronicUtil = medtronicUtil;
this.medtronicPumpHistoryDecoder = medtronicPumpHistoryDecoder;
+ this.databaseHelper = databaseHelperInterface;
}
private Gson gson() {
@@ -532,7 +536,7 @@ public class MedtronicHistoryData {
private void uploadCareportalEvent(long date, String event) {
- if (MainApp.getDbHelper().getCareportalEventFromTimestamp(date) != null)
+ if (databaseHelper.getCareportalEventFromTimestamp(date) != null)
return;
try {
JSONObject data = new JSONObject();
@@ -545,7 +549,7 @@ public class MedtronicHistoryData {
careportalEvent.source = Source.USER;
careportalEvent.eventType = event;
careportalEvent.json = data.toString();
- MainApp.getDbHelper().createOrUpdate(careportalEvent);
+ databaseHelper.createOrUpdate(careportalEvent);
nsUpload.uploadCareportalEntryToNS(data);
} catch (JSONException e) {
aapsLogger.error("Unhandled exception", e);
@@ -559,7 +563,7 @@ public class MedtronicHistoryData {
aapsLogger.debug(LTag.PUMP, getLogPrefix() + "TDDs found: {}.\n{}", tdds.size(), gson().toJson(tdds));
- List tddsDb = MainApp.getDbHelper().getTDDsForLastXDays(3);
+ List tddsDb = databaseHelper.getTDDsForLastXDays(3);
for (PumpHistoryEntry tdd : tdds) {
@@ -575,7 +579,7 @@ public class MedtronicHistoryData {
aapsLogger.debug(LTag.PUMP, "TDD Add: {}", tddNew);
- MainApp.getDbHelper().createOrUpdateTDD(tddNew);
+ databaseHelper.createOrUpdateTDD(tddNew);
} else {
@@ -584,7 +588,7 @@ public class MedtronicHistoryData {
aapsLogger.debug(LTag.PUMP, "TDD Edit: {}", tddDbEntry);
- MainApp.getDbHelper().createOrUpdateTDD(tddDbEntry);
+ databaseHelper.createOrUpdateTDD(tddDbEntry);
}
}
}
@@ -745,7 +749,7 @@ public class MedtronicHistoryData {
tempBasal.durationInMinutes = tempBasalProcessDTO.getDuration();
- MainApp.getDbHelper().createOrUpdate(tempBasal);
+ databaseHelper.createOrUpdate(tempBasal);
aapsLogger.debug(LTag.PUMP, "Edit " + ProcessHistoryRecord.TBR.getDescription() + " - (entryFromDb={}) ", tempBasal);
} else {
@@ -793,7 +797,7 @@ public class MedtronicHistoryData {
}
}
- TemporaryBasal tempBasal = MainApp.getDbHelper().findTempBasalByPumpId(pumpId);
+ TemporaryBasal tempBasal = databaseHelper.findTempBasalByPumpId(pumpId);
return tempBasal;
}
@@ -884,7 +888,7 @@ public class MedtronicHistoryData {
if (processHistoryRecord == ProcessHistoryRecord.Bolus) {
return activePlugin.getActiveTreatments().getTreatmentsFromHistoryAfterTimestamp(startTimestamp);
} else {
- return MainApp.getDbHelper().getTemporaryBasalsDataFromTime(startTimestamp, true);
+ return databaseHelper.getTemporaryBasalsDataFromTime(startTimestamp, true);
}
}
@@ -992,7 +996,7 @@ public class MedtronicHistoryData {
treatment.pumpId = bolus.getPumpId();
treatment.insulin = bolusDTO.getDeliveredAmount();
- TreatmentService.UpdateReturn updateReturn = ((TreatmentsPlugin) activePlugin.getActiveTreatments()).getService().createOrUpdateMedtronic(treatment, false);
+ TreatmentUpdateReturn updateReturn = activePlugin.getActiveTreatments().createOrUpdateMedtronic(treatment, false);
if (doubleBolusDebug)
aapsLogger.debug(LTag.PUMP, "DoubleBolusDebug: addBolus(tretament!=null): NewTreatment={}, UpdateReturn={}", treatment, updateReturn);
@@ -1042,7 +1046,7 @@ public class MedtronicHistoryData {
treatment.setLinkedObject(temporaryBasalDb);
- MainApp.getDbHelper().createOrUpdate(temporaryBasalDb);
+ databaseHelper.createOrUpdate(temporaryBasalDb);
aapsLogger.debug(LTag.PUMP, operation + " - [date={},pumpId={}, rate={} {}, duration={}]", //
temporaryBasalDb.date, //
@@ -1058,7 +1062,7 @@ public class MedtronicHistoryData {
for (TempBasalProcessDTO tempBasalProcess : tempBasalProcessList) {
- TemporaryBasal tempBasal = MainApp.getDbHelper().findTempBasalByPumpId(tempBasalProcess.itemOne.getPumpId());
+ TemporaryBasal tempBasal = databaseHelper.findTempBasalByPumpId(tempBasalProcess.itemOne.getPumpId());
if (tempBasal == null) {
// add
@@ -1074,7 +1078,7 @@ public class MedtronicHistoryData {
tempBasalProcess.itemOne.setLinkedObject(tempBasal);
tempBasalProcess.itemTwo.setLinkedObject(tempBasal);
- MainApp.getDbHelper().createOrUpdate(tempBasal);
+ databaseHelper.createOrUpdate(tempBasal);
}
}
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/data/dto/BasalProfile.java b/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/data/dto/BasalProfile.java
similarity index 99%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/data/dto/BasalProfile.java
rename to medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/data/dto/BasalProfile.java
index f5ff77cf72..c3f2050805 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/data/dto/BasalProfile.java
+++ b/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/data/dto/BasalProfile.java
@@ -8,7 +8,6 @@ import java.util.ArrayList;
import java.util.List;
import info.nightscout.androidaps.logging.AAPSLogger;
-import info.nightscout.androidaps.logging.L;
import info.nightscout.androidaps.logging.LTag;
import info.nightscout.androidaps.plugins.pump.common.defs.PumpType;
import info.nightscout.androidaps.plugins.pump.common.utils.ByteUtil;
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/data/dto/BasalProfileEntry.java b/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/data/dto/BasalProfileEntry.java
similarity index 100%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/data/dto/BasalProfileEntry.java
rename to medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/data/dto/BasalProfileEntry.java
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/data/dto/BatteryStatusDTO.java b/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/data/dto/BatteryStatusDTO.java
similarity index 100%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/data/dto/BatteryStatusDTO.java
rename to medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/data/dto/BatteryStatusDTO.java
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/data/dto/BolusDTO.java b/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/data/dto/BolusDTO.java
similarity index 100%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/data/dto/BolusDTO.java
rename to medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/data/dto/BolusDTO.java
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/data/dto/BolusWizardDTO.java b/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/data/dto/BolusWizardDTO.java
similarity index 100%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/data/dto/BolusWizardDTO.java
rename to medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/data/dto/BolusWizardDTO.java
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/data/dto/ClockDTO.java b/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/data/dto/ClockDTO.java
similarity index 100%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/data/dto/ClockDTO.java
rename to medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/data/dto/ClockDTO.java
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/data/dto/DailyTotalsDTO.java b/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/data/dto/DailyTotalsDTO.java
similarity index 83%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/data/dto/DailyTotalsDTO.java
rename to medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/data/dto/DailyTotalsDTO.java
index 8ca17e152f..11bd57d017 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/data/dto/DailyTotalsDTO.java
+++ b/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/data/dto/DailyTotalsDTO.java
@@ -1,14 +1,10 @@
package info.nightscout.androidaps.plugins.pump.medtronic.data.dto;
-import com.google.common.base.MoreObjects;
import com.google.gson.annotations.Expose;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.apache.commons.lang3.builder.ToStringBuilder;
import info.nightscout.androidaps.db.TDD;
-import info.nightscout.androidaps.logging.L;
-import info.nightscout.androidaps.logging.StacktraceLoggerWrapper;
import info.nightscout.androidaps.plugins.pump.common.utils.ByteUtil;
import info.nightscout.androidaps.plugins.pump.common.utils.DateTimeUtil;
import info.nightscout.androidaps.plugins.pump.common.utils.StringUtil;
@@ -209,38 +205,37 @@ public class DailyTotalsDTO {
//LOG.debug("523: {}", toString());
}
-
@Override
public String toString() {
- return MoreObjects.toStringHelper(this) //
- .add("bgAvg", bgAvg) //
- .add("bgLow", bgLow) //
- .add("bgHigh", bgHigh) //
- .add("bgCount", bgCount) //
- .add("sensorAvg", sensorAvg) //
- .add("sensorMin", sensorMin) //
- .add("sensorMax", sensorMax) //
- .add("sensorCalcCount", sensorCalcCount) //
- .add("sensorDataCount", sensorDataCount) //
- .add("insulinTotal", insulinTotal) //
- .add("insulinBasal", insulinBasal) //
- .add("insulinBolus", insulinBolus) //
- .add("insulinCarbs", insulinCarbs) //
- .add("bolusTotal", bolusTotal) //
- .add("bolusFood", bolusFood) //
- .add("bolusCorrection", bolusCorrection) //
- .add("bolusManual", bolusManual) //
- .add("bolusCount", bolusCount) //
- .add("bolusCountFoodOrCorr", bolusCountFoodOrCorr) //
- .add("bolusCountFoodAndCorr", bolusCountFoodAndCorr) //
- .add("bolusCountFood", bolusCountFood) //
- .add("bolusCountCorr", bolusCountCorr) //
- .add("bolusCountManual", bolusCountManual) //
- .omitNullValues() //
+ return new ToStringBuilder(this)
+ .append("bgAvg", bgAvg)
+ .append("bgLow", bgLow)
+ .append("bgHigh", bgHigh)
+ .append("bgCount", bgCount)
+ .append("sensorAvg", sensorAvg)
+ .append("sensorMin", sensorMin)
+ .append("sensorMax", sensorMax)
+ .append("sensorCalcCount", sensorCalcCount)
+ .append("sensorDataCount", sensorDataCount)
+ .append("insulinTotal", insulinTotal)
+ .append("insulinBasal", insulinBasal)
+ .append("insulinBolus", insulinBolus)
+ .append("insulinCarbs", insulinCarbs)
+ .append("bolusTotal", bolusTotal)
+ .append("bolusFood", bolusFood)
+ .append("bolusFoodAndCorr", bolusFoodAndCorr)
+ .append("bolusCorrection", bolusCorrection)
+ .append("bolusManual", bolusManual)
+ .append("bolusCount", bolusCount)
+ .append("bolusCountFoodOrCorr", bolusCountFoodOrCorr)
+ .append("bolusCountFoodAndCorr", bolusCountFoodAndCorr)
+ .append("bolusCountManual", bolusCountManual)
+ .append("bolusCountFood", bolusCountFood)
+ .append("bolusCountCorr", bolusCountCorr)
+ .append("entry", entry)
.toString();
}
-
public void setTDD(TDD tdd) {
tdd.date = DateTimeUtil.toMillisFromATD(this.entry.atechDateTime);
tdd.basal = insulinBasal;
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/data/dto/PumpSettingDTO.java b/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/data/dto/PumpSettingDTO.java
similarity index 100%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/data/dto/PumpSettingDTO.java
rename to medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/data/dto/PumpSettingDTO.java
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/data/dto/PumpTimeStampedRecord.java b/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/data/dto/PumpTimeStampedRecord.java
similarity index 100%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/data/dto/PumpTimeStampedRecord.java
rename to medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/data/dto/PumpTimeStampedRecord.java
diff --git a/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/data/dto/RLHistoryItemMedtronic.java b/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/data/dto/RLHistoryItemMedtronic.java
new file mode 100644
index 0000000000..399f58e8ac
--- /dev/null
+++ b/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/data/dto/RLHistoryItemMedtronic.java
@@ -0,0 +1,41 @@
+package info.nightscout.androidaps.plugins.pump.medtronic.data.dto;
+
+import org.joda.time.LocalDateTime;
+
+import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.data.RLHistoryItem;
+import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkError;
+import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkServiceState;
+import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkTargetDevice;
+import info.nightscout.androidaps.plugins.pump.medtronic.defs.MedtronicCommandType;
+import info.nightscout.androidaps.utils.resources.ResourceHelper;
+
+public class RLHistoryItemMedtronic extends RLHistoryItem {
+
+ private MedtronicCommandType medtronicCommandType;
+
+ public RLHistoryItemMedtronic(MedtronicCommandType medtronicCommandType) {
+ super(new LocalDateTime(), RLHistoryItemSource.MedtronicCommand, RileyLinkTargetDevice.MedtronicPump);
+ this.medtronicCommandType = medtronicCommandType;
+ }
+
+ public String getDescription(ResourceHelper resourceHelper) {
+
+ switch (this.source) {
+ case RileyLink:
+ return "State: " + resourceHelper.gs(serviceState.getResourceId(targetDevice))
+ + (this.errorCode == null ? "" : ", Error Code: " + errorCode);
+
+ case MedtronicPump:
+ return resourceHelper.gs(pumpDeviceState.getResourceId());
+
+ case MedtronicCommand:
+ return medtronicCommandType.name();
+
+ default:
+ return "Unknown Description";
+ }
+ }
+
+
+
+}
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/data/dto/TempBasalPair.java b/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/data/dto/TempBasalPair.java
similarity index 98%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/data/dto/TempBasalPair.java
rename to medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/data/dto/TempBasalPair.java
index bf3e771b1e..983f428a8f 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/data/dto/TempBasalPair.java
+++ b/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/data/dto/TempBasalPair.java
@@ -7,7 +7,6 @@ import java.util.List;
import java.util.Locale;
import info.nightscout.androidaps.logging.AAPSLogger;
-import info.nightscout.androidaps.logging.L;
import info.nightscout.androidaps.logging.LTag;
import info.nightscout.androidaps.plugins.pump.common.utils.ByteUtil;
import info.nightscout.androidaps.plugins.pump.medtronic.util.MedtronicUtil;
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/data/dto/TempBasalProcessDTO.java b/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/data/dto/TempBasalProcessDTO.java
similarity index 100%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/data/dto/TempBasalProcessDTO.java
rename to medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/data/dto/TempBasalProcessDTO.java
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/defs/BasalProfileStatus.java b/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/defs/BasalProfileStatus.java
similarity index 100%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/defs/BasalProfileStatus.java
rename to medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/defs/BasalProfileStatus.java
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/defs/BatteryType.java b/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/defs/BatteryType.java
similarity index 91%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/defs/BatteryType.java
rename to medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/defs/BatteryType.java
index 7552b50d7f..503074e640 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/defs/BatteryType.java
+++ b/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/defs/BatteryType.java
@@ -5,8 +5,8 @@ import androidx.annotation.StringRes;
import java.util.HashMap;
import java.util.Map;
-import info.nightscout.androidaps.MainApp;
-import info.nightscout.androidaps.R;
+import info.nightscout.androidaps.plugins.pump.medtronic.R;
+
/**
* Created by andy on 6/4/18.
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/defs/CommandValueDefinitionMDTType.java b/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/defs/CommandValueDefinitionMDTType.java
similarity index 100%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/defs/CommandValueDefinitionMDTType.java
rename to medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/defs/CommandValueDefinitionMDTType.java
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/defs/MedtronicCommandType.java b/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/defs/MedtronicCommandType.java
similarity index 99%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/defs/MedtronicCommandType.java
rename to medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/defs/MedtronicCommandType.java
index 516085269a..0c14ac42f8 100755
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/defs/MedtronicCommandType.java
+++ b/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/defs/MedtronicCommandType.java
@@ -4,7 +4,7 @@ import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
-import info.nightscout.androidaps.R;
+import info.nightscout.androidaps.plugins.pump.medtronic.R;
import info.nightscout.androidaps.plugins.pump.medtronic.comm.message.MessageBody;
import info.nightscout.androidaps.plugins.pump.medtronic.comm.message.PumpAckMessageBody;
import info.nightscout.androidaps.plugins.pump.medtronic.comm.message.UnknownMessageBody;
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/defs/MedtronicCustomActionType.java b/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/defs/MedtronicCustomActionType.java
similarity index 100%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/defs/MedtronicCustomActionType.java
rename to medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/defs/MedtronicCustomActionType.java
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/defs/MedtronicDeviceType.java b/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/defs/MedtronicDeviceType.java
similarity index 100%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/defs/MedtronicDeviceType.java
rename to medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/defs/MedtronicDeviceType.java
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/defs/MedtronicNotificationType.java b/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/defs/MedtronicNotificationType.java
similarity index 89%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/defs/MedtronicNotificationType.java
rename to medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/defs/MedtronicNotificationType.java
index d11d6ad64c..c472ad3520 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/defs/MedtronicNotificationType.java
+++ b/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/defs/MedtronicNotificationType.java
@@ -1,7 +1,7 @@
package info.nightscout.androidaps.plugins.pump.medtronic.defs;
-import info.nightscout.androidaps.R;
import info.nightscout.androidaps.plugins.general.overview.notifications.Notification;
+import info.nightscout.androidaps.plugins.pump.medtronic.R;
/**
* Created by andy on 10/15/18.
@@ -16,8 +16,8 @@ public enum MedtronicNotificationType {
PumpWrongTBRTypeSet(R.string.medtronic_error_pump_wrong_tbr_type_set, Notification.URGENT), //
PumpWrongMaxBolusSet(R.string.medtronic_error_pump_wrong_max_bolus_set, Notification.NORMAL), //
PumpWrongMaxBasalSet(R.string.medtronic_error_pump_wrong_max_basal_set, Notification.NORMAL), //
- PumpWrongTimeUrgent(R.string.combo_notification_check_time_date, Notification.URGENT),
- PumpWrongTimeNormal(R.string.combo_notification_check_time_date, Notification.NORMAL),
+ PumpWrongTimeUrgent(R.string.medtronic_notification_check_time_date, Notification.URGENT),
+ PumpWrongTimeNormal(R.string.medtronic_notification_check_time_date, Notification.NORMAL),
TimeChangeOver24h(Notification.OVER_24H_TIME_CHANGE_REQUESTED, R.string.medtronic_error_pump_24h_time_change_requested, Notification.URGENT),
//
;
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/defs/MedtronicStatusRefreshType.java b/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/defs/MedtronicStatusRefreshType.java
similarity index 100%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/defs/MedtronicStatusRefreshType.java
rename to medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/defs/MedtronicStatusRefreshType.java
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/defs/MedtronicUIResponseType.java b/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/defs/MedtronicUIResponseType.java
similarity index 100%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/defs/MedtronicUIResponseType.java
rename to medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/defs/MedtronicUIResponseType.java
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/defs/PumpBolusType.java b/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/defs/PumpBolusType.java
similarity index 100%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/defs/PumpBolusType.java
rename to medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/defs/PumpBolusType.java
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/defs/PumpConfigurationGroup.java b/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/defs/PumpConfigurationGroup.java
similarity index 100%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/defs/PumpConfigurationGroup.java
rename to medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/defs/PumpConfigurationGroup.java
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/dialog/MedtronicHistoryActivity.java b/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/dialog/MedtronicHistoryActivity.java
similarity index 99%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/dialog/MedtronicHistoryActivity.java
rename to medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/dialog/MedtronicHistoryActivity.java
index 1d5d300b49..fc986f4f83 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/dialog/MedtronicHistoryActivity.java
+++ b/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/dialog/MedtronicHistoryActivity.java
@@ -18,9 +18,9 @@ import java.util.List;
import javax.inject.Inject;
-import info.nightscout.androidaps.R;
import info.nightscout.androidaps.activities.NoSplashAppCompatActivity;
import info.nightscout.androidaps.plugins.pump.common.defs.PumpHistoryEntryGroup;
+import info.nightscout.androidaps.plugins.pump.medtronic.R;
import info.nightscout.androidaps.plugins.pump.medtronic.comm.history.pump.PumpHistoryEntry;
import info.nightscout.androidaps.plugins.pump.medtronic.data.MedtronicHistoryData;
import info.nightscout.androidaps.utils.resources.ResourceHelper;
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/dialog/RileyLinkStatusDeviceMedtronic.java b/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/dialog/RileyLinkStatusDeviceMedtronic.java
similarity index 98%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/dialog/RileyLinkStatusDeviceMedtronic.java
rename to medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/dialog/RileyLinkStatusDeviceMedtronic.java
index 616f033799..0d21b195df 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/dialog/RileyLinkStatusDeviceMedtronic.java
+++ b/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/dialog/RileyLinkStatusDeviceMedtronic.java
@@ -14,10 +14,10 @@ import java.util.List;
import javax.inject.Inject;
import dagger.android.support.DaggerFragment;
-import info.nightscout.androidaps.R;
import info.nightscout.androidaps.plugins.pump.common.dialog.RefreshableInterface;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.data.RLHistoryItem;
import info.nightscout.androidaps.plugins.pump.common.utils.StringUtil;
+import info.nightscout.androidaps.plugins.pump.medtronic.R;
import info.nightscout.androidaps.utils.DateUtil;
import info.nightscout.androidaps.utils.resources.ResourceHelper;
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/driver/MedtronicPumpStatus.java b/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/driver/MedtronicPumpStatus.java
similarity index 87%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/driver/MedtronicPumpStatus.java
rename to medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/driver/MedtronicPumpStatus.java
index f7686fa824..1dcf799a2e 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/driver/MedtronicPumpStatus.java
+++ b/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/driver/MedtronicPumpStatus.java
@@ -12,7 +12,7 @@ import javax.inject.Inject;
import javax.inject.Singleton;
import info.nightscout.androidaps.plugins.bus.RxBusWrapper;
-import info.nightscout.androidaps.plugins.pump.common.data.PumpStatus;
+import info.nightscout.androidaps.plugins.pump.common.defs.PumpDeviceState;
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.common.hw.rileylink.data.RLHistoryItem;
@@ -20,18 +20,19 @@ import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLin
import info.nightscout.androidaps.plugins.pump.medtronic.defs.BasalProfileStatus;
import info.nightscout.androidaps.plugins.pump.medtronic.defs.BatteryType;
import info.nightscout.androidaps.plugins.pump.medtronic.defs.MedtronicDeviceType;
-import info.nightscout.androidaps.plugins.pump.medtronic.defs.PumpDeviceState;
-import info.nightscout.androidaps.plugins.pump.medtronic.events.EventMedtronicDeviceStatusChange;
+import info.nightscout.androidaps.plugins.pump.common.events.EventRileyLinkDeviceStatusChange;
import info.nightscout.androidaps.plugins.pump.medtronic.util.MedtronicConst;
import info.nightscout.androidaps.utils.resources.ResourceHelper;
import info.nightscout.androidaps.utils.sharedPreferences.SP;
+
+
/**
* Created by andy on 4/28/18.
*/
@Singleton
-public class MedtronicPumpStatus extends PumpStatus {
+public class MedtronicPumpStatus extends info.nightscout.androidaps.plugins.pump.common.data.PumpStatus {
private final ResourceHelper resourceHelper;
private final SP sp;
@@ -164,6 +165,28 @@ public class MedtronicPumpStatus extends PumpStatus {
return (errorDescription == null) ? "-" : errorDescription;
}
+ @Override
+ public E getCustomData(String key, Class clazz) {
+ switch(key) {
+ case "SERIAL_NUMBER":
+ return (E)serialNumber;
+
+ case "PUMP_FREQUENCY":
+ return (E)pumpFrequency;
+
+ case "PUMP_MODEL": {
+ if (medtronicDeviceType==null)
+ return null;
+ else
+ return (E)medtronicDeviceType.getPumpModel();
+ }
+
+
+ default:
+ return null;
+ }
+ }
+
public PumpDeviceState getPumpDeviceState() {
return pumpDeviceState;
}
@@ -174,6 +197,6 @@ public class MedtronicPumpStatus extends PumpStatus {
rileyLinkUtil.getRileyLinkHistory().add(new RLHistoryItem(pumpDeviceState, RileyLinkTargetDevice.MedtronicPump));
- rxBus.send(new EventMedtronicDeviceStatusChange(pumpDeviceState));
+ rxBus.send(new EventRileyLinkDeviceStatusChange(pumpDeviceState));
}
}
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/events/EventMedtronicPumpConfigurationChanged.kt b/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/events/EventMedtronicPumpConfigurationChanged.kt
similarity index 100%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/events/EventMedtronicPumpConfigurationChanged.kt
rename to medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/events/EventMedtronicPumpConfigurationChanged.kt
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/events/EventMedtronicPumpValuesChanged.kt b/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/events/EventMedtronicPumpValuesChanged.kt
similarity index 100%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/events/EventMedtronicPumpValuesChanged.kt
rename to medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/events/EventMedtronicPumpValuesChanged.kt
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/service/RileyLinkMedtronicService.java b/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/service/RileyLinkMedtronicService.java
similarity index 96%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/service/RileyLinkMedtronicService.java
rename to medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/service/RileyLinkMedtronicService.java
index 7ae299036d..097633f574 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/service/RileyLinkMedtronicService.java
+++ b/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/service/RileyLinkMedtronicService.java
@@ -8,9 +8,8 @@ import android.os.IBinder;
import javax.inject.Inject;
-import dagger.android.HasAndroidInjector;
-import info.nightscout.androidaps.R;
import info.nightscout.androidaps.logging.LTag;
+import info.nightscout.androidaps.plugins.pump.common.defs.PumpDeviceState;
import info.nightscout.androidaps.plugins.pump.common.defs.PumpType;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkConst;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.RFSpy;
@@ -22,16 +21,15 @@ import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLin
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.RileyLinkService;
import info.nightscout.androidaps.plugins.pump.common.utils.ByteUtil;
import info.nightscout.androidaps.plugins.pump.medtronic.MedtronicPumpPlugin;
+import info.nightscout.androidaps.plugins.pump.medtronic.R;
import info.nightscout.androidaps.plugins.pump.medtronic.comm.MedtronicCommunicationManager;
import info.nightscout.androidaps.plugins.pump.medtronic.comm.ui.MedtronicUIComm;
import info.nightscout.androidaps.plugins.pump.medtronic.comm.ui.MedtronicUIPostprocessor;
import info.nightscout.androidaps.plugins.pump.medtronic.data.MedtronicHistoryData;
import info.nightscout.androidaps.plugins.pump.medtronic.defs.BatteryType;
-import info.nightscout.androidaps.plugins.pump.medtronic.defs.PumpDeviceState;
import info.nightscout.androidaps.plugins.pump.medtronic.driver.MedtronicPumpStatus;
import info.nightscout.androidaps.plugins.pump.medtronic.util.MedtronicConst;
import info.nightscout.androidaps.plugins.pump.medtronic.util.MedtronicUtil;
-import info.nightscout.androidaps.utils.resources.ResourceHelper;
/**
* RileyLinkMedtronicService is intended to stay running when the gui-app is closed.
@@ -339,11 +337,9 @@ public class RileyLinkMedtronicService extends RileyLinkService {
medtronicPumpStatus.batteryType = batteryType;
}
- String bolusDebugEnabled = sp.getStringOrNull(MedtronicConst.Prefs.BolusDebugEnabled, null);
-
- boolean bolusDebug = bolusDebugEnabled != null && bolusDebugEnabled.equals(resourceHelper.gs(R.string.common_on));
-
- MedtronicHistoryData.doubleBolusDebug = bolusDebug;
+ //String bolusDebugEnabled = sp.getStringOrNull(MedtronicConst.Prefs.BolusDebugEnabled, null);
+ //boolean bolusDebug = bolusDebugEnabled != null && bolusDebugEnabled.equals(resourceHelper.gs(R.string.common_on));
+ //MedtronicHistoryData.doubleBolusDebug = bolusDebug;
reconfigureService();
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/util/MedtronicConst.java b/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/util/MedtronicConst.java
similarity index 94%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/util/MedtronicConst.java
rename to medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/util/MedtronicConst.java
index fef95087de..141b23ed3a 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/util/MedtronicConst.java
+++ b/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/util/MedtronicConst.java
@@ -1,6 +1,6 @@
package info.nightscout.androidaps.plugins.pump.medtronic.util;
-import info.nightscout.androidaps.R;
+import info.nightscout.androidaps.plugins.pump.medtronic.R;
/**
* Created by andy on 5/12/18.
@@ -10,7 +10,7 @@ public class MedtronicConst {
static final String Prefix = "AAPS.Medtronic.";
- public class Prefs {
+ public static class Prefs {
public static final int PumpSerial = R.string.key_medtronic_serial;
public static final int PumpType = R.string.key_medtronic_pump_type;
public static final int PumpFrequency = R.string.key_medtronic_frequency;
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/util/MedtronicUtil.java b/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/util/MedtronicUtil.java
similarity index 95%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/util/MedtronicUtil.java
rename to medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/util/MedtronicUtil.java
index a4e7a51ec2..2e17b7808f 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/util/MedtronicUtil.java
+++ b/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/util/MedtronicUtil.java
@@ -26,11 +26,12 @@ import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.Riley
import info.nightscout.androidaps.plugins.pump.common.utils.ByteUtil;
import info.nightscout.androidaps.plugins.pump.medtronic.data.dto.ClockDTO;
import info.nightscout.androidaps.plugins.pump.medtronic.data.dto.PumpSettingDTO;
+import info.nightscout.androidaps.plugins.pump.medtronic.data.dto.RLHistoryItemMedtronic;
import info.nightscout.androidaps.plugins.pump.medtronic.defs.MedtronicCommandType;
import info.nightscout.androidaps.plugins.pump.medtronic.defs.MedtronicDeviceType;
import info.nightscout.androidaps.plugins.pump.medtronic.defs.MedtronicNotificationType;
import info.nightscout.androidaps.plugins.pump.medtronic.driver.MedtronicPumpStatus;
-import info.nightscout.androidaps.plugins.pump.medtronic.events.EventMedtronicDeviceStatusChange;
+import info.nightscout.androidaps.plugins.pump.common.events.EventRileyLinkDeviceStatusChange;
import info.nightscout.androidaps.utils.resources.ResourceHelper;
/**
@@ -42,7 +43,7 @@ public class MedtronicUtil {
private int ENVELOPE_SIZE = 4; // 0xA7 S1 S2 S3 CMD PARAM_COUNT [PARAMS]
private static boolean lowLevelDebug = true;
- private MedtronicDeviceType medtronicPumpModel;
+ //private MedtronicDeviceType medtronicPumpModel;
private MedtronicCommandType currentCommand;
private Map settings;
private int BIG_FRAME_LENGTH = 65;
@@ -144,7 +145,7 @@ public class MedtronicUtil {
public byte[] getBolusStrokes(double amount) {
- int strokesPerUnit = medtronicPumpModel.getBolusStrokes();
+ int strokesPerUnit = medtronicPumpStatus.medtronicDeviceType.getBolusStrokes();
int length;
int scrollRate;
@@ -391,15 +392,15 @@ public class MedtronicUtil {
}
public boolean isModelSet() {
- return medtronicPumpModel != null;
+ return medtronicPumpStatus.medtronicDeviceType != null;
}
public MedtronicDeviceType getMedtronicPumpModel() {
- return medtronicPumpModel;
+ return medtronicPumpStatus.medtronicDeviceType;
}
public void setMedtronicPumpModel(MedtronicDeviceType medtronicPumpModel) {
- this.medtronicPumpModel = medtronicPumpModel;
+ this.medtronicPumpStatus.medtronicDeviceType = medtronicPumpModel;
}
public MedtronicCommandType getCurrentCommand() {
@@ -410,7 +411,7 @@ public class MedtronicUtil {
this.currentCommand = currentCommand;
if (currentCommand != null)
- rileyLinkUtil.getRileyLinkHistory().add(new RLHistoryItem(currentCommand));
+ rileyLinkUtil.getRileyLinkHistory().add(new RLHistoryItemMedtronic(currentCommand));
}
@@ -426,7 +427,7 @@ public class MedtronicUtil {
setCurrentCommand(currentCommand);
}
- rxBus.send(new EventMedtronicDeviceStatusChange(medtronicPumpStatus.getPumpDeviceState()));
+ rxBus.send(new EventRileyLinkDeviceStatusChange(medtronicPumpStatus.getPumpDeviceState()));
}
diff --git a/app/src/main/res/layout/medtronic_fragment.xml b/medtronic/src/main/res/layout/medtronic_fragment.xml
similarity index 100%
rename from app/src/main/res/layout/medtronic_fragment.xml
rename to medtronic/src/main/res/layout/medtronic_fragment.xml
diff --git a/app/src/main/res/layout/medtronic_history_activity.xml b/medtronic/src/main/res/layout/medtronic_history_activity.xml
similarity index 100%
rename from app/src/main/res/layout/medtronic_history_activity.xml
rename to medtronic/src/main/res/layout/medtronic_history_activity.xml
diff --git a/app/src/main/res/layout/medtronic_history_item.xml b/medtronic/src/main/res/layout/medtronic_history_item.xml
similarity index 100%
rename from app/src/main/res/layout/medtronic_history_item.xml
rename to medtronic/src/main/res/layout/medtronic_history_item.xml
diff --git a/medtronic/src/main/res/values/strings.xml b/medtronic/src/main/res/values/strings.xml
new file mode 100644
index 0000000000..abcf6d97d6
--- /dev/null
+++ b/medtronic/src/main/res/values/strings.xml
@@ -0,0 +1,117 @@
+
+
+
+ Medtronic
+ MDT
+ Pump integration for Medtronic, requires RileyLink device and specific Pump Model
+
+
+ pref_medtronic_serial
+ pref_medtronic_pump_type
+ pref_medtronic_frequency
+ pref_medtronic_max_bolus
+ pref_medtronic_max_basal
+ pref_medtronic_bolus_delay
+ pref_medtronic_encoding
+ pref_medtronic_battery_type
+ pref_medtronic_bolus_debug
+ pref_rileylink_mac_address
+ medtronic_pump_frequency_us_ca
+ medtronic_pump_frequency_worldwide
+ medtronic_pump_encoding_4b6b_local
+ medtronic_pump_encoding_4b6b_rileylink
+ medtronic_pump_battery_no
+ medtronic_pump_battery_alkaline
+ medtronic_pump_battery_lithium
+ medtronic_pump_battery_nizn
+ medtronic_pump_battery_nimh
+
+ Pump Serial Number
+ Pump Type
+ Pump Frequency
+ Delay before Bolus is started (s)
+ Max Bolus on Pump (U)
+ Max Basal on Pump (U/h)
+ Medtronic Encoding
+ US & Canada (916 MHz)
+ Worldwide (868 Mhz)
+ Software 4b6b Encoding
+ Hardware 4b6b Encoding
+ Wake and Tune Up
+ Clear Bolus Block
+ Reset RileyLink Config
+ Battery Type (Power View)
+ Not selected (Simple view)
+ Alkaline (Extended view)
+ Lithium (Extended view)
+ NiZn (Extended view)
+ NiMH (Extended view)
+ Bolus/Treatments Debugging
+
+
+
+
+ Errors
+ Serial # not set.
+ Serial # invalid.
+ Pump Type not set.
+ Pump Type unsupported.
+ Pump Frequency not set.
+ Pump Frequency unsupported.
+ RileyLink Address invalid.
+ Pump type detected is not the same as configured type.
+
+ Basal profiles/patterns setting is not enabled on pump. Enable it on the pump.
+ Basal profile set on pump is incorrect (must be STD).
+ Wrong TBR type set on pump (must be Absolute).
+ Wrong Max Bolus set on Pump (must be %1$.2f).
+ Wrong Max Basal set on Pump (must be %1$.2f).
+ Operation is not possible.\n\n You need to configure Medtronic Pump first, before you can use this operation.
+ Over 24h Time change was requested.
+
+
+
+
+
+
+
+
+ Medtronic Pump History
+
+
+
+
+
+ You cancelled Bolus, after it was already set on Pump. Since Medtronic Pump doesn\'t support cancel, you will need to manually cancel it. Put the Pump into Suspend mode and then do Resume (if you still want to cancel). Application will pick up changes, on next update (in less than 5 minutes).
+ Could not read current TBR.
+ Could not cancel current TBR. Stopping operation.
+ Profile set failed, because following patterns, have too big basal rate: %1$s
+ Bolus could not be delivered.
+ Bolus could not be delivered, because available insulin amount (%1$.2f) is less than bolus required (%2$.2f).
+ TBR could not be set.
+ Could not cancel current TBR.
+ Basal profile could not be set.
+ Basal profile is the same, so it will not be set again.
+
+ Get History - Page %1$d (%2$d/16)
+ Get History - Page %1$d
+ Get Pump Time
+ Get Settings
+ Get Pump Model
+ Get Basal Profile
+ Set Basal Profile
+ Get Temporary Basal
+ Set Temporary Basal
+ Set Bolus
+
+ Pump unreachable
+ Warning
+ Now
+ ago
+ Pump clock update needed
+ On
+ Off
+ Pump time updated
+ set_neutral_temps
+
+
\ No newline at end of file
diff --git a/app/src/main/res/xml/pref_medtronic.xml b/medtronic/src/main/res/xml/pref_medtronic.xml
similarity index 100%
rename from app/src/main/res/xml/pref_medtronic.xml
rename to medtronic/src/main/res/xml/pref_medtronic.xml
diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/MedtronicConverterUTest.java b/medtronic/src/test/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/MedtronicConverterUTest.java
similarity index 70%
rename from app/src/test/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/MedtronicConverterUTest.java
rename to medtronic/src/test/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/MedtronicConverterUTest.java
index 1e10544e88..be499cdc97 100644
--- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/MedtronicConverterUTest.java
+++ b/medtronic/src/test/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/MedtronicConverterUTest.java
@@ -1,15 +1,6 @@
package info.nightscout.androidaps.plugins.pump.medtronic.comm;
-import java.util.Map;
-
import org.junit.Ignore;
-import org.junit.Test;
-
-import info.nightscout.androidaps.plugins.pump.common.utils.ByteUtil;
-import info.nightscout.androidaps.plugins.pump.medtronic.data.dto.PumpSettingDTO;
-import info.nightscout.androidaps.plugins.pump.medtronic.defs.MedtronicCommandType;
-import info.nightscout.androidaps.plugins.pump.medtronic.defs.MedtronicDeviceType;
-import info.nightscout.androidaps.plugins.pump.medtronic.util.MedtronicUtil;
/**
* Created by andy on 1/30/19.
diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/MedtronicHistoryDataUTest.java b/medtronic/src/test/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/MedtronicHistoryDataUTest.java
similarity index 96%
rename from app/src/test/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/MedtronicHistoryDataUTest.java
rename to medtronic/src/test/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/MedtronicHistoryDataUTest.java
index 824d9a3f1e..e02c4bab20 100644
--- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/MedtronicHistoryDataUTest.java
+++ b/medtronic/src/test/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/MedtronicHistoryDataUTest.java
@@ -1,18 +1,5 @@
package info.nightscout.androidaps.plugins.pump.medtronic.comm;
-import android.util.Log;
-
-import org.junit.Before;
-
-import java.util.List;
-
-import info.nightscout.androidaps.R;
-import info.nightscout.androidaps.plugins.pump.common.utils.ByteUtil;
-import info.nightscout.androidaps.plugins.pump.medtronic.comm.history.RawHistoryPage;
-import info.nightscout.androidaps.plugins.pump.medtronic.comm.history.pump.MedtronicPumpHistoryDecoder;
-import info.nightscout.androidaps.plugins.pump.medtronic.comm.history.pump.PumpHistoryEntry;
-
-import static org.mockito.Mockito.when;
//import uk.org.lidalia.slf4jtest.TestLogger;
//import uk.org.lidalia.slf4jtest.TestLoggerFactory;
diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/history/pump/MedtronicPumpHistoryDecoderUTest.java b/medtronic/src/test/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/history/pump/MedtronicPumpHistoryDecoderUTest.java
similarity index 98%
rename from app/src/test/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/history/pump/MedtronicPumpHistoryDecoderUTest.java
rename to medtronic/src/test/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/history/pump/MedtronicPumpHistoryDecoderUTest.java
index 0420dba922..3cfd7dc067 100644
--- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/history/pump/MedtronicPumpHistoryDecoderUTest.java
+++ b/medtronic/src/test/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/history/pump/MedtronicPumpHistoryDecoderUTest.java
@@ -1,10 +1,8 @@
package info.nightscout.androidaps.plugins.pump.medtronic.comm.history.pump;
-import org.junit.Before;
import org.junit.Ignore;
import info.nightscout.androidaps.plugins.pump.common.defs.PumpHistoryEntryGroup;
-import info.nightscout.androidaps.plugins.pump.common.utils.ByteUtil;
/**
* Created by andy on 11/1/18.
diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/history/pump/PumpHistoryEntryUTest.java b/medtronic/src/test/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/history/pump/PumpHistoryEntryUTest.java
similarity index 97%
rename from app/src/test/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/history/pump/PumpHistoryEntryUTest.java
rename to medtronic/src/test/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/history/pump/PumpHistoryEntryUTest.java
index c668f53f06..af8c7b0d0a 100644
--- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/history/pump/PumpHistoryEntryUTest.java
+++ b/medtronic/src/test/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/history/pump/PumpHistoryEntryUTest.java
@@ -1,7 +1,6 @@
package info.nightscout.androidaps.plugins.pump.medtronic.comm.history.pump;
import org.junit.Assert;
-import org.junit.Test;
import java.util.Date;
diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/medtronic/data/dto/BasalProfileUTest.java b/medtronic/src/test/java/info/nightscout/androidaps/plugins/pump/medtronic/data/dto/BasalProfileUTest.java
similarity index 94%
rename from app/src/test/java/info/nightscout/androidaps/plugins/pump/medtronic/data/dto/BasalProfileUTest.java
rename to medtronic/src/test/java/info/nightscout/androidaps/plugins/pump/medtronic/data/dto/BasalProfileUTest.java
index 21b98660d6..8b2eaa3e7e 100644
--- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/medtronic/data/dto/BasalProfileUTest.java
+++ b/medtronic/src/test/java/info/nightscout/androidaps/plugins/pump/medtronic/data/dto/BasalProfileUTest.java
@@ -1,20 +1,9 @@
package info.nightscout.androidaps.plugins.pump.medtronic.data.dto;
-import junit.framework.Assert;
-
-import org.junit.Before;
import org.junit.Ignore;
-import org.junit.Test;
-import org.powermock.api.mockito.PowerMockito;
-import info.nightscout.androidaps.interfaces.PumpDescription;
-import info.nightscout.androidaps.plugins.pump.common.defs.PumpType;
import info.nightscout.androidaps.plugins.pump.medtronic.driver.MedtronicPumpStatus;
import info.nightscout.androidaps.plugins.pump.medtronic.util.MedtronicUtil;
-import info.nightscout.androidaps.utils.DateUtil;
-import info.nightscout.androidaps.utils.T;
-
-import static org.mockito.Mockito.when;
/**
* Created by andy on 6/16/18.
diff --git a/rileylink/.gitignore b/rileylink/.gitignore
new file mode 100644
index 0000000000..796b96d1c4
--- /dev/null
+++ b/rileylink/.gitignore
@@ -0,0 +1 @@
+/build
diff --git a/rileylink/build.gradle b/rileylink/build.gradle
new file mode 100644
index 0000000000..07b262bfeb
--- /dev/null
+++ b/rileylink/build.gradle
@@ -0,0 +1,81 @@
+apply plugin: 'com.android.library'
+apply plugin: 'kotlin-android'
+apply plugin: 'kotlin-android-extensions'
+apply plugin: 'kotlin-kapt'
+
+android {
+ compileSdkVersion 28
+
+ defaultConfig {
+ minSdkVersion 24
+ targetSdkVersion 28
+ versionCode 1
+ versionName "1.0"
+
+ testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
+ consumerProguardFiles 'consumer-rules.pro'
+ }
+
+ kotlinOptions {
+ jvmTarget = '1.8'
+ }
+
+ buildTypes {
+ release {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
+ }
+ debug {
+ testCoverageEnabled(project.hasProperty('coverage'))
+ }
+ firebaseDisable {
+ System.setProperty("disableFirebase", "true")
+ ext.enableCrashlytics = false
+ }
+ }
+ compileOptions {
+ sourceCompatibility JavaVersion.VERSION_1_8
+ targetCompatibility JavaVersion.VERSION_1_8
+ }
+}
+
+dependencies {
+ implementation project(':core')
+
+ implementation fileTree(dir: 'libs', include: ['*.jar'])
+ implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
+ implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
+ implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutinesVersion"
+ implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutinesVersion"
+
+ implementation 'androidx.appcompat:appcompat:1.1.0'
+ implementation 'androidx.legacy:legacy-support-v13:1.0.0'
+ implementation 'androidx.core:core-ktx:1.2.0'
+ implementation "androidx.preference:preference-ktx:1.1.1"
+ implementation "androidx.activity:activity-ktx:${activityVersion}"
+ implementation 'com.google.android.material:material:1.1.0'
+
+ implementation "io.reactivex.rxjava2:rxandroid:${rxandroid_version}"
+
+ // Graphview cannot be upgraded
+ implementation "com.jjoe64:graphview:4.0.1"
+
+ implementation "com.joanzapata.iconify:android-iconify-fontawesome:2.2.2"
+
+ // rileylink - start
+ implementation 'org.apache.commons:commons-lang3:3.10'
+ implementation 'net.danlew:android.joda:2.10.6'
+ implementation 'org.slf4j:slf4j-api:1.7.30'
+ // rileylink - end
+
+ implementation "com.google.dagger:dagger-android:$dagger_version"
+ implementation "com.google.dagger:dagger-android-support:$dagger_version"
+ annotationProcessor "com.google.dagger:dagger-compiler:$dagger_version"
+ annotationProcessor "com.google.dagger:dagger-android-processor:$dagger_version"
+ kapt "com.google.dagger:dagger-android-processor:$dagger_version"
+ kapt "com.google.dagger:dagger-compiler:$dagger_version"
+
+ testImplementation 'junit:junit:4.13'
+ androidTestImplementation 'androidx.test.ext:junit:1.1.1'
+ androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
+}
diff --git a/rileylink/consumer-rules.pro b/rileylink/consumer-rules.pro
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/rileylink/proguard-rules.pro b/rileylink/proguard-rules.pro
new file mode 100644
index 0000000000..f1b424510d
--- /dev/null
+++ b/rileylink/proguard-rules.pro
@@ -0,0 +1,21 @@
+# Add project specific ProGuard rules here.
+# You can control the set of applied configuration files using the
+# proguardFiles setting in build.gradle.
+#
+# For more details, see
+# http://developer.android.com/guide/developing/tools/proguard.html
+
+# If your project uses WebView with JS, uncomment the following
+# and specify the fully qualified class name to the JavaScript interface
+# class:
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
+# public *;
+#}
+
+# Uncomment this to preserve the line number information for
+# debugging stack traces.
+#-keepattributes SourceFile,LineNumberTable
+
+# If you keep the line number information, uncomment this to
+# hide the original source file name.
+#-renamesourcefileattribute SourceFile
diff --git a/rileylink/src/androidTest/java/info/nightscout/androidaps/plugins/pump/common/ExampleInstrumentedTest.java b/rileylink/src/androidTest/java/info/nightscout/androidaps/plugins/pump/common/ExampleInstrumentedTest.java
new file mode 100644
index 0000000000..9942e86384
--- /dev/null
+++ b/rileylink/src/androidTest/java/info/nightscout/androidaps/plugins/pump/common/ExampleInstrumentedTest.java
@@ -0,0 +1,27 @@
+package info.nightscout.androidaps.plugins.pump.common;
+
+import android.content.Context;
+
+import androidx.test.platform.app.InstrumentationRegistry;
+import androidx.test.ext.junit.runners.AndroidJUnit4;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import static org.junit.Assert.*;
+
+/**
+ * Instrumented test, which will execute on an Android device.
+ *
+ * @see Testing documentation
+ */
+@RunWith(AndroidJUnit4.class)
+public class ExampleInstrumentedTest {
+ @Test
+ public void useAppContext() {
+ // Context of the app under test.
+ Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
+
+ assertEquals("info.nightscout.androidaps.plugins.pump.common.test", appContext.getPackageName());
+ }
+}
diff --git a/rileylink/src/main/AndroidManifest.xml b/rileylink/src/main/AndroidManifest.xml
new file mode 100644
index 0000000000..c603e9e7ef
--- /dev/null
+++ b/rileylink/src/main/AndroidManifest.xml
@@ -0,0 +1,23 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/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
similarity index 95%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/common/dialog/RileyLinkBLEScanActivity.java
rename to rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/dialog/RileyLinkBLEScanActivity.java
index c70b7e033a..78db788350 100644
--- a/app/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
@@ -24,6 +24,7 @@ import android.widget.Toast;
import androidx.appcompat.widget.Toolbar;
+
import org.apache.commons.lang3.StringUtils;
import java.util.ArrayList;
@@ -34,21 +35,20 @@ import java.util.Map;
import javax.inject.Inject;
-import info.nightscout.androidaps.R;
+
import info.nightscout.androidaps.activities.NoSplashAppCompatActivity;
import info.nightscout.androidaps.interfaces.ActivePluginProvider;
import info.nightscout.androidaps.interfaces.PumpInterface;
import info.nightscout.androidaps.logging.AAPSLogger;
import info.nightscout.androidaps.plugins.bus.RxBusWrapper;
import info.nightscout.androidaps.plugins.common.ManufacturerType;
+import info.nightscout.androidaps.plugins.pump.common.R;
import info.nightscout.androidaps.plugins.pump.common.ble.BlePreCheck;
import info.nightscout.androidaps.plugins.pump.common.defs.PumpType;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkConst;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkUtil;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.data.GattAttributes;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkPumpDevice;
-import info.nightscout.androidaps.plugins.pump.medtronic.events.EventMedtronicPumpConfigurationChanged;
-import info.nightscout.androidaps.plugins.pump.omnipod.events.EventOmnipodPumpValuesChanged;
import info.nightscout.androidaps.utils.resources.ResourceHelper;
import info.nightscout.androidaps.utils.sharedPreferences.SP;
@@ -116,7 +116,7 @@ public class RileyLinkBLEScanActivity extends NoSplashAppCompatActivity {
RileyLinkPumpDevice rileyLinkPump = (RileyLinkPumpDevice) activePump;
rileyLinkPump.getRileyLinkService().verifyConfiguration(); // force reloading of address
- rxBus.send(new EventMedtronicPumpConfigurationChanged());
+ rileyLinkPump.triggerPumpConfigurationChangedEvent();
} else if (activePlugin.getActivePump().manufacturer() == ManufacturerType.Insulet) {
if (activePump.model() == PumpType.Insulet_Omnipod_Dash) {
@@ -125,7 +125,7 @@ public class RileyLinkBLEScanActivity extends NoSplashAppCompatActivity {
RileyLinkPumpDevice rileyLinkPump = (RileyLinkPumpDevice) activePump;
rileyLinkPump.getRileyLinkService().verifyConfiguration(); // force reloading of address
- rxBus.send(new EventOmnipodPumpValuesChanged());
+ rileyLinkPump.triggerPumpConfigurationChangedEvent();
}
}
@@ -157,14 +157,14 @@ public class RileyLinkBLEScanActivity extends NoSplashAppCompatActivity {
@Override
public boolean onOptionsItemSelected(MenuItem item) {
- switch (item.getItemId()) {
- case R.id.rileylink_miScan: {
- scanLeDevice(menuItem.getTitle().equals(actionTitleStart));
- return true;
- }
-
- default:
- return super.onOptionsItemSelected(item);
+ if (item.getTitle().equals(actionTitleStart)) {
+ scanLeDevice(true);
+ return true;
+ } else if (item.getTitle().equals(actionTitleStop)) {
+ scanLeDevice(false);
+ return true;
+ } else {
+ return super.onOptionsItemSelected(item);
}
}
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/events/EventMedtronicDeviceStatusChange.kt b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/events/EventRileyLinkDeviceStatusChange.kt
similarity index 63%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/events/EventMedtronicDeviceStatusChange.kt
rename to rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/events/EventRileyLinkDeviceStatusChange.kt
index 37e6649252..b3425d14a5 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/events/EventMedtronicDeviceStatusChange.kt
+++ b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/events/EventRileyLinkDeviceStatusChange.kt
@@ -1,17 +1,21 @@
-package info.nightscout.androidaps.plugins.pump.medtronic.events
+package info.nightscout.androidaps.plugins.pump.common.events
import info.nightscout.androidaps.events.Event
+import info.nightscout.androidaps.plugins.pump.common.defs.PumpDeviceState
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkError
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkServiceState
-import info.nightscout.androidaps.plugins.pump.medtronic.defs.PumpDeviceState
-class EventMedtronicDeviceStatusChange : Event {
+open class EventRileyLinkDeviceStatusChange : Event {
- private var rileyLinkServiceState: RileyLinkServiceState? = null
- private var rileyLinkError: RileyLinkError? = null
+ var rileyLinkServiceState: RileyLinkServiceState? = null
+ var rileyLinkError: RileyLinkError? = null
- private var pumpDeviceState: PumpDeviceState? = null
- private var errorDescription: String? = null
+ var pumpDeviceState: PumpDeviceState? = null
+ var errorDescription: String? = null
+
+ constructor() {
+
+ }
constructor(rileyLinkServiceState: RileyLinkServiceState?, rileyLinkError: RileyLinkError?) {
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/RileyLinkCommunicationManager.java b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/RileyLinkCommunicationManager.java
similarity index 99%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/RileyLinkCommunicationManager.java
rename to rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/RileyLinkCommunicationManager.java
index 12a0f0f4d0..b8395241e2 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/RileyLinkCommunicationManager.java
+++ b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/RileyLinkCommunicationManager.java
@@ -6,6 +6,7 @@ import dagger.android.HasAndroidInjector;
import info.nightscout.androidaps.logging.AAPSLogger;
import info.nightscout.androidaps.logging.LTag;
import info.nightscout.androidaps.plugins.pump.common.data.PumpStatus;
+import info.nightscout.androidaps.plugins.pump.common.defs.PumpDeviceState;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.RFSpy;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.RileyLinkCommunicationException;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.data.FrequencyScanResults;
@@ -20,7 +21,6 @@ import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.Riley
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.tasks.ServiceTaskExecutor;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.tasks.WakeAndTuneTask;
import info.nightscout.androidaps.plugins.pump.common.utils.ByteUtil;
-import info.nightscout.androidaps.plugins.pump.medtronic.defs.PumpDeviceState;
import info.nightscout.androidaps.utils.Round;
import info.nightscout.androidaps.utils.sharedPreferences.SP;
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/RileyLinkConst.java b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/RileyLinkConst.java
similarity index 86%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/RileyLinkConst.java
rename to rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/RileyLinkConst.java
index bff2a39240..40d17aee84 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/RileyLinkConst.java
+++ b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/RileyLinkConst.java
@@ -1,6 +1,7 @@
package info.nightscout.androidaps.plugins.pump.common.hw.rileylink;
-import info.nightscout.androidaps.R;
+
+import info.nightscout.androidaps.plugins.pump.common.R;
/**
* Created by andy on 16/05/2018.
@@ -10,7 +11,7 @@ public class RileyLinkConst {
static final String Prefix = "AAPS.RileyLink.";
- public class Intents {
+ public static class Intents {
public static final String RileyLinkReady = Prefix + "RileyLink_Ready";
public static final String RileyLinkGattFailed = Prefix + "RileyLink_Gatt_Failed";
@@ -27,22 +28,21 @@ public class RileyLinkConst {
public static final String RileyLinkDisconnect = Prefix + "RileyLink_Disconnect";
}
- public class Prefs {
+ public static class Prefs {
//public static final String PrefPrefix = "pref_rileylink_";
//public static final String RileyLinkAddress = PrefPrefix + "mac_address"; // pref_rileylink_mac_address
public static final int RileyLinkAddress = R.string.key_rileylink_mac_address;
public static final String LastGoodDeviceCommunicationTime = Prefix + "lastGoodDeviceCommunicationTime";
public static final String LastGoodDeviceFrequency = Prefix + "LastGoodDeviceFrequency";
+ public static final int Encoding = R.string.key_medtronic_encoding;
}
- public class IPC {
+ public static class IPC {
// needs to br renamed (and maybe removed)
public static final String MSG_PUMP_quickTune = Prefix + "MSG_PUMP_quickTune";
public static final String MSG_PUMP_tunePump = Prefix + "MSG_PUMP_tunePump";
- public static final String MSG_PUMP_fetchHistory = Prefix + "MSG_PUMP_fetchHistory";
- public static final String MSG_PUMP_fetchSavedHistory = Prefix + "MSG_PUMP_fetchSavedHistory";
public static final String MSG_ServiceCommand = Prefix + "MSG_ServiceCommand";
}
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/RileyLinkUtil.java b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/RileyLinkUtil.java
similarity index 100%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/RileyLinkUtil.java
rename to rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/RileyLinkUtil.java
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/RFSpy.java b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/RFSpy.java
similarity index 98%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/RFSpy.java
rename to rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/RFSpy.java
index f3f6399570..7971b6a7aa 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/RFSpy.java
+++ b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/RFSpy.java
@@ -7,9 +7,11 @@ import java.util.UUID;
import javax.inject.Inject;
import dagger.android.HasAndroidInjector;
-import info.nightscout.androidaps.R;
+
import info.nightscout.androidaps.logging.AAPSLogger;
import info.nightscout.androidaps.logging.LTag;
+import info.nightscout.androidaps.plugins.pump.common.R;
+import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkConst;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkUtil;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.command.Reset;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.command.RileyLinkCommand;
@@ -31,7 +33,7 @@ import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.Riley
import info.nightscout.androidaps.plugins.pump.common.utils.ByteUtil;
import info.nightscout.androidaps.plugins.pump.common.utils.StringUtil;
import info.nightscout.androidaps.plugins.pump.common.utils.ThreadUtil;
-import info.nightscout.androidaps.plugins.pump.medtronic.util.MedtronicConst;
+
import info.nightscout.androidaps.utils.resources.ResourceHelper;
import info.nightscout.androidaps.utils.sharedPreferences.SP;
@@ -369,7 +371,8 @@ public class RFSpy {
RileyLinkEncodingType encoding = RileyLinkEncodingType.FourByteSixByteLocal;
if (RileyLinkFirmwareVersion.isSameVersion(rileyLinkServiceData.firmwareVersion, RileyLinkFirmwareVersion.Version2AndHigher)) {
- if (sp.getString(MedtronicConst.Prefs.Encoding, "None").equals(resourceHelper.gs(R.string.key_medtronic_pump_encoding_4b6b_rileylink))) {
+ if (sp.getString(RileyLinkConst.Prefs.Encoding, "None")
+ .equals(resourceHelper.gs(R.string.key_medtronic_pump_encoding_4b6b_rileylink))) {
encoding = RileyLinkEncodingType.FourByteSixByteRileyLink;
}
}
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/RFSpyReader.java b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/RFSpyReader.java
similarity index 100%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/RFSpyReader.java
rename to rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/RFSpyReader.java
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/RileyLinkBLE.java b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/RileyLinkBLE.java
similarity index 100%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/RileyLinkBLE.java
rename to rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/RileyLinkBLE.java
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/RileyLinkCommunicationException.java b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/RileyLinkCommunicationException.java
similarity index 100%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/RileyLinkCommunicationException.java
rename to rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/RileyLinkCommunicationException.java
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/command/GetVersion.java b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/command/GetVersion.java
similarity index 100%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/command/GetVersion.java
rename to rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/command/GetVersion.java
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/command/Reset.java b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/command/Reset.java
similarity index 100%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/command/Reset.java
rename to rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/command/Reset.java
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/command/ResetRadioConfig.java b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/command/ResetRadioConfig.java
similarity index 100%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/command/ResetRadioConfig.java
rename to rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/command/ResetRadioConfig.java
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/command/RileyLinkCommand.java b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/command/RileyLinkCommand.java
similarity index 100%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/command/RileyLinkCommand.java
rename to rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/command/RileyLinkCommand.java
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/command/SendAndListen.java b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/command/SendAndListen.java
similarity index 97%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/command/SendAndListen.java
rename to rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/command/SendAndListen.java
index 6304567751..d54fef0599 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/command/SendAndListen.java
+++ b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/command/SendAndListen.java
@@ -6,7 +6,6 @@ import java.util.ArrayList;
import javax.inject.Inject;
import dagger.android.HasAndroidInjector;
-import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkUtil;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.data.RadioPacket;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.defs.RileyLinkCommandType;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.defs.RileyLinkFirmwareVersion;
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/command/SetHardwareEncoding.java b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/command/SetHardwareEncoding.java
similarity index 100%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/command/SetHardwareEncoding.java
rename to rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/command/SetHardwareEncoding.java
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/command/SetPreamble.java b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/command/SetPreamble.java
similarity index 94%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/command/SetPreamble.java
rename to rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/command/SetPreamble.java
index d58525deb0..b3f32727c3 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/command/SetPreamble.java
+++ b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/command/SetPreamble.java
@@ -7,7 +7,6 @@ import org.apache.commons.lang3.NotImplementedException;
import javax.inject.Inject;
import dagger.android.HasAndroidInjector;
-import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkUtil;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.defs.RileyLinkCommandType;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.defs.RileyLinkFirmwareVersion;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.RileyLinkServiceData;
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/command/UpdateRegister.java b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/command/UpdateRegister.java
similarity index 100%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/command/UpdateRegister.java
rename to rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/command/UpdateRegister.java
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/data/FrequencyScanResults.java b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/data/FrequencyScanResults.java
similarity index 100%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/data/FrequencyScanResults.java
rename to rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/data/FrequencyScanResults.java
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/data/FrequencyTrial.java b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/data/FrequencyTrial.java
similarity index 100%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/data/FrequencyTrial.java
rename to rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/data/FrequencyTrial.java
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/data/GattAttributes.java b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/data/GattAttributes.java
similarity index 100%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/data/GattAttributes.java
rename to rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/data/GattAttributes.java
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/data/RFSpyResponse.java b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/data/RFSpyResponse.java
similarity index 100%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/data/RFSpyResponse.java
rename to rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/data/RFSpyResponse.java
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/data/RLMessage.java b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/data/RLMessage.java
similarity index 100%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/data/RLMessage.java
rename to rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/data/RLMessage.java
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/data/RLMessageType.java b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/data/RLMessageType.java
similarity index 100%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/data/RLMessageType.java
rename to rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/data/RLMessageType.java
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/data/RadioPacket.java b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/data/RadioPacket.java
similarity index 100%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/data/RadioPacket.java
rename to rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/data/RadioPacket.java
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/data/RadioResponse.java b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/data/RadioResponse.java
similarity index 98%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/data/RadioResponse.java
rename to rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/data/RadioResponse.java
index 785691e4c2..66a3a446cb 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/data/RadioResponse.java
+++ b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/data/RadioResponse.java
@@ -77,7 +77,7 @@ public class RadioResponse {
byte[] encodedPayload;
if (RileyLinkFirmwareVersion.isSameVersion(rileyLinkServiceData.versionCC110,
- RileyLinkFirmwareVersion.Version2)) {
+ RileyLinkFirmwareVersion.Version2AndHigher)) {
encodedPayload = ByteUtil.substring(rxData, 3, rxData.length - 3);
rssi = rxData[1];
responseNumber = rxData[2];
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/data/encoding/Encoding4b6b.java b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/data/encoding/Encoding4b6b.java
similarity index 100%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/data/encoding/Encoding4b6b.java
rename to rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/data/encoding/Encoding4b6b.java
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/data/encoding/Encoding4b6bAbstract.java b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/data/encoding/Encoding4b6bAbstract.java
similarity index 100%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/data/encoding/Encoding4b6bAbstract.java
rename to rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/data/encoding/Encoding4b6bAbstract.java
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/data/encoding/Encoding4b6bGeoff.java b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/data/encoding/Encoding4b6bGeoff.java
similarity index 99%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/data/encoding/Encoding4b6bGeoff.java
rename to rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/data/encoding/Encoding4b6bGeoff.java
index 47f13f3095..32176040f5 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/data/encoding/Encoding4b6bGeoff.java
+++ b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/data/encoding/Encoding4b6bGeoff.java
@@ -1,7 +1,6 @@
package info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.data.encoding;
import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import java.util.ArrayList;
import java.util.List;
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/data/encoding/Encoding4b6bGo.java b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/data/encoding/Encoding4b6bGo.java
similarity index 99%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/data/encoding/Encoding4b6bGo.java
rename to rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/data/encoding/Encoding4b6bGo.java
index 6b4bd73760..3b0152455c 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/data/encoding/Encoding4b6bGo.java
+++ b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/data/encoding/Encoding4b6bGo.java
@@ -4,7 +4,6 @@ import java.util.HashMap;
import java.util.Map;
import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import info.nightscout.androidaps.logging.StacktraceLoggerWrapper;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.RileyLinkCommunicationException;
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/data/encoding/Encoding4b6bLoop.java b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/data/encoding/Encoding4b6bLoop.java
similarity index 99%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/data/encoding/Encoding4b6bLoop.java
rename to rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/data/encoding/Encoding4b6bLoop.java
index 56ec7751a5..d7a3a5f9d1 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/data/encoding/Encoding4b6bLoop.java
+++ b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/data/encoding/Encoding4b6bLoop.java
@@ -6,7 +6,6 @@ import java.util.List;
import java.util.Map;
import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import info.nightscout.androidaps.logging.StacktraceLoggerWrapper;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.RileyLinkCommunicationException;
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/defs/CC111XRegister.java b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/defs/CC111XRegister.java
similarity index 100%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/defs/CC111XRegister.java
rename to rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/defs/CC111XRegister.java
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/defs/RFSpyCommand.java b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/defs/RFSpyCommand.java
similarity index 100%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/defs/RFSpyCommand.java
rename to rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/defs/RFSpyCommand.java
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/defs/RFSpyRLResponse.java b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/defs/RFSpyRLResponse.java
similarity index 100%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/defs/RFSpyRLResponse.java
rename to rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/defs/RFSpyRLResponse.java
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/defs/RLMessageType.java b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/defs/RLMessageType.java
similarity index 100%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/defs/RLMessageType.java
rename to rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/defs/RLMessageType.java
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/defs/RXFilterMode.java b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/defs/RXFilterMode.java
similarity index 100%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/defs/RXFilterMode.java
rename to rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/defs/RXFilterMode.java
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/defs/RileyLinkBLEError.java b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/defs/RileyLinkBLEError.java
similarity index 100%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/defs/RileyLinkBLEError.java
rename to rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/defs/RileyLinkBLEError.java
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/defs/RileyLinkCommandType.java b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/defs/RileyLinkCommandType.java
similarity index 100%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/defs/RileyLinkCommandType.java
rename to rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/defs/RileyLinkCommandType.java
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/defs/RileyLinkEncodingType.java b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/defs/RileyLinkEncodingType.java
similarity index 95%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/defs/RileyLinkEncodingType.java
rename to rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/defs/RileyLinkEncodingType.java
index fcfe1915a0..55c2ce9539 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/defs/RileyLinkEncodingType.java
+++ b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/defs/RileyLinkEncodingType.java
@@ -3,8 +3,8 @@ package info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.defs;
import java.util.HashMap;
import java.util.Map;
-import info.nightscout.androidaps.R;
-import info.nightscout.androidaps.MainApp;
+
+import info.nightscout.androidaps.plugins.pump.common.R;
import info.nightscout.androidaps.utils.resources.ResourceHelper;
public enum RileyLinkEncodingType {
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/defs/RileyLinkFirmwareVersion.java b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/defs/RileyLinkFirmwareVersion.java
similarity index 95%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/defs/RileyLinkFirmwareVersion.java
rename to rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/defs/RileyLinkFirmwareVersion.java
index b6d0eab3cd..1a6b42c443 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/defs/RileyLinkFirmwareVersion.java
+++ b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/defs/RileyLinkFirmwareVersion.java
@@ -12,11 +12,12 @@ public enum RileyLinkFirmwareVersion {
Version_1_0(1, 0, "1.0"), //
Version_2_0(2, 0, "2.0"), //
Version_2_2(2, 2, "2.2"), //
- Version_3_0(3, 0, "3.0"), //
+ Version_3_x(3, 0, "3.x"), //
+ Version_4_x(4, 0, "4.x"), //
UnknownVersion(0, 0, "???"), //
Version1(Version_0_0, Version_0_9, Version_1_0), //
Version2(Version_2_0, Version_2_2), //
- Version2AndHigher(Version_2_0, Version_2_2, Version_3_0), //
+ Version2AndHigher(Version_2_0, Version_2_2, Version_3_x, Version_4_x), //
;
private static final String FIRMWARE_IDENTIFICATION_PREFIX = "subg_rfspy ";
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/defs/RileyLinkTargetFrequency.java b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/defs/RileyLinkTargetFrequency.java
similarity index 100%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/defs/RileyLinkTargetFrequency.java
rename to rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/defs/RileyLinkTargetFrequency.java
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/operations/BLECommOperation.java b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/operations/BLECommOperation.java
similarity index 100%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/operations/BLECommOperation.java
rename to rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/operations/BLECommOperation.java
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/operations/BLECommOperationResult.java b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/operations/BLECommOperationResult.java
similarity index 100%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/operations/BLECommOperationResult.java
rename to rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/operations/BLECommOperationResult.java
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/operations/CharacteristicReadOperation.java b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/operations/CharacteristicReadOperation.java
similarity index 100%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/operations/CharacteristicReadOperation.java
rename to rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/operations/CharacteristicReadOperation.java
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/operations/CharacteristicWriteOperation.java b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/operations/CharacteristicWriteOperation.java
similarity index 100%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/operations/CharacteristicWriteOperation.java
rename to rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/operations/CharacteristicWriteOperation.java
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/operations/DescriptorWriteOperation.java b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/operations/DescriptorWriteOperation.java
similarity index 100%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/operations/DescriptorWriteOperation.java
rename to rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/operations/DescriptorWriteOperation.java
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/data/BleAdvertisedData.java b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/data/BleAdvertisedData.java
similarity index 100%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/data/BleAdvertisedData.java
rename to rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/data/BleAdvertisedData.java
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/data/CommandValueDefinition.java b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/data/CommandValueDefinition.java
similarity index 100%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/data/CommandValueDefinition.java
rename to rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/data/CommandValueDefinition.java
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/data/RLHistoryItem.java b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/data/RLHistoryItem.java
similarity index 62%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/data/RLHistoryItem.java
rename to rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/data/RLHistoryItem.java
index a75e59b17a..c845a3afe2 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/data/RLHistoryItem.java
+++ b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/data/RLHistoryItem.java
@@ -2,13 +2,17 @@ package info.nightscout.androidaps.plugins.pump.common.hw.rileylink.data;
import org.joda.time.LocalDateTime;
+
+
+
+import info.nightscout.androidaps.plugins.pump.common.defs.PumpDeviceState;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkError;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkServiceState;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkTargetDevice;
-import info.nightscout.androidaps.plugins.pump.medtronic.defs.MedtronicCommandType;
-import info.nightscout.androidaps.plugins.pump.medtronic.defs.PumpDeviceState;
+//import info.nightscout.androidaps.plugins.pump.medtronic.defs.MedtronicCommandType;
+//import info.nightscout.androidaps.plugins.pump.medtronic.defs.PumpDeviceState;
import info.nightscout.androidaps.utils.resources.ResourceHelper;
-import info.nightscout.androidaps.plugins.pump.omnipod.defs.OmnipodCommandType;
+//import info.nightscout.androidaps.plugins.pump.omnipod.defs.OmnipodCommandType;
/**
@@ -17,16 +21,21 @@ import info.nightscout.androidaps.plugins.pump.omnipod.defs.OmnipodCommandType;
public class RLHistoryItem {
- private MedtronicCommandType medtronicCommandType;
- private LocalDateTime dateTime;
- private RLHistoryItemSource source;
- private RileyLinkServiceState serviceState;
- private RileyLinkError errorCode;
+ //private MedtronicCommandType medtronicCommandType;
+ protected LocalDateTime dateTime;
+ protected RLHistoryItemSource source;
+ protected RileyLinkServiceState serviceState;
+ protected RileyLinkError errorCode;
- private RileyLinkTargetDevice targetDevice;
- private PumpDeviceState pumpDeviceState;
- private OmnipodCommandType omnipodCommandType;
+ protected RileyLinkTargetDevice targetDevice;
+ protected PumpDeviceState pumpDeviceState;
+ //private OmnipodCommandType omnipodCommandType;
+ public RLHistoryItem(LocalDateTime dateTime, RLHistoryItemSource source, RileyLinkTargetDevice targetDevice) {
+ this.dateTime = dateTime;
+ this.source = source;
+ this.targetDevice = targetDevice;
+ }
public RLHistoryItem(RileyLinkServiceState serviceState, RileyLinkError errorCode,
RileyLinkTargetDevice targetDevice) {
@@ -46,18 +55,18 @@ public class RLHistoryItem {
}
- public RLHistoryItem(MedtronicCommandType medtronicCommandType) {
- this.dateTime = new LocalDateTime();
- this.medtronicCommandType = medtronicCommandType;
- source = RLHistoryItemSource.MedtronicCommand;
- }
-
-
- public RLHistoryItem(OmnipodCommandType omnipodCommandType) {
- this.dateTime = new LocalDateTime();
- this.omnipodCommandType = omnipodCommandType;
- source = RLHistoryItemSource.OmnipodCommand;
- }
+// public RLHistoryItem(MedtronicCommandType medtronicCommandType) {
+// this.dateTime = new LocalDateTime();
+// this.medtronicCommandType = medtronicCommandType;
+// source = RLHistoryItemSource.MedtronicCommand;
+// }
+//
+//
+// public RLHistoryItem(OmnipodCommandType omnipodCommandType) {
+// this.dateTime = new LocalDateTime();
+// this.omnipodCommandType = omnipodCommandType;
+// source = RLHistoryItemSource.OmnipodCommand;
+// }
public LocalDateTime getDateTime() {
@@ -86,11 +95,11 @@ public class RLHistoryItem {
case MedtronicPump:
return resourceHelper.gs(pumpDeviceState.getResourceId());
- case MedtronicCommand:
- return medtronicCommandType.name();
-
- case OmnipodCommand:
- return omnipodCommandType.name();
+// case MedtronicCommand:
+// return medtronicCommandType.name();
+//
+// case OmnipodCommand:
+// return omnipodCommandType.name();
default:
return "Unknown Description";
@@ -130,7 +139,7 @@ public class RLHistoryItem {
@Override
public int compare(RLHistoryItem o1, RLHistoryItem o2) {
- return o2.dateTime.compareTo(o1.dateTime);
+ return o2.dateTime.compareTo(o1.getDateTime());
}
}
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/defs/CommandValueDefinitionRLType.java b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/defs/CommandValueDefinitionRLType.java
similarity index 100%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/defs/CommandValueDefinitionRLType.java
rename to rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/defs/CommandValueDefinitionRLType.java
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/defs/CommandValueDefinitionType.java b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/defs/CommandValueDefinitionType.java
similarity index 100%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/defs/CommandValueDefinitionType.java
rename to rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/defs/CommandValueDefinitionType.java
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/defs/RileyLinkError.java b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/defs/RileyLinkError.java
similarity index 95%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/defs/RileyLinkError.java
rename to rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/defs/RileyLinkError.java
index 07867a781a..0334c8d54e 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/defs/RileyLinkError.java
+++ b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/defs/RileyLinkError.java
@@ -1,6 +1,7 @@
package info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs;
-import info.nightscout.androidaps.R;
+
+import info.nightscout.androidaps.plugins.pump.common.R;
/**
* Created by andy on 14/05/2018.
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/defs/RileyLinkPumpDevice.java b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/defs/RileyLinkPumpDevice.java
similarity index 89%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/defs/RileyLinkPumpDevice.java
rename to rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/defs/RileyLinkPumpDevice.java
index 7ad31c2066..71c2b5d20a 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/defs/RileyLinkPumpDevice.java
+++ b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/defs/RileyLinkPumpDevice.java
@@ -14,6 +14,8 @@ public interface RileyLinkPumpDevice {
void doTuneUpDevice();
+ void triggerPumpConfigurationChangedEvent();
+
RileyLinkService getRileyLinkService();
}
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/defs/RileyLinkServiceState.java b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/defs/RileyLinkServiceState.java
similarity index 98%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/defs/RileyLinkServiceState.java
rename to rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/defs/RileyLinkServiceState.java
index 2ae66b53c9..31c5f981f3 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/defs/RileyLinkServiceState.java
+++ b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/defs/RileyLinkServiceState.java
@@ -1,6 +1,7 @@
package info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs;
-import info.nightscout.androidaps.R;
+
+import info.nightscout.androidaps.plugins.pump.common.R;
/**
* Created by andy on 14/05/2018.
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/defs/RileyLinkTargetDevice.java b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/defs/RileyLinkTargetDevice.java
similarity index 91%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/defs/RileyLinkTargetDevice.java
rename to rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/defs/RileyLinkTargetDevice.java
index 2d0dea69f7..99b4ecd40a 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/defs/RileyLinkTargetDevice.java
+++ b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/defs/RileyLinkTargetDevice.java
@@ -1,6 +1,7 @@
package info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs;
-import info.nightscout.androidaps.R;
+
+import info.nightscout.androidaps.plugins.pump.common.R;
/**
* Created by andy on 5/19/18.
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/dialog/RileyLinkStatusActivity.java b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/dialog/RileyLinkStatusActivity.java
similarity index 98%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/dialog/RileyLinkStatusActivity.java
rename to rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/dialog/RileyLinkStatusActivity.java
index 57aa01123f..7bcc9a93ac 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/dialog/RileyLinkStatusActivity.java
+++ b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/dialog/RileyLinkStatusActivity.java
@@ -16,8 +16,9 @@ import java.util.List;
import javax.inject.Inject;
-import info.nightscout.androidaps.R;
+
import info.nightscout.androidaps.activities.NoSplashAppCompatActivity;
+import info.nightscout.androidaps.plugins.pump.common.R;
import info.nightscout.androidaps.plugins.pump.common.dialog.RefreshableInterface;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkUtil;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.RileyLinkServiceData;
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/dialog/RileyLinkStatusDevice.java b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/dialog/RileyLinkStatusDevice.java
similarity index 98%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/dialog/RileyLinkStatusDevice.java
rename to rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/dialog/RileyLinkStatusDevice.java
index 226d7fc622..3140b1107e 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/dialog/RileyLinkStatusDevice.java
+++ b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/dialog/RileyLinkStatusDevice.java
@@ -14,7 +14,8 @@ import android.widget.Button;
import android.widget.ListView;
import android.widget.TextView;
-import info.nightscout.androidaps.R;
+
+import info.nightscout.androidaps.plugins.pump.common.R;
import info.nightscout.androidaps.plugins.pump.common.dialog.RefreshableInterface;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.data.CommandValueDefinition;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.CommandValueDefinitionType;
diff --git a/app/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
similarity index 79%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/dialog/RileyLinkStatusGeneralFragment.java
rename to rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/dialog/RileyLinkStatusGeneralFragment.java
index bec19c7d1f..e4b6f154af 100644
--- a/app/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
@@ -13,25 +13,18 @@ import java.util.Locale;
import javax.inject.Inject;
import dagger.android.support.DaggerFragment;
-import info.nightscout.androidaps.MainApp;
-import info.nightscout.androidaps.R;
import info.nightscout.androidaps.interfaces.ActivePluginProvider;
-import info.nightscout.androidaps.interfaces.PumpDescription;
import info.nightscout.androidaps.logging.AAPSLogger;
import info.nightscout.androidaps.plugins.common.ManufacturerType;
import info.nightscout.androidaps.plugins.pump.common.PumpPluginAbstract;
+import info.nightscout.androidaps.plugins.pump.common.R;
import info.nightscout.androidaps.plugins.pump.common.data.PumpStatus;
import info.nightscout.androidaps.plugins.pump.common.defs.PumpType;
import info.nightscout.androidaps.plugins.pump.common.dialog.RefreshableInterface;
-import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkUtil;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.defs.RileyLinkFirmwareVersion;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkTargetDevice;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.RileyLinkServiceData;
import info.nightscout.androidaps.plugins.pump.common.utils.StringUtil;
-import info.nightscout.androidaps.plugins.pump.medtronic.MedtronicPumpPlugin;
-import info.nightscout.androidaps.plugins.pump.medtronic.driver.MedtronicPumpStatus;
-import info.nightscout.androidaps.plugins.pump.medtronic.util.MedtronicUtil;
-import info.nightscout.androidaps.plugins.pump.omnipod.driver.OmnipodPumpStatus;
import info.nightscout.androidaps.utils.DateUtil;
import info.nightscout.androidaps.utils.resources.ResourceHelper;
@@ -43,7 +36,7 @@ public class RileyLinkStatusGeneralFragment extends DaggerFragment implements Re
@Inject ActivePluginProvider activePlugin;
@Inject ResourceHelper resourceHelper;
- @Inject MedtronicUtil medtronicUtil;
+ //@Inject MedtronicUtil medtronicUtil;
@Inject AAPSLogger aapsLogger;
@Inject RileyLinkServiceData rileyLinkServiceData;
@Inject DateUtil dateUtil;
@@ -118,7 +111,6 @@ public class RileyLinkStatusGeneralFragment extends DaggerFragment implements Re
"-"
: resourceHelper.gs(rileyLinkServiceData.rileyLinkError.getResourceId(targetDevice)));
-
RileyLinkFirmwareVersion firmwareVersion = rileyLinkServiceData.versionCC110;
if (firmwareVersion == null) {
@@ -133,15 +125,17 @@ public class RileyLinkStatusGeneralFragment extends DaggerFragment implements Re
PumpPluginAbstract pumpPlugin = (PumpPluginAbstract)activePlugin.getActivePump();
if (pumpPlugin.manufacturer()== ManufacturerType.Medtronic) {
- MedtronicPumpStatus medtronicPumpStatus = (MedtronicPumpStatus)pumpPlugin.getPumpStatusData();
+ //MedtronicPumpStatus medtronicPumpStatus = (MedtronicPumpStatus)pumpPlugin.getPumpStatusData();
+
+ PumpStatus pumpStatusData = pumpPlugin.getPumpStatusData();
this.deviceType.setText(resourceHelper.gs(RileyLinkTargetDevice.MedtronicPump.getResourceId()));
this.deviceModel.setText(pumpPlugin.getPumpType().getDescription());
- this.serialNumber.setText(medtronicPumpStatus.serialNumber);
- this.pumpFrequency.setText(resourceHelper.gs(medtronicPumpStatus.pumpFrequency.equals("medtronic_pump_frequency_us_ca") ? R.string.medtronic_pump_frequency_us_ca : R.string.medtronic_pump_frequency_worldwide));
+ this.serialNumber.setText(pumpStatusData.getCustomDataAsString("SERIAL_NUMBER")); // medtronicPumpStatus.serialNumber);
+ this.pumpFrequency.setText(resourceHelper.gs(pumpStatusData.getCustomDataAsString("PUMP_FREQUENCY").equals("medtronic_pump_frequency_us_ca") ? R.string.medtronic_pump_frequency_us_ca : R.string.medtronic_pump_frequency_worldwide));
- if (medtronicUtil.getMedtronicPumpModel() != null)
- this.connectedDevice.setText("Medtronic " + medtronicUtil.getMedtronicPumpModel().getPumpModel());
+ if (pumpStatusData.getCustomDataAsString("PUMP_MODEL") != null)
+ this.connectedDevice.setText("Medtronic " + pumpStatusData.getCustomDataAsString("PUMP_MODEL"));
else
this.connectedDevice.setText("???");
@@ -149,14 +143,15 @@ public class RileyLinkStatusGeneralFragment extends DaggerFragment implements Re
this.lastUsedFrequency.setText(String.format(Locale.ENGLISH, "%.2f MHz",
rileyLinkServiceData.lastGoodFrequency));
- if (medtronicPumpStatus.lastConnection != 0)
+ if (pumpStatusData.lastConnection != 0)
this.lastDeviceContact.setText(StringUtil.toDateTimeString(dateUtil, new LocalDateTime(
- medtronicPumpStatus.lastDataTime)));
+ pumpStatusData.lastDataTime)));
else
this.lastDeviceContact.setText(resourceHelper.gs(R.string.common_never));
} else {
- OmnipodPumpStatus omnipodPumpStatus = (OmnipodPumpStatus)pumpPlugin.getPumpStatusData();
+ //OmnipodPumpStatus omnipodPumpStatus = (OmnipodPumpStatus)pumpPlugin.getPumpStatusData();
+ PumpStatus pumpStatusData = pumpPlugin.getPumpStatusData();
this.deviceType.setText(resourceHelper.gs(RileyLinkTargetDevice.Omnipod.getResourceId()));
this.deviceModel.setText(pumpPlugin.getPumpType() == PumpType.Insulet_Omnipod ? "Eros" : "Dash");
@@ -169,11 +164,11 @@ public class RileyLinkStatusGeneralFragment extends DaggerFragment implements Re
this.pumpFrequency.setText(resourceHelper.gs(R.string.omnipod_frequency));
- if (omnipodPumpStatus != null) {
+ if (pumpStatusData != null) {
- if (omnipodPumpStatus.podAvailable) {
- this.serialNumber.setText(omnipodPumpStatus.podLotNumber);
- this.connectedDevice.setText(omnipodPumpStatus.pumpType == PumpType.Insulet_Omnipod ? "Eros Pod" : "Dash Pod");
+ if (pumpStatusData.getCustomData("POD_AVAILABLE", Boolean.class)) {
+ this.serialNumber.setText(pumpStatusData.getCustomDataAsString("POD_LOT_NUMBER"));
+ this.connectedDevice.setText(pumpStatusData.pumpType == PumpType.Insulet_Omnipod ? "Eros Pod" : "Dash Pod");
} else {
this.serialNumber.setText("??");
this.connectedDevice.setText("-");
@@ -183,16 +178,14 @@ public class RileyLinkStatusGeneralFragment extends DaggerFragment implements Re
this.lastUsedFrequency.setText(String.format(Locale.ENGLISH, "%.2f MHz",
rileyLinkServiceData.lastGoodFrequency));
- if (omnipodPumpStatus.lastConnection != 0)
+ if (pumpStatusData.lastConnection != 0)
this.lastDeviceContact.setText(StringUtil.toDateTimeString(dateUtil, new LocalDateTime(
- omnipodPumpStatus.lastDataTime)));
+ pumpStatusData.lastDataTime)));
else
this.lastDeviceContact.setText(resourceHelper.gs(R.string.common_never));
}
}
-
}
-
}
}
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/dialog/RileyLinkStatusHistoryFragment.java b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/dialog/RileyLinkStatusHistoryFragment.java
similarity index 97%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/dialog/RileyLinkStatusHistoryFragment.java
rename to rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/dialog/RileyLinkStatusHistoryFragment.java
index 8a3ff18207..11c8ac2f80 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/dialog/RileyLinkStatusHistoryFragment.java
+++ b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/dialog/RileyLinkStatusHistoryFragment.java
@@ -18,11 +18,13 @@ import java.util.List;
import javax.inject.Inject;
import dagger.android.support.DaggerFragment;
-import info.nightscout.androidaps.R;
+
+import info.nightscout.androidaps.plugins.pump.common.R;
+import info.nightscout.androidaps.plugins.pump.common.defs.PumpDeviceState;
import info.nightscout.androidaps.plugins.pump.common.dialog.RefreshableInterface;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkUtil;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.data.RLHistoryItem;
-import info.nightscout.androidaps.plugins.pump.medtronic.defs.PumpDeviceState;
+
import info.nightscout.androidaps.utils.DateUtil;
import info.nightscout.androidaps.utils.resources.ResourceHelper;
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/RileyLinkBluetoothStateReceiver.kt b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/RileyLinkBluetoothStateReceiver.kt
similarity index 100%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/RileyLinkBluetoothStateReceiver.kt
rename to rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/RileyLinkBluetoothStateReceiver.kt
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/RileyLinkBroadcastReceiver.java b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/RileyLinkBroadcastReceiver.java
similarity index 97%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/RileyLinkBroadcastReceiver.java
rename to rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/RileyLinkBroadcastReceiver.java
index 4beea20154..7fefacc8c5 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/RileyLinkBroadcastReceiver.java
+++ b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/RileyLinkBroadcastReceiver.java
@@ -81,13 +81,6 @@ public class RileyLinkBroadcastReceiver extends DaggerBroadcastReceiver {
RileyLinkConst.Intents.RileyLinkDisconnected, //
RileyLinkConst.Intents.RileyLinkNewAddressSet, //
RileyLinkConst.Intents.RileyLinkDisconnect));
-
- // Device Specific
- // TODO remove from service instance
- //deviceSpecificPrefix = serviceInstance.getDeviceSpecificBroadcastsIdentifierPrefix();
-
- // Application specific
-
}
private RileyLinkService getServiceInstance() {
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/RileyLinkService.java b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/RileyLinkService.java
similarity index 97%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/RileyLinkService.java
rename to rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/RileyLinkService.java
index 09273eb719..08503155af 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/RileyLinkService.java
+++ b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/RileyLinkService.java
@@ -15,6 +15,7 @@ import info.nightscout.androidaps.interfaces.ActivePluginProvider;
import info.nightscout.androidaps.logging.AAPSLogger;
import info.nightscout.androidaps.logging.LTag;
import info.nightscout.androidaps.plugins.bus.RxBusWrapper;
+import info.nightscout.androidaps.plugins.pump.common.defs.PumpDeviceState;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkCommunicationManager;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkConst;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkUtil;
@@ -26,9 +27,6 @@ import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLin
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkTargetDevice;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.data.ServiceResult;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.data.ServiceTransport;
-import info.nightscout.androidaps.plugins.pump.medtronic.defs.PumpDeviceState;
-import info.nightscout.androidaps.plugins.pump.medtronic.driver.MedtronicPumpStatus;
-import info.nightscout.androidaps.plugins.pump.medtronic.util.MedtronicUtil;
import info.nightscout.androidaps.utils.resources.ResourceHelper;
import info.nightscout.androidaps.utils.sharedPreferences.SP;
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/RileyLinkServiceData.java b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/RileyLinkServiceData.java
similarity index 94%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/RileyLinkServiceData.java
rename to rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/RileyLinkServiceData.java
index b16c4971b9..f3362e0db7 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/RileyLinkServiceData.java
+++ b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/RileyLinkServiceData.java
@@ -6,6 +6,7 @@ import javax.inject.Singleton;
import info.nightscout.androidaps.logging.AAPSLogger;
import info.nightscout.androidaps.logging.LTag;
import info.nightscout.androidaps.plugins.bus.RxBusWrapper;
+import info.nightscout.androidaps.plugins.pump.common.events.EventRileyLinkDeviceStatusChange;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkUtil;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.defs.RileyLinkFirmwareVersion;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.defs.RileyLinkTargetFrequency;
@@ -13,7 +14,7 @@ import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.data.RLHistor
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkError;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkServiceState;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkTargetDevice;
-import info.nightscout.androidaps.plugins.pump.medtronic.events.EventMedtronicDeviceStatusChange;
+
/**
* Created by andy on 16/05/2018.
@@ -79,7 +80,8 @@ public class RileyLinkServiceData {
aapsLogger.info(LTag.PUMP, "RileyLink State Changed: {} {}", newState, errorCode == null ? "" : " - Error State: " + errorCode.name());
rileyLinkUtil.getRileyLinkHistory().add(new RLHistoryItem(rileyLinkServiceState, errorCode, targetDevice));
- rxBus.send(new EventMedtronicDeviceStatusChange(newState, errorCode));
+ rxBus.send(new EventRileyLinkDeviceStatusChange(newState, errorCode));
+
return null;
} else {
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/data/ServiceCommand.java b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/data/ServiceCommand.java
similarity index 100%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/data/ServiceCommand.java
rename to rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/data/ServiceCommand.java
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/data/ServiceMessage.java b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/data/ServiceMessage.java
similarity index 100%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/data/ServiceMessage.java
rename to rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/data/ServiceMessage.java
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/data/ServiceNotification.java b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/data/ServiceNotification.java
similarity index 100%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/data/ServiceNotification.java
rename to rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/data/ServiceNotification.java
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/data/ServiceResult.java b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/data/ServiceResult.java
similarity index 100%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/data/ServiceResult.java
rename to rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/data/ServiceResult.java
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/data/ServiceTransport.java b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/data/ServiceTransport.java
similarity index 100%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/data/ServiceTransport.java
rename to rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/data/ServiceTransport.java
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/data/ServiceTransportType.java b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/data/ServiceTransportType.java
similarity index 100%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/data/ServiceTransportType.java
rename to rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/data/ServiceTransportType.java
diff --git a/app/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
similarity index 100%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/DiscoverGattServicesTask.java
rename to rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/DiscoverGattServicesTask.java
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/InitializePumpManagerTask.java b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/InitializePumpManagerTask.java
similarity index 100%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/InitializePumpManagerTask.java
rename to rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/InitializePumpManagerTask.java
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/PumpTask.java b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/PumpTask.java
similarity index 100%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/PumpTask.java
rename to rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/PumpTask.java
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/ResetRileyLinkConfigurationTask.java b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/ResetRileyLinkConfigurationTask.java
similarity index 91%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/ResetRileyLinkConfigurationTask.java
rename to rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/ResetRileyLinkConfigurationTask.java
index bc9a4a3aa0..3263253e5e 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/ResetRileyLinkConfigurationTask.java
+++ b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/ResetRileyLinkConfigurationTask.java
@@ -5,12 +5,12 @@ import javax.inject.Inject;
import dagger.android.HasAndroidInjector;
import info.nightscout.androidaps.interfaces.ActivePluginProvider;
import info.nightscout.androidaps.plugins.bus.RxBusWrapper;
+import info.nightscout.androidaps.plugins.pump.common.events.EventRefreshButtonState;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkPumpDevice;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.data.ServiceTransport;
-import info.nightscout.androidaps.plugins.pump.medtronic.events.EventRefreshButtonState;
/**
- * Created by geoff on 7/16/16.
+ * Created by andy on 9/16/18.
*/
public class ResetRileyLinkConfigurationTask extends PumpTask {
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/ServiceTask.java b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/ServiceTask.java
similarity index 100%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/ServiceTask.java
rename to rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/ServiceTask.java
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/ServiceTaskExecutor.java b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/ServiceTaskExecutor.java
similarity index 100%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/ServiceTaskExecutor.java
rename to rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/ServiceTaskExecutor.java
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/WakeAndTuneTask.java b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/WakeAndTuneTask.java
similarity index 84%
rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/WakeAndTuneTask.java
rename to rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/WakeAndTuneTask.java
index 219da8bf3f..d3011eede2 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/WakeAndTuneTask.java
+++ b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/WakeAndTuneTask.java
@@ -5,11 +5,9 @@ import javax.inject.Inject;
import dagger.android.HasAndroidInjector;
import info.nightscout.androidaps.interfaces.ActivePluginProvider;
import info.nightscout.androidaps.plugins.bus.RxBusWrapper;
-import info.nightscout.androidaps.plugins.pump.common.PumpPluginAbstract;
+import info.nightscout.androidaps.plugins.pump.common.events.EventRefreshButtonState;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkPumpDevice;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.data.ServiceTransport;
-import info.nightscout.androidaps.plugins.pump.medtronic.MedtronicPumpPlugin;
-import info.nightscout.androidaps.plugins.pump.medtronic.events.EventRefreshButtonState;
/**
* Created by geoff on 7/16/16.
diff --git a/app/src/main/res/layout/rileylink_scan_activity.xml b/rileylink/src/main/res/layout/rileylink_scan_activity.xml
similarity index 100%
rename from app/src/main/res/layout/rileylink_scan_activity.xml
rename to rileylink/src/main/res/layout/rileylink_scan_activity.xml
diff --git a/app/src/main/res/layout/rileylink_scan_item.xml b/rileylink/src/main/res/layout/rileylink_scan_item.xml
similarity index 100%
rename from app/src/main/res/layout/rileylink_scan_item.xml
rename to rileylink/src/main/res/layout/rileylink_scan_item.xml
diff --git a/app/src/main/res/layout/rileylink_status.xml b/rileylink/src/main/res/layout/rileylink_status.xml
similarity index 100%
rename from app/src/main/res/layout/rileylink_status.xml
rename to rileylink/src/main/res/layout/rileylink_status.xml
diff --git a/app/src/main/res/layout/rileylink_status_device.xml b/rileylink/src/main/res/layout/rileylink_status_device.xml
similarity index 100%
rename from app/src/main/res/layout/rileylink_status_device.xml
rename to rileylink/src/main/res/layout/rileylink_status_device.xml
diff --git a/app/src/main/res/layout/rileylink_status_device_item.xml b/rileylink/src/main/res/layout/rileylink_status_device_item.xml
similarity index 100%
rename from app/src/main/res/layout/rileylink_status_device_item.xml
rename to rileylink/src/main/res/layout/rileylink_status_device_item.xml
diff --git a/app/src/main/res/layout/rileylink_status_general.xml b/rileylink/src/main/res/layout/rileylink_status_general.xml
similarity index 100%
rename from app/src/main/res/layout/rileylink_status_general.xml
rename to rileylink/src/main/res/layout/rileylink_status_general.xml
diff --git a/app/src/main/res/layout/rileylink_status_history.xml b/rileylink/src/main/res/layout/rileylink_status_history.xml
similarity index 100%
rename from app/src/main/res/layout/rileylink_status_history.xml
rename to rileylink/src/main/res/layout/rileylink_status_history.xml
diff --git a/app/src/main/res/layout/rileylink_status_history_item.xml b/rileylink/src/main/res/layout/rileylink_status_history_item.xml
similarity index 100%
rename from app/src/main/res/layout/rileylink_status_history_item.xml
rename to rileylink/src/main/res/layout/rileylink_status_history_item.xml
diff --git a/app/src/main/res/menu/menu_rileylink_ble_scan.xml b/rileylink/src/main/res/menu/menu_rileylink_ble_scan.xml
similarity index 100%
rename from app/src/main/res/menu/menu_rileylink_ble_scan.xml
rename to rileylink/src/main/res/menu/menu_rileylink_ble_scan.xml
diff --git a/rileylink/src/main/res/values/strings.xml b/rileylink/src/main/res/values/strings.xml
new file mode 100644
index 0000000000..ddb9beaf9b
--- /dev/null
+++ b/rileylink/src/main/res/values/strings.xml
@@ -0,0 +1,89 @@
+
+
+
+
+ SCAN
+ STOP
+ Selected
+ RileyLink Scan
+ Enable
+ No
+ Scanning
+ Scanning finished
+ Scanning error: %1$d
+ Never
+
+
+ Settings
+ History
+ RileyLink Status
+ Pump Status
+ RileyLink Settings
+ RileyLink
+ Configured Address
+ Connected Device
+ Connection Status
+ Connection Error
+ Device
+ Device Type
+ Device Model
+ Last used frequency
+ Last device contact
+ RL Firmware
+
+
+
+ Bluetooth Initializing…
+ Bluetooth Error
+ Bluetooth Ready
+ Not Started
+ RileyLink Initialization…
+ RileyLink Error
+ Tuning up RileyLink and Pump
+ Problem connecting to Pump
+ Connected
+
+
+ Device is not RileyLink
+ RileyLink unreachable
+ Bluetooth disabled
+ No Bluetooth Adapter
+ TuneUp Failed
+ Pump unreachable
+ Pod unreachable
+
+
+ Medtronic Pump
+ Omnipod
+
+
+ Omnipod (433.91 MHz)
+ US & Canada (916 MHz)
+ Worldwide (868 Mhz)
+
+ medtronic_pump_encoding_4b6b_local
+ medtronic_pump_encoding_4b6b_rileylink
+
+ pref_rileylink_mac_address
+ pref_medtronic_encoding
+
+ %1$.1f %2$s (%3$s)
+
+
+
+
+
+ - %1$d day
+ - %1$d days
+
+
+ - %1$d hour
+ - %1$d hours
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/RFToolsParametrizedUTest.java b/rileylink/src/test/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/RFToolsParametrizedUTest.java
similarity index 100%
rename from app/src/test/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/RFToolsParametrizedUTest.java
rename to rileylink/src/test/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/RFToolsParametrizedUTest.java
diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/RFToolsUTest.java b/rileylink/src/test/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/RFToolsUTest.java
similarity index 100%
rename from app/src/test/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/RFToolsUTest.java
rename to rileylink/src/test/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/RFToolsUTest.java
diff --git a/settings.gradle b/settings.gradle
index 661d9ef66a..19da851b52 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -1 +1,2 @@
-include ':app', ':wear', ':core', ':dana', ':danar', ':danars'
+include ':app', ':wear', ':core', ':dana', ':danar', ':danars', ':rileylink', ':medtronic'
+