diff --git a/app/src/main/java/info/nightscout/androidaps/dialogs/FillDialog.kt b/app/src/main/java/info/nightscout/androidaps/dialogs/FillDialog.kt index f9cf203e5e..398eca586f 100644 --- a/app/src/main/java/info/nightscout/androidaps/dialogs/FillDialog.kt +++ b/app/src/main/java/info/nightscout/androidaps/dialogs/FillDialog.kt @@ -191,7 +191,7 @@ class FillDialog : DialogFragmentWithDate() { commandQueue.bolus(detailedBolusInfo, object : Callback() { override fun run() { if (!result.success) { - ErrorHelperActivity.runAlarm(ctx, result.comment, resourceHelper.gs(R.string.treatmentdeliveryerror), info.nightscout.androidaps.dana.R.raw.boluserror) + ErrorHelperActivity.runAlarm(ctx, result.comment, resourceHelper.gs(R.string.treatmentdeliveryerror), R.raw.boluserror) } } }) diff --git a/app/src/main/java/info/nightscout/androidaps/dialogs/InsulinDialog.kt b/app/src/main/java/info/nightscout/androidaps/dialogs/InsulinDialog.kt index 8d55d861a6..12d14ef265 100644 --- a/app/src/main/java/info/nightscout/androidaps/dialogs/InsulinDialog.kt +++ b/app/src/main/java/info/nightscout/androidaps/dialogs/InsulinDialog.kt @@ -224,7 +224,7 @@ class InsulinDialog : DialogFragmentWithDate() { commandQueue.bolus(detailedBolusInfo, object : Callback() { override fun run() { if (!result.success) { - ErrorHelperActivity.runAlarm(ctx, result.comment, resourceHelper.gs(R.string.treatmentdeliveryerror), info.nightscout.androidaps.dana.R.raw.boluserror) + ErrorHelperActivity.runAlarm(ctx, result.comment, resourceHelper.gs(R.string.treatmentdeliveryerror), R.raw.boluserror) } } }) diff --git a/app/src/main/java/info/nightscout/androidaps/dialogs/LoopDialog.kt b/app/src/main/java/info/nightscout/androidaps/dialogs/LoopDialog.kt index 5cffcd0427..493656f1cf 100644 --- a/app/src/main/java/info/nightscout/androidaps/dialogs/LoopDialog.kt +++ b/app/src/main/java/info/nightscout/androidaps/dialogs/LoopDialog.kt @@ -324,7 +324,7 @@ class LoopDialog : DaggerDialogFragment() { commandQueue.cancelTempBasal(true, object : Callback() { override fun run() { if (!result.success) { - ErrorHelperActivity.runAlarm(ctx, result.comment, resourceHelper.gs(R.string.tempbasaldeliveryerror), info.nightscout.androidaps.dana.R.raw.boluserror) + ErrorHelperActivity.runAlarm(ctx, result.comment, resourceHelper.gs(R.string.tempbasaldeliveryerror), R.raw.boluserror) } } }) diff --git a/app/src/main/java/info/nightscout/androidaps/dialogs/TempBasalDialog.kt b/app/src/main/java/info/nightscout/androidaps/dialogs/TempBasalDialog.kt index 10df72c584..f5c02a69d4 100644 --- a/app/src/main/java/info/nightscout/androidaps/dialogs/TempBasalDialog.kt +++ b/app/src/main/java/info/nightscout/androidaps/dialogs/TempBasalDialog.kt @@ -119,7 +119,7 @@ class TempBasalDialog : DialogFragmentWithDate() { val callback: Callback = object : Callback() { override fun run() { if (!result.success) { - ErrorHelperActivity.runAlarm(ctx, result.comment, resourceHelper.gs(R.string.tempbasaldeliveryerror), info.nightscout.androidaps.dana.R.raw.boluserror) + ErrorHelperActivity.runAlarm(ctx, result.comment, resourceHelper.gs(R.string.tempbasaldeliveryerror), R.raw.boluserror) } } } diff --git a/app/src/main/java/info/nightscout/androidaps/dialogs/TreatmentDialog.kt b/app/src/main/java/info/nightscout/androidaps/dialogs/TreatmentDialog.kt index a76863bce2..060eaff132 100644 --- a/app/src/main/java/info/nightscout/androidaps/dialogs/TreatmentDialog.kt +++ b/app/src/main/java/info/nightscout/androidaps/dialogs/TreatmentDialog.kt @@ -174,7 +174,7 @@ class TreatmentDialog : DialogFragmentWithDate() { commandQueue.bolus(detailedBolusInfo, object : Callback() { override fun run() { if (!result.success) { - ErrorHelperActivity.runAlarm(ctx, result.comment, resourceHelper.gs(R.string.treatmentdeliveryerror), info.nightscout.androidaps.dana.R.raw.boluserror) + ErrorHelperActivity.runAlarm(ctx, result.comment, resourceHelper.gs(R.string.treatmentdeliveryerror), R.raw.boluserror) } } }) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/aps/loop/LoopPlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/aps/loop/LoopPlugin.kt index 40a32ddcc2..82a7713b5d 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/aps/loop/LoopPlugin.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/aps/loop/LoopPlugin.kt @@ -631,7 +631,7 @@ open class LoopPlugin @Inject constructor( commandQueue.tempBasalAbsolute(0.0, durationInMinutes, true, profile, PumpSync.TemporaryBasalType.EMULATED_PUMP_SUSPEND, object : Callback() { override fun run() { if (!result.success) { - ErrorHelperActivity.runAlarm(context, result.comment, resourceHelper.gs(R.string.tempbasaldeliveryerror), info.nightscout.androidaps.dana.R.raw.boluserror) + ErrorHelperActivity.runAlarm(context, result.comment, resourceHelper.gs(R.string.tempbasaldeliveryerror), R.raw.boluserror) } } }) @@ -639,7 +639,7 @@ open class LoopPlugin @Inject constructor( commandQueue.tempBasalPercent(0, durationInMinutes, true, profile, PumpSync.TemporaryBasalType.EMULATED_PUMP_SUSPEND, object : Callback() { override fun run() { if (!result.success) { - ErrorHelperActivity.runAlarm(context, result.comment, resourceHelper.gs(R.string.tempbasaldeliveryerror), info.nightscout.androidaps.dana.R.raw.boluserror) + ErrorHelperActivity.runAlarm(context, result.comment, resourceHelper.gs(R.string.tempbasaldeliveryerror), R.raw.boluserror) } } }) @@ -648,7 +648,7 @@ open class LoopPlugin @Inject constructor( commandQueue.cancelExtended(object : Callback() { override fun run() { if (!result.success) { - ErrorHelperActivity.runAlarm(context, result.comment, resourceHelper.gs(R.string.extendedbolusdeliveryerror), info.nightscout.androidaps.dana.R.raw.boluserror) + ErrorHelperActivity.runAlarm(context, result.comment, resourceHelper.gs(R.string.extendedbolusdeliveryerror), R.raw.boluserror) } } }) @@ -666,7 +666,7 @@ open class LoopPlugin @Inject constructor( commandQueue.cancelTempBasal(true, object : Callback() { override fun run() { if (!result.success) { - ErrorHelperActivity.runAlarm(context, result.comment, resourceHelper.gs(R.string.tempbasaldeliveryerror), info.nightscout.androidaps.dana.R.raw.boluserror) + ErrorHelperActivity.runAlarm(context, result.comment, resourceHelper.gs(R.string.tempbasaldeliveryerror), R.raw.boluserror) } } }) diff --git a/danar/src/main/java/info/nightscout/androidaps/danaRv2/comm/MsgHistoryEvents_v2.kt b/danar/src/main/java/info/nightscout/androidaps/danaRv2/comm/MsgHistoryEvents_v2.kt index 0cd213a56a..cff117939c 100644 --- a/danar/src/main/java/info/nightscout/androidaps/danaRv2/comm/MsgHistoryEvents_v2.kt +++ b/danar/src/main/java/info/nightscout/androidaps/danaRv2/comm/MsgHistoryEvents_v2.kt @@ -1,6 +1,7 @@ package info.nightscout.androidaps.danaRv2.comm import dagger.android.HasAndroidInjector +import info.nightscout.androidaps.dana.DanaPump import info.nightscout.androidaps.danar.R import info.nightscout.androidaps.danar.comm.MessageBase import info.nightscout.androidaps.events.EventPumpStatusChanged @@ -69,7 +70,7 @@ class MsgHistoryEvents_v2 constructor( val param2 = intFromBuff(bytes, 9, 2) val status: String when (recordCode.toInt()) { - info.nightscout.androidaps.dana.DanaPump.TEMPSTART -> { + DanaPump.TEMPSTART -> { aapsLogger.debug(LTag.PUMPBTCOMM, "EVENT TEMPSTART (" + recordCode + ") " + dateUtil.dateAndTimeString(datetime) + " (" + datetime + ")" + " Ratio: " + param1 + "% Duration: " + param2 + "min") val temporaryBasalInfo = temporaryBasalStorage.findTemporaryBasal(datetime, param1.toDouble()) pumpSync.syncTemporaryBasalWithPumpId( @@ -84,7 +85,7 @@ class MsgHistoryEvents_v2 constructor( status = "TEMPSTART " + dateUtil.timeString(datetime) } - info.nightscout.androidaps.dana.DanaPump.TEMPSTOP -> { + DanaPump.TEMPSTOP -> { aapsLogger.debug(LTag.PUMPBTCOMM, "EVENT TEMPSTOP (" + recordCode + ") " + dateUtil.dateAndTimeString(datetime)) pumpSync.syncStopTemporaryBasalWithPumpId( timestamp = datetime, @@ -94,7 +95,7 @@ class MsgHistoryEvents_v2 constructor( status = "TEMPSTOP " + dateUtil.timeString(datetime) } - info.nightscout.androidaps.dana.DanaPump.EXTENDEDSTART -> { + DanaPump.EXTENDEDSTART -> { val newRecord = pumpSync.syncExtendedBolusWithPumpId( timestamp = datetime, amount = param1 / 100.0, @@ -107,7 +108,7 @@ class MsgHistoryEvents_v2 constructor( status = "EXTENDEDSTART " + dateUtil.timeString(datetime) } - info.nightscout.androidaps.dana.DanaPump.EXTENDEDSTOP -> { + DanaPump.EXTENDEDSTOP -> { val newRecord = pumpSync.syncStopExtendedBolusWithPumpId( timestamp = datetime, endPumpId = datetime, @@ -117,7 +118,7 @@ class MsgHistoryEvents_v2 constructor( status = "EXTENDEDSTOP " + dateUtil.timeString(datetime) } - info.nightscout.androidaps.dana.DanaPump.BOLUS -> { + DanaPump.BOLUS -> { val detailedBolusInfo = detailedBolusInfoStorage.findDetailedBolusInfo(datetime, param1 / 100.0) val newRecord = pumpSync.syncBolusWithPumpId( timestamp = datetime, @@ -130,7 +131,7 @@ class MsgHistoryEvents_v2 constructor( status = "BOLUS " + dateUtil.timeString(datetime) } - info.nightscout.androidaps.dana.DanaPump.DUALBOLUS -> { + DanaPump.DUALBOLUS -> { val detailedBolusInfo = detailedBolusInfoStorage.findDetailedBolusInfo(datetime, param1 / 100.0) val newRecord = pumpSync.syncBolusWithPumpId( timestamp = datetime, @@ -143,7 +144,7 @@ class MsgHistoryEvents_v2 constructor( status = "DUALBOLUS " + dateUtil.timeString(datetime) } - info.nightscout.androidaps.dana.DanaPump.DUALEXTENDEDSTART -> { + DanaPump.DUALEXTENDEDSTART -> { val newRecord = pumpSync.syncExtendedBolusWithPumpId( timestamp = datetime, amount = param1 / 100.0, @@ -156,7 +157,7 @@ class MsgHistoryEvents_v2 constructor( status = "DUALEXTENDEDSTART " + dateUtil.timeString(datetime) } - info.nightscout.androidaps.dana.DanaPump.DUALEXTENDEDSTOP -> { + DanaPump.DUALEXTENDEDSTOP -> { val newRecord = pumpSync.syncStopExtendedBolusWithPumpId( timestamp = datetime, endPumpId = datetime, @@ -166,32 +167,32 @@ class MsgHistoryEvents_v2 constructor( status = "DUALEXTENDEDSTOP " + dateUtil.timeString(datetime) } - info.nightscout.androidaps.dana.DanaPump.SUSPENDON -> { + DanaPump.SUSPENDON -> { aapsLogger.debug(LTag.PUMPBTCOMM, "EVENT SUSPENDON (" + recordCode + ") " + dateUtil.dateAndTimeString(datetime) + " (" + datetime + ")") status = "SUSPENDON " + dateUtil.timeString(datetime) } - info.nightscout.androidaps.dana.DanaPump.SUSPENDOFF -> { + DanaPump.SUSPENDOFF -> { aapsLogger.debug(LTag.PUMPBTCOMM, "EVENT SUSPENDOFF (" + recordCode + ") " + dateUtil.dateAndTimeString(datetime) + " (" + datetime + ")") status = "SUSPENDOFF " + dateUtil.timeString(datetime) } - info.nightscout.androidaps.dana.DanaPump.REFILL -> { + DanaPump.REFILL -> { aapsLogger.debug(LTag.PUMPBTCOMM, "EVENT REFILL (" + recordCode + ") " + dateUtil.dateAndTimeString(datetime) + " (" + datetime + ")" + " Amount: " + param1 / 100.0 + "U") status = "REFILL " + dateUtil.timeString(datetime) } - info.nightscout.androidaps.dana.DanaPump.PRIME -> { + DanaPump.PRIME -> { aapsLogger.debug(LTag.PUMPBTCOMM, "EVENT PRIME (" + recordCode + ") " + dateUtil.dateAndTimeString(datetime) + " (" + datetime + ")" + " Amount: " + param1 / 100.0 + "U") status = "PRIME " + dateUtil.timeString(datetime) } - info.nightscout.androidaps.dana.DanaPump.PROFILECHANGE -> { + DanaPump.PROFILECHANGE -> { aapsLogger.debug(LTag.PUMPBTCOMM, "EVENT PROFILECHANGE (" + recordCode + ") " + dateUtil.dateAndTimeString(datetime) + " (" + datetime + ")" + " No: " + param1 + " CurrentRate: " + param2 / 100.0 + "U/h") status = "PROFILECHANGE " + dateUtil.timeString(datetime) } - info.nightscout.androidaps.dana.DanaPump.CARBS -> { + DanaPump.CARBS -> { val newRecord = pumpSync.syncCarbsWithTimestamp( timestamp = datetime, amount = param1.toDouble(), diff --git a/danars/src/main/java/info/nightscout/androidaps/danars/DanaRSPlugin.kt b/danars/src/main/java/info/nightscout/androidaps/danars/DanaRSPlugin.kt index fdd97c7a4a..ffe87ed77b 100644 --- a/danars/src/main/java/info/nightscout/androidaps/danars/DanaRSPlugin.kt +++ b/danars/src/main/java/info/nightscout/androidaps/danars/DanaRSPlugin.kt @@ -9,13 +9,15 @@ import android.text.format.DateFormat import androidx.preference.Preference import dagger.android.HasAndroidInjector import info.nightscout.androidaps.dana.DanaPump +import info.nightscout.androidaps.dana.comm.RecordTypes import info.nightscout.androidaps.danars.events.EventDanaRSDeviceChange import info.nightscout.androidaps.danars.services.DanaRSService import info.nightscout.androidaps.data.DetailedBolusInfo -import info.nightscout.androidaps.interfaces.Profile import info.nightscout.androidaps.data.PumpEnactResult import info.nightscout.androidaps.events.EventAppExit import info.nightscout.androidaps.events.EventConfigBuilderChange +import info.nightscout.androidaps.extensions.convertedToAbsolute +import info.nightscout.androidaps.extensions.plannedRemainingMinutes import info.nightscout.androidaps.interfaces.* import info.nightscout.androidaps.logging.AAPSLogger import info.nightscout.androidaps.logging.LTag @@ -31,8 +33,6 @@ import info.nightscout.androidaps.plugins.pump.common.bolusInfo.TemporaryBasalSt import info.nightscout.androidaps.plugins.pump.common.defs.PumpType import info.nightscout.androidaps.utils.* import info.nightscout.androidaps.utils.T.Companion.mins -import info.nightscout.androidaps.extensions.convertedToAbsolute -import info.nightscout.androidaps.extensions.plannedRemainingMinutes import info.nightscout.androidaps.utils.resources.ResourceHelper import info.nightscout.androidaps.utils.rx.AapsSchedulers import info.nightscout.androidaps.utils.sharedPreferences.SP @@ -622,7 +622,7 @@ class DanaRSPlugin @Inject constructor( } override val isFakingTempsByExtendedBoluses: Boolean = false - override fun loadTDDs(): PumpEnactResult = loadHistory(info.nightscout.androidaps.dana.comm.RecordTypes.RECORD_TYPE_DAILY) + override fun loadTDDs(): PumpEnactResult = loadHistory(RecordTypes.RECORD_TYPE_DAILY) override fun canHandleDST(): Boolean = false override fun clearPairing() { sp.remove(resourceHelper.gs(R.string.key_danars_pairingkey) + mDeviceName) diff --git a/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsMessageHashTableTest.kt b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsMessageHashTableTest.kt index d8388ad435..1fa4f4c7ee 100644 --- a/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsMessageHashTableTest.kt +++ b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsMessageHashTableTest.kt @@ -2,12 +2,13 @@ package info.nightscout.androidaps.danars.comm import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector +import info.nightscout.androidaps.dana.DanaPump +import info.nightscout.androidaps.danars.DanaRSTestBase import info.nightscout.androidaps.danars.encryption.BleEncryption import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.interfaces.Constraint import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker import info.nightscout.androidaps.plugins.pump.common.bolusInfo.DetailedBolusInfoStorage -import info.nightscout.androidaps.danars.DanaRSTestBase import org.junit.Assert import org.junit.Test import org.junit.runner.RunWith @@ -47,7 +48,7 @@ class DanaRsMessageHashTableTest : DanaRSTestBase() { `when`(constraintChecker.applyBolusConstraints(anyObject())).thenReturn(Constraint(0.0)) val danaRSMessageHashTable = DanaRSMessageHashTable(packetInjector) - val forTesting: DanaRSPacket = DanaRSPacketAPSSetEventHistory(packetInjector, info.nightscout.androidaps.dana.DanaPump.CARBS, 0, 0, 0) + val forTesting: DanaRSPacket = DanaRSPacketAPSSetEventHistory(packetInjector, DanaPump.CARBS, 0, 0, 0) val testPacket: DanaRSPacket = danaRSMessageHashTable.findMessage(forTesting.command) Assert.assertEquals(BleEncryption.DANAR_PACKET__OPCODE__APS_SET_EVENT_HISTORY.toLong(), testPacket.opCode.toLong()) }