Merge pull request #2913 from AAPS-Omnipod/omnipod_eros_dev_merge_to_upstream

Omnipod updates
This commit is contained in:
Milos Kozak 2020-08-22 19:34:05 +02:00 committed by GitHub
commit 1e7a7a40bc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
302 changed files with 3540 additions and 4366 deletions

View file

@ -33,6 +33,7 @@ ext {
repositories { repositories {
jcenter { url "https://jcenter.bintray.com/" } jcenter { url "https://jcenter.bintray.com/" }
mavenCentral() mavenCentral()
google()
} }
def generateGitBuild = { -> def generateGitBuild = { ->
@ -280,8 +281,7 @@ dependencies {
implementation "com.joanzapata.iconify:android-iconify-fontawesome:2.2.2" implementation "com.joanzapata.iconify:android-iconify-fontawesome:2.2.2"
implementation 'com.madgag.spongycastle:core:1.58.0.0' implementation 'com.madgag.spongycastle:core:1.58.0.0'
// Omnipod wizard // Omnipod wizard
implementation(name: "com.atech-software.android.library.wizardpager-1.1.1", ext: "aar") implementation(name: "com.atech-software.android.library.wizardpager-1.1.4", ext: "aar")
implementation("com.google.android:flexbox:0.3.0") { implementation("com.google.android:flexbox:0.3.0") {
exclude group: "com.android.support" exclude group: "com.android.support"
} }

View file

@ -263,17 +263,6 @@
<uses-library android:name="org.apache.http.legacy" android:required="false"/> <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> </application>
</manifest> </manifest>

View file

@ -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.InsightBolusID;
import info.nightscout.androidaps.plugins.pump.insight.database.InsightHistoryOffset; import info.nightscout.androidaps.plugins.pump.insight.database.InsightHistoryOffset;
import info.nightscout.androidaps.plugins.pump.insight.database.InsightPumpID; 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.plugins.pump.virtual.VirtualPumpPlugin;
import info.nightscout.androidaps.utils.JsonHelper; import info.nightscout.androidaps.utils.JsonHelper;
import info.nightscout.androidaps.utils.PercentageSplitter; 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_HISTORY_OFFSETS = "InsightHistoryOffsets";
public static final String DATABASE_INSIGHT_BOLUS_IDS = "InsightBolusIDs"; public static final String DATABASE_INSIGHT_BOLUS_IDS = "InsightBolusIDs";
public static final String DATABASE_INSIGHT_PUMP_IDS = "InsightPumpIDs"; public static final String DATABASE_INSIGHT_PUMP_IDS = "InsightPumpIDs";
public static final String DATABASE_POD_HISTORY = "PodHistory";
private static final int DATABASE_VERSION = 12; private static final int DATABASE_VERSION = 12;
@ -142,7 +140,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
TableUtils.createTableIfNotExists(connectionSource, InsightHistoryOffset.class); TableUtils.createTableIfNotExists(connectionSource, InsightHistoryOffset.class);
TableUtils.createTableIfNotExists(connectionSource, InsightBolusID.class); TableUtils.createTableIfNotExists(connectionSource, InsightBolusID.class);
TableUtils.createTableIfNotExists(connectionSource, InsightPumpID.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() + " " + 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 + "\")"); "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() + " " + 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, CareportalEvent.class, true);
TableUtils.dropTable(connectionSource, ProfileSwitch.class, true); TableUtils.dropTable(connectionSource, ProfileSwitch.class, true);
TableUtils.dropTable(connectionSource, TDD.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, TempTarget.class);
TableUtils.createTableIfNotExists(connectionSource, BgReading.class); TableUtils.createTableIfNotExists(connectionSource, BgReading.class);
TableUtils.createTableIfNotExists(connectionSource, DanaRHistoryRecord.class); TableUtils.createTableIfNotExists(connectionSource, DanaRHistoryRecord.class);
@ -229,7 +227,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
TableUtils.createTableIfNotExists(connectionSource, CareportalEvent.class); TableUtils.createTableIfNotExists(connectionSource, CareportalEvent.class);
TableUtils.createTableIfNotExists(connectionSource, ProfileSwitch.class); TableUtils.createTableIfNotExists(connectionSource, ProfileSwitch.class);
TableUtils.createTableIfNotExists(connectionSource, TDD.class); TableUtils.createTableIfNotExists(connectionSource, TDD.class);
TableUtils.createTableIfNotExists(connectionSource, PodHistory.class); TableUtils.createTableIfNotExists(connectionSource, OmnipodHistoryRecord.class);
updateEarliestDataChange(0); updateEarliestDataChange(0);
} catch (SQLException e) { } catch (SQLException e) {
aapsLogger.error("Unhandled exception", e); aapsLogger.error("Unhandled exception", e);
@ -364,8 +362,8 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
return getDao(InsightHistoryOffset.class); return getDao(InsightHistoryOffset.class);
} }
private Dao<PodHistory, Long> getDaoPodHistory() throws SQLException { private Dao<OmnipodHistoryRecord, Long> getDaoPodHistory() throws SQLException {
return getDao(PodHistory.class); return getDao(OmnipodHistoryRecord.class);
} }
public long roundDateToSec(long date) { public long roundDateToSec(long date) {
@ -1865,25 +1863,25 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
// ---------------- PodHistory handling --------------- // ---------------- PodHistory handling ---------------
public void createOrUpdate(PodHistory podHistory) { public void createOrUpdate(OmnipodHistoryRecord omnipodHistoryRecord) {
try { try {
getDaoPodHistory().createOrUpdate(podHistory); getDaoPodHistory().createOrUpdate(omnipodHistoryRecord);
} catch (SQLException e) { } catch (SQLException e) {
aapsLogger.error("Unhandled exception", e); aapsLogger.error("Unhandled exception", e);
} }
} }
public List<PodHistory> getPodHistoryFromTime(long from, boolean ascending) { public List<OmnipodHistoryRecord> getAllOmnipodHistoryRecordsFromTimeStamp(long from, boolean ascending) {
try { try {
Dao<PodHistory, Long> daoPodHistory = getDaoPodHistory(); Dao<OmnipodHistoryRecord, Long> daoPodHistory = getDaoPodHistory();
List<PodHistory> podHistories; List<OmnipodHistoryRecord> podHistories;
QueryBuilder<PodHistory, Long> queryBuilder = daoPodHistory.queryBuilder(); QueryBuilder<OmnipodHistoryRecord, Long> queryBuilder = daoPodHistory.queryBuilder();
queryBuilder.orderBy("date", ascending); queryBuilder.orderBy("date", ascending);
//queryBuilder.limit(100L); //queryBuilder.limit(100L);
Where where = queryBuilder.where(); Where where = queryBuilder.where();
where.ge("date", from); where.ge("date", from);
PreparedQuery<PodHistory> preparedQuery = queryBuilder.prepare(); PreparedQuery<OmnipodHistoryRecord> preparedQuery = queryBuilder.prepare();
podHistories = daoPodHistory.query(preparedQuery); podHistories = daoPodHistory.query(preparedQuery);
return podHistories; return podHistories;
} catch (SQLException e) { } catch (SQLException e) {

View file

@ -16,7 +16,8 @@ import info.nightscout.androidaps.interfaces.DatabaseHelperInterface;
@Singleton @Singleton
public class DatabaseHelperProvider implements DatabaseHelperInterface { public class DatabaseHelperProvider implements DatabaseHelperInterface {
@Inject DatabaseHelperProvider() {} @Inject DatabaseHelperProvider() {
}
@NotNull @Override public List<BgReading> getAllBgreadingsDataFromTime(long mills, boolean ascending) { @NotNull @Override public List<BgReading> getAllBgreadingsDataFromTime(long mills, boolean ascending) {
return MainApp.getDbHelper().getAllBgreadingsDataFromTime(mills, ascending); return MainApp.getDbHelper().getAllBgreadingsDataFromTime(mills, ascending);
@ -30,6 +31,10 @@ public class DatabaseHelperProvider implements DatabaseHelperInterface {
MainApp.getDbHelper().createOrUpdate(record); MainApp.getDbHelper().createOrUpdate(record);
} }
@Override public void createOrUpdate(@NotNull OmnipodHistoryRecord record) {
MainApp.getDbHelper().createOrUpdate(record);
}
@NotNull @Override public List<DanaRHistoryRecord> getDanaRHistoryRecordsByType(byte type) { @NotNull @Override public List<DanaRHistoryRecord> getDanaRHistoryRecordsByType(byte type) {
return MainApp.getDbHelper().getDanaRHistoryRecordsByType(type); return MainApp.getDbHelper().getDanaRHistoryRecordsByType(type);
} }
@ -86,10 +91,14 @@ public class DatabaseHelperProvider implements DatabaseHelperInterface {
return MainApp.getDbHelper().getTemporaryBasalsDataFromTime(mills, ascending); return MainApp.getDbHelper().getTemporaryBasalsDataFromTime(mills, ascending);
} }
@NotNull @Override public CareportalEvent getCareportalEventFromTimestamp(long timestamp) { @Override public CareportalEvent getCareportalEventFromTimestamp(long timestamp) {
return MainApp.getDbHelper().getCareportalEventFromTimestamp(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) { @NotNull @Override public List<TDD> getTDDsForLastXDays(int days) {
return MainApp.getDbHelper().getTDDsForLastXDays(days); return MainApp.getDbHelper().getTDDsForLastXDays(days);
} }

View file

@ -26,6 +26,7 @@ import javax.inject.Singleton
CommandQueueModule::class, CommandQueueModule::class,
ObjectivesModule::class, ObjectivesModule::class,
WizardModule::class, WizardModule::class,
RileyLinkModule::class,
MedtronicModule::class, MedtronicModule::class,
APSModule::class, APSModule::class,
PreferencesModule::class, PreferencesModule::class,

View file

@ -34,7 +34,6 @@ import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.dialog.RileyL
import info.nightscout.androidaps.plugins.pump.insight.LocalInsightFragment import info.nightscout.androidaps.plugins.pump.insight.LocalInsightFragment
import info.nightscout.androidaps.plugins.pump.medtronic.MedtronicFragment import info.nightscout.androidaps.plugins.pump.medtronic.MedtronicFragment
import info.nightscout.androidaps.plugins.pump.medtronic.dialog.RileyLinkStatusDeviceMedtronic import info.nightscout.androidaps.plugins.pump.medtronic.dialog.RileyLinkStatusDeviceMedtronic
import info.nightscout.androidaps.plugins.pump.omnipod.OmnipodFragment
import info.nightscout.androidaps.plugins.pump.virtual.VirtualPumpFragment import info.nightscout.androidaps.plugins.pump.virtual.VirtualPumpFragment
import info.nightscout.androidaps.plugins.source.BGSourceFragment import info.nightscout.androidaps.plugins.source.BGSourceFragment
import info.nightscout.androidaps.plugins.treatments.TreatmentsFragment import info.nightscout.androidaps.plugins.treatments.TreatmentsFragment
@ -66,7 +65,6 @@ abstract class FragmentsModule {
@ContributesAndroidInjector abstract fun contributesLoopFragment(): LoopFragment @ContributesAndroidInjector abstract fun contributesLoopFragment(): LoopFragment
@ContributesAndroidInjector abstract fun contributesMaintenanceFragment(): MaintenanceFragment @ContributesAndroidInjector abstract fun contributesMaintenanceFragment(): MaintenanceFragment
@ContributesAndroidInjector abstract fun contributesMedtronicFragment(): MedtronicFragment @ContributesAndroidInjector abstract fun contributesMedtronicFragment(): MedtronicFragment
@ContributesAndroidInjector abstract fun contributesOmnipodFragment(): OmnipodFragment
@ContributesAndroidInjector abstract fun contributesNSProfileFragment(): NSProfileFragment @ContributesAndroidInjector abstract fun contributesNSProfileFragment(): NSProfileFragment
@ContributesAndroidInjector abstract fun contributesNSClientFragment(): NSClientFragment @ContributesAndroidInjector abstract fun contributesNSClientFragment(): NSClientFragment
@ContributesAndroidInjector abstract fun contributesSmsCommunicatorFragment(): SmsCommunicatorFragment @ContributesAndroidInjector abstract fun contributesSmsCommunicatorFragment(): SmsCommunicatorFragment

View file

@ -2,33 +2,12 @@ package info.nightscout.androidaps.dependencyInjection
import dagger.Module import dagger.Module
import dagger.android.ContributesAndroidInjector 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.MedtronicCommunicationManager
import info.nightscout.androidaps.plugins.pump.medtronic.comm.ui.MedtronicUITask import info.nightscout.androidaps.plugins.pump.medtronic.comm.ui.MedtronicUITask
@Module @Module
@Suppress("unused") @Suppress("unused")
abstract class MedtronicModule { abstract class MedtronicModule {
@ContributesAndroidInjector abstract fun rileyLinkCommunicationManagerProvider(): RileyLinkCommunicationManager
@ContributesAndroidInjector abstract fun medtronicCommunicationManagerProvider(): MedtronicCommunicationManager @ContributesAndroidInjector abstract fun medtronicCommunicationManagerProvider(): MedtronicCommunicationManager
@ContributesAndroidInjector abstract fun medtronicUITaskProvider(): MedtronicUITask @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
} }

View file

@ -1,28 +0,0 @@
package info.nightscout.androidaps.dependencyInjection
import dagger.Module
import dagger.android.ContributesAndroidInjector
import info.nightscout.androidaps.plugins.pump.omnipod.comm.OmnipodCommunicationManager
import info.nightscout.androidaps.plugins.pump.omnipod.defs.state.PodSessionState
import info.nightscout.androidaps.plugins.pump.omnipod.dialogs.PodHistoryActivity
import info.nightscout.androidaps.plugins.pump.omnipod.dialogs.PodManagementActivity
import info.nightscout.androidaps.plugins.pump.omnipod.dialogs.wizard.pages.InitPodRefreshAction
import info.nightscout.androidaps.plugins.pump.omnipod.driver.comm.AapsOmnipodManager
import info.nightscout.androidaps.plugins.pump.omnipod.driver.ui.OmnipodUITask
@Module
@Suppress("unused")
abstract class OmnipodModule {
// Activities
@ContributesAndroidInjector abstract fun contributesPodManagementActivity(): PodManagementActivity
@ContributesAndroidInjector abstract fun contributesPodHistoryActivity(): PodHistoryActivity
@ContributesAndroidInjector abstract fun omnipodCommunicationManagerProvider(): OmnipodCommunicationManager
@ContributesAndroidInjector abstract fun omnipodUITaskProvider(): OmnipodUITask
@ContributesAndroidInjector abstract fun aapsOmnipodManagerProvider(): AapsOmnipodManager
@ContributesAndroidInjector abstract fun initPodRefreshAction(): InitPodRefreshAction
@ContributesAndroidInjector abstract fun podSessionState(): PodSessionState
}

View file

@ -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
}

View file

@ -10,7 +10,6 @@ import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.Riley
import info.nightscout.androidaps.plugins.pump.insight.InsightAlertService import info.nightscout.androidaps.plugins.pump.insight.InsightAlertService
import info.nightscout.androidaps.plugins.pump.insight.connection_service.InsightConnectionService import info.nightscout.androidaps.plugins.pump.insight.connection_service.InsightConnectionService
import info.nightscout.androidaps.plugins.pump.medtronic.service.RileyLinkMedtronicService import info.nightscout.androidaps.plugins.pump.medtronic.service.RileyLinkMedtronicService
import info.nightscout.androidaps.plugins.pump.omnipod.service.RileyLinkOmnipodService
import info.nightscout.androidaps.services.AlarmSoundService import info.nightscout.androidaps.services.AlarmSoundService
import info.nightscout.androidaps.services.DataService import info.nightscout.androidaps.services.DataService
import info.nightscout.androidaps.services.LocationService import info.nightscout.androidaps.services.LocationService
@ -30,5 +29,4 @@ abstract class ServicesModule {
@ContributesAndroidInjector abstract fun contributesInsightConnectionService(): InsightConnectionService @ContributesAndroidInjector abstract fun contributesInsightConnectionService(): InsightConnectionService
@ContributesAndroidInjector abstract fun contributesRileyLinkService(): RileyLinkService @ContributesAndroidInjector abstract fun contributesRileyLinkService(): RileyLinkService
@ContributesAndroidInjector abstract fun contributesRileyLinkMedtronicService(): RileyLinkMedtronicService @ContributesAndroidInjector abstract fun contributesRileyLinkMedtronicService(): RileyLinkMedtronicService
@ContributesAndroidInjector abstract fun contributesRileyLinkOmnipodService(): RileyLinkOmnipodService
} }

View file

@ -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.plugins.general.overview.StatusLightHandler
import info.nightscout.androidaps.queue.Callback import info.nightscout.androidaps.queue.Callback
import info.nightscout.androidaps.utils.FabricPrivacy 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.alertDialogs.OKDialog
import info.nightscout.androidaps.utils.buildHelper.BuildHelper import info.nightscout.androidaps.utils.buildHelper.BuildHelper
import info.nightscout.androidaps.utils.extensions.plusAssign import info.nightscout.androidaps.utils.extensions.plusAssign

View file

@ -1,458 +0,0 @@
package info.nightscout.androidaps.plugins.pump.omnipod
import android.content.Intent
import android.graphics.Color
import android.os.Bundle
import android.os.Handler
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
import info.nightscout.androidaps.logging.AAPSLogger
import info.nightscout.androidaps.logging.LTag
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
import info.nightscout.androidaps.plugins.pump.common.defs.PumpType
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkServiceState
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkTargetDevice
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.dialog.RileyLinkStatusActivity
import info.nightscout.androidaps.plugins.pump.omnipod.defs.OmnipodStatusRequest
import info.nightscout.androidaps.plugins.pump.omnipod.defs.PodDeviceState
import info.nightscout.androidaps.plugins.pump.omnipod.dialogs.PodManagementActivity
import info.nightscout.androidaps.plugins.pump.omnipod.driver.OmnipodDriverState
import info.nightscout.androidaps.plugins.pump.omnipod.driver.OmnipodPumpStatus
import info.nightscout.androidaps.plugins.pump.omnipod.events.EventOmnipodAcknowledgeAlertsChanged
import info.nightscout.androidaps.plugins.pump.omnipod.events.EventOmnipodDeviceStatusChange
import info.nightscout.androidaps.plugins.pump.omnipod.events.EventOmnipodPumpValuesChanged
import info.nightscout.androidaps.plugins.pump.omnipod.events.EventOmnipodRefreshButtonState
import info.nightscout.androidaps.plugins.pump.omnipod.util.OmnipodConst
import info.nightscout.androidaps.plugins.pump.omnipod.util.OmnipodUtil
import info.nightscout.androidaps.queue.Callback
import info.nightscout.androidaps.utils.DateUtil
import info.nightscout.androidaps.utils.FabricPrivacy
import info.nightscout.androidaps.utils.Round
import info.nightscout.androidaps.utils.T
import info.nightscout.androidaps.utils.WarnColors
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
import info.nightscout.androidaps.utils.resources.ResourceHelper
import info.nightscout.androidaps.utils.sharedPreferences.SP
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 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
@Inject lateinit var commandQueue: CommandQueueProvider
@Inject lateinit var activePlugin: ActivePluginProvider
@Inject lateinit var omnipodPumpPlugin: OmnipodPumpPlugin
@Inject lateinit var warnColors: WarnColors
@Inject lateinit var omnipodPumpStatus: OmnipodPumpStatus
@Inject lateinit var sp: SP
@Inject lateinit var omnipodUtil: OmnipodUtil
private var disposable: CompositeDisposable = CompositeDisposable()
private val loopHandler = Handler()
private lateinit var refreshLoop: Runnable
operator fun CompositeDisposable.plusAssign(disposable: Disposable) {
add(disposable)
}
init {
refreshLoop = Runnable {
activity?.runOnUiThread { updateGUI() }
loopHandler.postDelayed(refreshLoop, T.mins(1).msecs())
}
}
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
return inflater.inflate(R.layout.omnipod_fragment, container, false)
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
omnipod_rl_status.text = resourceHelper.gs(RileyLinkServiceState.NotStarted.getResourceId(RileyLinkTargetDevice.Omnipod))
omnipod_pod_status.setTextColor(Color.WHITE)
omnipod_pod_status.text = "{fa-bed}"
omnipod_pod_mgmt.setOnClickListener {
if (omnipodPumpPlugin.rileyLinkService?.verifyConfiguration() == true) {
startActivity(Intent(context, PodManagementActivity::class.java))
} else {
displayNotConfiguredDialog()
}
}
omnipod_refresh.setOnClickListener {
if (omnipodPumpPlugin.rileyLinkService?.verifyConfiguration() != true) {
displayNotConfiguredDialog()
} else {
omnipod_refresh.isEnabled = false
omnipodPumpPlugin.addPodStatusRequest(OmnipodStatusRequest.GetPodState);
commandQueue.readStatus("Clicked Refresh", object : Callback() {
override fun run() {
activity?.runOnUiThread { omnipod_refresh.isEnabled = true }
}
})
}
}
omnipod_stats.setOnClickListener {
if (omnipodPumpPlugin.rileyLinkService?.verifyConfiguration() == true) {
startActivity(Intent(context, RileyLinkStatusActivity::class.java))
} else {
displayNotConfiguredDialog()
}
}
omnipod_pod_active_alerts_ack.setOnClickListener {
if (omnipodPumpPlugin.rileyLinkService?.verifyConfiguration() != true) {
displayNotConfiguredDialog()
} else {
omnipod_pod_active_alerts_ack.isEnabled = false
omnipodPumpPlugin.addPodStatusRequest(OmnipodStatusRequest.AcknowledgeAlerts);
commandQueue.readStatus("Clicked Alert Ack", null)
}
}
omnipod_pod_debug.setOnClickListener {
if (omnipodPumpPlugin.rileyLinkService?.verifyConfiguration() != true) {
displayNotConfiguredDialog()
} else {
omnipod_pod_debug.isEnabled = false
omnipodPumpPlugin.addPodStatusRequest(OmnipodStatusRequest.GetPodPulseLog);
commandQueue.readStatus("Clicked Refresh", object : Callback() {
override fun run() {
activity?.runOnUiThread { omnipod_pod_debug.isEnabled = true }
}
})
}
}
omnipod_lastconnection.setTextColor(Color.WHITE)
setVisibilityOfPodDebugButton()
updateGUI()
}
override fun onResume() {
super.onResume()
loopHandler.postDelayed(refreshLoop, T.mins(1).msecs())
disposable += rxBus
.toObservable(EventOmnipodRefreshButtonState::class.java)
.observeOn(AndroidSchedulers.mainThread())
.subscribe({ omnipod_refresh.isEnabled = it.newState }, { fabricPrivacy.logException(it) })
disposable += rxBus
.toObservable(EventOmnipodDeviceStatusChange::class.java)
.observeOn(AndroidSchedulers.mainThread())
.subscribe({
aapsLogger.info(LTag.PUMP, "onStatusEvent(EventOmnipodDeviceStatusChange): {}", it)
setDeviceStatus()
}, { fabricPrivacy.logException(it) })
disposable += rxBus
.toObservable(EventOmnipodPumpValuesChanged::class.java)
.observeOn(AndroidSchedulers.mainThread())
.subscribe({ updateGUI() }, { fabricPrivacy.logException(it) })
disposable += rxBus
.toObservable(EventOmnipodAcknowledgeAlertsChanged::class.java)
.observeOn(AndroidSchedulers.mainThread())
.subscribe({ updateAcknowledgeAlerts() }, { fabricPrivacy.logException(it) })
disposable += rxBus
.toObservable(EventPreferenceChange::class.java)
.observeOn(Schedulers.io())
.subscribe({
setVisibilityOfPodDebugButton()
}, { fabricPrivacy.logException(it) })
}
fun setVisibilityOfPodDebugButton() {
val isEnabled = sp.getBoolean(OmnipodConst.Prefs.PodDebuggingOptionsEnabled, false)
if (isEnabled)
omnipod_pod_debug.visibility = View.VISIBLE
else
omnipod_pod_debug.visibility = View.GONE
}
private fun displayNotConfiguredDialog() {
context?.let {
OKDialog.show(it, resourceHelper.gs(R.string.combo_warning),
resourceHelper.gs(R.string.omnipod_error_operation_not_possible_no_configuration), null)
}
}
override fun onPause() {
super.onPause()
disposable.clear()
loopHandler.removeCallbacks(refreshLoop)
}
@Synchronized
private fun setDeviceStatus() {
//val omnipodPumpStatus: OmnipodPumpStatus = OmnipodUtil.getPumpStatus()
// omnipodPumpStatus.rileyLinkServiceState = checkStatusSet(omnipodPumpStatus.rileyLinkServiceState,
// RileyLinkUtil.getServiceState()) as RileyLinkServiceState?
aapsLogger.info(LTag.PUMP, "setDeviceStatus: [pumpStatus={}]", omnipodPumpStatus)
val resourceId = omnipodPumpStatus.rileyLinkServiceState.getResourceId(RileyLinkTargetDevice.Omnipod)
val rileyLinkError = omnipodPumpPlugin.rileyLinkService?.error
omnipod_rl_status.text =
when {
omnipodPumpStatus.rileyLinkServiceState == RileyLinkServiceState.NotStarted -> resourceHelper.gs(resourceId)
omnipodPumpStatus.rileyLinkServiceState.isConnecting -> "{fa-bluetooth-b spin} " + resourceHelper.gs(resourceId)
omnipodPumpStatus.rileyLinkServiceState.isError && rileyLinkError == null -> "{fa-bluetooth-b} " + resourceHelper.gs(resourceId)
omnipodPumpStatus.rileyLinkServiceState.isError && rileyLinkError != null -> "{fa-bluetooth-b} " + resourceHelper.gs(rileyLinkError.getResourceId(RileyLinkTargetDevice.MedtronicPump))
else -> "{fa-bluetooth-b} " + resourceHelper.gs(resourceId)
}
omnipod_rl_status.setTextColor(if (rileyLinkError != null) Color.RED else Color.WHITE)
// omnipodPumpStatus.rileyLinkError = checkStatusSet(omnipodPumpStatus.rileyLinkError,
// RileyLinkUtil.getError()) as RileyLinkError?
omnipod_errors.text =
omnipodPumpStatus.rileyLinkError?.let {
resourceHelper.gs(it.getResourceId(RileyLinkTargetDevice.Omnipod))
} ?: "-"
val driverState = omnipodUtil.getDriverState();
aapsLogger.info(LTag.PUMP, "getDriverState: [driverState={}]", driverState)
if (driverState == OmnipodDriverState.NotInitalized) {
omnipod_pod_address.text = resourceHelper.gs(R.string.omnipod_pod_name_no_info)
omnipod_pod_expiry.text = "-"
omnipod_pod_status.text = resourceHelper.gs(R.string.omnipod_pod_not_initalized)
omnipodPumpStatus.podAvailable = false
omnipodPumpStatus.podNumber == null
} else if (driverState == OmnipodDriverState.Initalized_NoPod) {
omnipod_pod_address.text = resourceHelper.gs(R.string.omnipod_pod_name_no_info)
omnipod_pod_expiry.text = "-"
omnipod_pod_status.text = resourceHelper.gs(R.string.omnipod_pod_no_pod_connected)
omnipodPumpStatus.podAvailable = false
omnipodPumpStatus.podNumber == null
} else if (driverState == OmnipodDriverState.Initalized_PodInitializing) {
omnipod_pod_address.text = omnipodPumpStatus.podSessionState.address.toString()
omnipod_pod_expiry.text = "-"
omnipod_pod_status.text = omnipodPumpStatus.podSessionState.getSetupProgress().name
omnipodPumpStatus.podAvailable = false
omnipodPumpStatus.podNumber == omnipodPumpStatus.podSessionState.address.toString()
} else {
omnipodPumpStatus.podLotNumber = "" + omnipodPumpStatus.podSessionState.lot
omnipodPumpStatus.podAvailable = true
omnipod_pod_address.text = omnipodPumpStatus.podSessionState.address.toString()
omnipod_pod_expiry.text = omnipodPumpStatus.podSessionState.expiryDateAsString
omnipodPumpStatus.podNumber = omnipodPumpStatus.podSessionState.address.toString()
//pumpStatus.podSessionState = checkStatusSet(pumpStatus.podSessionState,
// OmnipodUtil.getPodSessionState()) as PodSessionState?
var podDeviceState = omnipodPumpStatus.podDeviceState
when (podDeviceState) {
null,
PodDeviceState.Sleeping -> omnipod_pod_status.text = "{fa-bed} " // + pumpStatus.pumpDeviceState.name());
PodDeviceState.NeverContacted,
PodDeviceState.WakingUp,
PodDeviceState.PumpUnreachable,
PodDeviceState.ErrorWhenCommunicating,
PodDeviceState.TimeoutWhenCommunicating,
PodDeviceState.InvalidConfiguration -> omnipod_pod_status.text = " " + resourceHelper.gs(podDeviceState.resourceId)
PodDeviceState.Active -> {
omnipod_pod_status.text = "Active";
// val cmd = OmnipodUtil.getCurrentCommand()
// if (cmd == null)
// omnipod_pod_status.text = " " + resourceHelper.gs(pumpStatus.pumpDeviceState.resourceId)
// else {
// aapsLogger.debug(LTag.PUMP,"Command: " + cmd)
// val cmdResourceId = cmd.resourceId
// if (cmd == MedtronicCommandType.GetHistoryData) {
// omnipod_pod_status.text = OmnipodUtil.frameNumber?.let {
// resourceHelper.gs(cmdResourceId, OmnipodUtil.pageNumber, OmnipodUtil.frameNumber)
// }
// ?: resourceHelper.gs(R.string.medtronic_cmd_desc_get_history_request, OmnipodUtil.pageNumber)
// } else {
// omnipod_pod_status.text = " " + (cmdResourceId?.let { resourceHelper.gs(it) }
// ?: cmd.getCommandDescription())
// }
// }
}
else -> aapsLogger.warn(LTag.PUMP, "Unknown pump state: " + omnipodPumpStatus.podDeviceState)
}
}
// pumpStatus.pumpDeviceState = checkStatusSet(pumpStatus.pumpDeviceState,
// OmnipodUtil.getPumpDeviceState()) as PumpDeviceState?
//
// when (pumpStatus.pumpDeviceState) {
// null,
// PumpDeviceState.Sleeping -> omnipod_pod_status.text = "{fa-bed} " // + pumpStatus.pumpDeviceState.name());
// PumpDeviceState.NeverContacted,
// PumpDeviceState.WakingUp,
// PumpDeviceState.PumpUnreachable,
// PumpDeviceState.ErrorWhenCommunicating,
// PumpDeviceState.TimeoutWhenCommunicating,
// PumpDeviceState.InvalidConfiguration -> omnipod_pod_status.text = " " + resourceHelper.gs(pumpStatus.pumpDeviceState.resourceId)
// PumpDeviceState.Active -> {
// val cmd = OmnipodUtil.getCurrentCommand()
// if (cmd == null)
// omnipod_pod_status.text = " " + resourceHelper.gs(pumpStatus.pumpDeviceState.resourceId)
// else {
// aapsLogger.debug(LTag.PUMP,"Command: " + cmd)
// val cmdResourceId = cmd.resourceId
// if (cmd == MedtronicCommandType.GetHistoryData) {
// omnipod_pod_status.text = OmnipodUtil.frameNumber?.let {
// resourceHelper.gs(cmdResourceId, OmnipodUtil.pageNumber, OmnipodUtil.frameNumber)
// }
// ?: resourceHelper.gs(R.string.medtronic_cmd_desc_get_history_request, OmnipodUtil.pageNumber)
// } else {
// omnipod_pod_status.text = " " + (cmdResourceId?.let { resourceHelper.gs(it) }
// ?: cmd.getCommandDescription())
// }
// }
// }
// else -> aapsLogger.warn(LTag.PUMP,"Unknown pump state: " + pumpStatus.pumpDeviceState)
// }
val status = commandQueue.spannedStatus()
if (status.toString() == "") {
omnipod_queue.visibility = View.GONE
} else {
omnipod_queue.visibility = View.VISIBLE
omnipod_queue.text = status
}
}
private fun checkStatusSet(object1: Any?, object2: Any?): Any? {
return if (object1 == null) {
object2
} else {
if (object1 != object2) {
object2
} else
object1
}
}
// GUI functions
fun updateGUI() {
val plugin = omnipodPumpPlugin
//val omnipodPumpStatus = OmnipodUtil.getPumpStatus()
var pumpType = omnipodPumpStatus.pumpType
if (pumpType == null) {
aapsLogger.warn(LTag.PUMP, "PumpType was not set, reseting to Omnipod.")
pumpType = PumpType.Insulet_Omnipod;
}
setDeviceStatus()
if (omnipodPumpStatus.podAvailable) {
// last connection
if (omnipodPumpStatus.lastConnection != 0L) {
//val minAgo = DateUtil.minAgo(pumpStatus.lastConnection)
val min = (System.currentTimeMillis() - omnipodPumpStatus.lastConnection) / 1000 / 60
if (omnipodPumpStatus.lastConnection + 60 * 1000 > System.currentTimeMillis()) {
omnipod_lastconnection.setText(R.string.combo_pump_connected_now)
//omnipod_lastconnection.setTextColor(Color.WHITE)
} else { //if (pumpStatus.lastConnection + 30 * 60 * 1000 < System.currentTimeMillis()) {
if (min < 60) {
omnipod_lastconnection.text = resourceHelper.gs(R.string.minago, min)
} else if (min < 1440) {
val h = (min / 60).toInt()
omnipod_lastconnection.text = (resourceHelper.gq(R.plurals.objective_hours, h, h) + " "
+ resourceHelper.gs(R.string.ago))
} else {
val h = (min / 60).toInt()
val d = h / 24
// h = h - (d * 24);
omnipod_lastconnection.text = (resourceHelper.gq(R.plurals.objective_days, d, d) + " "
+ resourceHelper.gs(R.string.ago))
}
//omnipod_lastconnection.setTextColor(Color.RED)
}
// } else {
// omnipod_lastconnection.text = minAgo
// //omnipod_lastconnection.setTextColor(Color.WHITE)
// }
}
// last bolus
val bolus = omnipodPumpStatus.lastBolusAmount
val bolusTime = omnipodPumpStatus.lastBolusTime
if (bolus != null && bolusTime != null && omnipodPumpStatus.podAvailable) {
val agoMsc = System.currentTimeMillis() - omnipodPumpStatus.lastBolusTime.time
val bolusMinAgo = agoMsc.toDouble() / 60.0 / 1000.0
val unit = resourceHelper.gs(R.string.insulin_unit_shortname)
val ago: String
if (agoMsc < 60 * 1000) {
ago = resourceHelper.gs(R.string.combo_pump_connected_now)
} else if (bolusMinAgo < 60) {
ago = DateUtil.minAgo(resourceHelper, omnipodPumpStatus.lastBolusTime.time)
} else {
ago = DateUtil.hourAgo(omnipodPumpStatus.lastBolusTime.time, resourceHelper)
}
omnipod_lastbolus.text = resourceHelper.gs(R.string.omnipod_last_bolus, pumpType.determineCorrectBolusSize(bolus), unit, ago)
} else {
omnipod_lastbolus.text = ""
}
// base basal rate
omnipod_basabasalrate.text = resourceHelper.gs(R.string.pump_basebasalrate, pumpType.determineCorrectBasalSize(plugin.baseBasalRate))
omnipod_tempbasal.text = activePlugin.activeTreatments
.getTempBasalFromHistory(System.currentTimeMillis())?.toStringFull() ?: ""
// reservoir
if (Round.isSame(omnipodPumpStatus.reservoirRemainingUnits, 75.0)) {
omnipod_reservoir.text = resourceHelper.gs(R.string.omnipod_reservoir_over50)
} else {
omnipod_reservoir.text = resourceHelper.gs(R.string.omnipod_reservoir_left, omnipodPumpStatus.reservoirRemainingUnits)
}
warnColors.setColorInverse(omnipod_reservoir, omnipodPumpStatus.reservoirRemainingUnits, 50.0, 20.0)
} else {
omnipod_basabasalrate.text = ""
omnipod_reservoir.text = ""
omnipod_tempbasal.text = ""
omnipod_lastbolus.text = ""
omnipod_lastconnection.text = ""
omnipod_lastconnection.setTextColor(Color.WHITE)
}
omnipod_errors.text = omnipodPumpStatus.errorInfo
updateAcknowledgeAlerts()
omnipod_refresh.isEnabled = omnipodPumpStatus.podAvailable
}
private fun updateAcknowledgeAlerts() {
omnipod_pod_active_alerts_ack.isEnabled = omnipodPumpStatus.ackAlertsAvailable
omnipod_pod_active_alerts.text = omnipodPumpStatus.ackAlertsText
}
}

View file

@ -1,7 +0,0 @@
package info.nightscout.androidaps.plugins.pump.omnipod.comm;
// TODO replace with Consumer when our min API level >= 24
@FunctionalInterface
public interface BolusProgressIndicationConsumer {
void accept(double estimatedUnitsDelivered, int percentage);
}

View file

@ -1,54 +0,0 @@
package info.nightscout.androidaps.plugins.pump.omnipod.comm.action;
import org.joda.time.DateTimeZone;
import java.util.Collections;
import info.nightscout.androidaps.plugins.pump.omnipod.comm.OmnipodCommunicationManager;
import info.nightscout.androidaps.plugins.pump.omnipod.comm.exception.IllegalMessageAddressException;
import info.nightscout.androidaps.plugins.pump.omnipod.comm.exception.IllegalVersionResponseTypeException;
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.OmnipodMessage;
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.command.AssignAddressCommand;
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.response.VersionResponse;
import info.nightscout.androidaps.plugins.pump.omnipod.defs.state.PodSessionState;
import info.nightscout.androidaps.plugins.pump.omnipod.defs.state.PodSetupState;
import info.nightscout.androidaps.plugins.pump.omnipod.defs.state.PodStateChangedHandler;
import info.nightscout.androidaps.plugins.pump.omnipod.util.OmnipodConst;
public class AssignAddressAction implements OmnipodAction<PodSessionState> {
private final int address;
private final PodStateChangedHandler podStateChangedHandler;
public AssignAddressAction(PodStateChangedHandler podStateChangedHandler, int address) {
this.address = address;
this.podStateChangedHandler = podStateChangedHandler;
}
@Override
public PodSessionState execute(OmnipodCommunicationManager communicationService) {
PodSetupState setupState = new PodSetupState(address, 0x00, 0x00);
AssignAddressCommand assignAddress = new AssignAddressCommand(setupState.getAddress());
OmnipodMessage assignAddressMessage = new OmnipodMessage(OmnipodConst.DEFAULT_ADDRESS,
Collections.singletonList(assignAddress), setupState.getMessageNumber());
VersionResponse assignAddressResponse = communicationService.exchangeMessages(VersionResponse.class, setupState, assignAddressMessage,
OmnipodConst.DEFAULT_ADDRESS, setupState.getAddress());
if (!assignAddressResponse.isAssignAddressVersionResponse()) {
throw new IllegalVersionResponseTypeException("assignAddress", "setupPod");
}
if (assignAddressResponse.getAddress() != address) {
throw new IllegalMessageAddressException(address, assignAddressResponse.getAddress());
}
DateTimeZone timeZone = DateTimeZone.getDefault();
PodSessionState podState = new PodSessionState(timeZone, address, assignAddressResponse.getPiVersion(),
assignAddressResponse.getPmVersion(), assignAddressResponse.getLot(), assignAddressResponse.getTid(),
setupState.getPacketNumber(), 0x00, communicationService.injector); // At this point, for an unknown reason, the pod starts counting messages from 0 again
podState.setStateChangedHandler(podStateChangedHandler);
return podState;
}
}

View file

@ -1,71 +0,0 @@
package info.nightscout.androidaps.plugins.pump.omnipod.comm.action;
import info.nightscout.androidaps.logging.AAPSLogger;
import info.nightscout.androidaps.logging.LTag;
import info.nightscout.androidaps.plugins.pump.omnipod.comm.OmnipodCommunicationManager;
import info.nightscout.androidaps.plugins.pump.omnipod.comm.action.service.InsertCannulaService;
import info.nightscout.androidaps.plugins.pump.omnipod.comm.exception.ActionInitializationException;
import info.nightscout.androidaps.plugins.pump.omnipod.comm.exception.IllegalSetupProgressException;
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.response.StatusResponse;
import info.nightscout.androidaps.plugins.pump.omnipod.defs.SetupProgress;
import info.nightscout.androidaps.plugins.pump.omnipod.defs.schedule.BasalSchedule;
import info.nightscout.androidaps.plugins.pump.omnipod.defs.state.PodSessionState;
public class InsertCannulaAction implements OmnipodAction<StatusResponse> {
private final PodSessionState podState;
private final InsertCannulaService service;
private final BasalSchedule initialBasalSchedule;
public InsertCannulaAction(InsertCannulaService insertCannulaService, PodSessionState podState, BasalSchedule initialBasalSchedule) {
if (insertCannulaService == null) {
throw new ActionInitializationException("Insert cannula service cannot be null");
}
if (podState == null) {
throw new ActionInitializationException("Pod state cannot be null");
}
if (initialBasalSchedule == null) {
throw new ActionInitializationException("Initial basal schedule cannot be null");
}
this.service = insertCannulaService;
this.podState = podState;
this.initialBasalSchedule = initialBasalSchedule;
}
public static void updateCannulaInsertionStatus(PodSessionState podState, StatusResponse statusResponse, AAPSLogger aapsLogger) {
if (podState.getSetupProgress().equals(SetupProgress.CANNULA_INSERTING) &&
statusResponse.getPodProgressStatus().isReadyForDelivery()) {
aapsLogger.debug(LTag.PUMPBTCOMM, "Updating SetupProgress from CANNULA_INSERTING to COMPLETED");
podState.setSetupProgress(SetupProgress.COMPLETED);
}
}
@Override
public StatusResponse execute(OmnipodCommunicationManager communicationService) {
if (podState.getSetupProgress().isBefore(SetupProgress.PRIMING_FINISHED)) {
throw new IllegalSetupProgressException(SetupProgress.PRIMING_FINISHED, podState.getSetupProgress());
}
if (podState.getSetupProgress().isBefore(SetupProgress.INITIAL_BASAL_SCHEDULE_SET)) {
service.programInitialBasalSchedule(communicationService, podState, initialBasalSchedule);
podState.setSetupProgress(SetupProgress.INITIAL_BASAL_SCHEDULE_SET);
}
if (podState.getSetupProgress().isBefore(SetupProgress.STARTING_INSERT_CANNULA)) {
service.executeExpirationRemindersAlertCommand(communicationService, podState);
podState.setSetupProgress(SetupProgress.STARTING_INSERT_CANNULA);
}
if (podState.getSetupProgress().isBefore(SetupProgress.CANNULA_INSERTING)) {
StatusResponse statusResponse = service.executeInsertionBolusCommand(communicationService, podState);
podState.setSetupProgress(SetupProgress.CANNULA_INSERTING);
return statusResponse;
} else if (podState.getSetupProgress().equals(SetupProgress.CANNULA_INSERTING)) {
// Check status
StatusResponse statusResponse = communicationService.executeAction(new GetStatusAction(podState));
updateCannulaInsertionStatus(podState, statusResponse, communicationService.aapsLogger);
return statusResponse;
} else {
throw new IllegalSetupProgressException(null, podState.getSetupProgress());
}
}
}

View file

@ -1,61 +0,0 @@
package info.nightscout.androidaps.plugins.pump.omnipod.comm.action;
import info.nightscout.androidaps.logging.AAPSLogger;
import info.nightscout.androidaps.logging.LTag;
import info.nightscout.androidaps.plugins.pump.omnipod.comm.OmnipodCommunicationManager;
import info.nightscout.androidaps.plugins.pump.omnipod.comm.action.service.PrimeService;
import info.nightscout.androidaps.plugins.pump.omnipod.comm.exception.ActionInitializationException;
import info.nightscout.androidaps.plugins.pump.omnipod.comm.exception.IllegalSetupProgressException;
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.response.StatusResponse;
import info.nightscout.androidaps.plugins.pump.omnipod.defs.PodProgressStatus;
import info.nightscout.androidaps.plugins.pump.omnipod.defs.SetupProgress;
import info.nightscout.androidaps.plugins.pump.omnipod.defs.state.PodSessionState;
public class PrimeAction implements OmnipodAction<StatusResponse> {
private final PrimeService service;
private final PodSessionState podState;
public PrimeAction(PrimeService primeService, PodSessionState podState) {
if (primeService == null) {
throw new ActionInitializationException("Prime service cannot be null");
}
if (podState == null) {
throw new ActionInitializationException("Pod state cannot be null");
}
this.service = primeService;
this.podState = podState;
}
public static void updatePrimingStatus(PodSessionState podState, StatusResponse statusResponse, AAPSLogger aapsLogger) {
if (podState.getSetupProgress().equals(SetupProgress.PRIMING) && statusResponse.getPodProgressStatus().equals(PodProgressStatus.PRIMING_COMPLETED)) {
aapsLogger.debug(LTag.PUMPBTCOMM, "Updating SetupProgress from PRIMING to PRIMING_FINISHED");
podState.setSetupProgress(SetupProgress.PRIMING_FINISHED);
}
}
@Override
public StatusResponse execute(OmnipodCommunicationManager communicationService) {
if (podState.getSetupProgress().isBefore(SetupProgress.POD_CONFIGURED)) {
throw new IllegalSetupProgressException(SetupProgress.POD_CONFIGURED, podState.getSetupProgress());
}
if (podState.getSetupProgress().isBefore(SetupProgress.STARTING_PRIME)) {
service.executeDisableTab5Sub16FaultConfigCommand(communicationService, podState);
service.executeFinishSetupReminderAlertCommand(communicationService, podState);
podState.setSetupProgress(SetupProgress.STARTING_PRIME);
}
if (podState.getSetupProgress().isBefore(SetupProgress.PRIMING)) {
StatusResponse statusResponse = service.executePrimeBolusCommand(communicationService, podState);
podState.setSetupProgress(SetupProgress.PRIMING);
return statusResponse;
} else if (podState.getSetupProgress().equals(SetupProgress.PRIMING)) {
// Check status
StatusResponse statusResponse = communicationService.executeAction(new GetStatusAction(podState));
updatePrimingStatus(podState, statusResponse, communicationService.aapsLogger);
return statusResponse;
} else {
throw new IllegalSetupProgressException(null, podState.getSetupProgress());
}
}
}

View file

@ -1,67 +0,0 @@
package info.nightscout.androidaps.plugins.pump.omnipod.comm.action;
import org.joda.time.DateTime;
import java.util.Collections;
import info.nightscout.androidaps.plugins.pump.omnipod.comm.OmnipodCommunicationManager;
import info.nightscout.androidaps.plugins.pump.omnipod.comm.exception.IllegalMessageAddressException;
import info.nightscout.androidaps.plugins.pump.omnipod.comm.exception.IllegalPacketTypeException;
import info.nightscout.androidaps.plugins.pump.omnipod.comm.exception.IllegalPodProgressException;
import info.nightscout.androidaps.plugins.pump.omnipod.comm.exception.IllegalSetupProgressException;
import info.nightscout.androidaps.plugins.pump.omnipod.comm.exception.IllegalVersionResponseTypeException;
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.OmnipodMessage;
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.command.SetupPodCommand;
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.response.VersionResponse;
import info.nightscout.androidaps.plugins.pump.omnipod.defs.PacketType;
import info.nightscout.androidaps.plugins.pump.omnipod.defs.PodProgressStatus;
import info.nightscout.androidaps.plugins.pump.omnipod.defs.SetupProgress;
import info.nightscout.androidaps.plugins.pump.omnipod.defs.state.PodSessionState;
import info.nightscout.androidaps.plugins.pump.omnipod.util.OmnipodConst;
public class SetupPodAction implements OmnipodAction<VersionResponse> {
private final PodSessionState podState;
public SetupPodAction(PodSessionState podState) {
this.podState = podState;
}
@Override
public VersionResponse execute(OmnipodCommunicationManager communicationService) {
if (!podState.getSetupProgress().equals(SetupProgress.ADDRESS_ASSIGNED)) {
throw new IllegalSetupProgressException(SetupProgress.ADDRESS_ASSIGNED, podState.getSetupProgress());
}
DateTime activationDate = DateTime.now(podState.getTimeZone());
SetupPodCommand setupPodCommand = new SetupPodCommand(podState.getAddress(), activationDate,
podState.getLot(), podState.getTid());
OmnipodMessage message = new OmnipodMessage(OmnipodConst.DEFAULT_ADDRESS,
Collections.singletonList(setupPodCommand), podState.getMessageNumber());
VersionResponse setupPodResponse;
try {
setupPodResponse = communicationService.exchangeMessages(VersionResponse.class, podState,
message, OmnipodConst.DEFAULT_ADDRESS, podState.getAddress());
} catch (IllegalPacketTypeException ex) {
if (PacketType.ACK.equals(ex.getActual())) {
// Pod is already configured
podState.setSetupProgress(SetupProgress.POD_CONFIGURED);
return null;
}
throw ex;
}
if (!setupPodResponse.isSetupPodVersionResponse()) {
throw new IllegalVersionResponseTypeException("setupPod", "assignAddress");
}
if (setupPodResponse.getAddress() != podState.getAddress()) {
throw new IllegalMessageAddressException(podState.getAddress(), setupPodResponse.getAddress());
}
if (setupPodResponse.getPodProgressStatus() != PodProgressStatus.PAIRING_COMPLETED) {
throw new IllegalPodProgressException(PodProgressStatus.PAIRING_COMPLETED, setupPodResponse.getPodProgressStatus());
}
podState.setSetupProgress(SetupProgress.POD_CONFIGURED);
return setupPodResponse;
}
}

View file

@ -1,26 +0,0 @@
package info.nightscout.androidaps.plugins.pump.omnipod.comm.exception;
import java.util.Locale;
import info.nightscout.androidaps.plugins.pump.omnipod.defs.SetupProgress;
import info.nightscout.androidaps.plugins.pump.omnipod.exception.OmnipodException;
public class IllegalSetupProgressException extends OmnipodException {
private final SetupProgress expected;
private final SetupProgress actual;
public IllegalSetupProgressException(SetupProgress expected, SetupProgress actual) {
super(String.format(Locale.getDefault(), "Illegal setup progress: %s, expected: %s", actual, expected), true);
this.expected = expected;
this.actual = actual;
}
public SetupProgress getExpected() {
return expected;
}
public SetupProgress getActual() {
return actual;
}
}

View file

@ -1,6 +0,0 @@
package info.nightscout.androidaps.plugins.pump.omnipod.defs;
public enum OmnipodPodType {
Eros, //
Dash
}

View file

@ -1,38 +0,0 @@
package info.nightscout.androidaps.plugins.pump.omnipod.defs;
import info.nightscout.androidaps.R;
/**
* Created by andy on 4.8.2019
*/
// TODO remove this class and use PumpDeviceState instead
public enum PodDeviceState {
// FIXME
NeverContacted(R.string.medtronic_pump_status_never_contacted), //
Sleeping(R.string.medtronic_pump_status_sleeping), //
WakingUp(R.string.medtronic_pump_status_waking_up), //
Active(R.string.medtronic_pump_status_active), //
ErrorWhenCommunicating(R.string.medtronic_pump_status_error_comm), //
TimeoutWhenCommunicating(R.string.medtronic_pump_status_timeout_comm), //
// ProblemContacting(R.string.medtronic_pump_status_problem_contacting), //
PumpUnreachable(R.string.medtronic_pump_status_pump_unreachable), //
InvalidConfiguration(R.string.medtronic_pump_status_invalid_config);
Integer resourceId = null;
PodDeviceState() {
}
PodDeviceState(int resourceId) {
this.resourceId = resourceId;
}
public Integer getResourceId() {
return resourceId;
}
}

View file

@ -1,21 +0,0 @@
package info.nightscout.androidaps.plugins.pump.omnipod.defs;
public enum SetupProgress {
ADDRESS_ASSIGNED,
POD_CONFIGURED,
STARTING_PRIME,
PRIMING,
PRIMING_FINISHED,
INITIAL_BASAL_SCHEDULE_SET,
STARTING_INSERT_CANNULA,
CANNULA_INSERTING,
COMPLETED;
public boolean isBefore(SetupProgress other) {
return this.ordinal() < other.ordinal();
}
public boolean isAfter(SetupProgress other) {
return this.ordinal() > other.ordinal();
}
}

View file

@ -1,306 +0,0 @@
package info.nightscout.androidaps.plugins.pump.omnipod.defs.state;
import com.google.gson.Gson;
import org.joda.time.DateTime;
import org.joda.time.DateTimeZone;
import org.joda.time.Duration;
import java.util.HashMap;
import java.util.Map;
import javax.inject.Inject;
import dagger.android.HasAndroidInjector;
import info.nightscout.androidaps.logging.AAPSLogger;
import info.nightscout.androidaps.logging.LTag;
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.response.StatusResponse;
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.response.podinfo.PodInfoFaultEvent;
import info.nightscout.androidaps.plugins.pump.omnipod.defs.AlertSet;
import info.nightscout.androidaps.plugins.pump.omnipod.defs.AlertSlot;
import info.nightscout.androidaps.plugins.pump.omnipod.defs.AlertType;
import info.nightscout.androidaps.plugins.pump.omnipod.defs.DeliveryStatus;
import info.nightscout.androidaps.plugins.pump.omnipod.defs.FirmwareVersion;
import info.nightscout.androidaps.plugins.pump.omnipod.defs.NonceState;
import info.nightscout.androidaps.plugins.pump.omnipod.defs.SetupProgress;
import info.nightscout.androidaps.plugins.pump.omnipod.defs.schedule.BasalSchedule;
import info.nightscout.androidaps.plugins.pump.omnipod.util.OmniCRC;
import info.nightscout.androidaps.plugins.pump.omnipod.util.OmnipodConst;
import info.nightscout.androidaps.plugins.pump.omnipod.util.OmnipodUtil;
import info.nightscout.androidaps.utils.DateUtil;
import info.nightscout.androidaps.utils.sharedPreferences.SP;
public class PodSessionState extends PodState {
@Inject transient AAPSLogger aapsLogger;
@Inject transient SP sp;
@Inject transient OmnipodUtil omnipodUtil;
@Inject transient DateUtil dateUtil;
private transient PodStateChangedHandler stateChangedHandler;
// TODO
// the problem you have with injection in this class is that you are mixing
// data storing and handlind. Move these member variables to extra class you can
// easy serialize and load it here by setData(dataInOtherClass)
private final Map<AlertSlot, AlertType> configuredAlerts;
private DateTimeZone timeZone;
private DateTime activatedAt;
private DateTime expiresAt;
private final FirmwareVersion piVersion;
private final FirmwareVersion pmVersion;
private final int lot;
private final int tid;
private Double reservoirLevel;
private boolean suspended;
private NonceState nonceState;
private SetupProgress setupProgress;
private AlertSet activeAlerts;
private BasalSchedule basalSchedule;
private DeliveryStatus lastDeliveryStatus;
public PodSessionState(DateTimeZone timeZone, int address, FirmwareVersion piVersion,
FirmwareVersion pmVersion, int lot, int tid, int packetNumber, int messageNumber, HasAndroidInjector injector) {
super(address, messageNumber, packetNumber);
injectDaggerClass(injector);
if (timeZone == null) {
throw new IllegalArgumentException("Time zone can not be null");
}
suspended = false;
configuredAlerts = new HashMap<>();
configuredAlerts.put(AlertSlot.SLOT7, AlertType.FINISH_SETUP_REMINDER);
this.timeZone = timeZone;
this.setupProgress = SetupProgress.ADDRESS_ASSIGNED;
this.piVersion = piVersion;
this.pmVersion = pmVersion;
this.lot = lot;
this.tid = tid;
this.nonceState = new NonceState(lot, tid);
handleUpdates();
}
@Deprecated
public void injectDaggerClass(HasAndroidInjector injector) {
injector.androidInjector().inject(this);
}
@Deprecated
public void setStateChangedHandler(PodStateChangedHandler handler) {
// FIXME this is an ugly workaround for not being able to serialize the PodStateChangedHandler
if (stateChangedHandler != null) {
throw new IllegalStateException("A PodStateChangedHandler has already been already registered");
}
stateChangedHandler = handler;
}
public AlertType getConfiguredAlertType(AlertSlot alertSlot) {
return configuredAlerts.get(alertSlot);
}
public void putConfiguredAlert(AlertSlot alertSlot, AlertType alertType) {
configuredAlerts.put(alertSlot, alertType);
handleUpdates();
}
public void removeConfiguredAlert(AlertSlot alertSlot) {
configuredAlerts.remove(alertSlot);
handleUpdates();
}
public DateTime getActivatedAt() {
return activatedAt == null ? null : activatedAt.withZone(timeZone);
}
public DateTime getExpiresAt() {
return expiresAt == null ? null : expiresAt.withZone(timeZone);
}
public String getExpiryDateAsString() {
return expiresAt == null ? "???" : dateUtil.dateAndTimeString(expiresAt.toDate());
}
public FirmwareVersion getPiVersion() {
return piVersion;
}
public FirmwareVersion getPmVersion() {
return pmVersion;
}
public int getLot() {
return lot;
}
public int getTid() {
return tid;
}
public Double getReservoirLevel() {
return reservoirLevel;
}
public synchronized void resyncNonce(int syncWord, int sentNonce, int sequenceNumber) {
int sum = (sentNonce & 0xFFFF)
+ OmniCRC.crc16lookup[sequenceNumber]
+ (this.lot & 0xFFFF)
+ (this.tid & 0xFFFF);
int seed = ((sum & 0xFFFF) ^ syncWord);
this.nonceState = new NonceState(lot, tid, (byte) (seed & 0xFF));
handleUpdates();
}
public int getCurrentNonce() {
return nonceState.getCurrentNonce();
}
public synchronized void advanceToNextNonce() {
nonceState.advanceToNextNonce();
handleUpdates();
}
public SetupProgress getSetupProgress() {
return setupProgress;
}
public synchronized void setSetupProgress(SetupProgress setupProgress) {
if (setupProgress == null) {
throw new IllegalArgumentException("Setup state cannot be null");
}
this.setupProgress = setupProgress;
handleUpdates();
}
public boolean isSuspended() {
return suspended;
}
public boolean hasActiveAlerts() {
return activeAlerts != null && activeAlerts.size() > 0;
}
public AlertSet getActiveAlerts() {
return activeAlerts;
}
public DateTimeZone getTimeZone() {
return timeZone;
}
public void setTimeZone(DateTimeZone timeZone) {
if (timeZone == null) {
throw new IllegalArgumentException("Time zone can not be null");
}
this.timeZone = timeZone;
handleUpdates();
}
public DateTime getTime() {
DateTime now = DateTime.now();
return now.withZone(timeZone);
}
public Duration getScheduleOffset() {
DateTime now = getTime();
DateTime startOfDay = new DateTime(now.getYear(), now.getMonthOfYear(), now.getDayOfMonth(),
0, 0, 0, timeZone);
return new Duration(startOfDay, now);
}
public boolean hasNonceState() {
return true;
}
@Override
public void setPacketNumber(int packetNumber) {
super.setPacketNumber(packetNumber);
handleUpdates();
}
@Override
public void setMessageNumber(int messageNumber) {
super.setMessageNumber(messageNumber);
handleUpdates();
}
public BasalSchedule getBasalSchedule() {
return basalSchedule;
}
public void setBasalSchedule(BasalSchedule basalSchedule) {
this.basalSchedule = basalSchedule;
handleUpdates();
}
public DeliveryStatus getLastDeliveryStatus() {
return lastDeliveryStatus;
}
@Override
public void setFaultEvent(PodInfoFaultEvent faultEvent) {
super.setFaultEvent(faultEvent);
suspended = true;
handleUpdates();
}
@Override
public void updateFromStatusResponse(StatusResponse statusResponse) {
DateTime activatedAtCalculated = getTime().minus(statusResponse.getTimeActive());
if (activatedAt == null) {
activatedAt = activatedAtCalculated;
}
DateTime expiresAtCalculated = activatedAtCalculated.plus(OmnipodConst.NOMINAL_POD_LIFE);
if (expiresAt == null || expiresAtCalculated.isBefore(expiresAt) || expiresAtCalculated.isAfter(expiresAt.plusMinutes(1))) {
expiresAt = expiresAtCalculated;
}
boolean newSuspendedState = statusResponse.getDeliveryStatus() == DeliveryStatus.SUSPENDED;
if (suspended != newSuspendedState) {
aapsLogger.info(LTag.PUMPCOMM, "Updating pod suspended state in updateFromStatusResponse. newSuspendedState={}, statusResponse={}", newSuspendedState, statusResponse.toString());
suspended = newSuspendedState;
}
activeAlerts = statusResponse.getAlerts();
lastDeliveryStatus = statusResponse.getDeliveryStatus();
reservoirLevel = statusResponse.getReservoirLevel();
handleUpdates();
}
private void handleUpdates() {
Gson gson = omnipodUtil.getGsonInstance();
String gsonValue = gson.toJson(this);
aapsLogger.info(LTag.PUMPCOMM, "PodSessionState-SP: Saved Session State to SharedPreferences: " + gsonValue);
sp.putString(OmnipodConst.Prefs.PodState, gsonValue);
if (stateChangedHandler != null) {
stateChangedHandler.handle(this);
}
}
@Override
public String toString() {
return "PodSessionState{" +
"configuredAlerts=" + configuredAlerts +
", stateChangedHandler=" + stateChangedHandler +
", activatedAt=" + activatedAt +
", expiresAt=" + expiresAt +
", piVersion=" + piVersion +
", pmVersion=" + pmVersion +
", lot=" + lot +
", tid=" + tid +
", reservoirLevel=" + reservoirLevel +
", suspended=" + suspended +
", timeZone=" + timeZone +
", nonceState=" + nonceState +
", setupProgress=" + setupProgress +
", activeAlerts=" + activeAlerts +
", basalSchedule=" + basalSchedule +
", lastDeliveryStatus=" + lastDeliveryStatus +
", address=" + address +
", packetNumber=" + packetNumber +
", messageNumber=" + messageNumber +
", faultEvent=" + faultEvent +
'}';
}
}

View file

@ -1,43 +0,0 @@
package info.nightscout.androidaps.plugins.pump.omnipod.defs.state;
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.response.StatusResponse;
public class PodSetupState extends PodState {
public PodSetupState(int address, int packetNumber, int messageNumber) {
super(address, packetNumber, messageNumber);
}
@Override
public boolean hasNonceState() {
return false;
}
@Override
public int getCurrentNonce() {
throw new UnsupportedOperationException("PodSetupState does not have a nonce state");
}
@Override
public void advanceToNextNonce() {
throw new UnsupportedOperationException("PodSetupState does not have a nonce state");
}
@Override
public void resyncNonce(int syncWord, int sentNonce, int sequenceNumber) {
throw new UnsupportedOperationException("PodSetupState does not have a nonce state");
}
@Override
public void updateFromStatusResponse(StatusResponse statusResponse) {
}
@Override
public String toString() {
return "PodSetupState{" +
"address=" + address +
", packetNumber=" + packetNumber +
", messageNumber=" + messageNumber +
", faultEvent=" + faultEvent +
'}';
}
}

View file

@ -1,68 +0,0 @@
package info.nightscout.androidaps.plugins.pump.omnipod.defs.state;
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.response.StatusResponse;
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.response.podinfo.PodInfoFaultEvent;
public abstract class PodState {
protected final int address;
protected int packetNumber;
protected int messageNumber;
protected PodInfoFaultEvent faultEvent;
public PodState(int address, int packetNumber, int messageNumber) {
this.address = address;
this.packetNumber = packetNumber;
this.messageNumber = messageNumber;
}
public abstract boolean hasNonceState();
public abstract int getCurrentNonce();
public abstract void advanceToNextNonce();
public abstract void resyncNonce(int syncWord, int sentNonce, int sequenceNumber);
public abstract void updateFromStatusResponse(StatusResponse statusResponse);
public int getAddress() {
return address;
}
public int getMessageNumber() {
return messageNumber;
}
public void setMessageNumber(int messageNumber) {
this.messageNumber = messageNumber;
}
public int getPacketNumber() {
return packetNumber;
}
public void setPacketNumber(int packetNumber) {
this.packetNumber = packetNumber;
}
public void increaseMessageNumber() {
setMessageNumber((messageNumber + 1) & 0b1111);
}
public void increasePacketNumber() {
setPacketNumber((packetNumber + 1) & 0b11111);
}
public boolean hasFaultEvent() {
return faultEvent != null;
}
public PodInfoFaultEvent getFaultEvent() {
return faultEvent;
}
public void setFaultEvent(PodInfoFaultEvent faultEvent) {
this.faultEvent = faultEvent;
}
}

View file

@ -1,6 +0,0 @@
package info.nightscout.androidaps.plugins.pump.omnipod.defs.state;
@FunctionalInterface
public interface PodStateChangedHandler {
void handle(PodSessionState podState);
}

View file

@ -1,10 +0,0 @@
package info.nightscout.androidaps.plugins.pump.omnipod.driver;
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
}

View file

@ -1,111 +0,0 @@
package info.nightscout.androidaps.plugins.pump.omnipod.driver.ui;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.Date;
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.defs.OmnipodPumpPluginInterface;
import info.nightscout.androidaps.plugins.pump.omnipod.driver.OmnipodPumpStatus;
/**
* Created by andy on 4.8.2019
*/
public class OmnipodUIPostprocessor {
private static final Logger LOG = LoggerFactory.getLogger(LTag.PUMP.name());
private OmnipodPumpStatus pumpStatus;
private OmnipodPumpPluginInterface omnipodPumpPlugin;
private RxBusWrapper rxBus;
public OmnipodUIPostprocessor(OmnipodPumpPluginInterface 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;
}
}

View file

@ -1,42 +0,0 @@
package info.nightscout.androidaps.plugins.pump.omnipod.events
import info.nightscout.androidaps.events.Event
import info.nightscout.androidaps.plugins.pump.common.events.EventRileyLinkDeviceStatusChange
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkError
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkServiceState
import info.nightscout.androidaps.plugins.pump.omnipod.defs.PodDeviceState
import info.nightscout.androidaps.plugins.pump.omnipod.defs.state.PodSessionState
/**
* Created by andy on 4.8.2019
*/
class EventOmnipodDeviceStatusChange : EventRileyLinkDeviceStatusChange {
var podSessionState: PodSessionState? = null
var podDeviceState: PodDeviceState? = null
@JvmOverloads
constructor(rileyLinkServiceState: RileyLinkServiceState?, rileyLinkError: RileyLinkError? = null) : super(rileyLinkServiceState, rileyLinkError) {
}
constructor(podSessionState: PodSessionState?) {
this.podSessionState = podSessionState
}
constructor(errorDescription: String?) {
this.errorDescription = errorDescription
}
constructor(podDeviceState: PodDeviceState?, errorDescription: String?) {
this.podDeviceState = podDeviceState
this.errorDescription = errorDescription
}
override fun toString(): String {
return ("EventOmnipodDeviceStatusChange [" //
+ "rileyLinkServiceState=" + rileyLinkServiceState
+ ", rileyLinkError=" + rileyLinkError //
+ ", podSessionState=" + podSessionState //
+ ", podDeviceState=" + podDeviceState + "]")
}
}

View file

@ -1,244 +0,0 @@
package info.nightscout.androidaps.plugins.pump.omnipod.util;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonDeserializer;
import com.google.gson.JsonPrimitive;
import com.google.gson.JsonSerializer;
import org.apache.commons.lang3.StringUtils;
import org.joda.time.DateTime;
import org.joda.time.DateTimeZone;
import org.joda.time.format.ISODateTimeFormat;
import javax.inject.Inject;
import javax.inject.Singleton;
import dagger.android.HasAndroidInjector;
import info.nightscout.androidaps.interfaces.ActivePluginProvider;
import info.nightscout.androidaps.logging.AAPSLogger;
import info.nightscout.androidaps.logging.LTag;
import info.nightscout.androidaps.plugins.bus.RxBusWrapper;
import info.nightscout.androidaps.plugins.pump.common.defs.PumpType;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkUtil;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.data.RLHistoryItem;
import info.nightscout.androidaps.plugins.pump.omnipod.comm.OmnipodManager;
import info.nightscout.androidaps.plugins.pump.omnipod.data.RLHistoryItemOmnipod;
import info.nightscout.androidaps.plugins.pump.omnipod.defs.OmnipodCommandType;
import info.nightscout.androidaps.plugins.pump.omnipod.defs.OmnipodPodType;
import info.nightscout.androidaps.plugins.pump.omnipod.defs.PodDeviceState;
import info.nightscout.androidaps.plugins.pump.omnipod.defs.state.PodSessionState;
import info.nightscout.androidaps.plugins.pump.omnipod.driver.OmnipodDriverState;
import info.nightscout.androidaps.plugins.pump.omnipod.driver.OmnipodPumpStatus;
import info.nightscout.androidaps.plugins.pump.omnipod.events.EventOmnipodDeviceStatusChange;
import info.nightscout.androidaps.utils.resources.ResourceHelper;
import info.nightscout.androidaps.utils.sharedPreferences.SP;
/**
* Created by andy on 4/8/19.
*/
@Singleton
public class OmnipodUtil {
private final AAPSLogger aapsLogger;
private final RxBusWrapper rxBus;
private final RileyLinkUtil rileyLinkUtil;
private final OmnipodPumpStatus omnipodPumpStatus;
private final ActivePluginProvider activePlugins;
private final SP sp;
private final ResourceHelper resourceHelper;
private final HasAndroidInjector injector;
private boolean lowLevelDebug = true;
private OmnipodCommandType currentCommand;
private Gson gsonInstance = createGson();
//private static PodSessionState podSessionState;
//private static PodDeviceState podDeviceState;
private OmnipodPodType omnipodPodType;
private OmnipodDriverState driverState = OmnipodDriverState.NotInitalized;
@Inject
public OmnipodUtil(
AAPSLogger aapsLogger,
RxBusWrapper rxBus,
RileyLinkUtil rileyLinkUtil,
OmnipodPumpStatus omnipodPumpStatus,
SP sp,
ResourceHelper resourceHelper,
ActivePluginProvider activePlugins,
HasAndroidInjector injector
) {
this.aapsLogger = aapsLogger;
this.rxBus = rxBus;
this.rileyLinkUtil = rileyLinkUtil;
this.omnipodPumpStatus = omnipodPumpStatus;
this.sp = sp;
this.resourceHelper = resourceHelper;
this.activePlugins = activePlugins;
this.injector = injector;
}
public boolean isLowLevelDebug() {
return lowLevelDebug;
}
public void setLowLevelDebug(boolean lowLevelDebug) {
this.lowLevelDebug = lowLevelDebug;
}
public OmnipodCommandType getCurrentCommand() {
return currentCommand;
}
public void setCurrentCommand(OmnipodCommandType currentCommand) {
this.currentCommand = currentCommand;
if (currentCommand != null)
rileyLinkUtil.getRileyLinkHistory().add(new RLHistoryItemOmnipod(currentCommand));
}
public OmnipodDriverState getDriverState() {
return driverState;
}
public void setDriverState(OmnipodDriverState state) {
if (driverState == state)
return;
driverState = state;
omnipodPumpStatus.driverState = state;
// TODO maybe remove
// if (OmnipodUtil.omnipodPumpStatus != null) {
// OmnipodUtil.omnipodPumpStatus.driverState = state;
// }
//
// if (OmnipodUtil.omnipodPumpPlugin != null) {
// OmnipodUtil.omnipodPumpPlugin.setDriverState(state);
// }
}
private Gson createGson() {
GsonBuilder gsonBuilder = new GsonBuilder()
.registerTypeAdapter(DateTime.class, (JsonSerializer<DateTime>) (dateTime, typeOfSrc, context) ->
new JsonPrimitive(ISODateTimeFormat.dateTime().print(dateTime)))
.registerTypeAdapter(DateTime.class, (JsonDeserializer<DateTime>) (json, typeOfT, context) ->
ISODateTimeFormat.dateTime().parseDateTime(json.getAsString()))
.registerTypeAdapter(DateTimeZone.class, (JsonSerializer<DateTimeZone>) (timeZone, typeOfSrc, context) ->
new JsonPrimitive(timeZone.getID()))
.registerTypeAdapter(DateTimeZone.class, (JsonDeserializer<DateTimeZone>) (json, typeOfT, context) ->
DateTimeZone.forID(json.getAsString()));
return gsonBuilder.create();
}
public void setPodSessionState(PodSessionState podSessionState) {
omnipodPumpStatus.podSessionState = podSessionState;
rxBus.send(new EventOmnipodDeviceStatusChange(podSessionState));
}
public void setPodDeviceState(PodDeviceState podDeviceState) {
omnipodPumpStatus.podDeviceState = podDeviceState;
}
public void setOmnipodPodType(OmnipodPodType omnipodPodType) {
this.omnipodPodType = omnipodPodType;
}
public OmnipodPodType getOmnipodPodType() {
return this.omnipodPodType;
}
public PodDeviceState getPodDeviceState() {
return omnipodPumpStatus.podDeviceState;
}
public PodSessionState getPodSessionState() {
return omnipodPumpStatus.podSessionState;
}
public boolean isOmnipodEros() {
return this.activePlugins.getActivePump().model() == PumpType.Insulet_Omnipod;
}
public boolean isOmnipodDash() {
return this.activePlugins.getActivePump().model() == PumpType.Insulet_Omnipod_Dash;
}
public void setPumpType(PumpType pumpType_) {
omnipodPumpStatus.pumpType = pumpType_;
}
public PumpType getPumpType() {
return omnipodPumpStatus.pumpType;
}
public Gson getGsonInstance() {
return this.gsonInstance;
}
public Integer getNextPodAddress() {
if (sp.contains(OmnipodConst.Prefs.NextPodAddress)) {
int nextPodAddress = sp.getInt(OmnipodConst.Prefs.NextPodAddress, 0);
if (OmnipodManager.isValidAddress(nextPodAddress)) {
return nextPodAddress;
}
}
return null;
}
public boolean hasNextPodAddress() {
return getNextPodAddress() != null;
}
public void setNextPodAddress(int address) {
sp.putInt(OmnipodConst.Prefs.NextPodAddress, address);
}
public void removeNextPodAddress() {
sp.remove(OmnipodConst.Prefs.NextPodAddress);
}
public AAPSLogger getAapsLogger() {
return this.aapsLogger;
}
public SP getSp() {
return this.sp;
}
public PodSessionState loadSessionState() {
String podState = sp.getString(OmnipodConst.Prefs.PodState, "");
aapsLogger.info(LTag.PUMP, "PodSessionState-SP: loaded from SharedPreferences: " + podState);
if (StringUtils.isNotEmpty(podState)) {
PodSessionState podSessionState = gsonInstance.fromJson(podState, PodSessionState.class);
podSessionState.injectDaggerClass(injector);
setPodSessionState(podSessionState);
return podSessionState;
}
return null;
}
}

View file

@ -1,308 +0,0 @@
package info.nightscout.androidaps.plugins.pump.omnipod_dash;
import android.content.Context;
import android.os.Bundle;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.Arrays;
import java.util.List;
import javax.inject.Inject;
import dagger.android.HasAndroidInjector;
import info.nightscout.androidaps.BuildConfig;
import info.nightscout.androidaps.R;
import info.nightscout.androidaps.data.Profile;
import info.nightscout.androidaps.interfaces.ActivePluginProvider;
import info.nightscout.androidaps.interfaces.CommandQueueProvider;
import info.nightscout.androidaps.interfaces.PluginDescription;
import info.nightscout.androidaps.interfaces.PluginType;
import info.nightscout.androidaps.logging.AAPSLogger;
import info.nightscout.androidaps.logging.L;
import info.nightscout.androidaps.logging.LTag;
import info.nightscout.androidaps.plugins.bus.RxBusWrapper;
import info.nightscout.androidaps.plugins.general.actions.defs.CustomAction;
import info.nightscout.androidaps.plugins.pump.common.defs.PumpDriverState;
import info.nightscout.androidaps.plugins.pump.common.defs.PumpType;
import info.nightscout.androidaps.plugins.pump.omnipod.OmnipodFragment;
import info.nightscout.androidaps.plugins.pump.omnipod.OmnipodPumpPlugin;
import info.nightscout.androidaps.plugins.pump.omnipod.defs.OmnipodPumpPluginInterface;
import info.nightscout.androidaps.plugins.pump.omnipod.events.EventOmnipodPumpValuesChanged;
import info.nightscout.androidaps.plugins.pump.omnipod.events.EventOmnipodRefreshButtonState;
import info.nightscout.androidaps.plugins.pump.omnipod.service.RileyLinkOmnipodService;
import info.nightscout.androidaps.plugins.pump.omnipod_dash.comm.OmnipodDashCommunicationManager;
import info.nightscout.androidaps.utils.DateUtil;
import info.nightscout.androidaps.utils.FabricPrivacy;
import info.nightscout.androidaps.utils.TimeChangeType;
import info.nightscout.androidaps.utils.resources.ResourceHelper;
import info.nightscout.androidaps.utils.sharedPreferences.SP;
/**
* Created by andy on 23.04.18.
*
* @author Andy Rozman (andy.rozman@gmail.com)
*/
// FIXME this is just placeholder for now, but this should use most of OmnipodPumpPlugin implementation
public class OmnipodDashPumpPlugin extends OmnipodPumpPlugin implements OmnipodPumpPluginInterface {
// TODO Dagger
//private static final Logger LOG = LoggerFactory.getLogger(L.PUMP);
//private RileyLinkOmnipodService omnipodService;
//private OmnipodPumpStatus pumpStatusLocal = null;
// variables for handling statuses and history
private boolean firstRun = true;
private boolean isRefresh = false;
private boolean isBasalProfileInvalid = false;
private boolean basalProfileChanged = false;
private boolean isInitialized = false;
public static boolean isBusy = false;
//private List<Long> busyTimestamps = new ArrayList<>();
//private boolean sentIdToFirebase = false;
//private boolean hasTimeDateOrTimeZoneChanged = false;
private Profile currentProfile;
//@Inject
public OmnipodDashPumpPlugin(HasAndroidInjector injector,
AAPSLogger aapsLogger,
RxBusWrapper rxBus,
Context context,
ResourceHelper resourceHelper,
ActivePluginProvider activePlugin,
SP sp,
CommandQueueProvider commandQueue,
FabricPrivacy fabricPrivacy,
DateUtil dateUtil
) {
super(new PluginDescription() //
.mainType(PluginType.PUMP) //
.fragmentClass(OmnipodFragment.class.getName()) //
.pluginName(R.string.omnipod_dash_name) //
.shortName(R.string.omnipod_dash_name_short) //
.preferencesId(R.xml.pref_omnipod) //
.description(R.string.description_pump_omnipod_dash), //
PumpType.Insulet_Omnipod_Dash,
injector, aapsLogger, rxBus, context, resourceHelper, activePlugin, sp, commandQueue, fabricPrivacy, dateUtil
);
displayConnectionMessages = false;
//OmnipodUtil.setOmnipodPodType(OmnipodPodType.Dash);
if (omnipodCommunicationManager == null) {
omnipodCommunicationManager = OmnipodDashCommunicationManager.getInstance();
}
// DG omnipodUIComm = new OmnipodUIComm(omnipodCommunicationManager, this, this.omnipodPumpStatus);
//OmnipodUtil.setPlugin(this);
// FIXME
// serviceConnection = new ServiceConnection() {
//
// public void onServiceDisconnected(ComponentName name) {
// if (isLoggingEnabled())
// aapsLogger.debug(LTag.PUMP, "RileyLinkOmnipodService is disconnected");
// omnipodService = null;
// }
//
// public void onServiceConnected(ComponentName name, IBinder service) {
// if (isLoggingEnabled())
// aapsLogger.debug(LTag.PUMP, "RileyLinkOmnipodService is connected");
// RileyLinkOmnipodService.LocalBinder mLocalBinder = (RileyLinkOmnipodService.LocalBinder) service;
// omnipodService = mLocalBinder.getServiceInstance();
//
// new Thread(() -> {
//
// for (int i = 0; i < 20; i++) {
// SystemClock.sleep(5000);
//
// if (OmnipodUtil.getPumpStatus() != null) {
// if (isLoggingEnabled())
// aapsLogger.debug(LTag.PUMP, "Starting OmniPod-RileyLink service");
// if (OmnipodUtil.getPumpStatus().setNotInPreInit()) {
// break;
// }
// }
// }
// }).start();
// }
// };
}
private String getLogPrefix() {
return "OmnipodPlugin::";
}
// FIXME
public Class getServiceClass() {
return RileyLinkOmnipodService.class;
}
@Override
public String deviceID() {
return "Omnipod Dash";
}
// Pump Plugin
private boolean isServiceSet() {
return true; //omnipodService != null;
}
private boolean isServiceInitialized() {
return true;
}
@Override
public boolean isInitialized() {
if (displayConnectionMessages)
aapsLogger.debug(LTag.PUMP, getLogPrefix() + "isInitialized");
return isServiceSet() && isInitialized;
}
@Override
public boolean isConnected() {
if (displayConnectionMessages)
aapsLogger.debug(LTag.PUMP, getLogPrefix() + "isConnected");
return isServiceSet() && isServiceInitialized();
}
@Override
public boolean isConnecting() {
if (displayConnectionMessages)
aapsLogger.debug(LTag.PUMP, getLogPrefix() + "isConnecting");
return !isServiceSet() || !isServiceInitialized();
}
@Override
public void getPumpStatus() {
if (firstRun) {
initializePump(!isRefresh);
}
// getPodPumpStatus();
//
// if (firstRun) {
// initializePump(!isRefresh);
// } else {
// refreshAnyStatusThatNeedsToBeRefreshed();
// }
//
// MainApp.bus().post(new EventMedtronicPumpValuesChanged());
}
public void resetStatusState() {
firstRun = true;
isRefresh = true;
}
private void setRefreshButtonEnabled(boolean enabled) {
rxBus.send(new EventOmnipodRefreshButtonState(enabled));
}
private void initializePump(boolean realInit) {
aapsLogger.info(LTag.PUMP, getLogPrefix() + "initializePump - start");
if (omnipodCommunicationManager == null) {
omnipodCommunicationManager = OmnipodDashCommunicationManager.getInstance();
}
// setRefreshButtonEnabled(false);
//
// getPodPumpStatus();
//
// if (isRefresh) {
// if (isPumpNotReachable()) {
// if (isLoggingEnabled())
// LOG.error(getLogPrefix() + "initializePump::Pump unreachable.");
// MedtronicUtil.sendNotification(MedtronicNotificationType.PumpUnreachable);
//
// setRefreshButtonEnabled(true);
//
// return;
// }
//
// MedtronicUtil.dismissNotification(MedtronicNotificationType.PumpUnreachable);
// }
//
// this.pumpState = PumpDriverState.Connected;
//
// pumpStatusLocal.setLastCommunicationToNow();
// setRefreshButtonEnabled(true);
// TODO need to read status and BasalProfile if pod inited and pod status and set correct commands enabled
if (!isRefresh) {
pumpState = PumpDriverState.Initialized;
}
if (!sentIdToFirebase) {
Bundle params = new Bundle();
params.putString("version", BuildConfig.VERSION);
//fabricPrivacy.logCustom().logEvent("OmnipodPumpInit", params);
sentIdToFirebase = true;
}
isInitialized = true;
// this.pumpState = PumpDriverState.Initialized;
this.firstRun = false;
}
protected void triggerUIChange() {
rxBus.send(new EventOmnipodPumpValuesChanged());
}
// OPERATIONS not supported by Pump or Plugin
//private List<CustomAction> customActions = null;
@Override
public List<CustomAction> getCustomActions() {
if (customActions == null) {
this.customActions = Arrays.asList(
// customActionPairAndPrime, //
// customActionFillCanullaSetBasalProfile, //
// customActionDeactivatePod, //
// customActionResetPod
);
}
return this.customActions;
}
@Override
public void timezoneOrDSTChanged(TimeChangeType timeChangeType) {
// if (isLoggingEnabled())
// LOG.warn(getLogPrefix() + "Time, Date and/or TimeZone changed. ");
//
// this.hasTimeDateOrTimeZoneChanged = true;
}
}

View file

@ -1,124 +0,0 @@
package info.nightscout.androidaps.plugins.pump.omnipod_dash.comm;
import android.content.Context;
import info.nightscout.androidaps.data.DetailedBolusInfo;
import info.nightscout.androidaps.data.Profile;
import info.nightscout.androidaps.data.PumpEnactResult;
import info.nightscout.androidaps.plugins.pump.common.data.TempBasalPair;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.RFSpy;
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.response.podinfo.PodInfoRecentPulseLog;
import info.nightscout.androidaps.plugins.pump.omnipod.defs.OmnipodCommunicationManagerInterface;
import info.nightscout.androidaps.plugins.pump.omnipod.defs.PodInitActionType;
import info.nightscout.androidaps.plugins.pump.omnipod.defs.PodInitReceiver;
import info.nightscout.androidaps.plugins.pump.omnipod.defs.state.PodSessionState;
/**
* Created by andy on 4.8.2019
*/
// TODO refactor to use dagger, just commented out errors
// TODO is this class used? remove if not
public class OmnipodDashCommunicationManager implements OmnipodCommunicationManagerInterface {
// TODO Dagger
// private static final Logger LOG = LoggerFactory.getLogger(L.PUMPCOMM);
// i didn't find where you instantiate this
private static OmnipodDashCommunicationManager omnipodCommunicationManager;
private String errorMessage;
public OmnipodDashCommunicationManager(Context context, RFSpy rfspy) {
omnipodCommunicationManager = this;
// OmnipodUtil.getPumpStatus().previousConnection = SP.getLong(
// RileyLinkConst.Prefs.LastGoodDeviceCommunicationTime, 0L);
}
private PodSessionState getPodSessionState() {
return null;
}
@Deprecated
public static OmnipodDashCommunicationManager getInstance() {
return omnipodCommunicationManager;
}
//@Override
protected void configurePumpSpecificSettings() {
//pumpStatus = OmnipodUtil.getPumpStatus();
}
public String getErrorResponse() {
return this.errorMessage;
}
// private boolean isLogEnabled() {
// return L.isEnabled(L.PUMPCOMM);
// }
@Override
public PumpEnactResult initPod(PodInitActionType podInitActionType, PodInitReceiver podInitReceiver, Profile profile) {
return null;
}
@Override
public PumpEnactResult getPodStatus() {
return null;
}
@Override
public PumpEnactResult deactivatePod(PodInitReceiver podInitReceiver) {
return null;
}
@Override
public PumpEnactResult setBasalProfile(Profile profile) {
return null;
}
@Override
public PumpEnactResult resetPodStatus() {
return null;
}
@Override
public PumpEnactResult setBolus(DetailedBolusInfo detailedBolusInfo) {
return null;
}
public PumpEnactResult setBolus(Double parameter, boolean isSmb) {
return null;
}
@Override
public PumpEnactResult cancelBolus() {
return null;
}
@Override
public PumpEnactResult setTemporaryBasal(TempBasalPair tbr) {
return null;
}
@Override
public PumpEnactResult cancelTemporaryBasal() {
return null;
}
@Override
public PumpEnactResult acknowledgeAlerts() {
return null;
}
@Override
public PumpEnactResult setTime() {
return null;
}
@Override
public PodInfoRecentPulseLog readPulseLog() {
return null;
}
}

View file

@ -1,24 +0,0 @@
package info.nightscout.androidaps.plugins.pump.omnipod_dash.driver;
import javax.inject.Inject;
import javax.inject.Singleton;
import info.nightscout.androidaps.plugins.bus.RxBusWrapper;
import info.nightscout.androidaps.plugins.pump.common.defs.PumpType;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkUtil;
import info.nightscout.androidaps.plugins.pump.omnipod.driver.OmnipodPumpStatus;
import info.nightscout.androidaps.utils.resources.ResourceHelper;
import info.nightscout.androidaps.utils.sharedPreferences.SP;
@Singleton
public class OmnipodDashPumpStatus extends OmnipodPumpStatus {
@Inject
public OmnipodDashPumpStatus(ResourceHelper resourceHelper,
SP sp,
RxBusWrapper rxBus,
RileyLinkUtil rileyLinkUtil) {
super(resourceHelper, sp, rxBus, rileyLinkUtil);
this.pumpType = PumpType.Insulet_Omnipod_Dash;
}
}

View file

@ -39,12 +39,12 @@ class LocalAlertUtils @Inject constructor(
return T.mins(sp.getInt(resourceHelper.gs(R.string.key_missed_bg_readings_threshold), 30).toLong()).msecs() return T.mins(sp.getInt(resourceHelper.gs(R.string.key_missed_bg_readings_threshold), 30).toLong()).msecs()
} }
private fun pumpUnreachableThreshold(): Long { fun pumpUnreachableThreshold(): Long {
return T.mins(sp.getInt(resourceHelper.gs(R.string.key_pump_unreachable_threshold), 30).toLong()).msecs() return T.mins(sp.getInt(resourceHelper.gs(R.string.key_pump_unreachable_threshold), 30).toLong()).msecs()
} }
fun checkPumpUnreachableAlarm(lastConnection: Long, isStatusOutdated: Boolean, isDisconnected: Boolean) { fun checkPumpUnreachableAlarm(lastConnection: Long, isStatusOutdated: Boolean, isDisconnected: Boolean) {
val alarmTimeoutExpired = lastConnection + pumpUnreachableThreshold() < System.currentTimeMillis() val alarmTimeoutExpired = isAlarmTimeoutExpired(lastConnection, pumpUnreachableThreshold())
val nextAlarmOccurrenceReached = sp.getLong("nextPumpDisconnectedAlarm", 0L) < System.currentTimeMillis() val nextAlarmOccurrenceReached = sp.getLong("nextPumpDisconnectedAlarm", 0L) < System.currentTimeMillis()
if (config.APS && sp.getBoolean(resourceHelper.gs(R.string.key_enable_pump_unreachable_alert), true) if (config.APS && sp.getBoolean(resourceHelper.gs(R.string.key_enable_pump_unreachable_alert), true)
&& isStatusOutdated && alarmTimeoutExpired && nextAlarmOccurrenceReached && !isDisconnected) { && isStatusOutdated && alarmTimeoutExpired && nextAlarmOccurrenceReached && !isDisconnected) {
@ -60,6 +60,14 @@ class LocalAlertUtils @Inject constructor(
if (!isStatusOutdated && !alarmTimeoutExpired) rxBus.send(EventDismissNotification(Notification.PUMP_UNREACHABLE)) if (!isStatusOutdated && !alarmTimeoutExpired) rxBus.send(EventDismissNotification(Notification.PUMP_UNREACHABLE))
} }
private fun isAlarmTimeoutExpired(lastConnection: Long, unreachableThreshold: Long): Boolean {
if (activePlugin.activePump.pumpDescription.hasCustomUnreachableAlertCheck) {
return activePlugin.activePump.isUnreachableAlertTimeoutExceeded(unreachableThreshold)
} else {
return lastConnection + pumpUnreachableThreshold() < System.currentTimeMillis()
}
}
/*Presnoozes the alarms with 5 minutes if no snooze exists. /*Presnoozes the alarms with 5 minutes if no snooze exists.
* Call only at startup! * Call only at startup!
*/ */

View file

@ -25,7 +25,7 @@
android:padding="10dip" android:padding="10dip"
app:columnCount="2"> app:columnCount="2">
<info.nightscout.androidaps.utils.SingleClickButton <info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/actions_profileswitch" android:id="@+id/actions_profileswitch"
style="@style/ButtonSmallFontStyle" style="@style/ButtonSmallFontStyle"
android:layout_width="0dp" android:layout_width="0dp"
@ -40,7 +40,7 @@
app:layout_gravity="fill" app:layout_gravity="fill"
app:layout_row="0" /> app:layout_row="0" />
<info.nightscout.androidaps.utils.SingleClickButton <info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/actions_temptarget" android:id="@+id/actions_temptarget"
style="@style/ButtonSmallFontStyle" style="@style/ButtonSmallFontStyle"
android:layout_width="0dp" android:layout_width="0dp"
@ -55,7 +55,7 @@
app:layout_gravity="fill" app:layout_gravity="fill"
app:layout_row="0" /> app:layout_row="0" />
<info.nightscout.androidaps.utils.SingleClickButton <info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/actions_settempbasal" android:id="@+id/actions_settempbasal"
style="@style/ButtonSmallFontStyle" style="@style/ButtonSmallFontStyle"
android:layout_width="0dp" android:layout_width="0dp"
@ -70,7 +70,7 @@
app:layout_gravity="fill" app:layout_gravity="fill"
app:layout_row="1" /> app:layout_row="1" />
<info.nightscout.androidaps.utils.SingleClickButton <info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/actions_canceltempbasal" android:id="@+id/actions_canceltempbasal"
style="@style/ButtonSmallFontStyle" style="@style/ButtonSmallFontStyle"
android:layout_width="0dp" android:layout_width="0dp"
@ -86,7 +86,7 @@
app:layout_gravity="fill" app:layout_gravity="fill"
app:layout_row="1" /> app:layout_row="1" />
<info.nightscout.androidaps.utils.SingleClickButton <info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/actions_extendedbolus" android:id="@+id/actions_extendedbolus"
style="@style/ButtonSmallFontStyle" style="@style/ButtonSmallFontStyle"
android:layout_width="0dp" android:layout_width="0dp"
@ -101,7 +101,7 @@
app:layout_gravity="fill" app:layout_gravity="fill"
app:layout_row="1" /> app:layout_row="1" />
<info.nightscout.androidaps.utils.SingleClickButton <info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/actions_extendedbolus_cancel" android:id="@+id/actions_extendedbolus_cancel"
style="@style/ButtonSmallFontStyle" style="@style/ButtonSmallFontStyle"
android:layout_width="0dp" android:layout_width="0dp"
@ -139,7 +139,7 @@
android:padding="10dip" android:padding="10dip"
app:columnCount="2"> app:columnCount="2">
<info.nightscout.androidaps.utils.SingleClickButton <info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/actions_bgcheck" android:id="@+id/actions_bgcheck"
style="@style/ButtonSmallFontStyle" style="@style/ButtonSmallFontStyle"
android:layout_width="0dp" android:layout_width="0dp"
@ -154,7 +154,7 @@
app:layout_gravity="fill" app:layout_gravity="fill"
app:layout_row="2" /> app:layout_row="2" />
<info.nightscout.androidaps.utils.SingleClickButton <info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/actions_fill" android:id="@+id/actions_fill"
style="@style/ButtonSmallFontStyle" style="@style/ButtonSmallFontStyle"
android:layout_width="0dp" android:layout_width="0dp"
@ -169,7 +169,7 @@
app:layout_gravity="fill" app:layout_gravity="fill"
app:layout_row="2" /> app:layout_row="2" />
<info.nightscout.androidaps.utils.SingleClickButton <info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/actions_cgmsensorinsert" android:id="@+id/actions_cgmsensorinsert"
style="@style/ButtonSmallFontStyle" style="@style/ButtonSmallFontStyle"
android:layout_width="0dp" android:layout_width="0dp"
@ -183,7 +183,7 @@
app:layout_gravity="fill" app:layout_gravity="fill"
app:layout_row="3" /> app:layout_row="3" />
<info.nightscout.androidaps.utils.SingleClickButton <info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/actions_pumpbatterychange" android:id="@+id/actions_pumpbatterychange"
style="@style/ButtonSmallFontStyle" style="@style/ButtonSmallFontStyle"
android:layout_width="0dp" android:layout_width="0dp"
@ -197,7 +197,7 @@
app:layout_gravity="fill" app:layout_gravity="fill"
app:layout_row="3" /> app:layout_row="3" />
<info.nightscout.androidaps.utils.SingleClickButton <info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/actions_note" android:id="@+id/actions_note"
style="@style/ButtonSmallFontStyle" style="@style/ButtonSmallFontStyle"
android:layout_width="0dp" android:layout_width="0dp"
@ -211,7 +211,7 @@
app:layout_gravity="fill" app:layout_gravity="fill"
app:layout_row="4" /> app:layout_row="4" />
<info.nightscout.androidaps.utils.SingleClickButton <info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/actions_exercise" android:id="@+id/actions_exercise"
style="@style/ButtonSmallFontStyle" style="@style/ButtonSmallFontStyle"
android:layout_width="0dp" android:layout_width="0dp"
@ -225,7 +225,7 @@
app:layout_gravity="fill" app:layout_gravity="fill"
app:layout_row="4" /> app:layout_row="4" />
<info.nightscout.androidaps.utils.SingleClickButton <info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/actions_announcement" android:id="@+id/actions_announcement"
style="@style/ButtonSmallFontStyle" style="@style/ButtonSmallFontStyle"
android:layout_width="0dp" android:layout_width="0dp"
@ -239,7 +239,7 @@
app:layout_gravity="fill" app:layout_gravity="fill"
app:layout_row="5" /> app:layout_row="5" />
<info.nightscout.androidaps.utils.SingleClickButton <info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/actions_question" android:id="@+id/actions_question"
style="@style/ButtonSmallFontStyle" style="@style/ButtonSmallFontStyle"
android:layout_width="0dp" android:layout_width="0dp"
@ -268,7 +268,7 @@
android:padding="10dip" android:padding="10dip"
app:columnCount="2"> app:columnCount="2">
<info.nightscout.androidaps.utils.SingleClickButton <info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/actions_historybrowser" android:id="@+id/actions_historybrowser"
style="@style/ButtonSmallFontStyle" style="@style/ButtonSmallFontStyle"
android:layout_width="0dp" android:layout_width="0dp"
@ -282,7 +282,7 @@
app:layout_gravity="fill" app:layout_gravity="fill"
app:layout_row="6" /> app:layout_row="6" />
<info.nightscout.androidaps.utils.SingleClickButton <info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/actions_tddstats" android:id="@+id/actions_tddstats"
style="@style/ButtonSmallFontStyle" style="@style/ButtonSmallFontStyle"
android:layout_width="0dp" android:layout_width="0dp"

View file

@ -86,7 +86,7 @@
style="@style/warning_label" style="@style/warning_label"
android:text="@string/smscommunicator_otp_reset_warning" /> 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" android:id="@+id/actions_smscommunicator_otp_reset"
style="?android:attr/buttonStyle" style="?android:attr/buttonStyle"
android:layout_width="fill_parent" android:layout_width="fill_parent"

View file

@ -45,7 +45,7 @@
android:padding="10dip" android:padding="10dip"
app:columnCount="3"> app:columnCount="3">
<info.nightscout.androidaps.utils.SingleClickButton <info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/careportal_bgcheck" android:id="@+id/careportal_bgcheck"
style="@style/ButtonSmallFontStyle" style="@style/ButtonSmallFontStyle"
android:layout_width="0px" android:layout_width="0px"
@ -60,7 +60,7 @@
app:layout_gravity="fill" app:layout_gravity="fill"
app:layout_row="0" /> app:layout_row="0" />
<info.nightscout.androidaps.utils.SingleClickButton <info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/careportal_exercise" android:id="@+id/careportal_exercise"
style="@style/ButtonSmallFontStyle" style="@style/ButtonSmallFontStyle"
android:layout_width="0dp" android:layout_width="0dp"
@ -74,7 +74,7 @@
app:layout_gravity="fill" app:layout_gravity="fill"
app:layout_row="0" /> app:layout_row="0" />
<info.nightscout.androidaps.utils.SingleClickButton <info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/careportal_temporarytarget" android:id="@+id/careportal_temporarytarget"
style="@style/ButtonSmallFontStyle" style="@style/ButtonSmallFontStyle"
android:layout_width="0dp" android:layout_width="0dp"
@ -105,7 +105,7 @@
android:padding="10dip" android:padding="10dip"
app:columnCount="3"> app:columnCount="3">
<info.nightscout.androidaps.utils.SingleClickButton <info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/careportal_snackbolus" android:id="@+id/careportal_snackbolus"
style="@style/ButtonSmallFontStyle" style="@style/ButtonSmallFontStyle"
android:layout_width="0dp" android:layout_width="0dp"
@ -119,7 +119,7 @@
app:layout_gravity="fill" app:layout_gravity="fill"
app:layout_row="1" /> app:layout_row="1" />
<info.nightscout.androidaps.utils.SingleClickButton <info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/careportal_mealbolus" android:id="@+id/careportal_mealbolus"
style="@style/ButtonSmallFontStyle" style="@style/ButtonSmallFontStyle"
android:layout_width="0dp" android:layout_width="0dp"
@ -133,7 +133,7 @@
app:layout_gravity="fill" app:layout_gravity="fill"
app:layout_row="1" /> app:layout_row="1" />
<info.nightscout.androidaps.utils.SingleClickButton <info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/careportal_correctionbolus" android:id="@+id/careportal_correctionbolus"
style="@style/ButtonSmallFontStyle" style="@style/ButtonSmallFontStyle"
android:layout_width="0dp" android:layout_width="0dp"
@ -147,7 +147,7 @@
app:layout_gravity="fill" app:layout_gravity="fill"
app:layout_row="1" /> app:layout_row="1" />
<info.nightscout.androidaps.utils.SingleClickButton <info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/careportal_carbscorrection" android:id="@+id/careportal_carbscorrection"
style="@style/ButtonSmallFontStyle" style="@style/ButtonSmallFontStyle"
android:layout_width="0dp" android:layout_width="0dp"
@ -161,7 +161,7 @@
app:layout_gravity="fill" app:layout_gravity="fill"
app:layout_row="2" /> app:layout_row="2" />
<info.nightscout.androidaps.utils.SingleClickButton <info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/careportal_combobolus" android:id="@+id/careportal_combobolus"
style="@style/ButtonSmallFontStyle" style="@style/ButtonSmallFontStyle"
android:layout_width="0dp" android:layout_width="0dp"
@ -175,7 +175,7 @@
app:layout_gravity="fill" app:layout_gravity="fill"
app:layout_row="2" /> app:layout_row="2" />
<info.nightscout.androidaps.utils.SingleClickButton <info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/careportal_tempbasalstart" android:id="@+id/careportal_tempbasalstart"
style="@style/ButtonSmallFontStyle" style="@style/ButtonSmallFontStyle"
android:layout_width="0dp" android:layout_width="0dp"
@ -189,7 +189,7 @@
app:layout_gravity="fill" app:layout_gravity="fill"
app:layout_row="2" /> app:layout_row="2" />
<info.nightscout.androidaps.utils.SingleClickButton <info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/careportal_tempbasalend" android:id="@+id/careportal_tempbasalend"
style="@style/ButtonSmallFontStyle" style="@style/ButtonSmallFontStyle"
android:layout_width="0dp" android:layout_width="0dp"
@ -219,7 +219,7 @@
android:padding="10dip" android:padding="10dip"
app:columnCount="3"> app:columnCount="3">
<info.nightscout.androidaps.utils.SingleClickButton <info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/careportal_cgmsensorstart" android:id="@+id/careportal_cgmsensorstart"
style="@style/ButtonSmallFontStyle" style="@style/ButtonSmallFontStyle"
android:layout_width="0dp" android:layout_width="0dp"
@ -234,7 +234,7 @@
app:layout_row="1" /> app:layout_row="1" />
<info.nightscout.androidaps.utils.SingleClickButton <info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/careportal_cgmsensorinsert" android:id="@+id/careportal_cgmsensorinsert"
style="@style/ButtonSmallFontStyle" style="@style/ButtonSmallFontStyle"
android:layout_width="0dp" android:layout_width="0dp"
@ -249,7 +249,7 @@
app:layout_row="1" /> app:layout_row="1" />
<info.nightscout.androidaps.utils.SingleClickButton <info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/careportal_openapsoffline" android:id="@+id/careportal_openapsoffline"
style="@style/ButtonSmallFontStyle" style="@style/ButtonSmallFontStyle"
android:layout_width="0dp" android:layout_width="0dp"
@ -264,7 +264,7 @@
app:layout_row="1" /> app:layout_row="1" />
<info.nightscout.androidaps.utils.SingleClickButton <info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/careportal_announcement" android:id="@+id/careportal_announcement"
style="@style/ButtonSmallFontStyle" style="@style/ButtonSmallFontStyle"
android:layout_width="0dp" android:layout_width="0dp"
@ -278,7 +278,7 @@
app:layout_gravity="fill" app:layout_gravity="fill"
app:layout_row="4" /> app:layout_row="4" />
<info.nightscout.androidaps.utils.SingleClickButton <info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/careportal_question" android:id="@+id/careportal_question"
style="@style/ButtonSmallFontStyle" style="@style/ButtonSmallFontStyle"
android:layout_width="0dp" android:layout_width="0dp"
@ -292,7 +292,7 @@
app:layout_gravity="fill" app:layout_gravity="fill"
app:layout_row="4" /> app:layout_row="4" />
<info.nightscout.androidaps.utils.SingleClickButton <info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/careportal_note" android:id="@+id/careportal_note"
style="@style/ButtonSmallFontStyle" style="@style/ButtonSmallFontStyle"
android:layout_width="0dp" android:layout_width="0dp"
@ -321,7 +321,7 @@
android:padding="10dip" android:padding="10dip"
app:columnCount="3"> app:columnCount="3">
<info.nightscout.androidaps.utils.SingleClickButton <info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/careportal_pumpsitechange" android:id="@+id/careportal_pumpsitechange"
style="@style/ButtonSmallFontStyle" style="@style/ButtonSmallFontStyle"
android:layout_width="0dp" android:layout_width="0dp"
@ -335,7 +335,7 @@
app:layout_gravity="fill" app:layout_gravity="fill"
app:layout_row="0" /> app:layout_row="0" />
<info.nightscout.androidaps.utils.SingleClickButton <info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/careportal_insulincartridgechange" android:id="@+id/careportal_insulincartridgechange"
style="@style/ButtonSmallFontStyle" style="@style/ButtonSmallFontStyle"
android:layout_width="0dp" android:layout_width="0dp"
@ -349,7 +349,7 @@
app:layout_gravity="fill" app:layout_gravity="fill"
app:layout_row="0" /> app:layout_row="0" />
<info.nightscout.androidaps.utils.SingleClickButton <info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/careportal_profileswitch" android:id="@+id/careportal_profileswitch"
style="@style/ButtonSmallFontStyle" style="@style/ButtonSmallFontStyle"
android:layout_width="0dp" android:layout_width="0dp"
@ -364,7 +364,7 @@
app:layout_row="0" /> app:layout_row="0" />
<info.nightscout.androidaps.utils.SingleClickButton <info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/careportal_pumpbatterychange" android:id="@+id/careportal_pumpbatterychange"
style="@style/ButtonSmallFontStyle" style="@style/ButtonSmallFontStyle"
android:layout_width="0dp" android:layout_width="0dp"

View file

@ -487,7 +487,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="horizontal"> android:orientation="horizontal">
<info.nightscout.androidaps.utils.SingleClickButton <info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/combo_refresh_button" android:id="@+id/combo_refresh_button"
style="@style/ButtonSmallFontStyle" style="@style/ButtonSmallFontStyle"
android:layout_width="match_parent" android:layout_width="match_parent"

View file

@ -6,7 +6,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical"> android:orientation="vertical">
<info.nightscout.androidaps.utils.SingleClickButton <info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/overview_accepttempbutton" android:id="@+id/overview_accepttempbutton"
style="?android:attr/buttonStyle" style="?android:attr/buttonStyle"
android:layout_width="match_parent" android:layout_width="match_parent"
@ -25,7 +25,7 @@
android:paddingStart="0dp" android:paddingStart="0dp"
android:paddingEnd="5dp" > android:paddingEnd="5dp" >
<info.nightscout.androidaps.utils.SingleClickButton <info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/overview_treatmentbutton" android:id="@+id/overview_treatmentbutton"
style="?android:attr/buttonStyle" style="?android:attr/buttonStyle"
android:layout_width="0px" android:layout_width="0px"
@ -38,7 +38,7 @@
android:textSize="10sp" android:textSize="10sp"
android:visibility="gone" /> android:visibility="gone" />
<info.nightscout.androidaps.utils.SingleClickButton <info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/overview_insulinbutton" android:id="@+id/overview_insulinbutton"
style="?android:attr/buttonStyle" style="?android:attr/buttonStyle"
android:layout_width="0px" android:layout_width="0px"
@ -50,7 +50,7 @@
android:textColor="@color/colorInsulinButton" android:textColor="@color/colorInsulinButton"
android:textSize="10sp" /> android:textSize="10sp" />
<info.nightscout.androidaps.utils.SingleClickButton <info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/overview_carbsbutton" android:id="@+id/overview_carbsbutton"
style="?android:attr/buttonStyle" style="?android:attr/buttonStyle"
android:layout_width="0px" android:layout_width="0px"
@ -62,7 +62,7 @@
android:textColor="@color/colorCarbsButton" android:textColor="@color/colorCarbsButton"
android:textSize="10sp" /> android:textSize="10sp" />
<info.nightscout.androidaps.utils.SingleClickButton <info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/overview_wizardbutton" android:id="@+id/overview_wizardbutton"
style="?android:attr/buttonStyle" style="?android:attr/buttonStyle"
android:layout_width="0px" android:layout_width="0px"
@ -74,7 +74,7 @@
android:textColor="@color/colorCalculatorButton" android:textColor="@color/colorCalculatorButton"
android:textSize="10sp" /> android:textSize="10sp" />
<info.nightscout.androidaps.utils.SingleClickButton <info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/overview_calibrationbutton" android:id="@+id/overview_calibrationbutton"
style="?android:attr/buttonStyle" style="?android:attr/buttonStyle"
android:layout_width="0px" android:layout_width="0px"
@ -87,7 +87,7 @@
android:textSize="10sp" android:textSize="10sp"
android:visibility="gone" /> android:visibility="gone" />
<info.nightscout.androidaps.utils.SingleClickButton <info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/overview_cgmbutton" android:id="@+id/overview_cgmbutton"
style="?android:attr/buttonStyle" style="?android:attr/buttonStyle"
android:layout_width="0px" android:layout_width="0px"
@ -100,7 +100,7 @@
android:textSize="10sp" android:textSize="10sp"
android:visibility="gone" /> android:visibility="gone" />
<info.nightscout.androidaps.utils.SingleClickButton <info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/overview_quickwizardbutton" android:id="@+id/overview_quickwizardbutton"
style="?android:attr/buttonStyle" style="?android:attr/buttonStyle"
android:layout_width="0px" android:layout_width="0px"

View file

@ -472,7 +472,7 @@
android:orientation="horizontal" android:orientation="horizontal"
android:paddingRight="5dp"> android:paddingRight="5dp">
<info.nightscout.androidaps.utils.SingleClickButton <info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/overview_treatmentbutton" android:id="@+id/overview_treatmentbutton"
style="?android:attr/buttonStyle" style="?android:attr/buttonStyle"
android:layout_width="0px" android:layout_width="0px"
@ -486,7 +486,7 @@
android:textColor="@color/colorTreatmentButton" android:textColor="@color/colorTreatmentButton"
android:textSize="10sp" /> android:textSize="10sp" />
<info.nightscout.androidaps.utils.SingleClickButton <info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/overview_insulinbutton" android:id="@+id/overview_insulinbutton"
style="?android:attr/buttonStyle" style="?android:attr/buttonStyle"
android:layout_width="0px" android:layout_width="0px"
@ -501,7 +501,7 @@
android:textSize="10sp" android:textSize="10sp"
android:visibility="gone" /> android:visibility="gone" />
<info.nightscout.androidaps.utils.SingleClickButton <info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/overview_carbsbutton" android:id="@+id/overview_carbsbutton"
style="?android:attr/buttonStyle" style="?android:attr/buttonStyle"
android:layout_width="0px" android:layout_width="0px"
@ -516,7 +516,7 @@
android:textSize="10sp" android:textSize="10sp"
android:visibility="gone" /> android:visibility="gone" />
<info.nightscout.androidaps.utils.SingleClickButton <info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/overview_wizardbutton" android:id="@+id/overview_wizardbutton"
style="?android:attr/buttonStyle" style="?android:attr/buttonStyle"
android:layout_width="0px" android:layout_width="0px"
@ -531,7 +531,7 @@
android:textSize="10sp" android:textSize="10sp"
android:visibility="gone" /> android:visibility="gone" />
<info.nightscout.androidaps.utils.SingleClickButton <info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/overview_quickwizardbutton" android:id="@+id/overview_quickwizardbutton"
style="?android:attr/buttonStyle" style="?android:attr/buttonStyle"
android:layout_width="0px" android:layout_width="0px"

View file

@ -744,7 +744,7 @@
<string name="extendedbolusdeliveryerror">Extended bolus delivery error</string> <string name="extendedbolusdeliveryerror">Extended bolus delivery error</string>
<string name="insightpump_shortname">Sight</string> <string name="insightpump_shortname">Sight</string>
<string name="ago">ago</string> <string name="ago">ago</string>
<string name="key_enableSMB_always" translatable="false">enableSMB_always</string> <string name="key_enableSMB_always" translatable="false">enableSMB_always</string>
<string name="key_enableSMB_with_COB" translatable="false">enableSMB_with_COB</string> <string name="key_enableSMB_with_COB" translatable="false">enableSMB_with_COB</string>
<string name="key_enableSMB_with_temptarget" translatable="false">enableSMB_with_temptarget</string> <string name="key_enableSMB_with_temptarget" translatable="false">enableSMB_with_temptarget</string>
<string name="key_enableSMB_after_carbs" translatable="false">enableSMB_after_carbs</string> <string name="key_enableSMB_after_carbs" translatable="false">enableSMB_after_carbs</string>
@ -915,18 +915,18 @@
<string name="openapsama_max_daily_safety_multiplier">Max daily safety multiplier</string> <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="openapsama_current_basal_safety_multiplier">Current basal safety multiplier</string>
<string name="value_unavailable_short">n/a</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_type">Virtual Pump Type</string>
<string name="virtualpump_definition">Pump Definition</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="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="ns_autobackfill_title">Autobackfill BG</string>
<string name="wear_wizard_settings">Wizard Settings</string> <string name="wear_wizard_settings">Wizard Settings</string>
<string translatable="false" name="key_wearwizard_bg">wearwizard_bg</string> <string name="key_wearwizard_bg" translatable="false">wearwizard_bg</string>
<string translatable="false" name="key_wearwizard_tt">wearwizard_tt</string> <string name="key_wearwizard_tt" translatable="false">wearwizard_tt</string>
<string translatable="false" name="key_wearwizard_trend">wearwizard_trend</string> <string name="key_wearwizard_trend" translatable="false">wearwizard_trend</string>
<string translatable="false" name="key_wearwizard_cob">wearwizard_cob</string> <string name="key_wearwizard_cob" translatable="false">wearwizard_cob</string>
<string translatable="false" name="key_wearwizard_bolusiob">wearwizard_bolusiob</string> <string name="key_wearwizard_bolusiob" translatable="false">wearwizard_bolusiob</string>
<string translatable="false" name="key_wearwizard_basaliob">wearwizard_basaliob</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_wizard_settings_summary">Calculations included in the Wizard result:</string>
<string name="wear_display_settings">Display Settings</string> <string name="wear_display_settings">Display Settings</string>
<string name="wear_general_settings">General Settings</string> <string name="wear_general_settings">General Settings</string>
@ -965,8 +965,8 @@
<string name="poctech">Poctech</string> <string name="poctech">Poctech</string>
<string name="description_source_poctech">Receive BG values from Poctech app</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 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 name="key_high_temptarget_raises_sensitivity" translatable="false">high_temptarget_raises_sensitivity</string>
<string translatable="false" name="key_low_temptarget_lowers_sensitivity">low_temptarget_lowers_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_title">High temptarget raises sensitivity</string>
<string name="high_temptarget_raises_sensitivity_summary"><![CDATA[Raise sensitivity for temptargets >= 100]]></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> <string name="low_temptarget_lowers_sensitivity_title">Low temptarget lowers sensitivity</string>
@ -1243,9 +1243,6 @@
<string name="remove_label">REMOVE</string> <string name="remove_label">REMOVE</string>
<string name="preconditions">Preconditions:</string> <string name="preconditions">Preconditions:</string>
<string name="profilename">Change profile to</string> <string name="profilename">Change profile to</string>
<string name="changengetoprofilename">Change profile to %1$s</string> <string name="changengetoprofilename">Change profile to %1$s</string>
<string name="automation_trigger_pump_last_connection_label">Last connection to pump</string> <string name="automation_trigger_pump_last_connection_label">Last connection to pump</string>
@ -1286,7 +1283,6 @@
<string name="objectives_button_unfinish">Clear finished</string> <string name="objectives_button_unfinish">Clear finished</string>
<string name="objectives_button_unstart">Clear started</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="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="nopumpselected">No pump selected</string>
<string name="setupwizard_units_prompt">Select units you want to display values in</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> <string name="ns_ploadlocalprofile">Upload local profile changes to NS</string>
@ -1386,7 +1382,6 @@
<string name="authorizationfailed">Authorization failed</string> <string name="authorizationfailed">Authorization failed</string>
<string name="overview_show_absinsulin">Absolute insulin</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="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="current_master_password">Current master password</string>
<string name="statuslights">Status lights</string> <string name="statuslights">Status lights</string>
<string name="statuslights_copy_ns">Copy settings from NS</string> <string name="statuslights_copy_ns">Copy settings from NS</string>
@ -1399,161 +1394,6 @@
<string name="key_skin" translatable="false">skin</string> <string name="key_skin" translatable="false">skin</string>
<string name="skin">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_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_pod_name_no_info">No info</string>
<string name="omnipod_pod_no_pod_connected">No Pod connected</string>
<string name="omnipod_pod_not_initalized">Not initialized</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>
<!-- Omnipod - Dialogs -->
<string name="omnipod_frequency">Omnipod (433.91 MHz)</string>
<!-- Omnipod - Error -->
<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 very close to the RileyLink 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 Dash -->
<!-- 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="comapareprofile">Compare profiles</string> <string name="comapareprofile">Compare profiles</string>
<string name="nav_profilehelper">Profile helper</string> <string name="nav_profilehelper">Profile helper</string>
<string name="motoldefaultprofile">Default profile</string> <string name="motoldefaultprofile">Default profile</string>

View file

@ -52,36 +52,5 @@
<item name="android:textColor">#ff0000</item> <item name="android:textColor">#ff0000</item>
</style> </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"/> <style name="ProfileHelperAppTheme" parent="Theme.MaterialComponents.DayNight.NoActionBar"/>
</resources> </resources>

View file

@ -1,95 +0,0 @@
package info.nightscout.androidaps.plugins.pump.omnipod.defs.state;
import org.joda.time.DateTime;
import org.joda.time.DateTimeUtils;
import org.joda.time.DateTimeZone;
import org.joda.time.Duration;
import org.junit.After;
import org.junit.Ignore;
import org.junit.Test;
import org.mockito.Mock;
import dagger.android.HasAndroidInjector;
import info.nightscout.androidaps.plugins.pump.omnipod.defs.FirmwareVersion;
import static org.junit.Assert.assertEquals;
public class PodSessionStateTest {
@Mock HasAndroidInjector hasAndroidInjector;
@Test
@Ignore("Not Dagger compliant") // FIXME
public void times() {
DateTimeZone timeZone = DateTimeZone.UTC;
DateTimeZone.setDefault(timeZone);
DateTime now = new DateTime(2020, 1, 1, 1, 2, 3, timeZone);
DateTime initialized = now.minus(Duration.standardDays(1));
DateTimeUtils.setCurrentMillisFixed(now.getMillis());
PodSessionState podSessionState = new PodSessionState(timeZone, 0x0,
new FirmwareVersion(1, 1, 1),
new FirmwareVersion(2, 2, 2),
0, 0, 0, 0, hasAndroidInjector);
assertEquals(now, podSessionState.getTime());
assertEquals(Duration.standardHours(1).plus(Duration.standardMinutes(2).plus(Duration.standardSeconds(3))), podSessionState.getScheduleOffset());
}
@Test
@Ignore("Not Dagger compliant") // FIXME
public void changeSystemTimeZoneWithoutChangingPodTimeZone() {
DateTimeZone timeZone = DateTimeZone.UTC;
DateTimeZone.setDefault(timeZone);
DateTime now = new DateTime(2020, 1, 1, 1, 2, 3, timeZone);
DateTime initialized = now.minus(Duration.standardDays(1));
DateTimeUtils.setCurrentMillisFixed(now.getMillis());
PodSessionState podSessionState = new PodSessionState(timeZone, 0x0,
new FirmwareVersion(1, 1, 1),
new FirmwareVersion(2, 2, 2),
0, 0, 0, 0, hasAndroidInjector);
DateTimeZone newTimeZone = DateTimeZone.forOffsetHours(2);
DateTimeZone.setDefault(newTimeZone);
// The system time zone has been updated, but the pod session state's time zone hasn't
// So the pods time should not have been changed
assertEquals(now, podSessionState.getTime());
assertEquals(Duration.standardHours(1).plus(Duration.standardMinutes(2).plus(Duration.standardSeconds(3))), podSessionState.getScheduleOffset());
}
@Test
@Ignore("Not Dagger compliant") // FIXME
public void changeSystemTimeZoneAndChangePodTimeZone() {
DateTimeZone timeZone = DateTimeZone.UTC;
DateTimeZone.setDefault(timeZone);
DateTime now = new DateTime(2020, 1, 1, 1, 2, 3, timeZone);
DateTime initialized = now.minus(Duration.standardDays(1));
DateTimeUtils.setCurrentMillisFixed(now.getMillis());
PodSessionState podSessionState = new PodSessionState(timeZone, 0x0,
new FirmwareVersion(1, 1, 1),
new FirmwareVersion(2, 2, 2),
0, 0, 0, 0, hasAndroidInjector);
DateTimeZone newTimeZone = DateTimeZone.forOffsetHours(2);
DateTimeZone.setDefault(newTimeZone);
podSessionState.setTimeZone(newTimeZone);
// Both the system time zone have been updated
// So the pods time should have been changed (to +2 hours)
assertEquals(now.withZone(newTimeZone), podSessionState.getTime());
assertEquals(Duration.standardHours(3).plus(Duration.standardMinutes(2).plus(Duration.standardSeconds(3))), podSessionState.getScheduleOffset());
}
@After
public void tearDown() {
DateTimeUtils.setCurrentMillisSystem();
}
}

View file

@ -44,6 +44,7 @@ dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.1.0' implementation 'androidx.appcompat:appcompat:1.1.0'
implementation "androidx.preference:preference-ktx:1.1.1" implementation "androidx.preference:preference-ktx:1.1.1"
implementation 'androidx.biometric:biometric:1.0.1'
implementation "androidx.activity:activity:${activityVersion}" implementation "androidx.activity:activity:${activityVersion}"
implementation "androidx.activity:activity-ktx:${activityVersion}" implementation "androidx.activity:activity-ktx:${activityVersion}"
implementation 'com.google.android.material:material:1.1.0' implementation 'com.google.android.material:material:1.1.0'
@ -65,6 +66,9 @@ dependencies {
implementation "io.reactivex.rxjava2:rxandroid:${rxandroid_version}" implementation "io.reactivex.rxjava2:rxandroid:${rxandroid_version}"
implementation 'org.apache.commons:commons-lang3:3.10' implementation 'org.apache.commons:commons-lang3:3.10'
//CryptoUtil
implementation 'com.madgag.spongycastle:core:1.58.0.0'
// Graphview cannot be upgraded // Graphview cannot be upgraded
implementation "com.jjoe64:graphview:4.0.1" implementation "com.jjoe64:graphview:4.0.1"

View file

@ -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.field.DatabaseField;
import com.j256.ormlite.table.DatabaseTable; 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; import info.nightscout.androidaps.plugins.pump.common.utils.DateTimeUtil;
/** /**
* Created by andy on 30.11.2019. * Created by andy on 30.11.2019.
*/ */
@DatabaseTable(tableName = DatabaseHelper.DATABASE_POD_HISTORY) @DatabaseTable(tableName = "PodHistory")
public class PodHistory implements DbObjectBase, Comparable<PodHistory> { public class OmnipodHistoryRecord implements DbObjectBase, Comparable<OmnipodHistoryRecord> {
@DatabaseField(id = true) @DatabaseField(id = true)
public long date; public long date;
private PodHistoryEntryType podHistoryEntryType;
@DatabaseField @DatabaseField
private long podEntryTypeCode; private long podEntryTypeCode;
@ -36,27 +32,16 @@ public class PodHistory implements DbObjectBase, Comparable<PodHistory> {
@DatabaseField @DatabaseField
private Boolean successConfirmed; private Boolean successConfirmed;
public PodHistory() { public OmnipodHistoryRecord() {
generatePumpId(); generatePumpId();
} }
public OmnipodHistoryRecord(long dateTimeInMillis, long podEntryTypeCode) {
public PodHistory(PodHistoryEntryType podDbEntryType) {
this.date = System.currentTimeMillis();
this.podHistoryEntryType = podDbEntryType;
this.podEntryTypeCode = podDbEntryType.getCode();
generatePumpId();
}
public PodHistory(long dateTimeInMillis, PodHistoryEntryType podDbEntryType) {
this.date = dateTimeInMillis; this.date = dateTimeInMillis;
this.podHistoryEntryType = podDbEntryType; this.podEntryTypeCode = podEntryTypeCode;
this.podEntryTypeCode = podDbEntryType.getCode();
generatePumpId(); generatePumpId();
} }
@Override @Override
public long getDate() { public long getDate() {
return this.date; return this.date;
@ -70,19 +55,14 @@ public class PodHistory implements DbObjectBase, Comparable<PodHistory> {
return DateTimeUtil.toStringFromTimeInMillis(this.date); 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() { public long getPodEntryTypeCode() {
return podEntryTypeCode; return podEntryTypeCode;
} }
public void setPodEntryTypeCode(long podEntryTypeCode) {
this.podEntryTypeCode = podEntryTypeCode;
}
public String getData() { public String getData() {
return data; return data;
} }
@ -130,7 +110,7 @@ public class PodHistory implements DbObjectBase, Comparable<PodHistory> {
} }
@Override @Override
public int compareTo(PodHistory otherOne) { public int compareTo(OmnipodHistoryRecord otherOne) {
return (int) (otherOne.date - this.date); return (int) (otherOne.date - this.date);
} }
} }

View file

@ -8,6 +8,7 @@ interface DatabaseHelperInterface {
fun getAllBgreadingsDataFromTime(mills: Long, ascending: Boolean): List<BgReading> fun getAllBgreadingsDataFromTime(mills: Long, ascending: Boolean): List<BgReading>
fun createOrUpdate(careportalEvent: CareportalEvent) fun createOrUpdate(careportalEvent: CareportalEvent)
fun createOrUpdate(record: DanaRHistoryRecord) fun createOrUpdate(record: DanaRHistoryRecord)
fun createOrUpdate(record: OmnipodHistoryRecord)
fun create(record: DbRequest) fun create(record: DbRequest)
fun getDanaRHistoryRecordsByType(type: Byte): List<DanaRHistoryRecord> fun getDanaRHistoryRecordsByType(type: Byte): List<DanaRHistoryRecord>
fun getTDDs(): List<TDD> fun getTDDs(): List<TDD>
@ -19,9 +20,10 @@ interface DatabaseHelperInterface {
fun roundDateToSec(date: Long): Long fun roundDateToSec(date: Long): Long
fun createOrUpdateTDD(record: TDD) fun createOrUpdateTDD(record: TDD)
fun createOrUpdate(tempBasal: TemporaryBasal) fun createOrUpdate(tempBasal: TemporaryBasal)
fun findTempBasalByPumpId(id: Long) : TemporaryBasal fun findTempBasalByPumpId(id: Long): TemporaryBasal
fun getTemporaryBasalsDataFromTime(mills: Long, ascending: Boolean) : List<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 getTDDsForLastXDays(days: Int): List<TDD>
fun getProfileSwitchData(from: Long, ascending: Boolean): List<ProfileSwitch> fun getProfileSwitchData(from: Long, ascending: Boolean): List<ProfileSwitch>
} }

View file

@ -60,7 +60,6 @@ public class PumpDescription {
public boolean supportsTDDs; public boolean supportsTDDs;
public boolean needsManualTDDLoad; public boolean needsManualTDDLoad;
public boolean hasFixedUnreachableAlert;
public boolean hasCustomUnreachableAlertCheck; public boolean hasCustomUnreachableAlertCheck;
public void resetSettings() { public void resetSettings() {
@ -95,7 +94,6 @@ public class PumpDescription {
supportsTDDs = false; supportsTDDs = false;
needsManualTDDLoad = true; needsManualTDDLoad = true;
hasFixedUnreachableAlert = false;
hasCustomUnreachableAlertCheck = false; hasCustomUnreachableAlertCheck = false;
} }
@ -145,7 +143,6 @@ public class PumpDescription {
is30minBasalRatesCapable = pumpCapability.hasCapability(PumpCapability.BasalRate30min); is30minBasalRatesCapable = pumpCapability.hasCapability(PumpCapability.BasalRate30min);
hasFixedUnreachableAlert = pumpType.getHasFixedUnreachableAlert();
hasCustomUnreachableAlertCheck = pumpType.getHasCustomUnreachableAlertCheck(); hasCustomUnreachableAlertCheck = pumpType.getHasCustomUnreachableAlertCheck();
} }

View file

@ -19,6 +19,7 @@ import info.nightscout.androidaps.data.Profile;
import info.nightscout.androidaps.data.PumpEnactResult; import info.nightscout.androidaps.data.PumpEnactResult;
import info.nightscout.androidaps.db.ExtendedBolus; import info.nightscout.androidaps.db.ExtendedBolus;
import info.nightscout.androidaps.db.TemporaryBasal; import info.nightscout.androidaps.db.TemporaryBasal;
import info.nightscout.androidaps.db.Treatment;
import info.nightscout.androidaps.events.EventAppExit; import info.nightscout.androidaps.events.EventAppExit;
import info.nightscout.androidaps.events.EventCustomActionsChanged; import info.nightscout.androidaps.events.EventCustomActionsChanged;
import info.nightscout.androidaps.interfaces.ActivePluginProvider; import info.nightscout.androidaps.interfaces.ActivePluginProvider;
@ -36,7 +37,6 @@ import info.nightscout.androidaps.plugins.general.overview.events.EventOverviewB
import info.nightscout.androidaps.plugins.pump.common.data.PumpStatus; import info.nightscout.androidaps.plugins.pump.common.data.PumpStatus;
import info.nightscout.androidaps.plugins.pump.common.defs.PumpDriverState; 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.defs.PumpType;
import info.nightscout.androidaps.db.Treatment;
import info.nightscout.androidaps.utils.DateUtil; import info.nightscout.androidaps.utils.DateUtil;
import info.nightscout.androidaps.utils.DecimalFormatter; import info.nightscout.androidaps.utils.DecimalFormatter;
import info.nightscout.androidaps.utils.FabricPrivacy; import info.nightscout.androidaps.utils.FabricPrivacy;
@ -64,17 +64,9 @@ public abstract class PumpPluginAbstract extends PumpPluginBase implements PumpI
protected CommandQueueProvider commandQueue; protected CommandQueueProvider commandQueue;
protected SP sp; protected SP sp;
protected DateUtil dateUtil; 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 PumpDescription pumpDescription = new PumpDescription();
protected ServiceConnection serviceConnection = null; protected ServiceConnection serviceConnection;
protected boolean serviceRunning = false; protected boolean serviceRunning = false;
// protected boolean isInitialized = false;
protected PumpDriverState pumpState = PumpDriverState.NotInitialized; protected PumpDriverState pumpState = PumpDriverState.NotInitialized;
protected boolean displayConnectionMessages = false; protected boolean displayConnectionMessages = false;
protected PumpType pumpType; protected PumpType pumpType;
@ -113,6 +105,7 @@ public abstract class PumpPluginAbstract extends PumpPluginBase implements PumpI
public abstract void initPumpStatusData(); public abstract void initPumpStatusData();
@Override @Override
protected void onStart() { protected void onStart() {
super.onStart(); super.onStart();
@ -135,6 +128,8 @@ public abstract class PumpPluginAbstract extends PumpPluginBase implements PumpI
@Override @Override
protected void onStop() { protected void onStop() {
aapsLogger.debug(LTag.PUMP, this.deviceID() + " onStop()");
context.unbindService(serviceConnection); context.unbindService(serviceConnection);
serviceRunning = false; serviceRunning = false;
@ -479,4 +474,8 @@ public abstract class PumpPluginAbstract extends PumpPluginBase implements PumpI
return new PumpEnactResult(getInjector()).success(false).enacted(false).comment(getResourceHelper().gs(resourceId)); return new PumpEnactResult(getInjector()).success(false).enacted(false).comment(getResourceHelper().gs(resourceId));
} }
protected FabricPrivacy getFabricPrivacy() {
return this.fabricPrivacy;
}
} }

View file

@ -19,8 +19,6 @@ public abstract class PumpStatus {
public long previousConnection = 0L; // here should be stored last connection of previous session (so needs to be public long previousConnection = 0L; // here should be stored last connection of previous session (so needs to be
// read before lastConnection is modified for first time). // read before lastConnection is modified for first time).
public long lastErrorConnection = 0L;
// last bolus // last bolus
public Date lastBolusTime; public Date lastBolusTime;
public Double lastBolusAmount; public Double lastBolusAmount;
@ -63,26 +61,11 @@ public abstract class PumpStatus {
public abstract void initSettings(); public abstract void initSettings();
public void setLastCommunicationToNow() { public void setLastCommunicationToNow() {
this.lastDataTime = DateUtil.now(); this.lastDataTime = DateUtil.now();
this.lastConnection = System.currentTimeMillis(); this.lastConnection = System.currentTimeMillis();
} }
public void setLastFailedCommunicationToNow() {
this.lastErrorConnection = System.currentTimeMillis();
}
public abstract String getErrorInfo(); public abstract String getErrorInfo();
public abstract <E> E getCustomData(String key, Class<E> clazz);
public String getCustomDataAsString(String key) {
return getCustomData(key, String.class);
}
} }

View file

@ -102,13 +102,7 @@ public enum PumpType {
new DoseSettings(0.05d, 30, 8 * 60, 0.05d), // new DoseSettings(0.05d, 30, 8 * 60, 0.05d), //
PumpTempBasalType.Absolute, // PumpTempBasalType.Absolute, //
new DoseSettings(0.05d, 30, 12 * 60, 0d, 30.0d), PumpCapability.BasalRate_Duration30minAllowed, // new DoseSettings(0.05d, 30, 12 * 60, 0d, 30.0d), PumpCapability.BasalRate_Duration30minAllowed, //
0.05d, null, 0.05d, null, PumpCapability.OmnipodCapabilities, true, true), 0.05d, null, 0.05d, null, PumpCapability.OmnipodCapabilities, true),
Insulet_Omnipod_Dash("Insulet Omnipod Dash", ManufacturerType.Insulet, "Omnipod Dash", 0.05d, null, //
new DoseSettings(0.05d, 30, 8 * 60, 0.05d), //
PumpTempBasalType.Absolute, //
new DoseSettings(0.05d, 30, 12 * 60, 0d, 30.0d), PumpCapability.BasalRate_Duration30minAllowed, //
0.05d, null, 0.05d, null, PumpCapability.OmnipodCapabilities, true, true), // TODO just copied OmniPod for now
// Medtronic // Medtronic
Medtronic_512_712("Medtronic 512/712", ManufacturerType.Medtronic, "512/712", 0.1d, null, // Medtronic_512_712("Medtronic 512/712", ManufacturerType.Medtronic, "512/712", 0.1d, null, //
@ -163,7 +157,6 @@ public enum PumpType {
private double baseBasalStep; // private double baseBasalStep; //
private DoseStepSize baseBasalSpecialSteps; // private DoseStepSize baseBasalSpecialSteps; //
private PumpCapability pumpCapability; private PumpCapability pumpCapability;
private boolean hasFixedUnreachableAlert;
private boolean hasCustomUnreachableAlertCheck; private boolean hasCustomUnreachableAlertCheck;
private PumpType parent; private PumpType parent;
@ -231,7 +224,7 @@ public enum PumpType {
PumpCapability pumpCapability) { PumpCapability pumpCapability) {
this(description, manufacturer, model, bolusSize, specialBolusSize, extendedBolusSettings, pumpTempBasalType, this(description, manufacturer, model, bolusSize, specialBolusSize, extendedBolusSettings, pumpTempBasalType,
tbrSettings, specialBasalDurations, baseBasalMinValue, null, baseBasalStep, tbrSettings, specialBasalDurations, baseBasalMinValue, null, baseBasalStep,
baseBasalSpecialSteps, pumpCapability, false, false); baseBasalSpecialSteps, pumpCapability, false);
} }
@ -249,7 +242,6 @@ public enum PumpType {
double baseBasalStep, double baseBasalStep,
DoseStepSize baseBasalSpecialSteps, // DoseStepSize baseBasalSpecialSteps, //
PumpCapability pumpCapability, PumpCapability pumpCapability,
boolean hasFixedUnreachableAlert,
boolean hasCustomUnreachableAlertCheck) { boolean hasCustomUnreachableAlertCheck) {
this.description = description; this.description = description;
this.manufacturer = manufacturer; this.manufacturer = manufacturer;
@ -265,17 +257,11 @@ public enum PumpType {
this.baseBasalStep = baseBasalStep; this.baseBasalStep = baseBasalStep;
this.baseBasalSpecialSteps = baseBasalSpecialSteps; this.baseBasalSpecialSteps = baseBasalSpecialSteps;
this.pumpCapability = pumpCapability; this.pumpCapability = pumpCapability;
this.hasFixedUnreachableAlert = hasFixedUnreachableAlert;
this.hasCustomUnreachableAlertCheck = hasCustomUnreachableAlertCheck; this.hasCustomUnreachableAlertCheck = hasCustomUnreachableAlertCheck;
} }
public boolean getHasFixedUnreachableAlert() {
return hasFixedUnreachableAlert;
}
public boolean getHasCustomUnreachableAlertCheck() { public boolean getHasCustomUnreachableAlertCheck() {
return hasFixedUnreachableAlert; return hasCustomUnreachableAlertCheck;
} }
public String getDescription() { public String getDescription() {

View file

@ -3,7 +3,7 @@ package info.nightscout.androidaps.utils.protection
import androidx.biometric.BiometricConstants import androidx.biometric.BiometricConstants
import androidx.biometric.BiometricPrompt import androidx.biometric.BiometricPrompt
import androidx.fragment.app.FragmentActivity 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.ToastUtils
import info.nightscout.androidaps.utils.extensions.runOnUiThread import info.nightscout.androidaps.utils.extensions.runOnUiThread
import java.util.concurrent.Executors import java.util.concurrent.Executors

View file

@ -7,7 +7,7 @@ import android.view.LayoutInflater
import android.view.View import android.view.View
import android.widget.EditText import android.widget.EditText
import androidx.annotation.StringRes 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.CryptoUtil
import info.nightscout.androidaps.utils.ToastUtils import info.nightscout.androidaps.utils.ToastUtils
import info.nightscout.androidaps.utils.alertDialogs.AlertDialogHelper import info.nightscout.androidaps.utils.alertDialogs.AlertDialogHelper

View file

@ -1,7 +1,7 @@
package info.nightscout.androidaps.utils.protection package info.nightscout.androidaps.utils.protection
import androidx.fragment.app.FragmentActivity import androidx.fragment.app.FragmentActivity
import info.nightscout.androidaps.R import info.nightscout.androidaps.core.R
import info.nightscout.androidaps.utils.sharedPreferences.SP import info.nightscout.androidaps.utils.sharedPreferences.SP
import javax.inject.Inject import javax.inject.Inject
import javax.inject.Singleton import javax.inject.Singleton
@ -42,10 +42,10 @@ class ProtectionCheck @Inject constructor(
fun isLocked(protection: Protection): Boolean { fun isLocked(protection: Protection): Boolean {
return when (ProtectionType.values()[sp.getInt(protectionTypeResourceIDs[protection.ordinal], ProtectionType.NONE.ordinal)]) { return when (ProtectionType.values()[sp.getInt(protectionTypeResourceIDs[protection.ordinal], ProtectionType.NONE.ordinal)]) {
ProtectionType.NONE -> false ProtectionType.NONE -> false
ProtectionType.BIOMETRIC -> true ProtectionType.BIOMETRIC -> true
ProtectionType.MASTER_PASSWORD -> sp.getString(R.string.key_master_password, "") != "" ProtectionType.MASTER_PASSWORD -> sp.getString(R.string.key_master_password, "") != ""
ProtectionType.CUSTOM_PASSWORD -> sp.getString(passwordsResourceIDs[protection.ordinal], "") != "" ProtectionType.CUSTOM_PASSWORD -> sp.getString(passwordsResourceIDs[protection.ordinal], "") != ""
} }
} }
@ -53,13 +53,13 @@ class ProtectionCheck @Inject constructor(
fun queryProtection(activity: FragmentActivity, protection: Protection, fun queryProtection(activity: FragmentActivity, protection: Protection,
ok: Runnable?, cancel: Runnable? = null, fail: Runnable? = null) { ok: Runnable?, cancel: Runnable? = null, fail: Runnable? = null) {
when (ProtectionType.values()[sp.getInt(protectionTypeResourceIDs[protection.ordinal], ProtectionType.NONE.ordinal)]) { when (ProtectionType.values()[sp.getInt(protectionTypeResourceIDs[protection.ordinal], ProtectionType.NONE.ordinal)]) {
ProtectionType.NONE -> ProtectionType.NONE ->
ok?.run() ok?.run()
ProtectionType.BIOMETRIC -> ProtectionType.BIOMETRIC ->
BiometricCheck.biometricPrompt(activity, titleResourceIDs[protection.ordinal], ok, cancel, fail, passwordCheck) BiometricCheck.biometricPrompt(activity, titleResourceIDs[protection.ordinal], ok, cancel, fail, passwordCheck)
ProtectionType.MASTER_PASSWORD -> ProtectionType.MASTER_PASSWORD ->
passwordCheck.queryPassword(activity, R.string.master_password, R.string.key_master_password, { ok?.run() }, { cancel?.run() }, { fail?.run() }) passwordCheck.queryPassword(activity, R.string.master_password, R.string.key_master_password, { ok?.run() }, { cancel?.run() }, { fail?.run() })
ProtectionType.CUSTOM_PASSWORD -> ProtectionType.CUSTOM_PASSWORD ->
passwordCheck.queryPassword(activity, titleResourceIDs[protection.ordinal], passwordsResourceIDs[protection.ordinal], { ok?.run() }, { cancel?.run() }, { fail?.run() }) passwordCheck.queryPassword(activity, titleResourceIDs[protection.ordinal], passwordsResourceIDs[protection.ordinal], { ok?.run() }, { cancel?.run() }, { fail?.run() })
} }
} }

View file

@ -1,4 +1,4 @@
package info.nightscout.androidaps.utils; package info.nightscout.androidaps.utils.ui;
import android.app.Activity; import android.app.Activity;
import android.content.Context; import android.content.Context;
@ -8,7 +8,6 @@ import android.util.AttributeSet;
import android.view.View; import android.view.View;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import info.nightscout.androidaps.logging.StacktraceLoggerWrapper; import info.nightscout.androidaps.logging.StacktraceLoggerWrapper;

View file

@ -129,6 +129,10 @@
<string name="shortminute">m</string> <string name="shortminute">m</string>
<string name="shortday">d</string> <string name="shortday">d</string>
<!-- Protection-->
<string name="wrongpassword">Wrong password</string>
<string name="passwords_dont_match">Passwords don\'t match</string>
<!-- Profile--> <!-- Profile-->
<string name="basalprofilenotaligned">Basal values not aligned to hours: %1$s</string> <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> <string name="minimalbasalvaluereplaced">Basal value replaced by minimal supported value: %1$s</string>

View file

@ -67,7 +67,6 @@
<string name="updatingbasalrates">Updating basal rates</string> <string name="updatingbasalrates">Updating basal rates</string>
<string name="settingtempbasal">Setting temp basal</string> <string name="settingtempbasal">Setting temp basal</string>
<string name="waitingfortimesynchronization">Waiting for time synchronization (%1$d sec)</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="wrongpumppassword">Wrong pump password!</string>
<string name="danar_history_alarm">Alarms</string> <string name="danar_history_alarm">Alarms</string>
<string name="danar_history_basalhours">Basal Hours</string> <string name="danar_history_basalhours">Basal Hours</string>

View file

@ -80,7 +80,7 @@ class MedtronicFragment : DaggerFragment() {
medtronic_pumpstatus.setBackgroundColor(resourceHelper.gc(R.color.colorInitializingBorder)) 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.setTextColor(Color.WHITE)
medtronic_pump_status.text = "{fa-bed}" medtronic_pump_status.text = "{fa-bed}"
@ -172,7 +172,7 @@ class MedtronicFragment : DaggerFragment() {
@Synchronized @Synchronized
private fun setDeviceStatus() { private fun setDeviceStatus() {
val resourceId = rileyLinkServiceData.rileyLinkServiceState.getResourceId(RileyLinkTargetDevice.MedtronicPump) val resourceId = rileyLinkServiceData.rileyLinkServiceState.getResourceId()
val rileyLinkError = medtronicPumpPlugin.rileyLinkService?.error val rileyLinkError = medtronicPumpPlugin.rileyLinkService?.error
medtronic_rl_status.text = medtronic_rl_status.text =
when { when {

View file

@ -36,7 +36,6 @@ import info.nightscout.androidaps.data.Profile;
import info.nightscout.androidaps.data.PumpEnactResult; import info.nightscout.androidaps.data.PumpEnactResult;
import info.nightscout.androidaps.db.Source; import info.nightscout.androidaps.db.Source;
import info.nightscout.androidaps.db.TemporaryBasal; import info.nightscout.androidaps.db.TemporaryBasal;
import info.nightscout.androidaps.events.EventRefreshOverview; import info.nightscout.androidaps.events.EventRefreshOverview;
import info.nightscout.androidaps.interfaces.ActivePluginProvider; import info.nightscout.androidaps.interfaces.ActivePluginProvider;
import info.nightscout.androidaps.interfaces.CommandQueueProvider; import info.nightscout.androidaps.interfaces.CommandQueueProvider;
@ -55,9 +54,11 @@ 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.PumpStatus;
import info.nightscout.androidaps.plugins.pump.common.defs.PumpDriverState; 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.defs.PumpType;
import info.nightscout.androidaps.plugins.pump.common.events.EventRefreshButtonState;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkConst; import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkConst;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkUtil; import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkUtil;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkPumpDevice; import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkPumpDevice;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkPumpInfo;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkServiceState; import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkServiceState;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.RileyLinkServiceData; import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.RileyLinkServiceData;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.tasks.ResetRileyLinkConfigurationTask; import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.tasks.ResetRileyLinkConfigurationTask;
@ -81,7 +82,6 @@ import info.nightscout.androidaps.plugins.pump.medtronic.defs.MedtronicUIRespons
import info.nightscout.androidaps.plugins.pump.medtronic.driver.MedtronicPumpStatus; import info.nightscout.androidaps.plugins.pump.medtronic.driver.MedtronicPumpStatus;
import info.nightscout.androidaps.plugins.pump.medtronic.events.EventMedtronicPumpConfigurationChanged; import info.nightscout.androidaps.plugins.pump.medtronic.events.EventMedtronicPumpConfigurationChanged;
import info.nightscout.androidaps.plugins.pump.medtronic.events.EventMedtronicPumpValuesChanged; import info.nightscout.androidaps.plugins.pump.medtronic.events.EventMedtronicPumpValuesChanged;
import info.nightscout.androidaps.plugins.pump.common.events.EventRefreshButtonState;
import info.nightscout.androidaps.plugins.pump.medtronic.service.RileyLinkMedtronicService; import info.nightscout.androidaps.plugins.pump.medtronic.service.RileyLinkMedtronicService;
import info.nightscout.androidaps.plugins.pump.medtronic.util.MedtronicConst; import info.nightscout.androidaps.plugins.pump.medtronic.util.MedtronicConst;
import info.nightscout.androidaps.plugins.pump.medtronic.util.MedtronicUtil; import info.nightscout.androidaps.plugins.pump.medtronic.util.MedtronicUtil;
@ -162,6 +162,12 @@ public class MedtronicPumpPlugin extends PumpPluginAbstract implements PumpInter
this.serviceTaskExecutor = serviceTaskExecutor; this.serviceTaskExecutor = serviceTaskExecutor;
displayConnectionMessages = false; displayConnectionMessages = false;
}
@Override
protected void onStart() {
aapsLogger.debug(LTag.PUMP, this.deviceID() + " started.");
serviceConnection = new ServiceConnection() { serviceConnection = new ServiceConnection() {
@ -189,11 +195,7 @@ public class MedtronicPumpPlugin extends PumpPluginAbstract implements PumpInter
}).start(); }).start();
} }
}; };
}
@Override
protected void onStart() {
super.onStart(); super.onStart();
} }
@ -234,21 +236,6 @@ public class MedtronicPumpPlugin extends PumpPluginAbstract implements PumpInter
} }
@Override
public void resetRileyLinkConfiguration() {
rileyLinkMedtronicService.resetRileyLinkConfiguration();
}
@Override
public boolean hasTuneUp() {
return true;
}
@Override
public void doTuneUpDevice() {
rileyLinkMedtronicService.doTuneUpDevice();
}
@Override @Override
public void triggerPumpConfigurationChangedEvent() { public void triggerPumpConfigurationChangedEvent() {
rxBus.send(new EventMedtronicPumpConfigurationChanged()); rxBus.send(new EventMedtronicPumpConfigurationChanged());
@ -337,6 +324,22 @@ public class MedtronicPumpPlugin extends PumpPluginAbstract implements PumpInter
return rileyLinkMedtronicService; return rileyLinkMedtronicService;
} }
@Override public RileyLinkPumpInfo getPumpInfo() {
String pumpDescription = pumpType.getDescription();
String frequency = resourceHelper.gs(medtronicPumpStatus.pumpFrequency.equals("medtronic_pump_frequency_us_ca") ? R.string.medtronic_pump_frequency_us_ca : R.string.medtronic_pump_frequency_worldwide);
String model = medtronicPumpStatus.medtronicDeviceType == null ? "???" : "Medtronic " + medtronicPumpStatus.medtronicDeviceType.getPumpModel();
String serialNumber = medtronicPumpStatus.serialNumber;
return new RileyLinkPumpInfo(pumpDescription, frequency, model, serialNumber);
}
@Override public long getLastConnectionTimeMillis() {
return medtronicPumpStatus.lastConnection;
}
@Override public void setLastCommunicationToNow() {
medtronicPumpStatus.setLastCommunicationToNow();
}
@Override @Override
public boolean isInitialized() { public boolean isInitialized() {
if (displayConnectionMessages) if (displayConnectionMessages)
@ -346,8 +349,8 @@ public class MedtronicPumpPlugin extends PumpPluginAbstract implements PumpInter
@Override @Override
public void setIsBusy(boolean isBusy_) { public void setBusy(boolean busy) {
isBusy = isBusy_; isBusy = busy;
} }
@Override @Override
@ -772,7 +775,7 @@ public class MedtronicPumpPlugin extends PumpPluginAbstract implements PumpInter
if ((clock.localDeviceTime.getYear() <= 2015) || (timeDiff <= 24 * 60 * 60)) { if ((clock.localDeviceTime.getYear() <= 2015) || (timeDiff <= 24 * 60 * 60)) {
aapsLogger.info(LTag.PUMP, "MedtronicPumpPlugin::checkTimeAndOptionallySetTime - Time difference is {} s. Set time on pump." , timeDiff); aapsLogger.info(LTag.PUMP, "MedtronicPumpPlugin::checkTimeAndOptionallySetTime - Time difference is {} s. Set time on pump.", timeDiff);
rileyLinkMedtronicService.getMedtronicUIComm().executeCommand(MedtronicCommandType.SetRealTimeClock); rileyLinkMedtronicService.getMedtronicUIComm().executeCommand(MedtronicCommandType.SetRealTimeClock);

View file

@ -10,14 +10,13 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import javax.inject.Inject; import javax.inject.Inject;
import javax.inject.Singleton;
import dagger.android.HasAndroidInjector;
import info.nightscout.androidaps.logging.LTag; import info.nightscout.androidaps.logging.LTag;
import info.nightscout.androidaps.plugins.pump.common.data.PumpStatus; import info.nightscout.androidaps.plugins.pump.common.data.PumpStatus;
import info.nightscout.androidaps.plugins.pump.common.defs.PumpDeviceState; import info.nightscout.androidaps.plugins.pump.common.defs.PumpDeviceState;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkCommunicationManager; 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.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.RileyLinkCommunicationException;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.data.RFSpyResponse; import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.data.RFSpyResponse;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.data.RLMessage; 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 * This was mostly rewritten from Original version, and lots of commands and
* functionality added. * functionality added.
*/ */
@Singleton
public class MedtronicCommunicationManager extends RileyLinkCommunicationManager { public class MedtronicCommunicationManager extends RileyLinkCommunicationManager {
@Inject MedtronicPumpStatus medtronicPumpStatus; @Inject MedtronicPumpStatus medtronicPumpStatus;
@ -73,9 +73,13 @@ public class MedtronicCommunicationManager extends RileyLinkCommunicationManager
private boolean doWakeUpBeforeCommand = true; private boolean doWakeUpBeforeCommand = true;
// This empty constructor must be kept, otherwise dagger injection might break!
@Inject
public MedtronicCommunicationManager() {}
public MedtronicCommunicationManager(HasAndroidInjector injector, RFSpy rfspy) { @Inject
super(injector, rfspy); 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( medtronicPumpStatus.previousConnection = sp.getLong(
RileyLinkConst.Prefs.LastGoodDeviceCommunicationTime, 0L); RileyLinkConst.Prefs.LastGoodDeviceCommunicationTime, 0L);
} }
@ -912,8 +916,4 @@ public class MedtronicCommunicationManager extends RileyLinkCommunicationManager
return false; return false;
} }
@Override public PumpStatus getPumpStatus() {
return medtronicPumpStatus;
}
} }

View file

@ -3,8 +3,6 @@ package info.nightscout.androidaps.plugins.pump.medtronic.data.dto;
import org.joda.time.LocalDateTime; 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.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.common.hw.rileylink.defs.RileyLinkTargetDevice;
import info.nightscout.androidaps.plugins.pump.medtronic.defs.MedtronicCommandType; import info.nightscout.androidaps.plugins.pump.medtronic.defs.MedtronicCommandType;
import info.nightscout.androidaps.utils.resources.ResourceHelper; import info.nightscout.androidaps.utils.resources.ResourceHelper;
@ -18,24 +16,13 @@ public class RLHistoryItemMedtronic extends RLHistoryItem {
this.medtronicCommandType = medtronicCommandType; this.medtronicCommandType = medtronicCommandType;
} }
@Override
public String getDescription(ResourceHelper resourceHelper) { public String getDescription(ResourceHelper resourceHelper) {
if (RLHistoryItemSource.MedtronicCommand.equals(source)) {
switch (this.source) { return medtronicCommandType.name();
case RileyLink:
return "State: " + resourceHelper.gs(serviceState.getResourceId(targetDevice))
+ (this.errorCode == null ? "" : ", Error Code: " + errorCode);
case MedtronicPump:
return resourceHelper.gs(pumpDeviceState.getResourceId());
case MedtronicCommand:
return medtronicCommandType.name();
default:
return "Unknown Description";
} }
return super.getDescription(resourceHelper);
} }
} }

View file

@ -165,27 +165,6 @@ public class MedtronicPumpStatus extends info.nightscout.androidaps.plugins.pump
return (errorDescription == null) ? "-" : errorDescription; return (errorDescription == null) ? "-" : errorDescription;
} }
@Override
public <E> E getCustomData(String key, Class<E> clazz) {
switch(key) {
case "SERIAL_NUMBER":
return (E)serialNumber;
case "PUMP_FREQUENCY":
return (E)pumpFrequency;
case "PUMP_MODEL": {
if (medtronicDeviceType==null)
return null;
else
return (E)medtronicDeviceType.getPumpModel();
}
default:
return null;
}
}
public PumpDeviceState getPumpDeviceState() { public PumpDeviceState getPumpDeviceState() {
return pumpDeviceState; return pumpDeviceState;

View file

@ -1,22 +1,20 @@
package info.nightscout.androidaps.plugins.pump.medtronic.service; package info.nightscout.androidaps.plugins.pump.medtronic.service;
import android.content.Intent; import android.content.Intent;
import android.content.IntentFilter;
import android.content.res.Configuration; import android.content.res.Configuration;
import android.os.Binder; import android.os.Binder;
import android.os.IBinder; import android.os.IBinder;
import javax.inject.Inject; import javax.inject.Inject;
import javax.inject.Singleton;
import info.nightscout.androidaps.logging.LTag; import info.nightscout.androidaps.logging.LTag;
import info.nightscout.androidaps.plugins.pump.common.defs.PumpDeviceState; import info.nightscout.androidaps.plugins.pump.common.defs.PumpDeviceState;
import info.nightscout.androidaps.plugins.pump.common.defs.PumpType; import info.nightscout.androidaps.plugins.pump.common.defs.PumpType;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkConst; 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.RFSpy;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.RileyLinkBLE;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.defs.RileyLinkEncodingType; import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.defs.RileyLinkEncodingType;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.defs.RileyLinkTargetFrequency; import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.defs.RileyLinkTargetFrequency;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkServiceState;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkTargetDevice; import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkTargetDevice;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.RileyLinkService; import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.RileyLinkService;
import info.nightscout.androidaps.plugins.pump.common.utils.ByteUtil; import info.nightscout.androidaps.plugins.pump.common.utils.ByteUtil;
@ -25,7 +23,6 @@ import info.nightscout.androidaps.plugins.pump.medtronic.R;
import info.nightscout.androidaps.plugins.pump.medtronic.comm.MedtronicCommunicationManager; import info.nightscout.androidaps.plugins.pump.medtronic.comm.MedtronicCommunicationManager;
import info.nightscout.androidaps.plugins.pump.medtronic.comm.ui.MedtronicUIComm; import info.nightscout.androidaps.plugins.pump.medtronic.comm.ui.MedtronicUIComm;
import info.nightscout.androidaps.plugins.pump.medtronic.comm.ui.MedtronicUIPostprocessor; import info.nightscout.androidaps.plugins.pump.medtronic.comm.ui.MedtronicUIPostprocessor;
import info.nightscout.androidaps.plugins.pump.medtronic.data.MedtronicHistoryData;
import info.nightscout.androidaps.plugins.pump.medtronic.defs.BatteryType; import info.nightscout.androidaps.plugins.pump.medtronic.defs.BatteryType;
import info.nightscout.androidaps.plugins.pump.medtronic.driver.MedtronicPumpStatus; import info.nightscout.androidaps.plugins.pump.medtronic.driver.MedtronicPumpStatus;
import info.nightscout.androidaps.plugins.pump.medtronic.util.MedtronicConst; import info.nightscout.androidaps.plugins.pump.medtronic.util.MedtronicConst;
@ -34,15 +31,17 @@ import info.nightscout.androidaps.plugins.pump.medtronic.util.MedtronicUtil;
/** /**
* RileyLinkMedtronicService is intended to stay running when the gui-app is closed. * RileyLinkMedtronicService is intended to stay running when the gui-app is closed.
*/ */
@Singleton
public class RileyLinkMedtronicService extends RileyLinkService { public class RileyLinkMedtronicService extends RileyLinkService {
@Inject MedtronicPumpPlugin medtronicPumpPlugin; @Inject MedtronicPumpPlugin medtronicPumpPlugin;
@Inject MedtronicUtil medtronicUtil; @Inject MedtronicUtil medtronicUtil;
@Inject MedtronicUIPostprocessor medtronicUIPostprocessor; @Inject MedtronicUIPostprocessor medtronicUIPostprocessor;
@Inject MedtronicPumpStatus medtronicPumpStatus; @Inject MedtronicPumpStatus medtronicPumpStatus;
@Inject RFSpy rfSpy;
@Inject MedtronicCommunicationManager medtronicCommunicationManager;
private MedtronicUIComm medtronicUIComm; private MedtronicUIComm medtronicUIComm;
private MedtronicCommunicationManager medtronicCommunicationManager;
private IBinder mBinder = new LocalBinder(); private IBinder mBinder = new LocalBinder();
private boolean serialChanged = false; private boolean serialChanged = false;
@ -54,8 +53,9 @@ public class RileyLinkMedtronicService extends RileyLinkService {
private boolean inPreInit = true; private boolean inPreInit = true;
// This empty constructor must be kept, otherwise dagger injection might break!
@Inject
public RileyLinkMedtronicService() { public RileyLinkMedtronicService() {
super();
} }
@ -99,23 +99,13 @@ public class RileyLinkMedtronicService extends RileyLinkService {
// get most recently used RileyLink address // get most recently used RileyLink address
rileyLinkServiceData.rileylinkAddress = sp.getString(RileyLinkConst.Prefs.RileyLinkAddress, ""); rileyLinkServiceData.rileylinkAddress = sp.getString(RileyLinkConst.Prefs.RileyLinkAddress, "");
rileyLinkBLE = new RileyLinkBLE(injector, this); // or this
rfspy = new RFSpy(injector, rileyLinkBLE);
rfspy.startReader(); rfspy.startReader();
// init rileyLinkCommunicationManager
medtronicCommunicationManager = new MedtronicCommunicationManager(injector, rfspy);
medtronicUIComm = new MedtronicUIComm(injector, aapsLogger, medtronicUtil, medtronicUIPostprocessor, medtronicCommunicationManager); medtronicUIComm = new MedtronicUIComm(injector, aapsLogger, medtronicUtil, medtronicUIPostprocessor, medtronicCommunicationManager);
aapsLogger.debug(LTag.PUMPCOMM, "RileyLinkMedtronicService newly constructed"); aapsLogger.debug(LTag.PUMPCOMM, "RileyLinkMedtronicService newly constructed");
} }
public void resetRileyLinkConfiguration() {
rfspy.resetRileyLinkConfiguration();
}
public MedtronicCommunicationManager getDeviceCommunicationManager() { public MedtronicCommunicationManager getDeviceCommunicationManager() {
return this.medtronicCommunicationManager; return this.medtronicCommunicationManager;
} }
@ -186,25 +176,10 @@ public class RileyLinkMedtronicService extends RileyLinkService {
// PumpInterface - REMOVE // PumpInterface - REMOVE
public boolean isInitialized() { public boolean isInitialized() {
return RileyLinkServiceState.isReady(rileyLinkServiceData.rileyLinkServiceState); return rileyLinkServiceData.rileyLinkServiceState.isReady();
} }
@Override
public String getDeviceSpecificBroadcastsIdentifierPrefix() {
return null;
}
public boolean handleDeviceSpecificBroadcasts(Intent intent) {
return false;
}
@Override
public void registerDeviceSpecificBroadcasts(IntentFilter intentFilter) {
}
public boolean verifyConfiguration() { public boolean verifyConfiguration() {
try { try {
String regexSN = "[0-9]{6}"; String regexSN = "[0-9]{6}";

1
omnipod/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
/build

110
omnipod/build.gradle Normal file
View file

@ -0,0 +1,110 @@
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
ext {
powermockVersion = "1.7.3"
}
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-rc4"'
buildConfigField "String", "DEV_VERSION_COMMIT", '"7d5dc54656c961660451c4fa4c6ea66bd83a1c46"'
buildConfigField "String", "DEV_VERSION_COMMIT_DATE", '"21.8.2020"' // 21st 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'
testImplementation "org.mockito:mockito-core:2.8.47"
testImplementation "org.powermock:powermock-api-mockito2:$powermockVersion"
testImplementation "org.powermock:powermock-module-junit4:${powermockVersion}"
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}

View file

Some files were not shown because too many files have changed in this diff Show more