Merge pull request #140 from AAPS-Omnipod/omnipod_eros_dev_omnipod_module
Move Omnipod into a separate module (and more)
This commit is contained in:
commit
cf643279e4
261 changed files with 1042 additions and 1235 deletions
|
@ -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'
|
||||
|
|
|
@ -263,17 +263,6 @@
|
|||
|
||||
<uses-library android:name="org.apache.http.legacy" android:required="false"/>
|
||||
|
||||
<!-- Omnipod service and activities -->
|
||||
<service
|
||||
android:name=".plugins.pump.omnipod.service.RileyLinkOmnipodService"
|
||||
android:enabled="true"
|
||||
android:exported="true" />
|
||||
|
||||
<activity android:name=".plugins.pump.omnipod.dialogs.PodManagementActivity" />
|
||||
<activity android:name=".plugins.pump.omnipod.dialogs.PodHistoryActivity" />
|
||||
<activity android:name="com.atech.android.library.wizardpager.WizardPagerActivity"
|
||||
android:theme="@style/AppTheme.NoActionBar"/>
|
||||
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
|
|
|
@ -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<PodHistory, Long> getDaoPodHistory() throws SQLException {
|
||||
return getDao(PodHistory.class);
|
||||
private Dao<OmnipodHistoryRecord, Long> 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<PodHistory> getPodHistoryFromTime(long from, boolean ascending) {
|
||||
public List<OmnipodHistoryRecord> getAllOmnipodHistoryRecordsFromTimeStamp(long from, boolean ascending) {
|
||||
try {
|
||||
Dao<PodHistory, Long> daoPodHistory = getDaoPodHistory();
|
||||
List<PodHistory> podHistories;
|
||||
QueryBuilder<PodHistory, Long> queryBuilder = daoPodHistory.queryBuilder();
|
||||
Dao<OmnipodHistoryRecord, Long> daoPodHistory = getDaoPodHistory();
|
||||
List<OmnipodHistoryRecord> podHistories;
|
||||
QueryBuilder<OmnipodHistoryRecord, Long> queryBuilder = daoPodHistory.queryBuilder();
|
||||
queryBuilder.orderBy("date", ascending);
|
||||
//queryBuilder.limit(100L);
|
||||
Where where = queryBuilder.where();
|
||||
where.ge("date", from);
|
||||
PreparedQuery<PodHistory> preparedQuery = queryBuilder.prepare();
|
||||
PreparedQuery<OmnipodHistoryRecord> preparedQuery = queryBuilder.prepare();
|
||||
podHistories = daoPodHistory.query(preparedQuery);
|
||||
return podHistories;
|
||||
} catch (SQLException e) {
|
||||
|
|
|
@ -16,7 +16,8 @@ import info.nightscout.androidaps.interfaces.DatabaseHelperInterface;
|
|||
@Singleton
|
||||
public class DatabaseHelperProvider implements DatabaseHelperInterface {
|
||||
|
||||
@Inject DatabaseHelperProvider() {}
|
||||
@Inject DatabaseHelperProvider() {
|
||||
}
|
||||
|
||||
@NotNull @Override public List<BgReading> 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<DanaRHistoryRecord> 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<OmnipodHistoryRecord> getAllOmnipodHistoryRecordsFromTimestamp(long timestamp, boolean ascending) {
|
||||
return MainApp.getDbHelper().getAllOmnipodHistoryRecordsFromTimeStamp(timestamp, ascending);
|
||||
}
|
||||
|
||||
@NotNull @Override public List<TDD> getTDDsForLastXDays(int days) {
|
||||
return MainApp.getDbHelper().getTDDsForLastXDays(days);
|
||||
}
|
||||
|
|
|
@ -26,6 +26,7 @@ import javax.inject.Singleton
|
|||
CommandQueueModule::class,
|
||||
ObjectivesModule::class,
|
||||
WizardModule::class,
|
||||
RileyLinkModule::class,
|
||||
MedtronicModule::class,
|
||||
OmnipodModule::class,
|
||||
APSModule::class,
|
||||
|
|
|
@ -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
|
||||
}
|
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
}
|
|
@ -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
|
||||
|
|
|
@ -1,4 +0,0 @@
|
|||
package info.nightscout.androidaps.plugins.pump.common.defs;
|
||||
|
||||
public interface DeviceCommandExecutor {
|
||||
}
|
|
@ -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
|
||||
|
||||
}
|
|
@ -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;
|
||||
}
|
||||
}
|
|
@ -25,7 +25,7 @@
|
|||
android:padding="10dip"
|
||||
app:columnCount="2">
|
||||
|
||||
<info.nightscout.androidaps.utils.SingleClickButton
|
||||
<info.nightscout.androidaps.utils.ui.SingleClickButton
|
||||
android:id="@+id/actions_profileswitch"
|
||||
style="@style/ButtonSmallFontStyle"
|
||||
android:layout_width="0dp"
|
||||
|
@ -40,7 +40,7 @@
|
|||
app:layout_gravity="fill"
|
||||
app:layout_row="0" />
|
||||
|
||||
<info.nightscout.androidaps.utils.SingleClickButton
|
||||
<info.nightscout.androidaps.utils.ui.SingleClickButton
|
||||
android:id="@+id/actions_temptarget"
|
||||
style="@style/ButtonSmallFontStyle"
|
||||
android:layout_width="0dp"
|
||||
|
@ -55,7 +55,7 @@
|
|||
app:layout_gravity="fill"
|
||||
app:layout_row="0" />
|
||||
|
||||
<info.nightscout.androidaps.utils.SingleClickButton
|
||||
<info.nightscout.androidaps.utils.ui.SingleClickButton
|
||||
android:id="@+id/actions_settempbasal"
|
||||
style="@style/ButtonSmallFontStyle"
|
||||
android:layout_width="0dp"
|
||||
|
@ -70,7 +70,7 @@
|
|||
app:layout_gravity="fill"
|
||||
app:layout_row="1" />
|
||||
|
||||
<info.nightscout.androidaps.utils.SingleClickButton
|
||||
<info.nightscout.androidaps.utils.ui.SingleClickButton
|
||||
android:id="@+id/actions_canceltempbasal"
|
||||
style="@style/ButtonSmallFontStyle"
|
||||
android:layout_width="0dp"
|
||||
|
@ -86,7 +86,7 @@
|
|||
app:layout_gravity="fill"
|
||||
app:layout_row="1" />
|
||||
|
||||
<info.nightscout.androidaps.utils.SingleClickButton
|
||||
<info.nightscout.androidaps.utils.ui.SingleClickButton
|
||||
android:id="@+id/actions_extendedbolus"
|
||||
style="@style/ButtonSmallFontStyle"
|
||||
android:layout_width="0dp"
|
||||
|
@ -101,7 +101,7 @@
|
|||
app:layout_gravity="fill"
|
||||
app:layout_row="1" />
|
||||
|
||||
<info.nightscout.androidaps.utils.SingleClickButton
|
||||
<info.nightscout.androidaps.utils.ui.SingleClickButton
|
||||
android:id="@+id/actions_extendedbolus_cancel"
|
||||
style="@style/ButtonSmallFontStyle"
|
||||
android:layout_width="0dp"
|
||||
|
@ -139,7 +139,7 @@
|
|||
android:padding="10dip"
|
||||
app:columnCount="2">
|
||||
|
||||
<info.nightscout.androidaps.utils.SingleClickButton
|
||||
<info.nightscout.androidaps.utils.ui.SingleClickButton
|
||||
android:id="@+id/actions_bgcheck"
|
||||
style="@style/ButtonSmallFontStyle"
|
||||
android:layout_width="0dp"
|
||||
|
@ -154,7 +154,7 @@
|
|||
app:layout_gravity="fill"
|
||||
app:layout_row="2" />
|
||||
|
||||
<info.nightscout.androidaps.utils.SingleClickButton
|
||||
<info.nightscout.androidaps.utils.ui.SingleClickButton
|
||||
android:id="@+id/actions_fill"
|
||||
style="@style/ButtonSmallFontStyle"
|
||||
android:layout_width="0dp"
|
||||
|
@ -169,7 +169,7 @@
|
|||
app:layout_gravity="fill"
|
||||
app:layout_row="2" />
|
||||
|
||||
<info.nightscout.androidaps.utils.SingleClickButton
|
||||
<info.nightscout.androidaps.utils.ui.SingleClickButton
|
||||
android:id="@+id/actions_cgmsensorinsert"
|
||||
style="@style/ButtonSmallFontStyle"
|
||||
android:layout_width="0dp"
|
||||
|
@ -183,7 +183,7 @@
|
|||
app:layout_gravity="fill"
|
||||
app:layout_row="3" />
|
||||
|
||||
<info.nightscout.androidaps.utils.SingleClickButton
|
||||
<info.nightscout.androidaps.utils.ui.SingleClickButton
|
||||
android:id="@+id/actions_pumpbatterychange"
|
||||
style="@style/ButtonSmallFontStyle"
|
||||
android:layout_width="0dp"
|
||||
|
@ -197,7 +197,7 @@
|
|||
app:layout_gravity="fill"
|
||||
app:layout_row="3" />
|
||||
|
||||
<info.nightscout.androidaps.utils.SingleClickButton
|
||||
<info.nightscout.androidaps.utils.ui.SingleClickButton
|
||||
android:id="@+id/actions_note"
|
||||
style="@style/ButtonSmallFontStyle"
|
||||
android:layout_width="0dp"
|
||||
|
@ -211,7 +211,7 @@
|
|||
app:layout_gravity="fill"
|
||||
app:layout_row="4" />
|
||||
|
||||
<info.nightscout.androidaps.utils.SingleClickButton
|
||||
<info.nightscout.androidaps.utils.ui.SingleClickButton
|
||||
android:id="@+id/actions_exercise"
|
||||
style="@style/ButtonSmallFontStyle"
|
||||
android:layout_width="0dp"
|
||||
|
@ -225,7 +225,7 @@
|
|||
app:layout_gravity="fill"
|
||||
app:layout_row="4" />
|
||||
|
||||
<info.nightscout.androidaps.utils.SingleClickButton
|
||||
<info.nightscout.androidaps.utils.ui.SingleClickButton
|
||||
android:id="@+id/actions_announcement"
|
||||
style="@style/ButtonSmallFontStyle"
|
||||
android:layout_width="0dp"
|
||||
|
@ -239,7 +239,7 @@
|
|||
app:layout_gravity="fill"
|
||||
app:layout_row="5" />
|
||||
|
||||
<info.nightscout.androidaps.utils.SingleClickButton
|
||||
<info.nightscout.androidaps.utils.ui.SingleClickButton
|
||||
android:id="@+id/actions_question"
|
||||
style="@style/ButtonSmallFontStyle"
|
||||
android:layout_width="0dp"
|
||||
|
@ -268,7 +268,7 @@
|
|||
android:padding="10dip"
|
||||
app:columnCount="2">
|
||||
|
||||
<info.nightscout.androidaps.utils.SingleClickButton
|
||||
<info.nightscout.androidaps.utils.ui.SingleClickButton
|
||||
android:id="@+id/actions_historybrowser"
|
||||
style="@style/ButtonSmallFontStyle"
|
||||
android:layout_width="0dp"
|
||||
|
@ -282,7 +282,7 @@
|
|||
app:layout_gravity="fill"
|
||||
app:layout_row="6" />
|
||||
|
||||
<info.nightscout.androidaps.utils.SingleClickButton
|
||||
<info.nightscout.androidaps.utils.ui.SingleClickButton
|
||||
android:id="@+id/actions_tddstats"
|
||||
style="@style/ButtonSmallFontStyle"
|
||||
android:layout_width="0dp"
|
||||
|
|
|
@ -86,7 +86,7 @@
|
|||
style="@style/warning_label"
|
||||
android:text="@string/smscommunicator_otp_reset_warning" />
|
||||
|
||||
<info.nightscout.androidaps.utils.SingleClickButton
|
||||
<info.nightscout.androidaps.utils.ui.SingleClickButton
|
||||
android:id="@+id/actions_smscommunicator_otp_reset"
|
||||
style="?android:attr/buttonStyle"
|
||||
android:layout_width="fill_parent"
|
||||
|
|
|
@ -45,7 +45,7 @@
|
|||
android:padding="10dip"
|
||||
app:columnCount="3">
|
||||
|
||||
<info.nightscout.androidaps.utils.SingleClickButton
|
||||
<info.nightscout.androidaps.utils.ui.SingleClickButton
|
||||
android:id="@+id/careportal_bgcheck"
|
||||
style="@style/ButtonSmallFontStyle"
|
||||
android:layout_width="0px"
|
||||
|
@ -60,7 +60,7 @@
|
|||
app:layout_gravity="fill"
|
||||
app:layout_row="0" />
|
||||
|
||||
<info.nightscout.androidaps.utils.SingleClickButton
|
||||
<info.nightscout.androidaps.utils.ui.SingleClickButton
|
||||
android:id="@+id/careportal_exercise"
|
||||
style="@style/ButtonSmallFontStyle"
|
||||
android:layout_width="0dp"
|
||||
|
@ -74,7 +74,7 @@
|
|||
app:layout_gravity="fill"
|
||||
app:layout_row="0" />
|
||||
|
||||
<info.nightscout.androidaps.utils.SingleClickButton
|
||||
<info.nightscout.androidaps.utils.ui.SingleClickButton
|
||||
android:id="@+id/careportal_temporarytarget"
|
||||
style="@style/ButtonSmallFontStyle"
|
||||
android:layout_width="0dp"
|
||||
|
@ -105,7 +105,7 @@
|
|||
android:padding="10dip"
|
||||
app:columnCount="3">
|
||||
|
||||
<info.nightscout.androidaps.utils.SingleClickButton
|
||||
<info.nightscout.androidaps.utils.ui.SingleClickButton
|
||||
android:id="@+id/careportal_snackbolus"
|
||||
style="@style/ButtonSmallFontStyle"
|
||||
android:layout_width="0dp"
|
||||
|
@ -119,7 +119,7 @@
|
|||
app:layout_gravity="fill"
|
||||
app:layout_row="1" />
|
||||
|
||||
<info.nightscout.androidaps.utils.SingleClickButton
|
||||
<info.nightscout.androidaps.utils.ui.SingleClickButton
|
||||
android:id="@+id/careportal_mealbolus"
|
||||
style="@style/ButtonSmallFontStyle"
|
||||
android:layout_width="0dp"
|
||||
|
@ -133,7 +133,7 @@
|
|||
app:layout_gravity="fill"
|
||||
app:layout_row="1" />
|
||||
|
||||
<info.nightscout.androidaps.utils.SingleClickButton
|
||||
<info.nightscout.androidaps.utils.ui.SingleClickButton
|
||||
android:id="@+id/careportal_correctionbolus"
|
||||
style="@style/ButtonSmallFontStyle"
|
||||
android:layout_width="0dp"
|
||||
|
@ -147,7 +147,7 @@
|
|||
app:layout_gravity="fill"
|
||||
app:layout_row="1" />
|
||||
|
||||
<info.nightscout.androidaps.utils.SingleClickButton
|
||||
<info.nightscout.androidaps.utils.ui.SingleClickButton
|
||||
android:id="@+id/careportal_carbscorrection"
|
||||
style="@style/ButtonSmallFontStyle"
|
||||
android:layout_width="0dp"
|
||||
|
@ -161,7 +161,7 @@
|
|||
app:layout_gravity="fill"
|
||||
app:layout_row="2" />
|
||||
|
||||
<info.nightscout.androidaps.utils.SingleClickButton
|
||||
<info.nightscout.androidaps.utils.ui.SingleClickButton
|
||||
android:id="@+id/careportal_combobolus"
|
||||
style="@style/ButtonSmallFontStyle"
|
||||
android:layout_width="0dp"
|
||||
|
@ -175,7 +175,7 @@
|
|||
app:layout_gravity="fill"
|
||||
app:layout_row="2" />
|
||||
|
||||
<info.nightscout.androidaps.utils.SingleClickButton
|
||||
<info.nightscout.androidaps.utils.ui.SingleClickButton
|
||||
android:id="@+id/careportal_tempbasalstart"
|
||||
style="@style/ButtonSmallFontStyle"
|
||||
android:layout_width="0dp"
|
||||
|
@ -189,7 +189,7 @@
|
|||
app:layout_gravity="fill"
|
||||
app:layout_row="2" />
|
||||
|
||||
<info.nightscout.androidaps.utils.SingleClickButton
|
||||
<info.nightscout.androidaps.utils.ui.SingleClickButton
|
||||
android:id="@+id/careportal_tempbasalend"
|
||||
style="@style/ButtonSmallFontStyle"
|
||||
android:layout_width="0dp"
|
||||
|
@ -219,7 +219,7 @@
|
|||
android:padding="10dip"
|
||||
app:columnCount="3">
|
||||
|
||||
<info.nightscout.androidaps.utils.SingleClickButton
|
||||
<info.nightscout.androidaps.utils.ui.SingleClickButton
|
||||
android:id="@+id/careportal_cgmsensorstart"
|
||||
style="@style/ButtonSmallFontStyle"
|
||||
android:layout_width="0dp"
|
||||
|
@ -234,7 +234,7 @@
|
|||
app:layout_row="1" />
|
||||
|
||||
|
||||
<info.nightscout.androidaps.utils.SingleClickButton
|
||||
<info.nightscout.androidaps.utils.ui.SingleClickButton
|
||||
android:id="@+id/careportal_cgmsensorinsert"
|
||||
style="@style/ButtonSmallFontStyle"
|
||||
android:layout_width="0dp"
|
||||
|
@ -249,7 +249,7 @@
|
|||
app:layout_row="1" />
|
||||
|
||||
|
||||
<info.nightscout.androidaps.utils.SingleClickButton
|
||||
<info.nightscout.androidaps.utils.ui.SingleClickButton
|
||||
android:id="@+id/careportal_openapsoffline"
|
||||
style="@style/ButtonSmallFontStyle"
|
||||
android:layout_width="0dp"
|
||||
|
@ -264,7 +264,7 @@
|
|||
app:layout_row="1" />
|
||||
|
||||
|
||||
<info.nightscout.androidaps.utils.SingleClickButton
|
||||
<info.nightscout.androidaps.utils.ui.SingleClickButton
|
||||
android:id="@+id/careportal_announcement"
|
||||
style="@style/ButtonSmallFontStyle"
|
||||
android:layout_width="0dp"
|
||||
|
@ -278,7 +278,7 @@
|
|||
app:layout_gravity="fill"
|
||||
app:layout_row="4" />
|
||||
|
||||
<info.nightscout.androidaps.utils.SingleClickButton
|
||||
<info.nightscout.androidaps.utils.ui.SingleClickButton
|
||||
android:id="@+id/careportal_question"
|
||||
style="@style/ButtonSmallFontStyle"
|
||||
android:layout_width="0dp"
|
||||
|
@ -292,7 +292,7 @@
|
|||
app:layout_gravity="fill"
|
||||
app:layout_row="4" />
|
||||
|
||||
<info.nightscout.androidaps.utils.SingleClickButton
|
||||
<info.nightscout.androidaps.utils.ui.SingleClickButton
|
||||
android:id="@+id/careportal_note"
|
||||
style="@style/ButtonSmallFontStyle"
|
||||
android:layout_width="0dp"
|
||||
|
@ -321,7 +321,7 @@
|
|||
android:padding="10dip"
|
||||
app:columnCount="3">
|
||||
|
||||
<info.nightscout.androidaps.utils.SingleClickButton
|
||||
<info.nightscout.androidaps.utils.ui.SingleClickButton
|
||||
android:id="@+id/careportal_pumpsitechange"
|
||||
style="@style/ButtonSmallFontStyle"
|
||||
android:layout_width="0dp"
|
||||
|
@ -335,7 +335,7 @@
|
|||
app:layout_gravity="fill"
|
||||
app:layout_row="0" />
|
||||
|
||||
<info.nightscout.androidaps.utils.SingleClickButton
|
||||
<info.nightscout.androidaps.utils.ui.SingleClickButton
|
||||
android:id="@+id/careportal_insulincartridgechange"
|
||||
style="@style/ButtonSmallFontStyle"
|
||||
android:layout_width="0dp"
|
||||
|
@ -349,7 +349,7 @@
|
|||
app:layout_gravity="fill"
|
||||
app:layout_row="0" />
|
||||
|
||||
<info.nightscout.androidaps.utils.SingleClickButton
|
||||
<info.nightscout.androidaps.utils.ui.SingleClickButton
|
||||
android:id="@+id/careportal_profileswitch"
|
||||
style="@style/ButtonSmallFontStyle"
|
||||
android:layout_width="0dp"
|
||||
|
@ -364,7 +364,7 @@
|
|||
app:layout_row="0" />
|
||||
|
||||
|
||||
<info.nightscout.androidaps.utils.SingleClickButton
|
||||
<info.nightscout.androidaps.utils.ui.SingleClickButton
|
||||
android:id="@+id/careportal_pumpbatterychange"
|
||||
style="@style/ButtonSmallFontStyle"
|
||||
android:layout_width="0dp"
|
||||
|
|
|
@ -487,7 +487,7 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<info.nightscout.androidaps.utils.SingleClickButton
|
||||
<info.nightscout.androidaps.utils.ui.SingleClickButton
|
||||
android:id="@+id/combo_refresh_button"
|
||||
style="@style/ButtonSmallFontStyle"
|
||||
android:layout_width="match_parent"
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<info.nightscout.androidaps.utils.SingleClickButton
|
||||
<info.nightscout.androidaps.utils.ui.SingleClickButton
|
||||
android:id="@+id/overview_accepttempbutton"
|
||||
style="?android:attr/buttonStyle"
|
||||
android:layout_width="match_parent"
|
||||
|
@ -25,7 +25,7 @@
|
|||
android:paddingStart="0dp"
|
||||
android:paddingEnd="5dp" >
|
||||
|
||||
<info.nightscout.androidaps.utils.SingleClickButton
|
||||
<info.nightscout.androidaps.utils.ui.SingleClickButton
|
||||
android:id="@+id/overview_treatmentbutton"
|
||||
style="?android:attr/buttonStyle"
|
||||
android:layout_width="0px"
|
||||
|
@ -38,7 +38,7 @@
|
|||
android:textSize="10sp"
|
||||
android:visibility="gone" />
|
||||
|
||||
<info.nightscout.androidaps.utils.SingleClickButton
|
||||
<info.nightscout.androidaps.utils.ui.SingleClickButton
|
||||
android:id="@+id/overview_insulinbutton"
|
||||
style="?android:attr/buttonStyle"
|
||||
android:layout_width="0px"
|
||||
|
@ -50,7 +50,7 @@
|
|||
android:textColor="@color/colorInsulinButton"
|
||||
android:textSize="10sp" />
|
||||
|
||||
<info.nightscout.androidaps.utils.SingleClickButton
|
||||
<info.nightscout.androidaps.utils.ui.SingleClickButton
|
||||
android:id="@+id/overview_carbsbutton"
|
||||
style="?android:attr/buttonStyle"
|
||||
android:layout_width="0px"
|
||||
|
@ -62,7 +62,7 @@
|
|||
android:textColor="@color/colorCarbsButton"
|
||||
android:textSize="10sp" />
|
||||
|
||||
<info.nightscout.androidaps.utils.SingleClickButton
|
||||
<info.nightscout.androidaps.utils.ui.SingleClickButton
|
||||
android:id="@+id/overview_wizardbutton"
|
||||
style="?android:attr/buttonStyle"
|
||||
android:layout_width="0px"
|
||||
|
@ -74,7 +74,7 @@
|
|||
android:textColor="@color/colorCalculatorButton"
|
||||
android:textSize="10sp" />
|
||||
|
||||
<info.nightscout.androidaps.utils.SingleClickButton
|
||||
<info.nightscout.androidaps.utils.ui.SingleClickButton
|
||||
android:id="@+id/overview_calibrationbutton"
|
||||
style="?android:attr/buttonStyle"
|
||||
android:layout_width="0px"
|
||||
|
@ -87,7 +87,7 @@
|
|||
android:textSize="10sp"
|
||||
android:visibility="gone" />
|
||||
|
||||
<info.nightscout.androidaps.utils.SingleClickButton
|
||||
<info.nightscout.androidaps.utils.ui.SingleClickButton
|
||||
android:id="@+id/overview_cgmbutton"
|
||||
style="?android:attr/buttonStyle"
|
||||
android:layout_width="0px"
|
||||
|
@ -100,7 +100,7 @@
|
|||
android:textSize="10sp"
|
||||
android:visibility="gone" />
|
||||
|
||||
<info.nightscout.androidaps.utils.SingleClickButton
|
||||
<info.nightscout.androidaps.utils.ui.SingleClickButton
|
||||
android:id="@+id/overview_quickwizardbutton"
|
||||
style="?android:attr/buttonStyle"
|
||||
android:layout_width="0px"
|
||||
|
|
|
@ -476,7 +476,7 @@
|
|||
android:orientation="horizontal"
|
||||
android:paddingRight="5dp">
|
||||
|
||||
<info.nightscout.androidaps.utils.SingleClickButton
|
||||
<info.nightscout.androidaps.utils.ui.SingleClickButton
|
||||
android:id="@+id/overview_treatmentbutton"
|
||||
style="?android:attr/buttonStyle"
|
||||
android:layout_width="0px"
|
||||
|
@ -490,7 +490,7 @@
|
|||
android:textColor="@color/colorTreatmentButton"
|
||||
android:textSize="10sp" />
|
||||
|
||||
<info.nightscout.androidaps.utils.SingleClickButton
|
||||
<info.nightscout.androidaps.utils.ui.SingleClickButton
|
||||
android:id="@+id/overview_insulinbutton"
|
||||
style="?android:attr/buttonStyle"
|
||||
android:layout_width="0px"
|
||||
|
@ -505,7 +505,7 @@
|
|||
android:textSize="10sp"
|
||||
android:visibility="gone" />
|
||||
|
||||
<info.nightscout.androidaps.utils.SingleClickButton
|
||||
<info.nightscout.androidaps.utils.ui.SingleClickButton
|
||||
android:id="@+id/overview_carbsbutton"
|
||||
style="?android:attr/buttonStyle"
|
||||
android:layout_width="0px"
|
||||
|
@ -520,7 +520,7 @@
|
|||
android:textSize="10sp"
|
||||
android:visibility="gone" />
|
||||
|
||||
<info.nightscout.androidaps.utils.SingleClickButton
|
||||
<info.nightscout.androidaps.utils.ui.SingleClickButton
|
||||
android:id="@+id/overview_wizardbutton"
|
||||
style="?android:attr/buttonStyle"
|
||||
android:layout_width="0px"
|
||||
|
@ -535,7 +535,7 @@
|
|||
android:textSize="10sp"
|
||||
android:visibility="gone" />
|
||||
|
||||
<info.nightscout.androidaps.utils.SingleClickButton
|
||||
<info.nightscout.androidaps.utils.ui.SingleClickButton
|
||||
android:id="@+id/overview_quickwizardbutton"
|
||||
style="?android:attr/buttonStyle"
|
||||
android:layout_width="0px"
|
||||
|
|
|
@ -915,18 +915,18 @@
|
|||
<string name="openapsama_max_daily_safety_multiplier">Max daily safety multiplier</string>
|
||||
<string name="openapsama_current_basal_safety_multiplier">Current basal safety multiplier</string>
|
||||
<string name="value_unavailable_short">n/a</string>
|
||||
<string translatable="false" name="key_virtualpump_type">virtualpump_type</string>
|
||||
<string name="key_virtualpump_type" translatable="false">virtualpump_type</string>
|
||||
<string name="virtualpump_type">Virtual Pump Type</string>
|
||||
<string name="virtualpump_definition">Pump Definition</string>
|
||||
<string name="virtualpump_pump_def">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</string>
|
||||
<string name="ns_autobackfill_title">Autobackfill BG</string>
|
||||
<string name="wear_wizard_settings">Wizard Settings</string>
|
||||
<string translatable="false" name="key_wearwizard_bg">wearwizard_bg</string>
|
||||
<string translatable="false" name="key_wearwizard_tt">wearwizard_tt</string>
|
||||
<string translatable="false" name="key_wearwizard_trend">wearwizard_trend</string>
|
||||
<string translatable="false" name="key_wearwizard_cob">wearwizard_cob</string>
|
||||
<string translatable="false" name="key_wearwizard_bolusiob">wearwizard_bolusiob</string>
|
||||
<string translatable="false" name="key_wearwizard_basaliob">wearwizard_basaliob</string>
|
||||
<string name="key_wearwizard_bg" translatable="false">wearwizard_bg</string>
|
||||
<string name="key_wearwizard_tt" translatable="false">wearwizard_tt</string>
|
||||
<string name="key_wearwizard_trend" translatable="false">wearwizard_trend</string>
|
||||
<string name="key_wearwizard_cob" translatable="false">wearwizard_cob</string>
|
||||
<string name="key_wearwizard_bolusiob" translatable="false">wearwizard_bolusiob</string>
|
||||
<string name="key_wearwizard_basaliob" translatable="false">wearwizard_basaliob</string>
|
||||
<string name="wear_wizard_settings_summary">Calculations included in the Wizard result:</string>
|
||||
<string name="wear_display_settings">Display Settings</string>
|
||||
<string name="wear_general_settings">General Settings</string>
|
||||
|
@ -965,8 +965,8 @@
|
|||
<string name="poctech">Poctech</string>
|
||||
<string name="description_source_poctech">Receive BG values from Poctech app</string>
|
||||
<string name="description_source_tomato">Receive BG values from Tomato app (MiaoMiao device)</string>
|
||||
<string translatable="false" name="key_high_temptarget_raises_sensitivity">high_temptarget_raises_sensitivity</string>
|
||||
<string translatable="false" name="key_low_temptarget_lowers_sensitivity">low_temptarget_lowers_sensitivity</string>
|
||||
<string name="key_high_temptarget_raises_sensitivity" translatable="false">high_temptarget_raises_sensitivity</string>
|
||||
<string name="key_low_temptarget_lowers_sensitivity" translatable="false">low_temptarget_lowers_sensitivity</string>
|
||||
<string name="high_temptarget_raises_sensitivity_title">High temptarget raises sensitivity</string>
|
||||
<string name="high_temptarget_raises_sensitivity_summary"><![CDATA[Raise sensitivity for temptargets >= 100]]></string>
|
||||
<string name="low_temptarget_lowers_sensitivity_title">Low temptarget lowers sensitivity</string>
|
||||
|
@ -1284,7 +1284,6 @@
|
|||
<string name="objectives_button_unfinish">Clear finished</string>
|
||||
<string name="objectives_button_unstart">Clear started</string>
|
||||
<string name="doyouwantresetstart">Do you want reset objective start? You may lose your progress.</string>
|
||||
<string name="time_or_timezone_change">Time and/or Timezone change on pump</string>
|
||||
<string name="nopumpselected">No pump selected</string>
|
||||
<string name="setupwizard_units_prompt">Select units you want to display values in</string>
|
||||
<string name="ns_ploadlocalprofile">Upload local profile changes to NS</string>
|
||||
|
@ -1384,7 +1383,6 @@
|
|||
<string name="authorizationfailed">Authorization failed</string>
|
||||
<string name="overview_show_absinsulin">Absolute insulin</string>
|
||||
<string name="master_password_summary">Master password is used for backup encryption and to override security in application. Remember it or store on a safe place.</string>
|
||||
<string name="passwords_dont_match">Passwords don\'t match</string>
|
||||
<string name="current_master_password">Current master password</string>
|
||||
<string name="statuslights">Status lights</string>
|
||||
<string name="statuslights_copy_ns">Copy settings from NS</string>
|
||||
|
@ -1397,174 +1395,6 @@
|
|||
<string name="key_skin" translatable="false">skin</string>
|
||||
<string name="skin">Skin</string>
|
||||
|
||||
|
||||
<!-- MDT Pump Status - removed when PodDeviceState is removed -->
|
||||
<string name="medtronic_pump_status_never_contacted">Never contacted</string>
|
||||
<string name="medtronic_pump_status_waking_up">Waking up</string>
|
||||
<string name="medtronic_pump_status_error_comm">Error with communication</string>
|
||||
<string name="medtronic_pump_status_timeout_comm">Timeout on communication</string>
|
||||
<string name="medtronic_pump_status_pump_unreachable">Pump unreachable</string>
|
||||
<string name="medtronic_pump_status_invalid_config">Invalid configuration</string>
|
||||
<string name="medtronic_pump_status_active">Active</string>
|
||||
<string name="medtronic_pump_status_sleeping">Sleeping</string>
|
||||
|
||||
|
||||
<!-- Omnipod -->
|
||||
|
||||
<!-- Omnipod - Base -->
|
||||
<string name="omnipod_name" translatable="false">Omnipod</string>
|
||||
<string name="omnipod_name_short" translatable="false">POD</string>
|
||||
<string name="description_pump_omnipod">Pump integration for Omnipod, requires RileyLink (with at least 2.0 firmware) device.</string>
|
||||
|
||||
<!-- Omnipod Configuration -->
|
||||
<string name="key_omnipod_beep_bolus_enabled" translatable="false">pref_omnipod_beep_bolus_enabled</string>
|
||||
<string name="key_omnipod_beep_basal_enabled" translatable="false">pref_omnipod_beep_basal_enabled</string>
|
||||
<string name="key_omnipod_beep_smb_enabled" translatable="false">pref_omnipod_beep_smb_enabled</string>
|
||||
<string name="key_omnipod_beep_tbr_enabled" translatable="false">pref_omnipod_beep_tbr_enabled</string>
|
||||
<string name="key_omnipod_pod_debugging_options_enabled" translatable="false">pref_omnipod_pod_debugging_options_enabled</string>
|
||||
<string name="key_omnipod_timechange_enabled" translatable="false">pref_omnipod_timechange_enabled</string>
|
||||
<string name="omnipod_config_beep_bolus_enabled">Bolus Beep Enabled</string>
|
||||
<string name="omnipod_config_beep_basal_enabled">Basal Beep Enabled</string>
|
||||
<string name="omnipod_config_beep_smb_enabled">SMB Beep Enabled</string>
|
||||
<string name="omnipod_config_beep_tbr_enabled">TBR Beep Enabled</string>
|
||||
<string name="omnipod_config_pod_debugging_options_enabled">Pod Debugging Options Enabled</string>
|
||||
<string name="omnipod_config_timechange_enabled">DST/Timezone Detection Enabled</string>
|
||||
|
||||
<!-- Omnipod - Fragment -->
|
||||
<string name="omnipod_connected_now">Now</string>
|
||||
<string name="omnipod_pod_mgmt">Pod Mgmt</string>
|
||||
<string name="omnipod_pod_status">Pod Status</string>
|
||||
<string name="omnipod_reservoir_left">%1$.2f U left</string>
|
||||
<string name="omnipod_reservoir_over50">Over 50 U</string>
|
||||
<string name="omnipod_pod_address">Pod Address</string>
|
||||
<string name="omnipod_pod_expiry">Pod Expires</string>
|
||||
<string name="omnipod_warning">Warning</string>
|
||||
<string name="omnipod_pod_status_no_pod_connected">No Pod connected</string>
|
||||
<string name="omnipod_pod_setup_in_progress">Pod setup in progress (Pod progress status: %1$s)</string>
|
||||
<string name="omnipod_pod_status_not_initalized">Pod not initialized</string>
|
||||
<string name="omnipod_pod_status_pod_fault">Pod Fault</string>
|
||||
<string name="omnipod_pod_status_pod_fault_description">Pod Fault: %1$s %2$s</string>
|
||||
<string name="omnipod_pod_status_pod_running">Pod running (last delivery status: %1$s)</string>
|
||||
<string name="omnipod_pod_active_alerts">Active Pod Alerts</string>
|
||||
<string name="omnipod_ack_short">Ack Alerts</string>
|
||||
<string name="omnipod_last_bolus" translatable="false">%1$.2f %2$s (%3$s)</string>
|
||||
<string name="omnipod_pod_status_initalizing">Initializing</string>
|
||||
<string name="omnipod_pod_status_active">Active</string>
|
||||
<string name="omnipod_pod_status_unknown">Unknown</string>
|
||||
|
||||
|
||||
<!-- Omnipod - Dialogs -->
|
||||
<string name="omnipod_frequency">Omnipod (433.91 MHz)</string>
|
||||
|
||||
|
||||
<!-- Omnipod - Error -->
|
||||
<string name="omnipod_error_rileylink_address_invalid">RileyLink Address invalid.</string>
|
||||
<string name="omnipod_error_operation_not_possible_no_configuration">Operation is not possible.\n\nYou need to configure Omnipod first, before you can use this operation.</string>
|
||||
<string name="omnipod_error_operation_not_possible_no_profile">Operation is not possible.\n\n You need to wait few minutes, until AAPS tries to set profile for first time.</string>
|
||||
<string name="omnipod_error_illegal_init_action_type">Illegal PodInitActionType: %1$s</string>
|
||||
<string name="omnipod_error_pod_not_attached">No active pod.</string>
|
||||
|
||||
<string name="omnipod_driver_error_setup_action_verification_failed">Command verification failed.</string>
|
||||
<string name="omnipod_driver_error_unexpected_exception_type">An unexpected error occurred. Please report! (type: %1$s).</string>
|
||||
<string name="omnipod_driver_error_invalid_parameters">Communication failed: received invalid input parameters.</string>
|
||||
<string name="omnipod_driver_error_communication_failed_timeout">Communication failed: timeout.</string>
|
||||
<string name="omnipod_driver_error_communication_failed_unexpected_exception">Communication failed: an unexpected error occurred. Please report!</string>
|
||||
<string name="omnipod_driver_error_crc_mismatch">Communication failed: message integrity verification failed.</string>
|
||||
<string name="omnipod_driver_error_invalid_packet_type">Communication failed: received an invalid packet from the Pod.</string>
|
||||
<string name="omnipod_driver_error_invalid_progress_state">Communication failed: the Pod is in a wrong state.</string>
|
||||
<string name="omnipod_driver_error_invalid_response">Communication failed: received an invalid response from the Pod.</string>
|
||||
<string name="omnipod_driver_error_invalid_message_sequence_number">Communication failed: received a message with an invalid sequence number from the Pod.</string>
|
||||
<string name="omnipod_driver_error_invalid_message_address">Communication failed: received a message with an invalid address from the Pod.</string>
|
||||
<string name="omnipod_driver_error_message_decoding_failed">Communication failed: failed to decode message from the Pod.</string>
|
||||
<string name="omnipod_driver_error_nonce_resync_failed">Communication failed: nonce resync failed.</string>
|
||||
<string name="omnipod_driver_error_nonce_out_of_sync">Communication failed: nonce out of sync.</string>
|
||||
<string name="omnipod_driver_error_not_enough_data">Communication failed: not enough data received from the Pod.</string>
|
||||
<string name="omnipod_driver_error_pod_fault">A Pod fault (%1$03d %2$s) has been detected. Please deactivate your Pod and start a new one.</string>
|
||||
<string name="omnipod_driver_error_pod_returned_error_response">Communication failed: the Pod returned an error response.</string>
|
||||
|
||||
<!-- Omnipod - Pod Mgmt -->
|
||||
<string name="omnipod_pod_mgmt_title">Pod Management</string>
|
||||
<string name="omnipod_cmd_init_pod">Init Pod</string>
|
||||
<string name="omnipod_cmd_deactivate_pod">Deactivate Pod</string>
|
||||
<string name="omnipod_cmd_reset_pod">Reset Pod</string>
|
||||
<string name="omnipod_cmd_pod_history">Pod History</string>
|
||||
|
||||
<string name="omnipod_cmd_set_bolus">Set Bolus</string>
|
||||
<string name="omnipod_cmd_cancel_bolus">Cancel Bolus</string>
|
||||
<string name="omnipod_cmd_set_tbr">Set Temporary Basal</string>
|
||||
<string name="omnipod_cmd_cancel_tbr">Cancel Temporary Basal (Internally by driver)</string>
|
||||
<string name="omnipod_cmd_cancel_tbr_forced">Cancel Temporary Basal (Forced by user)</string>
|
||||
<string name="omnipod_cmd_set_basal_schedule">Set Basal Schedule</string>
|
||||
<string name="omnipod_cmd_get_pod_status">Get Pod Status</string>
|
||||
<string name="omnipod_cmd_get_pod_info">Get Pod Info</string>
|
||||
<string name="omnipod_cmd_set_time">Set Time</string>
|
||||
<string name="omnipod_cmd_configure_alerts">Configure Alerts</string>
|
||||
<string name="omnipod_cmd_acknowledge_alerts">Acknowledge Alerts</string>
|
||||
<string name="omnipod_cmd_suspend_delivery">Suspend Delivery</string>
|
||||
<string name="omnipod_cmd_resume_delivery">Resume Delivery</string>
|
||||
<string name="omnipod_cmd_unknown_entry">Unknown Entry</string>
|
||||
|
||||
<string name="omnipod_cmd_bolus_value">%1$.1f U</string>
|
||||
<string name="omnipod_cmd_bolus_value_with_carbs">%1$.1f U, CH=%2$.1f g</string>
|
||||
<string name="omnipod_cmd_tbr_value">Rate: %1$.1f U, Duration: %2$d min</string>
|
||||
|
||||
<string name="omnipod_cmd_reset_pod_desc">If you press <b>OK</b>, 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 <b>Deactivate Pod</b> option.</string>
|
||||
<string name="omnipod_cmd_pod_history_na">Pod History not available at the moment.</string>
|
||||
|
||||
<string name="omnipod_namex" translatable="false">Omnipod</string>
|
||||
<string name="omnipod_namex2" translatable="false">Omnipod</string>
|
||||
<string name="omnipod_namexxx" translatable="false">Omnipod</string>
|
||||
|
||||
|
||||
<string name="omnipod_init_pod_wizard_step1_title">Fill the Pod</string>
|
||||
<string name="omnipod_init_pod_wizard_step1_desc">\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 <b>Next</b>.\n\n<b>Note:</b> do not remove the Pod\'s needle cap at this time.</string>
|
||||
<string name="omnipod_init_pod_wizard_step2_title">Priming</string>
|
||||
<string name="omnipod_init_pod_wizard_step2_action_header">Trying to pair with the new Pod and prime it.\n\nWhen all items are checked, you can press <b>Next</b>.\n\n<b>Note:</b> please keep the Pod and the RileyLink a few inches apart at this time.</string>
|
||||
<string name="omnipod_init_pod_wizard_step3_title">Attach the Pod</string>
|
||||
<string name="omnipod_init_pod_wizard_step3_desc">\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 <b>Cancel</b> and discard your Pod.\n\nPress <b>Next</b> to insert the cannula and begin basal delivery.</string>
|
||||
<string name="omnipod_init_pod_wizard_step4_title">Inserting cannula</string>
|
||||
<string name="omnipod_init_pod_wizard_step4_action_header">Trying to set initial basal schedule and insert the cannula.\n\nWhen all items are checked, you can press <b>Next</b>.</string>
|
||||
|
||||
<string name="omnipod_init_pod_wizard_pod_info_title">Pod Info</string>
|
||||
<string name="omnipod_init_pod_wizard_pod_info_init_pod_description">\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.</string>
|
||||
|
||||
<string name="omnipod_remove_pod_wizard_step1_title">Deactivate Pod</string>
|
||||
<string name="omnipod_remove_pod_wizard_step1_desc">\nPress <b>Next</b> to deactivate the Pod.\n\n<b>Note:</b> This will suspend all insulin delivery and deactivate the Pod.</string>
|
||||
<string name="omnipod_remove_pod_wizard_step2_title">Deactivating the Pod</string>
|
||||
<string name="omnipod_remove_pod_wizard_step2_action_header">Deactivating the Pod.\n\nWhen all items are checked, you can press <b>Next</b>.\n\n<b>Note:</b> If deactivating continuously fails, please press <b>Cancel</b> and use the <b>Reset Pod</b> option to forcibly reset the Pod state.</string>
|
||||
|
||||
<string name="omnipod_init_pod_wizard_pod_info_remove_pod_description">Pod deactivated.\n\nPlease remove the Pod from your body and discard it.</string>
|
||||
|
||||
<string name="omnipod_init_pod_pair_pod">Pair Pod</string>
|
||||
<string name="omnipod_init_pod_prime_pod">Prime Pod</string>
|
||||
<string name="omnipod_init_pod_fill_cannula">Fill Cannula</string>
|
||||
<string name="omnipod_init_pod_set_basal_profile">Set Basal Profile</string>
|
||||
<string name="omnipod_deactivate_pod_cancel_delivery">Cancel Delivery</string>
|
||||
<string name="omnipod_deactivate_pod_deactivate_pod">Deactivate Pod</string>
|
||||
|
||||
|
||||
<!-- Omnipod - Base -->
|
||||
<string name="omnipod_dash_name" translatable="false">Omnipod Dash</string>
|
||||
<string name="omnipod_dash_name_short" translatable="false">DASH</string>
|
||||
<string name="description_pump_omnipod_dash">Pump integration for Omnipod Dash.</string>
|
||||
<string name="omnipod_alert_finish_pairing_reminder">Finish pairing reminder</string>
|
||||
<string name="omnipod_alert_finish_setup_reminder_reminder">Finish setup reminder</string>
|
||||
<string name="omnipod_alert_expiration">Pod will expire soon</string>
|
||||
<string name="omnipod_alert_expiration_advisory">Pod will expire soon</string>
|
||||
<string name="omnipod_alert_shutdown_imminent">Shutdown is imminent</string>
|
||||
<string name="omnipod_alert_low_reservoir">Low reservoir</string>
|
||||
<string name="omnipod_alert_unknown_alert">Unknown alert</string>
|
||||
<string name="omnipod_error_set_basal_failed_uncertain">Setting basal profile might have failed. Delivery might be suspended! Please refresh Pod status.</string>
|
||||
<string name="omnipod_error_set_temp_basal_failed_uncertain">Setting temp basal might have failed. If there was a temp basal already running, that may have been cancelled! Please refresh pod status.</string>
|
||||
<string name="omnipod_error_set_time_failed_uncertain">Setting time might have failed. Delivery might be suspended! Please refresh Pod status.</string>
|
||||
<string name="omnipod_bolus_failed_uncertain">Unable to verify whether the bolus succeeded. Please verify that your Pod is bolusing or cancel the bolus.</string>
|
||||
<string name="omnipod_rl_stats">RL Stats</string>
|
||||
<string name="omnipod_read_pulse_log_short">Pulse Log</string>
|
||||
<string name="omnipod_pod_lot">LOT</string>
|
||||
<string name="omnipod_pod_tid">TID</string>
|
||||
<string name="omnipod_pod_fw_version">PM / PI version</string>
|
||||
<string name="omnipod_errors">Errors</string>
|
||||
|
||||
<string name="comapareprofile">Compare profiles</string>
|
||||
<string name="nav_profilehelper">Profile helper</string>
|
||||
<string name="motoldefaultprofile">Default profile</string>
|
||||
|
|
|
@ -52,36 +52,5 @@
|
|||
<item name="android:textColor">#ff0000</item>
|
||||
</style>
|
||||
|
||||
<style name="WizardPagePodContent">
|
||||
<item name="android:layout_width">match_parent</item>
|
||||
<item name="android:layout_height">wrap_content</item>
|
||||
<item name="android:layout_marginBottom">8dp</item>
|
||||
<item name="android:paddingLeft">20px</item>
|
||||
<item name="android:paddingRight">20px</item>
|
||||
<item name="android:textSize">18sp</item>
|
||||
|
||||
<!-- <item name="android:textColor">?android:textColorPrimary</item> -->
|
||||
</style>
|
||||
|
||||
<style name="WizardPagePodListItem">
|
||||
<item name="android:layout_width">match_parent</item>
|
||||
<item name="android:layout_height">wrap_content</item>
|
||||
<item name="android:layout_marginBottom">20dp</item>
|
||||
<item name="android:layout_marginTop">20dp</item>
|
||||
<item name="android:paddingTop">20px</item>
|
||||
<item name="android:paddingBottom">20px</item>
|
||||
<item name="android:paddingLeft">60px</item>
|
||||
<item name="android:paddingRight">60px</item>
|
||||
<item name="android:textSize">18sp</item>
|
||||
<!-- <item name="android:textColor">#000000</item> -->
|
||||
</style>
|
||||
|
||||
<style name="PodInfoListView" parent="@android:style/Widget.ListView">
|
||||
<item name="android:background">@color/colorLightGray</item>
|
||||
<item name="android:cacheColorHint">@android:color/transparent</item>
|
||||
<item name="android:divider">@android:color/black</item>
|
||||
<item name="android:dividerHeight">1dp</item>
|
||||
</style>
|
||||
|
||||
<style name="ProfileHelperAppTheme" parent="Theme.MaterialComponents.DayNight.NoActionBar"/>
|
||||
</resources>
|
||||
|
|
|
@ -44,6 +44,7 @@ dependencies {
|
|||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
|
||||
implementation 'androidx.appcompat:appcompat:1.1.0'
|
||||
implementation "androidx.preference:preference-ktx:1.1.1"
|
||||
implementation 'androidx.biometric:biometric:1.0.1'
|
||||
implementation "androidx.activity:activity:${activityVersion}"
|
||||
implementation "androidx.activity:activity-ktx:${activityVersion}"
|
||||
implementation 'com.google.android.material:material:1.1.0'
|
||||
|
@ -65,6 +66,9 @@ dependencies {
|
|||
implementation "io.reactivex.rxjava2:rxandroid:${rxandroid_version}"
|
||||
implementation 'org.apache.commons:commons-lang3:3.10'
|
||||
|
||||
//CryptoUtil
|
||||
implementation 'com.madgag.spongycastle:core:1.58.0.0'
|
||||
|
||||
// Graphview cannot be upgraded
|
||||
implementation "com.jjoe64:graphview:4.0.1"
|
||||
|
||||
|
|
|
@ -1,23 +1,19 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod.driver.db;
|
||||
package info.nightscout.androidaps.db;
|
||||
|
||||
import com.j256.ormlite.field.DatabaseField;
|
||||
import com.j256.ormlite.table.DatabaseTable;
|
||||
|
||||
import info.nightscout.androidaps.db.DatabaseHelper;
|
||||
import info.nightscout.androidaps.db.DbObjectBase;
|
||||
import info.nightscout.androidaps.plugins.pump.common.utils.DateTimeUtil;
|
||||
|
||||
/**
|
||||
* Created by andy on 30.11.2019.
|
||||
*/
|
||||
@DatabaseTable(tableName = DatabaseHelper.DATABASE_POD_HISTORY)
|
||||
public class PodHistory implements DbObjectBase, Comparable<PodHistory> {
|
||||
@DatabaseTable(tableName = "PodHistory")
|
||||
public class OmnipodHistoryRecord implements DbObjectBase, Comparable<OmnipodHistoryRecord> {
|
||||
|
||||
@DatabaseField(id = true)
|
||||
public long date;
|
||||
|
||||
private PodHistoryEntryType podHistoryEntryType;
|
||||
|
||||
@DatabaseField
|
||||
private long podEntryTypeCode;
|
||||
|
||||
|
@ -36,27 +32,16 @@ public class PodHistory implements DbObjectBase, Comparable<PodHistory> {
|
|||
@DatabaseField
|
||||
private Boolean successConfirmed;
|
||||
|
||||
public PodHistory() {
|
||||
public OmnipodHistoryRecord() {
|
||||
generatePumpId();
|
||||
}
|
||||
|
||||
|
||||
public PodHistory(PodHistoryEntryType podDbEntryType) {
|
||||
this.date = System.currentTimeMillis();
|
||||
this.podHistoryEntryType = podDbEntryType;
|
||||
this.podEntryTypeCode = podDbEntryType.getCode();
|
||||
generatePumpId();
|
||||
}
|
||||
|
||||
|
||||
public PodHistory(long dateTimeInMillis, PodHistoryEntryType podDbEntryType) {
|
||||
public OmnipodHistoryRecord(long dateTimeInMillis, long podEntryTypeCode) {
|
||||
this.date = dateTimeInMillis;
|
||||
this.podHistoryEntryType = podDbEntryType;
|
||||
this.podEntryTypeCode = podDbEntryType.getCode();
|
||||
this.podEntryTypeCode = podEntryTypeCode;
|
||||
generatePumpId();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public long getDate() {
|
||||
return this.date;
|
||||
|
@ -70,19 +55,14 @@ public class PodHistory implements DbObjectBase, Comparable<PodHistory> {
|
|||
return DateTimeUtil.toStringFromTimeInMillis(this.date);
|
||||
}
|
||||
|
||||
public PodHistoryEntryType getPodDbEntryType() {
|
||||
return PodHistoryEntryType.getByCode((int) this.podEntryTypeCode);
|
||||
}
|
||||
|
||||
public void setPodDbEntryType(PodHistoryEntryType podDbEntryType) {
|
||||
//this.podHistoryEntryType = podDbEntryType;
|
||||
this.podEntryTypeCode = podDbEntryType.getCode();
|
||||
}
|
||||
|
||||
public long getPodEntryTypeCode() {
|
||||
return podEntryTypeCode;
|
||||
}
|
||||
|
||||
public void setPodEntryTypeCode(long podEntryTypeCode) {
|
||||
this.podEntryTypeCode = podEntryTypeCode;
|
||||
}
|
||||
|
||||
public String getData() {
|
||||
return data;
|
||||
}
|
||||
|
@ -130,7 +110,7 @@ public class PodHistory implements DbObjectBase, Comparable<PodHistory> {
|
|||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(PodHistory otherOne) {
|
||||
public int compareTo(OmnipodHistoryRecord otherOne) {
|
||||
return (int) (otherOne.date - this.date);
|
||||
}
|
||||
}
|
|
@ -8,6 +8,7 @@ interface DatabaseHelperInterface {
|
|||
fun getAllBgreadingsDataFromTime(mills: Long, ascending: Boolean): List<BgReading>
|
||||
fun createOrUpdate(careportalEvent: CareportalEvent)
|
||||
fun createOrUpdate(record: DanaRHistoryRecord)
|
||||
fun createOrUpdate(record: OmnipodHistoryRecord)
|
||||
fun create(record: DbRequest)
|
||||
fun getDanaRHistoryRecordsByType(type: Byte): List<DanaRHistoryRecord>
|
||||
fun getTDDs(): List<TDD>
|
||||
|
@ -21,7 +22,8 @@ interface DatabaseHelperInterface {
|
|||
fun createOrUpdate(tempBasal: TemporaryBasal)
|
||||
fun findTempBasalByPumpId(id: Long): TemporaryBasal
|
||||
fun getTemporaryBasalsDataFromTime(mills: Long, ascending: Boolean): List<TemporaryBasal>
|
||||
fun getCareportalEventFromTimestamp(timestamp: Long): CareportalEvent
|
||||
fun getCareportalEventFromTimestamp(timestamp: Long): CareportalEvent?
|
||||
fun getAllOmnipodHistoryRecordsFromTimestamp(timestamp: Long, ascending: Boolean): List<OmnipodHistoryRecord>
|
||||
fun getTDDsForLastXDays(days: Int): List<TDD>
|
||||
fun getProfileSwitchData(from: Long, ascending: Boolean): List<ProfileSwitch>
|
||||
}
|
||||
|
|
|
@ -64,17 +64,9 @@ public abstract class PumpPluginAbstract extends PumpPluginBase implements PumpI
|
|||
protected CommandQueueProvider commandQueue;
|
||||
protected SP sp;
|
||||
protected DateUtil dateUtil;
|
||||
|
||||
/*
|
||||
protected static final PumpEnactResult OPERATION_NOT_SUPPORTED = new PumpEnactResult().success(false)
|
||||
.enacted(false).comment(MainApp.gs(R.string.pump_operation_not_supported_by_pump_driver));
|
||||
protected static final PumpEnactResult OPERATION_NOT_YET_SUPPORTED = new PumpEnactResult().success(false)
|
||||
.enacted(false).comment(MainApp.gs(R.string.pump_operation_not_yet_supported_by_pump));
|
||||
*/
|
||||
protected PumpDescription pumpDescription = new PumpDescription();
|
||||
protected ServiceConnection serviceConnection = null;
|
||||
protected ServiceConnection serviceConnection;
|
||||
protected boolean serviceRunning = false;
|
||||
// protected boolean isInitialized = false;
|
||||
protected PumpDriverState pumpState = PumpDriverState.NotInitialized;
|
||||
protected boolean displayConnectionMessages = false;
|
||||
protected PumpType pumpType;
|
||||
|
|
|
@ -3,7 +3,7 @@ package info.nightscout.androidaps.utils.protection
|
|||
import androidx.biometric.BiometricConstants
|
||||
import androidx.biometric.BiometricPrompt
|
||||
import androidx.fragment.app.FragmentActivity
|
||||
import info.nightscout.androidaps.R
|
||||
import info.nightscout.androidaps.core.R
|
||||
import info.nightscout.androidaps.utils.ToastUtils
|
||||
import info.nightscout.androidaps.utils.extensions.runOnUiThread
|
||||
import java.util.concurrent.Executors
|
|
@ -7,7 +7,7 @@ import android.view.LayoutInflater
|
|||
import android.view.View
|
||||
import android.widget.EditText
|
||||
import androidx.annotation.StringRes
|
||||
import info.nightscout.androidaps.R
|
||||
import info.nightscout.androidaps.core.R
|
||||
import info.nightscout.androidaps.utils.CryptoUtil
|
||||
import info.nightscout.androidaps.utils.ToastUtils
|
||||
import info.nightscout.androidaps.utils.alertDialogs.AlertDialogHelper
|
|
@ -1,7 +1,7 @@
|
|||
package info.nightscout.androidaps.utils.protection
|
||||
|
||||
import androidx.fragment.app.FragmentActivity
|
||||
import info.nightscout.androidaps.R
|
||||
import info.nightscout.androidaps.core.R
|
||||
import info.nightscout.androidaps.utils.sharedPreferences.SP
|
||||
import javax.inject.Inject
|
||||
import javax.inject.Singleton
|
|
@ -1,4 +1,4 @@
|
|||
package info.nightscout.androidaps.utils;
|
||||
package info.nightscout.androidaps.utils.ui;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
|
@ -8,7 +8,6 @@ import android.util.AttributeSet;
|
|||
import android.view.View;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import info.nightscout.androidaps.logging.StacktraceLoggerWrapper;
|
||||
|
|
@ -127,6 +127,10 @@
|
|||
<string name="shortminute">m</string>
|
||||
<string name="shortday">d</string>
|
||||
|
||||
<!-- Protection-->
|
||||
<string name="wrongpassword">Wrong password</string>
|
||||
<string name="passwords_dont_match">Passwords don\'t match</string>
|
||||
|
||||
<!-- Profile-->
|
||||
<string name="basalprofilenotaligned">Basal values not aligned to hours: %1$s</string>
|
||||
<string name="minimalbasalvaluereplaced">Basal value replaced by minimal supported value: %1$s</string>
|
||||
|
|
|
@ -67,7 +67,6 @@
|
|||
<string name="updatingbasalrates">Updating basal rates</string>
|
||||
<string name="settingtempbasal">Setting temp basal</string>
|
||||
<string name="waitingfortimesynchronization">Waiting for time synchronization (%1$d sec)</string>
|
||||
<string name="wrongpassword">Wrong password</string>
|
||||
<string name="wrongpumppassword">Wrong pump password!</string>
|
||||
<string name="danar_history_alarm">Alarms</string>
|
||||
<string name="danar_history_basalhours">Basal Hours</string>
|
||||
|
|
|
@ -80,7 +80,7 @@ class MedtronicFragment : DaggerFragment() {
|
|||
|
||||
medtronic_pumpstatus.setBackgroundColor(resourceHelper.gc(R.color.colorInitializingBorder))
|
||||
|
||||
medtronic_rl_status.text = resourceHelper.gs(RileyLinkServiceState.NotStarted.getResourceId(RileyLinkTargetDevice.MedtronicPump))
|
||||
medtronic_rl_status.text = resourceHelper.gs(RileyLinkServiceState.NotStarted.getResourceId())
|
||||
|
||||
medtronic_pump_status.setTextColor(Color.WHITE)
|
||||
medtronic_pump_status.text = "{fa-bed}"
|
||||
|
@ -172,7 +172,7 @@ class MedtronicFragment : DaggerFragment() {
|
|||
|
||||
@Synchronized
|
||||
private fun setDeviceStatus() {
|
||||
val resourceId = rileyLinkServiceData.rileyLinkServiceState.getResourceId(RileyLinkTargetDevice.MedtronicPump)
|
||||
val resourceId = rileyLinkServiceData.rileyLinkServiceState.getResourceId()
|
||||
val rileyLinkError = medtronicPumpPlugin.rileyLinkService?.error
|
||||
medtronic_rl_status.text =
|
||||
when {
|
||||
|
|
|
@ -10,14 +10,13 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import dagger.android.HasAndroidInjector;
|
||||
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;
|
||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.RileyLinkCommunicationException;
|
||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.data.RFSpyResponse;
|
||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.data.RLMessage;
|
||||
|
@ -56,6 +55,7 @@ import info.nightscout.androidaps.plugins.pump.medtronic.util.MedtronicUtil;
|
|||
* This was mostly rewritten from Original version, and lots of commands and
|
||||
* functionality added.
|
||||
*/
|
||||
@Singleton
|
||||
public class MedtronicCommunicationManager extends RileyLinkCommunicationManager {
|
||||
|
||||
@Inject MedtronicPumpStatus medtronicPumpStatus;
|
||||
|
@ -73,9 +73,13 @@ public class MedtronicCommunicationManager extends RileyLinkCommunicationManager
|
|||
|
||||
private boolean doWakeUpBeforeCommand = true;
|
||||
|
||||
// This empty constructor must be kept, otherwise dagger injection might break!
|
||||
@Inject
|
||||
public MedtronicCommunicationManager() {}
|
||||
|
||||
public MedtronicCommunicationManager(HasAndroidInjector injector, RFSpy rfspy) {
|
||||
super(injector, rfspy);
|
||||
@Inject
|
||||
public void onInit() {
|
||||
// we can't do this in the constructor, as sp only gets injected after the constructor has returned
|
||||
medtronicPumpStatus.previousConnection = sp.getLong(
|
||||
RileyLinkConst.Prefs.LastGoodDeviceCommunicationTime, 0L);
|
||||
}
|
||||
|
|
|
@ -3,8 +3,6 @@ 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;
|
||||
|
@ -18,24 +16,13 @@ public class RLHistoryItemMedtronic extends RLHistoryItem {
|
|||
this.medtronicCommandType = medtronicCommandType;
|
||||
}
|
||||
|
||||
@Override
|
||||
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:
|
||||
if (RLHistoryItemSource.MedtronicCommand.equals(source)) {
|
||||
return medtronicCommandType.name();
|
||||
|
||||
default:
|
||||
return "Unknown Description";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return super.getDescription(resourceHelper);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@ import android.os.Binder;
|
|||
import android.os.IBinder;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import info.nightscout.androidaps.logging.LTag;
|
||||
import info.nightscout.androidaps.plugins.pump.common.defs.PumpDeviceState;
|
||||
|
@ -34,15 +35,17 @@ import info.nightscout.androidaps.plugins.pump.medtronic.util.MedtronicUtil;
|
|||
/**
|
||||
* RileyLinkMedtronicService is intended to stay running when the gui-app is closed.
|
||||
*/
|
||||
@Singleton
|
||||
public class RileyLinkMedtronicService extends RileyLinkService {
|
||||
|
||||
@Inject MedtronicPumpPlugin medtronicPumpPlugin;
|
||||
@Inject MedtronicUtil medtronicUtil;
|
||||
@Inject MedtronicUIPostprocessor medtronicUIPostprocessor;
|
||||
@Inject MedtronicPumpStatus medtronicPumpStatus;
|
||||
@Inject RFSpy rfSpy;
|
||||
@Inject MedtronicCommunicationManager medtronicCommunicationManager;
|
||||
|
||||
private MedtronicUIComm medtronicUIComm;
|
||||
private MedtronicCommunicationManager medtronicCommunicationManager;
|
||||
private IBinder mBinder = new LocalBinder();
|
||||
|
||||
private boolean serialChanged = false;
|
||||
|
@ -54,8 +57,9 @@ public class RileyLinkMedtronicService extends RileyLinkService {
|
|||
private boolean inPreInit = true;
|
||||
|
||||
|
||||
// This empty constructor must be kept, otherwise dagger injection might break!
|
||||
@Inject
|
||||
public RileyLinkMedtronicService() {
|
||||
super();
|
||||
}
|
||||
|
||||
|
||||
|
@ -99,12 +103,8 @@ public class RileyLinkMedtronicService extends RileyLinkService {
|
|||
// get most recently used RileyLink address
|
||||
rileyLinkServiceData.rileylinkAddress = sp.getString(RileyLinkConst.Prefs.RileyLinkAddress, "");
|
||||
|
||||
rileyLinkBLE = new RileyLinkBLE(injector, this); // or this
|
||||
rfspy = new RFSpy(injector, rileyLinkBLE);
|
||||
rfspy.startReader();
|
||||
|
||||
// init rileyLinkCommunicationManager
|
||||
medtronicCommunicationManager = new MedtronicCommunicationManager(injector, rfspy);
|
||||
medtronicUIComm = new MedtronicUIComm(injector, aapsLogger, medtronicUtil, medtronicUIPostprocessor, medtronicCommunicationManager);
|
||||
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "RileyLinkMedtronicService newly constructed");
|
||||
|
|
1
omnipod/.gitignore
vendored
Normal file
1
omnipod/.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
/build
|
104
omnipod/build.gradle
Normal file
104
omnipod/build.gradle
Normal file
|
@ -0,0 +1,104 @@
|
|||
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'
|
||||
|
||||
// OMNIPOD: for usage in Firebase event during testing phase
|
||||
buildConfigField "String", "VERSION", '"2.7-omnipod-0.4.1-SNAPSHOT"'
|
||||
// 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.7.0-rc3"'
|
||||
buildConfigField "String", "DEV_VERSION_COMMIT", '"a4b2ce32a59a617eed9ad006e85efdeec51cd899"'
|
||||
buildConfigField "String", "DEV_VERSION_COMMIT_DATE", '"16.8.2020"' // 16th of August
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
allprojects {
|
||||
repositories {
|
||||
jcenter()
|
||||
flatDir {
|
||||
dirs 'libs'
|
||||
}
|
||||
maven { url 'https://jitpack.io' }
|
||||
}
|
||||
}
|
||||
|
||||
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 'com.google.firebase:firebase-analytics-ktx:17.4.3'
|
||||
|
||||
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"
|
||||
|
||||
// Omnipod - start
|
||||
implementation 'org.apache.commons:commons-lang3:3.10'
|
||||
implementation 'net.danlew:android.joda:2.10.6'
|
||||
implementation "com.google.code.gson:gson:2.8.6"
|
||||
implementation(name: "com.atech-software.android.library.wizardpager-1.1.4", ext: "aar")
|
||||
// Omnipod - 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'
|
||||
|
||||
|
||||
}
|
0
omnipod/consumer-rules.pro
Normal file
0
omnipod/consumer-rules.pro
Normal file
Binary file not shown.
21
omnipod/proguard-rules.pro
vendored
Normal file
21
omnipod/proguard-rules.pro
vendored
Normal file
|
@ -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
|
16
omnipod/src/main/AndroidManifest.xml
Normal file
16
omnipod/src/main/AndroidManifest.xml
Normal file
|
@ -0,0 +1,16 @@
|
|||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="info.nightscout.androidaps.plugins.pump.omnipod">
|
||||
|
||||
<application>
|
||||
<service
|
||||
android:name=".service.RileyLinkOmnipodService"
|
||||
android:enabled="true"
|
||||
android:exported="true" />
|
||||
|
||||
<activity android:name=".dialogs.PodManagementActivity" />
|
||||
<activity android:name=".dialogs.PodHistoryActivity" />
|
||||
<activity
|
||||
android:name="com.atech.android.library.wizardpager.WizardPagerActivity"
|
||||
android:theme="@style/AppTheme.NoActionBar" />
|
||||
</application>
|
||||
</manifest>
|
|
@ -9,8 +9,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.EventPreferenceChange
|
||||
import info.nightscout.androidaps.interfaces.ActivePluginProvider
|
||||
import info.nightscout.androidaps.interfaces.CommandQueueProvider
|
||||
|
@ -34,17 +32,16 @@ import info.nightscout.androidaps.plugins.pump.omnipod.util.OmnipodConst
|
|||
import info.nightscout.androidaps.plugins.pump.omnipod.util.OmnipodUtil
|
||||
import info.nightscout.androidaps.queue.Callback
|
||||
import info.nightscout.androidaps.utils.FabricPrivacy
|
||||
import info.nightscout.androidaps.utils.LocalAlertUtils
|
||||
import info.nightscout.androidaps.utils.T
|
||||
import info.nightscout.androidaps.utils.WarnColors
|
||||
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
|
||||
import info.nightscout.androidaps.utils.extensions.plusAssign
|
||||
import info.nightscout.androidaps.utils.protection.ProtectionCheck
|
||||
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
||||
import info.nightscout.androidaps.utils.sharedPreferences.SP
|
||||
import info.nightscout.androidaps.utils.ui.UIRunnable
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
||||
import io.reactivex.disposables.CompositeDisposable
|
||||
import io.reactivex.disposables.Disposable
|
||||
import io.reactivex.schedulers.Schedulers
|
||||
import kotlinx.android.synthetic.main.omnipod_fragment.*
|
||||
import org.apache.commons.lang3.StringUtils
|
||||
|
@ -55,7 +52,6 @@ import javax.inject.Inject
|
|||
class OmnipodFragment : 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
|
||||
|
@ -68,18 +64,16 @@ class OmnipodFragment : DaggerFragment() {
|
|||
@Inject lateinit var sp: SP
|
||||
@Inject lateinit var omnipodUtil: OmnipodUtil
|
||||
@Inject lateinit var rileyLinkServiceData: RileyLinkServiceData
|
||||
@Inject lateinit var localAlertUtils: LocalAlertUtils
|
||||
|
||||
// TODO somehow obtain the pumpUnreachableThreshold in order to display last connection time red or white
|
||||
// @Inject lateinit var localAlertUtils: LocalAlertUtils
|
||||
@Inject lateinit var protectionCheck: ProtectionCheck
|
||||
|
||||
private var disposable: CompositeDisposable = CompositeDisposable()
|
||||
private var disposables: CompositeDisposable = CompositeDisposable()
|
||||
|
||||
private val loopHandler = Handler()
|
||||
private lateinit var refreshLoop: Runnable
|
||||
|
||||
operator fun CompositeDisposable.plusAssign(disposable: Disposable) {
|
||||
add(disposable)
|
||||
}
|
||||
|
||||
init {
|
||||
refreshLoop = Runnable {
|
||||
activity?.runOnUiThread { updateUi() }
|
||||
|
@ -159,23 +153,23 @@ class OmnipodFragment : DaggerFragment() {
|
|||
override fun onResume() {
|
||||
super.onResume()
|
||||
loopHandler.postDelayed(refreshLoop, T.mins(1).msecs())
|
||||
disposable += rxBus
|
||||
disposables += rxBus
|
||||
.toObservable(EventOmnipodRefreshButtonState::class.java)
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe({ omnipod_refresh.isEnabled = it.newState }, { fabricPrivacy.logException(it) })
|
||||
disposable += rxBus
|
||||
disposables += rxBus
|
||||
.toObservable(EventRileyLinkDeviceStatusChange::class.java)
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe({ updateRileyLinkUiElements() }, { fabricPrivacy.logException(it) })
|
||||
disposable += rxBus
|
||||
disposables += rxBus
|
||||
.toObservable(EventOmnipodPumpValuesChanged::class.java)
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe({ updateOmipodUiElements() }, { fabricPrivacy.logException(it) })
|
||||
disposable += rxBus
|
||||
disposables += rxBus
|
||||
.toObservable(EventOmnipodAcknowledgeAlertsChanged::class.java)
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe({ updateAcknowledgeAlertsUiElements() }, { fabricPrivacy.logException(it) })
|
||||
disposable += rxBus
|
||||
disposables += rxBus
|
||||
.toObservable(EventPreferenceChange::class.java)
|
||||
.observeOn(Schedulers.io())
|
||||
.subscribe({
|
||||
|
@ -202,7 +196,7 @@ class OmnipodFragment : DaggerFragment() {
|
|||
|
||||
override fun onPause() {
|
||||
super.onPause()
|
||||
disposable.clear()
|
||||
disposables.clear()
|
||||
loopHandler.removeCallbacks(refreshLoop)
|
||||
}
|
||||
|
||||
|
@ -217,7 +211,7 @@ class OmnipodFragment : DaggerFragment() {
|
|||
|
||||
val rileyLinkServiceState = rileyLinkServiceData.rileyLinkServiceState
|
||||
|
||||
val resourceId = rileyLinkServiceState.getResourceId(RileyLinkTargetDevice.Omnipod)
|
||||
val resourceId = rileyLinkServiceState.getResourceId()
|
||||
val rileyLinkError = rileyLinkServiceData.rileyLinkError
|
||||
|
||||
omnipod_rl_status.text =
|
||||
|
@ -250,7 +244,7 @@ class OmnipodFragment : DaggerFragment() {
|
|||
}
|
||||
omnipod_pod_lot.text = "-"
|
||||
omnipod_pod_tid.text = "-"
|
||||
omnipod_pod_fw_version.text = "-"
|
||||
omnipod_pod_firmware_version.text = "-"
|
||||
omnipod_pod_expiry.text = "-"
|
||||
omnipod_basabasalrate.text = "-"
|
||||
omnipod_reservoir.text = "-"
|
||||
|
@ -266,7 +260,7 @@ class OmnipodFragment : DaggerFragment() {
|
|||
omnipod_pod_address.text = podStateManager.address.toString()
|
||||
omnipod_pod_lot.text = podStateManager.lot.toString()
|
||||
omnipod_pod_tid.text = podStateManager.tid.toString()
|
||||
omnipod_pod_fw_version.text = podStateManager.pmVersion.toString() + " / " + podStateManager.piVersion.toString()
|
||||
omnipod_pod_firmware_version.text = resourceHelper.gs(R.string.omnipod_pod_firmware_version_value, podStateManager.pmVersion.toString(), podStateManager.piVersion.toString())
|
||||
omnipod_pod_expiry.text = podStateManager.expiryDateAsString
|
||||
|
||||
val stateText: String
|
||||
|
@ -330,11 +324,15 @@ class OmnipodFragment : DaggerFragment() {
|
|||
private fun updateLastConnectionUiElements() {
|
||||
if (podStateManager.isPodInitialized && podStateManager.lastSuccessfulCommunication != null) { // Null check for backwards compatibility
|
||||
omnipod_lastconnection.text = readableDuration(podStateManager.lastSuccessfulCommunication)
|
||||
omnipod_lastconnection.setTextColor(Color.WHITE)
|
||||
/*
|
||||
// TODO
|
||||
if (omnipodPumpPlugin.isUnreachableAlertTimeoutExceeded(localAlertUtils.pumpUnreachableThreshold())) {
|
||||
omnipod_lastconnection.setTextColor(Color.RED)
|
||||
} else {
|
||||
omnipod_lastconnection.setTextColor(Color.WHITE)
|
||||
}
|
||||
*/
|
||||
} else {
|
||||
omnipod_lastconnection.setTextColor(Color.WHITE)
|
||||
if (podStateManager.hasPodState() && podStateManager.lastSuccessfulCommunication != null) {
|
||||
|
@ -356,25 +354,33 @@ class OmnipodFragment : DaggerFragment() {
|
|||
}
|
||||
|
||||
private fun readableDuration(dateTime: DateTime): String {
|
||||
val min = Duration(dateTime, DateTime.now()).standardMinutes
|
||||
val minutes = Duration(dateTime, DateTime.now()).standardMinutes.toInt()
|
||||
when {
|
||||
min == 0L -> {
|
||||
return resourceHelper.gs(R.string.omnipod_connected_now)
|
||||
minutes == 0 -> {
|
||||
return resourceHelper.gs(R.string.omnipod_moments_ago)
|
||||
}
|
||||
|
||||
min < 60 -> {
|
||||
return resourceHelper.gs(R.string.minago, min)
|
||||
minutes < 60 -> {
|
||||
return resourceHelper.gs(R.string.omnipod_time_ago, resourceHelper.gq(R.plurals.omnipod_minutes, minutes, minutes))
|
||||
}
|
||||
|
||||
min < 1440 -> {
|
||||
val h = (min / 60).toInt()
|
||||
return resourceHelper.gq(R.plurals.objective_hours, h, h) + " " + resourceHelper.gs(R.string.ago)
|
||||
minutes < 1440 -> {
|
||||
val hours = minutes / 60
|
||||
val minutesLeft = minutes % 60
|
||||
if (minutesLeft > 0)
|
||||
return resourceHelper.gs(R.string.omnipod_time_ago,
|
||||
resourceHelper.gs(R.string.omnipod_composite_time, resourceHelper.gq(R.plurals.omnipod_hours, hours, hours), resourceHelper.gq(R.plurals.omnipod_minutes, minutesLeft, minutesLeft)))
|
||||
return resourceHelper.gs(R.string.omnipod_time_ago, resourceHelper.gq(R.plurals.omnipod_hours, hours, hours))
|
||||
}
|
||||
|
||||
else -> {
|
||||
val h = (min / 60).toInt()
|
||||
val d = h / 24
|
||||
return resourceHelper.gq(R.plurals.objective_days, d, d) + " " + resourceHelper.gs(R.string.ago)
|
||||
val hours = minutes / 60
|
||||
val days = hours / 24
|
||||
val hoursLeft = hours % 24
|
||||
if (hoursLeft > 0)
|
||||
return resourceHelper.gs(R.string.omnipod_time_ago,
|
||||
resourceHelper.gs(R.string.omnipod_composite_time, resourceHelper.gq(R.plurals.omnipod_days, days, days), resourceHelper.gq(R.plurals.omnipod_hours, hoursLeft, hoursLeft)))
|
||||
return resourceHelper.gs(R.string.omnipod_time_ago, resourceHelper.gq(R.plurals.omnipod_days, days, days))
|
||||
}
|
||||
}
|
||||
}
|
|
@ -24,14 +24,13 @@ import javax.inject.Inject;
|
|||
import javax.inject.Singleton;
|
||||
|
||||
import dagger.android.HasAndroidInjector;
|
||||
import info.nightscout.androidaps.BuildConfig;
|
||||
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.EventAppInitialized;
|
||||
import info.nightscout.androidaps.events.EventPreferenceChange;
|
||||
import info.nightscout.androidaps.events.EventRefreshOverview;
|
||||
import info.nightscout.androidaps.interfaces.ActivePluginProvider;
|
||||
|
@ -49,7 +48,6 @@ import info.nightscout.androidaps.plugins.general.overview.notifications.Notific
|
|||
import info.nightscout.androidaps.plugins.pump.common.PumpPluginAbstract;
|
||||
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.PumpDriverState;
|
||||
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.defs.RileyLinkPumpDevice;
|
||||
|
@ -59,13 +57,12 @@ import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.tasks
|
|||
import info.nightscout.androidaps.plugins.pump.common.utils.DateTimeUtil;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.response.podinfo.PodInfoRecentPulseLog;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.OmnipodCommandType;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.IOmnipodManager;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.OmnipodCustomActionType;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.OmnipodPumpPluginInterface;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.OmnipodStatusRequest;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.state.PodStateManager;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.OmnipodDriverState;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.OmnipodPumpStatus;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.comm.AapsOmnipodManager;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.ui.OmnipodUIComm;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.ui.OmnipodUITask;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.events.EventOmnipodPumpValuesChanged;
|
||||
|
@ -89,41 +86,31 @@ import io.reactivex.schedulers.Schedulers;
|
|||
*/
|
||||
@Singleton
|
||||
public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPumpPluginInterface, RileyLinkPumpDevice {
|
||||
protected PodStateManager podStateManager;
|
||||
private static OmnipodPumpPlugin plugin = null;
|
||||
private RileyLinkServiceData rileyLinkServiceData;
|
||||
private ServiceTaskExecutor serviceTaskExecutor;
|
||||
private RileyLinkOmnipodService rileyLinkOmnipodService;
|
||||
private OmnipodUtil omnipodUtil;
|
||||
protected OmnipodPumpStatus omnipodPumpStatus = null;
|
||||
//protected OmnipodUIComm omnipodUIComm;
|
||||
private final PodStateManager podStateManager;
|
||||
private final RileyLinkServiceData rileyLinkServiceData;
|
||||
private final ServiceTaskExecutor serviceTaskExecutor;
|
||||
private final OmnipodPumpStatus omnipodPumpStatus;
|
||||
private final AapsOmnipodManager aapsOmnipodManager;
|
||||
private final OmnipodUtil omnipodUtil;
|
||||
|
||||
private CompositeDisposable disposable = new CompositeDisposable();
|
||||
|
||||
|
||||
// variables for handling statuses and history
|
||||
protected boolean firstRun = true;
|
||||
protected boolean isRefresh = false;
|
||||
private boolean isBasalProfileInvalid = false;
|
||||
private boolean basalProfileChanged = false;
|
||||
private boolean isInitialized = false;
|
||||
protected IOmnipodManager omnipodCommunicationManager;
|
||||
|
||||
// TODO make non-static just inject the Singleton and use a getter)
|
||||
public static boolean isBusy = false;
|
||||
private RileyLinkOmnipodService rileyLinkOmnipodService;
|
||||
|
||||
private boolean isBusy = false;
|
||||
// TODO it seems that we never add anything to this list?
|
||||
// I Wouldn't know why we need it anyway
|
||||
protected List<Long> busyTimestamps = new ArrayList<>();
|
||||
protected boolean sentIdToFirebase = false;
|
||||
protected boolean hasTimeDateOrTimeZoneChanged = false;
|
||||
private int timeChangeRetries = 0;
|
||||
|
||||
private Profile currentProfile;
|
||||
|
||||
boolean omnipodServiceRunning = false;
|
||||
|
||||
private long nextPodCheck = 0L;
|
||||
//OmnipodDriverState driverState = OmnipodDriverState.NotInitalized;
|
||||
private boolean sentIdToFirebase;
|
||||
|
||||
@Inject
|
||||
public OmnipodPumpPlugin(
|
||||
|
@ -134,16 +121,16 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPump
|
|||
ResourceHelper resourceHelper,
|
||||
ActivePluginProvider activePlugin,
|
||||
SP sp,
|
||||
OmnipodUtil omnipodUtil,
|
||||
OmnipodPumpStatus omnipodPumpStatus,
|
||||
PodStateManager podStateManager,
|
||||
AapsOmnipodManager aapsOmnipodManager,
|
||||
CommandQueueProvider commandQueue,
|
||||
FabricPrivacy fabricPrivacy,
|
||||
RileyLinkServiceData rileyLinkServiceData,
|
||||
ServiceTaskExecutor serviceTaskExecutor,
|
||||
DateUtil dateUtil
|
||||
DateUtil dateUtil,
|
||||
OmnipodUtil omnipodUtil
|
||||
) {
|
||||
|
||||
super(new PluginDescription() //
|
||||
.mainType(PluginType.PUMP) //
|
||||
.fragmentClass(OmnipodFragment.class.getName()) //
|
||||
|
@ -152,39 +139,25 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPump
|
|||
.preferencesId(R.xml.pref_omnipod) //
|
||||
.description(R.string.description_pump_omnipod), //
|
||||
PumpType.Insulet_Omnipod,
|
||||
injector, resourceHelper, aapsLogger, commandQueue, rxBus, activePlugin, sp, context, fabricPrivacy, dateUtil
|
||||
);
|
||||
injector, resourceHelper, aapsLogger, commandQueue, rxBus, activePlugin, sp, context, fabricPrivacy, dateUtil);
|
||||
this.podStateManager = podStateManager;
|
||||
this.rileyLinkServiceData = rileyLinkServiceData;
|
||||
this.serviceTaskExecutor = serviceTaskExecutor;
|
||||
this.omnipodPumpStatus = omnipodPumpStatus;
|
||||
this.aapsOmnipodManager = aapsOmnipodManager;
|
||||
this.omnipodUtil = omnipodUtil;
|
||||
|
||||
displayConnectionMessages = false;
|
||||
this.omnipodUtil = omnipodUtil;
|
||||
this.omnipodPumpStatus = omnipodPumpStatus;
|
||||
|
||||
//OmnipodUtil.setDriverState();
|
||||
|
||||
// TODO loop
|
||||
// if (OmnipodUtil.isOmnipodEros()) {
|
||||
// OmnipodUtil.setPlugin(this);
|
||||
// OmnipodUtil.setOmnipodPodType(OmnipodPodType.Eros);
|
||||
// OmnipodUtil.setPumpType(PumpType.Insulet_Omnipod);
|
||||
// }
|
||||
|
||||
// // TODO ccc
|
||||
|
||||
serviceConnection = new ServiceConnection() {
|
||||
this.serviceConnection = new ServiceConnection() {
|
||||
|
||||
@Override
|
||||
public void onServiceDisconnected(ComponentName name) {
|
||||
|
||||
aapsLogger.debug(LTag.PUMP, "RileyLinkOmnipodService is disconnected");
|
||||
rileyLinkOmnipodService = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onServiceConnected(ComponentName name, IBinder service) {
|
||||
|
||||
aapsLogger.debug(LTag.PUMP, "RileyLinkOmnipodService is connected");
|
||||
RileyLinkOmnipodService.LocalBinder mLocalBinder = (RileyLinkOmnipodService.LocalBinder) service;
|
||||
rileyLinkOmnipodService = mLocalBinder.getServiceInstance();
|
||||
|
@ -200,56 +173,9 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPump
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// if (OmnipodPumpPlugin.this.omnipodPumpStatus != null) {
|
||||
//
|
||||
// aapsLogger.debug(LTag.PUMP, "Starting OmniPod-RileyLink service");
|
||||
// if (omnipodService.setNotInPreInit()) {
|
||||
// if (omnipodCommunicationManager == null) {
|
||||
// omnipodCommunicationManager = AapsOmnipodManager.getInstance();
|
||||
// omnipodCommunicationManager.setPumpStatus(OmnipodPumpPlugin.this.omnipodPumpStatus);
|
||||
// omnipodServiceRunning = true;
|
||||
// } else {
|
||||
// omnipodCommunicationManager.setPumpStatus(OmnipodPumpPlugin.this.omnipodPumpStatus);
|
||||
// }
|
||||
//
|
||||
// omnipodUtil.setOmnipodPodType(OmnipodPodType.Eros);
|
||||
// //omnipodUtil.setPlugin(OmnipodPumpPlugin.this);
|
||||
//
|
||||
// omnipodUIComm = new OmnipodUIComm(omnipodCommunicationManager, plugin, OmnipodPumpPlugin.this.omnipodPumpStatus);
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// SystemClock.sleep(5000);
|
||||
//}
|
||||
}).start();
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
protected OmnipodPumpPlugin(PluginDescription pluginDescription, PumpType pumpType,
|
||||
HasAndroidInjector injector,
|
||||
AAPSLogger aapsLogger,
|
||||
RxBusWrapper rxBus,
|
||||
Context context,
|
||||
ResourceHelper resourceHelper,
|
||||
ActivePluginProvider activePlugin,
|
||||
info.nightscout.androidaps.utils.sharedPreferences.SP sp,
|
||||
CommandQueueProvider commandQueue,
|
||||
FabricPrivacy fabricPrivacy,
|
||||
DateUtil dateUtil) {
|
||||
super(pluginDescription, pumpType, injector, resourceHelper, aapsLogger, commandQueue, rxBus, activePlugin, sp, context, fabricPrivacy, dateUtil);
|
||||
|
||||
// this.rileyLinkUtil = rileyLinkUtil;
|
||||
// this.medtronicUtil = medtronicUtil;
|
||||
// this.sp = sp;
|
||||
// this.medtronicPumpStatus = medtronicPumpStatus;
|
||||
// this.medtronicHistoryData = medtronicHistoryData;
|
||||
// this.rileyLinkServiceData = rileyLinkServiceData;
|
||||
// this.serviceTaskExecutor = serviceTaskExecutor;
|
||||
}
|
||||
|
||||
public PodStateManager getPodStateManager() {
|
||||
|
@ -276,26 +202,31 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPump
|
|||
rileyLinkOmnipodService.verifyConfiguration();
|
||||
}, fabricPrivacy::logException)
|
||||
);
|
||||
disposable.add(rxBus
|
||||
.toObservable(EventAppInitialized.class)
|
||||
.observeOn(Schedulers.io())
|
||||
.subscribe(event -> {
|
||||
// See if a bolus was active before the app previously exited
|
||||
// If so, add it to history
|
||||
// Needs to be done after EventAppInitialized because otherwise, TreatmentsPlugin.onStart() hasn't been called yet
|
||||
// so it didn't initialize a TreatmentService yet, resulting in a NullPointerException
|
||||
if (sp.contains(OmnipodConst.Prefs.CurrentBolus)) {
|
||||
String currentBolusString = sp.getString(OmnipodConst.Prefs.CurrentBolus, "");
|
||||
aapsLogger.warn(LTag.PUMP, "Found active bolus in SP. Adding Treatment: {}", currentBolusString);
|
||||
try {
|
||||
DetailedBolusInfo detailedBolusInfo = omnipodUtil.getGsonInstance().fromJson(currentBolusString, DetailedBolusInfo.class);
|
||||
aapsOmnipodManager.addBolusToHistory(detailedBolusInfo);
|
||||
} catch (Exception ex) {
|
||||
aapsLogger.error(LTag.PUMP, "Failed to add active bolus to history", ex);
|
||||
}
|
||||
sp.remove(OmnipodConst.Prefs.CurrentBolus);
|
||||
}
|
||||
}, fabricPrivacy::logException)
|
||||
);
|
||||
|
||||
super.onStart();
|
||||
|
||||
|
||||
//rileyLinkOmnipodService.verifyConfiguration();
|
||||
//initPumpStatusData();
|
||||
}
|
||||
|
||||
// @Override
|
||||
// protected void onResume() {
|
||||
//
|
||||
// }
|
||||
|
||||
// private void refreshConfiguration() {
|
||||
// if (pumpStatusLocal != null) {
|
||||
// pumpStatusLocal.refreshConfiguration();
|
||||
// }
|
||||
// verifyConfiguration()
|
||||
// }
|
||||
|
||||
@Override
|
||||
protected void onStop() {
|
||||
disposable.clear();
|
||||
|
@ -306,10 +237,8 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPump
|
|||
return "OmnipodPlugin::";
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void initPumpStatusData() {
|
||||
|
||||
omnipodPumpStatus.lastConnection = sp.getLong(RileyLinkConst.Prefs.LastGoodDeviceCommunicationTime, 0L);
|
||||
omnipodPumpStatus.lastDataTime = omnipodPumpStatus.lastConnection;
|
||||
omnipodPumpStatus.previousConnection = omnipodPumpStatus.lastConnection;
|
||||
|
@ -322,16 +251,12 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPump
|
|||
if (!sp.contains(OmnipodConst.Statistics.FirstPumpStart)) {
|
||||
sp.putLong(OmnipodConst.Statistics.FirstPumpStart, System.currentTimeMillis());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onStartCustomActions() {
|
||||
|
||||
// check status every minute (if any status needs refresh we send readStatus command)
|
||||
new Thread(() -> {
|
||||
|
||||
do {
|
||||
SystemClock.sleep(60000);
|
||||
|
||||
|
@ -365,7 +290,6 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPump
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Class getServiceClass() {
|
||||
return RileyLinkOmnipodService.class;
|
||||
|
@ -376,20 +300,17 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPump
|
|||
return this.omnipodPumpStatus;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String deviceID() {
|
||||
return "Omnipod";
|
||||
}
|
||||
|
||||
|
||||
// Pump Plugin
|
||||
|
||||
private boolean isServiceSet() {
|
||||
return rileyLinkOmnipodService != null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isInitialized() {
|
||||
if (displayConnectionMessages)
|
||||
|
@ -397,7 +318,6 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPump
|
|||
return isServiceSet() && isInitialized;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isBusy() {
|
||||
if (displayConnectionMessages)
|
||||
|
@ -419,19 +339,16 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPump
|
|||
return false;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void resetRileyLinkConfiguration() {
|
||||
rileyLinkOmnipodService.resetRileyLinkConfiguration();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean hasTuneUp() {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void doTuneUpDevice() {
|
||||
//rileyLinkOmnipodService.doTuneUpDevice();
|
||||
|
@ -442,7 +359,6 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPump
|
|||
rxBus.send(new EventOmnipodPumpValuesChanged());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public RileyLinkOmnipodService getRileyLinkService() {
|
||||
return rileyLinkOmnipodService;
|
||||
|
@ -452,7 +368,6 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPump
|
|||
return rileyLinkOmnipodService.getDeviceCommandExecutor();
|
||||
}
|
||||
|
||||
|
||||
private synchronized void clearBusyQueue() {
|
||||
|
||||
if (busyTimestamps.size() == 0) {
|
||||
|
@ -479,7 +394,6 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPump
|
|||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isConnected() {
|
||||
if (displayConnectionMessages)
|
||||
|
@ -487,7 +401,6 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPump
|
|||
return isServiceSet() && rileyLinkOmnipodService.isInitialized();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isConnecting() {
|
||||
if (displayConnectionMessages)
|
||||
|
@ -495,7 +408,6 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPump
|
|||
return !isServiceSet() || !rileyLinkOmnipodService.isInitialized();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isSuspended() {
|
||||
return !podStateManager.isPodRunning() || podStateManager.isSuspended();
|
||||
|
@ -503,10 +415,10 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPump
|
|||
|
||||
@Override
|
||||
public void getPumpStatus() {
|
||||
|
||||
if (firstRun) {
|
||||
initializePump(!isRefresh);
|
||||
triggerUIChange();
|
||||
|
||||
} else if (!omnipodStatusRequestList.isEmpty()) {
|
||||
|
||||
List<OmnipodStatusRequest> removeList = new ArrayList<>();
|
||||
|
@ -525,7 +437,7 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPump
|
|||
Intent i = new Intent(context, ErrorHelperActivity.class);
|
||||
i.putExtra("soundid", 0);
|
||||
i.putExtra("status", "Pulse Log (copied to clipboard):\n" + result.toString());
|
||||
i.putExtra("title", resourceHelper.gs(R.string.combo_warning));
|
||||
i.putExtra("title", resourceHelper.gs(R.string.omnipod_warning));
|
||||
i.putExtra("clipboardContent", result.toString());
|
||||
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
context.startActivity(i);
|
||||
|
@ -551,7 +463,7 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPump
|
|||
|
||||
Notification notification = new Notification(
|
||||
Notification.TIME_OR_TIMEZONE_CHANGE,
|
||||
resourceHelper.gs(R.string.time_or_timezone_change),
|
||||
resourceHelper.gs(R.string.omnipod_time_or_timezone_change),
|
||||
Notification.INFO, 60);
|
||||
rxBus.send(new EventNewNotification(notification));
|
||||
|
||||
|
@ -566,26 +478,15 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPump
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
public void setIsBusy(boolean isBusy_) {
|
||||
isBusy = isBusy_;
|
||||
public void setIsBusy(boolean isBusy) {
|
||||
this.isBusy = isBusy;
|
||||
}
|
||||
|
||||
|
||||
private void getPodPumpStatus() {
|
||||
// TODO read pod status
|
||||
aapsLogger.error(LTag.PUMP, "getPodPumpStatus() NOT IMPLEMENTED");
|
||||
|
||||
//addPodStatusRequest(OmnipodStatusRequest.GetPodState);
|
||||
|
||||
//getPodPumpStatusObject().driverState = OmnipodDriverState.Initalized_PodAvailable;
|
||||
//driverState = OmnipodDriverState.Initalized_PodAvailable;
|
||||
// FIXME this does not seem to make sense
|
||||
omnipodUtil.setDriverState(OmnipodDriverState.Initalized_PodAttached);
|
||||
// we would probably need to read Basal Profile here too
|
||||
}
|
||||
|
||||
|
||||
List<OmnipodStatusRequest> omnipodStatusRequestList = new ArrayList<>();
|
||||
|
||||
public void addPodStatusRequest(OmnipodStatusRequest pumpStatusRequest) {
|
||||
|
@ -596,25 +497,17 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPump
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDriverState(OmnipodDriverState state) {
|
||||
//this.driverState = state;
|
||||
}
|
||||
|
||||
|
||||
public void resetStatusState() {
|
||||
firstRun = true;
|
||||
isRefresh = true;
|
||||
}
|
||||
|
||||
|
||||
// FIXME do we actually need this? If a user presses refresh during an action,
|
||||
// I suppose the GetStatusCommand would just be queued?
|
||||
private void setRefreshButtonEnabled(boolean enabled) {
|
||||
rxBus.send(new EventOmnipodRefreshButtonState(enabled));
|
||||
}
|
||||
|
||||
|
||||
private void initializePump(boolean realInit) {
|
||||
aapsLogger.info(LTag.PUMP, getLogPrefix() + "initializePump - start");
|
||||
|
||||
|
@ -625,16 +518,10 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPump
|
|||
|
||||
if (podStateManager.isPodInitialized()) {
|
||||
aapsLogger.debug(LTag.PUMP, "PodStateManager (saved): " + podStateManager);
|
||||
|
||||
if (!isRefresh) {
|
||||
pumpState = PumpDriverState.Initialized;
|
||||
}
|
||||
|
||||
// TODO handle if session state too old
|
||||
getPodPumpStatus();
|
||||
} else {
|
||||
aapsLogger.debug(LTag.PUMP, "No Pod running");
|
||||
omnipodUtil.setDriverState(OmnipodDriverState.Initalized_NoPod);
|
||||
}
|
||||
|
||||
finishAction("Omnipod Pump");
|
||||
|
@ -653,7 +540,6 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPump
|
|||
this.firstRun = false;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isThisProfileSet(Profile profile) {
|
||||
|
||||
|
@ -667,7 +553,6 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPump
|
|||
return (currentProfile.areProfileBasalPatternsSame(profile));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public long lastDataTime() {
|
||||
if (omnipodPumpStatus.lastConnection != 0) {
|
||||
|
@ -677,7 +562,6 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPump
|
|||
return System.currentTimeMillis();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public double getBaseBasalRate() {
|
||||
|
||||
|
@ -689,35 +573,29 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPump
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public double getReservoirLevel() {
|
||||
return omnipodPumpStatus.reservoirRemainingUnits;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getBatteryLevel() {
|
||||
return 75;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void triggerUIChange() {
|
||||
rxBus.send(new EventOmnipodPumpValuesChanged());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isFakingTempsByExtendedBoluses() {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@NonNull
|
||||
protected PumpEnactResult deliverBolus(final DetailedBolusInfo detailedBolusInfo) {
|
||||
|
||||
aapsLogger.info(LTag.PUMP, getLogPrefix() + "deliverBolus - {}", detailedBolusInfo);
|
||||
|
||||
setRefreshButtonEnabled(false);
|
||||
|
@ -768,20 +646,17 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPump
|
|||
//finishAction("Bolus");
|
||||
}
|
||||
|
||||
|
||||
private void incrementStatistics(String statsKey) {
|
||||
long currentCount = sp.getLong(statsKey, 0L);
|
||||
currentCount++;
|
||||
sp.putLong(statsKey, currentCount);
|
||||
}
|
||||
|
||||
|
||||
// if enforceNew===true current temp basal is canceled and new TBR set (duration is prolonged),
|
||||
// if false and the same rate is requested enacted=false and success=true is returned and TBR is not changed
|
||||
@Override
|
||||
public PumpEnactResult setTempBasalAbsolute(Double absoluteRate, Integer durationInMinutes, Profile profile,
|
||||
boolean enforceNew) {
|
||||
|
||||
setRefreshButtonEnabled(false);
|
||||
|
||||
aapsLogger.info(LTag.PUMP, getLogPrefix() + "setTempBasalAbsolute: rate: {}, duration={}", absoluteRate, durationInMinutes);
|
||||
|
@ -802,29 +677,6 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPump
|
|||
}
|
||||
}
|
||||
|
||||
// if TBR is running we will cancel it.
|
||||
// if (tbrCurrent != null) {
|
||||
//
|
||||
// aapsLogger.info(LTag.PUMP,getLogPrefix() + "setTempBasalAbsolute - TBR running - so canceling it.");
|
||||
//
|
||||
// // CANCEL
|
||||
// OmnipodUITask responseTask2 = omnipodUIComm.executeCommand(OmnipodCommandType.CancelTemporaryBasal);
|
||||
//
|
||||
// PumpEnactResult result = responseTask2.getResult();
|
||||
//
|
||||
// if (result.success) {
|
||||
//
|
||||
// aapsLogger.info(LTag.PUMP,getLogPrefix() + "setTempBasalAbsolute - Current TBR cancelled.");
|
||||
// } else {
|
||||
//
|
||||
// aapsLogger.error(LTag.PUMP,getLogPrefix() + "setTempBasalAbsolute - Cancel TBR failed.");
|
||||
//
|
||||
// finishAction("TBR");
|
||||
//
|
||||
// return result;
|
||||
// }
|
||||
// }
|
||||
|
||||
// now start new TBR
|
||||
OmnipodUITask responseTask = getDeviceCommandExecutor().executeCommand(OmnipodCommandType.SetTemporaryBasal,
|
||||
absoluteRate, durationInMinutes);
|
||||
|
@ -853,7 +705,6 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPump
|
|||
return omnipodPumpStatus.getTemporaryBasal();
|
||||
}
|
||||
|
||||
|
||||
protected void finishAction(String overviewKey) {
|
||||
if (overviewKey != null)
|
||||
rxBus.send(new EventRefreshOverview(overviewKey, false));
|
||||
|
@ -863,7 +714,6 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPump
|
|||
setRefreshButtonEnabled(true);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public PumpEnactResult cancelTempBasal(boolean enforceNew) {
|
||||
|
||||
|
@ -917,7 +767,7 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPump
|
|||
return new PumpEnactResult(getInjector()) //
|
||||
.success(true) //
|
||||
.enacted(false) //
|
||||
.comment(resourceHelper.gs(R.string.medtronic_cmd_basal_profile_not_set_is_same));
|
||||
.comment(resourceHelper.gs(R.string.omnipod_cmd_basal_profile_not_set_is_same));
|
||||
}
|
||||
|
||||
setRefreshButtonEnabled(false);
|
||||
|
@ -946,18 +796,16 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPump
|
|||
return result;
|
||||
}
|
||||
|
||||
|
||||
// OPERATIONS not supported by Pump or Plugin
|
||||
|
||||
protected List<CustomAction> customActions = null;
|
||||
|
||||
private CustomAction customActionResetRLConfig = new CustomAction(
|
||||
R.string.medtronic_custom_action_reset_rileylink, OmnipodCustomActionType.ResetRileyLinkConfiguration, true);
|
||||
R.string.omnipod_custom_action_reset_rileylink, OmnipodCustomActionType.ResetRileyLinkConfiguration, true);
|
||||
|
||||
|
||||
@Override
|
||||
public List<CustomAction> getCustomActions() {
|
||||
|
||||
if (customActions == null) {
|
||||
this.customActions = Arrays.asList(
|
||||
customActionResetRLConfig //,
|
||||
|
@ -973,7 +821,6 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPump
|
|||
OmnipodCustomActionType mcat = (OmnipodCustomActionType) customActionType;
|
||||
|
||||
switch (mcat) {
|
||||
|
||||
case ResetRileyLinkConfiguration: {
|
||||
serviceTaskExecutor.startTask(new ResetRileyLinkConfigurationTask(getInjector()));
|
||||
}
|
||||
|
@ -988,13 +835,11 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPump
|
|||
public void timezoneOrDSTChanged(TimeChangeType timeChangeType) {
|
||||
aapsLogger.warn(LTag.PUMP, getLogPrefix() + "Time, Date and/or TimeZone changed. [changeType=" + timeChangeType.name() + ", eventHandlingEnabled=" + omnipodPumpStatus.timeChangeEventEnabled + "]");
|
||||
|
||||
if (omnipodUtil.getDriverState() == OmnipodDriverState.Initalized_PodAttached) {
|
||||
if (omnipodPumpStatus.timeChangeEventEnabled) {
|
||||
if (omnipodPumpStatus.timeChangeEventEnabled && podStateManager.isPodRunning()) {
|
||||
aapsLogger.info(LTag.PUMP, getLogPrefix() + "Time,and/or TimeZone changed event received and will be consumed by driver.");
|
||||
this.hasTimeDateOrTimeZoneChanged = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUnreachableAlertTimeoutExceeded(long unreachableTimeoutMilliseconds) {
|
||||
|
@ -1018,11 +863,4 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPump
|
|||
return false;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public RxBusWrapper getRxBus() {
|
||||
return this.rxBus;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -6,15 +6,13 @@ import java.util.Collections;
|
|||
import java.util.List;
|
||||
|
||||
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.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;
|
||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.RileyLinkCommunicationException;
|
||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.data.RLMessage;
|
||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.defs.RLMessageType;
|
||||
|
@ -50,18 +48,20 @@ import info.nightscout.androidaps.plugins.pump.omnipod.util.OmnipodConst;
|
|||
/**
|
||||
* Created by andy on 6/29/18.
|
||||
*/
|
||||
// TODO make singleton and rename to OmnipodRileyLinkCommunicationManager
|
||||
// TODO rename to OmnipodRileyLinkCommunicationManager
|
||||
@Singleton
|
||||
public class OmnipodCommunicationManager extends RileyLinkCommunicationManager {
|
||||
|
||||
@Inject public AAPSLogger aapsLogger;
|
||||
@Inject OmnipodPumpStatus omnipodPumpStatus;
|
||||
//@Inject OmnipodPumpPlugin omnipodPumpPlugin;
|
||||
//@Inject RileyLinkServiceData rileyLinkServiceData;
|
||||
//@Inject ServiceTaskExecutor serviceTaskExecutor;
|
||||
|
||||
// This empty constructor must be kept, otherwise dagger injection might break!
|
||||
@Inject
|
||||
public OmnipodCommunicationManager() {
|
||||
}
|
||||
|
||||
@Inject
|
||||
public OmnipodCommunicationManager(HasAndroidInjector injector, RFSpy rfspy) {
|
||||
super(injector, rfspy);
|
||||
public void onInit() {
|
||||
// this cannot be done in the constructor, as sp is not populated at that time
|
||||
omnipodPumpStatus.previousConnection = sp.getLong(
|
||||
RileyLinkConst.Prefs.LastGoodDeviceCommunicationTime, 0L);
|
||||
}
|
|
@ -61,6 +61,8 @@ public class OmnipodManager {
|
|||
private PodStateManager podStateManager;
|
||||
|
||||
private ActiveBolusData activeBolusData;
|
||||
private SingleSubject<Boolean> bolusCommandExecutionSubject;
|
||||
|
||||
private final Object bolusDataMutex = new Object();
|
||||
|
||||
private AAPSLogger aapsLogger;
|
||||
|
@ -277,12 +279,16 @@ public class OmnipodManager {
|
|||
|
||||
logStartingCommandExecution("bolus [units=" + units + ", acknowledgementBeep=" + acknowledgementBeep + ", completionBeep=" + completionBeep + "]");
|
||||
|
||||
bolusCommandExecutionSubject = SingleSubject.create();
|
||||
|
||||
CommandDeliveryStatus commandDeliveryStatus = CommandDeliveryStatus.SUCCESS;
|
||||
|
||||
try {
|
||||
executeAndVerify(() -> communicationService.executeAction(new BolusAction(podStateManager, units, acknowledgementBeep, completionBeep)));
|
||||
} catch (OmnipodException ex) {
|
||||
if (ex.isCertainFailure()) {
|
||||
bolusCommandExecutionSubject.onSuccess(false);
|
||||
bolusCommandExecutionSubject = null;
|
||||
throw ex;
|
||||
}
|
||||
|
||||
|
@ -319,6 +325,11 @@ public class OmnipodManager {
|
|||
activeBolusData = new ActiveBolusData(units, startDate, bolusCompletionSubject, disposables);
|
||||
}
|
||||
|
||||
// Return successful command execution AFTER storing activeBolusData
|
||||
// Otherwise, hasActiveBolus() would return false and the caller would not cancel the bolus.
|
||||
bolusCommandExecutionSubject.onSuccess(true);
|
||||
bolusCommandExecutionSubject = null;
|
||||
|
||||
disposables.add(Completable.complete() //
|
||||
.delay(estimatedRemainingBolusDuration.getMillis() + 250, TimeUnit.MILLISECONDS) //
|
||||
.observeOn(Schedulers.io()) //
|
||||
|
@ -486,6 +497,10 @@ public class OmnipodManager {
|
|||
}
|
||||
}
|
||||
|
||||
public SingleSubject<Boolean> getBolusCommandExecutionSubject() {
|
||||
return bolusCommandExecutionSubject;
|
||||
}
|
||||
|
||||
// Only works for commands with nonce resyncable message blocks
|
||||
// FIXME method is too big, needs refactoring
|
||||
private StatusResponse executeAndVerify(Supplier<StatusResponse> supplier) {
|
|
@ -1,10 +1,10 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod.comm.action;
|
||||
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.OmnipodCommunicationManager;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.exception.ActionInitializationException;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.command.GetStatusCommand;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.response.StatusResponse;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.PodInfoType;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.exception.ActionInitializationException;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.state.PodStateManager;
|
||||
|
||||
public class GetStatusAction implements OmnipodAction<StatusResponse> {
|
|
@ -3,7 +3,6 @@ package info.nightscout.androidaps.plugins.pump.omnipod.comm.exception;
|
|||
import java.util.Locale;
|
||||
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.DeliveryStatus;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.PodProgressStatus;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.exception.OmnipodException;
|
||||
|
||||
public class IllegalDeliveryStatusException extends OmnipodException {
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue