DanaR: remove core dependency
This commit is contained in:
parent
b38bc5c830
commit
da14175da4
|
@ -11,6 +11,7 @@
|
|||
<option name="XML_TEXT_WRAP" value="0" />
|
||||
</XML>
|
||||
<codeStyleSettings language="JAVA">
|
||||
<option name="RIGHT_MARGIN" value="200" />
|
||||
<option name="METHOD_ANNOTATION_WRAP" value="0" />
|
||||
<option name="FIELD_ANNOTATION_WRAP" value="0" />
|
||||
</codeStyleSettings>
|
||||
|
|
|
@ -447,7 +447,7 @@ class BolusWizard @Inject constructor(
|
|||
commandQueue.tempBasalAbsolute(0.0, 120, true, profile, PumpSync.TemporaryBasalType.NORMAL, object : Callback() {
|
||||
override fun run() {
|
||||
if (!result.success) {
|
||||
activityNames.runAlarm(ctx, result.comment, rh.gs(R.string.tempbasaldeliveryerror), R.raw.boluserror)
|
||||
activityNames.runAlarm(ctx, result.comment, rh.gs(R.string.temp_basal_delivery_error), R.raw.boluserror)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
@ -455,7 +455,7 @@ class BolusWizard @Inject constructor(
|
|||
commandQueue.tempBasalPercent(0, 120, true, profile, PumpSync.TemporaryBasalType.NORMAL, object : Callback() {
|
||||
override fun run() {
|
||||
if (!result.success) {
|
||||
activityNames.runAlarm(ctx, result.comment, rh.gs(R.string.tempbasaldeliveryerror), R.raw.boluserror)
|
||||
activityNames.runAlarm(ctx, result.comment, rh.gs(R.string.temp_basal_delivery_error), R.raw.boluserror)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
<!-- General-->
|
||||
<string name="save">Save</string>
|
||||
<string name="not_set_short">Not set</string>
|
||||
<string name="tempbasaldeliveryerror">Tempbasal delivery error</string>
|
||||
<string name="goingtodeliver">Going to deliver %1$.2f U</string>
|
||||
<string name="waitingforpump">Waiting for pump</string>
|
||||
<string name="androidaps_start">AAPS started</string>
|
||||
|
@ -128,13 +127,6 @@
|
|||
<string name="ic_short">IC</string>
|
||||
<string name="isf_short">ISF</string>
|
||||
|
||||
<!-- Constraints-->
|
||||
<string name="limitingbasalratio">Limiting max basal rate to %1$.2f U/h because of %2$s</string>
|
||||
<string name="pumplimit">pump limit</string>
|
||||
<string name="limitingpercentrate">Limiting max percent rate to %1$d%% because of %2$s</string>
|
||||
<string name="itmustbepositivevalue">it must be positive value</string>
|
||||
<string name="limitingbolus">Limiting bolus to %1$.1f U because of %2$s</string>
|
||||
|
||||
<!-- BlePreCheck-->
|
||||
<string name="ble_not_supported">Bluetooth Low Energy not supported.</string>
|
||||
<string name="ble_not_supported_or_not_paired">Bluetooth Low Energy not supported or device not paired.</string>
|
||||
|
@ -426,13 +418,10 @@
|
|||
<string name="keepalive_status_outdated" comment="26 characters max for translation">KeepAlive. Status outdated.</string>
|
||||
<string name="keepalive_basal_outdated" comment="26 characters max for translation">KeepAlive. Basal outdated.</string>
|
||||
<string name="sms" comment="26 characters max for translation">SMS</string>
|
||||
<string name="pump_driver_change" comment="26 characters max for translation">Pump driver change.</string>
|
||||
<string name="device_changed" comment="26 characters max for translation">Device changed</string>
|
||||
<string name="clicked_refresh" comment="26 characters max for translation">Clicked refresh</string>
|
||||
<string name="scheduled_status_refresh" comment="26 characters max for translation">Scheduled Status Refresh</string>
|
||||
<string name="unconfirmed_command" comment="26 characters max for translation">Unconfirmed command</string>
|
||||
<string name="requested_by_user" comment="26 characters max for translation">Requested by user</string>
|
||||
<string name="bolus_ok" comment="26 characters max for translation">Bolus OK</string>
|
||||
<string name="insight_refresh_button" comment="26 characters max for translation">Insight Refresh Button</string>
|
||||
<string name="formatPercent">%1$.0f%%</string>
|
||||
<string name="basal">Basal</string>
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
<string name="mgdl">mg/dl</string>
|
||||
<string name="mmol">mmol/l</string>
|
||||
|
||||
<!-- PumpFragments-->
|
||||
<!-- Pumps -->
|
||||
<string name="battery_label">Battery</string>
|
||||
<string name="reservoir_label">Reservoir</string>
|
||||
<string name="last_connection_label">Last connection</string>
|
||||
|
@ -41,6 +41,17 @@
|
|||
<string name="view_profile">View profile</string>
|
||||
<string name="pump_history">Pump history</string>
|
||||
<string name="stats">Stats</string>
|
||||
<string name="pump_driver_change" comment="26 characters max for translation">Pump driver change.</string>
|
||||
<string name="device_changed" comment="26 characters max for translation">Device changed</string>
|
||||
<string name="bolus_ok" comment="26 characters max for translation">Bolus OK</string>
|
||||
<string name="temp_basal_delivery_error">Tempbasal delivery error</string>
|
||||
|
||||
<!-- Constraints-->
|
||||
<string name="limitingbasalratio">Limiting max basal rate to %1$.2f U/h because of %2$s</string>
|
||||
<string name="pumplimit">pump limit</string>
|
||||
<string name="limitingpercentrate">Limiting max percent rate to %1$d%% because of %2$s</string>
|
||||
<string name="itmustbepositivevalue">it must be positive value</string>
|
||||
<string name="limitingbolus">Limiting bolus to %1$.1f U because of %2$s</string>
|
||||
|
||||
<!-- Locale -->
|
||||
<string name="key_language" translatable="false">language</string>
|
||||
|
|
|
@ -679,7 +679,7 @@ class LoopPlugin @Inject constructor(
|
|||
commandQueue.tempBasalAbsolute(0.0, durationInMinutes, true, profile, PumpSync.TemporaryBasalType.EMULATED_PUMP_SUSPEND, object : Callback() {
|
||||
override fun run() {
|
||||
if (!result.success) {
|
||||
activityNames.runAlarm(context, result.comment, rh.gs(R.string.tempbasaldeliveryerror), R.raw.boluserror)
|
||||
activityNames.runAlarm(context, result.comment, rh.gs(R.string.temp_basal_delivery_error), R.raw.boluserror)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
@ -687,7 +687,7 @@ class LoopPlugin @Inject constructor(
|
|||
commandQueue.tempBasalPercent(0, durationInMinutes, true, profile, PumpSync.TemporaryBasalType.EMULATED_PUMP_SUSPEND, object : Callback() {
|
||||
override fun run() {
|
||||
if (!result.success) {
|
||||
activityNames.runAlarm(context, result.comment, rh.gs(R.string.tempbasaldeliveryerror), R.raw.boluserror)
|
||||
activityNames.runAlarm(context, result.comment, rh.gs(R.string.temp_basal_delivery_error), R.raw.boluserror)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
@ -714,7 +714,7 @@ class LoopPlugin @Inject constructor(
|
|||
commandQueue.cancelTempBasal(true, object : Callback() {
|
||||
override fun run() {
|
||||
if (!result.success) {
|
||||
activityNames.runAlarm(context, result.comment, rh.gs(R.string.tempbasaldeliveryerror), R.raw.boluserror)
|
||||
activityNames.runAlarm(context, result.comment, rh.gs(R.string.temp_basal_delivery_error), R.raw.boluserror)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
|
|
@ -158,7 +158,7 @@ class ActionsFragment : DaggerFragment() {
|
|||
commandQueue.cancelTempBasal(true, object : Callback() {
|
||||
override fun run() {
|
||||
if (!result.success) {
|
||||
activityNames.runAlarm(ctx, result.comment, rh.gs(R.string.tempbasaldeliveryerror), R.raw.boluserror)
|
||||
activityNames.runAlarm(ctx, result.comment, rh.gs(R.string.temp_basal_delivery_error), R.raw.boluserror)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
|
|
@ -17,9 +17,11 @@ android {
|
|||
|
||||
dependencies {
|
||||
implementation project(':app-wear-shared:shared')
|
||||
implementation project(':core:core-main')
|
||||
//implementation project(':core:core-main')
|
||||
implementation project(':core:interfaces')
|
||||
implementation project(':core:utils')
|
||||
implementation project(':core:ui')
|
||||
implementation project(':pump:dana')
|
||||
|
||||
testImplementation project(':core:core-main')
|
||||
}
|
|
@ -20,6 +20,7 @@ import info.nightscout.interfaces.pump.PumpSync
|
|||
import info.nightscout.interfaces.pump.PumpSync.TemporaryBasalType
|
||||
import info.nightscout.interfaces.pump.defs.PumpType
|
||||
import info.nightscout.interfaces.queue.CommandQueue
|
||||
import info.nightscout.interfaces.ui.ActivityNames
|
||||
import info.nightscout.interfaces.utils.Round
|
||||
import info.nightscout.pump.dana.DanaPump
|
||||
import info.nightscout.rx.AapsSchedulers
|
||||
|
@ -53,8 +54,9 @@ class DanaRKoreanPlugin @Inject constructor(
|
|||
danaPump: DanaPump,
|
||||
dateUtil: DateUtil,
|
||||
private val fabricPrivacy: FabricPrivacy,
|
||||
pumpSync: PumpSync
|
||||
) : AbstractDanaRPlugin(injector, danaPump, rh, constraintChecker, aapsLogger, aapsSchedulers, commandQueue, rxBus, activePlugin, sp, dateUtil, pumpSync) {
|
||||
pumpSync: PumpSync,
|
||||
activityNames: ActivityNames
|
||||
) : AbstractDanaRPlugin(injector, danaPump, rh, constraintChecker, aapsLogger, aapsSchedulers, commandQueue, rxBus, activePlugin, sp, dateUtil, pumpSync, activityNames) {
|
||||
|
||||
init {
|
||||
pluginDescription.description(R.string.description_pump_dana_r_korean)
|
||||
|
|
|
@ -3,7 +3,6 @@ package info.nightscout.androidaps.danaRKorean.comm
|
|||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.danar.R
|
||||
import info.nightscout.androidaps.danar.comm.MessageBase
|
||||
import info.nightscout.core.events.EventNewNotification
|
||||
import info.nightscout.interfaces.notifications.Notification
|
||||
import info.nightscout.rx.events.EventDismissNotification
|
||||
import info.nightscout.rx.logging.LTag
|
||||
|
@ -32,14 +31,12 @@ class MsgInitConnStatusBasic_k(
|
|||
aapsLogger.debug(LTag.PUMPCOMM, "easyUIMode: $easyUIMode")
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "Pump password: " + danaPump.password)
|
||||
if (danaPump.isEasyModeEnabled) {
|
||||
val notification = Notification(Notification.EASY_MODE_ENABLED, rh.gs(R.string.danar_disableeasymode), Notification.URGENT)
|
||||
rxBus.send(EventNewNotification(notification))
|
||||
activityNames.addNotification(Notification.EASY_MODE_ENABLED, rh.gs(R.string.danar_disableeasymode), Notification.URGENT)
|
||||
} else {
|
||||
rxBus.send(EventDismissNotification(Notification.EASY_MODE_ENABLED))
|
||||
}
|
||||
if (!danaPump.isPasswordOK) {
|
||||
val notification = Notification(Notification.WRONG_PUMP_PASSWORD, rh.gs(R.string.wrongpumppassword), Notification.URGENT)
|
||||
rxBus.send(EventNewNotification(notification))
|
||||
activityNames.addNotification(Notification.WRONG_PUMP_PASSWORD, rh.gs(R.string.wrongpumppassword), Notification.URGENT)
|
||||
} else {
|
||||
rxBus.send(EventDismissNotification(Notification.WRONG_PUMP_PASSWORD))
|
||||
}
|
||||
|
|
|
@ -3,7 +3,6 @@ package info.nightscout.androidaps.danaRKorean.comm
|
|||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.danar.R
|
||||
import info.nightscout.androidaps.danar.comm.MessageBase
|
||||
import info.nightscout.core.events.EventNewNotification
|
||||
import info.nightscout.interfaces.notifications.Notification
|
||||
import info.nightscout.rx.events.EventDismissNotification
|
||||
import info.nightscout.rx.logging.LTag
|
||||
|
@ -32,8 +31,7 @@ class MsgInitConnStatusBolus_k(
|
|||
aapsLogger.debug(LTag.PUMPCOMM, "Bolus max: " + danaPump.maxBolus)
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "Delivery status: $deliveryStatus")
|
||||
if (!danaPump.isExtendedBolusEnabled) {
|
||||
val notification = Notification(Notification.EXTENDED_BOLUS_DISABLED, rh.gs(R.string.danar_enableextendedbolus), Notification.URGENT)
|
||||
rxBus.send(EventNewNotification(notification))
|
||||
activityNames.addNotification(Notification.EXTENDED_BOLUS_DISABLED, rh.gs(R.string.danar_enableextendedbolus), Notification.URGENT)
|
||||
} else {
|
||||
rxBus.send(EventDismissNotification(Notification.EXTENDED_BOLUS_DISABLED))
|
||||
}
|
||||
|
|
|
@ -3,7 +3,6 @@ package info.nightscout.androidaps.danaRKorean.comm
|
|||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.danar.R
|
||||
import info.nightscout.androidaps.danar.comm.MessageBase
|
||||
import info.nightscout.core.events.EventNewNotification
|
||||
import info.nightscout.interfaces.notifications.Notification
|
||||
import info.nightscout.interfaces.plugin.PluginType
|
||||
import info.nightscout.rx.events.EventRebuildTabs
|
||||
|
@ -20,8 +19,7 @@ class MsgInitConnStatusTime_k(
|
|||
|
||||
override fun handleMessage(bytes: ByteArray) {
|
||||
if (bytes.size - 10 < 10) {
|
||||
val notification = Notification(Notification.WRONG_DRIVER, rh.gs(R.string.pumpdrivercorrected), Notification.NORMAL)
|
||||
rxBus.send(EventNewNotification(notification))
|
||||
activityNames.addNotification(Notification.WRONG_DRIVER, rh.gs(R.string.pumpdrivercorrected), Notification.NORMAL)
|
||||
danaRKoreanPlugin.disconnect("Wrong Model")
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "Wrong model selected. Switching to export DanaR")
|
||||
danaRKoreanPlugin.setPluginEnabled(PluginType.PUMP, false)
|
||||
|
|
|
@ -34,7 +34,6 @@ import info.nightscout.androidaps.danar.comm.MsgSettingShippingInfo;
|
|||
import info.nightscout.androidaps.danar.comm.MsgStatusBolusExtended;
|
||||
import info.nightscout.androidaps.danar.comm.MsgStatusTempBasal;
|
||||
import info.nightscout.androidaps.danar.services.AbstractDanaRExecutionService;
|
||||
import info.nightscout.core.events.EventNewNotification;
|
||||
import info.nightscout.interfaces.Constants;
|
||||
import info.nightscout.interfaces.constraints.Constraints;
|
||||
import info.nightscout.interfaces.notifications.Notification;
|
||||
|
@ -47,6 +46,7 @@ import info.nightscout.interfaces.pump.PumpSync;
|
|||
import info.nightscout.interfaces.pump.defs.PumpType;
|
||||
import info.nightscout.interfaces.queue.Command;
|
||||
import info.nightscout.interfaces.queue.CommandQueue;
|
||||
import info.nightscout.interfaces.ui.ActivityNames;
|
||||
import info.nightscout.pump.dana.DanaPump;
|
||||
import info.nightscout.pump.dana.events.EventDanaRNewStatus;
|
||||
import info.nightscout.rx.bus.RxBus;
|
||||
|
@ -70,11 +70,12 @@ public class DanaRKoreanExecutionService extends AbstractDanaRExecutionService {
|
|||
@Inject DanaRKoreanPlugin danaRKoreanPlugin;
|
||||
@Inject CommandQueue commandQueue;
|
||||
@Inject MessageHashTableRKorean messageHashTableRKorean;
|
||||
@Inject ActivePlugin activePlugin;
|
||||
@Inject ActivityNames activityNames;
|
||||
@Inject ProfileFunction profileFunction;
|
||||
@Inject PumpSync pumpSync;
|
||||
@Inject DateUtil dateUtil;
|
||||
|
||||
|
||||
public DanaRKoreanExecutionService() {
|
||||
}
|
||||
|
||||
|
@ -198,8 +199,7 @@ public class DanaRKoreanExecutionService extends AbstractDanaRExecutionService {
|
|||
if (danaPump.getDailyTotalUnits() > danaPump.getMaxDailyTotalUnits() * Constants.dailyLimitWarning) {
|
||||
aapsLogger.debug(LTag.PUMP, "Approaching daily limit: " + danaPump.getDailyTotalUnits() + "/" + danaPump.getMaxDailyTotalUnits());
|
||||
if (System.currentTimeMillis() > lastApproachingDailyLimit + 30 * 60 * 1000) {
|
||||
Notification reportFail = new Notification(Notification.APPROACHING_DAILY_LIMIT, rh.gs(R.string.approachingdailylimit), Notification.URGENT);
|
||||
rxBus.send(new EventNewNotification(reportFail));
|
||||
activityNames.addNotification(Notification.APPROACHING_DAILY_LIMIT, rh.gs(R.string.approachingdailylimit), Notification.URGENT);
|
||||
pumpSync.insertAnnouncement(rh.gs(R.string.approachingdailylimit) + ": " + danaPump.getDailyTotalUnits() + "/" + danaPump.getMaxDailyTotalUnits() + "U", null, PumpType.DANA_R_KOREAN, danaRKoreanPlugin.serialNumber());
|
||||
lastApproachingDailyLimit = System.currentTimeMillis();
|
||||
}
|
||||
|
|
|
@ -27,6 +27,7 @@ import info.nightscout.interfaces.pump.PumpSync;
|
|||
import info.nightscout.interfaces.pump.TemporaryBasalStorage;
|
||||
import info.nightscout.interfaces.pump.defs.PumpType;
|
||||
import info.nightscout.interfaces.queue.CommandQueue;
|
||||
import info.nightscout.interfaces.ui.ActivityNames;
|
||||
import info.nightscout.interfaces.utils.Round;
|
||||
import info.nightscout.pump.dana.DanaPump;
|
||||
import info.nightscout.rx.AapsSchedulers;
|
||||
|
@ -72,9 +73,10 @@ public class DanaRv2Plugin extends AbstractDanaRPlugin {
|
|||
TemporaryBasalStorage temporaryBasalStorage,
|
||||
DateUtil dateUtil,
|
||||
FabricPrivacy fabricPrivacy,
|
||||
PumpSync pumpSync
|
||||
PumpSync pumpSync,
|
||||
ActivityNames activityNames
|
||||
) {
|
||||
super(injector, danaPump, rh, constraintChecker, aapsLogger, aapsSchedulers, commandQueue, rxBus, activePlugin, sp, dateUtil, pumpSync);
|
||||
super(injector, danaPump, rh, constraintChecker, aapsLogger, aapsSchedulers, commandQueue, rxBus, activePlugin, sp, dateUtil, pumpSync, activityNames);
|
||||
this.aapsLogger = aapsLogger;
|
||||
this.context = context;
|
||||
this.rh = rh;
|
||||
|
@ -316,7 +318,7 @@ public class DanaRv2Plugin extends AbstractDanaRPlugin {
|
|||
aapsLogger.debug(LTag.PUMP, "setTempBasalPercent: OK");
|
||||
return result;
|
||||
}
|
||||
result.enacted(false).success(false).comment(R.string.tempbasaldeliveryerror);
|
||||
result.enacted(false).success(false).comment(R.string.temp_basal_delivery_error);
|
||||
aapsLogger.error("setTempBasalPercent: Failed to set temp basal");
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -3,7 +3,6 @@ package info.nightscout.androidaps.danaRv2.comm
|
|||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.danar.R
|
||||
import info.nightscout.androidaps.danar.comm.MessageBase
|
||||
import info.nightscout.core.events.EventNewNotification
|
||||
import info.nightscout.interfaces.notifications.Notification
|
||||
import info.nightscout.interfaces.plugin.PluginType
|
||||
import info.nightscout.pump.dana.DanaPump
|
||||
|
@ -26,8 +25,7 @@ class MsgCheckValue_v2(
|
|||
danaPump.protocol = intFromBuff(bytes, 1, 1)
|
||||
danaPump.productCode = intFromBuff(bytes, 2, 1)
|
||||
if (danaPump.hwModel != DanaPump.EXPORT_MODEL) {
|
||||
val notification = Notification(Notification.WRONG_DRIVER, rh.gs(R.string.pumpdrivercorrected), Notification.NORMAL)
|
||||
rxBus.send(EventNewNotification(notification))
|
||||
activityNames.addNotification(Notification.WRONG_DRIVER, rh.gs(R.string.pumpdrivercorrected), Notification.NORMAL)
|
||||
danaRPlugin.disconnect("Wrong Model")
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "Wrong model selected. Switching to Korean DanaR")
|
||||
danaRKoreanPlugin.setPluginEnabled(PluginType.PUMP, true)
|
||||
|
@ -43,8 +41,7 @@ class MsgCheckValue_v2(
|
|||
return
|
||||
}
|
||||
if (danaPump.protocol != 2) {
|
||||
val notification = Notification(Notification.WRONG_DRIVER, rh.gs(R.string.pumpdrivercorrected), Notification.NORMAL)
|
||||
rxBus.send(EventNewNotification(notification))
|
||||
activityNames.addNotification(Notification.WRONG_DRIVER, rh.gs(R.string.pumpdrivercorrected), Notification.NORMAL)
|
||||
danaRKoreanPlugin.disconnect("Wrong Model")
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "Wrong model selected. Switching to non APS DanaR")
|
||||
danaRv2Plugin.setPluginEnabled(PluginType.PUMP, false)
|
||||
|
|
|
@ -46,7 +46,6 @@ import info.nightscout.androidaps.danar.comm.MsgStatusBasic;
|
|||
import info.nightscout.androidaps.danar.comm.MsgStatusBolusExtended;
|
||||
import info.nightscout.androidaps.danar.comm.MsgStatusTempBasal;
|
||||
import info.nightscout.androidaps.danar.services.AbstractDanaRExecutionService;
|
||||
import info.nightscout.core.events.EventNewNotification;
|
||||
import info.nightscout.interfaces.Constants;
|
||||
import info.nightscout.interfaces.notifications.Notification;
|
||||
import info.nightscout.interfaces.plugin.ActivePlugin;
|
||||
|
@ -237,8 +236,7 @@ public class DanaRv2ExecutionService extends AbstractDanaRExecutionService {
|
|||
if (danaPump.getDailyTotalUnits() > danaPump.getMaxDailyTotalUnits() * Constants.dailyLimitWarning) {
|
||||
aapsLogger.debug(LTag.PUMP, "Approaching daily limit: " + danaPump.getDailyTotalUnits() + "/" + danaPump.getMaxDailyTotalUnits());
|
||||
if (System.currentTimeMillis() > lastApproachingDailyLimit + 30 * 60 * 1000) {
|
||||
Notification reportFail = new Notification(Notification.APPROACHING_DAILY_LIMIT, rh.gs(R.string.approachingdailylimit), Notification.URGENT);
|
||||
rxBus.send(new EventNewNotification(reportFail));
|
||||
activityNames.addNotification(Notification.APPROACHING_DAILY_LIMIT, rh.gs(R.string.approachingdailylimit), Notification.URGENT);
|
||||
pumpSync.insertAnnouncement(rh.gs(R.string.approachingdailylimit) + ": " + danaPump.getDailyTotalUnits() + "/" + danaPump.getMaxDailyTotalUnits() + "U", null, PumpType.DANA_R_KOREAN, danaRKoreanPlugin.serialNumber());
|
||||
lastApproachingDailyLimit = System.currentTimeMillis();
|
||||
}
|
||||
|
|
|
@ -7,7 +7,6 @@ import org.json.JSONObject;
|
|||
|
||||
import dagger.android.HasAndroidInjector;
|
||||
import info.nightscout.androidaps.danar.services.AbstractDanaRExecutionService;
|
||||
import info.nightscout.core.events.EventNewNotification;
|
||||
import info.nightscout.interfaces.constraints.Constraint;
|
||||
import info.nightscout.interfaces.constraints.Constraints;
|
||||
import info.nightscout.interfaces.notifications.Notification;
|
||||
|
@ -23,6 +22,7 @@ import info.nightscout.interfaces.pump.PumpSync;
|
|||
import info.nightscout.interfaces.pump.defs.ManufacturerType;
|
||||
import info.nightscout.interfaces.pump.defs.PumpDescription;
|
||||
import info.nightscout.interfaces.queue.CommandQueue;
|
||||
import info.nightscout.interfaces.ui.ActivityNames;
|
||||
import info.nightscout.interfaces.utils.DecimalFormatter;
|
||||
import info.nightscout.interfaces.utils.Round;
|
||||
import info.nightscout.pump.dana.DanaFragment;
|
||||
|
@ -60,6 +60,7 @@ public abstract class AbstractDanaRPlugin extends PumpPluginBase implements Pump
|
|||
protected DateUtil dateUtil;
|
||||
protected AapsSchedulers aapsSchedulers;
|
||||
protected PumpSync pumpSync;
|
||||
protected ActivityNames activityNames;
|
||||
|
||||
protected AbstractDanaRPlugin(
|
||||
HasAndroidInjector injector,
|
||||
|
@ -73,7 +74,8 @@ public abstract class AbstractDanaRPlugin extends PumpPluginBase implements Pump
|
|||
ActivePlugin activePlugin,
|
||||
SP sp,
|
||||
DateUtil dateUtil,
|
||||
PumpSync pumpSync
|
||||
PumpSync pumpSync,
|
||||
ActivityNames activityNames
|
||||
) {
|
||||
super(new PluginDescription()
|
||||
.mainType(PluginType.PUMP)
|
||||
|
@ -93,6 +95,7 @@ public abstract class AbstractDanaRPlugin extends PumpPluginBase implements Pump
|
|||
this.dateUtil = dateUtil;
|
||||
this.aapsSchedulers = aapsSchedulers;
|
||||
this.pumpSync = pumpSync;
|
||||
this.activityNames = activityNames;
|
||||
}
|
||||
|
||||
@Override protected void onStart() {
|
||||
|
@ -143,22 +146,19 @@ public abstract class AbstractDanaRPlugin extends PumpPluginBase implements Pump
|
|||
}
|
||||
if (!isInitialized()) {
|
||||
getAapsLogger().error("setNewBasalProfile not initialized");
|
||||
Notification notification = new Notification(Notification.PROFILE_NOT_SET_NOT_INITIALIZED, getRh().gs(R.string.pump_not_initialized_profile_not_set), Notification.URGENT);
|
||||
rxBus.send(new EventNewNotification(notification));
|
||||
activityNames.addNotification(Notification.PROFILE_NOT_SET_NOT_INITIALIZED, getRh().gs(R.string.pump_not_initialized_profile_not_set), Notification.URGENT);
|
||||
result.comment(R.string.pump_not_initialized_profile_not_set);
|
||||
return result;
|
||||
} else {
|
||||
rxBus.send(new EventDismissNotification(Notification.PROFILE_NOT_SET_NOT_INITIALIZED));
|
||||
}
|
||||
if (!sExecutionService.updateBasalsInPump(profile)) {
|
||||
Notification notification = new Notification(Notification.FAILED_UPDATE_PROFILE, getRh().gs(R.string.failed_update_basal_profile), Notification.URGENT);
|
||||
rxBus.send(new EventNewNotification(notification));
|
||||
activityNames.addNotification(Notification.FAILED_UPDATE_PROFILE, getRh().gs(R.string.failed_update_basal_profile), Notification.URGENT);
|
||||
result.comment(R.string.failed_update_basal_profile);
|
||||
} else {
|
||||
rxBus.send(new EventDismissNotification(Notification.PROFILE_NOT_SET_NOT_INITIALIZED));
|
||||
rxBus.send(new EventDismissNotification(Notification.FAILED_UPDATE_PROFILE));
|
||||
Notification notification = new Notification(Notification.PROFILE_SET_OK, getRh().gs(R.string.profile_set_ok), Notification.INFO, 60);
|
||||
rxBus.send(new EventNewNotification(notification));
|
||||
activityNames.addNotificationValidFor(Notification.PROFILE_SET_OK, getRh().gs(R.string.profile_set_ok), Notification.INFO, 60);
|
||||
result.success(true).enacted(true).comment("OK");
|
||||
}
|
||||
return result;
|
||||
|
@ -255,7 +255,7 @@ public abstract class AbstractDanaRPlugin extends PumpPluginBase implements Pump
|
|||
);
|
||||
return result;
|
||||
}
|
||||
result.enacted(false).success(false).comment(R.string.tempbasaldeliveryerror);
|
||||
result.enacted(false).success(false).comment(R.string.temp_basal_delivery_error);
|
||||
getAapsLogger().error("setTempBasalPercent: Failed to set temp basal");
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@ import info.nightscout.interfaces.pump.PumpEnactResult;
|
|||
import info.nightscout.interfaces.pump.PumpSync;
|
||||
import info.nightscout.interfaces.pump.defs.PumpType;
|
||||
import info.nightscout.interfaces.queue.CommandQueue;
|
||||
import info.nightscout.interfaces.ui.ActivityNames;
|
||||
import info.nightscout.interfaces.utils.Round;
|
||||
import info.nightscout.pump.dana.DanaPump;
|
||||
import info.nightscout.rx.AapsSchedulers;
|
||||
|
@ -62,9 +63,10 @@ public class DanaRPlugin extends AbstractDanaRPlugin {
|
|||
DanaPump danaPump,
|
||||
DateUtil dateUtil,
|
||||
FabricPrivacy fabricPrivacy,
|
||||
PumpSync pumpSync
|
||||
PumpSync pumpSync,
|
||||
ActivityNames activityNames
|
||||
) {
|
||||
super(injector, danaPump, rh, constraints, aapsLogger, aapsSchedulers, commandQueue, rxBus, activePlugin, sp, dateUtil, pumpSync);
|
||||
super(injector, danaPump, rh, constraints, aapsLogger, aapsSchedulers, commandQueue, rxBus, activePlugin, sp, dateUtil, pumpSync, activityNames);
|
||||
this.aapsLogger = aapsLogger;
|
||||
this.context = context;
|
||||
this.rh = rh;
|
||||
|
|
|
@ -13,6 +13,7 @@ import info.nightscout.interfaces.pump.DetailedBolusInfoStorage
|
|||
import info.nightscout.interfaces.pump.PumpSync
|
||||
import info.nightscout.interfaces.pump.TemporaryBasalStorage
|
||||
import info.nightscout.interfaces.queue.CommandQueue
|
||||
import info.nightscout.interfaces.ui.ActivityNames
|
||||
import info.nightscout.pump.dana.DanaPump
|
||||
import info.nightscout.pump.dana.database.DanaHistoryRecordDao
|
||||
import info.nightscout.rx.bus.RxBus
|
||||
|
@ -50,6 +51,7 @@ open class MessageBase(injector: HasAndroidInjector) {
|
|||
@Inject lateinit var constraintChecker: Constraints
|
||||
@Inject lateinit var pumpSync: PumpSync
|
||||
@Inject lateinit var danaHistoryRecordDao: DanaHistoryRecordDao
|
||||
@Inject lateinit var activityNames: ActivityNames
|
||||
|
||||
var injector: HasAndroidInjector
|
||||
var buffer = ByteArray(512)
|
||||
|
|
|
@ -2,7 +2,6 @@ package info.nightscout.androidaps.danar.comm
|
|||
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.danar.R
|
||||
import info.nightscout.core.events.EventNewNotification
|
||||
import info.nightscout.interfaces.notifications.Notification
|
||||
import info.nightscout.rx.events.EventDismissNotification
|
||||
import info.nightscout.rx.logging.LTag
|
||||
|
@ -31,8 +30,7 @@ class MsgInitConnStatusBolus(
|
|||
aapsLogger.debug(LTag.PUMPCOMM, "Bolus increment: " + danaPump.bolusStep)
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "Bolus max: " + danaPump.maxBolus)
|
||||
if (!danaPump.isExtendedBolusEnabled) {
|
||||
val notification = Notification(Notification.EXTENDED_BOLUS_DISABLED, rh.gs(R.string.danar_enableextendedbolus), Notification.URGENT)
|
||||
rxBus.send(EventNewNotification(notification))
|
||||
activityNames.addNotification(Notification.EXTENDED_BOLUS_DISABLED, rh.gs(R.string.danar_enableextendedbolus), Notification.URGENT)
|
||||
} else {
|
||||
rxBus.send(EventDismissNotification(Notification.EXTENDED_BOLUS_DISABLED))
|
||||
}
|
||||
|
|
|
@ -2,7 +2,6 @@ package info.nightscout.androidaps.danar.comm
|
|||
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.danar.R
|
||||
import info.nightscout.core.events.EventNewNotification
|
||||
import info.nightscout.interfaces.notifications.Notification
|
||||
import info.nightscout.rx.events.EventDismissNotification
|
||||
import info.nightscout.rx.logging.LTag
|
||||
|
@ -34,8 +33,7 @@ class MsgInitConnStatusOption(
|
|||
failed = true
|
||||
}
|
||||
if (!danaPump.isPasswordOK) {
|
||||
val notification = Notification(Notification.WRONG_PUMP_PASSWORD, rh.gs(R.string.wrongpumppassword), Notification.URGENT)
|
||||
rxBus.send(EventNewNotification(notification))
|
||||
activityNames.addNotification(Notification.WRONG_PUMP_PASSWORD, rh.gs(R.string.wrongpumppassword), Notification.URGENT)
|
||||
} else {
|
||||
rxBus.send(EventDismissNotification(Notification.WRONG_PUMP_PASSWORD))
|
||||
}
|
||||
|
|
|
@ -2,7 +2,6 @@ package info.nightscout.androidaps.danar.comm
|
|||
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.danar.R
|
||||
import info.nightscout.core.events.EventNewNotification
|
||||
import info.nightscout.interfaces.notifications.Notification
|
||||
import info.nightscout.interfaces.plugin.PluginType
|
||||
import info.nightscout.rx.events.EventRebuildTabs
|
||||
|
@ -19,8 +18,7 @@ class MsgInitConnStatusTime(
|
|||
|
||||
override fun handleMessage(bytes: ByteArray) {
|
||||
if (bytes.size - 10 > 7) {
|
||||
val notification = Notification(Notification.WRONG_DRIVER, rh.gs(R.string.pumpdrivercorrected), Notification.NORMAL)
|
||||
rxBus.send(EventNewNotification(notification))
|
||||
activityNames.addNotification(Notification.WRONG_DRIVER, rh.gs(R.string.pumpdrivercorrected), Notification.NORMAL)
|
||||
danaRPlugin.disconnect("Wrong Model")
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "Wrong model selected. Switching to Korean DanaR")
|
||||
danaRKoreanPlugin.setPluginEnabled(PluginType.PUMP, true)
|
||||
|
|
|
@ -2,7 +2,6 @@ package info.nightscout.androidaps.danar.comm
|
|||
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.danar.R
|
||||
import info.nightscout.core.events.EventNewNotification
|
||||
import info.nightscout.interfaces.notifications.Notification
|
||||
import info.nightscout.rx.logging.LTag
|
||||
|
||||
|
@ -27,13 +26,11 @@ class MsgSetBasalProfile(
|
|||
if (result != 1) {
|
||||
failed = true
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "Set basal profile result: $result FAILED!!!")
|
||||
val reportFail = Notification(Notification.PROFILE_SET_FAILED, rh.gs(R.string.profile_set_failed), Notification.URGENT)
|
||||
rxBus.send(EventNewNotification(reportFail))
|
||||
activityNames.addNotification(Notification.PROFILE_SET_FAILED, rh.gs(R.string.profile_set_failed), Notification.URGENT)
|
||||
} else {
|
||||
failed = false
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "Set basal profile result: $result")
|
||||
val reportOK = Notification(Notification.PROFILE_SET_OK, rh.gs(R.string.profile_set_ok), Notification.INFO, 60)
|
||||
rxBus.send(EventNewNotification(reportOK))
|
||||
activityNames.addNotificationValidFor(Notification.PROFILE_SET_OK, rh.gs(R.string.profile_set_ok), Notification.INFO, 60)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -2,7 +2,6 @@ package info.nightscout.androidaps.danar.comm
|
|||
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.danar.R
|
||||
import info.nightscout.core.events.EventNewNotification
|
||||
import info.nightscout.interfaces.notifications.Notification
|
||||
import info.nightscout.rx.logging.LTag
|
||||
|
||||
|
@ -25,13 +24,11 @@ class MsgSetSingleBasalProfile(
|
|||
if (result != 1) {
|
||||
failed = true
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "Set basal profile result: $result FAILED!!!")
|
||||
val reportFail = Notification(Notification.PROFILE_SET_FAILED, rh.gs(R.string.profile_set_failed), Notification.URGENT)
|
||||
rxBus.send(EventNewNotification(reportFail))
|
||||
activityNames.addNotification(Notification.PROFILE_SET_FAILED, rh.gs(R.string.profile_set_failed), Notification.URGENT)
|
||||
} else {
|
||||
failed = false
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "Set basal profile result: $result")
|
||||
val reportOK = Notification(Notification.PROFILE_SET_OK, rh.gs(R.string.profile_set_ok), Notification.INFO, 60)
|
||||
rxBus.send(EventNewNotification(reportOK))
|
||||
activityNames.addNotificationValidFor(Notification.PROFILE_SET_OK, rh.gs(R.string.profile_set_ok), Notification.INFO, 60)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -2,7 +2,6 @@ package info.nightscout.androidaps.danar.comm
|
|||
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.danar.R
|
||||
import info.nightscout.core.events.EventNewNotification
|
||||
import info.nightscout.interfaces.notifications.Notification
|
||||
import info.nightscout.rx.events.EventDismissNotification
|
||||
import info.nightscout.rx.logging.LTag
|
||||
|
@ -34,14 +33,12 @@ class MsgSettingMeal(
|
|||
danaPump.basalStep = 0.01
|
||||
}
|
||||
if (danaPump.basalStep != 0.01) {
|
||||
val notification = Notification(Notification.WRONG_BASAL_STEP, rh.gs(R.string.danar_setbasalstep001), Notification.URGENT)
|
||||
rxBus.send(EventNewNotification(notification))
|
||||
activityNames.addNotification(Notification.WRONG_BASAL_STEP, rh.gs(R.string.danar_setbasalstep001), Notification.URGENT)
|
||||
} else {
|
||||
rxBus.send(EventDismissNotification(Notification.WRONG_BASAL_STEP))
|
||||
}
|
||||
if (danaPump.isConfigUD) {
|
||||
val notification = Notification(Notification.UD_MODE_ENABLED, rh.gs(R.string.danar_switchtouhmode), Notification.URGENT)
|
||||
rxBus.send(EventNewNotification(notification))
|
||||
activityNames.addNotification(Notification.UD_MODE_ENABLED, rh.gs(R.string.danar_switchtouhmode), Notification.URGENT)
|
||||
} else {
|
||||
rxBus.send(EventDismissNotification(Notification.UD_MODE_ENABLED))
|
||||
}
|
||||
|
|
|
@ -37,7 +37,6 @@ import info.nightscout.androidaps.danar.comm.MsgHistoryRefill;
|
|||
import info.nightscout.androidaps.danar.comm.MsgHistorySuspend;
|
||||
import info.nightscout.androidaps.danar.comm.MsgPCCommStart;
|
||||
import info.nightscout.androidaps.danar.comm.MsgPCCommStop;
|
||||
import info.nightscout.core.events.EventNewNotification;
|
||||
import info.nightscout.core.ui.toast.ToastUtils;
|
||||
import info.nightscout.core.utils.fabric.FabricPrivacy;
|
||||
import info.nightscout.interfaces.notifications.Notification;
|
||||
|
@ -45,6 +44,7 @@ import info.nightscout.interfaces.plugin.ActivePlugin;
|
|||
import info.nightscout.interfaces.profile.Profile;
|
||||
import info.nightscout.interfaces.pump.PumpEnactResult;
|
||||
import info.nightscout.interfaces.pump.PumpSync;
|
||||
import info.nightscout.interfaces.ui.ActivityNames;
|
||||
import info.nightscout.pump.dana.DanaPump;
|
||||
import info.nightscout.pump.dana.comm.RecordTypes;
|
||||
import info.nightscout.rx.AapsSchedulers;
|
||||
|
@ -77,6 +77,7 @@ public abstract class AbstractDanaRExecutionService extends DaggerService {
|
|||
@Inject AapsSchedulers aapsSchedulers;
|
||||
@Inject PumpSync pumpSync;
|
||||
@Inject ActivePlugin activePlugin;
|
||||
@Inject ActivityNames activityNames;
|
||||
|
||||
private final CompositeDisposable disposable = new CompositeDisposable();
|
||||
|
||||
|
@ -306,8 +307,7 @@ public abstract class AbstractDanaRExecutionService extends DaggerService {
|
|||
if (pumpState.getTemporaryBasal().getRate() != danaPump.getTempBasalPercent()
|
||||
|| Math.abs(pumpState.getTemporaryBasal().getTimestamp() - danaPump.getTempBasalStart()) > 10000
|
||||
) { // Close current temp basal
|
||||
Notification notification = new Notification(Notification.UNSUPPORTED_ACTION_IN_PUMP, rh.gs(R.string.unsupported_action_in_pump), Notification.URGENT);
|
||||
rxBus.send(new EventNewNotification(notification));
|
||||
activityNames.addNotification(Notification.UNSUPPORTED_ACTION_IN_PUMP, rh.gs(R.string.unsupported_action_in_pump), Notification.URGENT);
|
||||
aapsLogger.error(LTag.PUMP, "Different temporary basal found running AAPS: " + (pumpState.getTemporaryBasal() + " DanaPump " + danaPump.temporaryBasalToString()));
|
||||
pumpSync.syncTemporaryBasalWithPumpId(
|
||||
danaPump.getTempBasalStart(),
|
||||
|
@ -326,8 +326,7 @@ public abstract class AbstractDanaRExecutionService extends DaggerService {
|
|||
activePlugin.getActivePump().model(),
|
||||
activePlugin.getActivePump().serialNumber()
|
||||
);
|
||||
Notification notification = new Notification(Notification.UNSUPPORTED_ACTION_IN_PUMP, rh.gs(R.string.unsupported_action_in_pump), Notification.URGENT);
|
||||
rxBus.send(new EventNewNotification(notification));
|
||||
activityNames.addNotification(Notification.UNSUPPORTED_ACTION_IN_PUMP, rh.gs(R.string.unsupported_action_in_pump), Notification.URGENT);
|
||||
aapsLogger.error(LTag.PUMP, "Temporary basal should not be running. Sending stop to AAPS");
|
||||
}
|
||||
} else {
|
||||
|
@ -341,8 +340,7 @@ public abstract class AbstractDanaRExecutionService extends DaggerService {
|
|||
activePlugin.getActivePump().model(),
|
||||
activePlugin.getActivePump().serialNumber()
|
||||
);
|
||||
Notification notification = new Notification(Notification.UNSUPPORTED_ACTION_IN_PUMP, rh.gs(R.string.unsupported_action_in_pump), Notification.URGENT);
|
||||
rxBus.send(new EventNewNotification(notification));
|
||||
activityNames.addNotification(Notification.UNSUPPORTED_ACTION_IN_PUMP, rh.gs(R.string.unsupported_action_in_pump), Notification.URGENT);
|
||||
aapsLogger.error(LTag.PUMP, "Temporary basal should be running: DanaPump " + danaPump.temporaryBasalToString());
|
||||
}
|
||||
}
|
||||
|
@ -352,8 +350,7 @@ public abstract class AbstractDanaRExecutionService extends DaggerService {
|
|||
if (pumpState.getExtendedBolus().getRate() != danaPump.getExtendedBolusAbsoluteRate()
|
||||
|| Math.abs(pumpState.getExtendedBolus().getTimestamp() - danaPump.getExtendedBolusStart()) > 10000
|
||||
) { // Close current extended
|
||||
Notification notification = new Notification(Notification.UNSUPPORTED_ACTION_IN_PUMP, rh.gs(R.string.unsupported_action_in_pump), Notification.URGENT);
|
||||
rxBus.send(new EventNewNotification(notification));
|
||||
activityNames.addNotification(Notification.UNSUPPORTED_ACTION_IN_PUMP, rh.gs(R.string.unsupported_action_in_pump), Notification.URGENT);
|
||||
aapsLogger.error(LTag.PUMP, "Different extended bolus found running AAPS: " + (pumpState.getExtendedBolus() + " DanaPump " + danaPump.extendedBolusToString()));
|
||||
pumpSync.syncExtendedBolusWithPumpId(
|
||||
danaPump.getExtendedBolusStart(),
|
||||
|
@ -372,14 +369,12 @@ public abstract class AbstractDanaRExecutionService extends DaggerService {
|
|||
activePlugin.getActivePump().model(),
|
||||
activePlugin.getActivePump().serialNumber()
|
||||
);
|
||||
Notification notification = new Notification(Notification.UNSUPPORTED_ACTION_IN_PUMP, rh.gs(R.string.unsupported_action_in_pump), Notification.URGENT);
|
||||
rxBus.send(new EventNewNotification(notification));
|
||||
activityNames.addNotification(Notification.UNSUPPORTED_ACTION_IN_PUMP, rh.gs(R.string.unsupported_action_in_pump), Notification.URGENT);
|
||||
aapsLogger.error(LTag.PUMP, "Extended bolus should not be running. Sending stop to AAPS");
|
||||
}
|
||||
} else {
|
||||
if (danaPump.isExtendedInProgress()) { // Create new
|
||||
Notification notification = new Notification(Notification.UNSUPPORTED_ACTION_IN_PUMP, rh.gs(R.string.unsupported_action_in_pump), Notification.URGENT);
|
||||
rxBus.send(new EventNewNotification(notification));
|
||||
activityNames.addNotification(Notification.UNSUPPORTED_ACTION_IN_PUMP, rh.gs(R.string.unsupported_action_in_pump), Notification.URGENT);
|
||||
aapsLogger.error(LTag.PUMP, "Extended bolus should not be running: DanaPump " + danaPump.extendedBolusToString());
|
||||
pumpSync.syncExtendedBolusWithPumpId(
|
||||
danaPump.getExtendedBolusStart(),
|
||||
|
|
|
@ -41,7 +41,6 @@ import info.nightscout.androidaps.danar.comm.MsgStatus;
|
|||
import info.nightscout.androidaps.danar.comm.MsgStatusBasic;
|
||||
import info.nightscout.androidaps.danar.comm.MsgStatusBolusExtended;
|
||||
import info.nightscout.androidaps.danar.comm.MsgStatusTempBasal;
|
||||
import info.nightscout.core.events.EventNewNotification;
|
||||
import info.nightscout.interfaces.Constants;
|
||||
import info.nightscout.interfaces.notifications.Notification;
|
||||
import info.nightscout.interfaces.profile.Profile;
|
||||
|
@ -204,8 +203,7 @@ public class DanaRExecutionService extends AbstractDanaRExecutionService {
|
|||
if (danaPump.getDailyTotalUnits() > danaPump.getMaxDailyTotalUnits() * Constants.dailyLimitWarning) {
|
||||
aapsLogger.debug(LTag.PUMP, "Approaching daily limit: " + danaPump.getDailyTotalUnits() + "/" + danaPump.getMaxDailyTotalUnits());
|
||||
if (System.currentTimeMillis() > lastApproachingDailyLimit + 30 * 60 * 1000) {
|
||||
Notification reportFail = new Notification(Notification.APPROACHING_DAILY_LIMIT, rh.gs(R.string.approachingdailylimit), Notification.URGENT);
|
||||
rxBus.send(new EventNewNotification(reportFail));
|
||||
activityNames.addNotification(Notification.APPROACHING_DAILY_LIMIT, rh.gs(R.string.approachingdailylimit), Notification.URGENT);
|
||||
pumpSync.insertAnnouncement(rh.gs(R.string.approachingdailylimit) + ": " + danaPump.getDailyTotalUnits() + "/" + danaPump.getMaxDailyTotalUnits() + "U", null, PumpType.DANA_R_KOREAN, danaRKoreanPlugin.serialNumber());
|
||||
lastApproachingDailyLimit = System.currentTimeMillis();
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@ import info.nightscout.interfaces.plugin.PluginType
|
|||
import info.nightscout.interfaces.profile.ProfileInstantiator
|
||||
import info.nightscout.interfaces.pump.PumpSync
|
||||
import info.nightscout.interfaces.queue.CommandQueue
|
||||
import info.nightscout.interfaces.ui.ActivityNames
|
||||
import info.nightscout.pump.dana.DanaPump
|
||||
import info.nightscout.shared.sharedPreferences.SP
|
||||
import org.junit.Assert
|
||||
|
@ -27,6 +28,7 @@ class DanaRPluginTest : TestBaseWithProfile() {
|
|||
@Mock lateinit var commandQueue: CommandQueue
|
||||
@Mock lateinit var pumpSync: PumpSync
|
||||
@Mock lateinit var profileInstantiator: ProfileInstantiator
|
||||
@Mock lateinit var activityNames: ActivityNames
|
||||
|
||||
lateinit var danaPump: DanaPump
|
||||
|
||||
|
@ -44,7 +46,7 @@ class DanaRPluginTest : TestBaseWithProfile() {
|
|||
`when`(rh.gs(R.string.limitingbasalratio)).thenReturn("Limiting max basal rate to %1\$.2f U/h because of %2\$s")
|
||||
`when`(rh.gs(R.string.limitingpercentrate)).thenReturn("Limiting max percent rate to %1\$d%% because of %2\$s")
|
||||
danaPump = DanaPump(aapsLogger, sp, dateUtil, profileInstantiator)
|
||||
danaRPlugin = DanaRPlugin(injector, aapsLogger, aapsSchedulers, rxBus, context, rh, constraintChecker, activePluginProvider, sp, commandQueue, danaPump, dateUtil, fabricPrivacy, pumpSync)
|
||||
danaRPlugin = DanaRPlugin(injector, aapsLogger, aapsSchedulers, rxBus, context, rh, constraintChecker, activePluginProvider, sp, commandQueue, danaPump, dateUtil, fabricPrivacy, pumpSync, activityNames)
|
||||
}
|
||||
|
||||
@Test @Throws(Exception::class)
|
||||
|
|
|
@ -16,6 +16,7 @@ import info.nightscout.interfaces.profile.ProfileInstantiator
|
|||
import info.nightscout.interfaces.pump.DetailedBolusInfoStorage
|
||||
import info.nightscout.interfaces.pump.PumpSync
|
||||
import info.nightscout.interfaces.queue.CommandQueue
|
||||
import info.nightscout.interfaces.ui.ActivityNames
|
||||
import info.nightscout.pump.dana.DanaPump
|
||||
import info.nightscout.pump.dana.database.DanaHistoryRecordDao
|
||||
import info.nightscout.rx.bus.RxBus
|
||||
|
@ -46,6 +47,7 @@ open class DanaRTestBase : TestBase() {
|
|||
@Mock lateinit var pumpSync: PumpSync
|
||||
@Mock lateinit var danaHistoryRecordDao: DanaHistoryRecordDao
|
||||
@Mock lateinit var profileInstantiator: ProfileInstantiator
|
||||
@Mock lateinit var activityNames: ActivityNames
|
||||
|
||||
private lateinit var testPumpPlugin: TestPumpPlugin
|
||||
|
||||
|
@ -77,6 +79,7 @@ open class DanaRTestBase : TestBase() {
|
|||
it.commandQueue = commandQueue
|
||||
it.pumpSync = pumpSync
|
||||
it.danaHistoryRecordDao = danaHistoryRecordDao
|
||||
it.activityNames = activityNames
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@ import info.nightscout.interfaces.plugin.PluginType
|
|||
import info.nightscout.interfaces.profile.ProfileInstantiator
|
||||
import info.nightscout.interfaces.pump.PumpSync
|
||||
import info.nightscout.interfaces.queue.CommandQueue
|
||||
import info.nightscout.interfaces.ui.ActivityNames
|
||||
import info.nightscout.pump.dana.DanaPump
|
||||
import info.nightscout.shared.sharedPreferences.SP
|
||||
import org.junit.Assert
|
||||
|
@ -27,6 +28,7 @@ class DanaRKoreanPluginTest : TestBaseWithProfile() {
|
|||
@Mock lateinit var commandQueue: CommandQueue
|
||||
@Mock lateinit var pumpSync: PumpSync
|
||||
@Mock lateinit var profileInstantiator: ProfileInstantiator
|
||||
@Mock lateinit var activityNames: ActivityNames
|
||||
|
||||
lateinit var danaPump: DanaPump
|
||||
|
||||
|
@ -44,7 +46,8 @@ class DanaRKoreanPluginTest : TestBaseWithProfile() {
|
|||
`when`(rh.gs(R.string.limitingbasalratio)).thenReturn("Limiting max basal rate to %1\$.2f U/h because of %2\$s")
|
||||
`when`(rh.gs(R.string.limitingpercentrate)).thenReturn("Limiting max percent rate to %1\$d%% because of %2\$s")
|
||||
danaPump = DanaPump(aapsLogger, sp, dateUtil, profileInstantiator)
|
||||
danaRPlugin = DanaRKoreanPlugin(injector, aapsLogger, aapsSchedulers, rxBus, context, rh, constraintChecker, activePluginProvider, sp, commandQueue, danaPump, dateUtil, fabricPrivacy, pumpSync)
|
||||
danaRPlugin = DanaRKoreanPlugin(injector, aapsLogger, aapsSchedulers, rxBus, context, rh, constraintChecker, activePluginProvider, sp, commandQueue, danaPump, dateUtil, fabricPrivacy,
|
||||
pumpSync, activityNames)
|
||||
}
|
||||
|
||||
@Test @Throws(Exception::class)
|
||||
|
|
|
@ -14,6 +14,7 @@ import info.nightscout.interfaces.pump.DetailedBolusInfoStorage
|
|||
import info.nightscout.interfaces.pump.PumpSync
|
||||
import info.nightscout.interfaces.pump.TemporaryBasalStorage
|
||||
import info.nightscout.interfaces.queue.CommandQueue
|
||||
import info.nightscout.interfaces.ui.ActivityNames
|
||||
import info.nightscout.pump.dana.DanaPump
|
||||
import info.nightscout.shared.sharedPreferences.SP
|
||||
import org.junit.Before
|
||||
|
@ -30,6 +31,7 @@ class DanaRv2PluginTest : TestBaseWithProfile() {
|
|||
@Mock lateinit var temporaryBasalStorage: TemporaryBasalStorage
|
||||
@Mock lateinit var pumpSync: PumpSync
|
||||
@Mock lateinit var profileInstantiator: ProfileInstantiator
|
||||
@Mock lateinit var activityNames: ActivityNames
|
||||
|
||||
lateinit var danaPump: DanaPump
|
||||
|
||||
|
@ -47,7 +49,8 @@ class DanaRv2PluginTest : TestBaseWithProfile() {
|
|||
`when`(rh.gs(R.string.limitingbasalratio)).thenReturn("Limiting max basal rate to %1\$.2f U/h because of %2\$s")
|
||||
`when`(rh.gs(R.string.limitingpercentrate)).thenReturn("Limiting max percent rate to %1\$d%% because of %2\$s")
|
||||
danaPump = DanaPump(aapsLogger, sp, dateUtil, profileInstantiator)
|
||||
danaRv2Plugin = DanaRv2Plugin(injector, aapsLogger, aapsSchedulers, rxBus, context, rh, constraintChecker, activePluginProvider, sp, commandQueue, danaPump,detailedBolusInfoStorage, temporaryBasalStorage, dateUtil, fabricPrivacy, pumpSync)
|
||||
danaRv2Plugin = DanaRv2Plugin(injector, aapsLogger, aapsSchedulers, rxBus, context, rh, constraintChecker, activePluginProvider, sp, commandQueue, danaPump,detailedBolusInfoStorage,
|
||||
temporaryBasalStorage, dateUtil, fabricPrivacy, pumpSync, activityNames)
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -454,7 +454,7 @@ class DanaRSPlugin @Inject constructor(
|
|||
}
|
||||
result.enacted = false
|
||||
result.success = false
|
||||
result.comment = rh.gs(R.string.tempbasaldeliveryerror)
|
||||
result.comment = rh.gs(R.string.temp_basal_delivery_error)
|
||||
aapsLogger.error("setTempBasalPercent: Failed to set temp basal. connectionOK: $connectionOK isTempBasalInProgress: ${danaPump.isTempBasalInProgress} tempBasalPercent: ${danaPump.tempBasalPercent}")
|
||||
return result
|
||||
}
|
||||
|
|
|
@ -368,7 +368,7 @@ class DiaconnG8Plugin @Inject constructor(
|
|||
|
||||
result.enacted = false
|
||||
result.success = false
|
||||
result.comment = rh.gs(R.string.tempbasaldeliveryerror)
|
||||
result.comment = rh.gs(R.string.temp_basal_delivery_error)
|
||||
aapsLogger.error("setTempBasalAbsolute: Failed to set temp basal")
|
||||
return result
|
||||
}
|
||||
|
|
|
@ -310,7 +310,7 @@ class LoopDialog : DaggerDialogFragment() {
|
|||
commandQueue.cancelTempBasal(true, object : Callback() {
|
||||
override fun run() {
|
||||
if (!result.success) {
|
||||
ToastUtils.errorToast(ctx, rh.gs(R.string.tempbasaldeliveryerror))
|
||||
ToastUtils.errorToast(ctx, rh.gs(R.string.temp_basal_delivery_error))
|
||||
}
|
||||
}
|
||||
})
|
||||
|
@ -351,7 +351,7 @@ class LoopDialog : DaggerDialogFragment() {
|
|||
commandQueue.cancelTempBasal(true, object : Callback() {
|
||||
override fun run() {
|
||||
if (!result.success) {
|
||||
activityNames.runAlarm(ctx, result.comment, rh.gs(R.string.tempbasaldeliveryerror), R.raw.boluserror)
|
||||
activityNames.runAlarm(ctx, result.comment, rh.gs(R.string.temp_basal_delivery_error), R.raw.boluserror)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
|
|
@ -135,7 +135,7 @@ class TempBasalDialog : DialogFragmentWithDate() {
|
|||
val callback: Callback = object : Callback() {
|
||||
override fun run() {
|
||||
if (!result.success) {
|
||||
activityNames.runAlarm(ctx, result.comment, rh.gs(R.string.tempbasaldeliveryerror), R.raw.boluserror)
|
||||
activityNames.runAlarm(ctx, result.comment, rh.gs(R.string.temp_basal_delivery_error), R.raw.boluserror)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue