Resolve warnings
This commit is contained in:
parent
33a636945e
commit
be30b3cd3d
15 changed files with 276 additions and 190 deletions
|
@ -2,6 +2,7 @@ package info.nightscout.androidaps.plugins.general.dataBroadcaster
|
|||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.content.pm.PackageManager
|
||||
import android.content.pm.ResolveInfo
|
||||
import android.os.Bundle
|
||||
import dagger.android.HasAndroidInjector
|
||||
|
@ -186,7 +187,7 @@ class DataBroadcastPlugin @Inject constructor(
|
|||
}
|
||||
|
||||
private fun sendBroadcast(intent: Intent) {
|
||||
val receivers: List<ResolveInfo> = context.packageManager.queryBroadcastReceivers(intent, 0)
|
||||
val receivers: List<ResolveInfo> = context.packageManager.queryBroadcastReceivers(intent, PackageManager.ResolveInfoFlags.of(0))
|
||||
for (resolveInfo in receivers)
|
||||
resolveInfo.activityInfo.packageName?.let {
|
||||
intent.setPackage(it)
|
||||
|
|
|
@ -8,11 +8,11 @@ import android.os.IBinder
|
|||
import dagger.android.DaggerService
|
||||
import info.nightscout.androidaps.events.EventAppExit
|
||||
import info.nightscout.androidaps.interfaces.NotificationHolder
|
||||
import info.nightscout.shared.logging.AAPSLogger
|
||||
import info.nightscout.shared.logging.LTag
|
||||
import info.nightscout.androidaps.plugins.bus.RxBus
|
||||
import info.nightscout.androidaps.utils.FabricPrivacy
|
||||
import info.nightscout.androidaps.utils.rx.AapsSchedulers
|
||||
import info.nightscout.shared.logging.AAPSLogger
|
||||
import info.nightscout.shared.logging.LTag
|
||||
import io.reactivex.rxjava3.disposables.CompositeDisposable
|
||||
import javax.inject.Inject
|
||||
|
||||
|
@ -59,7 +59,7 @@ class DummyService : DaggerService() {
|
|||
aapsLogger.debug(LTag.CORE, "onDestroy")
|
||||
disposable.clear()
|
||||
super.onDestroy()
|
||||
stopForeground(true)
|
||||
stopForeground(STOP_FOREGROUND_REMOVE)
|
||||
}
|
||||
|
||||
override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {
|
||||
|
|
|
@ -190,7 +190,7 @@ class SmsCommunicatorPlugin @Inject constructor(
|
|||
?: return Result.failure(workDataOf("Error" to "missing input data"))
|
||||
val format = bundle.getString("format")
|
||||
?: return Result.failure(workDataOf("Error" to "missing format in input data"))
|
||||
val pdus = bundle["pdus"] as Array<*>
|
||||
@Suppress("DEPRECATION") val pdus = bundle["pdus"] as Array<*>
|
||||
for (pdu in pdus) {
|
||||
val message = SmsMessage.createFromPdu(pdu as ByteArray, format)
|
||||
smsCommunicatorPlugin.processSms(Sms(message))
|
||||
|
|
|
@ -244,7 +244,7 @@ class DexcomPlugin @Inject constructor(
|
|||
|
||||
fun findDexcomPackageName(): String? {
|
||||
val packageManager = context.packageManager
|
||||
for (packageInfo in packageManager.getInstalledPackages(0)) {
|
||||
for (packageInfo in packageManager.getInstalledPackages(PackageManager.PackageInfoFlags.of(0))) {
|
||||
if (PACKAGE_NAMES.contains(packageInfo.packageName)) return packageInfo.packageName
|
||||
}
|
||||
return null
|
||||
|
|
|
@ -91,7 +91,7 @@ class IntelligoPlugin @Inject constructor(
|
|||
private fun handleNewData() {
|
||||
if (!isEnabled()) return
|
||||
|
||||
for (pack in context.packageManager.getInstalledPackages(PackageManager.GET_PROVIDERS)) {
|
||||
for (pack in context.packageManager.getInstalledPackages(PackageManager.PackageInfoFlags.of(PackageManager.GET_PROVIDERS.toLong()))) {
|
||||
val providers = pack.providers
|
||||
if (providers != null) {
|
||||
for (provider in providers) {
|
||||
|
@ -162,13 +162,13 @@ class IntelligoPlugin @Inject constructor(
|
|||
aapsLogger.debug(LTag.DATABASE, "Inserted bg $it")
|
||||
}
|
||||
savedValues.calibrationsInserted.forEach { calibration ->
|
||||
calibration.glucose?.let { glucosevalue ->
|
||||
calibration.glucose?.let { glucoseValue ->
|
||||
uel.log(
|
||||
UserEntry.Action.CALIBRATION,
|
||||
UserEntry.Sources.Dexcom,
|
||||
ValueWithUnit.Timestamp(calibration.timestamp),
|
||||
ValueWithUnit.TherapyEventType(calibration.type),
|
||||
ValueWithUnit.fromGlucoseUnit(glucosevalue, calibration.glucoseUnit.toString)
|
||||
ValueWithUnit.fromGlucoseUnit(glucoseValue, calibration.glucoseUnit.toString)
|
||||
)
|
||||
}
|
||||
aapsLogger.debug(LTag.DATABASE, "Inserted calibration $calibration")
|
||||
|
|
|
@ -9,11 +9,12 @@ import info.nightscout.androidaps.plugins.bus.RxBus
|
|||
import javax.inject.Inject
|
||||
|
||||
class BTReceiver : DaggerBroadcastReceiver() {
|
||||
|
||||
@Inject lateinit var rxBus: RxBus
|
||||
|
||||
override fun onReceive(context: Context, intent: Intent) {
|
||||
super.onReceive(context, intent)
|
||||
val device: BluetoothDevice = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE) ?: return
|
||||
val device = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE, BluetoothDevice::class.java) ?: return
|
||||
|
||||
when (intent.action) {
|
||||
BluetoothDevice.ACTION_ACL_CONNECTED ->
|
||||
|
|
|
@ -33,7 +33,7 @@ class SWHtmlLink(injector: HasAndroidInjector) : SWItem(injector, Type.HTML_LINK
|
|||
val context = layout.context
|
||||
l = TextView(context)
|
||||
l?.id = View.generateViewId()
|
||||
l?.autoLinkMask = Linkify.ALL
|
||||
l?.autoLinkMask = Linkify.WEB_URLS
|
||||
if (textLabel != null) l?.text = textLabel else l?.setText(label!!)
|
||||
layout.addView(l)
|
||||
}
|
||||
|
|
|
@ -2,22 +2,23 @@ package info.nightscout.androidaps.utils
|
|||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.content.pm.PackageManager
|
||||
import android.os.Bundle
|
||||
import info.nightscout.androidaps.R
|
||||
import info.nightscout.androidaps.annotations.OpenForTesting
|
||||
import info.nightscout.androidaps.database.entities.GlucoseValue
|
||||
import info.nightscout.androidaps.interfaces.GlucoseUnit
|
||||
import info.nightscout.androidaps.interfaces.ProfileFunction
|
||||
import info.nightscout.androidaps.interfaces.ResourceHelper
|
||||
import info.nightscout.androidaps.receivers.Intents
|
||||
import info.nightscout.shared.logging.AAPSLogger
|
||||
import info.nightscout.shared.logging.LTag
|
||||
import info.nightscout.androidaps.receivers.Intents
|
||||
import info.nightscout.androidaps.interfaces.ResourceHelper
|
||||
import info.nightscout.shared.sharedPreferences.SP
|
||||
import org.json.JSONArray
|
||||
import org.json.JSONException
|
||||
import org.json.JSONObject
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.*
|
||||
import java.util.Locale
|
||||
import javax.inject.Inject
|
||||
import javax.inject.Singleton
|
||||
|
||||
|
@ -41,7 +42,7 @@ class XDripBroadcast @Inject constructor(
|
|||
intent.putExtras(bundle)
|
||||
intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES)
|
||||
context.sendBroadcast(intent)
|
||||
val q = context.packageManager.queryBroadcastReceivers(intent, 0)
|
||||
val q = context.packageManager.queryBroadcastReceivers(intent, PackageManager.ResolveInfoFlags.of(0))
|
||||
return if (q.size < 1) {
|
||||
ToastUtils.errorToast(context, R.string.xdripnotinstalled)
|
||||
aapsLogger.debug(rh.gs(R.string.xdripnotinstalled))
|
||||
|
@ -74,7 +75,7 @@ class XDripBroadcast @Inject constructor(
|
|||
val intent = Intent(Intents.XDRIP_PLUS_NS_EMULATOR)
|
||||
intent.putExtras(bundle).addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES)
|
||||
context.sendBroadcast(intent)
|
||||
val receivers = context.packageManager.queryBroadcastReceivers(intent, 0)
|
||||
val receivers = context.packageManager.queryBroadcastReceivers(intent, PackageManager.ResolveInfoFlags.of(0))
|
||||
if (receivers.size < 1) {
|
||||
//NSUpload.log.debug("No xDrip receivers found. ")
|
||||
aapsLogger.debug(LTag.BGSOURCE, "No xDrip receivers found.")
|
||||
|
@ -150,7 +151,7 @@ class XDripBroadcast @Inject constructor(
|
|||
}
|
||||
|
||||
private fun broadcast(intent: Intent) {
|
||||
context.packageManager.queryBroadcastReceivers(intent, 0).forEach { resolveInfo ->
|
||||
context.packageManager.queryBroadcastReceivers(intent, PackageManager.ResolveInfoFlags.of(0)).forEach { resolveInfo ->
|
||||
resolveInfo.activityInfo.packageName?.let {
|
||||
intent.setPackage(it)
|
||||
context.sendBroadcast(intent)
|
||||
|
|
|
@ -15,7 +15,7 @@ class PrefsFileContract : ActivityResultContract<Void?, PrefsFile?>() {
|
|||
|
||||
override fun parseResult(resultCode: Int, intent: Intent?): PrefsFile? {
|
||||
return when (resultCode) {
|
||||
FragmentActivity.RESULT_OK -> intent?.getParcelableExtra(OUTPUT_PARAM)
|
||||
FragmentActivity.RESULT_OK -> intent?.getParcelableExtra(OUTPUT_PARAM, PrefsFile::class.java)
|
||||
else -> null
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package info.nightscout.androidaps.diaconn.packet
|
||||
|
||||
import android.content.Context
|
||||
import android.content.pm.PackageManager
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.data.DetailedBolusInfo
|
||||
import info.nightscout.androidaps.diaconn.DiaconnG8Pump
|
||||
|
@ -13,24 +14,49 @@ import info.nightscout.androidaps.diaconn.api.PumpLogDto
|
|||
import info.nightscout.androidaps.diaconn.common.RecordTypes
|
||||
import info.nightscout.androidaps.diaconn.database.DiaconnHistoryRecord
|
||||
import info.nightscout.androidaps.diaconn.database.DiaconnHistoryRecordDao
|
||||
import info.nightscout.androidaps.diaconn.pumplog.*
|
||||
import info.nightscout.androidaps.diaconn.pumplog.LOG_ALARM_BATTERY
|
||||
import info.nightscout.androidaps.diaconn.pumplog.LOG_ALARM_BLOCK
|
||||
import info.nightscout.androidaps.diaconn.pumplog.LOG_ALARM_SHORTAGE
|
||||
import info.nightscout.androidaps.diaconn.pumplog.LOG_CHANGE_INJECTOR_SUCCESS
|
||||
import info.nightscout.androidaps.diaconn.pumplog.LOG_CHANGE_NEEDLE_SUCCESS
|
||||
import info.nightscout.androidaps.diaconn.pumplog.LOG_CHANGE_TUBE_SUCCESS
|
||||
import info.nightscout.androidaps.diaconn.pumplog.LOG_INJECTION_1DAY
|
||||
import info.nightscout.androidaps.diaconn.pumplog.LOG_INJECTION_1DAY_BASAL
|
||||
import info.nightscout.androidaps.diaconn.pumplog.LOG_INJECTION_1HOUR_BASAL
|
||||
import info.nightscout.androidaps.diaconn.pumplog.LOG_INJECTION_DUAL_NORMAL
|
||||
import info.nightscout.androidaps.diaconn.pumplog.LOG_INJECT_DUAL_FAIL
|
||||
import info.nightscout.androidaps.diaconn.pumplog.LOG_INJECT_DUAL_SUCCESS
|
||||
import info.nightscout.androidaps.diaconn.pumplog.LOG_INJECT_MEAL_FAIL
|
||||
import info.nightscout.androidaps.diaconn.pumplog.LOG_INJECT_MEAL_SUCCESS
|
||||
import info.nightscout.androidaps.diaconn.pumplog.LOG_INJECT_NORMAL_FAIL
|
||||
import info.nightscout.androidaps.diaconn.pumplog.LOG_INJECT_NORMAL_SUCCESS
|
||||
import info.nightscout.androidaps.diaconn.pumplog.LOG_INJECT_SQUARE_FAIL
|
||||
import info.nightscout.androidaps.diaconn.pumplog.LOG_INJECT_SQUARE_SUCCESS
|
||||
import info.nightscout.androidaps.diaconn.pumplog.LOG_RESET_SYS_V3
|
||||
import info.nightscout.androidaps.diaconn.pumplog.LOG_SET_DUAL_INJECTION
|
||||
import info.nightscout.androidaps.diaconn.pumplog.LOG_SET_SQUARE_INJECTION
|
||||
import info.nightscout.androidaps.diaconn.pumplog.LOG_SUSPEND_RELEASE_V2
|
||||
import info.nightscout.androidaps.diaconn.pumplog.LOG_SUSPEND_V2
|
||||
import info.nightscout.androidaps.diaconn.pumplog.LOG_TB_START_V3
|
||||
import info.nightscout.androidaps.diaconn.pumplog.LOG_TB_STOP_V3
|
||||
import info.nightscout.androidaps.diaconn.pumplog.PumplogUtil
|
||||
import info.nightscout.androidaps.events.EventPumpStatusChanged
|
||||
import info.nightscout.androidaps.interfaces.ActivePlugin
|
||||
import info.nightscout.androidaps.interfaces.PumpDescription
|
||||
import info.nightscout.androidaps.interfaces.PumpSync
|
||||
import info.nightscout.androidaps.interfaces.ResourceHelper
|
||||
import info.nightscout.androidaps.plugins.bus.RxBus
|
||||
import info.nightscout.androidaps.plugins.pump.common.bolusInfo.DetailedBolusInfoStorage
|
||||
import info.nightscout.androidaps.plugins.pump.common.bolusInfo.TemporaryBasalStorage
|
||||
import info.nightscout.androidaps.plugins.pump.common.defs.PumpType
|
||||
import info.nightscout.androidaps.utils.T
|
||||
import info.nightscout.androidaps.interfaces.ResourceHelper
|
||||
import info.nightscout.shared.logging.LTag
|
||||
import info.nightscout.shared.sharedPreferences.SP
|
||||
import org.apache.commons.lang3.time.DateUtils
|
||||
import org.joda.time.DateTime
|
||||
import retrofit2.Call
|
||||
import retrofit2.Response
|
||||
import java.util.*
|
||||
import java.util.UUID
|
||||
import javax.inject.Inject
|
||||
|
||||
/**
|
||||
|
@ -39,6 +65,7 @@ import javax.inject.Inject
|
|||
class BigLogInquireResponsePacket(
|
||||
injector: HasAndroidInjector
|
||||
) : DiaconnG8Packet(injector) {
|
||||
|
||||
@Inject lateinit var rxBus: RxBus
|
||||
@Inject lateinit var rh: ResourceHelper
|
||||
@Inject lateinit var activePlugin: ActivePlugin
|
||||
|
@ -53,6 +80,7 @@ class BigLogInquireResponsePacket(
|
|||
|
||||
var result = 0// 조회결과
|
||||
private var pumpDesc = PumpDescription(PumpType.DIACONN_G8)
|
||||
|
||||
init {
|
||||
msgType = 0xb2.toByte()
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "BigLogInquireResponsePacket init")
|
||||
|
@ -74,17 +102,17 @@ class BigLogInquireResponsePacket(
|
|||
}
|
||||
val logLength = getByteToInt(bufferData) // 로그의 갯수. 1byte
|
||||
|
||||
// initalize
|
||||
val dailyMaxvalInfo = mutableMapOf<String, MutableMap<String, Double>>()
|
||||
dailyMaxvalInfo[""] = mutableMapOf()
|
||||
// initialize
|
||||
val dailyMaxValInfo = mutableMapOf<String, MutableMap<String, Double>>()
|
||||
dailyMaxValInfo[""] = mutableMapOf()
|
||||
val pumpLogs: MutableList<PumpLog> = mutableListOf()
|
||||
|
||||
// 15 byte 를 로그갯수만큼 돌기.
|
||||
for (i in 0 until logLength) {
|
||||
val wrapingCount = getByteToInt(bufferData) // 1byte
|
||||
val wrappingCount = getByteToInt(bufferData) // 1byte
|
||||
val logNum = getShortToInt(bufferData) // 2byte
|
||||
// log Data Parsing
|
||||
val logdata = byteArrayOf(
|
||||
val logData = byteArrayOf(
|
||||
PumplogUtil.getByte(bufferData),
|
||||
PumplogUtil.getByte(bufferData),
|
||||
PumplogUtil.getByte(bufferData),
|
||||
|
@ -99,8 +127,8 @@ class BigLogInquireResponsePacket(
|
|||
PumplogUtil.getByte(bufferData)
|
||||
)
|
||||
// process Log to DB
|
||||
val logDataToHexString = toNarrowHex(logdata)
|
||||
val pumplogKind: Byte = PumplogUtil.getKind(logDataToHexString)
|
||||
val logDataToHexString = toNarrowHex(logData)
|
||||
val pumpLogKind: Byte = PumplogUtil.getKind(logDataToHexString)
|
||||
var status: String
|
||||
val diaconnG8HistoryRecord = DiaconnHistoryRecord(0)
|
||||
|
||||
|
@ -109,7 +137,7 @@ class BigLogInquireResponsePacket(
|
|||
aapsLogger.debug(LTag.PUMPCOMM, "make api upload parameter")
|
||||
val pumpLog = PumpLog(
|
||||
pumplog_no = logNum.toLong(),
|
||||
pumplog_wrapping_count = wrapingCount,
|
||||
pumplog_wrapping_count = wrappingCount,
|
||||
pumplog_data = logDataToHexString,
|
||||
act_type = "1"
|
||||
)
|
||||
|
@ -118,10 +146,10 @@ class BigLogInquireResponsePacket(
|
|||
|
||||
} else {
|
||||
// APS Local history sync start
|
||||
diaconnG8Pump.apsWrappingCount = wrapingCount
|
||||
diaconnG8Pump.apsWrappingCount = wrappingCount
|
||||
diaconnG8Pump.apslastLogNum = logNum
|
||||
|
||||
when(pumplogKind) {
|
||||
when (pumpLogKind) {
|
||||
|
||||
LOG_INJECT_MEAL_SUCCESS.LOG_KIND -> {
|
||||
val logItem = LOG_INJECT_MEAL_SUCCESS.parse(logDataToHexString)
|
||||
|
@ -135,8 +163,12 @@ class BigLogInquireResponsePacket(
|
|||
type = detailedBolusInfo?.bolusType,
|
||||
pumpId = logDateTime,
|
||||
pumpType = PumpType.DIACONN_G8,
|
||||
pumpSerial = diaconnG8Pump.serialNo.toString())
|
||||
aapsLogger.debug(LTag.PUMPCOMM, (if (newRecord) "**NEW** " else "") + "EVENT MEALBOLUS (" + pumplogKind + ") " + dateUtil.dateAndTimeString(logDateTime) + " (" + logDateTime + ")" + " Bolus: " + logItem.injectAmount / 100.0 + "U ")
|
||||
pumpSerial = diaconnG8Pump.serialNo.toString()
|
||||
)
|
||||
aapsLogger.debug(
|
||||
LTag.PUMPCOMM,
|
||||
"${if (newRecord) "**NEW** " else ""}EVENT MEAL_BOLUS ($pumpLogKind) ${dateUtil.dateAndTimeString(logDateTime)} ($logDateTime) Bolus: ${logItem.injectAmount / 100.0}U "
|
||||
)
|
||||
diaconnG8HistoryRecord.code = RecordTypes.RECORD_TYPE_BOLUS
|
||||
diaconnG8HistoryRecord.timestamp = logDateTime
|
||||
diaconnG8HistoryRecord.value = logItem.injectAmount / 100.0
|
||||
|
@ -144,14 +176,14 @@ class BigLogInquireResponsePacket(
|
|||
diaconnG8HistoryRecord.bolusType = "M" // meal bolus
|
||||
diaconnG8HistoryRecord.stringValue = rh.gs(R.string.diaconn_g8_logmealsuccess)
|
||||
diaconnG8HistoryRecord.lognum = logNum
|
||||
diaconnG8HistoryRecord.wrappingCount = wrapingCount
|
||||
diaconnG8HistoryRecord.wrappingCount = wrappingCount
|
||||
diaconnG8HistoryRecord.pumpUid = diaconnG8Pump.pumpUid
|
||||
diaconnHistoryRecordDao.createOrUpdate(diaconnG8HistoryRecord)
|
||||
if (!newRecord && detailedBolusInfo != null) {
|
||||
// detailedInfo can be from another similar record. Reinsert
|
||||
detailedBolusInfoStorage.add(detailedBolusInfo)
|
||||
}
|
||||
status = "MEALBOLUSSUCCESS" + dateUtil.timeString(logDateTime)
|
||||
status = "MEAL_BOLUS_SUCCESS" + dateUtil.timeString(logDateTime)
|
||||
}
|
||||
|
||||
LOG_INJECT_MEAL_FAIL.LOG_KIND -> {
|
||||
|
@ -166,8 +198,12 @@ class BigLogInquireResponsePacket(
|
|||
type = detailedBolusInfo?.bolusType,
|
||||
pumpId = logDateTime,
|
||||
pumpType = PumpType.DIACONN_G8,
|
||||
pumpSerial = diaconnG8Pump.serialNo.toString())
|
||||
aapsLogger.debug(LTag.PUMPCOMM, (if (newRecord) "**NEW** " else "") + "EVENT MEALBOLUS (" + pumplogKind + ") " + dateUtil.dateAndTimeString(logDateTime) + " (" + logDateTime + ")" + " Bolus: " + logItem.injectAmount / 100.0 + "U ")
|
||||
pumpSerial = diaconnG8Pump.serialNo.toString()
|
||||
)
|
||||
aapsLogger.debug(
|
||||
LTag.PUMPCOMM,
|
||||
"${if (newRecord) "**NEW** " else ""}EVENT MEAL_BOLUS ($pumpLogKind) ${dateUtil.dateAndTimeString(logDateTime)} ($logDateTime) Bolus: ${logItem.injectAmount / 100.0}U "
|
||||
)
|
||||
diaconnG8HistoryRecord.code = RecordTypes.RECORD_TYPE_BOLUS
|
||||
diaconnG8HistoryRecord.timestamp = logDateTime
|
||||
diaconnG8HistoryRecord.value = if ((logItem.injectAmount / 100.0) < 0) 0.0 else (logItem.injectAmount / 100.0)
|
||||
|
@ -175,14 +211,14 @@ class BigLogInquireResponsePacket(
|
|||
diaconnG8HistoryRecord.bolusType = "M" // Meal bolus
|
||||
diaconnG8HistoryRecord.stringValue = rh.gs(R.string.diaconn_g8_logmealfail)
|
||||
diaconnG8HistoryRecord.lognum = logNum
|
||||
diaconnG8HistoryRecord.wrappingCount = wrapingCount
|
||||
diaconnG8HistoryRecord.wrappingCount = wrappingCount
|
||||
diaconnG8HistoryRecord.pumpUid = diaconnG8Pump.pumpUid
|
||||
diaconnHistoryRecordDao.createOrUpdate(diaconnG8HistoryRecord)
|
||||
if (!newRecord && detailedBolusInfo != null) {
|
||||
// detailedInfo can be from another similar record. Reinsert
|
||||
detailedBolusInfoStorage.add(detailedBolusInfo)
|
||||
}
|
||||
status = "MEALBOLUSFAIL " + dateUtil.timeString(logDateTime)
|
||||
status = "MEAL_BOLUS_FAIL " + dateUtil.timeString(logDateTime)
|
||||
}
|
||||
|
||||
LOG_INJECT_NORMAL_SUCCESS.LOG_KIND -> {
|
||||
|
@ -198,8 +234,12 @@ class BigLogInquireResponsePacket(
|
|||
type = detailedBolusInfo?.bolusType,
|
||||
pumpId = logDateTime,
|
||||
pumpType = PumpType.DIACONN_G8,
|
||||
pumpSerial = diaconnG8Pump.serialNo.toString())
|
||||
aapsLogger.debug(LTag.PUMPCOMM, (if (newRecord) "**NEW** " else "") + "EVENT BOLUS (" + pumplogKind + ") " + dateUtil.dateAndTimeString(logDateTime) + " (" + logDateTime + ")" + " Bolus: " + logItem.injectAmount / 100.0 + "U ")
|
||||
pumpSerial = diaconnG8Pump.serialNo.toString()
|
||||
)
|
||||
aapsLogger.debug(
|
||||
LTag.PUMPCOMM,
|
||||
(if (newRecord) "**NEW** " else "") + "EVENT BOLUS (" + pumpLogKind + ") " + dateUtil.dateAndTimeString(logDateTime) + " (" + logDateTime + ")" + " Bolus: " + logItem.injectAmount / 100.0 + "U "
|
||||
)
|
||||
diaconnG8HistoryRecord.code = RecordTypes.RECORD_TYPE_BOLUS
|
||||
diaconnG8HistoryRecord.timestamp = logDateTime
|
||||
diaconnG8HistoryRecord.value = logItem.injectAmount / 100.0
|
||||
|
@ -207,14 +247,14 @@ class BigLogInquireResponsePacket(
|
|||
diaconnG8HistoryRecord.bolusType = "B" // bolus
|
||||
diaconnG8HistoryRecord.stringValue = rh.gs(R.string.diaconn_g8_logsuccess)
|
||||
diaconnG8HistoryRecord.lognum = logNum
|
||||
diaconnG8HistoryRecord.wrappingCount = wrapingCount
|
||||
diaconnG8HistoryRecord.wrappingCount = wrappingCount
|
||||
diaconnG8HistoryRecord.pumpUid = diaconnG8Pump.pumpUid
|
||||
diaconnHistoryRecordDao.createOrUpdate(diaconnG8HistoryRecord)
|
||||
if (!newRecord && detailedBolusInfo != null) {
|
||||
// detailedInfo can be from another similar record. Reinsert
|
||||
detailedBolusInfoStorage.add(detailedBolusInfo)
|
||||
}
|
||||
status = "BOLUSSUCCESS" + dateUtil.timeString(logDateTime)
|
||||
status = "BOLUS_SUCCESS" + dateUtil.timeString(logDateTime)
|
||||
}
|
||||
|
||||
LOG_INJECT_NORMAL_FAIL.LOG_KIND -> {
|
||||
|
@ -231,24 +271,28 @@ class BigLogInquireResponsePacket(
|
|||
type = detailedBolusInfo?.bolusType,
|
||||
pumpId = logDateTime,
|
||||
pumpType = PumpType.DIACONN_G8,
|
||||
pumpSerial = diaconnG8Pump.serialNo.toString())
|
||||
aapsLogger.debug(LTag.PUMPCOMM, (if (newRecord) "**NEW** " else "") + "EVENT BOLUS (" + pumplogKind + ") " + dateUtil.dateAndTimeString(logDateTime) + " (" + logDateTime + ")" + " Bolus: " + logItem.injectAmount / 100.0 + "U ")
|
||||
pumpSerial = diaconnG8Pump.serialNo.toString()
|
||||
)
|
||||
aapsLogger.debug(
|
||||
LTag.PUMPCOMM,
|
||||
(if (newRecord) "**NEW** " else "") + "EVENT BOLUS (" + pumpLogKind + ") " + dateUtil.dateAndTimeString(logDateTime) + " (" + logDateTime + ")" + " Bolus: " + logItem.injectAmount / 100.0 + "U "
|
||||
)
|
||||
// Diaconn History Process
|
||||
diaconnG8HistoryRecord.code = RecordTypes.RECORD_TYPE_BOLUS
|
||||
diaconnG8HistoryRecord.timestamp = logDateTime
|
||||
diaconnG8HistoryRecord.value = if ((logItem.injectAmount / 100.0) < 0) 0.0 else (logItem.injectAmount / 100.0)
|
||||
diaconnG8HistoryRecord.duration = logItem.getInjectTime()
|
||||
diaconnG8HistoryRecord.bolusType = "B" // bolus
|
||||
diaconnG8HistoryRecord.stringValue = getReasonName(pumplogKind, logItem.reason)
|
||||
diaconnG8HistoryRecord.stringValue = getReasonName(pumpLogKind, logItem.reason)
|
||||
diaconnG8HistoryRecord.lognum = logNum
|
||||
diaconnG8HistoryRecord.wrappingCount = wrapingCount
|
||||
diaconnG8HistoryRecord.wrappingCount = wrappingCount
|
||||
diaconnG8HistoryRecord.pumpUid = diaconnG8Pump.pumpUid
|
||||
diaconnHistoryRecordDao.createOrUpdate(diaconnG8HistoryRecord)
|
||||
if (!newRecord && detailedBolusInfo != null) {
|
||||
// detailedInfo can be from another similar record. Reinsert
|
||||
detailedBolusInfoStorage.add(detailedBolusInfo)
|
||||
}
|
||||
status = "BOLUSFAIL " + dateUtil.timeString(logDateTime)
|
||||
status = "BOLUS_FAIL " + dateUtil.timeString(logDateTime)
|
||||
}
|
||||
|
||||
LOG_SET_SQUARE_INJECTION.LOG_KIND -> {
|
||||
|
@ -263,8 +307,12 @@ class BigLogInquireResponsePacket(
|
|||
isEmulatingTB = false,
|
||||
pumpId = logDateTime,
|
||||
pumpType = PumpType.DIACONN_G8,
|
||||
pumpSerial = diaconnG8Pump.serialNo.toString())
|
||||
aapsLogger.debug(LTag.PUMPCOMM, (if (newRecord) "**NEW** " else "") + "EVENT EXTENDEDSTART (" + pumplogKind + ") " + dateUtil.dateAndTimeString(logDateTime) + " (" + logDateTime + ")" + " Amount: " + logItem.setAmount / 100.0 + "U Duration: " + logItem.getInjectTime() * 10 + "min")
|
||||
pumpSerial = diaconnG8Pump.serialNo.toString()
|
||||
)
|
||||
aapsLogger.debug(
|
||||
LTag.PUMPCOMM,
|
||||
"${if (newRecord) "**NEW** " else ""}EVENT EXTENDED_START ($pumpLogKind) ${dateUtil.dateAndTimeString(logDateTime)} ($logDateTime) Amount: ${logItem.setAmount / 100.0}U Duration: ${logItem.getInjectTime() * 10}min"
|
||||
)
|
||||
diaconnG8HistoryRecord.code = RecordTypes.RECORD_TYPE_BOLUS
|
||||
diaconnG8HistoryRecord.timestamp = logDateTime
|
||||
diaconnG8HistoryRecord.value = logItem.setAmount / 100.0
|
||||
|
@ -272,10 +320,10 @@ class BigLogInquireResponsePacket(
|
|||
diaconnG8HistoryRecord.stringValue = rh.gs(R.string.diaconn_g8_logsquarestart)
|
||||
diaconnG8HistoryRecord.bolusType = "E" // Extended
|
||||
diaconnG8HistoryRecord.lognum = logNum
|
||||
diaconnG8HistoryRecord.wrappingCount = wrapingCount
|
||||
diaconnG8HistoryRecord.wrappingCount = wrappingCount
|
||||
diaconnG8HistoryRecord.pumpUid = diaconnG8Pump.pumpUid
|
||||
diaconnHistoryRecordDao.createOrUpdate(diaconnG8HistoryRecord)
|
||||
status = "EXTENDEDBOLUSSTART " + dateUtil.timeString(logDateTime)
|
||||
status = "EXTENDED_BOLUS_START " + dateUtil.timeString(logDateTime)
|
||||
}
|
||||
|
||||
LOG_INJECT_SQUARE_SUCCESS.LOG_KIND -> {
|
||||
|
@ -289,10 +337,10 @@ class BigLogInquireResponsePacket(
|
|||
diaconnG8HistoryRecord.stringValue = rh.gs(R.string.diaconn_g8_logsquaresuccess)
|
||||
diaconnG8HistoryRecord.bolusType = "E" // Extended
|
||||
diaconnG8HistoryRecord.lognum = logNum
|
||||
diaconnG8HistoryRecord.wrappingCount = wrapingCount
|
||||
diaconnG8HistoryRecord.wrappingCount = wrappingCount
|
||||
diaconnG8HistoryRecord.pumpUid = diaconnG8Pump.pumpUid
|
||||
diaconnHistoryRecordDao.createOrUpdate(diaconnG8HistoryRecord)
|
||||
status = "EXTENDEDBOLUSEND " + dateUtil.timeString(logDateTime)
|
||||
status = "EXTENDED_BOLUS_END " + dateUtil.timeString(logDateTime)
|
||||
}
|
||||
|
||||
LOG_INJECT_SQUARE_FAIL.LOG_KIND -> {
|
||||
|
@ -304,19 +352,23 @@ class BigLogInquireResponsePacket(
|
|||
timestamp = logDateTime,
|
||||
endPumpId = logDateTime,
|
||||
pumpType = PumpType.DIACONN_G8,
|
||||
pumpSerial = diaconnG8Pump.serialNo.toString())
|
||||
aapsLogger.debug(LTag.PUMPCOMM, (if (newRecord) "**NEW** " else "") + "EVENT EXTENDEDSTOP (" + pumplogKind + ") " + dateUtil.dateAndTimeString(logDateTime) + " (" + logDateTime + ")" + " Delivered: " + logItem.injectAmount / 100.0 + "U RealDuration: " + logItem.getInjectTime() + "min")
|
||||
pumpSerial = diaconnG8Pump.serialNo.toString()
|
||||
)
|
||||
aapsLogger.debug(
|
||||
LTag.PUMPCOMM,
|
||||
"${if (newRecord) "**NEW** " else ""}EVENT EXTENDED_STOP ($pumpLogKind) ${dateUtil.dateAndTimeString(logDateTime)} ($logDateTime) Delivered: ${logItem.injectAmount / 100.0}U RealDuration: ${logItem.getInjectTime()}min"
|
||||
)
|
||||
diaconnG8HistoryRecord.code = RecordTypes.RECORD_TYPE_BOLUS
|
||||
diaconnG8HistoryRecord.timestamp = logDateTime
|
||||
diaconnG8HistoryRecord.value = logItem.injectAmount / 100.0
|
||||
diaconnG8HistoryRecord.duration = logItem.getInjectTime()
|
||||
diaconnG8HistoryRecord.stringValue = getReasonName(pumplogKind, logItem.reason)
|
||||
diaconnG8HistoryRecord.stringValue = getReasonName(pumpLogKind, logItem.reason)
|
||||
diaconnG8HistoryRecord.bolusType = "E"
|
||||
diaconnG8HistoryRecord.lognum = logNum
|
||||
diaconnG8HistoryRecord.wrappingCount = wrapingCount
|
||||
diaconnG8HistoryRecord.wrappingCount = wrappingCount
|
||||
diaconnG8HistoryRecord.pumpUid = diaconnG8Pump.pumpUid
|
||||
diaconnHistoryRecordDao.createOrUpdate(diaconnG8HistoryRecord)
|
||||
status = "EXTENDEDBOLUSFAIL " + dateUtil.timeString(logDateTime)
|
||||
status = "EXTENDED_BOLUS_FAIL " + dateUtil.timeString(logDateTime)
|
||||
}
|
||||
|
||||
LOG_SET_DUAL_INJECTION.LOG_KIND -> {
|
||||
|
@ -333,8 +385,12 @@ class BigLogInquireResponsePacket(
|
|||
isEmulatingTB = false,
|
||||
pumpId = logDateTime,
|
||||
pumpType = PumpType.DIACONN_G8,
|
||||
pumpSerial = diaconnG8Pump.serialNo.toString())
|
||||
aapsLogger.debug(LTag.PUMPCOMM, (if (newRecord) "**NEW** " else "") + "EVENT EXTENDEDSTART (" + pumplogKind + ") " + dateUtil.dateAndTimeString(logDateTime) + " (" + logDateTime + ")" + " Amount: " + logItem.setSquareAmount / 100.0 + "U Duration: " + logItem.getInjectTime() * 10 + "min")
|
||||
pumpSerial = diaconnG8Pump.serialNo.toString()
|
||||
)
|
||||
aapsLogger.debug(
|
||||
LTag.PUMPCOMM,
|
||||
"${if (newRecord) "**NEW** " else ""}EVENT EXTENDED_START ($pumpLogKind) ${dateUtil.dateAndTimeString(logDateTime)} ($logDateTime) Amount: ${logItem.setSquareAmount / 100.0}U Duration: ${logItem.getInjectTime() * 10}min"
|
||||
)
|
||||
diaconnG8HistoryRecord.code = RecordTypes.RECORD_TYPE_BOLUS
|
||||
diaconnG8HistoryRecord.timestamp = logDateTime
|
||||
diaconnG8HistoryRecord.value = logItem.setSquareAmount / 100.0
|
||||
|
@ -342,11 +398,11 @@ class BigLogInquireResponsePacket(
|
|||
diaconnG8HistoryRecord.stringValue = rh.gs(R.string.diaconn_g8_logdualsquarestart)
|
||||
diaconnG8HistoryRecord.bolusType = "D" // Extended
|
||||
diaconnG8HistoryRecord.lognum = logNum
|
||||
diaconnG8HistoryRecord.wrappingCount = wrapingCount
|
||||
diaconnG8HistoryRecord.wrappingCount = wrappingCount
|
||||
diaconnG8HistoryRecord.pumpUid = diaconnG8Pump.pumpUid
|
||||
diaconnHistoryRecordDao.createOrUpdate(diaconnG8HistoryRecord)
|
||||
|
||||
status = "DUALEXTENTEDSTART " + dateUtil.timeString(logDateTime)
|
||||
status = "DUAL_EXTENDED_START " + dateUtil.timeString(logDateTime)
|
||||
}
|
||||
|
||||
LOG_INJECTION_DUAL_NORMAL.LOG_KIND -> {
|
||||
|
@ -361,8 +417,12 @@ class BigLogInquireResponsePacket(
|
|||
type = detailedBolusInfo?.bolusType,
|
||||
pumpId = logDateTime,
|
||||
pumpType = PumpType.DIACONN_G8,
|
||||
pumpSerial = diaconnG8Pump.serialNo.toString())
|
||||
aapsLogger.debug(LTag.PUMPCOMM, (if (newRecord) "**NEW** " else "") + "EVENT DUALBOLUS (" + pumplogKind + ") " + dateUtil.dateAndTimeString(logDateTime) + " (" + logDateTime + ")" + " Bolus: " + logItem.injectAmount / 100.0 + "U Duration: " + logItem.getInjectTime() + "min")
|
||||
pumpSerial = diaconnG8Pump.serialNo.toString()
|
||||
)
|
||||
aapsLogger.debug(
|
||||
LTag.PUMPCOMM,
|
||||
"${if (newRecord) "**NEW** " else ""}EVENT DUAL_BOLUS ($pumpLogKind) ${dateUtil.dateAndTimeString(logDateTime)} ($logDateTime) Bolus: ${logItem.injectAmount / 100.0}U Duration: ${logItem.getInjectTime()}min"
|
||||
)
|
||||
|
||||
diaconnG8Pump.lastBolusAmount = logItem.injectAmount / 100.0
|
||||
diaconnG8Pump.lastBolusTime = logDateTime
|
||||
|
@ -375,14 +435,14 @@ class BigLogInquireResponsePacket(
|
|||
diaconnG8HistoryRecord.bolusType = "D" // bolus
|
||||
diaconnG8HistoryRecord.stringValue = rh.gs(R.string.diaconn_g8_logdualnormalsuccess)
|
||||
diaconnG8HistoryRecord.lognum = logNum
|
||||
diaconnG8HistoryRecord.wrappingCount = wrapingCount
|
||||
diaconnG8HistoryRecord.wrappingCount = wrappingCount
|
||||
diaconnG8HistoryRecord.pumpUid = diaconnG8Pump.pumpUid
|
||||
diaconnHistoryRecordDao.createOrUpdate(diaconnG8HistoryRecord)
|
||||
if (!newRecord && detailedBolusInfo != null) {
|
||||
// detailedInfo can be from another similar record. Reinsert
|
||||
detailedBolusInfoStorage.add(detailedBolusInfo)
|
||||
}
|
||||
status = "DUALBOLUS" + dateUtil.timeString(logDateTime)
|
||||
status = "DUAL_BOLUS" + dateUtil.timeString(logDateTime)
|
||||
}
|
||||
|
||||
LOG_INJECT_DUAL_SUCCESS.LOG_KIND -> {
|
||||
|
@ -398,10 +458,10 @@ class BigLogInquireResponsePacket(
|
|||
diaconnG8HistoryRecord.bolusType = "D"
|
||||
diaconnG8HistoryRecord.stringValue = rh.gs(R.string.diaconn_g8_logdualsquaresuccess)
|
||||
diaconnG8HistoryRecord.lognum = logNum
|
||||
diaconnG8HistoryRecord.wrappingCount = wrapingCount
|
||||
diaconnG8HistoryRecord.wrappingCount = wrappingCount
|
||||
diaconnG8HistoryRecord.pumpUid = diaconnG8Pump.pumpUid
|
||||
diaconnHistoryRecordDao.createOrUpdate(diaconnG8HistoryRecord)
|
||||
status = "DUALBOLUS SQUARESUCCESS " + dateUtil.timeString(logDateTime)
|
||||
status = "DUAL_BOLUS_SQUARE_SUCCESS " + dateUtil.timeString(logDateTime)
|
||||
}
|
||||
|
||||
LOG_INJECT_DUAL_FAIL.LOG_KIND -> {
|
||||
|
@ -413,20 +473,24 @@ class BigLogInquireResponsePacket(
|
|||
timestamp = logDateTime,
|
||||
endPumpId = logDateTime,
|
||||
pumpType = PumpType.DIACONN_G8,
|
||||
pumpSerial = diaconnG8Pump.serialNo.toString())
|
||||
aapsLogger.debug(LTag.PUMPCOMM, (if (newRecord) "**NEW** " else "") + "EVENT EXTENDEDSTOP (" + pumplogKind + ") " + dateUtil.dateAndTimeString(logDateTime) + " (" + logDateTime + ")" + " Delivered: " + logItem.injectSquareAmount / 100.0 + "U RealDuration: " + logItem.getInjectTime() + "min")
|
||||
pumpSerial = diaconnG8Pump.serialNo.toString()
|
||||
)
|
||||
aapsLogger.debug(
|
||||
LTag.PUMPCOMM,
|
||||
"${if (newRecord) "**NEW** " else ""}EVENT EXTENDED_STOP ($pumpLogKind) ${dateUtil.dateAndTimeString(logDateTime)} ($logDateTime) Delivered: ${logItem.injectSquareAmount / 100.0}U RealDuration: ${logItem.getInjectTime()}min"
|
||||
)
|
||||
|
||||
diaconnG8HistoryRecord.code = RecordTypes.RECORD_TYPE_BOLUS
|
||||
diaconnG8HistoryRecord.timestamp = logDateTime
|
||||
diaconnG8HistoryRecord.value = logItem.injectNormAmount / 100.0 + logItem.injectSquareAmount / 100.0
|
||||
diaconnG8HistoryRecord.duration = logItem.getInjectTime()
|
||||
diaconnG8HistoryRecord.bolusType = "D"
|
||||
diaconnG8HistoryRecord.stringValue = getReasonName(pumplogKind, logItem.reason)
|
||||
diaconnG8HistoryRecord.stringValue = getReasonName(pumpLogKind, logItem.reason)
|
||||
diaconnG8HistoryRecord.lognum = logNum
|
||||
diaconnG8HistoryRecord.wrappingCount = wrapingCount
|
||||
diaconnG8HistoryRecord.wrappingCount = wrappingCount
|
||||
diaconnG8HistoryRecord.pumpUid = diaconnG8Pump.pumpUid
|
||||
diaconnHistoryRecordDao.createOrUpdate(diaconnG8HistoryRecord)
|
||||
status = "DUALBOLUS FAIL " + dateUtil.timeString(logDateTime)
|
||||
status = "DUAL_BOLUS FAIL " + dateUtil.timeString(logDateTime)
|
||||
}
|
||||
|
||||
LOG_INJECTION_1HOUR_BASAL.LOG_KIND -> {
|
||||
|
@ -439,7 +503,7 @@ class BigLogInquireResponsePacket(
|
|||
diaconnG8HistoryRecord.value = logItem.beforeAmount / 100.0
|
||||
diaconnG8HistoryRecord.stringValue = "TB before: ${logItem.beforeAmount / 100.0} / TB after: ${logItem.afterAmount / 100.0}"
|
||||
diaconnG8HistoryRecord.lognum = logNum
|
||||
diaconnG8HistoryRecord.wrappingCount = wrapingCount
|
||||
diaconnG8HistoryRecord.wrappingCount = wrappingCount
|
||||
diaconnG8HistoryRecord.pumpUid = diaconnG8Pump.pumpUid
|
||||
diaconnHistoryRecordDao.createOrUpdate(diaconnG8HistoryRecord)
|
||||
status = "1HOUR BASAL " + dateUtil.dateAndTimeString(logDateTime)
|
||||
|
@ -454,7 +518,7 @@ class BigLogInquireResponsePacket(
|
|||
diaconnG8HistoryRecord.timestamp = logDateTime
|
||||
diaconnG8HistoryRecord.stringValue = rh.gs(R.string.diaconn_g8_lgosuspend, logItem.getBasalPattern())
|
||||
diaconnG8HistoryRecord.lognum = logNum
|
||||
diaconnG8HistoryRecord.wrappingCount = wrapingCount
|
||||
diaconnG8HistoryRecord.wrappingCount = wrappingCount
|
||||
diaconnG8HistoryRecord.pumpUid = diaconnG8Pump.pumpUid
|
||||
diaconnHistoryRecordDao.createOrUpdate(diaconnG8HistoryRecord)
|
||||
status = "SUSPEND " + dateUtil.timeString(logDateTime)
|
||||
|
@ -469,10 +533,10 @@ class BigLogInquireResponsePacket(
|
|||
diaconnG8HistoryRecord.timestamp = logDateTime
|
||||
diaconnG8HistoryRecord.stringValue = rh.gs(R.string.diaconn_g8_lgorelease, logItem.getBasalPattern())
|
||||
diaconnG8HistoryRecord.lognum = logNum
|
||||
diaconnG8HistoryRecord.wrappingCount = wrapingCount
|
||||
diaconnG8HistoryRecord.wrappingCount = wrappingCount
|
||||
diaconnG8HistoryRecord.pumpUid = diaconnG8Pump.pumpUid
|
||||
diaconnHistoryRecordDao.createOrUpdate(diaconnG8HistoryRecord)
|
||||
status = "SUSPENDRELEASE " + dateUtil.timeString(logDateTime)
|
||||
status = "SUSPEND_RELEASE " + dateUtil.timeString(logDateTime)
|
||||
}
|
||||
|
||||
LOG_CHANGE_INJECTOR_SUCCESS.LOG_KIND -> {
|
||||
|
@ -488,17 +552,20 @@ class BigLogInquireResponsePacket(
|
|||
pumpType = PumpType.DIACONN_G8,
|
||||
pumpSerial = diaconnG8Pump.serialNo.toString()
|
||||
)
|
||||
aapsLogger.debug(LTag.PUMPCOMM, (if (newRecord) "**NEW** " else "") + "EVENT INSULINCHANGE(" + pumplogKind + ") " + dateUtil.dateAndTimeString(logDateTime) + " (" + logDateTime + ")" + " Amount: " + logItem.remainAmount / 100.0 + "U")
|
||||
aapsLogger.debug(
|
||||
LTag.PUMPCOMM,
|
||||
"${if (newRecord) "**NEW** " else ""}EVENT INSULIN_CHANGE($pumpLogKind) ${dateUtil.dateAndTimeString(logDateTime)} ($logDateTime) Amount: ${logItem.remainAmount / 100.0}U"
|
||||
)
|
||||
}
|
||||
diaconnG8HistoryRecord.code = RecordTypes.RECORD_TYPE_REFILL
|
||||
diaconnG8HistoryRecord.timestamp = logDateTime
|
||||
diaconnG8HistoryRecord.value = logItem.remainAmount / 100.0
|
||||
diaconnG8HistoryRecord.stringValue = rh.gs(R.string.diaconn_g8_loginjectorprime, logItem.primeAmount / 100.0)
|
||||
diaconnG8HistoryRecord.lognum = logNum
|
||||
diaconnG8HistoryRecord.wrappingCount = wrapingCount
|
||||
diaconnG8HistoryRecord.wrappingCount = wrappingCount
|
||||
diaconnG8HistoryRecord.pumpUid = diaconnG8Pump.pumpUid
|
||||
diaconnHistoryRecordDao.createOrUpdate(diaconnG8HistoryRecord)
|
||||
status = "INSULINCHANGE " + dateUtil.timeString(logDateTime)
|
||||
status = "INSULIN_CHANGE " + dateUtil.timeString(logDateTime)
|
||||
}
|
||||
|
||||
LOG_CHANGE_TUBE_SUCCESS.LOG_KIND -> {
|
||||
|
@ -515,7 +582,10 @@ class BigLogInquireResponsePacket(
|
|||
pumpType = PumpType.DIACONN_G8,
|
||||
pumpSerial = diaconnG8Pump.serialNo.toString()
|
||||
)
|
||||
aapsLogger.debug(LTag.PUMPCOMM, (if (newRecord) "**NEW** " else "") + "EVENT TUBECHANGE(" + pumplogKind + ") " + dateUtil.dateAndTimeString(logDateTime) + " (" + logDateTime + ")" + " Amount: " + logItem.primeAmount / 100.0 + "U")
|
||||
aapsLogger.debug(
|
||||
LTag.PUMPCOMM,
|
||||
"${if (newRecord) "**NEW** " else ""}EVENT TUBE_CHANGE($pumpLogKind) ${dateUtil.dateAndTimeString(logDateTime)} ($logDateTime) Amount: ${logItem.primeAmount / 100.0}U"
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
|
@ -524,10 +594,10 @@ class BigLogInquireResponsePacket(
|
|||
diaconnG8HistoryRecord.value = logItem.remainAmount / 100.0
|
||||
diaconnG8HistoryRecord.stringValue = rh.gs(R.string.diaconn_g8_logtubeprime, logItem.primeAmount / 100.0)
|
||||
diaconnG8HistoryRecord.lognum = logNum
|
||||
diaconnG8HistoryRecord.wrappingCount = wrapingCount
|
||||
diaconnG8HistoryRecord.wrappingCount = wrappingCount
|
||||
diaconnG8HistoryRecord.pumpUid = diaconnG8Pump.pumpUid
|
||||
diaconnHistoryRecordDao.createOrUpdate(diaconnG8HistoryRecord)
|
||||
status = "TUBECHANGE " + dateUtil.timeString(logDateTime)
|
||||
status = "TUBE_CHANGE " + dateUtil.timeString(logDateTime)
|
||||
}
|
||||
|
||||
LOG_INJECTION_1DAY.LOG_KIND -> { // Daily Bolus Log
|
||||
|
@ -543,12 +613,12 @@ class BigLogInquireResponsePacket(
|
|||
val recordDateStr = "" + diaconnG8HistoryRecord.timestamp
|
||||
var recordMap: MutableMap<String, Double> = mutableMapOf("dummy" to 0.0)
|
||||
|
||||
if (dailyMaxvalInfo.containsKey(recordDateStr)) {
|
||||
recordMap = dailyMaxvalInfo[recordDateStr]!!
|
||||
if (dailyMaxValInfo.containsKey(recordDateStr)) {
|
||||
recordMap = dailyMaxValInfo[recordDateStr]!!
|
||||
} else {
|
||||
recordMap["bolus"] = 0.0
|
||||
recordMap["basal"] = 0.0
|
||||
dailyMaxvalInfo[recordDateStr] = recordMap
|
||||
dailyMaxValInfo[recordDateStr] = recordMap
|
||||
}
|
||||
|
||||
if (diaconnG8HistoryRecord.dailyBolus > recordMap["bolus"]!!) {
|
||||
|
@ -561,7 +631,7 @@ class BigLogInquireResponsePacket(
|
|||
diaconnG8HistoryRecord.dailyBasal = recordMap["basal"]!!
|
||||
}
|
||||
diaconnG8HistoryRecord.lognum = logNum
|
||||
diaconnG8HistoryRecord.wrappingCount = wrapingCount
|
||||
diaconnG8HistoryRecord.wrappingCount = wrappingCount
|
||||
diaconnG8HistoryRecord.pumpUid = diaconnG8Pump.pumpUid
|
||||
diaconnHistoryRecordDao.createOrUpdate(diaconnG8HistoryRecord)
|
||||
|
||||
|
@ -576,7 +646,7 @@ class BigLogInquireResponsePacket(
|
|||
diaconnG8Pump.serialNo.toString()
|
||||
)
|
||||
|
||||
status = "DAILYBOLUS " + dateUtil.timeString(logDateTime)
|
||||
status = "DAILY_BOLUS " + dateUtil.timeString(logDateTime)
|
||||
}
|
||||
|
||||
LOG_INJECTION_1DAY_BASAL.LOG_KIND -> { // Daily Basal Log
|
||||
|
@ -592,12 +662,12 @@ class BigLogInquireResponsePacket(
|
|||
val recordDateStr = "" + diaconnG8HistoryRecord.timestamp
|
||||
var recordMap: MutableMap<String, Double> = mutableMapOf("dummy" to 0.0)
|
||||
|
||||
if (dailyMaxvalInfo.containsKey(recordDateStr)) {
|
||||
recordMap = dailyMaxvalInfo[recordDateStr]!!
|
||||
if (dailyMaxValInfo.containsKey(recordDateStr)) {
|
||||
recordMap = dailyMaxValInfo[recordDateStr]!!
|
||||
} else {
|
||||
recordMap["bolus"] = 0.0
|
||||
recordMap["basal"] = 0.0
|
||||
dailyMaxvalInfo[recordDateStr] = recordMap
|
||||
dailyMaxValInfo[recordDateStr] = recordMap
|
||||
}
|
||||
|
||||
if (diaconnG8HistoryRecord.dailyBasal > recordMap["basal"]!!) {
|
||||
|
@ -610,7 +680,7 @@ class BigLogInquireResponsePacket(
|
|||
diaconnG8HistoryRecord.dailyBolus = recordMap["bolus"]!!
|
||||
}
|
||||
diaconnG8HistoryRecord.lognum = logNum
|
||||
diaconnG8HistoryRecord.wrappingCount = wrapingCount
|
||||
diaconnG8HistoryRecord.wrappingCount = wrappingCount
|
||||
diaconnG8HistoryRecord.pumpUid = diaconnG8Pump.pumpUid
|
||||
diaconnHistoryRecordDao.createOrUpdate(diaconnG8HistoryRecord)
|
||||
|
||||
|
@ -625,8 +695,7 @@ class BigLogInquireResponsePacket(
|
|||
// diaconnG8Pump.serialNo.toString()
|
||||
// )
|
||||
|
||||
|
||||
status = "DAILYBASAL " + dateUtil.timeString(logDateTime)
|
||||
status = "DAILY_BASAL " + dateUtil.timeString(logDateTime)
|
||||
}
|
||||
|
||||
LOG_CHANGE_NEEDLE_SUCCESS.LOG_KIND -> {
|
||||
|
@ -642,7 +711,10 @@ class BigLogInquireResponsePacket(
|
|||
pumpType = PumpType.DIACONN_G8,
|
||||
pumpSerial = diaconnG8Pump.serialNo.toString()
|
||||
)
|
||||
aapsLogger.debug(LTag.PUMPCOMM, (if (newRecord) "**NEW** " else "") + "EVENT NEEDLECHANGE(" + pumplogKind + ") " + dateUtil.dateAndTimeString(logDateTime) + " (" + logDateTime + ")" + " Amount: " + logItem.remainAmount / 100.0 + "U")
|
||||
aapsLogger.debug(
|
||||
LTag.PUMPCOMM,
|
||||
"${if (newRecord) "**NEW** " else ""}EVENT NEEDLE_CHANGE($pumpLogKind) ${dateUtil.dateAndTimeString(logDateTime)} ($logDateTime) Amount: ${logItem.remainAmount / 100.0}U"
|
||||
)
|
||||
}
|
||||
|
||||
diaconnG8HistoryRecord.code = RecordTypes.RECORD_TYPE_REFILL
|
||||
|
@ -650,10 +722,10 @@ class BigLogInquireResponsePacket(
|
|||
diaconnG8HistoryRecord.value = logItem.remainAmount / 100.0
|
||||
diaconnG8HistoryRecord.stringValue = rh.gs(R.string.diaconn_g8_logneedleprime, logItem.primeAmount / 100.0)
|
||||
diaconnG8HistoryRecord.lognum = logNum
|
||||
diaconnG8HistoryRecord.wrappingCount = wrapingCount
|
||||
diaconnG8HistoryRecord.wrappingCount = wrappingCount
|
||||
diaconnG8HistoryRecord.pumpUid = diaconnG8Pump.pumpUid
|
||||
diaconnHistoryRecordDao.createOrUpdate(diaconnG8HistoryRecord)
|
||||
status = "NEEDLECHANGE " + dateUtil.timeString(logDateTime)
|
||||
status = "NEEDLE_CHANGE " + dateUtil.timeString(logDateTime)
|
||||
}
|
||||
|
||||
LOG_TB_START_V3.LOG_KIND -> {
|
||||
|
@ -681,8 +753,12 @@ class BigLogInquireResponsePacket(
|
|||
type = temporaryBasalInfo?.type,
|
||||
pumpId = logDateTime,
|
||||
pumpType = PumpType.DIACONN_G8,
|
||||
pumpSerial = diaconnG8Pump.serialNo.toString())
|
||||
aapsLogger.debug(LTag.PUMPCOMM, (if (newRecord) "**NEW** " else "") + "EVENT TEMPSTART (" + pumplogKind + ") " + dateUtil.dateAndTimeString(logDateTime) + " (" + logDateTime + ")" + " Ratio: " + absoluteRate + "U Duration: " + logItem.tbTime * 15 + "min")
|
||||
pumpSerial = diaconnG8Pump.serialNo.toString()
|
||||
)
|
||||
aapsLogger.debug(
|
||||
LTag.PUMPCOMM,
|
||||
"${if (newRecord) "**NEW** " else ""}EVENT TEMP_START ($pumpLogKind) ${dateUtil.dateAndTimeString(logDateTime)} ($logDateTime) Ratio: ${absoluteRate}U Duration: ${logItem.tbTime * 15}min"
|
||||
)
|
||||
|
||||
diaconnG8HistoryRecord.code = RecordTypes.RECORD_TYPE_TB
|
||||
diaconnG8HistoryRecord.timestamp = logDateTime
|
||||
|
@ -690,10 +766,10 @@ class BigLogInquireResponsePacket(
|
|||
diaconnG8HistoryRecord.value = absoluteRate
|
||||
diaconnG8HistoryRecord.stringValue = rh.gs(R.string.diaconn_g8_logtempstart)
|
||||
diaconnG8HistoryRecord.lognum = logNum
|
||||
diaconnG8HistoryRecord.wrappingCount = wrapingCount
|
||||
diaconnG8HistoryRecord.wrappingCount = wrappingCount
|
||||
diaconnG8HistoryRecord.pumpUid = diaconnG8Pump.pumpUid
|
||||
diaconnHistoryRecordDao.createOrUpdate(diaconnG8HistoryRecord)
|
||||
status = "TEMPSTART " + dateUtil.timeString(logDateTime)
|
||||
status = "TEMP_START " + dateUtil.timeString(logDateTime)
|
||||
}
|
||||
|
||||
LOG_TB_STOP_V3.LOG_KIND -> {
|
||||
|
@ -714,19 +790,20 @@ class BigLogInquireResponsePacket(
|
|||
timestamp = logDateTime,
|
||||
endPumpId = dateUtil.now(),
|
||||
pumpType = PumpType.DIACONN_G8,
|
||||
pumpSerial = diaconnG8Pump.serialNo.toString())
|
||||
aapsLogger.debug(LTag.PUMPCOMM, (if (newRecord) "**NEW** " else "") + "EVENT TEMPSTOP (" + pumplogKind + ") " + dateUtil.dateAndTimeString(logDateTime) + " (" + logDateTime + ")")
|
||||
pumpSerial = diaconnG8Pump.serialNo.toString()
|
||||
)
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "${if (newRecord) "**NEW** " else ""}EVENT TEMP_STOP ($pumpLogKind) ${dateUtil.dateAndTimeString(logDateTime)} ($logDateTime)")
|
||||
|
||||
|
||||
diaconnG8HistoryRecord.code = RecordTypes.RECORD_TYPE_TB
|
||||
diaconnG8HistoryRecord.timestamp = logDateTime
|
||||
diaconnG8HistoryRecord.value = absoluteRate
|
||||
diaconnG8HistoryRecord.stringValue = getReasonName(pumplogKind, logItem.reason)
|
||||
diaconnG8HistoryRecord.stringValue = getReasonName(pumpLogKind, logItem.reason)
|
||||
diaconnG8HistoryRecord.lognum = logNum
|
||||
diaconnG8HistoryRecord.wrappingCount = wrapingCount
|
||||
diaconnG8HistoryRecord.wrappingCount = wrappingCount
|
||||
diaconnG8HistoryRecord.pumpUid = diaconnG8Pump.pumpUid
|
||||
diaconnHistoryRecordDao.createOrUpdate(diaconnG8HistoryRecord)
|
||||
status = "TEMPSTOP " + dateUtil.timeString(logDateTime)
|
||||
status = "TEMP_STOP " + dateUtil.timeString(logDateTime)
|
||||
}
|
||||
|
||||
LOG_ALARM_BATTERY.LOG_KIND -> { // BATTERY SHORTAGE ALARM
|
||||
|
@ -739,10 +816,10 @@ class BigLogInquireResponsePacket(
|
|||
diaconnG8HistoryRecord.timestamp = logDateTime
|
||||
diaconnG8HistoryRecord.stringValue = rh.gs(R.string.diaconn_g8_logbatteryshorage)
|
||||
diaconnG8HistoryRecord.lognum = logNum
|
||||
diaconnG8HistoryRecord.wrappingCount = wrapingCount
|
||||
diaconnG8HistoryRecord.wrappingCount = wrappingCount
|
||||
diaconnG8HistoryRecord.pumpUid = diaconnG8Pump.pumpUid
|
||||
diaconnHistoryRecordDao.createOrUpdate(diaconnG8HistoryRecord)
|
||||
status = "BATTERYALARM " + dateUtil.timeString(logDateTime)
|
||||
status = "BATTERY_ALARM " + dateUtil.timeString(logDateTime)
|
||||
}
|
||||
|
||||
LOG_ALARM_BLOCK.LOG_KIND -> { // INJECTION BLOCKED ALARM
|
||||
|
@ -755,12 +832,12 @@ class BigLogInquireResponsePacket(
|
|||
diaconnG8HistoryRecord.code = RecordTypes.RECORD_TYPE_ALARM
|
||||
diaconnG8HistoryRecord.timestamp = logDateTime
|
||||
diaconnG8HistoryRecord.value = logItem.amount / 100.0
|
||||
diaconnG8HistoryRecord.stringValue = rh.gs(R.string.diaconn_g8_logalarmblock, getReasonName(pumplogKind, logItem.reason))
|
||||
diaconnG8HistoryRecord.stringValue = rh.gs(R.string.diaconn_g8_logalarmblock, getReasonName(pumpLogKind, logItem.reason))
|
||||
diaconnG8HistoryRecord.lognum = logNum
|
||||
diaconnG8HistoryRecord.wrappingCount = wrapingCount
|
||||
diaconnG8HistoryRecord.wrappingCount = wrappingCount
|
||||
diaconnG8HistoryRecord.pumpUid = diaconnG8Pump.pumpUid
|
||||
diaconnHistoryRecordDao.createOrUpdate(diaconnG8HistoryRecord)
|
||||
status = "BLOCKALARM " + dateUtil.timeString(logDateTime)
|
||||
status = "BLOCK_ALARM " + dateUtil.timeString(logDateTime)
|
||||
}
|
||||
|
||||
LOG_ALARM_SHORTAGE.LOG_KIND -> { // INSULIN SHORTAGE ALARM
|
||||
|
@ -775,10 +852,10 @@ class BigLogInquireResponsePacket(
|
|||
diaconnG8HistoryRecord.value = logItem.remain.toDouble()
|
||||
diaconnG8HistoryRecord.stringValue = rh.gs(R.string.diaconn_g8_loginsulinshorage)
|
||||
diaconnG8HistoryRecord.lognum = logNum
|
||||
diaconnG8HistoryRecord.wrappingCount = wrapingCount
|
||||
diaconnG8HistoryRecord.wrappingCount = wrappingCount
|
||||
diaconnG8HistoryRecord.pumpUid = diaconnG8Pump.pumpUid
|
||||
diaconnHistoryRecordDao.createOrUpdate(diaconnG8HistoryRecord)
|
||||
status = "SHORTAGEALARM " + dateUtil.timeString(logDateTime)
|
||||
status = "SHORT_AGE_ALARM " + dateUtil.timeString(logDateTime)
|
||||
}
|
||||
|
||||
LOG_RESET_SYS_V3.LOG_KIND -> {
|
||||
|
@ -790,7 +867,7 @@ class BigLogInquireResponsePacket(
|
|||
|
||||
diaconnG8HistoryRecord.code = RecordTypes.RECORD_TYPE_ALARM
|
||||
diaconnG8HistoryRecord.timestamp = logDateTime
|
||||
diaconnG8HistoryRecord.stringValue = getReasonName(pumplogKind, logItem.reason)
|
||||
diaconnG8HistoryRecord.stringValue = getReasonName(pumpLogKind, logItem.reason)
|
||||
diaconnHistoryRecordDao.createOrUpdate(diaconnG8HistoryRecord)
|
||||
if (logItem.reason == 3.toByte()) {
|
||||
if (sp.getBoolean(R.string.key_diaconn_g8_logbatterychange, true)) {
|
||||
|
@ -801,7 +878,10 @@ class BigLogInquireResponsePacket(
|
|||
pumpType = PumpType.DIACONN_G8,
|
||||
pumpSerial = diaconnG8Pump.serialNo.toString()
|
||||
)
|
||||
aapsLogger.debug(LTag.PUMPCOMM, (if (newRecord) "**NEW** " else "") + "EVENT BATTERYCHANGE(" + pumplogKind + ") " + dateUtil.dateAndTimeString(logDateTime) + " (" + logDateTime + ")" + " remainAmount: " + logItem.batteryRemain.toInt() + "%")
|
||||
aapsLogger.debug(
|
||||
LTag.PUMPCOMM,
|
||||
"${if (newRecord) "**NEW** " else ""}EVENT BATTERY_CHANGE($pumpLogKind) ${dateUtil.dateAndTimeString(logDateTime)} ($logDateTime) remainAmount: ${logItem.batteryRemain.toInt()}%"
|
||||
)
|
||||
}
|
||||
}
|
||||
status = "RESET " + dateUtil.timeString(logDateTime)
|
||||
|
@ -831,7 +911,7 @@ class BigLogInquireResponsePacket(
|
|||
val api = retrofit?.create(DiaconnApiService::class.java)
|
||||
val pumpLogDto = PumpLogDto(
|
||||
app_uid = appUid,
|
||||
app_version = context.packageManager.getPackageInfo(context.packageName, 0).versionName,
|
||||
app_version = context.packageManager.getPackageInfo(context.packageName, PackageManager.PackageInfoFlags.of(0)).versionName,
|
||||
pump_uid = diaconnG8Pump.pumpUid,
|
||||
pump_version = diaconnG8Pump.pumpVersion,
|
||||
incarnation_num = diaconnG8Pump.pumpIncarnationNum,
|
||||
|
@ -845,8 +925,9 @@ class BigLogInquireResponsePacket(
|
|||
aapsLogger.debug(LTag.PUMPCOMM, "logs upload Success")
|
||||
}
|
||||
}
|
||||
|
||||
override fun onFailure(call: Call<ApiResponse>, t: Throwable) {
|
||||
aapsLogger.error(LTag.PUMPCOMM, "api uploadPumplogs failed")
|
||||
aapsLogger.error(LTag.PUMPCOMM, "api uploadPumpLogs failed")
|
||||
diaconnG8Pump.isPumpLogUploadFailed = true
|
||||
t.printStackTrace()
|
||||
}
|
||||
|
@ -868,12 +949,12 @@ class BigLogInquireResponsePacket(
|
|||
val logInjectDualFail: Byte = 0x11
|
||||
val logTBStopV3: Byte = 0x13
|
||||
val logResetSysV3: Byte = 0x01
|
||||
val logALarmBlock: Byte = 0x29
|
||||
val logAlarmBlock: Byte = 0x29
|
||||
|
||||
return when (logKind) {
|
||||
logInjectNormalFail, logInjectSquareFail, logInjectDualFail, logTBStopV3 -> failLog(reason)
|
||||
logResetSysV3 -> resetLog(reason)
|
||||
logALarmBlock -> blockLog(reason)
|
||||
logAlarmBlock -> blockLog(reason)
|
||||
else -> ""
|
||||
}
|
||||
}
|
||||
|
|
|
@ -333,7 +333,7 @@ public class InsightAlertService extends DaggerService implements InsightConnect
|
|||
|
||||
private void dismissNotification() {
|
||||
NotificationManagerCompat.from(this).cancel(NOTIFICATION_ID);
|
||||
stopForeground(true);
|
||||
stopForeground(STOP_FOREGROUND_REMOVE);
|
||||
}
|
||||
|
||||
public class LocalBinder extends Binder {
|
||||
|
|
|
@ -26,7 +26,7 @@ abstract class PodActivationWizardActivity : OmnipodWizardActivityBase() {
|
|||
setContentView(R.layout.omnipod_common_pod_activation_wizard_activity)
|
||||
|
||||
startDestination = savedInstanceState?.getInt(KEY_START_DESTINATION, R.id.startPodActivationFragment)
|
||||
?: if (intent.getSerializableExtra(KEY_TYPE) as Type == Type.LONG) {
|
||||
?: if (intent.getSerializableExtra(KEY_TYPE, Type::class.java) == Type.LONG) {
|
||||
R.id.startPodActivationFragment
|
||||
} else {
|
||||
R.id.attachPodFragment
|
||||
|
|
|
@ -6,9 +6,9 @@ import android.content.Intent
|
|||
import androidx.annotation.StringRes
|
||||
import com.google.gson.Gson
|
||||
import dagger.android.DaggerBroadcastReceiver
|
||||
import info.nightscout.androidaps.interfaces.ResourceHelper
|
||||
import info.nightscout.androidaps.plugins.bus.RxBus
|
||||
import info.nightscout.androidaps.plugins.pump.common.events.EventPumpConnectionParametersChanged
|
||||
import info.nightscout.androidaps.interfaces.ResourceHelper
|
||||
import info.nightscout.shared.logging.AAPSLogger
|
||||
import info.nightscout.shared.logging.LTag
|
||||
import info.nightscout.shared.sharedPreferences.SP
|
||||
|
@ -27,21 +27,20 @@ class BondStateReceiver(
|
|||
@Inject lateinit var aapsLogger: AAPSLogger
|
||||
@Inject lateinit var rxBus: RxBus
|
||||
|
||||
var TAG = LTag.PUMPBTCOMM
|
||||
var gson = Gson()
|
||||
var applicationContext: Context? = null
|
||||
|
||||
override fun onReceive(context: Context, intent: Intent) {
|
||||
super.onReceive(context, intent)
|
||||
val action = intent.action
|
||||
val device = intent.getParcelableExtra<BluetoothDevice>(BluetoothDevice.EXTRA_DEVICE)
|
||||
aapsLogger.info(TAG, "in onReceive: INTENT" + gson.toJson(intent))
|
||||
val device = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE, BluetoothDevice::class.java)
|
||||
aapsLogger.info(LTag.PUMPBTCOMM, "in onReceive: INTENT" + gson.toJson(intent))
|
||||
if (device == null) {
|
||||
aapsLogger.error(TAG, "onReceive. Device is null. Exiting.")
|
||||
aapsLogger.error(LTag.PUMPBTCOMM, "onReceive. Device is null. Exiting.")
|
||||
return
|
||||
} else {
|
||||
if (device.address != targetDevice) {
|
||||
aapsLogger.error(TAG, "onReceive. Device is not the same as targetDevice. Exiting.")
|
||||
aapsLogger.error(LTag.PUMPBTCOMM, "onReceive. Device is not the same as targetDevice. Exiting.")
|
||||
return
|
||||
}
|
||||
}
|
||||
|
@ -53,11 +52,11 @@ class BondStateReceiver(
|
|||
if (action == BluetoothDevice.ACTION_BOND_STATE_CHANGED) {
|
||||
val bondState = intent.getIntExtra(BluetoothDevice.EXTRA_BOND_STATE, BluetoothDevice.ERROR)
|
||||
val previousBondState = intent.getIntExtra(BluetoothDevice.EXTRA_PREVIOUS_BOND_STATE, -1)
|
||||
aapsLogger.info(TAG, "in onReceive: bondState=$bondState, previousBondState=$previousBondState")
|
||||
aapsLogger.info(LTag.PUMPBTCOMM, "in onReceive: bondState=$bondState, previousBondState=$previousBondState")
|
||||
if (bondState == targetState) {
|
||||
aapsLogger.info(TAG, "onReceive: found targeted state: $targetState")
|
||||
aapsLogger.info(LTag.PUMPBTCOMM, "onReceive: found targeted state: $targetState")
|
||||
val currentDeviceSettings = sp.getString(deviceAddress, "")
|
||||
if (currentDeviceSettings.equals(targetDevice)) {
|
||||
if (currentDeviceSettings == targetDevice) {
|
||||
if (targetState == 12) {
|
||||
sp.putBoolean(bondedFlag, true)
|
||||
rxBus.send(EventPumpConnectionParametersChanged())
|
||||
|
@ -67,10 +66,10 @@ class BondStateReceiver(
|
|||
}
|
||||
context.unregisterReceiver(this)
|
||||
} else {
|
||||
aapsLogger.error(TAG, "onReceive: Device stored in SP is not the same as target device, process interrupted")
|
||||
aapsLogger.error(LTag.PUMPBTCOMM, "onReceive: Device stored in SP is not the same as target device, process interrupted")
|
||||
}
|
||||
} else {
|
||||
aapsLogger.info(TAG, "onReceive: currentBondState=$bondState, targetBondState=$targetState")
|
||||
aapsLogger.info(LTag.PUMPBTCOMM, "onReceive: currentBondState=$bondState, targetBondState=$targetState")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@ object BundleLogger {
|
|||
}
|
||||
var string = "Bundle{"
|
||||
for (key in bundle.keySet()) {
|
||||
@Suppress("DEPRECATION")
|
||||
string += " " + key + " => " + bundle[key] + ";"
|
||||
}
|
||||
string += " }Bundle"
|
||||
|
|
|
@ -2,6 +2,7 @@ package info.nightscout.androidaps.interaction.actions
|
|||
|
||||
import android.content.Intent
|
||||
import android.content.pm.PackageManager
|
||||
import android.content.pm.PackageManager.PackageInfoFlags
|
||||
import android.os.Bundle
|
||||
import android.util.Log
|
||||
import android.widget.Toast
|
||||
|
@ -41,9 +42,10 @@ class QuickSnoozeActivity : DaggerActivity() {
|
|||
finish()
|
||||
}
|
||||
|
||||
@Suppress("SameParameterValue")
|
||||
private fun isPackageExisted(targetPackage: String): Boolean {
|
||||
try {
|
||||
packageManager.getPackageInfo(targetPackage, PackageManager.GET_META_DATA)
|
||||
packageManager.getPackageInfo(targetPackage, PackageInfoFlags.of(0))
|
||||
} catch (e: PackageManager.NameNotFoundException) {
|
||||
return false
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue