diff --git a/app/build.gradle b/app/build.gradle index 4b4aaa1876..dde53c2b49 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -127,6 +127,7 @@ android { multiDexEnabled true versionCode 1500 version "2.7-omnipod-0.4.1-SNAPSHOT" + version "2.7.0-rc3" buildConfigField "String", "VERSION", '"' + version + '"' buildConfigField "String", "BUILDVERSION", '"' + generateGitBuild() + '-' + generateDate() + '"' buildConfigField "String", "REMOTE", '"' + generateGitRemote() + '"' @@ -134,11 +135,6 @@ android { testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" // if you change minSdkVersion to less than 11, you need to change executeTask for wear - // OMNIPOD: Keep track of what commit from the main repository we're on, these fields aren't actually used anywhere - buildConfigField "String", "DEV_VERSION", '"2.6.7-dev"' - buildConfigField "String", "DEV_VERSION_COMMIT", '"65c8cc98804cfc366239ad2bedb2dd98e3e4f3c2"' - buildConfigField "String", "DEV_VERSION_COMMIT_DATE", '"16.8.2020"' // 16th of August - ndk { moduleName "BleCommandUtil" } @@ -250,6 +246,7 @@ dependencies { implementation project(':danar') implementation project(':rileylink') implementation project(':medtronic') + implementation project(':omnipod') 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 8f3db8e179..531e88e83a 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -263,17 +263,6 @@ - - - - - - - diff --git a/app/src/main/java/info/nightscout/androidaps/db/DatabaseHelper.java b/app/src/main/java/info/nightscout/androidaps/db/DatabaseHelper.java index 7ba9957ed8..d96fda8d3b 100644 --- a/app/src/main/java/info/nightscout/androidaps/db/DatabaseHelper.java +++ b/app/src/main/java/info/nightscout/androidaps/db/DatabaseHelper.java @@ -57,7 +57,6 @@ import info.nightscout.androidaps.plugins.iob.iobCobCalculator.events.EventNewHi import info.nightscout.androidaps.plugins.pump.insight.database.InsightBolusID; import info.nightscout.androidaps.plugins.pump.insight.database.InsightHistoryOffset; import info.nightscout.androidaps.plugins.pump.insight.database.InsightPumpID; -import info.nightscout.androidaps.plugins.pump.omnipod.driver.db.PodHistory; import info.nightscout.androidaps.plugins.pump.virtual.VirtualPumpPlugin; import info.nightscout.androidaps.utils.JsonHelper; import info.nightscout.androidaps.utils.PercentageSplitter; @@ -88,7 +87,6 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper { public static final String DATABASE_INSIGHT_HISTORY_OFFSETS = "InsightHistoryOffsets"; public static final String DATABASE_INSIGHT_BOLUS_IDS = "InsightBolusIDs"; public static final String DATABASE_INSIGHT_PUMP_IDS = "InsightPumpIDs"; - public static final String DATABASE_POD_HISTORY = "PodHistory"; private static final int DATABASE_VERSION = 12; @@ -142,7 +140,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper { TableUtils.createTableIfNotExists(connectionSource, InsightHistoryOffset.class); TableUtils.createTableIfNotExists(connectionSource, InsightBolusID.class); TableUtils.createTableIfNotExists(connectionSource, InsightPumpID.class); - TableUtils.createTableIfNotExists(connectionSource, PodHistory.class); + TableUtils.createTableIfNotExists(connectionSource, OmnipodHistoryRecord.class); database.execSQL("INSERT INTO sqlite_sequence (name, seq) SELECT \"" + DATABASE_INSIGHT_BOLUS_IDS + "\", " + System.currentTimeMillis() + " " + "WHERE NOT EXISTS (SELECT 1 FROM sqlite_sequence WHERE name = \"" + DATABASE_INSIGHT_BOLUS_IDS + "\")"); database.execSQL("INSERT INTO sqlite_sequence (name, seq) SELECT \"" + DATABASE_INSIGHT_PUMP_IDS + "\", " + System.currentTimeMillis() + " " + @@ -219,7 +217,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper { TableUtils.dropTable(connectionSource, CareportalEvent.class, true); TableUtils.dropTable(connectionSource, ProfileSwitch.class, true); TableUtils.dropTable(connectionSource, TDD.class, true); - TableUtils.dropTable(connectionSource, PodHistory.class, true); + TableUtils.dropTable(connectionSource, OmnipodHistoryRecord.class, true); TableUtils.createTableIfNotExists(connectionSource, TempTarget.class); TableUtils.createTableIfNotExists(connectionSource, BgReading.class); TableUtils.createTableIfNotExists(connectionSource, DanaRHistoryRecord.class); @@ -229,7 +227,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper { TableUtils.createTableIfNotExists(connectionSource, CareportalEvent.class); TableUtils.createTableIfNotExists(connectionSource, ProfileSwitch.class); TableUtils.createTableIfNotExists(connectionSource, TDD.class); - TableUtils.createTableIfNotExists(connectionSource, PodHistory.class); + TableUtils.createTableIfNotExists(connectionSource, OmnipodHistoryRecord.class); updateEarliestDataChange(0); } catch (SQLException e) { aapsLogger.error("Unhandled exception", e); @@ -364,8 +362,8 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper { return getDao(InsightHistoryOffset.class); } - private Dao getDaoPodHistory() throws SQLException { - return getDao(PodHistory.class); + private Dao getDaoPodHistory() throws SQLException { + return getDao(OmnipodHistoryRecord.class); } public long roundDateToSec(long date) { @@ -1865,25 +1863,25 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper { // ---------------- PodHistory handling --------------- - public void createOrUpdate(PodHistory podHistory) { + public void createOrUpdate(OmnipodHistoryRecord omnipodHistoryRecord) { try { - getDaoPodHistory().createOrUpdate(podHistory); + getDaoPodHistory().createOrUpdate(omnipodHistoryRecord); } catch (SQLException e) { aapsLogger.error("Unhandled exception", e); } } - public List getPodHistoryFromTime(long from, boolean ascending) { + public List getAllOmnipodHistoryRecordsFromTimeStamp(long from, boolean ascending) { try { - Dao daoPodHistory = getDaoPodHistory(); - List podHistories; - QueryBuilder queryBuilder = daoPodHistory.queryBuilder(); + Dao daoPodHistory = getDaoPodHistory(); + List podHistories; + QueryBuilder queryBuilder = daoPodHistory.queryBuilder(); queryBuilder.orderBy("date", ascending); //queryBuilder.limit(100L); Where where = queryBuilder.where(); where.ge("date", from); - PreparedQuery preparedQuery = queryBuilder.prepare(); + PreparedQuery preparedQuery = queryBuilder.prepare(); podHistories = daoPodHistory.query(preparedQuery); return podHistories; } catch (SQLException e) { 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 0e9f9d82b2..4468692189 100644 --- a/app/src/main/java/info/nightscout/androidaps/db/DatabaseHelperProvider.java +++ b/app/src/main/java/info/nightscout/androidaps/db/DatabaseHelperProvider.java @@ -16,7 +16,8 @@ import info.nightscout.androidaps.interfaces.DatabaseHelperInterface; @Singleton public class DatabaseHelperProvider implements DatabaseHelperInterface { - @Inject DatabaseHelperProvider() {} + @Inject DatabaseHelperProvider() { + } @NotNull @Override public List getAllBgreadingsDataFromTime(long mills, boolean ascending) { return MainApp.getDbHelper().getAllBgreadingsDataFromTime(mills, ascending); @@ -30,6 +31,10 @@ public class DatabaseHelperProvider implements DatabaseHelperInterface { MainApp.getDbHelper().createOrUpdate(record); } + @Override public void createOrUpdate(@NotNull OmnipodHistoryRecord record) { + MainApp.getDbHelper().createOrUpdate(record); + } + @NotNull @Override public List getDanaRHistoryRecordsByType(byte type) { return MainApp.getDbHelper().getDanaRHistoryRecordsByType(type); } @@ -86,10 +91,14 @@ public class DatabaseHelperProvider implements DatabaseHelperInterface { return MainApp.getDbHelper().getTemporaryBasalsDataFromTime(mills, ascending); } - @NotNull @Override public CareportalEvent getCareportalEventFromTimestamp(long timestamp) { + @Override public CareportalEvent getCareportalEventFromTimestamp(long timestamp) { return MainApp.getDbHelper().getCareportalEventFromTimestamp(timestamp); } + @NotNull @Override public List getAllOmnipodHistoryRecordsFromTimestamp(long timestamp, boolean ascending) { + return MainApp.getDbHelper().getAllOmnipodHistoryRecordsFromTimeStamp(timestamp, ascending); + } + @NotNull @Override public List getTDDsForLastXDays(int days) { return MainApp.getDbHelper().getTDDsForLastXDays(days); } diff --git a/app/src/main/java/info/nightscout/androidaps/dependencyInjection/AppComponent.kt b/app/src/main/java/info/nightscout/androidaps/dependencyInjection/AppComponent.kt index e45db6c006..345ab5a615 100644 --- a/app/src/main/java/info/nightscout/androidaps/dependencyInjection/AppComponent.kt +++ b/app/src/main/java/info/nightscout/androidaps/dependencyInjection/AppComponent.kt @@ -26,6 +26,7 @@ import javax.inject.Singleton CommandQueueModule::class, ObjectivesModule::class, WizardModule::class, + RileyLinkModule::class, MedtronicModule::class, OmnipodModule::class, APSModule::class, 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 f813a6d49d..cadac7d13c 100644 --- a/app/src/main/java/info/nightscout/androidaps/dependencyInjection/MedtronicModule.kt +++ b/app/src/main/java/info/nightscout/androidaps/dependencyInjection/MedtronicModule.kt @@ -2,33 +2,12 @@ package info.nightscout.androidaps.dependencyInjection import dagger.Module import dagger.android.ContributesAndroidInjector -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 -import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.command.SendAndListen -import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.command.SetPreamble -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.service.tasks.* import info.nightscout.androidaps.plugins.pump.medtronic.comm.MedtronicCommunicationManager import info.nightscout.androidaps.plugins.pump.medtronic.comm.ui.MedtronicUITask @Module @Suppress("unused") abstract class MedtronicModule { - @ContributesAndroidInjector abstract fun rileyLinkCommunicationManagerProvider(): RileyLinkCommunicationManager @ContributesAndroidInjector abstract fun medtronicCommunicationManagerProvider(): MedtronicCommunicationManager @ContributesAndroidInjector abstract fun medtronicUITaskProvider(): MedtronicUITask - @ContributesAndroidInjector abstract fun serviceTaskProvider(): ServiceTask - @ContributesAndroidInjector abstract fun pumpTaskProvider(): PumpTask - @ContributesAndroidInjector abstract fun discoverGattServicesTaskProvider(): DiscoverGattServicesTask - @ContributesAndroidInjector abstract fun initializePumpManagerTaskProvider(): InitializePumpManagerTask - @ContributesAndroidInjector abstract fun resetRileyLinkConfigurationTaskProvider(): ResetRileyLinkConfigurationTask - @ContributesAndroidInjector abstract fun wakeAndTuneTaskProvider(): WakeAndTuneTask - @ContributesAndroidInjector abstract fun radioResponseProvider(): RadioResponse - @ContributesAndroidInjector abstract fun rileyLinkBLEProvider(): RileyLinkBLE - @ContributesAndroidInjector abstract fun rfSpyProvider(): RFSpy - @ContributesAndroidInjector abstract fun sendAndListenProvider(): SendAndListen - @ContributesAndroidInjector abstract fun setPreambleProvider(): SetPreamble - @ContributesAndroidInjector abstract fun radioPacketProvider(): RadioPacket } \ No newline at end of file diff --git a/app/src/main/java/info/nightscout/androidaps/dependencyInjection/OmnipodModule.kt b/app/src/main/java/info/nightscout/androidaps/dependencyInjection/OmnipodModule.kt index 0e73cea942..e7a8f31cfa 100644 --- a/app/src/main/java/info/nightscout/androidaps/dependencyInjection/OmnipodModule.kt +++ b/app/src/main/java/info/nightscout/androidaps/dependencyInjection/OmnipodModule.kt @@ -3,8 +3,6 @@ package info.nightscout.androidaps.dependencyInjection import dagger.Module import dagger.Provides import dagger.android.ContributesAndroidInjector -import info.nightscout.androidaps.logging.AAPSLogger -import info.nightscout.androidaps.plugins.bus.RxBusWrapper 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.PodStateManager @@ -15,14 +13,9 @@ import info.nightscout.androidaps.plugins.pump.omnipod.dialogs.wizard.initpod.In import info.nightscout.androidaps.plugins.pump.omnipod.dialogs.wizard.pages.InitPodRefreshAction import info.nightscout.androidaps.plugins.pump.omnipod.dialogs.wizard.pages.PodInfoFragment import info.nightscout.androidaps.plugins.pump.omnipod.dialogs.wizard.removepod.RemoveActionFragment -import info.nightscout.androidaps.plugins.pump.omnipod.driver.OmnipodPumpStatus import info.nightscout.androidaps.plugins.pump.omnipod.driver.comm.AapsOmnipodManager import info.nightscout.androidaps.plugins.pump.omnipod.driver.comm.AapsPodStateManager import info.nightscout.androidaps.plugins.pump.omnipod.driver.ui.OmnipodUITask -import info.nightscout.androidaps.utils.DateUtil -import info.nightscout.androidaps.utils.resources.ResourceHelper -import info.nightscout.androidaps.utils.sharedPreferences.SP -import javax.inject.Singleton @Module @Suppress("unused") @@ -52,9 +45,6 @@ abstract class OmnipodModule { companion object { @Provides - @Singleton - fun podStateManagerProvider(aapsLogger: AAPSLogger, sp: SP, omnipodPumpStatus: OmnipodPumpStatus, - rxBus: RxBusWrapper, resourceHelper: ResourceHelper, dateUtil: DateUtil): PodStateManager = - AapsPodStateManager(aapsLogger, sp, omnipodPumpStatus, rxBus, resourceHelper, dateUtil) + fun podStateManagerProvider(aapsPodStateManager: AapsPodStateManager) : PodStateManager = aapsPodStateManager } } diff --git a/app/src/main/java/info/nightscout/androidaps/dependencyInjection/PluginsModule.kt b/app/src/main/java/info/nightscout/androidaps/dependencyInjection/PluginsModule.kt index 41c1615fe0..efb59be7c3 100644 --- a/app/src/main/java/info/nightscout/androidaps/dependencyInjection/PluginsModule.kt +++ b/app/src/main/java/info/nightscout/androidaps/dependencyInjection/PluginsModule.kt @@ -148,6 +148,12 @@ abstract class PluginsModule { @IntKey(150) abstract fun bindMedtronicPumpPlugin(plugin: MedtronicPumpPlugin): PluginBase + @Binds + @PumpDriver + @IntoMap + @IntKey(155) + abstract fun bindOmnipodPumpPlugin(plugin: OmnipodPumpPlugin): PluginBase + @Binds @NotNSClient @IntoMap @@ -340,12 +346,6 @@ abstract class PluginsModule { @IntKey(480) abstract fun bindConfigBuilderPlugin(plugin: ConfigBuilderPlugin): PluginBase - @Binds - @PumpDriver - @IntoMap - @IntKey(490) - abstract fun bindOmnipodPumpPlugin(plugin: OmnipodPumpPlugin): PluginBase - @Qualifier annotation class AllConfigs diff --git a/app/src/main/java/info/nightscout/androidaps/dependencyInjection/RileyLinkModule.kt b/app/src/main/java/info/nightscout/androidaps/dependencyInjection/RileyLinkModule.kt new file mode 100644 index 0000000000..b74b2e4263 --- /dev/null +++ b/app/src/main/java/info/nightscout/androidaps/dependencyInjection/RileyLinkModule.kt @@ -0,0 +1,30 @@ +package info.nightscout.androidaps.dependencyInjection + +import dagger.Module +import dagger.android.ContributesAndroidInjector +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 +import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.command.SendAndListen +import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.command.SetPreamble +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.service.tasks.* + +@Module +@Suppress("unused") +abstract class RileyLinkModule { + @ContributesAndroidInjector abstract fun rileyLinkCommunicationManagerProvider(): RileyLinkCommunicationManager + @ContributesAndroidInjector abstract fun serviceTaskProvider(): ServiceTask + @ContributesAndroidInjector abstract fun pumpTaskProvider(): PumpTask + @ContributesAndroidInjector abstract fun discoverGattServicesTaskProvider(): DiscoverGattServicesTask + @ContributesAndroidInjector abstract fun initializePumpManagerTaskProvider(): InitializePumpManagerTask + @ContributesAndroidInjector abstract fun resetRileyLinkConfigurationTaskProvider(): ResetRileyLinkConfigurationTask + @ContributesAndroidInjector abstract fun wakeAndTuneTaskProvider(): WakeAndTuneTask + @ContributesAndroidInjector abstract fun radioResponseProvider(): RadioResponse + @ContributesAndroidInjector abstract fun rileyLinkBLEProvider(): RileyLinkBLE + @ContributesAndroidInjector abstract fun rfSpyProvider(): RFSpy + @ContributesAndroidInjector abstract fun sendAndListenProvider(): SendAndListen + @ContributesAndroidInjector abstract fun setPreambleProvider(): SetPreamble + @ContributesAndroidInjector abstract fun radioPacketProvider(): RadioPacket +} \ No newline at end of file diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/actions/ActionsFragment.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/actions/ActionsFragment.kt index 22973b3caf..20a6493ea8 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/actions/ActionsFragment.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/actions/ActionsFragment.kt @@ -25,7 +25,7 @@ import info.nightscout.androidaps.plugins.general.actions.defs.CustomAction import info.nightscout.androidaps.plugins.general.overview.StatusLightHandler import info.nightscout.androidaps.queue.Callback import info.nightscout.androidaps.utils.FabricPrivacy -import info.nightscout.androidaps.utils.SingleClickButton +import info.nightscout.androidaps.utils.ui.SingleClickButton import info.nightscout.androidaps.utils.alertDialogs.OKDialog import info.nightscout.androidaps.utils.buildHelper.BuildHelper import info.nightscout.androidaps.utils.extensions.plusAssign diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/defs/DeviceCommandExecutor.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/defs/DeviceCommandExecutor.java deleted file mode 100644 index 8145d7f13b..0000000000 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/defs/DeviceCommandExecutor.java +++ /dev/null @@ -1,4 +0,0 @@ -package info.nightscout.androidaps.plugins.pump.common.defs; - -public interface DeviceCommandExecutor { -} diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/driver/OmnipodDriverState.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/driver/OmnipodDriverState.java deleted file mode 100644 index daa51b3685..0000000000 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/driver/OmnipodDriverState.java +++ /dev/null @@ -1,11 +0,0 @@ -package info.nightscout.androidaps.plugins.pump.omnipod.driver; - -// TODO replace with method calls on PodStateManager -public enum OmnipodDriverState { - - NotInitalized, // when we start - Initalized_NoPod, // driver is initalized, but there is no pod - Initalized_PodInitializing, // driver is initalized, pod is initalizing - Initalized_PodAttached, // driver is initalized, pod is there - -} diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/driver/ui/OmnipodUIPostprocessor.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/driver/ui/OmnipodUIPostprocessor.java deleted file mode 100644 index cf14405dcc..0000000000 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/driver/ui/OmnipodUIPostprocessor.java +++ /dev/null @@ -1,115 +0,0 @@ -package info.nightscout.androidaps.plugins.pump.omnipod.driver.ui; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.util.Date; - -import javax.inject.Inject; -import javax.inject.Singleton; - -import info.nightscout.androidaps.data.DetailedBolusInfo; -import info.nightscout.androidaps.data.PumpEnactResult; -import info.nightscout.androidaps.logging.LTag; -import info.nightscout.androidaps.plugins.bus.RxBusWrapper; -import info.nightscout.androidaps.plugins.pump.omnipod.OmnipodPumpPlugin; -import info.nightscout.androidaps.plugins.pump.omnipod.defs.OmnipodPumpPluginInterface; -import info.nightscout.androidaps.plugins.pump.omnipod.driver.OmnipodPumpStatus; - -/** - * Created by andy on 4.8.2019 - */ -// TODO remove once OmnipodPumpStatus has been removed -@Singleton -public class OmnipodUIPostprocessor { - - - private static final Logger LOG = LoggerFactory.getLogger(LTag.PUMP.name()); - - private OmnipodPumpStatus pumpStatus; - private OmnipodPumpPluginInterface omnipodPumpPlugin; - private RxBusWrapper rxBus; - - @Inject - public OmnipodUIPostprocessor(OmnipodPumpPlugin plugin, OmnipodPumpStatus pumpStatus) { - this.pumpStatus = pumpStatus; - this.omnipodPumpPlugin = plugin; - this.rxBus = plugin.getRxBus(); - } - - // this is mostly intended for command that return certain statuses (Remaining Insulin, ...), and - // where responses won't be directly used - public void postProcessData(OmnipodUITask uiTask) { - - switch (uiTask.commandType) { - - case SetBolus: { - if (uiTask.returnData != null) { - - PumpEnactResult result = uiTask.returnData; - - DetailedBolusInfo detailedBolusInfo = (DetailedBolusInfo) uiTask.getObjectFromParameters(0); - - if (result.success) { - boolean isSmb = detailedBolusInfo.isSMB; - - if (!isSmb) { - pumpStatus.lastBolusAmount = detailedBolusInfo.insulin; - pumpStatus.lastBolusTime = new Date(); - } - } - } - } - break; - - case CancelTemporaryBasal: { - pumpStatus.tempBasalStart = 0; - pumpStatus.tempBasalEnd = 0; - pumpStatus.tempBasalAmount = null; - pumpStatus.tempBasalLength = null; - } - break; - -// case PairAndPrimePod: { -// if (uiTask.returnData.success) { -// omnipodPumpPlugin.setEnableCustomAction(OmnipodCustomActionType.PairAndPrime, false); -// omnipodPumpPlugin.setEnableCustomAction(OmnipodCustomActionType.FillCanulaSetBasalProfile, true); -// } -// omnipodPumpPlugin.setEnableCustomAction(OmnipodCustomActionType.DeactivatePod, true); -// } -// break; -// -// case FillCanulaAndSetBasalProfile: { -// if (uiTask.returnData.success) { -// omnipodPumpPlugin.setEnableCustomAction(OmnipodCustomActionType.FillCanulaSetBasalProfile, false); -// } -// omnipodPumpPlugin.setEnableCustomAction(OmnipodCustomActionType.DeactivatePod, true); -// } -// break; -// -// case DeactivatePod: -// case ResetPodStatus: { -// omnipodPumpPlugin.setEnableCustomAction(OmnipodCustomActionType.PairAndPrime, true); -// omnipodPumpPlugin.setEnableCustomAction(OmnipodCustomActionType.DeactivatePod, false); -// } -// break; - - - default: - if (isLogEnabled()) - LOG.trace("Post-processing not implemented for {}.", uiTask.commandType.name()); - - } - - - } - - - private boolean isLogEnabled() { - return true; //L.isEnabled(LTag.PUMP); - } - - public RxBusWrapper getRxBus() { - return this.rxBus; - } -} diff --git a/app/src/main/res/layout/actions_fragment.xml b/app/src/main/res/layout/actions_fragment.xml index ebb517dcb7..427000813d 100644 --- a/app/src/main/res/layout/actions_fragment.xml +++ b/app/src/main/res/layout/actions_fragment.xml @@ -25,7 +25,7 @@ android:padding="10dip" app:columnCount="2"> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Extended bolus delivery error Sight ago - enableSMB_always + enableSMB_always enableSMB_with_COB enableSMB_with_temptarget enableSMB_after_carbs @@ -915,18 +915,18 @@ Max daily safety multiplier Current basal safety multiplier n/a - virtualpump_type + virtualpump_type Virtual Pump Type Pump Definition Bolus: Step=%1$s\nExtended Bolus: [Step=%2$s, Duration=%3$smin-%4$sh]\nBasal: Step=%5$s\nTBR: %6$s (by %7$s), Duration=%8$smin-%9$sh\n%10$s Autobackfill BG Wizard Settings - wearwizard_bg - wearwizard_tt - wearwizard_trend - wearwizard_cob - wearwizard_bolusiob - wearwizard_basaliob + wearwizard_bg + wearwizard_tt + wearwizard_trend + wearwizard_cob + wearwizard_bolusiob + wearwizard_basaliob Calculations included in the Wizard result: Display Settings General Settings @@ -965,8 +965,8 @@ Poctech Receive BG values from Poctech app Receive BG values from Tomato app (MiaoMiao device) - high_temptarget_raises_sensitivity - low_temptarget_lowers_sensitivity + high_temptarget_raises_sensitivity + low_temptarget_lowers_sensitivity High temptarget raises sensitivity = 100]]> Low temptarget lowers sensitivity @@ -1284,7 +1284,6 @@ Clear finished Clear started Do you want reset objective start? You may lose your progress. - Time and/or Timezone change on pump No pump selected Select units you want to display values in Upload local profile changes to NS @@ -1384,7 +1383,6 @@ Authorization failed Absolute insulin Master password is used for backup encryption and to override security in application. Remember it or store on a safe place. - Passwords don\'t match Current master password Status lights Copy settings from NS @@ -1397,174 +1395,6 @@ skin Skin - - - Never contacted - Waking up - Error with communication - Timeout on communication - Pump unreachable - Invalid configuration - Active - Sleeping - - - - - - Omnipod - POD - Pump integration for Omnipod, requires RileyLink (with at least 2.0 firmware) device. - - - pref_omnipod_beep_bolus_enabled - pref_omnipod_beep_basal_enabled - pref_omnipod_beep_smb_enabled - pref_omnipod_beep_tbr_enabled - pref_omnipod_pod_debugging_options_enabled - pref_omnipod_timechange_enabled - Bolus Beep Enabled - Basal Beep Enabled - SMB Beep Enabled - TBR Beep Enabled - Pod Debugging Options Enabled - DST/Timezone Detection Enabled - - - Now - Pod Mgmt - Pod Status - %1$.2f U left - Over 50 U - Pod Address - Pod Expires - Warning - No Pod connected - Pod setup in progress (Pod progress status: %1$s) - Pod not initialized - Pod Fault - Pod Fault: %1$s %2$s - Pod running (last delivery status: %1$s) - Active Pod Alerts - Ack Alerts - %1$.2f %2$s (%3$s) - Initializing - Active - Unknown - - - - Omnipod (433.91 MHz) - - - - RileyLink Address invalid. - Operation is not possible.\n\nYou need to configure Omnipod first, before you can use this operation. - Operation is not possible.\n\n You need to wait few minutes, until AAPS tries to set profile for first time. - Illegal PodInitActionType: %1$s - No active pod. - - Command verification failed. - An unexpected error occurred. Please report! (type: %1$s). - Communication failed: received invalid input parameters. - Communication failed: timeout. - Communication failed: an unexpected error occurred. Please report! - Communication failed: message integrity verification failed. - Communication failed: received an invalid packet from the Pod. - Communication failed: the Pod is in a wrong state. - Communication failed: received an invalid response from the Pod. - Communication failed: received a message with an invalid sequence number from the Pod. - Communication failed: received a message with an invalid address from the Pod. - Communication failed: failed to decode message from the Pod. - Communication failed: nonce resync failed. - Communication failed: nonce out of sync. - Communication failed: not enough data received from the Pod. - A Pod fault (%1$03d %2$s) has been detected. Please deactivate your Pod and start a new one. - Communication failed: the Pod returned an error response. - - - Pod Management - Init Pod - Deactivate Pod - Reset Pod - Pod History - - Set Bolus - Cancel Bolus - Set Temporary Basal - Cancel Temporary Basal (Internally by driver) - Cancel Temporary Basal (Forced by user) - Set Basal Schedule - Get Pod Status - Get Pod Info - Set Time - Configure Alerts - Acknowledge Alerts - Suspend Delivery - Resume Delivery - Unknown Entry - - %1$.1f U - %1$.1f U, CH=%2$.1f g - Rate: %1$.1f U, Duration: %2$d min - - If you press OK, the Pod state will be forcibly reset and you will not be able to communicate with the Pod anymore. Do this only if you can not communicate with the Pod anymore. If you can still communicate with the Pod, please use the Deactivate Pod option. - Pod History not available at the moment. - - Omnipod - Omnipod - Omnipod - - - Fill the Pod - \nFill the new Pod with enough insulin for 3 days.\n\nListen for two beeps from the Pod during the filling process. These indicate that the minimum amount of 85U has been inserted. Be sure to completely empty the fill syringe, even after hearing the two beeps.\n\nAfter filling the Pod, please press Next.\n\nNote: do not remove the Pod\'s needle cap at this time. - Priming - Trying to pair with the new Pod and prime it.\n\nWhen all items are checked, you can press Next.\n\nNote: please keep the Pod and the RileyLink a few inches apart at this time. - Attach the Pod - \nPrepare the infusion site. Remove the Pod\'s needle cap and adhesive backing and attach the Pod to the infusion site.\n\nIf the cannula sticks out, please press Cancel and discard your Pod.\n\nPress Next to insert the cannula and begin basal delivery. - Inserting cannula - Trying to set initial basal schedule and insert the cannula.\n\nWhen all items are checked, you can press Next. - - Pod Info - \nThe Pod is now active.\n\nYour basal schedule has been programmed and the cannula has been inserted.\n\nPlease verify that the cannula has been inserted correctly and replace your Pod if you feel hasn\'t. - - Deactivate Pod - \nPress Next to deactivate the Pod.\n\nNote: This will suspend all insulin delivery and deactivate the Pod. - Deactivating the Pod - Deactivating the Pod.\n\nWhen all items are checked, you can press Next.\n\nNote: If deactivating continuously fails, please press Cancel and use the Reset Pod option to forcibly reset the Pod state. - - Pod deactivated.\n\nPlease remove the Pod from your body and discard it. - - Pair Pod - Prime Pod - Fill Cannula - Set Basal Profile - Cancel Delivery - Deactivate Pod - - - - Omnipod Dash - DASH - Pump integration for Omnipod Dash. - Finish pairing reminder - Finish setup reminder - Pod will expire soon - Pod will expire soon - Shutdown is imminent - Low reservoir - Unknown alert - Setting basal profile might have failed. Delivery might be suspended! Please refresh Pod status. - Setting temp basal might have failed. If there was a temp basal already running, that may have been cancelled! Please refresh pod status. - Setting time might have failed. Delivery might be suspended! Please refresh Pod status. - Unable to verify whether the bolus succeeded. Please verify that your Pod is bolusing or cancel the bolus. - RL Stats - Pulse Log - LOT - TID - PM / PI version - Errors - Compare profiles Profile helper Default profile diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index 29f4ef5bc7..7425a772b4 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -52,36 +52,5 @@ #ff0000 - - - - - - + + + + + \ No newline at end of file diff --git a/app/src/main/res/xml/pref_omnipod.xml b/omnipod/src/main/res/xml/pref_omnipod.xml similarity index 100% rename from app/src/main/res/xml/pref_omnipod.xml rename to omnipod/src/main/res/xml/pref_omnipod.xml diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/message/command/AcknowledgeAlertsCommandTest.java b/omnipod/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/message/command/AcknowledgeAlertsCommandTest.java similarity index 100% rename from app/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/message/command/AcknowledgeAlertsCommandTest.java rename to omnipod/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/message/command/AcknowledgeAlertsCommandTest.java diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/message/command/AssignAddressCommandTest.java b/omnipod/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/message/command/AssignAddressCommandTest.java similarity index 100% rename from app/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/message/command/AssignAddressCommandTest.java rename to omnipod/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/message/command/AssignAddressCommandTest.java diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/message/command/BasalScheduleExtraCommandTest.java b/omnipod/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/message/command/BasalScheduleExtraCommandTest.java similarity index 100% rename from app/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/message/command/BasalScheduleExtraCommandTest.java rename to omnipod/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/message/command/BasalScheduleExtraCommandTest.java diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/message/command/BeepConfigCommandTest.java b/omnipod/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/message/command/BeepConfigCommandTest.java similarity index 100% rename from app/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/message/command/BeepConfigCommandTest.java rename to omnipod/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/message/command/BeepConfigCommandTest.java diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/message/command/BolusExtraCommandTest.java b/omnipod/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/message/command/BolusExtraCommandTest.java similarity index 100% rename from app/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/message/command/BolusExtraCommandTest.java rename to omnipod/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/message/command/BolusExtraCommandTest.java diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/message/command/CancelDeliveryCommandTest.java b/omnipod/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/message/command/CancelDeliveryCommandTest.java similarity index 100% rename from app/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/message/command/CancelDeliveryCommandTest.java rename to omnipod/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/message/command/CancelDeliveryCommandTest.java diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/message/command/ConfigureAlertsCommandTest.java b/omnipod/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/message/command/ConfigureAlertsCommandTest.java similarity index 100% rename from app/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/message/command/ConfigureAlertsCommandTest.java rename to omnipod/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/message/command/ConfigureAlertsCommandTest.java diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/message/command/DeactivatePodCommandTest.java b/omnipod/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/message/command/DeactivatePodCommandTest.java similarity index 100% rename from app/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/message/command/DeactivatePodCommandTest.java rename to omnipod/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/message/command/DeactivatePodCommandTest.java diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/message/command/FaultConfigCommandTest.java b/omnipod/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/message/command/FaultConfigCommandTest.java similarity index 100% rename from app/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/message/command/FaultConfigCommandTest.java rename to omnipod/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/message/command/FaultConfigCommandTest.java diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/message/command/GetStatusCommandTest.java b/omnipod/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/message/command/GetStatusCommandTest.java similarity index 100% rename from app/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/message/command/GetStatusCommandTest.java rename to omnipod/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/message/command/GetStatusCommandTest.java diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/message/command/SetInsulinScheduleCommandTest.java b/omnipod/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/message/command/SetInsulinScheduleCommandTest.java similarity index 100% rename from app/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/message/command/SetInsulinScheduleCommandTest.java rename to omnipod/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/message/command/SetInsulinScheduleCommandTest.java diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/message/command/SetupPodCommandTest.java b/omnipod/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/message/command/SetupPodCommandTest.java similarity index 100% rename from app/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/message/command/SetupPodCommandTest.java rename to omnipod/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/message/command/SetupPodCommandTest.java diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/message/command/TempBasalExtraCommandTest.java b/omnipod/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/message/command/TempBasalExtraCommandTest.java similarity index 100% rename from app/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/message/command/TempBasalExtraCommandTest.java rename to omnipod/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/message/command/TempBasalExtraCommandTest.java diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/message/defs/schedule/BasalTableEntryTest.java b/omnipod/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/message/defs/schedule/BasalTableEntryTest.java similarity index 100% rename from app/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/message/defs/schedule/BasalTableEntryTest.java rename to omnipod/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/message/defs/schedule/BasalTableEntryTest.java diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/message/response/ErrorResponseTest.java b/omnipod/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/message/response/ErrorResponseTest.java similarity index 100% rename from app/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/message/response/ErrorResponseTest.java rename to omnipod/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/message/response/ErrorResponseTest.java diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/message/response/StatusResponseTest.java b/omnipod/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/message/response/StatusResponseTest.java similarity index 100% rename from app/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/message/response/StatusResponseTest.java rename to omnipod/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/message/response/StatusResponseTest.java diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/message/response/VersionResponseTest.java b/omnipod/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/message/response/VersionResponseTest.java similarity index 100% rename from app/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/message/response/VersionResponseTest.java rename to omnipod/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/message/response/VersionResponseTest.java diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/message/response/podinfo/PodInfoActiveAlertsTest.java b/omnipod/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/message/response/podinfo/PodInfoActiveAlertsTest.java similarity index 100% rename from app/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/message/response/podinfo/PodInfoActiveAlertsTest.java rename to omnipod/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/message/response/podinfo/PodInfoActiveAlertsTest.java diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/message/response/podinfo/PodInfoDataLogTest.java b/omnipod/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/message/response/podinfo/PodInfoDataLogTest.java similarity index 100% rename from app/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/message/response/podinfo/PodInfoDataLogTest.java rename to omnipod/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/message/response/podinfo/PodInfoDataLogTest.java diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/message/response/podinfo/PodInfoFaultAndInitializationTimeTest.java b/omnipod/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/message/response/podinfo/PodInfoFaultAndInitializationTimeTest.java similarity index 77% rename from app/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/message/response/podinfo/PodInfoFaultAndInitializationTimeTest.java rename to omnipod/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/message/response/podinfo/PodInfoFaultAndInitializationTimeTest.java index a7baff4f06..2998dc4f83 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/message/response/podinfo/PodInfoFaultAndInitializationTimeTest.java +++ b/omnipod/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/message/response/podinfo/PodInfoFaultAndInitializationTimeTest.java @@ -2,6 +2,7 @@ package info.nightscout.androidaps.plugins.pump.omnipod.comm.message.response.po import org.joda.time.DateTime; import org.joda.time.Duration; +import org.junit.Assert; import org.junit.Test; import info.nightscout.androidaps.plugins.pump.common.utils.ByteUtil; @@ -19,10 +20,10 @@ public class PodInfoFaultAndInitializationTimeTest { assertTrue(Duration.standardMinutes(1).isEqual(podInfoFaultAndInitializationTime.getTimeFaultEvent())); DateTime dateTime = podInfoFaultAndInitializationTime.getInitializationTime(); - assertEquals(2018, dateTime.getYear()); - assertEquals(9, dateTime.getMonthOfYear()); - assertEquals(25, dateTime.getDayOfMonth()); - assertEquals(23, dateTime.getHourOfDay()); - assertEquals(14, dateTime.getMinuteOfHour()); + Assert.assertEquals(2018, dateTime.getYear()); + Assert.assertEquals(9, dateTime.getMonthOfYear()); + Assert.assertEquals(25, dateTime.getDayOfMonth()); + Assert.assertEquals(23, dateTime.getHourOfDay()); + Assert.assertEquals(14, dateTime.getMinuteOfHour()); } } diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/message/response/podinfo/PodInfoFaultEventTest.java b/omnipod/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/message/response/podinfo/PodInfoFaultEventTest.java similarity index 100% rename from app/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/message/response/podinfo/PodInfoFaultEventTest.java rename to omnipod/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/message/response/podinfo/PodInfoFaultEventTest.java diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/message/response/podinfo/PodInfoOlderPulseLogTest.java b/omnipod/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/message/response/podinfo/PodInfoOlderPulseLogTest.java similarity index 100% rename from app/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/message/response/podinfo/PodInfoOlderPulseLogTest.java rename to omnipod/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/message/response/podinfo/PodInfoOlderPulseLogTest.java diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/message/response/podinfo/PodInfoRecentPulseLogTest.java b/omnipod/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/message/response/podinfo/PodInfoRecentPulseLogTest.java similarity index 100% rename from app/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/message/response/podinfo/PodInfoRecentPulseLogTest.java rename to omnipod/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/message/response/podinfo/PodInfoRecentPulseLogTest.java diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/message/response/podinfo/PodInfoResponseTest.java b/omnipod/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/message/response/podinfo/PodInfoResponseTest.java similarity index 100% rename from app/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/message/response/podinfo/PodInfoResponseTest.java rename to omnipod/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/message/response/podinfo/PodInfoResponseTest.java diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/defs/state/AapsPodStateManagerTest.java b/omnipod/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/defs/state/AapsPodStateManagerTest.java similarity index 100% rename from app/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/defs/state/AapsPodStateManagerTest.java rename to omnipod/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/defs/state/AapsPodStateManagerTest.java diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/driver/comm/AapsOmnipodManagerTest.java b/omnipod/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/driver/comm/AapsOmnipodManagerTest.java similarity index 71% rename from app/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/driver/comm/AapsOmnipodManagerTest.java rename to omnipod/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/driver/comm/AapsOmnipodManagerTest.java index 5def4c92d4..fcfd6c7d7a 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/driver/comm/AapsOmnipodManagerTest.java +++ b/omnipod/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/driver/comm/AapsOmnipodManagerTest.java @@ -21,21 +21,21 @@ public class AapsOmnipodManagerTest { @Test public void validProfile() { - Profile profile = mock(Profile.class); + Profile profile = Mockito.mock(Profile.class); - Profile.ProfileValue value1 = mock(Profile.ProfileValue.class); + Profile.ProfileValue value1 = Mockito.mock(Profile.ProfileValue.class); value1.timeAsSeconds = 0; value1.value = 0.5D; - Profile.ProfileValue value2 = mock(Profile.ProfileValue.class); + Profile.ProfileValue value2 = Mockito.mock(Profile.ProfileValue.class); value2.timeAsSeconds = 18000; value2.value = 1.0D; - Profile.ProfileValue value3 = mock(Profile.ProfileValue.class); + Profile.ProfileValue value3 = Mockito.mock(Profile.ProfileValue.class); value3.timeAsSeconds = 50400; value3.value = 3.05D; - when(profile.getBasalValues()).thenReturn(new Profile.ProfileValue[]{ + PowerMockito.when(profile.getBasalValues()).thenReturn(new Profile.ProfileValue[]{ value1, value2, value3 @@ -70,16 +70,16 @@ public class AapsOmnipodManagerTest { public void invalidProfileNullEntries() { thrown.expect(IllegalArgumentException.class); thrown.expectMessage("Basal values can not be null"); - AapsOmnipodManager.mapProfileToBasalSchedule(mock(Profile.class)); + AapsOmnipodManager.mapProfileToBasalSchedule(Mockito.mock(Profile.class)); } @Test public void invalidProfileZeroEntries() { thrown.expect(IllegalArgumentException.class); thrown.expectMessage("Entries can not be empty"); - Profile profile = mock(Profile.class); + Profile profile = Mockito.mock(Profile.class); - when(profile.getBasalValues()).thenReturn(new Profile.ProfileValue[0]); + PowerMockito.when(profile.getBasalValues()).thenReturn(new Profile.ProfileValue[0]); AapsOmnipodManager.mapProfileToBasalSchedule(profile); } @@ -89,13 +89,13 @@ public class AapsOmnipodManagerTest { thrown.expect(IllegalArgumentException.class); thrown.expectMessage("First basal schedule entry should have 0 offset"); - Profile profile = mock(Profile.class); + Profile profile = Mockito.mock(Profile.class); - Profile.ProfileValue value = mock(Profile.ProfileValue.class); + Profile.ProfileValue value = Mockito.mock(Profile.ProfileValue.class); value.timeAsSeconds = 1800; value.value = 0.5D; - when(profile.getBasalValues()).thenReturn(new Profile.ProfileValue[]{ + PowerMockito.when(profile.getBasalValues()).thenReturn(new Profile.ProfileValue[]{ value, }); @@ -107,17 +107,17 @@ public class AapsOmnipodManagerTest { thrown.expect(IllegalArgumentException.class); thrown.expectMessage("Invalid start time"); - Profile profile = mock(Profile.class); + Profile profile = Mockito.mock(Profile.class); - Profile.ProfileValue value1 = mock(Profile.ProfileValue.class); + Profile.ProfileValue value1 = Mockito.mock(Profile.ProfileValue.class); value1.timeAsSeconds = 0; value1.value = 0.5D; - Profile.ProfileValue value2 = mock(Profile.ProfileValue.class); + Profile.ProfileValue value2 = Mockito.mock(Profile.ProfileValue.class); value2.timeAsSeconds = 86400; value2.value = 0.5D; - when(profile.getBasalValues()).thenReturn(new Profile.ProfileValue[]{ + PowerMockito.when(profile.getBasalValues()).thenReturn(new Profile.ProfileValue[]{ value1, value2 }); @@ -130,13 +130,13 @@ public class AapsOmnipodManagerTest { thrown.expect(IllegalArgumentException.class); thrown.expectMessage("Invalid start time"); - Profile profile = mock(Profile.class); + Profile profile = Mockito.mock(Profile.class); - Profile.ProfileValue value = mock(Profile.ProfileValue.class); + Profile.ProfileValue value = Mockito.mock(Profile.ProfileValue.class); value.timeAsSeconds = -1; value.value = 0.5D; - when(profile.getBasalValues()).thenReturn(new Profile.ProfileValue[]{ + PowerMockito.when(profile.getBasalValues()).thenReturn(new Profile.ProfileValue[]{ value, }); @@ -145,13 +145,13 @@ public class AapsOmnipodManagerTest { @Test public void roundsToSupportedPrecision() { - Profile profile = mock(Profile.class); + Profile profile = Mockito.mock(Profile.class); - Profile.ProfileValue value = mock(Profile.ProfileValue.class); + Profile.ProfileValue value = Mockito.mock(Profile.ProfileValue.class); value.timeAsSeconds = 0; value.value = 0.04D; - when(profile.getBasalValues()).thenReturn(new Profile.ProfileValue[]{ + PowerMockito.when(profile.getBasalValues()).thenReturn(new Profile.ProfileValue[]{ value, }); diff --git a/rileylink/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 index 8a47453ad3..729ecf9f1a 100644 --- a/rileylink/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 @@ -35,29 +35,20 @@ public abstract class RileyLinkCommunicationManager { @Inject protected SP sp; @Inject protected RileyLinkServiceData rileyLinkServiceData; @Inject protected ServiceTaskExecutor serviceTaskExecutor; - + @Inject protected RFSpy rfspy; + @Inject protected HasAndroidInjector injector; private final int SCAN_TIMEOUT = 1500; private final int ALLOWED_PUMP_UNREACHABLE = 10 * 60 * 1000; // 10 minutes - public final HasAndroidInjector injector; - protected final RFSpy rfspy; protected int receiverDeviceAwakeForMinutes = 1; // override this in constructor of specific implementation protected String receiverDeviceID; // String representation of receiver device (ex. Pump (xxxxxx) or Pod (yyyyyy)) protected long lastGoodReceiverCommunicationTime = 0; // protected PumpStatus pumpStatus; private long nextWakeUpRequired = 0L; - private int timeoutCount = 0; - public RileyLinkCommunicationManager(HasAndroidInjector injector, RFSpy rfspy) { - this.injector = injector; - injector.androidInjector().inject(this); - this.rfspy = rfspy; - } - - // All pump communications go through this function. protected RLMessage sendAndListen(RLMessage msg, int timeout_ms) throws RileyLinkCommunicationException { diff --git a/rileylink/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 index dc5e648194..128152aa31 100644 --- a/rileylink/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 @@ -5,6 +5,7 @@ import android.os.SystemClock; import java.util.UUID; import javax.inject.Inject; +import javax.inject.Singleton; import dagger.android.HasAndroidInjector; @@ -40,6 +41,7 @@ import info.nightscout.androidaps.utils.sharedPreferences.SP; /** * Created by geoff on 5/26/16. */ +@Singleton public class RFSpy { @Inject AAPSLogger aapsLogger; @@ -64,10 +66,14 @@ public class RFSpy { private Double currentFrequencyMHz; + @Inject public RFSpy(HasAndroidInjector injector, RileyLinkBLE rileyLinkBle) { - injector.androidInjector().inject(this); this.injector = injector; this.rileyLinkBle = rileyLinkBle; + } + + @Inject + public void onInit() { aapsLogger.debug("RileyLinkServiceData:" + rileyLinkServiceData); reader = new RFSpyReader(aapsLogger, rileyLinkBle); } diff --git a/rileylink/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 index a132218751..6c90c62e24 100644 --- a/rileylink/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 @@ -18,8 +18,8 @@ import java.util.UUID; import java.util.concurrent.Semaphore; import javax.inject.Inject; +import javax.inject.Singleton; -import dagger.android.HasAndroidInjector; import info.nightscout.androidaps.logging.AAPSLogger; import info.nightscout.androidaps.logging.LTag; import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkConst; @@ -40,6 +40,7 @@ import info.nightscout.androidaps.plugins.pump.common.utils.ThreadUtil; * Created by geoff on 5/26/16. * Added: State handling, configuration of RF for different configuration ranges, connection handling */ +@Singleton public class RileyLinkBLE { @Inject AAPSLogger aapsLogger; @@ -58,13 +59,11 @@ public class RileyLinkBLE { private Runnable radioResponseCountNotified; private boolean mIsConnected = false; - - public RileyLinkBLE(HasAndroidInjector injector, final Context context) { - injector.androidInjector().inject(this); + @Inject + public RileyLinkBLE(final Context context) { this.context = context; this.bluetoothAdapter = BluetoothAdapter.getDefaultAdapter(); - aapsLogger.debug(LTag.PUMPBTCOMM, "BT Adapter: " + this.bluetoothAdapter); bluetoothGattCallback = new BluetoothGattCallback() { @Override @@ -257,6 +256,11 @@ public class RileyLinkBLE { }; } + @Inject + public void onInit() { + aapsLogger.debug(LTag.PUMPBTCOMM, "BT Adapter: " + this.bluetoothAdapter); + } + private boolean isAnyRileyLinkServiceFound(BluetoothGattService service) { diff --git a/rileylink/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 index c845a3afe2..7b25cf63ec 100644 --- a/rileylink/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,17 +2,11 @@ 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.utils.resources.ResourceHelper; -//import info.nightscout.androidaps.plugins.pump.omnipod.defs.OmnipodCommandType; /** @@ -21,7 +15,6 @@ import info.nightscout.androidaps.utils.resources.ResourceHelper; public class RLHistoryItem { - //private MedtronicCommandType medtronicCommandType; protected LocalDateTime dateTime; protected RLHistoryItemSource source; protected RileyLinkServiceState serviceState; @@ -29,9 +22,8 @@ public class RLHistoryItem { protected RileyLinkTargetDevice targetDevice; protected PumpDeviceState pumpDeviceState; - //private OmnipodCommandType omnipodCommandType; - public RLHistoryItem(LocalDateTime dateTime, RLHistoryItemSource source, RileyLinkTargetDevice targetDevice) { + public RLHistoryItem(LocalDateTime dateTime, RLHistoryItemSource source, RileyLinkTargetDevice targetDevice) { this.dateTime = dateTime; this.source = source; this.targetDevice = targetDevice; @@ -46,7 +38,6 @@ public class RLHistoryItem { this.source = RLHistoryItemSource.RileyLink; } - public RLHistoryItem(PumpDeviceState pumpDeviceState, RileyLinkTargetDevice targetDevice) { this.pumpDeviceState = pumpDeviceState; this.dateTime = new LocalDateTime(); @@ -54,64 +45,34 @@ public class RLHistoryItem { this.source = RLHistoryItemSource.MedtronicPump; } - -// 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() { return dateTime; } - public RileyLinkServiceState getServiceState() { return serviceState; } - public RileyLinkError getErrorCode() { return errorCode; } - public String getDescription(ResourceHelper resourceHelper) { - - // TODO extend when we have Omnipod switch (this.source) { case RileyLink: - return "State: " + resourceHelper.gs(serviceState.getResourceId(targetDevice)) + return "State: " + resourceHelper.gs(serviceState.getResourceId()) + (this.errorCode == null ? "" : ", Error Code: " + errorCode); - case MedtronicPump: return resourceHelper.gs(pumpDeviceState.getResourceId()); - -// case MedtronicCommand: -// return medtronicCommandType.name(); -// -// case OmnipodCommand: -// return omnipodCommandType.name(); - default: return "Unknown Description"; } } - public RLHistoryItemSource getSource() { return source; } - public PumpDeviceState getPumpDeviceState() { return pumpDeviceState; } @@ -129,14 +90,12 @@ public class RLHistoryItem { this.desc = desc; } - public String getDesc() { return desc; } } public static class Comparator implements java.util.Comparator { - @Override public int compare(RLHistoryItem o1, RLHistoryItem o2) { return o2.dateTime.compareTo(o1.getDateTime()); diff --git a/rileylink/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 index 76c31f9cf2..97ce0c6ce1 100644 --- a/rileylink/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 @@ -22,7 +22,7 @@ public enum RileyLinkServiceState { RileyLinkInitializing(R.string.rileylink_state_rl_init), // (S) start Gatt discovery (OK -> RileyLinkReady, Error -> // BluetoothEnabled) ?? RileyLinkError(R.string.rileylink_state_rl_error), // (E) - RileyLinkReady(R.string.rileylink_state_connected), // (OK) if tunning was already done we go to PumpConnectorReady + RileyLinkReady(R.string.rileylink_state_rl_ready), // (OK) if tunning was already done we go to PumpConnectorReady // Tunning TuneUpDevice(R.string.rileylink_state_pc_tune_up), // (S) @@ -40,43 +40,23 @@ public enum RileyLinkServiceState { // RileyLinkConnected, // -> TuneUpPump (on 1st), else PumpConnectorReady // PumpConnected, // - ; int resourceId; - Integer resourceIdPod; - RileyLinkServiceState(int resourceId) { this.resourceId = resourceId; } - - RileyLinkServiceState(int resourceId, int resourceIdPod) { - this.resourceId = resourceId; - this.resourceIdPod = resourceIdPod; - } - - public boolean isReady() { return (this == PumpConnectorReady); } - - public int getResourceId(RileyLinkTargetDevice targetDevice) { - if (this.resourceIdPod != null) { - - return (targetDevice == null || targetDevice == RileyLinkTargetDevice.MedtronicPump) ? // - this.resourceId - : this.resourceIdPod; - } else { - return this.resourceId; - } + public int getResourceId() { + return this.resourceId; } - public boolean isConnecting() { - return (this == RileyLinkServiceState.BluetoothInitializing || // // this == RileyLinkServiceState.BluetoothError || // this == RileyLinkServiceState.BluetoothReady || // @@ -86,9 +66,7 @@ public enum RileyLinkServiceState { ); } - public boolean isError() { - return (this == RileyLinkServiceState.BluetoothError || // // this == RileyLinkServiceState.PumpConnectorError || // this == RileyLinkServiceState.RileyLinkError); diff --git a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/dialog/RileyLinkStatusGeneralFragment.java b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/dialog/RileyLinkStatusGeneralFragment.java index f48dfe95de..49094c3bcc 100644 --- a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/dialog/RileyLinkStatusGeneralFragment.java +++ b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/dialog/RileyLinkStatusGeneralFragment.java @@ -36,7 +36,6 @@ public class RileyLinkStatusGeneralFragment extends DaggerFragment implements Re @Inject ActivePluginProvider activePlugin; @Inject ResourceHelper resourceHelper; - //@Inject MedtronicUtil medtronicUtil; @Inject AAPSLogger aapsLogger; @Inject RileyLinkServiceData rileyLinkServiceData; @Inject DateUtil dateUtil; @@ -103,7 +102,7 @@ public class RileyLinkStatusGeneralFragment extends DaggerFragment implements Re RileyLinkTargetDevice targetDevice = rileyLinkServiceData.targetDevice; - this.connectionStatus.setText(resourceHelper.gs(rileyLinkServiceData.rileyLinkServiceState.getResourceId(targetDevice))); + this.connectionStatus.setText(resourceHelper.gs(rileyLinkServiceData.rileyLinkServiceState.getResourceId())); if (rileyLinkServiceData != null) { this.configuredAddress.setText(rileyLinkServiceData.rileylinkAddress); diff --git a/rileylink/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 index c0ae9d3140..986bbf4d9d 100644 --- a/rileylink/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 @@ -45,10 +45,10 @@ public abstract class RileyLinkService extends DaggerService { @Inject protected ResourceHelper resourceHelper; @Inject protected RileyLinkServiceData rileyLinkServiceData; @Inject protected ActivePluginProvider activePlugin; + @Inject protected RileyLinkBLE rileyLinkBLE; // android-bluetooth management + @Inject protected RFSpy rfspy; // interface for RL xxx Mhz radio. - @NotNull protected RileyLinkBLE rileyLinkBLE; // android-bluetooth management, must be set in initRileyLinkServiceData protected BluetoothAdapter bluetoothAdapter; - protected RFSpy rfspy; // interface for RL xxx Mhz radio. protected RileyLinkBroadcastReceiver mBroadcastReceiver; protected RileyLinkBluetoothStateReceiver bluetoothStateReceiver; diff --git a/rileylink/src/main/res/values/strings.xml b/rileylink/src/main/res/values/strings.xml index ddb9beaf9b..8e7445464b 100644 --- a/rileylink/src/main/res/values/strings.xml +++ b/rileylink/src/main/res/values/strings.xml @@ -42,6 +42,7 @@ Tuning up RileyLink and Pump Problem connecting to Pump Connected + RileyLink ready Device is not RileyLink diff --git a/settings.gradle b/settings.gradle index 19da851b52..4fb6743f5f 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,2 +1,2 @@ -include ':app', ':wear', ':core', ':dana', ':danar', ':danars', ':rileylink', ':medtronic' +include ':app', ':wear', ':core', ':dana', ':danar', ':danars', ':rileylink', ':medtronic', ':omnipod'