Merge branch 'dev' of https://github.com/nightscout/AndroidAPS into dev
This commit is contained in:
commit
7f4f5de34d
37 changed files with 403 additions and 521 deletions
|
@ -16,12 +16,12 @@ import info.nightscout.androidaps.dependencyInjection.AutotuneModule
|
||||||
import info.nightscout.androidaps.diaconn.di.DiaconnG8Module
|
import info.nightscout.androidaps.diaconn.di.DiaconnG8Module
|
||||||
import info.nightscout.androidaps.insight.di.InsightDatabaseModule
|
import info.nightscout.androidaps.insight.di.InsightDatabaseModule
|
||||||
import info.nightscout.androidaps.insight.di.InsightModule
|
import info.nightscout.androidaps.insight.di.InsightModule
|
||||||
import info.nightscout.androidaps.plugin.general.openhumans.dagger.OpenHumansModule
|
import info.nightscout.androidaps.plugin.general.openhumans.di.OpenHumansModule
|
||||||
import info.nightscout.androidaps.plugins.pump.common.di.PumpCommonModule
|
import info.nightscout.androidaps.plugins.pump.common.di.PumpCommonModule
|
||||||
import info.nightscout.androidaps.plugins.pump.common.di.RileyLinkModule
|
import info.nightscout.androidaps.plugins.pump.common.di.RileyLinkModule
|
||||||
import info.nightscout.androidaps.plugins.pump.medtronic.di.MedtronicModule
|
import info.nightscout.androidaps.plugins.pump.medtronic.di.MedtronicModule
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.dagger.OmnipodDashModule
|
import info.nightscout.androidaps.plugins.pump.omnipod.dash.di.OmnipodDashModule
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.eros.dagger.OmnipodErosModule
|
import info.nightscout.androidaps.plugins.pump.omnipod.eros.di.OmnipodErosModule
|
||||||
import info.nightscout.shared.di.SharedModule
|
import info.nightscout.shared.di.SharedModule
|
||||||
import javax.inject.Singleton
|
import javax.inject.Singleton
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,8 @@ import android.content.Context
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.graphics.Color
|
import android.graphics.Color
|
||||||
import android.graphics.Paint
|
import android.graphics.Paint
|
||||||
|
import android.os.Handler
|
||||||
|
import android.os.HandlerThread
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.widget.RemoteViews
|
import android.widget.RemoteViews
|
||||||
import dagger.android.HasAndroidInjector
|
import dagger.android.HasAndroidInjector
|
||||||
|
@ -26,7 +28,6 @@ import info.nightscout.androidaps.plugins.general.overview.OverviewData
|
||||||
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatusProvider
|
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatusProvider
|
||||||
import info.nightscout.androidaps.utils.DateUtil
|
import info.nightscout.androidaps.utils.DateUtil
|
||||||
import info.nightscout.androidaps.utils.TrendCalculator
|
import info.nightscout.androidaps.utils.TrendCalculator
|
||||||
import info.nightscout.androidaps.interfaces.ResourceHelper
|
|
||||||
import info.nightscout.shared.logging.AAPSLogger
|
import info.nightscout.shared.logging.AAPSLogger
|
||||||
import info.nightscout.shared.logging.LTag
|
import info.nightscout.shared.logging.LTag
|
||||||
import info.nightscout.shared.sharedPreferences.SP
|
import info.nightscout.shared.sharedPreferences.SP
|
||||||
|
@ -53,6 +54,7 @@ class Widget : AppWidgetProvider() {
|
||||||
@Inject lateinit var sp: SP
|
@Inject lateinit var sp: SP
|
||||||
@Inject lateinit var constraintChecker: ConstraintChecker
|
@Inject lateinit var constraintChecker: ConstraintChecker
|
||||||
|
|
||||||
|
private var handler = Handler(HandlerThread(this::class.simpleName + "Handler").also { it.start() }.looper)
|
||||||
private val intentAction = "OpenApp"
|
private val intentAction = "OpenApp"
|
||||||
|
|
||||||
override fun onReceive(context: Context, intent: Intent?) {
|
override fun onReceive(context: Context, intent: Intent?) {
|
||||||
|
@ -88,16 +90,17 @@ class Widget : AppWidgetProvider() {
|
||||||
views.setOnClickPendingIntent(R.id.widget_layout, pendingIntent)
|
views.setOnClickPendingIntent(R.id.widget_layout, pendingIntent)
|
||||||
views.setInt(R.id.widget_layout, "setBackgroundColor", Color.argb(alpha, 0, 0, 0))
|
views.setInt(R.id.widget_layout, "setBackgroundColor", Color.argb(alpha, 0, 0, 0))
|
||||||
|
|
||||||
updateBg(views)
|
handler.post {
|
||||||
updateTemporaryBasal(views)
|
updateBg(views)
|
||||||
updateExtendedBolus(views)
|
updateTemporaryBasal(views)
|
||||||
updateIobCob(views)
|
updateExtendedBolus(views)
|
||||||
updateTemporaryTarget(views)
|
updateIobCob(views)
|
||||||
updateProfile(views)
|
updateTemporaryTarget(views)
|
||||||
updateSensitivity(views)
|
updateProfile(views)
|
||||||
|
updateSensitivity(views)
|
||||||
// Instruct the widget manager to update the widget
|
// Instruct the widget manager to update the widget
|
||||||
appWidgetManager.updateAppWidget(appWidgetId, views)
|
appWidgetManager.updateAppWidget(appWidgetId, views)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun updateBg(views: RemoteViews) {
|
private fun updateBg(views: RemoteViews) {
|
||||||
|
|
|
@ -10,7 +10,7 @@ buildscript {
|
||||||
room_version = '2.4.2'
|
room_version = '2.4.2'
|
||||||
lifecycle_version = '2.4.1'
|
lifecycle_version = '2.4.1'
|
||||||
dagger_version = '2.42'
|
dagger_version = '2.42'
|
||||||
coroutines_version = '1.6.2'
|
coroutines_version = '1.6.3'
|
||||||
activity_version = '1.4.0'
|
activity_version = '1.4.0'
|
||||||
fragmentktx_version = '1.4.1'
|
fragmentktx_version = '1.4.1'
|
||||||
ormLite_version = '4.46'
|
ormLite_version = '4.46'
|
||||||
|
|
|
@ -91,16 +91,17 @@ class MedtronicPumpPlugin @Inject constructor(
|
||||||
aapsSchedulers: AapsSchedulers,
|
aapsSchedulers: AapsSchedulers,
|
||||||
pumpSync: PumpSync,
|
pumpSync: PumpSync,
|
||||||
pumpSyncStorage: info.nightscout.androidaps.plugins.pump.common.sync.PumpSyncStorage
|
pumpSyncStorage: info.nightscout.androidaps.plugins.pump.common.sync.PumpSyncStorage
|
||||||
) : PumpPluginAbstract(PluginDescription() //
|
) : PumpPluginAbstract(
|
||||||
.mainType(PluginType.PUMP) //
|
PluginDescription() //
|
||||||
.fragmentClass(MedtronicFragment::class.java.name) //
|
.mainType(PluginType.PUMP) //
|
||||||
.pluginIcon(R.drawable.ic_veo_128)
|
.fragmentClass(MedtronicFragment::class.java.name) //
|
||||||
.pluginName(R.string.medtronic_name) //
|
.pluginIcon(R.drawable.ic_veo_128)
|
||||||
.shortName(R.string.medtronic_name_short) //
|
.pluginName(R.string.medtronic_name) //
|
||||||
.preferencesId(R.xml.pref_medtronic)
|
.shortName(R.string.medtronic_name_short) //
|
||||||
.description(R.string.description_pump_medtronic), //
|
.preferencesId(R.xml.pref_medtronic)
|
||||||
PumpType.MEDTRONIC_522_722, // we default to most basic model, correct model from config is loaded later
|
.description(R.string.description_pump_medtronic), //
|
||||||
injector, rh, aapsLogger, commandQueue, rxBus, activePlugin, sp, context, fabricPrivacy, dateUtil, aapsSchedulers, pumpSync, pumpSyncStorage
|
PumpType.MEDTRONIC_522_722, // we default to most basic model, correct model from config is loaded later
|
||||||
|
injector, rh, aapsLogger, commandQueue, rxBus, activePlugin, sp, context, fabricPrivacy, dateUtil, aapsSchedulers, pumpSync, pumpSyncStorage
|
||||||
), Pump, RileyLinkPumpDevice, PumpSyncEntriesCreator {
|
), Pump, RileyLinkPumpDevice, PumpSyncEntriesCreator {
|
||||||
|
|
||||||
private var rileyLinkMedtronicService: RileyLinkMedtronicService? = null
|
private var rileyLinkMedtronicService: RileyLinkMedtronicService? = null
|
||||||
|
@ -234,18 +235,16 @@ class MedtronicPumpPlugin @Inject constructor(
|
||||||
// Pump Plugin
|
// Pump Plugin
|
||||||
private var isServiceSet: Boolean = false
|
private var isServiceSet: Boolean = false
|
||||||
|
|
||||||
override fun getRileyLinkService(): RileyLinkMedtronicService? = rileyLinkMedtronicService
|
override val rileyLinkService: RileyLinkMedtronicService? = rileyLinkMedtronicService
|
||||||
|
|
||||||
override fun getPumpInfo(): RileyLinkPumpInfo {
|
override val pumpInfo: RileyLinkPumpInfo
|
||||||
val frequency = rh.gs(if (medtronicPumpStatus.pumpFrequency == "medtronic_pump_frequency_us_ca") R.string.medtronic_pump_frequency_us_ca else R.string.medtronic_pump_frequency_worldwide)
|
get() = RileyLinkPumpInfo(
|
||||||
val model = if (!medtronicUtil.isModelSet) "???" else "Medtronic " + medtronicPumpStatus.medtronicDeviceType.pumpModel
|
rh.gs(if (medtronicPumpStatus.pumpFrequency == "medtronic_pump_frequency_us_ca") R.string.medtronic_pump_frequency_us_ca else R.string.medtronic_pump_frequency_worldwide),
|
||||||
val serialNumber = medtronicPumpStatus.serialNumber
|
if (!medtronicUtil.isModelSet) "???" else "Medtronic " + medtronicPumpStatus.medtronicDeviceType.pumpModel,
|
||||||
return RileyLinkPumpInfo(frequency, model, serialNumber)
|
medtronicPumpStatus.serialNumber
|
||||||
}
|
)
|
||||||
|
|
||||||
override fun getLastConnectionTimeMillis(): Long {
|
override val lastConnectionTimeMillis: Long = medtronicPumpStatus.lastConnection
|
||||||
return medtronicPumpStatus.lastConnection
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun setLastCommunicationToNow() {
|
override fun setLastCommunicationToNow() {
|
||||||
medtronicPumpStatus.setLastCommunicationToNow()
|
medtronicPumpStatus.setLastCommunicationToNow()
|
||||||
|
@ -326,7 +325,8 @@ class MedtronicPumpPlugin @Inject constructor(
|
||||||
}
|
}
|
||||||
if (rileyLinkServiceState != RileyLinkServiceState.PumpConnectorReady //
|
if (rileyLinkServiceState != RileyLinkServiceState.PumpConnectorReady //
|
||||||
&& rileyLinkServiceState != RileyLinkServiceState.RileyLinkReady //
|
&& rileyLinkServiceState != RileyLinkServiceState.RileyLinkReady //
|
||||||
&& rileyLinkServiceState != RileyLinkServiceState.TuneUpDevice) {
|
&& rileyLinkServiceState != RileyLinkServiceState.TuneUpDevice
|
||||||
|
) {
|
||||||
aapsLogger.debug(LTag.PUMP, "RileyLink unreachable.")
|
aapsLogger.debug(LTag.PUMP, "RileyLink unreachable.")
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
@ -334,8 +334,10 @@ class MedtronicPumpPlugin @Inject constructor(
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun refreshAnyStatusThatNeedsToBeRefreshed() {
|
private fun refreshAnyStatusThatNeedsToBeRefreshed() {
|
||||||
val statusRefresh = workWithStatusRefresh(StatusRefreshAction.GetData, null,
|
val statusRefresh = workWithStatusRefresh(
|
||||||
null)!!
|
StatusRefreshAction.GetData, null,
|
||||||
|
null
|
||||||
|
)!!
|
||||||
if (!doWeHaveAnyStatusNeededRefreshing(statusRefresh)) {
|
if (!doWeHaveAnyStatusNeededRefreshing(statusRefresh)) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -491,7 +493,7 @@ class MedtronicPumpPlugin @Inject constructor(
|
||||||
val basalsByHour: DoubleArray? = medtronicPumpStatus.basalsByHour
|
val basalsByHour: DoubleArray? = medtronicPumpStatus.basalsByHour
|
||||||
aapsLogger.debug(
|
aapsLogger.debug(
|
||||||
LTag.PUMP, "Current Basals (h): "
|
LTag.PUMP, "Current Basals (h): "
|
||||||
+ (basalsByHour?.let { getProfilesByHourToString(it) } ?: "null"))
|
+ (basalsByHour?.let { getProfilesByHourToString(it) } ?: "null"))
|
||||||
|
|
||||||
// int index = 0;
|
// int index = 0;
|
||||||
if (basalsByHour == null) return true // we don't want to set profile again, unless we are sure
|
if (basalsByHour == null) return true // we don't want to set profile again, unless we are sure
|
||||||
|
@ -594,9 +596,13 @@ class MedtronicPumpPlugin @Inject constructor(
|
||||||
return PumpEnactResult(injector) //
|
return PumpEnactResult(injector) //
|
||||||
.success(false) //
|
.success(false) //
|
||||||
.enacted(false) //
|
.enacted(false) //
|
||||||
.comment(rh.gs(R.string.medtronic_cmd_bolus_could_not_be_delivered_no_insulin,
|
.comment(
|
||||||
medtronicPumpStatus.reservoirRemainingUnits,
|
rh.gs(
|
||||||
detailedBolusInfo.insulin))
|
R.string.medtronic_cmd_bolus_could_not_be_delivered_no_insulin,
|
||||||
|
medtronicPumpStatus.reservoirRemainingUnits,
|
||||||
|
detailedBolusInfo.insulin
|
||||||
|
)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
bolusDeliveryType = BolusDeliveryType.DeliveryPrepared
|
bolusDeliveryType = BolusDeliveryType.DeliveryPrepared
|
||||||
if (isPumpNotReachable) {
|
if (isPumpNotReachable) {
|
||||||
|
@ -619,8 +625,10 @@ class MedtronicPumpPlugin @Inject constructor(
|
||||||
bolusDeliveryType = BolusDeliveryType.Delivering
|
bolusDeliveryType = BolusDeliveryType.Delivering
|
||||||
|
|
||||||
// LOG.debug("MedtronicPumpPlugin::deliverBolus - Start delivery");
|
// LOG.debug("MedtronicPumpPlugin::deliverBolus - Start delivery");
|
||||||
val responseTask = rileyLinkMedtronicService?.medtronicUIComm?.executeCommand(MedtronicCommandType.SetBolus,
|
val responseTask = rileyLinkMedtronicService?.medtronicUIComm?.executeCommand(
|
||||||
arrayListOf(detailedBolusInfo.insulin))
|
MedtronicCommandType.SetBolus,
|
||||||
|
arrayListOf(detailedBolusInfo.insulin)
|
||||||
|
)
|
||||||
val response = responseTask?.result as Boolean?
|
val response = responseTask?.result as Boolean?
|
||||||
setRefreshButtonEnabled(true)
|
setRefreshButtonEnabled(true)
|
||||||
|
|
||||||
|
@ -757,8 +765,10 @@ class MedtronicPumpPlugin @Inject constructor(
|
||||||
}
|
}
|
||||||
|
|
||||||
// now start new TBR
|
// now start new TBR
|
||||||
val responseTask = rileyLinkMedtronicService?.medtronicUIComm?.executeCommand(MedtronicCommandType.SetTemporaryBasal,
|
val responseTask = rileyLinkMedtronicService?.medtronicUIComm?.executeCommand(
|
||||||
arrayListOf(absoluteRate, durationInMinutes))
|
MedtronicCommandType.SetTemporaryBasal,
|
||||||
|
arrayListOf(absoluteRate, durationInMinutes)
|
||||||
|
)
|
||||||
val response = responseTask?.result as Boolean?
|
val response = responseTask?.result as Boolean?
|
||||||
aapsLogger.info(LTag.PUMP, logPrefix + "setTempBasalAbsolute - setTBR. Response: " + response)
|
aapsLogger.info(LTag.PUMP, logPrefix + "setTempBasalAbsolute - setTBR. Response: " + response)
|
||||||
return if (response == null || !response) {
|
return if (response == null || !response) {
|
||||||
|
@ -784,13 +794,13 @@ class MedtronicPumpPlugin @Inject constructor(
|
||||||
|
|
||||||
@Deprecated("Not used, TBRs fixed in history, should be removed.")
|
@Deprecated("Not used, TBRs fixed in history, should be removed.")
|
||||||
private fun cancelTBRWithTemporaryId() {
|
private fun cancelTBRWithTemporaryId() {
|
||||||
val tbrs : MutableList<PumpDbEntryTBR> = pumpSyncStorage.getTBRs()
|
val tbrs: MutableList<PumpDbEntryTBR> = pumpSyncStorage.getTBRs()
|
||||||
if (tbrs.size > 0 && medtronicPumpStatus.runningTBRWithTemp!=null) {
|
if (tbrs.size > 0 && medtronicPumpStatus.runningTBRWithTemp != null) {
|
||||||
aapsLogger.info(LTag.PUMP, logPrefix + "cancelTBRWithTemporaryId - TBR items: ${tbrs.size}")
|
aapsLogger.info(LTag.PUMP, logPrefix + "cancelTBRWithTemporaryId - TBR items: ${tbrs.size}")
|
||||||
|
|
||||||
var item : PumpDbEntryTBR? = null
|
var item: PumpDbEntryTBR? = null
|
||||||
|
|
||||||
if (tbrs.size==1) {
|
if (tbrs.size == 1) {
|
||||||
item = tbrs[0]
|
item = tbrs[0]
|
||||||
} else {
|
} else {
|
||||||
for (tbr in tbrs) {
|
for (tbr in tbrs) {
|
||||||
|
@ -801,7 +811,7 @@ class MedtronicPumpPlugin @Inject constructor(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item!=null) {
|
if (item != null) {
|
||||||
|
|
||||||
aapsLogger.debug(LTag.PUMP, "DD: cancelTBRWithTemporaryId: tempIdEntry=${item}")
|
aapsLogger.debug(LTag.PUMP, "DD: cancelTBRWithTemporaryId: tempIdEntry=${item}")
|
||||||
|
|
||||||
|
@ -809,23 +819,25 @@ class MedtronicPumpPlugin @Inject constructor(
|
||||||
|
|
||||||
aapsLogger.debug(
|
aapsLogger.debug(
|
||||||
LTag.PUMP, "syncTemporaryBasalWithTempId " +
|
LTag.PUMP, "syncTemporaryBasalWithTempId " +
|
||||||
"[date=${item.date}, " +
|
"[date=${item.date}, " +
|
||||||
"rate=${item.rate}, " +
|
"rate=${item.rate}, " +
|
||||||
"duration=${differenceS} s, " +
|
"duration=${differenceS} s, " +
|
||||||
"isAbsolute=${!item.isAbsolute}, temporaryId=${item.temporaryId}, " +
|
"isAbsolute=${!item.isAbsolute}, temporaryId=${item.temporaryId}, " +
|
||||||
"pumpId=NO, pumpType=${medtronicPumpStatus.pumpType}, " +
|
"pumpId=NO, pumpType=${medtronicPumpStatus.pumpType}, " +
|
||||||
"pumpSerial=${medtronicPumpStatus.serialNumber}]")
|
"pumpSerial=${medtronicPumpStatus.serialNumber}]"
|
||||||
|
)
|
||||||
|
|
||||||
val result = pumpSync.syncTemporaryBasalWithTempId(
|
val result = pumpSync.syncTemporaryBasalWithTempId(
|
||||||
timestamp = item.date,
|
timestamp = item.date,
|
||||||
rate = item.rate,
|
rate = item.rate,
|
||||||
duration= differenceS * 1000L,
|
duration = differenceS * 1000L,
|
||||||
isAbsolute = item.isAbsolute,
|
isAbsolute = item.isAbsolute,
|
||||||
temporaryId = item.temporaryId,
|
temporaryId = item.temporaryId,
|
||||||
type = item.tbrType,
|
type = item.tbrType,
|
||||||
pumpId = null,
|
pumpId = null,
|
||||||
pumpType = medtronicPumpStatus.pumpType,
|
pumpType = medtronicPumpStatus.pumpType,
|
||||||
pumpSerial = medtronicPumpStatus.serialNumber)
|
pumpSerial = medtronicPumpStatus.serialNumber
|
||||||
|
)
|
||||||
|
|
||||||
aapsLogger.debug(LTag.PUMP, "syncTemporaryBasalWithTempId - Result: $result")
|
aapsLogger.debug(LTag.PUMP, "syncTemporaryBasalWithTempId - Result: $result")
|
||||||
}
|
}
|
||||||
|
@ -834,7 +846,7 @@ class MedtronicPumpPlugin @Inject constructor(
|
||||||
aapsLogger.info(LTag.PUMP, logPrefix + "cancelTBRWithTemporaryId - TBR items: ${tbrs.size}, runningTBRWithTemp=${medtronicPumpStatus.runningTBRWithTemp}")
|
aapsLogger.info(LTag.PUMP, logPrefix + "cancelTBRWithTemporaryId - TBR items: ${tbrs.size}, runningTBRWithTemp=${medtronicPumpStatus.runningTBRWithTemp}")
|
||||||
}
|
}
|
||||||
|
|
||||||
if (medtronicPumpStatus.runningTBRWithTemp!=null) {
|
if (medtronicPumpStatus.runningTBRWithTemp != null) {
|
||||||
medtronicPumpStatus.runningTBRWithTemp = null
|
medtronicPumpStatus.runningTBRWithTemp = null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -846,7 +858,10 @@ class MedtronicPumpPlugin @Inject constructor(
|
||||||
} else {
|
} else {
|
||||||
var absoluteValue = profile.getBasal() * (percent / 100.0)
|
var absoluteValue = profile.getBasal() * (percent / 100.0)
|
||||||
absoluteValue = pumpDescription.pumpType.determineCorrectBasalSize(absoluteValue)
|
absoluteValue = pumpDescription.pumpType.determineCorrectBasalSize(absoluteValue)
|
||||||
aapsLogger.warn(LTag.PUMP, "setTempBasalPercent [MedtronicPumpPlugin] - You are trying to use setTempBasalPercent with percent other then 0% ($percent). This will start setTempBasalAbsolute, with calculated value ($absoluteValue). Result might not be 100% correct.")
|
aapsLogger.warn(
|
||||||
|
LTag.PUMP,
|
||||||
|
"setTempBasalPercent [MedtronicPumpPlugin] - You are trying to use setTempBasalPercent with percent other then 0% ($percent). This will start setTempBasalAbsolute, with calculated value ($absoluteValue). Result might not be 100% correct."
|
||||||
|
)
|
||||||
setTempBasalAbsolute(absoluteValue, durationInMinutes, profile, enforceNew, tbrType)
|
setTempBasalAbsolute(absoluteValue, durationInMinutes, profile, enforceNew, tbrType)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -870,7 +885,8 @@ class MedtronicPumpPlugin @Inject constructor(
|
||||||
scheduleNextRefresh(MedtronicStatusRefreshType.PumpTime, -1)
|
scheduleNextRefresh(MedtronicStatusRefreshType.PumpTime, -1)
|
||||||
}
|
}
|
||||||
if (medtronicPumpStatus.basalProfileStatus !== BasalProfileStatus.NotInitialized
|
if (medtronicPumpStatus.basalProfileStatus !== BasalProfileStatus.NotInitialized
|
||||||
&& medtronicHistoryData.hasBasalProfileChanged()) {
|
&& medtronicHistoryData.hasBasalProfileChanged()
|
||||||
|
) {
|
||||||
medtronicHistoryData.processLastBasalProfileChange(pumpDescription.pumpType, medtronicPumpStatus)
|
medtronicHistoryData.processLastBasalProfileChange(pumpDescription.pumpType, medtronicPumpStatus)
|
||||||
}
|
}
|
||||||
val previousState = pumpState
|
val previousState = pumpState
|
||||||
|
@ -890,7 +906,7 @@ class MedtronicPumpPlugin @Inject constructor(
|
||||||
private fun readPumpHistoryLogic() {
|
private fun readPumpHistoryLogic() {
|
||||||
|
|
||||||
val debugHistory = false
|
val debugHistory = false
|
||||||
var targetDate: LocalDateTime? = null
|
val targetDate: LocalDateTime?
|
||||||
if (lastPumpHistoryEntry == null) { // first read
|
if (lastPumpHistoryEntry == null) { // first read
|
||||||
if (debugHistory) aapsLogger.debug(LTag.PUMP, logPrefix + "readPumpHistoryLogic(): lastPumpHistoryEntry: null")
|
if (debugHistory) aapsLogger.debug(LTag.PUMP, logPrefix + "readPumpHistoryLogic(): lastPumpHistoryEntry: null")
|
||||||
val lastPumpHistoryEntryTime = lastPumpEntryTime
|
val lastPumpHistoryEntryTime = lastPumpEntryTime
|
||||||
|
@ -898,13 +914,11 @@ class MedtronicPumpPlugin @Inject constructor(
|
||||||
timeMinus36h = timeMinus36h.minusHours(36)
|
timeMinus36h = timeMinus36h.minusHours(36)
|
||||||
medtronicHistoryData.setIsInInit(true)
|
medtronicHistoryData.setIsInInit(true)
|
||||||
if (lastPumpHistoryEntryTime == 0L) {
|
if (lastPumpHistoryEntryTime == 0L) {
|
||||||
if (debugHistory) aapsLogger.debug(
|
if (debugHistory) aapsLogger.debug(LTag.PUMP, logPrefix + "readPumpHistoryLogic(): lastPumpHistoryEntryTime: 0L")
|
||||||
LTag.PUMP, logPrefix + "readPumpHistoryLogic(): lastPumpHistoryEntryTime: 0L - targetDate: "
|
|
||||||
+ targetDate)
|
|
||||||
targetDate = timeMinus36h
|
targetDate = timeMinus36h
|
||||||
} else {
|
} else {
|
||||||
// LocalDateTime lastHistoryRecordTime = DateTimeUtil.toLocalDateTime(lastPumpHistoryEntryTime);
|
// LocalDateTime lastHistoryRecordTime = DateTimeUtil.toLocalDateTime(lastPumpHistoryEntryTime);
|
||||||
if (debugHistory) aapsLogger.debug(LTag.PUMP, logPrefix + "readPumpHistoryLogic(): lastPumpHistoryEntryTime: " + lastPumpHistoryEntryTime + " - targetDate: " + targetDate)
|
if (debugHistory) aapsLogger.debug(LTag.PUMP, logPrefix + "readPumpHistoryLogic(): lastPumpHistoryEntryTime: " + lastPumpHistoryEntryTime)
|
||||||
//medtronicHistoryData.setLastHistoryRecordTime(lastPumpHistoryEntryTime)
|
//medtronicHistoryData.setLastHistoryRecordTime(lastPumpHistoryEntryTime)
|
||||||
var lastHistoryRecordTime = DateTimeUtil.toLocalDateTime(lastPumpHistoryEntryTime)
|
var lastHistoryRecordTime = DateTimeUtil.toLocalDateTime(lastPumpHistoryEntryTime)
|
||||||
lastHistoryRecordTime = lastHistoryRecordTime.minusHours(12) // we get last 12 hours of history to
|
lastHistoryRecordTime = lastHistoryRecordTime.minusHours(12) // we get last 12 hours of history to
|
||||||
|
@ -922,8 +936,10 @@ class MedtronicPumpPlugin @Inject constructor(
|
||||||
|
|
||||||
//aapsLogger.debug(LTag.PUMP, "HST: Target Date: " + targetDate);
|
//aapsLogger.debug(LTag.PUMP, "HST: Target Date: " + targetDate);
|
||||||
@Suppress("UNCHECKED_CAST")
|
@Suppress("UNCHECKED_CAST")
|
||||||
val responseTask2 = rileyLinkMedtronicService?.medtronicUIComm?.executeCommand(MedtronicCommandType.GetHistoryData,
|
val responseTask2 = rileyLinkMedtronicService?.medtronicUIComm?.executeCommand(
|
||||||
arrayListOf(/*lastPumpHistoryEntry*/ null, targetDate) as? ArrayList<Any>?)
|
MedtronicCommandType.GetHistoryData,
|
||||||
|
arrayListOf(/*lastPumpHistoryEntry*/ null, targetDate) as? ArrayList<Any>?
|
||||||
|
)
|
||||||
if (debugHistory) aapsLogger.debug(LTag.PUMP, "HST: After task")
|
if (debugHistory) aapsLogger.debug(LTag.PUMP, "HST: After task")
|
||||||
val historyResult = responseTask2?.result as PumpHistoryResult?
|
val historyResult = responseTask2?.result as PumpHistoryResult?
|
||||||
if (debugHistory) aapsLogger.debug(LTag.PUMP, "HST: History Result: " + historyResult.toString())
|
if (debugHistory) aapsLogger.debug(LTag.PUMP, "HST: History Result: " + historyResult.toString())
|
||||||
|
@ -981,8 +997,10 @@ class MedtronicPumpPlugin @Inject constructor(
|
||||||
}
|
}
|
||||||
|
|
||||||
MedtronicStatusRefreshType.PumpTime, MedtronicStatusRefreshType.Configuration, MedtronicStatusRefreshType.BatteryStatus, MedtronicStatusRefreshType.PumpHistory -> {
|
MedtronicStatusRefreshType.PumpTime, MedtronicStatusRefreshType.Configuration, MedtronicStatusRefreshType.BatteryStatus, MedtronicStatusRefreshType.PumpHistory -> {
|
||||||
workWithStatusRefresh(StatusRefreshAction.Add, refreshType,
|
workWithStatusRefresh(
|
||||||
getTimeInFutureFromMinutes(refreshType.refreshTime + additionalTimeInMinutes))
|
StatusRefreshAction.Add, refreshType,
|
||||||
|
getTimeInFutureFromMinutes(refreshType.refreshTime + additionalTimeInMinutes)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -993,9 +1011,11 @@ class MedtronicPumpPlugin @Inject constructor(
|
||||||
}
|
}
|
||||||
|
|
||||||
@Synchronized
|
@Synchronized
|
||||||
private fun workWithStatusRefresh(action: StatusRefreshAction, //
|
private fun workWithStatusRefresh(
|
||||||
statusRefreshType: MedtronicStatusRefreshType?, //
|
action: StatusRefreshAction, //
|
||||||
time: Long?): Map<MedtronicStatusRefreshType, Long>? {
|
statusRefreshType: MedtronicStatusRefreshType?, //
|
||||||
|
time: Long?
|
||||||
|
): Map<MedtronicStatusRefreshType, Long>? {
|
||||||
return when (action) {
|
return when (action) {
|
||||||
StatusRefreshAction.Add -> {
|
StatusRefreshAction.Add -> {
|
||||||
statusRefreshMap[statusRefreshType!!] = time!!
|
statusRefreshMap[statusRefreshType!!] = time!!
|
||||||
|
@ -1086,14 +1106,16 @@ class MedtronicPumpPlugin @Inject constructor(
|
||||||
runningTBR.tbrType,
|
runningTBR.tbrType,
|
||||||
runningTBR.pumpId!!,
|
runningTBR.pumpId!!,
|
||||||
runningTBR.pumpType,
|
runningTBR.pumpType,
|
||||||
runningTBR.serialNumber)
|
runningTBR.serialNumber
|
||||||
|
)
|
||||||
|
|
||||||
val differenceTimeMin = floor(differenceTime / (60.0 * 1000.0))
|
val differenceTimeMin = floor(differenceTime / (60.0 * 1000.0))
|
||||||
|
|
||||||
aapsLogger.debug(
|
aapsLogger.debug(
|
||||||
LTag.PUMP, "canceling running TBR - syncTemporaryBasalWithPumpId [date=${runningTBR.date}, " +
|
LTag.PUMP, "canceling running TBR - syncTemporaryBasalWithPumpId [date=${runningTBR.date}, " +
|
||||||
"pumpId=${runningTBR.pumpId}, rate=${runningTBR.rate} U, duration=${differenceTimeMin.toInt()}, " +
|
"pumpId=${runningTBR.pumpId}, rate=${runningTBR.rate} U, duration=${differenceTimeMin.toInt()}, " +
|
||||||
"pumpSerial=${medtronicPumpStatus.serialNumber}] - Result: $result")
|
"pumpSerial=${medtronicPumpStatus.serialNumber}] - Result: $result"
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1145,8 +1167,10 @@ class MedtronicPumpPlugin @Inject constructor(
|
||||||
.enacted(false) //
|
.enacted(false) //
|
||||||
.comment(rh.gs(R.string.medtronic_cmd_set_profile_pattern_overflow, profileInvalid))
|
.comment(rh.gs(R.string.medtronic_cmd_set_profile_pattern_overflow, profileInvalid))
|
||||||
}
|
}
|
||||||
val responseTask = rileyLinkMedtronicService?.medtronicUIComm?.executeCommand(MedtronicCommandType.SetBasalProfileSTD,
|
val responseTask = rileyLinkMedtronicService?.medtronicUIComm?.executeCommand(
|
||||||
arrayListOf(basalProfile))
|
MedtronicCommandType.SetBasalProfileSTD,
|
||||||
|
arrayListOf(basalProfile)
|
||||||
|
)
|
||||||
val response = responseTask?.result as Boolean?
|
val response = responseTask?.result as Boolean?
|
||||||
aapsLogger.info(LTag.PUMP, logPrefix + "Basal Profile was set: " + response)
|
aapsLogger.info(LTag.PUMP, logPrefix + "Basal Profile was set: " + response)
|
||||||
return if (response == null || !response) {
|
return if (response == null || !response) {
|
||||||
|
@ -1184,18 +1208,24 @@ class MedtronicPumpPlugin @Inject constructor(
|
||||||
|
|
||||||
// OPERATIONS not supported by Pump or Plugin
|
// OPERATIONS not supported by Pump or Plugin
|
||||||
private var customActions: List<CustomAction>? = null
|
private var customActions: List<CustomAction>? = null
|
||||||
private val customActionWakeUpAndTune = CustomAction(R.string.medtronic_custom_action_wake_and_tune,
|
private val customActionWakeUpAndTune = CustomAction(
|
||||||
MedtronicCustomActionType.WakeUpAndTune)
|
R.string.medtronic_custom_action_wake_and_tune,
|
||||||
|
MedtronicCustomActionType.WakeUpAndTune
|
||||||
|
)
|
||||||
private val customActionClearBolusBlock = CustomAction(
|
private val customActionClearBolusBlock = CustomAction(
|
||||||
R.string.medtronic_custom_action_clear_bolus_block, MedtronicCustomActionType.ClearBolusBlock, false)
|
R.string.medtronic_custom_action_clear_bolus_block, MedtronicCustomActionType.ClearBolusBlock, false
|
||||||
|
)
|
||||||
private val customActionResetRLConfig = CustomAction(
|
private val customActionResetRLConfig = CustomAction(
|
||||||
R.string.medtronic_custom_action_reset_rileylink, MedtronicCustomActionType.ResetRileyLinkConfiguration, true)
|
R.string.medtronic_custom_action_reset_rileylink, MedtronicCustomActionType.ResetRileyLinkConfiguration, true
|
||||||
|
)
|
||||||
|
|
||||||
override fun getCustomActions(): List<CustomAction>? {
|
override fun getCustomActions(): List<CustomAction>? {
|
||||||
if (customActions == null) {
|
if (customActions == null) {
|
||||||
customActions = listOf(customActionWakeUpAndTune, //
|
customActions = listOf(
|
||||||
|
customActionWakeUpAndTune, //
|
||||||
customActionClearBolusBlock, //
|
customActionClearBolusBlock, //
|
||||||
customActionResetRLConfig)
|
customActionResetRLConfig
|
||||||
|
)
|
||||||
}
|
}
|
||||||
return customActions
|
return customActions
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,10 +4,8 @@ import android.content.Intent
|
||||||
import android.content.res.Configuration
|
import android.content.res.Configuration
|
||||||
import android.os.Binder
|
import android.os.Binder
|
||||||
import android.os.IBinder
|
import android.os.IBinder
|
||||||
import info.nightscout.shared.logging.LTag
|
|
||||||
import info.nightscout.androidaps.plugins.pump.common.defs.PumpDeviceState
|
import info.nightscout.androidaps.plugins.pump.common.defs.PumpDeviceState
|
||||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkConst
|
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkConst
|
||||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.RFSpy
|
|
||||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.defs.RileyLinkEncodingType
|
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.defs.RileyLinkEncodingType
|
||||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.defs.RileyLinkTargetFrequency
|
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.defs.RileyLinkTargetFrequency
|
||||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkTargetDevice
|
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkTargetDevice
|
||||||
|
@ -21,6 +19,7 @@ import info.nightscout.androidaps.plugins.pump.medtronic.defs.MedtronicDeviceTyp
|
||||||
import info.nightscout.androidaps.plugins.pump.medtronic.driver.MedtronicPumpStatus
|
import info.nightscout.androidaps.plugins.pump.medtronic.driver.MedtronicPumpStatus
|
||||||
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.shared.logging.LTag
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
import javax.inject.Singleton
|
import javax.inject.Singleton
|
||||||
|
|
||||||
|
@ -33,7 +32,6 @@ class RileyLinkMedtronicService : RileyLinkService() {
|
||||||
@Inject lateinit var medtronicPumpPlugin: MedtronicPumpPlugin
|
@Inject lateinit var medtronicPumpPlugin: MedtronicPumpPlugin
|
||||||
@Inject lateinit var medtronicUtil: MedtronicUtil
|
@Inject lateinit var medtronicUtil: MedtronicUtil
|
||||||
@Inject lateinit var medtronicPumpStatus: MedtronicPumpStatus
|
@Inject lateinit var medtronicPumpStatus: MedtronicPumpStatus
|
||||||
@Inject lateinit var rfSpy: RFSpy
|
|
||||||
@Inject lateinit var medtronicCommunicationManager: MedtronicCommunicationManager
|
@Inject lateinit var medtronicCommunicationManager: MedtronicCommunicationManager
|
||||||
@Inject lateinit var medtronicUIComm: MedtronicUIComm
|
@Inject lateinit var medtronicUIComm: MedtronicUIComm
|
||||||
|
|
||||||
|
@ -79,7 +77,7 @@ class RileyLinkMedtronicService : RileyLinkService() {
|
||||||
// get most recently used RileyLink address and name
|
// get most recently used RileyLink address and name
|
||||||
rileyLinkServiceData.rileyLinkAddress = sp.getString(RileyLinkConst.Prefs.RileyLinkAddress, "")
|
rileyLinkServiceData.rileyLinkAddress = sp.getString(RileyLinkConst.Prefs.RileyLinkAddress, "")
|
||||||
rileyLinkServiceData.rileyLinkName = sp.getString(RileyLinkConst.Prefs.RileyLinkName, "")
|
rileyLinkServiceData.rileyLinkName = sp.getString(RileyLinkConst.Prefs.RileyLinkName, "")
|
||||||
rfspy.startReader()
|
rfSpy.startReader()
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "RileyLinkMedtronicService newly constructed")
|
aapsLogger.debug(LTag.PUMPCOMM, "RileyLinkMedtronicService newly constructed")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,34 +2,21 @@ package info.nightscout.androidaps.plugins.pump.medtronic.comm
|
||||||
|
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
import info.nightscout.androidaps.TestBase
|
import info.nightscout.androidaps.TestBase
|
||||||
import info.nightscout.androidaps.plugins.pump.common.utils.ByteUtil
|
|
||||||
import org.mockito.Mock
|
|
||||||
import info.nightscout.androidaps.plugins.bus.RxBus
|
import info.nightscout.androidaps.plugins.bus.RxBus
|
||||||
import info.nightscout.androidaps.interfaces.ResourceHelper
|
import info.nightscout.androidaps.plugins.pump.common.utils.ByteUtil
|
||||||
import info.nightscout.androidaps.plugins.pump.common.defs.PumpType
|
|
||||||
import info.nightscout.shared.sharedPreferences.SP
|
|
||||||
import info.nightscout.shared.logging.AAPSLogger
|
|
||||||
import info.nightscout.shared.logging.AAPSLoggerTest
|
|
||||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkUtil
|
|
||||||
import info.nightscout.androidaps.plugins.pump.medtronic.driver.MedtronicPumpStatus
|
|
||||||
import info.nightscout.androidaps.plugins.pump.medtronic.util.MedtronicUtil
|
|
||||||
import info.nightscout.androidaps.plugins.pump.medtronic.comm.history.pump.MedtronicPumpHistoryDecoder
|
|
||||||
import kotlin.Throws
|
|
||||||
import info.nightscout.androidaps.plugins.pump.medtronic.comm.history.RawHistoryPage
|
import info.nightscout.androidaps.plugins.pump.medtronic.comm.history.RawHistoryPage
|
||||||
|
import info.nightscout.androidaps.plugins.pump.medtronic.comm.history.pump.MedtronicPumpHistoryDecoder
|
||||||
import info.nightscout.androidaps.plugins.pump.medtronic.comm.history.pump.PumpHistoryEntry
|
import info.nightscout.androidaps.plugins.pump.medtronic.comm.history.pump.PumpHistoryEntry
|
||||||
import info.nightscout.androidaps.plugins.pump.medtronic.comm.history.pump.PumpHistoryEntryType
|
import info.nightscout.androidaps.plugins.pump.medtronic.comm.history.pump.PumpHistoryEntryType
|
||||||
import info.nightscout.androidaps.plugins.pump.medtronic.data.MedtronicHistoryData
|
import info.nightscout.androidaps.plugins.pump.medtronic.data.MedtronicHistoryData
|
||||||
import info.nightscout.androidaps.plugins.pump.medtronic.data.dto.TempBasalProcessDTO
|
import info.nightscout.androidaps.plugins.pump.medtronic.data.dto.TempBasalProcessDTO
|
||||||
import info.nightscout.androidaps.plugins.pump.medtronic.defs.MedtronicDeviceType
|
import info.nightscout.androidaps.plugins.pump.medtronic.defs.MedtronicDeviceType
|
||||||
|
import info.nightscout.androidaps.plugins.pump.medtronic.driver.MedtronicPumpStatus
|
||||||
|
import info.nightscout.androidaps.plugins.pump.medtronic.util.MedtronicUtil
|
||||||
import info.nightscout.androidaps.utils.rx.TestAapsSchedulers
|
import info.nightscout.androidaps.utils.rx.TestAapsSchedulers
|
||||||
import info.nightscout.androidaps.utils.serialisation.SealedClassHelper.gson
|
import info.nightscout.androidaps.utils.serialisation.SealedClassHelper.gson
|
||||||
import org.junit.Before
|
import org.junit.Before
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
import org.junit.runner.RunWith
|
|
||||||
import org.mockito.ArgumentMatchers
|
|
||||||
import org.mockito.Mockito
|
|
||||||
import org.mockito.MockitoAnnotations
|
|
||||||
import java.lang.Exception
|
|
||||||
|
|
||||||
//import uk.org.lidalia.slf4jtest.TestLogger;
|
//import uk.org.lidalia.slf4jtest.TestLogger;
|
||||||
//import uk.org.lidalia.slf4jtest.TestLoggerFactory;
|
//import uk.org.lidalia.slf4jtest.TestLoggerFactory;
|
||||||
|
@ -44,50 +31,30 @@ class MedtronicHistoryDataUTest : TestBase() {
|
||||||
// "16 00 12 EC 14 47 13 33 00 14 F2 14 47 13 00 16 01 14 F2 14 47 13 33 00 1C C9 15 47 13 00 16 00 1C C9 15 47 13 33 4E 31 D3 15 47 13 00 16 01 31 D3 15 47 13 33 00 1A F1 15 47 13 00 16 00 1A F1 15 47 13 33 50 1D F1 15 47 13 00 16 01 1D F1 15 47 13 33 50 11 D8 16 47 13 00 16 01 11 D8 16 47 13 33 50 31 FB 16 47 13 00 16 01 31 FB 16 47 13 33 50 12 E3 17 47 13 00 16 01 12 E3 17 47 13 33 00 1E FB 17 47 13 00 16 00 1E FB 17 47 13 33 D8 21 FB 17 47 13 00 16 01 21 FB 17 47 13 07 00 00 05 CC 27 93 6D 27 93 05 0C 00 E8 00 00 00 00 05 CC 05 CC 64 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0C 00 E8 00 00 00 33 00 36 C4 00 48 13 00 16 00 36 C4 00 48 13 33 D8 29 C9 00 48 13 00 16 01 29 C9 00 48 13 33 00 12 E7 00 48 13 00 16 00 12 E7 00 48 13 33 BC 19 C9 01 48 13 00 16 01 19 C9 01 48 13 33 00 26 CE 01 48 13 00 16 00 26 CE 01 48 13 33 44 29 CE 01 48 13 00 16 01 29 CE 01 48 13 33 00 13 D3 01 48 13 00 16 00 13 D3 01 48 13 33 64 31 F1 01 48 13 00 16 01 31 F1 01 48 13 33 00 0B F7 01 48 13 00 16 00 0B F7 01 48 13 33 00 12 D8 02 48 13 00 16 01 12 D8 02 48 13 33 00 10 F1 02 48 13 00 16 00 10 F1 02 48 13 33 00 30 C4 03 48 13 00 16 01 30 C4 03 48 13 33 00 04 CA 03 48 13 00 16 00 04 CA 03 48 13 33 00 2F D3 03 48 13 00 16 01 2F D3 03 48 13 33 00 30 D8 03 48 13 00 16 00 30 D8 03 48 13 33 00 13 E7 03 48 13 00 16 01 13 E7 03 48 13 33 00 2E FB 03 48 13 00 16 00 2E FB 03 48 13 19 00 00 C1 04 08 13 07 00 00 04 0C 28 93 6D 28 93 05 0C 00 E8 00 00 00 00 04 0C 04 0C 64 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0C 00 E8 00 00 00 06 3E 03 7A 19 DC 48 49 13 0C 3E 0C E6 08 09 13 07 00 00 01 E4 29 93 6D 29 93 05 0C 00 E8 00 00 00 00 01 E4 01 E4 64 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0C 00 E8 00 00 00 1A 00 13 D2 0D 0A 13 1A 01 28 D2 0D 0A 13 21 00 2A D8 0D 0A 13 03 00 00 00 0E 2D D9 2D 0A 13 33 98 26 DE 0D 4A 13 00 16 01 26 DE 0D 4A 13 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 5D 70"
|
// "16 00 12 EC 14 47 13 33 00 14 F2 14 47 13 00 16 01 14 F2 14 47 13 33 00 1C C9 15 47 13 00 16 00 1C C9 15 47 13 33 4E 31 D3 15 47 13 00 16 01 31 D3 15 47 13 33 00 1A F1 15 47 13 00 16 00 1A F1 15 47 13 33 50 1D F1 15 47 13 00 16 01 1D F1 15 47 13 33 50 11 D8 16 47 13 00 16 01 11 D8 16 47 13 33 50 31 FB 16 47 13 00 16 01 31 FB 16 47 13 33 50 12 E3 17 47 13 00 16 01 12 E3 17 47 13 33 00 1E FB 17 47 13 00 16 00 1E FB 17 47 13 33 D8 21 FB 17 47 13 00 16 01 21 FB 17 47 13 07 00 00 05 CC 27 93 6D 27 93 05 0C 00 E8 00 00 00 00 05 CC 05 CC 64 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0C 00 E8 00 00 00 33 00 36 C4 00 48 13 00 16 00 36 C4 00 48 13 33 D8 29 C9 00 48 13 00 16 01 29 C9 00 48 13 33 00 12 E7 00 48 13 00 16 00 12 E7 00 48 13 33 BC 19 C9 01 48 13 00 16 01 19 C9 01 48 13 33 00 26 CE 01 48 13 00 16 00 26 CE 01 48 13 33 44 29 CE 01 48 13 00 16 01 29 CE 01 48 13 33 00 13 D3 01 48 13 00 16 00 13 D3 01 48 13 33 64 31 F1 01 48 13 00 16 01 31 F1 01 48 13 33 00 0B F7 01 48 13 00 16 00 0B F7 01 48 13 33 00 12 D8 02 48 13 00 16 01 12 D8 02 48 13 33 00 10 F1 02 48 13 00 16 00 10 F1 02 48 13 33 00 30 C4 03 48 13 00 16 01 30 C4 03 48 13 33 00 04 CA 03 48 13 00 16 00 04 CA 03 48 13 33 00 2F D3 03 48 13 00 16 01 2F D3 03 48 13 33 00 30 D8 03 48 13 00 16 00 30 D8 03 48 13 33 00 13 E7 03 48 13 00 16 01 13 E7 03 48 13 33 00 2E FB 03 48 13 00 16 00 2E FB 03 48 13 19 00 00 C1 04 08 13 07 00 00 04 0C 28 93 6D 28 93 05 0C 00 E8 00 00 00 00 04 0C 04 0C 64 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0C 00 E8 00 00 00 06 3E 03 7A 19 DC 48 49 13 0C 3E 0C E6 08 09 13 07 00 00 01 E4 29 93 6D 29 93 05 0C 00 E8 00 00 00 00 01 E4 01 E4 64 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0C 00 E8 00 00 00 1A 00 13 D2 0D 0A 13 1A 01 28 D2 0D 0A 13 21 00 2A D8 0D 0A 13 03 00 00 00 0E 2D D9 2D 0A 13 33 98 26 DE 0D 4A 13 00 16 01 26 DE 0D 4A 13 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 5D 70"
|
||||||
// )
|
// )
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//lateinit var rxBus: RxBus
|
//lateinit var rxBus: RxBus
|
||||||
lateinit var medtronicHistoryData: MedtronicHistoryData
|
lateinit var medtronicHistoryData: MedtronicHistoryData
|
||||||
lateinit var medtronicPumpStatus : MedtronicPumpStatus
|
lateinit var medtronicPumpStatus: MedtronicPumpStatus
|
||||||
|
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
fun setup() {
|
fun setup() {
|
||||||
MockitoAnnotations.initMocks(this)
|
|
||||||
|
|
||||||
rxBus = RxBus(TestAapsSchedulers(), aapsLogger)
|
rxBus = RxBus(TestAapsSchedulers(), aapsLogger)
|
||||||
|
|
||||||
medtronicPumpStatus = MedtronicPumpStatus(
|
medtronicPumpStatus = MedtronicPumpStatus(rh, sp, rxBus, rileyLinkUtil)
|
||||||
rh, sp, rxBus,
|
medtronicUtil = MedtronicUtil(aapsLogger, rxBus, rileyLinkUtil, medtronicPumpStatus)
|
||||||
rileyLinkUtil
|
decoder = MedtronicPumpHistoryDecoder(aapsLogger, medtronicUtil, byteUtil)
|
||||||
|
medtronicHistoryData = MedtronicHistoryData(
|
||||||
|
packetInjector, aapsLogger, sp, rh, rxBus, activePlugin,
|
||||||
|
medtronicUtil, decoder, medtronicPumpStatus, pumpSync, pumpSyncStorage
|
||||||
)
|
)
|
||||||
|
|
||||||
medtronicUtil = MedtronicUtil(
|
|
||||||
aapsLogger, rxBus, rileyLinkUtil,
|
|
||||||
medtronicPumpStatus
|
|
||||||
)
|
|
||||||
|
|
||||||
decoder = MedtronicPumpHistoryDecoder(
|
|
||||||
aapsLogger,
|
|
||||||
medtronicUtil, byteUtil
|
|
||||||
)
|
|
||||||
|
|
||||||
medtronicHistoryData = MedtronicHistoryData(packetInjector, aapsLogger, sp, rh, rxBus, activePlugin,
|
|
||||||
medtronicUtil, decoder,
|
|
||||||
medtronicPumpStatus,
|
|
||||||
pumpSync,
|
|
||||||
pumpSyncStorage)
|
|
||||||
|
|
||||||
|
|
||||||
System.setProperty("org.slf4j.simpleLogger.defaultLogLevel", "trace")
|
System.setProperty("org.slf4j.simpleLogger.defaultLogLevel", "trace")
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//@Test
|
//@Test
|
||||||
@Throws(Exception::class) fun testTBR() {
|
@Throws(Exception::class) fun testTBR() {
|
||||||
var historyPageData = ByteUtil
|
val historyPageData = ByteUtil
|
||||||
.createByteArrayFromString(
|
.createByteArrayFromString(
|
||||||
"16 00 12 EC 14 47 13 33 00 14 F2 14 47 13 00 16 01 14 F2 14 47 13 33 00 1C C9 15 47 13 00 16 00 1C C9 15 47 13 33 4E 31 D3 15 47 13 00 16 01 31 D3 15 47 13 33 00 1A F1 15 47 13 00 16 00 1A F1 15 47 13 33 50 1D F1 15 47 13 00 16 01 1D F1 15 47 13 33 50 11 D8 16 47 13 00 16 01 11 D8 16 47 13 33 50 31 FB 16 47 13 00 16 01 31 FB 16 47 13 33 50 12 E3 17 47 13 00 16 01 12 E3 17 47 13 33 00 1E FB 17 47 13 00 16 00 1E FB 17 47 13 33 D8 21 FB 17 47 13 00 16 01 21 FB 17 47 13 07 00 00 05 CC 27 93 6D 27 93 05 0C 00 E8 00 00 00 00 05 CC 05 CC 64 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0C 00 E8 00 00 00 33 00 36 C4 00 48 13 00 16 00 36 C4 00 48 13 33 D8 29 C9 00 48 13 00 16 01 29 C9 00 48 13 33 00 12 E7 00 48 13 00 16 00 12 E7 00 48 13 33 BC 19 C9 01 48 13 00 16 01 19 C9 01 48 13 33 00 26 CE 01 48 13 00 16 00 26 CE 01 48 13 33 44 29 CE 01 48 13 00 16 01 29 CE 01 48 13 33 00 13 D3 01 48 13 00 16 00 13 D3 01 48 13 33 64 31 F1 01 48 13 00 16 01 31 F1 01 48 13 33 00 0B F7 01 48 13 00 16 00 0B F7 01 48 13 33 00 12 D8 02 48 13 00 16 01 12 D8 02 48 13 33 00 10 F1 02 48 13 00 16 00 10 F1 02 48 13 33 00 30 C4 03 48 13 00 16 01 30 C4 03 48 13 33 00 04 CA 03 48 13 00 16 00 04 CA 03 48 13 33 00 2F D3 03 48 13 00 16 01 2F D3 03 48 13 33 00 30 D8 03 48 13 00 16 00 30 D8 03 48 13 33 00 13 E7 03 48 13 00 16 01 13 E7 03 48 13 33 00 2E FB 03 48 13 00 16 00 2E FB 03 48 13 19 00 00 C1 04 08 13 07 00 00 04 0C 28 93 6D 28 93 05 0C 00 E8 00 00 00 00 04 0C 04 0C 64 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0C 00 E8 00 00 00 06 3E 03 7A 19 DC 48 49 13 0C 3E 0C E6 08 09 13 07 00 00 01 E4 29 93 6D 29 93 05 0C 00 E8 00 00 00 00 01 E4 01 E4 64 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0C 00 E8 00 00 00 1A 00 13 D2 0D 0A 13 1A 01 28 D2 0D 0A 13 21 00 2A D8 0D 0A 13 03 00 00 00 0E 2D D9 2D 0A 13 33 98 26 DE 0D 4A 13 00 16 01 26 DE 0D 4A 13 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 5D 70"
|
"16 00 12 EC 14 47 13 33 00 14 F2 14 47 13 00 16 01 14 F2 14 47 13 33 00 1C C9 15 47 13 00 16 00 1C C9 15 47 13 33 4E 31 D3 15 47 13 00 16 01 31 D3 15 47 13 33 00 1A F1 15 47 13 00 16 00 1A F1 15 47 13 33 50 1D F1 15 47 13 00 16 01 1D F1 15 47 13 33 50 11 D8 16 47 13 00 16 01 11 D8 16 47 13 33 50 31 FB 16 47 13 00 16 01 31 FB 16 47 13 33 50 12 E3 17 47 13 00 16 01 12 E3 17 47 13 33 00 1E FB 17 47 13 00 16 00 1E FB 17 47 13 33 D8 21 FB 17 47 13 00 16 01 21 FB 17 47 13 07 00 00 05 CC 27 93 6D 27 93 05 0C 00 E8 00 00 00 00 05 CC 05 CC 64 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0C 00 E8 00 00 00 33 00 36 C4 00 48 13 00 16 00 36 C4 00 48 13 33 D8 29 C9 00 48 13 00 16 01 29 C9 00 48 13 33 00 12 E7 00 48 13 00 16 00 12 E7 00 48 13 33 BC 19 C9 01 48 13 00 16 01 19 C9 01 48 13 33 00 26 CE 01 48 13 00 16 00 26 CE 01 48 13 33 44 29 CE 01 48 13 00 16 01 29 CE 01 48 13 33 00 13 D3 01 48 13 00 16 00 13 D3 01 48 13 33 64 31 F1 01 48 13 00 16 01 31 F1 01 48 13 33 00 0B F7 01 48 13 00 16 00 0B F7 01 48 13 33 00 12 D8 02 48 13 00 16 01 12 D8 02 48 13 33 00 10 F1 02 48 13 00 16 00 10 F1 02 48 13 33 00 30 C4 03 48 13 00 16 01 30 C4 03 48 13 33 00 04 CA 03 48 13 00 16 00 04 CA 03 48 13 33 00 2F D3 03 48 13 00 16 01 2F D3 03 48 13 33 00 30 D8 03 48 13 00 16 00 30 D8 03 48 13 33 00 13 E7 03 48 13 00 16 01 13 E7 03 48 13 33 00 2E FB 03 48 13 00 16 00 2E FB 03 48 13 19 00 00 C1 04 08 13 07 00 00 04 0C 28 93 6D 28 93 05 0C 00 E8 00 00 00 00 04 0C 04 0C 64 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0C 00 E8 00 00 00 06 3E 03 7A 19 DC 48 49 13 0C 3E 0C E6 08 09 13 07 00 00 01 E4 29 93 6D 29 93 05 0C 00 E8 00 00 00 00 01 E4 01 E4 64 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0C 00 E8 00 00 00 1A 00 13 D2 0D 0A 13 1A 01 28 D2 0D 0A 13 21 00 2A D8 0D 0A 13 03 00 00 00 0E 2D D9 2D 0A 13 33 98 26 DE 0D 4A 13 00 16 01 26 DE 0D 4A 13 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 5D 70"
|
||||||
)
|
)
|
||||||
|
@ -141,10 +108,10 @@ class MedtronicHistoryDataUTest : TestBase() {
|
||||||
.createByteArrayFromString(
|
.createByteArrayFromString(
|
||||||
"33 20 53 78 15 51 16 00 16 01 53 78 15 51 16 33 00 6F 40 16 51 16 00 16 00 6F 40 16 51 16 7B 16 6F 40 16 11 16 2C 1E 00 33 30 71 40 16 51 16 00 16 01 71 40 16 51 16 33 00 6E 45 16 51 16 00 16 00 6E 45 16 51 16 7B 16 6E 45 16 11 16 2C 1E 00 33 3A 70 45 16 51 16 00 16 01 70 45 16 51 16 33 00 71 5E 16 51 16 00 16 00 71 5E 16 51 16 7B 16 71 5E 16 11 16 2C 1E 00 33 40 73 5E 16 51 16 00 16 01 73 5E 16 51 16 33 00 74 6D 16 51 16 00 16 00 74 6D 16 51 16 7B 16 74 6D 16 11 16 2C 1E 00 33 14 76 6D 16 51 16 00 16 01 76 6D 16 51 16 33 00 77 72 16 51 16 00 16 00 77 72 16 51 16 7B 16 77 72 16 11 16 2C 1E 00 7B 17 40 40 17 11 16 2E 1E 00 33 28 51 41 17 51 16 00 16 01 51 41 17 51 16 33 00 56 46 17 51 16 00 16 00 56 46 17 51 16 7B 17 56 46 17 11 16 2E 1E 00 33 34 59 46 17 51 16 00 16 01 59 46 17 51 16 33 00 70 4A 17 51 16 00 16 00 70 4A 17 51 16 7B 17 70 4A 17 11 16 2E 1E 00 33 58 72 4A 17 51 16 00 16 01 72 4A 17 51 16 33 00 6E 59 17 51 16 00 16 00 6E 59 17 51 16 7B 17 6E 59 17 11 16 2E 1E 00 33 18 70 59 17 51 16 00 16 01 70 59 17 51 16 33 00 70 5E 17 51 16 00 16 00 70 5E 17 51 16 7B 17 70 5E 17 11 16 2E 1E 00 33 0C 72 5E 17 51 16 00 16 01 72 5E 17 51 16 33 00 72 63 17 51 16 00 16 00 72 63 17 51 16 7B 17 72 63 17 11 16 2E 1E 00 33 1C 70 72 17 51 16 00 16 01 70 72 17 51 16 33 00 51 78 17 51 16 00 16 00 51 78 17 51 16 7B 17 52 78 17 11 16 2E 1E 00 33 12 54 78 17 51 16 00 16 01 54 78 17 51 16 07 00 00 04 4E 51 96 00 00 00 6E 51 96 05 00 00 00 00 00 00 00 04 4E 03 A2 54 00 AC 10 00 00 00 00 00 00 00 00 00 AC 00 00 00 24 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 33 00 46 46 00 52 16 00 16 00 46 46 00 52 16 7B 00 47 46 00 12 16 00 1E 00 33 20 47 64 00 52 16 00 16 01 47 64 00 52 16 33 00 6D 77 00 52 16 00 16 00 6D 77 00 52 16 7B 00 6D 77 00 12 16 00 1E 00 33 12 70 77 00 52 16 00 16 01 70 77 00 52 16 33 00 58 78 00 52 16 00 16 00 58 78 00 52 16 7B 00 59 78 00 12 16 00 1E 00 33 00 5C 78 00 52 16 00 16 02 5C 78 00 52 16 21 00 66 79 00 12 16 03 00 00 00 9C 74 42 21 12 16 03 00 03 00 03 6E 4D 01 12 16 33 00 79 4E 01 52 16 00 16 00 79 4E 01 52 16 7B 01 79 4E 01 12 16 02 1E 00 33 2A 6B 4F 01 52 16 00 16 01 6B 4F 01 52 16 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 2E D1"
|
"33 20 53 78 15 51 16 00 16 01 53 78 15 51 16 33 00 6F 40 16 51 16 00 16 00 6F 40 16 51 16 7B 16 6F 40 16 11 16 2C 1E 00 33 30 71 40 16 51 16 00 16 01 71 40 16 51 16 33 00 6E 45 16 51 16 00 16 00 6E 45 16 51 16 7B 16 6E 45 16 11 16 2C 1E 00 33 3A 70 45 16 51 16 00 16 01 70 45 16 51 16 33 00 71 5E 16 51 16 00 16 00 71 5E 16 51 16 7B 16 71 5E 16 11 16 2C 1E 00 33 40 73 5E 16 51 16 00 16 01 73 5E 16 51 16 33 00 74 6D 16 51 16 00 16 00 74 6D 16 51 16 7B 16 74 6D 16 11 16 2C 1E 00 33 14 76 6D 16 51 16 00 16 01 76 6D 16 51 16 33 00 77 72 16 51 16 00 16 00 77 72 16 51 16 7B 16 77 72 16 11 16 2C 1E 00 7B 17 40 40 17 11 16 2E 1E 00 33 28 51 41 17 51 16 00 16 01 51 41 17 51 16 33 00 56 46 17 51 16 00 16 00 56 46 17 51 16 7B 17 56 46 17 11 16 2E 1E 00 33 34 59 46 17 51 16 00 16 01 59 46 17 51 16 33 00 70 4A 17 51 16 00 16 00 70 4A 17 51 16 7B 17 70 4A 17 11 16 2E 1E 00 33 58 72 4A 17 51 16 00 16 01 72 4A 17 51 16 33 00 6E 59 17 51 16 00 16 00 6E 59 17 51 16 7B 17 6E 59 17 11 16 2E 1E 00 33 18 70 59 17 51 16 00 16 01 70 59 17 51 16 33 00 70 5E 17 51 16 00 16 00 70 5E 17 51 16 7B 17 70 5E 17 11 16 2E 1E 00 33 0C 72 5E 17 51 16 00 16 01 72 5E 17 51 16 33 00 72 63 17 51 16 00 16 00 72 63 17 51 16 7B 17 72 63 17 11 16 2E 1E 00 33 1C 70 72 17 51 16 00 16 01 70 72 17 51 16 33 00 51 78 17 51 16 00 16 00 51 78 17 51 16 7B 17 52 78 17 11 16 2E 1E 00 33 12 54 78 17 51 16 00 16 01 54 78 17 51 16 07 00 00 04 4E 51 96 00 00 00 6E 51 96 05 00 00 00 00 00 00 00 04 4E 03 A2 54 00 AC 10 00 00 00 00 00 00 00 00 00 AC 00 00 00 24 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 33 00 46 46 00 52 16 00 16 00 46 46 00 52 16 7B 00 47 46 00 12 16 00 1E 00 33 20 47 64 00 52 16 00 16 01 47 64 00 52 16 33 00 6D 77 00 52 16 00 16 00 6D 77 00 52 16 7B 00 6D 77 00 12 16 00 1E 00 33 12 70 77 00 52 16 00 16 01 70 77 00 52 16 33 00 58 78 00 52 16 00 16 00 58 78 00 52 16 7B 00 59 78 00 12 16 00 1E 00 33 00 5C 78 00 52 16 00 16 02 5C 78 00 52 16 21 00 66 79 00 12 16 03 00 00 00 9C 74 42 21 12 16 03 00 03 00 03 6E 4D 01 12 16 33 00 79 4E 01 52 16 00 16 00 79 4E 01 52 16 7B 01 79 4E 01 12 16 02 1E 00 33 2A 6B 4F 01 52 16 00 16 01 6B 4F 01 52 16 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 2E D1"
|
||||||
//"33 20 53 78 15 51 16 00 16 01 53 78 15 51 16 33 00 6F 40 16 51 16 00 16 00 6F 40 16 51 16 7B 16 6F 40 16 11 16 2C 1E 00 33 30 71 40 16 51 16 00 16 01 71 40 16 51 16 33 00 6E 45
|
//"33 20 53 78 15 51 16 00 16 01 53 78 15 51 16 33 00 6F 40 16 51 16 00 16 00 6F 40 16 51 16 7B 16 6F 40 16 11 16 2C 1E 00 33 30 71 40 16 51 16 00 16 01 71 40 16 51 16 33 00 6E 45
|
||||||
// 16 51 16 00 16 00 6E 45 16 51 16 7B 16 6E 45 16 11 16 2C 1E 00 33 3A 70 45 16 51 16 00 16 01 70 45 16 51 16 33 00 71 5E 16 51 16 00 16 00 71 5E 16 51 16 7B 16 71 5E 16 11 16 2C 1E 00 33 40 73 5E 16 51 16 00 16 01 73 5E 16 51 16 33 00 74 6D 16 51 16 00 16 00 74 6D 16 51 16 7B 16 74 6D 16 11 16 2C 1E 00 33 14 76 6D 16 51 16 00 16 01 76 6D 16 51 16 33 00 77 72 16 51 16 00 16 00 77 72 16 51 16 7B 16 77 72 16 11 16 2C 1E 00 7B 17 40 40 17 11 16 2E 1E 00 33 28 51 41 17 51 16 00 16 01 51 41 17 51 16 33 00 56 46 17 51 16 00 16 00 56 46 17 51 16 7B 17 56 46 17 11 16 2E 1E 00 33 34 59 46 17 51 16 00 16 01 59 46 17 51 16 33 00 70 4A 17 51 16 00 16 00 70 4A 17 51 16 7B 17 70 4A 17 11 16 2E 1E 00 33 58 72 4A 17 51 16 00 16 01 72 4A 17 51 16 33 00 6E 59 17 51 16 00 16 00 6E 59 17 51 16 7B 17 6E 59 17 11 16 2E 1E 00 33 18 70 59 17 51 16 00 16 01 70 59 17 51 16 33 00 70 5E 17 51 16 00 16 00 70 5E 17 51 16 7B 17 70 5E 17 11 16 2E 1E 00 33 0C 72 5E 17 51 16 00 16 01 72 5E 17 51 16 33 00 72 63 17 51 16 00 16 00 72 63 17 51 16 7B 17 72 63 17 11 16 2E 1E 00 33 1C 70 72 17 51 16 00 16 01 70 72 17 51 16 33 00 51 78 17 51 16 00 16 00 51 78 17 51 16 7B 17 52 78 17 11 16 2E 1E 00 33 12 54 78 17 51 16 00 16 01 54 78 17 51 16 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 4D 6D"
|
// 16 51 16 00 16 00 6E 45 16 51 16 7B 16 6E 45 16 11 16 2C 1E 00 33 3A 70 45 16 51 16 00 16 01 70 45 16 51 16 33 00 71 5E 16 51 16 00 16 00 71 5E 16 51 16 7B 16 71 5E 16 11 16 2C 1E 00 33 40 73 5E 16 51 16 00 16 01 73 5E 16 51 16 33 00 74 6D 16 51 16 00 16 00 74 6D 16 51 16 7B 16 74 6D 16 11 16 2C 1E 00 33 14 76 6D 16 51 16 00 16 01 76 6D 16 51 16 33 00 77 72 16 51 16 00 16 00 77 72 16 51 16 7B 16 77 72 16 11 16 2C 1E 00 7B 17 40 40 17 11 16 2E 1E 00 33 28 51 41 17 51 16 00 16 01 51 41 17 51 16 33 00 56 46 17 51 16 00 16 00 56 46 17 51 16 7B 17 56 46 17 11 16 2E 1E 00 33 34 59 46 17 51 16 00 16 01 59 46 17 51 16 33 00 70 4A 17 51 16 00 16 00 70 4A 17 51 16 7B 17 70 4A 17 11 16 2E 1E 00 33 58 72 4A 17 51 16 00 16 01 72 4A 17 51 16 33 00 6E 59 17 51 16 00 16 00 6E 59 17 51 16 7B 17 6E 59 17 11 16 2E 1E 00 33 18 70 59 17 51 16 00 16 01 70 59 17 51 16 33 00 70 5E 17 51 16 00 16 00 70 5E 17 51 16 7B 17 70 5E 17 11 16 2E 1E 00 33 0C 72 5E 17 51 16 00 16 01 72 5E 17 51 16 33 00 72 63 17 51 16 00 16 00 72 63 17 51 16 7B 17 72 63 17 11 16 2E 1E 00 33 1C 70 72 17 51 16 00 16 01 70 72 17 51 16 33 00 51 78 17 51 16 00 16 00 51 78 17 51 16 7B 17 52 78 17 11 16 2E 1E 00 33 12 54 78 17 51 16 00 16 01 54 78 17 51 16 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 4D 6D"
|
||||||
)
|
)
|
||||||
|
|
||||||
medtronicUtil.medtronicPumpModel =MedtronicDeviceType.Medtronic_723_Revel
|
medtronicUtil.medtronicPumpModel = MedtronicDeviceType.Medtronic_723_Revel
|
||||||
medtronicUtil.isModelSet = true
|
medtronicUtil.isModelSet = true
|
||||||
|
|
||||||
val historyPage = RawHistoryPage(aapsLogger)
|
val historyPage = RawHistoryPage(aapsLogger)
|
||||||
|
@ -152,7 +119,7 @@ class MedtronicHistoryDataUTest : TestBase() {
|
||||||
val pumpHistoryEntries: MutableList<PumpHistoryEntry> = decoder.processPageAndCreateRecords(historyPage)
|
val pumpHistoryEntries: MutableList<PumpHistoryEntry> = decoder.processPageAndCreateRecords(historyPage)
|
||||||
println("PumpHistoryEntries: " + pumpHistoryEntries.size)
|
println("PumpHistoryEntries: " + pumpHistoryEntries.size)
|
||||||
|
|
||||||
val rewindRecords: MutableList<PumpHistoryEntry> = medtronicHistoryData.getFilteredItems(pumpHistoryEntries, PumpHistoryEntryType.Rewind)
|
val rewindRecords: MutableList<PumpHistoryEntry> = medtronicHistoryData.getFilteredItems(pumpHistoryEntries, PumpHistoryEntryType.Rewind)
|
||||||
|
|
||||||
preProcessListTBR(pumpHistoryEntries)
|
preProcessListTBR(pumpHistoryEntries)
|
||||||
|
|
||||||
|
@ -172,7 +139,7 @@ class MedtronicHistoryDataUTest : TestBase() {
|
||||||
|
|
||||||
println("PumpHistoryEntries: getFilteredItems: " + tbrs.size)
|
println("PumpHistoryEntries: getFilteredItems: " + tbrs.size)
|
||||||
|
|
||||||
println("PumpHistoryEntries: getRewindItems: $rewindRecords.size : " + gson.toJson(rewindRecords) )
|
println("PumpHistoryEntries: getRewindItems: $rewindRecords.size : " + gson.toJson(rewindRecords))
|
||||||
|
|
||||||
val processList: MutableList<TempBasalProcessDTO> = medtronicHistoryData.createTBRProcessList(tbrs, rewindRecords)
|
val processList: MutableList<TempBasalProcessDTO> = medtronicHistoryData.createTBRProcessList(tbrs, rewindRecords)
|
||||||
|
|
||||||
|
|
|
@ -2,19 +2,14 @@ package info.nightscout.androidaps.plugins.pump.medtronic.comm.history.pump
|
||||||
|
|
||||||
//import dagger.android.HasAndroidInjector
|
//import dagger.android.HasAndroidInjector
|
||||||
import info.nightscout.androidaps.TestBase
|
import info.nightscout.androidaps.TestBase
|
||||||
import info.nightscout.androidaps.plugins.bus.RxBus
|
|
||||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkUtil
|
|
||||||
import info.nightscout.androidaps.plugins.pump.common.utils.ByteUtil
|
import info.nightscout.androidaps.plugins.pump.common.utils.ByteUtil
|
||||||
import info.nightscout.androidaps.plugins.pump.medtronic.comm.history.RawHistoryPage
|
import info.nightscout.androidaps.plugins.pump.medtronic.comm.history.RawHistoryPage
|
||||||
import info.nightscout.androidaps.plugins.pump.medtronic.defs.MedtronicDeviceType
|
import info.nightscout.androidaps.plugins.pump.medtronic.defs.MedtronicDeviceType
|
||||||
import info.nightscout.androidaps.plugins.pump.medtronic.driver.MedtronicPumpStatus
|
import info.nightscout.androidaps.plugins.pump.medtronic.driver.MedtronicPumpStatus
|
||||||
import info.nightscout.androidaps.plugins.pump.medtronic.util.MedtronicUtil
|
import info.nightscout.androidaps.plugins.pump.medtronic.util.MedtronicUtil
|
||||||
import info.nightscout.androidaps.utils.rx.TestAapsSchedulers
|
|
||||||
import org.junit.Assert
|
import org.junit.Assert
|
||||||
import org.junit.Before
|
import org.junit.Before
|
||||||
import org.junit.Ignore
|
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
import org.mockito.Mock
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by andy on 11/1/18.
|
* Created by andy on 11/1/18.
|
||||||
|
@ -28,17 +23,17 @@ class MedtronicPumpHistoryDecoderUTest : TestBase() {
|
||||||
//@Mock lateinit var rileyLinkUtil: RileyLinkUtil
|
//@Mock lateinit var rileyLinkUtil: RileyLinkUtil
|
||||||
//@Mock lateinit var sp: SP
|
//@Mock lateinit var sp: SP
|
||||||
|
|
||||||
private var medtronicPumpStatus: MedtronicPumpStatus? = null
|
private lateinit var medtronicPumpStatus: MedtronicPumpStatus
|
||||||
|
|
||||||
//private var medtronicUtil: MedtronicUtil? = null
|
//private var medtronicUtil: MedtronicUtil? = null
|
||||||
//private var decoder: MedtronicPumpHistoryDecoder? = null
|
//private var decoder: MedtronicPumpHistoryDecoder? = null
|
||||||
var rxBusWrapper = RxBus(TestAapsSchedulers(), aapsLogger)
|
|
||||||
|
|
||||||
@Before fun setup() {
|
@Before fun setup() {
|
||||||
medtronicPumpStatus =
|
medtronicPumpStatus =
|
||||||
MedtronicPumpStatus(rh, sp, rxBusWrapper, rileyLinkUtil)
|
MedtronicPumpStatus(rh, sp, rxBus, rileyLinkUtil)
|
||||||
medtronicUtil =
|
medtronicUtil =
|
||||||
MedtronicUtil(aapsLogger, rxBusWrapper, rileyLinkUtil, medtronicPumpStatus!!)
|
MedtronicUtil(aapsLogger, rxBus, rileyLinkUtil, medtronicPumpStatus)
|
||||||
decoder = MedtronicPumpHistoryDecoder(aapsLogger, medtronicUtil!!, ByteUtil())
|
decoder = MedtronicPumpHistoryDecoder(aapsLogger, medtronicUtil, ByteUtil())
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -191,12 +186,11 @@ class MedtronicPumpHistoryDecoderUTest : TestBase() {
|
||||||
): List<PumpHistoryEntry> {
|
): List<PumpHistoryEntry> {
|
||||||
val historyPageData = ByteUtil.createByteArrayFromString(historyPageString)
|
val historyPageData = ByteUtil.createByteArrayFromString(historyPageString)
|
||||||
aapsLogger.debug("History Page Length:" + historyPageData.size)
|
aapsLogger.debug("History Page Length:" + historyPageData.size)
|
||||||
medtronicUtil!!.medtronicPumpModel = medtronicDeviceType
|
medtronicUtil.medtronicPumpModel = medtronicDeviceType
|
||||||
medtronicUtil!!.isModelSet = true
|
medtronicUtil.isModelSet = true
|
||||||
val historyPage = RawHistoryPage(aapsLogger)
|
val historyPage = RawHistoryPage(aapsLogger)
|
||||||
historyPage.appendData(historyPageData)
|
historyPage.appendData(historyPageData)
|
||||||
val pumpHistoryEntries: List<PumpHistoryEntry> =
|
val pumpHistoryEntries: List<PumpHistoryEntry> = decoder.processPageAndCreateRecords(historyPage)
|
||||||
decoder!!.processPageAndCreateRecords(historyPage)
|
|
||||||
displayHistoryRecords(pumpHistoryEntries)
|
displayHistoryRecords(pumpHistoryEntries)
|
||||||
return pumpHistoryEntries
|
return pumpHistoryEntries
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,70 +1,37 @@
|
||||||
package info.nightscout.androidaps.plugins.pump.medtronic.data
|
package info.nightscout.androidaps.plugins.pump.medtronic.data
|
||||||
|
|
||||||
import java.lang.reflect.Type
|
|
||||||
import com.google.gson.reflect.TypeToken
|
|
||||||
import com.google.gson.Gson
|
import com.google.gson.Gson
|
||||||
import com.google.gson.internal.LinkedTreeMap
|
import com.google.gson.internal.LinkedTreeMap
|
||||||
// import dagger.android.AndroidInjector
|
import com.google.gson.reflect.TypeToken
|
||||||
// import dagger.android.HasAndroidInjector
|
|
||||||
import info.nightscout.androidaps.TestBase
|
import info.nightscout.androidaps.TestBase
|
||||||
import info.nightscout.androidaps.interfaces.ActivePlugin
|
|
||||||
import info.nightscout.androidaps.interfaces.PumpSync
|
|
||||||
import info.nightscout.androidaps.plugins.bus.RxBus
|
|
||||||
import info.nightscout.androidaps.plugins.pump.common.sync.PumpSyncStorage
|
|
||||||
import info.nightscout.androidaps.plugins.pump.medtronic.comm.history.pump.MedtronicPumpHistoryDecoder
|
import info.nightscout.androidaps.plugins.pump.medtronic.comm.history.pump.MedtronicPumpHistoryDecoder
|
||||||
import info.nightscout.androidaps.plugins.pump.medtronic.comm.history.pump.PumpHistoryEntry
|
import info.nightscout.androidaps.plugins.pump.medtronic.comm.history.pump.PumpHistoryEntry
|
||||||
import info.nightscout.androidaps.plugins.pump.medtronic.data.dto.TempBasalPair
|
import info.nightscout.androidaps.plugins.pump.medtronic.data.dto.TempBasalPair
|
||||||
import info.nightscout.androidaps.plugins.pump.medtronic.driver.MedtronicPumpStatus
|
import info.nightscout.androidaps.plugins.pump.medtronic.driver.MedtronicPumpStatus
|
||||||
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.shared.sharedPreferences.SP
|
|
||||||
import org.junit.Before
|
import org.junit.Before
|
||||||
import org.junit.Ignore
|
|
||||||
|
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
import org.mockito.Mock
|
import org.mockito.Mock
|
||||||
|
import java.lang.reflect.Type
|
||||||
|
|
||||||
@Suppress("UNCHECKED_CAST")
|
@Suppress("UNCHECKED_CAST")
|
||||||
class MedtronicHistoryDataUTest : TestBase() {
|
class MedtronicHistoryDataUTest : TestBase() {
|
||||||
|
|
||||||
//@Mock lateinit var activePlugin: ActivePlugin
|
|
||||||
//@Mock lateinit var medtronicUtil: MedtronicUtil
|
|
||||||
//@Mock lateinit var medtronicPumpHistoryDecoder: MedtronicPumpHistoryDecoder
|
|
||||||
@Mock lateinit var medtronicPumpStatus: MedtronicPumpStatus
|
@Mock lateinit var medtronicPumpStatus: MedtronicPumpStatus
|
||||||
// @Mock lateinit var pumpSync: PumpSync
|
|
||||||
// @Mock lateinit var pumpSyncStorage: PumpSyncStorage
|
|
||||||
|
|
||||||
//@Mock lateinit var rxBus: RxBus
|
|
||||||
|
|
||||||
// val packetInjector = HasAndroidInjector {
|
|
||||||
// AndroidInjector {
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
fun setUp() {
|
fun setUp() {
|
||||||
medtronicUtil = MedtronicUtil(
|
medtronicUtil = MedtronicUtil(aapsLogger, rxBus, rileyLinkUtil, medtronicPumpStatus)
|
||||||
aapsLogger, rxBus, rileyLinkUtil,
|
decoder = MedtronicPumpHistoryDecoder(aapsLogger, medtronicUtil, byteUtil)
|
||||||
medtronicPumpStatus
|
|
||||||
)
|
|
||||||
|
|
||||||
decoder = MedtronicPumpHistoryDecoder(
|
|
||||||
aapsLogger,
|
|
||||||
medtronicUtil, byteUtil
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun createTBRProcessList() {
|
fun createTBRProcessList() {
|
||||||
|
|
||||||
var unitToTest = MedtronicHistoryData(packetInjector, aapsLogger, sp, rh, rxBus, activePlugin,
|
val unitToTest = MedtronicHistoryData(
|
||||||
medtronicUtil, decoder,
|
packetInjector, aapsLogger, sp, rh, rxBus, activePlugin,
|
||||||
medtronicPumpStatus,
|
medtronicUtil, decoder, medtronicPumpStatus, pumpSync, pumpSyncStorage
|
||||||
pumpSync,
|
)
|
||||||
pumpSyncStorage)
|
|
||||||
|
|
||||||
val gson = Gson()
|
val gson = Gson()
|
||||||
|
|
||||||
|
@ -74,26 +41,26 @@ class MedtronicHistoryDataUTest : TestBase() {
|
||||||
val yourClassList: MutableList<PumpHistoryEntry> = gson.fromJson(fileText, listType)
|
val yourClassList: MutableList<PumpHistoryEntry> = gson.fromJson(fileText, listType)
|
||||||
|
|
||||||
for (pumpHistoryEntry in yourClassList) {
|
for (pumpHistoryEntry in yourClassList) {
|
||||||
val stringObject = pumpHistoryEntry.decodedData["Object"] as LinkedTreeMap<String,Object>
|
val stringObject = pumpHistoryEntry.decodedData["Object"] as LinkedTreeMap<String, Any>
|
||||||
|
|
||||||
val rate : Double = stringObject.get("insulinRate") as Double
|
val rate: Double = stringObject["insulinRate"] as Double
|
||||||
val durationMinutes: Double = stringObject.get("durationMinutes") as Double
|
val durationMinutes: Double = stringObject["durationMinutes"] as Double
|
||||||
val durationMinutesInt : Int = durationMinutes.toInt()
|
val durationMinutesInt: Int = durationMinutes.toInt()
|
||||||
|
|
||||||
var tmbPair = TempBasalPair(rate, false, durationMinutesInt)
|
val tmbPair = TempBasalPair(rate, false, durationMinutesInt)
|
||||||
|
|
||||||
pumpHistoryEntry.decodedData.remove("Object")
|
pumpHistoryEntry.decodedData.remove("Object")
|
||||||
pumpHistoryEntry.addDecodedData("Object", tmbPair)
|
pumpHistoryEntry.addDecodedData("Object", tmbPair)
|
||||||
}
|
}
|
||||||
|
|
||||||
System.out.println("TBR Pre-Process List: " + gson.toJson(yourClassList))
|
println("TBR Pre-Process List: " + gson.toJson(yourClassList))
|
||||||
|
|
||||||
val createTBRProcessList = unitToTest.createTBRProcessList(yourClassList, mutableListOf())
|
val createTBRProcessList = unitToTest.createTBRProcessList(yourClassList, mutableListOf())
|
||||||
|
|
||||||
System.out.println("TBR Process List: " + createTBRProcessList.size)
|
println("TBR Process List: " + createTBRProcessList.size)
|
||||||
|
|
||||||
for (tempBasalProcessDTO in createTBRProcessList) {
|
for (tempBasalProcessDTO in createTBRProcessList) {
|
||||||
System.out.println(tempBasalProcessDTO.toTreatmentString())
|
println(tempBasalProcessDTO.toTreatmentString())
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -101,11 +68,13 @@ class MedtronicHistoryDataUTest : TestBase() {
|
||||||
@Test
|
@Test
|
||||||
fun createTBRProcessList_SpecialCase() {
|
fun createTBRProcessList_SpecialCase() {
|
||||||
|
|
||||||
var unitToTest = MedtronicHistoryData(packetInjector, aapsLogger, sp, rh, rxBus, activePlugin,
|
val unitToTest = MedtronicHistoryData(
|
||||||
medtronicUtil, decoder,
|
packetInjector, aapsLogger, sp, rh, rxBus, activePlugin,
|
||||||
medtronicPumpStatus,
|
medtronicUtil, decoder,
|
||||||
pumpSync,
|
medtronicPumpStatus,
|
||||||
pumpSyncStorage)
|
pumpSync,
|
||||||
|
pumpSyncStorage
|
||||||
|
)
|
||||||
|
|
||||||
val gson = Gson()
|
val gson = Gson()
|
||||||
|
|
||||||
|
@ -115,26 +84,26 @@ class MedtronicHistoryDataUTest : TestBase() {
|
||||||
val yourClassList: MutableList<PumpHistoryEntry> = gson.fromJson(fileText, listType)
|
val yourClassList: MutableList<PumpHistoryEntry> = gson.fromJson(fileText, listType)
|
||||||
|
|
||||||
for (pumpHistoryEntry in yourClassList) {
|
for (pumpHistoryEntry in yourClassList) {
|
||||||
val stringObject = pumpHistoryEntry.decodedData["Object"] as LinkedTreeMap<String,Object>
|
val stringObject = pumpHistoryEntry.decodedData["Object"] as LinkedTreeMap<String, Any>
|
||||||
|
|
||||||
val rate : Double = stringObject.get("insulinRate") as Double
|
val rate: Double = stringObject["insulinRate"] as Double
|
||||||
val durationMinutes: Double = stringObject.get("durationMinutes") as Double
|
val durationMinutes: Double = stringObject["durationMinutes"] as Double
|
||||||
val durationMinutesInt : Int = durationMinutes.toInt()
|
val durationMinutesInt: Int = durationMinutes.toInt()
|
||||||
|
|
||||||
var tmbPair = TempBasalPair(rate, false, durationMinutesInt)
|
val tmbPair = TempBasalPair(rate, false, durationMinutesInt)
|
||||||
|
|
||||||
pumpHistoryEntry.decodedData.remove("Object")
|
pumpHistoryEntry.decodedData.remove("Object")
|
||||||
pumpHistoryEntry.addDecodedData("Object", tmbPair)
|
pumpHistoryEntry.addDecodedData("Object", tmbPair)
|
||||||
}
|
}
|
||||||
|
|
||||||
System.out.println("TBR Pre-Process List (Special): " + gson.toJson(yourClassList))
|
println("TBR Pre-Process List (Special): " + gson.toJson(yourClassList))
|
||||||
|
|
||||||
val createTBRProcessList = unitToTest.createTBRProcessList(yourClassList, mutableListOf())
|
val createTBRProcessList = unitToTest.createTBRProcessList(yourClassList, mutableListOf())
|
||||||
|
|
||||||
System.out.println("TBR Process List (Special): " + createTBRProcessList.size)
|
println("TBR Process List (Special): " + createTBRProcessList.size)
|
||||||
|
|
||||||
for (tempBasalProcessDTO in createTBRProcessList) {
|
for (tempBasalProcessDTO in createTBRProcessList) {
|
||||||
System.out.println(tempBasalProcessDTO.toTreatmentString())
|
println(tempBasalProcessDTO.toTreatmentString())
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package info.nightscout.androidaps.plugins.pump.omnipod.common.dagger
|
package info.nightscout.androidaps.plugins.pump.omnipod.common.di
|
||||||
|
|
||||||
import androidx.lifecycle.ViewModel
|
import androidx.lifecycle.ViewModel
|
||||||
import androidx.lifecycle.ViewModelProvider
|
import androidx.lifecycle.ViewModelProvider
|
|
@ -1,4 +1,4 @@
|
||||||
package info.nightscout.androidaps.plugins.pump.omnipod.common.dagger
|
package info.nightscout.androidaps.plugins.pump.omnipod.common.di
|
||||||
|
|
||||||
import androidx.lifecycle.ViewModel
|
import androidx.lifecycle.ViewModel
|
||||||
import androidx.lifecycle.ViewModelProvider
|
import androidx.lifecycle.ViewModelProvider
|
|
@ -5,7 +5,7 @@ import androidx.annotation.IdRes
|
||||||
import androidx.fragment.app.viewModels
|
import androidx.fragment.app.viewModels
|
||||||
import androidx.lifecycle.ViewModelProvider
|
import androidx.lifecycle.ViewModelProvider
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.common.R
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.R
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.common.dagger.OmnipodPluginQualifier
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.di.OmnipodPluginQualifier
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.activation.viewmodel.action.InitializePodViewModel
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.activation.viewmodel.action.InitializePodViewModel
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ import androidx.annotation.IdRes
|
||||||
import androidx.fragment.app.viewModels
|
import androidx.fragment.app.viewModels
|
||||||
import androidx.lifecycle.ViewModelProvider
|
import androidx.lifecycle.ViewModelProvider
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.common.R
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.R
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.common.dagger.OmnipodPluginQualifier
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.di.OmnipodPluginQualifier
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.activation.viewmodel.action.InsertCannulaViewModel
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.activation.viewmodel.action.InsertCannulaViewModel
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ import androidx.fragment.app.viewModels
|
||||||
import androidx.lifecycle.ViewModelProvider
|
import androidx.lifecycle.ViewModelProvider
|
||||||
import androidx.navigation.fragment.findNavController
|
import androidx.navigation.fragment.findNavController
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.common.R
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.R
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.common.dagger.OmnipodPluginQualifier
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.di.OmnipodPluginQualifier
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.activation.viewmodel.info.AttachPodViewModel
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.activation.viewmodel.info.AttachPodViewModel
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.common.fragment.InfoFragmentBase
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.common.fragment.InfoFragmentBase
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
|
@ -4,7 +4,7 @@ import android.os.Bundle
|
||||||
import androidx.annotation.IdRes
|
import androidx.annotation.IdRes
|
||||||
import androidx.fragment.app.viewModels
|
import androidx.fragment.app.viewModels
|
||||||
import androidx.lifecycle.ViewModelProvider
|
import androidx.lifecycle.ViewModelProvider
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.common.dagger.OmnipodPluginQualifier
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.di.OmnipodPluginQualifier
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.activation.viewmodel.info.PodActivatedViewModel
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.activation.viewmodel.info.PodActivatedViewModel
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.common.fragment.InfoFragmentBase
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.common.fragment.InfoFragmentBase
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
|
@ -5,7 +5,7 @@ import androidx.annotation.IdRes
|
||||||
import androidx.fragment.app.viewModels
|
import androidx.fragment.app.viewModels
|
||||||
import androidx.lifecycle.ViewModelProvider
|
import androidx.lifecycle.ViewModelProvider
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.common.R
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.R
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.common.dagger.OmnipodPluginQualifier
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.di.OmnipodPluginQualifier
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.activation.viewmodel.info.StartPodActivationViewModel
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.activation.viewmodel.info.StartPodActivationViewModel
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.common.fragment.InfoFragmentBase
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.common.fragment.InfoFragmentBase
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
|
@ -9,7 +9,7 @@ import androidx.fragment.app.viewModels
|
||||||
import androidx.lifecycle.ViewModelProvider
|
import androidx.lifecycle.ViewModelProvider
|
||||||
import androidx.navigation.fragment.findNavController
|
import androidx.navigation.fragment.findNavController
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.common.R
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.R
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.common.dagger.OmnipodPluginQualifier
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.di.OmnipodPluginQualifier
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.common.fragment.ActionFragmentBase
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.common.fragment.ActionFragmentBase
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.deactivation.viewmodel.action.DeactivatePodViewModel
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.deactivation.viewmodel.action.DeactivatePodViewModel
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
|
@ -4,7 +4,7 @@ import android.os.Bundle
|
||||||
import androidx.annotation.IdRes
|
import androidx.annotation.IdRes
|
||||||
import androidx.fragment.app.viewModels
|
import androidx.fragment.app.viewModels
|
||||||
import androidx.lifecycle.ViewModelProvider
|
import androidx.lifecycle.ViewModelProvider
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.common.dagger.OmnipodPluginQualifier
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.di.OmnipodPluginQualifier
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.common.fragment.InfoFragmentBase
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.common.fragment.InfoFragmentBase
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.deactivation.viewmodel.info.PodDeactivatedViewModel
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.deactivation.viewmodel.info.PodDeactivatedViewModel
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
|
@ -4,7 +4,7 @@ import android.os.Bundle
|
||||||
import androidx.annotation.IdRes
|
import androidx.annotation.IdRes
|
||||||
import androidx.fragment.app.viewModels
|
import androidx.fragment.app.viewModels
|
||||||
import androidx.lifecycle.ViewModelProvider
|
import androidx.lifecycle.ViewModelProvider
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.common.dagger.OmnipodPluginQualifier
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.di.OmnipodPluginQualifier
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.common.fragment.InfoFragmentBase
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.common.fragment.InfoFragmentBase
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.deactivation.viewmodel.info.PodDiscardedViewModel
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.deactivation.viewmodel.info.PodDiscardedViewModel
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
|
@ -5,7 +5,7 @@ import androidx.annotation.IdRes
|
||||||
import androidx.fragment.app.viewModels
|
import androidx.fragment.app.viewModels
|
||||||
import androidx.lifecycle.ViewModelProvider
|
import androidx.lifecycle.ViewModelProvider
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.common.R
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.R
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.common.dagger.OmnipodPluginQualifier
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.di.OmnipodPluginQualifier
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.common.fragment.InfoFragmentBase
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.common.fragment.InfoFragmentBase
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.deactivation.viewmodel.info.StartPodDeactivationViewModel
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.deactivation.viewmodel.info.StartPodDeactivationViewModel
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package info.nightscout.androidaps.plugins.pump.omnipod.dash.dagger
|
package info.nightscout.androidaps.plugins.pump.omnipod.dash.di
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import dagger.Module
|
import dagger.Module
|
|
@ -1,10 +1,10 @@
|
||||||
package info.nightscout.androidaps.plugins.pump.omnipod.dash.dagger
|
package info.nightscout.androidaps.plugins.pump.omnipod.dash.di
|
||||||
|
|
||||||
import dagger.Binds
|
import dagger.Binds
|
||||||
import dagger.Module
|
import dagger.Module
|
||||||
import dagger.android.ContributesAndroidInjector
|
import dagger.android.ContributesAndroidInjector
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.common.dagger.ActivityScope
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.di.ActivityScope
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.common.dagger.OmnipodWizardModule
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.di.OmnipodWizardModule
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.OmnipodDashManager
|
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.OmnipodDashManager
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.OmnipodDashManagerImpl
|
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.OmnipodDashManagerImpl
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.comm.OmnipodDashBleManager
|
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.comm.OmnipodDashBleManager
|
|
@ -1,11 +1,11 @@
|
||||||
package info.nightscout.androidaps.plugins.pump.omnipod.dash.dagger
|
package info.nightscout.androidaps.plugins.pump.omnipod.dash.di
|
||||||
|
|
||||||
import androidx.lifecycle.ViewModel
|
import androidx.lifecycle.ViewModel
|
||||||
import dagger.Binds
|
import dagger.Binds
|
||||||
import dagger.Module
|
import dagger.Module
|
||||||
import dagger.multibindings.IntoMap
|
import dagger.multibindings.IntoMap
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.common.dagger.OmnipodPluginQualifier
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.di.OmnipodPluginQualifier
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.common.dagger.ViewModelKey
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.di.ViewModelKey
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.activation.viewmodel.action.InitializePodViewModel
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.activation.viewmodel.action.InitializePodViewModel
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.activation.viewmodel.action.InsertCannulaViewModel
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.activation.viewmodel.action.InsertCannulaViewModel
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.activation.viewmodel.info.AttachPodViewModel
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.activation.viewmodel.info.AttachPodViewModel
|
|
@ -1,4 +1,4 @@
|
||||||
package info.nightscout.androidaps.plugins.pump.omnipod.eros.dagger
|
package info.nightscout.androidaps.plugins.pump.omnipod.eros.di
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import dagger.Module
|
import dagger.Module
|
|
@ -1,10 +1,10 @@
|
||||||
package info.nightscout.androidaps.plugins.pump.omnipod.eros.dagger
|
package info.nightscout.androidaps.plugins.pump.omnipod.eros.di
|
||||||
|
|
||||||
import dagger.Module
|
import dagger.Module
|
||||||
import dagger.Provides
|
import dagger.Provides
|
||||||
import dagger.android.ContributesAndroidInjector
|
import dagger.android.ContributesAndroidInjector
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.common.dagger.ActivityScope
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.di.ActivityScope
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.common.dagger.OmnipodWizardModule
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.di.OmnipodWizardModule
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.eros.data.RLHistoryItemOmnipod
|
import info.nightscout.androidaps.plugins.pump.omnipod.eros.data.RLHistoryItemOmnipod
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.manager.ErosPodStateManager
|
import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.manager.ErosPodStateManager
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.eros.manager.AapsErosPodStateManager
|
import info.nightscout.androidaps.plugins.pump.omnipod.eros.manager.AapsErosPodStateManager
|
|
@ -1,11 +1,11 @@
|
||||||
package info.nightscout.androidaps.plugins.pump.omnipod.eros.dagger
|
package info.nightscout.androidaps.plugins.pump.omnipod.eros.di
|
||||||
|
|
||||||
import androidx.lifecycle.ViewModel
|
import androidx.lifecycle.ViewModel
|
||||||
import dagger.Binds
|
import dagger.Binds
|
||||||
import dagger.Module
|
import dagger.Module
|
||||||
import dagger.multibindings.IntoMap
|
import dagger.multibindings.IntoMap
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.common.dagger.OmnipodPluginQualifier
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.di.OmnipodPluginQualifier
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.common.dagger.ViewModelKey
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.di.ViewModelKey
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.activation.viewmodel.action.InitializePodViewModel
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.activation.viewmodel.action.InitializePodViewModel
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.activation.viewmodel.action.InsertCannulaViewModel
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.activation.viewmodel.action.InsertCannulaViewModel
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.activation.viewmodel.info.AttachPodViewModel
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.activation.viewmodel.info.AttachPodViewModel
|
|
@ -69,7 +69,7 @@ public class RileyLinkOmnipodService extends RileyLinkService {
|
||||||
rileyLinkServiceData.rileyLinkAddress = sp.getString(RileyLinkConst.Prefs.RileyLinkAddress, "");
|
rileyLinkServiceData.rileyLinkAddress = sp.getString(RileyLinkConst.Prefs.RileyLinkAddress, "");
|
||||||
rileyLinkServiceData.rileyLinkName = sp.getString(RileyLinkConst.Prefs.RileyLinkName, "");
|
rileyLinkServiceData.rileyLinkName = sp.getString(RileyLinkConst.Prefs.RileyLinkName, "");
|
||||||
|
|
||||||
rfspy.startReader();
|
rfSpy.startReader();
|
||||||
|
|
||||||
aapsLogger.debug(LTag.PUMPBTCOMM, "RileyLinkOmnipodService newly constructed");
|
aapsLogger.debug(LTag.PUMPBTCOMM, "RileyLinkOmnipodService newly constructed");
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package info.nightscout.androidaps.plugins.pump.omnipod.eros.ui
|
package info.nightscout.androidaps.plugins.pump.omnipod.eros.ui
|
||||||
|
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.graphics.Color
|
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.os.Handler
|
import android.os.Handler
|
||||||
import android.os.HandlerThread
|
import android.os.HandlerThread
|
||||||
|
@ -15,6 +14,7 @@ import info.nightscout.androidaps.activities.ErrorHelperActivity
|
||||||
import info.nightscout.androidaps.events.EventPreferenceChange
|
import info.nightscout.androidaps.events.EventPreferenceChange
|
||||||
import info.nightscout.androidaps.interfaces.ActivePlugin
|
import info.nightscout.androidaps.interfaces.ActivePlugin
|
||||||
import info.nightscout.androidaps.interfaces.CommandQueue
|
import info.nightscout.androidaps.interfaces.CommandQueue
|
||||||
|
import info.nightscout.androidaps.interfaces.ResourceHelper
|
||||||
import info.nightscout.androidaps.plugins.bus.RxBus
|
import info.nightscout.androidaps.plugins.bus.RxBus
|
||||||
import info.nightscout.androidaps.plugins.general.overview.events.EventDismissNotification
|
import info.nightscout.androidaps.plugins.general.overview.events.EventDismissNotification
|
||||||
import info.nightscout.androidaps.plugins.general.overview.notifications.Notification
|
import info.nightscout.androidaps.plugins.general.overview.notifications.Notification
|
||||||
|
@ -48,10 +48,9 @@ import info.nightscout.androidaps.utils.DateUtil
|
||||||
import info.nightscout.androidaps.utils.FabricPrivacy
|
import info.nightscout.androidaps.utils.FabricPrivacy
|
||||||
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
|
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
|
||||||
import info.nightscout.androidaps.utils.protection.ProtectionCheck
|
import info.nightscout.androidaps.utils.protection.ProtectionCheck
|
||||||
import info.nightscout.androidaps.interfaces.ResourceHelper
|
|
||||||
import info.nightscout.androidaps.utils.rx.AapsSchedulers
|
import info.nightscout.androidaps.utils.rx.AapsSchedulers
|
||||||
import info.nightscout.shared.sharedPreferences.SP
|
|
||||||
import info.nightscout.androidaps.utils.ui.UIRunnable
|
import info.nightscout.androidaps.utils.ui.UIRunnable
|
||||||
|
import info.nightscout.shared.sharedPreferences.SP
|
||||||
import io.reactivex.rxjava3.disposables.CompositeDisposable
|
import io.reactivex.rxjava3.disposables.CompositeDisposable
|
||||||
import io.reactivex.rxjava3.kotlin.plusAssign
|
import io.reactivex.rxjava3.kotlin.plusAssign
|
||||||
import org.apache.commons.lang3.StringUtils
|
import org.apache.commons.lang3.StringUtils
|
||||||
|
@ -59,7 +58,6 @@ import org.joda.time.DateTime
|
||||||
import org.joda.time.Duration
|
import org.joda.time.Duration
|
||||||
import java.util.*
|
import java.util.*
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
import kotlin.collections.ArrayList
|
|
||||||
|
|
||||||
class OmnipodErosOverviewFragment : DaggerFragment() {
|
class OmnipodErosOverviewFragment : DaggerFragment() {
|
||||||
companion object {
|
companion object {
|
||||||
|
@ -96,17 +94,17 @@ class OmnipodErosOverviewFragment : DaggerFragment() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var _binding: OmnipodErosOverviewBinding? = null
|
private var _binding: OmnipodErosOverviewBinding? = null
|
||||||
var _rileyLinkStatusBinding: OmnipodErosOverviewRileyLinkStatusBinding? = null
|
private var _rileyLinkStatusBinding: OmnipodErosOverviewRileyLinkStatusBinding? = null
|
||||||
var _podInfoBinding: OmnipodCommonOverviewPodInfoBinding? = null
|
private var _podInfoBinding: OmnipodCommonOverviewPodInfoBinding? = null
|
||||||
var _buttonBinding: OmnipodCommonOverviewButtonsBinding? = null
|
private var _buttonBinding: OmnipodCommonOverviewButtonsBinding? = null
|
||||||
|
|
||||||
// These properties are only valid between onCreateView and
|
// These properties are only valid between onCreateView and
|
||||||
// onDestroyView.
|
// onDestroyView.
|
||||||
val binding get() = _binding!!
|
private val binding get() = _binding!!
|
||||||
val rileyLinkStatusBinding get() = _rileyLinkStatusBinding!!
|
private val rileyLinkStatusBinding get() = _rileyLinkStatusBinding!!
|
||||||
val podInfoBinding get() = _podInfoBinding!!
|
private val podInfoBinding get() = _podInfoBinding!!
|
||||||
val buttonBinding get() = _buttonBinding!!
|
private val buttonBinding get() = _buttonBinding!!
|
||||||
|
|
||||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View =
|
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View =
|
||||||
OmnipodErosOverviewBinding.inflate(inflater, container, false).also {
|
OmnipodErosOverviewBinding.inflate(inflater, container, false).also {
|
||||||
|
@ -256,9 +254,9 @@ class OmnipodErosOverviewFragment : DaggerFragment() {
|
||||||
|
|
||||||
val errors = ArrayList<String>()
|
val errors = ArrayList<String>()
|
||||||
if (omnipodErosPumpPlugin.rileyLinkService != null) {
|
if (omnipodErosPumpPlugin.rileyLinkService != null) {
|
||||||
val rileyLinkErrorDescription = omnipodErosPumpPlugin.rileyLinkService.errorDescription
|
val rileyLinkErrorDescription = omnipodErosPumpPlugin.rileyLinkService?.errorDescription
|
||||||
if (StringUtils.isNotEmpty(rileyLinkErrorDescription)) {
|
if (StringUtils.isNotEmpty(rileyLinkErrorDescription)) {
|
||||||
errors.add(rileyLinkErrorDescription)
|
errors.add(rileyLinkErrorDescription!!)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,10 +2,10 @@ package info.nightscout.androidaps.plugin.general.openhumans
|
||||||
|
|
||||||
import android.annotation.SuppressLint
|
import android.annotation.SuppressLint
|
||||||
import android.util.Base64
|
import android.util.Base64
|
||||||
import info.nightscout.androidaps.plugin.general.openhumans.dagger.BaseUrl
|
import info.nightscout.androidaps.plugin.general.openhumans.di.BaseUrl
|
||||||
import info.nightscout.androidaps.plugin.general.openhumans.dagger.ClientId
|
import info.nightscout.androidaps.plugin.general.openhumans.di.ClientId
|
||||||
import info.nightscout.androidaps.plugin.general.openhumans.dagger.ClientSecret
|
import info.nightscout.androidaps.plugin.general.openhumans.di.ClientSecret
|
||||||
import info.nightscout.androidaps.plugin.general.openhumans.dagger.RedirectUrl
|
import info.nightscout.androidaps.plugin.general.openhumans.di.RedirectUrl
|
||||||
import kotlinx.coroutines.ExperimentalCoroutinesApi
|
import kotlinx.coroutines.ExperimentalCoroutinesApi
|
||||||
import kotlinx.coroutines.suspendCancellableCoroutine
|
import kotlinx.coroutines.suspendCancellableCoroutine
|
||||||
import okhttp3.*
|
import okhttp3.*
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package info.nightscout.androidaps.plugin.general.openhumans.dagger
|
package info.nightscout.androidaps.plugin.general.openhumans.di
|
||||||
|
|
||||||
import androidx.lifecycle.ViewModel
|
import androidx.lifecycle.ViewModel
|
||||||
import androidx.lifecycle.ViewModelProvider
|
import androidx.lifecycle.ViewModelProvider
|
|
@ -1,4 +1,4 @@
|
||||||
package info.nightscout.androidaps.plugin.general.openhumans.dagger
|
package info.nightscout.androidaps.plugin.general.openhumans.di
|
||||||
|
|
||||||
import androidx.lifecycle.ViewModel
|
import androidx.lifecycle.ViewModel
|
||||||
import dagger.Binds
|
import dagger.Binds
|
|
@ -17,8 +17,8 @@ import com.google.android.material.appbar.MaterialToolbar
|
||||||
import com.google.android.material.button.MaterialButton
|
import com.google.android.material.button.MaterialButton
|
||||||
import dagger.android.support.DaggerAppCompatActivity
|
import dagger.android.support.DaggerAppCompatActivity
|
||||||
import info.nightscout.androidaps.plugin.general.openhumans.R
|
import info.nightscout.androidaps.plugin.general.openhumans.R
|
||||||
import info.nightscout.androidaps.plugin.general.openhumans.dagger.AuthUrl
|
import info.nightscout.androidaps.plugin.general.openhumans.di.AuthUrl
|
||||||
import info.nightscout.androidaps.plugin.general.openhumans.dagger.ViewModelFactory
|
import info.nightscout.androidaps.plugin.general.openhumans.di.ViewModelFactory
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
class OHLoginActivity : DaggerAppCompatActivity() {
|
class OHLoginActivity : DaggerAppCompatActivity() {
|
||||||
|
|
|
@ -87,7 +87,7 @@ class RileyLinkBLEConfigActivity : DaggerAppCompatActivity() {
|
||||||
sp.putString(RileyLinkConst.Prefs.RileyLinkAddress, bleAddress)
|
sp.putString(RileyLinkConst.Prefs.RileyLinkAddress, bleAddress)
|
||||||
sp.putString(RileyLinkConst.Prefs.RileyLinkName, deviceName)
|
sp.putString(RileyLinkConst.Prefs.RileyLinkName, deviceName)
|
||||||
val rileyLinkPump = activePlugin.activePump as RileyLinkPumpDevice
|
val rileyLinkPump = activePlugin.activePump as RileyLinkPumpDevice
|
||||||
rileyLinkPump.rileyLinkService.verifyConfiguration(true) // force reloading of address to assure that the RL gets reconnected (even if the address didn't change)
|
rileyLinkPump.rileyLinkService?.verifyConfiguration(true) // force reloading of address to assure that the RL gets reconnected (even if the address didn't change)
|
||||||
rileyLinkPump.triggerPumpConfigurationChangedEvent()
|
rileyLinkPump.triggerPumpConfigurationChangedEvent()
|
||||||
finish()
|
finish()
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,18 +0,0 @@
|
||||||
package info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs;
|
|
||||||
|
|
||||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.RileyLinkService;
|
|
||||||
|
|
||||||
public interface RileyLinkPumpDevice {
|
|
||||||
|
|
||||||
void setBusy(boolean busy);
|
|
||||||
|
|
||||||
void triggerPumpConfigurationChangedEvent();
|
|
||||||
|
|
||||||
RileyLinkService getRileyLinkService();
|
|
||||||
|
|
||||||
RileyLinkPumpInfo getPumpInfo();
|
|
||||||
|
|
||||||
long getLastConnectionTimeMillis();
|
|
||||||
|
|
||||||
void setLastCommunicationToNow();
|
|
||||||
}
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
package info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs
|
||||||
|
|
||||||
|
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.RileyLinkService
|
||||||
|
|
||||||
|
interface RileyLinkPumpDevice {
|
||||||
|
|
||||||
|
fun setBusy(busy: Boolean)
|
||||||
|
fun triggerPumpConfigurationChangedEvent()
|
||||||
|
val rileyLinkService: RileyLinkService?
|
||||||
|
val pumpInfo: RileyLinkPumpInfo
|
||||||
|
val lastConnectionTimeMillis: Long
|
||||||
|
fun setLastCommunicationToNow()
|
||||||
|
}
|
|
@ -1,232 +0,0 @@
|
||||||
package info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by andy on 10/23/18.
|
|
||||||
*/
|
|
||||||
|
|
||||||
import android.bluetooth.BluetoothAdapter;
|
|
||||||
import android.bluetooth.BluetoothManager;
|
|
||||||
import android.content.Context;
|
|
||||||
import android.content.Intent;
|
|
||||||
import android.content.IntentFilter;
|
|
||||||
|
|
||||||
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
|
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import javax.inject.Inject;
|
|
||||||
|
|
||||||
import dagger.android.DaggerBroadcastReceiver;
|
|
||||||
import dagger.android.HasAndroidInjector;
|
|
||||||
import info.nightscout.androidaps.interfaces.ActivePlugin;
|
|
||||||
import info.nightscout.shared.logging.AAPSLogger;
|
|
||||||
import info.nightscout.shared.logging.LTag;
|
|
||||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkConst;
|
|
||||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.defs.RileyLinkFirmwareVersion;
|
|
||||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkError;
|
|
||||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkPumpDevice;
|
|
||||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkServiceState;
|
|
||||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.tasks.DiscoverGattServicesTask;
|
|
||||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.tasks.InitializePumpManagerTask;
|
|
||||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.tasks.ServiceTask;
|
|
||||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.tasks.ServiceTaskExecutor;
|
|
||||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.tasks.WakeAndTuneTask;
|
|
||||||
import info.nightscout.shared.sharedPreferences.SP;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* I added this class outside of RileyLinkService, because for now it's very important part of RL framework and
|
|
||||||
* where we get a lot of problems. Especially merging between AAPS and RileyLinkAAPS. I might put it back at
|
|
||||||
* later time
|
|
||||||
*/
|
|
||||||
public class RileyLinkBroadcastReceiver extends DaggerBroadcastReceiver {
|
|
||||||
|
|
||||||
@Inject HasAndroidInjector injector;
|
|
||||||
@Inject SP sp;
|
|
||||||
@Inject AAPSLogger aapsLogger;
|
|
||||||
@Inject RileyLinkServiceData rileyLinkServiceData;
|
|
||||||
@Inject ServiceTaskExecutor serviceTaskExecutor;
|
|
||||||
@Inject ActivePlugin activePlugin;
|
|
||||||
|
|
||||||
RileyLinkService serviceInstance;
|
|
||||||
protected Map<String, List<String>> broadcastIdentifiers = null;
|
|
||||||
//String deviceSpecificPrefix;
|
|
||||||
|
|
||||||
public RileyLinkBroadcastReceiver(RileyLinkService serviceInstance) {
|
|
||||||
this.serviceInstance = serviceInstance;
|
|
||||||
|
|
||||||
createBroadcastIdentifiers();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private void createBroadcastIdentifiers() {
|
|
||||||
|
|
||||||
this.broadcastIdentifiers = new HashMap<>();
|
|
||||||
|
|
||||||
// Bluetooth
|
|
||||||
this.broadcastIdentifiers.put("Bluetooth", Arrays.asList( //
|
|
||||||
RileyLinkConst.Intents.BluetoothConnected, //
|
|
||||||
RileyLinkConst.Intents.BluetoothReconnected));
|
|
||||||
|
|
||||||
// TuneUp
|
|
||||||
this.broadcastIdentifiers.put("TuneUp", Arrays.asList( //
|
|
||||||
RileyLinkConst.IPC.MSG_PUMP_tunePump, //
|
|
||||||
RileyLinkConst.IPC.MSG_PUMP_quickTune));
|
|
||||||
|
|
||||||
// RileyLink
|
|
||||||
this.broadcastIdentifiers.put("RileyLink", Arrays.asList( //
|
|
||||||
RileyLinkConst.Intents.RileyLinkDisconnected, //
|
|
||||||
RileyLinkConst.Intents.RileyLinkReady, //
|
|
||||||
RileyLinkConst.Intents.RileyLinkDisconnected, //
|
|
||||||
RileyLinkConst.Intents.RileyLinkNewAddressSet, //
|
|
||||||
RileyLinkConst.Intents.RileyLinkDisconnect));
|
|
||||||
}
|
|
||||||
|
|
||||||
private RileyLinkService getServiceInstance() {
|
|
||||||
RileyLinkPumpDevice pumpDevice = (RileyLinkPumpDevice) activePlugin.getActivePump();
|
|
||||||
return pumpDevice.getRileyLinkService();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onReceive(Context context, Intent intent) {
|
|
||||||
super.onReceive(context, intent);
|
|
||||||
|
|
||||||
if (intent == null) {
|
|
||||||
aapsLogger.error(LTag.PUMPBTCOMM, "onReceive: received null intent");
|
|
||||||
} else {
|
|
||||||
String action = intent.getAction();
|
|
||||||
if (action == null) {
|
|
||||||
aapsLogger.error("onReceive: null action");
|
|
||||||
} else {
|
|
||||||
aapsLogger.debug(LTag.PUMPBTCOMM, "Received Broadcast: " + action);
|
|
||||||
|
|
||||||
if (!processBluetoothBroadcasts(action) && //
|
|
||||||
!processRileyLinkBroadcasts(action, context) && //
|
|
||||||
!processTuneUpBroadcasts(action) && //
|
|
||||||
!processApplicationSpecificBroadcasts(action, intent) //
|
|
||||||
) {
|
|
||||||
aapsLogger.error(LTag.PUMPBTCOMM, "Unhandled broadcast: action=" + action);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public void registerBroadcasts(Context context) {
|
|
||||||
|
|
||||||
IntentFilter intentFilter = new IntentFilter();
|
|
||||||
|
|
||||||
for (Map.Entry<String, List<String>> stringListEntry : broadcastIdentifiers.entrySet()) {
|
|
||||||
|
|
||||||
for (String intentKey : stringListEntry.getValue()) {
|
|
||||||
intentFilter.addAction(intentKey);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
LocalBroadcastManager.getInstance(context).registerReceiver(this, intentFilter);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private boolean processRileyLinkBroadcasts(String action, Context context) {
|
|
||||||
|
|
||||||
RileyLinkService rileyLinkService = getServiceInstance();
|
|
||||||
|
|
||||||
if (action.equals(RileyLinkConst.Intents.RileyLinkDisconnected)) {
|
|
||||||
if (((BluetoothManager)context.getSystemService(Context.BLUETOOTH_SERVICE)).getAdapter().isEnabled()) {
|
|
||||||
rileyLinkServiceData.setServiceState(RileyLinkServiceState.BluetoothError, RileyLinkError.RileyLinkUnreachable);
|
|
||||||
} else {
|
|
||||||
rileyLinkServiceData.setServiceState(RileyLinkServiceState.BluetoothError, RileyLinkError.BluetoothDisabled);
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
} else if (action.equals(RileyLinkConst.Intents.RileyLinkReady)) {
|
|
||||||
aapsLogger.warn(LTag.PUMPBTCOMM, "RileyLinkConst.Intents.RileyLinkReady");
|
|
||||||
// sendIPCNotification(RT2Const.IPC.MSG_note_WakingPump);
|
|
||||||
|
|
||||||
rileyLinkService.rileyLinkBLE.enableNotifications();
|
|
||||||
rileyLinkService.rfspy.startReader(); // call startReader from outside?
|
|
||||||
|
|
||||||
rileyLinkService.rfspy.initializeRileyLink();
|
|
||||||
String bleVersion = rileyLinkService.rfspy.getBLEVersionCached();
|
|
||||||
RileyLinkFirmwareVersion rlVersion = rileyLinkServiceData.firmwareVersion;
|
|
||||||
|
|
||||||
aapsLogger.debug(LTag.PUMPBTCOMM, "RfSpy version (BLE113): " + bleVersion);
|
|
||||||
rileyLinkService.rileyLinkServiceData.versionBLE113 = bleVersion;
|
|
||||||
|
|
||||||
// if (isLoggingEnabled())
|
|
||||||
aapsLogger.debug(LTag.PUMPBTCOMM, "RfSpy Radio version (CC110): " + rlVersion.name());
|
|
||||||
this.rileyLinkServiceData.firmwareVersion = rlVersion;
|
|
||||||
|
|
||||||
ServiceTask task = new InitializePumpManagerTask(injector, context);
|
|
||||||
serviceTaskExecutor.startTask(task);
|
|
||||||
aapsLogger.info(LTag.PUMPBTCOMM, "Announcing RileyLink open For business");
|
|
||||||
|
|
||||||
return true;
|
|
||||||
} else if (action.equals(RileyLinkConst.Intents.RileyLinkNewAddressSet)) {
|
|
||||||
String RileylinkBLEAddress = sp.getString(RileyLinkConst.Prefs.RileyLinkAddress, "");
|
|
||||||
if (RileylinkBLEAddress.equals("")) {
|
|
||||||
aapsLogger.error("No Rileylink BLE Address saved in app");
|
|
||||||
} else {
|
|
||||||
// showBusy("Configuring Service", 50);
|
|
||||||
// rileyLinkBLE.findRileyLink(RileylinkBLEAddress);
|
|
||||||
rileyLinkService.reconfigureRileyLink(RileylinkBLEAddress);
|
|
||||||
// MainApp.getServiceClientConnection().setThisRileylink(RileylinkBLEAddress);
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
} else if (action.equals(RileyLinkConst.Intents.RileyLinkDisconnect)) {
|
|
||||||
rileyLinkService.disconnectRileyLink();
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public boolean processBluetoothBroadcasts(String action) {
|
|
||||||
|
|
||||||
if (action.equals(RileyLinkConst.Intents.BluetoothConnected)) {
|
|
||||||
aapsLogger.debug(LTag.PUMPBTCOMM, "Bluetooth - Connected");
|
|
||||||
serviceTaskExecutor.startTask(new DiscoverGattServicesTask(injector));
|
|
||||||
|
|
||||||
return true;
|
|
||||||
|
|
||||||
} else if (action.equals(RileyLinkConst.Intents.BluetoothReconnected)) {
|
|
||||||
aapsLogger.debug(LTag.PUMPBTCOMM, "Bluetooth - Reconnecting");
|
|
||||||
|
|
||||||
getServiceInstance().bluetoothInit();
|
|
||||||
serviceTaskExecutor.startTask(new DiscoverGattServicesTask(injector, true));
|
|
||||||
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private boolean processTuneUpBroadcasts(String action) {
|
|
||||||
|
|
||||||
if (this.broadcastIdentifiers.get("TuneUp").contains(action)) {
|
|
||||||
if (serviceInstance.getRileyLinkTargetDevice().isTuneUpEnabled()) {
|
|
||||||
serviceTaskExecutor.startTask(new WakeAndTuneTask(injector));
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public boolean processApplicationSpecificBroadcasts(String action, Intent intent) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void unregisterBroadcasts(Context context) {
|
|
||||||
LocalBroadcastManager.getInstance(context).unregisterReceiver(this);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -0,0 +1,160 @@
|
||||||
|
package info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service
|
||||||
|
|
||||||
|
import android.bluetooth.BluetoothManager
|
||||||
|
import android.content.Context
|
||||||
|
import android.content.Intent
|
||||||
|
import android.content.IntentFilter
|
||||||
|
import android.os.Handler
|
||||||
|
import android.os.HandlerThread
|
||||||
|
import androidx.localbroadcastmanager.content.LocalBroadcastManager
|
||||||
|
import dagger.android.DaggerBroadcastReceiver
|
||||||
|
import dagger.android.HasAndroidInjector
|
||||||
|
import info.nightscout.androidaps.interfaces.ActivePlugin
|
||||||
|
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkConst
|
||||||
|
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkError
|
||||||
|
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkPumpDevice
|
||||||
|
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkServiceState
|
||||||
|
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.tasks.DiscoverGattServicesTask
|
||||||
|
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.tasks.InitializePumpManagerTask
|
||||||
|
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.tasks.ServiceTask
|
||||||
|
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.tasks.ServiceTaskExecutor
|
||||||
|
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.tasks.WakeAndTuneTask
|
||||||
|
import info.nightscout.shared.logging.AAPSLogger
|
||||||
|
import info.nightscout.shared.logging.LTag
|
||||||
|
import info.nightscout.shared.sharedPreferences.SP
|
||||||
|
import javax.inject.Inject
|
||||||
|
|
||||||
|
class RileyLinkBroadcastReceiver : DaggerBroadcastReceiver() {
|
||||||
|
|
||||||
|
@Inject lateinit var injector: HasAndroidInjector
|
||||||
|
@Inject lateinit var sp: SP
|
||||||
|
@Inject lateinit var aapsLogger: AAPSLogger
|
||||||
|
@Inject lateinit var rileyLinkServiceData: RileyLinkServiceData
|
||||||
|
@Inject lateinit var serviceTaskExecutor: ServiceTaskExecutor
|
||||||
|
@Inject lateinit var activePlugin: ActivePlugin
|
||||||
|
|
||||||
|
private var handler = Handler(HandlerThread(this::class.simpleName + "Handler").also { it.start() }.looper)
|
||||||
|
private val broadcastIdentifiers: MutableMap<String, List<String>> = HashMap()
|
||||||
|
|
||||||
|
init {
|
||||||
|
createBroadcastIdentifiers()
|
||||||
|
}
|
||||||
|
|
||||||
|
private val rileyLinkService: RileyLinkService?
|
||||||
|
get() = (activePlugin.activePump as RileyLinkPumpDevice).rileyLinkService
|
||||||
|
|
||||||
|
private fun createBroadcastIdentifiers() {
|
||||||
|
|
||||||
|
// Bluetooth
|
||||||
|
broadcastIdentifiers["Bluetooth"] = listOf(
|
||||||
|
RileyLinkConst.Intents.BluetoothConnected,
|
||||||
|
RileyLinkConst.Intents.BluetoothReconnected
|
||||||
|
)
|
||||||
|
|
||||||
|
// TuneUp
|
||||||
|
broadcastIdentifiers["TuneUp"] = listOf(
|
||||||
|
RileyLinkConst.IPC.MSG_PUMP_tunePump,
|
||||||
|
RileyLinkConst.IPC.MSG_PUMP_quickTune
|
||||||
|
)
|
||||||
|
|
||||||
|
// RileyLink
|
||||||
|
broadcastIdentifiers["RileyLink"] = listOf(
|
||||||
|
RileyLinkConst.Intents.RileyLinkDisconnected,
|
||||||
|
RileyLinkConst.Intents.RileyLinkReady,
|
||||||
|
RileyLinkConst.Intents.RileyLinkDisconnected,
|
||||||
|
RileyLinkConst.Intents.RileyLinkNewAddressSet,
|
||||||
|
RileyLinkConst.Intents.RileyLinkDisconnect
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onReceive(context: Context, intent: Intent) {
|
||||||
|
super.onReceive(context, intent)
|
||||||
|
val action = intent.action ?: return
|
||||||
|
handler.post {
|
||||||
|
aapsLogger.debug(LTag.PUMPBTCOMM, "Received Broadcast: $action")
|
||||||
|
if (!processBluetoothBroadcasts(action) && !processRileyLinkBroadcasts(action, context) && !processTuneUpBroadcasts(action))
|
||||||
|
aapsLogger.error(LTag.PUMPBTCOMM, "Unhandled broadcast: action=$action")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun registerBroadcasts(context: Context) {
|
||||||
|
val intentFilter = IntentFilter()
|
||||||
|
for ((_, value) in broadcastIdentifiers)
|
||||||
|
for (intentKey in value)
|
||||||
|
intentFilter.addAction(intentKey)
|
||||||
|
LocalBroadcastManager.getInstance(context).registerReceiver(this, intentFilter)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun unregisterBroadcasts(context: Context) {
|
||||||
|
LocalBroadcastManager.getInstance(context).unregisterReceiver(this)
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun processRileyLinkBroadcasts(action: String, context: Context): Boolean =
|
||||||
|
when (action) {
|
||||||
|
RileyLinkConst.Intents.RileyLinkDisconnected -> {
|
||||||
|
if ((context.getSystemService(Context.BLUETOOTH_SERVICE) as BluetoothManager).adapter.isEnabled)
|
||||||
|
rileyLinkServiceData.setServiceState(RileyLinkServiceState.BluetoothError, RileyLinkError.RileyLinkUnreachable)
|
||||||
|
else
|
||||||
|
rileyLinkServiceData.setServiceState(RileyLinkServiceState.BluetoothError, RileyLinkError.BluetoothDisabled)
|
||||||
|
true
|
||||||
|
}
|
||||||
|
|
||||||
|
RileyLinkConst.Intents.RileyLinkReady -> {
|
||||||
|
aapsLogger.warn(LTag.PUMPBTCOMM, "RileyLinkConst.Intents.RileyLinkReady")
|
||||||
|
// sendIPCNotification(RT2Const.IPC.MSG_note_WakingPump);
|
||||||
|
rileyLinkService?.rileyLinkBLE?.enableNotifications()
|
||||||
|
rileyLinkService?.rfSpy?.startReader() // call startReader from outside?
|
||||||
|
rileyLinkService?.rfSpy?.initializeRileyLink()
|
||||||
|
val bleVersion = rileyLinkService?.rfSpy?.bleVersionCached
|
||||||
|
val rlVersion = rileyLinkServiceData.firmwareVersion
|
||||||
|
aapsLogger.debug(LTag.PUMPBTCOMM, "RfSpy version (BLE113): $bleVersion")
|
||||||
|
rileyLinkService?.rileyLinkServiceData?.versionBLE113 = bleVersion
|
||||||
|
|
||||||
|
aapsLogger.debug(LTag.PUMPBTCOMM, "RfSpy Radio version (CC110): " + rlVersion.name)
|
||||||
|
rileyLinkServiceData.firmwareVersion = rlVersion
|
||||||
|
val task: ServiceTask = InitializePumpManagerTask(injector, context)
|
||||||
|
serviceTaskExecutor.startTask(task)
|
||||||
|
aapsLogger.info(LTag.PUMPBTCOMM, "Announcing RileyLink open For business")
|
||||||
|
true
|
||||||
|
}
|
||||||
|
|
||||||
|
RileyLinkConst.Intents.RileyLinkNewAddressSet -> {
|
||||||
|
val rileylinkBLEAddress = sp.getString(RileyLinkConst.Prefs.RileyLinkAddress, "")
|
||||||
|
if (rileylinkBLEAddress == "") {
|
||||||
|
aapsLogger.error("No Rileylink BLE Address saved in app")
|
||||||
|
} else rileyLinkService?.reconfigureRileyLink(rileylinkBLEAddress)
|
||||||
|
true
|
||||||
|
}
|
||||||
|
|
||||||
|
RileyLinkConst.Intents.RileyLinkDisconnect -> {
|
||||||
|
rileyLinkService?.disconnectRileyLink()
|
||||||
|
true
|
||||||
|
}
|
||||||
|
|
||||||
|
else -> false
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun processBluetoothBroadcasts(action: String): Boolean =
|
||||||
|
when (action) {
|
||||||
|
RileyLinkConst.Intents.BluetoothConnected -> {
|
||||||
|
aapsLogger.debug(LTag.PUMPBTCOMM, "Bluetooth - Connected")
|
||||||
|
serviceTaskExecutor.startTask(DiscoverGattServicesTask(injector))
|
||||||
|
true
|
||||||
|
}
|
||||||
|
|
||||||
|
RileyLinkConst.Intents.BluetoothReconnected -> {
|
||||||
|
aapsLogger.debug(LTag.PUMPBTCOMM, "Bluetooth - Reconnecting")
|
||||||
|
rileyLinkService?.bluetoothInit()
|
||||||
|
serviceTaskExecutor.startTask(DiscoverGattServicesTask(injector, true))
|
||||||
|
true
|
||||||
|
}
|
||||||
|
|
||||||
|
else -> false
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun processTuneUpBroadcasts(action: String): Boolean =
|
||||||
|
if (broadcastIdentifiers["TuneUp"]?.contains(action) == true) {
|
||||||
|
if (rileyLinkService?.rileyLinkTargetDevice?.isTuneUpEnabled == true) serviceTaskExecutor.startTask(WakeAndTuneTask(injector))
|
||||||
|
true
|
||||||
|
} else false
|
||||||
|
}
|
|
@ -41,18 +41,18 @@ abstract class RileyLinkService : DaggerService() {
|
||||||
@Inject lateinit var rileyLinkServiceData: RileyLinkServiceData
|
@Inject lateinit var rileyLinkServiceData: RileyLinkServiceData
|
||||||
@Inject lateinit var activePlugin: ActivePlugin
|
@Inject lateinit var activePlugin: ActivePlugin
|
||||||
@Inject lateinit var rileyLinkBLE: RileyLinkBLE // android-bluetooth management
|
@Inject lateinit var rileyLinkBLE: RileyLinkBLE // android-bluetooth management
|
||||||
@Inject lateinit var rfspy: RFSpy // interface for RL xxx Mhz radio.
|
@Inject lateinit var rfSpy: RFSpy // interface for RL xxx Mhz radio.
|
||||||
|
|
||||||
private val bluetoothAdapter: BluetoothAdapter? get() = (context.getSystemService(Context.BLUETOOTH_SERVICE) as BluetoothManager?)?.adapter
|
private val bluetoothAdapter: BluetoothAdapter? get() = (context.getSystemService(Context.BLUETOOTH_SERVICE) as BluetoothManager?)?.adapter
|
||||||
protected var mBroadcastReceiver: RileyLinkBroadcastReceiver? = null
|
protected var broadcastReceiver: RileyLinkBroadcastReceiver? = null
|
||||||
private var bluetoothStateReceiver: RileyLinkBluetoothStateReceiver? = null
|
private var bluetoothStateReceiver: RileyLinkBluetoothStateReceiver? = null
|
||||||
|
|
||||||
override fun onCreate() {
|
override fun onCreate() {
|
||||||
super.onCreate()
|
super.onCreate()
|
||||||
rileyLinkUtil.encoding = encoding
|
rileyLinkUtil.encoding = encoding
|
||||||
initRileyLinkServiceData()
|
initRileyLinkServiceData()
|
||||||
mBroadcastReceiver = RileyLinkBroadcastReceiver(this)
|
broadcastReceiver = RileyLinkBroadcastReceiver()
|
||||||
mBroadcastReceiver?.registerBroadcasts(this)
|
broadcastReceiver?.registerBroadcasts(this)
|
||||||
bluetoothStateReceiver = RileyLinkBluetoothStateReceiver()
|
bluetoothStateReceiver = RileyLinkBluetoothStateReceiver()
|
||||||
bluetoothStateReceiver?.registerBroadcasts(this)
|
bluetoothStateReceiver?.registerBroadcasts(this)
|
||||||
}
|
}
|
||||||
|
@ -80,7 +80,7 @@ abstract class RileyLinkService : DaggerService() {
|
||||||
super.onDestroy()
|
super.onDestroy()
|
||||||
|
|
||||||
rileyLinkBLE.disconnect() // dispose of Gatt (disconnect and close)
|
rileyLinkBLE.disconnect() // dispose of Gatt (disconnect and close)
|
||||||
mBroadcastReceiver?.unregisterBroadcasts(this)
|
broadcastReceiver?.unregisterBroadcasts(this)
|
||||||
bluetoothStateReceiver?.unregisterBroadcasts(this)
|
bluetoothStateReceiver?.unregisterBroadcasts(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -139,7 +139,7 @@ abstract class RileyLinkService : DaggerService() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: This needs to be run in a session so that is interruptible, has a separate thread, etc.
|
// FIXME: This needs to be run in a session so that is incorruptible, has a separate thread, etc.
|
||||||
fun doTuneUpDevice() {
|
fun doTuneUpDevice() {
|
||||||
rileyLinkServiceData.setRileyLinkServiceState(RileyLinkServiceState.TuneUpDevice)
|
rileyLinkServiceData.setRileyLinkServiceState(RileyLinkServiceState.TuneUpDevice)
|
||||||
setPumpDeviceState(PumpDeviceState.Sleeping)
|
setPumpDeviceState(PumpDeviceState.Sleeping)
|
||||||
|
@ -178,7 +178,7 @@ abstract class RileyLinkService : DaggerService() {
|
||||||
get() = rileyLinkServiceData.targetDevice
|
get() = rileyLinkServiceData.targetDevice
|
||||||
|
|
||||||
fun changeRileyLinkEncoding(encodingType: RileyLinkEncodingType?) {
|
fun changeRileyLinkEncoding(encodingType: RileyLinkEncodingType?) {
|
||||||
rfspy.setRileyLinkEncoding(encodingType)
|
rfSpy.setRileyLinkEncoding(encodingType)
|
||||||
}
|
}
|
||||||
|
|
||||||
val error: RileyLinkError?
|
val error: RileyLinkError?
|
||||||
|
|
Loading…
Reference in a new issue