Rename OmnipodPumpPlugin to OmnipodErosPumpPlugin

This commit is contained in:
Bart Sopers 2021-02-09 21:05:40 +01:00
parent c4ef0dc997
commit 9489cbf9a7
9 changed files with 31 additions and 32 deletions

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.eros.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

@ -26,7 +26,7 @@ import info.nightscout.androidaps.logging.AAPSLogger
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.eros.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
@ -301,7 +301,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

@ -9,7 +9,7 @@ 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.eros.OmnipodPumpPlugin
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
@ -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.eros.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

@ -66,7 +66,6 @@ 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.eros.R;
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;
@ -116,7 +115,7 @@ import static info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.defini
* @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;
@ -159,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,
@ -248,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

@ -18,7 +18,7 @@ import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.defs.Rile
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.defs.RileyLinkTargetFrequency;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkTargetDevice;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.RileyLinkService;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.OmnipodPumpPlugin;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.OmnipodErosPumpPlugin;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.R;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.manager.PodStateManager;
import info.nightscout.androidaps.plugins.pump.omnipod.eros.manager.AapsOmnipodManager;
@ -34,7 +34,7 @@ public class RileyLinkOmnipodService extends RileyLinkService {
private static final String REGEX_MAC = "([\\da-fA-F]{1,2}(?:\\:|$)){6}";
@Inject OmnipodPumpPlugin omnipodPumpPlugin;
@Inject OmnipodErosPumpPlugin omnipodErosPumpPlugin;
@Inject AapsOmnipodUtil aapsOmnipodUtil;
@Inject PodStateManager podStateManager;
@Inject DatabaseHelperInterface databaseHelper;

View file

@ -22,7 +22,7 @@ import info.nightscout.androidaps.plugins.pump.common.events.EventRileyLinkDevic
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkServiceState
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkTargetDevice
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.RileyLinkServiceData
import info.nightscout.androidaps.plugins.pump.omnipod.eros.OmnipodPumpPlugin
import info.nightscout.androidaps.plugins.pump.omnipod.eros.OmnipodErosPumpPlugin
import info.nightscout.androidaps.plugins.pump.omnipod.eros.R
import info.nightscout.androidaps.plugins.pump.omnipod.eros.databinding.OmnipodOverviewBinding
import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.definition.ActivationProgress
@ -70,7 +70,7 @@ class OmnipodOverviewFragment : DaggerFragment() {
@Inject lateinit var rxBus: RxBusWrapper
@Inject lateinit var commandQueue: CommandQueueProvider
@Inject lateinit var activePlugin: ActivePluginProvider
@Inject lateinit var omnipodPumpPlugin: OmnipodPumpPlugin
@Inject lateinit var omnipodErosPumpPlugin: OmnipodErosPumpPlugin
@Inject lateinit var podStateManager: PodStateManager
@Inject lateinit var sp: SP
@Inject lateinit var omnipodUtil: AapsOmnipodUtil
@ -106,7 +106,7 @@ class OmnipodOverviewFragment : DaggerFragment() {
super.onViewCreated(view, savedInstanceState)
binding.buttonPodManagement.setOnClickListener {
if (omnipodPumpPlugin.rileyLinkService?.verifyConfiguration() == true) {
if (omnipodErosPumpPlugin.rileyLinkService?.verifyConfiguration() == true) {
activity?.let { activity ->
context?.let { context ->
protectionCheck.queryProtection(
@ -232,8 +232,8 @@ class OmnipodOverviewFragment : DaggerFragment() {
updatePodStatus()
val errors = ArrayList<String>()
if (omnipodPumpPlugin.rileyLinkService != null) {
val rileyLinkErrorDescription = omnipodPumpPlugin.rileyLinkService.errorDescription
if (omnipodErosPumpPlugin.rileyLinkService != null) {
val rileyLinkErrorDescription = omnipodErosPumpPlugin.rileyLinkService.errorDescription
if (StringUtils.isNotEmpty(rileyLinkErrorDescription)) {
errors.add(rileyLinkErrorDescription)
}
@ -288,7 +288,7 @@ class OmnipodOverviewFragment : DaggerFragment() {
// base basal rate
binding.baseBasalRate.text = if (podStateManager.isPodActivationCompleted) {
resourceHelper.gs(R.string.pump_basebasalrate, omnipodPumpPlugin.model().determineCorrectBasalSize(podStateManager.basalSchedule.rateAt(TimeUtil.toDuration(DateTime.now()))))
resourceHelper.gs(R.string.pump_basebasalrate, omnipodErosPumpPlugin.model().determineCorrectBasalSize(podStateManager.basalSchedule.rateAt(TimeUtil.toDuration(DateTime.now()))))
} else {
PLACEHOLDER
}
@ -336,7 +336,7 @@ class OmnipodOverviewFragment : DaggerFragment() {
if (podStateManager.isPodInitialized && podStateManager.lastSuccessfulCommunication != null) {
binding.lastConnection.text = readableDuration(podStateManager.lastSuccessfulCommunication)
val lastConnectionColor =
if (omnipodPumpPlugin.isUnreachableAlertTimeoutExceeded(getPumpUnreachableTimeout().millis)) {
if (omnipodErosPumpPlugin.isUnreachableAlertTimeoutExceeded(getPumpUnreachableTimeout().millis)) {
Color.RED
} else {
Color.WHITE
@ -397,7 +397,7 @@ class OmnipodOverviewFragment : DaggerFragment() {
private fun updateLastBolus() {
if (podStateManager.isPodActivationCompleted && podStateManager.hasLastBolus()) {
var text = resourceHelper.gs(R.string.omnipod_overview_last_bolus_value, omnipodPumpPlugin.model().determineCorrectBolusSize(podStateManager.lastBolusAmount), resourceHelper.gs(R.string.insulin_unit_shortname), readableDuration(podStateManager.lastBolusStartTime))
var text = resourceHelper.gs(R.string.omnipod_overview_last_bolus_value, omnipodErosPumpPlugin.model().determineCorrectBolusSize(podStateManager.lastBolusAmount), resourceHelper.gs(R.string.insulin_unit_shortname), readableDuration(podStateManager.lastBolusStartTime))
val textColor: Int
if (podStateManager.isLastBolusCertain) {

View file

@ -13,7 +13,7 @@ import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.dialog.RileyL
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.RileyLinkServiceData
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.tasks.ResetRileyLinkConfigurationTask
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.tasks.ServiceTaskExecutor
import info.nightscout.androidaps.plugins.pump.omnipod.eros.OmnipodPumpPlugin
import info.nightscout.androidaps.plugins.pump.omnipod.eros.OmnipodErosPumpPlugin
import info.nightscout.androidaps.plugins.pump.omnipod.eros.R
import info.nightscout.androidaps.plugins.pump.omnipod.eros.databinding.OmnipodPodManagementBinding
import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.definition.ActivationProgress
@ -49,7 +49,7 @@ class PodManagementActivity : NoSplashAppCompatActivity() {
@Inject lateinit var rileyLinkServiceData: RileyLinkServiceData
@Inject lateinit var aapsOmnipodManager: AapsOmnipodManager
@Inject lateinit var context: Context
@Inject lateinit var omnipodPumpPlugin: OmnipodPumpPlugin
@Inject lateinit var omnipodErosPumpPlugin: OmnipodErosPumpPlugin
@Inject lateinit var serviceTaskExecutor: ServiceTaskExecutor
@Inject lateinit var aapsSchedulers: AapsSchedulers
@ -78,7 +78,7 @@ class PodManagementActivity : NoSplashAppCompatActivity() {
}
binding.buttonRileylinkStats.setOnClickListener {
if (omnipodPumpPlugin.rileyLinkService?.verifyConfiguration() == true) {
if (omnipodErosPumpPlugin.rileyLinkService?.verifyConfiguration() == true) {
startActivity(Intent(context, RileyLinkStatusActivity::class.java))
} else {
displayNotConfiguredDialog()

View file

@ -38,7 +38,7 @@ import static org.mockito.Mockito.when;
@RunWith(PowerMockRunner.class)
public class OmnipodPumpPluginTest {
public class OmnipodErosPumpPluginTest {
@Mock HasAndroidInjector injector;
AAPSLogger aapsLogger = new AAPSLoggerTest();
@ -58,7 +58,7 @@ public class OmnipodPumpPluginTest {
// mock all the things
PowerMockito.mockStatic(Looper.class);
OmnipodPumpPlugin plugin = new OmnipodPumpPlugin(injector, aapsLogger, new TestAapsSchedulers(), rxBusWrapper, null,
OmnipodErosPumpPlugin plugin = new OmnipodErosPumpPlugin(injector, aapsLogger, new TestAapsSchedulers(), rxBusWrapper, null,
resourceHelper, activePluginProvider, null, null, aapsOmnipodManager, commandQueueProvider,
null, null, null, null,
rileyLinkUtil, null, null, null, null