encodingTypeMap;
- static {
- encodingTypeMap = new HashMap<>();
-
- for (RileyLinkEncodingType encType : values()) {
- if (encType.resourceId!=null) {
- encodingTypeMap.put(MainApp.gs(encType.resourceId), encType);
- }
- }
- }
-
-
RileyLinkEncodingType(int value) {
this.value = (byte)value;
}
-
RileyLinkEncodingType(int value, Integer resourceId) {
this.value = (byte)value;
this.resourceId = resourceId;
}
- public static RileyLinkEncodingType getByDescription(String description) {
+ private static void doTranslation(ResourceHelper resourceHelper) {
+ encodingTypeMap = new HashMap<>();
+
+ for (RileyLinkEncodingType encType : values()) {
+ if (encType.resourceId!=null) {
+ encodingTypeMap.put(resourceHelper.gs(encType.resourceId), encType);
+ }
+ }
+ }
+
+ public static RileyLinkEncodingType getByDescription(String description, ResourceHelper resourceHelper) {
+ if (encodingTypeMap == null) doTranslation(resourceHelper);
if (encodingTypeMap.containsKey(description)) {
return encodingTypeMap.get(description);
}
return RileyLinkEncodingType.FourByteSixByteLocal;
}
-
}
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/ResetRileyLinkConfigurationTask.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/ResetRileyLinkConfigurationTask.java
index 370015ab95..bc9a4a3aa0 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/ResetRileyLinkConfigurationTask.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/ResetRileyLinkConfigurationTask.java
@@ -4,15 +4,10 @@ import javax.inject.Inject;
import dagger.android.HasAndroidInjector;
import info.nightscout.androidaps.interfaces.ActivePluginProvider;
-import info.nightscout.androidaps.plugins.bus.RxBus;
import info.nightscout.androidaps.plugins.bus.RxBusWrapper;
-import info.nightscout.androidaps.plugins.common.ManufacturerType;
-import info.nightscout.androidaps.plugins.pump.common.PumpPluginAbstract;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkPumpDevice;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.data.ServiceTransport;
-import info.nightscout.androidaps.plugins.pump.medtronic.MedtronicPumpPlugin;
import info.nightscout.androidaps.plugins.pump.medtronic.events.EventRefreshButtonState;
-import info.nightscout.androidaps.plugins.pump.medtronic.service.RileyLinkMedtronicService;
/**
* Created by geoff on 7/16/16.
@@ -34,7 +29,7 @@ public class ResetRileyLinkConfigurationTask extends PumpTask {
@Override
public void run() {
- RileyLinkPumpDevice pumpAbstract = (RileyLinkPumpDevice)activePlugin.getActivePump();
+ RileyLinkPumpDevice pumpAbstract = (RileyLinkPumpDevice) activePlugin.getActivePump();
rxBus.send(new EventRefreshButtonState(false));
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/utils/LocationHelper.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/utils/LocationHelper.java
deleted file mode 100644
index 03b42b730f..0000000000
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/utils/LocationHelper.java
+++ /dev/null
@@ -1,69 +0,0 @@
-package info.nightscout.androidaps.plugins.pump.common.utils;
-
-import android.app.Activity;
-import android.content.Context;
-import android.content.Intent;
-import android.location.LocationManager;
-
-import info.nightscout.androidaps.R;
-import info.nightscout.androidaps.utils.alertDialogs.OKDialog;
-
-/**
- * Helper for checking if location services are enabled on the device.
- */
-public class LocationHelper {
-
- /**
- * Determine if GPS is currently enabled.
- *
- * On Android 6 (Marshmallow), location needs to be enabled for Bluetooth discovery to work.
- *
- * @param context The current app context.
- * @return true if location is enabled, false otherwise.
- */
- public static boolean isLocationEnabled(Context context) {
- LocationManager locationManager = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE);
-
- return (locationManager != null && //
- (locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER) || //
- locationManager.isProviderEnabled(LocationManager.NETWORK_PROVIDER)));
-
- // return locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER);
- }
-
-
- /**
- * Prompt the user to enable GPS location if it isn't already on.
- *
- * @param parent The currently visible activity.
- */
- public static void requestLocation(final Activity parent) {
- if (LocationHelper.isLocationEnabled(parent)) {
- return;
- }
-
- // Shamelessly borrowed from http://stackoverflow.com/a/10311877/868533
- OKDialog.showConfirmation(parent, parent.getString(R.string.location_not_found_title), parent.getString(R.string.location_not_found_message), () -> {
- parent.startActivity(new Intent(android.provider.Settings.ACTION_LOCATION_SOURCE_SETTINGS));
- });
- }
-
-
- /**
- * Prompt the user to enable GPS location on devices that need it for Bluetooth discovery.
- *
- * Android 6 (Marshmallow) needs GPS enabled for Bluetooth discovery to work.
- *
- * @param activity The currently visible activity.
- */
- public static void requestLocationForBluetooth(Activity activity) {
- // Location needs to be enabled for Bluetooth discovery on Marshmallow.
- LocationHelper.requestLocation(activity);
- }
-
- // public static Boolean locationPermission(ActivityWithMenu act) {
- // return ActivityCompat.checkSelfPermission(act, Manifest.permission.ACCESS_FINE_LOCATION) ==
- // PackageManager.PERMISSION_GRANTED;
- // }
-
-}
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MessageHashTableR.kt b/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MessageHashTableR.kt
deleted file mode 100644
index dd4c59cee4..0000000000
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MessageHashTableR.kt
+++ /dev/null
@@ -1,102 +0,0 @@
-package info.nightscout.androidaps.plugins.pump.danaR.comm
-
-import dagger.android.HasAndroidInjector
-import info.nightscout.androidaps.interfaces.ActivePluginProvider
-import info.nightscout.androidaps.interfaces.CommandQueueProvider
-import info.nightscout.androidaps.logging.AAPSLogger
-import info.nightscout.androidaps.plugins.bus.RxBusWrapper
-import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin
-import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker
-import info.nightscout.androidaps.plugins.pump.danaR.DanaRPlugin
-import info.nightscout.androidaps.plugins.pump.danaR.DanaRPump
-import info.nightscout.androidaps.plugins.pump.danaRKorean.DanaRKoreanPlugin
-import info.nightscout.androidaps.utils.DateUtil
-import info.nightscout.androidaps.utils.resources.ResourceHelper
-import java.util.*
-import javax.inject.Inject
-import javax.inject.Singleton
-
-@Singleton
-class MessageHashTableR @Inject constructor(
- aapsLogger: AAPSLogger,
- rxBus: RxBusWrapper,
- resourceHelper: ResourceHelper,
- constraintChecker: ConstraintChecker,
- danaRPump: DanaRPump,
- danaRPlugin: DanaRPlugin,
- danaRKoreanPlugin: DanaRKoreanPlugin,
- configBuilderPlugin: ConfigBuilderPlugin,
- commandQueue: CommandQueueProvider,
- activePlugin: ActivePluginProvider,
- injector: HasAndroidInjector,
- dateUtil: DateUtil
-) : MessageHashTableBase {
-
- var messages: HashMap = HashMap()
-
- init {
- put(MsgBolusStop(aapsLogger, rxBus, resourceHelper, danaRPump)) // 0x0101 CMD_MEALINS_STOP
- put(MsgBolusStart(aapsLogger, constraintChecker, danaRPump, 0.0)) // 0x0102 CMD_MEALINS_START_DATA
- put(MsgBolusStartWithSpeed(aapsLogger, constraintChecker, danaRPump, 0.0, 0)) // 0x0104 CMD_MEALINS_START_DATA_SPEED
- put(MsgBolusProgress(aapsLogger, resourceHelper, rxBus, danaRPump)) // 0x0202 CMD_PUMP_THIS_REMAINDER_MEAL_INS
- put(MsgStatusProfile(aapsLogger, danaRPump)) // 0x0204 CMD_PUMP_CALCULATION_SETTING
- put(MsgStatusTempBasal(aapsLogger, danaRPump, activePlugin, injector)) // 0x0205 CMD_PUMP_EXERCISE_MODE
- put(MsgStatusBolusExtended(injector, aapsLogger, danaRPump, activePlugin, dateUtil)) // 0x0207 CMD_PUMP_EXPANS_INS_I
- put(MsgStatusBasic(aapsLogger, danaRPump)) // 0x020A CMD_PUMP_INITVIEW_I
- put(MsgStatus(aapsLogger, danaRPump)) // 0x020B CMD_PUMP_STATUS
- // 0x0301 CMD_PUMPINIT_TIME_INFO
- put(MsgInitConnStatusTime(aapsLogger, rxBus, resourceHelper, danaRPump, danaRPlugin, danaRKoreanPlugin, configBuilderPlugin, commandQueue, dateUtil))
- put(MsgInitConnStatusBolus(aapsLogger, rxBus, resourceHelper, danaRPump)) // 0x0302 CMD_PUMPINIT_BOLUS_INFO
- put(MsgInitConnStatusBasic(aapsLogger, danaRPump)) // 0x0303 CMD_PUMPINIT_INIT_INFO
- put(MsgInitConnStatusOption(aapsLogger, rxBus, resourceHelper, danaRPump, activePlugin)) // 0x0304 CMD_PUMPINIT_OPTION
- put(MsgSetTempBasalStart(aapsLogger, 0, 0)) // 0x0401 CMD_PUMPSET_EXERCISE_S
- put(MsgSetCarbsEntry(aapsLogger, 0, 0)) // 0x0402 CMD_PUMPSET_HIS_S
- put(MsgSetTempBasalStop(aapsLogger)) // 0x0403 CMD_PUMPSET_EXERCISE_STOP
- put(MsgSetExtendedBolusStop(aapsLogger)) // 0x0406 CMD_PUMPSET_EXPANS_INS_STOP
- put(MsgSetExtendedBolusStart(aapsLogger, constraintChecker, 0.0, 0)) // 0x0407 CMD_PUMPSET_EXPANS_INS_S
- put(MsgError(aapsLogger, rxBus, resourceHelper, danaRPump)) // 0x0601 CMD_PUMPOWAY_SYSTEM_STATUS
- put(MsgPCCommStart(aapsLogger)) // 0x3001 CMD_CONNECT
- put(MsgPCCommStop(aapsLogger)) // 0x3002 CMD_DISCONNECT
- put(MsgHistoryBolus(aapsLogger, rxBus, dateUtil)) // 0x3101 CMD_HISTORY_MEAL_INS
- put(MsgHistoryDailyInsulin(aapsLogger, rxBus, dateUtil)) // 0x3102 CMD_HISTORY_DAY_INS
- put(MsgHistoryGlucose(aapsLogger, rxBus, dateUtil)) // 0x3104 CMD_HISTORY_GLUCOSE
- put(MsgHistoryAlarm(aapsLogger, rxBus, dateUtil)) // 0x3105 CMD_HISTORY_ALARM
- put(MsgHistoryError(aapsLogger, rxBus, dateUtil)) // 0x3106 CMD_HISTORY_ERROR
- put(MsgHistoryCarbo(aapsLogger, rxBus, dateUtil)) // 0x3107 CMD_HISTORY_CARBOHY
- put(MsgHistoryRefill(aapsLogger, rxBus, dateUtil)) // 0x3108 CMD_HISTORY_REFILL
- put(MsgHistorySuspend(aapsLogger, rxBus, dateUtil)) // 0x3109 CMD_HISTORY_SUSPEND
- put(MsgHistoryBasalHour(aapsLogger, rxBus, dateUtil)) // 0x310A CMD_HISTORY_BASAL_HOUR
- put(MsgHistoryDone(aapsLogger, danaRPump)) // 0x31F1 CMD_HISTORY_DONT_USED
- // 0x3202 CMD_SETTING_V_BASAL_INS_I
- put(MsgSettingBasal(aapsLogger, danaRPump, danaRPlugin))
- // 0x3203 CMD_SETTING_V_MEAL_SETTING_I
- put(MsgSettingMeal(aapsLogger, rxBus, resourceHelper, danaRPump, danaRKoreanPlugin))
- put(MsgSettingProfileRatios(aapsLogger, danaRPump)) // 0x3204 CMD_SETTING_V_CCC_I
- put(MsgSettingMaxValues(aapsLogger, danaRPump)) // 0x3205 CMD_SETTING_V_MAX_VALUE_I
- put(MsgSettingBasalProfileAll(aapsLogger, danaRPump)) // 0x3206 CMD_SETTING_V_BASAL_PROFILE_ALL
- put(MsgSettingShippingInfo(aapsLogger, danaRPump)) // 0x3207 CMD_SETTING_V_SHIPPING_I
- put(MsgSettingGlucose(aapsLogger, danaRPump)) // 0x3209 CMD_SETTING_V_GLUCOSEandEASY
- put(MsgSettingPumpTime(aapsLogger, danaRPump, dateUtil)) // 0x320A CMD_SETTING_V_TIME_I
- put(MsgSettingUserOptions(aapsLogger, danaRPump)) // 0x320B CMD_SETTING_V_USER_OPTIONS
- put(MsgSettingActiveProfile(aapsLogger, danaRPump)) // 0x320C CMD_SETTING_V_PROFILE_NUMBER
- put(MsgSettingProfileRatiosAll(aapsLogger, danaRPump)) // 0x320D CMD_SETTING_V_CIR_CF_VALUE
- put(MsgSetSingleBasalProfile(aapsLogger, rxBus, resourceHelper, Array(24) { 0.0 })) // 0x3302 CMD_SETTING_BASAL_INS_S
- put(MsgSetBasalProfile(aapsLogger, rxBus, resourceHelper, 0.toByte(), Array(24) { 0.0 })) // 0x3306 CMD_SETTING_BASAL_PROFILE_S
- put(MsgSetUserOptions(aapsLogger, danaRPump)) // 0x330B CMD_SETTING_USER_OPTIONS_S
- put(MsgSetActivateBasalProfile(aapsLogger, 0.toByte())) // 0x330C CMD_SETTING_PROFILE_NUMBER_S
- put(MsgHistoryAllDone(aapsLogger, danaRPump)) // 0x41F1 CMD_HISTORY_ALL_DONE
- put(MsgHistoryAll(aapsLogger, rxBus, dateUtil)) // 0x41F2 CMD_HISTORY_ALL
- put(MsgHistoryNewDone(aapsLogger, danaRPump)) // 0x42F1 CMD_HISTORY_NEW_DONE
- put(MsgHistoryNew(aapsLogger, rxBus, dateUtil)) // 0x42F2 CMD_HISTORY_NEW
- // 0xF0F1 CMD_PUMP_CHECK_VALUE
- put(MsgCheckValue(aapsLogger, danaRPump, danaRPlugin))
- }
-
- override fun put(message: MessageBase) {
- messages[message.command] = message
- }
-
- override fun findMessage(command: Int): MessageBase {
- return messages[command] ?: MessageBase()
- }
-}
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetUserOptions.kt b/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetUserOptions.kt
deleted file mode 100644
index f2a579fd72..0000000000
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetUserOptions.kt
+++ /dev/null
@@ -1,43 +0,0 @@
-package info.nightscout.androidaps.plugins.pump.danaR.comm
-
-import info.nightscout.androidaps.logging.AAPSLogger
-import info.nightscout.androidaps.logging.LTag
-import info.nightscout.androidaps.plugins.pump.danaR.DanaRPump
-
-class MsgSetUserOptions(
- private val aapsLogger: AAPSLogger,
- danaRPump: DanaRPump
-) : MessageBase() {
-
- init {
- SetCommand(0x330B)
- if (danaRPump.userOptionsFrompump == null) {
- // No options set -> Exiting
- aapsLogger.debug(LTag.PUMPCOMM, "NO USER OPTIONS LOADED EXITING!")
- } else {
- danaRPump.userOptionsFrompump!![0] = (if (danaRPump.timeDisplayType == 1) 0 else 1).toByte()
- danaRPump.userOptionsFrompump!![1] = danaRPump.buttonScrollOnOff.toByte()
- danaRPump.userOptionsFrompump!![2] = danaRPump.beepAndAlarm.toByte()
- danaRPump.userOptionsFrompump!![3] = danaRPump.lcdOnTimeSec.toByte()
- danaRPump.userOptionsFrompump!![4] = danaRPump.backlightOnTimeSec.toByte()
- danaRPump.userOptionsFrompump!![5] = danaRPump.selectedLanguage.toByte()
- danaRPump.userOptionsFrompump!![8] = danaRPump.units.toByte()
- danaRPump.userOptionsFrompump!![9] = danaRPump.shutdownHour.toByte()
- danaRPump.userOptionsFrompump!![27] = danaRPump.lowReservoirRate.toByte()
- for (element in danaRPump.userOptionsFrompump!!) {
- AddParamByte(element)
- }
- aapsLogger.debug(LTag.PUMPCOMM, "New message")
- }
- }
-
- override fun handleMessage(bytes: ByteArray) {
- val result = intFromBuff(bytes, 0, 1)
- if (result != 1) {
- failed = true
- aapsLogger.debug(LTag.PUMPCOMM, "Setting user options: $result FAILED!!!")
- } else {
- aapsLogger.debug(LTag.PUMPCOMM, "Setting user options: $result")
- }
- }
-}
\ No newline at end of file
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingMaxValues.kt b/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingMaxValues.kt
deleted file mode 100644
index 437af793f8..0000000000
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingMaxValues.kt
+++ /dev/null
@@ -1,25 +0,0 @@
-package info.nightscout.androidaps.plugins.pump.danaR.comm
-
-import info.nightscout.androidaps.logging.AAPSLogger
-import info.nightscout.androidaps.logging.LTag
-import info.nightscout.androidaps.plugins.pump.danaR.DanaRPump
-
-class MsgSettingMaxValues(
- private val aapsLogger: AAPSLogger,
- private val danaRPump: DanaRPump
-) : MessageBase() {
-
- init {
- SetCommand(0x3205)
- aapsLogger.debug(LTag.PUMPCOMM, "New message")
- }
-
- override fun handleMessage(bytes: ByteArray) {
- danaRPump.maxBolus = intFromBuff(bytes, 0, 2) / 100.0
- danaRPump.maxBasal = intFromBuff(bytes, 2, 2) / 100.0
- danaRPump.maxDailyTotalUnits = intFromBuff(bytes, 4, 2) / 100
- aapsLogger.debug(LTag.PUMPCOMM, "Max bolus: " + danaRPump.maxBolus)
- aapsLogger.debug(LTag.PUMPCOMM, "Max basal: " + danaRPump.maxBasal)
- aapsLogger.debug(LTag.PUMPCOMM, "Total daily max units: " + danaRPump.maxDailyTotalUnits)
- }
-}
\ No newline at end of file
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingProfileRatios.kt b/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingProfileRatios.kt
deleted file mode 100644
index 6c29024677..0000000000
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingProfileRatios.kt
+++ /dev/null
@@ -1,38 +0,0 @@
-package info.nightscout.androidaps.plugins.pump.danaR.comm
-
-import info.nightscout.androidaps.logging.AAPSLogger
-import info.nightscout.androidaps.logging.LTag
-import info.nightscout.androidaps.plugins.pump.danaR.DanaRPump
-
-class MsgSettingProfileRatios(
- private val aapsLogger: AAPSLogger,
- private val danaRPump: DanaRPump
-) : MessageBase() {
-
- init {
- SetCommand(0x3204)
- aapsLogger.debug(LTag.PUMPCOMM, "New message")
- }
-
- override fun handleMessage(bytes: ByteArray) {
- if (danaRPump.units == DanaRPump.UNITS_MGDL) {
- danaRPump.currentCIR = intFromBuff(bytes, 0, 2)
- danaRPump.currentCF = intFromBuff(bytes, 2, 2).toDouble()
- danaRPump.currentAI = intFromBuff(bytes, 4, 2) / 100.0
- danaRPump.currentTarget = intFromBuff(bytes, 6, 2).toDouble()
- danaRPump.currentAIDR = intFromBuff(bytes, 8, 1)
- } else {
- danaRPump.currentCIR = intFromBuff(bytes, 0, 2)
- danaRPump.currentCF = intFromBuff(bytes, 2, 2) / 100.0
- danaRPump.currentAI = intFromBuff(bytes, 4, 2) / 100.0
- danaRPump.currentTarget = intFromBuff(bytes, 6, 2) / 100.0
- danaRPump.currentAIDR = intFromBuff(bytes, 8, 1)
- }
- aapsLogger.debug(LTag.PUMPCOMM, "Pump units (saved): " + if (danaRPump.units == DanaRPump.UNITS_MGDL) "MGDL" else "MMOL")
- aapsLogger.debug(LTag.PUMPCOMM, "Current pump CIR: " + danaRPump.currentCIR)
- aapsLogger.debug(LTag.PUMPCOMM, "Current pump CF: " + danaRPump.currentCF)
- aapsLogger.debug(LTag.PUMPCOMM, "Current pump AI: " + danaRPump.currentAI)
- aapsLogger.debug(LTag.PUMPCOMM, "Current pump target: " + danaRPump.currentTarget)
- aapsLogger.debug(LTag.PUMPCOMM, "Current pump AIDR: " + danaRPump.currentAIDR)
- }
-}
\ No newline at end of file
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingProfileRatiosAll.kt b/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingProfileRatiosAll.kt
deleted file mode 100644
index 4f626e89df..0000000000
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingProfileRatiosAll.kt
+++ /dev/null
@@ -1,47 +0,0 @@
-package info.nightscout.androidaps.plugins.pump.danaR.comm
-
-import info.nightscout.androidaps.logging.AAPSLogger
-import info.nightscout.androidaps.logging.LTag
-import info.nightscout.androidaps.plugins.pump.danaR.DanaRPump
-
-class MsgSettingProfileRatiosAll(
- private val aapsLogger: AAPSLogger,
- private val danaRPump: DanaRPump
-) : MessageBase() {
-
- init {
- SetCommand(0x320D)
- aapsLogger.debug(LTag.PUMPCOMM, "New message")
- }
-
- override fun handleMessage(bytes: ByteArray) {
- if (danaRPump.units == DanaRPump.UNITS_MGDL) {
- danaRPump.morningCIR = intFromBuff(bytes, 0, 2)
- danaRPump.morningCF = intFromBuff(bytes, 2, 2).toDouble()
- danaRPump.afternoonCIR = intFromBuff(bytes, 4, 2)
- danaRPump.afternoonCF = intFromBuff(bytes, 6, 2).toDouble()
- danaRPump.eveningCIR = intFromBuff(bytes, 8, 2)
- danaRPump.eveningCF = intFromBuff(bytes, 10, 2).toDouble()
- danaRPump.nightCIR = intFromBuff(bytes, 12, 2)
- danaRPump.nightCF = intFromBuff(bytes, 14, 2).toDouble()
- } else {
- danaRPump.morningCIR = intFromBuff(bytes, 0, 2)
- danaRPump.morningCF = intFromBuff(bytes, 2, 2) / 100.0
- danaRPump.afternoonCIR = intFromBuff(bytes, 4, 2)
- danaRPump.afternoonCF = intFromBuff(bytes, 6, 2) / 100.0
- danaRPump.eveningCIR = intFromBuff(bytes, 8, 2)
- danaRPump.eveningCF = intFromBuff(bytes, 10, 2) / 100.0
- danaRPump.nightCIR = intFromBuff(bytes, 12, 2)
- danaRPump.nightCF = intFromBuff(bytes, 14, 2) / 100.0
- }
- aapsLogger.debug(LTag.PUMPCOMM, "Pump units: " + if (danaRPump.units == DanaRPump.UNITS_MGDL) "MGDL" else "MMOL")
- aapsLogger.debug(LTag.PUMPCOMM, "Current pump morning CIR: " + danaRPump.morningCIR)
- aapsLogger.debug(LTag.PUMPCOMM, "Current pump morning CF: " + danaRPump.morningCF)
- aapsLogger.debug(LTag.PUMPCOMM, "Current pump afternoon CIR: " + danaRPump.afternoonCIR)
- aapsLogger.debug(LTag.PUMPCOMM, "Current pump afternoon CF: " + danaRPump.afternoonCF)
- aapsLogger.debug(LTag.PUMPCOMM, "Current pump evening CIR: " + danaRPump.eveningCIR)
- aapsLogger.debug(LTag.PUMPCOMM, "Current pump evening CF: " + danaRPump.eveningCF)
- aapsLogger.debug(LTag.PUMPCOMM, "Current pump night CIR: " + danaRPump.nightCIR)
- aapsLogger.debug(LTag.PUMPCOMM, "Current pump night CF: " + danaRPump.nightCF)
- }
-}
\ No newline at end of file
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingUserOptions.kt b/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingUserOptions.kt
deleted file mode 100644
index 3678424499..0000000000
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingUserOptions.kt
+++ /dev/null
@@ -1,59 +0,0 @@
-package info.nightscout.androidaps.plugins.pump.danaR.comm
-
-import info.nightscout.androidaps.logging.AAPSLogger
-import info.nightscout.androidaps.logging.LTag
-import info.nightscout.androidaps.plugins.pump.danaR.DanaRPump
-import java.util.*
-
-class MsgSettingUserOptions(
- private val aapsLogger: AAPSLogger,
- private val danaRPump: DanaRPump
-) : MessageBase() {
-
-
- init {
- SetCommand(0x320B)
- aapsLogger.debug(LTag.PUMPCOMM, "New message")
- }
-
- override fun handleMessage(packet: ByteArray) {
- val bytes = getDataBytes(packet, packet.size - 10)
- danaRPump.userOptionsFrompump = Arrays.copyOf(bytes, bytes!!.size) // saving pumpDataBytes to use it in MsgSetUserOptions
- for (pos in bytes.indices) {
- aapsLogger.debug(LTag.PUMPCOMM, "[" + pos + "]" + bytes[pos])
- }
- danaRPump.timeDisplayType = if (bytes[0] == 1.toByte()) 0 else 1 // 1 -> 24h 0 -> 12h
- danaRPump.buttonScrollOnOff = if (bytes[1] == 1.toByte()) 1 else 0 // 1 -> ON, 0-> OFF
- danaRPump.beepAndAlarm = bytes[2].toInt() // 1 -> Sound on alarm 2-> Vibrate on alarm 3-> Both on alarm 5-> Sound + beep 6-> vibrate + beep 7-> both + beep Beep adds 4
- danaRPump.lcdOnTimeSec = bytes[3].toInt() and 255
- danaRPump.backlightOnTimeSec = bytes[4].toInt() and 255
- danaRPump.selectedLanguage = bytes[5].toInt() // on DanaRv2 is that needed ?
- danaRPump.units = bytes[8].toInt()
- danaRPump.shutdownHour = bytes[9].toInt()
- danaRPump.lowReservoirRate = bytes[32].toInt() and 255
- /* int selectableLanguage1 = bytes[10];
- int selectableLanguage2 = bytes[11];
- int selectableLanguage3 = bytes[12];
- int selectableLanguage4 = bytes[13];
- int selectableLanguage5 = bytes[14];
- */
- aapsLogger.debug(LTag.PUMPCOMM, "timeDisplayType: " + danaRPump.timeDisplayType)
- aapsLogger.debug(LTag.PUMPCOMM, "Button scroll: " + danaRPump.buttonScrollOnOff)
- aapsLogger.debug(LTag.PUMPCOMM, "BeepAndAlarm: " + danaRPump.beepAndAlarm)
- aapsLogger.debug(LTag.PUMPCOMM, "screen timeout: " + danaRPump.lcdOnTimeSec)
- aapsLogger.debug(LTag.PUMPCOMM, "BackLight: " + danaRPump.backlightOnTimeSec)
- aapsLogger.debug(LTag.PUMPCOMM, "Selected language: " + danaRPump.selectedLanguage)
- aapsLogger.debug(LTag.PUMPCOMM, "Units: " + danaRPump.getUnits())
- aapsLogger.debug(LTag.PUMPCOMM, "Shutdown: " + danaRPump.shutdownHour)
- aapsLogger.debug(LTag.PUMPCOMM, "Low reservoir: " + danaRPump.lowReservoirRate)
- }
-
- private fun getDataBytes(bytes: ByteArray?, len: Int): ByteArray? {
- if (bytes == null) {
- return null
- }
- val ret = ByteArray(len)
- System.arraycopy(bytes, 6, ret, 0, len)
- return ret
- }
-}
\ No newline at end of file
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgStatus.kt b/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgStatus.kt
deleted file mode 100644
index e37ad1ebb6..0000000000
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgStatus.kt
+++ /dev/null
@@ -1,37 +0,0 @@
-package info.nightscout.androidaps.plugins.pump.danaR.comm
-
-import info.nightscout.androidaps.logging.AAPSLogger
-import info.nightscout.androidaps.logging.LTag
-import info.nightscout.androidaps.plugins.pump.danaR.DanaRPump
-
-class MsgStatus(
- private val aapsLogger: AAPSLogger,
- private val danaRPump: DanaRPump
-
-) : MessageBase() {
-
- init {
- SetCommand(0x020B)
- aapsLogger.debug(LTag.PUMPCOMM, "New message")
- }
-
- override fun handleMessage(bytes: ByteArray) {
- danaRPump.dailyTotalUnits = intFromBuff(bytes, 0, 3) / 750.0
- danaRPump.isExtendedInProgress = intFromBuff(bytes, 3, 1) == 1
- danaRPump.extendedBolusMinutes = intFromBuff(bytes, 4, 2)
- danaRPump.extendedBolusAmount = intFromBuff(bytes, 6, 2) / 100.0
- val lastBolusAmount = intFromBuff(bytes, 13, 2) / 100.0
- if (lastBolusAmount != 0.0) {
- danaRPump.lastBolusTime = dateTimeFromBuff(bytes, 8)
- danaRPump.lastBolusAmount = lastBolusAmount
- }
- danaRPump.iob = intFromBuff(bytes, 15, 2) / 100.0
- aapsLogger.debug(LTag.PUMPCOMM, "Daily total: " + danaRPump.dailyTotalUnits)
- aapsLogger.debug(LTag.PUMPCOMM, "Is extended bolus running: " + danaRPump.isExtendedInProgress)
- aapsLogger.debug(LTag.PUMPCOMM, "Extended bolus min: " + danaRPump.extendedBolusMinutes)
- aapsLogger.debug(LTag.PUMPCOMM, "Extended bolus amount: " + danaRPump.extendedBolusAmount)
- aapsLogger.debug(LTag.PUMPCOMM, "Last bolus time: " + danaRPump.lastBolusTime)
- aapsLogger.debug(LTag.PUMPCOMM, "Last bolus amount: " + danaRPump.lastBolusAmount)
- aapsLogger.debug(LTag.PUMPCOMM, "IOB: " + danaRPump.iob)
- }
-}
\ No newline at end of file
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgStatusProfile.kt b/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgStatusProfile.kt
deleted file mode 100644
index e8bd43012b..0000000000
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgStatusProfile.kt
+++ /dev/null
@@ -1,36 +0,0 @@
-package info.nightscout.androidaps.plugins.pump.danaR.comm
-
-import info.nightscout.androidaps.logging.AAPSLogger
-import info.nightscout.androidaps.logging.LTag
-import info.nightscout.androidaps.plugins.pump.danaR.DanaRPump
-
-class MsgStatusProfile(
- private val aapsLogger: AAPSLogger,
- private val danaRPump: DanaRPump
-) : MessageBase() {
-
- init {
- SetCommand(0x0204)
- aapsLogger.debug(LTag.PUMPCOMM, "New message")
- }
-
- override fun handleMessage(bytes: ByteArray) {
- if (danaRPump.units == DanaRPump.UNITS_MGDL) {
- danaRPump.currentCIR = intFromBuff(bytes, 0, 2)
- danaRPump.currentCF = intFromBuff(bytes, 2, 2).toDouble()
- danaRPump.currentAI = intFromBuff(bytes, 4, 2) / 100.0
- danaRPump.currentTarget = intFromBuff(bytes, 6, 2).toDouble()
- } else {
- danaRPump.currentCIR = intFromBuff(bytes, 0, 2)
- danaRPump.currentCF = intFromBuff(bytes, 2, 2) / 100.0
- danaRPump.currentAI = intFromBuff(bytes, 4, 2) / 100.0
- danaRPump.currentTarget = intFromBuff(bytes, 6, 2) / 100.0
- }
- aapsLogger.debug(LTag.PUMPCOMM, "Pump units (saved): " + if (danaRPump.units == DanaRPump.UNITS_MGDL) "MGDL" else "MMOL")
- aapsLogger.debug(LTag.PUMPCOMM, "Current pump CIR: " + danaRPump.currentCIR)
- aapsLogger.debug(LTag.PUMPCOMM, "Current pump CF: " + danaRPump.currentCF)
- aapsLogger.debug(LTag.PUMPCOMM, "Current pump AI: " + danaRPump.currentAI)
- aapsLogger.debug(LTag.PUMPCOMM, "Current pump target: " + danaRPump.currentTarget)
- aapsLogger.debug(LTag.PUMPCOMM, "Current pump AIDR: " + danaRPump.currentAIDR)
- }
-}
\ No newline at end of file
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/services/AbstractSerialIOThread.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/services/AbstractSerialIOThread.java
deleted file mode 100644
index 6d2cba9741..0000000000
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/services/AbstractSerialIOThread.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package info.nightscout.androidaps.plugins.pump.danaR.services;
-
-import info.nightscout.androidaps.plugins.pump.danaR.comm.MessageBase;
-
-/**
- * Created by mike on 28.01.2018.
- */
-
-public abstract class AbstractSerialIOThread extends Thread {
-
- public abstract void sendMessage(MessageBase message);
- public abstract void disconnect(String reason);
-}
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRKorean/comm/MessageHashTableRKorean.kt b/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRKorean/comm/MessageHashTableRKorean.kt
deleted file mode 100644
index 882ab11739..0000000000
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRKorean/comm/MessageHashTableRKorean.kt
+++ /dev/null
@@ -1,85 +0,0 @@
-package info.nightscout.androidaps.plugins.pump.danaRKorean.comm
-
-import dagger.android.HasAndroidInjector
-import info.nightscout.androidaps.interfaces.ActivePluginProvider
-import info.nightscout.androidaps.interfaces.CommandQueueProvider
-import info.nightscout.androidaps.logging.AAPSLogger
-import info.nightscout.androidaps.plugins.bus.RxBusWrapper
-import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin
-import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker
-import info.nightscout.androidaps.plugins.pump.danaR.DanaRPlugin
-import info.nightscout.androidaps.plugins.pump.danaR.DanaRPump
-import info.nightscout.androidaps.plugins.pump.danaR.comm.*
-import info.nightscout.androidaps.plugins.pump.danaRKorean.DanaRKoreanPlugin
-import info.nightscout.androidaps.utils.DateUtil
-import info.nightscout.androidaps.utils.resources.ResourceHelper
-import java.util.*
-import javax.inject.Inject
-import javax.inject.Singleton
-
-@Singleton
-class MessageHashTableRKorean @Inject constructor(
- aapsLogger: AAPSLogger,
- rxBus: RxBusWrapper,
- resourceHelper: ResourceHelper,
- constraintChecker: ConstraintChecker,
- danaRPump: DanaRPump,
- danaRPlugin: DanaRPlugin,
- danaRKoreanPlugin: DanaRKoreanPlugin,
- configBuilderPlugin: ConfigBuilderPlugin,
- commandQueue: CommandQueueProvider,
- activePlugin: ActivePluginProvider,
- dateUtil: DateUtil,
- injector: HasAndroidInjector
-) : MessageHashTableBase {
-
- var messages: HashMap = HashMap()
-
- init {
- put(MsgBolusStop(aapsLogger, rxBus, resourceHelper, danaRPump)) // 0x0101 CMD_MEALINS_STOP
- put(MsgBolusStart(aapsLogger, constraintChecker, danaRPump, 0.0)) // 0x0102 CMD_MEALINS_START_DATA
- put(MsgBolusProgress(aapsLogger, resourceHelper, rxBus, danaRPump)) // 0x0202 CMD_PUMP_THIS_REMAINDER_MEAL_INS
- put(MsgStatusProfile(aapsLogger, danaRPump)) // 0x0204 CMD_PUMP_CALCULATION_SETTING
- put(MsgStatusTempBasal(aapsLogger, danaRPump, activePlugin, injector)) // 0x0205 CMD_PUMP_EXERCISE_MODE
- put(MsgStatusBolusExtended(injector, aapsLogger, danaRPump, activePlugin, dateUtil)) // 0x0207 CMD_PUMP_EXPANS_INS_I
- put(MsgStatusBasic_k(aapsLogger, danaRPump)) // 0x020A CMD_PUMP_INITVIEW_I
- put(MsgStatus_k(aapsLogger, danaRPump)) // 0x020B CMD_PUMP_STATUS
- put(MsgInitConnStatusTime_k(aapsLogger, rxBus, resourceHelper, danaRPump, danaRPlugin, danaRKoreanPlugin, configBuilderPlugin, commandQueue, dateUtil)) // 0x0301 CMD_PUMPINIT_TIME_INFO
- put(MsgInitConnStatusBolus_k(aapsLogger, rxBus, resourceHelper, danaRPump, activePlugin)) // 0x0302 CMD_PUMPINIT_BOLUS_INFO
- put(MsgInitConnStatusBasic_k(aapsLogger, rxBus, resourceHelper, danaRPump)) // 0x0303 CMD_PUMPINIT_INIT_INFO
- put(MsgSetTempBasalStart(aapsLogger, 0, 0)) // 0x0401 CMD_PUMPSET_EXERCISE_S
- put(MsgSetCarbsEntry(aapsLogger, 0, 0)) // 0x0402 CMD_PUMPSET_HIS_S
- put(MsgSetTempBasalStop(aapsLogger)) // 0x0403 CMD_PUMPSET_EXERCISE_STOP
- put(MsgSetExtendedBolusStop(aapsLogger)) // 0x0406 CMD_PUMPSET_EXPANS_INS_STOP
- put(MsgSetExtendedBolusStart(aapsLogger, constraintChecker, 0.0, 0)) // 0x0407 CMD_PUMPSET_EXPANS_INS_S
- put(MsgError(aapsLogger, rxBus, resourceHelper, danaRPump)) // 0x0601 CMD_PUMPOWAY_SYSTEM_STATUS
- put(MsgPCCommStart(aapsLogger)) // 0x3001 CMD_CONNECT
- put(MsgPCCommStop(aapsLogger)) // 0x3002 CMD_DISCONNECT
- put(MsgHistoryBolus(aapsLogger, rxBus, dateUtil)) // 0x3101 CMD_HISTORY_MEAL_INS
- put(MsgHistoryDailyInsulin(aapsLogger, rxBus, dateUtil)) // 0x3102 CMD_HISTORY_DAY_INS
- put(MsgHistoryGlucose(aapsLogger, rxBus, dateUtil)) // 0x3104 CMD_HISTORY_GLUCOSE
- put(MsgHistoryAlarm(aapsLogger, rxBus, dateUtil)) // 0x3105 CMD_HISTORY_ALARM
- put(MsgHistoryCarbo(aapsLogger, rxBus, dateUtil)) // 0x3107 CMD_HISTORY_CARBOHY
- put(MsgSettingBasal_k(aapsLogger, danaRPump, danaRKoreanPlugin)) // 0x3202 CMD_SETTING_V_BASAL_INS_I
- put(MsgSettingMeal(aapsLogger, rxBus, resourceHelper, danaRPump, danaRKoreanPlugin)) // 0x3203 CMD_SETTING_V_MEAL_SETTING_I
- put(MsgSettingProfileRatios(aapsLogger, danaRPump)) // 0x3204 CMD_SETTING_V_CCC_I
- put(MsgSettingMaxValues(aapsLogger, danaRPump)) // 0x3205 CMD_SETTING_V_MAX_VALUE_I
- put(MsgSettingBasalProfileAll_k(aapsLogger, danaRPump)) // 0x3206 CMD_SETTING_V_BASAL_PROFILE_ALL
- put(MsgSettingShippingInfo(aapsLogger, danaRPump)) // 0x3207 CMD_SETTING_V_SHIPPING_I
- put(MsgSettingGlucose(aapsLogger, danaRPump)) // 0x3209 CMD_SETTING_V_GLUCOSEandEASY
- put(MsgSettingPumpTime(aapsLogger, danaRPump, dateUtil)) // 0x320A CMD_SETTING_V_TIME_I
- put(MsgSetSingleBasalProfile(aapsLogger, rxBus, resourceHelper, Array(24) { 0.0 })) // 0x3302 CMD_SETTING_BASAL_INS_S
- put(MsgHistoryAll(aapsLogger, rxBus, dateUtil)) // 0x41F2 CMD_HISTORY_ALL
- put(MsgHistoryNewDone(aapsLogger, danaRPump)) // 0x42F1 CMD_HISTORY_NEW_DONE
- put(MsgHistoryNew(aapsLogger, rxBus, dateUtil)) // 0x42F2 CMD_HISTORY_NEW
- put(MsgCheckValue_k(aapsLogger, danaRPump, danaRKoreanPlugin)) // 0xF0F1 CMD_PUMP_CHECK_VALUE
- }
-
- override fun put(message: MessageBase) {
- messages[message.command] = message
- }
-
- override fun findMessage(command: Int): MessageBase {
- return messages[command] ?: MessageBase()
- }
-}
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRS/DanaRSPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRS/DanaRSPlugin.java
deleted file mode 100644
index 293faf8621..0000000000
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRS/DanaRSPlugin.java
+++ /dev/null
@@ -1,836 +0,0 @@
-package info.nightscout.androidaps.plugins.pump.danaRS;
-
-import android.content.ComponentName;
-import android.content.Context;
-import android.content.Intent;
-import android.content.ServiceConnection;
-import android.os.IBinder;
-
-import androidx.annotation.NonNull;
-import androidx.preference.Preference;
-
-import org.jetbrains.annotations.NotNull;
-import org.json.JSONException;
-import org.json.JSONObject;
-
-import java.util.List;
-
-import javax.inject.Inject;
-import javax.inject.Singleton;
-
-import dagger.android.HasAndroidInjector;
-import info.nightscout.androidaps.BuildConfig;
-import info.nightscout.androidaps.R;
-import info.nightscout.androidaps.data.DetailedBolusInfo;
-import info.nightscout.androidaps.data.Profile;
-import info.nightscout.androidaps.data.PumpEnactResult;
-import info.nightscout.androidaps.db.ExtendedBolus;
-import info.nightscout.androidaps.db.TemporaryBasal;
-import info.nightscout.androidaps.events.EventAppExit;
-import info.nightscout.androidaps.interfaces.CommandQueueProvider;
-import info.nightscout.androidaps.interfaces.Constraint;
-import info.nightscout.androidaps.interfaces.ConstraintsInterface;
-import info.nightscout.androidaps.interfaces.DanaRInterface;
-import info.nightscout.androidaps.interfaces.PluginDescription;
-import info.nightscout.androidaps.interfaces.PluginType;
-import info.nightscout.androidaps.interfaces.PumpDescription;
-import info.nightscout.androidaps.interfaces.PumpInterface;
-import info.nightscout.androidaps.interfaces.PumpPluginBase;
-import info.nightscout.androidaps.logging.AAPSLogger;
-import info.nightscout.androidaps.logging.LTag;
-import info.nightscout.androidaps.plugins.bus.RxBusWrapper;
-import info.nightscout.androidaps.plugins.common.ManufacturerType;
-import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker;
-import info.nightscout.androidaps.interfaces.ProfileFunction;
-import info.nightscout.androidaps.plugins.general.actions.defs.CustomAction;
-import info.nightscout.androidaps.plugins.general.actions.defs.CustomActionType;
-import info.nightscout.androidaps.plugins.general.overview.events.EventDismissNotification;
-import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification;
-import info.nightscout.androidaps.plugins.general.overview.notifications.Notification;
-import info.nightscout.androidaps.plugins.pump.common.bolusInfo.DetailedBolusInfoStorage;
-import info.nightscout.androidaps.plugins.pump.common.defs.PumpType;
-import info.nightscout.androidaps.plugins.pump.danaR.DanaRFragment;
-import info.nightscout.androidaps.plugins.pump.danaR.DanaRPump;
-import info.nightscout.androidaps.plugins.pump.danaR.comm.RecordTypes;
-import info.nightscout.androidaps.plugins.pump.danaRS.events.EventDanaRSDeviceChange;
-import info.nightscout.androidaps.plugins.pump.danaRS.services.DanaRSService;
-import info.nightscout.androidaps.db.Treatment;
-import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin;
-import info.nightscout.androidaps.utils.DateUtil;
-import info.nightscout.androidaps.utils.DecimalFormatter;
-import info.nightscout.androidaps.utils.FabricPrivacy;
-import info.nightscout.androidaps.utils.Round;
-import info.nightscout.androidaps.utils.T;
-import info.nightscout.androidaps.utils.TimeChangeType;
-import info.nightscout.androidaps.utils.resources.ResourceHelper;
-import info.nightscout.androidaps.utils.sharedPreferences.SP;
-import io.reactivex.disposables.CompositeDisposable;
-import io.reactivex.schedulers.Schedulers;
-
-@Singleton
-public class DanaRSPlugin extends PumpPluginBase implements PumpInterface, DanaRInterface, ConstraintsInterface {
- private CompositeDisposable disposable = new CompositeDisposable();
-
- private final Context context;
- private final ResourceHelper resourceHelper;
- private final ConstraintChecker constraintChecker;
- private final ProfileFunction profileFunction;
- private final TreatmentsPlugin treatmentsPlugin;
- private final SP sp;
- private final RxBusWrapper rxBus;
- private final CommandQueueProvider commandQueue;
- private final DanaRPump danaRPump;
- private final DetailedBolusInfoStorage detailedBolusInfoStorage;
- private final DateUtil dateUtil;
-
- private static DanaRSService danaRSService;
-
- private static String mDeviceAddress = "";
- public static String mDeviceName = "";
-
- public static PumpDescription pumpDescription = new PumpDescription();
-
- // Bolus & history handling
- public int bolusStartErrorCode; // from start message
- public Treatment bolusingTreatment; // actually delivered treatment
- public double bolusAmountToBeDelivered = 0.0; // amount to be delivered
- public boolean bolusStopped = false; // bolus finished
- public boolean bolusStopForced = false; // bolus forced to stop by user
- public boolean bolusDone = false; // success end
- public long bolusProgressLastTimeStamp = 0; // timestamp of last bolus progress message
- public boolean apsHistoryDone = false; // true when last history message is received
- public long lastEventTimeLoaded = 0; // timestamp of last received event
-
- @Inject
- public DanaRSPlugin(
- HasAndroidInjector injector,
- AAPSLogger aapsLogger,
- RxBusWrapper rxBus,
- Context context,
- ResourceHelper resourceHelper,
- ConstraintChecker constraintChecker,
- ProfileFunction profileFunction,
- TreatmentsPlugin treatmentsPlugin,
- SP sp,
- CommandQueueProvider commandQueue,
- DanaRPump danaRPump,
- DetailedBolusInfoStorage detailedBolusInfoStorage,
- DateUtil dateUtil
- ) {
- super(new PluginDescription()
- .mainType(PluginType.PUMP)
- .fragmentClass(DanaRFragment.class.getName())
- .pluginName(R.string.danarspump)
- .shortName(R.string.danarspump_shortname)
- .preferencesId(R.xml.pref_danars)
- .description(R.string.description_pump_dana_rs),
- injector, aapsLogger, resourceHelper, commandQueue
- );
- this.context = context;
- this.rxBus = rxBus;
- this.resourceHelper = resourceHelper;
- this.constraintChecker = constraintChecker;
- this.profileFunction = profileFunction;
- this.treatmentsPlugin = treatmentsPlugin;
- this.sp = sp;
- this.commandQueue = commandQueue;
- this.danaRPump = danaRPump;
- this.detailedBolusInfoStorage = detailedBolusInfoStorage;
- this.dateUtil = dateUtil;
-
- pumpDescription.setPumpDescription(PumpType.DanaRS);
- }
-
- @Override
- public void updatePreferenceSummary(@NotNull Preference pref) {
- super.updatePreferenceSummary(pref);
-
- if (pref.getKey().equals(resourceHelper.gs(R.string.key_danars_name)))
- pref.setSummary(sp.getString(R.string.key_danars_name, ""));
- }
-
- @Override
- protected void onStart() {
- Intent intent = new Intent(context, DanaRSService.class);
- context.bindService(intent, mConnection, Context.BIND_AUTO_CREATE);
-
- disposable.add(rxBus
- .toObservable(EventAppExit.class)
- .observeOn(Schedulers.io())
- .subscribe(event -> context.unbindService(mConnection), exception -> FabricPrivacy.getInstance().logException(exception))
- );
- disposable.add(rxBus
- .toObservable(EventDanaRSDeviceChange.class)
- .observeOn(Schedulers.io())
- .subscribe(event -> loadAddress(), exception -> FabricPrivacy.getInstance().logException(exception))
- );
- loadAddress(); // load device name
- super.onStart();
- }
-
- @Override
- protected void onStop() {
- context.unbindService(mConnection);
-
- disposable.clear();
- super.onStop();
- }
-
- private ServiceConnection mConnection = new ServiceConnection() {
-
- public void onServiceDisconnected(ComponentName name) {
- getAapsLogger().debug(LTag.PUMP, "Service is disconnected");
- danaRSService = null;
- }
-
- public void onServiceConnected(ComponentName name, IBinder service) {
- getAapsLogger().debug(LTag.PUMP, "Service is connected");
- DanaRSService.LocalBinder mLocalBinder = (DanaRSService.LocalBinder) service;
- danaRSService = mLocalBinder.getServiceInstance();
- }
- };
-
- private void loadAddress() {
- mDeviceAddress = sp.getString(R.string.key_danars_address, "");
- mDeviceName = sp.getString(R.string.key_danars_name, "");
- }
-
- @Override
- public void connect(String from) {
- getAapsLogger().debug(LTag.PUMP, "RS connect from: " + from);
- if (danaRSService != null && !mDeviceAddress.equals("") && !mDeviceName.equals("")) {
- final Object o = new Object();
-
- danaRSService.connect(from, mDeviceAddress, o);
- }
- }
-
- @Override
- public boolean isConnected() {
- return danaRSService != null && danaRSService.isConnected();
- }
-
- @Override
- public boolean isConnecting() {
- return danaRSService != null && danaRSService.isConnecting();
- }
-
- @Override
- public boolean isHandshakeInProgress() {
- return false;
- }
-
- @Override
- public void finishHandshaking() {
- }
-
- @Override
- public void disconnect(String from) {
- getAapsLogger().debug(LTag.PUMP, "RS disconnect from: " + from);
- if (danaRSService != null) danaRSService.disconnect(from);
- }
-
- @Override
- public void stopConnecting() {
- if (danaRSService != null) danaRSService.stopConnecting();
- }
-
- @Override
- public void getPumpStatus() {
- if (danaRSService != null) {
- danaRSService.getPumpStatus();
- pumpDescription.basalStep = danaRPump.getBasalStep();
- pumpDescription.bolusStep = danaRPump.getBolusStep();
- }
- }
-
- // DanaR interface
-
- @Override
- public PumpEnactResult loadHistory(byte type) {
- return danaRSService.loadHistory(type);
- }
-
- @Override
- public PumpEnactResult loadEvents() {
- return danaRSService.loadEvents();
- }
-
- @Override
- public PumpEnactResult setUserOptions() {
- return danaRSService.setUserSettings();
- }
-
- // Constraints interface
-
- @NonNull
- @Override
- public Constraint applyBasalConstraints(Constraint absoluteRate, @NonNull Profile profile) {
- absoluteRate.setIfSmaller(getAapsLogger(), danaRPump.getMaxBasal(), resourceHelper.gs(R.string.limitingbasalratio, danaRPump.getMaxBasal(), resourceHelper.gs(R.string.pumplimit)), this);
- return absoluteRate;
- }
-
- @NonNull
- @Override
- public Constraint applyBasalPercentConstraints(Constraint percentRate, @NonNull Profile profile) {
- percentRate.setIfGreater(getAapsLogger(), 0, resourceHelper.gs(R.string.limitingpercentrate, 0, resourceHelper.gs(R.string.itmustbepositivevalue)), this);
- percentRate.setIfSmaller(getAapsLogger(), getPumpDescription().maxTempPercent, resourceHelper.gs(R.string.limitingpercentrate, getPumpDescription().maxTempPercent, resourceHelper.gs(R.string.pumplimit)), this);
-
- return percentRate;
- }
-
-
- @NonNull
- @Override
- public Constraint applyBolusConstraints(Constraint insulin) {
- insulin.setIfSmaller(getAapsLogger(), danaRPump.getMaxBolus(), resourceHelper.gs(R.string.limitingbolus, danaRPump.getMaxBolus(), resourceHelper.gs(R.string.pumplimit)), this);
- return insulin;
- }
-
- @NonNull
- @Override
- public Constraint applyExtendedBolusConstraints(@NonNull Constraint insulin) {
- return applyBolusConstraints(insulin);
- }
-
- // Pump interface
-
- @Override
- public boolean isInitialized() {
- return danaRPump.getLastConnection() > 0 && danaRPump.getMaxBasal() > 0;
- }
-
- @Override
- public boolean isSuspended() {
- return danaRPump.getPumpSuspended();
- }
-
- @Override
- public boolean isBusy() {
- if (danaRSService == null) return false;
- return danaRSService.isConnected() || danaRSService.isConnecting();
- }
-
- @NonNull @Override
- public PumpEnactResult setNewBasalProfile(Profile profile) {
- PumpEnactResult result = new PumpEnactResult(getInjector());
-
- if (danaRSService == null) {
- getAapsLogger().error("setNewBasalProfile sExecutionService is null");
- result.comment = "setNewBasalProfile sExecutionService is null";
- return result;
- }
- if (!isInitialized()) {
- getAapsLogger().error("setNewBasalProfile not initialized");
- Notification notification = new Notification(Notification.PROFILE_NOT_SET_NOT_INITIALIZED, resourceHelper.gs(R.string.pumpNotInitializedProfileNotSet), Notification.URGENT);
- rxBus.send(new EventNewNotification(notification));
- result.comment = resourceHelper.gs(R.string.pumpNotInitializedProfileNotSet);
- return result;
- } else {
- rxBus.send(new EventDismissNotification(Notification.PROFILE_NOT_SET_NOT_INITIALIZED));
- }
- if (!danaRSService.updateBasalsInPump(profile)) {
- Notification notification = new Notification(Notification.FAILED_UDPATE_PROFILE, resourceHelper.gs(R.string.failedupdatebasalprofile), Notification.URGENT);
- rxBus.send(new EventNewNotification(notification));
- result.comment = resourceHelper.gs(R.string.failedupdatebasalprofile);
- return result;
- } else {
- rxBus.send(new EventDismissNotification(Notification.PROFILE_NOT_SET_NOT_INITIALIZED));
- rxBus.send(new EventDismissNotification(Notification.FAILED_UDPATE_PROFILE));
- Notification notification = new Notification(Notification.PROFILE_SET_OK, resourceHelper.gs(R.string.profile_set_ok), Notification.INFO, 60);
- rxBus.send(new EventNewNotification(notification));
- result.success = true;
- result.enacted = true;
- result.comment = "OK";
- return result;
- }
- }
-
- @Override
- public boolean isThisProfileSet(Profile profile) {
- if (!isInitialized())
- return true; // TODO: not sure what's better. so far TRUE to prevent too many SMS
- if (danaRPump.getPumpProfiles() == null)
- return true; // TODO: not sure what's better. so far TRUE to prevent too many SMS
- int basalValues = danaRPump.getBasal48Enable() ? 48 : 24;
- int basalIncrement = danaRPump.getBasal48Enable() ? 30 * 60 : 60 * 60;
- for (int h = 0; h < basalValues; h++) {
- Double pumpValue = danaRPump.getPumpProfiles()[danaRPump.getActiveProfile()][h];
- Double profileValue = profile.getBasalTimeFromMidnight(h * basalIncrement);
- if (Math.abs(pumpValue - profileValue) > getPumpDescription().basalStep) {
- getAapsLogger().debug(LTag.PUMP, "Diff found. Hour: " + h + " Pump: " + pumpValue + " Profile: " + profileValue);
- return false;
- }
- }
- return true;
- }
-
- @Override
- public long lastDataTime() {
- return danaRPump.getLastConnection();
- }
-
- @Override
- public double getBaseBasalRate() {
- return danaRPump.getCurrentBasal();
- }
-
- @Override
- public double getReservoirLevel() {
- return danaRPump.getReservoirRemainingUnits();
- }
-
- @Override
- public int getBatteryLevel() {
- return danaRPump.getBatteryRemaining();
- }
-
- @NonNull @Override
- public synchronized PumpEnactResult deliverTreatment(DetailedBolusInfo detailedBolusInfo) {
- detailedBolusInfo.insulin = constraintChecker.applyBolusConstraints(new Constraint<>(detailedBolusInfo.insulin)).value();
- if (detailedBolusInfo.insulin > 0 || detailedBolusInfo.carbs > 0) {
- int preferencesSpeed = sp.getInt(R.string.key_danars_bolusspeed, 0);
- int speed = 12;
- switch (preferencesSpeed) {
- case 0:
- speed = 12;
- break;
- case 1:
- speed = 30;
- break;
- case 2:
- speed = 60;
- break;
- }
- // RS stores end time for bolus, we need to adjust time
- // default delivery speed is 12 sec/U
- detailedBolusInfo.date = DateUtil.now() + (long) (speed * detailedBolusInfo.insulin * 1000);
- // clean carbs to prevent counting them as twice because they will picked up as another record
- // I don't think it's necessary to copy DetailedBolusInfo right now for carbs records
- double carbs = detailedBolusInfo.carbs;
- detailedBolusInfo.carbs = 0;
- int carbTime = detailedBolusInfo.carbTime;
- if (carbTime == 0) carbTime--; // better set 1 min back to prevents clash with insulin
- detailedBolusInfo.carbTime = 0;
-
- detailedBolusInfoStorage.add(detailedBolusInfo); // will be picked up on reading history
-
- Treatment t = new Treatment();
- t.isSMB = detailedBolusInfo.isSMB;
- boolean connectionOK = false;
- if (detailedBolusInfo.insulin > 0 || carbs > 0)
- connectionOK = danaRSService.bolus(detailedBolusInfo.insulin, (int) carbs, DateUtil.now() + T.mins(carbTime).msecs(), t);
- PumpEnactResult result = new PumpEnactResult(getInjector());
- result.success = connectionOK && Math.abs(detailedBolusInfo.insulin - t.insulin) < pumpDescription.bolusStep;
- result.bolusDelivered = t.insulin;
- result.carbsDelivered = detailedBolusInfo.carbs;
- if (!result.success) {
- String error = "" + bolusStartErrorCode;
- switch (bolusStartErrorCode) {
- // 4 reported as max bolus violation. Check later
- case 0x10:
- error = resourceHelper.gs(R.string.maxbolusviolation);
- break;
- case 0x20:
- error = resourceHelper.gs(R.string.commanderror);
- break;
- case 0x40:
- error = resourceHelper.gs(R.string.speederror);
- break;
- case 0x80:
- error = resourceHelper.gs(R.string.insulinlimitviolation);
- break;
- }
- result.comment = String.format(resourceHelper.gs(R.string.boluserrorcode), detailedBolusInfo.insulin, t.insulin, error);
- } else
- result.comment = resourceHelper.gs(R.string.virtualpump_resultok);
- getAapsLogger().debug(LTag.PUMP, "deliverTreatment: OK. Asked: " + detailedBolusInfo.insulin + " Delivered: " + result.bolusDelivered);
- return result;
- } else {
- PumpEnactResult result = new PumpEnactResult(getInjector());
- result.success = false;
- result.bolusDelivered = 0d;
- result.carbsDelivered = 0d;
- result.comment = resourceHelper.gs(R.string.danar_invalidinput);
- getAapsLogger().error("deliverTreatment: Invalid input");
- return result;
- }
- }
-
- @Override
- public void stopBolusDelivering() {
- if (danaRSService == null) {
- getAapsLogger().error("stopBolusDelivering sExecutionService is null");
- return;
- }
- danaRSService.bolusStop();
- }
-
- // This is called from APS
- @NonNull @Override
- public synchronized PumpEnactResult setTempBasalAbsolute(Double absoluteRate, Integer durationInMinutes, Profile profile, boolean enforceNew) {
- // Recheck pump status if older than 30 min
-
- //This should not be needed while using queue because connection should be done before calling this
- //if (pump.lastConnection.getTime() + 30 * 60 * 1000L < System.currentTimeMillis()) {
- // connect("setTempBasalAbsolute old data");
- //}
-
- PumpEnactResult result = new PumpEnactResult(getInjector());
-
- absoluteRate = constraintChecker.applyBasalConstraints(new Constraint<>(absoluteRate), profile).value();
-
- final boolean doTempOff = getBaseBasalRate() - absoluteRate == 0d;
- final boolean doLowTemp = absoluteRate < getBaseBasalRate();
- final boolean doHighTemp = absoluteRate > getBaseBasalRate();
-
- if (doTempOff) {
- // If temp in progress
- if (treatmentsPlugin.isTempBasalInProgress()) {
- getAapsLogger().debug(LTag.PUMP, "setTempBasalAbsolute: Stopping temp basal (doTempOff)");
- return cancelTempBasal(false);
- }
- result.success = true;
- result.enacted = false;
- result.percent = 100;
- result.isPercent = true;
- result.isTempCancel = true;
- getAapsLogger().debug(LTag.PUMP, "setTempBasalAbsolute: doTempOff OK");
- return result;
- }
-
- if (doLowTemp || doHighTemp) {
- Integer percentRate = Double.valueOf(absoluteRate / getBaseBasalRate() * 100).intValue();
- if (percentRate < 100) percentRate = Round.ceilTo((double) percentRate, 10d).intValue();
- else percentRate = Round.floorTo((double) percentRate, 10d).intValue();
- if (percentRate > 500) // Special high temp 500/15min
- percentRate = 500;
- // Check if some temp is already in progress
- TemporaryBasal activeTemp = treatmentsPlugin.getTempBasalFromHistory(System.currentTimeMillis());
- if (activeTemp != null) {
- getAapsLogger().debug(LTag.PUMP, "setTempBasalAbsolute: currently running: " + activeTemp.toString());
- // Correct basal already set ?
- if (activeTemp.percentRate == percentRate && activeTemp.getPlannedRemainingMinutes() > 4) {
- if (!enforceNew) {
- result.success = true;
- result.percent = percentRate;
- result.enacted = false;
- result.duration = activeTemp.getPlannedRemainingMinutes();
- result.isPercent = true;
- result.isTempCancel = false;
- getAapsLogger().debug(LTag.PUMP, "setTempBasalAbsolute: Correct temp basal already set (doLowTemp || doHighTemp)");
- return result;
- }
- }
- }
- // Convert duration from minutes to hours
- getAapsLogger().debug(LTag.PUMP, "setTempBasalAbsolute: Setting temp basal " + percentRate + "% for " + durationInMinutes + " mins (doLowTemp || doHighTemp)");
- if (percentRate == 0 && durationInMinutes > 30) {
- result = setTempBasalPercent(percentRate, durationInMinutes, profile, enforceNew);
- } else {
- // use special APS temp basal call ... 100+/15min .... 100-/30min
- result = setHighTempBasalPercent(percentRate);
- }
- if (!result.success) {
- getAapsLogger().error("setTempBasalAbsolute: Failed to set hightemp basal");
- return result;
- }
- getAapsLogger().debug(LTag.PUMP, "setTempBasalAbsolute: hightemp basal set ok");
- return result;
- }
- // We should never end here
- getAapsLogger().error("setTempBasalAbsolute: Internal error");
- result.success = false;
- result.comment = "Internal error";
- return result;
- }
-
- @NonNull @Override
- public synchronized PumpEnactResult setTempBasalPercent(Integer percent, Integer durationInMinutes, Profile profile, boolean enforceNew) {
- DanaRPump pump = danaRPump;
- PumpEnactResult result = new PumpEnactResult(getInjector());
- percent = constraintChecker.applyBasalPercentConstraints(new Constraint<>(percent), profile).value();
- if (percent < 0) {
- result.isTempCancel = false;
- result.enacted = false;
- result.success = false;
- result.comment = resourceHelper.gs(R.string.danar_invalidinput);
- getAapsLogger().error("setTempBasalPercent: Invalid input");
- return result;
- }
- if (percent > getPumpDescription().maxTempPercent)
- percent = getPumpDescription().maxTempPercent;
- long now = System.currentTimeMillis();
- TemporaryBasal activeTemp = treatmentsPlugin.getTempBasalFromHistory(now);
- if (activeTemp != null && activeTemp.percentRate == percent && activeTemp.getPlannedRemainingMinutes() > 4 && !enforceNew) {
- result.enacted = false;
- result.success = true;
- result.isTempCancel = false;
- result.comment = resourceHelper.gs(R.string.virtualpump_resultok);
- result.duration = pump.getTempBasalRemainingMin();
- result.percent = pump.getTempBasalPercent();
- result.isPercent = true;
- getAapsLogger().debug(LTag.PUMP, "setTempBasalPercent: Correct value already set");
- return result;
- }
- boolean connectionOK;
- if (durationInMinutes == 15 || durationInMinutes == 30) {
- connectionOK = danaRSService.tempBasalShortDuration(percent, durationInMinutes);
- } else {
- int durationInHours = Math.max(durationInMinutes / 60, 1);
- connectionOK = danaRSService.tempBasal(percent, durationInHours);
- }
- if (connectionOK && pump.isTempBasalInProgress() && pump.getTempBasalPercent() == percent) {
- result.enacted = true;
- result.success = true;
- result.comment = resourceHelper.gs(R.string.virtualpump_resultok);
- result.isTempCancel = false;
- result.duration = pump.getTempBasalRemainingMin();
- result.percent = pump.getTempBasalPercent();
- result.isPercent = true;
- getAapsLogger().debug(LTag.PUMP, "setTempBasalPercent: OK");
- return result;
- }
- result.enacted = false;
- result.success = false;
- result.comment = resourceHelper.gs(R.string.tempbasaldeliveryerror);
- getAapsLogger().error("setTempBasalPercent: Failed to set temp basal");
- return result;
- }
-
- private synchronized PumpEnactResult setHighTempBasalPercent(Integer percent) {
- DanaRPump pump = danaRPump;
- PumpEnactResult result = new PumpEnactResult(getInjector());
- boolean connectionOK = danaRSService.highTempBasal(percent);
- if (connectionOK && pump.isTempBasalInProgress() && pump.getTempBasalPercent() == percent) {
- result.enacted = true;
- result.success = true;
- result.comment = resourceHelper.gs(R.string.virtualpump_resultok);
- result.isTempCancel = false;
- result.duration = pump.getTempBasalRemainingMin();
- result.percent = pump.getTempBasalPercent();
- result.isPercent = true;
- getAapsLogger().debug(LTag.PUMP, "setHighTempBasalPercent: OK");
- return result;
- }
- result.enacted = false;
- result.success = false;
- result.comment = resourceHelper.gs(R.string.danar_valuenotsetproperly);
- getAapsLogger().error("setHighTempBasalPercent: Failed to set temp basal");
- return result;
- }
-
- @NonNull @Override
- public synchronized PumpEnactResult setExtendedBolus(Double insulin, Integer durationInMinutes) {
- DanaRPump pump = danaRPump;
- insulin = constraintChecker.applyExtendedBolusConstraints(new Constraint<>(insulin)).value();
- // needs to be rounded
- int durationInHalfHours = Math.max(durationInMinutes / 30, 1);
- insulin = Round.roundTo(insulin, getPumpDescription().extendedBolusStep);
- PumpEnactResult result = new PumpEnactResult(getInjector());
- ExtendedBolus runningEB = treatmentsPlugin.getExtendedBolusFromHistory(System.currentTimeMillis());
- if (runningEB != null && Math.abs(runningEB.insulin - insulin) < getPumpDescription().extendedBolusStep) {
- result.enacted = false;
- result.success = true;
- result.comment = resourceHelper.gs(R.string.virtualpump_resultok);
- result.duration = pump.getExtendedBolusRemainingMinutes();
- result.absolute = pump.getExtendedBolusAbsoluteRate();
- result.isPercent = false;
- result.isTempCancel = false;
- getAapsLogger().debug(LTag.PUMP, "setExtendedBolus: Correct extended bolus already set. Current: " + pump.getExtendedBolusAmount() + " Asked: " + insulin);
- return result;
- }
- boolean connectionOK = danaRSService.extendedBolus(insulin, durationInHalfHours);
- if (connectionOK && pump.isExtendedInProgress() && Math.abs(pump.getExtendedBolusAbsoluteRate() - insulin) < getPumpDescription().extendedBolusStep) {
- result.enacted = true;
- result.success = true;
- result.comment = resourceHelper.gs(R.string.virtualpump_resultok);
- result.isTempCancel = false;
- result.duration = pump.getExtendedBolusRemainingMinutes();
- result.absolute = pump.getExtendedBolusAbsoluteRate();
- result.bolusDelivered = pump.getExtendedBolusAmount();
- result.isPercent = false;
- getAapsLogger().debug(LTag.PUMP, "setExtendedBolus: OK");
- return result;
- }
- result.enacted = false;
- result.success = false;
- result.comment = resourceHelper.gs(R.string.danar_valuenotsetproperly);
- getAapsLogger().error("setExtendedBolus: Failed to extended bolus");
- return result;
- }
-
- @NonNull @Override
- public synchronized PumpEnactResult cancelTempBasal(boolean force) {
- PumpEnactResult result = new PumpEnactResult(getInjector());
- TemporaryBasal runningTB = treatmentsPlugin.getTempBasalFromHistory(System.currentTimeMillis());
- if (runningTB != null) {
- danaRSService.tempBasalStop();
- result.enacted = true;
- result.isTempCancel = true;
- }
- if (!danaRPump.isTempBasalInProgress()) {
- result.success = true;
- result.isTempCancel = true;
- result.comment = resourceHelper.gs(R.string.virtualpump_resultok);
- getAapsLogger().debug(LTag.PUMP, "cancelRealTempBasal: OK");
- return result;
- } else {
- result.success = false;
- result.comment = resourceHelper.gs(R.string.danar_valuenotsetproperly);
- result.isTempCancel = true;
- getAapsLogger().error("cancelRealTempBasal: Failed to cancel temp basal");
- return result;
- }
- }
-
- @NonNull @Override
- public synchronized PumpEnactResult cancelExtendedBolus() {
- PumpEnactResult result = new PumpEnactResult(getInjector());
- ExtendedBolus runningEB = treatmentsPlugin.getExtendedBolusFromHistory(System.currentTimeMillis());
- if (runningEB != null) {
- danaRSService.extendedBolusStop();
- result.enacted = true;
- result.isTempCancel = true;
- }
- if (!danaRPump.isExtendedInProgress()) {
- result.success = true;
- result.comment = resourceHelper.gs(R.string.virtualpump_resultok);
- getAapsLogger().debug(LTag.PUMP, "cancelExtendedBolus: OK");
- return result;
- } else {
- result.success = false;
- result.comment = resourceHelper.gs(R.string.danar_valuenotsetproperly);
- getAapsLogger().error("cancelExtendedBolus: Failed to cancel extended bolus");
- return result;
- }
- }
-
- @NonNull @Override
- public JSONObject getJSONStatus(Profile profile, String profileName) {
- DanaRPump pump = danaRPump;
- long now = System.currentTimeMillis();
- if (pump.getLastConnection() + 5 * 60 * 1000L < System.currentTimeMillis()) {
- return new JSONObject();
- }
- JSONObject pumpjson = new JSONObject();
- JSONObject battery = new JSONObject();
- JSONObject status = new JSONObject();
- JSONObject extended = new JSONObject();
- try {
- battery.put("percent", pump.getBatteryRemaining());
- status.put("status", pump.getPumpSuspended() ? "suspended" : "normal");
- status.put("timestamp", DateUtil.toISOString(pump.getLastConnection()));
- extended.put("Version", BuildConfig.VERSION_NAME + "-" + BuildConfig.BUILDVERSION);
- if (pump.getLastBolusTime() != 0) {
- extended.put("LastBolus", dateUtil.dateAndTimeString(pump.getLastBolusTime()));
- extended.put("LastBolusAmount", pump.getLastBolusAmount());
- }
- TemporaryBasal tb = treatmentsPlugin.getTempBasalFromHistory(now);
- if (tb != null) {
- extended.put("TempBasalAbsoluteRate", tb.tempBasalConvertedToAbsolute(now, profile));
- extended.put("TempBasalStart", dateUtil.dateAndTimeString(tb.date));
- extended.put("TempBasalRemaining", tb.getPlannedRemainingMinutes());
- }
- ExtendedBolus eb = treatmentsPlugin.getExtendedBolusFromHistory(now);
- if (eb != null) {
- extended.put("ExtendedBolusAbsoluteRate", eb.absoluteRate());
- extended.put("ExtendedBolusStart", dateUtil.dateAndTimeString(eb.date));
- extended.put("ExtendedBolusRemaining", eb.getPlannedRemainingMinutes());
- }
- extended.put("BaseBasalRate", getBaseBasalRate());
- try {
- extended.put("ActiveProfile", profileFunction.getProfileName());
- } catch (Exception e) {
- getAapsLogger().error("Unhandled exception", e);
- }
-
- pumpjson.put("battery", battery);
- pumpjson.put("status", status);
- pumpjson.put("extended", extended);
- pumpjson.put("reservoir", (int) pump.getReservoirRemainingUnits());
- pumpjson.put("clock", DateUtil.toISOString(now));
- } catch (JSONException e) {
- getAapsLogger().error("Unhandled exception", e);
- }
- return pumpjson;
- }
-
- @NonNull @Override
- public ManufacturerType manufacturer() {
- return ManufacturerType.Sooil;
- }
-
- @NonNull @Override
- public PumpType model() {
- return PumpType.DanaRS;
- }
-
- @NonNull @Override
- public String serialNumber() {
- return danaRPump.getSerialNumber();
- }
-
- @NonNull @Override
- public PumpDescription getPumpDescription() {
- return pumpDescription;
- }
-
- @NonNull @Override
- public String shortStatus(boolean veryShort) {
- DanaRPump pump = danaRPump;
- String ret = "";
- if (pump.getLastConnection() != 0) {
- long agoMsec = System.currentTimeMillis() - pump.getLastConnection();
- int agoMin = (int) (agoMsec / 60d / 1000d);
- ret += "LastConn: " + agoMin + " minago\n";
- }
- if (pump.getLastBolusTime() != 0) {
- ret += "LastBolus: " + DecimalFormatter.to2Decimal(pump.getLastBolusAmount()) + "U @" + android.text.format.DateFormat.format("HH:mm", pump.getLastBolusTime()) + "\n";
- }
- TemporaryBasal activeTemp = treatmentsPlugin.getRealTempBasalFromHistory(System.currentTimeMillis());
- if (activeTemp != null) {
- ret += "Temp: " + activeTemp.toStringFull() + "\n";
- }
- ExtendedBolus activeExtendedBolus = treatmentsPlugin.getExtendedBolusFromHistory(System.currentTimeMillis());
- if (activeExtendedBolus != null) {
- ret += "Extended: " + activeExtendedBolus.toString() + "\n";
- }
- if (!veryShort) {
- ret += "TDD: " + DecimalFormatter.to0Decimal(pump.getDailyTotalUnits()) + " / " + pump.getMaxDailyTotalUnits() + " U\n";
- }
- ret += "Reserv: " + DecimalFormatter.to0Decimal(pump.getReservoirRemainingUnits()) + "U\n";
- ret += "Batt: " + pump.getBatteryRemaining() + "\n";
- return ret;
- }
-
- @Override
- public boolean isFakingTempsByExtendedBoluses() {
- return false;
- }
-
- @NonNull @Override
- public PumpEnactResult loadTDDs() {
- return loadHistory(RecordTypes.RECORD_TYPE_DAILY);
- }
-
- @Override
- public List getCustomActions() {
- return null;
- }
-
- @Override
- public void executeCustomAction(CustomActionType customActionType) {
-
- }
-
- @Override
- public boolean canHandleDST() {
- return false;
- }
-
- @Override
- public void timezoneOrDSTChanged(TimeChangeType changeType) {
- }
-
-}
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRS/activities/BLEScanActivity.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRS/activities/BLEScanActivity.java
deleted file mode 100644
index 89f794259e..0000000000
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRS/activities/BLEScanActivity.java
+++ /dev/null
@@ -1,217 +0,0 @@
-package info.nightscout.androidaps.plugins.pump.danaRS.activities;
-
-import android.bluetooth.BluetoothAdapter;
-import android.bluetooth.BluetoothDevice;
-import android.bluetooth.le.BluetoothLeScanner;
-import android.bluetooth.le.ScanCallback;
-import android.bluetooth.le.ScanResult;
-import android.content.pm.ActivityInfo;
-import android.os.Bundle;
-import android.os.Handler;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.BaseAdapter;
-import android.widget.ListView;
-import android.widget.TextView;
-
-import java.util.ArrayList;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import info.nightscout.androidaps.R;
-import info.nightscout.androidaps.activities.NoSplashAppCompatActivity;
-import info.nightscout.androidaps.plugins.bus.RxBus;
-import info.nightscout.androidaps.plugins.pump.danaRS.events.EventDanaRSDeviceChange;
-import info.nightscout.androidaps.utils.SP;
-
-public class BLEScanActivity extends NoSplashAppCompatActivity {
- private ListAdapter mListAdapter = null;
- private ArrayList mDevices = new ArrayList<>();
-
- private BluetoothLeScanner mBluetoothLeScanner = null;
-
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.danars_blescanner_activity);
- setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
-
- mListAdapter = new ListAdapter();
-
- ListView listView = findViewById(R.id.danars_blescanner_listview);
- listView.setEmptyView(findViewById(R.id.danars_blescanner_nodevice));
- listView.setAdapter(mListAdapter);
-
- mListAdapter.notifyDataSetChanged();
- }
-
- @Override
- protected void onResume() {
- super.onResume();
-
- BluetoothAdapter mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
- if (mBluetoothAdapter != null) {
- if (!mBluetoothAdapter.isEnabled()) mBluetoothAdapter.enable();
- mBluetoothLeScanner = mBluetoothAdapter.getBluetoothLeScanner();
-
- if (mBluetoothLeScanner == null) {
- mBluetoothAdapter.enable();
- mBluetoothLeScanner = mBluetoothAdapter.getBluetoothLeScanner();
- }
- startScan();
- }
- }
-
- @Override
- protected void onPause() {
- super.onPause();
-
- stopScan();
- }
-
- private void startScan() {
- if (mBluetoothLeScanner != null)
- mBluetoothLeScanner.startScan(mBleScanCallback);
- }
-
- private void stopScan() {
- if (mBluetoothLeScanner != null)
- mBluetoothLeScanner.stopScan(mBleScanCallback);
- }
-
- private void addBleDevice(BluetoothDevice device) {
- if (device == null || device.getName() == null || device.getName().equals("")) {
- return;
- }
- BluetoothDeviceItem item = new BluetoothDeviceItem(device);
- if (!isSNCheck(device.getName()) || mDevices.contains(item)) {
- return;
- }
-
- mDevices.add(item);
- new Handler().post(() -> mListAdapter.notifyDataSetChanged());
- }
-
- private ScanCallback mBleScanCallback = new ScanCallback() {
- @Override
- public void onScanResult(int callbackType, ScanResult result) {
- addBleDevice(result.getDevice());
- }
- };
-
- class ListAdapter extends BaseAdapter {
-
- @Override
- public int getCount() {
- return mDevices.size();
- }
-
- @Override
- public BluetoothDeviceItem getItem(int i) {
- return mDevices.get(i);
- }
-
- @Override
- public long getItemId(int i) {
- return 0;
- }
-
- @Override
- public View getView(int i, View convertView, ViewGroup parent) {
- View v = convertView;
- ViewHolder holder;
-
- if (v == null) {
- v = View.inflate(getApplicationContext(), R.layout.danars_blescanner_item, null);
- holder = new ViewHolder(v);
- v.setTag(holder);
- } else {
- holder = (ViewHolder) v.getTag();
- }
-
- BluetoothDeviceItem item = getItem(i);
- holder.setData(item);
- return v;
- }
-
- private class ViewHolder implements View.OnClickListener {
- private BluetoothDeviceItem item = null;
-
- private TextView mName;
- private TextView mAddress;
-
- ViewHolder(View v) {
- mName = v.findViewById(R.id.ble_name);
- mAddress = v.findViewById(R.id.ble_address);
-
- v.setOnClickListener(ViewHolder.this);
- }
-
- @Override
- public void onClick(View v) {
- SP.putString(R.string.key_danars_address, item.device.getAddress());
- SP.putString(R.string.key_danars_name, mName.getText().toString());
- item.device.createBond();
- RxBus.Companion.getINSTANCE().send(new EventDanaRSDeviceChange());
- finish();
- }
-
- public void setData(BluetoothDeviceItem data) {
- if (data != null) {
- try {
- String tTitle = data.device.getName();
- if (tTitle == null || tTitle.equals("")) {
- tTitle = "(unknown)";
- } else if (tTitle.length() > 10) {
- tTitle = tTitle.substring(0, 10);
- }
- mName.setText(tTitle);
-
- mAddress.setText(data.device.getAddress());
-
- item = data;
- } catch (Exception ignored) {
- }
- }
- }
- }
- }
-
- //
- private class BluetoothDeviceItem {
- private BluetoothDevice device;
-
- BluetoothDeviceItem(BluetoothDevice device) {
- super();
- this.device = device;
- }
-
- @Override
- public boolean equals(Object o) {
- if (device == null || !(o instanceof BluetoothDeviceItem)) {
- return false;
- }
- BluetoothDeviceItem checkItem = (BluetoothDeviceItem) o;
- if (checkItem.device == null) {
- return false;
- }
- return stringEquals(device.getAddress(), checkItem.device.getAddress());
- }
-
- boolean stringEquals(String arg1, String arg2) {
- try {
- return arg1.equals(arg2);
- } catch (Exception e) {
- return false;
- }
- }
- }
-
- public static boolean isSNCheck(String sn) {
- String regex = "^([a-zA-Z]{3})([0-9]{5})([a-zA-Z]{2})$";
- Pattern p = Pattern.compile(regex);
- Matcher m = p.matcher(sn);
-
- return m.matches();
- }
-}
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRS/activities/PairingHelperActivity.kt b/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRS/activities/PairingHelperActivity.kt
deleted file mode 100644
index ba73e1b368..0000000000
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRS/activities/PairingHelperActivity.kt
+++ /dev/null
@@ -1,16 +0,0 @@
-package info.nightscout.androidaps.plugins.pump.danaRS.activities
-
-import android.content.pm.ActivityInfo
-import android.os.Bundle
-import info.nightscout.androidaps.activities.NoSplashAppCompatActivity
-import info.nightscout.androidaps.plugins.pump.danaRS.dialogs.PairingProgressDialog
-
-class PairingHelperActivity : NoSplashAppCompatActivity() {
- override fun onCreate(savedInstanceState: Bundle?) {
- super.onCreate(savedInstanceState)
- PairingProgressDialog()
- .setHelperActivity(this)
- .show(supportFragmentManager, "PairingProgress")
- requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT;
- }
-}
\ No newline at end of file
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRSMessageHashTable.kt b/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRSMessageHashTable.kt
deleted file mode 100644
index 0a4c81314d..0000000000
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRSMessageHashTable.kt
+++ /dev/null
@@ -1,109 +0,0 @@
-package info.nightscout.androidaps.plugins.pump.danaRS.comm
-
-import dagger.android.HasAndroidInjector
-import info.nightscout.androidaps.interfaces.ActivePluginProvider
-import info.nightscout.androidaps.logging.AAPSLogger
-import info.nightscout.androidaps.plugins.bus.RxBusWrapper
-import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker
-import info.nightscout.androidaps.plugins.pump.common.bolusInfo.DetailedBolusInfoStorage
-import info.nightscout.androidaps.plugins.pump.danaR.DanaRPump
-import info.nightscout.androidaps.plugins.pump.danaRS.DanaRSPlugin
-import info.nightscout.androidaps.utils.DateUtil
-import info.nightscout.androidaps.utils.resources.ResourceHelper
-import java.util.*
-import javax.inject.Inject
-import javax.inject.Singleton
-
-@Singleton
-class DanaRSMessageHashTable @Inject constructor(
- aapsLogger: AAPSLogger,
- rxBus: RxBusWrapper,
- resourceHelper: ResourceHelper,
- danaRPump: DanaRPump,
- danaRSPlugin: DanaRSPlugin,
- activePlugin: ActivePluginProvider,
- constraintChecker: ConstraintChecker,
- detailedBolusInfoStorage: DetailedBolusInfoStorage,
- injector: HasAndroidInjector,
- dateUtil: DateUtil
-) {
-
- var messages: HashMap = HashMap()
-
- fun put(message: DanaRS_Packet) {
- messages[message.command] = message
- }
-
- fun findMessage(command: Int): DanaRS_Packet {
- return messages[command] ?: DanaRS_Packet()
- }
-
- init {
- put(DanaRS_Packet_Basal_Set_Cancel_Temporary_Basal(aapsLogger))
- put(DanaRS_Packet_Basal_Get_Basal_Rate(aapsLogger, rxBus, resourceHelper, danaRPump))
- put(DanaRS_Packet_Basal_Get_Profile_Basal_Rate(aapsLogger, danaRPump))
- put(DanaRS_Packet_Basal_Get_Profile_Number(aapsLogger, danaRPump))
- put(DanaRS_Packet_Basal_Set_Basal_Rate(aapsLogger, arrayOf()))
- put(DanaRS_Packet_Basal_Set_Profile_Basal_Rate(aapsLogger, 0, arrayOf()))
- put(DanaRS_Packet_Basal_Set_Profile_Number(aapsLogger))
- put(DanaRS_Packet_Basal_Set_Suspend_Off(aapsLogger))
- put(DanaRS_Packet_Basal_Set_Suspend_On(aapsLogger))
- put(DanaRS_Packet_Basal_Set_Temporary_Basal(aapsLogger))
- put(DanaRS_Packet_Basal_Get_Temporary_Basal_State(aapsLogger, danaRPump, dateUtil))
- put(DanaRS_Packet_Bolus_Get_Bolus_Option(aapsLogger, rxBus, resourceHelper, danaRPump))
- put(DanaRS_Packet_Bolus_Get_Initial_Bolus(aapsLogger))
- put(DanaRS_Packet_Bolus_Get_Calculation_Information(aapsLogger, danaRPump))
- put(DanaRS_Packet_Bolus_Get_Carbohydrate_Calculation_Information(aapsLogger, danaRPump))
- put(DanaRS_Packet_Bolus_Get_CIR_CF_Array(aapsLogger, danaRPump))
- put(DanaRS_Packet_Bolus_Get_Dual_Bolus(aapsLogger, danaRPump))
- put(DanaRS_Packet_Bolus_Get_Extended_Bolus(aapsLogger, danaRPump))
- put(DanaRS_Packet_Bolus_Get_Extended_Bolus_State(aapsLogger, danaRPump))
- put(DanaRS_Packet_Bolus_Get_Extended_Menu_Option_State(aapsLogger, danaRPump))
- put(DanaRS_Packet_Bolus_Get_Step_Bolus_Information(aapsLogger, danaRPump, dateUtil))
- put(DanaRS_Packet_Bolus_Set_Bolus_Option(aapsLogger))
- put(DanaRS_Packet_Bolus_Set_Initial_Bolus(aapsLogger))
- put(DanaRS_Packet_Bolus_Set_CIR_CF_Array(aapsLogger))
- put(DanaRS_Packet_Bolus_Set_Dual_Bolus(aapsLogger))
- put(DanaRS_Packet_Bolus_Set_Extended_Bolus(aapsLogger))
- put(DanaRS_Packet_Bolus_Set_Extended_Bolus_Cancel(aapsLogger))
- put(DanaRS_Packet_Bolus_Set_Step_Bolus_Start(aapsLogger, danaRSPlugin, constraintChecker))
- put(DanaRS_Packet_Bolus_Set_Step_Bolus_Stop(aapsLogger, rxBus, resourceHelper, danaRSPlugin))
- put(DanaRS_Packet_Etc_Keep_Connection(aapsLogger))
- put(DanaRS_Packet_Etc_Set_History_Save(aapsLogger))
- put(DanaRS_Packet_General_Delivery_Status(aapsLogger))
- put(DanaRS_Packet_General_Get_Password(aapsLogger, danaRPump))
- put(DanaRS_Packet_General_Initial_Screen_Information(aapsLogger, danaRPump))
- put(DanaRS_Packet_Notify_Alarm(aapsLogger, resourceHelper))
- put(DanaRS_Packet_Notify_Delivery_Complete(aapsLogger, rxBus, resourceHelper, danaRSPlugin))
- put(DanaRS_Packet_Notify_Delivery_Rate_Display(aapsLogger, rxBus, resourceHelper, danaRSPlugin))
- put(DanaRS_Packet_Notify_Missed_Bolus_Alarm(aapsLogger))
- put(DanaRS_Packet_Option_Get_Pump_Time(aapsLogger, danaRPump, dateUtil))
- put(DanaRS_Packet_Option_Get_User_Option(aapsLogger, danaRPump))
- put(DanaRS_Packet_Option_Set_Pump_Time(aapsLogger, dateUtil))
- put(DanaRS_Packet_Option_Set_User_Option(aapsLogger, danaRPump))
- //put(new DanaRS_Packet_History_());
- put(DanaRS_Packet_History_Alarm(aapsLogger, rxBus, dateUtil))
- put(DanaRS_Packet_History_All_History(aapsLogger, rxBus, dateUtil))
- put(DanaRS_Packet_History_Basal(aapsLogger, rxBus, dateUtil))
- put(DanaRS_Packet_History_Blood_Glucose(aapsLogger, rxBus, dateUtil))
- put(DanaRS_Packet_History_Bolus(aapsLogger, rxBus, dateUtil))
- put(DanaRS_Packet_Review_Bolus_Avg(aapsLogger))
- put(DanaRS_Packet_History_Carbohydrate(aapsLogger, rxBus, dateUtil))
- put(DanaRS_Packet_History_Daily(aapsLogger, rxBus, dateUtil))
- put(DanaRS_Packet_General_Get_More_Information(aapsLogger, danaRPump, dateUtil))
- put(DanaRS_Packet_General_Get_Pump_Check(aapsLogger, danaRPump, rxBus, resourceHelper))
- put(DanaRS_Packet_General_Get_Shipping_Information(aapsLogger, danaRPump, dateUtil))
- put(DanaRS_Packet_General_Get_Today_Delivery_Total(aapsLogger, danaRPump))
- put(DanaRS_Packet_General_Get_User_Time_Change_Flag(aapsLogger))
- put(DanaRS_Packet_History_Prime(aapsLogger, rxBus, dateUtil))
- put(DanaRS_Packet_History_Refill(aapsLogger, rxBus, dateUtil))
- put(DanaRS_Packet_General_Set_History_Upload_Mode(aapsLogger))
- put(DanaRS_Packet_General_Set_User_Time_Change_Flag_Clear(aapsLogger))
- put(DanaRS_Packet_History_Suspend(aapsLogger, rxBus, dateUtil))
- put(DanaRS_Packet_History_Temporary(aapsLogger, rxBus, dateUtil))
- // APS
- put(DanaRS_Packet_APS_Basal_Set_Temporary_Basal(aapsLogger, 0))
- put(DanaRS_Packet_APS_History_Events(aapsLogger, rxBus, resourceHelper, activePlugin, danaRSPlugin, detailedBolusInfoStorage, injector, dateUtil, 0))
- put(DanaRS_Packet_APS_Set_Event_History(aapsLogger, dateUtil, 0, 0, 0, 0))
- }
-}
\ No newline at end of file
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_Basal_Get_Profile_Number.kt b/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_Basal_Get_Profile_Number.kt
deleted file mode 100644
index c37242b740..0000000000
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_Basal_Get_Profile_Number.kt
+++ /dev/null
@@ -1,27 +0,0 @@
-package info.nightscout.androidaps.plugins.pump.danaRS.comm
-
-import com.cozmo.danar.util.BleCommandUtil
-import info.nightscout.androidaps.logging.AAPSLogger
-import info.nightscout.androidaps.logging.LTag
-import info.nightscout.androidaps.plugins.pump.danaR.DanaRPump
-
-class DanaRS_Packet_Basal_Get_Profile_Number(
- private val aapsLogger: AAPSLogger,
- private val danaRPump: DanaRPump
-) : DanaRS_Packet() {
-
- init {
- opCode = BleCommandUtil.DANAR_PACKET__OPCODE_BASAL__GET_PROFILE_NUMBER
- aapsLogger.debug(LTag.PUMPCOMM, "Requesting active profile")
- }
-
- override fun handleMessage(data: ByteArray) {
- danaRPump.activeProfile = byteArrayToInt(getBytes(data, DATA_START, 1))
- aapsLogger.debug(LTag.PUMPCOMM, "Active profile: " + danaRPump.activeProfile)
- }
-
- override fun getFriendlyName(): String {
- return "BASAL__GET_PROFILE_NUMBER"
- }
-
-}
\ No newline at end of file
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_Bolus_Get_Dual_Bolus.kt b/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_Bolus_Get_Dual_Bolus.kt
deleted file mode 100644
index 2fbe624322..0000000000
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_Bolus_Get_Dual_Bolus.kt
+++ /dev/null
@@ -1,35 +0,0 @@
-package info.nightscout.androidaps.plugins.pump.danaRS.comm
-
-import com.cozmo.danar.util.BleCommandUtil
-import info.nightscout.androidaps.logging.AAPSLogger
-import info.nightscout.androidaps.logging.LTag
-import info.nightscout.androidaps.plugins.pump.danaR.DanaRPump
-
-class DanaRS_Packet_Bolus_Get_Dual_Bolus(
- private val aapsLogger: AAPSLogger,
- private val danaRPump: DanaRPump
-) : DanaRS_Packet() {
-
- init {
- opCode = BleCommandUtil.DANAR_PACKET__OPCODE_BOLUS__GET_DUAL_BOLUS
- aapsLogger.debug(LTag.PUMPCOMM, "New message")
- }
-
- override fun handleMessage(data: ByteArray) {
- val error = byteArrayToInt(getBytes(data, DATA_START, 1))
- danaRPump.bolusStep = byteArrayToInt(getBytes(data, DATA_START + 1, 2)) / 100.0
- danaRPump.extendedBolusAbsoluteRate = byteArrayToInt(getBytes(data, DATA_START + 3, 2)) / 100.0
- danaRPump.maxBolus = byteArrayToInt(getBytes(data, DATA_START + 5, 2)) / 100.0
- val bolusIncrement = byteArrayToInt(getBytes(data, DATA_START + 7, 1)) / 100.0
- failed = error != 0
- aapsLogger.debug(LTag.PUMPCOMM, "Result: $error")
- aapsLogger.debug(LTag.PUMPCOMM, "Bolus step: ${danaRPump.bolusStep} U")
- aapsLogger.debug(LTag.PUMPCOMM, "Extended bolus running: ${danaRPump.extendedBolusAbsoluteRate} U/h")
- aapsLogger.debug(LTag.PUMPCOMM, "Max bolus: " + danaRPump.maxBolus + " U")
- aapsLogger.debug(LTag.PUMPCOMM, "bolusIncrement: $bolusIncrement U")
- }
-
- override fun getFriendlyName(): String {
- return "BOLUS__GET_DUAL_BOLUS"
- }
-}
\ No newline at end of file
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_Bolus_Get_Extended_Bolus.kt b/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_Bolus_Get_Extended_Bolus.kt
deleted file mode 100644
index 3cd50febdb..0000000000
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_Bolus_Get_Extended_Bolus.kt
+++ /dev/null
@@ -1,41 +0,0 @@
-package info.nightscout.androidaps.plugins.pump.danaRS.comm
-
-import com.cozmo.danar.util.BleCommandUtil
-import info.nightscout.androidaps.logging.AAPSLogger
-import info.nightscout.androidaps.logging.LTag
-import info.nightscout.androidaps.plugins.pump.danaR.DanaRPump
-
-class DanaRS_Packet_Bolus_Get_Extended_Bolus(
- private val aapsLogger: AAPSLogger,
- private val danaRPump: DanaRPump
-) : DanaRS_Packet() {
-
- init {
- opCode = BleCommandUtil.DANAR_PACKET__OPCODE_BOLUS__GET_EXTENDED_BOLUS
- aapsLogger.debug(LTag.PUMPCOMM, "New message")
- }
-
- override fun handleMessage(data: ByteArray) {
- var dataIndex = DATA_START
- var dataSize = 1
- val error = byteArrayToInt(getBytes(data, dataIndex, dataSize))
- dataIndex += dataSize
- dataSize = 2
- danaRPump.extendedBolusAbsoluteRate = byteArrayToInt(getBytes(data, dataIndex, dataSize)) / 100.0
- dataIndex += dataSize
- dataSize = 2
- danaRPump.maxBolus = byteArrayToInt(getBytes(data, dataIndex, dataSize)) / 100.0
- dataIndex += dataSize
- dataSize = 1
- danaRPump.bolusStep = byteArrayToInt(getBytes(data, dataIndex, dataSize)) / 100.0
- failed = error != 0
- aapsLogger.debug(LTag.PUMPCOMM, "Result: $error")
- aapsLogger.debug(LTag.PUMPCOMM, "Extended bolus running: " + danaRPump.extendedBolusAbsoluteRate + " U/h")
- aapsLogger.debug(LTag.PUMPCOMM, "Max bolus: " + danaRPump.maxBolus + " U")
- aapsLogger.debug(LTag.PUMPCOMM, "Bolus step: " + danaRPump.bolusStep + " U")
- }
-
- override fun getFriendlyName(): String {
- return "BOLUS__GET_EXTENDED_BOLUS"
- }
-}
\ No newline at end of file
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_Bolus_Get_Extended_Bolus_State.kt b/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_Bolus_Get_Extended_Bolus_State.kt
deleted file mode 100644
index c48b08150b..0000000000
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_Bolus_Get_Extended_Bolus_State.kt
+++ /dev/null
@@ -1,49 +0,0 @@
-package info.nightscout.androidaps.plugins.pump.danaRS.comm
-
-import com.cozmo.danar.util.BleCommandUtil
-import info.nightscout.androidaps.logging.AAPSLogger
-import info.nightscout.androidaps.logging.LTag
-import info.nightscout.androidaps.plugins.pump.danaR.DanaRPump
-
-class DanaRS_Packet_Bolus_Get_Extended_Bolus_State(
- private val aapsLogger: AAPSLogger,
- private val danaRPump: DanaRPump
-) : DanaRS_Packet() {
-
- init {
- opCode = BleCommandUtil.DANAR_PACKET__OPCODE_BOLUS__GET_EXTENDED_BOLUS_STATE
- aapsLogger.debug(LTag.PUMPCOMM, "New message")
- }
-
- override fun handleMessage(data: ByteArray) {
- var dataIndex = DATA_START
- var dataSize = 1
- val error = byteArrayToInt(getBytes(data, dataIndex, dataSize))
- dataIndex += dataSize
- dataSize = 1
- danaRPump.isExtendedInProgress = byteArrayToInt(getBytes(data, dataIndex, dataSize)) == 0x01
- dataIndex += dataSize
- dataSize = 1
- danaRPump.extendedBolusMinutes = byteArrayToInt(getBytes(data, dataIndex, dataSize)) * 30
- dataIndex += dataSize
- dataSize = 2
- danaRPump.extendedBolusAbsoluteRate = byteArrayToInt(getBytes(data, dataIndex, dataSize)) / 100.0
- dataIndex += dataSize
- dataSize = 2
- danaRPump.extendedBolusSoFarInMinutes = byteArrayToInt(getBytes(data, dataIndex, dataSize))
- dataIndex += dataSize
- dataSize = 2
- danaRPump.extendedBolusDeliveredSoFar = byteArrayToInt(getBytes(data, dataIndex, dataSize)) / 100.0
- failed = error != 0
- aapsLogger.debug(LTag.PUMPCOMM, "Result: $error")
- aapsLogger.debug(LTag.PUMPCOMM, "Is extended bolus running: " + danaRPump.isExtendedInProgress)
- aapsLogger.debug(LTag.PUMPCOMM, "Extended bolus running: " + danaRPump.extendedBolusAbsoluteRate + " U/h")
- aapsLogger.debug(LTag.PUMPCOMM, "Extended bolus duration: " + danaRPump.extendedBolusMinutes + " min")
- aapsLogger.debug(LTag.PUMPCOMM, "Extended bolus so far: " + danaRPump.extendedBolusSoFarInMinutes + " min")
- aapsLogger.debug(LTag.PUMPCOMM, "Extended bolus delivered so far: " + danaRPump.extendedBolusDeliveredSoFar + " U")
- }
-
- override fun getFriendlyName(): String {
- return "BOLUS__GET_EXTENDED_BOLUS_STATE"
- }
-}
\ No newline at end of file
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_Bolus_Get_Step_Bolus_Information.kt b/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_Bolus_Get_Step_Bolus_Information.kt
deleted file mode 100644
index a78bf0c525..0000000000
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_Bolus_Get_Step_Bolus_Information.kt
+++ /dev/null
@@ -1,61 +0,0 @@
-package info.nightscout.androidaps.plugins.pump.danaRS.comm
-
-import com.cozmo.danar.util.BleCommandUtil
-import info.nightscout.androidaps.logging.AAPSLogger
-import info.nightscout.androidaps.logging.LTag
-import info.nightscout.androidaps.plugins.pump.danaR.DanaRPump
-import info.nightscout.androidaps.utils.DateUtil
-import java.util.*
-
-class DanaRS_Packet_Bolus_Get_Step_Bolus_Information(
- private val aapsLogger: AAPSLogger,
- private val danaRPump: DanaRPump,
- private val dateUtil: DateUtil
-) : DanaRS_Packet() {
-
- init {
- opCode = BleCommandUtil.DANAR_PACKET__OPCODE_BOLUS__GET_STEP_BOLUS_INFORMATION
- aapsLogger.debug(LTag.PUMPCOMM, "New message")
- }
-
- override fun handleMessage(data: ByteArray) {
- var dataIndex = DATA_START
- var dataSize = 1
- val error = byteArrayToInt(getBytes(data, dataIndex, dataSize))
- dataIndex += dataSize
- dataSize = 1
- val bolusType = byteArrayToInt(getBytes(data, dataIndex, dataSize))
- dataIndex += dataSize
- dataSize = 2
- danaRPump.initialBolusAmount = byteArrayToInt(getBytes(data, dataIndex, dataSize)) / 100.0
- val lbt = Date() // it doesn't provide day only hour+min, workaround: expecting today
- dataIndex += dataSize
- dataSize = 1
- lbt.hours = byteArrayToInt(getBytes(data, dataIndex, dataSize))
- dataIndex += dataSize
- dataSize = 1
- lbt.minutes = byteArrayToInt(getBytes(data, dataIndex, dataSize))
- danaRPump.lastBolusTime = lbt.time
- dataIndex += dataSize
- dataSize = 2
- danaRPump.lastBolusAmount = byteArrayToInt(getBytes(data, dataIndex, dataSize)) / 100.0
- dataIndex += dataSize
- dataSize = 2
- danaRPump.maxBolus = byteArrayToInt(getBytes(data, dataIndex, dataSize)) / 100.0
- dataIndex += dataSize
- dataSize = 1
- danaRPump.bolusStep = byteArrayToInt(getBytes(data, dataIndex, dataSize)) / 100.0
- failed = error != 0
- aapsLogger.debug(LTag.PUMPCOMM, "Result: $error")
- aapsLogger.debug(LTag.PUMPCOMM, "BolusType: $bolusType")
- aapsLogger.debug(LTag.PUMPCOMM, "Initial bolus amount: " + danaRPump.initialBolusAmount + " U")
- aapsLogger.debug(LTag.PUMPCOMM, "Last bolus time: " + dateUtil.dateAndTimeString(danaRPump.lastBolusTime))
- aapsLogger.debug(LTag.PUMPCOMM, "Last bolus amount: " + danaRPump.lastBolusAmount)
- aapsLogger.debug(LTag.PUMPCOMM, "Max bolus: " + danaRPump.maxBolus + " U")
- aapsLogger.debug(LTag.PUMPCOMM, "Bolus step: " + danaRPump.bolusStep + " U")
- }
-
- override fun getFriendlyName(): String {
- return "BOLUS__GET_STEP_BOLUS_INFORMATION"
- }
-}
\ No newline at end of file
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_General_Get_More_Information.kt b/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_General_Get_More_Information.kt
deleted file mode 100644
index a9b1b2df62..0000000000
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_General_Get_More_Information.kt
+++ /dev/null
@@ -1,63 +0,0 @@
-package info.nightscout.androidaps.plugins.pump.danaRS.comm
-
-import com.cozmo.danar.util.BleCommandUtil
-import info.nightscout.androidaps.logging.AAPSLogger
-import info.nightscout.androidaps.logging.LTag
-import info.nightscout.androidaps.plugins.pump.danaR.DanaRPump
-import info.nightscout.androidaps.utils.DateUtil
-import java.util.*
-
-class DanaRS_Packet_General_Get_More_Information(
- private val aapsLogger: AAPSLogger,
- private val danaRPump: DanaRPump,
- private val dateUtil: DateUtil
-) : DanaRS_Packet() {
-
- init {
- opCode = BleCommandUtil.DANAR_PACKET__OPCODE_REVIEW__GET_MORE_INFORMATION
- aapsLogger.debug(LTag.PUMPCOMM, "New message")
- }
-
- override fun handleMessage(data: ByteArray) {
- if (data.size < 15) {
- failed = true
- return
- }
- var dataIndex = DATA_START
- var dataSize = 2
- danaRPump.iob = byteArrayToInt(getBytes(data, dataIndex, dataSize)).toDouble()
- dataIndex += dataSize
- dataSize = 2
- danaRPump.dailyTotalUnits = byteArrayToInt(getBytes(data, dataIndex, dataSize)) / 100.0
- dataIndex += dataSize
- dataSize = 1
- danaRPump.isExtendedInProgress = byteArrayToInt(getBytes(data, dataIndex, dataSize)) == 0x01
- dataIndex += dataSize
- dataSize = 2
- danaRPump.extendedBolusRemainingMinutes = byteArrayToInt(getBytes(data, dataIndex, dataSize))
- dataIndex += dataSize
- dataSize = 2
- //val remainRate = byteArrayToInt(getBytes(data, dataIndex, dataSize)) / 100.0
- val lastBolusTime = Date() // it doesn't provide day only hour+min, workaround: expecting today
- dataIndex += dataSize
- dataSize = 1
- lastBolusTime.hours = byteArrayToInt(getBytes(data, dataIndex, dataSize))
- dataIndex += dataSize
- dataSize = 1
- lastBolusTime.minutes = byteArrayToInt(getBytes(data, dataIndex, dataSize))
- dataIndex += dataSize
- dataSize = 2
- danaRPump.lastBolusAmount = byteArrayToInt(getBytes(data, dataIndex, dataSize)).toDouble()
- // On DanaRS DailyUnits can't be more than 160
- if (danaRPump.dailyTotalUnits > 160) failed = true
- aapsLogger.debug(LTag.PUMPCOMM, "Daily total units: " + danaRPump.dailyTotalUnits.toString() + " U")
- aapsLogger.debug(LTag.PUMPCOMM, "Is extended in progress: " + danaRPump.isExtendedInProgress)
- aapsLogger.debug(LTag.PUMPCOMM, "Extended bolus remaining minutes: " + danaRPump.extendedBolusRemainingMinutes)
- aapsLogger.debug(LTag.PUMPCOMM, "Last bolus time: " + dateUtil.dateAndTimeAndSecondsString(lastBolusTime.time))
- aapsLogger.debug(LTag.PUMPCOMM, "Last bolus amount: " + danaRPump.lastBolusAmount)
- }
-
- override fun getFriendlyName(): String {
- return "REVIEW__GET_MORE_INFORMATION"
- }
-}
\ No newline at end of file
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_General_Get_Shipping_Information.kt b/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_General_Get_Shipping_Information.kt
deleted file mode 100644
index 6a60ea523a..0000000000
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_General_Get_Shipping_Information.kt
+++ /dev/null
@@ -1,42 +0,0 @@
-package info.nightscout.androidaps.plugins.pump.danaRS.comm
-
-import com.cozmo.danar.util.BleCommandUtil
-import info.nightscout.androidaps.logging.AAPSLogger
-import info.nightscout.androidaps.logging.LTag
-import info.nightscout.androidaps.plugins.pump.danaR.DanaRPump
-import info.nightscout.androidaps.utils.DateUtil
-
-class DanaRS_Packet_General_Get_Shipping_Information(
- private val aapsLogger: AAPSLogger,
- private val danaRPump: DanaRPump,
- private val dateUtil: DateUtil
-) : DanaRS_Packet() {
-
- init {
- opCode = BleCommandUtil.DANAR_PACKET__OPCODE_REVIEW__GET_SHIPPING_INFORMATION
- aapsLogger.debug(LTag.PUMPCOMM, "New message")
- }
-
- override fun handleMessage(data: ByteArray) {
- if (data.size < 18) {
- failed = true
- return
- } else failed = false
- var dataIndex = DATA_START
- var dataSize = 10
- danaRPump.serialNumber = stringFromBuff(data, dataIndex, dataSize)
- dataIndex += dataSize
- dataSize = 3
- danaRPump.shippingDate = dateFromBuff(data, dataIndex)
- dataIndex += dataSize
- dataSize = 3
- danaRPump.shippingCountry = asciiStringFromBuff(data, dataIndex, dataSize)
- aapsLogger.debug(LTag.PUMPCOMM, "Serial number: " + danaRPump.serialNumber)
- aapsLogger.debug(LTag.PUMPCOMM, "Shipping date: " + dateUtil.dateAndTimeString(danaRPump.shippingDate))
- aapsLogger.debug(LTag.PUMPCOMM, "Shipping country: " + danaRPump.shippingCountry)
- }
-
- override fun getFriendlyName(): String {
- return "REVIEW__GET_SHIPPING_INFORMATION"
- }
-}
\ No newline at end of file
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_General_Get_Today_Delivery_Total.kt b/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_General_Get_Today_Delivery_Total.kt
deleted file mode 100644
index 31310e3d08..0000000000
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_General_Get_Today_Delivery_Total.kt
+++ /dev/null
@@ -1,40 +0,0 @@
-package info.nightscout.androidaps.plugins.pump.danaRS.comm
-
-import com.cozmo.danar.util.BleCommandUtil
-import info.nightscout.androidaps.logging.AAPSLogger
-import info.nightscout.androidaps.logging.LTag
-import info.nightscout.androidaps.plugins.pump.danaR.DanaRPump
-
-class DanaRS_Packet_General_Get_Today_Delivery_Total(
- private val aapsLogger: AAPSLogger,
- private val danaRPump: DanaRPump
-) : DanaRS_Packet() {
-
- init {
- opCode = BleCommandUtil.DANAR_PACKET__OPCODE_REVIEW__GET_TODAY_DELIVERY_TOTAL
- aapsLogger.debug(LTag.PUMPCOMM, "New message")
- }
-
- override fun handleMessage(data: ByteArray) {
- if (data.size < 8) {
- failed = true
- return
- } else failed = false
- var dataIndex = DATA_START
- var dataSize = 2
- danaRPump.dailyTotalUnits = byteArrayToInt(getBytes(data, dataIndex, dataSize)) / 100.0
- dataIndex += dataSize
- dataSize = 2
- danaRPump.dailyTotalBasalUnits = byteArrayToInt(getBytes(data, dataIndex, dataSize)) / 100.0
- dataIndex += dataSize
- dataSize = 2
- danaRPump.dailyTotalBolusUnits = byteArrayToInt(getBytes(data, dataIndex, dataSize)) / 100.0
- aapsLogger.debug(LTag.PUMPCOMM, "Daily total: " + danaRPump.dailyTotalUnits + " U")
- aapsLogger.debug(LTag.PUMPCOMM, "Daily total bolus: " + danaRPump.dailyTotalBolusUnits + " U")
- aapsLogger.debug(LTag.PUMPCOMM, "Daily total basal: " + danaRPump.dailyTotalBasalUnits + " U")
- }
-
- override fun getFriendlyName(): String {
- return "REVIEW__GET_TODAY_DELIVERY_TOTAL"
- }
-}
\ No newline at end of file
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_General_Initial_Screen_Information.kt b/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_General_Initial_Screen_Information.kt
deleted file mode 100644
index fab00aca3d..0000000000
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_General_Initial_Screen_Information.kt
+++ /dev/null
@@ -1,71 +0,0 @@
-package info.nightscout.androidaps.plugins.pump.danaRS.comm
-
-import com.cozmo.danar.util.BleCommandUtil
-import info.nightscout.androidaps.logging.AAPSLogger
-import info.nightscout.androidaps.logging.LTag
-import info.nightscout.androidaps.plugins.pump.danaR.DanaRPump
-
-class DanaRS_Packet_General_Initial_Screen_Information(
- private val aapsLogger: AAPSLogger,
- private val danaRPump: DanaRPump
-) : DanaRS_Packet() {
-
- init {
- type = BleCommandUtil.DANAR_PACKET__TYPE_RESPONSE
- opCode = BleCommandUtil.DANAR_PACKET__OPCODE_REVIEW__INITIAL_SCREEN_INFORMATION
- aapsLogger.debug(LTag.PUMPCOMM, "New message")
- }
-
- override fun handleMessage(data: ByteArray) {
- if (data.size < 17) {
- failed = true
- return
- } else failed = false
- var dataIndex = DATA_START
- var dataSize = 1
- val status = byteArrayToInt(getBytes(data, dataIndex, dataSize))
- danaRPump.pumpSuspended = status and 0x01 == 0x01
- danaRPump.isTempBasalInProgress = status and 0x10 == 0x10
- danaRPump.isExtendedInProgress = status and 0x04 == 0x04
- danaRPump.isDualBolusInProgress = status and 0x08 == 0x08
- dataIndex += dataSize
- dataSize = 2
- danaRPump.dailyTotalUnits = byteArrayToInt(getBytes(data, dataIndex, dataSize)) / 100.0
- dataIndex += dataSize
- dataSize = 2
- danaRPump.maxDailyTotalUnits = (byteArrayToInt(getBytes(data, dataIndex, dataSize)) / 100.0).toInt()
- dataIndex += dataSize
- dataSize = 2
- danaRPump.reservoirRemainingUnits = byteArrayToInt(getBytes(data, dataIndex, dataSize)) / 100.0
- dataIndex += dataSize
- dataSize = 2
- danaRPump.currentBasal = byteArrayToInt(getBytes(data, dataIndex, dataSize)) / 100.0
- dataIndex += dataSize
- dataSize = 1
- danaRPump.tempBasalPercent = byteArrayToInt(getBytes(data, dataIndex, dataSize))
- dataIndex += dataSize
- dataSize = 1
- danaRPump.batteryRemaining = byteArrayToInt(getBytes(data, dataIndex, dataSize))
- dataIndex += dataSize
- dataSize = 2
- danaRPump.extendedBolusAbsoluteRate = byteArrayToInt(getBytes(data, dataIndex, dataSize)) / 100.0
- dataIndex += dataSize
- dataSize = 2
- danaRPump.iob = byteArrayToInt(getBytes(data, dataIndex, dataSize)) / 100.0
- aapsLogger.debug(LTag.PUMPCOMM, "Pump suspended: " + danaRPump.pumpSuspended)
- aapsLogger.debug(LTag.PUMPCOMM, "Temp basal in progress: " + danaRPump.isTempBasalInProgress)
- aapsLogger.debug(LTag.PUMPCOMM, "Extended in progress: " + danaRPump.isExtendedInProgress)
- aapsLogger.debug(LTag.PUMPCOMM, "Dual in progress: " + danaRPump.isDualBolusInProgress)
- aapsLogger.debug(LTag.PUMPCOMM, "Daily units: " + danaRPump.dailyTotalUnits)
- aapsLogger.debug(LTag.PUMPCOMM, "Max daily units: " + danaRPump.maxDailyTotalUnits)
- aapsLogger.debug(LTag.PUMPCOMM, "Reservoir remaining units: " + danaRPump.reservoirRemainingUnits)
- aapsLogger.debug(LTag.PUMPCOMM, "Battery: " + danaRPump.batteryRemaining)
- aapsLogger.debug(LTag.PUMPCOMM, "Current basal: " + danaRPump.currentBasal)
- aapsLogger.debug(LTag.PUMPCOMM, "Temp basal percent: " + danaRPump.tempBasalPercent)
- aapsLogger.debug(LTag.PUMPCOMM, "Extended absolute rate: " + danaRPump.extendedBolusAbsoluteRate)
- }
-
- override fun getFriendlyName(): String {
- return "REVIEW__INITIAL_SCREEN_INFORMATION"
- }
-}
\ No newline at end of file
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_History_Alarm.kt b/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_History_Alarm.kt
deleted file mode 100644
index 360499cc21..0000000000
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_History_Alarm.kt
+++ /dev/null
@@ -1,24 +0,0 @@
-package info.nightscout.androidaps.plugins.pump.danaRS.comm
-
-import com.cozmo.danar.util.BleCommandUtil
-import info.nightscout.androidaps.logging.AAPSLogger
-import info.nightscout.androidaps.logging.LTag
-import info.nightscout.androidaps.plugins.bus.RxBusWrapper
-import info.nightscout.androidaps.utils.DateUtil
-
-class DanaRS_Packet_History_Alarm @JvmOverloads constructor(
- aapsLogger: AAPSLogger,
- rxBus: RxBusWrapper,
- dateUtil: DateUtil,
- from: Long = 0
-) : DanaRS_Packet_History_(aapsLogger, rxBus, dateUtil, from) {
-
- init {
- opCode = BleCommandUtil.DANAR_PACKET__OPCODE_REVIEW__ALARM
- aapsLogger.debug(LTag.PUMPCOMM, "New message")
- }
-
- override fun getFriendlyName(): String {
- return "REVIEW__ALARM"
- }
-}
\ No newline at end of file
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_History_All_History.kt b/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_History_All_History.kt
deleted file mode 100644
index 8f6343604b..0000000000
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_History_All_History.kt
+++ /dev/null
@@ -1,24 +0,0 @@
-package info.nightscout.androidaps.plugins.pump.danaRS.comm
-
-import com.cozmo.danar.util.BleCommandUtil
-import info.nightscout.androidaps.logging.AAPSLogger
-import info.nightscout.androidaps.logging.LTag
-import info.nightscout.androidaps.plugins.bus.RxBusWrapper
-import info.nightscout.androidaps.utils.DateUtil
-
-class DanaRS_Packet_History_All_History(
- aapsLogger: AAPSLogger,
- rxBus: RxBusWrapper,
- dateUtil: DateUtil,
- from: Long = 0
-) : DanaRS_Packet_History_(aapsLogger, rxBus, dateUtil, from) {
-
- init {
- opCode = BleCommandUtil.DANAR_PACKET__OPCODE_REVIEW__ALL_HISTORY
- aapsLogger.debug(LTag.PUMPCOMM, "New message")
- }
-
- override fun getFriendlyName(): String {
- return "REVIEW__ALL_HISTORY"
- }
-}
\ No newline at end of file
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_History_Basal.kt b/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_History_Basal.kt
deleted file mode 100644
index e3268bcf1d..0000000000
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_History_Basal.kt
+++ /dev/null
@@ -1,24 +0,0 @@
-package info.nightscout.androidaps.plugins.pump.danaRS.comm
-
-import com.cozmo.danar.util.BleCommandUtil
-import info.nightscout.androidaps.logging.AAPSLogger
-import info.nightscout.androidaps.logging.LTag
-import info.nightscout.androidaps.plugins.bus.RxBusWrapper
-import info.nightscout.androidaps.utils.DateUtil
-
-class DanaRS_Packet_History_Basal @JvmOverloads constructor(
- aapsLogger: AAPSLogger,
- rxBus: RxBusWrapper,
- dateUtil: DateUtil,
- from: Long = 0
-) : DanaRS_Packet_History_(aapsLogger, rxBus, dateUtil, from) {
-
- init {
- opCode = BleCommandUtil.DANAR_PACKET__OPCODE_REVIEW__BASAL
- aapsLogger.debug(LTag.PUMPCOMM, "New message")
- }
-
- override fun getFriendlyName(): String {
- return "REVIEW__BASAL"
- }
-}
\ No newline at end of file
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_History_Blood_Glucose.kt b/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_History_Blood_Glucose.kt
deleted file mode 100644
index 7235137871..0000000000
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_History_Blood_Glucose.kt
+++ /dev/null
@@ -1,24 +0,0 @@
-package info.nightscout.androidaps.plugins.pump.danaRS.comm
-
-import com.cozmo.danar.util.BleCommandUtil
-import info.nightscout.androidaps.logging.AAPSLogger
-import info.nightscout.androidaps.logging.LTag
-import info.nightscout.androidaps.plugins.bus.RxBusWrapper
-import info.nightscout.androidaps.utils.DateUtil
-
-class DanaRS_Packet_History_Blood_Glucose @JvmOverloads constructor(
- aapsLogger: AAPSLogger,
- rxBus: RxBusWrapper,
- dateUtil: DateUtil,
- from: Long = 0
-) : DanaRS_Packet_History_(aapsLogger, rxBus, dateUtil, from) {
-
- init {
- opCode = BleCommandUtil.DANAR_PACKET__OPCODE_REVIEW__BLOOD_GLUCOSE
- aapsLogger.debug(LTag.PUMPCOMM, "New message")
- }
-
- override fun getFriendlyName(): String {
- return "REVIEW__BLOOD_GLUCOSE"
- }
-}
\ No newline at end of file
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_History_Bolus.kt b/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_History_Bolus.kt
deleted file mode 100644
index 1d7950e8b3..0000000000
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_History_Bolus.kt
+++ /dev/null
@@ -1,24 +0,0 @@
-package info.nightscout.androidaps.plugins.pump.danaRS.comm
-
-import com.cozmo.danar.util.BleCommandUtil
-import info.nightscout.androidaps.logging.AAPSLogger
-import info.nightscout.androidaps.logging.LTag
-import info.nightscout.androidaps.plugins.bus.RxBusWrapper
-import info.nightscout.androidaps.utils.DateUtil
-
-class DanaRS_Packet_History_Bolus @JvmOverloads constructor(
- aapsLogger: AAPSLogger,
- rxBus: RxBusWrapper,
- dateUtil: DateUtil,
- from: Long = 0
-) : DanaRS_Packet_History_(aapsLogger, rxBus, dateUtil, from) {
-
- init {
- opCode = BleCommandUtil.DANAR_PACKET__OPCODE_REVIEW__BOLUS
- aapsLogger.debug(LTag.PUMPCOMM, "New message")
- }
-
- override fun getFriendlyName(): String {
- return "REVIEW__BOLUS"
- }
-}
\ No newline at end of file
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_History_Carbohydrate.kt b/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_History_Carbohydrate.kt
deleted file mode 100644
index 03b84489cb..0000000000
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_History_Carbohydrate.kt
+++ /dev/null
@@ -1,24 +0,0 @@
-package info.nightscout.androidaps.plugins.pump.danaRS.comm
-
-import com.cozmo.danar.util.BleCommandUtil
-import info.nightscout.androidaps.logging.AAPSLogger
-import info.nightscout.androidaps.logging.LTag
-import info.nightscout.androidaps.plugins.bus.RxBusWrapper
-import info.nightscout.androidaps.utils.DateUtil
-
-class DanaRS_Packet_History_Carbohydrate @JvmOverloads constructor(
- aapsLogger: AAPSLogger,
- rxBus: RxBusWrapper,
- dateUtil: DateUtil,
- from: Long = 0
-) : DanaRS_Packet_History_(aapsLogger, rxBus, dateUtil, from) {
-
- init {
- opCode = BleCommandUtil.DANAR_PACKET__OPCODE_REVIEW__CARBOHYDRATE
- aapsLogger.debug(LTag.PUMPCOMM, "New message")
- }
-
- override fun getFriendlyName(): String {
- return "REVIEW__CARBOHYDRATE"
- }
-}
\ No newline at end of file
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_History_Daily.kt b/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_History_Daily.kt
deleted file mode 100644
index 74f3894e79..0000000000
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_History_Daily.kt
+++ /dev/null
@@ -1,24 +0,0 @@
-package info.nightscout.androidaps.plugins.pump.danaRS.comm
-
-import com.cozmo.danar.util.BleCommandUtil
-import info.nightscout.androidaps.logging.AAPSLogger
-import info.nightscout.androidaps.logging.LTag
-import info.nightscout.androidaps.plugins.bus.RxBusWrapper
-import info.nightscout.androidaps.utils.DateUtil
-
-class DanaRS_Packet_History_Daily @JvmOverloads constructor(
- aapsLogger: AAPSLogger,
- rxBus: RxBusWrapper,
- dateUtil: DateUtil,
- from: Long = 0
-) : DanaRS_Packet_History_(aapsLogger, rxBus, dateUtil, from) {
-
- init {
- opCode = BleCommandUtil.DANAR_PACKET__OPCODE_REVIEW__DAILY
- aapsLogger.debug(LTag.PUMPCOMM, "New message")
- }
-
- override fun getFriendlyName(): String {
- return "REVIEW__DAILY"
- }
-}
\ No newline at end of file
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_History_Prime.kt b/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_History_Prime.kt
deleted file mode 100644
index 9d283e905c..0000000000
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_History_Prime.kt
+++ /dev/null
@@ -1,24 +0,0 @@
-package info.nightscout.androidaps.plugins.pump.danaRS.comm
-
-import com.cozmo.danar.util.BleCommandUtil
-import info.nightscout.androidaps.logging.AAPSLogger
-import info.nightscout.androidaps.logging.LTag
-import info.nightscout.androidaps.plugins.bus.RxBusWrapper
-import info.nightscout.androidaps.utils.DateUtil
-
-class DanaRS_Packet_History_Prime @JvmOverloads constructor(
- aapsLogger: AAPSLogger,
- rxBus: RxBusWrapper,
- dateUtil: DateUtil,
- from: Long = 0
-) : DanaRS_Packet_History_(aapsLogger, rxBus, dateUtil, from) {
-
- init {
- opCode = BleCommandUtil.DANAR_PACKET__OPCODE_REVIEW__PRIME
- aapsLogger.debug(LTag.PUMPCOMM, "New message")
- }
-
- override fun getFriendlyName(): String {
- return "REVIEW__PRIME"
- }
-}
\ No newline at end of file
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_History_Refill.kt b/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_History_Refill.kt
deleted file mode 100644
index 637fb1be0d..0000000000
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_History_Refill.kt
+++ /dev/null
@@ -1,24 +0,0 @@
-package info.nightscout.androidaps.plugins.pump.danaRS.comm
-
-import com.cozmo.danar.util.BleCommandUtil
-import info.nightscout.androidaps.logging.AAPSLogger
-import info.nightscout.androidaps.logging.LTag
-import info.nightscout.androidaps.plugins.bus.RxBusWrapper
-import info.nightscout.androidaps.utils.DateUtil
-
-class DanaRS_Packet_History_Refill @JvmOverloads constructor(
- aapsLogger: AAPSLogger,
- rxBus: RxBusWrapper,
- dateUtil: DateUtil,
- from: Long = 0
-) : DanaRS_Packet_History_(aapsLogger, rxBus, dateUtil, from) {
-
- init {
- opCode = BleCommandUtil.DANAR_PACKET__OPCODE_REVIEW__REFILL
- aapsLogger.debug(LTag.PUMPCOMM, "New message")
- }
-
- override fun getFriendlyName(): String {
- return "REVIEW__REFILL"
- }
-}
\ No newline at end of file
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_History_Suspend.kt b/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_History_Suspend.kt
deleted file mode 100644
index 3d35ec35dc..0000000000
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_History_Suspend.kt
+++ /dev/null
@@ -1,24 +0,0 @@
-package info.nightscout.androidaps.plugins.pump.danaRS.comm
-
-import com.cozmo.danar.util.BleCommandUtil
-import info.nightscout.androidaps.logging.AAPSLogger
-import info.nightscout.androidaps.logging.LTag
-import info.nightscout.androidaps.plugins.bus.RxBusWrapper
-import info.nightscout.androidaps.utils.DateUtil
-
-class DanaRS_Packet_History_Suspend @JvmOverloads constructor(
- aapsLogger: AAPSLogger,
- rxBus: RxBusWrapper,
- dateUtil: DateUtil,
- from: Long = 0
-) : DanaRS_Packet_History_(aapsLogger, rxBus, dateUtil, from) {
-
- init {
- opCode = BleCommandUtil.DANAR_PACKET__OPCODE_REVIEW__SUSPEND
- aapsLogger.debug(LTag.PUMPCOMM, "New message")
- }
-
- override fun getFriendlyName(): String {
- return "REVIEW__SUSPEND"
- }
-}
\ No newline at end of file
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_History_Temporary.kt b/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_History_Temporary.kt
deleted file mode 100644
index 31258ea1b0..0000000000
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_History_Temporary.kt
+++ /dev/null
@@ -1,24 +0,0 @@
-package info.nightscout.androidaps.plugins.pump.danaRS.comm
-
-import com.cozmo.danar.util.BleCommandUtil
-import info.nightscout.androidaps.logging.AAPSLogger
-import info.nightscout.androidaps.logging.LTag
-import info.nightscout.androidaps.plugins.bus.RxBusWrapper
-import info.nightscout.androidaps.utils.DateUtil
-
-class DanaRS_Packet_History_Temporary(
- aapsLogger: AAPSLogger,
- rxBus: RxBusWrapper,
- dateUtil: DateUtil,
- from: Long = 0
-) : DanaRS_Packet_History_(aapsLogger, rxBus, dateUtil, from) {
-
- init {
- opCode = BleCommandUtil.DANAR_PACKET__OPCODE_REVIEW__TEMPORARY
- aapsLogger.debug(LTag.PUMPCOMM, "New message")
- }
-
- override fun getFriendlyName(): String {
- return "REVIEW__TEMPORARY"
- }
-}
\ No newline at end of file
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_Option_Set_User_Option.kt b/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_Option_Set_User_Option.kt
deleted file mode 100644
index 2ca965fc60..0000000000
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_Option_Set_User_Option.kt
+++ /dev/null
@@ -1,60 +0,0 @@
-package info.nightscout.androidaps.plugins.pump.danaRS.comm
-
-import com.cozmo.danar.util.BleCommandUtil
-import info.nightscout.androidaps.logging.AAPSLogger
-import info.nightscout.androidaps.logging.LTag
-import info.nightscout.androidaps.plugins.pump.danaR.DanaRPump
-
-class DanaRS_Packet_Option_Set_User_Option(
- private val aapsLogger: AAPSLogger,
- private val danaRPump: DanaRPump
-) : DanaRS_Packet() {
-
-
- init {
- opCode = BleCommandUtil.DANAR_PACKET__OPCODE_OPTION__SET_USER_OPTION
- aapsLogger.debug(LTag.PUMPCOMM, "Setting user settings")
- }
-
- override fun getRequestParams(): ByteArray {
- aapsLogger.debug(LTag.PUMPCOMM,
- "UserOptions:" + (System.currentTimeMillis() - danaRPump.lastConnection) / 1000 + " s ago"
- + "\ntimeDisplayType:" + danaRPump.timeDisplayType
- + "\nbuttonScroll:" + danaRPump.buttonScrollOnOff
- + "\ntimeDisplayType:" + danaRPump.timeDisplayType
- + "\nlcdOnTimeSec:" + danaRPump.lcdOnTimeSec
- + "\nbacklight:" + danaRPump.backlightOnTimeSec
- + "\ndanaRPumpUnits:" + danaRPump.units
- + "\nlowReservoir:" + danaRPump.lowReservoirRate)
- val request = ByteArray(13)
- request[0] = (danaRPump.timeDisplayType and 0xff).toByte()
- request[1] = (danaRPump.buttonScrollOnOff and 0xff).toByte()
- request[2] = (danaRPump.beepAndAlarm and 0xff).toByte()
- request[3] = (danaRPump.lcdOnTimeSec and 0xff).toByte()
- request[4] = (danaRPump.backlightOnTimeSec and 0xff).toByte()
- request[5] = (danaRPump.selectedLanguage and 0xff).toByte()
- request[6] = (danaRPump.units and 0xff).toByte()
- request[7] = (danaRPump.shutdownHour and 0xff).toByte()
- request[8] = (danaRPump.lowReservoirRate and 0xff).toByte()
- request[9] = (danaRPump.cannulaVolume and 0xff).toByte()
- request[10] = (danaRPump.cannulaVolume ushr 8 and 0xff).toByte()
- request[11] = (danaRPump.refillAmount and 0xff).toByte()
- request[12] = (danaRPump.refillAmount ushr 8 and 0xff).toByte()
- return request
- }
-
- override fun handleMessage(data: ByteArray) {
- val result = intFromBuff(data, 0, 1)
- if (result == 0) {
- aapsLogger.debug(LTag.PUMPCOMM, "Result OK")
- failed = false
- } else {
- aapsLogger.error("Result Error: $result")
- failed = true
- }
- }
-
- override fun getFriendlyName(): String {
- return "OPTION__SET_USER_OPTION"
- }
-}
\ No newline at end of file
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRS/services/BLEComm.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRS/services/BLEComm.java
deleted file mode 100644
index 35097dcef5..0000000000
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRS/services/BLEComm.java
+++ /dev/null
@@ -1,682 +0,0 @@
-package info.nightscout.androidaps.plugins.pump.danaRS.services;
-
-import android.bluetooth.BluetoothAdapter;
-import android.bluetooth.BluetoothDevice;
-import android.bluetooth.BluetoothGatt;
-import android.bluetooth.BluetoothGattCallback;
-import android.bluetooth.BluetoothGattCharacteristic;
-import android.bluetooth.BluetoothGattService;
-import android.bluetooth.BluetoothManager;
-import android.bluetooth.BluetoothProfile;
-import android.content.Context;
-import android.content.Intent;
-import android.os.SystemClock;
-
-import com.cozmo.danar.util.BleCommandUtil;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.UUID;
-import java.util.concurrent.ScheduledFuture;
-
-import info.nightscout.androidaps.MainApp;
-import info.nightscout.androidaps.R;
-import info.nightscout.androidaps.events.EventPumpStatusChanged;
-import info.nightscout.androidaps.logging.L;
-import info.nightscout.androidaps.logging.LTag;
-import info.nightscout.androidaps.logging.StacktraceLoggerWrapper;
-import info.nightscout.androidaps.plugins.bus.RxBus;
-import info.nightscout.androidaps.plugins.general.nsclient.NSUpload;
-import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification;
-import info.nightscout.androidaps.plugins.general.overview.notifications.Notification;
-import info.nightscout.androidaps.plugins.pump.danaR.DanaRPump;
-import info.nightscout.androidaps.plugins.pump.danaRS.DanaRSPlugin;
-import info.nightscout.androidaps.plugins.pump.danaRS.activities.PairingHelperActivity;
-import info.nightscout.androidaps.plugins.pump.danaRS.comm.DanaRSMessageHashTable;
-import info.nightscout.androidaps.plugins.pump.danaRS.comm.DanaRS_Packet;
-import info.nightscout.androidaps.plugins.pump.danaRS.events.EventDanaRSPairingSuccess;
-import info.nightscout.androidaps.utils.SP;
-
-/**
- * Created by mike on 23.09.2017.
- */
-
-public class BLEComm {
- private Logger log = StacktraceLoggerWrapper.getLogger(LTag.PUMPBTCOMM);
-
- private final long WRITE_DELAY_MILLIS = 50;
-
- private String UART_READ_UUID = "0000fff1-0000-1000-8000-00805f9b34fb";
- private String UART_WRITE_UUID = "0000fff2-0000-1000-8000-00805f9b34fb";
-
- private final byte PACKET_START_BYTE = (byte) 0xA5;
- private final byte PACKET_END_BYTE = (byte) 0x5A;
- private Context context;
- private DanaRPump danaRPump;
- private DanaRSMessageHashTable danaRSMessageHashTable;
-
- public BLEComm(Context context, DanaRSMessageHashTable danaRSMessageHashTable, DanaRPump danaRPump) {
- this.context = context;
- this.danaRPump = danaRPump;
- this.danaRSMessageHashTable = danaRSMessageHashTable;
- initialize();
- }
-
- private ScheduledFuture> scheduledDisconnection = null;
-
- private DanaRS_Packet processsedMessage = null;
- private final ArrayList mSendQueue = new ArrayList<>();
-
- private BluetoothManager mBluetoothManager = null;
- private BluetoothAdapter mBluetoothAdapter = null;
- private String mBluetoothDeviceName = null;
- private BluetoothGatt mBluetoothGatt = null;
-
- protected boolean isConnected = false;
- protected boolean isConnecting = false;
-
- private BluetoothGattCharacteristic UART_Read;
- private BluetoothGattCharacteristic UART_Write;
-
- private boolean initialize() {
- if (L.isEnabled(LTag.PUMPBTCOMM))
- log.debug("Initializing BLEComm.");
-
- if (mBluetoothManager == null) {
- mBluetoothManager = ((BluetoothManager) MainApp.instance().getApplicationContext().getSystemService(Context.BLUETOOTH_SERVICE));
- if (mBluetoothManager == null) {
- log.error("Unable to initialize BluetoothManager.");
- return false;
- }
- }
-
- mBluetoothAdapter = mBluetoothManager.getAdapter();
- if (mBluetoothAdapter == null) {
- log.error("Unable to obtain a BluetoothAdapter.");
- return false;
- }
-
- return true;
- }
-
- public boolean isConnected() {
- return isConnected;
- }
-
- public boolean isConnecting() {
- return isConnecting;
- }
-
- public boolean connect(String from, String address, Object confirmConnect) {
- BluetoothManager tBluetoothManager = ((BluetoothManager) MainApp.instance().getApplicationContext().getSystemService(Context.BLUETOOTH_SERVICE));
- if (tBluetoothManager == null) {
- return false;
- }
-
- BluetoothAdapter tBluetoothAdapter = tBluetoothManager.getAdapter();
- if (tBluetoothAdapter == null) {
- return false;
- }
-
- if (mBluetoothAdapter == null) {
- if (!initialize()) {
- return false;
- }
- }
-
- if (address == null) {
- log.error("unspecified address.");
- return false;
- }
-
- isConnecting = true;
-
- BluetoothDevice device = mBluetoothAdapter.getRemoteDevice(address);
- if (device == null) {
- log.error("Device not found. Unable to connect from: " + from);
- return false;
- }
-
- if (L.isEnabled(LTag.PUMPBTCOMM))
- log.debug("Trying to create a new connection from: " + from);
- mBluetoothDeviceName = device.getName();
- mBluetoothGatt = device.connectGatt(context, false, mGattCallback);
- setCharacteristicNotification(getUARTReadBTGattChar(), true);
- return true;
- }
-
- public void stopConnecting() {
- isConnecting = false;
- }
-
- public synchronized void disconnect(String from) {
- if (L.isEnabled(LTag.PUMPBTCOMM))
- log.debug("disconnect from: " + from);
-
- // cancel previous scheduled disconnection to prevent closing upcomming connection
- if (scheduledDisconnection != null)
- scheduledDisconnection.cancel(false);
- scheduledDisconnection = null;
-
- if ((mBluetoothAdapter == null) || (mBluetoothGatt == null)) {
- log.error("disconnect not possible: (mBluetoothAdapter == null) " + (mBluetoothAdapter == null));
- log.error("disconnect not possible: (mBluetoothGatt == null) " + (mBluetoothGatt == null));
- return;
- }
- setCharacteristicNotification(getUARTReadBTGattChar(), false);
- mBluetoothGatt.disconnect();
- isConnected = false;
- SystemClock.sleep(2000);
- }
-
- public synchronized void close() {
- if (L.isEnabled(LTag.PUMPBTCOMM))
- log.debug("BluetoothAdapter close");
- if (mBluetoothGatt == null) {
- return;
- }
-
- mBluetoothGatt.close();
- mBluetoothGatt = null;
- }
-
-
- private String getConnectDeviceName() {
- return mBluetoothDeviceName;
- }
-
- private final BluetoothGattCallback mGattCallback = new BluetoothGattCallback() {
- public void onConnectionStateChange(BluetoothGatt gatt, int status, int newState) {
- onConnectionStateChangeSynchronized(gatt, status, newState); // call it synchronized
- }
-
- public void onServicesDiscovered(BluetoothGatt gatt, int status) {
- if (L.isEnabled(LTag.PUMPBTCOMM))
- log.debug("onServicesDiscovered");
- if (status == BluetoothGatt.GATT_SUCCESS) {
- findCharacteristic();
- }
- SendPumpCheck();
- // 1st message sent to pump after connect
- }
-
- public void onCharacteristicRead(BluetoothGatt gatt, BluetoothGattCharacteristic characteristic, int status) {
- if (L.isEnabled(LTag.PUMPBTCOMM))
- log.debug("onCharacteristicRead" + (characteristic != null ? ":" + DanaRS_Packet.toHexString(characteristic.getValue()) : ""));
- addToReadBuffer(characteristic.getValue());
- readDataParsing();
- }
-
- public void onCharacteristicChanged(BluetoothGatt gatt, final BluetoothGattCharacteristic characteristic) {
- if (L.isEnabled(LTag.PUMPBTCOMM))
- log.debug("onCharacteristicChanged" + (characteristic != null ? ":" + DanaRS_Packet.toHexString(characteristic.getValue()) : ""));
- addToReadBuffer(characteristic.getValue());
- new Thread(() -> readDataParsing()).start();
- }
-
- public void onCharacteristicWrite(BluetoothGatt gatt, BluetoothGattCharacteristic characteristic, int status) {
- if (L.isEnabled(LTag.PUMPBTCOMM))
- log.debug("onCharacteristicWrite" + (characteristic != null ? ":" + DanaRS_Packet.toHexString(characteristic.getValue()) : ""));
- new Thread(() -> {
- synchronized (mSendQueue) {
- // after message sent, check if there is the rest of the message waiting and send it
- if (mSendQueue.size() > 0) {
- byte[] bytes = mSendQueue.get(0);
- mSendQueue.remove(0);
- writeCharacteristic_NO_RESPONSE(getUARTWriteBTGattChar(), bytes);
- }
- }
- }).start();
- }
- };
-
- private synchronized void setCharacteristicNotification(BluetoothGattCharacteristic characteristic, boolean enabled) {
- if (L.isEnabled(LTag.PUMPBTCOMM))
- log.debug("setCharacteristicNotification");
- if ((mBluetoothAdapter == null) || (mBluetoothGatt == null)) {
- log.error("BluetoothAdapter not initialized_ERROR");
- isConnecting = false;
- isConnected = false;
- return;
- }
- mBluetoothGatt.setCharacteristicNotification(characteristic, enabled);
- }
-
- public synchronized void readCharacteristic(BluetoothGattCharacteristic characteristic) {
- if (L.isEnabled(LTag.PUMPBTCOMM))
- log.debug("readCharacteristic");
- if ((mBluetoothAdapter == null) || (mBluetoothGatt == null)) {
- log.error("BluetoothAdapter not initialized_ERROR");
- isConnecting = false;
- isConnected = false;
- return;
- }
- mBluetoothGatt.readCharacteristic(characteristic);
- }
-
- private synchronized void writeCharacteristic_NO_RESPONSE(final BluetoothGattCharacteristic characteristic, final byte[] data) {
- new Thread(() -> {
- SystemClock.sleep(WRITE_DELAY_MILLIS);
-
- if ((mBluetoothAdapter == null) || (mBluetoothGatt == null)) {
- log.error("BluetoothAdapter not initialized_ERROR");
- isConnecting = false;
- isConnected = false;
- return;
- }
-
- characteristic.setValue(data);
- characteristic.setWriteType(BluetoothGattCharacteristic.WRITE_TYPE_NO_RESPONSE);
- if (L.isEnabled(LTag.PUMPBTCOMM))
- log.debug("writeCharacteristic:" + DanaRS_Packet.toHexString(data));
- mBluetoothGatt.writeCharacteristic(characteristic);
- }).start();
- }
-
- private BluetoothGattCharacteristic getUARTReadBTGattChar() {
- if (UART_Read == null) {
- UART_Read = new BluetoothGattCharacteristic(UUID.fromString(UART_READ_UUID), BluetoothGattCharacteristic.PROPERTY_READ | BluetoothGattCharacteristic.PROPERTY_NOTIFY, 0);
- }
- return UART_Read;
- }
-
- private BluetoothGattCharacteristic getUARTWriteBTGattChar() {
- if (UART_Write == null) {
- UART_Write = new BluetoothGattCharacteristic(UUID.fromString(UART_WRITE_UUID), BluetoothGattCharacteristic.PROPERTY_WRITE_NO_RESPONSE, 0);
- }
- return UART_Write;
- }
-
- private List getSupportedGattServices() {
- if (L.isEnabled(LTag.PUMPBTCOMM))
- log.debug("getSupportedGattServices");
- if ((mBluetoothAdapter == null) || (mBluetoothGatt == null)) {
- log.error("BluetoothAdapter not initialized_ERROR");
- isConnecting = false;
- isConnected = false;
- return null;
- }
-
- return mBluetoothGatt.getServices();
- }
-
- private void findCharacteristic() {
- List gattServices = getSupportedGattServices();
-
- if (gattServices == null) {
- return;
- }
- String uuid;
-
- for (BluetoothGattService gattService : gattServices) {
- List gattCharacteristics = gattService.getCharacteristics();
- for (BluetoothGattCharacteristic gattCharacteristic : gattCharacteristics) {
- uuid = gattCharacteristic.getUuid().toString();
- if (UART_READ_UUID.equals(uuid)) {
- UART_Read = gattCharacteristic;
- setCharacteristicNotification(UART_Read, true);
- }
- if (UART_WRITE_UUID.equals(uuid)) {
- UART_Write = gattCharacteristic;
- }
- }
- }
- }
-
- private synchronized void onConnectionStateChangeSynchronized(BluetoothGatt gatt, int status, int newState) {
- if (L.isEnabled(LTag.PUMPBTCOMM))
- log.debug("onConnectionStateChange");
-
- if (newState == BluetoothProfile.STATE_CONNECTED) {
- mBluetoothGatt.discoverServices();
- } else if (newState == BluetoothProfile.STATE_DISCONNECTED) {
- close();
- isConnected = false;
- isConnecting = false;
- RxBus.Companion.getINSTANCE().send(new EventPumpStatusChanged(EventPumpStatusChanged.Status.DISCONNECTED));
- if (L.isEnabled(LTag.PUMPBTCOMM))
- log.debug("Device was disconnected " + gatt.getDevice().getName());//Device was disconnected
- }
- }
-
- private final byte[] readBuffer = new byte[1024];
- private int bufferLength = 0;
-
- private void addToReadBuffer(byte[] buffer) {
- //log.debug("addToReadBuffer " + DanaRS_Packet.toHexString(buffer));
- if (buffer == null || buffer.length == 0) {
- return;
- }
- synchronized (readBuffer) {
- // Append incomming data to input buffer
- System.arraycopy(buffer, 0, readBuffer, bufferLength, buffer.length);
- bufferLength += buffer.length;
- }
- }
-
- private void readDataParsing() {
- boolean startSignatureFound = false, packetIsValid = false;
- boolean isProcessing;
-
- isProcessing = true;
-
- while (isProcessing) {
- int length = 0;
- byte[] inputBuffer = null;
- synchronized (readBuffer) {
- // Find packet start [A5 A5]
- if (bufferLength >= 6) {
- for (int idxStartByte = 0; idxStartByte < bufferLength - 2; idxStartByte++) {
- if ((readBuffer[idxStartByte] == PACKET_START_BYTE) && (readBuffer[idxStartByte + 1] == PACKET_START_BYTE)) {
- if (idxStartByte > 0) {
- // if buffer doesn't start with signature remove the leading trash
- if (L.isEnabled(LTag.PUMPBTCOMM))
- log.debug("Shifting the input buffer by " + idxStartByte + " bytes");
- System.arraycopy(readBuffer, idxStartByte, readBuffer, 0, bufferLength - idxStartByte);
- bufferLength -= idxStartByte;
- }
- startSignatureFound = true;
- break;
- }
- }
- }
- // A5 A5 LEN TYPE CODE PARAMS CHECKSUM1 CHECKSUM2 5A 5A
- // ^---- LEN -----^
- // total packet length 2 + 1 + readBuffer[2] + 2 + 2
- if (startSignatureFound) {
- length = readBuffer[2];
- // test if there is enough data loaded
- if (length + 7 > bufferLength)
- return;
- // Verify packed end [5A 5A]
- if ((readBuffer[length + 5] == PACKET_END_BYTE) && (readBuffer[length + 6] == PACKET_END_BYTE)) {
- packetIsValid = true;
- }
- }
- if (packetIsValid) {
- inputBuffer = new byte[length + 7];
- // copy packet to input buffer
- System.arraycopy(readBuffer, 0, inputBuffer, 0, length + 7);
- // Cut off the message from readBuffer
- try {
- System.arraycopy(readBuffer, length + 7, readBuffer, 0, bufferLength - (length + 7));
- } catch (Exception e) {
- log.error("length: " + length + "bufferLength: " + bufferLength);
- throw e;
- }
- bufferLength -= (length + 7);
- // now we have encrypted packet in inputBuffer
- }
- }
- if (packetIsValid) {
- try {
- // decrypt the packet
- inputBuffer = BleCommandUtil.getInstance().getDecryptedPacket(inputBuffer);
-
- if (inputBuffer == null) {
- log.error("Null decryptedInputBuffer");
- return;
- }
-
- switch (inputBuffer[0]) {
- // initial handshake packet
- case (byte) BleCommandUtil.DANAR_PACKET__TYPE_ENCRYPTION_RESPONSE:
- switch (inputBuffer[1]) {
- // 1st packet
- case (byte) BleCommandUtil.DANAR_PACKET__OPCODE_ENCRYPTION__PUMP_CHECK:
- if (inputBuffer.length == 4 && inputBuffer[2] == 'O' && inputBuffer[3] == 'K') {
- if (L.isEnabled(LTag.PUMPBTCOMM))
- log.debug("<<<<< " + "ENCRYPTION__PUMP_CHECK (OK)" + " " + DanaRS_Packet.toHexString(inputBuffer));
- // Grab pairing key from preferences if exists
- String pairingKey = SP.getString(MainApp.gs(R.string.key_danars_pairingkey) + DanaRSPlugin.mDeviceName, null);
- if (L.isEnabled(LTag.PUMPBTCOMM))
- log.debug("Using stored pairing key: " + pairingKey);
- if (pairingKey != null) {
- byte[] encodedPairingKey = DanaRS_Packet.hexToBytes(pairingKey);
- byte[] bytes = BleCommandUtil.getInstance().getEncryptedPacket(BleCommandUtil.DANAR_PACKET__OPCODE_ENCRYPTION__CHECK_PASSKEY, encodedPairingKey, null);
- if (L.isEnabled(LTag.PUMPBTCOMM))
- log.debug(">>>>> " + "ENCRYPTION__CHECK_PASSKEY" + " " + DanaRS_Packet.toHexString(bytes));
- writeCharacteristic_NO_RESPONSE(getUARTWriteBTGattChar(), bytes);
- } else {
- // Stored pairing key does not exists, request pairing
- SendPairingRequest();
- }
-
- } else if (inputBuffer.length == 6 && inputBuffer[2] == 'P' && inputBuffer[3] == 'U' && inputBuffer[4] == 'M' && inputBuffer[5] == 'P') {
- if (L.isEnabled(LTag.PUMPBTCOMM))
- log.debug("<<<<< " + "ENCRYPTION__PUMP_CHECK (PUMP)" + " " + DanaRS_Packet.toHexString(inputBuffer));
- mSendQueue.clear();
- RxBus.Companion.getINSTANCE().send(new EventPumpStatusChanged(EventPumpStatusChanged.Status.DISCONNECTED, MainApp.gs(R.string.pumperror)));
- NSUpload.uploadError(MainApp.gs(R.string.pumperror));
- Notification n = new Notification(Notification.PUMPERROR, MainApp.gs(R.string.pumperror), Notification.URGENT);
- RxBus.Companion.getINSTANCE().send(new EventNewNotification(n));
- } else if (inputBuffer.length == 6 && inputBuffer[2] == 'B' && inputBuffer[3] == 'U' && inputBuffer[4] == 'S' && inputBuffer[5] == 'Y') {
- if (L.isEnabled(LTag.PUMPBTCOMM))
- log.debug("<<<<< " + "ENCRYPTION__PUMP_CHECK (BUSY)" + " " + DanaRS_Packet.toHexString(inputBuffer));
- mSendQueue.clear();
- RxBus.Companion.getINSTANCE().send(new EventPumpStatusChanged(EventPumpStatusChanged.Status.DISCONNECTED, MainApp.gs(R.string.pumpbusy)));
- } else {
- // ERROR in response, wrong serial number
- if (L.isEnabled(LTag.PUMPBTCOMM))
- log.debug("<<<<< " + "ENCRYPTION__PUMP_CHECK (ERROR)" + " " + DanaRS_Packet.toHexString(inputBuffer));
- mSendQueue.clear();
- RxBus.Companion.getINSTANCE().send(new EventPumpStatusChanged(EventPumpStatusChanged.Status.DISCONNECTED, MainApp.gs(R.string.connectionerror)));
- SP.remove(MainApp.gs(R.string.key_danars_pairingkey) + DanaRSPlugin.mDeviceName);
- Notification n = new Notification(Notification.WRONGSERIALNUMBER, MainApp.gs(R.string.wrongpassword), Notification.URGENT);
- RxBus.Companion.getINSTANCE().send(new EventNewNotification(n));
- }
- break;
- // 2nd packet, pairing key
- case (byte) BleCommandUtil.DANAR_PACKET__OPCODE_ENCRYPTION__CHECK_PASSKEY:
- if (L.isEnabled(LTag.PUMPBTCOMM))
- log.debug("<<<<< " + "ENCRYPTION__CHECK_PASSKEY" + " " + DanaRS_Packet.toHexString(inputBuffer));
- if (inputBuffer[2] == (byte) 0x00) {
- // Paring is not requested, sending time info
- SendTimeInfo();
- } else {
- // Pairing on pump is requested
- SendPairingRequest();
- }
- break;
- case (byte) BleCommandUtil.DANAR_PACKET__OPCODE_ENCRYPTION__PASSKEY_REQUEST:
- if (L.isEnabled(LTag.PUMPBTCOMM))
- log.debug("<<<<< " + "ENCRYPTION__PASSKEY_REQUEST " + DanaRS_Packet.toHexString(inputBuffer));
- if (inputBuffer[2] != (byte) 0x00) {
- disconnect("passkey request failed");
- }
- break;
- // Paring response, OK button on pump pressed
- case (byte) BleCommandUtil.DANAR_PACKET__OPCODE_ENCRYPTION__PASSKEY_RETURN:
- if (L.isEnabled(LTag.PUMPBTCOMM))
- log.debug("<<<<< " + "ENCRYPTION__PASSKEY_RETURN " + DanaRS_Packet.toHexString(inputBuffer));
- // Paring is successfull, sending time info
- RxBus.Companion.getINSTANCE().send(new EventDanaRSPairingSuccess());
- SendTimeInfo();
- byte[] pairingKey = {inputBuffer[2], inputBuffer[3]};
- // store pairing key to preferences
- SP.putString(MainApp.gs(R.string.key_danars_pairingkey) + DanaRSPlugin.mDeviceName, DanaRS_Packet.bytesToHex(pairingKey));
- if (L.isEnabled(LTag.PUMPBTCOMM))
- log.debug("Got pairing key: " + DanaRS_Packet.bytesToHex(pairingKey));
- break;
- // time and user password information. last packet in handshake
- case (byte) BleCommandUtil.DANAR_PACKET__OPCODE_ENCRYPTION__TIME_INFORMATION:
- if (L.isEnabled(LTag.PUMPBTCOMM))
- log.debug("<<<<< " + "ENCRYPTION__TIME_INFORMATION " + /*message.getMessageName() + " " + */ DanaRS_Packet.toHexString(inputBuffer));
- int size = inputBuffer.length;
- int pass = ((inputBuffer[size - 1] & 0x000000FF) << 8) + ((inputBuffer[size - 2] & 0x000000FF));
- pass = pass ^ 3463;
- danaRPump.setRsPassword(Integer.toHexString(pass));
- if (L.isEnabled(LTag.PUMPBTCOMM))
- log.debug("Pump user password: " + Integer.toHexString(pass));
-
- RxBus.Companion.getINSTANCE().send(new EventPumpStatusChanged(EventPumpStatusChanged.Status.CONNECTED));
- isConnected = true;
- isConnecting = false;
- if (L.isEnabled(LTag.PUMPBTCOMM))
- log.debug("RS connected and status read");
- break;
- }
- break;
- // common data packet
- default:
- DanaRS_Packet message;
- // Retrieve message code from received buffer and last message sent
- int originalCommand = processsedMessage != null ? processsedMessage.getCommand() : 0xFFFF;
- int receivedCommand = DanaRS_Packet.getCommand(inputBuffer);
- if (originalCommand == receivedCommand) {
- // it's response to last message
- message = processsedMessage;
- } else {
- // it's not response to last message, create new instance
- message = danaRSMessageHashTable.findMessage(receivedCommand);
- }
- if (message != null) {
- if (L.isEnabled(LTag.PUMPBTCOMM))
- log.debug("<<<<< " + message.getFriendlyName() + " " + DanaRS_Packet.toHexString(inputBuffer));
- // process received data
- message.handleMessage(inputBuffer);
- message.setReceived();
- synchronized (message) {
- // notify to sendMessage
- message.notify();
- }
- } else {
- log.error("Unknown message received " + DanaRS_Packet.toHexString(inputBuffer));
- }
- break;
- }
- } catch (Exception e) {
- log.error("Unhandled exception", e);
- }
- startSignatureFound = false;
- packetIsValid = false;
- if (bufferLength < 6) {
- // stop the loop
- isProcessing = false;
- }
- } else {
- // stop the loop
- isProcessing = false;
- }
- }
- }
-
- public void sendMessage(DanaRS_Packet message) {
- processsedMessage = message;
- if (message == null)
- return;
-
- byte[] command = {(byte) message.getType(), (byte) message.getOpCode()};
- byte[] params = message.getRequestParams();
- if (L.isEnabled(LTag.PUMPBTCOMM))
- log.debug(">>>>> " + message.getFriendlyName() + " " + DanaRS_Packet.toHexString(command) + " " + DanaRS_Packet.toHexString(params));
- byte[] bytes = BleCommandUtil.getInstance().getEncryptedPacket(message.getOpCode(), params, null);
- // If there is another message not completely sent, add to queue only
- if (mSendQueue.size() > 0) {
- // Split to parts per 20 bytes max
- for (; ; ) {
- if (bytes.length > 20) {
- byte[] addBytes = new byte[20];
- System.arraycopy(bytes, 0, addBytes, 0, addBytes.length);
- byte[] reBytes = new byte[bytes.length - addBytes.length];
- System.arraycopy(bytes, addBytes.length, reBytes, 0, reBytes.length);
- bytes = reBytes;
- synchronized (mSendQueue) {
- mSendQueue.add(addBytes);
- }
- } else {
- synchronized (mSendQueue) {
- mSendQueue.add(bytes);
- }
- break;
- }
- }
-
- } else {
- if (bytes.length > 20) {
- // Cut first 20 bytes
- byte[] sendBytes = new byte[20];
- System.arraycopy(bytes, 0, sendBytes, 0, sendBytes.length);
- byte[] reBytes = new byte[bytes.length - sendBytes.length];
- System.arraycopy(bytes, sendBytes.length, reBytes, 0, reBytes.length);
- bytes = reBytes;
- // and send
- writeCharacteristic_NO_RESPONSE(getUARTWriteBTGattChar(), sendBytes);
- // The rest split to parts per 20 bytes max
- for (; ; ) {
- if (bytes.length > 20) {
- byte[] addBytes = new byte[20];
- System.arraycopy(bytes, 0, addBytes, 0, addBytes.length);
- reBytes = new byte[bytes.length - addBytes.length];
- System.arraycopy(bytes, addBytes.length, reBytes, 0, reBytes.length);
- bytes = reBytes;
- synchronized (mSendQueue) {
- mSendQueue.add(addBytes);
- }
- } else {
- synchronized (mSendQueue) {
- mSendQueue.add(bytes);
- }
- break;
- }
- }
- } else {
- writeCharacteristic_NO_RESPONSE(getUARTWriteBTGattChar(), bytes);
- }
- }
- // The rest from queue is send from onCharasteristicWrite (after sending 1st part)
- synchronized (message) {
- try {
- message.wait(5000);
- } catch (InterruptedException e) {
- log.error("sendMessage InterruptedException", e);
- log.error("Unhandled exception", e);
- }
- }
-
- //SystemClock.sleep(200);
- if (!message.isReceived()) {
- log.warn("Reply not received " + message.getFriendlyName());
- message.handleMessageNotReceived();
- }
- }
-
- private void SendPairingRequest() {
- // Start activity which is waiting 20sec
- // On pump pairing request is displayed and is waiting for conformation
- Intent i = new Intent();
- i.setClass(MainApp.instance(), PairingHelperActivity.class);
- i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
- MainApp.instance().startActivity(i);
-
- byte[] bytes = BleCommandUtil.getInstance().getEncryptedPacket(BleCommandUtil.DANAR_PACKET__OPCODE_ENCRYPTION__PASSKEY_REQUEST, null, null);
- if (L.isEnabled(LTag.PUMPBTCOMM))
- log.debug(">>>>> " + "ENCRYPTION__PASSKEY_REQUEST" + " " + DanaRS_Packet.toHexString(bytes));
- writeCharacteristic_NO_RESPONSE(getUARTWriteBTGattChar(), bytes);
- }
-
- private void SendPumpCheck() {
- // 1st message sent to pump after connect
- String devicename = getConnectDeviceName();
- if (devicename == null || devicename.equals("")) {
- Notification n = new Notification(Notification.DEVICENOTPAIRED, MainApp.gs(R.string.pairfirst), Notification.URGENT);
- RxBus.Companion.getINSTANCE().send(new EventNewNotification(n));
- return;
- }
- byte[] bytes = BleCommandUtil.getInstance().getEncryptedPacket(BleCommandUtil.DANAR_PACKET__OPCODE_ENCRYPTION__PUMP_CHECK, null, devicename);
- if (L.isEnabled(LTag.PUMPBTCOMM))
- log.debug(">>>>> " + "ENCRYPTION__PUMP_CHECK (0x00)" + " " + DanaRS_Packet.toHexString(bytes));
- writeCharacteristic_NO_RESPONSE(getUARTWriteBTGattChar(), bytes);
- }
-
- private void SendTimeInfo() {
- byte[] bytes = BleCommandUtil.getInstance().getEncryptedPacket(BleCommandUtil.DANAR_PACKET__OPCODE_ENCRYPTION__TIME_INFORMATION, null, null);
- if (L.isEnabled(LTag.PUMPBTCOMM))
- log.debug(">>>>> " + "ENCRYPTION__TIME_INFORMATION" + " " + DanaRS_Packet.toHexString(bytes));
- writeCharacteristic_NO_RESPONSE(getUARTWriteBTGattChar(), bytes);
- }
-
-}
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRS/services/DanaRSService.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRS/services/DanaRSService.java
deleted file mode 100644
index 359294ca00..0000000000
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRS/services/DanaRSService.java
+++ /dev/null
@@ -1,566 +0,0 @@
-package info.nightscout.androidaps.plugins.pump.danaRS.services;
-
-import android.content.Context;
-import android.content.Intent;
-import android.os.Binder;
-import android.os.IBinder;
-import android.os.SystemClock;
-
-import javax.inject.Inject;
-
-import dagger.android.DaggerService;
-import dagger.android.HasAndroidInjector;
-import info.nightscout.androidaps.Constants;
-import info.nightscout.androidaps.R;
-import info.nightscout.androidaps.activities.ErrorHelperActivity;
-import info.nightscout.androidaps.data.Profile;
-import info.nightscout.androidaps.data.PumpEnactResult;
-import info.nightscout.androidaps.dialogs.BolusProgressDialog;
-import info.nightscout.androidaps.events.EventAppExit;
-import info.nightscout.androidaps.events.EventInitializationChanged;
-import info.nightscout.androidaps.events.EventProfileNeedsUpdate;
-import info.nightscout.androidaps.events.EventPumpStatusChanged;
-import info.nightscout.androidaps.interfaces.ActivePluginProvider;
-import info.nightscout.androidaps.interfaces.CommandQueueProvider;
-import info.nightscout.androidaps.interfaces.PumpInterface;
-import info.nightscout.androidaps.logging.AAPSLogger;
-import info.nightscout.androidaps.logging.LTag;
-import info.nightscout.androidaps.plugins.bus.RxBusWrapper;
-import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker;
-import info.nightscout.androidaps.interfaces.ProfileFunction;
-import info.nightscout.androidaps.plugins.general.nsclient.NSUpload;
-import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification;
-import info.nightscout.androidaps.plugins.general.overview.events.EventOverviewBolusProgress;
-import info.nightscout.androidaps.plugins.general.overview.notifications.Notification;
-import info.nightscout.androidaps.plugins.pump.common.bolusInfo.DetailedBolusInfoStorage;
-import info.nightscout.androidaps.plugins.pump.danaR.DanaRPump;
-import info.nightscout.androidaps.plugins.pump.danaR.comm.RecordTypes;
-import info.nightscout.androidaps.plugins.pump.danaR.events.EventDanaRNewStatus;
-import info.nightscout.androidaps.plugins.pump.danaRS.DanaRSPlugin;
-import info.nightscout.androidaps.plugins.pump.danaRS.comm.DanaRSMessageHashTable;
-import info.nightscout.androidaps.plugins.pump.danaRS.comm.DanaRS_Packet;
-import info.nightscout.androidaps.plugins.pump.danaRS.comm.DanaRS_Packet_APS_Basal_Set_Temporary_Basal;
-import info.nightscout.androidaps.plugins.pump.danaRS.comm.DanaRS_Packet_APS_History_Events;
-import info.nightscout.androidaps.plugins.pump.danaRS.comm.DanaRS_Packet_APS_Set_Event_History;
-import info.nightscout.androidaps.plugins.pump.danaRS.comm.DanaRS_Packet_Basal_Get_Basal_Rate;
-import info.nightscout.androidaps.plugins.pump.danaRS.comm.DanaRS_Packet_Basal_Get_Profile_Number;
-import info.nightscout.androidaps.plugins.pump.danaRS.comm.DanaRS_Packet_Basal_Get_Temporary_Basal_State;
-import info.nightscout.androidaps.plugins.pump.danaRS.comm.DanaRS_Packet_Basal_Set_Cancel_Temporary_Basal;
-import info.nightscout.androidaps.plugins.pump.danaRS.comm.DanaRS_Packet_Basal_Set_Profile_Basal_Rate;
-import info.nightscout.androidaps.plugins.pump.danaRS.comm.DanaRS_Packet_Basal_Set_Profile_Number;
-import info.nightscout.androidaps.plugins.pump.danaRS.comm.DanaRS_Packet_Basal_Set_Temporary_Basal;
-import info.nightscout.androidaps.plugins.pump.danaRS.comm.DanaRS_Packet_Bolus_Get_Bolus_Option;
-import info.nightscout.androidaps.plugins.pump.danaRS.comm.DanaRS_Packet_Bolus_Get_CIR_CF_Array;
-import info.nightscout.androidaps.plugins.pump.danaRS.comm.DanaRS_Packet_Bolus_Get_Calculation_Information;
-import info.nightscout.androidaps.plugins.pump.danaRS.comm.DanaRS_Packet_Bolus_Get_Extended_Bolus_State;
-import info.nightscout.androidaps.plugins.pump.danaRS.comm.DanaRS_Packet_Bolus_Get_Step_Bolus_Information;
-import info.nightscout.androidaps.plugins.pump.danaRS.comm.DanaRS_Packet_Bolus_Set_Extended_Bolus;
-import info.nightscout.androidaps.plugins.pump.danaRS.comm.DanaRS_Packet_Bolus_Set_Extended_Bolus_Cancel;
-import info.nightscout.androidaps.plugins.pump.danaRS.comm.DanaRS_Packet_Bolus_Set_Step_Bolus_Start;
-import info.nightscout.androidaps.plugins.pump.danaRS.comm.DanaRS_Packet_Bolus_Set_Step_Bolus_Stop;
-import info.nightscout.androidaps.plugins.pump.danaRS.comm.DanaRS_Packet_General_Get_Pump_Check;
-import info.nightscout.androidaps.plugins.pump.danaRS.comm.DanaRS_Packet_General_Get_Shipping_Information;
-import info.nightscout.androidaps.plugins.pump.danaRS.comm.DanaRS_Packet_General_Initial_Screen_Information;
-import info.nightscout.androidaps.plugins.pump.danaRS.comm.DanaRS_Packet_General_Set_History_Upload_Mode;
-import info.nightscout.androidaps.plugins.pump.danaRS.comm.DanaRS_Packet_History_;
-import info.nightscout.androidaps.plugins.pump.danaRS.comm.DanaRS_Packet_History_Alarm;
-import info.nightscout.androidaps.plugins.pump.danaRS.comm.DanaRS_Packet_History_Basal;
-import info.nightscout.androidaps.plugins.pump.danaRS.comm.DanaRS_Packet_History_Blood_Glucose;
-import info.nightscout.androidaps.plugins.pump.danaRS.comm.DanaRS_Packet_History_Bolus;
-import info.nightscout.androidaps.plugins.pump.danaRS.comm.DanaRS_Packet_History_Carbohydrate;
-import info.nightscout.androidaps.plugins.pump.danaRS.comm.DanaRS_Packet_History_Daily;
-import info.nightscout.androidaps.plugins.pump.danaRS.comm.DanaRS_Packet_History_Prime;
-import info.nightscout.androidaps.plugins.pump.danaRS.comm.DanaRS_Packet_History_Refill;
-import info.nightscout.androidaps.plugins.pump.danaRS.comm.DanaRS_Packet_History_Suspend;
-import info.nightscout.androidaps.plugins.pump.danaRS.comm.DanaRS_Packet_Option_Get_Pump_Time;
-import info.nightscout.androidaps.plugins.pump.danaRS.comm.DanaRS_Packet_Option_Get_User_Option;
-import info.nightscout.androidaps.plugins.pump.danaRS.comm.DanaRS_Packet_Option_Set_Pump_Time;
-import info.nightscout.androidaps.db.Treatment;
-import info.nightscout.androidaps.queue.Callback;
-import info.nightscout.androidaps.queue.commands.Command;
-import info.nightscout.androidaps.utils.DateUtil;
-import info.nightscout.androidaps.utils.FabricPrivacy;
-import info.nightscout.androidaps.utils.T;
-import info.nightscout.androidaps.utils.resources.ResourceHelper;
-import info.nightscout.androidaps.utils.sharedPreferences.SP;
-import io.reactivex.disposables.CompositeDisposable;
-import io.reactivex.schedulers.Schedulers;
-
-public class DanaRSService extends DaggerService {
- @Inject HasAndroidInjector injector;
- @Inject AAPSLogger aapsLogger;
- @Inject RxBusWrapper rxBus;
- @Inject SP sp;
- @Inject ResourceHelper resourceHelper;
- @Inject ProfileFunction profileFunction;
- @Inject CommandQueueProvider commandQueue;
- @Inject Context context;
- @Inject DanaRSPlugin danaRSPlugin;
- @Inject DanaRPump danaRPump;
- @Inject DanaRSMessageHashTable danaRSMessageHashTable;
- @Inject ActivePluginProvider activePlugin;
- @Inject ConstraintChecker constraintChecker;
- @Inject DetailedBolusInfoStorage detailedBolusInfoStorage;
- @Inject DateUtil dateUtil;
-
- private CompositeDisposable disposable = new CompositeDisposable();
-
- private BLEComm bleComm;
-
- private IBinder mBinder = new LocalBinder();
-
- private Treatment bolusingTreatment = null;
-
- private long lastHistoryFetched = 0;
- private long lastApproachingDailyLimit = 0;
-
- @Override
- public void onCreate() {
- super.onCreate();
- bleComm = new BLEComm(this, danaRSMessageHashTable, danaRPump);
- disposable.add(rxBus
- .toObservable(EventAppExit.class)
- .observeOn(Schedulers.io())
- .subscribe(event -> {
- aapsLogger.debug(LTag.PUMPCOMM, "EventAppExit received");
- stopSelf();
- }, exception -> FabricPrivacy.getInstance().logException(exception))
- );
- }
-
- @Override
- public void onDestroy() {
- disposable.clear();
- super.onDestroy();
- }
-
- public boolean isConnected() {
- return bleComm.isConnected;
- }
-
- public boolean isConnecting() {
- return bleComm.isConnecting;
- }
-
- public boolean connect(String from, String address, Object confirmConnect) {
- return bleComm.connect(from, address, confirmConnect);
- }
-
- public void stopConnecting() {
- bleComm.stopConnecting();
- }
-
- public void disconnect(String from) {
- bleComm.disconnect(from);
- }
-
- @SuppressWarnings("unused")
- public void sendMessage(DanaRS_Packet message) {
- bleComm.sendMessage(message);
- }
-
- public void getPumpStatus() {
- try {
- rxBus.send(new EventPumpStatusChanged(resourceHelper.gs(R.string.gettingpumpstatus)));
-
- bleComm.sendMessage(new DanaRS_Packet_General_Initial_Screen_Information(aapsLogger, danaRPump));
- rxBus.send(new EventPumpStatusChanged(resourceHelper.gs(R.string.gettingextendedbolusstatus)));
- bleComm.sendMessage(new DanaRS_Packet_Bolus_Get_Extended_Bolus_State(aapsLogger, danaRPump));
- rxBus.send(new EventPumpStatusChanged(resourceHelper.gs(R.string.gettingbolusstatus)));
- bleComm.sendMessage(new DanaRS_Packet_Bolus_Get_Step_Bolus_Information(aapsLogger, danaRPump, dateUtil)); // last bolus, bolusStep, maxBolus
- rxBus.send(new EventPumpStatusChanged(resourceHelper.gs(R.string.gettingtempbasalstatus)));
- bleComm.sendMessage(new DanaRS_Packet_Basal_Get_Temporary_Basal_State(aapsLogger, danaRPump, dateUtil));
-
- danaRPump.setLastConnection(System.currentTimeMillis());
-
- Profile profile = profileFunction.getProfile();
- PumpInterface pump = activePlugin.getActivePump();
- if (profile != null && Math.abs(danaRPump.getCurrentBasal() - profile.getBasal()) >= pump.getPumpDescription().basalStep) {
- rxBus.send(new EventPumpStatusChanged(resourceHelper.gs(R.string.gettingpumpsettings)));
- bleComm.sendMessage(new DanaRS_Packet_Basal_Get_Basal_Rate(aapsLogger, rxBus, resourceHelper, danaRPump)); // basal profile, basalStep, maxBasal
- if (!pump.isThisProfileSet(profile) && !commandQueue.isRunning(Command.CommandType.BASAL_PROFILE)) {
- rxBus.send(new EventProfileNeedsUpdate());
- }
- }
-
- rxBus.send(new EventPumpStatusChanged(resourceHelper.gs(R.string.gettingpumptime)));
- bleComm.sendMessage(new DanaRS_Packet_Option_Get_Pump_Time(aapsLogger, danaRPump, dateUtil));
-
- long timeDiff = (danaRPump.getPumpTime() - System.currentTimeMillis()) / 1000L;
- if (danaRPump.getPumpTime() == 0) {
- // initial handshake was not successfull
- // deinitialize pump
- danaRPump.setLastConnection(0);
- rxBus.send(new EventDanaRNewStatus());
- rxBus.send(new EventInitializationChanged());
- return;
- }
- long now = System.currentTimeMillis();
- if (danaRPump.getLastSettingsRead() + 60 * 60 * 1000L < now || !pump.isInitialized()) {
- rxBus.send(new EventPumpStatusChanged(resourceHelper.gs(R.string.gettingpumpsettings)));
- bleComm.sendMessage(new DanaRS_Packet_General_Get_Shipping_Information(aapsLogger, danaRPump, dateUtil)); // serial no
- bleComm.sendMessage(new DanaRS_Packet_General_Get_Pump_Check(aapsLogger, danaRPump, rxBus, resourceHelper)); // firmware
- bleComm.sendMessage(new DanaRS_Packet_Basal_Get_Profile_Number(aapsLogger, danaRPump));
- bleComm.sendMessage(new DanaRS_Packet_Bolus_Get_Bolus_Option(aapsLogger, rxBus, resourceHelper, danaRPump)); // isExtendedEnabled
- bleComm.sendMessage(new DanaRS_Packet_Basal_Get_Basal_Rate(aapsLogger, rxBus, resourceHelper, danaRPump)); // basal profile, basalStep, maxBasal
- bleComm.sendMessage(new DanaRS_Packet_Bolus_Get_Calculation_Information(aapsLogger, danaRPump)); // target
- bleComm.sendMessage(new DanaRS_Packet_Bolus_Get_CIR_CF_Array(aapsLogger, danaRPump));
- bleComm.sendMessage(new DanaRS_Packet_Option_Get_User_Option(aapsLogger, danaRPump)); // Getting user options
- danaRPump.setLastSettingsRead(now);
- }
-
- aapsLogger.debug(LTag.PUMPCOMM, "Pump time difference: " + timeDiff + " seconds");
- if (Math.abs(timeDiff) > 3) {
- if (Math.abs(timeDiff) > 60 * 60 * 1.5) {
- aapsLogger.debug(LTag.PUMPCOMM, "Pump time difference: " + timeDiff + " seconds - large difference");
- //If time-diff is very large, warn user until we can synchronize history readings properly
- Intent i = new Intent(context, ErrorHelperActivity.class);
- i.putExtra("soundid", R.raw.error);
- i.putExtra("status", resourceHelper.gs(R.string.largetimediff));
- i.putExtra("title", resourceHelper.gs(R.string.largetimedifftitle));
- i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
- context.startActivity(i);
-
- //deinitialize pump
- danaRPump.setLastConnection(0);
- rxBus.send(new EventDanaRNewStatus());
- rxBus.send(new EventInitializationChanged());
- return;
- } else {
- if (danaRPump.getProtocol() >= 6) {
- bleComm.sendMessage(new DanaRS_Packet_Option_Set_Pump_Time(aapsLogger, dateUtil, DateUtil.now()));
- } else {
- waitForWholeMinute(); // Dana can set only whole minute
- // add 10sec to be sure we are over minute (will be cutted off anyway)
- bleComm.sendMessage(new DanaRS_Packet_Option_Set_Pump_Time(aapsLogger, dateUtil, DateUtil.now() + T.secs(10).msecs()));
- }
- bleComm.sendMessage(new DanaRS_Packet_Option_Get_Pump_Time(aapsLogger, danaRPump, dateUtil));
- timeDiff = (danaRPump.getPumpTime() - System.currentTimeMillis()) / 1000L;
- aapsLogger.debug(LTag.PUMPCOMM, "Pump time difference: " + timeDiff + " seconds");
- }
- }
-
- loadEvents();
-
- rxBus.send(new EventDanaRNewStatus());
- rxBus.send(new EventInitializationChanged());
- //NSUpload.uploadDeviceStatus();
- if (danaRPump.getDailyTotalUnits() > danaRPump.getMaxDailyTotalUnits() * Constants.dailyLimitWarning) {
- aapsLogger.debug(LTag.PUMPCOMM, "Approaching daily limit: " + danaRPump.getDailyTotalUnits() + "/" + danaRPump.getMaxDailyTotalUnits());
- if (System.currentTimeMillis() > lastApproachingDailyLimit + 30 * 60 * 1000) {
- Notification reportFail = new Notification(Notification.APPROACHING_DAILY_LIMIT, resourceHelper.gs(R.string.approachingdailylimit), Notification.URGENT);
- rxBus.send(new EventNewNotification(reportFail));
- NSUpload.uploadError(resourceHelper.gs(R.string.approachingdailylimit) + ": " + danaRPump.getDailyTotalUnits() + "/" + danaRPump.getMaxDailyTotalUnits() + "U");
- lastApproachingDailyLimit = System.currentTimeMillis();
- }
- }
- } catch (Exception e) {
- aapsLogger.error(LTag.PUMPCOMM, "Unhandled exception", e);
- }
- aapsLogger.debug(LTag.PUMPCOMM, "Pump status loaded");
- }
-
- public PumpEnactResult loadEvents() {
-
- if (!danaRSPlugin.isInitialized()) {
- PumpEnactResult result = new PumpEnactResult(injector).success(false);
- result.comment = "pump not initialized";
- return result;
- }
-
- SystemClock.sleep(1000);
-
- DanaRS_Packet_APS_History_Events msg;
- if (lastHistoryFetched == 0) {
- msg = new DanaRS_Packet_APS_History_Events(aapsLogger, rxBus, resourceHelper, activePlugin, danaRSPlugin, detailedBolusInfoStorage, injector, dateUtil, 0);
- aapsLogger.debug(LTag.PUMPCOMM, "Loading complete event history");
- } else {
- msg = new DanaRS_Packet_APS_History_Events(aapsLogger, rxBus, resourceHelper, activePlugin, danaRSPlugin, detailedBolusInfoStorage, injector, dateUtil, lastHistoryFetched);
- aapsLogger.debug(LTag.PUMPCOMM, "Loading event history from: " + dateUtil.dateAndTimeString(lastHistoryFetched));
- }
- bleComm.sendMessage(msg);
- while (!danaRSPlugin.apsHistoryDone && bleComm.isConnected()) {
- SystemClock.sleep(100);
- }
- if (danaRSPlugin.lastEventTimeLoaded != 0)
- lastHistoryFetched = danaRSPlugin.lastEventTimeLoaded - T.mins(1).msecs();
- else
- lastHistoryFetched = 0;
- aapsLogger.debug(LTag.PUMPCOMM, "Events loaded");
- danaRPump.setLastConnection(System.currentTimeMillis());
- return new PumpEnactResult(injector).success(true);
- }
-
-
- public PumpEnactResult setUserSettings() {
- bleComm.sendMessage(new DanaRS_Packet_Option_Get_User_Option(aapsLogger, danaRPump));
- return new PumpEnactResult(injector).success(true);
- }
-
-
- public boolean bolus(final double insulin, int carbs, long carbtime, Treatment t) {
- if (!isConnected()) return false;
- if (BolusProgressDialog.stopPressed) return false;
-
- rxBus.send(new EventPumpStatusChanged(resourceHelper.gs(R.string.startingbolus)));
- bolusingTreatment = t;
- final int preferencesSpeed = sp.getInt(R.string.key_danars_bolusspeed, 0);
- danaRSPlugin.bolusingTreatment = t;
- danaRSPlugin.bolusAmountToBeDelivered = insulin;
- danaRSPlugin.bolusStopped = false;
- danaRSPlugin.bolusStopForced = false;
- danaRSPlugin.bolusProgressLastTimeStamp = DateUtil.now();
-
- DanaRS_Packet_Bolus_Set_Step_Bolus_Start start = new DanaRS_Packet_Bolus_Set_Step_Bolus_Start(aapsLogger, danaRSPlugin, constraintChecker, insulin, preferencesSpeed);
- if (carbs > 0) {
-// MsgSetCarbsEntry msg = new MsgSetCarbsEntry(carbtime, carbs); ####
-// bleComm.sendMessage(msg);
- DanaRS_Packet_APS_Set_Event_History msgSetHistoryEntry_v2 = new DanaRS_Packet_APS_Set_Event_History(aapsLogger, dateUtil, DanaRPump.CARBS, carbtime, carbs, 0);
- bleComm.sendMessage(msgSetHistoryEntry_v2);
- lastHistoryFetched = Math.min(lastHistoryFetched, carbtime - T.mins(1).msecs());
- }
-
- final long bolusStart = System.currentTimeMillis();
- if (insulin > 0) {
- if (!danaRSPlugin.bolusStopped) {
- bleComm.sendMessage(start);
- } else {
- t.insulin = 0d;
- return false;
- }
-
- while (!danaRSPlugin.bolusStopped && !start.failed && !danaRSPlugin.bolusDone) {
- SystemClock.sleep(100);
- if ((System.currentTimeMillis() - danaRSPlugin.bolusProgressLastTimeStamp) > 15 * 1000L) { // if i didn't receive status for more than 20 sec expecting broken comm
- danaRSPlugin.bolusStopped = true;
- danaRSPlugin.bolusStopForced = true;
- aapsLogger.debug(LTag.PUMPCOMM, "Communication stopped");
- }
- }
- }
-
- final EventOverviewBolusProgress bolusingEvent = EventOverviewBolusProgress.INSTANCE;
- bolusingEvent.setT(t);
- bolusingEvent.setPercent(99);
-
- bolusingTreatment = null;
- int speed = 12;
- switch (preferencesSpeed) {
- case 0:
- speed = 12;
- break;
- case 1:
- speed = 30;
- break;
- case 2:
- speed = 60;
- break;
- }
- long bolusDurationInMSec = (long) (insulin * speed * 1000);
- long expectedEnd = bolusStart + bolusDurationInMSec + 2000;
- while (System.currentTimeMillis() < expectedEnd) {
- long waitTime = expectedEnd - System.currentTimeMillis();
- bolusingEvent.setStatus(String.format(resourceHelper.gs(R.string.waitingforestimatedbolusend), waitTime / 1000));
- rxBus.send(bolusingEvent);
- SystemClock.sleep(1000);
- }
- // do not call loadEvents() directly, reconnection may be needed
- commandQueue.loadEvents(new Callback() {
- @Override
- public void run() {
- // reread bolus status
- rxBus.send(new EventPumpStatusChanged(resourceHelper.gs(R.string.gettingbolusstatus)));
- bleComm.sendMessage(new DanaRS_Packet_Bolus_Get_Step_Bolus_Information(aapsLogger, danaRPump, dateUtil)); // last bolus
- bolusingEvent.setPercent(100);
- rxBus.send(new EventPumpStatusChanged(resourceHelper.gs(R.string.disconnecting)));
- }
- });
- return !start.failed;
- }
-
- public void bolusStop() {
- aapsLogger.debug(LTag.PUMPCOMM, "bolusStop >>>>> @ " + (bolusingTreatment == null ? "" : bolusingTreatment.insulin));
- DanaRS_Packet_Bolus_Set_Step_Bolus_Stop stop = new DanaRS_Packet_Bolus_Set_Step_Bolus_Stop(aapsLogger, rxBus, resourceHelper, danaRSPlugin);
- danaRSPlugin.bolusStopForced = true;
- if (isConnected()) {
- bleComm.sendMessage(stop);
- while (!danaRSPlugin.bolusStopped) {
- bleComm.sendMessage(stop);
- SystemClock.sleep(200);
- }
- } else {
- danaRSPlugin.bolusStopped = true;
- }
- }
-
- public boolean tempBasal(Integer percent, int durationInHours) {
- if (!isConnected()) return false;
- if (danaRPump.isTempBasalInProgress()) {
- rxBus.send(new EventPumpStatusChanged(resourceHelper.gs(R.string.stoppingtempbasal)));
- bleComm.sendMessage(new DanaRS_Packet_Basal_Set_Cancel_Temporary_Basal(aapsLogger));
- SystemClock.sleep(500);
- }
- rxBus.send(new EventPumpStatusChanged(resourceHelper.gs(R.string.settingtempbasal)));
- bleComm.sendMessage(new DanaRS_Packet_Basal_Set_Temporary_Basal(aapsLogger, percent, durationInHours));
- SystemClock.sleep(200);
- bleComm.sendMessage(new DanaRS_Packet_Basal_Get_Temporary_Basal_State(aapsLogger, danaRPump, dateUtil));
- loadEvents();
- rxBus.send(new EventPumpStatusChanged(EventPumpStatusChanged.Status.DISCONNECTING));
- return true;
- }
-
- public boolean highTempBasal(Integer percent) {
- if (danaRPump.isTempBasalInProgress()) {
- rxBus.send(new EventPumpStatusChanged(resourceHelper.gs(R.string.stoppingtempbasal)));
- bleComm.sendMessage(new DanaRS_Packet_Basal_Set_Cancel_Temporary_Basal(aapsLogger));
- SystemClock.sleep(500);
- }
- rxBus.send(new EventPumpStatusChanged(resourceHelper.gs(R.string.settingtempbasal)));
- bleComm.sendMessage(new DanaRS_Packet_APS_Basal_Set_Temporary_Basal(aapsLogger, percent));
- bleComm.sendMessage(new DanaRS_Packet_Basal_Get_Temporary_Basal_State(aapsLogger, danaRPump, dateUtil));
- loadEvents();
- rxBus.send(new EventPumpStatusChanged(EventPumpStatusChanged.Status.DISCONNECTING));
- return true;
- }
-
- public boolean tempBasalShortDuration(Integer percent, int durationInMinutes) {
- if (durationInMinutes != 15 && durationInMinutes != 30) {
- aapsLogger.error(LTag.PUMPCOMM, "Wrong duration param");
- return false;
- }
-
- if (danaRPump.isTempBasalInProgress()) {
- rxBus.send(new EventPumpStatusChanged(resourceHelper.gs(R.string.stoppingtempbasal)));
- bleComm.sendMessage(new DanaRS_Packet_Basal_Set_Cancel_Temporary_Basal(aapsLogger));
- SystemClock.sleep(500);
- }
- rxBus.send(new EventPumpStatusChanged(resourceHelper.gs(R.string.settingtempbasal)));
- bleComm.sendMessage(new DanaRS_Packet_APS_Basal_Set_Temporary_Basal(aapsLogger, percent));
- bleComm.sendMessage(new DanaRS_Packet_Basal_Get_Temporary_Basal_State(aapsLogger, danaRPump, dateUtil));
- loadEvents();
- rxBus.send(new EventPumpStatusChanged(EventPumpStatusChanged.Status.DISCONNECTING));
- return true;
- }
-
- public boolean tempBasalStop() {
- if (!isConnected()) return false;
- rxBus.send(new EventPumpStatusChanged(resourceHelper.gs(R.string.stoppingtempbasal)));
- bleComm.sendMessage(new DanaRS_Packet_Basal_Set_Cancel_Temporary_Basal(aapsLogger));
- bleComm.sendMessage(new DanaRS_Packet_Basal_Get_Temporary_Basal_State(aapsLogger, danaRPump, dateUtil));
- loadEvents();
- rxBus.send(new EventPumpStatusChanged(EventPumpStatusChanged.Status.DISCONNECTING));
- return true;
- }
-
- public boolean extendedBolus(Double insulin, int durationInHalfHours) {
- if (!isConnected()) return false;
- rxBus.send(new EventPumpStatusChanged(resourceHelper.gs(R.string.settingextendedbolus)));
- bleComm.sendMessage(new DanaRS_Packet_Bolus_Set_Extended_Bolus(aapsLogger, insulin, durationInHalfHours));
- SystemClock.sleep(200);
- bleComm.sendMessage(new DanaRS_Packet_Bolus_Get_Extended_Bolus_State(aapsLogger, danaRPump));
- loadEvents();
- rxBus.send(new EventPumpStatusChanged(EventPumpStatusChanged.Status.DISCONNECTING));
- return true;
- }
-
- public boolean extendedBolusStop() {
- if (!isConnected()) return false;
- rxBus.send(new EventPumpStatusChanged(resourceHelper.gs(R.string.stoppingextendedbolus)));
- bleComm.sendMessage(new DanaRS_Packet_Bolus_Set_Extended_Bolus_Cancel(aapsLogger));
- bleComm.sendMessage(new DanaRS_Packet_Bolus_Get_Extended_Bolus_State(aapsLogger, danaRPump));
- loadEvents();
- rxBus.send(new EventPumpStatusChanged(EventPumpStatusChanged.Status.DISCONNECTING));
- return true;
- }
-
- public boolean updateBasalsInPump(Profile profile) {
- if (!isConnected()) return false;
- rxBus.send(new EventPumpStatusChanged(resourceHelper.gs(R.string.updatingbasalrates)));
- Double[] basal = danaRPump.buildDanaRProfileRecord(profile);
- DanaRS_Packet_Basal_Set_Profile_Basal_Rate msgSet = new DanaRS_Packet_Basal_Set_Profile_Basal_Rate(aapsLogger, 0, basal);
- bleComm.sendMessage(msgSet);
- DanaRS_Packet_Basal_Set_Profile_Number msgActivate = new DanaRS_Packet_Basal_Set_Profile_Number(aapsLogger, 0);
- bleComm.sendMessage(msgActivate);
- danaRPump.setLastSettingsRead(0); // force read full settings
- getPumpStatus();
- rxBus.send(new EventPumpStatusChanged(EventPumpStatusChanged.Status.DISCONNECTING));
- return true;
- }
-
- public PumpEnactResult loadHistory(byte type) {
- PumpEnactResult result = new PumpEnactResult(injector);
- if (!isConnected()) return result;
- DanaRS_Packet_History_ msg = null;
- switch (type) {
- case RecordTypes.RECORD_TYPE_ALARM:
- msg = new DanaRS_Packet_History_Alarm(aapsLogger, rxBus, dateUtil);
- break;
- case RecordTypes.RECORD_TYPE_PRIME:
- msg = new DanaRS_Packet_History_Prime(aapsLogger, rxBus, dateUtil);
- break;
- case RecordTypes.RECORD_TYPE_BASALHOUR:
- msg = new DanaRS_Packet_History_Basal(aapsLogger, rxBus, dateUtil);
- break;
- case RecordTypes.RECORD_TYPE_BOLUS:
- msg = new DanaRS_Packet_History_Bolus(aapsLogger, rxBus, dateUtil);
- break;
- case RecordTypes.RECORD_TYPE_CARBO:
- msg = new DanaRS_Packet_History_Carbohydrate(aapsLogger, rxBus, dateUtil);
- break;
- case RecordTypes.RECORD_TYPE_DAILY:
- msg = new DanaRS_Packet_History_Daily(aapsLogger, rxBus, dateUtil);
- break;
- case RecordTypes.RECORD_TYPE_GLUCOSE:
- msg = new DanaRS_Packet_History_Blood_Glucose(aapsLogger, rxBus, dateUtil);
- break;
- case RecordTypes.RECORD_TYPE_REFILL:
- msg = new DanaRS_Packet_History_Refill(aapsLogger, rxBus, dateUtil);
- break;
- case RecordTypes.RECORD_TYPE_SUSPEND:
- msg = new DanaRS_Packet_History_Suspend(aapsLogger, rxBus, dateUtil);
- break;
- }
- if (msg != null) {
- bleComm.sendMessage(new DanaRS_Packet_General_Set_History_Upload_Mode(aapsLogger, 1));
- SystemClock.sleep(200);
- bleComm.sendMessage(msg);
- while (!msg.getDone() && isConnected()) {
- SystemClock.sleep(100);
- }
- SystemClock.sleep(200);
- bleComm.sendMessage(new DanaRS_Packet_General_Set_History_Upload_Mode(aapsLogger, 0));
- }
- result.success = true;
- result.comment = "OK";
- return result;
- }
-
-
- public class LocalBinder extends Binder {
- public DanaRSService getServiceInstance() {
- return DanaRSService.this;
- }
-
- }
-
- @Override
- public IBinder onBind(Intent intent) {
- return mBinder;
- }
-
- @Override
- public int onStartCommand(Intent intent, int flags, int startId) {
- return START_STICKY;
- }
-
- void waitForWholeMinute() {
- while (true) {
- long time = DateUtil.now();
- long timeToWholeMinute = (60000 - time % 60000);
- if (timeToWholeMinute > 59800 || timeToWholeMinute < 300)
- break;
- rxBus.send(new EventPumpStatusChanged(resourceHelper.gs(R.string.waitingfortimesynchronization, (int) (timeToWholeMinute / 1000))));
- SystemClock.sleep(Math.min(timeToWholeMinute, 100));
- }
- }
-}
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MessageHashTableRv2.kt b/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MessageHashTableRv2.kt
deleted file mode 100644
index 8833ea6b3f..0000000000
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MessageHashTableRv2.kt
+++ /dev/null
@@ -1,109 +0,0 @@
-package info.nightscout.androidaps.plugins.pump.danaRv2.comm
-
-import dagger.android.HasAndroidInjector
-import info.nightscout.androidaps.interfaces.ActivePluginProvider
-import info.nightscout.androidaps.interfaces.CommandQueueProvider
-import info.nightscout.androidaps.logging.AAPSLogger
-import info.nightscout.androidaps.plugins.bus.RxBusWrapper
-import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin
-import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker
-import info.nightscout.androidaps.plugins.pump.common.bolusInfo.DetailedBolusInfoStorage
-import info.nightscout.androidaps.plugins.pump.danaR.DanaRPlugin
-import info.nightscout.androidaps.plugins.pump.danaR.DanaRPump
-import info.nightscout.androidaps.plugins.pump.danaR.comm.*
-import info.nightscout.androidaps.plugins.pump.danaRKorean.DanaRKoreanPlugin
-import info.nightscout.androidaps.plugins.pump.danaRv2.DanaRv2Plugin
-import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin
-import info.nightscout.androidaps.utils.DateUtil
-import info.nightscout.androidaps.utils.resources.ResourceHelper
-import java.util.*
-import javax.inject.Inject
-import javax.inject.Singleton
-
-@Singleton
-class MessageHashTableRv2 @Inject constructor(
- aapsLogger: AAPSLogger,
- rxBus: RxBusWrapper,
- resourceHelper: ResourceHelper,
- constraintChecker: ConstraintChecker,
- danaRPump: DanaRPump,
- danaRPlugin: DanaRPlugin,
- danaRKoreanPlugin: DanaRKoreanPlugin,
- danaRv2Plugin: DanaRv2Plugin,
- configBuilderPlugin: ConfigBuilderPlugin,
- commandQueue: CommandQueueProvider,
- activePlugin: ActivePluginProvider,
- detailedBolusInfoStorage: DetailedBolusInfoStorage,
- treatmentsPlugin: TreatmentsPlugin,
- injector: HasAndroidInjector,
- dateUtil: DateUtil
-) : MessageHashTableBase {
-
- var messages: HashMap = HashMap()
-
- init {
- put(MsgBolusStop(aapsLogger, rxBus, resourceHelper, danaRPump)) // 0x0101 CMD_MEALINS_STOP
- put(MsgBolusStart(aapsLogger, constraintChecker, danaRPump, 0.0)) // 0x0102 CMD_MEALINS_START_DATA
- put(MsgBolusStartWithSpeed(aapsLogger, constraintChecker, danaRPump, 0.0, 0)) // 0x0104 CMD_MEALINS_START_DATA_SPEED
- put(MsgBolusProgress(aapsLogger, resourceHelper, rxBus, danaRPump)) // 0x0202 CMD_PUMP_THIS_REMAINDER_MEAL_INS
- put(MsgStatusProfile(aapsLogger, danaRPump)) // 0x0204 CMD_PUMP_CALCULATION_SETTING
- put(MsgStatusTempBasal_v2(aapsLogger, danaRPump, dateUtil)) // 0x0205 CMD_PUMP_EXERCISE_MODE
- put(MsgStatusBolusExtended_v2(aapsLogger, danaRPump)) // 0x0207 CMD_PUMP_EXPANS_INS_I
- put(MsgStatusBasic(aapsLogger, danaRPump)) // 0x020A CMD_PUMP_INITVIEW_I
- put(MsgStatus(aapsLogger, danaRPump)) // 0x020B CMD_PUMP_STATUS
- put(MsgInitConnStatusTime(aapsLogger, rxBus, resourceHelper, danaRPump, danaRPlugin, danaRKoreanPlugin, configBuilderPlugin, commandQueue, dateUtil)) // 0x0301 CMD_PUMPINIT_TIME_INFO
- put(MsgInitConnStatusBolus(aapsLogger, rxBus, resourceHelper, danaRPump)) // 0x0302 CMD_PUMPINIT_BOLUS_INFO
- put(MsgInitConnStatusBasic(aapsLogger, danaRPump)) // 0x0303 CMD_PUMPINIT_INIT_INFO
- put(MsgInitConnStatusOption(aapsLogger, rxBus, resourceHelper, danaRPump, activePlugin)) // 0x0304 CMD_PUMPINIT_OPTION
- put(MsgSetTempBasalStart(aapsLogger, 0, 0)) // 0x0401 CMD_PUMPSET_EXERCISE_S
- put(MsgSetCarbsEntry(aapsLogger, 0, 0)) // 0x0402 CMD_PUMPSET_HIS_S
- put(MsgSetTempBasalStop(aapsLogger)) // 0x0403 CMD_PUMPSET_EXERCISE_STOP
- put(MsgSetExtendedBolusStop(aapsLogger)) // 0x0406 CMD_PUMPSET_EXPANS_INS_STOP
- put(MsgSetExtendedBolusStart(aapsLogger, constraintChecker, 0.0, 0)) // 0x0407 CMD_PUMPSET_EXPANS_INS_S
- put(MsgError(aapsLogger, rxBus, resourceHelper, danaRPump)) // 0x0601 CMD_PUMPOWAY_SYSTEM_STATUS
- put(MsgPCCommStart(aapsLogger)) // 0x3001 CMD_CONNECT
- put(MsgPCCommStop(aapsLogger)) // 0x3002 CMD_DISCONNECT
- put(MsgHistoryBolus(aapsLogger, rxBus, dateUtil)) // 0x3101 CMD_HISTORY_MEAL_INS
- put(MsgHistoryDailyInsulin(aapsLogger, rxBus, dateUtil)) // 0x3102 CMD_HISTORY_DAY_INS
- put(MsgHistoryGlucose(aapsLogger, rxBus, dateUtil)) // 0x3104 CMD_HISTORY_GLUCOSE
- put(MsgHistoryAlarm(aapsLogger, rxBus, dateUtil)) // 0x3105 CMD_HISTORY_ALARM
- put(MsgHistoryError(aapsLogger, rxBus, dateUtil)) // 0x3106 CMD_HISTORY_ERROR
- put(MsgHistoryCarbo(aapsLogger, rxBus, dateUtil)) // 0x3107 CMD_HISTORY_CARBOHY
- put(MsgHistoryRefill(aapsLogger, rxBus, dateUtil)) // 0x3108 CMD_HISTORY_REFILL
- put(MsgHistorySuspend(aapsLogger, rxBus, dateUtil)) // 0x3109 CMD_HISTORY_SUSPEND
- put(MsgHistoryBasalHour(aapsLogger, rxBus, dateUtil)) // 0x310A CMD_HISTORY_BASAL_HOUR
- put(MsgHistoryDone(aapsLogger, danaRPump)) // 0x31F1 CMD_HISTORY_DONT_USED
- put(MsgSettingBasal(aapsLogger, danaRPump, danaRPlugin)) // 0x3202 CMD_SETTING_V_BASAL_INS_I
- put(MsgSettingMeal(aapsLogger, rxBus, resourceHelper, danaRPump, danaRKoreanPlugin)) // 0x3203 CMD_SETTING_V_MEAL_SETTING_I
- put(MsgSettingProfileRatios(aapsLogger, danaRPump)) // 0x3204 CMD_SETTING_V_CCC_I
- put(MsgSettingMaxValues(aapsLogger, danaRPump)) // 0x3205 CMD_SETTING_V_MAX_VALUE_I
- put(MsgSettingBasalProfileAll(aapsLogger, danaRPump)) // 0x3206 CMD_SETTING_V_BASAL_PROFILE_ALL
- put(MsgSettingShippingInfo(aapsLogger, danaRPump)) // 0x3207 CMD_SETTING_V_SHIPPING_I
- put(MsgSettingGlucose(aapsLogger, danaRPump)) // 0x3209 CMD_SETTING_V_GLUCOSEandEASY
- put(MsgSettingPumpTime(aapsLogger, danaRPump, dateUtil)) // 0x320A CMD_SETTING_V_TIME_I
- put(MsgSettingUserOptions(aapsLogger, danaRPump)) // 0x320B CMD_SETTING_V_USER_OPTIONS
- put(MsgSettingActiveProfile(aapsLogger, danaRPump)) // 0x320C CMD_SETTING_V_PROFILE_NUMBER
- put(MsgSettingProfileRatiosAll(aapsLogger, danaRPump)) // 0x320D CMD_SETTING_V_CIR_CF_VALUE
- put(MsgSetSingleBasalProfile(aapsLogger, rxBus, resourceHelper, Array(24) { 0.0 })) // 0x3302 CMD_SETTING_BASAL_INS_S
- put(MsgSetBasalProfile(aapsLogger, rxBus, resourceHelper, 0.toByte(), Array(24) { 0.0 })) // 0x3306 CMD_SETTING_BASAL_PROFILE_S
- put(MsgSetUserOptions(aapsLogger, danaRPump)) // 0x330B CMD_SETTING_USER_OPTIONS_S
- put(MsgSetActivateBasalProfile(aapsLogger, 0.toByte())) // 0x330C CMD_SETTING_PROFILE_NUMBER_S
- put(MsgHistoryAllDone(aapsLogger, danaRPump)) // 0x41F1 CMD_HISTORY_ALL_DONE
- put(MsgHistoryAll(aapsLogger, rxBus, dateUtil)) // 0x41F2 CMD_HISTORY_ALL
- put(MsgHistoryNewDone(aapsLogger, danaRPump)) // 0x42F1 CMD_HISTORY_NEW_DONE
- put(MsgHistoryNew(aapsLogger, rxBus, dateUtil)) // 0x42F2 CMD_HISTORY_NEW
- put(MsgCheckValue_v2(aapsLogger, rxBus, resourceHelper, danaRPump, danaRPlugin, danaRKoreanPlugin, danaRv2Plugin, configBuilderPlugin, commandQueue)) // 0xF0F1 CMD_PUMP_CHECK_VALUE
- put(MsgStatusAPS_v2(aapsLogger, danaRPump)) // 0xE001 CMD_PUMPSTATUS_APS
- put(MsgSetAPSTempBasalStart_v2(aapsLogger, 0, false, false)) // 0xE002 CMD_PUMPSET_APSTEMP
- put(MsgHistoryEvents_v2(aapsLogger, resourceHelper, detailedBolusInfoStorage, danaRv2Plugin, rxBus, treatmentsPlugin, injector, dateUtil)) // 0xE003 CMD_GET_HISTORY
- put(MsgSetHistoryEntry_v2(aapsLogger, 0, 0, 0, 0)) // 0xE004 CMD_SET_HISTORY_ENTRY
- }
-
- override fun put(message: MessageBase) {
- messages[message.command] = message
- }
-
- override fun findMessage(command: Int): MessageBase {
- return messages[command] ?: MessageBase()
- }
-}
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/insight/InsightAlertService.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/insight/InsightAlertService.java
index 0812bb7614..50722c627c 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/insight/InsightAlertService.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/insight/InsightAlertService.java
@@ -8,7 +8,6 @@ import android.content.ServiceConnection;
import android.os.Binder;
import android.os.IBinder;
import android.os.Vibrator;
-import android.text.Html;
import androidx.annotation.Nullable;
import androidx.core.app.NotificationCompat;
@@ -34,6 +33,7 @@ import info.nightscout.androidaps.plugins.pump.insight.exceptions.InsightExcepti
import info.nightscout.androidaps.plugins.pump.insight.exceptions.app_layer_errors.AppLayerErrorException;
import info.nightscout.androidaps.plugins.pump.insight.utils.AlertUtils;
import info.nightscout.androidaps.plugins.pump.insight.utils.ExceptionTranslator;
+import info.nightscout.androidaps.utils.HtmlHelper;
import info.nightscout.androidaps.utils.resources.ResourceHelper;
public class InsightAlertService extends DaggerService implements InsightConnectionService.StateCallback {
@@ -299,7 +299,7 @@ public class InsightAlertService extends DaggerService implements InsightConnect
notificationBuilder.setContentTitle(alertUtils.getAlertCode(alert.getAlertType()) + " – " + alertUtils.getAlertTitle(alert.getAlertType()));
String description = alertUtils.getAlertDescription(alert);
if (description != null)
- notificationBuilder.setContentText(Html.fromHtml(description).toString());
+ notificationBuilder.setContentText(HtmlHelper.INSTANCE.fromHtml(description).toString());
Intent fullScreenIntent = new Intent(this, InsightAlertActivity.class);
PendingIntent fullScreenPendingIntent = PendingIntent.getActivity(this, 0, fullScreenIntent, PendingIntent.FLAG_UPDATE_CURRENT);
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/insight/LocalInsightFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/insight/LocalInsightFragment.java
index 2c1c9b6e91..cc4cdd9516 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/insight/LocalInsightFragment.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/insight/LocalInsightFragment.java
@@ -269,7 +269,7 @@ public class LocalInsightFragment extends DaggerFragment implements View.OnClick
private void getBatteryStatusItem(List statusItems) {
if (localInsightPlugin.getBatteryStatus() == null) return;
- statusItems.add(getStatusItem(resourceHelper.gs(R.string.pump_battery_label),
+ statusItems.add(getStatusItem(resourceHelper.gs(R.string.battery_label),
localInsightPlugin.getBatteryStatus().getBatteryAmount() + "%"));
}
@@ -280,7 +280,7 @@ public class LocalInsightFragment extends DaggerFragment implements View.OnClick
if (cartridgeStatus.isInserted())
status = DecimalFormatter.to2Decimal(localInsightPlugin.getCartridgeStatus().getRemainingAmount()) + "U";
else status = resourceHelper.gs(R.string.not_inserted);
- statusItems.add(getStatusItem(resourceHelper.gs(R.string.pump_reservoir_label), status));
+ statusItems.add(getStatusItem(resourceHelper.gs(R.string.reservoir_label), status));
}
private void getTDDItems(List statusItems) {
@@ -294,14 +294,14 @@ public class LocalInsightFragment extends DaggerFragment implements View.OnClick
private void getBaseBasalRateItem(List statusItems) {
if (localInsightPlugin.getActiveBasalRate() == null) return;
ActiveBasalRate activeBasalRate = localInsightPlugin.getActiveBasalRate();
- statusItems.add(getStatusItem(resourceHelper.gs(R.string.pump_basebasalrate_label),
+ statusItems.add(getStatusItem(resourceHelper.gs(R.string.basebasalrate_label),
DecimalFormatter.to2Decimal(activeBasalRate.getActiveBasalRate()) + " U/h (" + activeBasalRate.getActiveBasalProfileName() + ")"));
}
private void getTBRItem(List statusItems) {
if (localInsightPlugin.getActiveTBR() == null) return;
ActiveTBR activeTBR = localInsightPlugin.getActiveTBR();
- statusItems.add(getStatusItem(resourceHelper.gs(R.string.pump_tempbasal_label),
+ statusItems.add(getStatusItem(resourceHelper.gs(R.string.tempbasal_label),
resourceHelper.gs(R.string.tbr_formatter, activeTBR.getPercentage(), activeTBR.getInitialDuration() - activeTBR.getRemainingDuration(), activeTBR.getInitialDuration())));
}
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/insight/LocalInsightPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/insight/LocalInsightPlugin.java
index d44470bad1..f8d1cf1ce5 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/insight/LocalInsightPlugin.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/insight/LocalInsightPlugin.java
@@ -27,7 +27,6 @@ import javax.inject.Inject;
import javax.inject.Singleton;
import dagger.android.HasAndroidInjector;
-import info.nightscout.androidaps.BuildConfig;
import info.nightscout.androidaps.Config;
import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R;
@@ -39,6 +38,7 @@ import info.nightscout.androidaps.db.ExtendedBolus;
import info.nightscout.androidaps.db.Source;
import info.nightscout.androidaps.db.TDD;
import info.nightscout.androidaps.db.TemporaryBasal;
+import info.nightscout.androidaps.db.Treatment;
import info.nightscout.androidaps.events.EventInitializationChanged;
import info.nightscout.androidaps.events.EventRefreshOverview;
import info.nightscout.androidaps.interfaces.CommandQueueProvider;
@@ -46,6 +46,7 @@ import info.nightscout.androidaps.interfaces.Constraint;
import info.nightscout.androidaps.interfaces.ConstraintsInterface;
import info.nightscout.androidaps.interfaces.PluginDescription;
import info.nightscout.androidaps.interfaces.PluginType;
+import info.nightscout.androidaps.interfaces.ProfileFunction;
import info.nightscout.androidaps.interfaces.PumpDescription;
import info.nightscout.androidaps.interfaces.PumpInterface;
import info.nightscout.androidaps.interfaces.PumpPluginBase;
@@ -53,7 +54,6 @@ import info.nightscout.androidaps.logging.AAPSLogger;
import info.nightscout.androidaps.logging.LTag;
import info.nightscout.androidaps.plugins.bus.RxBusWrapper;
import info.nightscout.androidaps.plugins.common.ManufacturerType;
-import info.nightscout.androidaps.interfaces.ProfileFunction;
import info.nightscout.androidaps.plugins.general.actions.defs.CustomAction;
import info.nightscout.androidaps.plugins.general.actions.defs.CustomActionType;
import info.nightscout.androidaps.plugins.general.nsclient.NSUpload;
@@ -132,7 +132,6 @@ import info.nightscout.androidaps.plugins.pump.insight.exceptions.app_layer_erro
import info.nightscout.androidaps.plugins.pump.insight.exceptions.app_layer_errors.NoActiveTBRToCanceLException;
import info.nightscout.androidaps.plugins.pump.insight.utils.ExceptionTranslator;
import info.nightscout.androidaps.plugins.pump.insight.utils.ParameterBlockUtil;
-import info.nightscout.androidaps.db.Treatment;
import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin;
import info.nightscout.androidaps.utils.DateUtil;
import info.nightscout.androidaps.utils.TimeChangeType;
@@ -149,7 +148,9 @@ public class LocalInsightPlugin extends PumpPluginBase implements PumpInterface,
private final SP sp;
private final CommandQueueProvider commandQueue;
private final ProfileFunction profileFunction;
+ private final NSUpload nsUpload;
private final Context context;
+ private final UploadQueue uploadQueue;
private final DateUtil dateUtil;
public static final String ALERT_CHANNEL_ID = "AndroidAPS-InsightAlert";
@@ -209,7 +210,9 @@ public class LocalInsightPlugin extends PumpPluginBase implements PumpInterface,
SP sp,
CommandQueueProvider commandQueue,
ProfileFunction profileFunction,
+ NSUpload nsUpload,
Context context,
+ UploadQueue uploadQueue,
Config config,
DateUtil dateUtil
) {
@@ -230,7 +233,9 @@ public class LocalInsightPlugin extends PumpPluginBase implements PumpInterface,
this.sp = sp;
this.commandQueue = commandQueue;
this.profileFunction = profileFunction;
+ this.nsUpload = nsUpload;
this.context = context;
+ this.uploadQueue = uploadQueue;
this.dateUtil = dateUtil;
pumpDescription = new PumpDescription();
@@ -929,8 +934,8 @@ public class LocalInsightPlugin extends PumpPluginBase implements PumpInterface,
if (extendedBolus.durationInMinutes <= 0) {
final String _id = extendedBolus._id;
if (NSUpload.isIdValid(_id))
- NSUpload.removeCareportalEntryFromNS(_id);
- else UploadQueue.removeID("dbAdd", _id);
+ nsUpload.removeCareportalEntryFromNS(_id);
+ else uploadQueue.removeID("dbAdd", _id);
MainApp.getDbHelper().delete(extendedBolus);
} else
treatmentsPlugin.addToHistoryExtendedBolus(extendedBolus);
@@ -978,7 +983,7 @@ public class LocalInsightPlugin extends PumpPluginBase implements PumpInterface,
}
@NonNull @Override
- public JSONObject getJSONStatus(Profile profile, String profileName) {
+ public JSONObject getJSONStatus(Profile profile, String profileName, String version) {
long now = System.currentTimeMillis();
if (connectionService == null) return null;
if (System.currentTimeMillis() - connectionService.getLastConnected() > (60 * 60 * 1000)) {
@@ -991,7 +996,7 @@ public class LocalInsightPlugin extends PumpPluginBase implements PumpInterface,
final JSONObject extended = new JSONObject();
try {
status.put("timestamp", DateUtil.toISOString(connectionService.getLastConnected()));
- extended.put("Version", BuildConfig.VERSION_NAME + "-" + BuildConfig.BUILDVERSION);
+ extended.put("Version", version);
try {
extended.put("ActiveProfile", profileFunction.getProfileName());
} catch (Exception e) {
@@ -1451,8 +1456,8 @@ public class LocalInsightPlugin extends PumpPluginBase implements PumpInterface,
ExtendedBolus extendedBolus = MainApp.getDbHelper().getExtendedBolusByPumpId(bolusID.id);
if (extendedBolus != null) {
final String _id = extendedBolus._id;
- if (NSUpload.isIdValid(_id)) NSUpload.removeCareportalEntryFromNS(_id);
- else UploadQueue.removeID("dbAdd", _id);
+ if (NSUpload.isIdValid(_id)) nsUpload.removeCareportalEntryFromNS(_id);
+ else uploadQueue.removeID("dbAdd", _id);
MainApp.getDbHelper().delete(extendedBolus);
}
} else {
@@ -1583,7 +1588,7 @@ public class LocalInsightPlugin extends PumpPluginBase implements PumpInterface,
careportalEvent.eventType = CareportalEvent.NOTE;
careportalEvent.json = data.toString();
MainApp.getDbHelper().createOrUpdate(careportalEvent);
- NSUpload.uploadCareportalEntryToNS(data);
+ nsUpload.uploadCareportalEntryToNS(data);
} catch (JSONException e) {
aapsLogger.error("Unhandled exception", e);
}
@@ -1617,7 +1622,7 @@ public class LocalInsightPlugin extends PumpPluginBase implements PumpInterface,
careportalEvent.eventType = event;
careportalEvent.json = data.toString();
MainApp.getDbHelper().createOrUpdate(careportalEvent);
- NSUpload.uploadCareportalEntryToNS(data);
+ nsUpload.uploadCareportalEntryToNS(data);
} catch (JSONException e) {
aapsLogger.error("Unhandled exception", e);
}
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/insight/activities/InsightAlertActivity.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/insight/activities/InsightAlertActivity.java
index 65034d321a..c5121184ac 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/insight/activities/InsightAlertActivity.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/insight/activities/InsightAlertActivity.java
@@ -22,6 +22,7 @@ import info.nightscout.androidaps.plugins.pump.insight.InsightAlertService;
import info.nightscout.androidaps.plugins.pump.insight.descriptors.Alert;
import info.nightscout.androidaps.plugins.pump.insight.descriptors.AlertStatus;
import info.nightscout.androidaps.plugins.pump.insight.utils.AlertUtils;
+import info.nightscout.androidaps.utils.HtmlHelper;
public class InsightAlertActivity extends DaggerAppCompatActivity {
@@ -91,7 +92,7 @@ public class InsightAlertActivity extends DaggerAppCompatActivity {
if (description == null) this.errorDescription.setVisibility(View.GONE);
else {
this.errorDescription.setVisibility(View.VISIBLE);
- this.errorDescription.setText(Html.fromHtml(description));
+ this.errorDescription.setText(HtmlHelper.INSTANCE.fromHtml(description));
}
}
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/insight/app_layer/remote_control/DeliverBolusMessage.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/insight/app_layer/remote_control/DeliverBolusMessage.java
index f1b4c3f6de..e0d0f2461a 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/insight/app_layer/remote_control/DeliverBolusMessage.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/insight/app_layer/remote_control/DeliverBolusMessage.java
@@ -22,7 +22,7 @@ public class DeliverBolusMessage extends AppLayerMessage {
@Override
protected ByteBuf getData() {
ByteBuf byteBuf = new ByteBuf(22);
- byteBuf.putUInt16LE(805);
+ byteBuf.putUInt16LE(252);
byteBuf.putUInt16LE(BolusTypeIDs.IDS.getID(bolusType));
byteBuf.putUInt16LE(31);
byteBuf.putUInt16LE(0);
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/mdi/MDIPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/mdi/MDIPlugin.java
index b5d7fafb4e..44550ebea6 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/mdi/MDIPlugin.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/mdi/MDIPlugin.java
@@ -227,14 +227,14 @@ public class MDIPlugin extends PumpPluginBase implements PumpInterface {
}
@NonNull @Override
- public JSONObject getJSONStatus(Profile profile, String profileName) {
+ public JSONObject getJSONStatus(Profile profile, String profileName, String version) {
long now = System.currentTimeMillis();
JSONObject pump = new JSONObject();
JSONObject status = new JSONObject();
JSONObject extended = new JSONObject();
try {
status.put("status", "normal");
- extended.put("Version", BuildConfig.VERSION_NAME + "-" + BuildConfig.BUILDVERSION);
+ extended.put("Version", version);
try {
extended.put("ActiveProfile", profileName);
} catch (Exception e) {
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/MedtronicPumpPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/MedtronicPumpPlugin.java
index 95a3f68c12..77df3be676 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/MedtronicPumpPlugin.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/MedtronicPumpPlugin.java
@@ -201,7 +201,7 @@ public class MedtronicPumpPlugin extends PumpPluginAbstract implements PumpInter
if (pref.getKey().equals(getResourceHelper().gs(R.string.key_rileylink_mac_address))) {
String value = sp.getStringOrNull(R.string.key_rileylink_mac_address, null);
- pref.setSummary(value == null ? getResourceHelper().gs(R.string.rileylink_error_address_not_set_short) : value);
+ pref.setSummary(value == null ? getResourceHelper().gs(R.string.not_set_short) : value);
}
}
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/MedtronicCommunicationManager.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/MedtronicCommunicationManager.java
index 086dc92cd7..83ed08ddd0 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/MedtronicCommunicationManager.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/MedtronicCommunicationManager.java
@@ -87,9 +87,9 @@ public class MedtronicCommunicationManager extends RileyLinkCommunicationManager
}
@Override
- public E createResponseMessage(byte[] payload, Class clazz) {
+ public RLMessage createResponseMessage(byte[] payload) {
PumpMessage pumpMessage = new PumpMessage(aapsLogger, payload);
- return (E) pumpMessage;
+ return pumpMessage;
}
@Override
@@ -170,7 +170,7 @@ public class MedtronicCommunicationManager extends RileyLinkCommunicationManager
if (radioResponse.isValid()) {
- PumpMessage pumpResponse = createResponseMessage(radioResponse.getPayload(), PumpMessage.class);
+ PumpMessage pumpResponse = (PumpMessage) createResponseMessage(radioResponse.getPayload());
if (!pumpResponse.isValid()) {
aapsLogger.warn(LTag.PUMPCOMM, "Response is invalid ! [interrupted={}, timeout={}]", rfSpyResponse.wasInterrupted(),
@@ -551,8 +551,8 @@ public class MedtronicCommunicationManager extends RileyLinkCommunicationManager
// All pump communications go through this function.
- private PumpMessage sendAndListen(RLMessage msg, int timeout_ms) throws RileyLinkCommunicationException {
- return sendAndListen(msg, timeout_ms, PumpMessage.class);
+ protected PumpMessage sendAndListen(RLMessage msg, int timeout_ms) throws RileyLinkCommunicationException {
+ return sendAndListen(msg, timeout_ms);
}
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/data/MedtronicHistoryData.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/data/MedtronicHistoryData.java
index d8f5c47b4f..76f011da16 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/data/MedtronicHistoryData.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/data/MedtronicHistoryData.java
@@ -78,6 +78,7 @@ public class MedtronicHistoryData {
private final AAPSLogger aapsLogger;
private final SP sp;
private final ActivePluginProvider activePlugin;
+ private final NSUpload nsUpload;
private final MedtronicUtil medtronicUtil;
private final MedtronicPumpHistoryDecoder medtronicPumpHistoryDecoder;
@@ -106,6 +107,7 @@ public class MedtronicHistoryData {
AAPSLogger aapsLogger,
SP sp,
ActivePluginProvider activePlugin,
+ NSUpload nsUpload,
MedtronicUtil medtronicUtil,
MedtronicPumpHistoryDecoder medtronicPumpHistoryDecoder
) {
@@ -115,6 +117,7 @@ public class MedtronicHistoryData {
this.aapsLogger = aapsLogger;
this.sp = sp;
this.activePlugin = activePlugin;
+ this.nsUpload = nsUpload;
this.medtronicUtil = medtronicUtil;
this.medtronicPumpHistoryDecoder = medtronicPumpHistoryDecoder;
}
@@ -543,7 +546,7 @@ public class MedtronicHistoryData {
careportalEvent.eventType = event;
careportalEvent.json = data.toString();
MainApp.getDbHelper().createOrUpdate(careportalEvent);
- NSUpload.uploadCareportalEntryToNS(data);
+ nsUpload.uploadCareportalEntryToNS(data);
} catch (JSONException e) {
aapsLogger.error("Unhandled exception", e);
}
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/data/dto/BasalProfile.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/data/dto/BasalProfile.java
index 61b235f1d2..f5ff77cf72 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/data/dto/BasalProfile.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/data/dto/BasalProfile.java
@@ -363,10 +363,6 @@ public class BasalProfile {
}
- private boolean isLogEnabled() {
- return L.isEnabled(LTag.PUMPCOMM);
- }
-
public boolean verify(PumpType pumpType) {
try {
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/data/dto/TempBasalPair.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/data/dto/TempBasalPair.java
index caac54e122..bf3e771b1e 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/data/dto/TempBasalPair.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/data/dto/TempBasalPair.java
@@ -42,8 +42,7 @@ public class TempBasalPair extends info.nightscout.androidaps.plugins.pump.commo
public TempBasalPair(AAPSLogger aapsLogger, byte[] response) {
super();
- if (L.isEnabled(LTag.PUMPCOMM))
- aapsLogger.debug(LTag.PUMPBTCOMM, "Received TempBasal response: " + ByteUtil.getHex(response));
+ aapsLogger.debug(LTag.PUMPBTCOMM, "Received TempBasal response: " + ByteUtil.getHex(response));
isPercent = response[0] == 1;
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/dialog/MedtronicHistoryActivity.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/dialog/MedtronicHistoryActivity.java
index cb3aad5f94..1d5d300b49 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/dialog/MedtronicHistoryActivity.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/dialog/MedtronicHistoryActivity.java
@@ -23,11 +23,13 @@ import info.nightscout.androidaps.activities.NoSplashAppCompatActivity;
import info.nightscout.androidaps.plugins.pump.common.defs.PumpHistoryEntryGroup;
import info.nightscout.androidaps.plugins.pump.medtronic.comm.history.pump.PumpHistoryEntry;
import info.nightscout.androidaps.plugins.pump.medtronic.data.MedtronicHistoryData;
+import info.nightscout.androidaps.utils.resources.ResourceHelper;
public class MedtronicHistoryActivity extends NoSplashAppCompatActivity {
@Inject MedtronicHistoryData medtronicHistoryData;
+ @Inject ResourceHelper resourceHelper;
Spinner historyTypeSpinner;
TextView statusView;
@@ -119,7 +121,7 @@ public class MedtronicHistoryActivity extends NoSplashAppCompatActivity {
statusView.setVisibility(View.GONE);
- typeListFull = getTypeList(PumpHistoryEntryGroup.getList());
+ typeListFull = getTypeList(PumpHistoryEntryGroup.getTranslatedList(resourceHelper));
ArrayAdapter spinnerAdapter = new ArrayAdapter<>(this, R.layout.spinner_centered, typeListFull);
historyTypeSpinner.setAdapter(spinnerAdapter);
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/service/RileyLinkMedtronicService.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/service/RileyLinkMedtronicService.java
index 7c6a55d092..7ae299036d 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/service/RileyLinkMedtronicService.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/service/RileyLinkMedtronicService.java
@@ -61,6 +61,11 @@ public class RileyLinkMedtronicService extends RileyLinkService {
}
+ @Override public void onCreate() {
+ super.onCreate();
+ aapsLogger.debug(LTag.PUMPCOMM, "RileyLinkMedtronicService newly created");
+ }
+
@Override
public void onConfigurationChanged(Configuration newConfig) {
aapsLogger.warn(LTag.PUMPCOMM, "onConfigurationChanged");
@@ -314,7 +319,7 @@ public class RileyLinkMedtronicService extends RileyLinkService {
return false;
}
- RileyLinkEncodingType newEncodingType = RileyLinkEncodingType.getByDescription(encodingTypeStr);
+ RileyLinkEncodingType newEncodingType = RileyLinkEncodingType.getByDescription(encodingTypeStr, resourceHelper);
if (encodingType == null) {
encodingType = newEncodingType;
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/OmnipodFragment.kt b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/OmnipodFragment.kt
index 6dba697009..843beed61f 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/OmnipodFragment.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/OmnipodFragment.kt
@@ -100,7 +100,7 @@ class OmnipodFragment : DaggerFragment() {
omnipod_refresh.setOnClickListener {
if (omnipodPumpPlugin.rileyLinkService?.verifyConfiguration() != true) {
- OmnipodUtil.displayNotConfiguredDialog(context)
+ displayNotConfiguredDialog()
} else {
omnipod_refresh.isEnabled = false
omnipodPumpPlugin.addPodStatusRequest(OmnipodStatusRequest.GetPodState);
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/OmnipodPumpPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/OmnipodPumpPlugin.java
index 0c51b5901c..76d39f7318 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/OmnipodPumpPlugin.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/OmnipodPumpPlugin.java
@@ -24,7 +24,6 @@ import javax.inject.Inject;
import javax.inject.Singleton;
import dagger.android.HasAndroidInjector;
-import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R;
import info.nightscout.androidaps.activities.ErrorHelperActivity;
import info.nightscout.androidaps.data.DetailedBolusInfo;
@@ -91,8 +90,6 @@ import io.reactivex.schedulers.Schedulers;
public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPumpPluginInterface, RileyLinkPumpDevice {
// TODO Dagger (maybe done)
- private static OmnipodPumpPlugin plugin = null;
- private RileyLinkServiceData rileyLinkServiceData;
private ServiceTaskExecutor serviceTaskExecutor;
private RileyLinkOmnipodService rileyLinkOmnipodService;
private OmnipodUtil omnipodUtil;
@@ -151,11 +148,9 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPump
PumpType.Insulet_Omnipod,
injector, resourceHelper, aapsLogger, commandQueue, rxBus, activePlugin, sp, context, fabricPrivacy, dateUtil
);
- this.rileyLinkServiceData = rileyLinkServiceData;
this.serviceTaskExecutor = serviceTaskExecutor;
displayConnectionMessages = false;
- OmnipodPumpPlugin.plugin = this;
this.omnipodUtil = omnipodUtil;
this.omnipodPumpStatus = omnipodPumpStatus;
@@ -250,14 +245,6 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPump
}
- @Deprecated
- public static OmnipodPumpPlugin getPlugin() {
- if (plugin == null)
- throw new IllegalStateException("Plugin not injected jet");
- return plugin;
- }
-
-
@Override
protected void onStart() {
super.onStart();
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/OmnipodCommunicationManager.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/OmnipodCommunicationManager.java
index e77befd258..89b6a43559 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/OmnipodCommunicationManager.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/OmnipodCommunicationManager.java
@@ -16,11 +16,8 @@ import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.RileyLink
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.data.RLMessage;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.defs.RLMessageType;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.defs.RileyLinkBLEError;
-import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.RileyLinkServiceData;
-import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.tasks.ServiceTaskExecutor;
import info.nightscout.androidaps.plugins.pump.common.utils.ByteUtil;
import info.nightscout.androidaps.plugins.pump.medtronic.defs.PumpDeviceState;
-import info.nightscout.androidaps.plugins.pump.omnipod.OmnipodPumpPlugin;
import info.nightscout.androidaps.plugins.pump.omnipod.comm.action.OmnipodAction;
import info.nightscout.androidaps.plugins.pump.omnipod.comm.exception.CommunicationException;
import info.nightscout.androidaps.plugins.pump.omnipod.comm.exception.IllegalMessageAddressException;
@@ -94,8 +91,8 @@ public class OmnipodCommunicationManager extends RileyLinkCommunicationManager {
}
@Override
- public E createResponseMessage(byte[] payload, Class clazz) {
- return (E) new OmnipodPacket(payload);
+ public RLMessage createResponseMessage(byte[] payload) {
+ return new OmnipodPacket(payload);
}
@Override
@@ -301,7 +298,7 @@ public class OmnipodCommunicationManager extends RileyLinkCommunicationManager {
OmnipodPacket ack = createAckPacket(podState, packetAddress, messageAddress);
boolean quiet = false;
while (!quiet) try {
- sendAndListen(ack, 300, 1, 0, 40, OmnipodPacket.class);
+ sendAndListen(ack, 300, 1, 0, 40);
} catch (RileyLinkCommunicationException ex) {
if (RileyLinkBLEError.Timeout.equals(ex.getErrorCode())) {
quiet = true;
@@ -333,7 +330,7 @@ public class OmnipodCommunicationManager extends RileyLinkCommunicationManager {
while (System.currentTimeMillis() < timeoutTime) {
OmnipodPacket response = null;
try {
- response = sendAndListen(packet, responseTimeoutMilliseconds, repeatCount, 9, preambleExtensionMilliseconds, OmnipodPacket.class);
+ response = (OmnipodPacket) sendAndListen(packet, responseTimeoutMilliseconds, repeatCount, 9, preambleExtensionMilliseconds);
} catch (RileyLinkCommunicationException | OmnipodException ex) {
aapsLogger.debug(LTag.PUMPBTCOMM, "Ignoring exception in exchangePackets: " + ex.getClass().getSimpleName() + ": " + ex.getMessage());
continue;
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/defs/OmnipodPumpPluginInterface.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/defs/OmnipodPumpPluginInterface.java
index f2066ebb2b..0026d41f97 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/defs/OmnipodPumpPluginInterface.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/defs/OmnipodPumpPluginInterface.java
@@ -10,6 +10,7 @@ public interface OmnipodPumpPluginInterface extends PumpInterface {
void setDriverState(OmnipodDriverState state);
+ @Deprecated
RxBusWrapper getRxBus();
}
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dialogs/PodHistoryActivity.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dialogs/PodHistoryActivity.java
index d98721ff15..bfbdbfc9d6 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dialogs/PodHistoryActivity.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dialogs/PodHistoryActivity.java
@@ -148,7 +148,7 @@ public class PodHistoryActivity extends NoSplashAppCompatActivity {
statusView.setVisibility(View.GONE);
- typeListFull = getTypeList(PumpHistoryEntryGroup.getList());
+ typeListFull = getTypeList(PumpHistoryEntryGroup.getTranslatedList(resourceHelper));
ArrayAdapter spinnerAdapter = new ArrayAdapter<>(this, R.layout.spinner_centered, typeListFull);
historyTypeSpinner.setAdapter(spinnerAdapter);
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dialogs/wizard/pages/InitPodRefreshAction.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dialogs/wizard/pages/InitPodRefreshAction.java
index 37c6d420f7..70dac25789 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dialogs/wizard/pages/InitPodRefreshAction.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dialogs/wizard/pages/InitPodRefreshAction.java
@@ -35,6 +35,7 @@ public class InitPodRefreshAction extends AbstractCancelAction implements Finish
@Inject OmnipodUtil omnipodUtil;
@Inject AAPSLogger aapsLogger;
@Inject SP sp;
+ @Inject NSUpload nsUpload;
public InitPodRefreshAction(HasAndroidInjector injector, PodManagementActivity podManagementActivity, PodActionType actionType) {
injector.androidInjector().inject(this);
@@ -86,7 +87,7 @@ public class InitPodRefreshAction extends AbstractCancelAction implements Finish
careportalEvent.eventType = event;
careportalEvent.json = data.toString();
MainApp.getDbHelper().createOrUpdate(careportalEvent);
- NSUpload.uploadCareportalEntryToNS(data);
+ nsUpload.uploadCareportalEntryToNS(data);
} catch (JSONException e) {
aapsLogger.error(LTag.PUMPCOMM, "Unhandled exception when uploading SiteChange event.", e);
}
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/driver/comm/AapsOmnipodManager.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/driver/comm/AapsOmnipodManager.java
index 6632cd0213..5a47672e8c 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/driver/comm/AapsOmnipodManager.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/driver/comm/AapsOmnipodManager.java
@@ -425,7 +425,7 @@ public class AapsOmnipodManager implements OmnipodCommunicationManagerInterface
pumpStatus.tempBasalEnd = DateTimeUtil.getTimeInFutureFromMinutes(time, tempBasalPair.getDurationMinutes());
pumpStatus.tempBasalPumpId = pumpId;
- TemporaryBasal tempStart = new TemporaryBasal() //
+ TemporaryBasal tempStart = new TemporaryBasal(injector) //
.date(time) //
.duration(tempBasalPair.getDurationMinutes()) //
.absolute(tempBasalPair.getInsulinRate()) //
@@ -561,7 +561,7 @@ public class AapsOmnipodManager implements OmnipodCommunicationManagerInterface
addSuccessToHistory(time, PodHistoryEntryType.CancelTemporaryBasal, null);
- TemporaryBasal temporaryBasal = new TemporaryBasal() //
+ TemporaryBasal temporaryBasal = new TemporaryBasal(injector) //
.date(time) //
.duration(0) //
.pumpId(pumpStatus.tempBasalPumpId)
@@ -709,7 +709,7 @@ public class AapsOmnipodManager implements OmnipodCommunicationManagerInterface
Intent intent = new Intent(context, ErrorHelperActivity.class);
intent.putExtra("soundid", sound == null ? 0 : sound);
intent.putExtra("status", message);
- intent.putExtra("title", MainApp.gs(R.string.treatmentdeliveryerror));
+ intent.putExtra("title", resourceHelper.gs(R.string.treatmentdeliveryerror));
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(intent);
}
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/util/OmnipodUtil.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/util/OmnipodUtil.java
index f002989e3c..dfaa18bcaa 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/util/OmnipodUtil.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/util/OmnipodUtil.java
@@ -35,6 +35,7 @@ import info.nightscout.androidaps.plugins.pump.omnipod.driver.OmnipodDriverState
import info.nightscout.androidaps.plugins.pump.omnipod.driver.OmnipodPumpStatus;
import info.nightscout.androidaps.plugins.pump.omnipod.events.EventOmnipodDeviceStatusChange;
import info.nightscout.androidaps.utils.alertDialogs.OKDialog;
+import info.nightscout.androidaps.utils.resources.ResourceHelper;
import info.nightscout.androidaps.utils.sharedPreferences.SP;
/**
@@ -49,6 +50,7 @@ public class OmnipodUtil {
private final OmnipodPumpStatus omnipodPumpStatus;
private final ActivePluginProvider activePlugins;
private final SP sp;
+ private final ResourceHelper resourceHelper;
private final HasAndroidInjector injector;
private boolean lowLevelDebug = true;
@@ -67,6 +69,7 @@ public class OmnipodUtil {
RileyLinkUtil rileyLinkUtil,
OmnipodPumpStatus omnipodPumpStatus,
SP sp,
+ ResourceHelper resourceHelper,
ActivePluginProvider activePlugins,
HasAndroidInjector injector
) {
@@ -75,6 +78,7 @@ public class OmnipodUtil {
this.rileyLinkUtil = rileyLinkUtil;
this.omnipodPumpStatus = omnipodPumpStatus;
this.sp = sp;
+ this.resourceHelper = resourceHelper;
this.activePlugins = activePlugins;
this.injector = injector;
}
@@ -102,11 +106,6 @@ public class OmnipodUtil {
rileyLinkUtil.getRileyLinkHistory().add(new RLHistoryItem(currentCommand));
}
- public static void displayNotConfiguredDialog(Context context) {
- OKDialog.showConfirmation(context, MainApp.gs(R.string.combo_warning),
- MainApp.gs(R.string.omnipod_error_operation_not_possible_no_configuration), (Runnable) null);
- }
-
public OmnipodDriverState getDriverState() {
return driverState;
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod_dash/OmnipodDashPumpPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod_dash/OmnipodDashPumpPlugin.java
index d4f8e8dc85..29e21e41ab 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod_dash/OmnipodDashPumpPlugin.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod_dash/OmnipodDashPumpPlugin.java
@@ -50,7 +50,6 @@ public class OmnipodDashPumpPlugin extends OmnipodPumpPlugin implements OmnipodP
// TODO Dagger
//private static final Logger LOG = LoggerFactory.getLogger(L.PUMP);
- protected static OmnipodDashPumpPlugin plugin = null;
//private RileyLinkOmnipodService omnipodService;
//private OmnipodPumpStatus pumpStatusLocal = null;
@@ -136,14 +135,6 @@ public class OmnipodDashPumpPlugin extends OmnipodPumpPlugin implements OmnipodP
// };
}
- @Deprecated
- public static OmnipodDashPumpPlugin getPlugin() {
- if (plugin == null)
- throw new IllegalStateException("Plugin not injected jet");
- return plugin;
- }
-
-
private String getLogPrefix() {
return "OmnipodPlugin::";
}
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/virtual/VirtualPumpPlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/pump/virtual/VirtualPumpPlugin.kt
index 3db377a230..2ef49e95b5 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/virtual/VirtualPumpPlugin.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/virtual/VirtualPumpPlugin.kt
@@ -2,7 +2,6 @@ package info.nightscout.androidaps.plugins.pump.virtual
import android.os.SystemClock
import dagger.android.HasAndroidInjector
-import info.nightscout.androidaps.BuildConfig
import info.nightscout.androidaps.Config
import info.nightscout.androidaps.R
import info.nightscout.androidaps.data.DetailedBolusInfo
@@ -67,16 +66,6 @@ class VirtualPumpPlugin @Inject constructor(
), PumpInterface {
- companion object {
- private lateinit var virtualPumpPlugin: VirtualPumpPlugin
-
- @Deprecated("Use dagger to get an instance")
- fun getPlugin(): VirtualPumpPlugin {
- checkNotNull(virtualPumpPlugin) { "Accessing VirtualPumpPlugin before first instantiation" }
- return virtualPumpPlugin
- }
- }
-
private val disposable = CompositeDisposable()
var batteryPercent = 50
var reservoirInUnits = 50
@@ -87,7 +76,6 @@ class VirtualPumpPlugin @Inject constructor(
private val pumpDescription = PumpDescription()
init {
- virtualPumpPlugin = this
pumpDescription.isBolusCapable = true
pumpDescription.bolusStep = 0.1
pumpDescription.isExtendedBolusCapable = true
@@ -337,7 +325,7 @@ class VirtualPumpPlugin @Inject constructor(
return result
}
- override fun getJSONStatus(profile: Profile, profileName: String): JSONObject {
+ override fun getJSONStatus(profile: Profile, profileName: String, version: String): JSONObject {
val now = System.currentTimeMillis()
if (!sp.getBoolean("virtualpump_uploadstatus", false)) {
return JSONObject()
@@ -349,7 +337,7 @@ class VirtualPumpPlugin @Inject constructor(
try {
battery.put("percent", batteryPercent)
status.put("status", "normal")
- extended.put("Version", BuildConfig.VERSION_NAME + "-" + BuildConfig.BUILDVERSION)
+ extended.put("Version", version)
try {
extended.put("ActiveProfile", profileName)
} catch (ignored: Exception) {
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/sensitivity/SensitivityOref1Plugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/sensitivity/SensitivityOref1Plugin.java
index 5740c7a5d1..fec1b6d960 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/sensitivity/SensitivityOref1Plugin.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/sensitivity/SensitivityOref1Plugin.java
@@ -2,6 +2,8 @@ package info.nightscout.androidaps.plugins.sensitivity;
import androidx.collection.LongSparseArray;
+import org.jetbrains.annotations.NotNull;
+
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@@ -61,7 +63,7 @@ public class SensitivityOref1Plugin extends AbstractSensitivityPlugin {
this.dateUtil = dateUtil;
}
- @Override
+ @NotNull @Override
public AutosensResult detectSensitivity(IobCobCalculatorInterface iobCobCalculatorPlugin, long fromTime, long toTime) {
// todo this method is called from the IobCobCalculatorPlugin, which leads to a circular
// dependency, this should be avoided
@@ -92,7 +94,7 @@ public class SensitivityOref1Plugin extends AbstractSensitivityPlugin {
//[0] = 8 hour
//[1] = 24 hour
//Deviationshour has DeviationsArray
- List deviationsHour = Arrays.asList(new ArrayList(), new ArrayList());
+ List> deviationsHour = Arrays.asList(new ArrayList<>(), new ArrayList<>());
List pastSensitivityArray = Arrays.asList("", "");
List sensResultArray = Arrays.asList("", "");
List ratioArray = Arrays.asList(0d, 0d);
@@ -118,7 +120,7 @@ public class SensitivityOref1Plugin extends AbstractSensitivityPlugin {
//hoursegment = 0 = 8 hour
//hoursegment = 1 = 24 hour
while (hoursegment < deviationsHour.size()) {
- ArrayList deviationsArray = deviationsHour.get(hoursegment);
+ ArrayList deviationsArray = deviationsHour.get(hoursegment);
String pastSensitivity = pastSensitivityArray.get(hoursegment);
// reset deviations after site change
@@ -144,8 +146,7 @@ public class SensitivityOref1Plugin extends AbstractSensitivityPlugin {
deviationsArray.add(deviation);
- for (int i = 0; i < autosensData.extraDeviation.size(); i++)
- deviationsArray.add(autosensData.extraDeviation.get(i));
+ deviationsArray.addAll(autosensData.extraDeviation);
if (deviationsArray.size() > deviationCategory.get(hoursegment)) {
deviationsArray.remove(0);
@@ -170,13 +171,12 @@ public class SensitivityOref1Plugin extends AbstractSensitivityPlugin {
// this dampens any large sensitivity changes detected based on too little data, without ignoring them completely
for (int i = 0; i < deviationsHour.size(); i++) {
- ArrayList deviations = deviationsHour.get(i);
+ ArrayList deviations = deviationsHour.get(i);
getAapsLogger().debug(LTag.AUTOSENS, "Using most recent " + deviations.size() + " deviations");
if (deviations.size() < deviationCategory.get(i)) {
int pad = (int) Math.round((1 - (double) deviations.size() / deviationCategory.get(i)) * 18);
getAapsLogger().debug(LTag.AUTOSENS, "Adding " + pad + " more zero deviations");
for (int d = 0; d < pad; d++) {
- ;
deviations.add(0d);
}
}
@@ -190,11 +190,7 @@ public class SensitivityOref1Plugin extends AbstractSensitivityPlugin {
ArrayList deviationsArray = deviationsHour.get(hourused);
String pastSensitivity = pastSensitivityArray.get(hourused);
String sensResult = "(8 hours) ";
- String senstime = sensResult;
- if (hourused == 1) {
- senstime = "(24 hours) ";
- sensResult = senstime;
- }
+ if (hourused == 1) sensResult = "(24 hours) ";
String ratioLimit = "";
Double[] deviations = new Double[deviationsArray.size()];
@@ -212,10 +208,10 @@ public class SensitivityOref1Plugin extends AbstractSensitivityPlugin {
double basalOff = 0;
if (pSensitive < 0) { // sensitive
- basalOff = pSensitive * (60 / 5) / Profile.toMgdl(sens, profile.getUnits());
+ basalOff = pSensitive * (60.0 / 5) / Profile.toMgdl(sens, profile.getUnits());
sensResult += "Excess insulin sensitivity detected";
} else if (pResistant > 0) { // resistant
- basalOff = pResistant * (60 / 5) / Profile.toMgdl(sens, profile.getUnits());
+ basalOff = pResistant * (60.0 / 5) / Profile.toMgdl(sens, profile.getUnits());
sensResult += "Excess insulin resistance detected";
} else {
sensResult += "Sensitivity normal";
@@ -239,7 +235,7 @@ public class SensitivityOref1Plugin extends AbstractSensitivityPlugin {
if (ratioArray.get(0) < ratioArray.get(1)) {
key = 0;
}
- String message = hoursDetection.get(key) + " of sensitivity used";
+ //String message = hoursDetection.get(key) + " of sensitivity used";
AutosensResult output = fillResult(ratioArray.get(key), current.cob, pastSensitivityArray.get(key), ratioLimitArray.get(key),
sensResultArray.get(key) + comparison, deviationsHour.get(key).size());
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/source/DexcomPlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/source/DexcomPlugin.kt
index 7e854f7e96..41d1c07ddc 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/source/DexcomPlugin.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/source/DexcomPlugin.kt
@@ -31,7 +31,8 @@ class DexcomPlugin @Inject constructor(
private val sp: SP,
private val mainApp: MainApp,
resourceHelper: ResourceHelper,
- aapsLogger: AAPSLogger
+ aapsLogger: AAPSLogger,
+ private val nsUpload: NSUpload
) : PluginBase(PluginDescription()
.mainType(PluginType.BGSOURCE)
.fragmentClass(BGSourceFragment::class.java.name)
@@ -78,10 +79,10 @@ class DexcomPlugin @Inject constructor(
bgReading.raw = 0.0
if (MainApp.getDbHelper().createIfNotExists(bgReading, "Dexcom$sensorType")) {
if (sp.getBoolean(R.string.key_dexcomg5_nsupload, false)) {
- NSUpload.uploadBg(bgReading, "AndroidAPS-Dexcom$sensorType")
+ nsUpload.uploadBg(bgReading, "AndroidAPS-Dexcom$sensorType")
}
if (sp.getBoolean(R.string.key_dexcomg5_xdripupload, false)) {
- NSUpload.sendToXdrip(bgReading)
+ nsUpload.sendToXdrip(bgReading)
}
}
}
@@ -108,7 +109,7 @@ class DexcomPlugin @Inject constructor(
careportalEvent.eventType = CareportalEvent.BGCHECK
careportalEvent.json = jsonObject.toString()
MainApp.getDbHelper().createOrUpdate(careportalEvent)
- NSUpload.uploadCareportalEntryToNS(jsonObject)
+ nsUpload.uploadCareportalEntryToNS(jsonObject)
}
}
}
@@ -128,7 +129,7 @@ class DexcomPlugin @Inject constructor(
careportalEvent.eventType = CareportalEvent.SENSORCHANGE
careportalEvent.json = jsonObject.toString()
MainApp.getDbHelper().createOrUpdate(careportalEvent)
- NSUpload.uploadCareportalEntryToNS(jsonObject)
+ nsUpload.uploadCareportalEntryToNS(jsonObject)
}
}
}
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/source/EversensePlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/source/EversensePlugin.kt
index 6b0021fbcf..9141d57214 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/source/EversensePlugin.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/source/EversensePlugin.kt
@@ -29,7 +29,8 @@ class EversensePlugin @Inject constructor(
private val sp: SP,
resourceHelper: ResourceHelper,
aapsLogger: AAPSLogger,
- private val dateUtil: DateUtil
+ private val dateUtil: DateUtil,
+ private val nsUpload: NSUpload
) : PluginBase(PluginDescription()
.mainType(PluginType.BGSOURCE)
.fragmentClass(BGSourceFragment::class.java.name)
@@ -77,10 +78,10 @@ class EversensePlugin @Inject constructor(
bgReading.raw = 0.0
val isNew = MainApp.getDbHelper().createIfNotExists(bgReading, "Eversense")
if (isNew && sp.getBoolean(R.string.key_dexcomg5_nsupload, false)) {
- NSUpload.uploadBg(bgReading, "AndroidAPS-Eversense")
+ nsUpload.uploadBg(bgReading, "AndroidAPS-Eversense")
}
if (isNew && sp.getBoolean(R.string.key_dexcomg5_xdripupload, false)) {
- NSUpload.sendToXdrip(bgReading)
+ nsUpload.sendToXdrip(bgReading)
}
}
}
@@ -103,7 +104,7 @@ class EversensePlugin @Inject constructor(
data.put("glucoseType", "Finger")
data.put("glucose", calibrationGlucoseLevels[i])
data.put("units", Constants.MGDL)
- NSUpload.uploadCareportalEntryToNS(data)
+ nsUpload.uploadCareportalEntryToNS(data)
}
} catch (e: JSONException) {
aapsLogger.error("Unhandled exception", e)
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/source/PoctechPlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/source/PoctechPlugin.kt
index c33cfaee0f..2032dd4479 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/source/PoctechPlugin.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/source/PoctechPlugin.kt
@@ -26,7 +26,8 @@ class PoctechPlugin @Inject constructor(
injector: HasAndroidInjector,
resourceHelper: ResourceHelper,
aapsLogger: AAPSLogger,
- private val sp: SP
+ private val sp: SP,
+ private val nsUpload: NSUpload
) : PluginBase(PluginDescription()
.mainType(PluginType.BGSOURCE)
.fragmentClass(BGSourceFragment::class.java.name)
@@ -58,10 +59,10 @@ class PoctechPlugin @Inject constructor(
if (safeGetString(json, "units", Constants.MGDL) == "mmol/L") bgReading.value = bgReading.value * Constants.MMOLL_TO_MGDL
val isNew = MainApp.getDbHelper().createIfNotExists(bgReading, "Poctech")
if (isNew && sp.getBoolean(R.string.key_dexcomg5_nsupload, false)) {
- NSUpload.uploadBg(bgReading, "AndroidAPS-Poctech")
+ nsUpload.uploadBg(bgReading, "AndroidAPS-Poctech")
}
if (isNew && sp.getBoolean(R.string.key_dexcomg5_xdripupload, false)) {
- NSUpload.sendToXdrip(bgReading)
+ nsUpload.sendToXdrip(bgReading)
}
}
} catch (e: JSONException) {
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/source/TomatoPlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/source/TomatoPlugin.kt
index db4c658614..1ba7958b61 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/source/TomatoPlugin.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/source/TomatoPlugin.kt
@@ -22,7 +22,8 @@ class TomatoPlugin @Inject constructor(
injector: HasAndroidInjector,
resourceHelper: ResourceHelper,
aapsLogger: AAPSLogger,
- private val sp: SP
+ private val sp: SP,
+ private val nsUpload: NSUpload
) : PluginBase(PluginDescription()
.mainType(PluginType.BGSOURCE)
.fragmentClass(BGSourceFragment::class.java.name)
@@ -46,10 +47,10 @@ class TomatoPlugin @Inject constructor(
bgReading.date = bundle.getLong("com.fanqies.tomatofn.Extras.Time")
val isNew = MainApp.getDbHelper().createIfNotExists(bgReading, "Tomato")
if (isNew && sp.getBoolean(R.string.key_dexcomg5_nsupload, false)) {
- NSUpload.uploadBg(bgReading, "AndroidAPS-Tomato")
+ nsUpload.uploadBg(bgReading, "AndroidAPS-Tomato")
}
if (isNew && sp.getBoolean(R.string.key_dexcomg5_xdripupload, false)) {
- NSUpload.sendToXdrip(bgReading)
+ nsUpload.sendToXdrip(bgReading)
}
}
}
\ No newline at end of file
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/treatments/TreatmentService.java b/app/src/main/java/info/nightscout/androidaps/plugins/treatments/TreatmentService.java
index f43ece03d8..60bd9b9b8c 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/treatments/TreatmentService.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/treatments/TreatmentService.java
@@ -38,6 +38,7 @@ import info.nightscout.androidaps.events.Event;
import info.nightscout.androidaps.events.EventNsTreatment;
import info.nightscout.androidaps.events.EventReloadTreatmentData;
import info.nightscout.androidaps.events.EventTreatmentChange;
+import info.nightscout.androidaps.interfaces.DatabaseHelperInterface;
import info.nightscout.androidaps.logging.AAPSLogger;
import info.nightscout.androidaps.logging.LTag;
import info.nightscout.androidaps.plugins.bus.RxBusWrapper;
@@ -60,6 +61,7 @@ public class TreatmentService extends OrmLiteBaseService {
@Inject FabricPrivacy fabricPrivacy;
@Inject RxBusWrapper rxBus;
@Inject MedtronicPumpPlugin medtronicPumpPlugin;
+ @Inject DatabaseHelperInterface databaseHelper;
private CompositeDisposable disposable = new CompositeDisposable();
@@ -289,7 +291,7 @@ public class TreatmentService extends OrmLiteBaseService {
}
try {
Treatment old;
- treatment.date = DatabaseHelper.roundDateToSec(treatment.date);
+ treatment.date = databaseHelper.roundDateToSec(treatment.date);
if (treatment.source == Source.PUMP) {
// check for changed from pump change in NS
@@ -412,7 +414,7 @@ public class TreatmentService extends OrmLiteBaseService {
aapsLogger.debug(LTag.DATATREATMENTS, "DoubleBolusDebug: createOrUpdateMedtronic:: originalTreatment={}, fromNightScout={}", treatment, fromNightScout);
try {
- treatment.date = DatabaseHelper.roundDateToSec(treatment.date);
+ treatment.date = databaseHelper.roundDateToSec(treatment.date);
Treatment existingTreatment = getRecord(treatment.pumpId, treatment.date);
@@ -539,37 +541,6 @@ public class TreatmentService extends OrmLiteBaseService {
return (Math.abs(diff) <= 0.00001);
}
- @Deprecated
- private void treatmentCopy(Treatment oldTreatment, Treatment newTreatment, boolean fromNightScout) {
-
- aapsLogger.debug(LTag.DATATREATMENTS, "treatmentCopy [old={}, new={}]", oldTreatment.toString(), newTreatment.toString());
-
-
- if (fromNightScout) {
- long pumpId_old = oldTreatment.pumpId;
- boolean isSMB = (oldTreatment.isSMB || newTreatment.isSMB);
-
- oldTreatment.copyFrom(newTreatment);
-
- if (pumpId_old != 0) {
- oldTreatment.pumpId = pumpId_old;
- }
-
- if (oldTreatment.pumpId != 0 && oldTreatment.source != Source.PUMP) {
- oldTreatment.source = Source.PUMP;
- }
-
- oldTreatment.isSMB = isSMB;
-
- } else {
- oldTreatment.copyFrom(newTreatment);
- }
-
- aapsLogger.debug(LTag.DATATREATMENTS, "treatmentCopy [newAfterChange={}]", oldTreatment.toString());
-
- }
-
-
public Treatment getRecord(long pumpId, long date) {
Treatment record = null;
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/treatments/TreatmentsPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/treatments/TreatmentsPlugin.java
index f83e522b30..f273015441 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/treatments/TreatmentsPlugin.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/treatments/TreatmentsPlugin.java
@@ -75,6 +75,7 @@ public class TreatmentsPlugin extends PluginBase implements TreatmentsInterface
private final ResourceHelper resourceHelper;
private final ProfileFunction profileFunction;
private final ActivePluginProvider activePlugin;
+ private final NSUpload nsUpload;
private final FabricPrivacy fabricPrivacy;
private final DateUtil dateUtil;
@@ -101,6 +102,7 @@ public class TreatmentsPlugin extends PluginBase implements TreatmentsInterface
SP sp,
ProfileFunction profileFunction,
ActivePluginProvider activePlugin,
+ NSUpload nsUpload,
FabricPrivacy fabricPrivacy,
DateUtil dateUtil
) {
@@ -122,6 +124,7 @@ public class TreatmentsPlugin extends PluginBase implements TreatmentsInterface
this.activePlugin = activePlugin;
this.fabricPrivacy = fabricPrivacy;
this.dateUtil = dateUtil;
+ this.nsUpload = nsUpload;
}
@Override
@@ -293,7 +296,7 @@ public class TreatmentsPlugin extends PluginBase implements TreatmentsInterface
/**
* Returns all Treatments after specified timestamp. Also returns invalid entries (required to
- * map "Fill Canulla" entries to history (and not to add double bolus for it)
+ * map "Fill Canula" entries to history (and not to add double bolus for it)
*
* @param fromTimestamp
* @return
@@ -304,13 +307,13 @@ public class TreatmentsPlugin extends PluginBase implements TreatmentsInterface
long time = System.currentTimeMillis();
synchronized (treatments) {
- getAapsLogger().debug(MedtronicHistoryData.doubleBolusDebug, LTag.DATATREATMENTS, "DoubleBolusDebug: AllTreatmentsInDb: " + new GsonBuilder().excludeFieldsWithoutExposeAnnotation().create().toJson(treatments));
+// getAapsLogger().debug(MedtronicHistoryData.doubleBolusDebug, LTag.DATATREATMENTS, "DoubleBolusDebug: AllTreatmentsInDb: " + new GsonBuilder().excludeFieldsWithoutExposeAnnotation().create().toJson(treatments));
for (Treatment t : treatments) {
if (t.date <= time && t.date >= fromTimestamp)
in5minback.add(t);
}
- getAapsLogger().debug(MedtronicHistoryData.doubleBolusDebug, LTag.DATATREATMENTS, "DoubleBolusDebug: FilteredTreatments: AfterTime={}, Items={} " + fromTimestamp + " " + new GsonBuilder().excludeFieldsWithoutExposeAnnotation().create().toJson(in5minback));
+// getAapsLogger().debug(MedtronicHistoryData.doubleBolusDebug, LTag.DATATREATMENTS, "DoubleBolusDebug: FilteredTreatments: AfterTime={}, Items={} " + fromTimestamp + " " + new GsonBuilder().excludeFieldsWithoutExposeAnnotation().create().toJson(in5minback));
return in5minback;
}
}
@@ -553,13 +556,13 @@ public class TreatmentsPlugin extends PluginBase implements TreatmentsInterface
if (newRecordCreated) {
if (extendedBolus.durationInMinutes == 0) {
if (activePlugin.getActivePump().isFakingTempsByExtendedBoluses())
- NSUpload.uploadTempBasalEnd(extendedBolus.date, true, extendedBolus.pumpId);
+ nsUpload.uploadTempBasalEnd(extendedBolus.date, true, extendedBolus.pumpId);
else
- NSUpload.uploadExtendedBolusEnd(extendedBolus.date, extendedBolus.pumpId);
+ nsUpload.uploadExtendedBolusEnd(extendedBolus.date, extendedBolus.pumpId);
} else if (activePlugin.getActivePump().isFakingTempsByExtendedBoluses())
- NSUpload.uploadTempBasalStartAbsolute(new TemporaryBasal(extendedBolus), extendedBolus.insulin);
+ nsUpload.uploadTempBasalStartAbsolute(new TemporaryBasal(extendedBolus), extendedBolus.insulin);
else
- NSUpload.uploadExtendedBolus(extendedBolus);
+ nsUpload.uploadExtendedBolus(extendedBolus);
}
return newRecordCreated;
}
@@ -586,11 +589,11 @@ public class TreatmentsPlugin extends PluginBase implements TreatmentsInterface
boolean newRecordCreated = MainApp.getDbHelper().createOrUpdate(tempBasal);
if (newRecordCreated) {
if (tempBasal.durationInMinutes == 0)
- NSUpload.uploadTempBasalEnd(tempBasal.date, false, tempBasal.pumpId);
+ nsUpload.uploadTempBasalEnd(tempBasal.date, false, tempBasal.pumpId);
else if (tempBasal.isAbsolute)
- NSUpload.uploadTempBasalStartAbsolute(tempBasal, null);
+ nsUpload.uploadTempBasalStartAbsolute(tempBasal, null);
else
- NSUpload.uploadTempBasalStartPercent(tempBasal, profileFunction.getProfile(tempBasal.date));
+ nsUpload.uploadTempBasalStartPercent(tempBasal, profileFunction.getProfile(tempBasal.date));
}
return newRecordCreated;
}
@@ -641,7 +644,7 @@ public class TreatmentsPlugin extends PluginBase implements TreatmentsInterface
//log.debug("Adding new Treatment record" + carbsTreatment);
}
if (newRecordCreated && detailedBolusInfo.isValid)
- NSUpload.uploadTreatmentRecord(detailedBolusInfo);
+ nsUpload.uploadTreatmentRecord(detailedBolusInfo);
if (!allowUpdate && !creatOrUpdateResult.success) {
getAapsLogger().error("Treatment could not be added to DB", new Exception());
@@ -710,7 +713,7 @@ public class TreatmentsPlugin extends PluginBase implements TreatmentsInterface
public void addToHistoryTempTarget(TempTarget tempTarget) {
//log.debug("Adding new TemporaryBasal record" + profileSwitch.log());
MainApp.getDbHelper().createOrUpdate(tempTarget);
- NSUpload.uploadTempTarget(tempTarget, profileFunction);
+ nsUpload.uploadTempTarget(tempTarget, profileFunction);
}
@Override
@@ -733,7 +736,7 @@ public class TreatmentsPlugin extends PluginBase implements TreatmentsInterface
//log.debug("Adding new TemporaryBasal record" + profileSwitch.log());
rxBus.send(new EventDismissNotification(Notification.PROFILE_SWITCH_MISSING));
MainApp.getDbHelper().createOrUpdate(profileSwitch);
- NSUpload.uploadProfileSwitch(profileSwitch);
+ nsUpload.uploadProfileSwitch(profileSwitch);
}
@Override
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsBolusFragment.kt b/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsBolusFragment.kt
index 63574ea8d2..e6d2f02883 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsBolusFragment.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsBolusFragment.kt
@@ -42,6 +42,8 @@ class TreatmentsBolusFragment : DaggerFragment() {
@Inject lateinit var fabricPrivacy: FabricPrivacy
@Inject lateinit var treatmentsPlugin: TreatmentsPlugin
@Inject lateinit var profileFunction: ProfileFunction
+ @Inject lateinit var nsUpload: NSUpload
+ @Inject lateinit var uploadQueue: UploadQueue
@Inject lateinit var dateUtil: DateUtil
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
@@ -68,9 +70,9 @@ class TreatmentsBolusFragment : DaggerFragment() {
val futureTreatments = treatmentsPlugin.service.getTreatmentDataFromTime(DateUtil.now() + 1000, true)
for (treatment in futureTreatments) {
if (NSUpload.isIdValid(treatment._id))
- NSUpload.removeCareportalEntryFromNS(treatment._id)
+ nsUpload.removeCareportalEntryFromNS(treatment._id)
else
- UploadQueue.removeID("dbAdd", treatment._id)
+ uploadQueue.removeID("dbAdd", treatment._id)
treatmentsPlugin.service.delete(treatment)
}
updateGui()
@@ -166,9 +168,9 @@ class TreatmentsBolusFragment : DaggerFragment() {
treatmentsPlugin.service.update(treatment)
} else {
if (NSUpload.isIdValid(treatment._id))
- NSUpload.removeCareportalEntryFromNS(treatment._id)
+ nsUpload.removeCareportalEntryFromNS(treatment._id)
else
- UploadQueue.removeID("dbAdd", treatment._id)
+ uploadQueue.removeID("dbAdd", treatment._id)
treatmentsPlugin.service.delete(treatment)
}
updateGui()
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsCareportalFragment.kt b/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsCareportalFragment.kt
index 9307238211..26165ec661 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsCareportalFragment.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsCareportalFragment.kt
@@ -38,6 +38,8 @@ class TreatmentsCareportalFragment : DaggerFragment() {
@Inject lateinit var resourceHelper: ResourceHelper
@Inject lateinit var fabricPrivacy: FabricPrivacy
@Inject lateinit var translator: Translator
+ @Inject lateinit var nsUpload: NSUpload
+ @Inject lateinit var uploadQueue: UploadQueue
@Inject lateinit var dateUtil: DateUtil
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
@@ -66,9 +68,9 @@ class TreatmentsCareportalFragment : DaggerFragment() {
val careportalEvent = events[i]
if (careportalEvent.json.contains(resourceHelper.gs(R.string.androidaps_start))) {
if (NSUpload.isIdValid(careportalEvent._id))
- NSUpload.removeCareportalEntryFromNS(careportalEvent._id)
+ nsUpload.removeCareportalEntryFromNS(careportalEvent._id)
else
- UploadQueue.removeID("dbAdd", careportalEvent._id)
+ uploadQueue.removeID("dbAdd", careportalEvent._id)
MainApp.getDbHelper().delete(careportalEvent)
}
}
@@ -131,14 +133,14 @@ class TreatmentsCareportalFragment : DaggerFragment() {
remove.setOnClickListener { v: View ->
val careportalEvent = v.tag as CareportalEvent
activity?.let { activity ->
- val text = resourceHelper.gs(R.string.careportal_newnstreatment_eventtype) + ": " + translator.translate(careportalEvent.eventType) + "\n" +
+ val text = resourceHelper.gs(R.string.eventtype) + ": " + translator.translate(careportalEvent.eventType) + "\n" +
resourceHelper.gs(R.string.careportal_newnstreatment_notes_label) + ": " + careportalEvent.notes + "\n" +
resourceHelper.gs(R.string.date) + ": " + dateUtil.dateAndTimeString(careportalEvent.date)
OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.removerecord), text, Runnable {
if (NSUpload.isIdValid(careportalEvent._id))
- NSUpload.removeCareportalEntryFromNS(careportalEvent._id)
+ nsUpload.removeCareportalEntryFromNS(careportalEvent._id)
else
- UploadQueue.removeID("dbAdd", careportalEvent._id)
+ uploadQueue.removeID("dbAdd", careportalEvent._id)
MainApp.getDbHelper().delete(careportalEvent)
}, null)
}
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsExtendedBolusesFragment.kt b/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsExtendedBolusesFragment.kt
index d2dcd632ea..91e3b098fc 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsExtendedBolusesFragment.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsExtendedBolusesFragment.kt
@@ -40,6 +40,8 @@ class TreatmentsExtendedBolusesFragment : DaggerFragment() {
@Inject lateinit var rxBus: RxBusWrapper
@Inject lateinit var resourceHelper: ResourceHelper
@Inject lateinit var fabricPrivacy: FabricPrivacy
+ @Inject lateinit var nsUpload: NSUpload
+ @Inject lateinit var uploadQueue: UploadQueue
@Inject lateinit var dateUtil: DateUtil
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
@@ -116,8 +118,8 @@ class TreatmentsExtendedBolusesFragment : DaggerFragment() {
${resourceHelper.gs(R.string.date)}: ${dateUtil.dateAndTimeString(extendedBolus.date)}
""".trimIndent(), DialogInterface.OnClickListener { _: DialogInterface, _: Int ->
val id = extendedBolus._id
- if (NSUpload.isIdValid(id)) NSUpload.removeCareportalEntryFromNS(id)
- else UploadQueue.removeID("dbAdd", id)
+ if (NSUpload.isIdValid(id)) nsUpload.removeCareportalEntryFromNS(id)
+ else uploadQueue.removeID("dbAdd", id)
MainApp.getDbHelper().delete(extendedBolus)
}, null)
}
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsProfileSwitchFragment.kt b/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsProfileSwitchFragment.kt
index 77934e304c..886c0ec34e 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsProfileSwitchFragment.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsProfileSwitchFragment.kt
@@ -43,6 +43,8 @@ class TreatmentsProfileSwitchFragment : DaggerFragment() {
@Inject lateinit var localProfilePlugin: LocalProfilePlugin
@Inject lateinit var resourceHelper: ResourceHelper
@Inject lateinit var fabricPrivacy: FabricPrivacy
+ @Inject lateinit var nsUpload: NSUpload
+ @Inject lateinit var uploadQueue: UploadQueue
@Inject lateinit var dateUtil: DateUtil
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
@@ -135,8 +137,8 @@ class TreatmentsProfileSwitchFragment : DaggerFragment() {
resourceHelper.gs(R.string.careportal_profileswitch) + ": " + profileSwitch.profileName +
"\n" + resourceHelper.gs(R.string.date) + ": " + dateUtil.dateAndTimeString(profileSwitch.date), Runnable {
val id = profileSwitch._id
- if (NSUpload.isIdValid(id)) NSUpload.removeCareportalEntryFromNS(id)
- else UploadQueue.removeID("dbAdd", id)
+ if (NSUpload.isIdValid(id)) nsUpload.removeCareportalEntryFromNS(id)
+ else uploadQueue.removeID("dbAdd", id)
MainApp.getDbHelper().delete(profileSwitch)
})
}
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsTempTargetFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsTempTargetFragment.java
index 7df7db72be..980e9efe7d 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsTempTargetFragment.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsTempTargetFragment.java
@@ -47,6 +47,8 @@ public class TreatmentsTempTargetFragment extends DaggerFragment {
@Inject RxBusWrapper rxBus;
@Inject ProfileFunction profileFunction;
@Inject ResourceHelper resourceHelper;
+ @Inject NSUpload nsUpload;
+ @Inject UploadQueue uploadQueue;
@Inject FabricPrivacy fabricPrivacy;
@Inject DateUtil dateUtil;
@@ -146,9 +148,9 @@ public class TreatmentsTempTargetFragment extends DaggerFragment {
(dialog, id) -> {
final String _id = tempTarget._id;
if (NSUpload.isIdValid(_id)) {
- NSUpload.removeCareportalEntryFromNS(_id);
+ nsUpload.removeCareportalEntryFromNS(_id);
} else {
- UploadQueue.removeID("dbAdd", _id);
+ uploadQueue.removeID("dbAdd", _id);
}
MainApp.getDbHelper().delete(tempTarget);
}, null);
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsTemporaryBasalsFragment.kt b/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsTemporaryBasalsFragment.kt
index 4ff6b15950..fed0ba1137 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsTemporaryBasalsFragment.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsTemporaryBasalsFragment.kt
@@ -44,6 +44,8 @@ class TreatmentsTemporaryBasalsFragment : DaggerFragment() {
@Inject lateinit var fabricPrivacy: FabricPrivacy
@Inject lateinit var activePlugin: ActivePluginProvider
@Inject lateinit var profileFunction: ProfileFunction
+ @Inject lateinit var nsUpload: NSUpload
+ @Inject lateinit var uploadQueue: UploadQueue
@Inject lateinit var dateUtil: DateUtil
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
@@ -160,13 +162,13 @@ class TreatmentsTemporaryBasalsFragment : DaggerFragment() {
context?.let {
showConfirmation(it, resourceHelper.gs(R.string.removerecord),
"""
- ${resourceHelper.gs(R.string.pump_tempbasal_label)}: ${tempBasal.toStringFull()}
+ ${resourceHelper.gs(R.string.tempbasal_label)}: ${tempBasal.toStringFull()}
${resourceHelper.gs(R.string.date)}: ${dateUtil.dateAndTimeString(tempBasal.date)}
""".trimIndent(),
DialogInterface.OnClickListener { _: DialogInterface?, _: Int ->
val id = tempBasal._id
- if (NSUpload.isIdValid(id)) NSUpload.removeCareportalEntryFromNS(id)
- else UploadQueue.removeID("dbAdd", id)
+ if (NSUpload.isIdValid(id)) nsUpload.removeCareportalEntryFromNS(id)
+ else uploadQueue.removeID("dbAdd", id)
MainApp.getDbHelper().delete(tempBasal)
}, null)
}
diff --git a/app/src/main/java/info/nightscout/androidaps/queue/CommandQueue.kt b/app/src/main/java/info/nightscout/androidaps/queue/CommandQueue.kt
index 15f1eaa9f8..bbc541c7b9 100644
--- a/app/src/main/java/info/nightscout/androidaps/queue/CommandQueue.kt
+++ b/app/src/main/java/info/nightscout/androidaps/queue/CommandQueue.kt
@@ -375,12 +375,14 @@ class CommandQueue @Inject constructor(
callback?.result(PumpEnactResult(injector).success(true).enacted(false))?.run()
return false
}
+ /* this is breaking setting of profile at all if not engineering mode
if (!buildHelper.isEngineeringModeOrRelease()) {
val notification = Notification(Notification.NOT_ENG_MODE_OR_RELEASE, resourceHelper.gs(R.string.not_eng_mode_or_release), Notification.URGENT)
rxBus.send(EventNewNotification(notification))
callback?.result(PumpEnactResult(injector).success(false).enacted(false).comment(resourceHelper.gs(R.string.not_eng_mode_or_release)))?.run()
return false
}
+ */
// Compare with pump limits
val basalValues = profile.basalValues
for (basalValue in basalValues) {
diff --git a/app/src/main/java/info/nightscout/androidaps/receivers/KeepAliveReceiver.kt b/app/src/main/java/info/nightscout/androidaps/receivers/KeepAliveReceiver.kt
index a3dda44325..b6705ac733 100644
--- a/app/src/main/java/info/nightscout/androidaps/receivers/KeepAliveReceiver.kt
+++ b/app/src/main/java/info/nightscout/androidaps/receivers/KeepAliveReceiver.kt
@@ -8,15 +8,16 @@ import android.content.Intent
import android.os.PowerManager
import android.os.SystemClock
import dagger.android.DaggerBroadcastReceiver
+import info.nightscout.androidaps.BuildConfig
import info.nightscout.androidaps.Config
import info.nightscout.androidaps.events.EventProfileNeedsUpdate
import info.nightscout.androidaps.interfaces.ActivePluginProvider
import info.nightscout.androidaps.interfaces.CommandQueueProvider
+import info.nightscout.androidaps.interfaces.ProfileFunction
import info.nightscout.androidaps.logging.AAPSLogger
import info.nightscout.androidaps.logging.LTag
import info.nightscout.androidaps.plugins.aps.loop.LoopPlugin
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
-import info.nightscout.androidaps.interfaces.ProfileFunction
import info.nightscout.androidaps.plugins.general.nsclient.NSUpload
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.IobCobCalculatorPlugin
import info.nightscout.androidaps.queue.commands.Command
@@ -39,6 +40,7 @@ class KeepAliveReceiver : DaggerBroadcastReceiver() {
@Inject lateinit var fabricPrivacy: FabricPrivacy
@Inject lateinit var receiverStatusStore: ReceiverStatusStore
@Inject lateinit var config: Config
+ @Inject lateinit var nsUpload: NSUpload
@Inject lateinit var dateUtil: DateUtil
companion object {
@@ -108,7 +110,7 @@ class KeepAliveReceiver : DaggerBroadcastReceiver() {
else if (DateUtil.isOlderThan(activePlugin.activeAPS.lastAPSRun, 5)) shouldUploadStatus = true
if (DateUtil.isOlderThan(lastIobUpload, IOB_UPDATE_FREQUENCY) && shouldUploadStatus) {
lastIobUpload = DateUtil.now()
- NSUpload.uploadDeviceStatus(loopPlugin, iobCobCalculatorPlugin, profileFunction, activePlugin.activePump, receiverStatusStore)
+ nsUpload.uploadDeviceStatus(loopPlugin, iobCobCalculatorPlugin, profileFunction, activePlugin.activePump, receiverStatusStore, BuildConfig.VERSION_NAME + "-" + BuildConfig.BUILDVERSION)
}
}
diff --git a/app/src/main/java/info/nightscout/androidaps/services/DataService.java b/app/src/main/java/info/nightscout/androidaps/services/DataService.java
index 83891275a2..cf1833e892 100644
--- a/app/src/main/java/info/nightscout/androidaps/services/DataService.java
+++ b/app/src/main/java/info/nightscout/androidaps/services/DataService.java
@@ -20,6 +20,7 @@ import info.nightscout.androidaps.logging.AAPSLogger;
import info.nightscout.androidaps.logging.BundleLogger;
import info.nightscout.androidaps.logging.LTag;
import info.nightscout.androidaps.plugins.bus.RxBusWrapper;
+import info.nightscout.androidaps.plugins.general.nsclient.NSUpload;
import info.nightscout.androidaps.plugins.general.nsclient.data.NSMbg;
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification;
import info.nightscout.androidaps.plugins.general.overview.notifications.Notification;
@@ -42,6 +43,7 @@ public class DataService extends DaggerIntentService {
@Inject AAPSLogger aapsLogger;
@Inject SP sp;
@Inject RxBusWrapper rxBus;
+ @Inject NSUpload nsUpload;
@Inject SmsCommunicatorPlugin smsCommunicatorPlugin;
@Inject DexcomPlugin dexcomPlugin;
@Inject EversensePlugin eversensePlugin;
@@ -210,7 +212,7 @@ public class DataService extends DaggerIntentService {
} else if (eventType.equals(CareportalEvent.COMBOBOLUS)) {
MainApp.getDbHelper().createExtendedBolusFromJsonIfNotExists(json);
} else if (eventType.equals(CareportalEvent.PROFILESWITCH)) {
- MainApp.getDbHelper().createProfileSwitchFromJsonIfNotExists(activePlugin, json);
+ MainApp.getDbHelper().createProfileSwitchFromJsonIfNotExists(activePlugin, nsUpload, json);
} else if (eventType.equals(CareportalEvent.SITECHANGE) ||
eventType.equals(CareportalEvent.INSULINCHANGE) ||
eventType.equals(CareportalEvent.SENSORCHANGE) ||
diff --git a/app/src/main/java/info/nightscout/androidaps/utils/CryptoUtil.kt b/app/src/main/java/info/nightscout/androidaps/utils/CryptoUtil.kt
index 01cc925942..e78b112615 100644
--- a/app/src/main/java/info/nightscout/androidaps/utils/CryptoUtil.kt
+++ b/app/src/main/java/info/nightscout/androidaps/utils/CryptoUtil.kt
@@ -1,6 +1,7 @@
package info.nightscout.androidaps.utils
import info.nightscout.androidaps.logging.AAPSLogger
+import info.nightscout.androidaps.utils.extensions.toHex
import org.spongycastle.util.encoders.Base64
import java.nio.ByteBuffer
import java.security.MessageDigest
@@ -16,42 +17,10 @@ import javax.crypto.spec.SecretKeySpec
import javax.inject.Inject
import javax.inject.Singleton
-private val HEX_CHARS = "0123456789abcdef"
-private val HEX_CHARS_ARRAY = "0123456789abcdef".toCharArray()
-
-fun String.hexStringToByteArray() : ByteArray {
-
- val upperCased = this.toLowerCase()
- val result = ByteArray(length / 2)
- for (i in 0 until length step 2) {
- val firstIndex = HEX_CHARS.indexOf(upperCased[i]);
- val secondIndex = HEX_CHARS.indexOf(upperCased[i + 1]);
-
- val octet = firstIndex.shl(4).or(secondIndex)
- result.set(i.shr(1), octet.toByte())
- }
-
- return result
-}
-
-fun ByteArray.toHex() : String{
- val result = StringBuffer()
-
- forEach {
- val octet = it.toInt()
- val firstIndex = (octet and 0xF0).ushr(4)
- val secondIndex = octet and 0x0F
- result.append(HEX_CHARS_ARRAY[firstIndex])
- result.append(HEX_CHARS_ARRAY[secondIndex])
- }
-
- return result.toString()
-}
-
@Singleton
class CryptoUtil @Inject constructor(
val aapsLogger: AAPSLogger
-) {
+) {
companion object {
private const val IV_LENGTH_BYTE = 12
@@ -71,26 +40,26 @@ class CryptoUtil @Inject constructor(
}
fun hmac256(str: String, secret: String): String? {
- val sha256_HMAC = Mac.getInstance("HmacSHA256")
+ val sha256HMAC = Mac.getInstance("HmacSHA256")
val secretKey = SecretKeySpec(secret.toByteArray(), "HmacSHA256")
- sha256_HMAC.init(secretKey)
- return sha256_HMAC.doFinal(str.toByteArray()).toHex()
+ sha256HMAC.init(secretKey)
+ return sha256HMAC.doFinal(str.toByteArray()).toHex()
}
- private fun prepCipherKey(passPhrase: String, salt:ByteArray, iterationCount:Int = PBKDF2_ITERATIONS, keyStrength:Int = AES_KEY_SIZE_BIT): SecretKeySpec {
+ private fun prepCipherKey(passPhrase: String, salt: ByteArray, iterationCount: Int = PBKDF2_ITERATIONS, keyStrength: Int = AES_KEY_SIZE_BIT): SecretKeySpec {
val factory: SecretKeyFactory = SecretKeyFactory.getInstance("PBKDF2withHmacSHA1")
val spec: KeySpec = PBEKeySpec(passPhrase.toCharArray(), salt, iterationCount, keyStrength)
val tmp: SecretKey = factory.generateSecret(spec)
- return SecretKeySpec(tmp.getEncoded(), "AES")
+ return SecretKeySpec(tmp.encoded, "AES")
}
- fun mineSalt(len :Int = SALT_SIZE_BYTE): ByteArray {
+ fun mineSalt(len: Int = SALT_SIZE_BYTE): ByteArray {
val salt = ByteArray(len)
secureRandom.nextBytes(salt)
return salt
}
- fun encrypt(passPhrase: String, salt:ByteArray, rawData: String ): String? {
+ fun encrypt(passPhrase: String, salt: ByteArray, rawData: String): String? {
val iv: ByteArray?
val encrypted: ByteArray?
return try {
@@ -107,12 +76,12 @@ class CryptoUtil @Inject constructor(
String(Base64.encode(byteBuffer.array()))
} catch (e: Exception) {
lastException = e
- aapsLogger.error("Encryption failed due to technical exception: ${e}")
+ aapsLogger.error("Encryption failed due to technical exception: $e")
null
}
}
- fun decrypt(passPhrase: String, salt:ByteArray, encryptedData: String): String? {
+ fun decrypt(passPhrase: String, salt: ByteArray, encryptedData: String): String? {
val iv: ByteArray?
val encrypted: ByteArray?
return try {
@@ -129,7 +98,7 @@ class CryptoUtil @Inject constructor(
String(dec)
} catch (e: Exception) {
lastException = e
- aapsLogger.error("Decryption failed due to technical exception: ${e}")
+ aapsLogger.error("Decryption failed due to technical exception: $e")
null
}
}
diff --git a/app/src/main/java/info/nightscout/androidaps/utils/HardLimits.kt b/app/src/main/java/info/nightscout/androidaps/utils/HardLimits.kt
index c9e2835ceb..bec9c0fa16 100644
--- a/app/src/main/java/info/nightscout/androidaps/utils/HardLimits.kt
+++ b/app/src/main/java/info/nightscout/androidaps/utils/HardLimits.kt
@@ -12,11 +12,12 @@ import javax.inject.Singleton
@Singleton
class HardLimits @Inject constructor(
- val aapsLogger: AAPSLogger,
- val rxBus: RxBusWrapper,
- val sp: SP,
- val resourceHelper: ResourceHelper,
- val context: Context
+ private val aapsLogger: AAPSLogger,
+ private val rxBus: RxBusWrapper,
+ private val sp: SP,
+ private val resourceHelper: ResourceHelper,
+ private val context: Context,
+ private val nsUpload: NSUpload
) {
val CHILD = 0
@@ -90,7 +91,7 @@ class HardLimits @Inject constructor(
msg += ".\n"
msg += String.format(resourceHelper.gs(R.string.valuelimitedto), value, newvalue)
aapsLogger.error(msg)
- NSUpload.uploadError(msg)
+ nsUpload.uploadError(msg)
ToastUtils.showToastInUiThread(context, rxBus, msg, R.raw.error)
}
return newvalue
diff --git a/app/src/main/java/info/nightscout/androidaps/utils/LocalAlertUtils.kt b/app/src/main/java/info/nightscout/androidaps/utils/LocalAlertUtils.kt
index eff444aa6e..f5ac9d64ce 100644
--- a/app/src/main/java/info/nightscout/androidaps/utils/LocalAlertUtils.kt
+++ b/app/src/main/java/info/nightscout/androidaps/utils/LocalAlertUtils.kt
@@ -31,6 +31,7 @@ class LocalAlertUtils @Inject constructor(
private val profileFunction: ProfileFunction,
private val iobCobCalculatorPlugin: IobCobCalculatorPlugin,
private val config: Config,
+ private val nsUpload: NSUpload,
private val dateUtil: DateUtil
) {
@@ -53,7 +54,7 @@ class LocalAlertUtils @Inject constructor(
sp.putLong("nextPumpDisconnectedAlarm", System.currentTimeMillis() + pumpUnreachableThreshold())
rxBus.send(EventNewNotification(n))
if (sp.getBoolean(R.string.key_ns_create_announcements_from_errors, true)) {
- NSUpload.uploadError(n.text)
+ nsUpload.uploadError(n.text)
}
}
if (!isStatusOutdated && !alarmTimeoutExpired) rxBus.send(EventDismissNotification(Notification.PUMP_UNREACHABLE))
@@ -101,7 +102,7 @@ class LocalAlertUtils @Inject constructor(
sp.putLong("nextMissedReadingsAlarm", System.currentTimeMillis() + missedReadingsThreshold())
rxBus.send(EventNewNotification(n))
if (sp.getBoolean(R.string.key_ns_create_announcements_from_errors, true)) {
- NSUpload.uploadError(n.text)
+ nsUpload.uploadError(n.text)
}
}
}
diff --git a/app/src/main/java/info/nightscout/androidaps/utils/NumberPickerVertical.java b/app/src/main/java/info/nightscout/androidaps/utils/NumberPickerVertical.java
index cae1a3cde3..f09f562d25 100644
--- a/app/src/main/java/info/nightscout/androidaps/utils/NumberPickerVertical.java
+++ b/app/src/main/java/info/nightscout/androidaps/utils/NumberPickerVertical.java
@@ -30,8 +30,6 @@ import info.nightscout.androidaps.logging.StacktraceLoggerWrapper;
* Created by mike on 28.06.2016.
*/
public class NumberPickerVertical extends NumberPicker {
- private static Logger log = StacktraceLoggerWrapper.getLogger(NumberPickerVertical.class);
-
public NumberPickerVertical(Context context) {
super(context);
}
diff --git a/app/src/main/java/info/nightscout/androidaps/utils/SP.java b/app/src/main/java/info/nightscout/androidaps/utils/SP.java
deleted file mode 100644
index a6124acf10..0000000000
--- a/app/src/main/java/info/nightscout/androidaps/utils/SP.java
+++ /dev/null
@@ -1,50 +0,0 @@
-package info.nightscout.androidaps.utils;
-
-import android.content.SharedPreferences;
-import android.preference.PreferenceManager;
-
-import java.util.Map;
-
-import info.nightscout.androidaps.MainApp;
-
-/**
- * Created by mike on 17.02.2017.
- */
-
-public class SP {
- private static SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(MainApp.instance().getApplicationContext());
-
- @Deprecated
- static public Map getAll() {
- return sharedPreferences.getAll();
- }
-
- @Deprecated
- static public String getString(String key, String defaultValue) {
- return sharedPreferences.getString(key, defaultValue);
- }
-
- @Deprecated
- static public boolean getBoolean(int resourceID, Boolean defaultValue) {
- try {
- return sharedPreferences.getBoolean(MainApp.gs(resourceID), defaultValue);
- } catch (Exception e) {
- return defaultValue;
- }
- }
-
- @Deprecated
- static public void putString(int resourceID, String value) {
- sharedPreferences.edit().putString(MainApp.gs(resourceID), value).apply();
- }
-
- @Deprecated
- static public void putString(String key, String value) {
- sharedPreferences.edit().putString(key, value).apply();
- }
-
- @Deprecated
- static public void remove(String key) {
- sharedPreferences.edit().remove(key).apply();
- }
-}
diff --git a/app/src/main/java/info/nightscout/androidaps/utils/SPBackupAgent.java b/app/src/main/java/info/nightscout/androidaps/utils/SPBackupAgent.java
index fa79caaf2b..098b90c5d1 100644
--- a/app/src/main/java/info/nightscout/androidaps/utils/SPBackupAgent.java
+++ b/app/src/main/java/info/nightscout/androidaps/utils/SPBackupAgent.java
@@ -2,21 +2,14 @@ package info.nightscout.androidaps.utils;
import android.app.backup.BackupAgentHelper;
import android.app.backup.SharedPreferencesBackupHelper;
-import android.content.SharedPreferences;
-import android.preference.PreferenceManager;
-
-import info.nightscout.androidaps.MainApp;
public class SPBackupAgent extends BackupAgentHelper {
- // API 24
- //static final String PREFS = PreferenceManager.getDefaultSharedPreferencesName(MainApp.instance().getApplicationContext());
- static final String PREFS = MainApp.instance().getApplicationContext().getPackageName() + "_preferences";
-
- static final String PREFS_BACKUP_KEY = "SP";
-
@Override
public void onCreate() {
+ // API 24
+ final String PREFS = getApplicationContext().getPackageName() + "_preferences";
+ final String PREFS_BACKUP_KEY = "SP";
SharedPreferencesBackupHelper helper =
new SharedPreferencesBackupHelper(this, PREFS);
addHelper(PREFS_BACKUP_KEY, helper);
diff --git a/app/src/main/java/info/nightscout/androidaps/utils/androidNotification/NotificationHolder.kt b/app/src/main/java/info/nightscout/androidaps/utils/androidNotification/NotificationHolder.kt
index 6ee23a85f5..028c63086e 100644
--- a/app/src/main/java/info/nightscout/androidaps/utils/androidNotification/NotificationHolder.kt
+++ b/app/src/main/java/info/nightscout/androidaps/utils/androidNotification/NotificationHolder.kt
@@ -10,6 +10,7 @@ import androidx.core.app.TaskStackBuilder
import info.nightscout.androidaps.MainActivity
import info.nightscout.androidaps.MainApp
import info.nightscout.androidaps.R
+import info.nightscout.androidaps.interfaces.NotificationHolderInterface
import info.nightscout.androidaps.utils.resources.IconsProvider
import info.nightscout.androidaps.utils.resources.ResourceHelper
import javax.inject.Inject
@@ -20,11 +21,11 @@ class NotificationHolder @Inject constructor(
private val resourceHelper: ResourceHelper,
private val context: Context,
private val iconsProvider: IconsProvider
-) {
+) : NotificationHolderInterface {
- val channelID = "AndroidAPS-Ongoing"
- val notificationID = 4711
- var notification: Notification
+ override val channelID = "AndroidAPS-Ongoing"
+ override val notificationID = 4711
+ override lateinit var notification: Notification
init {
val stackBuilder = TaskStackBuilder.create(context)
diff --git a/app/src/main/java/info/nightscout/androidaps/utils/stats/TddCalculator.kt b/app/src/main/java/info/nightscout/androidaps/utils/stats/TddCalculator.kt
index 6ee3024fc6..1e567dd94a 100644
--- a/app/src/main/java/info/nightscout/androidaps/utils/stats/TddCalculator.kt
+++ b/app/src/main/java/info/nightscout/androidaps/utils/stats/TddCalculator.kt
@@ -11,6 +11,7 @@ import info.nightscout.androidaps.logging.AAPSLogger
import info.nightscout.androidaps.logging.LTag
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
import info.nightscout.androidaps.interfaces.ProfileFunction
+import info.nightscout.androidaps.plugins.general.nsclient.NSUpload
import info.nightscout.androidaps.plugins.treatments.TreatmentService
import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin
import info.nightscout.androidaps.utils.DateUtil
@@ -32,8 +33,9 @@ class TddCalculator @Inject constructor(
val activePlugin: ActivePluginProvider,
val profileFunction: ProfileFunction,
fabricPrivacy: FabricPrivacy,
+ nsUpload: NSUpload,
private val dateUtil: DateUtil
-) : TreatmentsPlugin(injector, aapsLogger, rxBus, resourceHelper, mainApp, sp, profileFunction, activePlugin, fabricPrivacy, dateUtil) {
+) : TreatmentsPlugin(injector, aapsLogger, rxBus, resourceHelper, mainApp, sp, profileFunction, activePlugin, nsUpload, fabricPrivacy, dateUtil) {
init {
service = TreatmentService(injector) // plugin is not started
diff --git a/app/src/main/res/drawable-hdpi/icon_local_savehdpi.png b/app/src/main/res/drawable-hdpi/icon_local_savehdpi.png
deleted file mode 100644
index e5c1d5cedc..0000000000
Binary files a/app/src/main/res/drawable-hdpi/icon_local_savehdpi.png and /dev/null differ
diff --git a/app/src/main/res/drawable-xhdpi/icon_local_activatexhdpi.png b/app/src/main/res/drawable-xhdpi/icon_local_activatexhdpi.png
deleted file mode 100644
index 75e9af38ed..0000000000
Binary files a/app/src/main/res/drawable-xhdpi/icon_local_activatexhdpi.png and /dev/null differ
diff --git a/app/src/main/res/drawable-xhdpi/icon_local_resetxhdpi.png b/app/src/main/res/drawable-xhdpi/icon_local_resetxhdpi.png
deleted file mode 100644
index 2813cb448d..0000000000
Binary files a/app/src/main/res/drawable-xhdpi/icon_local_resetxhdpi.png and /dev/null differ
diff --git a/app/src/main/res/drawable-xhdpi/icon_local_savexhdpi.png b/app/src/main/res/drawable-xhdpi/icon_local_savexhdpi.png
deleted file mode 100644
index 0cf81430cc..0000000000
Binary files a/app/src/main/res/drawable-xhdpi/icon_local_savexhdpi.png and /dev/null differ
diff --git a/app/src/main/res/drawable-xxhdpi/icon_local_activatexxhdpi.png b/app/src/main/res/drawable-xxhdpi/icon_local_activatexxhdpi.png
deleted file mode 100644
index 600e6ee61c..0000000000
Binary files a/app/src/main/res/drawable-xxhdpi/icon_local_activatexxhdpi.png and /dev/null differ
diff --git a/app/src/main/res/drawable-xxhdpi/icon_local_savexxhdpi.png b/app/src/main/res/drawable-xxhdpi/icon_local_savexxhdpi.png
deleted file mode 100644
index 20448e4bf9..0000000000
Binary files a/app/src/main/res/drawable-xxhdpi/icon_local_savexxhdpi.png and /dev/null differ
diff --git a/app/src/main/res/drawable-xxxhdpi/icon_local_resetxxxhdpi.png b/app/src/main/res/drawable-xxxhdpi/icon_local_resetxxxhdpi.png
deleted file mode 100644
index ec54479149..0000000000
Binary files a/app/src/main/res/drawable-xxxhdpi/icon_local_resetxxxhdpi.png and /dev/null differ
diff --git a/app/src/main/res/drawable-xxxhdpi/icon_local_activatexxxhdpi.png b/app/src/main/res/drawable/icon_local_activate.png
similarity index 100%
rename from app/src/main/res/drawable-xxxhdpi/icon_local_activatexxxhdpi.png
rename to app/src/main/res/drawable/icon_local_activate.png
diff --git a/app/src/main/res/drawable-xxhdpi/icon_local_resetxxhdpi.png b/app/src/main/res/drawable/icon_local_reset.png
similarity index 100%
rename from app/src/main/res/drawable-xxhdpi/icon_local_resetxxhdpi.png
rename to app/src/main/res/drawable/icon_local_reset.png
diff --git a/app/src/main/res/layout/actions_fragment.xml b/app/src/main/res/layout/actions_fragment.xml
index 77a5ab00dd..0290c1cf8a 100644
--- a/app/src/main/res/layout/actions_fragment.xml
+++ b/app/src/main/res/layout/actions_fragment.xml
@@ -126,6 +126,13 @@
android:paddingEnd="15dp"
android:text="@string/careportal" />
+
+
-
+
-
+
+
+
+ app:layout_row="6" />
+ app:layout_row="6" />
diff --git a/app/src/main/res/layout/careportal_newnstreatment_dialog.xml b/app/src/main/res/layout/careportal_newnstreatment_dialog.xml
index 4251efd3a2..a501e70a77 100644
--- a/app/src/main/res/layout/careportal_newnstreatment_dialog.xml
+++ b/app/src/main/res/layout/careportal_newnstreatment_dialog.xml
@@ -233,7 +233,7 @@
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/dialog_tempbasal.xml b/app/src/main/res/layout/dialog_tempbasal.xml
index c748960c33..e13d7fc872 100644
--- a/app/src/main/res/layout/dialog_tempbasal.xml
+++ b/app/src/main/res/layout/dialog_tempbasal.xml
@@ -24,7 +24,7 @@
diff --git a/app/src/main/res/layout/dialog_temptarget.xml b/app/src/main/res/layout/dialog_temptarget.xml
index be4258ec5c..d03413a237 100644
--- a/app/src/main/res/layout/dialog_temptarget.xml
+++ b/app/src/main/res/layout/dialog_temptarget.xml
@@ -81,7 +81,7 @@
android:layout_gravity="center_vertical"
android:width="120dp"
android:padding="10dp"
- android:text="@string/nsprofileview_target_label"
+ android:text="@string/target_label"
android:textAppearance="@android:style/TextAppearance.Material.Small"
android:textStyle="bold" />
diff --git a/app/src/main/res/layout/medtronic_fragment.xml b/app/src/main/res/layout/medtronic_fragment.xml
index a67872fa5d..af16dd26cb 100644
--- a/app/src/main/res/layout/medtronic_fragment.xml
+++ b/app/src/main/res/layout/medtronic_fragment.xml
@@ -164,7 +164,7 @@
android:layout_weight="1.5"
android:gravity="end"
android:paddingRight="5dp"
- android:text="@string/pump_battery_label"
+ android:text="@string/battery_label"
android:textSize="14sp" />
+ android:text="@string/pumphistory" />
+ android:text="@string/tempbasal_label" />
Herstel databasis
Wil jy regtig die databasis herstel?
Gaan uit
- Gebruik verlengde boluses vir >200%%
- DanaR Bluetooth-toestel
Gebruik altyd absolute basale aardes
Herlaai jou foon of herlaai AndroidAPS met die stelsel instellings \nanders sal AndroidAPS nie geskiedenis hê nie! (Belangrik om te spoor en te verifieer dat die algoritmes korrek werk)!
\'n Paar knoppies vir vinnige algemene nutsfunskies
- Tik gevorderde log boek inskrywings.
Gebruik vir die aktiewe plugins te konfigureer
Onderrig program
Vertoon kos-voorafinstellings soos omskryf in Nightscout
@@ -35,10 +32,6 @@
Bied die profiel wat jy het beskryf het in Nightscout
Definieer \'n profiel met net een tydblok.
Pomp Integrasie met Accu-Chek Combo pompe, vereis dat ruffy geïnstalleer is
- Pomp integrasie vir DANA Diabecare R pompe
- Pomp integrasie vir Koreanse DANA Diabecare R pompe
- Pomp integrasie vir DANA Diabecare R pompe met opgegradeerde firmware
- Pomp integrasie vir DANA Diabecare RS pompe
Pomp integrasie vir mense wat veelvoudige daaglikse inspuitings doen vir hul diabetes terapie/regime
Pomp integrasie vir pompe wat nog nie enige drywer het nie (oop lus)
Sensitiwiteit word bereken op dieselfde manier as Oref0, maar jy kan die tydsraamwerk spesifiseer in die verlede. Minimale karb absorpsie is bereken uit maks karb absorpsie tyd vanaf voorkeure.
@@ -52,13 +45,6 @@
Monitor en beheer AndroidAPS met jou WearOS horlosie.
Wys informasie van jou loop op jou xDrip+ horlosie-gesig.
Afstandbeheer AndroidAPS met SMS kodes.
- Eenhede
- DIA
- IC
- ISF
- Basale
- Doelwit
- GEEN PROFIEL
Insulien:
Karbs:
IAB:
@@ -74,15 +60,9 @@
TT
Karbs
Corr
- U
Bolus IOB
Begin nou
VIRTUELE POMP
- Basis basale tempo
- Tydelike basaal
- Verlengde Bolus
- Battery
- Stoor
OK
Vorige lopie
Insette parameters
@@ -93,16 +73,11 @@
Maaltyd data
Uitslag
Geen beskikbare glukose data
- Geen verandering was versoek
Versoek
- Tempo
- Tydsduur
- Rede
Glukose
Delta
Delta:
Konfigurasie bouer
- Doelstellings
Oorsig
Ns Profiel
Maklike profiel
@@ -120,7 +95,6 @@
Algemene
Hier is \'n paar algemene invoegtoepassings wat jy dalk nuttig sal vind.
Watter beperkings word toegepas?
- dae
Beperkings
Lus
Lus
@@ -136,7 +110,6 @@
Plugin is gedeaktiveer
Beperkings skending
Bolus aflewering fout
- Tempbasal aflewering fout
Aanvaar nuwe tydelike basale:
Behandeling
Rekenaar
@@ -146,7 +119,6 @@
Bolus:
Basale
Basale:
- Karbs
Verander jou insette!
BG bron
Waarvandaan moet AndroidAPS data kry?
@@ -163,24 +135,6 @@
Basale IAB
Bolus beperking toegepas
Karbs beperking toegepas
- BG Toets
- Aankondiging
- Nota
- Vraag
- Oefening
- Pomp ligging wysig
- CGM Sensor insetsel
- CGM Sensor Begin
- Insulien stoor verandering
- Peuselhappie Bolus
- Maaltyd Bolus
- Regstelling Bolus
- Kombo Bolus
- Temp Basale Begin
- Temp Basale eind
- Karbs regstelling
- OpenAPS vanlynaf
- Gebeurtenis tipe
Ander
Meter
Sensor
@@ -210,34 +164,12 @@
Die waarde word \"maks basal\" genoem in OpenAPS konteks
Maksimum basale IAB wat OpenAPS mag lewer [U]
Hierdie waarde word Maks IAB genoem in OpenAPS konteks\nDit is die maksimum insulien in [U] wat APS op een slag kan lewer.
- DISMISS
- DanaR
- Koppel
- Gekoppel
- Ontkoppel
Eindverbruiker Lisensie Ooreenkoms
MOET NIE GEBRUIK WORD OM MEDIESE BESLUITE TE MAAK NIE. DAAR IS GEEN WAARBORG DAT DIE PROGRAM, ONDERWORPE AAN TOEPASSELIKE WETTE EN WETGEWING. TENSY ANDERS GEMELD IN TEKS VOORSIEN DIE KOPIEREG-HOUERS EN / OF ANDER PARTYE DIE PROGRAM \"AS IS\" SONDER ËNIGE WAARBORG VAN ENIGE ORDE, UITDRUKKELIK OF IMPLISIET, INKLUSIEF, MAAR NIE BEPERK TOT DIE IMPLISIETE WAARBORG VAN TOEPAASBAARHEID OF NUT VIR EEN SPESIFIEKE DOEL. DIE TOTALE EN ALLE RISIKOVIR DIE KWALITEIT EN PRESTASIE VAN DIE PROGRAM RUS MET JOUSELF. VIR ENIGE PROGRAM DEFEKTIEWE OF FALINGS MOET JY PERSOONLIK DIE KOSTE EN REGSAANSPREEKLIKHEID DRA VAN ALLE NODIGE AKSIES, DIENS, REPARASIES OF KORREKSIES VIR USELF OF ENIGE DERDE PARTYE EN/OF AKSIES, DIENS, REPARASIES OF KORREKSIES WAT DEUR DIE PROGRAM GEDOEN WAS.
EK VERSTAAN en STEM IN
Stoor
- Geen bluetooth passtuk gevind
- Geselekteerde toestel nie gevind nie
- Pomp verbindingsfout
- Pomp IAB
- Daaglikse eenhede
- Laaste bolus
- %1$.1fh terug
- Ongeldige invoer
- Waarde nie behoorlik gestel
Herlaai profiel
- Bekyk profiel
- By hand gedoen
- Kommentaar
- Sukses
- Persentasie
- Absolute
- Kanselleer tydelike basale
SMS Communicator
- Wag vir uitslag
Toegelate telefoon nommers
+XXXXXXXXXX;+YYYYYYYYYY
Om %1$.2fU bolus te lewer antwoord met kode %2$s
@@ -246,52 +178,13 @@
Bolus %1$.2fU suksesvol afgelewer
Gaan %1$.2fU lewer
Bolus %1$.2fU suksesvol afgelewer
- Lewering van %1$.2fU
Laat afstandbeheerde bevele toe via SMS
- Vinger
- Sensor
- Per hand
DanaR profiel stellings
DIA [h]
Duur van insulien aktiwiteit
- Kon nie die basale profiel bywerk nie
- Herlaai
Laai tans op
- E bolus
- DS bolus
- DE bolus
- fout
- hervul
- basale uur
- glukose
- karbohidraat
- alarm
- Totale %1$d rekords opgelaai
- S bolus
- Alarms
- Basale ure
- Boluses
- Karbohidrate
- Daaglikse insulien
- Foute
- Glukose
- Hervul
- Opgeskort
- Koppel vir %1$d s
- Pomp wagwoord
- Verkeerde pomp wagwoord!
- Pomp is besig
- Gelewer
- Gestaak
Bolus gestaak
Staak bolus
- Verstopping
- Staak
- STAAK GEDRUK
- Wag vir pomp
- Gaan %1$.2fU lewer
- Die toegelate limiet is bereik
- Geen profiel gekies
Loop is gedeaktiveer
Loop is geaktiveerd
Loop is gedeaktiveer
@@ -328,11 +221,9 @@
Maaltyd
Corr
Aksies
- AndroidAPS begin
NS laai net op (opgeskorte sinkro)
NS oplaai net. Nie effektief op SGV tensy \'n plaaslike bron soos xDrip gekies is. Nie effektief op profiele terwyl NS-profiele gebruik word.
Pomp nie geïnisialiseer nie!
- Pomp nie geïnisialiseer, profiel nie opgestel nie!
Prima/vul
Maak asseblief seker dat die hoeveelheid ooreenstem met die spesifikasies van jou infusie stel!
Ander
@@ -340,8 +231,6 @@
Knoppie 1
Knoppie 2
Knoppie 3
- mg/dl
- mmol/l
Doelwit reeks:
Reeks vir visualisering
Hoë en lae merke vir die diagramme in Overview en Smartwatch
@@ -350,17 +239,7 @@
Wear
Stuur alle Data weer
Oop instellings op Wear
- Pomp fout
- Battery laag
- Pomp afskakeling
- Pomp Battery leeg
- DanaR Koreaans
Basale waarde:
- Instelling van basale profiel het misluk
- Basale profiel in pomp bygewerk
- Versper EasyUI modus in pomp
- Uitgebreide boluses op pomp aktiveer
- Verander in modus van U/d U/h op pomp
Basale waarde onder minimum. Profiel nie gestel nie!
BG:
Laaste BG:
@@ -368,7 +247,6 @@
MM640g
Voortgesette kennisgewing
OU DATA
- %1$d min terug
%1$d min terug
Plaaslike profiel
OpenAPS AMA
@@ -383,41 +261,22 @@
Eet binnekort
Hipo
Aktiwiteit
- DanaR Stats
- Kumulatiewe TDD
- Eksponensiele geweegde TDD
- Basale
- Bolus
- TDD
- Datum
- Verhouding
- # Dae
- Gewig
- Moontlik onakkuraat as boluse gebruik word vir optop/vulling gebruik!
- Ou Data Druk asseblief \"RELOAD\"
- Totale basis basale
- TBB * 2
- Inisialiseer tans...
ACT
CONF
LUS
SP
OAPS
LP
- DANA
TUIS
VPOMP
NSPROFIEL
BEHANDEL
- CP
OBJ
WEAR
SMS
Verkort oortjie titels
Gebruik altyd kort gemiddelde delta in plaas van eenvoudige delta
Nuttig wanneer data van ongefiltreerde bronne soos xDrip baie raas.
- Gevorderde instellings
- Model: %1$02X Protokol: %2$02X Kode: %3$02X
Profiel
Verstek waarde: 3 dit is \'n sleutel OpenAPS veiligheidsdrumpels. Wat dit doen is om jou basale te berk tot 3 x (in hierdie mense) jou grootste basale koers. Jy sal waarskynlik nooit dit hoef te verander, maar jy moet bewus wees wat bespreek is oor \"3 x max daaglikse; 4 x huidige\"vir veiligheidsdrumpels.
Verstek waarde: 4 dit is die helfte van die sleutel OpenAPS veiligheid limiete, en die ander helfte van \"3 x maks daaglikse; 4 x huidige\"van die veiligheid limiet. Dit beteken jou basale, ongeag max basale stel op jou pomp, kan enige hoër wees as hierdie nommer tye die huidige vlak van jou basale. Dit is om te verhoed dat mense in gevaarlike gebied deur instelling buitensporig hoë max basals voor om te verstaan hoe die algoritme werk. Weer, die verstek is 4 x; die meeste mense sal nooit moet dit aanpas en is eerder meer geneig om te moet aanpas ander instellings as hulle voel hulle \"loop in\" hierdie veiligheid limiet.
@@ -436,18 +295,9 @@
Kalibrasie gestuur. Ontvang moet geaktiveer word in xDrip.
xDrip ontvang nie kalibrasies
Pomp opgeskort
- Verkry pomp status
- Stel tydelike basale
- Stop tydelike basale
- Stel verlengde bolus
- Stop verlengde bolus
- Outobywerking basale tariewe
- Ontkoppel
Besig met uitvoering
Virtuele pomp instellings
Oplaaistatus aan NS
- Verkeerde wagwoord
- Naderende insulien daaglikse limiet
NSClient
NSCI
URL:
@@ -471,7 +321,6 @@
Wys gedetailleerde IAB
Breek af IAB in bolus en basale IAB op die watchface
nie suksesvol - Kontroleer asseblief foon
- Nie beskikbaar nie
Pasiënt ouderdom
Kind
Tiener
@@ -504,8 +353,6 @@
Superbolus
Log app begin na NS
Begin toepassing weer om instellings toe te pas.
- DanaRv2
- Insulien
Watter tipe insulien gebruik jy?
Vinnige aksie Insulien
Novorapid, Novolog, Humalog
@@ -518,9 +365,6 @@
Drempel kritieke stoor vlak [U]
IAB
KOB
- Firmware
- Laaste verbinding
- Bluetooth status
Omtrent
Vermiste SMS toestemming
Toestemming vir foon status nog nie gegee nie
@@ -531,16 +375,11 @@
Voeg BGI by status lyn
Geen oplaai na NS
Alle data na NS gestuur word laat val is gedaal. AAPS is gekoppel aan NS maar geen verandering in NS is gedoen
- Basale Stap
- Bolus Stap
Kanselleer Verlengde Bolus
Sensor ouderdom
Canula tydsduur
Insulien ouderdom
- ure
- Ongeldige profiel !!!
Pomp battery ouderdom
- Pomp Battery Verander
Alarm Opsies
Nood hoog
Hoog
@@ -564,7 +403,6 @@
Absorpsie instellings
Maaltyd max\ks absorpsie tyd [h]
Tyd in ure waarna verwag word dat alle koolhidrate uit maaltyd geabsorbeer sal wees
- Visualiseer verlengde bolus as %%
SAGE
IAGE
CAGE
@@ -588,7 +426,6 @@
POMP
Durasie [min]
OpenAPS SMB
- SMB
Aktiveer UAM
Aktiveer SMB
Gebruik Super Mikro Boluses in plaas van of tydelike basale vir vinniger resultate
@@ -600,22 +437,7 @@
Ultra-Snel Oref
DIA van %1$f is te kort - %2$f in stede gebruik!
Aktiveer profiel
- Datum
ONGELDIG
- Wag vir paring op pomp
- Paring OK
- Paring tyd verstreke
- Geen toestel gevind so ver
- Leë stoor
- Bloed suiker meting alarm
- Oorblywende insulien vlak
- DanaRS
- Dana
- Geselekteerde pomp
- Paar nuwe pomp
- Bolus spoed
- Stel basale stap tot 0.01 U/h
- Reeksnommer
Persentasie
Tyd verskuiwing
Verstek Tydelike-doelwitte
@@ -625,31 +447,18 @@
aktiwiteit doelwit
hipo duur
hipo doelwit
- Prima
- Verkry verlengde bolus status
- Verkry bolus status
- Verkry tydelike basale status
- Kry pomp instellings
- Verkry pomp tyd
hergebruik
Kontroles van horlosie
Stel tydeleike doelwitte en behandelings vanaf horlosie.
- Verbinding verstreke
Kos
g
- m
- h
]]>
kJ
En
Pr
Vet
]]>
- Wag tans vir bolus se einde. Oorblywende %1$d sec.
- Verwerk gebeurtenis
- Begin bolus aflewering
Opdrag word nou uitgevoer
- Pomp drywer gekorrigeer
Pomp onbereikbaar
Gemiste BG lesings
Gebruik stelsel kennisgewings vir waarskuwings en kennisgewings
@@ -659,21 +468,15 @@
Pomp onbereikbaar drempel [min]
Dringende Alarm
INFO
- Bluetooth
- BT Watchdog
- Skakel asb die foon se bluetooth af vir een sekonde Indien geen verbinding met die pomp moontlik is nie. Dit mag help vir sommige selfone waar die bluetooth stapel vries.
Eversense App (bygewerk)
BG data oplaai na NS
BG oplaai instellings
Wys gedetailleerde delta
Wys delta met een meer desimale plek
Maks minute van basale beperk SMB tot
- Onondersteunde pomp firmware
Stuur BG data na xDrip+
Xdrip+ kies 640g/Eversense data bron
NSClient BG
- Basale waarde vervang deur minimum ondersteunde waarde: %1$s
- Basale waarde vervang deur maksimum ondersteunde waarde: %1$s
BG berekening
Bolus IAB berekening
Basale IAB berekening
@@ -691,8 +494,6 @@
Geslote modus geaktiveer
Maksimum IAB behoorlik gestel
BG beskikbaar vanaf geselekteerde bron
- Basale waardes nie in lyn met ure: %1$s
- Ongeldige profiel: %1$s
Programmeer pomp vir bolusing
Verfris
Staat
@@ -731,7 +532,6 @@
Verlengde bolus afleweringsfout
Sig
terug
- %1$.2f h
Aktiveer SMB altyd
Aktiveer SMB altyd onafhanklik van boluse. Slegs moonlik met BG source met goeie filter van data soos G5
Aktiveer SMB na koolhidrate
@@ -742,8 +542,6 @@
Aktiveer SMB wanneer daar tydelike doelwitte aktief is (eetgou, oefen)
Aktiveer SMB met hoë tydelike doelwitte
Aktiveer SMB as daar hoë tydelike doelwitte aktief is (oefening)
- Laat tydelike basale, hardloop
- Demp
Insulien
Karbs
Knoppies
@@ -785,7 +583,6 @@
Veranderende ontwikkelende weergawe. Geslote lus is gedeaktiveerd.
Ingenieurswese modus geaktiveer
Ingenieurswese modus ontsper nie en nie op publike vrylating tak
- %1$.2f U/h
Lees basale profiel
Die pomp geskiedenis het verander nadat die bolus berekening uitgevoer was. Die bolus was nie afgelewer nie. Herbereken asseblief of \'n bolus steeds nodig is.
Bolus suksesvol afgelewer, maar die behandeling inskrywing het gefaal. Dit kan gebeur as twee klein boluses van dieselfde grootte binne die laaste twee minute toegedien word. Kontroleer die pomp geskiedenis en behandeling inskrywings en gebruik die Careportal om vermiste inskrywings te voeg. Maak seker om nie enige inskrywings vir dieselfde minuut en dieselfde bedrag by te voeg.
@@ -808,15 +605,10 @@
SMB gedeaktiveer in voorkeure
UAM in voorkeure gedeaktiveer
UAM versper omdat dit staatmaak op Oref1 sensitiwiteit plugin
- Max basale koers beperk tot %1$.2f U/h as gevolg van %2$s
- pomp limiet
- dit moet \'n positiewe waarde wees
maks basale vermenigvuldiger
maks daaglikse basale vermenigvuldiger
\'n Bolus was binne die laaste 3 minute afgelewer, SMB is oorgespring
Basale reggestel
- Beperk maks persentasie koers tot %1$d%% agv %2$s
- Beperk bolus %1$.1f U as gevolg van %2$s
Verlengde bolus is beperk tot %1$.1f U as gevolg van %2$s
Beperk maks IAB tot %1$.1f U agv %2$s
Beperk koolhidrate tot %1$d g agv %2$s
@@ -831,7 +623,6 @@
SMB nie toegelaat in open lus modus
Kos
herstel
- Wag vir tydsinkronisasie (%1$d sec)
Ontkoppel (%1$d m)
Maksimum totale IAB OpenAPS kan nie oor [U] gaan
Hierdie waarde is Maks IAB genoem in OpenAPS kontekst\nOpenAPS sal nie meer insulien byvoeg as huidige IAB is groter as hierdie waarde
@@ -847,7 +638,6 @@
Opstel Ghoeroe
EINDIG
Kies u taal
- Versoek: %1$.2fU Gelewer: %2$.2fU Fout kode: %3$s
Eerste insulien inkrement
Tweede insulien inkrement
Derde insulien inkrement
@@ -870,7 +660,6 @@
Virtuele Pomp
Pomp definisie
Bolus: Stap =%1$s\nVerlengde Bolus: [stap%2$s, duur = =%3$smin -%4$sh]\nBasal: stap =%5$s\nTBR: %6$s (deur %7$s), duur =%8$smin -%9$sh\n%10$s
- * Slegs diskrete waardes geen reekse word ondersteun as granulariteit vir basale/bolus in virtuele pomp.
Autobackfill BG
Ghoeroe-instellings
Berekeninge is ingesluit in die ghoeroe verslag:
@@ -899,18 +688,6 @@
Versoek
Konfigureer insulien plugin
Uitgang
- Gebruiker opsies
- Vertoon tyd formaat
- Knoppie rol
- Biep op knoppie druk
- Alarm
- Klank
- Vibreer
- Beide
- Glukose eenhede
- Stoor opsies te pomp
- Aan
- Af
Open navigasie
Sluit navigasie
Plugin voorkeure
@@ -926,8 +703,6 @@
Ongeldige pomp opstelling kontroleer die hulpdokumente en verifieer dat die vinnige inligting kieslys wel QUICK INFO benaam is met behulp van die 360 konfigurasie sagteware.
Gepasmaak
- Enorme tydsverskil
- Groot tydverskil: \nTyd in pomp is uit met meer as 1,5 uur. \nVerstel asb die tyd per hand op die pomp en maak seker dat lees die geskiedenis van die pomp nie onverwagte gedrag veroorsaak. \nAs moontlik, verwyder die geskiedenis vanaf die pomp voor die verandering van die tyd of versper die geslote lus vir een DIA na die laaste verkeerde geskiedenis inskrywing maar minimum een DIA van nou.
Skoon AndroidAPS begin
Gestoorde instellings gevind
Aandag: As jy aktiveer en koppel aan \'n hardeware pomp, AndroidAPS sal die basale instellings uit die profiel aan die pomp kopieer, die bestaande basale koers gestoor op die pomp sal oorskryf word. Maak seker jy het die korrekte basale instelling in AndroidAPS. As jy nie seker is of nie die basale instellings wil oorskryf op jou pomp, druk Kanselleer en herhaal oorskakel na die pomp op \'n later tyd.
@@ -951,17 +726,10 @@
Verkose APS modus
Totaal
Bereken
- Handskudding
Stuur vandag se loglêers aan ontwikkelaars saam met hierdie tyd. Onverwagte situasie.
- Max bolus skending
- Opdrag fout
- Spoedfout
- Insulien limiet skending
Minimale versoek verandering [%]
Oop lus sal nuwe verandering versoek as die %. Verstek waarde is 20%
- Verbind asseblief jou pomp met jou selfoon!
Soek vir toestelle…
- Wag asseblief…
Maats voltooi
Stem die kodes gewys op hierdie toestel en op jou pomp saam?
Insight maatjies
@@ -1050,7 +818,6 @@
is ewe of groter as
is groter as
is nie beskikbaar nie
- onbekend
Glukose is nie beskikbaar nie
Glukose %1$s %2$.0f %3$s
Glukose %1$s %2$.1f %3$s
@@ -1067,23 +834,10 @@
Outo
Outomatisasie
== ∑ %1$s U
- U/h
- g/U
- /U
Log sensor verander na NS
Skep geleentheid \"sensor verandering\" in NS automaties op sensor begin
Tomato (MiaoMiao)
Tomato
- sekonde
- minuut
- uur
- dag
- week
- sekondes
- minute
- ure
- dae
- weke
JouTidepool login gebruiker, normaallweg \'n email adres
Login Gebruiker Naam
Jou Tidepool login kode
@@ -1123,7 +877,6 @@
ou weergawe
baie ou weergawe
2h
- %1$.2fU
DexcomG App (opgedateerde)
DXCM
Ontvang BG waardes vanaf die opgedateerde Dexcom app.
@@ -1186,10 +939,6 @@
STOP
Verkose
RileyLink Skan
- Bluetooth Low Energy word nie ondersteun.
- Bluetooth nie aan.
- Location nie aan
- Vir Bluetooth ontdek om te werk op nuwer toestelle, lokaliteit moet aan wees. AAPS speur nie jou lokaliteit en kan afgeskakel na paring.
Aktiveer
Nee
Skandeer
@@ -1229,7 +978,6 @@
Opstel het gefaal
Pomp onbereikbaar
Pod onbereikbaar
- Nie gestel nie
Medtronic Pomp
Omnipod
@@ -1295,13 +1043,11 @@
Stuur\'n SMS: %1$s
Stuur\'n SMS met die teks
Bolus beperking aangewend: %2$.2fU to %3$.2fU]]>
- %1$.0f / %2$d U
Laai tans...
Sluimer
Tyd reeks
Tyd is tussen %1$s en %2$s
Tussen
- Maak toe
Ongeldig boodskap teks
%1$s ISF: %2$.1f
%1$.0fg IC: %2$.1f
@@ -1310,4 +1056,13 @@
Bolus slimjan
min
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/values-bg-rBG/strings.xml b/app/src/main/res/values-bg-rBG/strings.xml
index 2811beea92..5da523fc0d 100644
--- a/app/src/main/res/values-bg-rBG/strings.xml
+++ b/app/src/main/res/values-bg-rBG/strings.xml
@@ -12,13 +12,10 @@
Нулирай базата данни
Сигурни ли сте че искате да изтриете всички данни?
Изход
- Използвай удължени болуси при над >200%%
- DanaR Bluetooth устройство
Използване на абсолютни стойности за базал
Рестартирайте телефона или AndroidAPS от системните настройки или Android APS няма да записва проблемите (което е важно за работата на алгоритъма)!
Вашият телефон не поддържа оптимизация на батерията - може да се появят проблеми!
Бутони за бърз достъп до основни функции
- Въвеждане на разширени записи в логовете.
За конфигурация на активните плъгини
Разучаване на програмата
Показва въведените в Nightscout храни
@@ -36,10 +33,6 @@
Работа с профила, които сте дефинирали в Nightscout
Работа с профил със само една стойност за всички часове.
Поддръжка за Accu-Chek Combo помпи, изискваща инсталиран ruffy
- Поддръжка за Dana Diabecare R помпи
- Поддръжка за корейски Dana Diabecare R помпи
- Поддръжка за Dana Diabecare R помпи с обновен софтуер
- Поддръжка за Dana Diabecare RS помпи
Писалки - За хората, които правят множество ежедневни инжекции ( интензифицирано лечение с писалки)
За помпи, който все още не работят с AndroidAPS(Open Loop)
Чувствителността се изчислява по същия начин като в Oref0, но можете да зададете времева рамка. Минимална въглехидрати абсорбция се изчислява от Макс време за усвояване на въглехидратите в опциите.
@@ -54,13 +47,6 @@
Наблюдавайте и контролирайте AndroidAPS, от вашия WearOS часовник.
Покажи информация за вашия APS на xDrip + циферблат на часовник.
Дистанционно управление AndroidAPS чрез използване на SMS команди.
- Единици
- DIA (Време на действие на инсулина):
- IC (Инсулин/въглехидр.):
- ISF (Инс.чувствителност):
- Базал
- Целeва КЗ:
- НЕ Е ЗАДАДЕН ПРОФИЛ
Инсулин:
Вълехидрати:
IOB:
@@ -76,15 +62,9 @@
Вр.цел
ВХ
Корекция
- Ед.
IOB от болуси
Старт сега
ВИРТУАЛНА ПОМПА
- Базова базална стойност
- Временен базал
- Удължен болус
- Батерия
- Резервоар
ОК
Последно изпълнение
Параметри на входа
@@ -96,16 +76,11 @@
Резултат
Резултат: %1$s %2$s
Няма данни за КЗ
- Не се изисква промяна
Искане
- Стойност
- Срок
- Основание
Кръвна захар
Изменение (Δ)
Изменение (делта):
Конфигурация
- Цели
Общ
NS Профил
Обикновен профил
@@ -123,7 +98,6 @@
Общи
Това са някой общи функции, които може да са Ви от полза.
Кои ограничения да се прилагат?
- дни
Ограничения
Кръг - Loop
Режим на APS - Loop
@@ -139,7 +113,6 @@
Модула е изключен
Нарушено ограничение
Грешка при подаване на болус
- Грешка при подаване на временен базал
Базална стойност [%]
Приложи нов временен базал:
Болус
@@ -150,7 +123,6 @@
Болус:
Базал
Базал:
- Въглехидрати
Променете данните!
Източник на данни за КЗ
От къде трябва да AndroidAPS да си взима данни?
@@ -167,25 +139,6 @@
Базален IOB
Приложено ограничение на болус
Приложено ограничение на въглехидрати
- Проверка на КЗ
- Известие
- Бележка
- Въпрос
- Физ. активност
- Смяна на сет
- Смяна на сензор
- Старт на сензор
- Смяна на резервоар
- Смяна на профил
- Болус за закуска
- Болус за основно хранене
- Болус корекция
- Комбиниран болус
- Старт на временен базал
- Край на временен базал
- Корекция с въглехидрати
- OpenAPS спрян
- Тип събитие
Друго
Глюкомер
Сензор
@@ -217,35 +170,12 @@
Макс. лимит на временен базал [Е/ч]
Максимален IOB
Този параметър се нарича максимален IOB в OpenAPS и подразбиране е 0. След няколко дни или седмици можете да го увеличите.
- Разбрах
- DanaR
- Свързване
- Свързана
- Не е сврзана
- DanaR настройки
Лицензионно споразумение с краен потребител
НЕ ТРЯБВА ДА СЕ ИЗПОЛЗВА ЗА ВЗЕМАНЕ НА МЕДИЦИНСКИ РЕШЕНИЯ. НЯМА ГАРАНЦИЯ ЗА ПРОГРАМАТА, ДО СТЕПЕНТА, ПОЗВОЛЕНА ОТ ПРИЛОЖИМОТО ПРАВО. ОСВЕН КОГАТО Е ПОСОЧЕНО ДРУГО В ПИСМЕН ВИД, ПРИТЕЖАТЕЛИТЕ НА АВТОРСКОТО ПРАВО И/ИЛИ ДРУГИ СТРАНИ ПРЕДОСТАВЯТ ПРОГРАМАТА \"КАКТО Е\", БЕЗ ГАРАНЦИИ ОТ ВСЯКАКЪВ ВИД, ИЗРАЗЕНИ ИЛИ ПОДРАЗБИРАЩИ СЕ, ВКЛЮЧИТЕЛНО, НО НЕ САМО, ПОДРАЗБИРАЩИ СЕ ГАРАНЦИИ ЗА ПРОДАВАЕМОСТ И ПРИГОДНОСТ ЗА КОНКРЕТНА ЦЕЛ. ЦЕЛИЯ РИСК ПО ОТНОШЕНИЕ НА КАЧЕСТВОТО И ЕФЕКТИВНОСТТА НА ПРОГРАМАТА Е САМО ВАШ. АКО ПРОГРАМАТА НЕ СРАБОТИ, ВИЕ ПОЕМАТЕ ВСИЧКИ НЕОБХОДИМИ РАЗХОДИ ЗА ОБСЛУЖВАНЕ, РЕМОНТ ИЛИ КОРЕКЦИЯ.
Разбирам и приемам
Съхрани
- Не е открит Bluetooth адаптер
- Избраното устройство не е открито
- Грешка при свързване с помпата
- IOB на помпата
- Инсулин за деня
- Последен болус:
- преди %1$.1fч
- Грешни входящи данни
- Неправилна стойност
Презареди профил
- Виж профил
- Приложено
- Коментар
- Успешен
- Процент
- Абсолютна
- Откажи временен базал
SMS комуникатор
- Изчаква резултат от помпата
Разрешени телефонни номера
+XXXXXXXXXX;+YYYYYYYYYY
За да доставите болус от %1$.2fЕ отговорете с код %2$s
@@ -266,54 +196,13 @@
Временна цел от %1$s за %2$d минути
Временна цел от %1$s за %2$d минути стартирана успешно
Временна цел успешно спряна
- Стартирам %1$.2fЕ
Позволи отдалечени команди чрез SMS
- Пръст
- Сензор
- Друго
- Временна цел
- Откажи временна цел
DanaR профил
DIA (Време на действие на инсулина) ч.:
Време на действие на инсулина
- Неуспешно обновяване на базалния профил
- Презареди
Качване
- E болус
- Двувълнов болус
- Двоен разширен болус
- грешка
- презареждане
- базал по часове
- КЗ
- въглехидрати
- аларма
- Общо %1$d записа качени
- Бърз болус
- Аларми
- Базален по часове
- Болуси
- Въглехидрати
- Инсулин за деня
- Грешки
- КЗ
- Презареждане
- Спиране
- Свързване %1$d сек
- Парола за помпата
- Грешна парола за помпата!
- Помпата е заета
- Доставен
- Спрян
Болусът е спрян
Спиране на болус
- Запушване
- Спри
- Натиснат е СТОП!
- Очаква помпата
- Ще стартира %1$.2fЕ болус
- Достигнахте лимита
- Няма избран профил
APS е деактивиран
APS е активиран
APS е изключен
@@ -353,11 +242,9 @@
Хранене
Корекция
Действия
- Стартиран AndroidAPS
Само качва данни в NS (изключва синхронизацията)
Само качване на данните в NS. Няма ефект върху данните за КЗ ако локален източник като xDrip е избран. Няма ефект върху профила освен ако не е избран NS-профил.
Помпата не е инициализирана!
- Помпата не е инициализирана, профила не е зададен!
Пълнене на сет
Моля, уверете се, че стойността съответсва на вашият сет! Този инсулин не се включва в IOB!
Други
@@ -367,8 +254,6 @@
Бутон 3
Единици:
Единици
- мг/дл
- ммол/л
DIA
Целева КЗ:
Диапазон за визуализация
@@ -378,17 +263,7 @@
Часовник
Изпрати отново всички дани
Отвори настройките на часовника
- Грешка в промпата
- Изтощена батерия
- Помпата е изключена
- Батерията на помпата е изтощена
- DanaR Корейска
Базал:
- Неуспешно задаване на базален профил
- Профила на помпата е обновен
- Забрани EasyUI режим в помпата
- Разрешете удължените болуси в настройките на помпата
- Променете режима от U/d на U/h в помпата
Базалните стойности са под минимума. Не е зададен профил!
КЗ:
Последна КЗ:
@@ -396,7 +271,6 @@
MM640g
Текущи известия
СТАРИ ДАННИ
- преди %1$d мин
преди %1$d мин
Локален профил
OpenAPS AMA
@@ -412,41 +286,22 @@
Хипоглекимия
Физ.активност
Премахни
- DanaR статистика
- Комулативна TDD
- Експоненциално претеглена TDD
- Базал
- Болус
- TDD
- Дата
- Коефициент
- # дни
- Тегло
- Възможна неточност, ако сте използвали болус за презареждане!
- Стари данни - натиснете \"ПРЕЗАРЕДИ\"
- Общо базален инсулин
- ОБИ * 2
- Инициализация ...
ДЕЙСТВ
КОНФ
ЦИК
ОПр
APS
ЛПр
- DANA
ОСН
ВП
NSПр
Леч
- КП
Цел
WEAR
SMS
Използвай къси имена
Използвай краткоср. Δ вместо разлика от последната КЗ
Полезно при данни за КЗ с много шум
- Разширени настройки
- Модел: %1$02X Протокол: %2$02X Код: %3$02X
Профил
По подразбиране: 3 Това е основен параметър в сигурността на OpenAPS. Той ограничава максималният базал да бъде 3 пъти най-голямата стойност от дневните базали. Не би трябвало да има нужа от промяна, защото от опит сме проверили, че максимумите са “3x от най-високия дневен; 4x от текущия”.
По подразбиране: 4\nТова е другият основен параметър в сигурността на OpenAPS, и другата половина от \"3x от най-високия дневен; 4x от текущия\". Това означава, че независимо от макс базал настроен в помпата, стойността на базала не може да е по-висока от тази стойност умножена по стойността на базала за текущият час от денонощието. Това е с цел да предпази от прекалено високи стойности на максималния базал преди да разбират как работи алгоритъма. Повечето от Вас няма да имат нужда от смяна на тази стойност и могат да се справят с настойки на другите параметри.
@@ -465,18 +320,9 @@
Неуспешно. Получаването трябва да е разрешено в xDrip.
xDrip не получава калибрации
Помпата е спряна
- Получава статус на помпата
- Настройва временен базал
- Спира временен базал
- Настойва удължен болус
- Спира удължен болус
- Обновява базални стойности
- Спира връзката
Изпълнява
Настойки Виртуална Помпа
Качва статуса в NS
- Грешна парола
- Близо до максмалния дневен инсулин
Вътрешен NS клиент
NSКЛ
Nightscout aдрес:
@@ -500,7 +346,6 @@
Покажи подробен IOB
Раздели IOB от болус и от базал на часовника
неуспешно - моля проверете телефона
- Недостъпно
Възраст на потребителя
Дете
Тийнейджър
@@ -533,8 +378,6 @@
Суперболус
Записвай всяко стартиране на AndroidAPS в NS
Рестартиране за да се приложат новите настройки.
- DanaRv2
- Инсулин
Кой тип на инсулин използвате?
Бързодействащ инсулин
Novorapid Novolog, Humalog
@@ -549,9 +392,6 @@
Критично ниво на батерията под [%]
IOB
СОВ
- Фърмуер
- Последно свързване
- Bluetooh статус
За приложението
SMS команда забранена
Липсва разрешение до данни от телефона
@@ -562,17 +402,12 @@
Добави BGI към статуса
Без качване на данни в NS
Всички данни за NS се пропускат. AAPS е свързан с NS, но не прави промени в NS
- Стъпка при базал
- Стъпка при болус
Спри удължен болус
Възраст на сензора
Възраст на канюла
Възраст на инсулина
- часа
- Грешен профил !!!
Смени профил
Възраст на батерията на помпата
- Смяна на батерия
Опции за аларми
Много висока
Висока
@@ -596,7 +431,6 @@
Настройки за абсорбция
Максимално време за усвояване на храненето [ч]
Брой часове, за които се очаква храненето да бъде напълно усвоено в организма
- Показвай удължените болуси като %%
ВСенз
ВИнс
ВКан
@@ -621,7 +455,6 @@
ПОМПА
Продължителност [мин.]
OpenAPS SMB
- SMB
Разреши UAM
Разреши SMB
Използвай супер микро болуси вместо временен базал за по бързо действие
@@ -633,23 +466,7 @@
Ултра бързодействащ по Oref
DIA от %1$f е твърде кратка - използвай %2$f вместо това!
Активирай профила
- Дата
НЕВАЛИДНО
- Очаква сдвояване с помпа
- Сдвояване - ОК
- Времето за сдвояване изтече
- Сдвояване
- Все още устройството не е намерено
- Празен резервоар
- Предупреждение за измерване на КЗ
- Оставащ инсулин
- DanaRS
- Dana
- Избрана помпа
- Сдвояване с нова помпа
- Скорост на болус
- Задайте стъпка на базала 0.01 Е/ч
- Сериен номер
% от профила
Време на отместване
Временна цел по подразбиране
@@ -659,32 +476,18 @@
Целева КЗ при физ. активност
Продължителност на вр. цел при хипоглекимия
Временна цел при хипоглекимия
- Пълнене
- Получава статус на удължен болус
- Получава болус статус
- Получава статус на временен базал
- Получава настройките на помпата
- Получава времето на помпата
отново
Контролиране от часовник
Задаване временни цели и въвеждане Лечения от часовник Android wear
- Времето за връзка изтече
Храна
гр.
- мин.
- ч.
- д
]]>
килодж.
Ен
Бел.
Маз.
]]>
- Изчаква края на болуса. Остават %1$d сек.
- Обработва се събитие
- Стартира доставка на болус
Командата се изпълнява в момента
- Драйверът за помпата е коригиран
Помпата е недостъпна
Липсват данни за КЗ
Използвай системни известия за аларми и съобщения
@@ -694,9 +497,6 @@
Лимит за недостъпна помпа [мин]
Спешна аларма
ИНФО
- Блутуут
- Блутуут ограничения
- Изключва Bluetooth на телефона за една секунда, ако няма връзка с помпата. Това може да помогне на някои телефони, където Bluetooth блокира.
Eversense приложение(модифицирано)
Качвай данните за КЗ в NS
Настройки при качване на КЗ към Nightscout
@@ -704,12 +504,9 @@
Показвай делта с още един десетичен знак
Максимум минути СМБ
Максимални минути за ограничаване на базала от SMB
- Неподдържан фърмуер на помпата
Изпращай данни за КЗ към xDrip+
В xDrip+ изберете 640g/Eversense за източник на данни
КЗ от NS
- Базалната стойност е заместена от минимално поддържаната стойност %1$s
- Базалната стойност е заместена от максимално поддържаната стойност %1$s
Калкулиране на КЗ
Калкулиране на Болус IOB
Калкулиране на базален IOB
@@ -727,8 +524,6 @@
APS - Затворен кръг е позволен
Максимален IOB е зададен правилно
Има данни за КЗ от избрания източник
- Базалните стойности не са за кръгли часове: %1$s
- Грешен профил: %1$s
Програмиране на помпа за болус
Обнови
Състояние
@@ -749,7 +544,6 @@
Болуси с едно и също количество бяха поискани в последните две минути. За да се предотврати дублиране вече доставен болус, операцията е забранена.
Сега
Чете историята на помпата
- История
Настройва базалният профил
Ниско ниво на резервоар на помпа
Батерията на помпата е слаба
@@ -768,8 +562,6 @@
Грешка при доставяне на удължен болус
Sight
преди
- %1$.2f ч
- %1$d мин
Разреши SMB постоянно
Разрешава SMB постоянно и независимо от болусите. Възможно само с източник на КЗ с добра филтрация като G5
Разреши SMB след въглехидрати
@@ -780,8 +572,6 @@
Разрешава SMB, когато има активна временна цел на КЗ
Разреши SMB с по-високи временни цели на КЗ
Разрешава SMB когато има активна по-висока временна цел
- Нека текущия временен базал продължи
- Заглушаване
Инсулин
Въглехидрати
Бутони
@@ -823,7 +613,6 @@
Използвате dev версия. Затворения кръг е недостъпен за Вас.
Режим за раработчици (Engineering mode) включен
Режим за раработчици (Engineering mode) не е активиран и не е release версия
- %1$.2f Е/ч
Прочита базалният профил
Историята на помпата се промени след извършване на изчислението за болус. Болусът не беше доставен. Моля, преизчислете дали все още е необходим болус.
Болус успешно инжектиран, но добавянето на лечение в базата данни е неуспешно. Това може да се случи, ако два малки болуса със същия размер са направени в рамките на последните две минути. Проверете записите в историята на помпата и използвайте Careportal, за да добавите липсващи записи. Уверете се,че не добавяте еднакви записи за точно една и съща минута и същото количество инсулин.
@@ -846,15 +635,10 @@
SMB е забранен в настройките
UAM е забранен в настройките
UAM изключен, защото му трябва Oref1 плъгин за чувствителност
- Ограничаване на макс. базална стойност до %1$.2f Е/ч поради %2$s
- лимит на помпата
- трябва да бъде положително число
множител на макс. базал
множител на макс. дневен базал
Има болус през последните 3 мин, пропускам SMB
Базалът е зададен коректно
- Ограничаване на максималната процентна стойност до %1$d%% поради %2$s
- Ограничаване на болус до %1$.1f Е поради %2$s
Ограничение на удължен болус до %1$.1f Е поради %2$s
Ограничаване на макс. IOB до %1$.1f Е поради %2$s
Ограничаване на въглехидрати до %1$d гр. поради %2$s
@@ -869,7 +653,6 @@
SMB не е позволен в режим Отворен кръг
Храна
нулиране
- Изчаква синхронизация на времето (%1$d сек)
Разкачена помпа (%1$d мин)
Максималният общ IOB OpenAPS не може да бъде повече от [U]
Тази стойност се нарича Max IOB в контекста на OpenAPS. OpenAPS няма да добавя инсулин, ако текущата IOB е по-голяма от тази стойност
@@ -885,7 +668,6 @@
Съветник за настройване
КРАЙ
Избиране на език
- Стартирано: %1$.2fЕ Доставено: %2$.2fЕ Код на грешка: %3$s
Стойност на първия бърз бутон [e]
Стойност на втория бърз бутон [e]
Стойност на третия бърз бутон [e]
@@ -908,7 +690,6 @@
Виртуална помпа тип
Описание на помпата
Болус: Стъпка =%1$s\Удължен болус: [стъпка =%2$s, продължителност =%3$smin -%4$sh] \nБазал: стъпка =%5$s\ nTBR: %6$s (от %7$s), продължителност =%8$sмин -%9$sh\n%10$s
- * Само конкретни стойности! Диапазони не се поддържат за базал/болус при виртуална помпа.
Изтегляне КЗ от Найтскаут
Настройки на съветник
Изчисления, включени в резултата на съветника:
@@ -939,22 +720,6 @@
Искане
Конфигуриране на модула за Инсулин
Изход
- Потребителски опции
- Формат на времето
- Превъртане при задъжане
- Звуков сигнал при натискане на бутон
- Тип аларма
- Звукова
- Вибрация
- И двете
- Включен екран за [seconds]
- Подсветка [seconds]
- Единици на КЗ
- Изключване след [hours]
- Минимален инсулин в резервоара [Units]
- Запиши опциите в помпата
- Вкл
- Изкл
Отвори меню
Затвори меню
Настройки на модул
@@ -970,8 +735,6 @@
Невалидни настройки на помпата, проверете wiki и се уверете че меню Quick Info се казва QUICK INFO, с помощта на 360 софтуера.
По избор
- Голяма времева разлика
- Голяма времева разлика: Помпата е изключена за повече от 1,5 часа. Моля, регулирайте ръчно времето на помпата и се уверете, че четенето на историята от помпата не води до неочаквано поведение. Ако е възможно, премахнете историята от помпата, преди да промените времето или да изключите затворения кръг за едно DIA след последното погрешно влизане в историята, но поне едно DIA отсега.
AndroidAPS стартира
Открити са предишни настройки
Внимание: Ако активирате и свържете с хардуерна помпа, AndroidAPS ще копира основните настройки от профила в помпата, като презапише съществуващата базова скорост, съхранявана на помпата. Уверете се, че имате правилните основни настройки в AndroidAPS. Ако не сте сигурни или не искате да презапишете основните настройки на помпата, натиснете Cancel и повторете превключването към помпата по-късно.
@@ -996,17 +759,10 @@
Предпочитаният режим на APS
Общо
Калк
- Сдвояване
Изпрати последните лог файлове на разработчиците. Непредвидена ситуация.
- Превишавате макс болус
- Грешка при команда
- Скорост грешка
- Нарушение на макс дневен инсулин
Минимална стойност за промяна [%]
AndroidAPS ще покаже запитването за промяна на базала само ако е по-голямо от тази стойност.(Стандартно 20%)
- Моля първо свържете помпата с телефона от Bluetooth настройките
Търсене на устройства...
- Моля изчакайте...
Сдвояване завършено
Съвпадат ли кодовете, показани на това устройство и на Вашата помпа?
Insight свързване
@@ -1095,7 +851,6 @@
е равно или по-голямо от
е по-голяма от
не е налично
- неизвестно
КЗ не е достъпна
КЗ %1$s %2$.0f %3$s
КЗ %1$s %2$.1f %3$s
@@ -1112,23 +867,10 @@
Автом
Автоматизация
Общо %1$s Е
- Е/ч
- гр/Е
- /Е
Записвай смяната на сензор в NS
Създаване на събитие \"Смяна на сеснзор\" в NS автоматично при старт на сензор
Tomato(MяоМяо)
Tomato
- секунда
- минута
- час
- ден
- седмица
- секунди
- минути
- часове
- дни
- седмици
Потребителското Ви име за Tidepool, обикновено е Вашия имейл
Потребителско име
Tidepool парола
@@ -1171,7 +913,6 @@
много стара версия
Има нова версия от най-малко %1$d дни! Ще спре подаването на инсулин след %2$d дни, цикълът ще бъде изключен след %3$d дни
2ч
- %1$.2fЕ
Dexcom приложение (модифицирано)
DXCM
Да получава данни за КЗ от модифицираното приложение на Dexcom.
@@ -1245,10 +986,6 @@
СТОП
Избрано
RileyLink скенер
- Bluetooth Low Energy не се поддържа.
- Bluetooth не е включен.
- Локацията не е включена
- За да работи откриването на нови устройсва чрез Bluetooth, трябва да включите локацията. AAPS не проследява вашето местоположение и ще можете да я изключите след успешното свързване.
Разреши
Не
Сканиране
@@ -1289,7 +1026,6 @@
Настройката се провали
Помпата е недостъпна
Pod е недостъпen
- Не е зададен
Medtronic помпа
Omnipod
@@ -1359,7 +1095,6 @@
%2$+.2fг Е]]>
Ограничение на болуса: %2$.2fЕ на %3$.2fЕ]]>
!!!!! Бавна абсорбция на въглехидрати: %2$d%% от времето. Проверете въведените данни. Може да има голяма грешка !!!!!]]>
- %1$.0f / %2$d Е
Стартирай част от резултата в калкулатора [%]
Калкулатора изчислява нужния инсулин, но само тази част ще бъде доставена. Полезно със SMB алгоритъма.
Зареждане ...
@@ -1367,7 +1102,6 @@
Времеви диапазон
Часът е между %1$s и %2$s
Между
- Затвори
Повишавам максималната стойност на базал, защото тя е по-ниска от най-високата в базалния профил
Невалиден текст на съобщение
%1$s ISF: %2$.1f
@@ -1385,7 +1119,6 @@
Изкл
Изчисти приключение
Изчисти стартираните
- Засичане на времето
Искате ли да нулирате прогреса си?
Не е избрана помпа
Изберете единиците, в които искате да работите
@@ -1411,7 +1144,6 @@
Проучване
Невалидна възраст
Невалидно тегло
- %1$s: ∑: %2$.2f Бол: %3$.2f Баз: %4$.2f]]>
%1$s: Ниски: %2$02d%% В: %3$02d%% Вис: %4$02d%%]]>
Средно
ТДД
@@ -1424,12 +1156,8 @@
КЗ
Инструменти
Покажи изчисленията
- Грешка
- 12ч
- 24ч
Събитие
Вече направено
- Съобщение
Изтрий опашка? Всички данни ще се загубят!
Използване на удължен болус ще спре режим затворен цикъл за времето на болуса. Сигурни ли сте?
Затворен цикъл е недостъпен поради стартиран Удължен болус
@@ -1442,4 +1170,13 @@
Диапазон между временни базали
Продължителност на временни базали
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/values-cs-rCZ/strings.xml b/app/src/main/res/values-cs-rCZ/strings.xml
index 52cdbe4638..9819565981 100644
--- a/app/src/main/res/values-cs-rCZ/strings.xml
+++ b/app/src/main/res/values-cs-rCZ/strings.xml
@@ -12,13 +12,10 @@
Inicializovat databáze
Opravdu resetovat všechny databáze?
Konec
- Použít prodloužené bolusy pro >200%%
- DanaR Bluetooth zařízení
Vždy použít absolutní hodnoty bazálu
Prosím restartujte Váš telefon nebo restartujte AndroidAPS z nastavení systému\njinak nebudou zaznamenány ladící informace (důležité pro sledování a kontrolu, zda algoritmus pracuje správně)!
Toto zařízení zřejmě neumožňuje vypnout optimalizaci baterie - může docházet k problémům s výkonem.
Tlačítka k běžně používaným úkonům
- Zadávání událostí pro management diabetu.
Nastavení konfigurace (povolování součástí systému)
Výukový program
Zobrazení jídel definovaných v NS
@@ -36,10 +33,6 @@
Použití profilu definovaného v Nightscoutu
Jednoduchý profil s jedním časovým pásmem.
Ovladač pumpy pro Accu-Check Combo. Vyžaduje nainstalovanou aplikaci Ruffy
- Ovladač pumpy pro DanaR
- Ovladač pumpy pro korejskou verzi DanaR
- Ovladač pumpy pro DanaR s upgradovaným firmwarem
- Ovladač pumpy pro DanaRS
Ovladač pumpy pro uživatele inzulínových per
Ovladač pumpy pro uživatele bez podporované pumpy (Otevřená smyčka)
Citlivost je počítána stejným způsobem jako v Oref0, ale je možné specifikovat dobu do minulosti. Minimální absorpce sacharidů je počítána dynamicky z maximální doby absorpce definované v nastavení.
@@ -54,13 +47,6 @@
Zobrazování stavu a řízení AndroidAPS z hodinek s WearOS
Zobrazování informací o smyčce na xDrip+ watchface.
Vzdálené řízení pomocí SMS příkazů
- Jednotky
- Doba působnosti inzulínu
- Inzulínosacharidový poměr
- Citlivost
- Bazál
- Cíl
- ŽÁDNÝ PROFIL NENASTAVEN
Inzulín:
Sacharidy:
IOB:
@@ -76,15 +62,9 @@
DC
Sacharidy
Korekce
- U
Bolusové IOB
Spustit teď
VIRTUÁLNÍ PUMPA
- Základní hodnota bazálu
- Dočasný bazál
- Prodloužený bolus
- Baterie
- Zásobník
OK
Poslední spuštění
Vstupní parametry
@@ -96,16 +76,11 @@
Výsledek
Výsledek: %1$s %2$s
Nedostupná data o glykémiích
- Změna nepožadována
Požadavek
- Hodnota
- Trvání
- Zdůvodnění
Glykémie
Rozdíl
Rozdíl:
Konfigurace
- Cíle
Přehled
NS profil
Jednoduchý profil
@@ -123,7 +98,6 @@
Obecné
Obecné pluginy, které by se Vám mohly hodit.
Jaká omezení byla použita?
- dnů
Omezení
Smyčka
Smyčka
@@ -139,7 +113,6 @@
Modul zakázán
Mimo povolený rozsah
Chyba podání bolusu
- Chyba nastavování dočasného bazálu
Hodnota bazálu [%]
Spustit nový dočasný bazál:
Bolus
@@ -150,7 +123,6 @@
Bolus:
Bazál
Bazál:
- Sacharidy
Změňte zadání!
Zdroj glykémie
Odkud má získávat AndroidAPS glykémie?
@@ -158,6 +130,7 @@
Typ smyčky
Uzavřená smyčka
Otevřená smyčka
+ Ochrana před nízkou glykémií
Smyčka zakázána
Zakázat smyčku
Povolit smyčku
@@ -167,25 +140,6 @@
Bazální IOB
Aplikováno omezení bolusu
Aplikováno omezení sacharidů
- Kontrola glykémie
- Oznámení
- Poznámka
- Otázka
- Cvičení
- Výměna setu
- Výměna senzoru
- Znovu spuštění senzoru
- Výměna inzulínu
- Přepnutí profilu
- Bolus na svačinu
- Bolus na jídlo
- Korekční bolus
- Kombinovaný bolus
- Dočasný bazál začátek
- Dočasný bazál konec
- Přídavek sacharidů
- OpenAPS vypnuto
- Typ události
Jiné
Glukoměr
Senzor
@@ -217,11 +171,11 @@
Tato hodnota je v kontextu OpenAPS nazývána max basal
Maximální bazální IOB [U]
Tato hodnota je v kontextu OpenAPS nazývána max IOB
- POTVRDIT
Zobrazí se výzva k zadání hlavního hesla, které bude použito k šifrování exportovaných předvoleb.
Zobrazí se výzva k zadání hlavního hesla, které bude použito k dešifrování importovaných předvoleb.
Export zrušen! Předvolby NEBYLY exportovány!
Import zrušen! Předvolby NEBYLY importovány!
+ Vyberte soubor, který chcete importovat
Před importem zkontrolujte předvolby:
Předvolby nelze importovat!
Předvolby by neměly být importovány!
@@ -234,6 +188,8 @@
Používáte zastaralý formát od starých verzí AAPS, který není zabezpečený! Použijte jej pouze jako poslední možnost, pokud nemáte exporty v aktuálním formátu JSON.
Importované předvolby jsou staré již %1$s dní! Možná máte aktualnější export nebo jste vybral špatný soubor? Nezapomeňte předvolby pravidelně exportovat!
Neplatný formát datumu!
+ Nastavení z odlišné nižší verze aplikace. Je to v pořádku, pokud importujete po aktualizaci, po importu však zkontrolujte, zda jsou nastavení stálé správná!
+ Nastavení z odlišné hlavní verze aplikace. Hlavní verze se výrazně liší a nemusejí mít kompatibilní nastavení. Po importu zkontrolujte, zda jsou nastavení stálé správná!
Formát souboru
Vytvořeno
Verze AAPS
@@ -256,34 +212,17 @@
Chyba dešifrování, zadané heslo je neplatné, nebo byl soubor nastavení změněn! Může se stát, že importovaný soubor byl exportován s jiným hlavním heslem.
Chybí konfigurace šifrování, formát nastavení je neplatný!
Nepodporovaný nebo neurčený šifrovací algoritmus!
- DanaR
- Připojuji
- Připojeno
- Odpojeno
- Nastavení pumpy Dana
+ exportováno dnes
+ exportováno před %1$s
+ exportováno v %1$s
+ exportováno před méně než hodinou
+ v adresáři: %1$s
Licenční ujednání
MUST NOT BE USED TO MAKE MEDICAL DECISIONS. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
ROZUMÍM A POTVRZUJI
Uložit
- Nenalezen Bluetooth adaptér
- Vybrané zařízení nenalezeno
- Chyba připojování pumpy
- IOB z pumpy
- Jednotek za den
- Poslední bolus
- před %1$.1fh
- Chybná vstupní data
- Hodnota nenastavena správně
Obnovit profil
- Zobrazit profil
- Provedeno
- Komentář
- Úspěch
- Procent
- Absolutní
- Zrušit dočasný bazál
SMS komunikátor
- Čekání na výsledek
Povolená tel. čísla
+XXXXXXXXXX;+YYYYYYYYYY
K potvrzení bolusu %1$.2fU odpověz SMS s kódem %2$s
@@ -304,54 +243,13 @@
Cíl %1$s na %2$d minut
Cíl %1$s na %2$d minut byl úspěšně nastaven
Dočasný cíl byl úspěšně zrušen
- Aplikováno %1$.2fU
Povolit posílání příkazů přes SMS
- Glukoměr
- Senzor
- Jiný
- Dočasný cíl
- Dočasný cíl konec
DanaR profil
DIA [h]
Celková doba aktivity inzulínu
- Chyba při nastavení bazálního pprofilu
- Načíst
Nahrávám
- E bolus
- DS bolus
- DE bolus
- chyba
- plnění
- hodinový bazál
- glykémie
- sacharidy
- alarm
- Celkem nahráno %1$d záznamů
- S bolus
- Alarmy
- Hodinové bazály
- Bolusy
- Sacharidy
- Denní inzulín
- Chyby
- Glykémie
- Plnění
- Vypnutí
- Připojování %1$d sec
- Heslo k pumpě
- Špatné heslo k pumpě!
- Pumpa je zaneprázdněna
- Podáno
- Zastaveno
Bolus zastaven
Zastavování bolusu
- Okluze
- Stop
- STISKNUTO STOP
- Čekání na pumpu
- Podávání %1$.2fU inzulínu
- Dosaženo limitu
- Není vybrán žádný profil
Smyčka byla zakázána
Smyčka byla povolena
Smyčka je zakázána
@@ -391,11 +289,9 @@
Bolus
Korekce
Akce
- AndroidAPS restartován
Pouze nahrávání do NS (zakázaná synchronizace)
Pouze nahrávání dat do NS. Neplatí pro glykémie, dokud není vybraný místní zdroj dat jako xDrip. Neplatí pro profily, pokud se používá NS profil.
Pumpa není inicializována!
- Pumpa není inicializována, profil nenastaven!
Plnění/doplňování
Prosím ujistěte se, že hodnota odpovídá specifikaci Vašeho setu!
Jiné
@@ -405,8 +301,6 @@
Tlačítko 3
Jednotky:
Jednotky
- mg/dL
- mmol/L
DIA
Cílový rozsah:
Rozsah pro zobrazení
@@ -416,17 +310,7 @@
Wear
Znovu poslat všechna data
Otevřít nastavení na hodinkách Wear
- Chyba pumpy
- Nízký stav baterie
- Pumpa vypnuta
- Baterie v pumpě vybitá
- Korejská DanaR
Bazál:
- Nastavení bazálního profilu selhalo
- Bazální profil aktualizován
- Zakázat EasyUI režim v pumpě
- Povolit kombo bolusy v pumpě
- Změnit režim z U/d na U/h v pumpě
Hodnota bazálu pod povoleným minimem. Nenastaveno!
Glykémie:
Poslední glykémie:
@@ -434,7 +318,6 @@
MM640g
Průběžné oznámení
ZASTARALÉ
- před %1$d min
před %1$d min
Místní profil
OpenAPS AMA
@@ -450,41 +333,22 @@
Hypoglykémie
Aktivita
Odstranit záznam
- Statistika z pumpy
- Kumulativní TDD
- Exponenciálně vážené TDD
- Bazál
- Bolus
- CDD
- Datum
- Koef
- Dní
- Váha
- Pravděpodobně nepřesné při používání bolusů k doplňování
- Zastaralá data. Prosím načtěte je znovu
- Celk. denní bazál
- TBB * 2
- Inicializuji ...
AKCE
KONF
SMYČ
JPRO
OAPS
MPRF
- DANA
PŘEH
VPUM
PROF
OŠET
- PÉČE
CÍLE
WEAR
SMS
Krátké názvy modulů
Vždy používat krátkodobý průměrný rozdíl glykémií místo rozdílu posledních 2 hodnot
Výhodné, pokud data z xDripu obsahují velký šum.
- Rozšířené nastavení
- Model: %1$02X Protokol: %2$02X Kód: %3$02X
Profil
Výchozí hodnota: 3 Toto je klíčová hodnota zabezpečení. Říká, že maximální nastavitelný bazál je trojnásobkem maximálního denního bazálu. Patrně to nebudete muset měnit, případně si přečtete o tématu \"3x max denní; 4x aktuální\".
Výchozí hodnota: 4 Toto je druhá klíčová hodnota. Říká, že maximální hodnota dočasného bazálu nikdy nebude větší, než čtyřnásobek aktuálního bazálu. Je to proto, aby se lidé nedostali do nebezpečných hodnot dříve, než pochopí jak OpenAPS pracuje. Znovu, výchozí hodnota je 4 a většina lidí ji nikdy nebude muset změnit. Pokud nestačí, obvykle je problém někde jinde.
@@ -503,18 +367,9 @@
Kalibrace odeslána. Příjem musí být v xDripu povolený.
xDrip nepřijímá kalibrace
Pumpa pozastavena
- Nahrávám stav pumpy
- Nastavuji dočasný bazál
- Zastavuji dočasný bazál
- Nastavuji extended bolus
- Zastavuji extended bolus
- Aktualizuji bazály
- Odpojuji
Provádím
Nastavení virtuální pumpy
Nahrávat status do NS
- Chybné heslo
- Blíží se denní limit inzulínu
NSClient
NSCl
Adresa URL:
@@ -538,7 +393,7 @@
Zobrazit detailní IOB
Rozepsat IOB do bolusového a bazálního na hodinkách
neúspěšně - zkontrolujte mobil
- Nedostupný
+ n/a
Stáří pacienta
Dítě
Dospívající
@@ -574,8 +429,6 @@
Superbolus
Zaznamenávat spuštění aplikace do NS
Ukončuji aplikaci, aby se nastavení projevilo.
- DanaRv2
- Inzulín
Jaký druh inzulínu používáte?
Rychlý inzulín
Novorapid
@@ -598,9 +451,6 @@
Úroveň kritického varování stavu baterie [%]
IOB
COB
- Firmware
- Poslední spojení
- Stav Bluetooth
O aplikaci
Chybějící povolení SMS
Chybí oprávnění pro zjišťování stavu telefonu
@@ -611,17 +461,12 @@
Přidat BGI do stavové řádky
Zakázat nahrávání do NS
Všechna data odeslaná do NS jsou zahozena. AAPS je připojen k NS, ale nedělá do něj žádné změny
- Krok bazálu
- Krok bolusu
Zrušit prodloužený bolus
Stáří senzoru
Stáří kanyly
Stáří inzulínu
- hodin
- Chybný profil !!!
Proveďte přepnutí profilu
Stáří baterie v pumpě
- Výměna baterie pumpy
Nastavení alarmů
Urgentně vysoká
Vysoká
@@ -645,7 +490,6 @@
Nastavení absorpce sacharidů
Max. doba absorpce sacharidů [h]
Čas v hodinách, ve kterém předpokládáme, že všechny sacharidy budou strávené
- Zobrazovat prodloužený bolus v %%
SEN
INZ
KAN
@@ -670,7 +514,6 @@
PUMPA
Trvání [min]
OpenAPS SMB
- SMB
Povolit UAM
Povolit SMB
Použít super mikro bolusy místo dočasných bazálů pro zrychlení účinku
@@ -682,23 +525,7 @@
Ultra rychlý - Oref
DIA %1$f je příliš krátké - použito %2$f !
Aktivovat profil
- Datum
NEPLATNÝ
- Čekání na spárování na pumpě
- Spárováno
- Vypršel časový limit pro párování
- Párování
- Prozatím žádné zařízení nenalezeno
- Prázdný zásobník
- Výstraha měření glykémie
- Zbývající inzulín
- DanaRS
- Dana
- Vybraná pumpa
- Párování pumpy
- Rychlost bolusu
- Nastavte bazální krok 0.01U/h
- Sériové číslo
% změna
Posun času
Výchozí nastavení dočasných cílů
@@ -708,32 +535,18 @@
Cíl při aktivitě
Trvání dočasného cíle při hypoglykémii
Cílová glykémie při hypoglykémii
- Doplňování
- Nahrávám prodloužené bolusy
- Nahrávám bolusy
- Nahrávám dočasné bazály
- Nahrávám nastavení pumpy
- Nahrávám čas v pumpě
znovu použít
Řízení z hodinek Wear
Nastavování dočasných cílů a vkládání ošetření na hodinkách Wear.
- Vypršel čas připojování
Jídlo
g
- m
- h
- d
]]>
kJ
En
Pr
Tuk
]]>
- Čekání na konec bolusu. Zbývá %1$d sek.
- Zpracovávám
- Spouštím bolus
Příkaz je právě prováděn
- Ovladač pumpy opraven
Pumpa nedostupná
Chybějící glykémie
Používat systémové notifikace pro výstrahy a oznámení
@@ -743,9 +556,6 @@
Limit pro nedostupnost pumpy [min]
Urgentní alarm
INFO
- Bluetooth
- Hlídač BT
- Vypne na 1 sek bluetooth v telefonu, pokud se nedaří připojit k pumpě. Může to pomoci u telefonů, které mají problémy s BT
Eversense aplikace (upravená)
Nahrávat data do NS
Nastavení nahrávání glykémií
@@ -758,12 +568,9 @@
Maximální počet minut bazálu, ke kterým se limituje SMB pro UAM
Prahová hodnota doporučení sacharidů
Po navržení sacharidů, kolik sacharidů vyvolá upozornění
- Nepodporovaný firmware v pumpě
Odesílat data do xDrip+
V xDrip+ vyberte zdroj dat 640g/Eversense
Glykémie z NS
- Hodnota bazálu nahrazena minimální možnou: %1$s
- Hodnota bazálu nahrazena maximální možnou: %1$s
Kalkulace glykémie
Kalkulace bolusového IOB
Kalkulace bazálního IOB
@@ -781,8 +588,6 @@
Uzavřená smyčka povolena
Maximální IOB nastaveno správně
Glykémie dostupné z vybraného zdroje
- Bazální hodnoty nejsou zarovnané na celé hodiny: %1$s
- Chybný profil: %1$s
Programování pumpy pro bolus
Obnovit
Stav
@@ -803,7 +608,6 @@
Bolus stejné velikosti už byl během poslední minuty požadován. Jako preventivní ochrana před zdvojeným bolusem byla operace zakázána.
Teď
Načítání historie pumpy
- Historie pumpy
Nastavení bazálního profilu
V zásobníku je málo inzulínu
Slabá baterie v pumpě
@@ -822,9 +626,6 @@
Chyba spuštění extended bolusu
Insight
zpět
- %1$.2f h
- %1$d min
- %1$dm
Vždy povolit SMB
Povolit SMB nezávisle na bolusech. Možno pouze se zdroji glykémií s dobrým filtrováním dat, jako např. G5
Povolit SMB po jídle
@@ -835,8 +636,6 @@
Povolit SMB, pokud je aktivní dočasný cíl (aktivita, blížící se jídlo)
Povolit SMB s vysokými dočasnými cíli
Povolit SMB, pokud je aktivní vysoký dočasný cíl (aktivita)
- Nechat běžet aktuální dočasný bazál
- Ztlumit
Inzulín
Sacharidy
Tlačítka
@@ -878,7 +677,6 @@
Běží DEV verze. Uzavřená smyčka je zakázána.
Expertní mód povolen
Expertní mód není povolen a neběží vydaná verze
- %1$.2f U/h
Načítám bazální profil
Historie v pumpě se změnila po spočítání bolusu. Bolus nebyl proveden. Prosím spočítejte ho znovu, pokud je to stále potřeba.
Bolus úspěšně podán, ale zápis se nezdařil. To se může stát pokud jsou podány bolusy stejné velikosti během 2 minut. Zkontrolujte historii pumpy a zadejte chybějící položky do ošetření. Ujistěte se, že nezadáváte stejnou velikost v rámci 1 minuty.
@@ -901,15 +699,10 @@
SMB zakázáno v nastavení
UAM zakázáno v nastavení
UAM zakázáno, protože není povolen Oref1 plugin
- Max bazál omezen na %1$.2f U/h: %2$s
- limit pumpy
- požadována kladná hodnota
maximální násobek bazálu
maximální násobek nejvyššího bazálu
Odeslán bolus během posledních 3 minut, SMB přeskočeno
Bazál nastaven správně
- Bazál omezen na %1$d%%: %2$s
- Bolus omezen na %1$.1f U: %2$s
Prodloužený bolus omezen na %1$.1f U: %2$s
Max IOB omezeno na %1$.1f U: %2$s
Sacharidy omezeny na %1$d g: %2$s
@@ -924,7 +717,6 @@
SBM není povoleno v otevřené smyčce
Jídlo
Resetovat
- Čekání na synchronizaci času (%1$d s)
Odpojeno (%1$d m)
Maximální celková hodnota IOB, kterou OpenAPS nemůže překročit [U]
Tato hodnota je v kontextu OpenAPS nazývána Max IOB.\nOpenAPS nikdy nepřidá inzulín, pokud je současné IOB větší než tato hodnota
@@ -940,7 +732,6 @@
Průvodce nastavením
Dokončit
Vyberte jazyk
- Požadováno: %1$.2fU Doručeno: %2$.2fU Chyba: %3$s
První přídavek inzulínu
Druhý přídavek inzulínu
Třetí přídavek inzulínu
@@ -963,7 +754,6 @@
Typ virtuální pumpy
Definice pumpy
Bolus: Krok =%1$s\nProdl. bolus: [Krok=%2$s, Délka=%3$smin-%4$sh]\nBazál: Krok=%5$s\nDoč. bazál: %6$s (%7$s), Délka=%8$smin-%9$sh\n%10$s
- * Pouze diskrétní hodnoty a ne rozsahy jsou podporovány pro bazál/bolus ve virtuální pumpě.
Doplňování glykémií z NS
Nastavení wizardu
Kalkulace použité ve výsledku wizardu:
@@ -994,22 +784,6 @@
Požadavek
Nastavení inzulínu
Konec
- Uživatelská nastavení
- Formát času
- Posun při stisknutí tlačítka
- Zvuk při stisknutí tlačítka
- Alarm
- Zvuk
- Vibrace
- Oboje
- Čas před vypnutím displeje [sekundy]
- Podsvícení [sekundy]
- Jednotky
- Vypnutí [hodiny]
- Nízký stav zásobníku [Jednotky]
- Uložit do pumpy
- ZAP
- VYP
Otevřít menu
Zavřít menu
Nastavení pluginu
@@ -1029,8 +803,6 @@
Je-li zjištěna vyšší citlivost, zvýší cílovou hladinu glukózy
Chybné nastavení pumpy. Projděte si dokumentaci a přesvědčete se, že menu Quick Info se jmenuje QUICK INFO, za použití 360 configuration software.
Volitelný
- Velký rozdíl v času
- Velký rozdíl v času:\nČas v pumpě se liší minimálně o 1,5 h.\nProsím upravte čas v pumpě ručně a vymažte historii pumpy.\nPokud je to třeba, případně pozastavte smyčku alespoň na \"DIA\" hodin.
Vyčistit události \"AndroidAPS restartován\"
Nalezeno uložené nastavení
POZOR: Pokud aktivuje a připojíte skutečnou pumpu, AndroidAPS nakopíruje (a bude udržovat) nastavení bazálu z aktivního profilu do pumpy. Nastavení bazálu v pumpě bude přepsáno. Pokud si nejste jistí nebo nechcete přepsat bazály v pumpě, stiskněte Zrušit a opakujte přepnutí na jinou pumpu později.
@@ -1056,17 +828,10 @@
Preferovaný režim APS
Výsledek
Kalk
- Navazování spojení
Odešlete dnešní soubory protokolů vývojářům spolu s tímto časem. Neočekávaná situace.
- Překročen maximální bolus
- Chyba příkazu
- Chyba rychlosti
- Překročen limit inzulínu
Minimální změna pro výzvu [%]
Otevřená smyčka vytvoří novou žádost o změnu pouze v případě, že změna je větší než tato hodnota. Výchozí hodnota je 20 %
- Spárujte pumpu s telefonem!
Vyhledávání zařízení…
- Počkejte prosím…
Párování dokončeno
Souhlasí kódy na tomto zařízení a na pumpě?
Insight párování
@@ -1155,7 +920,6 @@
je rovno nebo větší než
je větší než
není k dispozici
- neznámý
Glykémie není k dispozici
Glykémie %1$s %2$.0f %3$s
Glykémie %1$s %2$.1f %3$s
@@ -1172,23 +936,10 @@
Auto
Automatizace
== ∑ %1$s U
- U/h
- g/U
- /U
Zaznamenávat výměnu senzoru do NS
Vytvořit událost \"Výměna senzoru\" v NS automaticky po spuštění senzoru
Tomato (MiaoMiao)
Tomato
- sekunda
- minuta
- hodina
- den
- týden
- sekund
- minut
- hodin
- dnů
- týdnů
Vaše uživatelské jméno na Tidepoolu, obvykle vaše e-mailová adresa
Uživatelské jméno
Heslo na Tidepoolu
@@ -1231,7 +982,6 @@
velmi stará verze
Nová verze je dostupná minimálně %1$d dní! Přepnutí na ochranu před nízkou glykémií po %2$d dnech, vypnutí smyčky po %3$d dnech
2h
- %1$.2fU
Aplikace Dexcom (upravená)
DXCM
Příjem hodnot glykémií z upravené aplikace Dexcom.
@@ -1308,15 +1058,12 @@
ZASTAVIT
Vybráno
Vyhledávání RileyLinku
- Bluetooth Low Energy nepodporováno.
- Bluetooth není povoleno.
- Zjišťování místa není povoleno
- Pro vyhledání Bluetooth zařízení na novějších telefonech musí být povoleno zjišťování polohy. AAPS vás nesleduje a po provedení párování můžete tuto volbu opět zakázat.
Povolit
Ne
Vyhledávání
Vyhledávání dokončeno
Chyba při vyhledávání: %1$d
+ Nikdy
Nastavení
Historie
@@ -1352,7 +1099,6 @@
Spojování selhalo
Pumpa nedostupná
Pod nedostupný
- Nenastaveno
Pumpa Medtronic
Omipod
@@ -1422,7 +1168,6 @@
%2$+.2fU]]>
Aplikováno omezení bolusu: %2$.2fU na %3$.2fU]]>
!!!!! Detekována pomalá absorbce sacharidů: %2$d%% času. Překontrolujte kalkulaci. COB může být nadhodnocené, a proto může být započítáno více inzulínu !!!!!]]>
- %1$.0f / %2$d U
Podat tuto část z výsledku kalkulace [%]
Kalkulátor provede výpočet, ale dodána je pouze tato část inzulínu. Výhodné při používání SMB algoritmu.
Načítání…
@@ -1430,7 +1175,6 @@
Časový rozsah
Čas je mezi %1$s a %2$s
Mezi
- Zavřít
Zvýšena hodnota maximálního bazálu, protože nastavení je nižší než Vaše maximální hodnota bazální profilu
Neplatné tělo zprávy
%1$s ISF: %2$.1f
@@ -1448,8 +1192,8 @@
VYP
Vymazat dokončeno
Vymazat start
- Detekce času
Chcete resetovat začátek cíle? Můžete přijít o svůj pokrok.
+ Změna času a/nebo časové zóny pumpy
Nevybrána žádná pumpa
Vyberte jednotky, ve kterých chcete zobrazit hodnoty
Odeslat změny lokálního profilu do NS
@@ -1474,7 +1218,6 @@
Průzkum
Neplatná položka věku
Neplatná položka váhy
- %1$s: ∑: %2$.2f Bol: %3$.2f Baz: %4$.2f]]>
%1$s: Pod: %2$02d%% V: %3$02d%% Nad: %4$02d%%]]>
Průměr
CDD
@@ -1487,12 +1230,8 @@
GLYK
Nástroje
Zobrazit kalkulaci
- Chyba
- 12h
- 24h
Událost automatizace
Již nastaveno
- Zpráva
Vymazat frontu? Všechna data ve frontě budou ztracena!
Použití funkce prodlouženého bolusu zastaví uzavřenou smyčku po dobu trvání prodlouženého bolusu. Opravdu to chcete?
Uzavřená smyčka je zastavena kvůli běžícímu prodlouženému bolusu
@@ -1536,4 +1275,81 @@
Stavové indikátory
Zkopírovat nastavení z NS
Zkopírovat nastavení NS (existuje-li)?
+ Původní vzhled
+ Tlačítka jsou vždy zobrazena v dolní části obrazovky
+ Vzhled
+
+
+ Integrace pumpy pro Omnipod, vyžaduje zařízení RileyLink (s firmwarem alespoň 2.0).
+
+ Pípnutí při bolusu povoleno
+ Pípnutí při bazálu povoleno
+ Pípnutí při SMB povoleno
+ Pípnutí při TBR povoleno
+ Možnosti ladění podu povoleny
+ Letní čas / Detekce časového pásma povoleny
+
+ Správa Podu
+ Stav Podu
+ Zbývá %1$.2f U
+ Více než 50 U
+ Adresa Podu
+ Expirace Podu
+ Žádné info
+ Žádný Pod není připojen
+ Není inicializován
+ Výstrahy aktivního Podu
+ Potrvdit upozornění
+
+ Omnipod (433,91 MHz)
+
+ Operace není možná.\n\nNejdříve je nutné nakonfigurovat Omnipod, než bude možné tuto funkci použít.
+ Operace není možná.\n\n Je třeba několik minut počkat, dokud se AAPS nepokusí poprvé nastavit profil.
+ Neplatný atribut PodInitActionType: %1$s
+ Žádný aktivní Pod.
+ Ověření příkazu se nezdařilo.
+ Došlo k neočekávané chybě. Nahlaste ji! (typ: %1$s).
+ Komunikace selhala: byly přijaty neplatné vstupní parametry.
+ Komunikace selhala: časový limit vypršel.
+ Komunikace se nezdařila: došlo k neočekávané chybě. Prosím nahlašte!
+ Komunikace selhala: ověření integrity zprávy se nezdařilo.
+ Komunikace selhala: byly přijaty neplatné pakety z podu.
+ Komunikace selhala: Pod je v chybném stavu.
+ Komunikace selhala: byla přijata neplatná odezva z Podu.
+ Komunikace selhala: od Podu byla přijata zpráva s neplatným pořadovým číslem.
+ Komunikace selhala: od Podu byla přijata zpráva s neplatnou adresou.
+ Komunikace selhala: nepodařilo se dekódovat zprávu z Podu.
+ Komunikace selhala: opaková synchronizace hodnoty Nonce se nezdařila.
+ Komunikace selhala: hodnota Nonce nebyla synchronizována.
+ Komunikace selhala: nedostatek dat přijatých z Podu.
+ Byla zjištěna chyba Podu (%1$03d %2$s). Deaktivujte Pod a spusťte nový.
+ Komunikace selhala: Pod vrátil chybovou odezvu.
+
+ Správa Podu
+ Inicializovat Pod
+ Deaktivovat Pod
+ Resetovat Pod
+ Historie Podu
+ Nastavit bolsu
+ Zrušit bolus
+ Nastavit dočasný bazál
+ Zrušit dočasný bazál (interně ovladačem)
+ Zrušit dočasný bazál (nuceně uživatelem)
+ Nastavit plán bazálu
+ Zjistit stav Podu
+ Zjistit informace o Podu
+ Nastavit čas
+ Konfigurovat výstrahy
+ Potvrdit výstrahy
+ Pozastavit dodávání inzulínu
+ Obnovit dodávání inzulínu
+ Neznámá položka
+ %1$.1f U
+ %1$.1f U, Sach=%2$.1f g
+ Rychlost: %1$.1f U, doba trvání: %2$d min
+ Deaktivovat Pod
+ Nastavit bazální profil
+ Deaktivovat Pod
+
+
diff --git a/app/src/main/res/values-de-rDE/strings.xml b/app/src/main/res/values-de-rDE/strings.xml
index db4a75a29c..f496669e05 100644
--- a/app/src/main/res/values-de-rDE/strings.xml
+++ b/app/src/main/res/values-de-rDE/strings.xml
@@ -12,13 +12,10 @@
Datenbanken zurücksetzen
Möchtest du die Datenbank wirklich zurücksetzen?
Schließen
- Benutze verzögerten Bolus für hohe TBR >200%%
- DanaR Blueetooth--Gerät
Verwende absolute statt prozentuale Basalwerte beim Upload zu NightScout.
Bitte starte dein Telefon neu oder starte AndroidAPS in den System-Einstellungen neu.\nAndernfalls wird AndroidAPS nichts protokollieren (wichtig zum Nachverfolgen und Verifizieren, dass der Algorithmus korrekt funktioniert)!
Dieses Gerät scheint keine Deaktivierung der Energieoptimierung zu unterstützen - das könnte zu Leistungsproblemen führen.
Einige Schaltflächen, um auf häufig verwendete Funktionen zugreifen zu können.
- Gib erweiterte Tagebuch-Einträge ein.
Dient zum Konfigurieren der aktiven Plugins
Das Programm kennenlernen
Zeigt die Essens-Vorlagen aus Nightscout an
@@ -36,10 +33,6 @@
Stellt das Profil zur Verfügung, das in Nightscout definiert ist
Definiere ein Profil mit nur einem Zeitblock.
Pumpen-Integration für Accu-Chek Combo Pumpen; erfordert, dass ruffy installiert ist
- Pumpen-Integration für DANA Diabecare R Pumpen
- Pumpen-Integration für koreanische DANA Diabecare R Pumpen
- Pumpen-Integration für DANA Diabecare R Pumpen mit aktualisierter Firmware
- Pumpen-Integration für Dana Diabecare RS Pumpen
Pumpen-Integration für Personen, die täglich mehrere Injektionen für ihre Diabetestherapie vornehmen
Pumpen-Integration für Pumpen, die noch nicht über einen Treiber verfügen (Open Loop)
Die Sensitivität wird genauso wie bei Oref0 berechnet, aber Du kannst dafür ein Zeitfenster bestimmen. Die minimale Kohlenhydrat-Absorptionsrate wird aus der maximalen Absorptionsdauer aus den Einstellungen abgeleitet.
@@ -54,13 +47,6 @@
Überwache und steuere AndroidAPS mit Deiner WearOS-Smartwatch.
Zeige Loop-Informationen auf Deinem xDrip+-Watchface.
Steuere AndroiAPS fern mittels SMS-Anweisungen.
- Einheiten
- DIA
- IC
- ISF
- Basal
- Ziel
- KEIN PROFIL GESETZT
Insulin:
Kohlenhydrate:
IOB:
@@ -76,15 +62,9 @@
TT
Kohlenhydrate
Korr
- IE
Bolus-IOB
Ausführen
VIRTUELLE PUMPE
- Basis-Basalrate
- TBR
- Verzögerter Bolus
- Batterie
- Reservoir
OK
Letzte Ausführung
Eingabeparameter
@@ -96,16 +76,11 @@
Ergebnis
Ergebnis: %1$s %2$s
Keine BZ-Werte verfügbar
- Keine Anpassung benötigt
Anfrage
- Rate
- Dauer
- Grund
Glukose
Delta
Delta:
Konfiguration
- Zielsetzungen
Übersicht
Nightscout-Profil
Einfaches Profil
@@ -123,7 +98,6 @@
Allgemein
Dies sind einige generelle Plugins, die Du vielleicht hilfreich findest.
Welche Beschränkungen werden angewendet?
- Tage
Beschränkungen
Loop
Loop
@@ -139,7 +113,6 @@
Plugin ist deaktiviert
Beschränkungen wurden verletzt oder Limit erreicht.
Bolus-Abgabefehler
- TBR Abgabe-Fehler
Basal-Wert [%]
Akzeptiere neue TBR:
Bolus
@@ -150,7 +123,6 @@
Bolus:
Basal
Basal:
- Kohlenhydrate
Ändere deine Eingabe!
BZ-Quelle
Woher soll AndroidAPS seine Blutzuckerwerte beziehen?
@@ -158,6 +130,7 @@
APS-Modus
Closed Loop
Open Loop
+ Unterbrechung bei niedrigem BZ (LGS)
Loop deaktiviert
Deaktiviere Loop
Aktiviere Loop
@@ -167,25 +140,6 @@
Basal-IOB
Bolus-Beschränkung angewendet
Kohlenhydrat-Beschränkung erreicht
- BZ Test
- Ankündigung
- Notiz
- Frage
- Bewegung
- Pumpenkatheter Wechsel
- CGM-Sensor gesetzt
- CGM-Sensor Start
- Insulinreservoir Wechsel
- Profilwechsel
- Snack Bolus
- Mahlzeiten Bolus
- Korrektur Bolus
- Combo Bolus
- TBR Start
- TBR Ende
- Kohlenhydrat Korrektur
- OpenAPS offline
- Ereignistyp
Anderes
Messgerät
Sensor
@@ -217,11 +171,11 @@
Dieser Wert wird \"max basal\" in OpenAPS genannt.
Maximales Basal-IOB, das OpenAPS abgeben darf [IE]
Maximale Menge von nicht Bolus-IOB, die OpenAPs abgeben kann.
- VERWERFEN
Du wirst nach dem Master-Passwort gefragt. Mit diesem werden die exportierten Einstellungen verschlüsselt.
Du wirst nach dem Master-Passwort gefragt. Mit diesem werden die importierten Einstellungen entschlüsselt.
Export abgebrochen! Einstellungen wurden NICHT exportiert!
Import abgebrochen! Einstellungen wurden NICHT importiert!
+ Wähle die zu importierende Datei
Überprüfe die Einstellungen vor dem Import:
Einstellungen können nicht importiert werden!
Einstellungen sollten nicht importiert werden!
@@ -234,6 +188,8 @@
Du verwendest das veraltete Format einer alten AAPS-Version das nicht sicher ist! Verwende dieses nur als letzte Möglichkeit, wenn Du keinen Export im aktuellen JSON-Format hast.
Die importierten Einstellungen sind bereits %1$s Tage alt! Hast Du aktuellere Einstellungen oder evtl. die falsche Datei gewählt? Denke daran, die Einstellungen regelmäßig zu exportieren.
Ungültiges Datums-/Zeitformat!
+ Einstellungen stammen aus einer Vorgängerversion (Nebenversion). Du kannst diese importieren, prüfe aber unbedingt nach dem Import, ob diese noch korrekt sind!
+ Einstellungen stammen aus einer Vorgängerversion (Hauptversion). Hauptversionen unterscheiden sich deutlich und die Einstellungen können daher nicht kompatibel sein! Prüfe nach dem Import unbedingt, ob diese noch korrekt sind!
Dateiformat
Erstellt am
AAPS-Version
@@ -256,34 +212,17 @@
Entschlüsselungsfehler. Das angegebene Passwort ist ungültig oder die Einstellungsdatei wurde verändert! Evtl. wurde die importierte Datei mit einem anderen Master-Passwort exportiert.
Fehlende Verschlüsselungskonfiguration, Einstellungsformat ist ungültig!
Nicht unterstützter oder nicht angegebener Verschlüsselungsalgorithmus!
- DanaR
- Verbinden
- Verbunden
- Getrennt
- Dana Pumpen-Einstellungen
+ Heute exportiert
+ Vor %1$s Tagen exportiert
+ am %1$s exportiert
+ vor weniger als einer Stunde exportiert
+ in Verzeichnis: %1$s
Endbenutzervereinbarung
DAS PROGRAMM DARF NICHT FÜR MEDIZINISCHE ENTSCHEIDUNGEN BENUTZT WERDEN. ES GIBT IN DIESEM PROJEKT KEINE GEWÄHRLEISTUNG ODER GARANTIERTE UNTERSTÜTZUNG IN IRGENDEINER ART. WENN DU DICH ENTSCHEIDEST, ES ZU NUTZEN, HÄNGT DIE QUALITÄT UND LEISTUNGSFÄHIGKEIT DIESES PROJEKTES VON DIR SELBST AB. ES WIRD \"WIE BESEHEN\" ZUR VERFÜGUNG GESTELLT. SOLLTE SICH DAS PROGRAMM ALS FEHLERHAFT ERWEISEN, ÜBERNEHMEN SIE ALLE NOTWENDIGEN KRANKHEITSKOSTEN, SERVICELEISTUNGEN, REPARATUREN ODER KORREKTUREN.
Ich verstehe und stimme zu.
Speichern
- Kein Bluetooth-Adapter gefunden
- Ausgewähltes Gerät nicht gefunden
- Pumpen-Verbindungsfehler
- Pumpen-IOB
- Tägliche Einheiten
- Letzter Bolus:
- vor %1$.1f Stunde
- Ungültige Eingabedaten
- Wert nicht korrekt gesetzt
Profil neuladen
- Profil anzeigen
- Ausgeführt
- Kommentar
- Erfolgreich
- Prozent
- Absolut
- TBR abbrechen
SMS-Kommunikator
- Auf Pumpenergebnis warten
Erlaubte Telefonnummern
+XXXXXXXXXX;+YYYYYYYYYY
Um einen Bolus von %1$.2f IE abzugeben, antworte mit dem Code %2$s.
@@ -304,54 +243,13 @@
Ziel %1$s für %2$d Minuten
Ziel %1$s für %2$d Minuten erfolgreich gesetzt.
Temporäres Ziel wurde erfolgreich abgebrochen
- Gebe %1$.2fIE ab
Erlaube externe Befehle per SMS
- Finger
- Sensor
- Manuell
- Temporäres Ziel
- Temporäres Ziel abbrechen
DanaR Profil-Einstellungen
DIA [h]
Dauer der Insulinwirkung
- Fehler beim Aktualisieren des Basalprofils
- Neu laden
Hochladen
- E-Bolus
- DS-Bolus
- DE-Bolus
- Fehler
- Befüllen
- Basal-Stunde
- Glukose
- Kohlenhydrate
- Alarm
- Insgesamt %1$d Einträge hochgeladen
- S-Bolus
- Alarme
- Basal-Stunden
- Boli
- Kohlenhydrate
- Insulin-Tagesmengen
- Fehler
- Glukose
- Füllmenge
- Unterbrechungen
- Verbindungsaufbau seit %1$d s
- Pumpen-Passwort
- Falsches Pumpen-Passwort!
- Pumpe ist beschäftigt
- Abgegeben
- Gestoppt
Bolus gestoppt
Bolus wird gestoppt
- Verstopfung
- Stopp
- STOPP GEDRÜCKT
- Warte auf Pumpe
- Werde %1$.2fIE abgeben
- Limit erreicht
- Kein Profil ausgewählt
Loop wurde deaktiviert.
Loop wurde aktiviert
Loop ist deaktiviert.
@@ -391,11 +289,9 @@
Essensbolus
Korr
Aktionen
- AndroidAPS gestartet
Zu Nightscout nur hochladen (keine Synchronisation)
Zu Nightscout nur hochladen. Nicht wirksam bei BZ-Werten, wenn nicht eine lokale Quelle wie z. B. xDrip gewählt wird; nicht wirksam bei Profilen, wenn Nightscout-Profile verwendet werden.
Pumpe nicht initialisiert!
- Pumpe nicht initialisiert, Profil nicht gesetzt!
Katheterwechsel
Bitte vergewissere Dich, dass die Füllmenge den Eigenschaften des Katheters entspricht!
Andere
@@ -405,8 +301,6 @@
Schaltfläche 3
Einheiten:
Einheiten
- mg/dl
- mmol/l
DIA
Zielbereich:
Zielbereich für die Grafikanzeige
@@ -416,17 +310,7 @@
Wear
Alle Daten erneut senden
Öffne Einstellungen auf der Uhr
- Pumpenfehler
- Niedriger Batteriestand
- Pumpe stoppen
- Pumpenbatterie entladen
- DanaR Korean
Basalrate:
- Setzen des Basal-Profils fehlgeschlagen
- Basal-Profil in der Pumpe aktualisiert
- EasyUI-Modus in der Pumpe deaktivieren
- Aktiviere verzögerten Bolus in der Pumpe.
- Wechsel den Modus von IE/d zu IE/h in der Pumpe
Wert der Basalrate unter Minimum. Profil nicht gesetzt!
BZ:
Letzter BZ:
@@ -434,7 +318,6 @@
MM640g
Anhaltende Benachrichtigung
VERALTETE DATEN
- %1$d min her
%1$d\' her
Lokales Profil
OpenAPS AMA
@@ -450,41 +333,22 @@
Hypo
Aktivität
Eintrag löschen
- DanaR Statistiken
- Kumulative TDD
- Exponentiell gewichtete TDD
- Basal
- Bolus
- TDD
- Datum
- Verhältnis
- # Tage
- Gewichtung
- Möglicherweise ungenau, wenn zum Befüllen ein Bolus verwendet wurde!
- Veraltete Daten, bitte klicke auf \"NEU LADEN\"
- Tägl. Basalmenge
- Tägl. Basalmenge * 2
- Initialisierung …
AKT
KONF
LOOP
EP
OAPS
LP
- DANA
HOME
VP
PROF
BEH
- CP
ZIEL
UHR
SMS
Kurze Tab-Überschriften
Verwende immer das kurze durchschnittliche Delta statt des einfachen Deltas
Das ist sinnvoll, wenn die Daten von einer ungefilterten Quelle Signalrauschen haben.
- Erweiterte Einstellungen
- Modell: %1$02X Protokoll: %2$02X Code: %3$02X
Profil
Standardwert: 3\nDies ist eine wichtige Sicherheitseinstellung. Sie begrenzt das maximale Basal-IOB auf die dreifache Menge (im Standardfall) deiner größten Basalrate. In der Regel solltest Du diesen Wert nicht ändern. Aber Du solltest wissen, was \"3x max daily, 4x current\" als Sicherheitseinstellung bedeutet.
Standardwert: 4\nDies ist die andere wichtige Sicherheitseinstellung, die zweite Hälfte von \"3x max daily, 4x current\". Diese Grenze beschränkt das Basal-IOB auf die (im Standardfall) vierfache Menge der aktuellen Basalrate. Dies ist wichtig, um Nutzer davor zu bewahren, zuviel Basal-Insulin zu verabreichen. Nochmals, der Standardwert ist 4x. Die meisten Nutzer werden niemals diese Einstellung verändern, sondern andere Einstellungen anpassen, um sich nicht dieser Sicherheitsgrenze zu nähern.
@@ -503,18 +367,9 @@
Kalibrierung gesendet. Das Empfangen von Kalbrierungen muss in xDrip+ aktiviert sein.
xDrip+ hat die Kalbrierung nicht erhalten
Pumpe pausiert
- Pumpenstatus wird geladen
- TBR wird gesetzt
- TBR wird abgebrochen
- Verzögerter Bolus wird gesetzt
- Verzögerter Bolus wird abgebrochen
- Basal-Profil wird aktualisiert
- Verbindung wird getrennt
Wird ausgeführt
Einstellungen der virtuellen Pumpe
Status zu Nightscout hochladen
- Falsches Passwort
- Tagesinsulin-Limit wird bald erreicht
Nightscout-Client
NSCl
URL:
@@ -538,7 +393,7 @@
Zeige detailliertes IOB
Differenziere IOB in Bolus- und Basal-IOB auf dem Watchface
Nicht erfolgreich - bitte Telefon prüfen
- Nicht verfügbar
+ nicht verfügbar
Patientenalter
Kind
Teenager
@@ -574,8 +429,6 @@
Superbolus
Logge App-Start in Nightscout
App wird beendet, um neue Einstellungen zu laden.
- DanaRv2
- Insulin
Welchen Insulin-Typ verwendest Du?
Schnell wirkendes Insulin
NovoRapid, NovoLog, Humalog
@@ -598,9 +451,6 @@
Warnschwelle kritischer Batteriestand [%]
IOB
COB
- Firmware
- Letzte Verbindung
- Bluetooth-Status
Über
SMS-Steuerung nicht erlaubt
Fehlende Berechtigung für den Zugriff auf den Telefonstatus
@@ -611,17 +461,12 @@
Füge BGI zur Statuszeile hinzu.
Kein Upload zu Nightscout
Alle an Nightscout gesendeten Daten werden verworfen. AAPS ist verbunden, aber Nightscout-Daten werden nicht geändert.
- Basal-Schritt
- Bolus-Schritt
Verzögerten Bolus abbrechen
Sensoralter
Katheteralter
Insulinalter
- Stunden
- Ungültiges oder defektes Profil!
Profilwechsel durchführen
Batteriealter
- Pumpenbatterie Wechsel
Alarm-Optionen
Sehr hoch
Hoch
@@ -645,7 +490,6 @@
Resorptions-Einstellungen
Maximale Essens-Resorptionszeit [h]
Zeit in Stunden, in der zu erwarten ist, dass alle Kohlenhydrate resorbiert sein werden.
- Zeige verzögerten Bolus als %% an.
SAGE
IAGE
CAGE
@@ -670,7 +514,6 @@
PUMPE
Dauer [min]
OpenAPS SMB
- SMB
Aktiviere UAM
Aktiviere SMB
Benutze Super-Mikro-Boli anstelle von temporären Basalraten, um eine schnellere Wirkung zu erreichen.
@@ -682,23 +525,7 @@
Ultra-Rapid Oref
DIA von %1$f ist zu kurz - AAPS nutzt stattdessen %2$f!
Aktiviere Profil
- Datum
Ungültig
- Auf Verbindung warten
- Pairing OK
- Zeitüberschreitung beim Pairing
- Koppeln
- Pumpe noch nicht gefunden
- Reservoir leer
- Alarm BZ-Messung
- Restinsulin
- DanaRS
- Dana
- Ausgewählte Pumpe
- Verbinde neue Pumpe
- Bolus-Geschwindigkeit
- Setze Basalschritt auf 0.01 IE/h
- Seriennummer
Prozentsatz
Zeitverschiebung
Vordefinierte temporäre Ziele
@@ -708,32 +535,18 @@
Aktivitäts-Zielwert
Hypo-Dauer
Hypo - Zielwert
- Füllen
- Status des verzögerten Bolus wird ermittelt
- Status des Bolus wird ermittelt
- Status der TBR wird ermittelt
- Pumpen-Einstellungen werden ermittelt
- Zeiteinstellung der Pumpe wird ermittelt
Erneut verwenden
Steuerung durch die Uhr
Setze temporäre Ziele und Behandlungen mit der Uhr
- Zeitüberschreitung der Verbindung
Essen
g
- min
- h
- d
]]>
kJ
En
Prot
Ft
]]>
- Warte auf Ende der Bolus-Abgabe. %1$d sec verbleiben.
- Ereignis wird verarbeitet
- Bolus-Abgabe gestartet
Befehl wird zurzeit ausgeführt
- Pumpen-Treiber korrigiert
Pumpe ist nicht erreichbar
BZ-Werte fehlen
Benutze Systemmeldungen für Alarme und Meldungen
@@ -743,9 +556,6 @@
Grenzwert Pumpe ist nicht erreichbar [min]
Wichtiger Alarm
INFO
- Bluetooth
- BT Watchdog
- Deaktiviert Bluetooth kurzzeitig, falls keine Verbindung zur Pumpe besteht. Dies kann für Smartphones mit Verbindungsproblemen nützlich sein.
Eversense App (gepatcht)
Speichere BZ-Werte in Nightscout
BZ Upload Einstellungen
@@ -757,12 +567,9 @@
UAM SMB max minutes
SMB Basal-Limit in Minuten für UAM
Schwellenwert für KH-Empfehlung
- Nicht unterstützte Pumpen-Firmware
Sende BZ-Werte zu xDrip+
Wähle in xDrip+ 640g/Eversense als Daten-Quelle.
Nightscout-Client BZ
- Basal-Wert wurde durch den kleinst möglichen Wert ersetzt: %1$s
- Basal-Wert wurde durch größt möglichen Wert ersetzt: %1$s
BZ Berechnung
Bolus-IOB Berechnung
Basal-IOB Berechnung
@@ -780,8 +587,6 @@
Closed mode aktiviert
Maximales IOB richtig gesetzt
BZ verfügbar von gewählter Quelle
- Basalraten beginnen nicht zur vollen Stunde: %1$s
- Ungültiges Profil: %1$s
Bolusabgabe wird vorbereitet
Aktualisieren
Status
@@ -802,7 +607,6 @@
Ein gleich großer Bolus wurde in den letzten zwei Minuten angefordert. Dies ist nicht zulässig, um ungewollte Doppelboli zu verhindern und vor eventuellen Bugs zu schützen.
Jetzt
Historie wird gelesen
- Pumpen Historie
BR-Profil wird aktualisiert.
Das Reservoir in der Pumpe ist fast leer
Die Batterie in der Pumpe ist fast leer
@@ -821,9 +625,6 @@
Fehler bei der Abgabe eines verzögerten Bolus
Sight
her
- %1$.2f h
- %1$d mins
- %1$dm
SMB immer aktivieren
Aktiviere SMB immer, unabhängig von Boli. Dies ist nur möglich, wenn eine BZ-Quelle genutzt wird, die die Daten besonders gut filtert wie z. B. G5.
Aktiviere SMB nach Mahlzeiten.
@@ -834,8 +635,6 @@
Aktiviere SMB, wenn ein temporäres Ziel aktiv ist (bald essen, Aktivität)
Aktiviere SMB bei temporären Zielen oberhalb des regulären Ziels
Aktiviere SMB bei temporären Zielen oberhalb des regulären Ziels (Aktivität).
- Temporäre Basalrate aktiv lassen
- Alarm stoppen
Insulin
Kohlenhydrate
Schaltflächen
@@ -877,7 +676,6 @@
Entwickler-Version, Closed Loop ist nicht verfügbar.
Entwickler-Modus aktiviert
Entwickler-Modus nicht aktiviert und keine Release-Version
- %1$.2f IE/h
Basalratenprofil wird gelesen
Nach der Berechnung des Bolus hat sich die Pumpenhistorie geändert. Daher wurde kein Bolus abgegeben. Bitte prüfe, ob überhaupt noch ein Bolus benötigt wird.
Der Bolus wurde erfolgreich abgegeben, aber nicht als Behandlungseintrag gespeichert. Dies kann passieren, wenn zwei kleine, gleich große Boli innerhalb von zwei Minuten verabreicht werden. Bitte überprüfe die Pumpenhistorie und Behandlungseinträge. Verwende das Careportal, um fehlende Einträge hinzuzufügen. Stelle sicher, dass keine Einträge für genau dieselbe Minute und dieselbe Menge hinzugefügt werden.
@@ -900,15 +698,10 @@
SMB in Einstellungen deaktiviert
UAM in Einstellungen deaktiviert
UAM deaktiviert, da diese auf die Oref1 Empfindlichkeitserkennung angewiesen sind.
- Begrenzung der max. Basalrate auf %1$.2f IE/h wegen %2$s
- Limit der Pumpe
- Es muss ein positiver Wert sein.
max basal multiplier
max daily basal multiplier
Aufgrund eines Bolus in den letzten 3 Minuten wird kein SMB abgegeben.
Basalrate richtig eingestellt
- Begrenzung des max. Prozentsatzes auf %1$d%% wegen %2$s
- Begrenze Bolusmenge auf %1$.1f IE wegen %2$s
Begrenze verzögerten Bolus auf %1$.1f IE wegen %2$s
Begrenze max. IOB auf %1$.1f IE wegen %2$s
Begrenze Kohlenhydrate auf %1$d g wegen %2$s
@@ -923,7 +716,6 @@
SMB sind im Open Loop Modus nicht erlaubt
Essen
Zurücksetzen
- Warte auf Zeitsynchronisierung (%1$d Sek.)
Getrennt (%1$d m)
Maximales Gesamt-IOB, das nicht überschritten werden darf [IE]
Diesen Wert nennt OpenAPS MaxIOB.\nSolange dieser Wert überschritten wird, wird AndroidAPS kein Insulin abgeben.
@@ -939,7 +731,6 @@
Einrichtungsassistent
FERTIG
Wähle Deine Sprache.
- Angefragt: %1$.2f IE. Abgegeben: %2$.2f IE. Fehlercode: %3$s
Erste Insulin-Erhöhung
Zweite Insulin-Erhöhung
Dritte Insulin-Erhöhung
@@ -962,7 +753,6 @@
Typ der virtuellen Pumpe
Pumpen-Definition
Bolus: Schritt=%1$s\nVerzögerter Bolus: [Schritt=%2$s, Dauer=%3$smin-%4$sh]\nBasal: Schritt=%5$s\nTBR: %6$s (bei %7$s), Dauer=%8$smin-%9$sh\n%10$s
- * Bei der virtuellen Pumpe können nur einzelne Werte und keine Bereiche zur Festlegung der Basal/Bolus-Granularität gewählt werden.
BZ automatisch auffüllen
Wizard-Einstellungen
Berechnungen, die im Assistenten berücksichtigt werden:
@@ -993,22 +783,6 @@
Anfordern
Insulin-Plugin konfigurieren
Verlassen
- Benutzerdefinierte Einstellungen
- Zeitmodus
- Scrollfunktion
- Piepen (Tastentöne)
- Alarm
- Töne
- Vibration
- Beides
- LCD-Einschaltdauer [Sek.]
- Einschaltdauer Hintergrundbeleuchtung [Sek.]
- BZ-Einheit
- Abschalten (Std.)
- Reservoir fast leer (IE)
- In Pumpe speichern
- Ein
- Aus
Menü öffnen
Menü schließen
Plugin-Einstellungen
@@ -1028,8 +802,6 @@
Wenn eine höhere Empfindlichkeit festgestellt wird, wird der Glukose-Zielwert erhöht.
Ungültige Pumpen-Einstellungen. Lies das Wiki und stelle mit der 360° Konfigurations-Software sicher, dass das Quick-Info-Menü \"QUICK INFO\" heißt.
Benutzerdefiniert
- Große Zeitdifferenz
- Großer Zeitunterschied:\nDie Zeit in der Pumpe weicht um mindestens 1,5 Stunden ab.\nPasse die Zeit auf der Pumpe manuell an und lösche zuvor - falls möglich - die Pumpenhistorie.\nAlternativ kannst Du den Loop für die Stunden der Insulinwirkzeit (DIA) deaktivieren.
\"AndroidAPS gestartet\" Ereignisse löschen
Gespeicherte Einstellungen gefunden
WARNUNG: Wenn Du eine echte Pumpe aktivierst und anschließt, kopiert AndroidAPS die Basaleinstellungen vom aktiven Profil zur Pumpe (und behält sie bei). Die Einstellungen in der Pumpe werden hierbei überschrieben. Wenn Du Dir nicht sicher bist oder die Basaleinstellungen in der Pumpe nicht überschreiben möchten, drücke \"Abbrechen\" und vollziehe den Wechsel zur Pumpe später.
@@ -1055,18 +827,11 @@
Bevorzugter APS-Modus
Gesamt
Berech.
- Handshaking
Sende die heutigen Logdateien unter Angabe dieser Uhrzeit an die Entwickler.
Unerwartetes Verhalten.
- Max. Bolus überschritten
- Fehler bei Befehl
- Geschwindigkeits-Fehler
- Insulin-Beschränkung verletzt
Minimaler Wert zur Anfrage einer Änderung [%]
Open Loop schlägt neue Änderungen nur dann vor, wenn die Änderung größer als dieser Wert ist. Der Standard-Wert ist 20%.
- Bitte kopple deine Pumpe mit deinem Telefon!
Geräte werden gesucht…
- Bitte warten…
Pairing abgeschlossen
Stimmen die Codes auf diesem Gerät und auf deiner Pumpe überein?
Insight Pairing
@@ -1155,7 +920,6 @@ Unerwartetes Verhalten.
ist gleich oder größer als
ist größer als
ist nicht verfügbar
- unbekannt
Glukosewert nicht verfügbar
Glukosewert %1$s %2$.0f %3$s
Glukosewert %1$s %2$.1f %3$s
@@ -1172,23 +936,10 @@ Unerwartetes Verhalten.
Auto
Automatisierung
== ∑ %1$s IE
- IE/h
- g/IE
- /IE
Speichere Sensor Wechsel in Nightscout
Ereignis \"Sensorwechsel\" bei Sensorstart automatisch in NS erstellen
Tomato (MiaoMiao)
Tomato
- Sekunde
- Minute
- Stunde
- Tag
- Woche
- Sekunden
- Minuten
- Stunden
- Tage
- Wochen
Dein Tidepool-Login-Benutzername, normalerweise deine E-Mail-Adresse
Login-Benutzername
Dein Tidepool Anmeldekennwort
@@ -1231,7 +982,6 @@ Unerwartetes Verhalten.