ComboV2: remove core dependency
This commit is contained in:
parent
681fe52d80
commit
c6d01f10bd
36 changed files with 145 additions and 161 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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"
|
||||
|
||||
|
|
|
@ -6,8 +6,6 @@
|
|||
<string name="tempbasaldeliveryerror">Tempbasal delivery error</string>
|
||||
<string name="goingtodeliver">Going to deliver %1$.2f U</string>
|
||||
<string name="waitingforpump">Waiting for pump</string>
|
||||
<string name="connecting">Connecting</string>
|
||||
<string name="disconnected">Disconnected</string>
|
||||
<string name="androidaps_start">AAPS started</string>
|
||||
<string name="formatsignedinsulinunits">%1$+.2f U</string>
|
||||
<string name="format_carbs">%1$d g</string>
|
||||
|
@ -446,7 +444,6 @@
|
|||
<string name="unconfirmed_command" comment="26 characters max for translation">Unconfirmed command</string>
|
||||
<string name="requested_by_user" comment="26 characters max for translation">Requested by user</string>
|
||||
<string name="bolus_ok" comment="26 characters max for translation">Bolus OK</string>
|
||||
<string name="pump_paired" comment="26 characters max for translation">Pump paired</string>
|
||||
<string name="insight_refresh_button" comment="26 characters max for translation">Insight Refresh Button</string>
|
||||
<string name="formatPercent">%1$.0f%%</string>
|
||||
<string name="basal">Basal</string>
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
|
@ -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))
|
||||
}
|
||||
}
|
||||
}
|
|
@ -28,6 +28,8 @@
|
|||
<string name="tempbasal_label">Temp basal</string>
|
||||
<string name="extended_bolus_label">Extended bolus</string>
|
||||
<string name="serial_number">Serial number</string>
|
||||
<string name="disconnected">Disconnected</string>
|
||||
<string name="connecting">Connecting</string>
|
||||
|
||||
<!-- Locale -->
|
||||
<string name="key_language" translatable="false">language</string>
|
||||
|
@ -55,9 +57,10 @@
|
|||
<string name="event_time_label">Event time</string>
|
||||
|
||||
<!-- BluetoothDevicePreference -->
|
||||
<string name="needconnectpermission">Application needs bluetooth permission</string>
|
||||
<string name="need_connect_permission">Application needs bluetooth permission</string>
|
||||
|
||||
<!-- Combo-->
|
||||
<string name="user_request" comment="26 characters max for translation">User request</string>
|
||||
<string name="pump_paired" comment="26 characters max for translation">Pump paired</string>
|
||||
|
||||
</resources>
|
|
@ -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)) }
|
||||
|
|
|
@ -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));
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
<application>
|
||||
<activity
|
||||
android:name="info.nightscout.androidaps.plugins.pump.combov2.activities.ComboV2PairingActivity"
|
||||
android:name="info.nightscout.pump.combov2.activities.ComboV2PairingActivity"
|
||||
android:label="@string/combov2_pair_with_pump_title"
|
||||
android:theme="@style/AppTheme" />
|
||||
</application>
|
||||
|
|
|
@ -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?) {
|
|
@ -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
|
||||
}
|
||||
)
|
||||
}
|
|
@ -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) {
|
|
@ -1,4 +1,4 @@
|
|||
package info.nightscout.androidaps.plugins.pump.combov2
|
||||
package info.nightscout.pump.combov2
|
||||
|
||||
import android.content.Context
|
||||
import android.graphics.Bitmap
|
|
@ -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
|
|
@ -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
|
|
@ -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?) {
|
|
@ -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")
|
|
@ -1,4 +1,4 @@
|
|||
package info.nightscout.androidaps.combov2.di
|
||||
package info.nightscout.pump.combov2.di
|
||||
|
||||
import dagger.Module
|
||||
|
|
@ -412,7 +412,7 @@
|
|||
android:orientation="horizontal"
|
||||
android:gravity="center">
|
||||
|
||||
<info.nightscout.androidaps.plugins.pump.combov2.ComboV2RTDisplayFrameView
|
||||
<info.nightscout.pump.combov2.ComboV2RTDisplayFrameView
|
||||
android:id="@+id/combov2_rt_display_frame"
|
||||
android:layout_width="192dp"
|
||||
android:layout_height="64dp"
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
android:summary="@string/combov2_pair_with_pump_summary"
|
||||
android:shouldDisableView="true">
|
||||
<intent
|
||||
android:targetClass="info.nightscout.androidaps.plugins.pump.combov2.activities.ComboV2PairingActivity"
|
||||
android:targetClass="info.nightscout.pump.combov2.activities.ComboV2PairingActivity"
|
||||
android:targetPackage="info.nightscout.androidaps" />
|
||||
</Preference>
|
||||
|
||||
|
|
|
@ -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";
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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()
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 == "") {
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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> T executeCommand(OmnipodCommandType commandType, Supplier<T> supplier) {
|
||||
try {
|
||||
aapsLogger.debug(LTag.PUMP, "Executing command: {}", commandType);
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue