Merge branch 'dev' into newdb

This commit is contained in:
Milos Kozak 2021-02-11 21:55:47 +01:00
commit 5a4a662ec1
338 changed files with 3142 additions and 964 deletions

8
.github/dependabot.yml vendored Normal file
View file

@ -0,0 +1,8 @@
version: 2
updates:
- package-ecosystem: gradle
directory: "/"
schedule:
interval: daily
open-pull-requests-limit: 10
target-branch: dev

View file

@ -216,9 +216,6 @@ android {
useLibrary "org.apache.http.legacy"
configurations.all {
resolutionStrategy.force 'com.google.code.findbugs:jsr305:1.3.9'
}
}
allprojects {
@ -239,7 +236,8 @@ dependencies {
implementation project(':danar')
implementation project(':rileylink')
implementation project(':medtronic')
implementation project(':omnipod')
implementation project(':omnipod-eros')
implementation project(':omnipod-dash')
implementation fileTree(include: ['*.jar'], dir: 'libs')
@ -253,18 +251,16 @@ dependencies {
testImplementation "org.powermock:powermock-module-junit4-rule-agent:${powermockVersion}"
testImplementation "org.powermock:powermock-module-junit4-rule:${powermockVersion}"
testImplementation "org.powermock:powermock-module-junit4:${powermockVersion}"
testImplementation 'joda-time:joda-time:2.10.9'
testImplementation "joda-time:joda-time:$jodatime_version"
testImplementation('com.google.truth:truth:1.1.2') {
exclude group: "com.google.guava", module: "guava"
exclude group: "com.google.code.findbugs", module: "jsr305"
}
testImplementation "org.skyscreamer:jsonassert:1.5.0"
testImplementation "org.hamcrest:hamcrest-all:1.3"
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0-alpha03'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0-alpha03'
androidTestImplementation "androidx.test.ext:junit:$androidx_junit"
androidTestImplementation "androidx.test:rules:$androidx_rules"
androidTestImplementation 'com.google.code.findbugs:jsr305:3.0.2'
/* Dagger2 - We are going to use dagger.android which includes
* support for Activity and fragment injection so we need to include

Binary file not shown.

View file

@ -11,7 +11,7 @@ import info.nightscout.androidaps.danar.di.DanaRModule
import info.nightscout.androidaps.danars.di.DanaRSModule
import info.nightscout.androidaps.database.DatabaseModule
import info.nightscout.androidaps.plugins.pump.common.dagger.RileyLinkModule
import info.nightscout.androidaps.plugins.pump.omnipod.dagger.OmnipodModule
import info.nightscout.androidaps.plugins.pump.omnipod.eros.dagger.OmnipodErosModule
import javax.inject.Singleton
@Singleton
@ -32,7 +32,7 @@ import javax.inject.Singleton
WizardModule::class,
RileyLinkModule::class,
MedtronicModule::class,
OmnipodModule::class,
OmnipodErosModule::class,
APSModule::class,
PreferencesModule::class,
OverviewModule::class,

View file

@ -36,7 +36,7 @@ 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.medtronic.MedtronicFragment
import info.nightscout.androidaps.plugins.pump.medtronic.dialog.RileyLinkStatusDeviceMedtronic
import info.nightscout.androidaps.plugins.pump.omnipod.ui.OmnipodOverviewFragment
import info.nightscout.androidaps.plugins.pump.omnipod.eros.ui.OmnipodOverviewFragment
import info.nightscout.androidaps.plugins.pump.virtual.VirtualPumpFragment
import info.nightscout.androidaps.plugins.source.BGSourceFragment
import info.nightscout.androidaps.plugins.treatments.TreatmentsFragment

View file

@ -42,7 +42,7 @@ import info.nightscout.androidaps.plugins.pump.combo.ComboPlugin
import info.nightscout.androidaps.plugins.pump.insight.LocalInsightPlugin
import info.nightscout.androidaps.plugins.pump.mdi.MDIPlugin
import info.nightscout.androidaps.plugins.pump.medtronic.MedtronicPumpPlugin
import info.nightscout.androidaps.plugins.pump.omnipod.OmnipodPumpPlugin
import info.nightscout.androidaps.plugins.pump.omnipod.eros.OmnipodErosPumpPlugin
import info.nightscout.androidaps.plugins.pump.virtual.VirtualPumpPlugin
import info.nightscout.androidaps.plugins.sensitivity.SensitivityAAPSPlugin
import info.nightscout.androidaps.plugins.sensitivity.SensitivityOref1Plugin
@ -160,7 +160,7 @@ abstract class PluginsModule {
@PumpDriver
@IntoMap
@IntKey(155)
abstract fun bindOmnipodPumpPlugin(plugin: OmnipodPumpPlugin): PluginBase
abstract fun bindOmnipodPumpPlugin(plugin: OmnipodErosPumpPlugin): PluginBase
@Binds
@NotNSClient

View file

@ -10,7 +10,7 @@ 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.connection_service.InsightConnectionService
import info.nightscout.androidaps.plugins.pump.medtronic.service.RileyLinkMedtronicService
import info.nightscout.androidaps.plugins.pump.omnipod.rileylink.service.RileyLinkOmnipodService
import info.nightscout.androidaps.plugins.pump.omnipod.eros.rileylink.service.RileyLinkOmnipodService
import info.nightscout.androidaps.services.AlarmSoundService
import info.nightscout.androidaps.services.LocationService

View file

@ -1,5 +1,7 @@
package info.nightscout.androidaps.plugins.aps.openAPSAMA;
import androidx.annotation.Nullable;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
@ -16,7 +18,6 @@ import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.nio.charset.StandardCharsets;
import javax.annotation.Nullable;
import javax.inject.Inject;
import info.nightscout.androidaps.plugins.general.openhumans.OpenHumansUploader;

View file

@ -1,5 +1,7 @@
package info.nightscout.androidaps.plugins.aps.openAPSSMB;
import androidx.annotation.Nullable;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
@ -16,7 +18,6 @@ import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.nio.charset.StandardCharsets;
import javax.annotation.Nullable;
import javax.inject.Inject;
import dagger.android.HasAndroidInjector;

View file

@ -27,7 +27,7 @@ import info.nightscout.androidaps.logging.UserEntryLogger
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
import info.nightscout.androidaps.plugins.general.actions.defs.CustomAction
import info.nightscout.androidaps.plugins.general.overview.StatusLightHandler
import info.nightscout.androidaps.plugins.pump.omnipod.OmnipodPumpPlugin
import info.nightscout.androidaps.plugins.pump.omnipod.eros.OmnipodErosPumpPlugin
import info.nightscout.androidaps.queue.Callback
import info.nightscout.androidaps.skins.SkinProvider
import info.nightscout.androidaps.utils.FabricPrivacy
@ -303,7 +303,7 @@ class ActionsFragment : DaggerFragment() {
val activeBgSource = activePlugin.activeBgSource
historyBrowser?.visibility = (profile != null).toVisibility()
fill?.visibility = (pump.pumpDescription.isRefillingCapable && pump.isInitialized && !pump.isSuspended).toVisibility()
pumpBatteryChange?.visibility = (pump.pumpDescription.isBatteryReplaceable || (pump is OmnipodPumpPlugin && pump.isUseRileyLinkBatteryLevel && pump.isBatteryChangeLoggingEnabled)).toVisibility()
pumpBatteryChange?.visibility = (pump.pumpDescription.isBatteryReplaceable || (pump is OmnipodErosPumpPlugin && pump.isUseRileyLinkBatteryLevel && pump.isBatteryChangeLoggingEnabled)).toVisibility()
tempTarget?.visibility = (profile != null && config.APS).toVisibility()
tddStats?.visibility = pump.pumpDescription.supportsTDDs.toVisibility()

View file

@ -7,19 +7,13 @@ import androidx.annotation.DrawableRes
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.R
import info.nightscout.androidaps.activities.ErrorHelperActivity
import info.nightscout.androidaps.activities.PreferencesActivity
import info.nightscout.androidaps.data.PumpEnactResult
import info.nightscout.androidaps.events.EventRefreshOverview
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
import info.nightscout.androidaps.plugins.general.automation.elements.InputString
import info.nightscout.androidaps.plugins.general.automation.elements.LabelWithElement
import info.nightscout.androidaps.plugins.general.automation.elements.LayoutBuilder
import info.nightscout.androidaps.plugins.general.nsclient.NSUpload
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification
import info.nightscout.androidaps.plugins.general.overview.notifications.NotificationUserMessage
import info.nightscout.androidaps.queue.Callback
import info.nightscout.androidaps.utils.JsonHelper
import info.nightscout.androidaps.utils.alertDialogs.WarningDialog
import info.nightscout.androidaps.utils.resources.ResourceHelper
import org.json.JSONObject
import javax.inject.Inject
@ -28,7 +22,6 @@ class ActionAlarm(injector: HasAndroidInjector) : Action(injector) {
@Inject lateinit var resourceHelper: ResourceHelper
@Inject lateinit var rxBus: RxBusWrapper
@Inject lateinit var nsUpload: NSUpload
@Inject lateinit var context: Context
var text = InputString(injector)

View file

@ -9,8 +9,8 @@ import info.nightscout.androidaps.R
import info.nightscout.androidaps.db.CareportalEvent
import info.nightscout.androidaps.interfaces.ActivePluginProvider
import info.nightscout.androidaps.plugins.pump.common.defs.PumpType
import info.nightscout.androidaps.plugins.pump.omnipod.OmnipodPumpPlugin
import info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.OmnipodConstants
import info.nightscout.androidaps.plugins.pump.omnipod.eros.OmnipodErosPumpPlugin
import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.definition.OmnipodConstants
import info.nightscout.androidaps.utils.DecimalFormatter
import info.nightscout.androidaps.utils.WarnColors
import info.nightscout.androidaps.utils.resources.ResourceHelper
@ -52,7 +52,7 @@ class StatusLightHandler @Inject constructor(
}
if (!config.NSCLIENT) {
if (pump.model() == PumpType.Insulet_Omnipod && pump is OmnipodPumpPlugin) { // instance of check is needed because at startup, pump can still be VirtualPumpPlugin and that will cause a crash because of the class cast below
if (pump.model() == PumpType.Insulet_Omnipod && pump is OmnipodErosPumpPlugin) { // instance of check is needed because at startup, pump can still be VirtualPumpPlugin and that will cause a crash because of the class cast below
handleOmnipodBatteryLevel(careportal_battery_level, R.string.key_statuslights_bat_critical, 26.0, R.string.key_statuslights_bat_warning, 51.0, pump.batteryLevel.toDouble(), "%", pump.isUseRileyLinkBatteryLevel)
} else if (pump.model() != PumpType.AccuChekCombo) {
handleLevel(careportal_battery_level, R.string.key_statuslights_bat_critical, 26.0, R.string.key_statuslights_bat_warning, 51.0, pump.batteryLevel.toDouble(), "%")

View file

@ -27,7 +27,7 @@ import info.nightscout.androidaps.plugins.profile.local.LocalProfilePlugin
import info.nightscout.androidaps.plugins.profile.ns.NSProfileFragment
import info.nightscout.androidaps.plugins.profile.ns.NSProfilePlugin
import info.nightscout.androidaps.plugins.pump.common.events.EventRileyLinkDeviceStatusChange
import info.nightscout.androidaps.plugins.pump.omnipod.OmnipodPumpPlugin
import info.nightscout.androidaps.plugins.pump.omnipod.eros.OmnipodErosPumpPlugin
import info.nightscout.androidaps.setupwizard.elements.*
import info.nightscout.androidaps.setupwizard.events.EventSWUpdate
import info.nightscout.androidaps.utils.AndroidPermission
@ -267,22 +267,22 @@ class SWDefinition @Inject constructor(
.label(R.string.setupwizard_pump_waiting_for_riley_link_connection)
.visibility {
val activePump = activePlugin.activePump
activePump is OmnipodPumpPlugin && !activePump.isRileyLinkReady
activePump is OmnipodErosPumpPlugin && !activePump.isRileyLinkReady
})
.add( // Omnipod only
SWEventListener(injector, EventRileyLinkDeviceStatusChange::class.java)
.label(R.string.setupwizard_pump_riley_link_status)
.visibility { activePlugin.activePump is OmnipodPumpPlugin })
.visibility { activePlugin.activePump is OmnipodErosPumpPlugin })
.add(SWButton(injector)
.text(R.string.readstatus)
.action { commandQueue.readStatus("Clicked connect to pump", null) }
.visibility {
// Hide for Omnipod, because as we don't require a Pod to be paired in the setup wizard,
// Getting the status might not be possible
activePlugin.activePump !is OmnipodPumpPlugin
activePlugin.activePump !is OmnipodErosPumpPlugin
})
.add(SWEventListener(injector, EventPumpStatusChanged::class.java)
.visibility { activePlugin.activePump !is OmnipodPumpPlugin })
.visibility { activePlugin.activePump !is OmnipodErosPumpPlugin })
.validator { isPumpInitialized() }
private fun isPumpInitialized(): Boolean {
@ -290,7 +290,7 @@ class SWDefinition @Inject constructor(
// For Omnipod, consider the pump initialized when a RL has been configured successfully
// Users will be prompted to activate a Pod after completing the setup wizard.
return activePump.isInitialized || (activePump is OmnipodPumpPlugin && activePump.isRileyLinkReady)
return activePump.isInitialized || (activePump is OmnipodErosPumpPlugin && activePump.isRileyLinkReady)
}
private val screenAps = SWScreen(injector, R.string.configbuilder_aps)

View file

@ -34,7 +34,7 @@
<FrameLayout
android:id="@+id/frame_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"></FrameLayout>
android:layout_height="wrap_content" />
</ScrollView>

View file

@ -17,9 +17,7 @@ import org.junit.Test
import org.junit.runner.RunWith
import org.mockito.ArgumentMatchers
import org.mockito.Mock
import org.mockito.Mockito
import org.mockito.Mockito.`when`
import org.powermock.api.mockito.PowerMockito
import org.powermock.core.classloader.annotations.PrepareForTest
import org.powermock.modules.junit4.PowerMockRunner
@ -29,7 +27,6 @@ class ActionAlarmTest : TestBase() {
@Mock lateinit var resourceHelper: ResourceHelper
@Mock lateinit var rxBus: RxBusWrapper
@Mock lateinit var nsUpload: NSUpload
@Mock lateinit var context: Context
private lateinit var sut: ActionAlarm
@ -38,7 +35,6 @@ class ActionAlarmTest : TestBase() {
if (it is ActionAlarm) {
it.resourceHelper = resourceHelper
it.rxBus = rxBus
it.nsUpload = nsUpload
it.context = context
}
if (it is PumpEnactResult) {
@ -50,7 +46,6 @@ class ActionAlarmTest : TestBase() {
@Before
fun setup() {
PowerMockito.mockStatic(NSUpload::class.java)
`when`(resourceHelper.gs(R.string.ok)).thenReturn("OK")
`when`(resourceHelper.gs(R.string.alarm)).thenReturn("Alarm")
`when`(resourceHelper.gs(ArgumentMatchers.eq(R.string.alarm_message), ArgumentMatchers.anyString())).thenReturn("Alarm: %s")
@ -77,7 +72,6 @@ class ActionAlarmTest : TestBase() {
Assert.assertTrue(result.success)
}
})
PowerMockito.verifyStatic(NSUpload::class.java, Mockito.times(1))
}
@Test fun hasDialogTest() {

View file

@ -18,7 +18,6 @@ import org.mockito.ArgumentMatchers
import org.mockito.Mock
import org.mockito.Mockito
import org.mockito.Mockito.`when`
import org.powermock.api.mockito.PowerMockito
import org.powermock.core.classloader.annotations.PrepareForTest
import org.powermock.modules.junit4.PowerMockRunner
@ -47,7 +46,6 @@ class ActionNotificationTest : TestBase() {
@Before
fun setup() {
PowerMockito.mockStatic(NSUpload::class.java)
`when`(resourceHelper.gs(R.string.ok)).thenReturn("OK")
`when`(resourceHelper.gs(R.string.notification)).thenReturn("Notification")
`when`(resourceHelper.gs(ArgumentMatchers.eq(R.string.notification_message), ArgumentMatchers.anyString())).thenReturn("Notification: %s")
@ -75,7 +73,7 @@ class ActionNotificationTest : TestBase() {
}
})
Mockito.verify(rxBus, Mockito.times(2)).send(anyObject())
PowerMockito.verifyStatic(NSUpload::class.java, Mockito.times(1))
Mockito.verify(nsUpload, Mockito.times(1)).uploadError(anyObject())
}
@Test fun hasDialogTest() {

View file

@ -104,7 +104,7 @@ class SmsCommunicatorPluginTest : TestBaseWithProfile() {
`when`(SmsManager.getDefault()).thenReturn(smsManager)
`when`(sp.getString(R.string.key_smscommunicator_allowednumbers, "")).thenReturn("1234;5678")
smsCommunicatorPlugin = SmsCommunicatorPlugin(injector, aapsLogger, resourceHelper, aapsSchedulers, sp, constraintChecker, rxBus, profileFunction, fabricPrivacy, activePlugin, commandQueue, loopPlugin, iobCobCalculatorPlugin, xdripCalibrations, otp, Config(), DateUtil(context, resourceHelper))
smsCommunicatorPlugin = SmsCommunicatorPlugin(injector, aapsLogger, resourceHelper, aapsSchedulers, sp, constraintChecker, rxBus, profileFunction, fabricPrivacy, activePlugin, commandQueue, loopPlugin, iobCobCalculatorPlugin, xdripCalibrations, otp, Config(), DateUtil(context))
smsCommunicatorPlugin.setPluginEnabled(PluginType.GENERAL, true)
Mockito.doAnswer { invocation: InvocationOnMock ->
val callback = invocation.getArgument<Callback>(1)

View file

@ -48,22 +48,22 @@ class DateUtilTest : TestBase() {
}
@Test fun timeStringTest() {
Assert.assertTrue(DateUtil(context, resourceHelper).timeString(Date(1513902750000L)).contains("32"))
Assert.assertTrue(DateUtil(context, resourceHelper).timeString(1513902750000L).contains("32"))
Assert.assertTrue(DateUtil(context).timeString(Date(1513902750000L)).contains("32"))
Assert.assertTrue(DateUtil(context).timeString(1513902750000L).contains("32"))
}
@Test fun dateAndTimeStringTest() {
Assert.assertTrue(DateUtil(context, resourceHelper).dateAndTimeString(1513902750000L).contains("22"))
Assert.assertTrue(DateUtil(context, resourceHelper).dateAndTimeString(1513902750000L).contains("32"))
Assert.assertTrue(DateUtil(context, resourceHelper).dateAndTimeString(Date(1513902750000L)).contains("22"))
Assert.assertTrue(DateUtil(context, resourceHelper).dateAndTimeString(Date(1513902750000L)).contains("32"))
Assert.assertTrue(DateUtil(context).dateAndTimeString(1513902750000L).contains("22"))
Assert.assertTrue(DateUtil(context).dateAndTimeString(1513902750000L).contains("32"))
Assert.assertTrue(DateUtil(context).dateAndTimeString(Date(1513902750000L)).contains("22"))
Assert.assertTrue(DateUtil(context).dateAndTimeString(Date(1513902750000L)).contains("32"))
}
@Test fun dateAndTimeRangeStringTest() {
Assert.assertTrue(DateUtil(context, resourceHelper).dateAndTimeRangeString(1513902750000L, 1513902750000L).contains("22"))
Assert.assertTrue(DateUtil(context, resourceHelper).dateAndTimeRangeString(1513902750000L, 1513902750000L).contains("32"))
Assert.assertTrue(DateUtil(context, resourceHelper).dateAndTimeRangeString(1513902750000L, 1513902750000L).contains("22"))
Assert.assertTrue(DateUtil(context, resourceHelper).dateAndTimeRangeString(1513902750000L, 1513902750000L).contains("32"))
Assert.assertTrue(DateUtil(context).dateAndTimeRangeString(1513902750000L, 1513902750000L).contains("22"))
Assert.assertTrue(DateUtil(context).dateAndTimeRangeString(1513902750000L, 1513902750000L).contains("32"))
Assert.assertTrue(DateUtil(context).dateAndTimeRangeString(1513902750000L, 1513902750000L).contains("22"))
Assert.assertTrue(DateUtil(context).dateAndTimeRangeString(1513902750000L, 1513902750000L).contains("32"))
}
/*

View file

@ -8,29 +8,31 @@ buildscript {
rxandroid_version = '2.1.1'
rxkotlin_version = '2.4.0'
room_version = '2.2.6'
lifecycle_version = '2.2.0'
lifecycle_version = '2.3.0'
dagger_version = '2.31.2'
coroutinesVersion = '1.4.1'
activityVersion = '1.2.0-rc01'
activityVersion = '1.2.0'
fragmentktx_version = '1.3.0-rc01'
ormLiteVersion = '4.46'
nav_version = '2.3.2'
appcompat_verison = '1.2.0'
appcompat_version = '1.2.0'
material_version = '1.2.1'
constraintlayout_version = '2.0.4'
preferencektx_version = '1.1.1'
commonslang3_version = '3.11'
commonscodec_version = '1.15'
jodatime_version = '2.10.10'
work_version = '2.5.0'
junit_version = '4.13.1'
mockitoVersion = '2.8.47'
powermockVersion = "1.7.3"
powermockVersion = '2.0.9'
dexmakerVersion = "1.2"
retrofit2Version = '2.9.0'
okhttp3Version = '4.9.0'
androidx_junit = '1.1.2'
androidx_rules = '1.3.1-alpha03'
androidx_rules = '1.4.0-alpha04'
}
repositories {
google()

View file

@ -7,7 +7,7 @@ android {
compileSdkVersion 28
defaultConfig {
minSdkVersion 24
minSdkVersion 26
targetSdkVersion 28
versionCode 1
versionName "1.0"

View file

@ -8,16 +8,16 @@ dependencies {
api "androidx.core:core-ktx:$coreVersion"
api 'androidx.legacy:legacy-support-v13:1.0.0'
api 'androidx.legacy:legacy-support-v4:1.0.0'
api "androidx.appcompat:appcompat:$appcompat_verison"
api "androidx.appcompat:appcompat:$appcompat_version"
api "androidx.preference:preference-ktx:$preferencektx_version"
api 'androidx.biometric:biometric:1.0.1'
api 'androidx.biometric:biometric:1.1.0'
api "androidx.browser:browser:1.3.0"
api "androidx.activity:activity-ktx:${activityVersion}"
api "androidx.lifecycle:lifecycle-runtime-ktx:$lifecycle_version"
api 'androidx.cardview:cardview:1.0.0'
api 'androidx.recyclerview:recyclerview:1.1.0'
api 'androidx.gridlayout:gridlayout:1.0.0'
api 'androidx.percentlayout:percentlayout:1.0.0'
api 'androidx.activity:activity-ktx:1.2.0-rc01'
api "com.google.android.material:material:$material_version"
api "com.google.dagger:dagger-android:$dagger_version"
@ -53,9 +53,6 @@ dependencies {
// Graphview cannot be upgraded
api "com.jjoe64:graphview:4.0.1"
//DateUtil
api 'net.danlew:android.joda:2.10.6'
//db
api "com.j256.ormlite:ormlite-core:${ormLiteVersion}"
api "com.j256.ormlite:ormlite-android:${ormLiteVersion}"
@ -72,7 +69,6 @@ dependencies {
api "androidx.work:work-runtime:$work_version"
api "androidx.work:work-runtime-ktx:$work_version"
api "androidx.work:work-rxjava2:$work_version"
api 'com.google.androidbrowserhelper:androidbrowserhelper:2.0.1'
api 'com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava'
// new for tidepool
@ -102,10 +98,7 @@ dependencies {
exclude group: "org.json", module: "json"
}
api('com.google.guava:guava:30.0-jre') {
exclude group: "com.google.code.findbugs", module: "jsr305"
}
api 'com.google.code.findbugs:jsr305:3.0.2'
api 'com.google.guava:guava:30.0-jre'
api 'org.mozilla:rhino:1.7.13'

View file

@ -42,12 +42,10 @@ import info.nightscout.androidaps.utils.resources.ResourceHelper;
@Singleton
public class DateUtil {
private final Context context;
private final ResourceHelper resourceHelper;
@Inject
public DateUtil(Context context, ResourceHelper resourceHelper) {
public DateUtil(Context context) {
this.context = context;
this.resourceHelper = resourceHelper;
}
/**
@ -193,10 +191,6 @@ public class DateUtil {
return new DateTime(mills).toString(DateTimeFormat.forPattern(format));
}
public static String timeFullString(long mills) {
return new DateTime(mills).toString(DateTimeFormat.fullTime());
}
public String dateAndTimeString(Date date) {
return dateString(date) + " " + timeString(date);
}
@ -279,10 +273,6 @@ public class DateUtil {
return diff > T.mins(minutes).msecs();
}
public static GregorianCalendar gregorianCalendar() {
return new GregorianCalendar();
}
public static long getTimeZoneOffsetMs() {
return new GregorianCalendar().getTimeZone().getRawOffset();
}

View file

@ -1,7 +1,7 @@
package info.nightscout.androidaps.utils.protection
import androidx.biometric.BiometricConstants
import androidx.biometric.BiometricPrompt
import androidx.biometric.BiometricPrompt.*
import androidx.fragment.app.FragmentActivity
import info.nightscout.androidaps.core.R
import info.nightscout.androidaps.utils.ToastUtils
@ -16,43 +16,43 @@ object BiometricCheck {
override fun onAuthenticationError(errorCode: Int, errString: CharSequence) {
super.onAuthenticationError(errorCode, errString)
when (errorCode) {
BiometricConstants.ERROR_UNABLE_TO_PROCESS,
BiometricConstants.ERROR_TIMEOUT,
BiometricConstants.ERROR_CANCELED,
BiometricConstants.ERROR_LOCKOUT,
BiometricConstants.ERROR_VENDOR,
BiometricConstants.ERROR_LOCKOUT_PERMANENT,
BiometricConstants.ERROR_USER_CANCELED -> {
ERROR_UNABLE_TO_PROCESS,
ERROR_TIMEOUT,
ERROR_CANCELED,
ERROR_LOCKOUT,
ERROR_VENDOR,
ERROR_LOCKOUT_PERMANENT,
ERROR_USER_CANCELED -> {
ToastUtils.showToastInUiThread(activity.baseContext, errString.toString())
// fallback to master password
runOnUiThread(Runnable {
runOnUiThread {
passwordCheck.queryPassword(activity, R.string.master_password, R.string.key_master_password, { ok?.run() }, { cancel?.run() }, { fail?.run() })
})
}
}
BiometricConstants.ERROR_NEGATIVE_BUTTON ->
ERROR_NEGATIVE_BUTTON ->
cancel?.run()
BiometricConstants.ERROR_NO_DEVICE_CREDENTIAL -> {
ERROR_NO_DEVICE_CREDENTIAL -> {
ToastUtils.showToastInUiThread(activity.baseContext, errString.toString())
// no pin set
// fallback to master password
runOnUiThread(Runnable {
runOnUiThread {
passwordCheck.queryPassword(activity, R.string.master_password, R.string.key_master_password, { ok?.run() }, { cancel?.run() }, { fail?.run() })
})
}
}
BiometricConstants.ERROR_NO_SPACE,
BiometricConstants.ERROR_HW_UNAVAILABLE,
BiometricConstants.ERROR_HW_NOT_PRESENT,
BiometricConstants.ERROR_NO_BIOMETRICS ->
runOnUiThread(Runnable {
ERROR_NO_SPACE,
ERROR_HW_UNAVAILABLE,
ERROR_HW_NOT_PRESENT,
ERROR_NO_BIOMETRICS ->
runOnUiThread {
passwordCheck.queryPassword(activity, R.string.master_password, R.string.key_master_password, { ok?.run() }, { cancel?.run() }, { fail?.run() })
})
}
}
}
override fun onAuthenticationSucceeded(result: BiometricPrompt.AuthenticationResult) {
override fun onAuthenticationSucceeded(result: AuthenticationResult) {
super.onAuthenticationSucceeded(result)
// Called when a biometric is recognized.
ok?.run()
@ -65,7 +65,7 @@ object BiometricCheck {
}
})
val promptInfo = BiometricPrompt.PromptInfo.Builder()
val promptInfo = PromptInfo.Builder()
.setTitle(activity.getString(title))
.setDescription(activity.getString(R.string.biometric_title))
.setNegativeButtonText(activity.getString(R.string.cancel)) // not possible with setDeviceCredentialAllowed

View file

@ -19,7 +19,9 @@ files:
translation: /dana/src/main/res/values-%android_code%/strings.xml
- source: /medtronic/src/main/res/values/strings.xml
translation: /medtronic/src/main/res/values-%android_code%/strings.xml
- source: /omnipod/src/main/res/values/strings.xml
translation: /omnipod/src/main/res/values-%android_code%/strings.xml
- source: /omnipod-dash/src/main/res/values/strings.xml
translation: /omnipod-dash/src/main/res/values-%android_code%/strings.xml
- source: /omnipod-eros/src/main/res/values/strings.xml
translation: /omnipod-eros/src/main/res/values-%android_code%/strings.xml
- source: /rileylink/src/main/res/values/strings.xml
translation: /rileylink/src/main/res/values-%android_code%/strings.xml

52
omnipod-dash/build.gradle Normal file
View file

@ -0,0 +1,52 @@
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
android {
compileSdkVersion 28
defaultConfig {
minSdkVersion 24
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles "consumer-rules.pro"
}
kotlinOptions {
jvmTarget = '1.8'
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
debug {
testCoverageEnabled(project.hasProperty('coverage'))
}
firebaseDisable {
System.setProperty("disableFirebase", "true")
ext.enableCrashlytics = false
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
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"
implementation "commons-codec:commons-codec:$commonscodec_version"
implementation "androidx.appcompat:appcompat:$appcompat_version"
implementation "com.google.android.material:material:$material_version"
testImplementation "junit:junit:$junit_version"
androidTestImplementation "androidx.test.ext:junit:$androidx_junit"
}

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest package="info.nightscout.androidaps.plugins.pump.omnipod.dash">
</manifest>

View file

@ -0,0 +1,5 @@
package info.nightscout.androidaps.plugins.pump.omnipod.dash;
public class OmnipodDashPumpPlugin {
// TODO
}

View file

@ -0,0 +1,4 @@
package info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod;
public class OmnipodDashManager {
}

View file

@ -0,0 +1,7 @@
package info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.command;
public interface Command {
CommandType getCommandType();
byte[] getEncoded();
}

View file

@ -0,0 +1,84 @@
package info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.command;
import java.nio.ByteBuffer;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.List;
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.util.CrcUtil;
abstract class CommandBase implements Command {
static final short HEADER_LENGTH = 6;
final CommandType commandType;
final int address;
final short sequenceNumber;
final boolean unknown;
CommandBase(CommandType commandType, int address, short sequenceNumber, boolean unknown) {
this.commandType = commandType;
this.address = address;
this.sequenceNumber = sequenceNumber;
this.unknown = unknown;
}
@Override public CommandType getCommandType() {
return commandType;
}
public int getAddress() {
return address;
}
public short getSequenceNumber() {
return sequenceNumber;
}
public boolean isUnknown() {
return unknown;
}
static byte[] formatCommand(byte[] command) {
List<Byte> temp = new ArrayList<>();
byte[] prefix = "S0.0=".getBytes(StandardCharsets.UTF_8);
for (byte b : prefix) {
temp.add(b);
}
byte[] length = ByteBuffer.allocate(2).putShort((short) command.length).array();
for (int i = 0; i < 2; i++) {
temp.add(length[i]);
}
// Append command
for (byte b : command) {
temp.add(b);
}
byte[] suffix = ",G0.0".getBytes(StandardCharsets.UTF_8);
for (byte b : suffix) {
temp.add(b);
}
byte[] out = new byte[((short) temp.size())];
for (int i2 = 0; i2 < temp.size(); i2++) {
out[i2] = temp.get(i2);
}
return out;
}
static byte[] appendCrc(byte[] command) {
return ByteBuffer.allocate(command.length + 2) //
.put(command) //
.putShort(CrcUtil.createCrc(command)) //
.array();
}
static byte[] encodeHeader(int address, short sequenceNumber, short length, boolean unknown) {
return ByteBuffer.allocate(6) //
.putInt(address) //
.putShort((short) (((sequenceNumber & 0x0f) << 10) | length | ((unknown ? 1 : 0) << 15))) //
.array();
}
}

View file

@ -0,0 +1,26 @@
package info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.command;
public enum CommandType {
SET_UNIQUE_ID((byte) 0x03),
GET_VERSION((byte) 0x07),
GET_STATUS((byte) 0x0e),
SILENCE_ALERTS((byte) 0x11),
PROGRAM_BASAL((byte) 0x13),
PROGRAM_TEMP_BASAL((byte) 0x16),
BOLUS((byte) 0x17),
PROGRAM_ALERTS((byte) 0x19),
DELIVERY_INTERLOCK((byte) 0x1a),
DEACTIVATE((byte) 0x1c),
PROGRAM_BEEPS((byte) 0x1e),
STOP_DELIVERY((byte) 0x1f);
byte value;
CommandType(byte value) {
this.value = value;
}
public byte getValue() {
return value;
}
}

View file

@ -0,0 +1,30 @@
package info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.command;
import java.nio.ByteBuffer;
public class DeactivateCommand extends CommandBase {
private static final short LENGTH = 6;
private static final byte BODY_LENGTH = 4;
DeactivateCommand(int address, short sequenceNumber, boolean unknown) {
super(CommandType.DEACTIVATE, address, sequenceNumber, unknown);
}
@Override public byte[] getEncoded() {
return appendCrc(ByteBuffer.allocate(LENGTH + HEADER_LENGTH) //
.put(encodeHeader(address, sequenceNumber, LENGTH, unknown)) //
.put(commandType.getValue()) //
.put(BODY_LENGTH) //
.putInt(1229869870) // FIXME ?? was: byte array of int 777211465 converted to little endian
.array());
}
@Override public String toString() {
return "DeactivateCommand{" +
"commandType=" + commandType +
", address=" + address +
", sequenceNumber=" + sequenceNumber +
", unknown=" + unknown +
'}';
}
}

View file

@ -0,0 +1,35 @@
package info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.command;
import java.nio.ByteBuffer;
public class GetVersionCommand extends CommandBase {
private static final int DEFAULT_ADDRESS = -1;
private static final short LENGTH = 6;
private static final byte BODY_LENGTH = 4;
public GetVersionCommand(short sequenceNumber, boolean unknown) {
this(DEFAULT_ADDRESS, sequenceNumber, unknown);
}
public GetVersionCommand(int address, short sequenceNumber, boolean unknown) {
super(CommandType.GET_VERSION, address, sequenceNumber, unknown);
}
@Override public byte[] getEncoded() {
return appendCrc(ByteBuffer.allocate(LENGTH + HEADER_LENGTH) //
.put(encodeHeader(address, sequenceNumber, LENGTH, unknown)) //
.put(commandType.getValue()) //
.put(BODY_LENGTH) //
.putInt(address) //
.array());
}
@Override public String toString() {
return "GetVersionCommand{" +
"commandType=" + commandType +
", address=" + address +
", sequenceNumber=" + sequenceNumber +
", unknown=" + unknown +
'}';
}
}

View file

@ -0,0 +1,46 @@
package info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.command;
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.List;
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definition.AlertConfiguration;
public class ProgramAlertsCommand extends CommandBase {
private final List<AlertConfiguration> alertConfigurations;
ProgramAlertsCommand(int address, short sequenceNumber, boolean unknown, List<AlertConfiguration> alertConfigurations) {
super(CommandType.PROGRAM_ALERTS, address, sequenceNumber, unknown);
this.alertConfigurations = new ArrayList<>(alertConfigurations);
}
@Override public byte[] getEncoded() {
ByteBuffer byteBuffer = ByteBuffer.allocate(getLength() + HEADER_LENGTH) //
.put(encodeHeader(address, sequenceNumber, getLength(), unknown)) //
.put(commandType.getValue()) //
.put(getBodyLength()) //
.putInt(1229869870); // FIXME ?? was: byte array of int 777211465 converted to little endian
for (AlertConfiguration configuration : alertConfigurations) {
byteBuffer.put(configuration.getEncoded());
}
return appendCrc(byteBuffer.array());
}
private short getLength() {
return (short) (alertConfigurations.size() * 6 + 6);
}
private byte getBodyLength() {
return (byte) (alertConfigurations.size() * 6 + 4);
}
@Override public String toString() {
return "ProgramAlertsCommand{" +
"alertConfigurations=" + alertConfigurations +
", commandType=" + commandType +
", address=" + address +
", sequenceNumber=" + sequenceNumber +
", unknown=" + unknown +
'}';
}
}

View file

@ -0,0 +1,61 @@
package info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.command;
import java.nio.ByteBuffer;
import java.util.Calendar;
import java.util.Date;
public class SetUniqueIdCommand extends CommandBase {
private static final int DEFAULT_ADDRESS = -1;
private static final short LENGTH = 21;
private static final byte BODY_LENGTH = 19;
private final int lotNumber;
private final int podSequenceNumber;
private final Date initializationTime;
SetUniqueIdCommand(int address, short sequenceNumber, int lotNumber, int podSequenceNumber, Date initializationTime, boolean unknown) {
super(CommandType.SET_UNIQUE_ID, address, sequenceNumber, unknown);
this.lotNumber = lotNumber;
this.podSequenceNumber = podSequenceNumber;
this.initializationTime = initializationTime;
}
@Override public byte[] getEncoded() {
return appendCrc(ByteBuffer.allocate(LENGTH + HEADER_LENGTH) //
.put(encodeHeader(DEFAULT_ADDRESS, sequenceNumber, LENGTH, unknown)) //
.put(commandType.getValue()) //
.put(BODY_LENGTH) //
.putInt(address) //
.put((byte) 0x14) // FIXME ??
.put((byte) 0x04) // FIXME ??
.put(encodeInitializationTime(initializationTime)) //
.putInt(lotNumber) //
.putInt(podSequenceNumber) //
.array());
}
private static byte[] encodeInitializationTime(Date date) {
Calendar instance = Calendar.getInstance();
instance.setTime(date);
return new byte[]{ //
(byte) (instance.get(Calendar.MONTH) + 1), //
(byte) instance.get(Calendar.DATE), //
(byte) (instance.get(Calendar.YEAR) % 100), //
(byte) instance.get(Calendar.HOUR_OF_DAY), //
(byte) instance.get(Calendar.MINUTE) //
};
}
@Override public String toString() {
return "SetUniqueIdCommand{" +
"lotNumber=" + lotNumber +
", podSequenceNumber=" + podSequenceNumber +
", initializationTime=" + initializationTime +
", commandType=" + commandType +
", address=" + address +
", sequenceNumber=" + sequenceNumber +
", unknown=" + unknown +
'}';
}
}

View file

@ -0,0 +1,61 @@
package info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.command;
import java.nio.ByteBuffer;
import java.util.BitSet;
public class SilenceAlertsCommand extends CommandBase {
private static final short LENGTH = (short) 7;
private static final byte BODY_LENGTH = (byte) 5;
private final SilenceAlertCommandParameters parameters;
public SilenceAlertsCommand(int address, short sequenceNumber, boolean unknown, SilenceAlertCommandParameters parameters) {
super(CommandType.SILENCE_ALERTS, address, sequenceNumber, unknown);
this.parameters = parameters;
}
@Override public byte[] getEncoded() {
return appendCrc(ByteBuffer.allocate(LENGTH + HEADER_LENGTH) //
.put(encodeHeader(address, sequenceNumber, LENGTH, unknown)) //
.put(commandType.getValue()) //
.put(BODY_LENGTH) //
.putInt(1229869870) // FIXME ?? was: byte array of int 777211465 converted to little endian
.put(parameters.getEncoded()) //
.array());
}
public static final class SilenceAlertCommandParameters {
private final boolean silenceAutoOffAlert;
private final boolean silenceMultiCommandAlert;
private final boolean silenceExpirationImminentAlert;
private final boolean silenceUserSetExpirationAlert;
private final boolean silenceLowReservoirAlert;
private final boolean silenceSuspendInProgressAlert;
private final boolean silenceSuspendEndedAlert;
private final boolean silencePodExpirationAlert;
public SilenceAlertCommandParameters(boolean silenceAutoOffAlert, boolean silenceMultiCommandAlert, boolean silenceExpirationImminentAlert, boolean silenceUserSetExpirationAlert, boolean silenceLowReservoirAlert, boolean silenceSuspendInProgressAlert, boolean silenceSuspendEndedAlert, boolean silencePodExpirationAlert) {
this.silenceAutoOffAlert = silenceAutoOffAlert;
this.silenceMultiCommandAlert = silenceMultiCommandAlert;
this.silenceExpirationImminentAlert = silenceExpirationImminentAlert;
this.silenceUserSetExpirationAlert = silenceUserSetExpirationAlert;
this.silenceLowReservoirAlert = silenceLowReservoirAlert;
this.silenceSuspendInProgressAlert = silenceSuspendInProgressAlert;
this.silenceSuspendEndedAlert = silenceSuspendEndedAlert;
this.silencePodExpirationAlert = silencePodExpirationAlert;
}
public byte[] getEncoded() {
BitSet bitSet = new BitSet(8);
bitSet.set(0, this.silenceAutoOffAlert);
bitSet.set(1, this.silenceMultiCommandAlert);
bitSet.set(2, this.silenceExpirationImminentAlert);
bitSet.set(3, this.silenceUserSetExpirationAlert);
bitSet.set(4, this.silenceLowReservoirAlert);
bitSet.set(5, this.silenceSuspendInProgressAlert);
bitSet.set(6, this.silenceSuspendEndedAlert);
bitSet.set(7, this.silencePodExpirationAlert);
return bitSet.toByteArray();
}
}
}

View file

@ -0,0 +1,55 @@
package info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.command;
import java.nio.ByteBuffer;
import java.util.BitSet;
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definition.BeepType;
public class StopDeliveryCommand extends CommandBase {
private static final short LENGTH = 7;
private static final byte BODY_LENGTH = 5;
private final DeliveryType deliveryType;
private final BeepType beepType;
public StopDeliveryCommand(int address, short sequenceNumber, boolean unknown, DeliveryType deliveryType, BeepType beepType) {
super(CommandType.STOP_DELIVERY, address, sequenceNumber, unknown);
this.deliveryType = deliveryType;
this.beepType = beepType;
}
@Override public byte[] getEncoded() {
return appendCrc(ByteBuffer.allocate(LENGTH + HEADER_LENGTH) //
.put(encodeHeader(address, sequenceNumber, LENGTH, unknown)) //
.put(commandType.getValue()) //
.put(BODY_LENGTH) //
.putInt(1229869870) // FIXME ?? was: byte array of int 777211465 converted to little endian
.put((byte) ((beepType.getValue() << 4) | deliveryType.getEncoded())) //
.array());
}
public enum DeliveryType {
BASAL(true, false, false),
TEMP_BASAL(false, true, false),
BOLUS(false, false, true),
ALL(true, true, true);
private final boolean basal;
private final boolean tempBasal;
private final boolean bolus;
DeliveryType(boolean basal, boolean tempBasal, boolean bolus) {
this.basal = basal;
this.tempBasal = tempBasal;
this.bolus = bolus;
}
public byte getEncoded() {
BitSet bitSet = new BitSet(8);
bitSet.set(0, this.basal);
bitSet.set(1, this.tempBasal);
bitSet.set(2, this.bolus);
return bitSet.toByteArray()[0];
}
}
}

View file

@ -0,0 +1,174 @@
package info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definition;
public enum AlarmType {
NONE((byte) 0x00),
ALARM_PW_FLASH_ERASE((byte) 0x01),
ALARM_PW_FLASH_WRITE((byte) 0x02),
ALARM_BASAL_CKSUM((byte) 0x03),
ALARM_BASAL_PPULSE((byte) 0x04),
ALARM_BASAL_STEP((byte) 0x05),
ALARM_AUTO_WAKEUP_TIMEOUT((byte) 0x06),
ALARM_WIRE_OVERDRIVEN((byte) 0x07),
ALARM_BEEP_REP_INVALID_INDEX((byte) 0x08),
ALARM_INVALID_REP_PATTERN((byte) 0x09),
ALARM_TEMP_BASAL_STEP((byte) 0x0a),
ALARM_TEMP_BASAL_CKSUM((byte) 0x0b),
ALARM_BOLUS_OVERFLOW((byte) 0x0c),
ALARM_COP_RESET((byte) 0x0d),
ALARM_ILOP_RESET((byte) 0x0e),
ALARM_ILAD_RESET((byte) 0x0f),
ALARM_SAWCOP_RESET((byte) 0x10),
ALARM_BOLUS_STEP((byte) 0x11),
ALARM_LVD_RESET((byte) 0x12),
ALARM_INVALID_RF_MSG_LENGTH((byte) 0x13),
ALARM_OCCLUDED((byte) 0x14),
ALARM_BOLUSPROG_CHKSUM((byte) 0x15),
ALARM_BOLUS_LOG((byte) 0x16),
ALARM_CRITICAL_VAR((byte) 0x17),
ALARM_EMPTY_RESERVOIR((byte) 0x18),
ALARM_LOADERR((byte) 0x19),
ALARM_PSA_FAILURE((byte) 0x1a),
ALARM_TICKCNT_NOT_CLEARED((byte) 0x1b),
ALARM_PUMP_EXPIRED((byte) 0x1c),
ALARM_COMD_BIT_NOT_SET((byte) 0x1d),
ALARM_INVALID_COMD_SET((byte) 0x1e),
ALARM_ALERTS_ARRAY_CKSM((byte) 0x1f),
ALARM_UNIT_TEST((byte) 0x20),
ALARM_TICK_TIME_ERROR((byte) 0x21),
ALARM_CRITICAL_HAZARD((byte) 0x22),
ALARM_PIEZO_FREQ((byte) 0x23),
ALARM_TICKCNT_ERROR_RTC((byte) 0x24),
ALARM_TICK_FAILURE((byte) 0x25),
ALARM_INVALID((byte) 0x26),
ALARM_LUMP_ALERT_PROGRAM((byte) 0x27),
ALARM_INVALID_PASS_CODE((byte) 0x28),
ALARM_ALERT0((byte) 0x29),
ALARM_ALERT1((byte) 0x2a),
ALARM_ALERT2((byte) 0x2b),
ALARM_ALERT3((byte) 0x2c),
ALARM_ALERT4((byte) 0x2d),
ALARM_ALERT5((byte) 0x2e),
ALARM_ALERT6((byte) 0x2f),
ALARM_ALERT7((byte) 0x30),
ALARM_ILLEGAL_PUMP_STATE((byte) 0x31),
ALARM_COP_TEST_FAILURE((byte) 0x32),
ALARM_MCTF((byte) 0x33),
ALARM_ILLEGAL_RESET((byte) 0x34),
ALARM_VETO_NOT_SET((byte) 0x35),
ALARM_ILLEGAL_PIN_RESET((byte) 0x36),
ALARM_INVALID_BEEP_PATTERN((byte) 0x37),
ALARM_WIRE_STATE_MACHINE((byte) 0x38),
ALARM_VETO_TEST_DEFAULT((byte) 0x39),
ALARM_ALERT_INVALID_INDEX((byte) 0x3a),
ALARM_SAWCOP_TEST_FAIL((byte) 0x3b),
ALARM_MCUCOP_TEST_FAIL((byte) 0x3c),
ALARM_STEP_SENSOR_SHORTED((byte) 0x3d),
ALARM_FLASH_FAILURE((byte) 0x3e),
ALARM_SPARE63((byte) 0x3f),
ALARM_SS_OPEN_CNT_EXCEEDED((byte) 0x40),
ALARM_SS_EXCESSIVE_SUMMED((byte) 0x41),
ALARM_SS_MIN_PULSE_TRANSITION((byte) 0x42),
ALARM_SS_DEFAULT((byte) 0x43),
ALARM_OPEN_WIRE1((byte) 0x44),
ALARM_OPEN_WIRE2((byte) 0x45),
ALARM_LOADERR_FAILURE((byte) 0x46),
ALARM_SAW_VETO_FAILURE((byte) 0x47),
ALARM_BAD_RFM_CLOCK((byte) 0x48),
ALARM_BAD_TICK_HIGH((byte) 0x49),
ALARM_BAD_TICK_PERIOD((byte) 0x4a),
ALARM_BAD_TRIM_VALUE((byte) 0x4b),
ALARM_BAD_BUS_CLOCK((byte) 0x4c),
ALARM_BAD_CAL_MODE((byte) 0x4d),
ALARM_SAW_TRIM_ERROR((byte) 0x4e),
ALARM_RFM_CRYSTAL_ERROR((byte) 0x4f),
ALARM_CALST_TIMEOUT((byte) 0x50),
ALARM_TICKCNT_ERROR((byte) 0x51),
ALARM_BAD_RFM_XTAL_START((byte) 0x52),
ALARM_BAD_RX_SENSENSITIVITY((byte) 0x53),
ALARM_BAD_TX_PKT_SIZE((byte) 0x54),
ALARM_TICK_LOW_PHASE_EXCEEDED((byte) 0x55),
ALARM_TICK_HIGH_PHASE_EXCEEDED((byte) 0x56),
ALARM_OCCL_CRITVAR_FAIL((byte) 0x57),
ALARM_OCCL_PARAM((byte) 0x58),
ALARM_PROG_OCCL_FAIL((byte) 0x59),
ALARM_PW_TO_HIGH_FOR_OCCL_DET((byte) 0x5a),
ALARM_OCCL_CSUM((byte) 0x5b),
ALARM_PRIME_OPEN_CNT_TO_LOW((byte) 0x5c),
ALARM_BAD_RF_CDTHR((byte) 0x5d),
ALARM_FLASH_NOT_SECURE((byte) 0x5e),
ALARM_WIRE_TEST_OPEN_GROUND((byte) 0x5f),
ALARM_OCCL_STARTUP1((byte) 0x60),
ALARM_OCCL_STARTUP2((byte) 0x61),
ALARM_OCCL_EXCESS_TIMEOUTS1((byte) 0x62),
ALARM_SPARE99((byte) 0x63),
ALARM_SPARE100((byte) 0x64),
ALARM_SPARE101((byte) 0x65),
ALARM_OCCL_EXCESS_TIMEOUTS2((byte) 0x66),
ALARM_OCCL_EXCESS_TIMEOUTS3((byte) 0x67),
ALARM_OCCL_NOISY_PULSE_WIDTHS((byte) 0x68),
ALARM_OCCL_AT_BOLUS_END((byte) 0x69),
ALARM_OCCL_ABOVE_THRESHOLD((byte) 0x6a),
ALARM_BASAL_UNDERINFUSION((byte) 0x80),
ALARM_BASAL_OVERINFUSION((byte) 0x81),
ALARM_TEMP_UNDERINFUSION((byte) 0x82),
ALARM_TEMP_OVERINFUSION((byte) 0x83),
ALARM_BOLUS_UNDERINFUSION((byte) 0x84),
ALARM_BOLUS_OVERINFUSION((byte) 0x85),
ALARM_BASAL_OVERINFUSION_PULSE((byte) 0x86),
ALARM_TEMP_OVERINFUSION_PULSE((byte) 0x87),
ALARM_BOLUS_OVERINFUSION_PULSE((byte) 0x88),
ALARM_IMMBOLUS_UNDERINFUSION_PULSE((byte) 0x89),
ALARM_EXTBOLUS_OVERINFUSION_PULSE((byte) 0x8a),
ALARM_PROGRAM_CSUM((byte) 0x8b),
ALARM_UNUSED_140((byte) 0x8c),
ALARM_UNRECOGNIZED_PULSE((byte) 0x8d),
ALARM_SYNC_WITHOUT_TEMP_ACTIVE((byte) 0x8e),
ALARM_INTERLOCK_LOAD((byte) 0x8f),
ALARM_ILLEGAL_CHAN_PARAM((byte) 0x90),
ALARM_BASAL_PULSE_CHAN_INACTIVE((byte) 0x91),
ALARM_TEMP_PULSE_CHAN_INACTIVE((byte) 0x92),
ALARM_BOLUS_PULSE_CHAN_INACTIVE((byte) 0x93),
ALARM_INT_SEMAPHORE_NOT_SET((byte) 0x94),
ALARM_ILLEGAL_INTERLOCK_CHAN((byte) 0x95),
ALARM_TERMINATE_BOLUS((byte) 0x96),
ALARM_OPEN_TRANSITIONS_COUNT((byte) 0x97),
ALARM_BLE_TO((byte) 0xa0),
ALARM_BLE_INITIATED((byte) 0xa1),
ALARM_BLE_UNK_ALARM((byte) 0xa2),
ALARM_UNUSED_163((byte) 0xa3),
ALARM_UNUSED_164((byte) 0xa4),
ALARM_UNUSED_165((byte) 0xa5),
ALARM_BLE_IAAS((byte) 0xa6),
ALARM_UNUSED_167((byte) 0xa7),
ALARM_CRC_FAILURE((byte) 0xa8),
ALARM_BLE_WD_PING_TIMEOUT((byte) 0xa9),
ALARM_BLE_EXCESSIVE_RESETS((byte) 0xaa),
ALARM_BLE_NAK_ERROR((byte) 0xab),
ALARM_BLE_REQ_HIGH_TIMEOUT((byte) 0xac),
ALARM_BLE_UNKNOWN_RESP((byte) 0xad),
ALARM_BLE_UNUSED_174((byte) 0xae),
ALARM_BLE_REQ_STUCK_HIGH((byte) 0xaf),
ALARM_BLE_STATE_MACHINE_1((byte) 0xb1),
ALARM_BLE_STATE_MACHINE_2((byte) 0xb2),
ALARM_BLE_UNUSED_179((byte) 0xb3),
ALARM_BLE_ARB_LOST((byte) 0xb4),
ALARM_BLE_ER48_DUAL_NACK((byte) 0xc0),
ALARM_BLE_QN_EXCEED_MAX_RETRY((byte) 0xc1),
ALARM_BLE_QN_CRIT_VAR_FAIL((byte) 0xc2),
UNKNOWN((byte) 0xff);
private byte value;
AlarmType(byte value) {
this.value = value;
}
public static AlarmType byValue(byte value) {
for (AlarmType type : values()) {
if (type.value == value) {
return type;
}
}
return UNKNOWN;
}
}

View file

@ -0,0 +1,61 @@
package info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definition;
import java.nio.ByteBuffer;
public class AlertConfiguration {
private AlertSlot slot;
private boolean enabled;
private short durationInMinutes;
private boolean autoOff;
private AlertTriggerType triggerType;
private short offsetInMinutesOrThresholdInMicroLiters;
private BeepType beepType;
private BeepRepetitionType beepRepetition;
public AlertConfiguration(AlertSlot slot, boolean enabled, short durationInMinutes, boolean autoOff, AlertTriggerType triggerType, short offsetInMinutesOrThresholdInMicroLiters, BeepType beepType, BeepRepetitionType beepRepetition) {
this.slot = slot;
this.enabled = enabled;
this.durationInMinutes = durationInMinutes;
this.autoOff = autoOff;
this.triggerType = triggerType;
this.offsetInMinutesOrThresholdInMicroLiters = offsetInMinutesOrThresholdInMicroLiters;
this.beepType = beepType;
this.beepRepetition = beepRepetition;
}
public byte[] getEncoded() {
byte firstByte = (byte) (slot.getValue() << 4);
if (enabled) {
firstByte |= 1 << 3;
}
if (triggerType == AlertTriggerType.RESERVOIR_VOLUME_TRIGGER) {
firstByte |= 1 << 2;
}
if (autoOff) {
firstByte |= 1 << 1;
}
firstByte |= ((durationInMinutes >> 8) & 0x01);
return ByteBuffer.allocate(6) //
.put(firstByte)
.put((byte) durationInMinutes) //
.putShort(offsetInMinutesOrThresholdInMicroLiters) //
.put(beepRepetition.getValue()) //
.put(beepType.getValue()) //
.array();
}
@Override public String toString() {
return "AlertConfiguration{" +
"slot=" + slot +
", enabled=" + enabled +
", durationInMinutes=" + durationInMinutes +
", autoOff=" + autoOff +
", triggerType=" + triggerType +
", offsetInMinutesOrThresholdInMicroLiters=" + offsetInMinutesOrThresholdInMicroLiters +
", beepType=" + beepType +
", beepRepetition=" + beepRepetition +
'}';
}
}

View file

@ -0,0 +1,32 @@
package info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definition;
public enum AlertSlot {
AUTO_OFF((byte) 0x00),
MULTI_COMMAND((byte) 0x01),
EXPIRATION_IMMINENT((byte) 0x02),
USER_SET_EXPIRATION((byte) 0x03),
LOW_RESERVOIR((byte) 0x04),
SUSPEND_IN_PROGRESS((byte) 0x05),
SUSPEND_ENDED((byte) 0x06),
EXPIRATION((byte) 0x07),
UNKNOWN((byte) 0xff);
private byte value;
AlertSlot(byte value) {
this.value = value;
}
public static AlertSlot byValue(byte value) {
for (AlertSlot slot : values()) {
if (slot.value == value) {
return slot;
}
}
return UNKNOWN;
}
public byte getValue() {
return value;
}
}

View file

@ -0,0 +1,6 @@
package info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definition;
public enum AlertTriggerType {
TIME_TRIGGER,
RESERVOIR_VOLUME_TRIGGER
}

View file

@ -0,0 +1,20 @@
package info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definition;
// FIXME names
public enum BeepRepetitionType {
XXX((byte) 0x01), // Used in low reservoir alert
XXX2((byte) 0x03), // Used in user pod expiration alert
XXX3((byte) 0x05), // Used in pod expiration alert
XXX4((byte) 0x06), // Used in imminent pod expiration alert
XXX5((byte) 0x08); // Used in lump of coal alert
private byte value;
BeepRepetitionType(byte value) {
this.value = value;
}
public byte getValue() {
return value;
}
}

View file

@ -0,0 +1,17 @@
package info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definition;
public enum BeepType {
SILENT((byte) 0x00),
FOUR_TIMES_BIP_BEEP((byte) 0x02), // Used in low reservoir alert, user expiration alert, expiration alert, imminent expiration alert, lump of coal alert
LONG_SINGLE_BEEP((byte) 0x06); // Used in stop delivery command
private byte value;
BeepType(byte value) {
this.value = value;
}
public byte getValue() {
return value;
}
}

View file

@ -0,0 +1,26 @@
package info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definition;
public enum DeliveryStatus {
SUSPENDED((byte) 0x00),
BASAL_ACTIVE((byte) 0x01),
TEMP_BASAL_ACTIVE((byte) 0x02),
PRIMING((byte) 0x04),
BOLUS_AND_BASAL_ACTIVE((byte) 0x05),
BOLUS_AND_TEMP_BASAL_ACTIVE((byte) 0x06),
UNKNOWN((byte) 0xff);
private byte value;
DeliveryStatus(byte value) {
this.value = value;
}
public static DeliveryStatus byValue(byte value) {
for (DeliveryStatus status : values()) {
if (status.value == value) {
return status;
}
}
return UNKNOWN;
}
}

View file

@ -0,0 +1,49 @@
package info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definition;
public enum NakErrorType {
FLASH_WRITE((byte) 0x01),
FLASH_ERASE((byte) 0x02),
FLASH_OPERATION((byte) 0x03),
FLASH_ADDR((byte) 0x04),
POD_STATE((byte) 0x05),
CRITICAL_VARIABLE((byte) 0x06),
ILLEGAL_PARAM((byte) 0x07),
BOLUS_CRITICAL_VAR((byte) 0x08),
INT_ILLEGAL_PARAM((byte) 0x09),
ILLEGAL_CHECKSUM((byte) 0x0a),
INVALID_MSG_LEN((byte) 0x0b),
PUMP_STATE((byte) 0x0c),
ILLEGAL_COMMAND((byte) 0x0d),
ILLEGAL_FILL_STATE((byte) 0x0e),
MAX_READWRITE_SIZE((byte) 0x0f),
ILLEGAL_READ_ADDRESS((byte) 0x10),
ILLEGAL_READ_MEM_TYPE((byte) 0x11),
INIT_POD((byte) 0x12),
ILLEGAL_CMD_STATE((byte) 0x13),
ILLEGAL_SECURITY_CODE((byte) 0x14),
POD_IN_ALARM((byte) 0x15),
COMD_NOT_SET((byte) 0x16),
ILLEGAL_RX_SENS_VALUE((byte) 0x17),
ILLEGAL_TX_PKT_SIZE((byte) 0x18),
OCCL_PARAMS_ALREADY_SET((byte) 0x19),
OCCL_PARAM((byte) 0x1a),
ILLEGAL_CDTHR_VALUE((byte) 0x1b),
IGNORE_COMMAND((byte) 0x1c),
INVALID_CRC((byte) 0x1d),
UNKNOWN((byte) 0xff);
private byte value;
NakErrorType(byte value) {
this.value = value;
}
public static NakErrorType byValue(byte value) {
for (NakErrorType type : values()) {
if (type.value == value) {
return type;
}
}
return UNKNOWN;
}
}

View file

@ -0,0 +1,26 @@
package info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definition;
public class OmnipodEvent {
public enum OmnipodEventType {
CONNECTED,
ALREADY_CONNECTED,
FAILED_TO_CONNECT,
DISCONNECTED,
COMMAND_SENT,
GOT_POD_VERSION,
SET_UNIQUE_ID,
PRIMED_PUMP,
FINISHED_ACTIVATION_1,
PROGRAMMED_BASAL,
PROGRAMMED_ALERTS,
SET_BEEPS,
INSERTED_CANNULA,
FINISHED_ACTIVATION_2,
PROGRAMMED_TEMP_BASAL,
STARTED_BOLUS,
STOPPED_DELIVERY,
SILENCED_ALERTS,
DEACTIVATED,
COMMAND_SENDING,
}
}

View file

@ -0,0 +1,36 @@
package info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definition;
public enum PodStatus {
UNINITIALIZED((byte) 0x00),
MFG_TEST((byte) 0x01),
FILLED((byte) 0x02),
UID_SET((byte) 0x03),
ENGAGING_CLUTCH_DRIVE((byte) 0x04),
CLUTCH_DRIVE_ENGAGED((byte) 0x05),
BASAL_PROGRAM_RUNNING((byte) 0x06),
PRIMING((byte) 0x07),
RUNNING_ABOVE_MIN_VOLUME((byte) 0x08),
RUNNING_BELOW_MIN_VOLUME((byte) 0x09),
UNUSED_10((byte) 0x0a),
UNUSED_11((byte) 0x0b),
UNUSED_12((byte) 0x0c),
ALARM((byte) 0x0d),
LUMP_OF_COAL((byte) 0x0e),
DEACTIVATED((byte) 0x0f),
UNKNOWN((byte) 0xff);
private byte value;
PodStatus(byte value) {
this.value = value;
}
public static PodStatus byValue(byte value) {
for (PodStatus status : values()) {
if (status.value == value) {
return status;
}
}
return UNKNOWN;
}
}

View file

@ -0,0 +1,14 @@
package info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.response;
abstract class ActivationResponseBase extends ResponseBase {
final ResponseType.ActivationResponseType activationResponseType;
ActivationResponseBase(ResponseType.ActivationResponseType activationResponseType, byte[] encoded) {
super(ResponseType.ACTIVATION_RESPONSE, encoded);
this.activationResponseType = activationResponseType;
}
public ResponseType.ActivationResponseType getActivationResponseType() {
return activationResponseType;
}
}

View file

@ -0,0 +1,14 @@
package info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.response;
public class AdditionalStatusResponseBase extends ResponseBase {
final ResponseType.AdditionalStatusResponseType statusResponseType;
AdditionalStatusResponseBase(ResponseType.AdditionalStatusResponseType statusResponseType, byte[] encoded) {
super(ResponseType.ADDITIONAL_STATUS_RESPONSE, encoded);
this.statusResponseType = statusResponseType;
}
public ResponseType.AdditionalStatusResponseType getStatusResponseType() {
return statusResponseType;
}
}

View file

@ -0,0 +1,240 @@
package info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.response;
import java.nio.ByteBuffer;
import java.util.Arrays;
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definition.AlarmType;
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definition.DeliveryStatus;
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definition.PodStatus;
public class AlarmStatusResponse extends AdditionalStatusResponseBase {
private final byte messageType;
private final short messageLength;
private final byte additionalStatusResponseType;
private final PodStatus podStatus;
private final DeliveryStatus deliveryStatus;
private final short bolusPulsesRemaining;
private final short sequenceNumberOfLastProgrammingCommand;
private final short totalPulsesDelivered;
private final AlarmType alarmType;
private final short alarmTime;
private final short reservoirPulsesRemaining;
private final short minutesSinceActivation;
private final boolean alert0Active;
private final boolean alert1Active;
private final boolean alert2Active;
private final boolean alert3Active;
private final boolean alert4Active;
private final boolean alert5Active;
private final boolean alert6Active;
private final boolean alert7Active;
private final boolean occlusionAlarm;
private final boolean pulseInfoInvalid;
private final PodStatus podStatusWhenAlarmOccurred;
private final boolean immediateBolusWhenAlarmOccurred;
private final byte occlusionType;
private final boolean occurredWhenFetchingImmediateBolusActiveInformation;
private final short rssi;
private final short receiverLowerGain;
private final PodStatus podStatusWhenAlarmOccurred2;
private final short returnAddressOfPodAlarmHandlerCaller;
public AlarmStatusResponse(byte[] encoded) {
super(ResponseType.AdditionalStatusResponseType.ALARM_STATUS, encoded);
messageType = encoded[0];
messageLength = (short) (encoded[1] & 0xff);
additionalStatusResponseType = encoded[2];
podStatus = PodStatus.byValue((byte) (encoded[3] & 0x0f));
deliveryStatus = DeliveryStatus.byValue((byte) (encoded[4] & 0x0f));
bolusPulsesRemaining = (short) (ByteBuffer.wrap(new byte[]{encoded[5], encoded[6]}).getShort() & 2047);
sequenceNumberOfLastProgrammingCommand = (short) (encoded[7] & 0x0f);
totalPulsesDelivered = ByteBuffer.wrap(new byte[]{encoded[8], encoded[9]}).getShort();
alarmType = AlarmType.byValue(encoded[10]);
alarmTime = ByteBuffer.wrap(new byte[]{encoded[11], encoded[12]}).getShort();
reservoirPulsesRemaining = ByteBuffer.wrap(new byte[]{encoded[13], encoded[14]}).getShort();
minutesSinceActivation = ByteBuffer.wrap(new byte[]{encoded[15], encoded[16]}).getShort();
byte activeAlerts = encoded[17];
alert0Active = (activeAlerts & 1) == 1;
alert1Active = ((activeAlerts >>> 1) & 1) == 1;
alert2Active = ((activeAlerts >>> 2) & 1) == 1;
alert3Active = ((activeAlerts >>> 3) & 1) == 1;
alert4Active = ((activeAlerts >>> 4) & 1) == 1;
alert5Active = ((activeAlerts >>> 5) & 1) == 1;
alert6Active = ((activeAlerts >>> 6) & 1) == 1;
alert7Active = ((activeAlerts >>> 7) & 1) == 1;
byte alarmFlags = encoded[18];
occlusionAlarm = (alarmFlags & 1) == 1;
pulseInfoInvalid = ((alarmFlags >> 1) & 1) == 1;
byte byte19 = encoded[19];
byte byte20 = encoded[20];
podStatusWhenAlarmOccurred = PodStatus.byValue((byte) (byte19 & 0x0f));
immediateBolusWhenAlarmOccurred = ((byte19 >> 4) & 1) == 1;
occlusionType = (byte) ((byte19 >> 5) & 3);
occurredWhenFetchingImmediateBolusActiveInformation = ((byte19 >> 7) & 1) == 1;
rssi = (short) (byte20 & 0x3f);
receiverLowerGain = (short) ((byte20 >> 6) & 0x03);
podStatusWhenAlarmOccurred2 = PodStatus.byValue((byte) (encoded[21] & 0x0f));
returnAddressOfPodAlarmHandlerCaller = ByteBuffer.wrap(new byte[]{encoded[22], encoded[23]}).getShort();
}
public byte getMessageType() {
return messageType;
}
public short getMessageLength() {
return messageLength;
}
public byte getAdditionalStatusResponseType() {
return additionalStatusResponseType;
}
public PodStatus getPodStatus() {
return podStatus;
}
public DeliveryStatus getDeliveryStatus() {
return deliveryStatus;
}
public short getBolusPulsesRemaining() {
return bolusPulsesRemaining;
}
public short getSequenceNumberOfLastProgrammingCommand() {
return sequenceNumberOfLastProgrammingCommand;
}
public short getTotalPulsesDelivered() {
return totalPulsesDelivered;
}
public AlarmType getAlarmType() {
return alarmType;
}
public short getAlarmTime() {
return alarmTime;
}
public short getReservoirPulsesRemaining() {
return reservoirPulsesRemaining;
}
public short getMinutesSinceActivation() {
return minutesSinceActivation;
}
public boolean isAlert0Active() {
return alert0Active;
}
public boolean isAlert1Active() {
return alert1Active;
}
public boolean isAlert2Active() {
return alert2Active;
}
public boolean isAlert3Active() {
return alert3Active;
}
public boolean isAlert4Active() {
return alert4Active;
}
public boolean isAlert5Active() {
return alert5Active;
}
public boolean isAlert6Active() {
return alert6Active;
}
public boolean isAlert7Active() {
return alert7Active;
}
public boolean isOcclusionAlarm() {
return occlusionAlarm;
}
public boolean isPulseInfoInvalid() {
return pulseInfoInvalid;
}
public PodStatus getPodStatusWhenAlarmOccurred() {
return podStatusWhenAlarmOccurred;
}
public boolean isImmediateBolusWhenAlarmOccurred() {
return immediateBolusWhenAlarmOccurred;
}
public byte getOcclusionType() {
return occlusionType;
}
public boolean isOccurredWhenFetchingImmediateBolusActiveInformation() {
return occurredWhenFetchingImmediateBolusActiveInformation;
}
public short getRssi() {
return rssi;
}
public short getReceiverLowerGain() {
return receiverLowerGain;
}
public PodStatus getPodStatusWhenAlarmOccurred2() {
return podStatusWhenAlarmOccurred2;
}
public short getReturnAddressOfPodAlarmHandlerCaller() {
return returnAddressOfPodAlarmHandlerCaller;
}
@Override public String toString() {
return "AlarmStatusResponse{" +
"messageType=" + messageType +
", messageLength=" + messageLength +
", additionalStatusResponseType=" + additionalStatusResponseType +
", podStatus=" + podStatus +
", deliveryStatus=" + deliveryStatus +
", bolusPulsesRemaining=" + bolusPulsesRemaining +
", sequenceNumberOfLastProgrammingCommand=" + sequenceNumberOfLastProgrammingCommand +
", totalPulsesDelivered=" + totalPulsesDelivered +
", alarmType=" + alarmType +
", alarmTime=" + alarmTime +
", reservoirPulsesRemaining=" + reservoirPulsesRemaining +
", minutesSinceActivation=" + minutesSinceActivation +
", alert0Active=" + alert0Active +
", alert1Active=" + alert1Active +
", alert2Active=" + alert2Active +
", alert3Active=" + alert3Active +
", alert4Active=" + alert4Active +
", alert5Active=" + alert5Active +
", alert6Active=" + alert6Active +
", alert7Active=" + alert7Active +
", occlusionAlarm=" + occlusionAlarm +
", pulseInfoInvalid=" + pulseInfoInvalid +
", podStatusWhenAlarmOccurred=" + podStatusWhenAlarmOccurred +
", immediateBolusWhenAlarmOccurred=" + immediateBolusWhenAlarmOccurred +
", occlusionType=" + occlusionType +
", occurredWhenFetchingImmediateBolusActiveInformation=" + occurredWhenFetchingImmediateBolusActiveInformation +
", rssi=" + rssi +
", receiverLowerGain=" + receiverLowerGain +
", podStatusWhenAlarmOccurred2=" + podStatusWhenAlarmOccurred2 +
", returnAddressOfPodAlarmHandlerCaller=" + returnAddressOfPodAlarmHandlerCaller +
", statusResponseType=" + statusResponseType +
", responseType=" + responseType +
", encoded=" + Arrays.toString(encoded) +
'}';
}
}

View file

@ -0,0 +1,136 @@
package info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.response;
import java.util.Arrays;
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definition.DeliveryStatus;
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definition.PodStatus;
public class DefaultStatusResponse extends ResponseBase {
private final byte messageType;
private final DeliveryStatus deliveryStatus;
private final PodStatus podStatus;
private final short totalPulsesDelivered;
private final short sequenceNumberOfLastProgrammingCommand;
private final short bolusPulsesRemaining;
private final boolean occlusionAlertActive;
private final boolean alert1Active;
private final boolean alert2Active;
private final boolean alert3Active;
private final boolean alert4Active;
private final boolean alert5Active;
private final boolean alert6Active;
private final boolean alert7Active;
private final short minutesSinceActivation;
private final short reservoirPulsesRemaining;
public DefaultStatusResponse(byte[] encoded) {
super(ResponseType.DEFAULT_STATUS_RESPONSE, encoded);
messageType = encoded[0];
deliveryStatus = DeliveryStatus.byValue((byte) ((encoded[1] >> 4) & 0x0f));
podStatus = PodStatus.byValue((byte) (encoded[1] & 0x0f));
totalPulsesDelivered = (short) (((encoded[2] & 0x0f) << 12) | ((encoded[3] & 0xff) << 1) | ((encoded[4] & 0xff) >>> 7));
sequenceNumberOfLastProgrammingCommand = (byte) ((encoded[4] >>> 3) & 0x0f);
bolusPulsesRemaining = (short) ((((encoded[4] & 0x07) << 10) | (encoded[5] & 0xff)) & 2047);
short activeAlerts = (short) (((encoded[6] & 0xff) << 1) | (encoded[7] >>> 7));
occlusionAlertActive = (activeAlerts & 1) == 1;
alert1Active = ((activeAlerts >> 1) & 1) == 1;
alert2Active = ((activeAlerts >> 2) & 1) == 1;
alert3Active = ((activeAlerts >> 3) & 1) == 1;
alert4Active = ((activeAlerts >> 4) & 1) == 1;
alert5Active = ((activeAlerts >> 5) & 1) == 1;
alert6Active = ((activeAlerts >> 6) & 1) == 1;
alert7Active = ((activeAlerts >> 7) & 1) == 1;
minutesSinceActivation = (short) (((encoded[7] & 0x7f) << 6) | (((encoded[8] & 0xff) >>> 2) & 0x3f));
reservoirPulsesRemaining = (short) (((encoded[8] << 8) | encoded[9]) & 0x3ff);
}
public byte getMessageType() {
return messageType;
}
public DeliveryStatus getDeliveryStatus() {
return deliveryStatus;
}
public PodStatus getPodStatus() {
return podStatus;
}
public short getTotalPulsesDelivered() {
return totalPulsesDelivered;
}
public short getSequenceNumberOfLastProgrammingCommand() {
return sequenceNumberOfLastProgrammingCommand;
}
public short getBolusPulsesRemaining() {
return bolusPulsesRemaining;
}
public boolean isOcclusionAlertActive() {
return occlusionAlertActive;
}
public boolean isAlert1Active() {
return alert1Active;
}
public boolean isAlert2Active() {
return alert2Active;
}
public boolean isAlert3Active() {
return alert3Active;
}
public boolean isAlert4Active() {
return alert4Active;
}
public boolean isAlert5Active() {
return alert5Active;
}
public boolean isAlert6Active() {
return alert6Active;
}
public boolean isAlert7Active() {
return alert7Active;
}
public short getMinutesSinceActivation() {
return minutesSinceActivation;
}
public short getReservoirPulsesRemaining() {
return reservoirPulsesRemaining;
}
@Override public String toString() {
return "DefaultStatusResponse{" +
"messageType=" + messageType +
", deliveryStatus=" + deliveryStatus +
", podStatus=" + podStatus +
", totalPulsesDelivered=" + totalPulsesDelivered +
", sequenceNumberOfLastProgrammingCommand=" + sequenceNumberOfLastProgrammingCommand +
", bolusPulsesRemaining=" + bolusPulsesRemaining +
", occlusionAlertActive=" + occlusionAlertActive +
", alert1Active=" + alert1Active +
", alert2Active=" + alert2Active +
", alert3Active=" + alert3Active +
", alert4Active=" + alert4Active +
", alert5Active=" + alert5Active +
", alert6Active=" + alert6Active +
", alert7Active=" + alert7Active +
", minutesSinceActivation=" + minutesSinceActivation +
", reservoirPulsesRemaining=" + reservoirPulsesRemaining +
", responseType=" + responseType +
", encoded=" + Arrays.toString(encoded) +
'}';
}
}

View file

@ -0,0 +1,71 @@
package info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.response;
import java.util.Arrays;
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definition.AlarmType;
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definition.NakErrorType;
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definition.PodStatus;
public class NakResponse extends ResponseBase {
private final byte messageType;
private final short messageLength;
private final NakErrorType nakErrorType;
private final AlarmType alarmType;
private final PodStatus podStatus;
private final short securityNakSyncCount;
public NakResponse(byte[] encoded) {
super(ResponseType.NAK_RESPONSE, encoded);
this.messageType = encoded[0];
this.messageLength = encoded[1];
this.nakErrorType = NakErrorType.byValue(encoded[2]);
byte byte3 = encoded[3];
byte byte4 = encoded[4];
if (nakErrorType == NakErrorType.ILLEGAL_SECURITY_CODE) {
this.securityNakSyncCount = (short) ((byte3 << 8) | byte4);
this.alarmType = null;
this.podStatus = null;
} else {
this.securityNakSyncCount = 0;
this.alarmType = AlarmType.byValue(byte3);
this.podStatus = PodStatus.byValue(byte4);
}
}
public byte getMessageType() {
return messageType;
}
public short getMessageLength() {
return messageLength;
}
public NakErrorType getNakErrorType() {
return nakErrorType;
}
public AlarmType getAlarmType() {
return alarmType;
}
public PodStatus getPodStatus() {
return podStatus;
}
public short getSecurityNakSyncCount() {
return securityNakSyncCount;
}
@Override public String toString() {
return "NakResponse{" +
"messageType=" + messageType +
", messageLength=" + messageLength +
", nakErrorType=" + nakErrorType +
", alarmType=" + alarmType +
", podStatus=" + podStatus +
", securityNakSyncCount=" + securityNakSyncCount +
", responseType=" + responseType +
", encoded=" + Arrays.toString(encoded) +
'}';
}
}

View file

@ -0,0 +1,7 @@
package info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.response;
public interface Response {
ResponseType getResponseType();
byte[] getEncoded();
}

View file

@ -0,0 +1,22 @@
package info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.response;
import java.util.Arrays;
abstract class ResponseBase implements Response {
final ResponseType responseType;
final byte[] encoded;
ResponseBase(ResponseType responseType, byte[] encoded) {
this.responseType = responseType;
this.encoded = Arrays.copyOf(encoded, encoded.length);
}
@Override public ResponseType getResponseType() {
return responseType;
}
@Override
public byte[] getEncoded() {
return encoded;
}
}

View file

@ -0,0 +1,80 @@
package info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.response;
public enum ResponseType {
ACTIVATION_RESPONSE((byte) 0x01),
DEFAULT_STATUS_RESPONSE((byte) 0x1d),
ADDITIONAL_STATUS_RESPONSE((byte) 0x02),
NAK_RESPONSE((byte) 0x06),
UNKNOWN((byte) 0xff);
private byte value;
ResponseType(byte value) {
this.value = value;
}
public byte getValue() {
return value;
}
public static ResponseType byValue(byte value) {
for (ResponseType type : values()) {
if (type.value == value) {
return type;
}
}
return UNKNOWN;
}
enum AdditionalStatusResponseType {
STATUS_RESPONSE_PAGE_1((byte) 0x01),
ALARM_STATUS((byte) 0x02),
STATUS_RESPONSE_PAGE_3((byte) 0x03),
STATUS_RESPONSE_PAGE_5((byte) 0x05),
STATUS_RESPONSE_PAGE_6((byte) 0x06),
STATUS_RESPONSE_PAGE_70((byte) 0x46),
STATUS_RESPONSE_PAGE_80((byte) 0x50),
STATUS_RESPONSE_PAGE_81((byte) 0x51),
UNKNOWN((byte) 0xff);
private byte value;
AdditionalStatusResponseType(byte value) {
this.value = value;
}
public static AdditionalStatusResponseType byValue(byte value) {
for (AdditionalStatusResponseType type : values()) {
if (type.value == value) {
return type;
}
}
return UNKNOWN;
}
public byte getValue() {
return value;
}
}
enum ActivationResponseType {
GET_VERSION_RESPONSE((byte) 0x15),
SET_UNIQUE_ID_RESPONSE((byte) 0x1b),
UNKNOWN((byte) 0xff);
private byte length;
ActivationResponseType(byte length) {
this.length = length;
}
public static ActivationResponseType byLength(byte length) {
for (ActivationResponseType type : values()) {
if (type.length == length) {
return type;
}
}
return UNKNOWN;
}
}
}

View file

@ -0,0 +1,155 @@
package info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.response;
import java.nio.ByteBuffer;
import java.util.Arrays;
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definition.PodStatus;
public final class SetUniqueIdResponse extends ActivationResponseBase {
private byte messageType;
private short messageLength;
private short pulseVolumeInTenThousandthMicroLiter;
private short pumpRate;
private short primePumpRate;
private short numberOfEngagingClutchDrivePulses;
private short numberOfPrimePulses;
private short podExpirationTimeInHours;
private short firmwareVersionMajor;
private short firmwareVersionMinor;
private short firmwareVersionInterim;
private short bleVersionMajor;
private short bleVersionMinor;
private short bleVersionInterim;
private short productId;
private PodStatus podStatus;
private long lotNumber;
private long podSequenceNumber;
private long uniqueIdReceivedInCommand;
public SetUniqueIdResponse(byte[] encoded) {
super(ResponseType.ActivationResponseType.SET_UNIQUE_ID_RESPONSE, encoded);
messageType = encoded[0];
messageLength = (short) (encoded[1] & 0xff);
pulseVolumeInTenThousandthMicroLiter = ByteBuffer.wrap(new byte[]{encoded[2], encoded[3]}).getShort();
pumpRate = (short) (encoded[4] & 0xff);
primePumpRate = (short) (encoded[5] & 0xff);
numberOfEngagingClutchDrivePulses = (short) (encoded[6] & 0xff);
numberOfPrimePulses = (short) (encoded[7] & 0xff);
podExpirationTimeInHours = (short) (encoded[8] & 0xff);
firmwareVersionMajor = (short) (encoded[9] & 0xff);
firmwareVersionMinor = (short) (encoded[10] & 0xff);
firmwareVersionInterim = (short) (encoded[11] & 0xff);
bleVersionMajor = (short) (encoded[12] & 0xff);
bleVersionMinor = (short) (encoded[13] & 0xff);
bleVersionInterim = (short) (encoded[14] & 0xff);
productId = (short) (encoded[15] & 0xff);
podStatus = PodStatus.byValue(encoded[16]);
lotNumber = ByteBuffer.wrap(new byte[]{0, 0, 0, 0, encoded[17], encoded[18], encoded[19], encoded[20]}).getLong();
podSequenceNumber = ByteBuffer.wrap(new byte[]{0, 0, 0, 0, encoded[21], encoded[22], encoded[23], encoded[24]}).getLong();
uniqueIdReceivedInCommand = ByteBuffer.wrap(new byte[]{0, 0, 0, 0, encoded[25], encoded[26], encoded[27], encoded[28]}).getLong();
}
public byte getMessageType() {
return messageType;
}
public short getMessageLength() {
return messageLength;
}
public short getPulseVolumeInTenThousandthMicroLiter() {
return pulseVolumeInTenThousandthMicroLiter;
}
public short getDeliveryRate() {
return pumpRate;
}
public short getPrimeRate() {
return primePumpRate;
}
public short getNumberOfEngagingClutchDrivePulses() {
return numberOfEngagingClutchDrivePulses;
}
public short getNumberOfPrimePulses() {
return numberOfPrimePulses;
}
public short getPodExpirationTimeInHours() {
return podExpirationTimeInHours;
}
public short getFirmwareVersionMajor() {
return firmwareVersionMajor;
}
public short getFirmwareVersionMinor() {
return firmwareVersionMinor;
}
public short getFirmwareVersionInterim() {
return firmwareVersionInterim;
}
public short getBleVersionMajor() {
return bleVersionMajor;
}
public short getBleVersionMinor() {
return bleVersionMinor;
}
public short getBleVersionInterim() {
return bleVersionInterim;
}
public short getProductId() {
return productId;
}
public PodStatus getPodStatus() {
return podStatus;
}
public long getLotNumber() {
return lotNumber;
}
public long getPodSequenceNumber() {
return podSequenceNumber;
}
public long getUniqueIdReceivedInCommand() {
return uniqueIdReceivedInCommand;
}
@Override public String toString() {
return "SetUniqueIdResponse{" +
"messageType=" + messageType +
", messageLength=" + messageLength +
", pulseVolume=" + pulseVolumeInTenThousandthMicroLiter +
", pumpRate=" + pumpRate +
", primePumpRate=" + primePumpRate +
", numberOfEngagingClutchDrivePulses=" + numberOfEngagingClutchDrivePulses +
", numberOfPrimePulses=" + numberOfPrimePulses +
", podExpirationTimeInHours=" + podExpirationTimeInHours +
", softwareVersionMajor=" + firmwareVersionMajor +
", softwareVersionMinor=" + firmwareVersionMinor +
", softwareVersionInterim=" + firmwareVersionInterim +
", bleVersionMajor=" + bleVersionMajor +
", bleVersionMinor=" + bleVersionMinor +
", bleVersionInterim=" + bleVersionInterim +
", productId=" + productId +
", podStatus=" + podStatus +
", lotNumber=" + lotNumber +
", podSequenceNumber=" + podSequenceNumber +
", uniqueIdReceivedInCommand=" + uniqueIdReceivedInCommand +
", activationResponseType=" + activationResponseType +
", responseType=" + responseType +
", encoded=" + Arrays.toString(encoded) +
'}';
}
}

View file

@ -0,0 +1,128 @@
package info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.response;
import java.nio.ByteBuffer;
import java.util.Arrays;
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definition.PodStatus;
public final class VersionResponse extends ActivationResponseBase {
private final byte messageType;
private final short messageLength;
private final short firmwareVersionMajor;
private final short firmwareVersionMinor;
private final short firmwareVersionInterim;
private final short bleVersionMajor;
private final short bleVersionMinor;
private final short bleVersionInterim;
private final short productId;
private final PodStatus podStatus;
private final long lotNumber;
private final long podSequenceNumber;
private final byte rssi;
private final byte receiverLowerGain;
private final long uniqueIdReceivedInCommand;
public VersionResponse(byte[] encoded) {
super(ResponseType.ActivationResponseType.GET_VERSION_RESPONSE, encoded);
messageType = encoded[0];
messageLength = (short) (encoded[1] & 0xff);
firmwareVersionMajor = (short) (encoded[2] & 0xff);
firmwareVersionMinor = (short) (encoded[3] & 0xff);
firmwareVersionInterim = (short) (encoded[4] & 0xff);
bleVersionMajor = (short) (encoded[5] & 0xff);
bleVersionMinor = (short) (encoded[6] & 0xff);
bleVersionInterim = (short) (encoded[7] & 0xff);
productId = (short) (encoded[8] & 0xff);
podStatus = PodStatus.byValue((byte) (encoded[9] & 0xf));
lotNumber = ByteBuffer.wrap(new byte[]{0, 0, 0, 0, encoded[10], encoded[11], encoded[12], encoded[13]}).getLong();
podSequenceNumber = ByteBuffer.wrap(new byte[]{0, 0, 0, 0, encoded[14], encoded[15], encoded[16], encoded[17]}).getLong();
rssi = (byte) (encoded[18] & 0x3f);
receiverLowerGain = (byte) ((encoded[18] >> 6) & 0x03);
uniqueIdReceivedInCommand = ByteBuffer.wrap(new byte[]{0, 0, 0, 0, encoded[19], encoded[20], encoded[21], encoded[22]}).getLong();
}
public byte getMessageType() {
return messageType;
}
public short getMessageLength() {
return messageLength;
}
public short getFirmwareVersionMajor() {
return firmwareVersionMajor;
}
public short getFirmwareVersionMinor() {
return firmwareVersionMinor;
}
public short getFirmwareVersionInterim() {
return firmwareVersionInterim;
}
public short getBleVersionMajor() {
return bleVersionMajor;
}
public short getBleVersionMinor() {
return bleVersionMinor;
}
public short getBleVersionInterim() {
return bleVersionInterim;
}
public short getProductId() {
return productId;
}
public PodStatus getPodStatus() {
return podStatus;
}
public long getLotNumber() {
return lotNumber;
}
public long getPodSequenceNumber() {
return podSequenceNumber;
}
public byte getRssi() {
return rssi;
}
public byte getReceiverLowerGain() {
return receiverLowerGain;
}
public long getUniqueIdReceivedInCommand() {
return uniqueIdReceivedInCommand;
}
@Override public String toString() {
return "VersionResponse{" +
"messageType=" + messageType +
", messageLength=" + messageLength +
", firmwareVersionMajor=" + firmwareVersionMajor +
", firmwareVersionMinor=" + firmwareVersionMinor +
", firmwareVersionInterim=" + firmwareVersionInterim +
", bleVersionMajor=" + bleVersionMajor +
", bleVersionMinor=" + bleVersionMinor +
", bleVersionInterim=" + bleVersionInterim +
", productId=" + productId +
", podStatus=" + podStatus +
", lotNumber=" + lotNumber +
", podSequenceNumber=" + podSequenceNumber +
", rssi=" + rssi +
", receiverLowerGain=" + receiverLowerGain +
", uniqueIdReceivedInCommand=" + uniqueIdReceivedInCommand +
", activationResponseType=" + activationResponseType +
", responseType=" + responseType +
", encoded=" + Arrays.toString(encoded) +
'}';
}
}

View file

@ -0,0 +1,32 @@
package info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.util;
public class CrcUtil {
private static final short[] crc16table = {0, -32763, -32753, 10, -32741, 30, 20, -32751, -32717, 54, 60, -32711, 40, -32723, -32729, 34, -32669, 102, 108, -32663, 120, -32643, -32649, 114, 80, -32683, -32673, 90, -32693, 78, 68, -32703, -32573, 198, 204, -32567, 216, -32547, -32553, 210, 240, -32523, -32513, 250, -32533, 238, 228, -32543, 160, -32603, -32593, 170, -32581, 190, 180, -32591, -32621, 150, 156, -32615, 136, -32627, -32633, 130, -32381, 390, 396, -32375, 408, -32355, -32361, 402, 432, -32331, -32321, 442, -32341, 430, 420, -32351, 480, -32283, -32273, 490, -32261, 510, 500, -32271, -32301, 470, 476, -32295, 456, -32307, -32313, 450, 320, -32443, -32433, 330, -32421, 350, 340, -32431, -32397, 374, 380, -32391, 360, -32403, -32409, 354, -32477, 294, 300, -32471, 312, -32451, -32457, 306, 272, -32491, -32481, 282, -32501, 270, 260, -32511, -31997, 774, 780, -31991, 792, -31971, -31977, 786, 816, -31947, -31937, 826, -31957, 814, 804, -31967, 864, -31899, -31889, 874, -31877, 894, 884, -31887, -31917, 854, 860, -31911, 840, -31923, -31929, 834, 960, -31803, -31793, 970, -31781, 990, 980, -31791, -31757, 1014, 1020, -31751, 1000, -31763, -31769, 994, -31837, 934, 940, -31831, 952, -31811, -31817, 946, 912, -31851, -31841, 922, -31861, 910, 900, -31871, 640, -32123, -32113, 650, -32101, 670, 660, -32111, -32077, 694, 700, -32071, 680, -32083, -32089, 674, -32029, 742, 748, -32023, 760, -32003, -32009, 754, 720, -32043, -32033, 730, -32053, 718, 708, -32063, -32189, 582, 588, -32183, 600, -32163, -32169, 594, 624, -32139, -32129, 634, -32149, 622, 612, -32159, 544, -32219, -32209, 554, -32197, 574, 564, -32207, -32237, 534, 540, -32231, 520, -32243, -32249, 514};
public static int createCrc(short[] sArr) {
int i = 0;
for (short s = 0; s < sArr.length; s = (short) (s + 1)) {
byte b = (byte) sArr[s];
short s2 = b;
if (b < 0) {
s2 = (short) (((byte) (b & Byte.MAX_VALUE)) + 128);
}
i += s2;
}
return i;
}
public static short createCrc(byte[] bArr) {
short s = 0;
for (byte b : bArr) {
byte b2 = (byte) (b ^ (s & 255));
short s2 = b2;
if (b2 < 0) {
s2 = (short) (((byte) (b2 & Byte.MAX_VALUE)) + 128);
}
s = (short) (((short) (((short) (s >> 8)) & 255)) ^ crc16table[s2]);
}
return s;
}
}

View file

@ -0,0 +1,17 @@
package info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.command;
import org.apache.commons.codec.DecoderException;
import org.apache.commons.codec.binary.Hex;
import org.junit.Test;
import static org.junit.Assert.assertArrayEquals;
public class DeactivateCommandTest {
@Test
public void testEncoding() throws DecoderException {
byte[] encoded = new DeactivateCommand(37879809, (short) 5, false) //
.getEncoded();
assertArrayEquals(Hex.decodeHex("0242000114061C04494E532E001C"), encoded);
}
}

View file

@ -0,0 +1,17 @@
package info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.command;
import org.apache.commons.codec.DecoderException;
import org.apache.commons.codec.binary.Hex;
import org.junit.Test;
import static org.junit.Assert.assertArrayEquals;
public class GetVersionCommandTest {
@Test
public void testEncoding() throws DecoderException {
byte[] encoded = new GetVersionCommand((short) 0, false) //
.getEncoded();
assertArrayEquals(Hex.decodeHex("FFFFFFFF00060704FFFFFFFF82B2"), encoded);
}
}

View file

@ -0,0 +1,60 @@
package info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.command;
import org.apache.commons.codec.DecoderException;
import org.apache.commons.codec.binary.Hex;
import org.junit.Test;
import java.util.ArrayList;
import java.util.List;
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definition.AlertConfiguration;
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definition.AlertSlot;
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definition.AlertTriggerType;
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definition.BeepRepetitionType;
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definition.BeepType;
import static org.junit.Assert.assertArrayEquals;
public class ProgramAlertsCommandTest {
@Test
public void testExpirationAlerts() throws DecoderException {
List<AlertConfiguration> configurations = new ArrayList<>();
configurations.add(new AlertConfiguration(AlertSlot.EXPIRATION, true, (short) 420, false, AlertTriggerType.TIME_TRIGGER, (short) 4305, BeepType.FOUR_TIMES_BIP_BEEP, BeepRepetitionType.XXX3));
configurations.add(new AlertConfiguration(AlertSlot.EXPIRATION_IMMINENT, true, (short) 0, false, AlertTriggerType.TIME_TRIGGER, (short) 4725, BeepType.FOUR_TIMES_BIP_BEEP, BeepRepetitionType.XXX4));
byte[] encoded = new ProgramAlertsCommand(37879811, (short) 3, true, configurations).getEncoded();
assertArrayEquals(Hex.decodeHex("024200038C121910494E532E79A410D1050228001275060280F5"), encoded);
}
@Test
public void testLowReservoirAlert() throws DecoderException {
List<AlertConfiguration> configurations = new ArrayList<>();
configurations.add(new AlertConfiguration(AlertSlot.LOW_RESERVOIR, true, (short) 0, false, AlertTriggerType.RESERVOIR_VOLUME_TRIGGER, (short) 200, BeepType.FOUR_TIMES_BIP_BEEP, BeepRepetitionType.XXX));
byte[] encoded = new ProgramAlertsCommand(37879811, (short) 8, false, configurations).getEncoded();
assertArrayEquals(Hex.decodeHex("02420003200C190A494E532E4C0000C801020149"), encoded);
}
@Test
public void testUserExpirationAlert() throws DecoderException {
List<AlertConfiguration> configurations = new ArrayList<>();
configurations.add(new AlertConfiguration(AlertSlot.USER_SET_EXPIRATION, true, (short) 0, false, AlertTriggerType.TIME_TRIGGER, (short) 4079, BeepType.FOUR_TIMES_BIP_BEEP, BeepRepetitionType.XXX2));
byte[] encoded = new ProgramAlertsCommand(37879811, (short) 15, false, configurations).getEncoded();
assertArrayEquals(Hex.decodeHex("024200033C0C190A494E532E38000FEF030203E2"), encoded);
}
@Test
public void testLumpOfCoalAlert() throws DecoderException {
List<AlertConfiguration> configurations = new ArrayList<>();
configurations.add(new AlertConfiguration(AlertSlot.EXPIRATION, true, (short) 55, false, AlertTriggerType.TIME_TRIGGER, (short) 5, BeepType.FOUR_TIMES_BIP_BEEP, BeepRepetitionType.XXX5));
byte[] encoded = new ProgramAlertsCommand(37879811, (short) 10, false, configurations).getEncoded();
assertArrayEquals(Hex.decodeHex("02420003280C190A494E532E7837000508020356"), encoded);
}
}

View file

@ -0,0 +1,19 @@
package info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.command;
import org.apache.commons.codec.DecoderException;
import org.apache.commons.codec.binary.Hex;
import org.junit.Test;
import java.util.Date;
import static org.junit.Assert.assertArrayEquals;
public class SetUniqueIdCommandTest {
@Test
public void testEncoding() throws DecoderException {
byte[] encoded = new SetUniqueIdCommand(37879811, (short) 6, 135556289, 681767, new Date(2021, 1, 10, 14, 41), false) //
.getEncoded();
assertArrayEquals(Hex.decodeHex("FFFFFFFF18150313024200031404020A150E2908146CC1000A67278344"), encoded);
}
}

View file

@ -0,0 +1,19 @@
package info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.command;
import org.apache.commons.codec.DecoderException;
import org.apache.commons.codec.binary.Hex;
import org.junit.Test;
import static org.junit.Assert.assertArrayEquals;
public class SilenceAlertsCommandTest {
@Test
public void testSilenceLowReservoirAlert() throws DecoderException {
byte[] encoded = new SilenceAlertsCommand(37879811, (short) 1, false, new SilenceAlertsCommand.SilenceAlertCommandParameters(false, false, false, false, true, false, false, false)) //
.getEncoded();
assertArrayEquals(Hex.decodeHex("0242000304071105494E532E1081CE"), encoded);
}
// TODO capture more silence alerts commands
}

View file

@ -0,0 +1,29 @@
package info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.command;
import org.apache.commons.codec.DecoderException;
import org.apache.commons.codec.binary.Hex;
import org.junit.Test;
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definition.BeepType;
import static org.junit.Assert.assertArrayEquals;
public class StopDeliveryCommandTest {
@Test
public void testStopTempBasal() throws DecoderException {
byte[] encoded = new StopDeliveryCommand(37879811, (short) 0, false, StopDeliveryCommand.DeliveryType.TEMP_BASAL, BeepType.LONG_SINGLE_BEEP) //
.getEncoded();
assertArrayEquals(Hex.decodeHex("0242000300071F05494E532E6201B1"), encoded);
}
@Test
public void testSuspendDelivery() throws DecoderException {
byte[] encoded = new StopDeliveryCommand(37879811, (short) 2, false, StopDeliveryCommand.DeliveryType.ALL, BeepType.SILENT) //
.getEncoded();
assertArrayEquals(Hex.decodeHex("0242000308071F05494E532E078287"), encoded);
}
// TODO test cancel bolus
}

View file

@ -0,0 +1,56 @@
package info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.response;
import org.apache.commons.codec.DecoderException;
import org.apache.commons.codec.binary.Hex;
import org.junit.Test;
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definition.AlarmType;
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definition.DeliveryStatus;
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definition.PodStatus;
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotSame;
public class AlarmStatusResponseTest {
@Test
public void testValidResponse() throws DecoderException {
byte[] encoded = Hex.decodeHex("021602080100000501BD00000003FF01950000000000670A");
AlarmStatusResponse response = new AlarmStatusResponse(encoded);
assertArrayEquals(encoded, response.getEncoded());
assertNotSame(encoded, response.getEncoded());
assertEquals(ResponseType.ADDITIONAL_STATUS_RESPONSE, response.getResponseType());
assertEquals(ResponseType.ADDITIONAL_STATUS_RESPONSE.getValue(), response.getMessageType());
assertEquals(ResponseType.AdditionalStatusResponseType.ALARM_STATUS, response.getStatusResponseType());
assertEquals(ResponseType.AdditionalStatusResponseType.ALARM_STATUS.getValue(), response.getAdditionalStatusResponseType());
assertEquals(PodStatus.RUNNING_ABOVE_MIN_VOLUME, response.getPodStatus());
assertEquals(DeliveryStatus.BASAL_ACTIVE, response.getDeliveryStatus());
assertEquals((short) 0, response.getBolusPulsesRemaining());
assertEquals((short) 5, response.getSequenceNumberOfLastProgrammingCommand());
assertEquals((short) 445, response.getTotalPulsesDelivered());
assertEquals(AlarmType.NONE, response.getAlarmType());
assertEquals((short) 0, response.getAlarmTime());
assertEquals((short) 1023, response.getReservoirPulsesRemaining());
assertEquals((short) 405, response.getMinutesSinceActivation());
assertFalse(response.isAlert0Active());
assertFalse(response.isAlert1Active());
assertFalse(response.isAlert2Active());
assertFalse(response.isAlert3Active());
assertFalse(response.isAlert4Active());
assertFalse(response.isAlert5Active());
assertFalse(response.isAlert6Active());
assertFalse(response.isAlert7Active());
assertFalse(response.isOcclusionAlarm());
assertFalse(response.isPulseInfoInvalid());
assertEquals(PodStatus.UNINITIALIZED, response.getPodStatusWhenAlarmOccurred());
assertFalse(response.isImmediateBolusWhenAlarmOccurred());
assertEquals((byte) 0x00, response.getOcclusionType());
assertFalse(response.isOccurredWhenFetchingImmediateBolusActiveInformation());
assertEquals(0, response.getRssi());
assertEquals(0, response.getReceiverLowerGain());
assertEquals(PodStatus.UNINITIALIZED, response.getPodStatusWhenAlarmOccurred2());
assertEquals((short) 26378, response.getReturnAddressOfPodAlarmHandlerCaller());
}
}

View file

@ -0,0 +1,41 @@
package info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.response;
import org.apache.commons.codec.DecoderException;
import org.apache.commons.codec.binary.Hex;
import org.junit.Test;
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definition.DeliveryStatus;
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definition.PodStatus;
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotSame;
public class DefaultStatusResponseTest {
@Test
public void testValidResponse() throws DecoderException {
byte[] encoded = Hex.decodeHex("1D1800A02800000463FF");
DefaultStatusResponse response = new DefaultStatusResponse(encoded);
assertArrayEquals(encoded, response.getEncoded());
assertNotSame(encoded, response.getEncoded());
assertEquals(ResponseType.DEFAULT_STATUS_RESPONSE, response.getResponseType());
assertEquals(ResponseType.DEFAULT_STATUS_RESPONSE.getValue(), response.getMessageType());
assertEquals(DeliveryStatus.BASAL_ACTIVE, response.getDeliveryStatus());
assertEquals(PodStatus.RUNNING_ABOVE_MIN_VOLUME, response.getPodStatus());
assertEquals((short) 320, response.getTotalPulsesDelivered());
assertEquals((short) 5, response.getSequenceNumberOfLastProgrammingCommand());
assertEquals((short) 0, response.getBolusPulsesRemaining());
assertFalse(response.isOcclusionAlertActive());
assertFalse(response.isAlert1Active());
assertFalse(response.isAlert2Active());
assertFalse(response.isAlert3Active());
assertFalse(response.isAlert4Active());
assertFalse(response.isAlert5Active());
assertFalse(response.isAlert6Active());
assertFalse(response.isAlert7Active());
assertEquals((short) 280, response.getMinutesSinceActivation());
assertEquals((short) 1023, response.getReservoirPulsesRemaining());
}
}

View file

@ -0,0 +1,30 @@
package info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.response;
import org.apache.commons.codec.DecoderException;
import org.apache.commons.codec.binary.Hex;
import org.junit.Test;
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definition.AlarmType;
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definition.NakErrorType;
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definition.PodStatus;
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotSame;
public class NakResponseTest {
@Test
public void testValidResponse() throws DecoderException {
byte[] encoded = Hex.decodeHex("0603070009");
NakResponse response = new NakResponse(encoded);
assertArrayEquals(encoded, response.getEncoded());
assertNotSame(encoded, response.getEncoded());
assertEquals(ResponseType.NAK_RESPONSE, response.getResponseType());
assertEquals(ResponseType.NAK_RESPONSE.getValue(), response.getMessageType());
assertEquals(NakErrorType.ILLEGAL_PARAM, response.getNakErrorType());
assertEquals(AlarmType.NONE, response.getAlarmType());
assertEquals(PodStatus.RUNNING_BELOW_MIN_VOLUME, response.getPodStatus());
assertEquals((byte) 0x00, response.getSecurityNakSyncCount());
}
}

View file

@ -0,0 +1,44 @@
package info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.response;
import org.apache.commons.codec.DecoderException;
import org.apache.commons.codec.binary.Hex;
import org.junit.Test;
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definition.PodStatus;
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotSame;
public class SetUniqueIdResponseTest {
@Test
public void testValidResponse() throws DecoderException {
byte[] encoded = Hex.decodeHex("011B13881008340A50040A00010300040308146CC1000954D402420001");
SetUniqueIdResponse response = new SetUniqueIdResponse(encoded);
assertArrayEquals(encoded, response.getEncoded());
assertNotSame(encoded, response.getEncoded());
assertEquals(ResponseType.ACTIVATION_RESPONSE, response.getResponseType());
assertEquals(ResponseType.ActivationResponseType.SET_UNIQUE_ID_RESPONSE, response.getActivationResponseType());
assertEquals(ResponseType.ACTIVATION_RESPONSE.getValue(), response.getMessageType());
assertEquals(27, response.getMessageLength());
assertEquals(5000, response.getPulseVolumeInTenThousandthMicroLiter());
assertEquals(16, response.getDeliveryRate());
assertEquals(8, response.getPrimeRate());
assertEquals(52, response.getNumberOfEngagingClutchDrivePulses());
assertEquals(10, response.getNumberOfPrimePulses());
assertEquals(80, response.getPodExpirationTimeInHours());
assertEquals(4, response.getFirmwareVersionMajor());
assertEquals(10, response.getFirmwareVersionMinor());
assertEquals(0, response.getFirmwareVersionInterim());
assertEquals(1, response.getBleVersionMajor());
assertEquals(3, response.getBleVersionMinor());
assertEquals(0, response.getBleVersionInterim());
assertEquals(4, response.getProductId());
assertEquals(PodStatus.UID_SET, response.getPodStatus());
assertEquals(135556289L, response.getLotNumber());
assertEquals(611540L, response.getPodSequenceNumber());
assertEquals(37879809L, response.getUniqueIdReceivedInCommand());
}
}

View file

@ -0,0 +1,41 @@
package info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.response;
import org.apache.commons.codec.DecoderException;
import org.apache.commons.codec.binary.Hex;
import org.junit.Test;
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definition.PodStatus;
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotSame;
public class VersionResponseTest {
@Test
public void testValidResponse() throws DecoderException {
byte[] encoded = Hex.decodeHex("0115040A00010300040208146CC1000954D400FFFFFFFF");
VersionResponse response = new VersionResponse(encoded);
assertArrayEquals(encoded, response.getEncoded());
assertNotSame(encoded, response.getEncoded());
assertEquals(ResponseType.ACTIVATION_RESPONSE, response.getResponseType());
assertEquals(ResponseType.ActivationResponseType.GET_VERSION_RESPONSE, response.getActivationResponseType());
assertEquals(ResponseType.ACTIVATION_RESPONSE.getValue(), response.getMessageType());
assertEquals(21, response.getMessageLength());
assertEquals(4, response.getFirmwareVersionMajor());
assertEquals(10, response.getFirmwareVersionMinor());
assertEquals(0, response.getFirmwareVersionInterim());
assertEquals(1, response.getBleVersionMajor());
assertEquals(3, response.getBleVersionMinor());
assertEquals(0, response.getBleVersionInterim());
assertEquals(4, response.getProductId());
assertEquals(PodStatus.FILLED, response.getPodStatus());
assertEquals(135556289, response.getLotNumber());
assertEquals(611540, response.getPodSequenceNumber());
assertEquals(0L, response.getRssi());
assertEquals(0L, response.getReceiverLowerGain());
assertEquals(4294967295L, response.getUniqueIdReceivedInCommand());
}
}

1
omnipod-eros/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
/build

View file

@ -41,20 +41,10 @@ android {
}
}
allprojects {
repositories {
flatDir {
dirs 'libs'
}
}
}
dependencies {
implementation project(':core')
implementation project(':rileylink')
implementation fileTree(dir: 'libs', include: ['*.jar'])
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"
@ -64,7 +54,7 @@ dependencies {
testImplementation "org.mockito:mockito-core:${mockitoVersion}"
testImplementation "org.powermock:powermock-api-mockito2:$powermockVersion"
testImplementation "org.powermock:powermock-module-junit4:${powermockVersion}"
testImplementation 'joda-time:joda-time:2.10.9'
testImplementation "joda-time:joda-time:$jodatime_version"
androidTestImplementation "androidx.test.ext:junit:$androidx_junit"
androidTestImplementation "androidx.test:rules:$androidx_rules"
}

View file

21
omnipod-eros/proguard-rules.pro vendored Normal file
View file

@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile

View file

@ -1,5 +1,5 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="info.nightscout.androidaps.plugins.pump.omnipod">
package="info.nightscout.androidaps.plugins.pump.omnipod.eros">
<application>
<service

View file

@ -1,4 +1,4 @@
package info.nightscout.androidaps.plugins.pump.omnipod;
package info.nightscout.androidaps.plugins.pump.omnipod.eros;
import android.content.ComponentName;
import android.content.Context;
@ -66,35 +66,35 @@ import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLin
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkPumpInfo;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.RileyLinkServiceData;
import info.nightscout.androidaps.plugins.pump.common.utils.DateTimeUtil;
import info.nightscout.androidaps.plugins.pump.omnipod.data.ActiveBolus;
import info.nightscout.androidaps.plugins.pump.omnipod.data.RLHistoryItemOmnipod;
import info.nightscout.androidaps.plugins.pump.omnipod.definition.OmnipodCommandType;
import info.nightscout.androidaps.plugins.pump.omnipod.definition.OmnipodStorageKeys;
import info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.action.service.ExpirationReminderBuilder;
import info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.message.response.podinfo.PodInfoRecentPulseLog;
import info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.ActivationProgress;
import info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.AlertConfiguration;
import info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.AlertSet;
import info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.OmnipodConstants;
import info.nightscout.androidaps.plugins.pump.omnipod.driver.manager.PodStateManager;
import info.nightscout.androidaps.plugins.pump.omnipod.driver.util.TimeUtil;
import info.nightscout.androidaps.plugins.pump.omnipod.event.EventOmnipodActiveAlertsChanged;
import info.nightscout.androidaps.plugins.pump.omnipod.event.EventOmnipodFaultEventChanged;
import info.nightscout.androidaps.plugins.pump.omnipod.event.EventOmnipodPumpValuesChanged;
import info.nightscout.androidaps.plugins.pump.omnipod.event.EventOmnipodTbrChanged;
import info.nightscout.androidaps.plugins.pump.omnipod.event.EventOmnipodUncertainTbrRecovered;
import info.nightscout.androidaps.plugins.pump.omnipod.manager.AapsOmnipodManager;
import info.nightscout.androidaps.plugins.pump.omnipod.queue.command.CommandAcknowledgeAlerts;
import info.nightscout.androidaps.plugins.pump.omnipod.queue.command.CommandHandleTimeChange;
import info.nightscout.androidaps.plugins.pump.omnipod.queue.command.CommandPlayTestBeep;
import info.nightscout.androidaps.plugins.pump.omnipod.queue.command.CommandUpdateAlertConfiguration;
import info.nightscout.androidaps.plugins.pump.omnipod.queue.command.OmnipodCustomCommand;
import info.nightscout.androidaps.plugins.pump.omnipod.queue.command.OmnipodCustomCommandType;
import info.nightscout.androidaps.plugins.pump.omnipod.rileylink.manager.OmnipodRileyLinkCommunicationManager;
import info.nightscout.androidaps.plugins.pump.omnipod.rileylink.service.RileyLinkOmnipodService;
import info.nightscout.androidaps.plugins.pump.omnipod.ui.OmnipodOverviewFragment;
import info.nightscout.androidaps.plugins.pump.omnipod.util.AapsOmnipodUtil;
import info.nightscout.androidaps.plugins.pump.omnipod.util.OmnipodAlertUtil;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.data.ActiveBolus;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.data.RLHistoryItemOmnipod;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.definition.OmnipodCommandType;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.definition.OmnipodStorageKeys;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.communication.action.service.ExpirationReminderBuilder;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.communication.message.response.podinfo.PodInfoRecentPulseLog;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.definition.ActivationProgress;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.definition.AlertConfiguration;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.definition.AlertSet;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.definition.OmnipodConstants;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.manager.PodStateManager;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.util.TimeUtil;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.event.EventOmnipodActiveAlertsChanged;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.event.EventOmnipodFaultEventChanged;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.event.EventOmnipodPumpValuesChanged;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.event.EventOmnipodTbrChanged;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.event.EventOmnipodUncertainTbrRecovered;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.manager.AapsOmnipodManager;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.queue.command.CommandAcknowledgeAlerts;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.queue.command.CommandHandleTimeChange;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.queue.command.CommandPlayTestBeep;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.queue.command.CommandUpdateAlertConfiguration;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.queue.command.OmnipodCustomCommand;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.queue.command.OmnipodCustomCommandType;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.rileylink.manager.OmnipodRileyLinkCommunicationManager;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.rileylink.service.RileyLinkOmnipodService;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.ui.OmnipodOverviewFragment;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.util.AapsOmnipodUtil;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.util.OmnipodAlertUtil;
import info.nightscout.androidaps.queue.Callback;
import info.nightscout.androidaps.queue.commands.CustomCommand;
import info.nightscout.androidaps.utils.DateUtil;
@ -107,7 +107,7 @@ import info.nightscout.androidaps.utils.rx.AapsSchedulers;
import info.nightscout.androidaps.utils.sharedPreferences.SP;
import io.reactivex.disposables.CompositeDisposable;
import static info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.OmnipodConstants.BASAL_STEP_DURATION;
import static info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.definition.OmnipodConstants.BASAL_STEP_DURATION;
/**
* Created by andy on 23.04.18.
@ -115,7 +115,7 @@ import static info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.
* @author Andy Rozman (andy.rozman@gmail.com)
*/
@Singleton
public class OmnipodPumpPlugin extends PumpPluginBase implements PumpInterface, RileyLinkPumpDevice {
public class OmnipodErosPumpPlugin extends PumpPluginBase implements PumpInterface, RileyLinkPumpDevice {
private static final long RILEY_LINK_CONNECT_TIMEOUT_MILLIS = 3 * 60 * 1_000L; // 3 minutes
private static final long STATUS_CHECK_INTERVAL_MILLIS = 60 * 1_000L; // 1 minute
public static final int STARTUP_STATUS_REQUEST_TRIES = 2;
@ -158,7 +158,7 @@ public class OmnipodPumpPlugin extends PumpPluginBase implements PumpInterface,
private final Runnable statusChecker;
@Inject
public OmnipodPumpPlugin(
public OmnipodErosPumpPlugin(
HasAndroidInjector injector,
AAPSLogger aapsLogger,
AapsSchedulers aapsSchedulers,
@ -247,10 +247,10 @@ public class OmnipodPumpPlugin extends PumpPluginBase implements PumpInterface,
aapsOmnipodManager.createSuspendedFakeTbrIfNotExists();
}
if (OmnipodPumpPlugin.this.hasTimeDateOrTimeZoneChanged) {
if (OmnipodErosPumpPlugin.this.hasTimeDateOrTimeZoneChanged) {
getCommandQueue().customCommand(new CommandHandleTimeChange(false), null);
}
if (!OmnipodPumpPlugin.this.verifyPodAlertConfiguration()) {
if (!OmnipodErosPumpPlugin.this.verifyPodAlertConfiguration()) {
getCommandQueue().customCommand(new CommandUpdateAlertConfiguration(), null);
}

View file

@ -1,20 +1,20 @@
package info.nightscout.androidaps.plugins.pump.omnipod.dagger
package info.nightscout.androidaps.plugins.pump.omnipod.eros.dagger
import dagger.Module
import dagger.Provides
import dagger.android.ContributesAndroidInjector
import info.nightscout.androidaps.plugins.pump.omnipod.data.RLHistoryItemOmnipod
import info.nightscout.androidaps.plugins.pump.omnipod.driver.manager.PodStateManager
import info.nightscout.androidaps.plugins.pump.omnipod.manager.AapsPodStateManager
import info.nightscout.androidaps.plugins.pump.omnipod.rileylink.manager.OmnipodRileyLinkCommunicationManager
import info.nightscout.androidaps.plugins.pump.omnipod.ui.PodHistoryActivity
import info.nightscout.androidaps.plugins.pump.omnipod.ui.PodManagementActivity
import info.nightscout.androidaps.plugins.pump.omnipod.ui.wizard.activation.PodActivationWizardActivity
import info.nightscout.androidaps.plugins.pump.omnipod.ui.wizard.deactivation.PodDeactivationWizardActivity
import info.nightscout.androidaps.plugins.pump.omnipod.eros.data.RLHistoryItemOmnipod
import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.manager.PodStateManager
import info.nightscout.androidaps.plugins.pump.omnipod.eros.manager.AapsPodStateManager
import info.nightscout.androidaps.plugins.pump.omnipod.eros.rileylink.manager.OmnipodRileyLinkCommunicationManager
import info.nightscout.androidaps.plugins.pump.omnipod.eros.ui.PodHistoryActivity
import info.nightscout.androidaps.plugins.pump.omnipod.eros.ui.PodManagementActivity
import info.nightscout.androidaps.plugins.pump.omnipod.eros.ui.wizard.activation.PodActivationWizardActivity
import info.nightscout.androidaps.plugins.pump.omnipod.eros.ui.wizard.deactivation.PodDeactivationWizardActivity
@Module
@Suppress("unused")
abstract class OmnipodModule {
abstract class OmnipodErosModule {
// Activities
@ContributesAndroidInjector

View file

@ -1,4 +1,4 @@
package info.nightscout.androidaps.plugins.pump.omnipod.dagger
package info.nightscout.androidaps.plugins.pump.omnipod.eros.dagger
import androidx.lifecycle.ViewModel
import androidx.lifecycle.ViewModelProvider

View file

@ -1,4 +1,4 @@
package info.nightscout.androidaps.plugins.pump.omnipod.dagger
package info.nightscout.androidaps.plugins.pump.omnipod.eros.dagger
import androidx.lifecycle.ViewModel
import androidx.lifecycle.ViewModelProvider
@ -7,18 +7,18 @@ import dagger.Module
import dagger.Provides
import dagger.android.ContributesAndroidInjector
import dagger.multibindings.IntoMap
import info.nightscout.androidaps.plugins.pump.omnipod.ui.wizard.activation.fragment.AttachPodInfoFragment
import info.nightscout.androidaps.plugins.pump.omnipod.ui.wizard.activation.fragment.FillPodInfoFragment
import info.nightscout.androidaps.plugins.pump.omnipod.ui.wizard.activation.fragment.InitializePodActionFragment
import info.nightscout.androidaps.plugins.pump.omnipod.ui.wizard.activation.fragment.InsertCannulaActionFragment
import info.nightscout.androidaps.plugins.pump.omnipod.ui.wizard.activation.fragment.PodActivatedInfoFragment
import info.nightscout.androidaps.plugins.pump.omnipod.ui.wizard.activation.viewmodel.InitializePodActionViewModel
import info.nightscout.androidaps.plugins.pump.omnipod.ui.wizard.activation.viewmodel.InsertCannulaActionViewModel
import info.nightscout.androidaps.plugins.pump.omnipod.ui.wizard.deactivation.fragment.DeactivatePodActionFragment
import info.nightscout.androidaps.plugins.pump.omnipod.ui.wizard.deactivation.fragment.DeactivatePodInfoFragment
import info.nightscout.androidaps.plugins.pump.omnipod.ui.wizard.deactivation.fragment.PodDeactivatedInfoFragment
import info.nightscout.androidaps.plugins.pump.omnipod.ui.wizard.deactivation.fragment.PodDiscardedInfoFragment
import info.nightscout.androidaps.plugins.pump.omnipod.ui.wizard.deactivation.viewmodel.DeactivatePodActionViewModel
import info.nightscout.androidaps.plugins.pump.omnipod.eros.ui.wizard.activation.fragment.AttachPodInfoFragment
import info.nightscout.androidaps.plugins.pump.omnipod.eros.ui.wizard.activation.fragment.FillPodInfoFragment
import info.nightscout.androidaps.plugins.pump.omnipod.eros.ui.wizard.activation.fragment.InitializePodActionFragment
import info.nightscout.androidaps.plugins.pump.omnipod.eros.ui.wizard.activation.fragment.InsertCannulaActionFragment
import info.nightscout.androidaps.plugins.pump.omnipod.eros.ui.wizard.activation.fragment.PodActivatedInfoFragment
import info.nightscout.androidaps.plugins.pump.omnipod.eros.ui.wizard.activation.viewmodel.InitializePodActionViewModel
import info.nightscout.androidaps.plugins.pump.omnipod.eros.ui.wizard.activation.viewmodel.InsertCannulaActionViewModel
import info.nightscout.androidaps.plugins.pump.omnipod.eros.ui.wizard.deactivation.fragment.DeactivatePodActionFragment
import info.nightscout.androidaps.plugins.pump.omnipod.eros.ui.wizard.deactivation.fragment.DeactivatePodInfoFragment
import info.nightscout.androidaps.plugins.pump.omnipod.eros.ui.wizard.deactivation.fragment.PodDeactivatedInfoFragment
import info.nightscout.androidaps.plugins.pump.omnipod.eros.ui.wizard.deactivation.fragment.PodDiscardedInfoFragment
import info.nightscout.androidaps.plugins.pump.omnipod.eros.ui.wizard.deactivation.viewmodel.DeactivatePodActionViewModel
import javax.inject.Provider
@Module

View file

@ -1,4 +1,4 @@
package info.nightscout.androidaps.plugins.pump.omnipod.data;
package info.nightscout.androidaps.plugins.pump.omnipod.eros.data;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONException;

View file

@ -1,4 +1,4 @@
package info.nightscout.androidaps.plugins.pump.omnipod.data;
package info.nightscout.androidaps.plugins.pump.omnipod.eros.data;
import org.joda.time.LocalDateTime;
@ -7,7 +7,7 @@ import javax.inject.Inject;
import dagger.android.HasAndroidInjector;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.data.RLHistoryItem;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkTargetDevice;
import info.nightscout.androidaps.plugins.pump.omnipod.definition.OmnipodCommandType;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.definition.OmnipodCommandType;
import info.nightscout.androidaps.utils.resources.ResourceHelper;
public class RLHistoryItemOmnipod extends RLHistoryItem {

View file

@ -1,6 +1,6 @@
package info.nightscout.androidaps.plugins.pump.omnipod.definition;
package info.nightscout.androidaps.plugins.pump.omnipod.eros.definition;
import info.nightscout.androidaps.plugins.pump.omnipod.R;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.R;
/**
* Created by andy on 4.8.2019

View file

@ -1,6 +1,6 @@
package info.nightscout.androidaps.plugins.pump.omnipod.definition;
package info.nightscout.androidaps.plugins.pump.omnipod.eros.definition;
import info.nightscout.androidaps.plugins.pump.omnipod.R;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.R;
public class OmnipodStorageKeys {
public static class Preferences {

View file

@ -1,4 +1,4 @@
package info.nightscout.androidaps.plugins.pump.omnipod.definition;
package info.nightscout.androidaps.plugins.pump.omnipod.eros.definition;
import androidx.annotation.StringRes;
@ -6,7 +6,7 @@ import java.util.HashMap;
import java.util.Map;
import info.nightscout.androidaps.plugins.pump.common.defs.PumpHistoryEntryGroup;
import info.nightscout.androidaps.plugins.pump.omnipod.R;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.R;
/**
* Created by andy on 24.11.2019

View file

@ -1,13 +1,13 @@
package info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.action;
package info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.communication.action;
import java.util.Collections;
import info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.message.command.AcknowledgeAlertsCommand;
import info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.message.response.StatusResponse;
import info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.AlertSet;
import info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.AlertSlot;
import info.nightscout.androidaps.plugins.pump.omnipod.driver.manager.PodStateManager;
import info.nightscout.androidaps.plugins.pump.omnipod.rileylink.manager.OmnipodRileyLinkCommunicationManager;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.communication.message.command.AcknowledgeAlertsCommand;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.communication.message.response.StatusResponse;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.definition.AlertSet;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.definition.AlertSlot;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.manager.PodStateManager;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.rileylink.manager.OmnipodRileyLinkCommunicationManager;
public class AcknowledgeAlertsAction implements OmnipodAction<StatusResponse> {
private final PodStateManager podStateManager;

View file

@ -1,4 +1,4 @@
package info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.action;
package info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.communication.action;
import org.joda.time.DateTimeZone;
@ -6,16 +6,16 @@ import java.util.Collections;
import java.util.Random;
import info.nightscout.androidaps.logging.AAPSLogger;
import info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.message.OmnipodMessage;
import info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.message.command.AssignAddressCommand;
import info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.message.response.VersionResponse;
import info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.OmnipodConstants;
import info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.PacketType;
import info.nightscout.androidaps.plugins.pump.omnipod.driver.exception.IllegalMessageAddressException;
import info.nightscout.androidaps.plugins.pump.omnipod.driver.exception.IllegalPacketTypeException;
import info.nightscout.androidaps.plugins.pump.omnipod.driver.exception.IllegalVersionResponseTypeException;
import info.nightscout.androidaps.plugins.pump.omnipod.driver.manager.PodStateManager;
import info.nightscout.androidaps.plugins.pump.omnipod.rileylink.manager.OmnipodRileyLinkCommunicationManager;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.communication.message.OmnipodMessage;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.communication.message.command.AssignAddressCommand;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.communication.message.response.VersionResponse;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.definition.OmnipodConstants;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.definition.PacketType;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.exception.IllegalMessageAddressException;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.exception.IllegalPacketTypeException;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.exception.IllegalVersionResponseTypeException;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.manager.PodStateManager;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.rileylink.manager.OmnipodRileyLinkCommunicationManager;
public class AssignAddressAction implements OmnipodAction<Void> {
private final PodStateManager podStateManager;

View file

@ -1,16 +1,16 @@
package info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.action;
package info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.communication.action;
import org.joda.time.Duration;
import java.util.Arrays;
import info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.message.OmnipodMessage;
import info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.message.command.BolusExtraCommand;
import info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.message.command.SetInsulinScheduleCommand;
import info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.message.response.StatusResponse;
import info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.schedule.BolusDeliverySchedule;
import info.nightscout.androidaps.plugins.pump.omnipod.driver.manager.PodStateManager;
import info.nightscout.androidaps.plugins.pump.omnipod.rileylink.manager.OmnipodRileyLinkCommunicationManager;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.communication.message.OmnipodMessage;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.communication.message.command.BolusExtraCommand;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.communication.message.command.SetInsulinScheduleCommand;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.communication.message.response.StatusResponse;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.definition.schedule.BolusDeliverySchedule;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.manager.PodStateManager;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.rileylink.manager.OmnipodRileyLinkCommunicationManager;
public class BolusAction implements OmnipodAction<StatusResponse> {
private final PodStateManager podStateManager;

View file

@ -1,4 +1,4 @@
package info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.action;
package info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.communication.action;
import org.joda.time.Duration;
@ -6,16 +6,16 @@ import java.util.ArrayList;
import java.util.EnumSet;
import java.util.List;
import info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.message.MessageBlock;
import info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.message.OmnipodMessage;
import info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.message.command.BeepConfigCommand;
import info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.message.command.CancelDeliveryCommand;
import info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.message.response.StatusResponse;
import info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.BeepConfigType;
import info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.BeepType;
import info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.DeliveryType;
import info.nightscout.androidaps.plugins.pump.omnipod.driver.manager.PodStateManager;
import info.nightscout.androidaps.plugins.pump.omnipod.rileylink.manager.OmnipodRileyLinkCommunicationManager;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.communication.message.MessageBlock;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.communication.message.OmnipodMessage;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.communication.message.command.BeepConfigCommand;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.communication.message.command.CancelDeliveryCommand;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.communication.message.response.StatusResponse;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.definition.BeepConfigType;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.definition.BeepType;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.definition.DeliveryType;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.manager.PodStateManager;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.rileylink.manager.OmnipodRileyLinkCommunicationManager;
public class CancelDeliveryAction implements OmnipodAction<StatusResponse> {
private final PodStateManager podStateManager;

View file

@ -1,12 +1,12 @@
package info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.action;
package info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.communication.action;
import java.util.List;
import info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.message.command.ConfigureAlertsCommand;
import info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.message.response.StatusResponse;
import info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.AlertConfiguration;
import info.nightscout.androidaps.plugins.pump.omnipod.driver.manager.PodStateManager;
import info.nightscout.androidaps.plugins.pump.omnipod.rileylink.manager.OmnipodRileyLinkCommunicationManager;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.communication.message.command.ConfigureAlertsCommand;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.communication.message.response.StatusResponse;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.definition.AlertConfiguration;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.manager.PodStateManager;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.rileylink.manager.OmnipodRileyLinkCommunicationManager;
public class ConfigureAlertsAction implements OmnipodAction<StatusResponse> {
private final PodStateManager podStateManager;

View file

@ -1,12 +1,12 @@
package info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.action;
package info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.communication.action;
import org.joda.time.Duration;
import info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.message.command.BeepConfigCommand;
import info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.message.response.StatusResponse;
import info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.BeepConfigType;
import info.nightscout.androidaps.plugins.pump.omnipod.driver.manager.PodStateManager;
import info.nightscout.androidaps.plugins.pump.omnipod.rileylink.manager.OmnipodRileyLinkCommunicationManager;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.communication.message.command.BeepConfigCommand;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.communication.message.response.StatusResponse;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.definition.BeepConfigType;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.manager.PodStateManager;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.rileylink.manager.OmnipodRileyLinkCommunicationManager;
public class ConfigureBeepAction implements OmnipodAction<StatusResponse> {
private final PodStateManager podStateManager;

View file

@ -1,13 +1,13 @@
package info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.action;
package info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.communication.action;
import java.util.EnumSet;
import info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.message.command.DeactivatePodCommand;
import info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.message.response.StatusResponse;
import info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.DeliveryType;
import info.nightscout.androidaps.plugins.pump.omnipod.driver.exception.PodFaultException;
import info.nightscout.androidaps.plugins.pump.omnipod.driver.manager.PodStateManager;
import info.nightscout.androidaps.plugins.pump.omnipod.rileylink.manager.OmnipodRileyLinkCommunicationManager;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.communication.message.command.DeactivatePodCommand;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.communication.message.response.StatusResponse;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.definition.DeliveryType;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.exception.PodFaultException;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.manager.PodStateManager;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.rileylink.manager.OmnipodRileyLinkCommunicationManager;
public class DeactivatePodAction implements OmnipodAction<StatusResponse> {
private final PodStateManager podStateManager;

View file

@ -1,10 +1,10 @@
package info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.action;
package info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.communication.action;
import info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.message.command.GetStatusCommand;
import info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.message.response.podinfo.PodInfoResponse;
import info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.PodInfoType;
import info.nightscout.androidaps.plugins.pump.omnipod.driver.manager.PodStateManager;
import info.nightscout.androidaps.plugins.pump.omnipod.rileylink.manager.OmnipodRileyLinkCommunicationManager;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.communication.message.command.GetStatusCommand;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.communication.message.response.podinfo.PodInfoResponse;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.definition.PodInfoType;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.manager.PodStateManager;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.rileylink.manager.OmnipodRileyLinkCommunicationManager;
public class GetPodInfoAction implements OmnipodAction<PodInfoResponse> {
private final PodStateManager podStateManager;

View file

@ -0,0 +1,23 @@
package info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.communication.action;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.communication.message.command.GetStatusCommand;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.communication.message.response.StatusResponse;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.definition.PodInfoType;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.manager.PodStateManager;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.rileylink.manager.OmnipodRileyLinkCommunicationManager;
public class GetStatusAction implements OmnipodAction<StatusResponse> {
private final PodStateManager podStateManager;
public GetStatusAction(PodStateManager podState) {
if (podState == null) {
throw new IllegalArgumentException("Pod state manager cannot be null");
}
this.podStateManager = podState;
}
@Override
public StatusResponse execute(OmnipodRileyLinkCommunicationManager communicationService) {
return communicationService.sendCommand(StatusResponse.class, podStateManager, new GetStatusCommand(PodInfoType.NORMAL));
}
}

View file

@ -1,18 +1,18 @@
package info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.action;
package info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.communication.action;
import org.joda.time.Duration;
import java.util.List;
import java.util.Optional;
import info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.action.service.ExpirationReminderBuilder;
import info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.ActivationProgress;
import info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.AlertConfiguration;
import info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.OmnipodConstants;
import info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.schedule.BasalSchedule;
import info.nightscout.androidaps.plugins.pump.omnipod.driver.exception.IllegalActivationProgressException;
import info.nightscout.androidaps.plugins.pump.omnipod.driver.manager.PodStateManager;
import info.nightscout.androidaps.plugins.pump.omnipod.rileylink.manager.OmnipodRileyLinkCommunicationManager;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.communication.action.service.ExpirationReminderBuilder;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.definition.ActivationProgress;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.definition.AlertConfiguration;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.definition.OmnipodConstants;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.definition.schedule.BasalSchedule;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.exception.IllegalActivationProgressException;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.manager.PodStateManager;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.rileylink.manager.OmnipodRileyLinkCommunicationManager;
public class InsertCannulaAction implements OmnipodAction<Void> {

View file

@ -0,0 +1,7 @@
package info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.communication.action;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.rileylink.manager.OmnipodRileyLinkCommunicationManager;
public interface OmnipodAction<T> {
T execute(OmnipodRileyLinkCommunicationManager communicationService);
}

View file

@ -1,10 +1,10 @@
package info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.action;
package info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.communication.action;
import info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.action.service.PrimeService;
import info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.ActivationProgress;
import info.nightscout.androidaps.plugins.pump.omnipod.driver.exception.IllegalActivationProgressException;
import info.nightscout.androidaps.plugins.pump.omnipod.driver.manager.PodStateManager;
import info.nightscout.androidaps.plugins.pump.omnipod.rileylink.manager.OmnipodRileyLinkCommunicationManager;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.communication.action.service.PrimeService;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.definition.ActivationProgress;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.exception.IllegalActivationProgressException;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.manager.PodStateManager;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.rileylink.manager.OmnipodRileyLinkCommunicationManager;
public class PrimeAction implements OmnipodAction<Void> {

View file

@ -1,16 +1,16 @@
package info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.action;
package info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.communication.action;
import org.joda.time.Duration;
import java.util.Arrays;
import info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.message.OmnipodMessage;
import info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.message.command.BasalScheduleExtraCommand;
import info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.message.command.SetInsulinScheduleCommand;
import info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.message.response.StatusResponse;
import info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.schedule.BasalSchedule;
import info.nightscout.androidaps.plugins.pump.omnipod.driver.manager.PodStateManager;
import info.nightscout.androidaps.plugins.pump.omnipod.rileylink.manager.OmnipodRileyLinkCommunicationManager;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.communication.message.OmnipodMessage;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.communication.message.command.BasalScheduleExtraCommand;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.communication.message.command.SetInsulinScheduleCommand;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.communication.message.response.StatusResponse;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.definition.schedule.BasalSchedule;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.manager.PodStateManager;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.rileylink.manager.OmnipodRileyLinkCommunicationManager;
public class SetBasalScheduleAction implements OmnipodAction<StatusResponse> {
private final PodStateManager podStateManager;

View file

@ -1,17 +1,17 @@
package info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.action;
package info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.communication.action;
import org.joda.time.Duration;
import java.util.Arrays;
import java.util.List;
import info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.message.MessageBlock;
import info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.message.OmnipodMessage;
import info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.message.command.SetInsulinScheduleCommand;
import info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.message.command.TempBasalExtraCommand;
import info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.message.response.StatusResponse;
import info.nightscout.androidaps.plugins.pump.omnipod.driver.manager.PodStateManager;
import info.nightscout.androidaps.plugins.pump.omnipod.rileylink.manager.OmnipodRileyLinkCommunicationManager;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.communication.message.MessageBlock;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.communication.message.OmnipodMessage;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.communication.message.command.SetInsulinScheduleCommand;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.communication.message.command.TempBasalExtraCommand;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.communication.message.response.StatusResponse;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.manager.PodStateManager;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.rileylink.manager.OmnipodRileyLinkCommunicationManager;
public class SetTempBasalAction implements OmnipodAction<StatusResponse> {
private final PodStateManager podStateManager;

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