diff --git a/app/src/main/java/info/nightscout/androidaps/activities/MyPreferenceFragment.kt b/app/src/main/java/info/nightscout/androidaps/activities/MyPreferenceFragment.kt
index 2541f50bc7..eccc1661d6 100644
--- a/app/src/main/java/info/nightscout/androidaps/activities/MyPreferenceFragment.kt
+++ b/app/src/main/java/info/nightscout/androidaps/activities/MyPreferenceFragment.kt
@@ -24,7 +24,6 @@ import info.nightscout.androidaps.danars.DanaRSPlugin
import info.nightscout.androidaps.diaconn.DiaconnG8Plugin
import info.nightscout.androidaps.plugin.general.openhumans.OpenHumansUploaderPlugin
import info.nightscout.androidaps.plugins.general.maintenance.MaintenancePlugin
-import info.nightscout.androidaps.plugins.pump.combov2.ComboV2Plugin
import info.nightscout.androidaps.plugins.pump.eopatch.EopatchPumpPlugin
import info.nightscout.androidaps.plugins.pump.insight.LocalInsightPlugin
import info.nightscout.androidaps.plugins.pump.medtronic.MedtronicPumpPlugin
@@ -60,6 +59,7 @@ import info.nightscout.plugins.sync.nsclient.data.NSSettingsStatus
import info.nightscout.plugins.sync.nsclientV3.NSClientV3Plugin
import info.nightscout.plugins.sync.tidepool.TidepoolPlugin
import info.nightscout.pump.combo.ComboPlugin
+import info.nightscout.pump.combov2.ComboV2Plugin
import info.nightscout.rx.bus.RxBus
import info.nightscout.rx.events.EventPreferenceChange
import info.nightscout.rx.events.EventRebuildTabs
diff --git a/app/src/main/java/info/nightscout/androidaps/di/AppComponent.kt b/app/src/main/java/info/nightscout/androidaps/di/AppComponent.kt
index 2b803a299f..8da6a46fc8 100644
--- a/app/src/main/java/info/nightscout/androidaps/di/AppComponent.kt
+++ b/app/src/main/java/info/nightscout/androidaps/di/AppComponent.kt
@@ -5,7 +5,6 @@ import dagger.Component
import dagger.android.AndroidInjectionModule
import dagger.android.AndroidInjector
import info.nightscout.androidaps.MainApp
-import info.nightscout.androidaps.combov2.di.ComboV2Module
import info.nightscout.androidaps.dana.di.DanaHistoryModule
import info.nightscout.androidaps.dana.di.DanaModule
import info.nightscout.androidaps.danar.di.DanaRModule
@@ -28,6 +27,7 @@ import info.nightscout.implementation.di.ImplementationModule
import info.nightscout.plugins.aps.di.ApsModule
import info.nightscout.plugins.di.PluginsModule
import info.nightscout.pump.combo.di.ComboModule
+import info.nightscout.pump.combov2.di.ComboV2Module
import info.nightscout.rx.di.RxModule
import info.nightscout.shared.di.SharedModule
import info.nightscout.shared.impl.di.SharedImplModule
diff --git a/app/src/main/java/info/nightscout/androidaps/di/PluginsListModule.kt b/app/src/main/java/info/nightscout/androidaps/di/PluginsListModule.kt
index 660178e8ae..8dd325c3f8 100644
--- a/app/src/main/java/info/nightscout/androidaps/di/PluginsListModule.kt
+++ b/app/src/main/java/info/nightscout/androidaps/di/PluginsListModule.kt
@@ -14,7 +14,6 @@ import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin
import info.nightscout.androidaps.plugins.general.maintenance.MaintenancePlugin
import info.nightscout.androidaps.plugins.general.overview.OverviewPlugin
import info.nightscout.androidaps.plugins.general.persistentNotification.PersistentNotificationPlugin
-import info.nightscout.androidaps.plugins.pump.combov2.ComboV2Plugin
import info.nightscout.androidaps.plugins.pump.eopatch.EopatchPumpPlugin
import info.nightscout.androidaps.plugins.pump.insight.LocalInsightPlugin
import info.nightscout.androidaps.plugins.pump.medtronic.MedtronicPumpPlugin
@@ -63,6 +62,7 @@ import info.nightscout.plugins.sync.nsclient.NSClientPlugin
import info.nightscout.plugins.sync.nsclientV3.NSClientV3Plugin
import info.nightscout.plugins.sync.tidepool.TidepoolPlugin
import info.nightscout.pump.combo.ComboPlugin
+import info.nightscout.pump.combov2.ComboV2Plugin
import info.nightscout.sensitivity.SensitivityAAPSPlugin
import info.nightscout.sensitivity.SensitivityOref1Plugin
import info.nightscout.sensitivity.SensitivityWeightedAveragePlugin
diff --git a/core/core-main/src/main/java/info/nightscout/core/pump/PumpStateExtension.kt b/core/core-main/src/main/java/info/nightscout/core/pump/PumpStateExtension.kt
index 8593995c81..a12532c9de 100644
--- a/core/core-main/src/main/java/info/nightscout/core/pump/PumpStateExtension.kt
+++ b/core/core-main/src/main/java/info/nightscout/core/pump/PumpStateExtension.kt
@@ -1,55 +1,11 @@
package info.nightscout.core.pump
-import info.nightscout.interfaces.profile.Profile
import info.nightscout.interfaces.pump.PumpSync
-import info.nightscout.interfaces.utils.DecimalFormatter
-import info.nightscout.shared.utils.DateUtil
-import info.nightscout.shared.utils.T
import kotlin.math.ceil
import kotlin.math.max
-import kotlin.math.min
-import kotlin.math.roundToInt
val PumpSync.PumpState.TemporaryBasal.plannedRemainingMinutesRoundedUp: Int
get() = max(ceil((end - System.currentTimeMillis()) / 1000.0 / 60).toInt(), 0)
-val PumpSync.PumpState.TemporaryBasal.durationInMinutes: Int
- get() = T.msecs(duration).mins().toInt()
-fun PumpSync.PumpState.TemporaryBasal.getPassedDurationToTimeInMinutes(time: Long): Int =
- ((min(time, end) - timestamp) / 60.0 / 1000).roundToInt()
-
-fun PumpSync.PumpState.TemporaryBasal.convertedToAbsolute(time: Long, profile: Profile): Double =
- if (isAbsolute) rate
- else profile.getBasal(time) * rate / 100
-
-fun PumpSync.PumpState.TemporaryBasal.toStringFull(dateUtil: DateUtil): String {
- return when {
- isAbsolute -> {
- DecimalFormatter.to2Decimal(rate) + "U/h @" +
- dateUtil.timeString(timestamp) +
- " " + getPassedDurationToTimeInMinutes(dateUtil.now()) + "/" + durationInMinutes + "'"
- }
-
- else -> { // percent
- rate.toString() + "% @" +
- dateUtil.timeString(timestamp) +
- " " + getPassedDurationToTimeInMinutes(dateUtil.now()) + "/" + durationInMinutes + "'"
- }
- }
-}
-
-val PumpSync.PumpState.ExtendedBolus.end: Long
- get() = timestamp + duration
-
-val PumpSync.PumpState.ExtendedBolus.plannedRemainingMinutes: Long
- get() = max(T.msecs(end - System.currentTimeMillis()).mins(), 0L)
-
-fun PumpSync.PumpState.ExtendedBolus.getPassedDurationToTimeInMinutes(time: Long): Int =
- ((min(time, end) - timestamp) / 60.0 / 1000).roundToInt()
-
-fun PumpSync.PumpState.ExtendedBolus.toStringFull(dateUtil: DateUtil): String =
- "E " + DecimalFormatter.to2Decimal(rate) + "U/h @" +
- dateUtil.timeString(timestamp) +
- " " + getPassedDurationToTimeInMinutes(dateUtil.now()) + "/" + T.msecs(duration).mins() + "min"
diff --git a/core/core-main/src/main/res/values/strings.xml b/core/core-main/src/main/res/values/strings.xml
index a740529e53..b248088562 100644
--- a/core/core-main/src/main/res/values/strings.xml
+++ b/core/core-main/src/main/res/values/strings.xml
@@ -6,8 +6,6 @@
Tempbasal delivery error
Going to deliver %1$.2f U
Waiting for pump
- Connecting
- Disconnected
AAPS started
%1$+.2f U
%1$d g
@@ -446,7 +444,6 @@
Unconfirmed command
Requested by user
Bolus OK
- Pump paired
Insight Refresh Button
%1$.0f%%
Basal
diff --git a/core/ui/src/main/java/info/nightscout/core/ui/activities/PluginNoSplashAppCompatActivity.kt b/core/ui/src/main/java/info/nightscout/core/ui/activities/PluginNoSplashAppCompatActivity.kt
new file mode 100644
index 0000000000..9c45162707
--- /dev/null
+++ b/core/ui/src/main/java/info/nightscout/core/ui/activities/PluginNoSplashAppCompatActivity.kt
@@ -0,0 +1,12 @@
+package info.nightscout.core.ui.activities
+
+import android.os.Bundle
+import dagger.android.support.DaggerAppCompatActivity
+import info.nightscout.core.ui.R
+
+open class PluginNoSplashAppCompatActivity : DaggerAppCompatActivity() {
+ public override fun onCreate(savedInstanceState: Bundle?) {
+ super.onCreate(savedInstanceState)
+ setTheme(R.style.AppTheme_NoActionBar)
+ }
+}
\ No newline at end of file
diff --git a/core/ui/src/main/java/info/nightscout/core/ui/elements/BluetoothDevicePreference.kt b/core/ui/src/main/java/info/nightscout/core/ui/elements/BluetoothDevicePreference.kt
index 01e09ed6a7..aa21175169 100644
--- a/core/ui/src/main/java/info/nightscout/core/ui/elements/BluetoothDevicePreference.kt
+++ b/core/ui/src/main/java/info/nightscout/core/ui/elements/BluetoothDevicePreference.kt
@@ -26,7 +26,7 @@ class BluetoothDevicePreference @JvmOverloads constructor(context: Context, attr
} else {
entries = emptyArray()
entryValues = emptyArray()
- ToastUtils.errorToast(context, context.getString(R.string.needconnectpermission))
+ ToastUtils.errorToast(context, context.getString(R.string.need_connect_permission))
}
}
}
\ No newline at end of file
diff --git a/core/ui/src/main/res/values/strings.xml b/core/ui/src/main/res/values/strings.xml
index f8183252f9..5e5177ca9f 100644
--- a/core/ui/src/main/res/values/strings.xml
+++ b/core/ui/src/main/res/values/strings.xml
@@ -28,6 +28,8 @@
Temp basal
Extended bolus
Serial number
+ Disconnected
+ Connecting
language
@@ -55,9 +57,10 @@
Event time
- Application needs bluetooth permission
+ Application needs bluetooth permission
User request
+ Pump paired
\ No newline at end of file
diff --git a/implementation/src/main/java/info/nightscout/implementation/AndroidPermissionImpl.kt b/implementation/src/main/java/info/nightscout/implementation/AndroidPermissionImpl.kt
index 8e986ae665..490c7e99cc 100644
--- a/implementation/src/main/java/info/nightscout/implementation/AndroidPermissionImpl.kt
+++ b/implementation/src/main/java/info/nightscout/implementation/AndroidPermissionImpl.kt
@@ -111,7 +111,7 @@ class AndroidPermissionImpl @Inject constructor(
if (permissionNotGranted(activity, Manifest.permission.BLUETOOTH_CONNECT) || permissionNotGranted(activity, Manifest.permission.BLUETOOTH_SCAN))
activePlugin.activeOverview.addNotification(
id = Notification.PERMISSION_BT,
- text = rh.gs(R.string.needconnectpermission),
+ text = rh.gs(R.string.need_connect_permission),
level = Notification.URGENT,
actionButtonId = R.string.request
) { askForPermission(activity, arrayOf(Manifest.permission.BLUETOOTH_SCAN, Manifest.permission.BLUETOOTH_CONNECT)) }
diff --git a/insight/src/main/java/info/nightscout/androidaps/plugins/pump/insight/LocalInsightPlugin.java b/insight/src/main/java/info/nightscout/androidaps/plugins/pump/insight/LocalInsightPlugin.java
index 6d0265a90e..942a30f996 100644
--- a/insight/src/main/java/info/nightscout/androidaps/plugins/pump/insight/LocalInsightPlugin.java
+++ b/insight/src/main/java/info/nightscout/androidaps/plugins/pump/insight/LocalInsightPlugin.java
@@ -1,8 +1,5 @@
package info.nightscout.androidaps.plugins.pump.insight;
-import static info.nightscout.core.pump.PumpStateExtensionKt.convertedToAbsolute;
-import static info.nightscout.core.pump.PumpStateExtensionKt.getPlannedRemainingMinutes;
-
import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.content.ComponentName;
@@ -966,7 +963,7 @@ public class LocalInsightPlugin extends PumpPluginBase implements Pump, Insight,
}
PumpSync.PumpState.TemporaryBasal tb = pumpSync.expectedPumpState().getTemporaryBasal();
if (tb != null) {
- extended.put("TempBasalAbsoluteRate", convertedToAbsolute(tb, now, profile));
+ extended.put("TempBasalAbsoluteRate", tb.convertedToAbsolute(now, profile));
extended.put("TempBasalStart", dateUtil.dateAndTimeString(tb.getTimestamp()));
extended.put("TempBasalRemaining", tb.getPlannedRemainingMinutes());
}
@@ -974,7 +971,7 @@ public class LocalInsightPlugin extends PumpPluginBase implements Pump, Insight,
if (eb != null) {
extended.put("ExtendedBolusAbsoluteRate", eb.getRate());
extended.put("ExtendedBolusStart", dateUtil.dateAndTimeString(eb.getTimestamp()));
- extended.put("ExtendedBolusRemaining", getPlannedRemainingMinutes(eb));
+ extended.put("ExtendedBolusRemaining", eb.getPlannedRemainingMinutes());
}
extended.put("BaseBasalRate", getBaseBasalRate());
status.put("timestamp", dateUtil.toISOString(now));
diff --git a/interfaces/src/main/java/info/nightscout/interfaces/pump/PumpSync.kt b/interfaces/src/main/java/info/nightscout/interfaces/pump/PumpSync.kt
index 7a3e85c901..89d378b927 100644
--- a/interfaces/src/main/java/info/nightscout/interfaces/pump/PumpSync.kt
+++ b/interfaces/src/main/java/info/nightscout/interfaces/pump/PumpSync.kt
@@ -3,8 +3,12 @@ package info.nightscout.interfaces.pump
import info.nightscout.database.entities.TemporaryBasal
import info.nightscout.interfaces.profile.Profile
import info.nightscout.interfaces.pump.defs.PumpType
+import info.nightscout.interfaces.utils.DecimalFormatter
+import info.nightscout.shared.utils.DateUtil
import info.nightscout.shared.utils.T
import kotlin.math.max
+import kotlin.math.min
+import kotlin.math.roundToInt
/**
* This interface allows pump drivers to push data changes (creation and update of treatments, temporary basals and extended boluses) back to AAPS-core.
@@ -83,6 +87,32 @@ interface PumpSync {
val end: Long get() = timestamp + duration
val plannedRemainingMinutes: Long get() = max(T.msecs(end - System.currentTimeMillis()).mins(), 0L)
+ fun convertedToAbsolute(time: Long, profile: Profile): Double =
+ if (isAbsolute) rate
+ else profile.getBasal(time) * rate / 100
+
+ fun toStringFull(dateUtil: DateUtil): String {
+ return when {
+ isAbsolute -> {
+ DecimalFormatter.to2Decimal(rate) + "U/h @" +
+ dateUtil.timeString(timestamp) +
+ " " + getPassedDurationToTimeInMinutes(dateUtil.now()) + "/" + durationInMinutes + "'"
+ }
+
+ else -> { // percent
+ rate.toString() + "% @" +
+ dateUtil.timeString(timestamp) +
+ " " + getPassedDurationToTimeInMinutes(dateUtil.now()) + "/" + durationInMinutes + "'"
+ }
+ }
+ }
+
+ val durationInMinutes: Int
+ get() = T.msecs(duration).mins().toInt()
+
+ private fun getPassedDurationToTimeInMinutes(time: Long): Int =
+ ((min(time, end) - timestamp) / 60.0 / 1000).roundToInt()
+
}
data class ExtendedBolus @JvmOverloads constructor(
@@ -93,7 +123,20 @@ interface PumpSync {
// used only to cancel EB on pump change
val pumpType: PumpType = PumpType.USER,
val pumpSerial: String = ""
- )
+ ) {
+
+ val end: Long
+ get() = timestamp + duration
+
+ val plannedRemainingMinutes: Long
+ get() = max(T.msecs(end - System.currentTimeMillis()).mins(), 0L)
+ private fun getPassedDurationToTimeInMinutes(time: Long): Int =
+ ((min(time, end) - timestamp) / 60.0 / 1000).roundToInt()
+ fun toStringFull(dateUtil: DateUtil): String =
+ "E " + DecimalFormatter.to2Decimal(rate) + "U/h @" +
+ dateUtil.timeString(timestamp) +
+ " " + getPassedDurationToTimeInMinutes(dateUtil.now()) + "/" + T.msecs(duration).mins() + "min"
+ }
data class Bolus(val timestamp: Long, val amount: Double)
}
diff --git a/plugins/automation/src/main/java/info/nightscout/automation/triggers/TriggerBTDevice.kt b/plugins/automation/src/main/java/info/nightscout/automation/triggers/TriggerBTDevice.kt
index 13a851d10a..37338a80e9 100644
--- a/plugins/automation/src/main/java/info/nightscout/automation/triggers/TriggerBTDevice.kt
+++ b/plugins/automation/src/main/java/info/nightscout/automation/triggers/TriggerBTDevice.kt
@@ -81,7 +81,7 @@ class TriggerBTDevice(injector: HasAndroidInjector) : Trigger(injector) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.S || ActivityCompat.checkSelfPermission(context, Manifest.permission.BLUETOOTH_CONNECT) == PackageManager.PERMISSION_GRANTED) {
(context.getSystemService(Context.BLUETOOTH_SERVICE) as BluetoothManager?)?.adapter?.bondedDevices?.forEach { s.add(it.name) }
} else {
- ToastUtils.errorToast(context, context.getString(R.string.needconnectpermission))
+ ToastUtils.errorToast(context, context.getString(R.string.need_connect_permission))
}
return s
}
diff --git a/pump/combov2/build.gradle b/pump/combov2/build.gradle
index 09f30b9198..696a6fcf44 100644
--- a/pump/combov2/build.gradle
+++ b/pump/combov2/build.gradle
@@ -4,14 +4,13 @@ apply plugin: 'kotlin-kapt'
apply plugin: 'kotlin-allopen'
apply plugin: 'com.hiya.jacoco-android'
-apply from: "${project.rootDir}/core/core-main//android_dependencies.gradle"
-apply from: "${project.rootDir}/core/core-main//android_module_dependencies.gradle"
-apply from: "${project.rootDir}/core/core-main//test_dependencies.gradle"
-apply from: "${project.rootDir}/core/core-main//jacoco_global.gradle"
+apply from: "${project.rootDir}/core/core-main/android_dependencies.gradle"
+apply from: "${project.rootDir}/core/core-main/android_module_dependencies.gradle"
+apply from: "${project.rootDir}/core/core-main/test_dependencies.gradle"
+apply from: "${project.rootDir}/core/core-main/jacoco_global.gradle"
dependencies {
implementation project(':libraries')
- implementation project(':core:core-main')
implementation project(':core:ui')
implementation project(':core:utils')
implementation project(':app-wear-shared:rx')
@@ -37,7 +36,7 @@ dependencies {
}
android {
- namespace 'info.nightscout.androidaps.combov2'
+ namespace 'info.nightscout.pump.combov2'
buildFeatures {
dataBinding true
}
diff --git a/pump/combov2/src/main/AndroidManifest.xml b/pump/combov2/src/main/AndroidManifest.xml
index 3e1c4bb4b6..4a8b96bcba 100644
--- a/pump/combov2/src/main/AndroidManifest.xml
+++ b/pump/combov2/src/main/AndroidManifest.xml
@@ -7,7 +7,7 @@
diff --git a/pump/combov2/src/main/kotlin/info/nightscout/androidaps/plugins/pump/combov2/AAPSComboCtlLogger.kt b/pump/combov2/src/main/kotlin/info/nightscout/pump/combov2/AAPSComboCtlLogger.kt
similarity index 97%
rename from pump/combov2/src/main/kotlin/info/nightscout/androidaps/plugins/pump/combov2/AAPSComboCtlLogger.kt
rename to pump/combov2/src/main/kotlin/info/nightscout/pump/combov2/AAPSComboCtlLogger.kt
index 49750cc3fb..defb8bb653 100644
--- a/pump/combov2/src/main/kotlin/info/nightscout/androidaps/plugins/pump/combov2/AAPSComboCtlLogger.kt
+++ b/pump/combov2/src/main/kotlin/info/nightscout/pump/combov2/AAPSComboCtlLogger.kt
@@ -1,10 +1,10 @@
-package info.nightscout.androidaps.plugins.pump.combov2
+package info.nightscout.pump.combov2
import android.util.Log
import info.nightscout.comboctl.base.LogLevel
-import info.nightscout.comboctl.base.LoggerBackend as ComboCtlLoggerBackend
import info.nightscout.rx.logging.AAPSLogger
import info.nightscout.rx.logging.LTag
+import info.nightscout.comboctl.base.LoggerBackend as ComboCtlLoggerBackend
internal class AAPSComboCtlLogger(private val aapsLogger: AAPSLogger) : ComboCtlLoggerBackend {
override fun log(tag: String, level: LogLevel, throwable: Throwable?, message: String?) {
diff --git a/pump/combov2/src/main/kotlin/info/nightscout/androidaps/plugins/pump/combov2/ComboV2Fragment.kt b/pump/combov2/src/main/kotlin/info/nightscout/pump/combov2/ComboV2Fragment.kt
similarity index 95%
rename from pump/combov2/src/main/kotlin/info/nightscout/androidaps/plugins/pump/combov2/ComboV2Fragment.kt
rename to pump/combov2/src/main/kotlin/info/nightscout/pump/combov2/ComboV2Fragment.kt
index b9afec68ab..944ab50b84 100644
--- a/pump/combov2/src/main/kotlin/info/nightscout/androidaps/plugins/pump/combov2/ComboV2Fragment.kt
+++ b/pump/combov2/src/main/kotlin/info/nightscout/pump/combov2/ComboV2Fragment.kt
@@ -1,4 +1,4 @@
-package info.nightscout.androidaps.plugins.pump.combov2
+package info.nightscout.pump.combov2
import android.graphics.Color
import android.os.Bundle
@@ -10,12 +10,11 @@ import androidx.lifecycle.Lifecycle
import androidx.lifecycle.lifecycleScope
import androidx.lifecycle.repeatOnLifecycle
import dagger.android.support.DaggerFragment
-import info.nightscout.androidaps.combov2.R
-import info.nightscout.androidaps.combov2.databinding.Combov2FragmentBinding
import info.nightscout.comboctl.base.NullDisplayFrame
import info.nightscout.comboctl.parser.BatteryState
import info.nightscout.comboctl.parser.ReservoirState
import info.nightscout.interfaces.queue.CommandQueue
+import info.nightscout.pump.combov2.databinding.Combov2FragmentBinding
import info.nightscout.shared.interfaces.ResourceHelper
import kotlinx.coroutines.delay
import kotlinx.coroutines.flow.launchIn
@@ -62,13 +61,13 @@ class ComboV2Fragment : DaggerFragment() {
combov2Plugin.driverStateUIFlow
.onEach { connectionState ->
val text = when (connectionState) {
- ComboV2Plugin.DriverState.NotInitialized -> rh.gs(R.string.combov2_not_initialized)
- ComboV2Plugin.DriverState.Disconnected -> rh.gs(R.string.disconnected)
- ComboV2Plugin.DriverState.Connecting -> rh.gs(R.string.connecting)
- ComboV2Plugin.DriverState.CheckingPump -> rh.gs(R.string.combov2_checking_pump)
- ComboV2Plugin.DriverState.Ready -> rh.gs(R.string.combov2_ready)
- ComboV2Plugin.DriverState.Suspended -> rh.gs(R.string.combov2_suspended)
- ComboV2Plugin.DriverState.Error -> rh.gs(R.string.error)
+ ComboV2Plugin.DriverState.NotInitialized -> rh.gs(R.string.combov2_not_initialized)
+ ComboV2Plugin.DriverState.Disconnected -> rh.gs(R.string.disconnected)
+ ComboV2Plugin.DriverState.Connecting -> rh.gs(R.string.connecting)
+ ComboV2Plugin.DriverState.CheckingPump -> rh.gs(R.string.combov2_checking_pump)
+ ComboV2Plugin.DriverState.Ready -> rh.gs(R.string.combov2_ready)
+ ComboV2Plugin.DriverState.Suspended -> rh.gs(R.string.combov2_suspended)
+ ComboV2Plugin.DriverState.Error -> rh.gs(R.string.error)
is ComboV2Plugin.DriverState.ExecutingCommand ->
when (val desc = connectionState.description) {
is ComboCtlPump.GettingBasalProfileCommandDesc ->
@@ -101,9 +100,9 @@ class ComboV2Fragment : DaggerFragment() {
binding.combov2DriverState.setTextColor(
when (connectionState) {
- ComboV2Plugin.DriverState.Error -> Color.RED
+ ComboV2Plugin.DriverState.Error -> Color.RED
ComboV2Plugin.DriverState.Suspended -> Color.YELLOW
- else -> Color.WHITE
+ else -> Color.WHITE
}
)
}
diff --git a/pump/combov2/src/main/kotlin/info/nightscout/androidaps/plugins/pump/combov2/ComboV2Plugin.kt b/pump/combov2/src/main/kotlin/info/nightscout/pump/combov2/ComboV2Plugin.kt
similarity index 98%
rename from pump/combov2/src/main/kotlin/info/nightscout/androidaps/plugins/pump/combov2/ComboV2Plugin.kt
rename to pump/combov2/src/main/kotlin/info/nightscout/pump/combov2/ComboV2Plugin.kt
index 2ddb5d0109..3088312651 100644
--- a/pump/combov2/src/main/kotlin/info/nightscout/androidaps/plugins/pump/combov2/ComboV2Plugin.kt
+++ b/pump/combov2/src/main/kotlin/info/nightscout/pump/combov2/ComboV2Plugin.kt
@@ -1,4 +1,4 @@
-package info.nightscout.androidaps.plugins.pump.combov2
+package info.nightscout.pump.combov2
import android.content.Context
import android.content.Intent
@@ -9,7 +9,6 @@ import androidx.preference.Preference
import androidx.preference.PreferenceFragmentCompat
import androidx.preference.SwitchPreference
import dagger.android.HasAndroidInjector
-import info.nightscout.androidaps.combov2.R
import info.nightscout.comboctl.android.AndroidBluetoothInterface
import info.nightscout.comboctl.base.BasicProgressStage
import info.nightscout.comboctl.base.BluetoothException
@@ -24,9 +23,6 @@ import info.nightscout.comboctl.parser.AlertScreenContent
import info.nightscout.comboctl.parser.AlertScreenException
import info.nightscout.comboctl.parser.BatteryState
import info.nightscout.comboctl.parser.ReservoirState
-import info.nightscout.core.events.EventNewNotification
-import info.nightscout.core.pump.convertedToAbsolute
-import info.nightscout.core.pump.toStringFull
import info.nightscout.core.ui.dialogs.OKDialog
import info.nightscout.core.ui.toast.ToastUtils
import info.nightscout.interfaces.constraints.Constraint
@@ -45,6 +41,7 @@ import info.nightscout.interfaces.pump.defs.ManufacturerType
import info.nightscout.interfaces.pump.defs.PumpDescription
import info.nightscout.interfaces.pump.defs.PumpType
import info.nightscout.interfaces.queue.CommandQueue
+import info.nightscout.interfaces.ui.ActivityNames
import info.nightscout.interfaces.utils.DecimalFormatter
import info.nightscout.interfaces.utils.TimeChangeType
import info.nightscout.rx.bus.RxBus
@@ -109,7 +106,8 @@ class ComboV2Plugin @Inject constructor (
private val profileFunction: ProfileFunction,
private val sp: SP,
private val pumpSync: PumpSync,
- private val dateUtil: DateUtil
+ private val dateUtil: DateUtil,
+ private val activityNames: ActivityNames
) :
PumpPluginBase(
PluginDescription()
@@ -337,7 +335,7 @@ class ComboV2Plugin @Inject constructor (
DriverState.Connecting,
DriverState.CheckingPump,
is DriverState.ExecutingCommand -> true
- else -> false
+ else -> false
}
override fun isConnected(): Boolean =
@@ -351,7 +349,7 @@ class ComboV2Plugin @Inject constructor (
DriverState.Ready,
DriverState.Suspended,
is DriverState.ExecutingCommand -> true
- else -> false
+ else -> false
}
override fun isConnecting(): Boolean =
@@ -515,12 +513,11 @@ class ComboV2Plugin @Inject constructor (
val activeBasalProfileNumber = it.statusFlow.value?.activeBasalProfileNumber
aapsLogger.debug(LTag.PUMP, "Active basal profile number: $activeBasalProfileNumber")
if ((activeBasalProfileNumber != null) && (activeBasalProfileNumber != 1)) {
- val notification = Notification(
+ activityNames.addNotification(
Notification.COMBO_PUMP_ALARM,
text = rh.gs(R.string.combov2_incorrect_active_basal_profile, activeBasalProfileNumber),
level = Notification.URGENT
)
- rxBus.send(EventNewNotification(notification))
}
lastActiveBasalProfileNumber = activeBasalProfileNumber
}
@@ -550,12 +547,11 @@ class ComboV2Plugin @Inject constructor (
notifyAboutComboAlert(e.alertScreenContent)
forciblyDisconnectDueToError = true
} catch (e: Exception) {
- val notification = Notification(
+ activityNames.addNotification(
Notification.COMBO_PUMP_ALARM,
text = rh.gs(R.string.combov2_connection_error, e.message),
level = Notification.URGENT
)
- rxBus.send(EventNewNotification(notification))
aapsLogger.error(LTag.PUMP, "Exception while connecting: ${e.stackTraceToString()}")
@@ -635,12 +631,11 @@ class ComboV2Plugin @Inject constructor (
if (!isInitialized()) {
aapsLogger.error(LTag.PUMP, "Cannot set profile since driver is not initialized")
- val notification = Notification(
+ activityNames.addNotification(
Notification.PROFILE_NOT_SET_NOT_INITIALIZED,
rh.gs(R.string.pump_not_initialized_profile_not_set),
Notification.URGENT
)
- rxBus.send(EventNewNotification(notification))
return PumpEnactResult(injector).apply {
success = false
@@ -665,13 +660,12 @@ class ComboV2Plugin @Inject constructor (
activeBasalProfile = requestedBasalProfile
updateBaseBasalRateUI()
- val notification = Notification(
+ activityNames.addNotificationValidFor(
Notification.PROFILE_SET_OK,
rh.gs(R.string.profile_set_ok),
Notification.INFO,
60
)
- rxBus.send(EventNewNotification(notification))
pumpEnactResult.apply {
success = true
@@ -696,12 +690,11 @@ class ComboV2Plugin @Inject constructor (
} catch (e: Exception) {
aapsLogger.error("Exception thrown during basal profile update: $e")
- val notification = Notification(
+ activityNames.addNotification(
Notification.FAILED_UPDATE_PROFILE,
rh.gs(R.string.failed_update_basal_profile),
Notification.URGENT
)
- rxBus.send(EventNewNotification(notification))
pumpEnactResult.apply {
success = false
@@ -1651,21 +1644,19 @@ class ComboV2Plugin @Inject constructor (
when (event) {
is ComboCtlPump.Event.BatteryLow -> {
- val notification = Notification(
+ activityNames.addNotification(
Notification.COMBO_PUMP_ALARM,
text = rh.gs(R.string.combov2_battery_low_warning),
level = Notification.NORMAL
)
- rxBus.send(EventNewNotification(notification))
}
is ComboCtlPump.Event.ReservoirLow -> {
- val notification = Notification(
+ activityNames.addNotification(
Notification.COMBO_PUMP_ALARM,
text = rh.gs(R.string.combov2_reservoir_low_warning),
level = Notification.NORMAL
)
- rxBus.send(EventNewNotification(notification))
}
is ComboCtlPump.Event.QuickBolusInfused -> {
@@ -1756,7 +1747,7 @@ class ComboV2Plugin @Inject constructor (
event.remainingTbrDurationInMinutes / 60,
event.remainingTbrDurationInMinutes % 60
)
- val notification = Notification(
+ activityNames.addNotification(
Notification.COMBO_UNKNOWN_TBR,
text = rh.gs(
R.string.combov2_unknown_tbr_detected,
@@ -1765,7 +1756,6 @@ class ComboV2Plugin @Inject constructor (
),
level = Notification.URGENT
)
- rxBus.send(EventNewNotification(notification))
}
else -> Unit
@@ -1900,7 +1890,7 @@ class ComboV2Plugin @Inject constructor (
else -> true
}
}
- else -> true
+ else -> true
}
if (updateUIState) {
_driverStateUIFlow.value = newState
@@ -1909,12 +1899,11 @@ class ComboV2Plugin @Inject constructor (
// that the Combo is currently suspended, otherwise this
// only shows up in the Combo fragment.
if (newState == DriverState.Suspended) {
- val notification = Notification(
+ activityNames.addNotification(
Notification.COMBO_PUMP_SUSPENDED,
text = rh.gs(R.string.combov2_pump_is_suspended),
level = Notification.NORMAL
)
- rxBus.send(EventNewNotification(notification))
}
}
@@ -1928,10 +1917,10 @@ class ComboV2Plugin @Inject constructor (
// TODO: Is it OK to send CONNECTED twice? It can happen when changing from Ready to Suspended.
when (newState) {
DriverState.Disconnected -> rxBus.send(EventPumpStatusChanged(EventPumpStatusChanged.Status.DISCONNECTED))
- DriverState.Connecting -> rxBus.send(EventPumpStatusChanged(EventPumpStatusChanged.Status.CONNECTING))
+ DriverState.Connecting -> rxBus.send(EventPumpStatusChanged(EventPumpStatusChanged.Status.CONNECTING))
DriverState.Ready,
- DriverState.Suspended -> rxBus.send(EventPumpStatusChanged(EventPumpStatusChanged.Status.CONNECTED))
- else -> Unit
+ DriverState.Suspended -> rxBus.send(EventPumpStatusChanged(EventPumpStatusChanged.Status.CONNECTED))
+ else -> Unit
}
}
@@ -1945,14 +1934,13 @@ class ComboV2Plugin @Inject constructor (
private fun unpairDueToPumpDataError() {
disconnectInternal(forceDisconnect = true)
- val notification = Notification(
+ activityNames.addNotificationValidTo(
id = Notification.PUMP_ERROR,
date = dateUtil.now(),
text = rh.gs(R.string.combov2_cannot_access_pump_data),
level = Notification.URGENT,
validTo = 0
)
- rxBus.send(EventNewNotification(notification))
unpair()
}
@@ -2032,12 +2020,11 @@ class ComboV2Plugin @Inject constructor (
}
private fun notifyAboutComboAlert(alert: AlertScreenContent) {
- val notification = Notification(
+ activityNames.addNotification(
Notification.COMBO_PUMP_ALARM,
text = "${rh.gs(R.string.combov2_combo_alert)}: ${getAlertDescription(alert)}",
level = if (alert is AlertScreenContent.Warning) Notification.NORMAL else Notification.URGENT
)
- rxBus.send(EventNewNotification(notification))
}
private fun reportFinishedBolus(status: String, pumpEnactResult: PumpEnactResult, succeeded: Boolean) {
diff --git a/pump/combov2/src/main/kotlin/info/nightscout/androidaps/plugins/pump/combov2/ComboV2RTDisplayFrameView.kt b/pump/combov2/src/main/kotlin/info/nightscout/pump/combov2/ComboV2RTDisplayFrameView.kt
similarity index 98%
rename from pump/combov2/src/main/kotlin/info/nightscout/androidaps/plugins/pump/combov2/ComboV2RTDisplayFrameView.kt
rename to pump/combov2/src/main/kotlin/info/nightscout/pump/combov2/ComboV2RTDisplayFrameView.kt
index 51c0c9fee3..90fef6ccca 100644
--- a/pump/combov2/src/main/kotlin/info/nightscout/androidaps/plugins/pump/combov2/ComboV2RTDisplayFrameView.kt
+++ b/pump/combov2/src/main/kotlin/info/nightscout/pump/combov2/ComboV2RTDisplayFrameView.kt
@@ -1,4 +1,4 @@
-package info.nightscout.androidaps.plugins.pump.combov2
+package info.nightscout.pump.combov2
import android.content.Context
import android.graphics.Bitmap
diff --git a/pump/combov2/src/main/kotlin/info/nightscout/androidaps/plugins/pump/combov2/SPPumpStateStore.kt b/pump/combov2/src/main/kotlin/info/nightscout/pump/combov2/SPPumpStateStore.kt
similarity index 99%
rename from pump/combov2/src/main/kotlin/info/nightscout/androidaps/plugins/pump/combov2/SPPumpStateStore.kt
rename to pump/combov2/src/main/kotlin/info/nightscout/pump/combov2/SPPumpStateStore.kt
index 95d9850766..0bc026e5af 100644
--- a/pump/combov2/src/main/kotlin/info/nightscout/androidaps/plugins/pump/combov2/SPPumpStateStore.kt
+++ b/pump/combov2/src/main/kotlin/info/nightscout/pump/combov2/SPPumpStateStore.kt
@@ -1,4 +1,4 @@
-package info.nightscout.androidaps.plugins.pump.combov2
+package info.nightscout.pump.combov2
import info.nightscout.comboctl.base.BluetoothAddress
import info.nightscout.comboctl.base.CurrentTbrState
diff --git a/pump/combov2/src/main/kotlin/info/nightscout/androidaps/plugins/pump/combov2/Utility.kt b/pump/combov2/src/main/kotlin/info/nightscout/pump/combov2/Utility.kt
similarity index 95%
rename from pump/combov2/src/main/kotlin/info/nightscout/androidaps/plugins/pump/combov2/Utility.kt
rename to pump/combov2/src/main/kotlin/info/nightscout/pump/combov2/Utility.kt
index f97b87da22..971d88e900 100644
--- a/pump/combov2/src/main/kotlin/info/nightscout/androidaps/plugins/pump/combov2/Utility.kt
+++ b/pump/combov2/src/main/kotlin/info/nightscout/pump/combov2/Utility.kt
@@ -1,4 +1,4 @@
-package info.nightscout.androidaps.plugins.pump.combov2
+package info.nightscout.pump.combov2
import info.nightscout.comboctl.main.BasalProfile
import info.nightscout.comboctl.main.NUM_COMBO_BASAL_PROFILE_FACTORS
diff --git a/pump/combov2/src/main/kotlin/info/nightscout/androidaps/plugins/pump/combov2/activities/ComboV2PairingActivity.kt b/pump/combov2/src/main/kotlin/info/nightscout/pump/combov2/activities/ComboV2PairingActivity.kt
similarity index 95%
rename from pump/combov2/src/main/kotlin/info/nightscout/androidaps/plugins/pump/combov2/activities/ComboV2PairingActivity.kt
rename to pump/combov2/src/main/kotlin/info/nightscout/pump/combov2/activities/ComboV2PairingActivity.kt
index b221cbfdea..25e2d07d59 100644
--- a/pump/combov2/src/main/kotlin/info/nightscout/androidaps/plugins/pump/combov2/activities/ComboV2PairingActivity.kt
+++ b/pump/combov2/src/main/kotlin/info/nightscout/pump/combov2/activities/ComboV2PairingActivity.kt
@@ -1,4 +1,4 @@
-package info.nightscout.androidaps.plugins.pump.combov2.activities
+package info.nightscout.pump.combov2.activities
import android.app.Activity
import android.os.Bundle
@@ -10,21 +10,25 @@ import androidx.databinding.DataBindingUtil
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.lifecycleScope
import androidx.lifecycle.repeatOnLifecycle
-import info.nightscout.androidaps.combov2.R
-import info.nightscout.androidaps.combov2.databinding.Combov2PairingActivityBinding
-import info.nightscout.androidaps.plugins.pump.combov2.ComboV2Plugin
import info.nightscout.comboctl.base.BasicProgressStage
import info.nightscout.comboctl.base.PairingPIN
-import info.nightscout.core.activities.NoSplashAppCompatActivity
+import info.nightscout.core.ui.activities.PluginNoSplashAppCompatActivity
import info.nightscout.core.ui.dialogs.OKDialog
+import info.nightscout.pump.combov2.ComboV2Plugin
+import info.nightscout.pump.combov2.R
+import info.nightscout.pump.combov2.databinding.Combov2PairingActivityBinding
+import info.nightscout.rx.logging.AAPSLogger
import info.nightscout.rx.logging.LTag
+import info.nightscout.shared.interfaces.ResourceHelper
import kotlinx.coroutines.flow.launchIn
import kotlinx.coroutines.flow.onEach
import kotlinx.coroutines.launch
import kotlinx.coroutines.runBlocking
import javax.inject.Inject
-class ComboV2PairingActivity : NoSplashAppCompatActivity() {
+class ComboV2PairingActivity : PluginNoSplashAppCompatActivity() {
+ @Inject lateinit var aapsLogger: AAPSLogger
+ @Inject lateinit var rh: ResourceHelper
@Inject lateinit var combov2Plugin: ComboV2Plugin
override fun onCreate(savedInstanceState: Bundle?) {
diff --git a/pump/combov2/src/main/kotlin/info/nightscout/androidaps/combov2/di/ComboV2ActivitiesModule.kt b/pump/combov2/src/main/kotlin/info/nightscout/pump/combov2/di/ComboV2ActivitiesModule.kt
similarity index 62%
rename from pump/combov2/src/main/kotlin/info/nightscout/androidaps/combov2/di/ComboV2ActivitiesModule.kt
rename to pump/combov2/src/main/kotlin/info/nightscout/pump/combov2/di/ComboV2ActivitiesModule.kt
index 2d7595b6dc..da2f6d4ebf 100644
--- a/pump/combov2/src/main/kotlin/info/nightscout/androidaps/combov2/di/ComboV2ActivitiesModule.kt
+++ b/pump/combov2/src/main/kotlin/info/nightscout/pump/combov2/di/ComboV2ActivitiesModule.kt
@@ -1,9 +1,9 @@
-package info.nightscout.androidaps.combov2.di
+package info.nightscout.pump.combov2.di
import dagger.Module
import dagger.android.ContributesAndroidInjector
-import info.nightscout.androidaps.plugins.pump.combov2.ComboV2Fragment
-import info.nightscout.androidaps.plugins.pump.combov2.activities.ComboV2PairingActivity
+import info.nightscout.pump.combov2.ComboV2Fragment
+import info.nightscout.pump.combov2.activities.ComboV2PairingActivity
@Module
@Suppress("unused")
diff --git a/pump/combov2/src/main/kotlin/info/nightscout/androidaps/combov2/di/ComboV2Module.kt b/pump/combov2/src/main/kotlin/info/nightscout/pump/combov2/di/ComboV2Module.kt
similarity index 69%
rename from pump/combov2/src/main/kotlin/info/nightscout/androidaps/combov2/di/ComboV2Module.kt
rename to pump/combov2/src/main/kotlin/info/nightscout/pump/combov2/di/ComboV2Module.kt
index 43c26351ce..17a4079492 100644
--- a/pump/combov2/src/main/kotlin/info/nightscout/androidaps/combov2/di/ComboV2Module.kt
+++ b/pump/combov2/src/main/kotlin/info/nightscout/pump/combov2/di/ComboV2Module.kt
@@ -1,4 +1,4 @@
-package info.nightscout.androidaps.combov2.di
+package info.nightscout.pump.combov2.di
import dagger.Module
diff --git a/pump/combov2/src/main/res/layout/combov2_fragment.xml b/pump/combov2/src/main/res/layout/combov2_fragment.xml
index 6cfb0f3913..caa797da2a 100644
--- a/pump/combov2/src/main/res/layout/combov2_fragment.xml
+++ b/pump/combov2/src/main/res/layout/combov2_fragment.xml
@@ -412,7 +412,7 @@
android:orientation="horizontal"
android:gravity="center">
-
diff --git a/pump/danar/src/main/java/info/nightscout/androidaps/danar/AbstractDanaRPlugin.java b/pump/danar/src/main/java/info/nightscout/androidaps/danar/AbstractDanaRPlugin.java
index 0d6eb00770..61c1e23fe1 100644
--- a/pump/danar/src/main/java/info/nightscout/androidaps/danar/AbstractDanaRPlugin.java
+++ b/pump/danar/src/main/java/info/nightscout/androidaps/danar/AbstractDanaRPlugin.java
@@ -11,7 +11,6 @@ import info.nightscout.androidaps.dana.DanaPump;
import info.nightscout.androidaps.dana.comm.RecordTypes;
import info.nightscout.androidaps.danar.services.AbstractDanaRExecutionService;
import info.nightscout.core.events.EventNewNotification;
-import info.nightscout.core.pump.PumpStateExtensionKt;
import info.nightscout.interfaces.constraints.Constraint;
import info.nightscout.interfaces.constraints.Constraints;
import info.nightscout.interfaces.notifications.Notification;
@@ -399,14 +398,14 @@ public abstract class AbstractDanaRPlugin extends PumpPluginBase implements Pump
}
PumpSync.PumpState pumpState = pumpSync.expectedPumpState();
if (pumpState.getTemporaryBasal() != null) {
- extended.put("TempBasalAbsoluteRate", PumpStateExtensionKt.convertedToAbsolute(pumpState.getTemporaryBasal(), now, profile));
+ extended.put("TempBasalAbsoluteRate", pumpState.getTemporaryBasal().convertedToAbsolute(now, profile));
extended.put("TempBasalStart", dateUtil.dateAndTimeString(pumpState.getTemporaryBasal().getTimestamp()));
extended.put("TempBasalRemaining", pumpState.getTemporaryBasal().getPlannedRemainingMinutes());
}
if (pumpState.getExtendedBolus() != null) {
extended.put("ExtendedBolusAbsoluteRate", pumpState.getExtendedBolus().getRate());
extended.put("ExtendedBolusStart", dateUtil.dateAndTimeString(pumpState.getExtendedBolus().getTimestamp()));
- extended.put("ExtendedBolusRemaining", PumpStateExtensionKt.getPlannedRemainingMinutes(pumpState.getExtendedBolus()));
+ extended.put("ExtendedBolusRemaining", pumpState.getExtendedBolus().getPlannedRemainingMinutes());
}
extended.put("BaseBasalRate", getBaseBasalRate());
try {
@@ -496,10 +495,10 @@ public abstract class AbstractDanaRPlugin extends PumpPluginBase implements Pump
}
PumpSync.PumpState pumpState = pumpSync.expectedPumpState();
if (pumpState.getTemporaryBasal() != null) {
- ret += "Temp: " + PumpStateExtensionKt.toStringFull(pumpState.getTemporaryBasal(), dateUtil) + "\n";
+ ret += "Temp: " + pumpState.getTemporaryBasal().toStringFull(dateUtil) + "\n";
}
if (pumpState.getExtendedBolus() != null) {
- ret += "Extended: " + PumpStateExtensionKt.toStringFull(pumpState.getExtendedBolus(), dateUtil) + "\n";
+ ret += "Extended: " + pumpState.getExtendedBolus().toStringFull(dateUtil) + "\n";
}
if (!veryShort) {
ret += "TDD: " + DecimalFormatter.INSTANCE.to0Decimal(danaPump.getDailyTotalUnits()) + " / " + danaPump.getMaxDailyTotalUnits() + " U\n";
diff --git a/pump/danar/src/main/java/info/nightscout/androidaps/danar/services/AbstractDanaRExecutionService.java b/pump/danar/src/main/java/info/nightscout/androidaps/danar/services/AbstractDanaRExecutionService.java
index fe9eaf7fb3..73dd41e909 100644
--- a/pump/danar/src/main/java/info/nightscout/androidaps/danar/services/AbstractDanaRExecutionService.java
+++ b/pump/danar/src/main/java/info/nightscout/androidaps/danar/services/AbstractDanaRExecutionService.java
@@ -221,7 +221,7 @@ public abstract class AbstractDanaRExecutionService extends DaggerService {
ToastUtils.INSTANCE.errorToast(context.getApplicationContext(), R.string.devicenotfound);
}
} else {
- ToastUtils.INSTANCE.errorToast(context, R.string.needconnectpermission);
+ ToastUtils.INSTANCE.errorToast(context, R.string.need_connect_permission);
}
}
diff --git a/pump/danars/src/main/java/info/nightscout/androidaps/danars/DanaRSPlugin.kt b/pump/danars/src/main/java/info/nightscout/androidaps/danars/DanaRSPlugin.kt
index a88baebe05..e59947f1ed 100644
--- a/pump/danars/src/main/java/info/nightscout/androidaps/danars/DanaRSPlugin.kt
+++ b/pump/danars/src/main/java/info/nightscout/androidaps/danars/DanaRSPlugin.kt
@@ -14,8 +14,6 @@ import info.nightscout.androidaps.dana.comm.RecordTypes
import info.nightscout.androidaps.danars.events.EventDanaRSDeviceChange
import info.nightscout.androidaps.danars.services.DanaRSService
import info.nightscout.core.events.EventNewNotification
-import info.nightscout.core.pump.convertedToAbsolute
-import info.nightscout.core.pump.plannedRemainingMinutes
import info.nightscout.core.ui.toast.ToastUtils
import info.nightscout.core.utils.fabric.FabricPrivacy
import info.nightscout.interfaces.constraints.Constraint
diff --git a/pump/danars/src/main/java/info/nightscout/androidaps/danars/activities/BLEScanActivity.kt b/pump/danars/src/main/java/info/nightscout/androidaps/danars/activities/BLEScanActivity.kt
index 7d02fe5e8e..42a9f5abe3 100644
--- a/pump/danars/src/main/java/info/nightscout/androidaps/danars/activities/BLEScanActivity.kt
+++ b/pump/danars/src/main/java/info/nightscout/androidaps/danars/activities/BLEScanActivity.kt
@@ -66,7 +66,7 @@ class BLEScanActivity : NoSplashAppCompatActivity() {
bluetoothAdapter?.safeEnable()
startScan()
} else {
- ToastUtils.errorToast(context, context.getString(info.nightscout.core.main.R.string.needconnectpermission))
+ ToastUtils.errorToast(context, context.getString(info.nightscout.core.main.R.string.need_connect_permission))
}
}
@@ -82,7 +82,7 @@ class BLEScanActivity : NoSplashAppCompatActivity() {
} catch (ignore: IllegalStateException) {
} // ignore BT not on
} else {
- ToastUtils.errorToast(context, context.getString(info.nightscout.core.main.R.string.needconnectpermission))
+ ToastUtils.errorToast(context, context.getString(info.nightscout.core.main.R.string.need_connect_permission))
}
private fun stopScan() =
@@ -92,7 +92,7 @@ class BLEScanActivity : NoSplashAppCompatActivity() {
} catch (ignore: IllegalStateException) {
} // ignore BT not on
} else {
- ToastUtils.errorToast(context, context.getString(info.nightscout.core.main.R.string.needconnectpermission))
+ ToastUtils.errorToast(context, context.getString(info.nightscout.core.main.R.string.need_connect_permission))
}
@SuppressLint("MissingPermission")
@@ -153,7 +153,7 @@ class BLEScanActivity : NoSplashAppCompatActivity() {
item.device.createBond()
rxBus.send(EventDanaRSDeviceChange())
} else {
- ToastUtils.errorToast(context, context.getString(info.nightscout.core.main.R.string.needconnectpermission))
+ ToastUtils.errorToast(context, context.getString(info.nightscout.core.main.R.string.need_connect_permission))
}
finish()
}
diff --git a/pump/danars/src/main/java/info/nightscout/androidaps/danars/services/BLEComm.kt b/pump/danars/src/main/java/info/nightscout/androidaps/danars/services/BLEComm.kt
index 348cdccb8d..86d86564b3 100644
--- a/pump/danars/src/main/java/info/nightscout/androidaps/danars/services/BLEComm.kt
+++ b/pump/danars/src/main/java/info/nightscout/androidaps/danars/services/BLEComm.kt
@@ -106,7 +106,7 @@ class BLEComm @Inject internal constructor(
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S &&
ActivityCompat.checkSelfPermission(context, Manifest.permission.BLUETOOTH_CONNECT) != PackageManager.PERMISSION_GRANTED
) {
- ToastUtils.errorToast(context, context.getString(info.nightscout.core.main.R.string.needconnectpermission))
+ ToastUtils.errorToast(context, context.getString(info.nightscout.core.main.R.string.need_connect_permission))
aapsLogger.error(LTag.PUMPBTCOMM, "missing permission: $from")
return false
}
diff --git a/pump/diaconn/src/main/java/info/nightscout/androidaps/diaconn/DiaconnG8Plugin.kt b/pump/diaconn/src/main/java/info/nightscout/androidaps/diaconn/DiaconnG8Plugin.kt
index c2a89982e6..73ed27c75c 100644
--- a/pump/diaconn/src/main/java/info/nightscout/androidaps/diaconn/DiaconnG8Plugin.kt
+++ b/pump/diaconn/src/main/java/info/nightscout/androidaps/diaconn/DiaconnG8Plugin.kt
@@ -12,8 +12,6 @@ import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.diaconn.events.EventDiaconnG8DeviceChange
import info.nightscout.androidaps.diaconn.service.DiaconnG8Service
import info.nightscout.core.events.EventNewNotification
-import info.nightscout.core.pump.convertedToAbsolute
-import info.nightscout.core.pump.plannedRemainingMinutes
import info.nightscout.core.ui.toast.ToastUtils
import info.nightscout.core.utils.fabric.FabricPrivacy
import info.nightscout.interfaces.constraints.Constraint
diff --git a/pump/diaconn/src/main/java/info/nightscout/androidaps/diaconn/activities/DiaconnG8BLEScanActivity.kt b/pump/diaconn/src/main/java/info/nightscout/androidaps/diaconn/activities/DiaconnG8BLEScanActivity.kt
index ed83e714b3..8ab19fa585 100644
--- a/pump/diaconn/src/main/java/info/nightscout/androidaps/diaconn/activities/DiaconnG8BLEScanActivity.kt
+++ b/pump/diaconn/src/main/java/info/nightscout/androidaps/diaconn/activities/DiaconnG8BLEScanActivity.kt
@@ -73,7 +73,7 @@ class DiaconnG8BLEScanActivity : NoSplashAppCompatActivity() {
startScan()
}
} else {
- ToastUtils.errorToast(context, context.getString(info.nightscout.core.main.R.string.needconnectpermission))
+ ToastUtils.errorToast(context, context.getString(info.nightscout.core.main.R.string.need_connect_permission))
}
}
@@ -112,7 +112,7 @@ class DiaconnG8BLEScanActivity : NoSplashAppCompatActivity() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S &&
ActivityCompat.checkSelfPermission(this, Manifest.permission.BLUETOOTH_CONNECT) != PackageManager.PERMISSION_GRANTED
) {
- ToastUtils.errorToast(context, context.getString(info.nightscout.core.main.R.string.needconnectpermission))
+ ToastUtils.errorToast(context, context.getString(info.nightscout.core.main.R.string.need_connect_permission))
return
}
if (device == null || device.name == null || device.name == "") {
diff --git a/pump/diaconn/src/main/java/info/nightscout/androidaps/diaconn/service/BLECommonService.kt b/pump/diaconn/src/main/java/info/nightscout/androidaps/diaconn/service/BLECommonService.kt
index b9fd166298..903fcb1008 100644
--- a/pump/diaconn/src/main/java/info/nightscout/androidaps/diaconn/service/BLECommonService.kt
+++ b/pump/diaconn/src/main/java/info/nightscout/androidaps/diaconn/service/BLECommonService.kt
@@ -89,7 +89,7 @@ class BLECommonService @Inject internal constructor(
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S &&
ActivityCompat.checkSelfPermission(context, Manifest.permission.BLUETOOTH_CONNECT) != PackageManager.PERMISSION_GRANTED
) {
- ToastUtils.errorToast(context, context.getString(info.nightscout.core.main.R.string.needconnectpermission))
+ ToastUtils.errorToast(context, context.getString(info.nightscout.core.main.R.string.need_connect_permission))
aapsLogger.error(LTag.PUMPBTCOMM, "missing permission: $from")
return false
}
diff --git a/pump/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/OmnipodDashPumpPlugin.kt b/pump/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/OmnipodDashPumpPlugin.kt
index b100ffdfa3..a1c6414887 100644
--- a/pump/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/OmnipodDashPumpPlugin.kt
+++ b/pump/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/OmnipodDashPumpPlugin.kt
@@ -34,9 +34,6 @@ import info.nightscout.androidaps.plugins.pump.omnipod.dash.ui.OmnipodDashOvervi
import info.nightscout.androidaps.plugins.pump.omnipod.dash.util.Constants
import info.nightscout.androidaps.plugins.pump.omnipod.dash.util.mapProfileToBasalProgram
import info.nightscout.core.events.EventNewNotification
-import info.nightscout.core.pump.convertedToAbsolute
-import info.nightscout.core.pump.plannedRemainingMinutes
-import info.nightscout.core.pump.toStringFull
import info.nightscout.core.utils.DateTimeUtil
import info.nightscout.core.utils.fabric.FabricPrivacy
import info.nightscout.interfaces.notifications.Notification
diff --git a/pump/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/OmnipodErosPumpPlugin.java b/pump/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/OmnipodErosPumpPlugin.java
index 5091d92450..b5bacf3834 100644
--- a/pump/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/OmnipodErosPumpPlugin.java
+++ b/pump/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/OmnipodErosPumpPlugin.java
@@ -1,9 +1,6 @@
package info.nightscout.androidaps.plugins.pump.omnipod.eros;
import static info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.definition.OmnipodConstants.BASAL_STEP_DURATION;
-import static info.nightscout.core.pump.PumpStateExtensionKt.convertedToAbsolute;
-import static info.nightscout.core.pump.PumpStateExtensionKt.getPlannedRemainingMinutes;
-import static info.nightscout.core.pump.PumpStateExtensionKt.toStringFull;
import android.content.ComponentName;
import android.content.Context;
@@ -774,7 +771,7 @@ public class OmnipodErosPumpPlugin extends PumpPluginBase implements Pump, Riley
PumpSync.PumpState.TemporaryBasal tb = pumpSync.expectedPumpState().getTemporaryBasal();
if (tb != null) {
- extended.put("TempBasalAbsoluteRate", convertedToAbsolute(tb, now, profile));
+ extended.put("TempBasalAbsoluteRate", tb.convertedToAbsolute(now, profile));
extended.put("TempBasalStart", dateUtil.dateAndTimeString(tb.getTimestamp()));
extended.put("TempBasalRemaining", tb.getPlannedRemainingMinutes());
}
@@ -782,7 +779,7 @@ public class OmnipodErosPumpPlugin extends PumpPluginBase implements Pump, Riley
if (eb != null) {
extended.put("ExtendedBolusAbsoluteRate", eb.getRate());
extended.put("ExtendedBolusStart", dateUtil.dateAndTimeString(eb.getTimestamp()));
- extended.put("ExtendedBolusRemaining", getPlannedRemainingMinutes(eb));
+ extended.put("ExtendedBolusRemaining", eb.getPlannedRemainingMinutes());
}
status.put("timestamp", dateUtil.toISOString(dateUtil.now()));
@@ -845,10 +842,10 @@ public class OmnipodErosPumpPlugin extends PumpPluginBase implements Pump, Riley
}
PumpSync.PumpState pumpState = pumpSync.expectedPumpState();
if (pumpState.getTemporaryBasal() != null && pumpState.getProfile() != null) {
- ret += rh.gs(R.string.omnipod_common_short_status_temp_basal, toStringFull(pumpState.getTemporaryBasal(), dateUtil) + "\n");
+ ret += rh.gs(R.string.omnipod_common_short_status_temp_basal, pumpState.getTemporaryBasal().toStringFull(dateUtil) + "\n");
}
if (pumpState.getExtendedBolus() != null) {
- ret += rh.gs(R.string.omnipod_common_short_status_extended_bolus, toStringFull(pumpState.getExtendedBolus(), dateUtil) + "\n");
+ ret += rh.gs(R.string.omnipod_common_short_status_extended_bolus, pumpState.getExtendedBolus().toStringFull(dateUtil) + "\n");
}
ret += rh.gs(R.string.omnipod_common_short_status_reservoir, (getReservoirLevel() > OmnipodConstants.MAX_RESERVOIR_READING ? "50+" : DecimalFormatter.INSTANCE.to0Decimal(getReservoirLevel()))) + "\n";
if (isUseRileyLinkBatteryLevel()) {
@@ -1139,6 +1136,7 @@ public class OmnipodErosPumpPlugin extends PumpPluginBase implements Pump, Riley
return result;
}
+ @SuppressWarnings("TypeParameterHidesVisibleType")
private T executeCommand(OmnipodCommandType commandType, Supplier supplier) {
try {
aapsLogger.debug(LTag.PUMP, "Executing command: {}", commandType);
diff --git a/pump/pump-common/src/main/java/info/nightscout/androidaps/plugins/pump/common/PumpPluginAbstract.kt b/pump/pump-common/src/main/java/info/nightscout/androidaps/plugins/pump/common/PumpPluginAbstract.kt
index 2abff18c65..395dc49d66 100644
--- a/pump/pump-common/src/main/java/info/nightscout/androidaps/plugins/pump/common/PumpPluginAbstract.kt
+++ b/pump/pump-common/src/main/java/info/nightscout/androidaps/plugins/pump/common/PumpPluginAbstract.kt
@@ -10,9 +10,6 @@ import info.nightscout.androidaps.plugins.pump.common.data.PumpStatus
import info.nightscout.androidaps.plugins.pump.common.defs.PumpDriverState
import info.nightscout.androidaps.plugins.pump.common.sync.PumpDbEntryCarbs
import info.nightscout.androidaps.plugins.pump.common.sync.PumpSyncStorage
-import info.nightscout.core.pump.convertedToAbsolute
-import info.nightscout.core.pump.plannedRemainingMinutes
-import info.nightscout.core.pump.toStringFull
import info.nightscout.core.utils.fabric.FabricPrivacy
import info.nightscout.interfaces.constraints.Constraints
import info.nightscout.interfaces.plugin.ActivePlugin