This commit is contained in:
Milos Kozak 2022-07-10 23:05:34 +02:00
parent 5cde729c54
commit 89d2290ed9
3 changed files with 15 additions and 15 deletions

View file

@ -34,6 +34,7 @@ import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.tasks
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.tasks.WakeAndTuneTask import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.tasks.WakeAndTuneTask
import info.nightscout.androidaps.plugins.pump.common.sync.PumpDbEntryTBR import info.nightscout.androidaps.plugins.pump.common.sync.PumpDbEntryTBR
import info.nightscout.androidaps.plugins.pump.common.sync.PumpSyncEntriesCreator import info.nightscout.androidaps.plugins.pump.common.sync.PumpSyncEntriesCreator
import info.nightscout.androidaps.plugins.pump.common.sync.PumpSyncStorage
import info.nightscout.androidaps.plugins.pump.common.utils.DateTimeUtil import info.nightscout.androidaps.plugins.pump.common.utils.DateTimeUtil
import info.nightscout.androidaps.plugins.pump.common.utils.ProfileUtil import info.nightscout.androidaps.plugins.pump.common.utils.ProfileUtil
import info.nightscout.androidaps.plugins.pump.medtronic.comm.history.pump.PumpHistoryEntry import info.nightscout.androidaps.plugins.pump.medtronic.comm.history.pump.PumpHistoryEntry
@ -90,7 +91,7 @@ class MedtronicPumpPlugin @Inject constructor(
dateUtil: DateUtil, dateUtil: DateUtil,
aapsSchedulers: AapsSchedulers, aapsSchedulers: AapsSchedulers,
pumpSync: PumpSync, pumpSync: PumpSync,
pumpSyncStorage: info.nightscout.androidaps.plugins.pump.common.sync.PumpSyncStorage pumpSyncStorage: PumpSyncStorage
) : PumpPluginAbstract( ) : PumpPluginAbstract(
PluginDescription() // PluginDescription() //
.mainType(PluginType.PUMP) // .mainType(PluginType.PUMP) //

View file

@ -29,6 +29,7 @@ import info.nightscout.androidaps.plugins.pump.medtronic.driver.MedtronicPumpSta
import info.nightscout.androidaps.plugins.pump.medtronic.util.MedtronicConst import info.nightscout.androidaps.plugins.pump.medtronic.util.MedtronicConst
import info.nightscout.androidaps.plugins.pump.medtronic.util.MedtronicUtil import info.nightscout.androidaps.plugins.pump.medtronic.util.MedtronicUtil
import info.nightscout.androidaps.interfaces.ResourceHelper import info.nightscout.androidaps.interfaces.ResourceHelper
import info.nightscout.androidaps.plugins.pump.common.sync.PumpSyncStorage
import info.nightscout.shared.sharedPreferences.SP import info.nightscout.shared.sharedPreferences.SP
import org.apache.commons.lang3.StringUtils import org.apache.commons.lang3.StringUtils
import org.joda.time.LocalDateTime import org.joda.time.LocalDateTime
@ -57,7 +58,7 @@ class MedtronicHistoryData @Inject constructor(
val medtronicPumpHistoryDecoder: MedtronicPumpHistoryDecoder, val medtronicPumpHistoryDecoder: MedtronicPumpHistoryDecoder,
val medtronicPumpStatus: MedtronicPumpStatus, val medtronicPumpStatus: MedtronicPumpStatus,
val pumpSync: PumpSync, val pumpSync: PumpSync,
val pumpSyncStorage: info.nightscout.androidaps.plugins.pump.common.sync.PumpSyncStorage val pumpSyncStorage: PumpSyncStorage
) { ) {
val allHistory: MutableList<PumpHistoryEntry> = mutableListOf() val allHistory: MutableList<PumpHistoryEntry> = mutableListOf()

View file

@ -26,6 +26,7 @@ import info.nightscout.androidaps.utils.DecimalFormatter.to0Decimal
import info.nightscout.androidaps.utils.DecimalFormatter.to2Decimal import info.nightscout.androidaps.utils.DecimalFormatter.to2Decimal
import info.nightscout.androidaps.utils.FabricPrivacy import info.nightscout.androidaps.utils.FabricPrivacy
import info.nightscout.androidaps.interfaces.ResourceHelper import info.nightscout.androidaps.interfaces.ResourceHelper
import info.nightscout.androidaps.plugins.pump.common.sync.PumpSyncStorage
import info.nightscout.androidaps.utils.rx.AapsSchedulers import info.nightscout.androidaps.utils.rx.AapsSchedulers
import info.nightscout.shared.logging.AAPSLogger import info.nightscout.shared.logging.AAPSLogger
import info.nightscout.shared.logging.LTag import info.nightscout.shared.logging.LTag
@ -39,9 +40,9 @@ import org.json.JSONObject
*/ */
// When using this class, make sure that your first step is to create mConnection (see MedtronicPumpPlugin) // When using this class, make sure that your first step is to create mConnection (see MedtronicPumpPlugin)
abstract class PumpPluginAbstract protected constructor( abstract class PumpPluginAbstract protected constructor(
pluginDescription: PluginDescription?, pluginDescription: PluginDescription,
pumpType: PumpType, pumpType: PumpType,
injector: HasAndroidInjector?, injector: HasAndroidInjector,
rh: ResourceHelper, rh: ResourceHelper,
aapsLogger: AAPSLogger, aapsLogger: AAPSLogger,
commandQueue: CommandQueue, commandQueue: CommandQueue,
@ -53,8 +54,8 @@ abstract class PumpPluginAbstract protected constructor(
var dateUtil: DateUtil, var dateUtil: DateUtil,
var aapsSchedulers: AapsSchedulers, var aapsSchedulers: AapsSchedulers,
var pumpSync: PumpSync, var pumpSync: PumpSync,
var pumpSyncStorage: info.nightscout.androidaps.plugins.pump.common.sync.PumpSyncStorage var pumpSyncStorage: PumpSyncStorage
) : PumpPluginBase(pluginDescription!!, injector!!, aapsLogger, rh, commandQueue), Pump, Constraints, info.nightscout.androidaps.plugins.pump.common.sync.PumpSyncEntriesCreator { ) : PumpPluginBase(pluginDescription, injector, aapsLogger, rh, commandQueue), Pump, Constraints, info.nightscout.androidaps.plugins.pump.common.sync.PumpSyncEntriesCreator {
private val disposable = CompositeDisposable() private val disposable = CompositeDisposable()
@ -84,7 +85,7 @@ abstract class PumpPluginAbstract protected constructor(
disposable.add(rxBus disposable.add(rxBus
.toObservable(EventAppExit::class.java) .toObservable(EventAppExit::class.java)
.observeOn(aapsSchedulers.io) .observeOn(aapsSchedulers.io)
.subscribe({ _ -> context.unbindService(serviceConnection!!) }) { throwable: Throwable? -> fabricPrivacy.logException(throwable!!) } .subscribe({ context.unbindService(serviceConnection!!) }) { throwable: Throwable? -> fabricPrivacy.logException(throwable!!) }
) )
onStartCustomActions() onStartCustomActions()
} }
@ -265,19 +266,16 @@ abstract class PumpPluginAbstract protected constructor(
override fun shortStatus(veryShort: Boolean): String { override fun shortStatus(veryShort: Boolean): String {
var ret = "" var ret = ""
if (pumpStatusData.lastConnection == 0L) { ret += if (pumpStatusData.lastConnection == 0L) {
ret += "LastConn: never\n" "LastConn: never\n"
} else { } else {
val agoMsec = System.currentTimeMillis() - pumpStatusData.lastConnection val agoMsec = System.currentTimeMillis() - pumpStatusData.lastConnection
val agoMin = (agoMsec / 60.0 / 1000.0).toInt() val agoMin = (agoMsec / 60.0 / 1000.0).toInt()
ret += "LastConn: $agoMin min ago\n" "LastConn: $agoMin min ago\n"
} }
if (pumpStatusData.lastBolusTime != null && pumpStatusData.lastBolusTime!!.time != 0L) { if (pumpStatusData.lastBolusTime?.time != 0L) {
ret += """ ret += "LastBolus: ${to2Decimal(pumpStatusData.lastBolusAmount!!)}U @${DateFormat.format("HH:mm", pumpStatusData.lastBolusTime)}"
LastBolus: ${to2Decimal(pumpStatusData.lastBolusAmount!!)}U @${DateFormat.format("HH:mm", pumpStatusData.lastBolusTime)}
""".trimIndent()
} }
val activeTemp = pumpSync.expectedPumpState().temporaryBasal val activeTemp = pumpSync.expectedPumpState().temporaryBasal
if (activeTemp != null) { if (activeTemp != null) {