From 17d4f3e8ce25283285f4a22760028e66c0953bca Mon Sep 17 00:00:00 2001 From: Andrei Vereha Date: Tue, 31 May 2022 09:52:10 +0200 Subject: [PATCH 01/44] try to fix disconnects --- .../pump/omnipod/dash/driver/comm/callbacks/BleCommCallbacks.kt | 2 +- .../plugins/pump/omnipod/dash/driver/comm/session/Connection.kt | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/comm/callbacks/BleCommCallbacks.kt b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/comm/callbacks/BleCommCallbacks.kt index 83ee2346b4..3724341c89 100644 --- a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/comm/callbacks/BleCommCallbacks.kt +++ b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/comm/callbacks/BleCommCallbacks.kt @@ -40,7 +40,7 @@ class BleCommCallbacks( if (newState == BluetoothProfile.STATE_CONNECTED && status == BluetoothGatt.GATT_SUCCESS) { connected.countDown() } - if (newState == BluetoothProfile.STATE_DISCONNECTED && status != BluetoothGatt.GATT_SUCCESS) { + if (newState == BluetoothProfile.STATE_DISCONNECTED) { // If status == SUCCESS, it means that we initiated the disconnect. disconnectHandler.onConnectionLost(status) } diff --git a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/comm/session/Connection.kt b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/comm/session/Connection.kt index b403cb7af2..3b934510ed 100644 --- a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/comm/session/Connection.kt +++ b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/comm/session/Connection.kt @@ -61,6 +61,7 @@ class Connection( @Volatile var msgIO: MessageIO? = null + @Synchronized fun connect(connectionWaitCond: ConnectionWaitCondition) { aapsLogger.debug("Connecting connectionWaitCond=$connectionWaitCond") podState.connectionAttempts++ @@ -117,6 +118,7 @@ class Connection( dataBleIO.readyToRead() } + @Synchronized fun disconnect(closeGatt: Boolean) { aapsLogger.debug(LTag.PUMPBTCOMM, "Disconnecting closeGatt=$closeGatt") podState.bluetoothConnectionState = OmnipodDashPodStateManager.BluetoothConnectionState.DISCONNECTED From c233f9ba1282a0a5f3c2d23ee06010955cd39693 Mon Sep 17 00:00:00 2001 From: t_j_s Date: Mon, 13 Jun 2022 20:35:08 +0100 Subject: [PATCH 02/44] Prep for Nightscout Dev upload. 1. DYnamic ISF Plugin uses combination of 8 hour weighted average, last full day and 7 day average TDDs. 2. Model is the reworked 1800 rule using log values and insulin peak. LGS Threshold moved in preferences to the DynamicISF prefs module and only available in the Dynamic ISF plugin. --- .../OpenAPSSMBDynamicISF/determine-basal.js | 112 ++++++++++++------ .../DetermineBasalAdapterSMBDynamicISFJS.kt | 15 ++- .../androidaps/utils/stats/TddCalculator.kt | 96 +++++++++++++++ app/src/main/res/values/strings.xml | 8 +- .../res/xml/pref_openapssmbdynamicisf.xml | 10 ++ 5 files changed, 204 insertions(+), 37 deletions(-) diff --git a/app/src/main/assets/OpenAPSSMBDynamicISF/determine-basal.js b/app/src/main/assets/OpenAPSSMBDynamicISF/determine-basal.js index adaa126a8c..8a6c00917c 100644 --- a/app/src/main/assets/OpenAPSSMBDynamicISF/determine-basal.js +++ b/app/src/main/assets/OpenAPSSMBDynamicISF/determine-basal.js @@ -218,7 +218,7 @@ var determine_basal = function determine_basal(glucose_status, currenttemp, iob_ //********************************************************************************* console.error("---------------------------------------------------------"); - console.error( " Dynamic ISF version Beta 1.5 "); + console.error( " Dynamic ISF version Beta 1.6.4 "); console.error("---------------------------------------------------------"); @@ -247,39 +247,48 @@ var determine_basal = function determine_basal(glucose_status, currenttemp, iob_ /*var tdd_pump_now = meal_data.TDDPUMP; var tdd_pump = ( tdd_pump_now / (now / 24));*/ - var TDD = (tdd7 * 0.4) + (tdd_pump * 0.6); + //var TDD = (tdd7 * 0.4) + (tdd_pump * 0.6); - console.error("Pump extrapolated TDD = "+tdd_pump+"; "); - //if (tdd7 > 0){ - if ( tdd_pump > tdd7 && now < 5 || now < 7 && TDD < ( 0.8 * tdd7 ) ){ - TDD = ( 0.8 * tdd7 ); - console.log("Excess or too low insulin from pump so TDD set to "+TDD+" based on 75% of TDD7; "); - rT.reason += "TDD: " +TDD+ " due to low or high tdd from pump; "; - } + var tdd1 = meal_data.TDDAIMI1; + var tdd_4 = meal_data.TDDLast4; + var tdd8to4 = meal_data.TDD4to8; + var tdd_last8_wt = ( ( ( 1.4 * tdd_4) + ( 0.6 * tdd8to4) ) * 3 ); - else if (tdd_pump > (1.75 * tdd7)){ - TDD = tdd7; - console.error("TDD set to TDD7 due to high pump usage reported. TDD = "+TDD+"; "); - rT.reason += "TDD set to TDD7 due to high pump usage reported. TDD = "+TDD+"; "; - } + console.error("Rolling 8 hours weight average: "+tdd_last8_wt+"; "); + console.error("1-day average TDD is: "+tdd1+"; "); + console.error("7-day average TDD is: " +tdd7+ "; "); + + //TDD = ( tdd_last8_wt * 0.6) + ( tdd7 * 0.4 ); + + var TDD = ( tdd_last8_wt * 0.33 ) + ( tdd7 * 0.34 ) + (tdd1 * 0.33); + console.log("TDD = " +TDD+ " using average of 7-day, 1-day and weighted 8hr average"); - else if (tdd_pump < (0.33 * tdd7)){ - TDD = (tdd7 * 0.25) + (tdd_pump * 0.75); - console.error("TDD weighted to pump due to low insulin usage. TDD = "+TDD+"; "); - rT.reason += "TDD weighted to pump due to low insulin usage. TDD = "+TDD+"; "; - } + //var ins_val = 75; + var insulin = profile.insulinType; + console.log("Insulin Peak = "+profile.insulinPeak+"; "); + //console.log("Initial insulin value for ISF: "+ins_val+"; "); + //console.log("Current value for insulin: "+insulin+"; "); - else { - console.log("TDD = " +TDD+ " based on standard pump 60/tdd7 40 split; "); - rT.reason += "TDD: " +TDD+ " based on standard pump 60/tdd7 40 split; "; - } + var ins_val = 75; // Lyumjev peak: 75 + if (profile.insulinPeak > 65) { // lyumjev peak: 45 + ins_val = 55; + } else if (profile.insulinPeak > 50 ){ // ultra rapid peak: 55 + ins_val = 65; + } + console.log("For "+profile.insulinType+" (insulin peak: "+profile.insulinPeak+") divisor is: "+ins_val+"; "); + + console.log("Insulin value for ISF based on profile: "+ins_val+"; "); var dynISFadjust = profile.DynISFAdjust; - var dynISFadjust = ( dynISFadjust / 100 ); - var TDD = (dynISFadjust * TDD); - var variable_sens = (277700 / ( TDD * bg)); + dynISFadjust = ( dynISFadjust / 100 ); + TDD = ( dynISFadjust * TDD ); + + var variable_sens = 1800 / ( TDD * (Math.log(( bg / ins_val ) + 1 ) ) ); + variable_sens = round(variable_sens,1); + + if (dynISFadjust > 1 ) { console.log("TDD adjustment factor is: " +dynISFadjust+"; "); console.log("TDD adjusted to "+TDD+" using adjustment factor of "+dynISFadjust+"; "); @@ -314,7 +323,7 @@ var determine_basal = function determine_basal(glucose_status, currenttemp, iob_ console.log("ISF from "+variable_sens+" to "+sens+ "due to temp target; "); } else { - sensitivityRatio = ( tdd_24 / tdd7 ); + sensitivityRatio = ( meal_data.TDD24 / tdd7 ); } if (sensitivityRatio > 1) { sensitivityRatio = Math.min(sensitivityRatio, profile.autosens_max); @@ -501,9 +510,41 @@ var determine_basal = function determine_basal(glucose_status, currenttemp, iob_ return rT; } - // min_bg of 90 -> threshold of 65, 100 -> 70 110 -> 75, and 130 -> 85 - var threshold = min_bg - 0.5*(min_bg-40); + // min_bg of 90 -> threshold of 65, 100 -> 70 110 -> 75, and 130 -> 85, or if specified by user, take that value + var lgsThreshold = profile.lgsThreshold; + console.error("Profile LGS Threshold set to"+lgsThreshold+"; "); + //if(lgsThreshold < 5.6) + if(lgsThreshold > 3.2 && lgsThreshold < 5.6){ + lgsThreshold = (18 * lgsThreshold); + lgsThreshold = round(lgsThreshold, 2); + console.error("LGS Threshold converted to"+lgsThreshold+"; "); + }else{ + lgsThreshold; + } + var threshold = min_bg - 0.5*(min_bg-40); + var oldThreshold = threshold; + if(lgsThreshold < 65 || lgsThreshold > 120) { + threshold; + } + else if( lgsThreshold < threshold){ + threshold; + } + else { + threshold = lgsThreshold; + } + console.error("Threshold set from " + convert_bg(oldThreshold, profile) + " to " + convert_bg(threshold, profile) + "; "); + /*var oldThreshold = threshold; + + if(lgsThreshold < 65 || lgsThreshold > 120) { + lgsThreshold = threshold; + } + else{ + threshold = Math.max(threshold, lgsThreshold); + } + if( threshold === lgsThreshold ) { + console.log("Threshold set from " + convert_bg(oldThreshold, profile) + " to " + convert_bg(threshold, profile) + "; ") + }*/ //console.error(reservoir_data); rT = { @@ -808,19 +849,22 @@ var determine_basal = function determine_basal(glucose_status, currenttemp, iob_ console.log("EventualBG is" +eventualBG+" ;"); if (bg > target_bg && glucose_status.delta < 3 && glucose_status.delta > -3 && glucose_status.short_avgdelta > -3 && glucose_status.short_avgdelta < 3 && eventualBG > target_bg && eventualBG < bg ) { - var future_sens = ( 277700 / (TDD * ((eventualBG * 0.5) + (bg * 0.5) ) ) ); + var future_sens = ( 1800 / (Math.log((((eventualBG * 0.5) + (bg * 0.5))/ins_val)+1)*TDD)); + var future_sens_old = ( 277700 / (TDD * ((bg * 0.5) + (eventualBG * 0.5 )))); console.log("Future state sensitivity is " +future_sens+" based on eventual and current bg due to flat glucose level above target"); rT.reason += "Dosing sensitivity: " +future_sens+" using eventual BG;"; } else if( glucose_status.delta > 0 && eventualBG > target_bg ) { - var future_sens = ( 277700 / (TDD * bg) ); + var future_sens = ( 1800 / (Math.log((bg/ins_val)+1)*TDD)); + var future_sens_old = ( 277700 / (TDD * bg)); console.log("Future state sensitivity is " +future_sens+" using current bg due to small delta or variation"); rT.reason += "Dosing sensitivity: " +future_sens+" using current BG;"; } else { - var future_sens = ( 277700 / (TDD * eventualBG) ); + var future_sens = ( 1800 / (Math.log((eventualBG/ins_val)+1)*TDD)); + var future_sens_old = ( 277700 / (TDD * eventualBG)); console.log("Future state sensitivity is " +future_sens+" based on eventual bg due to -ve delta"); rT.reason += "Dosing sensitivity: " +future_sens+" using eventual BG;"; } @@ -1085,7 +1129,7 @@ var determine_basal = function determine_basal(glucose_status, currenttemp, iob_ return tempBasalFunctions.setTempBasal(rate, 30, profile, rT, currenttemp); } if (typeof currenttemp.rate !== 'undefined' && (currenttemp.duration > 5 && rate >= currenttemp.rate * 0.8)) { - rT.reason += ", temp " + currenttemp.rate + " ~< req " + rate + "U/hr. "; + rT.reason += ", temp " + currenttemp.rate + " ~< req " + round(rate, 2) + "U/hr. "; return rT; } else { // calculate a long enough zero temp to eventually correct back up to target @@ -1106,7 +1150,7 @@ var determine_basal = function determine_basal(glucose_status, currenttemp, iob_ return tempBasalFunctions.setTempBasal(rate, durationReq, profile, rT, currenttemp); } } else { - rT.reason += ", setting " + rate + "U/hr. "; + rT.reason += ", setting " + round(rate, 2) + "U/hr. "; } return tempBasalFunctions.setTempBasal(rate, 30, profile, rT, currenttemp); } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/aps/openAPSSMBDynamicISF/DetermineBasalAdapterSMBDynamicISFJS.kt b/app/src/main/java/info/nightscout/androidaps/plugins/aps/openAPSSMBDynamicISF/DetermineBasalAdapterSMBDynamicISFJS.kt index c1cf1994d3..f2b8916721 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/aps/openAPSSMBDynamicISF/DetermineBasalAdapterSMBDynamicISFJS.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/aps/openAPSSMBDynamicISF/DetermineBasalAdapterSMBDynamicISFJS.kt @@ -192,6 +192,11 @@ class DetermineBasalAdapterSMBDynamicISFJS internal constructor(private val scri this.profile.put("sens", profile.getIsfMgdl()) this.profile.put("max_daily_safety_multiplier", sp.getInt(R.string.key_openapsama_max_daily_safety_multiplier, 3)) this.profile.put("current_basal_safety_multiplier", sp.getDouble(R.string.key_openapsama_current_basal_safety_multiplier, 4.0)) + this.profile.put("lgsThreshold", sp.getDouble(R.string.key_treatmentssafety_lgsThreshold, 60.0)) + + val insulin = activePlugin.activeInsulin + val insulinType = insulin.friendlyName + val insulinPeak = insulin.peak //mProfile.put("high_temptarget_raises_sensitivity", SP.getBoolean(R.string.key_high_temptarget_raises_sensitivity, SMBDefaults.high_temptarget_raises_sensitivity)); this.profile.put("high_temptarget_raises_sensitivity", sp.getBoolean(R.string.key_high_temptarget_raises_sensitivity, SMBDefaults.high_temptarget_raises_sensitivity)) @@ -223,6 +228,8 @@ class DetermineBasalAdapterSMBDynamicISFJS internal constructor(private val scri this.profile.put("maxSMBBasalMinutes", sp.getInt(R.string.key_smbmaxminutes, SMBDefaults.maxSMBBasalMinutes)) this.profile.put("maxUAMSMBBasalMinutes", sp.getInt(R.string.key_uamsmbmaxminutes, SMBDefaults.maxUAMSMBBasalMinutes)) this.profile.put("DynISFAdjust", SafeParse.stringToDouble(sp.getString(R.string.key_DynISFAdjust,"100"))) + this.profile.put("insulinType", insulinType) + this.profile.put("insulinPeak", insulinPeak) this.profile.put("maxUAMSMBBasalMinutes", sp.getInt(R.string.key_uamsmbmaxminutes, SMBDefaults.maxUAMSMBBasalMinutes)) //set the min SMB amount to be the amount set by the pump. this.profile.put("bolus_increment", pumpBolusStep) @@ -263,9 +270,13 @@ class DetermineBasalAdapterSMBDynamicISFJS internal constructor(private val scri this.mealData.put("lastBolusTime", mealData.lastBolusTime) this.mealData.put("lastCarbTime", mealData.lastCarbTime) + this.mealData.put("TDDAIMI1", tddCalculator.averageTDD(tddCalculator.calculate(1))?.totalAmount) this.mealData.put("TDDAIMI7", tddCalculator.averageTDD(tddCalculator.calculate(7))?.totalAmount) - this.mealData.put("TDDPUMP", tddCalculator.calculateDaily().totalAmount) - this.mealData.put("TDDLast24", tddCalculator.calculate24Daily().totalAmount) + this.mealData.put("TDDLast4", tddCalculator.calculate4Daily().totalAmount) + this.mealData.put("TDD4to8", tddCalculator.calculate8Gap().totalAmount) + this.mealData.put("TDD24", tddCalculator.calculate24Daily().totalAmount) + + if (constraintChecker.isAutosensModeEnabled().value()) { autosensData.put("ratio", autosensDataRatio) 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 91ef25a1f8..821668a3db 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 @@ -172,6 +172,102 @@ class TddCalculator @Inject constructor( tdd.totalAmount = tdd.bolusAmount + tdd.basalAmount //} + aapsLogger.debug(LTag.CORE, tdd.toString()) + return tdd + } + fun calculate4Daily():TotalDailyDose { + val startTime = dateUtil.now() - T.hours(hour = 4).msecs() + val endTime = dateUtil.now() + val tdd = TotalDailyDose(timestamp = startTime) + //val result = TotalDailyDose() + repository.getBolusesDataFromTimeToTime(startTime, endTime, true).blockingGet() + .filter { it.type != Bolus.Type.PRIMING } + .forEach { t -> + //val midnight = MidnightTime.calc(t.timestamp) + //val tdd = result[midnight] ?: TotalDailyDose(timestamp = midnight) + tdd.bolusAmount += t.amount + //result.put(midnight, tdd) + } + repository.getCarbsDataFromTimeToTimeExpanded(startTime, endTime, true).blockingGet().forEach { t -> + //val midnight = MidnightTime.calc(t.timestamp) + //val tdd = result[midnight] ?: TotalDailyDose(timestamp = midnight) + tdd.carbs += t.amount + //result.put(midnight, tdd) + } + val calculationStep = T.mins(5).msecs() + val tempBasals = iobCobCalculator.getTempBasalIncludingConvertedExtendedForRange(startTime, endTime, calculationStep) + for (t in startTime until endTime step calculationStep) { + + //val midnight = MidnightTime.calc(t) + //val tdd = result[midnight] ?: TotalDailyDose(timestamp = midnight) + val tbr = iobCobCalculator.getTempBasalIncludingConvertedExtended(t) + val profile = profileFunction.getProfile(t) ?: continue + val absoluteRate = tbr?.convertedToAbsolute(t, profile) ?: profile.getBasal(t) + tdd.basalAmount += absoluteRate / 60.0 * 5.0 + + if (!activePlugin.activePump.isFakingTempsByExtendedBoluses) { + // they are not included in TBRs + val eb = iobCobCalculator.getExtendedBolus(t) + val absoluteEbRate = eb?.rate ?: 0.0 + tdd.bolusAmount += absoluteEbRate / 60.0 * 5.0 + } + //result.put(midnight, tdd) + } + //for (i in 0 until tdd.size()) { + //val tdd = result.valueAt(i) + tdd.totalAmount = tdd.bolusAmount + tdd.basalAmount + //} + + + aapsLogger.debug(LTag.CORE, tdd.toString()) + return tdd + } + + + fun calculate8Gap():TotalDailyDose { + val startTime = dateUtil.now() - T.hours(hour = 8).msecs() + val endTime = dateUtil.now() - T.hours(hour = 4).msecs() + val tdd = TotalDailyDose(timestamp = startTime) + //val result = TotalDailyDose() + repository.getBolusesDataFromTimeToTime(startTime, endTime, true).blockingGet() + .filter { it.type != Bolus.Type.PRIMING } + .forEach { t -> + //val midnight = MidnightTime.calc(t.timestamp) + //val tdd = result[midnight] ?: TotalDailyDose(timestamp = midnight) + tdd.bolusAmount += t.amount + //result.put(midnight, tdd) + } + repository.getCarbsDataFromTimeToTimeExpanded(startTime, endTime, true).blockingGet().forEach { t -> + //val midnight = MidnightTime.calc(t.timestamp) + //val tdd = result[midnight] ?: TotalDailyDose(timestamp = midnight) + tdd.carbs += t.amount + //result.put(midnight, tdd) + } + val calculationStep = T.mins(5).msecs() + val tempBasals = iobCobCalculator.getTempBasalIncludingConvertedExtendedForRange(startTime, endTime, calculationStep) + for (t in startTime until endTime step calculationStep) { + + //val midnight = MidnightTime.calc(t) + //val tdd = result[midnight] ?: TotalDailyDose(timestamp = midnight) + val tbr = iobCobCalculator.getTempBasalIncludingConvertedExtended(t) + val profile = profileFunction.getProfile(t) ?: continue + val absoluteRate = tbr?.convertedToAbsolute(t, profile) ?: profile.getBasal(t) + tdd.basalAmount += absoluteRate / 60.0 * 5.0 + + if (!activePlugin.activePump.isFakingTempsByExtendedBoluses) { + // they are not included in TBRs + val eb = iobCobCalculator.getExtendedBolus(t) + val absoluteEbRate = eb?.rate ?: 0.0 + tdd.bolusAmount += absoluteEbRate / 60.0 * 5.0 + } + //result.put(midnight, tdd) + } + //for (i in 0 until tdd.size()) { + //val tdd = result.valueAt(i) + tdd.totalAmount = tdd.bolusAmount + tdd.basalAmount + //} + + aapsLogger.debug(LTag.CORE, tdd.toString()) return tdd } diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index f60b454a22..662224ae11 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -58,6 +58,7 @@ Treatments safety Max allowed bolus [U] Max allowed carbs [g] + BG level below which low glucose suspend occurs %1$s Preferences Preferences Refresh treatments from NS @@ -162,7 +163,10 @@ APS Mode Closed Loop Open Loop - Low Glucose Suspend + Low Glucose Suspend + Humalog/Novolog + Fiasp + Lyumjev Loop Disabled New suggestion available Carbs Suggestion @@ -701,6 +705,7 @@ A bolus was delivered within the last 3 minutes, skipping SMB Basal set correctly treatmentssafety_maxbolus + lgsThreshold Limiting extended bolus to %1$.1f U because of %2$s Limiting carbs to %1$d g because of %2$s Limiting IOB to %1$.1f U because of %2$s @@ -720,6 +725,7 @@ This value is called Max IOB in OpenAPS context\nOpenAPS will not add more insulin if current IOB is greater than this value Meal max absorption time [h] Time at which any meal is considered absorbed. Remaining carbs will be cut off. + BG value below which insulin is suspended. Default value uses standard target model. User can set value between 60mg/dl (3.3mmol/l) and 100mg/dl(5.5mmol/l). Values below 65/3.6 result in use of default model Show notes field in treatment dialogs SetupWizardActivity Next diff --git a/app/src/main/res/xml/pref_openapssmbdynamicisf.xml b/app/src/main/res/xml/pref_openapssmbdynamicisf.xml index 135771f768..03feac98ed 100644 --- a/app/src/main/res/xml/pref_openapssmbdynamicisf.xml +++ b/app/src/main/res/xml/pref_openapssmbdynamicisf.xml @@ -39,6 +39,16 @@ validate:floatminNumber="1" validate:testType="floatNumericRange" /> + + Date: Tue, 14 Jun 2022 11:56:43 +0200 Subject: [PATCH 03/44] DynISF cleanup --- .../OpenAPSSMBDynamicISF/determine-basal.js | 40 +----- .../DetermineBasalAdapterSMBDynamicISFJS.kt | 14 +- .../androidaps/utils/stats/TddCalculator.kt | 134 +----------------- app/src/main/res/values/strings.xml | 2 +- .../res/xml/pref_openapssmbdynamicisf.xml | 10 +- .../androidaps/interfaces/Profile.kt | 3 + 6 files changed, 26 insertions(+), 177 deletions(-) diff --git a/app/src/main/assets/OpenAPSSMBDynamicISF/determine-basal.js b/app/src/main/assets/OpenAPSSMBDynamicISF/determine-basal.js index 8a9e08b15d..321f3a4871 100644 --- a/app/src/main/assets/OpenAPSSMBDynamicISF/determine-basal.js +++ b/app/src/main/assets/OpenAPSSMBDynamicISF/determine-basal.js @@ -511,40 +511,14 @@ var determine_basal = function determine_basal(glucose_status, currenttemp, iob_ } // min_bg of 90 -> threshold of 65, 100 -> 70 110 -> 75, and 130 -> 85, or if specified by user, take that value - var lgsThreshold = profile.lgsThreshold; - console.error("Profile LGS Threshold set to"+lgsThreshold+"; "); - //if(lgsThreshold < 5.6) - if(lgsThreshold > 3.2 && lgsThreshold < 5.6){ - lgsThreshold = (18 * lgsThreshold); - lgsThreshold = round(lgsThreshold, 2); - console.error("LGS Threshold converted to"+lgsThreshold+"; "); - }else{ - lgsThreshold; - } - var threshold = min_bg - 0.5*(min_bg-40); - var oldThreshold = threshold; - if(lgsThreshold < 65 || lgsThreshold > 120) { - threshold; - } - else if( lgsThreshold < threshold){ - threshold; - } - else { - threshold = lgsThreshold; - } - console.error("Threshold set from " + convert_bg(oldThreshold, profile) + " to " + convert_bg(threshold, profile) + "; "); + var lgsThreshold = profile.lgsThreshold; + var threshold = min_bg - 0.5*(min_bg-40); + var oldThreshold = threshold; + if (lgsThreshold >= 65 && lgsThreshold <= 120 && lgsThreshold > threshold) { + threshold = lgsThreshold; + } + console.error("Threshold set from " + convert_bg(oldThreshold, profile) + " to " + convert_bg(threshold, profile) + "; "); - /*var oldThreshold = threshold; - - if(lgsThreshold < 65 || lgsThreshold > 120) { - lgsThreshold = threshold; - } - else{ - threshold = Math.max(threshold, lgsThreshold); - } - if( threshold === lgsThreshold ) { - console.log("Threshold set from " + convert_bg(oldThreshold, profile) + " to " + convert_bg(threshold, profile) + "; ") - }*/ //console.error(reservoir_data); rT = { diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/aps/openAPSSMBDynamicISF/DetermineBasalAdapterSMBDynamicISFJS.kt b/app/src/main/java/info/nightscout/androidaps/plugins/aps/openAPSSMBDynamicISF/DetermineBasalAdapterSMBDynamicISFJS.kt index f2b8916721..d5a33606eb 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/aps/openAPSSMBDynamicISF/DetermineBasalAdapterSMBDynamicISFJS.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/aps/openAPSSMBDynamicISF/DetermineBasalAdapterSMBDynamicISFJS.kt @@ -192,11 +192,11 @@ class DetermineBasalAdapterSMBDynamicISFJS internal constructor(private val scri this.profile.put("sens", profile.getIsfMgdl()) this.profile.put("max_daily_safety_multiplier", sp.getInt(R.string.key_openapsama_max_daily_safety_multiplier, 3)) this.profile.put("current_basal_safety_multiplier", sp.getDouble(R.string.key_openapsama_current_basal_safety_multiplier, 4.0)) - this.profile.put("lgsThreshold", sp.getDouble(R.string.key_treatmentssafety_lgsThreshold, 60.0)) + this.profile.put("lgsThreshold", Profile.toMgdl(sp.getDouble(R.string.key_lgs_threshold, 65.0))) val insulin = activePlugin.activeInsulin - val insulinType = insulin.friendlyName - val insulinPeak = insulin.peak + val insulinType = insulin.friendlyName + val insulinPeak = insulin.peak //mProfile.put("high_temptarget_raises_sensitivity", SP.getBoolean(R.string.key_high_temptarget_raises_sensitivity, SMBDefaults.high_temptarget_raises_sensitivity)); this.profile.put("high_temptarget_raises_sensitivity", sp.getBoolean(R.string.key_high_temptarget_raises_sensitivity, SMBDefaults.high_temptarget_raises_sensitivity)) @@ -227,7 +227,7 @@ class DetermineBasalAdapterSMBDynamicISFJS internal constructor(private val scri this.profile.put("enableSMB_after_carbs", smbEnabled && sp.getBoolean(R.string.key_enableSMB_after_carbs, false) && advancedFiltering) this.profile.put("maxSMBBasalMinutes", sp.getInt(R.string.key_smbmaxminutes, SMBDefaults.maxSMBBasalMinutes)) this.profile.put("maxUAMSMBBasalMinutes", sp.getInt(R.string.key_uamsmbmaxminutes, SMBDefaults.maxUAMSMBBasalMinutes)) - this.profile.put("DynISFAdjust", SafeParse.stringToDouble(sp.getString(R.string.key_DynISFAdjust,"100"))) + this.profile.put("DynISFAdjust", SafeParse.stringToDouble(sp.getString(R.string.key_DynISFAdjust, "100"))) this.profile.put("insulinType", insulinType) this.profile.put("insulinPeak", insulinPeak) this.profile.put("maxUAMSMBBasalMinutes", sp.getInt(R.string.key_uamsmbmaxminutes, SMBDefaults.maxUAMSMBBasalMinutes)) @@ -272,9 +272,9 @@ class DetermineBasalAdapterSMBDynamicISFJS internal constructor(private val scri this.mealData.put("TDDAIMI1", tddCalculator.averageTDD(tddCalculator.calculate(1))?.totalAmount) this.mealData.put("TDDAIMI7", tddCalculator.averageTDD(tddCalculator.calculate(7))?.totalAmount) - this.mealData.put("TDDLast4", tddCalculator.calculate4Daily().totalAmount) - this.mealData.put("TDD4to8", tddCalculator.calculate8Gap().totalAmount) - this.mealData.put("TDD24", tddCalculator.calculate24Daily().totalAmount) + this.mealData.put("TDDLast4", tddCalculator.calculateDaily(-4, 0).totalAmount) + this.mealData.put("TDD4to8", tddCalculator.calculateDaily(-8, -4).totalAmount) + this.mealData.put("TDD24", tddCalculator.calculateDaily(-24, 0).totalAmount) 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 87c702911a..e07e492e9a 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 @@ -99,41 +99,9 @@ class TddCalculator @Inject constructor( return result } - fun calculateDaily(): TotalDailyDose { - val startTime = MidnightTime.calc(dateUtil.now()) - val endTime = dateUtil.now() - val tdd = TotalDailyDose(timestamp = startTime) - //val result = TotalDailyDose() - repository.getBolusesDataFromTimeToTime(startTime, endTime, true).blockingGet() - .filter { it.type != Bolus.Type.PRIMING } - .forEach { t -> - tdd.bolusAmount += t.amount - } - repository.getCarbsDataFromTimeToTimeExpanded(startTime, endTime, true).blockingGet().forEach { t -> - tdd.carbs += t.amount - } - val calculationStep = T.mins(5).msecs() - for (t in startTime until endTime step calculationStep) { - val tbr = iobCobCalculator.getTempBasalIncludingConvertedExtended(t) - val profile = profileFunction.getProfile(t) ?: continue - val absoluteRate = tbr?.convertedToAbsolute(t, profile) ?: profile.getBasal(t) - tdd.basalAmount += absoluteRate / 60.0 * 5.0 - - if (!activePlugin.activePump.isFakingTempsByExtendedBoluses) { - // they are not included in TBRs - val eb = iobCobCalculator.getExtendedBolus(t) - val absoluteEbRate = eb?.rate ?: 0.0 - tdd.bolusAmount += absoluteEbRate / 60.0 * 5.0 - } - } - tdd.totalAmount = tdd.bolusAmount + tdd.basalAmount - aapsLogger.debug(LTag.CORE, tdd.toString()) - return tdd - } - - fun calculate24Daily(): TotalDailyDose { - val startTime = dateUtil.now() - T.hours(hour = 24).msecs() - val endTime = dateUtil.now() + fun calculateDaily(startHours: Long, endHours: Long): TotalDailyDose { + val startTime = dateUtil.now() + T.hours(hour = startHours).msecs() + val endTime = dateUtil.now() + T.hours(hour = endHours).msecs() val tdd = TotalDailyDose(timestamp = startTime) repository.getBolusesDataFromTimeToTime(startTime, endTime, true).blockingGet() .filter { it.type != Bolus.Type.PRIMING } @@ -161,102 +129,6 @@ class TddCalculator @Inject constructor( aapsLogger.debug(LTag.CORE, tdd.toString()) return tdd } - fun calculate4Daily():TotalDailyDose { - val startTime = dateUtil.now() - T.hours(hour = 4).msecs() - val endTime = dateUtil.now() - val tdd = TotalDailyDose(timestamp = startTime) - //val result = TotalDailyDose() - repository.getBolusesDataFromTimeToTime(startTime, endTime, true).blockingGet() - .filter { it.type != Bolus.Type.PRIMING } - .forEach { t -> - //val midnight = MidnightTime.calc(t.timestamp) - //val tdd = result[midnight] ?: TotalDailyDose(timestamp = midnight) - tdd.bolusAmount += t.amount - //result.put(midnight, tdd) - } - repository.getCarbsDataFromTimeToTimeExpanded(startTime, endTime, true).blockingGet().forEach { t -> - //val midnight = MidnightTime.calc(t.timestamp) - //val tdd = result[midnight] ?: TotalDailyDose(timestamp = midnight) - tdd.carbs += t.amount - //result.put(midnight, tdd) - } - val calculationStep = T.mins(5).msecs() - val tempBasals = iobCobCalculator.getTempBasalIncludingConvertedExtendedForRange(startTime, endTime, calculationStep) - for (t in startTime until endTime step calculationStep) { - - //val midnight = MidnightTime.calc(t) - //val tdd = result[midnight] ?: TotalDailyDose(timestamp = midnight) - val tbr = iobCobCalculator.getTempBasalIncludingConvertedExtended(t) - val profile = profileFunction.getProfile(t) ?: continue - val absoluteRate = tbr?.convertedToAbsolute(t, profile) ?: profile.getBasal(t) - tdd.basalAmount += absoluteRate / 60.0 * 5.0 - - if (!activePlugin.activePump.isFakingTempsByExtendedBoluses) { - // they are not included in TBRs - val eb = iobCobCalculator.getExtendedBolus(t) - val absoluteEbRate = eb?.rate ?: 0.0 - tdd.bolusAmount += absoluteEbRate / 60.0 * 5.0 - } - //result.put(midnight, tdd) - } - //for (i in 0 until tdd.size()) { - //val tdd = result.valueAt(i) - tdd.totalAmount = tdd.bolusAmount + tdd.basalAmount - //} - - - aapsLogger.debug(LTag.CORE, tdd.toString()) - return tdd - } - - - fun calculate8Gap():TotalDailyDose { - val startTime = dateUtil.now() - T.hours(hour = 8).msecs() - val endTime = dateUtil.now() - T.hours(hour = 4).msecs() - val tdd = TotalDailyDose(timestamp = startTime) - //val result = TotalDailyDose() - repository.getBolusesDataFromTimeToTime(startTime, endTime, true).blockingGet() - .filter { it.type != Bolus.Type.PRIMING } - .forEach { t -> - //val midnight = MidnightTime.calc(t.timestamp) - //val tdd = result[midnight] ?: TotalDailyDose(timestamp = midnight) - tdd.bolusAmount += t.amount - //result.put(midnight, tdd) - } - repository.getCarbsDataFromTimeToTimeExpanded(startTime, endTime, true).blockingGet().forEach { t -> - //val midnight = MidnightTime.calc(t.timestamp) - //val tdd = result[midnight] ?: TotalDailyDose(timestamp = midnight) - tdd.carbs += t.amount - //result.put(midnight, tdd) - } - val calculationStep = T.mins(5).msecs() - val tempBasals = iobCobCalculator.getTempBasalIncludingConvertedExtendedForRange(startTime, endTime, calculationStep) - for (t in startTime until endTime step calculationStep) { - - //val midnight = MidnightTime.calc(t) - //val tdd = result[midnight] ?: TotalDailyDose(timestamp = midnight) - val tbr = iobCobCalculator.getTempBasalIncludingConvertedExtended(t) - val profile = profileFunction.getProfile(t) ?: continue - val absoluteRate = tbr?.convertedToAbsolute(t, profile) ?: profile.getBasal(t) - tdd.basalAmount += absoluteRate / 60.0 * 5.0 - - if (!activePlugin.activePump.isFakingTempsByExtendedBoluses) { - // they are not included in TBRs - val eb = iobCobCalculator.getExtendedBolus(t) - val absoluteEbRate = eb?.rate ?: 0.0 - tdd.bolusAmount += absoluteEbRate / 60.0 * 5.0 - } - //result.put(midnight, tdd) - } - //for (i in 0 until tdd.size()) { - //val tdd = result.valueAt(i) - tdd.totalAmount = tdd.bolusAmount + tdd.basalAmount - //} - - - aapsLogger.debug(LTag.CORE, tdd.toString()) - return tdd - } fun averageTDD(tdds: LongSparseArray): TotalDailyDose? { val totalTdd = TotalDailyDose(timestamp = dateUtil.now()) diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 662224ae11..e34436ac85 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -705,7 +705,7 @@ A bolus was delivered within the last 3 minutes, skipping SMB Basal set correctly treatmentssafety_maxbolus - lgsThreshold + lgsThreshold Limiting extended bolus to %1$.1f U because of %2$s Limiting carbs to %1$d g because of %2$s Limiting IOB to %1$.1f U because of %2$s diff --git a/app/src/main/res/xml/pref_openapssmbdynamicisf.xml b/app/src/main/res/xml/pref_openapssmbdynamicisf.xml index 03feac98ed..c1267c75ef 100644 --- a/app/src/main/res/xml/pref_openapssmbdynamicisf.xml +++ b/app/src/main/res/xml/pref_openapssmbdynamicisf.xml @@ -40,14 +40,14 @@ validate:testType="floatNumericRange" /> + validate:floatmaxNumber="120" + validate:floatminNumber="65" + validate:testType="bgRange" /> Date: Fri, 17 Jun 2022 11:24:51 +0200 Subject: [PATCH 04/44] resolve deadlock in Objective 7 --- .../objectives/objectives/Objective6.kt | 21 +++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/constraints/objectives/objectives/Objective6.kt b/app/src/main/java/info/nightscout/androidaps/plugins/constraints/objectives/objectives/Objective6.kt index edcdf54bd5..dd10f4a33d 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/constraints/objectives/objectives/Objective6.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/constraints/objectives/objectives/Objective6.kt @@ -2,7 +2,9 @@ package info.nightscout.androidaps.plugins.constraints.objectives.objectives import dagger.android.HasAndroidInjector import info.nightscout.androidaps.R +import info.nightscout.androidaps.interfaces.Constraint import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker +import info.nightscout.androidaps.plugins.constraints.safety.SafetyPlugin import info.nightscout.androidaps.utils.T import javax.inject.Inject @@ -10,14 +12,21 @@ import javax.inject.Inject class Objective6(injector: HasAndroidInjector) : Objective(injector, "maxiob", R.string.objectives_maxiob_objective, R.string.objectives_maxiob_gate) { @Inject lateinit var constraintChecker: ConstraintChecker + @Inject lateinit var safetyPlugin: SafetyPlugin init { tasks.add(MinimumDurationTask(this, T.days(1).msecs())) - tasks.add(object : Task(this, R.string.maxiobset) { - override fun isCompleted(): Boolean { - val maxIOB = constraintChecker.getMaxIOBAllowed().value() - return maxIOB > 0 - } - }) + tasks.add( + object : Task(this, R.string.closedmodeenabled) { + override fun isCompleted(): Boolean = sp.getString(R.string.key_aps_mode, "open") == "closed" + }) + tasks.add( + object : Task(this, R.string.maxiobset) { + + override fun isCompleted(): Boolean { + val maxIOB = constraintChecker.getMaxIOBAllowed().value() + return maxIOB > 0 + } + }) } } \ No newline at end of file From 8f36b4a0dc23039fb01a0c8ebb72403516ee43e1 Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Fri, 17 Jun 2022 11:38:00 +0200 Subject: [PATCH 05/44] Cleanup #2 --- .../OpenAPSSMBDynamicISF/determine-basal.js | 34 ++++++++++--------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/app/src/main/assets/OpenAPSSMBDynamicISF/determine-basal.js b/app/src/main/assets/OpenAPSSMBDynamicISF/determine-basal.js index 321f3a4871..2944f6077f 100644 --- a/app/src/main/assets/OpenAPSSMBDynamicISF/determine-basal.js +++ b/app/src/main/assets/OpenAPSSMBDynamicISF/determine-basal.js @@ -270,13 +270,15 @@ var determine_basal = function determine_basal(glucose_status, currenttemp, iob_ //console.log("Initial insulin value for ISF: "+ins_val+"; "); //console.log("Current value for insulin: "+insulin+"; "); - var ins_val = 75; // Lyumjev peak: 75 - if (profile.insulinPeak > 65) { // lyumjev peak: 45 - ins_val = 55; - } else if (profile.insulinPeak > 50 ){ // ultra rapid peak: 55 - ins_val = 65; - } - console.log("For "+profile.insulinType+" (insulin peak: "+profile.insulinPeak+") divisor is: "+ins_val+"; "); + var ins_val; + if (profile.insulinPeak > 65) { // lyumjev peak: 45 + ins_val = 55; + } else if (profile.insulinPeak > 50 ){ // ultra rapid peak: 55 + ins_val = 65; + } else { + ins_val = 75; // rapid peak: 75 + } + console.log("For "+profile.insulinType+" (insulin peak: "+profile.insulinPeak+") divisor is: "+ins_val+"; "); console.log("Insulin value for ISF based on profile: "+ins_val+"; "); @@ -824,25 +826,25 @@ var determine_basal = function determine_basal(glucose_status, currenttemp, iob_ if (bg > target_bg && glucose_status.delta < 3 && glucose_status.delta > -3 && glucose_status.short_avgdelta > -3 && glucose_status.short_avgdelta < 3 && eventualBG > target_bg && eventualBG < bg ) { var future_sens = ( 1800 / (Math.log((((eventualBG * 0.5) + (bg * 0.5))/ins_val)+1)*TDD)); - var future_sens_old = ( 277700 / (TDD * ((bg * 0.5) + (eventualBG * 0.5 )))); - console.log("Future state sensitivity is " +future_sens+" based on eventual and current bg due to flat glucose level above target"); - rT.reason += "Dosing sensitivity: " +future_sens+" using eventual BG;"; + //var future_sens_old = ( 277700 / (TDD * ((bg * 0.5) + (eventualBG * 0.5 )))); + console.log("Future state sensitivity is " +future_sens+" based on eventual and current bg due to flat glucose level above target"); + rT.reason += "Dosing sensitivity: " +future_sens+" using eventual BG;"; } else if( glucose_status.delta > 0 && eventualBG > target_bg ) { var future_sens = ( 1800 / (Math.log((bg/ins_val)+1)*TDD)); - var future_sens_old = ( 277700 / (TDD * bg)); + //var future_sens_old = ( 277700 / (TDD * bg)); console.log("Future state sensitivity is " +future_sens+" using current bg due to small delta or variation"); rT.reason += "Dosing sensitivity: " +future_sens+" using current BG;"; } else { - var future_sens = ( 1800 / (Math.log((eventualBG/ins_val)+1)*TDD)); - var future_sens_old = ( 277700 / (TDD * eventualBG)); - console.log("Future state sensitivity is " +future_sens+" based on eventual bg due to -ve delta"); - rT.reason += "Dosing sensitivity: " +future_sens+" using eventual BG;"; + var future_sens = ( 1800 / (Math.log((eventualBG/ins_val)+1)*TDD)); + //var future_sens_old = ( 277700 / (TDD * eventualBG)); + console.log("Future state sensitivity is " +future_sens+" based on eventual bg due to -ve delta"); + rT.reason += "Dosing sensitivity: " +future_sens+" using eventual BG;"; } - var future_sens = round(future_sens,1); + future_sens = round(future_sens,1); From ac0a58bad4b06bf87af5c79a0c540333d8bf2187 Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Fri, 17 Jun 2022 11:42:06 +0200 Subject: [PATCH 06/44] New Crowdin updates (#1828) * New translations strings.xml (Romanian) * New translations strings.xml (French) * New translations strings.xml (Spanish) * New translations strings.xml (Afrikaans) * New translations strings.xml (Bulgarian) * New translations strings.xml (Catalan) * New translations strings.xml (Czech) * New translations strings.xml (Lithuanian) * New translations strings.xml (Czech) * New translations strings.xml (Danish) * New translations strings.xml (German) * New translations strings.xml (Greek) * New translations strings.xml (Irish) * New translations strings.xml (Hebrew) * New translations strings.xml (Hungarian) * New translations strings.xml (Italian) * New translations strings.xml (Korean) * New translations strings.xml (Dutch) * New translations strings.xml (Bulgarian) * New translations strings.xml (Norwegian) * New translations strings.xml (Polish) * New translations strings.xml (Portuguese) * New translations strings.xml (Russian) * New translations strings.xml (Slovak) * New translations strings.xml (Swedish) * New translations strings.xml (Turkish) * New translations strings.xml (Chinese Simplified) * New translations strings.xml (Portuguese, Brazilian) * New translations strings.xml (Catalan) * New translations strings.xml (Afrikaans) * New translations strings.xml (Danish) * New translations strings.xml (Norwegian) * New translations strings.xml (German) * New translations strings.xml (Greek) * New translations strings.xml (Irish) * New translations strings.xml (Hebrew) * New translations strings.xml (Hungarian) * New translations strings.xml (Italian) * New translations strings.xml (Korean) * New translations strings.xml (Lithuanian) * New translations strings.xml (Dutch) * New translations strings.xml (Polish) * New translations strings.xml (Spanish) * New translations strings.xml (Portuguese) * New translations strings.xml (Russian) * New translations strings.xml (Slovak) * New translations strings.xml (Swedish) * New translations strings.xml (Turkish) * New translations strings.xml (Chinese Simplified) * New translations strings.xml (Portuguese, Brazilian) * New translations strings.xml (Croatian) * New translations strings.xml (Romanian) * New translations strings.xml (French) * New translations strings.xml (Croatian) * New translations strings.xml (French) * New translations strings.xml (Turkish) * New translations strings.xml (French) * New translations strings.xml (Turkish) * New translations strings.xml (Slovak) * New translations strings.xml (Slovak) * New translations strings.xml (Hebrew) * New translations strings.xml (Slovak) * New translations strings.xml (Hebrew) * New translations strings.xml (Slovak) * New translations strings.xml (Russian) * New translations strings.xml (Russian) * New translations strings.xml (Russian) * New translations strings.xml (Russian) * New translations strings.xml (Turkish) * New translations strings.xml (Norwegian) * New translations strings.xml (Norwegian) * New translations strings.xml (Turkish) * New translations strings.xml (Spanish) * New translations strings.xml (Spanish) * New translations strings.xml (Spanish) --- app/src/main/res/values-tr-rTR/strings.xml | 2 +- core/src/main/res/values-ru-rRU/strings.xml | 2 ++ core/src/main/res/values-sk-rSK/strings.xml | 2 ++ danar/src/main/res/values-af-rZA/strings.xml | 2 ++ danar/src/main/res/values-bg-rBG/strings.xml | 2 ++ danar/src/main/res/values-ca-rES/strings.xml | 2 ++ danar/src/main/res/values-cs-rCZ/strings.xml | 4 +++ danar/src/main/res/values-da-rDK/strings.xml | 2 ++ danar/src/main/res/values-de-rDE/strings.xml | 2 ++ danar/src/main/res/values-el-rGR/strings.xml | 2 ++ danar/src/main/res/values-es-rES/strings.xml | 4 +++ danar/src/main/res/values-fr-rFR/strings.xml | 4 +++ danar/src/main/res/values-ga-rIE/strings.xml | 2 ++ danar/src/main/res/values-hr-rHR/strings.xml | 2 ++ danar/src/main/res/values-hu-rHU/strings.xml | 2 ++ danar/src/main/res/values-it-rIT/strings.xml | 2 ++ danar/src/main/res/values-iw-rIL/strings.xml | 4 +++ danar/src/main/res/values-ko-rKR/strings.xml | 2 ++ danar/src/main/res/values-lt-rLT/strings.xml | 2 ++ danar/src/main/res/values-nl-rNL/strings.xml | 2 ++ danar/src/main/res/values-no-rNO/strings.xml | 4 +++ danar/src/main/res/values-pl-rPL/strings.xml | 2 ++ danar/src/main/res/values-pt-rBR/strings.xml | 2 ++ danar/src/main/res/values-pt-rPT/strings.xml | 2 ++ danar/src/main/res/values-ro-rRO/strings.xml | 2 ++ danar/src/main/res/values-ru-rRU/strings.xml | 4 +++ danar/src/main/res/values-sk-rSK/strings.xml | 4 +++ danar/src/main/res/values-sv-rSE/strings.xml | 2 ++ danar/src/main/res/values-tr-rTR/strings.xml | 4 +++ danar/src/main/res/values-zh-rCN/strings.xml | 2 ++ .../src/main/res/values-af-rZA/strings.xml | 6 +++++ .../src/main/res/values-bg-rBG/strings.xml | 6 +++++ .../src/main/res/values-ca-rES/strings.xml | 6 +++++ .../src/main/res/values-cs-rCZ/strings.xml | 27 +++++++++++++++++++ .../src/main/res/values-da-rDK/strings.xml | 6 +++++ .../src/main/res/values-de-rDE/strings.xml | 6 +++++ .../src/main/res/values-el-rGR/strings.xml | 6 +++++ .../src/main/res/values-es-rES/strings.xml | 22 +++++++++++++++ .../src/main/res/values-fr-rFR/strings.xml | 27 +++++++++++++++++++ .../src/main/res/values-ga-rIE/strings.xml | 6 +++++ .../src/main/res/values-hr-rHR/strings.xml | 6 +++++ .../src/main/res/values-hu-rHU/strings.xml | 6 +++++ .../src/main/res/values-it-rIT/strings.xml | 6 +++++ .../src/main/res/values-iw-rIL/strings.xml | 27 +++++++++++++++++++ .../src/main/res/values-ko-rKR/strings.xml | 6 +++++ .../src/main/res/values-lt-rLT/strings.xml | 6 +++++ .../src/main/res/values-nl-rNL/strings.xml | 6 +++++ .../src/main/res/values-no-rNO/strings.xml | 27 +++++++++++++++++++ .../src/main/res/values-pl-rPL/strings.xml | 6 +++++ .../src/main/res/values-pt-rBR/strings.xml | 6 +++++ .../src/main/res/values-pt-rPT/strings.xml | 6 +++++ .../src/main/res/values-ro-rRO/strings.xml | 6 +++++ .../src/main/res/values-ru-rRU/strings.xml | 27 +++++++++++++++++++ .../src/main/res/values-sk-rSK/strings.xml | 27 +++++++++++++++++++ .../src/main/res/values-sv-rSE/strings.xml | 6 +++++ .../src/main/res/values-tr-rTR/strings.xml | 27 +++++++++++++++++++ .../src/main/res/values-zh-rCN/strings.xml | 6 +++++ wear/src/main/res/values-sk-rSK/strings.xml | 1 + 58 files changed, 401 insertions(+), 1 deletion(-) create mode 100644 danar/src/main/res/values-af-rZA/strings.xml create mode 100644 danar/src/main/res/values-bg-rBG/strings.xml create mode 100644 danar/src/main/res/values-ca-rES/strings.xml create mode 100644 danar/src/main/res/values-cs-rCZ/strings.xml create mode 100644 danar/src/main/res/values-da-rDK/strings.xml create mode 100644 danar/src/main/res/values-de-rDE/strings.xml create mode 100644 danar/src/main/res/values-el-rGR/strings.xml create mode 100644 danar/src/main/res/values-es-rES/strings.xml create mode 100644 danar/src/main/res/values-fr-rFR/strings.xml create mode 100644 danar/src/main/res/values-ga-rIE/strings.xml create mode 100644 danar/src/main/res/values-hr-rHR/strings.xml create mode 100644 danar/src/main/res/values-hu-rHU/strings.xml create mode 100644 danar/src/main/res/values-it-rIT/strings.xml create mode 100644 danar/src/main/res/values-iw-rIL/strings.xml create mode 100644 danar/src/main/res/values-ko-rKR/strings.xml create mode 100644 danar/src/main/res/values-lt-rLT/strings.xml create mode 100644 danar/src/main/res/values-nl-rNL/strings.xml create mode 100644 danar/src/main/res/values-no-rNO/strings.xml create mode 100644 danar/src/main/res/values-pl-rPL/strings.xml create mode 100644 danar/src/main/res/values-pt-rBR/strings.xml create mode 100644 danar/src/main/res/values-pt-rPT/strings.xml create mode 100644 danar/src/main/res/values-ro-rRO/strings.xml create mode 100644 danar/src/main/res/values-ru-rRU/strings.xml create mode 100644 danar/src/main/res/values-sk-rSK/strings.xml create mode 100644 danar/src/main/res/values-sv-rSE/strings.xml create mode 100644 danar/src/main/res/values-tr-rTR/strings.xml create mode 100644 danar/src/main/res/values-zh-rCN/strings.xml create mode 100644 pump-common/src/main/res/values-af-rZA/strings.xml create mode 100644 pump-common/src/main/res/values-bg-rBG/strings.xml create mode 100644 pump-common/src/main/res/values-ca-rES/strings.xml create mode 100644 pump-common/src/main/res/values-cs-rCZ/strings.xml create mode 100644 pump-common/src/main/res/values-da-rDK/strings.xml create mode 100644 pump-common/src/main/res/values-de-rDE/strings.xml create mode 100644 pump-common/src/main/res/values-el-rGR/strings.xml create mode 100644 pump-common/src/main/res/values-es-rES/strings.xml create mode 100644 pump-common/src/main/res/values-fr-rFR/strings.xml create mode 100644 pump-common/src/main/res/values-ga-rIE/strings.xml create mode 100644 pump-common/src/main/res/values-hr-rHR/strings.xml create mode 100644 pump-common/src/main/res/values-hu-rHU/strings.xml create mode 100644 pump-common/src/main/res/values-it-rIT/strings.xml create mode 100644 pump-common/src/main/res/values-iw-rIL/strings.xml create mode 100644 pump-common/src/main/res/values-ko-rKR/strings.xml create mode 100644 pump-common/src/main/res/values-lt-rLT/strings.xml create mode 100644 pump-common/src/main/res/values-nl-rNL/strings.xml create mode 100644 pump-common/src/main/res/values-no-rNO/strings.xml create mode 100644 pump-common/src/main/res/values-pl-rPL/strings.xml create mode 100644 pump-common/src/main/res/values-pt-rBR/strings.xml create mode 100644 pump-common/src/main/res/values-pt-rPT/strings.xml create mode 100644 pump-common/src/main/res/values-ro-rRO/strings.xml create mode 100644 pump-common/src/main/res/values-ru-rRU/strings.xml create mode 100644 pump-common/src/main/res/values-sk-rSK/strings.xml create mode 100644 pump-common/src/main/res/values-sv-rSE/strings.xml create mode 100644 pump-common/src/main/res/values-tr-rTR/strings.xml create mode 100644 pump-common/src/main/res/values-zh-rCN/strings.xml diff --git a/app/src/main/res/values-tr-rTR/strings.xml b/app/src/main/res/values-tr-rTR/strings.xml index fcf6eccb0b..510535d53d 100644 --- a/app/src/main/res/values-tr-rTR/strings.xml +++ b/app/src/main/res/values-tr-rTR/strings.xml @@ -140,7 +140,7 @@ Maks Ü/s geçici Bazal ayarlanabilir Bu değer OpenAPS\'te \"maksimum bazal\" olarak adlandırılır OpenAPS\'nin vermesine izin verilen maksimum bazal IOB (Aktif insülin) [U] - Bu değere OpenAPS bağlamında Max IOB denir.\nAPS\'de bir kerede verilebilen maksimum insülin [U] ü. + Bu değere OpenAPS bağlamında Maks IOB denir.\nAPS\'de bir kerede verilebilen maksimum insülin [U] ü. Dışa aktarılan tercihleri şifrelemek için kullanılacak ana parola sorulacaktır. İçe aktarılan tercihlerin şifresini çözmek için gerekli olan ana parola sorulacaktır. Aktarım iptal edildi! Tercihler dışa aktarılmadı! diff --git a/core/src/main/res/values-ru-rRU/strings.xml b/core/src/main/res/values-ru-rRU/strings.xml index 86d074832f..6cd340ae38 100644 --- a/core/src/main/res/values-ru-rRU/strings.xml +++ b/core/src/main/res/values-ru-rRU/strings.xml @@ -464,6 +464,8 @@ Последнее выполнение: Внимание: Выберите профиль для изменения + Выбранный профиль имеет %1$d значений IC. Автоматически будет использоваться %2$.2f г/ед + Выбранный профиль имеет %1$d значений ISF. Автоматически будет использоваться %2$.1f%3$s/ед Ошибка ввода данных, попробуйте запустить снова autotune или уменьшить количество дней Идет настройка автоматизации, ждите Перед использованием внимательно проверьте результаты! diff --git a/core/src/main/res/values-sk-rSK/strings.xml b/core/src/main/res/values-sk-rSK/strings.xml index cbd101e11e..485f80b80d 100644 --- a/core/src/main/res/values-sk-rSK/strings.xml +++ b/core/src/main/res/values-sk-rSK/strings.xml @@ -464,6 +464,8 @@ Posledné spustenie : Upozornenie : Vyberte profil pre ladenie + Vybraný profil má %1$d hodnôt IC. Autotune bude používať %2$.2f g/JI + Vybraný profil má %1$d hodnôt ISF. Autotune bude používať %2$.1f %3$s/JI Chyba vstupných dát, skúste znova spustiť Autotune, alebo znížte počet dní Autotune spustený, prosím buďte trpezliví Pred použitím výsledky starostlivo skontrolujte! diff --git a/danar/src/main/res/values-af-rZA/strings.xml b/danar/src/main/res/values-af-rZA/strings.xml new file mode 100644 index 0000000000..3ea04e700d --- /dev/null +++ b/danar/src/main/res/values-af-rZA/strings.xml @@ -0,0 +1,2 @@ + + diff --git a/danar/src/main/res/values-bg-rBG/strings.xml b/danar/src/main/res/values-bg-rBG/strings.xml new file mode 100644 index 0000000000..3ea04e700d --- /dev/null +++ b/danar/src/main/res/values-bg-rBG/strings.xml @@ -0,0 +1,2 @@ + + diff --git a/danar/src/main/res/values-ca-rES/strings.xml b/danar/src/main/res/values-ca-rES/strings.xml new file mode 100644 index 0000000000..3ea04e700d --- /dev/null +++ b/danar/src/main/res/values-ca-rES/strings.xml @@ -0,0 +1,2 @@ + + diff --git a/danar/src/main/res/values-cs-rCZ/strings.xml b/danar/src/main/res/values-cs-rCZ/strings.xml new file mode 100644 index 0000000000..d6f6dec21a --- /dev/null +++ b/danar/src/main/res/values-cs-rCZ/strings.xml @@ -0,0 +1,4 @@ + + + Nepodporovaná akce v pumpě. Používejte pouze rozhraní AndroidAPS! + diff --git a/danar/src/main/res/values-da-rDK/strings.xml b/danar/src/main/res/values-da-rDK/strings.xml new file mode 100644 index 0000000000..3ea04e700d --- /dev/null +++ b/danar/src/main/res/values-da-rDK/strings.xml @@ -0,0 +1,2 @@ + + diff --git a/danar/src/main/res/values-de-rDE/strings.xml b/danar/src/main/res/values-de-rDE/strings.xml new file mode 100644 index 0000000000..3ea04e700d --- /dev/null +++ b/danar/src/main/res/values-de-rDE/strings.xml @@ -0,0 +1,2 @@ + + diff --git a/danar/src/main/res/values-el-rGR/strings.xml b/danar/src/main/res/values-el-rGR/strings.xml new file mode 100644 index 0000000000..3ea04e700d --- /dev/null +++ b/danar/src/main/res/values-el-rGR/strings.xml @@ -0,0 +1,2 @@ + + diff --git a/danar/src/main/res/values-es-rES/strings.xml b/danar/src/main/res/values-es-rES/strings.xml new file mode 100644 index 0000000000..953c1b9b26 --- /dev/null +++ b/danar/src/main/res/values-es-rES/strings.xml @@ -0,0 +1,4 @@ + + + Acción no soportada en la bomba. Usa sólo la interfaz de AndroidAPS + diff --git a/danar/src/main/res/values-fr-rFR/strings.xml b/danar/src/main/res/values-fr-rFR/strings.xml new file mode 100644 index 0000000000..cacbde8ef7 --- /dev/null +++ b/danar/src/main/res/values-fr-rFR/strings.xml @@ -0,0 +1,4 @@ + + + Action non prise en charge par la pompe. Utilisez uniquement l’interface AndroidAPS! + diff --git a/danar/src/main/res/values-ga-rIE/strings.xml b/danar/src/main/res/values-ga-rIE/strings.xml new file mode 100644 index 0000000000..3ea04e700d --- /dev/null +++ b/danar/src/main/res/values-ga-rIE/strings.xml @@ -0,0 +1,2 @@ + + diff --git a/danar/src/main/res/values-hr-rHR/strings.xml b/danar/src/main/res/values-hr-rHR/strings.xml new file mode 100644 index 0000000000..3ea04e700d --- /dev/null +++ b/danar/src/main/res/values-hr-rHR/strings.xml @@ -0,0 +1,2 @@ + + diff --git a/danar/src/main/res/values-hu-rHU/strings.xml b/danar/src/main/res/values-hu-rHU/strings.xml new file mode 100644 index 0000000000..3ea04e700d --- /dev/null +++ b/danar/src/main/res/values-hu-rHU/strings.xml @@ -0,0 +1,2 @@ + + diff --git a/danar/src/main/res/values-it-rIT/strings.xml b/danar/src/main/res/values-it-rIT/strings.xml new file mode 100644 index 0000000000..3ea04e700d --- /dev/null +++ b/danar/src/main/res/values-it-rIT/strings.xml @@ -0,0 +1,2 @@ + + diff --git a/danar/src/main/res/values-iw-rIL/strings.xml b/danar/src/main/res/values-iw-rIL/strings.xml new file mode 100644 index 0000000000..089df8d969 --- /dev/null +++ b/danar/src/main/res/values-iw-rIL/strings.xml @@ -0,0 +1,4 @@ + + + פעולה שאינה נתמכת ע\"י המשאבה. נא להשתמש בממשק AndroidAPS בלבד! + diff --git a/danar/src/main/res/values-ko-rKR/strings.xml b/danar/src/main/res/values-ko-rKR/strings.xml new file mode 100644 index 0000000000..3ea04e700d --- /dev/null +++ b/danar/src/main/res/values-ko-rKR/strings.xml @@ -0,0 +1,2 @@ + + diff --git a/danar/src/main/res/values-lt-rLT/strings.xml b/danar/src/main/res/values-lt-rLT/strings.xml new file mode 100644 index 0000000000..3ea04e700d --- /dev/null +++ b/danar/src/main/res/values-lt-rLT/strings.xml @@ -0,0 +1,2 @@ + + diff --git a/danar/src/main/res/values-nl-rNL/strings.xml b/danar/src/main/res/values-nl-rNL/strings.xml new file mode 100644 index 0000000000..3ea04e700d --- /dev/null +++ b/danar/src/main/res/values-nl-rNL/strings.xml @@ -0,0 +1,2 @@ + + diff --git a/danar/src/main/res/values-no-rNO/strings.xml b/danar/src/main/res/values-no-rNO/strings.xml new file mode 100644 index 0000000000..1d5e4c4238 --- /dev/null +++ b/danar/src/main/res/values-no-rNO/strings.xml @@ -0,0 +1,4 @@ + + + Kommando ikke støttet i pumpen. Bruk kun AndroidAPS brukergrensesnittet! + diff --git a/danar/src/main/res/values-pl-rPL/strings.xml b/danar/src/main/res/values-pl-rPL/strings.xml new file mode 100644 index 0000000000..3ea04e700d --- /dev/null +++ b/danar/src/main/res/values-pl-rPL/strings.xml @@ -0,0 +1,2 @@ + + diff --git a/danar/src/main/res/values-pt-rBR/strings.xml b/danar/src/main/res/values-pt-rBR/strings.xml new file mode 100644 index 0000000000..3ea04e700d --- /dev/null +++ b/danar/src/main/res/values-pt-rBR/strings.xml @@ -0,0 +1,2 @@ + + diff --git a/danar/src/main/res/values-pt-rPT/strings.xml b/danar/src/main/res/values-pt-rPT/strings.xml new file mode 100644 index 0000000000..3ea04e700d --- /dev/null +++ b/danar/src/main/res/values-pt-rPT/strings.xml @@ -0,0 +1,2 @@ + + diff --git a/danar/src/main/res/values-ro-rRO/strings.xml b/danar/src/main/res/values-ro-rRO/strings.xml new file mode 100644 index 0000000000..3ea04e700d --- /dev/null +++ b/danar/src/main/res/values-ro-rRO/strings.xml @@ -0,0 +1,2 @@ + + diff --git a/danar/src/main/res/values-ru-rRU/strings.xml b/danar/src/main/res/values-ru-rRU/strings.xml new file mode 100644 index 0000000000..50ac352ff3 --- /dev/null +++ b/danar/src/main/res/values-ru-rRU/strings.xml @@ -0,0 +1,4 @@ + + + Неподдерживаемое действие в помпе. Пользуйтесь только интерфейсом AndroidAPS! + diff --git a/danar/src/main/res/values-sk-rSK/strings.xml b/danar/src/main/res/values-sk-rSK/strings.xml new file mode 100644 index 0000000000..8fe7511096 --- /dev/null +++ b/danar/src/main/res/values-sk-rSK/strings.xml @@ -0,0 +1,4 @@ + + + Nepodporovaná akcia v pumpe. Používajte iba užívateľské rozhranie AndroidAPS! + diff --git a/danar/src/main/res/values-sv-rSE/strings.xml b/danar/src/main/res/values-sv-rSE/strings.xml new file mode 100644 index 0000000000..3ea04e700d --- /dev/null +++ b/danar/src/main/res/values-sv-rSE/strings.xml @@ -0,0 +1,2 @@ + + diff --git a/danar/src/main/res/values-tr-rTR/strings.xml b/danar/src/main/res/values-tr-rTR/strings.xml new file mode 100644 index 0000000000..733236e044 --- /dev/null +++ b/danar/src/main/res/values-tr-rTR/strings.xml @@ -0,0 +1,4 @@ + + + Pompada desteklenmeyen eylem. Yalnızca AndroidAPS kullanıcı arayüzünü kullanın! + diff --git a/danar/src/main/res/values-zh-rCN/strings.xml b/danar/src/main/res/values-zh-rCN/strings.xml new file mode 100644 index 0000000000..3ea04e700d --- /dev/null +++ b/danar/src/main/res/values-zh-rCN/strings.xml @@ -0,0 +1,2 @@ + + diff --git a/pump-common/src/main/res/values-af-rZA/strings.xml b/pump-common/src/main/res/values-af-rZA/strings.xml new file mode 100644 index 0000000000..55baa3f071 --- /dev/null +++ b/pump-common/src/main/res/values-af-rZA/strings.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/pump-common/src/main/res/values-bg-rBG/strings.xml b/pump-common/src/main/res/values-bg-rBG/strings.xml new file mode 100644 index 0000000000..55baa3f071 --- /dev/null +++ b/pump-common/src/main/res/values-bg-rBG/strings.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/pump-common/src/main/res/values-ca-rES/strings.xml b/pump-common/src/main/res/values-ca-rES/strings.xml new file mode 100644 index 0000000000..55baa3f071 --- /dev/null +++ b/pump-common/src/main/res/values-ca-rES/strings.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/pump-common/src/main/res/values-cs-rCZ/strings.xml b/pump-common/src/main/res/values-cs-rCZ/strings.xml new file mode 100644 index 0000000000..a61e7b356c --- /dev/null +++ b/pump-common/src/main/res/values-cs-rCZ/strings.xml @@ -0,0 +1,27 @@ + + + + Operace není podporována pumpou a/nebo ovladačem. + Operace prozatím pumpou nepodporována. + OK + + Nikdy nekontaktováno + Probouzení + Chyba komunikace + Vypršel časový limit komunikace + Pumpa nedostupná + Neplatná konfigurace + Aktivní + Spící + + Bazály + Konfigurace + Oznámení + Statistika + Neznámé + Vše + Bolusy + Doplňování + Alarmy + Glykémie + diff --git a/pump-common/src/main/res/values-da-rDK/strings.xml b/pump-common/src/main/res/values-da-rDK/strings.xml new file mode 100644 index 0000000000..55baa3f071 --- /dev/null +++ b/pump-common/src/main/res/values-da-rDK/strings.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/pump-common/src/main/res/values-de-rDE/strings.xml b/pump-common/src/main/res/values-de-rDE/strings.xml new file mode 100644 index 0000000000..55baa3f071 --- /dev/null +++ b/pump-common/src/main/res/values-de-rDE/strings.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/pump-common/src/main/res/values-el-rGR/strings.xml b/pump-common/src/main/res/values-el-rGR/strings.xml new file mode 100644 index 0000000000..55baa3f071 --- /dev/null +++ b/pump-common/src/main/res/values-el-rGR/strings.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/pump-common/src/main/res/values-es-rES/strings.xml b/pump-common/src/main/res/values-es-rES/strings.xml new file mode 100644 index 0000000000..2dedba62c8 --- /dev/null +++ b/pump-common/src/main/res/values-es-rES/strings.xml @@ -0,0 +1,22 @@ + + + + Operación no soportada por la bomba y/o por el controlador. + Operación no soportada todavía por la bomba. + + Nunca contactado + Error con la comunicación + Tiempo de espera en la comunicación + Bomba no alcanzable + Configuración inválida + Activo + + Basales + Notificaciones + Estadísticas + Todo + Bolos + Cebado + Alarmas + Glucosa + diff --git a/pump-common/src/main/res/values-fr-rFR/strings.xml b/pump-common/src/main/res/values-fr-rFR/strings.xml new file mode 100644 index 0000000000..6d050ec761 --- /dev/null +++ b/pump-common/src/main/res/values-fr-rFR/strings.xml @@ -0,0 +1,27 @@ + + + + Opération non prise en charge par la pompe et/ou le pilote. + Opération PAS ENCORE supportée par la pompe. + OK + + Jamais contacté + Réveil en cours + Erreur de communication + Expiration du délai d\'attente de la communication + Pompe hors de portée + Configuration invalide + Actif + En veille + + Basales + Configurations + Notifications + Statistiques + Inconnus + Tous + Bolus + Amorcer + Alarmes + Glycémie + diff --git a/pump-common/src/main/res/values-ga-rIE/strings.xml b/pump-common/src/main/res/values-ga-rIE/strings.xml new file mode 100644 index 0000000000..55baa3f071 --- /dev/null +++ b/pump-common/src/main/res/values-ga-rIE/strings.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/pump-common/src/main/res/values-hr-rHR/strings.xml b/pump-common/src/main/res/values-hr-rHR/strings.xml new file mode 100644 index 0000000000..55baa3f071 --- /dev/null +++ b/pump-common/src/main/res/values-hr-rHR/strings.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/pump-common/src/main/res/values-hu-rHU/strings.xml b/pump-common/src/main/res/values-hu-rHU/strings.xml new file mode 100644 index 0000000000..55baa3f071 --- /dev/null +++ b/pump-common/src/main/res/values-hu-rHU/strings.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/pump-common/src/main/res/values-it-rIT/strings.xml b/pump-common/src/main/res/values-it-rIT/strings.xml new file mode 100644 index 0000000000..55baa3f071 --- /dev/null +++ b/pump-common/src/main/res/values-it-rIT/strings.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/pump-common/src/main/res/values-iw-rIL/strings.xml b/pump-common/src/main/res/values-iw-rIL/strings.xml new file mode 100644 index 0000000000..2e156137a1 --- /dev/null +++ b/pump-common/src/main/res/values-iw-rIL/strings.xml @@ -0,0 +1,27 @@ + + + + הפעולה לא נתמכת ע\"י המשאבה ו\\או מנהל ההתקן. + הפעולה עוד לא נתמכת על ידי המשאבה. + אישור + + מעולם לא נוצר קשר + מתעורר + שגיאת תקשורת + חריגה ממגבלת הזמן לתקשורת + המשאבה לא זמינה + תצורה לא חוקית + פעיל + שינה + + בזאלים + תצורות + התראות + סטטיסטיקה + לא ידועים + הכול + בולוסים + תיחול + התראות + גלוקוז + diff --git a/pump-common/src/main/res/values-ko-rKR/strings.xml b/pump-common/src/main/res/values-ko-rKR/strings.xml new file mode 100644 index 0000000000..55baa3f071 --- /dev/null +++ b/pump-common/src/main/res/values-ko-rKR/strings.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/pump-common/src/main/res/values-lt-rLT/strings.xml b/pump-common/src/main/res/values-lt-rLT/strings.xml new file mode 100644 index 0000000000..55baa3f071 --- /dev/null +++ b/pump-common/src/main/res/values-lt-rLT/strings.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/pump-common/src/main/res/values-nl-rNL/strings.xml b/pump-common/src/main/res/values-nl-rNL/strings.xml new file mode 100644 index 0000000000..55baa3f071 --- /dev/null +++ b/pump-common/src/main/res/values-nl-rNL/strings.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/pump-common/src/main/res/values-no-rNO/strings.xml b/pump-common/src/main/res/values-no-rNO/strings.xml new file mode 100644 index 0000000000..e4c5f1ab5b --- /dev/null +++ b/pump-common/src/main/res/values-no-rNO/strings.xml @@ -0,0 +1,27 @@ + + + + Operasjonen støttes ikke av pumpen og/eller driveren. + Operasjonen støttes ikke av pumpen ennå. + OK + + Aldri kontaktet + Våkner opp + Feil med kommunikasjonen + Tidsavbrudd ved kommunikasjonen + Pumpe er utilgjengelig + Ugyldig oppsett av pumpe + Aktiv + Hvilemodus + + Basaldoser + Konfigurasjoner + Varsler + Statistikker + Ukjente + Alle + Boluser + Prime + Alarmer + Blodsukker + diff --git a/pump-common/src/main/res/values-pl-rPL/strings.xml b/pump-common/src/main/res/values-pl-rPL/strings.xml new file mode 100644 index 0000000000..55baa3f071 --- /dev/null +++ b/pump-common/src/main/res/values-pl-rPL/strings.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/pump-common/src/main/res/values-pt-rBR/strings.xml b/pump-common/src/main/res/values-pt-rBR/strings.xml new file mode 100644 index 0000000000..55baa3f071 --- /dev/null +++ b/pump-common/src/main/res/values-pt-rBR/strings.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/pump-common/src/main/res/values-pt-rPT/strings.xml b/pump-common/src/main/res/values-pt-rPT/strings.xml new file mode 100644 index 0000000000..55baa3f071 --- /dev/null +++ b/pump-common/src/main/res/values-pt-rPT/strings.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/pump-common/src/main/res/values-ro-rRO/strings.xml b/pump-common/src/main/res/values-ro-rRO/strings.xml new file mode 100644 index 0000000000..55baa3f071 --- /dev/null +++ b/pump-common/src/main/res/values-ro-rRO/strings.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/pump-common/src/main/res/values-ru-rRU/strings.xml b/pump-common/src/main/res/values-ru-rRU/strings.xml new file mode 100644 index 0000000000..6eee027b2a --- /dev/null +++ b/pump-common/src/main/res/values-ru-rRU/strings.xml @@ -0,0 +1,27 @@ + + + + Операция не поддерживается помпой и/или драйвером. + Операция ЕЩЕ не поддерживается помпой. + OK + + Никогда не подключалась + Пробуждение + Ошибка связи + Таймаут связи + Помпа недоступна + Недопустимая конфигурация + Работает + Спящий режим + + Базалы + Конфигурации + Уведомления + Статистика + Неизвестные + Все + Болюсы + Заполнение + Оповещения + Гликемия + diff --git a/pump-common/src/main/res/values-sk-rSK/strings.xml b/pump-common/src/main/res/values-sk-rSK/strings.xml new file mode 100644 index 0000000000..cacd5482e8 --- /dev/null +++ b/pump-common/src/main/res/values-sk-rSK/strings.xml @@ -0,0 +1,27 @@ + + + + Operácia nepodporovaná pumpou a/alebo ovládačom. + Operácia zatiaľ nepodporovaná pumpou. + OK + + Nikdy nepripojené + Prebúdzanie + Chyba komunikácie + Uplynul časový limit komunikácie + Pumpa nedostupná + Neplatná konfigurácia + Aktívna + Spiaca + + Bazály + Konfigurácie + Notifikácie + Štatistiky + Neznáme + Všetko + Bolusy + Plnenie + Alarmy + Glykémia + diff --git a/pump-common/src/main/res/values-sv-rSE/strings.xml b/pump-common/src/main/res/values-sv-rSE/strings.xml new file mode 100644 index 0000000000..55baa3f071 --- /dev/null +++ b/pump-common/src/main/res/values-sv-rSE/strings.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/pump-common/src/main/res/values-tr-rTR/strings.xml b/pump-common/src/main/res/values-tr-rTR/strings.xml new file mode 100644 index 0000000000..8b2fb96986 --- /dev/null +++ b/pump-common/src/main/res/values-tr-rTR/strings.xml @@ -0,0 +1,27 @@ + + + + Pompa ve/veya sürücü tarafından desteklenmeyen işlem. + İşlem HENÜZ pompa tarafından desteklenmiyor. + Tamam + + Hiç bağlantı yapılmadı + Uyanıyor + İletişim hatası + İletişimde zaman aşımı + Pompa ulaşılamıyor + Geçersiz yapılandırma + Aktif + Uyuyor + + Bazallar + Konfigürasyon + Bildirimler + İstatistikler + Bilinmeyenler + Tümü + Boluslar + Dolumlar + Alarmlar + Glikoz + diff --git a/pump-common/src/main/res/values-zh-rCN/strings.xml b/pump-common/src/main/res/values-zh-rCN/strings.xml new file mode 100644 index 0000000000..55baa3f071 --- /dev/null +++ b/pump-common/src/main/res/values-zh-rCN/strings.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/wear/src/main/res/values-sk-rSK/strings.xml b/wear/src/main/res/values-sk-rSK/strings.xml index 08dde6af7b..49db0a922f 100644 --- a/wear/src/main/res/values-sk-rSK/strings.xml +++ b/wear/src/main/res/values-sk-rSK/strings.xml @@ -176,6 +176,7 @@ --JI --g -.--JI/h + Uploader: ---% S: žiadny stav Pred -- minútami --- mg/dl From 7ba4c19298db1a48c5e4adcf82d24fdd502e91d1 Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Fri, 17 Jun 2022 12:47:40 +0200 Subject: [PATCH 07/44] sync BolusCalculatorResult in full mode --- .../nsclient/NSClientAddUpdateWorker.kt | 158 ++++++++++-------- 1 file changed, 92 insertions(+), 66 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/NSClientAddUpdateWorker.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/NSClientAddUpdateWorker.kt index 5707cd439c..5abed9f9f2 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/NSClientAddUpdateWorker.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/NSClientAddUpdateWorker.kt @@ -85,14 +85,16 @@ class NSClientAddUpdateWorker( .blockingGet() .also { result -> result.inserted.forEach { - uel.log(Action.BOLUS, Sources.NSClient, + uel.log( + Action.BOLUS, Sources.NSClient, ValueWithUnit.Timestamp(it.timestamp), ValueWithUnit.Insulin(it.amount) ) aapsLogger.debug(LTag.DATABASE, "Inserted bolus $it") } result.invalidated.forEach { - uel.log(Action.BOLUS_REMOVED, Sources.NSClient, + uel.log( + Action.BOLUS_REMOVED, Sources.NSClient, ValueWithUnit.Timestamp(it.timestamp), ValueWithUnit.Insulin(it.amount) ) @@ -119,21 +121,24 @@ class NSClientAddUpdateWorker( .blockingGet() .also { result -> result.inserted.forEach { - uel.log(Action.CARBS, Sources.NSClient, + uel.log( + Action.CARBS, Sources.NSClient, ValueWithUnit.Timestamp(it.timestamp), ValueWithUnit.Gram(it.amount.toInt()) ) aapsLogger.debug(LTag.DATABASE, "Inserted carbs $it") } result.invalidated.forEach { - uel.log(Action.CARBS_REMOVED, Sources.NSClient, + uel.log( + Action.CARBS_REMOVED, Sources.NSClient, ValueWithUnit.Timestamp(it.timestamp), ValueWithUnit.Gram(it.amount.toInt()) ) aapsLogger.debug(LTag.DATABASE, "Invalidated carbs $it") } result.updated.forEach { - uel.log(Action.CARBS, Sources.NSClient, + uel.log( + Action.CARBS, Sources.NSClient, ValueWithUnit.Timestamp(it.timestamp), ValueWithUnit.Gram(it.amount.toInt()) ) @@ -157,8 +162,8 @@ class NSClientAddUpdateWorker( virtualPumpPlugin.fakeDataDetected = true } when { - insulin > 0 || carbs > 0 -> Any() - eventType == TherapyEvent.Type.TEMPORARY_TARGET.text -> + insulin > 0 || carbs > 0 -> Any() + eventType == TherapyEvent.Type.TEMPORARY_TARGET.text -> if (sp.getBoolean(R.string.key_ns_receive_temp_target, false) || config.NSCLIENT) { temporaryTargetFromJson(json)?.let { temporaryTarget -> repository.runTransactionForResult(SyncNsTemporaryTargetTransaction(temporaryTarget)) @@ -169,7 +174,8 @@ class NSClientAddUpdateWorker( .blockingGet() .also { result -> result.inserted.forEach { tt -> - uel.log(Action.TT, Sources.NSClient, + uel.log( + Action.TT, Sources.NSClient, ValueWithUnit.TherapyEventTTReason(tt.reason), ValueWithUnit.fromGlucoseUnit(tt.lowTarget, Constants.MGDL), ValueWithUnit.fromGlucoseUnit(tt.highTarget, Constants.MGDL).takeIf { tt.lowTarget != tt.highTarget }, @@ -178,7 +184,8 @@ class NSClientAddUpdateWorker( aapsLogger.debug(LTag.DATABASE, "Inserted TemporaryTarget $tt") } result.invalidated.forEach { tt -> - uel.log(Action.TT_REMOVED, Sources.NSClient, + uel.log( + Action.TT_REMOVED, Sources.NSClient, ValueWithUnit.TherapyEventTTReason(tt.reason), ValueWithUnit.Mgdl(tt.lowTarget), ValueWithUnit.Mgdl(tt.highTarget).takeIf { tt.lowTarget != tt.highTarget }, @@ -187,7 +194,8 @@ class NSClientAddUpdateWorker( aapsLogger.debug(LTag.DATABASE, "Invalidated TemporaryTarget $tt") } result.ended.forEach { tt -> - uel.log(Action.CANCEL_TT, Sources.NSClient, + uel.log( + Action.CANCEL_TT, Sources.NSClient, ValueWithUnit.TherapyEventTTReason(tt.reason), ValueWithUnit.Mgdl(tt.lowTarget), ValueWithUnit.Mgdl(tt.highTarget).takeIf { tt.lowTarget != tt.highTarget }, @@ -204,7 +212,7 @@ class NSClientAddUpdateWorker( } } ?: aapsLogger.error("Error parsing TT json $json") } - eventType == TherapyEvent.Type.NOTE.text && json.isEffectiveProfileSwitch() -> // replace this by new Type when available in NS + eventType == TherapyEvent.Type.NOTE.text && json.isEffectiveProfileSwitch() -> // replace this by new Type when available in NS if (sp.getBoolean(R.string.key_ns_receive_profile_switch, false) || config.NSCLIENT) { effectiveProfileSwitchFromJson(json, dateUtil)?.let { effectiveProfileSwitch -> repository.runTransactionForResult(SyncNsEffectiveProfileSwitchTransaction(effectiveProfileSwitch)) @@ -215,13 +223,17 @@ class NSClientAddUpdateWorker( .blockingGet() .also { result -> result.inserted.forEach { - uel.log(Action.PROFILE_SWITCH, Sources.NSClient, - ValueWithUnit.Timestamp(it.timestamp)) + uel.log( + Action.PROFILE_SWITCH, Sources.NSClient, + ValueWithUnit.Timestamp(it.timestamp) + ) aapsLogger.debug(LTag.DATABASE, "Inserted EffectiveProfileSwitch $it") } result.invalidated.forEach { - uel.log(Action.PROFILE_SWITCH_REMOVED, Sources.NSClient, - ValueWithUnit.Timestamp(it.timestamp)) + uel.log( + Action.PROFILE_SWITCH_REMOVED, Sources.NSClient, + ValueWithUnit.Timestamp(it.timestamp) + ) aapsLogger.debug(LTag.DATABASE, "Invalidated EffectiveProfileSwitch $it") } result.updatedNsId.forEach { @@ -230,34 +242,34 @@ class NSClientAddUpdateWorker( } } ?: aapsLogger.error("Error parsing EffectiveProfileSwitch json $json") } - eventType == TherapyEvent.Type.BOLUS_WIZARD.text -> - if (config.NSCLIENT) { - bolusCalculatorResultFromJson(json)?.let { bolusCalculatorResult -> - repository.runTransactionForResult(SyncNsBolusCalculatorResultTransaction(bolusCalculatorResult)) - .doOnError { - aapsLogger.error(LTag.DATABASE, "Error while saving BolusCalculatorResult", it) - ret = Result.failure(workDataOf("Error" to it.toString())) + eventType == TherapyEvent.Type.BOLUS_WIZARD.text -> + bolusCalculatorResultFromJson(json)?.let { bolusCalculatorResult -> + repository.runTransactionForResult(SyncNsBolusCalculatorResultTransaction(bolusCalculatorResult)) + .doOnError { + aapsLogger.error(LTag.DATABASE, "Error while saving BolusCalculatorResult", it) + ret = Result.failure(workDataOf("Error" to it.toString())) + } + .blockingGet() + .also { result -> + result.inserted.forEach { + uel.log( + Action.BOLUS_CALCULATOR_RESULT, Sources.NSClient, + ValueWithUnit.Timestamp(it.timestamp), + ) + aapsLogger.debug(LTag.DATABASE, "Inserted BolusCalculatorResult $it") } - .blockingGet() - .also { result -> - result.inserted.forEach { - uel.log(Action.BOLUS_CALCULATOR_RESULT, Sources.NSClient, - ValueWithUnit.Timestamp(it.timestamp), - ) - aapsLogger.debug(LTag.DATABASE, "Inserted BolusCalculatorResult $it") - } - result.invalidated.forEach { - uel.log(Action.BOLUS_CALCULATOR_RESULT_REMOVED, Sources.NSClient, - ValueWithUnit.Timestamp(it.timestamp), - ) - aapsLogger.debug(LTag.DATABASE, "Invalidated BolusCalculatorResult $it") - } - result.updatedNsId.forEach { - aapsLogger.debug(LTag.DATABASE, "Updated nsId BolusCalculatorResult $it") - } + result.invalidated.forEach { + uel.log( + Action.BOLUS_CALCULATOR_RESULT_REMOVED, Sources.NSClient, + ValueWithUnit.Timestamp(it.timestamp), + ) + aapsLogger.debug(LTag.DATABASE, "Invalidated BolusCalculatorResult $it") } - } ?: aapsLogger.error("Error parsing BolusCalculatorResult json $json") - } + result.updatedNsId.forEach { + aapsLogger.debug(LTag.DATABASE, "Updated nsId BolusCalculatorResult $it") + } + } + } ?: aapsLogger.error("Error parsing BolusCalculatorResult json $json") eventType == TherapyEvent.Type.CANNULA_CHANGE.text || eventType == TherapyEvent.Type.INSULIN_CHANGE.text || eventType == TherapyEvent.Type.SENSOR_CHANGE.text || @@ -267,7 +279,7 @@ class NSClientAddUpdateWorker( eventType == TherapyEvent.Type.QUESTION.text || eventType == TherapyEvent.Type.EXERCISE.text || eventType == TherapyEvent.Type.NOTE.text || - eventType == TherapyEvent.Type.PUMP_BATTERY_CHANGE.text -> + eventType == TherapyEvent.Type.PUMP_BATTERY_CHANGE.text -> if (sp.getBoolean(R.string.key_ns_receive_therapy_events, false) || config.NSCLIENT) { therapyEventFromJson(json)?.let { therapyEvent -> repository.runTransactionForResult(SyncNsTherapyEventTransaction(therapyEvent)) @@ -285,18 +297,18 @@ class NSClientAddUpdateWorker( result.inserted.forEach { therapyEvent -> uel.log(action, Sources.NSClient, therapyEvent.note ?: "", - ValueWithUnit.Timestamp(therapyEvent.timestamp), - ValueWithUnit.TherapyEventType(therapyEvent.type), - ValueWithUnit.fromGlucoseUnit(therapyEvent.glucose ?:0.0,therapyEvent.glucoseUnit.toString).takeIf { therapyEvent.glucose != null } + ValueWithUnit.Timestamp(therapyEvent.timestamp), + ValueWithUnit.TherapyEventType(therapyEvent.type), + ValueWithUnit.fromGlucoseUnit(therapyEvent.glucose ?: 0.0, therapyEvent.glucoseUnit.toString).takeIf { therapyEvent.glucose != null } ) aapsLogger.debug(LTag.DATABASE, "Inserted TherapyEvent $therapyEvent") } result.invalidated.forEach { therapyEvent -> uel.log(Action.CAREPORTAL_REMOVED, Sources.NSClient, therapyEvent.note ?: "", - ValueWithUnit.Timestamp(therapyEvent.timestamp), - ValueWithUnit.TherapyEventType(therapyEvent.type), - ValueWithUnit.fromGlucoseUnit(therapyEvent.glucose ?:0.0, therapyEvent.glucoseUnit.toString).takeIf { therapyEvent.glucose != null } + ValueWithUnit.Timestamp(therapyEvent.timestamp), + ValueWithUnit.TherapyEventType(therapyEvent.type), + ValueWithUnit.fromGlucoseUnit(therapyEvent.glucose ?: 0.0, therapyEvent.glucoseUnit.toString).takeIf { therapyEvent.glucose != null } ) aapsLogger.debug(LTag.DATABASE, "Invalidated TherapyEvent $therapyEvent") } @@ -309,7 +321,7 @@ class NSClientAddUpdateWorker( } } ?: aapsLogger.error("Error parsing TherapyEvent json $json") } - eventType == TherapyEvent.Type.COMBO_BOLUS.text -> + eventType == TherapyEvent.Type.COMBO_BOLUS.text -> if (buildHelper.isEngineeringMode() && sp.getBoolean(R.string.key_ns_receive_tbr_eb, false) || config.NSCLIENT) { extendedBolusFromJson(json)?.let { extendedBolus -> repository.runTransactionForResult(SyncNsExtendedBolusTransaction(extendedBolus)) @@ -320,7 +332,8 @@ class NSClientAddUpdateWorker( .blockingGet() .also { result -> result.inserted.forEach { - uel.log(Action.EXTENDED_BOLUS, Sources.NSClient, + uel.log( + Action.EXTENDED_BOLUS, Sources.NSClient, ValueWithUnit.Timestamp(it.timestamp), ValueWithUnit.Insulin(it.amount), ValueWithUnit.UnitPerHour(it.rate), @@ -329,7 +342,8 @@ class NSClientAddUpdateWorker( aapsLogger.debug(LTag.DATABASE, "Inserted ExtendedBolus $it") } result.invalidated.forEach { - uel.log(Action.EXTENDED_BOLUS_REMOVED, Sources.NSClient, + uel.log( + Action.EXTENDED_BOLUS_REMOVED, Sources.NSClient, ValueWithUnit.Timestamp(it.timestamp), ValueWithUnit.Insulin(it.amount), ValueWithUnit.UnitPerHour(it.rate), @@ -338,7 +352,8 @@ class NSClientAddUpdateWorker( aapsLogger.debug(LTag.DATABASE, "Invalidated ExtendedBolus $it") } result.ended.forEach { - uel.log(Action.CANCEL_EXTENDED_BOLUS, Sources.NSClient, + uel.log( + Action.CANCEL_EXTENDED_BOLUS, Sources.NSClient, ValueWithUnit.Timestamp(it.timestamp), ValueWithUnit.Insulin(it.amount), ValueWithUnit.UnitPerHour(it.rate), @@ -355,7 +370,7 @@ class NSClientAddUpdateWorker( } } ?: aapsLogger.error("Error parsing ExtendedBolus json $json") } - eventType == TherapyEvent.Type.TEMPORARY_BASAL.text -> + eventType == TherapyEvent.Type.TEMPORARY_BASAL.text -> if (buildHelper.isEngineeringMode() && sp.getBoolean(R.string.key_ns_receive_tbr_eb, false) || config.NSCLIENT) { temporaryBasalFromJson(json)?.let { temporaryBasal -> repository.runTransactionForResult(SyncNsTemporaryBasalTransaction(temporaryBasal)) @@ -366,7 +381,8 @@ class NSClientAddUpdateWorker( .blockingGet() .also { result -> result.inserted.forEach { - uel.log(Action.TEMP_BASAL, Sources.NSClient, + uel.log( + Action.TEMP_BASAL, Sources.NSClient, ValueWithUnit.Timestamp(it.timestamp), if (it.isAbsolute) ValueWithUnit.UnitPerHour(it.rate) else ValueWithUnit.Percent(it.rate.toInt()), ValueWithUnit.Minute(TimeUnit.MILLISECONDS.toMinutes(it.duration).toInt()) @@ -374,7 +390,8 @@ class NSClientAddUpdateWorker( aapsLogger.debug(LTag.DATABASE, "Inserted TemporaryBasal $it") } result.invalidated.forEach { - uel.log(Action.TEMP_BASAL_REMOVED, Sources.NSClient, + uel.log( + Action.TEMP_BASAL_REMOVED, Sources.NSClient, ValueWithUnit.Timestamp(it.timestamp), if (it.isAbsolute) ValueWithUnit.UnitPerHour(it.rate) else ValueWithUnit.Percent(it.rate.toInt()), ValueWithUnit.Minute(TimeUnit.MILLISECONDS.toMinutes(it.duration).toInt()) @@ -382,7 +399,8 @@ class NSClientAddUpdateWorker( aapsLogger.debug(LTag.DATABASE, "Invalidated TemporaryBasal $it") } result.ended.forEach { - uel.log(Action.CANCEL_TEMP_BASAL, Sources.NSClient, + uel.log( + Action.CANCEL_TEMP_BASAL, Sources.NSClient, ValueWithUnit.Timestamp(it.timestamp), if (it.isAbsolute) ValueWithUnit.UnitPerHour(it.rate) else ValueWithUnit.Percent(it.rate.toInt()), ValueWithUnit.Minute(TimeUnit.MILLISECONDS.toMinutes(it.duration).toInt()) @@ -398,7 +416,7 @@ class NSClientAddUpdateWorker( } } ?: aapsLogger.error("Error parsing TemporaryBasal json $json") } - eventType == TherapyEvent.Type.PROFILE_SWITCH.text -> + eventType == TherapyEvent.Type.PROFILE_SWITCH.text -> if (sp.getBoolean(R.string.key_ns_receive_profile_switch, false) || config.NSCLIENT) { profileSwitchFromJson(json, dateUtil, activePlugin)?.let { profileSwitch -> repository.runTransactionForResult(SyncNsProfileSwitchTransaction(profileSwitch)) @@ -409,13 +427,17 @@ class NSClientAddUpdateWorker( .blockingGet() .also { result -> result.inserted.forEach { - uel.log(Action.PROFILE_SWITCH, Sources.NSClient, - ValueWithUnit.Timestamp(it.timestamp)) + uel.log( + Action.PROFILE_SWITCH, Sources.NSClient, + ValueWithUnit.Timestamp(it.timestamp) + ) aapsLogger.debug(LTag.DATABASE, "Inserted ProfileSwitch $it") } result.invalidated.forEach { - uel.log(Action.PROFILE_SWITCH_REMOVED, Sources.NSClient, - ValueWithUnit.Timestamp(it.timestamp)) + uel.log( + Action.PROFILE_SWITCH_REMOVED, Sources.NSClient, + ValueWithUnit.Timestamp(it.timestamp) + ) aapsLogger.debug(LTag.DATABASE, "Invalidated ProfileSwitch $it") } result.updatedNsId.forEach { @@ -424,7 +446,7 @@ class NSClientAddUpdateWorker( } } ?: aapsLogger.error("Error parsing ProfileSwitch json $json") } - eventType == TherapyEvent.Type.APS_OFFLINE.text -> + eventType == TherapyEvent.Type.APS_OFFLINE.text -> if (sp.getBoolean(R.string.key_ns_receive_offline_event, false) && buildHelper.isEngineeringMode() || config.NSCLIENT) { offlineEventFromJson(json)?.let { offlineEvent -> repository.runTransactionForResult(SyncNsOfflineEventTransaction(offlineEvent)) @@ -435,21 +457,24 @@ class NSClientAddUpdateWorker( .blockingGet() .also { result -> result.inserted.forEach { oe -> - uel.log(Action.LOOP_CHANGE, Sources.NSClient, + uel.log( + Action.LOOP_CHANGE, Sources.NSClient, ValueWithUnit.OfflineEventReason(oe.reason), ValueWithUnit.Minute(TimeUnit.MILLISECONDS.toMinutes(oe.duration).toInt()) ) aapsLogger.debug(LTag.DATABASE, "Inserted OfflineEvent $oe") } result.invalidated.forEach { oe -> - uel.log(Action.LOOP_REMOVED, Sources.NSClient, + uel.log( + Action.LOOP_REMOVED, Sources.NSClient, ValueWithUnit.OfflineEventReason(oe.reason), ValueWithUnit.Minute(TimeUnit.MILLISECONDS.toMinutes(oe.duration).toInt()) ) aapsLogger.debug(LTag.DATABASE, "Invalidated OfflineEvent $oe") } result.ended.forEach { oe -> - uel.log(Action.LOOP_CHANGE, Sources.NSClient, + uel.log( + Action.LOOP_CHANGE, Sources.NSClient, ValueWithUnit.OfflineEventReason(oe.reason), ValueWithUnit.Minute(TimeUnit.MILLISECONDS.toMinutes(oe.duration).toInt()) ) @@ -472,7 +497,8 @@ class NSClientAddUpdateWorker( val enteredBy = JsonHelper.safeGetString(json, "enteredBy", "") val notes = JsonHelper.safeGetString(json, "notes", "") if (date > now - 15 * 60 * 1000L && notes.isNotEmpty() - && enteredBy != sp.getString("careportal_enteredby", "AndroidAPS")) { + && enteredBy != sp.getString("careportal_enteredby", "AndroidAPS") + ) { val defaultVal = config.NSCLIENT if (sp.getBoolean(R.string.key_ns_announcements, defaultVal)) { val announcement = Notification(Notification.NS_ANNOUNCEMENT, notes, Notification.ANNOUNCEMENT, 60) From 1eb7cd69d926716943458371224e02d7479ca054 Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Fri, 17 Jun 2022 12:53:22 +0200 Subject: [PATCH 08/44] remove unused strings --- app/src/main/res/values/strings.xml | 3 --- 1 file changed, 3 deletions(-) diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index e34436ac85..269dd9a883 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -164,9 +164,6 @@ Closed Loop Open Loop Low Glucose Suspend - Humalog/Novolog - Fiasp - Lyumjev Loop Disabled New suggestion available Carbs Suggestion From bf889793f0de9dcd91a028a013f91dba20bbf4e8 Mon Sep 17 00:00:00 2001 From: Andrei Vereha Date: Fri, 17 Jun 2022 17:58:21 +0200 Subject: [PATCH 09/44] make it compile --- .../pump/omnipod/dash/driver/comm/ServiceDiscoverer.kt | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/comm/ServiceDiscoverer.kt b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/comm/ServiceDiscoverer.kt index cd35a45bdb..ca371fafac 100644 --- a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/comm/ServiceDiscoverer.kt +++ b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/comm/ServiceDiscoverer.kt @@ -27,9 +27,13 @@ class ServiceDiscoverer( fun discoverServices(connectionWaitCond: ConnectionWaitCondition): Map { logger.debug(LTag.PUMPBTCOMM, "Discovering services") bleCallbacks.startServiceDiscovery() - val discover = gatt.discoverServices() - if (!discover) { - throw ConnectException("Could not start discovering services`") + try { + val discover = gatt.discoverServices() + if (!discover) { + throw ConnectException("Could not start discovering services`") + } + } catch (ex: SecurityException) { + throw ConnectException("Missing bluetooth permission") } connectionWaitCond.timeoutMs?.let { bleCallbacks.waitForServiceDiscovery(it) From 4c690eefd6d0bd3259b89544f8ab0f7862976f07 Mon Sep 17 00:00:00 2001 From: Andrei Vereha Date: Sun, 19 Jun 2022 19:00:19 +0200 Subject: [PATCH 10/44] fix discard pod --- .../pump/omnipod/dash/driver/comm/session/Connection.kt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/comm/session/Connection.kt b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/comm/session/Connection.kt index b403cb7af2..bfb565830c 100644 --- a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/comm/session/Connection.kt +++ b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/comm/session/Connection.kt @@ -6,6 +6,7 @@ import android.bluetooth.BluetoothManager import android.bluetooth.BluetoothProfile import android.content.Context import android.os.SystemClock +import info.nightscout.androidaps.Constants import info.nightscout.androidaps.extensions.toHex import info.nightscout.androidaps.plugins.pump.omnipod.dash.BuildConfig import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.comm.Ids @@ -137,11 +138,16 @@ class Connection( connectionWaitCond.timeoutMs?.let { bleCommCallbacks.waitForConnection(it) } + val startWaiting = System.currentTimeMillis() connectionWaitCond.stopConnection?.let { while (!bleCommCallbacks.waitForConnection(STOP_CONNECTING_CHECK_INTERVAL_MS)) { if (it.count == 0L) { throw ConnectException("stopConnecting called") } + val secondsElapsed = (System.currentTimeMillis() - startWaiting) / 1000 + if (secondsElapsed > MAX_WAIT_FOR_CONNECTION_SECONDS) { + throw ConnectException("connection timeout") + } } } } catch (e: InterruptedException) { @@ -199,6 +205,7 @@ class Connection( const val BASE_CONNECT_TIMEOUT_MS = 10000L const val MIN_DISCOVERY_TIMEOUT_MS = 10000L const val STOP_CONNECTING_CHECK_INTERVAL_MS = 500L + const val MAX_WAIT_FOR_CONNECTION_SECONDS = Constants.PUMP_MAX_CONNECTION_TIME_IN_SECONDS + 10 const val SLEEP_WHEN_FAILING_TO_CONNECT_GATT = 10000L } } From dc0b6ac9f7ee1d37825e58df87ff64f976e72bfe Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Sun, 19 Jun 2022 22:29:25 +0200 Subject: [PATCH 11/44] New Crowdin updates (#1837) * Update source file strings.xml * New translations strings.xml (French) * New translations strings.xml (Czech) * Update source file strings.xml * New translations strings.xml (Turkish) * New translations strings.xml (Spanish) * New translations strings.xml (Czech) * New translations strings.xml (Spanish) * New translations strings.xml (Spanish) * New translations strings.xml (Turkish) --- app/src/main/res/values-cs-rCZ/strings.xml | 2 ++ app/src/main/res/values-es-rES/strings.xml | 2 ++ app/src/main/res/values-fr-rFR/strings.xml | 2 ++ app/src/main/res/values-tr-rTR/strings.xml | 3 ++- pump-common/src/main/res/values-es-rES/strings.xml | 5 +++++ 5 files changed, 13 insertions(+), 1 deletion(-) diff --git a/app/src/main/res/values-cs-rCZ/strings.xml b/app/src/main/res/values-cs-rCZ/strings.xml index bf56dddb8f..5fbe88be2f 100644 --- a/app/src/main/res/values-cs-rCZ/strings.xml +++ b/app/src/main/res/values-cs-rCZ/strings.xml @@ -6,6 +6,7 @@ Bezpečnost zadání ošetřeni Maximální povolený bolus [U] Maximální počet sacharidů [g] + Hodnota glykémie pro zastavení inzulínu Nastavení pluginu %1$s Nastavení Obnovit ošetření z NS @@ -592,6 +593,7 @@ 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 Maximální doba absorpce sacharidů [h] Doba, po které jsou všechny sacharidy považovány za strávené. Zbylé budou oříznuty. + Hodnota glykémie, při níž bude vydávání inzulinu zastaveno. Výchozí hodnota využívá standardní cílový model. Uživatel může nastavit hodnoty od 3,3 mmol/l do 5,5 mmol/l. Při hodnotách pod 3,6 mmol/l se použije výchozí model. Zobrazovat kolonku poznámky v dialozích ošetření Další Zpět diff --git a/app/src/main/res/values-es-rES/strings.xml b/app/src/main/res/values-es-rES/strings.xml index edbe12fdeb..0f21604eb6 100644 --- a/app/src/main/res/values-es-rES/strings.xml +++ b/app/src/main/res/values-es-rES/strings.xml @@ -6,6 +6,7 @@ Seguridad de tratamientos Máximo bolo permitido [U] Máximos carbohidratos permitidos [g] + Nivel de glucosa por debajo de valor LGS (Suspensión por glucosa baja) Preferencias de %1$s Preferencias Actualizar los tratamientos desde Nightscout @@ -592,6 +593,7 @@ Este valor se denomina \"Max IOB\", en el contexto de OpenAPS\nOpenAPS no podrá superar esta cantidad de insulina activa (IOB) Tiempo máximo de absorción de la comida [h] Tiempo en el que cualquier comida se considera absorbida. Los carbohidratos restantes serán cortados. + Valor de glucosa por debajo del cual se suspende la administración de insulina. El valor predeterminado utiliza el modelo de objetivo estándar. El usuario puede establecer un valor entre 60mg/dl (3. mmol/l) y 100mg/dl (5.5mmol/l). Valores por debajo de 65/3.6 usan el modelo predeterminado Mostrar el campo notas en diálogos de tratamientos Siguiente Anterior diff --git a/app/src/main/res/values-fr-rFR/strings.xml b/app/src/main/res/values-fr-rFR/strings.xml index 9e0ec5ebc8..e160225133 100644 --- a/app/src/main/res/values-fr-rFR/strings.xml +++ b/app/src/main/res/values-fr-rFR/strings.xml @@ -6,6 +6,7 @@ Traitements de sécurité Maximum Bolus autorisé [U] Maximum de Glucides autorisé [g] + Glycémie au-dessous de laquelle se déclenche l\'Arrêt Glycémie Basse Préférences de %1$s Préférences Actualiser les données depuis NS @@ -593,6 +594,7 @@ L\'ENSEMBLE DES RISQUES LIÉS À LA QUALITÉ ET À LA PERFORMANCE DU PROGRAMME S Cette valeur est appelée Max IA (Insuline Active) dans le contaxte OpenAPS\nOpenAPS n’ajoutera pas plus d’insuline si l\'IA (Insuline Active) actuelle est supérieure à cette valeur Durée maximale d’absorption pour un repas [h] Durée où n’importe quel repas est considéré absorbé. Les glucides restants ne seront pas pris en compte. + Valeur glycémique au-dessous de laquelle l\'injection de l\'insuline est suspendu. La valeur par défaut utilise le modèle standard de la cible. L\'utilisateur peut choisir entre 60mg/dl (3.3mmol/l) et 100mg/dl (5.5mmol/l). Les valeurs au-dessous de 65/3.6 déclenchent l\'utilisation du modèle standard Affiche les notes dans les dialogues Suivant Préc diff --git a/app/src/main/res/values-tr-rTR/strings.xml b/app/src/main/res/values-tr-rTR/strings.xml index 510535d53d..f0383b2d42 100644 --- a/app/src/main/res/values-tr-rTR/strings.xml +++ b/app/src/main/res/values-tr-rTR/strings.xml @@ -283,7 +283,7 @@ Varsayılan değer: 0.7\nBu otoduyarlılık için diğer güvenlik önlemidir. Otoduyarlılığın bazal oranlarını ne kadar düşürebileceğini ve İnsülin Duyarlılık Faktörü ve KŞ hedeflerini ne kadar yüksek tutabileceğini gösterir. Otoduyarlılık, hedefleri de ayarlar Varsayılan değer: true\nBu otoduyarlılığın İnsülin Duyarlılık Faktörü ve bazallara ek olarak KŞ hedeflerinin ayarlanmasında kullanılır. - Varsayılan değer: 2\nYemek bolusu yaptıktan sonra bolus erteleme devreye girer, bu nedenle döngü, yeni yemek yediğinizde düşük geçici bazallar-hedefler ile etkileşime girmez. Buradaki örnek ve varsayılan 2\'dir; bu nedenle 3 saatlik bir DIA, bolus ertelemenin kademeli olarak 1,5 saat (3DIA/2) üzerinden aşamalı olarak sonlandırılacağı anlamına gelir. + Varsayılan değer: 2\nYemek bolusu yaptıktan sonra bolus erteleme devreye girer, bu nedenle döngü, yeni yemek yediğinizde düşük geçici bazallar-hedefler ile etkileşime girmez. Buradaki örnek ve varsayılan 2\'dir; bu nedenle 3 saatlik bir İES, bolus ertelemenin kademeli olarak 1,5 saat (3İES/2) üzerinden aşamalı olarak sonlandırılacağı anlamına gelir. Varsayılan değer: 3.0 (AMA) Gelişmiş Yemek Asistanı veya 8.0 (SMB) Super Micro Bolus. Bu 5 dakika başına varsayılan karbonhidrat emilimi için bir ayardır. Standart değer AMA için 3mg/dl/5dk aynı şekilde SMB 8mg/dl/5dk dir. Aktif Karbonhidratın ne kadar hızlı sindirildiğine ve KŞ\'nin beklenenden daha fazla düştüğü veya beklenildiği kadar yükselmediği zamanlarda gelecekte yapılacak tahminlerde KŞ\'nin hesaplanmasında ne kadar karbonhidrat emilimi gerçekleşeceğini öngörür. Dikkat!\nNormalde aşağıdaki bu değerleri değiştirmek zorunda değilsiniz. Lütfen burayı TIKLAYIN ve metni OKUYUN ve bu değerlerden herhangi birini değiştirmeden önce ANLADIĞINIZDAN emin olun. @@ -593,6 +593,7 @@ Aktif Karbonhidratın ne kadar hızlı sindirildiğine ve KŞ\'nin beklenenden d Bu değer OpenAPS bağlamında Max IOB (Aktif İnsülin) olarak adlandırılır\nOpenAPS, mevcut IOB bu değerden daha büyükse daha fazla insülin eklemez Besinin maksimum emilim süresi [h] Herhangi bir öğünün emildiği kabul edilen zaman. Kalan karbonhidratlar kesilecek. + Altına düştüğünde insülinin askıya alındığı KŞ değeri. Varsayılan değer, standart hedef modeli kullanır. Kullanıcı değeri 60mg/dl (3,3mmol/l) ile 100mg/dl(5.5mmol/l) arasında ayarlayabilir. 65/3,6\'nın altındaki değerler varsayılan modelin kullanılmasına neden olur Tedavi diyaloglarında not alanını göster İleri Önceki diff --git a/pump-common/src/main/res/values-es-rES/strings.xml b/pump-common/src/main/res/values-es-rES/strings.xml index 2dedba62c8..d2219bdce2 100644 --- a/pump-common/src/main/res/values-es-rES/strings.xml +++ b/pump-common/src/main/res/values-es-rES/strings.xml @@ -3,17 +3,22 @@ Operación no soportada por la bomba y/o por el controlador. Operación no soportada todavía por la bomba. + OK Nunca contactado + En fase de inicio Error con la comunicación Tiempo de espera en la comunicación Bomba no alcanzable Configuración inválida Activo + Suspendida Basales + Configuraciones Notificaciones Estadísticas + Desconocidas Todo Bolos Cebado From 6b6ba15852a0f1487dcae7c352b1a749357327ff Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Mon, 20 Jun 2022 11:34:12 +0200 Subject: [PATCH 12/44] Automation: catch instantiation errors --- .../androidaps/dialogs/WizardDialog.kt | 17 ++-- .../general/automation/triggers/Trigger.kt | 93 ++++++++++--------- 2 files changed, 57 insertions(+), 53 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/dialogs/WizardDialog.kt b/app/src/main/java/info/nightscout/androidaps/dialogs/WizardDialog.kt index c234ef63a2..8af683bcdb 100644 --- a/app/src/main/java/info/nightscout/androidaps/dialogs/WizardDialog.kt +++ b/app/src/main/java/info/nightscout/androidaps/dialogs/WizardDialog.kt @@ -72,7 +72,7 @@ class WizardDialog : DaggerDialogFragment() { private var wizard: BolusWizard? = null private var calculatedPercentage = 100.0 private var calculatedCorrection = 0.0 - private var correctionPercent = false + private var usePercentage = false private var carbsPassedIntoWizard = 0.0 private var notesPassedIntoWizard = "" private var okClicked: Boolean = false // one shot guards @@ -157,7 +157,7 @@ class WizardDialog : DaggerDialogFragment() { ?: 0.0, 0.0, maxCarbs.toDouble(), 1.0, DecimalFormat("0"), false, binding.okcancel.ok, textWatcher ) - if (correctionPercent) { + if (usePercentage) { calculatedPercentage = sp.getInt(R.string.key_boluswizard_percentage, 100).toDouble() binding.correctionInput.setParams(calculatedPercentage, 10.0, 200.0, 5.0, DecimalFormat("0"), false, binding.okcancel.ok, textWatcher) binding.correctionInput.value = calculatedPercentage @@ -176,6 +176,7 @@ class WizardDialog : DaggerDialogFragment() { handler.post { initDialog() } calculatedPercentage = sp.getInt(R.string.key_boluswizard_percentage, 100).toDouble() binding.percentUsed.text = rh.gs(R.string.format_percent, sp.getInt(R.string.key_boluswizard_percentage, 100)) + binding.percentUsed.visibility = (sp.getInt(R.string.key_boluswizard_percentage, 100) != 100 || usePercentage).toVisibility() // ok button binding.okcancel.ok.setOnClickListener { if (okClicked) { @@ -227,8 +228,8 @@ class WizardDialog : DaggerDialogFragment() { run { sp.putBoolean(rh.gs(R.string.key_wizard_correction_percent), isChecked) binding.correctionUnit.text = if (isChecked) "%" else rh.gs(R.string.insulin_unit_shortname) - correctionPercent = binding.correctionPercent.isChecked - if (correctionPercent) { + usePercentage = binding.correctionPercent.isChecked + if (usePercentage) { binding.correctionInput.setParams(calculatedPercentage, 10.0, 200.0, 5.0, DecimalFormat("0"), false, binding.okcancel.ok, textWatcher) binding.correctionInput.customContentDescription = rh.gs(R.string.a11_correction_percentage) } else { @@ -239,7 +240,7 @@ class WizardDialog : DaggerDialogFragment() { binding.correctionInput.customContentDescription = rh.gs(R.string.a11_correction_units) } binding.correctionInput.updateA11yDescription() - binding.correctionInput.value = if (correctionPercent) calculatedPercentage else Round.roundTo(calculatedCorrection, bolusStep) + binding.correctionInput.value = if (usePercentage) calculatedPercentage else Round.roundTo(calculatedCorrection, bolusStep) } } // profile @@ -320,8 +321,8 @@ class WizardDialog : DaggerDialogFragment() { private fun loadCheckedStates() { binding.bgTrendCheckbox.isChecked = sp.getBoolean(R.string.key_wizard_include_trend_bg, false) binding.cobCheckbox.isChecked = sp.getBoolean(R.string.key_wizard_include_cob, false) - correctionPercent = sp.getBoolean(R.string.key_wizard_correction_percent, false) - binding.correctionPercent.isChecked = correctionPercent + usePercentage = sp.getBoolean(R.string.key_wizard_correction_percent, false) + binding.correctionPercent.isChecked = usePercentage } private fun valueToUnitsToString(value: Double, units: String): String = @@ -370,8 +371,6 @@ class WizardDialog : DaggerDialogFragment() { binding.iobInsulin.text = rh.gs(R.string.formatinsulinunits, -bolusIob.iob - basalIob.basaliob) calculateInsulin() - - binding.percentUsed.visibility = (sp.getInt(R.string.key_boluswizard_percentage, 100) != 100 || correctionPercent).toVisibility() } } diff --git a/automation/src/main/java/info/nightscout/androidaps/plugins/general/automation/triggers/Trigger.kt b/automation/src/main/java/info/nightscout/androidaps/plugins/general/automation/triggers/Trigger.kt index c71eb696bd..0ef07dfab2 100644 --- a/automation/src/main/java/info/nightscout/androidaps/plugins/general/automation/triggers/Trigger.kt +++ b/automation/src/main/java/info/nightscout/androidaps/plugins/general/automation/triggers/Trigger.kt @@ -24,6 +24,7 @@ import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatusProv import info.nightscout.androidaps.services.LastLocationDataContainer import info.nightscout.androidaps.utils.DateUtil import info.nightscout.androidaps.interfaces.ResourceHelper +import info.nightscout.shared.logging.LTag import info.nightscout.shared.sharedPreferences.SP import org.json.JSONObject import javax.inject.Inject @@ -78,50 +79,54 @@ abstract class Trigger(val injector: HasAndroidInjector) { .toString() fun instantiate(obj: JSONObject): Trigger { - val type = obj.getString("type") - val data = obj.getJSONObject("data") - //val clazz = Class.forName(type).kotlin - //return (clazz.primaryConstructor?.call(injector) as Trigger).fromJSON(data?.toString() ?: "") - return when (type) { - TriggerAutosensValue::class.java.name, // backward compatibility - TriggerAutosensValue::class.java.simpleName -> TriggerAutosensValue(injector).fromJSON(data.toString()) - TriggerBg::class.java.name, - TriggerBg::class.java.simpleName -> TriggerBg(injector).fromJSON(data.toString()) - TriggerBolusAgo::class.java.name, - TriggerBolusAgo::class.java.simpleName -> TriggerBolusAgo(injector).fromJSON(data.toString()) - TriggerBTDevice::class.java.name, - TriggerBTDevice::class.java.simpleName -> TriggerBTDevice(injector).fromJSON(data.toString()) - TriggerIob::class.java.name, - TriggerIob::class.java.simpleName -> TriggerIob(injector).fromJSON(data.toString()) - TriggerCOB::class.java.name, - TriggerCOB::class.java.simpleName -> TriggerCOB(injector).fromJSON(data.toString()) - TriggerConnector::class.java.name, - TriggerConnector::class.java.simpleName -> TriggerConnector(injector).fromJSON(data.toString()) - TriggerDelta::class.java.name, - TriggerDelta::class.java.simpleName -> TriggerDelta(injector).fromJSON(data.toString()) - TriggerDummy::class.java.name, - TriggerDummy::class.java.simpleName -> TriggerDummy(injector).fromJSON(data.toString()) - TriggerIob::class.java.name, - TriggerIob::class.java.simpleName -> TriggerIob(injector).fromJSON(data.toString()) - TriggerLocation::class.java.name, - TriggerLocation::class.java.simpleName -> TriggerLocation(injector).fromJSON(data.toString()) - TriggerProfilePercent::class.java.name, - TriggerProfilePercent::class.java.simpleName -> TriggerProfilePercent(injector).fromJSON(data.toString()) - TriggerPumpLastConnection::class.java.name, - TriggerPumpLastConnection::class.java.simpleName -> TriggerPumpLastConnection(injector).fromJSON(data.toString()) - TriggerRecurringTime::class.java.name, - TriggerRecurringTime::class.java.simpleName -> TriggerRecurringTime(injector).fromJSON(data.toString()) - TriggerTempTarget::class.java.name, - TriggerTempTarget::class.java.simpleName -> TriggerTempTarget(injector).fromJSON(data.toString()) - TriggerTempTargetValue::class.java.name, - TriggerTempTargetValue::class.java.simpleName -> TriggerTempTargetValue(injector).fromJSON(data.toString()) - TriggerTime::class.java.name, - TriggerTime::class.java.simpleName -> TriggerTime(injector).fromJSON(data.toString()) - TriggerTimeRange::class.java.name, - TriggerTimeRange::class.java.simpleName -> TriggerTimeRange(injector).fromJSON(data.toString()) - TriggerWifiSsid::class.java.name, - TriggerWifiSsid::class.java.simpleName -> TriggerWifiSsid(injector).fromJSON(data.toString()) - else -> TriggerConnector(injector) + try { + val type = obj.getString("type") + val data = obj.getJSONObject("data") + //val clazz = Class.forName(type).kotlin + //return (clazz.primaryConstructor?.call(injector) as Trigger).fromJSON(data?.toString() ?: "") + return when (type) { + TriggerAutosensValue::class.java.name, // backward compatibility + TriggerAutosensValue::class.java.simpleName -> TriggerAutosensValue(injector).fromJSON(data.toString()) + TriggerBg::class.java.name, + TriggerBg::class.java.simpleName -> TriggerBg(injector).fromJSON(data.toString()) + TriggerBolusAgo::class.java.name, + TriggerBolusAgo::class.java.simpleName -> TriggerBolusAgo(injector).fromJSON(data.toString()) + TriggerBTDevice::class.java.name, + TriggerBTDevice::class.java.simpleName -> TriggerBTDevice(injector).fromJSON(data.toString()) + TriggerIob::class.java.name, + TriggerIob::class.java.simpleName -> TriggerIob(injector).fromJSON(data.toString()) + TriggerCOB::class.java.name, + TriggerCOB::class.java.simpleName -> TriggerCOB(injector).fromJSON(data.toString()) + TriggerConnector::class.java.name, + TriggerConnector::class.java.simpleName -> TriggerConnector(injector).fromJSON(data.toString()) + TriggerDelta::class.java.name, + TriggerDelta::class.java.simpleName -> TriggerDelta(injector).fromJSON(data.toString()) + TriggerDummy::class.java.name, + TriggerDummy::class.java.simpleName -> TriggerDummy(injector).fromJSON(data.toString()) + TriggerIob::class.java.name, + TriggerIob::class.java.simpleName -> TriggerIob(injector).fromJSON(data.toString()) + TriggerLocation::class.java.name, + TriggerLocation::class.java.simpleName -> TriggerLocation(injector).fromJSON(data.toString()) + TriggerProfilePercent::class.java.name, + TriggerProfilePercent::class.java.simpleName -> TriggerProfilePercent(injector).fromJSON(data.toString()) + TriggerPumpLastConnection::class.java.name, + TriggerPumpLastConnection::class.java.simpleName -> TriggerPumpLastConnection(injector).fromJSON(data.toString()) + TriggerRecurringTime::class.java.name, + TriggerRecurringTime::class.java.simpleName -> TriggerRecurringTime(injector).fromJSON(data.toString()) + TriggerTempTarget::class.java.name, + TriggerTempTarget::class.java.simpleName -> TriggerTempTarget(injector).fromJSON(data.toString()) + TriggerTempTargetValue::class.java.name, + TriggerTempTargetValue::class.java.simpleName -> TriggerTempTargetValue(injector).fromJSON(data.toString()) + TriggerTime::class.java.name, + TriggerTime::class.java.simpleName -> TriggerTime(injector).fromJSON(data.toString()) + TriggerTimeRange::class.java.name, + TriggerTimeRange::class.java.simpleName -> TriggerTimeRange(injector).fromJSON(data.toString()) + TriggerWifiSsid::class.java.name, + TriggerWifiSsid::class.java.simpleName -> TriggerWifiSsid(injector).fromJSON(data.toString()) + else -> TriggerConnector(injector) + } + } catch (e: Exception) { + aapsLogger.error(LTag.AUTOMATION, "Error parsing $obj") } } From bd979d24e501bb9afafa3201918b9f9e93c2fc30 Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Mon, 20 Jun 2022 18:32:38 +0200 Subject: [PATCH 13/44] fix build --- .../androidaps/plugins/general/automation/triggers/Trigger.kt | 1 + 1 file changed, 1 insertion(+) diff --git a/automation/src/main/java/info/nightscout/androidaps/plugins/general/automation/triggers/Trigger.kt b/automation/src/main/java/info/nightscout/androidaps/plugins/general/automation/triggers/Trigger.kt index 0ef07dfab2..2af7f49ce0 100644 --- a/automation/src/main/java/info/nightscout/androidaps/plugins/general/automation/triggers/Trigger.kt +++ b/automation/src/main/java/info/nightscout/androidaps/plugins/general/automation/triggers/Trigger.kt @@ -128,6 +128,7 @@ abstract class Trigger(val injector: HasAndroidInjector) { } catch (e: Exception) { aapsLogger.error(LTag.AUTOMATION, "Error parsing $obj") } + return TriggerConnector(injector) } fun createAddButton(context: Context, trigger: TriggerConnector): ImageButton = From be201f0177c9f51bd03a1420dab914cf260d89ab Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Mon, 20 Jun 2022 23:50:56 +0200 Subject: [PATCH 14/44] Improve bolus canceling --- .../queue/CommandQueueImplementation.kt | 4 ++-- .../queue/CommandQueueImplementationTest.kt | 2 +- .../androidaps/dialogs/BolusProgressDialog.kt | 23 +++++++------------ .../androidaps/interfaces/CommandQueue.kt | 2 +- 4 files changed, 12 insertions(+), 19 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/queue/CommandQueueImplementation.kt b/app/src/main/java/info/nightscout/androidaps/queue/CommandQueueImplementation.kt index bbfbd91d31..3f2e2de469 100644 --- a/app/src/main/java/info/nightscout/androidaps/queue/CommandQueueImplementation.kt +++ b/app/src/main/java/info/nightscout/androidaps/queue/CommandQueueImplementation.kt @@ -321,9 +321,9 @@ class CommandQueueImplementation @Inject constructor( } @Synchronized - override fun cancelAllBoluses() { + override fun cancelAllBoluses(timestamp: Long) { if (!isRunning(CommandType.BOLUS)) { - rxBus.send(EventDismissBolusProgressIfRunning(PumpEnactResult(injector).success(true).enacted(false), null)) + rxBus.send(EventDismissBolusProgressIfRunning(PumpEnactResult(injector).success(true).enacted(false), timestamp)) } removeAll(CommandType.BOLUS) removeAll(CommandType.SMB_BOLUS) diff --git a/app/src/test/java/info/nightscout/androidaps/queue/CommandQueueImplementationTest.kt b/app/src/test/java/info/nightscout/androidaps/queue/CommandQueueImplementationTest.kt index 907f739127..7c694189da 100644 --- a/app/src/test/java/info/nightscout/androidaps/queue/CommandQueueImplementationTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/queue/CommandQueueImplementationTest.kt @@ -241,7 +241,7 @@ class CommandQueueImplementationTest : TestBaseWithProfile() { Assert.assertEquals(2, commandQueue.size()) // when - commandQueue.cancelAllBoluses() + commandQueue.cancelAllBoluses(anyLong()) // then Assert.assertEquals(0, commandQueue.size()) diff --git a/core/src/main/java/info/nightscout/androidaps/dialogs/BolusProgressDialog.kt b/core/src/main/java/info/nightscout/androidaps/dialogs/BolusProgressDialog.kt index 8b6368bc0c..c19f869a71 100644 --- a/core/src/main/java/info/nightscout/androidaps/dialogs/BolusProgressDialog.kt +++ b/core/src/main/java/info/nightscout/androidaps/dialogs/BolusProgressDialog.kt @@ -1,6 +1,5 @@ package info.nightscout.androidaps.dialogs -import android.content.res.Resources import android.os.Bundle import android.os.SystemClock import android.view.LayoutInflater @@ -16,15 +15,15 @@ import info.nightscout.androidaps.database.entities.UserEntry.Action import info.nightscout.androidaps.database.entities.UserEntry.Sources import info.nightscout.androidaps.events.EventPumpStatusChanged import info.nightscout.androidaps.interfaces.CommandQueue -import info.nightscout.shared.logging.AAPSLogger -import info.nightscout.shared.logging.LTag +import info.nightscout.androidaps.interfaces.ResourceHelper import info.nightscout.androidaps.logging.UserEntryLogger import info.nightscout.androidaps.plugins.bus.RxBus import info.nightscout.androidaps.plugins.general.overview.events.EventDismissBolusProgressIfRunning import info.nightscout.androidaps.plugins.general.overview.events.EventOverviewBolusProgress import info.nightscout.androidaps.utils.FabricPrivacy -import info.nightscout.androidaps.interfaces.ResourceHelper import info.nightscout.androidaps.utils.rx.AapsSchedulers +import info.nightscout.shared.logging.AAPSLogger +import info.nightscout.shared.logging.LTag import io.reactivex.rxjava3.disposables.CompositeDisposable import io.reactivex.rxjava3.kotlin.plusAssign import javax.inject.Inject @@ -75,17 +74,12 @@ class BolusProgressDialog : DaggerDialogFragment() { // onDestroyView. private val binding get() = _binding!! - override fun onCreateView( - inflater: LayoutInflater, container: ViewGroup?, - savedInstanceState: Bundle? - ): View { + override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View { dialog?.window?.requestFeature(Window.FEATURE_NO_TITLE) dialog?.window?.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN) isCancelable = false dialog?.setCanceledOnTouchOutside(false) - - val theme: Resources.Theme? = context?.theme - theme?.applyStyle(R.style.AppTheme_NoActionBar, true) + context?.theme?.applyStyle(R.style.AppTheme_NoActionBar, true) _binding = DialogBolusprogressBinding.inflate(inflater, container, false) return binding.root @@ -95,6 +89,7 @@ class BolusProgressDialog : DaggerDialogFragment() { savedInstanceState?.let { amount = it.getDouble("amount") timestamp = it.getLong("timestamp") + state = it.getString("state") ?: rh.gs(R.string.waitingforpump) } binding.title.text = rh.gs(R.string.goingtodeliver, amount) binding.stop.setOnClickListener { @@ -103,11 +98,9 @@ class BolusProgressDialog : DaggerDialogFragment() { binding.stoppressed.visibility = View.VISIBLE binding.stop.visibility = View.INVISIBLE uel.log(Action.CANCEL_BOLUS, Sources.Overview, state) - commandQueue.cancelAllBoluses() + commandQueue.cancelAllBoluses(timestamp) } - val defaultState = rh.gs(R.string.waitingforpump) binding.progressbar.max = 100 - state = savedInstanceState?.getString("state", defaultState) ?: defaultState binding.status.text = state stopPressed = false } @@ -134,7 +127,7 @@ class BolusProgressDialog : DaggerDialogFragment() { .toObservable(EventDismissBolusProgressIfRunning::class.java) .observeOn(aapsSchedulers.main) .subscribe({ - aapsLogger.debug(LTag.PUMP, "Running timestamp $timestamp. Close request timestamp ${it.bolusTimestamp}") + aapsLogger.debug(LTag.PUMP, "Running timestamp $timestamp. Close request timestamp ${it.bolusTimestamp}") if (it.bolusTimestamp == null || it.bolusTimestamp == timestamp) if (running) dismiss() }, fabricPrivacy::logException) diff --git a/core/src/main/java/info/nightscout/androidaps/interfaces/CommandQueue.kt b/core/src/main/java/info/nightscout/androidaps/interfaces/CommandQueue.kt index 5ba0055402..8619f43a3a 100644 --- a/core/src/main/java/info/nightscout/androidaps/interfaces/CommandQueue.kt +++ b/core/src/main/java/info/nightscout/androidaps/interfaces/CommandQueue.kt @@ -17,7 +17,7 @@ interface CommandQueue { fun independentConnect(reason: String, callback: Callback?) fun bolusInQueue(): Boolean fun bolus(detailedBolusInfo: DetailedBolusInfo, callback: Callback?): Boolean - fun cancelAllBoluses() + fun cancelAllBoluses(running: Long) fun stopPump(callback: Callback?) fun startPump(callback: Callback?) fun setTBROverNotification(callback: Callback?, enable: Boolean) From 532c79c74461796babaab59be31fe845300d4092 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 21 Jun 2022 08:07:45 +0000 Subject: [PATCH 15/44] Bump coroutines_version from 1.6.2 to 1.6.3 Bumps `coroutines_version` from 1.6.2 to 1.6.3. Updates `kotlinx-coroutines-core` from 1.6.2 to 1.6.3 - [Release notes](https://github.com/Kotlin/kotlinx.coroutines/releases) - [Changelog](https://github.com/Kotlin/kotlinx.coroutines/blob/master/CHANGES.md) - [Commits](https://github.com/Kotlin/kotlinx.coroutines/compare/1.6.2...1.6.3) Updates `kotlinx-coroutines-android` from 1.6.2 to 1.6.3 - [Release notes](https://github.com/Kotlin/kotlinx.coroutines/releases) - [Changelog](https://github.com/Kotlin/kotlinx.coroutines/blob/master/CHANGES.md) - [Commits](https://github.com/Kotlin/kotlinx.coroutines/compare/1.6.2...1.6.3) Updates `kotlinx-coroutines-guava` from 1.6.2 to 1.6.3 - [Release notes](https://github.com/Kotlin/kotlinx.coroutines/releases) - [Changelog](https://github.com/Kotlin/kotlinx.coroutines/blob/master/CHANGES.md) - [Commits](https://github.com/Kotlin/kotlinx.coroutines/compare/1.6.2...1.6.3) Updates `kotlinx-coroutines-play-services` from 1.6.2 to 1.6.3 - [Release notes](https://github.com/Kotlin/kotlinx.coroutines/releases) - [Changelog](https://github.com/Kotlin/kotlinx.coroutines/blob/master/CHANGES.md) - [Commits](https://github.com/Kotlin/kotlinx.coroutines/compare/1.6.2...1.6.3) --- updated-dependencies: - dependency-name: org.jetbrains.kotlinx:kotlinx-coroutines-core dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: org.jetbrains.kotlinx:kotlinx-coroutines-android dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: org.jetbrains.kotlinx:kotlinx-coroutines-guava dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: org.jetbrains.kotlinx:kotlinx-coroutines-play-services dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index f7aeaacda4..2c78775b78 100644 --- a/build.gradle +++ b/build.gradle @@ -10,7 +10,7 @@ buildscript { room_version = '2.4.2' lifecycle_version = '2.4.1' dagger_version = '2.42' - coroutines_version = '1.6.2' + coroutines_version = '1.6.3' activity_version = '1.4.0' fragmentktx_version = '1.4.1' ormLite_version = '4.46' From 5a0fc8da74496d672ade014541ea7b0795911722 Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Tue, 21 Jun 2022 11:05:31 +0200 Subject: [PATCH 16/44] Widget: resolve db access in main thread --- .../nightscout/androidaps/widget/Widget.kt | 25 +++++++++++-------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/widget/Widget.kt b/app/src/main/java/info/nightscout/androidaps/widget/Widget.kt index b8b60ad34f..b4a2cbcd29 100644 --- a/app/src/main/java/info/nightscout/androidaps/widget/Widget.kt +++ b/app/src/main/java/info/nightscout/androidaps/widget/Widget.kt @@ -8,6 +8,8 @@ import android.content.Context import android.content.Intent import android.graphics.Color import android.graphics.Paint +import android.os.Handler +import android.os.HandlerThread import android.view.View import android.widget.RemoteViews import dagger.android.HasAndroidInjector @@ -26,7 +28,6 @@ import info.nightscout.androidaps.plugins.general.overview.OverviewData import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatusProvider import info.nightscout.androidaps.utils.DateUtil import info.nightscout.androidaps.utils.TrendCalculator -import info.nightscout.androidaps.interfaces.ResourceHelper import info.nightscout.shared.logging.AAPSLogger import info.nightscout.shared.logging.LTag import info.nightscout.shared.sharedPreferences.SP @@ -53,6 +54,7 @@ class Widget : AppWidgetProvider() { @Inject lateinit var sp: SP @Inject lateinit var constraintChecker: ConstraintChecker + private var handler = Handler(HandlerThread(this::class.simpleName + "Handler").also { it.start() }.looper) private val intentAction = "OpenApp" override fun onReceive(context: Context, intent: Intent?) { @@ -88,16 +90,17 @@ class Widget : AppWidgetProvider() { views.setOnClickPendingIntent(R.id.widget_layout, pendingIntent) views.setInt(R.id.widget_layout, "setBackgroundColor", Color.argb(alpha, 0, 0, 0)) - updateBg(views) - updateTemporaryBasal(views) - updateExtendedBolus(views) - updateIobCob(views) - updateTemporaryTarget(views) - updateProfile(views) - updateSensitivity(views) - - // Instruct the widget manager to update the widget - appWidgetManager.updateAppWidget(appWidgetId, views) + handler.post { + updateBg(views) + updateTemporaryBasal(views) + updateExtendedBolus(views) + updateIobCob(views) + updateTemporaryTarget(views) + updateProfile(views) + updateSensitivity(views) + // Instruct the widget manager to update the widget + appWidgetManager.updateAppWidget(appWidgetId, views) + } } private fun updateBg(views: RemoteViews) { From e8928e554f6138a0d0e5bae1b5883907acd5e51f Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Tue, 21 Jun 2022 12:03:58 +0200 Subject: [PATCH 17/44] RL: process BroadcastReceiver actions outside UI thread --- .../service/RileyLinkMedtronicService.kt | 6 +- .../service/RileyLinkOmnipodService.java | 2 +- .../service/RileyLinkBroadcastReceiver.java | 232 ------------------ .../service/RileyLinkBroadcastReceiver.kt | 160 ++++++++++++ .../hw/rileylink/service/RileyLinkService.kt | 14 +- 5 files changed, 170 insertions(+), 244 deletions(-) delete mode 100644 rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/RileyLinkBroadcastReceiver.java create mode 100644 rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/RileyLinkBroadcastReceiver.kt diff --git a/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/service/RileyLinkMedtronicService.kt b/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/service/RileyLinkMedtronicService.kt index a27b26b23e..e5157aadec 100644 --- a/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/service/RileyLinkMedtronicService.kt +++ b/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/service/RileyLinkMedtronicService.kt @@ -4,10 +4,8 @@ import android.content.Intent import android.content.res.Configuration import android.os.Binder import android.os.IBinder -import info.nightscout.shared.logging.LTag import info.nightscout.androidaps.plugins.pump.common.defs.PumpDeviceState import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkConst -import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.RFSpy import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.defs.RileyLinkEncodingType import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.defs.RileyLinkTargetFrequency import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkTargetDevice @@ -21,6 +19,7 @@ import info.nightscout.androidaps.plugins.pump.medtronic.defs.MedtronicDeviceTyp import info.nightscout.androidaps.plugins.pump.medtronic.driver.MedtronicPumpStatus import info.nightscout.androidaps.plugins.pump.medtronic.util.MedtronicConst import info.nightscout.androidaps.plugins.pump.medtronic.util.MedtronicUtil +import info.nightscout.shared.logging.LTag import javax.inject.Inject import javax.inject.Singleton @@ -33,7 +32,6 @@ class RileyLinkMedtronicService : RileyLinkService() { @Inject lateinit var medtronicPumpPlugin: MedtronicPumpPlugin @Inject lateinit var medtronicUtil: MedtronicUtil @Inject lateinit var medtronicPumpStatus: MedtronicPumpStatus - @Inject lateinit var rfSpy: RFSpy @Inject lateinit var medtronicCommunicationManager: MedtronicCommunicationManager @Inject lateinit var medtronicUIComm: MedtronicUIComm @@ -79,7 +77,7 @@ class RileyLinkMedtronicService : RileyLinkService() { // get most recently used RileyLink address and name rileyLinkServiceData.rileyLinkAddress = sp.getString(RileyLinkConst.Prefs.RileyLinkAddress, "") rileyLinkServiceData.rileyLinkName = sp.getString(RileyLinkConst.Prefs.RileyLinkName, "") - rfspy.startReader() + rfSpy.startReader() aapsLogger.debug(LTag.PUMPCOMM, "RileyLinkMedtronicService newly constructed") } diff --git a/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/rileylink/service/RileyLinkOmnipodService.java b/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/rileylink/service/RileyLinkOmnipodService.java index b28a66d3f8..8520db88d3 100644 --- a/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/rileylink/service/RileyLinkOmnipodService.java +++ b/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/rileylink/service/RileyLinkOmnipodService.java @@ -69,7 +69,7 @@ public class RileyLinkOmnipodService extends RileyLinkService { rileyLinkServiceData.rileyLinkAddress = sp.getString(RileyLinkConst.Prefs.RileyLinkAddress, ""); rileyLinkServiceData.rileyLinkName = sp.getString(RileyLinkConst.Prefs.RileyLinkName, ""); - rfspy.startReader(); + rfSpy.startReader(); aapsLogger.debug(LTag.PUMPBTCOMM, "RileyLinkOmnipodService newly constructed"); } diff --git a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/RileyLinkBroadcastReceiver.java b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/RileyLinkBroadcastReceiver.java deleted file mode 100644 index d984c9ed27..0000000000 --- a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/RileyLinkBroadcastReceiver.java +++ /dev/null @@ -1,232 +0,0 @@ -package info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service; - -/** - * Created by andy on 10/23/18. - */ - -import android.bluetooth.BluetoothAdapter; -import android.bluetooth.BluetoothManager; -import android.content.Context; -import android.content.Intent; -import android.content.IntentFilter; - -import androidx.localbroadcastmanager.content.LocalBroadcastManager; - -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import javax.inject.Inject; - -import dagger.android.DaggerBroadcastReceiver; -import dagger.android.HasAndroidInjector; -import info.nightscout.androidaps.interfaces.ActivePlugin; -import info.nightscout.shared.logging.AAPSLogger; -import info.nightscout.shared.logging.LTag; -import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkConst; -import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.defs.RileyLinkFirmwareVersion; -import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkError; -import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkPumpDevice; -import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkServiceState; -import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.tasks.DiscoverGattServicesTask; -import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.tasks.InitializePumpManagerTask; -import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.tasks.ServiceTask; -import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.tasks.ServiceTaskExecutor; -import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.tasks.WakeAndTuneTask; -import info.nightscout.shared.sharedPreferences.SP; - -/** - * I added this class outside of RileyLinkService, because for now it's very important part of RL framework and - * where we get a lot of problems. Especially merging between AAPS and RileyLinkAAPS. I might put it back at - * later time - */ -public class RileyLinkBroadcastReceiver extends DaggerBroadcastReceiver { - - @Inject HasAndroidInjector injector; - @Inject SP sp; - @Inject AAPSLogger aapsLogger; - @Inject RileyLinkServiceData rileyLinkServiceData; - @Inject ServiceTaskExecutor serviceTaskExecutor; - @Inject ActivePlugin activePlugin; - - RileyLinkService serviceInstance; - protected Map> broadcastIdentifiers = null; - //String deviceSpecificPrefix; - - public RileyLinkBroadcastReceiver(RileyLinkService serviceInstance) { - this.serviceInstance = serviceInstance; - - createBroadcastIdentifiers(); - } - - - private void createBroadcastIdentifiers() { - - this.broadcastIdentifiers = new HashMap<>(); - - // Bluetooth - this.broadcastIdentifiers.put("Bluetooth", Arrays.asList( // - RileyLinkConst.Intents.BluetoothConnected, // - RileyLinkConst.Intents.BluetoothReconnected)); - - // TuneUp - this.broadcastIdentifiers.put("TuneUp", Arrays.asList( // - RileyLinkConst.IPC.MSG_PUMP_tunePump, // - RileyLinkConst.IPC.MSG_PUMP_quickTune)); - - // RileyLink - this.broadcastIdentifiers.put("RileyLink", Arrays.asList( // - RileyLinkConst.Intents.RileyLinkDisconnected, // - RileyLinkConst.Intents.RileyLinkReady, // - RileyLinkConst.Intents.RileyLinkDisconnected, // - RileyLinkConst.Intents.RileyLinkNewAddressSet, // - RileyLinkConst.Intents.RileyLinkDisconnect)); - } - - private RileyLinkService getServiceInstance() { - RileyLinkPumpDevice pumpDevice = (RileyLinkPumpDevice) activePlugin.getActivePump(); - return pumpDevice.getRileyLinkService(); - } - - - @Override - public void onReceive(Context context, Intent intent) { - super.onReceive(context, intent); - - if (intent == null) { - aapsLogger.error(LTag.PUMPBTCOMM, "onReceive: received null intent"); - } else { - String action = intent.getAction(); - if (action == null) { - aapsLogger.error("onReceive: null action"); - } else { - aapsLogger.debug(LTag.PUMPBTCOMM, "Received Broadcast: " + action); - - if (!processBluetoothBroadcasts(action) && // - !processRileyLinkBroadcasts(action, context) && // - !processTuneUpBroadcasts(action) && // - !processApplicationSpecificBroadcasts(action, intent) // - ) { - aapsLogger.error(LTag.PUMPBTCOMM, "Unhandled broadcast: action=" + action); - } - } - } - } - - - public void registerBroadcasts(Context context) { - - IntentFilter intentFilter = new IntentFilter(); - - for (Map.Entry> stringListEntry : broadcastIdentifiers.entrySet()) { - - for (String intentKey : stringListEntry.getValue()) { - intentFilter.addAction(intentKey); - } - } - - LocalBroadcastManager.getInstance(context).registerReceiver(this, intentFilter); - } - - - private boolean processRileyLinkBroadcasts(String action, Context context) { - - RileyLinkService rileyLinkService = getServiceInstance(); - - if (action.equals(RileyLinkConst.Intents.RileyLinkDisconnected)) { - if (((BluetoothManager)context.getSystemService(Context.BLUETOOTH_SERVICE)).getAdapter().isEnabled()) { - rileyLinkServiceData.setServiceState(RileyLinkServiceState.BluetoothError, RileyLinkError.RileyLinkUnreachable); - } else { - rileyLinkServiceData.setServiceState(RileyLinkServiceState.BluetoothError, RileyLinkError.BluetoothDisabled); - } - - return true; - } else if (action.equals(RileyLinkConst.Intents.RileyLinkReady)) { - aapsLogger.warn(LTag.PUMPBTCOMM, "RileyLinkConst.Intents.RileyLinkReady"); - // sendIPCNotification(RT2Const.IPC.MSG_note_WakingPump); - - rileyLinkService.rileyLinkBLE.enableNotifications(); - rileyLinkService.rfspy.startReader(); // call startReader from outside? - - rileyLinkService.rfspy.initializeRileyLink(); - String bleVersion = rileyLinkService.rfspy.getBLEVersionCached(); - RileyLinkFirmwareVersion rlVersion = rileyLinkServiceData.firmwareVersion; - - aapsLogger.debug(LTag.PUMPBTCOMM, "RfSpy version (BLE113): " + bleVersion); - rileyLinkService.rileyLinkServiceData.versionBLE113 = bleVersion; - -// if (isLoggingEnabled()) - aapsLogger.debug(LTag.PUMPBTCOMM, "RfSpy Radio version (CC110): " + rlVersion.name()); - this.rileyLinkServiceData.firmwareVersion = rlVersion; - - ServiceTask task = new InitializePumpManagerTask(injector, context); - serviceTaskExecutor.startTask(task); - aapsLogger.info(LTag.PUMPBTCOMM, "Announcing RileyLink open For business"); - - return true; - } else if (action.equals(RileyLinkConst.Intents.RileyLinkNewAddressSet)) { - String RileylinkBLEAddress = sp.getString(RileyLinkConst.Prefs.RileyLinkAddress, ""); - if (RileylinkBLEAddress.equals("")) { - aapsLogger.error("No Rileylink BLE Address saved in app"); - } else { - // showBusy("Configuring Service", 50); - // rileyLinkBLE.findRileyLink(RileylinkBLEAddress); - rileyLinkService.reconfigureRileyLink(RileylinkBLEAddress); - // MainApp.getServiceClientConnection().setThisRileylink(RileylinkBLEAddress); - } - - return true; - } else if (action.equals(RileyLinkConst.Intents.RileyLinkDisconnect)) { - rileyLinkService.disconnectRileyLink(); - return true; - } else { - return false; - } - - } - - - public boolean processBluetoothBroadcasts(String action) { - - if (action.equals(RileyLinkConst.Intents.BluetoothConnected)) { - aapsLogger.debug(LTag.PUMPBTCOMM, "Bluetooth - Connected"); - serviceTaskExecutor.startTask(new DiscoverGattServicesTask(injector)); - - return true; - - } else if (action.equals(RileyLinkConst.Intents.BluetoothReconnected)) { - aapsLogger.debug(LTag.PUMPBTCOMM, "Bluetooth - Reconnecting"); - - getServiceInstance().bluetoothInit(); - serviceTaskExecutor.startTask(new DiscoverGattServicesTask(injector, true)); - - return true; - } else { - - return false; - } - } - - - private boolean processTuneUpBroadcasts(String action) { - - if (this.broadcastIdentifiers.get("TuneUp").contains(action)) { - if (serviceInstance.getRileyLinkTargetDevice().isTuneUpEnabled()) { - serviceTaskExecutor.startTask(new WakeAndTuneTask(injector)); - } - return true; - } else { - return false; - } - } - - - public boolean processApplicationSpecificBroadcasts(String action, Intent intent) { - return false; - } - - public void unregisterBroadcasts(Context context) { - LocalBroadcastManager.getInstance(context).unregisterReceiver(this); - } -} diff --git a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/RileyLinkBroadcastReceiver.kt b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/RileyLinkBroadcastReceiver.kt new file mode 100644 index 0000000000..1141cf69c9 --- /dev/null +++ b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/RileyLinkBroadcastReceiver.kt @@ -0,0 +1,160 @@ +package info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service + +import android.bluetooth.BluetoothManager +import android.content.Context +import android.content.Intent +import android.content.IntentFilter +import android.os.Handler +import android.os.HandlerThread +import androidx.localbroadcastmanager.content.LocalBroadcastManager +import dagger.android.DaggerBroadcastReceiver +import dagger.android.HasAndroidInjector +import info.nightscout.androidaps.interfaces.ActivePlugin +import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkConst +import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkError +import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkPumpDevice +import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkServiceState +import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.tasks.DiscoverGattServicesTask +import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.tasks.InitializePumpManagerTask +import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.tasks.ServiceTask +import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.tasks.ServiceTaskExecutor +import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.tasks.WakeAndTuneTask +import info.nightscout.shared.logging.AAPSLogger +import info.nightscout.shared.logging.LTag +import info.nightscout.shared.sharedPreferences.SP +import javax.inject.Inject + +class RileyLinkBroadcastReceiver : DaggerBroadcastReceiver() { + + @Inject lateinit var injector: HasAndroidInjector + @Inject lateinit var sp: SP + @Inject lateinit var aapsLogger: AAPSLogger + @Inject lateinit var rileyLinkServiceData: RileyLinkServiceData + @Inject lateinit var serviceTaskExecutor: ServiceTaskExecutor + @Inject lateinit var activePlugin: ActivePlugin + + private var handler = Handler(HandlerThread(this::class.simpleName + "Handler").also { it.start() }.looper) + private val broadcastIdentifiers: MutableMap> = HashMap() + + init { + createBroadcastIdentifiers() + } + + private val rileyLinkService: RileyLinkService + get() = (activePlugin.activePump as RileyLinkPumpDevice).rileyLinkService + + private fun createBroadcastIdentifiers() { + + // Bluetooth + broadcastIdentifiers["Bluetooth"] = listOf( + RileyLinkConst.Intents.BluetoothConnected, + RileyLinkConst.Intents.BluetoothReconnected + ) + + // TuneUp + broadcastIdentifiers["TuneUp"] = listOf( + RileyLinkConst.IPC.MSG_PUMP_tunePump, + RileyLinkConst.IPC.MSG_PUMP_quickTune + ) + + // RileyLink + broadcastIdentifiers["RileyLink"] = listOf( + RileyLinkConst.Intents.RileyLinkDisconnected, + RileyLinkConst.Intents.RileyLinkReady, + RileyLinkConst.Intents.RileyLinkDisconnected, + RileyLinkConst.Intents.RileyLinkNewAddressSet, + RileyLinkConst.Intents.RileyLinkDisconnect + ) + } + + override fun onReceive(context: Context, intent: Intent) { + super.onReceive(context, intent) + val action = intent.action ?: return + handler.post { + aapsLogger.debug(LTag.PUMPBTCOMM, "Received Broadcast: $action") + if (!processBluetoothBroadcasts(action) && !processRileyLinkBroadcasts(action, context) && !processTuneUpBroadcasts(action)) + aapsLogger.error(LTag.PUMPBTCOMM, "Unhandled broadcast: action=$action") + } + } + + fun registerBroadcasts(context: Context) { + val intentFilter = IntentFilter() + for ((_, value) in broadcastIdentifiers) + for (intentKey in value) + intentFilter.addAction(intentKey) + LocalBroadcastManager.getInstance(context).registerReceiver(this, intentFilter) + } + + fun unregisterBroadcasts(context: Context) { + LocalBroadcastManager.getInstance(context).unregisterReceiver(this) + } + + private fun processRileyLinkBroadcasts(action: String, context: Context): Boolean = + when (action) { + RileyLinkConst.Intents.RileyLinkDisconnected -> { + if ((context.getSystemService(Context.BLUETOOTH_SERVICE) as BluetoothManager).adapter.isEnabled) + rileyLinkServiceData.setServiceState(RileyLinkServiceState.BluetoothError, RileyLinkError.RileyLinkUnreachable) + else + rileyLinkServiceData.setServiceState(RileyLinkServiceState.BluetoothError, RileyLinkError.BluetoothDisabled) + true + } + + RileyLinkConst.Intents.RileyLinkReady -> { + aapsLogger.warn(LTag.PUMPBTCOMM, "RileyLinkConst.Intents.RileyLinkReady") + // sendIPCNotification(RT2Const.IPC.MSG_note_WakingPump); + rileyLinkService.rileyLinkBLE.enableNotifications() + rileyLinkService.rfSpy.startReader() // call startReader from outside? + rileyLinkService.rfSpy.initializeRileyLink() + val bleVersion = rileyLinkService.rfSpy.bleVersionCached + val rlVersion = rileyLinkServiceData.firmwareVersion + aapsLogger.debug(LTag.PUMPBTCOMM, "RfSpy version (BLE113): $bleVersion") + rileyLinkService.rileyLinkServiceData.versionBLE113 = bleVersion + + aapsLogger.debug(LTag.PUMPBTCOMM, "RfSpy Radio version (CC110): " + rlVersion.name) + rileyLinkServiceData.firmwareVersion = rlVersion + val task: ServiceTask = InitializePumpManagerTask(injector, context) + serviceTaskExecutor.startTask(task) + aapsLogger.info(LTag.PUMPBTCOMM, "Announcing RileyLink open For business") + true + } + + RileyLinkConst.Intents.RileyLinkNewAddressSet -> { + val rileylinkBLEAddress = sp.getString(RileyLinkConst.Prefs.RileyLinkAddress, "") + if (rileylinkBLEAddress == "") { + aapsLogger.error("No Rileylink BLE Address saved in app") + } else rileyLinkService.reconfigureRileyLink(rileylinkBLEAddress) + true + } + + RileyLinkConst.Intents.RileyLinkDisconnect -> { + rileyLinkService.disconnectRileyLink() + true + } + + else -> false + } + + private fun processBluetoothBroadcasts(action: String): Boolean = + when (action) { + RileyLinkConst.Intents.BluetoothConnected -> { + aapsLogger.debug(LTag.PUMPBTCOMM, "Bluetooth - Connected") + serviceTaskExecutor.startTask(DiscoverGattServicesTask(injector)) + true + } + + RileyLinkConst.Intents.BluetoothReconnected -> { + aapsLogger.debug(LTag.PUMPBTCOMM, "Bluetooth - Reconnecting") + rileyLinkService.bluetoothInit() + serviceTaskExecutor.startTask(DiscoverGattServicesTask(injector, true)) + true + } + + else -> false + } + + private fun processTuneUpBroadcasts(action: String): Boolean = + if (broadcastIdentifiers["TuneUp"]?.contains(action) == true) { + if (rileyLinkService.rileyLinkTargetDevice.isTuneUpEnabled) serviceTaskExecutor.startTask(WakeAndTuneTask(injector)) + true + } else false +} \ No newline at end of file diff --git a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/RileyLinkService.kt b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/RileyLinkService.kt index 4b61ecec25..47449c5c3f 100644 --- a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/RileyLinkService.kt +++ b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/RileyLinkService.kt @@ -41,18 +41,18 @@ abstract class RileyLinkService : DaggerService() { @Inject lateinit var rileyLinkServiceData: RileyLinkServiceData @Inject lateinit var activePlugin: ActivePlugin @Inject lateinit var rileyLinkBLE: RileyLinkBLE // android-bluetooth management - @Inject lateinit var rfspy: RFSpy // interface for RL xxx Mhz radio. + @Inject lateinit var rfSpy: RFSpy // interface for RL xxx Mhz radio. private val bluetoothAdapter: BluetoothAdapter? get() = (context.getSystemService(Context.BLUETOOTH_SERVICE) as BluetoothManager?)?.adapter - protected var mBroadcastReceiver: RileyLinkBroadcastReceiver? = null + protected var broadcastReceiver: RileyLinkBroadcastReceiver? = null private var bluetoothStateReceiver: RileyLinkBluetoothStateReceiver? = null override fun onCreate() { super.onCreate() rileyLinkUtil.encoding = encoding initRileyLinkServiceData() - mBroadcastReceiver = RileyLinkBroadcastReceiver(this) - mBroadcastReceiver?.registerBroadcasts(this) + broadcastReceiver = RileyLinkBroadcastReceiver() + broadcastReceiver?.registerBroadcasts(this) bluetoothStateReceiver = RileyLinkBluetoothStateReceiver() bluetoothStateReceiver?.registerBroadcasts(this) } @@ -80,7 +80,7 @@ abstract class RileyLinkService : DaggerService() { super.onDestroy() rileyLinkBLE.disconnect() // dispose of Gatt (disconnect and close) - mBroadcastReceiver?.unregisterBroadcasts(this) + broadcastReceiver?.unregisterBroadcasts(this) bluetoothStateReceiver?.unregisterBroadcasts(this) } @@ -139,7 +139,7 @@ abstract class RileyLinkService : DaggerService() { } } - // FIXME: This needs to be run in a session so that is interruptible, has a separate thread, etc. + // FIXME: This needs to be run in a session so that is incorruptible, has a separate thread, etc. fun doTuneUpDevice() { rileyLinkServiceData.setRileyLinkServiceState(RileyLinkServiceState.TuneUpDevice) setPumpDeviceState(PumpDeviceState.Sleeping) @@ -178,7 +178,7 @@ abstract class RileyLinkService : DaggerService() { get() = rileyLinkServiceData.targetDevice fun changeRileyLinkEncoding(encodingType: RileyLinkEncodingType?) { - rfspy.setRileyLinkEncoding(encodingType) + rfSpy.setRileyLinkEncoding(encodingType) } val error: RileyLinkError? From 40d1c0c9bc527ee1255861b6602cd227fd897269 Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Tue, 21 Jun 2022 12:43:22 +0200 Subject: [PATCH 18/44] RileyLinkPumpDevice -> kt --- .../pump/medtronic/MedtronicPumpPlugin.kt | 170 ++++++++++-------- .../dialog/RileyLinkBLEConfigActivity.kt | 2 +- .../rileylink/defs/RileyLinkPumpDevice.java | 18 -- .../hw/rileylink/defs/RileyLinkPumpDevice.kt | 13 ++ .../service/RileyLinkBroadcastReceiver.kt | 20 +-- 5 files changed, 124 insertions(+), 99 deletions(-) delete mode 100644 rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/defs/RileyLinkPumpDevice.java create mode 100644 rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/defs/RileyLinkPumpDevice.kt diff --git a/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/MedtronicPumpPlugin.kt b/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/MedtronicPumpPlugin.kt index 9752d1ef42..2fbebf5bf7 100644 --- a/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/MedtronicPumpPlugin.kt +++ b/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/MedtronicPumpPlugin.kt @@ -91,16 +91,17 @@ class MedtronicPumpPlugin @Inject constructor( aapsSchedulers: AapsSchedulers, pumpSync: PumpSync, pumpSyncStorage: info.nightscout.androidaps.plugins.pump.common.sync.PumpSyncStorage -) : PumpPluginAbstract(PluginDescription() // - .mainType(PluginType.PUMP) // - .fragmentClass(MedtronicFragment::class.java.name) // - .pluginIcon(R.drawable.ic_veo_128) - .pluginName(R.string.medtronic_name) // - .shortName(R.string.medtronic_name_short) // - .preferencesId(R.xml.pref_medtronic) - .description(R.string.description_pump_medtronic), // - PumpType.MEDTRONIC_522_722, // we default to most basic model, correct model from config is loaded later - injector, rh, aapsLogger, commandQueue, rxBus, activePlugin, sp, context, fabricPrivacy, dateUtil, aapsSchedulers, pumpSync, pumpSyncStorage +) : PumpPluginAbstract( + PluginDescription() // + .mainType(PluginType.PUMP) // + .fragmentClass(MedtronicFragment::class.java.name) // + .pluginIcon(R.drawable.ic_veo_128) + .pluginName(R.string.medtronic_name) // + .shortName(R.string.medtronic_name_short) // + .preferencesId(R.xml.pref_medtronic) + .description(R.string.description_pump_medtronic), // + PumpType.MEDTRONIC_522_722, // we default to most basic model, correct model from config is loaded later + injector, rh, aapsLogger, commandQueue, rxBus, activePlugin, sp, context, fabricPrivacy, dateUtil, aapsSchedulers, pumpSync, pumpSyncStorage ), Pump, RileyLinkPumpDevice, PumpSyncEntriesCreator { private var rileyLinkMedtronicService: RileyLinkMedtronicService? = null @@ -234,18 +235,16 @@ class MedtronicPumpPlugin @Inject constructor( // Pump Plugin private var isServiceSet: Boolean = false - override fun getRileyLinkService(): RileyLinkMedtronicService? = rileyLinkMedtronicService + override val rileyLinkService: RileyLinkMedtronicService? = rileyLinkMedtronicService - override fun getPumpInfo(): RileyLinkPumpInfo { - val frequency = rh.gs(if (medtronicPumpStatus.pumpFrequency == "medtronic_pump_frequency_us_ca") R.string.medtronic_pump_frequency_us_ca else R.string.medtronic_pump_frequency_worldwide) - val model = if (!medtronicUtil.isModelSet) "???" else "Medtronic " + medtronicPumpStatus.medtronicDeviceType.pumpModel - val serialNumber = medtronicPumpStatus.serialNumber - return RileyLinkPumpInfo(frequency, model, serialNumber) - } + override val pumpInfo: RileyLinkPumpInfo + get() = RileyLinkPumpInfo( + rh.gs(if (medtronicPumpStatus.pumpFrequency == "medtronic_pump_frequency_us_ca") R.string.medtronic_pump_frequency_us_ca else R.string.medtronic_pump_frequency_worldwide), + if (!medtronicUtil.isModelSet) "???" else "Medtronic " + medtronicPumpStatus.medtronicDeviceType.pumpModel, + medtronicPumpStatus.serialNumber + ) - override fun getLastConnectionTimeMillis(): Long { - return medtronicPumpStatus.lastConnection - } + override val lastConnectionTimeMillis: Long = medtronicPumpStatus.lastConnection override fun setLastCommunicationToNow() { medtronicPumpStatus.setLastCommunicationToNow() @@ -326,7 +325,8 @@ class MedtronicPumpPlugin @Inject constructor( } if (rileyLinkServiceState != RileyLinkServiceState.PumpConnectorReady // && rileyLinkServiceState != RileyLinkServiceState.RileyLinkReady // - && rileyLinkServiceState != RileyLinkServiceState.TuneUpDevice) { + && rileyLinkServiceState != RileyLinkServiceState.TuneUpDevice + ) { aapsLogger.debug(LTag.PUMP, "RileyLink unreachable.") return false } @@ -334,8 +334,10 @@ class MedtronicPumpPlugin @Inject constructor( } private fun refreshAnyStatusThatNeedsToBeRefreshed() { - val statusRefresh = workWithStatusRefresh(StatusRefreshAction.GetData, null, - null)!! + val statusRefresh = workWithStatusRefresh( + StatusRefreshAction.GetData, null, + null + )!! if (!doWeHaveAnyStatusNeededRefreshing(statusRefresh)) { return } @@ -491,7 +493,7 @@ class MedtronicPumpPlugin @Inject constructor( val basalsByHour: DoubleArray? = medtronicPumpStatus.basalsByHour aapsLogger.debug( LTag.PUMP, "Current Basals (h): " - + (basalsByHour?.let { getProfilesByHourToString(it) } ?: "null")) + + (basalsByHour?.let { getProfilesByHourToString(it) } ?: "null")) // int index = 0; if (basalsByHour == null) return true // we don't want to set profile again, unless we are sure @@ -594,9 +596,13 @@ class MedtronicPumpPlugin @Inject constructor( return PumpEnactResult(injector) // .success(false) // .enacted(false) // - .comment(rh.gs(R.string.medtronic_cmd_bolus_could_not_be_delivered_no_insulin, - medtronicPumpStatus.reservoirRemainingUnits, - detailedBolusInfo.insulin)) + .comment( + rh.gs( + R.string.medtronic_cmd_bolus_could_not_be_delivered_no_insulin, + medtronicPumpStatus.reservoirRemainingUnits, + detailedBolusInfo.insulin + ) + ) } bolusDeliveryType = BolusDeliveryType.DeliveryPrepared if (isPumpNotReachable) { @@ -619,8 +625,10 @@ class MedtronicPumpPlugin @Inject constructor( bolusDeliveryType = BolusDeliveryType.Delivering // LOG.debug("MedtronicPumpPlugin::deliverBolus - Start delivery"); - val responseTask = rileyLinkMedtronicService?.medtronicUIComm?.executeCommand(MedtronicCommandType.SetBolus, - arrayListOf(detailedBolusInfo.insulin)) + val responseTask = rileyLinkMedtronicService?.medtronicUIComm?.executeCommand( + MedtronicCommandType.SetBolus, + arrayListOf(detailedBolusInfo.insulin) + ) val response = responseTask?.result as Boolean? setRefreshButtonEnabled(true) @@ -757,8 +765,10 @@ class MedtronicPumpPlugin @Inject constructor( } // now start new TBR - val responseTask = rileyLinkMedtronicService?.medtronicUIComm?.executeCommand(MedtronicCommandType.SetTemporaryBasal, - arrayListOf(absoluteRate, durationInMinutes)) + val responseTask = rileyLinkMedtronicService?.medtronicUIComm?.executeCommand( + MedtronicCommandType.SetTemporaryBasal, + arrayListOf(absoluteRate, durationInMinutes) + ) val response = responseTask?.result as Boolean? aapsLogger.info(LTag.PUMP, logPrefix + "setTempBasalAbsolute - setTBR. Response: " + response) return if (response == null || !response) { @@ -784,13 +794,13 @@ class MedtronicPumpPlugin @Inject constructor( @Deprecated("Not used, TBRs fixed in history, should be removed.") private fun cancelTBRWithTemporaryId() { - val tbrs : MutableList = pumpSyncStorage.getTBRs() - if (tbrs.size > 0 && medtronicPumpStatus.runningTBRWithTemp!=null) { + val tbrs: MutableList = pumpSyncStorage.getTBRs() + if (tbrs.size > 0 && medtronicPumpStatus.runningTBRWithTemp != null) { aapsLogger.info(LTag.PUMP, logPrefix + "cancelTBRWithTemporaryId - TBR items: ${tbrs.size}") - var item : PumpDbEntryTBR? = null + var item: PumpDbEntryTBR? = null - if (tbrs.size==1) { + if (tbrs.size == 1) { item = tbrs[0] } else { for (tbr in tbrs) { @@ -801,7 +811,7 @@ class MedtronicPumpPlugin @Inject constructor( } } - if (item!=null) { + if (item != null) { aapsLogger.debug(LTag.PUMP, "DD: cancelTBRWithTemporaryId: tempIdEntry=${item}") @@ -809,23 +819,25 @@ class MedtronicPumpPlugin @Inject constructor( aapsLogger.debug( LTag.PUMP, "syncTemporaryBasalWithTempId " + - "[date=${item.date}, " + - "rate=${item.rate}, " + - "duration=${differenceS} s, " + - "isAbsolute=${!item.isAbsolute}, temporaryId=${item.temporaryId}, " + - "pumpId=NO, pumpType=${medtronicPumpStatus.pumpType}, " + - "pumpSerial=${medtronicPumpStatus.serialNumber}]") + "[date=${item.date}, " + + "rate=${item.rate}, " + + "duration=${differenceS} s, " + + "isAbsolute=${!item.isAbsolute}, temporaryId=${item.temporaryId}, " + + "pumpId=NO, pumpType=${medtronicPumpStatus.pumpType}, " + + "pumpSerial=${medtronicPumpStatus.serialNumber}]" + ) val result = pumpSync.syncTemporaryBasalWithTempId( timestamp = item.date, rate = item.rate, - duration= differenceS * 1000L, + duration = differenceS * 1000L, isAbsolute = item.isAbsolute, temporaryId = item.temporaryId, type = item.tbrType, pumpId = null, pumpType = medtronicPumpStatus.pumpType, - pumpSerial = medtronicPumpStatus.serialNumber) + pumpSerial = medtronicPumpStatus.serialNumber + ) aapsLogger.debug(LTag.PUMP, "syncTemporaryBasalWithTempId - Result: $result") } @@ -834,7 +846,7 @@ class MedtronicPumpPlugin @Inject constructor( aapsLogger.info(LTag.PUMP, logPrefix + "cancelTBRWithTemporaryId - TBR items: ${tbrs.size}, runningTBRWithTemp=${medtronicPumpStatus.runningTBRWithTemp}") } - if (medtronicPumpStatus.runningTBRWithTemp!=null) { + if (medtronicPumpStatus.runningTBRWithTemp != null) { medtronicPumpStatus.runningTBRWithTemp = null } } @@ -846,7 +858,10 @@ class MedtronicPumpPlugin @Inject constructor( } else { var absoluteValue = profile.getBasal() * (percent / 100.0) absoluteValue = pumpDescription.pumpType.determineCorrectBasalSize(absoluteValue) - aapsLogger.warn(LTag.PUMP, "setTempBasalPercent [MedtronicPumpPlugin] - You are trying to use setTempBasalPercent with percent other then 0% ($percent). This will start setTempBasalAbsolute, with calculated value ($absoluteValue). Result might not be 100% correct.") + aapsLogger.warn( + LTag.PUMP, + "setTempBasalPercent [MedtronicPumpPlugin] - You are trying to use setTempBasalPercent with percent other then 0% ($percent). This will start setTempBasalAbsolute, with calculated value ($absoluteValue). Result might not be 100% correct." + ) setTempBasalAbsolute(absoluteValue, durationInMinutes, profile, enforceNew, tbrType) } } @@ -870,7 +885,8 @@ class MedtronicPumpPlugin @Inject constructor( scheduleNextRefresh(MedtronicStatusRefreshType.PumpTime, -1) } if (medtronicPumpStatus.basalProfileStatus !== BasalProfileStatus.NotInitialized - && medtronicHistoryData.hasBasalProfileChanged()) { + && medtronicHistoryData.hasBasalProfileChanged() + ) { medtronicHistoryData.processLastBasalProfileChange(pumpDescription.pumpType, medtronicPumpStatus) } val previousState = pumpState @@ -890,7 +906,7 @@ class MedtronicPumpPlugin @Inject constructor( private fun readPumpHistoryLogic() { val debugHistory = false - var targetDate: LocalDateTime? = null + val targetDate: LocalDateTime? if (lastPumpHistoryEntry == null) { // first read if (debugHistory) aapsLogger.debug(LTag.PUMP, logPrefix + "readPumpHistoryLogic(): lastPumpHistoryEntry: null") val lastPumpHistoryEntryTime = lastPumpEntryTime @@ -898,13 +914,11 @@ class MedtronicPumpPlugin @Inject constructor( timeMinus36h = timeMinus36h.minusHours(36) medtronicHistoryData.setIsInInit(true) if (lastPumpHistoryEntryTime == 0L) { - if (debugHistory) aapsLogger.debug( - LTag.PUMP, logPrefix + "readPumpHistoryLogic(): lastPumpHistoryEntryTime: 0L - targetDate: " - + targetDate) + if (debugHistory) aapsLogger.debug(LTag.PUMP, logPrefix + "readPumpHistoryLogic(): lastPumpHistoryEntryTime: 0L") targetDate = timeMinus36h } else { // LocalDateTime lastHistoryRecordTime = DateTimeUtil.toLocalDateTime(lastPumpHistoryEntryTime); - if (debugHistory) aapsLogger.debug(LTag.PUMP, logPrefix + "readPumpHistoryLogic(): lastPumpHistoryEntryTime: " + lastPumpHistoryEntryTime + " - targetDate: " + targetDate) + if (debugHistory) aapsLogger.debug(LTag.PUMP, logPrefix + "readPumpHistoryLogic(): lastPumpHistoryEntryTime: " + lastPumpHistoryEntryTime) //medtronicHistoryData.setLastHistoryRecordTime(lastPumpHistoryEntryTime) var lastHistoryRecordTime = DateTimeUtil.toLocalDateTime(lastPumpHistoryEntryTime) lastHistoryRecordTime = lastHistoryRecordTime.minusHours(12) // we get last 12 hours of history to @@ -922,8 +936,10 @@ class MedtronicPumpPlugin @Inject constructor( //aapsLogger.debug(LTag.PUMP, "HST: Target Date: " + targetDate); @Suppress("UNCHECKED_CAST") - val responseTask2 = rileyLinkMedtronicService?.medtronicUIComm?.executeCommand(MedtronicCommandType.GetHistoryData, - arrayListOf(/*lastPumpHistoryEntry*/ null, targetDate) as? ArrayList?) + val responseTask2 = rileyLinkMedtronicService?.medtronicUIComm?.executeCommand( + MedtronicCommandType.GetHistoryData, + arrayListOf(/*lastPumpHistoryEntry*/ null, targetDate) as? ArrayList? + ) if (debugHistory) aapsLogger.debug(LTag.PUMP, "HST: After task") val historyResult = responseTask2?.result as PumpHistoryResult? if (debugHistory) aapsLogger.debug(LTag.PUMP, "HST: History Result: " + historyResult.toString()) @@ -981,8 +997,10 @@ class MedtronicPumpPlugin @Inject constructor( } MedtronicStatusRefreshType.PumpTime, MedtronicStatusRefreshType.Configuration, MedtronicStatusRefreshType.BatteryStatus, MedtronicStatusRefreshType.PumpHistory -> { - workWithStatusRefresh(StatusRefreshAction.Add, refreshType, - getTimeInFutureFromMinutes(refreshType.refreshTime + additionalTimeInMinutes)) + workWithStatusRefresh( + StatusRefreshAction.Add, refreshType, + getTimeInFutureFromMinutes(refreshType.refreshTime + additionalTimeInMinutes) + ) } } } @@ -993,9 +1011,11 @@ class MedtronicPumpPlugin @Inject constructor( } @Synchronized - private fun workWithStatusRefresh(action: StatusRefreshAction, // - statusRefreshType: MedtronicStatusRefreshType?, // - time: Long?): Map? { + private fun workWithStatusRefresh( + action: StatusRefreshAction, // + statusRefreshType: MedtronicStatusRefreshType?, // + time: Long? + ): Map? { return when (action) { StatusRefreshAction.Add -> { statusRefreshMap[statusRefreshType!!] = time!! @@ -1086,14 +1106,16 @@ class MedtronicPumpPlugin @Inject constructor( runningTBR.tbrType, runningTBR.pumpId!!, runningTBR.pumpType, - runningTBR.serialNumber) + runningTBR.serialNumber + ) val differenceTimeMin = floor(differenceTime / (60.0 * 1000.0)) aapsLogger.debug( LTag.PUMP, "canceling running TBR - syncTemporaryBasalWithPumpId [date=${runningTBR.date}, " + - "pumpId=${runningTBR.pumpId}, rate=${runningTBR.rate} U, duration=${differenceTimeMin.toInt()}, " + - "pumpSerial=${medtronicPumpStatus.serialNumber}] - Result: $result") + "pumpId=${runningTBR.pumpId}, rate=${runningTBR.rate} U, duration=${differenceTimeMin.toInt()}, " + + "pumpSerial=${medtronicPumpStatus.serialNumber}] - Result: $result" + ) } } @@ -1145,8 +1167,10 @@ class MedtronicPumpPlugin @Inject constructor( .enacted(false) // .comment(rh.gs(R.string.medtronic_cmd_set_profile_pattern_overflow, profileInvalid)) } - val responseTask = rileyLinkMedtronicService?.medtronicUIComm?.executeCommand(MedtronicCommandType.SetBasalProfileSTD, - arrayListOf(basalProfile)) + val responseTask = rileyLinkMedtronicService?.medtronicUIComm?.executeCommand( + MedtronicCommandType.SetBasalProfileSTD, + arrayListOf(basalProfile) + ) val response = responseTask?.result as Boolean? aapsLogger.info(LTag.PUMP, logPrefix + "Basal Profile was set: " + response) return if (response == null || !response) { @@ -1184,18 +1208,24 @@ class MedtronicPumpPlugin @Inject constructor( // OPERATIONS not supported by Pump or Plugin private var customActions: List? = null - private val customActionWakeUpAndTune = CustomAction(R.string.medtronic_custom_action_wake_and_tune, - MedtronicCustomActionType.WakeUpAndTune) + private val customActionWakeUpAndTune = CustomAction( + R.string.medtronic_custom_action_wake_and_tune, + MedtronicCustomActionType.WakeUpAndTune + ) private val customActionClearBolusBlock = CustomAction( - R.string.medtronic_custom_action_clear_bolus_block, MedtronicCustomActionType.ClearBolusBlock, false) + R.string.medtronic_custom_action_clear_bolus_block, MedtronicCustomActionType.ClearBolusBlock, false + ) private val customActionResetRLConfig = CustomAction( - R.string.medtronic_custom_action_reset_rileylink, MedtronicCustomActionType.ResetRileyLinkConfiguration, true) + R.string.medtronic_custom_action_reset_rileylink, MedtronicCustomActionType.ResetRileyLinkConfiguration, true + ) override fun getCustomActions(): List? { if (customActions == null) { - customActions = listOf(customActionWakeUpAndTune, // + customActions = listOf( + customActionWakeUpAndTune, // customActionClearBolusBlock, // - customActionResetRLConfig) + customActionResetRLConfig + ) } return customActions } diff --git a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/dialog/RileyLinkBLEConfigActivity.kt b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/dialog/RileyLinkBLEConfigActivity.kt index ad9c82bbb4..61be9e9b16 100644 --- a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/dialog/RileyLinkBLEConfigActivity.kt +++ b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/dialog/RileyLinkBLEConfigActivity.kt @@ -87,7 +87,7 @@ class RileyLinkBLEConfigActivity : DaggerAppCompatActivity() { sp.putString(RileyLinkConst.Prefs.RileyLinkAddress, bleAddress) sp.putString(RileyLinkConst.Prefs.RileyLinkName, deviceName) val rileyLinkPump = activePlugin.activePump as RileyLinkPumpDevice - rileyLinkPump.rileyLinkService.verifyConfiguration(true) // force reloading of address to assure that the RL gets reconnected (even if the address didn't change) + rileyLinkPump.rileyLinkService?.verifyConfiguration(true) // force reloading of address to assure that the RL gets reconnected (even if the address didn't change) rileyLinkPump.triggerPumpConfigurationChangedEvent() finish() } diff --git a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/defs/RileyLinkPumpDevice.java b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/defs/RileyLinkPumpDevice.java deleted file mode 100644 index 996eb5a358..0000000000 --- a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/defs/RileyLinkPumpDevice.java +++ /dev/null @@ -1,18 +0,0 @@ -package info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs; - -import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.RileyLinkService; - -public interface RileyLinkPumpDevice { - - void setBusy(boolean busy); - - void triggerPumpConfigurationChangedEvent(); - - RileyLinkService getRileyLinkService(); - - RileyLinkPumpInfo getPumpInfo(); - - long getLastConnectionTimeMillis(); - - void setLastCommunicationToNow(); -} diff --git a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/defs/RileyLinkPumpDevice.kt b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/defs/RileyLinkPumpDevice.kt new file mode 100644 index 0000000000..ce3048cbac --- /dev/null +++ b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/defs/RileyLinkPumpDevice.kt @@ -0,0 +1,13 @@ +package info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs + +import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.RileyLinkService + +interface RileyLinkPumpDevice { + + fun setBusy(busy: Boolean) + fun triggerPumpConfigurationChangedEvent() + val rileyLinkService: RileyLinkService? + val pumpInfo: RileyLinkPumpInfo + val lastConnectionTimeMillis: Long + fun setLastCommunicationToNow() +} \ No newline at end of file diff --git a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/RileyLinkBroadcastReceiver.kt b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/RileyLinkBroadcastReceiver.kt index 1141cf69c9..bfbaf4b184 100644 --- a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/RileyLinkBroadcastReceiver.kt +++ b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/RileyLinkBroadcastReceiver.kt @@ -40,7 +40,7 @@ class RileyLinkBroadcastReceiver : DaggerBroadcastReceiver() { createBroadcastIdentifiers() } - private val rileyLinkService: RileyLinkService + private val rileyLinkService: RileyLinkService? get() = (activePlugin.activePump as RileyLinkPumpDevice).rileyLinkService private fun createBroadcastIdentifiers() { @@ -102,13 +102,13 @@ class RileyLinkBroadcastReceiver : DaggerBroadcastReceiver() { RileyLinkConst.Intents.RileyLinkReady -> { aapsLogger.warn(LTag.PUMPBTCOMM, "RileyLinkConst.Intents.RileyLinkReady") // sendIPCNotification(RT2Const.IPC.MSG_note_WakingPump); - rileyLinkService.rileyLinkBLE.enableNotifications() - rileyLinkService.rfSpy.startReader() // call startReader from outside? - rileyLinkService.rfSpy.initializeRileyLink() - val bleVersion = rileyLinkService.rfSpy.bleVersionCached + rileyLinkService?.rileyLinkBLE?.enableNotifications() + rileyLinkService?.rfSpy?.startReader() // call startReader from outside? + rileyLinkService?.rfSpy?.initializeRileyLink() + val bleVersion = rileyLinkService?.rfSpy?.bleVersionCached val rlVersion = rileyLinkServiceData.firmwareVersion aapsLogger.debug(LTag.PUMPBTCOMM, "RfSpy version (BLE113): $bleVersion") - rileyLinkService.rileyLinkServiceData.versionBLE113 = bleVersion + rileyLinkService?.rileyLinkServiceData?.versionBLE113 = bleVersion aapsLogger.debug(LTag.PUMPBTCOMM, "RfSpy Radio version (CC110): " + rlVersion.name) rileyLinkServiceData.firmwareVersion = rlVersion @@ -122,12 +122,12 @@ class RileyLinkBroadcastReceiver : DaggerBroadcastReceiver() { val rileylinkBLEAddress = sp.getString(RileyLinkConst.Prefs.RileyLinkAddress, "") if (rileylinkBLEAddress == "") { aapsLogger.error("No Rileylink BLE Address saved in app") - } else rileyLinkService.reconfigureRileyLink(rileylinkBLEAddress) + } else rileyLinkService?.reconfigureRileyLink(rileylinkBLEAddress) true } RileyLinkConst.Intents.RileyLinkDisconnect -> { - rileyLinkService.disconnectRileyLink() + rileyLinkService?.disconnectRileyLink() true } @@ -144,7 +144,7 @@ class RileyLinkBroadcastReceiver : DaggerBroadcastReceiver() { RileyLinkConst.Intents.BluetoothReconnected -> { aapsLogger.debug(LTag.PUMPBTCOMM, "Bluetooth - Reconnecting") - rileyLinkService.bluetoothInit() + rileyLinkService?.bluetoothInit() serviceTaskExecutor.startTask(DiscoverGattServicesTask(injector, true)) true } @@ -154,7 +154,7 @@ class RileyLinkBroadcastReceiver : DaggerBroadcastReceiver() { private fun processTuneUpBroadcasts(action: String): Boolean = if (broadcastIdentifiers["TuneUp"]?.contains(action) == true) { - if (rileyLinkService.rileyLinkTargetDevice.isTuneUpEnabled) serviceTaskExecutor.startTask(WakeAndTuneTask(injector)) + if (rileyLinkService?.rileyLinkTargetDevice?.isTuneUpEnabled == true) serviceTaskExecutor.startTask(WakeAndTuneTask(injector)) true } else false } \ No newline at end of file From 37593a2d422f4d38738600cb80302862ed67039f Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Tue, 21 Jun 2022 13:26:13 +0200 Subject: [PATCH 19/44] cleanup --- .../nightscout/androidaps/di/AppComponent.kt | 6 +- .../comm/MedtronicHistoryDataUTest.kt | 65 ++++--------- .../pump/MedtronicPumpHistoryDecoderUTest.kt | 22 ++--- .../data/MedtronicHistoryDataUTest.kt | 95 +++++++------------ .../{dagger => di}/OmnipodInjectHelpers.kt | 2 +- .../{dagger => di}/OmnipodWizardModule.kt | 2 +- .../fragment/action/InitializePodFragment.kt | 2 +- .../fragment/action/InsertCannulaFragment.kt | 2 +- .../fragment/info/AttachPodFragment.kt | 2 +- .../fragment/info/PodActivatedFragment.kt | 2 +- .../info/StartPodActivationFragment.kt | 2 +- .../fragment/action/DeactivatePodFragment.kt | 2 +- .../fragment/info/PodDeactivatedFragment.kt | 2 +- .../fragment/info/PodDiscardedFragment.kt | 2 +- .../info/StartPodDeactivationFragment.kt | 2 +- .../OmnipodDashHistoryModule.kt | 2 +- .../dash/{dagger => di}/OmnipodDashModule.kt | 6 +- .../OmnipodDashWizardViewModelsModule.kt | 6 +- .../OmnipodErosHistoryModule.kt | 2 +- .../eros/{dagger => di}/OmnipodErosModule.kt | 6 +- .../OmnipodErosWizardViewModelsModule.kt | 6 +- .../eros/ui/OmnipodErosOverviewFragment.kt | 26 +++-- .../general/openhumans/OpenHumansAPI.kt | 8 +- .../openhumans/{dagger => di}/Helpers.kt | 2 +- .../{dagger => di}/OpenHumansModule.kt | 2 +- .../general/openhumans/ui/OHLoginActivity.kt | 4 +- 26 files changed, 104 insertions(+), 176 deletions(-) rename omnipod-common/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/common/{dagger => di}/OmnipodInjectHelpers.kt (99%) rename omnipod-common/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/common/{dagger => di}/OmnipodWizardModule.kt (99%) rename omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/{dagger => di}/OmnipodDashHistoryModule.kt (94%) rename omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/{dagger => di}/OmnipodDashModule.kt (91%) rename omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/{dagger => di}/OmnipodDashWizardViewModelsModule.kt (94%) rename omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/{dagger => di}/OmnipodErosHistoryModule.kt (92%) rename omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/{dagger => di}/OmnipodErosModule.kt (91%) rename omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/{dagger => di}/OmnipodErosWizardViewModelsModule.kt (94%) rename openhumans/src/main/java/info/nightscout/androidaps/plugin/general/openhumans/{dagger => di}/Helpers.kt (94%) rename openhumans/src/main/java/info/nightscout/androidaps/plugin/general/openhumans/{dagger => di}/OpenHumansModule.kt (96%) diff --git a/app/src/main/java/info/nightscout/androidaps/di/AppComponent.kt b/app/src/main/java/info/nightscout/androidaps/di/AppComponent.kt index 32b65aca7b..fb5bc21397 100644 --- a/app/src/main/java/info/nightscout/androidaps/di/AppComponent.kt +++ b/app/src/main/java/info/nightscout/androidaps/di/AppComponent.kt @@ -16,12 +16,12 @@ import info.nightscout.androidaps.dependencyInjection.AutotuneModule import info.nightscout.androidaps.diaconn.di.DiaconnG8Module import info.nightscout.androidaps.insight.di.InsightDatabaseModule import info.nightscout.androidaps.insight.di.InsightModule -import info.nightscout.androidaps.plugin.general.openhumans.dagger.OpenHumansModule +import info.nightscout.androidaps.plugin.general.openhumans.di.OpenHumansModule import info.nightscout.androidaps.plugins.pump.common.di.PumpCommonModule import info.nightscout.androidaps.plugins.pump.common.di.RileyLinkModule import info.nightscout.androidaps.plugins.pump.medtronic.di.MedtronicModule -import info.nightscout.androidaps.plugins.pump.omnipod.dash.dagger.OmnipodDashModule -import info.nightscout.androidaps.plugins.pump.omnipod.eros.dagger.OmnipodErosModule +import info.nightscout.androidaps.plugins.pump.omnipod.dash.di.OmnipodDashModule +import info.nightscout.androidaps.plugins.pump.omnipod.eros.di.OmnipodErosModule import info.nightscout.shared.di.SharedModule import javax.inject.Singleton diff --git a/medtronic/src/test/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/MedtronicHistoryDataUTest.kt b/medtronic/src/test/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/MedtronicHistoryDataUTest.kt index adb0844ef0..e2864fc967 100644 --- a/medtronic/src/test/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/MedtronicHistoryDataUTest.kt +++ b/medtronic/src/test/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/MedtronicHistoryDataUTest.kt @@ -2,34 +2,21 @@ package info.nightscout.androidaps.plugins.pump.medtronic.comm import android.util.Log import info.nightscout.androidaps.TestBase -import info.nightscout.androidaps.plugins.pump.common.utils.ByteUtil -import org.mockito.Mock import info.nightscout.androidaps.plugins.bus.RxBus -import info.nightscout.androidaps.interfaces.ResourceHelper -import info.nightscout.androidaps.plugins.pump.common.defs.PumpType -import info.nightscout.shared.sharedPreferences.SP -import info.nightscout.shared.logging.AAPSLogger -import info.nightscout.shared.logging.AAPSLoggerTest -import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkUtil -import info.nightscout.androidaps.plugins.pump.medtronic.driver.MedtronicPumpStatus -import info.nightscout.androidaps.plugins.pump.medtronic.util.MedtronicUtil -import info.nightscout.androidaps.plugins.pump.medtronic.comm.history.pump.MedtronicPumpHistoryDecoder -import kotlin.Throws +import info.nightscout.androidaps.plugins.pump.common.utils.ByteUtil import info.nightscout.androidaps.plugins.pump.medtronic.comm.history.RawHistoryPage +import info.nightscout.androidaps.plugins.pump.medtronic.comm.history.pump.MedtronicPumpHistoryDecoder import info.nightscout.androidaps.plugins.pump.medtronic.comm.history.pump.PumpHistoryEntry import info.nightscout.androidaps.plugins.pump.medtronic.comm.history.pump.PumpHistoryEntryType import info.nightscout.androidaps.plugins.pump.medtronic.data.MedtronicHistoryData import info.nightscout.androidaps.plugins.pump.medtronic.data.dto.TempBasalProcessDTO import info.nightscout.androidaps.plugins.pump.medtronic.defs.MedtronicDeviceType +import info.nightscout.androidaps.plugins.pump.medtronic.driver.MedtronicPumpStatus +import info.nightscout.androidaps.plugins.pump.medtronic.util.MedtronicUtil import info.nightscout.androidaps.utils.rx.TestAapsSchedulers import info.nightscout.androidaps.utils.serialisation.SealedClassHelper.gson import org.junit.Before import org.junit.Test -import org.junit.runner.RunWith -import org.mockito.ArgumentMatchers -import org.mockito.Mockito -import org.mockito.MockitoAnnotations -import java.lang.Exception //import uk.org.lidalia.slf4jtest.TestLogger; //import uk.org.lidalia.slf4jtest.TestLoggerFactory; @@ -44,50 +31,30 @@ class MedtronicHistoryDataUTest : TestBase() { // "16 00 12 EC 14 47 13 33 00 14 F2 14 47 13 00 16 01 14 F2 14 47 13 33 00 1C C9 15 47 13 00 16 00 1C C9 15 47 13 33 4E 31 D3 15 47 13 00 16 01 31 D3 15 47 13 33 00 1A F1 15 47 13 00 16 00 1A F1 15 47 13 33 50 1D F1 15 47 13 00 16 01 1D F1 15 47 13 33 50 11 D8 16 47 13 00 16 01 11 D8 16 47 13 33 50 31 FB 16 47 13 00 16 01 31 FB 16 47 13 33 50 12 E3 17 47 13 00 16 01 12 E3 17 47 13 33 00 1E FB 17 47 13 00 16 00 1E FB 17 47 13 33 D8 21 FB 17 47 13 00 16 01 21 FB 17 47 13 07 00 00 05 CC 27 93 6D 27 93 05 0C 00 E8 00 00 00 00 05 CC 05 CC 64 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0C 00 E8 00 00 00 33 00 36 C4 00 48 13 00 16 00 36 C4 00 48 13 33 D8 29 C9 00 48 13 00 16 01 29 C9 00 48 13 33 00 12 E7 00 48 13 00 16 00 12 E7 00 48 13 33 BC 19 C9 01 48 13 00 16 01 19 C9 01 48 13 33 00 26 CE 01 48 13 00 16 00 26 CE 01 48 13 33 44 29 CE 01 48 13 00 16 01 29 CE 01 48 13 33 00 13 D3 01 48 13 00 16 00 13 D3 01 48 13 33 64 31 F1 01 48 13 00 16 01 31 F1 01 48 13 33 00 0B F7 01 48 13 00 16 00 0B F7 01 48 13 33 00 12 D8 02 48 13 00 16 01 12 D8 02 48 13 33 00 10 F1 02 48 13 00 16 00 10 F1 02 48 13 33 00 30 C4 03 48 13 00 16 01 30 C4 03 48 13 33 00 04 CA 03 48 13 00 16 00 04 CA 03 48 13 33 00 2F D3 03 48 13 00 16 01 2F D3 03 48 13 33 00 30 D8 03 48 13 00 16 00 30 D8 03 48 13 33 00 13 E7 03 48 13 00 16 01 13 E7 03 48 13 33 00 2E FB 03 48 13 00 16 00 2E FB 03 48 13 19 00 00 C1 04 08 13 07 00 00 04 0C 28 93 6D 28 93 05 0C 00 E8 00 00 00 00 04 0C 04 0C 64 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0C 00 E8 00 00 00 06 3E 03 7A 19 DC 48 49 13 0C 3E 0C E6 08 09 13 07 00 00 01 E4 29 93 6D 29 93 05 0C 00 E8 00 00 00 00 01 E4 01 E4 64 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0C 00 E8 00 00 00 1A 00 13 D2 0D 0A 13 1A 01 28 D2 0D 0A 13 21 00 2A D8 0D 0A 13 03 00 00 00 0E 2D D9 2D 0A 13 33 98 26 DE 0D 4A 13 00 16 01 26 DE 0D 4A 13 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 5D 70" // ) - - - //lateinit var rxBus: RxBus lateinit var medtronicHistoryData: MedtronicHistoryData - lateinit var medtronicPumpStatus : MedtronicPumpStatus - + lateinit var medtronicPumpStatus: MedtronicPumpStatus @Before fun setup() { - MockitoAnnotations.initMocks(this) - rxBus = RxBus(TestAapsSchedulers(), aapsLogger) - medtronicPumpStatus = MedtronicPumpStatus( - rh, sp, rxBus, - rileyLinkUtil + medtronicPumpStatus = MedtronicPumpStatus(rh, sp, rxBus, rileyLinkUtil) + medtronicUtil = MedtronicUtil(aapsLogger, rxBus, rileyLinkUtil, medtronicPumpStatus) + decoder = MedtronicPumpHistoryDecoder(aapsLogger, medtronicUtil, byteUtil) + medtronicHistoryData = MedtronicHistoryData( + packetInjector, aapsLogger, sp, rh, rxBus, activePlugin, + medtronicUtil, decoder, medtronicPumpStatus, pumpSync, pumpSyncStorage ) - medtronicUtil = MedtronicUtil( - aapsLogger, rxBus, rileyLinkUtil, - medtronicPumpStatus - ) - - decoder = MedtronicPumpHistoryDecoder( - aapsLogger, - medtronicUtil, byteUtil - ) - - medtronicHistoryData = MedtronicHistoryData(packetInjector, aapsLogger, sp, rh, rxBus, activePlugin, - medtronicUtil, decoder, - medtronicPumpStatus, - pumpSync, - pumpSyncStorage) - System.setProperty("org.slf4j.simpleLogger.defaultLogLevel", "trace") } - //@Test @Throws(Exception::class) fun testTBR() { - var historyPageData = ByteUtil + val historyPageData = ByteUtil .createByteArrayFromString( "16 00 12 EC 14 47 13 33 00 14 F2 14 47 13 00 16 01 14 F2 14 47 13 33 00 1C C9 15 47 13 00 16 00 1C C9 15 47 13 33 4E 31 D3 15 47 13 00 16 01 31 D3 15 47 13 33 00 1A F1 15 47 13 00 16 00 1A F1 15 47 13 33 50 1D F1 15 47 13 00 16 01 1D F1 15 47 13 33 50 11 D8 16 47 13 00 16 01 11 D8 16 47 13 33 50 31 FB 16 47 13 00 16 01 31 FB 16 47 13 33 50 12 E3 17 47 13 00 16 01 12 E3 17 47 13 33 00 1E FB 17 47 13 00 16 00 1E FB 17 47 13 33 D8 21 FB 17 47 13 00 16 01 21 FB 17 47 13 07 00 00 05 CC 27 93 6D 27 93 05 0C 00 E8 00 00 00 00 05 CC 05 CC 64 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0C 00 E8 00 00 00 33 00 36 C4 00 48 13 00 16 00 36 C4 00 48 13 33 D8 29 C9 00 48 13 00 16 01 29 C9 00 48 13 33 00 12 E7 00 48 13 00 16 00 12 E7 00 48 13 33 BC 19 C9 01 48 13 00 16 01 19 C9 01 48 13 33 00 26 CE 01 48 13 00 16 00 26 CE 01 48 13 33 44 29 CE 01 48 13 00 16 01 29 CE 01 48 13 33 00 13 D3 01 48 13 00 16 00 13 D3 01 48 13 33 64 31 F1 01 48 13 00 16 01 31 F1 01 48 13 33 00 0B F7 01 48 13 00 16 00 0B F7 01 48 13 33 00 12 D8 02 48 13 00 16 01 12 D8 02 48 13 33 00 10 F1 02 48 13 00 16 00 10 F1 02 48 13 33 00 30 C4 03 48 13 00 16 01 30 C4 03 48 13 33 00 04 CA 03 48 13 00 16 00 04 CA 03 48 13 33 00 2F D3 03 48 13 00 16 01 2F D3 03 48 13 33 00 30 D8 03 48 13 00 16 00 30 D8 03 48 13 33 00 13 E7 03 48 13 00 16 01 13 E7 03 48 13 33 00 2E FB 03 48 13 00 16 00 2E FB 03 48 13 19 00 00 C1 04 08 13 07 00 00 04 0C 28 93 6D 28 93 05 0C 00 E8 00 00 00 00 04 0C 04 0C 64 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0C 00 E8 00 00 00 06 3E 03 7A 19 DC 48 49 13 0C 3E 0C E6 08 09 13 07 00 00 01 E4 29 93 6D 29 93 05 0C 00 E8 00 00 00 00 01 E4 01 E4 64 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0C 00 E8 00 00 00 1A 00 13 D2 0D 0A 13 1A 01 28 D2 0D 0A 13 21 00 2A D8 0D 0A 13 03 00 00 00 0E 2D D9 2D 0A 13 33 98 26 DE 0D 4A 13 00 16 01 26 DE 0D 4A 13 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 5D 70" ) @@ -141,10 +108,10 @@ class MedtronicHistoryDataUTest : TestBase() { .createByteArrayFromString( "33 20 53 78 15 51 16 00 16 01 53 78 15 51 16 33 00 6F 40 16 51 16 00 16 00 6F 40 16 51 16 7B 16 6F 40 16 11 16 2C 1E 00 33 30 71 40 16 51 16 00 16 01 71 40 16 51 16 33 00 6E 45 16 51 16 00 16 00 6E 45 16 51 16 7B 16 6E 45 16 11 16 2C 1E 00 33 3A 70 45 16 51 16 00 16 01 70 45 16 51 16 33 00 71 5E 16 51 16 00 16 00 71 5E 16 51 16 7B 16 71 5E 16 11 16 2C 1E 00 33 40 73 5E 16 51 16 00 16 01 73 5E 16 51 16 33 00 74 6D 16 51 16 00 16 00 74 6D 16 51 16 7B 16 74 6D 16 11 16 2C 1E 00 33 14 76 6D 16 51 16 00 16 01 76 6D 16 51 16 33 00 77 72 16 51 16 00 16 00 77 72 16 51 16 7B 16 77 72 16 11 16 2C 1E 00 7B 17 40 40 17 11 16 2E 1E 00 33 28 51 41 17 51 16 00 16 01 51 41 17 51 16 33 00 56 46 17 51 16 00 16 00 56 46 17 51 16 7B 17 56 46 17 11 16 2E 1E 00 33 34 59 46 17 51 16 00 16 01 59 46 17 51 16 33 00 70 4A 17 51 16 00 16 00 70 4A 17 51 16 7B 17 70 4A 17 11 16 2E 1E 00 33 58 72 4A 17 51 16 00 16 01 72 4A 17 51 16 33 00 6E 59 17 51 16 00 16 00 6E 59 17 51 16 7B 17 6E 59 17 11 16 2E 1E 00 33 18 70 59 17 51 16 00 16 01 70 59 17 51 16 33 00 70 5E 17 51 16 00 16 00 70 5E 17 51 16 7B 17 70 5E 17 11 16 2E 1E 00 33 0C 72 5E 17 51 16 00 16 01 72 5E 17 51 16 33 00 72 63 17 51 16 00 16 00 72 63 17 51 16 7B 17 72 63 17 11 16 2E 1E 00 33 1C 70 72 17 51 16 00 16 01 70 72 17 51 16 33 00 51 78 17 51 16 00 16 00 51 78 17 51 16 7B 17 52 78 17 11 16 2E 1E 00 33 12 54 78 17 51 16 00 16 01 54 78 17 51 16 07 00 00 04 4E 51 96 00 00 00 6E 51 96 05 00 00 00 00 00 00 00 04 4E 03 A2 54 00 AC 10 00 00 00 00 00 00 00 00 00 AC 00 00 00 24 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 33 00 46 46 00 52 16 00 16 00 46 46 00 52 16 7B 00 47 46 00 12 16 00 1E 00 33 20 47 64 00 52 16 00 16 01 47 64 00 52 16 33 00 6D 77 00 52 16 00 16 00 6D 77 00 52 16 7B 00 6D 77 00 12 16 00 1E 00 33 12 70 77 00 52 16 00 16 01 70 77 00 52 16 33 00 58 78 00 52 16 00 16 00 58 78 00 52 16 7B 00 59 78 00 12 16 00 1E 00 33 00 5C 78 00 52 16 00 16 02 5C 78 00 52 16 21 00 66 79 00 12 16 03 00 00 00 9C 74 42 21 12 16 03 00 03 00 03 6E 4D 01 12 16 33 00 79 4E 01 52 16 00 16 00 79 4E 01 52 16 7B 01 79 4E 01 12 16 02 1E 00 33 2A 6B 4F 01 52 16 00 16 01 6B 4F 01 52 16 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 2E D1" //"33 20 53 78 15 51 16 00 16 01 53 78 15 51 16 33 00 6F 40 16 51 16 00 16 00 6F 40 16 51 16 7B 16 6F 40 16 11 16 2C 1E 00 33 30 71 40 16 51 16 00 16 01 71 40 16 51 16 33 00 6E 45 - // 16 51 16 00 16 00 6E 45 16 51 16 7B 16 6E 45 16 11 16 2C 1E 00 33 3A 70 45 16 51 16 00 16 01 70 45 16 51 16 33 00 71 5E 16 51 16 00 16 00 71 5E 16 51 16 7B 16 71 5E 16 11 16 2C 1E 00 33 40 73 5E 16 51 16 00 16 01 73 5E 16 51 16 33 00 74 6D 16 51 16 00 16 00 74 6D 16 51 16 7B 16 74 6D 16 11 16 2C 1E 00 33 14 76 6D 16 51 16 00 16 01 76 6D 16 51 16 33 00 77 72 16 51 16 00 16 00 77 72 16 51 16 7B 16 77 72 16 11 16 2C 1E 00 7B 17 40 40 17 11 16 2E 1E 00 33 28 51 41 17 51 16 00 16 01 51 41 17 51 16 33 00 56 46 17 51 16 00 16 00 56 46 17 51 16 7B 17 56 46 17 11 16 2E 1E 00 33 34 59 46 17 51 16 00 16 01 59 46 17 51 16 33 00 70 4A 17 51 16 00 16 00 70 4A 17 51 16 7B 17 70 4A 17 11 16 2E 1E 00 33 58 72 4A 17 51 16 00 16 01 72 4A 17 51 16 33 00 6E 59 17 51 16 00 16 00 6E 59 17 51 16 7B 17 6E 59 17 11 16 2E 1E 00 33 18 70 59 17 51 16 00 16 01 70 59 17 51 16 33 00 70 5E 17 51 16 00 16 00 70 5E 17 51 16 7B 17 70 5E 17 11 16 2E 1E 00 33 0C 72 5E 17 51 16 00 16 01 72 5E 17 51 16 33 00 72 63 17 51 16 00 16 00 72 63 17 51 16 7B 17 72 63 17 11 16 2E 1E 00 33 1C 70 72 17 51 16 00 16 01 70 72 17 51 16 33 00 51 78 17 51 16 00 16 00 51 78 17 51 16 7B 17 52 78 17 11 16 2E 1E 00 33 12 54 78 17 51 16 00 16 01 54 78 17 51 16 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 4D 6D" + // 16 51 16 00 16 00 6E 45 16 51 16 7B 16 6E 45 16 11 16 2C 1E 00 33 3A 70 45 16 51 16 00 16 01 70 45 16 51 16 33 00 71 5E 16 51 16 00 16 00 71 5E 16 51 16 7B 16 71 5E 16 11 16 2C 1E 00 33 40 73 5E 16 51 16 00 16 01 73 5E 16 51 16 33 00 74 6D 16 51 16 00 16 00 74 6D 16 51 16 7B 16 74 6D 16 11 16 2C 1E 00 33 14 76 6D 16 51 16 00 16 01 76 6D 16 51 16 33 00 77 72 16 51 16 00 16 00 77 72 16 51 16 7B 16 77 72 16 11 16 2C 1E 00 7B 17 40 40 17 11 16 2E 1E 00 33 28 51 41 17 51 16 00 16 01 51 41 17 51 16 33 00 56 46 17 51 16 00 16 00 56 46 17 51 16 7B 17 56 46 17 11 16 2E 1E 00 33 34 59 46 17 51 16 00 16 01 59 46 17 51 16 33 00 70 4A 17 51 16 00 16 00 70 4A 17 51 16 7B 17 70 4A 17 11 16 2E 1E 00 33 58 72 4A 17 51 16 00 16 01 72 4A 17 51 16 33 00 6E 59 17 51 16 00 16 00 6E 59 17 51 16 7B 17 6E 59 17 11 16 2E 1E 00 33 18 70 59 17 51 16 00 16 01 70 59 17 51 16 33 00 70 5E 17 51 16 00 16 00 70 5E 17 51 16 7B 17 70 5E 17 11 16 2E 1E 00 33 0C 72 5E 17 51 16 00 16 01 72 5E 17 51 16 33 00 72 63 17 51 16 00 16 00 72 63 17 51 16 7B 17 72 63 17 11 16 2E 1E 00 33 1C 70 72 17 51 16 00 16 01 70 72 17 51 16 33 00 51 78 17 51 16 00 16 00 51 78 17 51 16 7B 17 52 78 17 11 16 2E 1E 00 33 12 54 78 17 51 16 00 16 01 54 78 17 51 16 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 4D 6D" ) - medtronicUtil.medtronicPumpModel =MedtronicDeviceType.Medtronic_723_Revel + medtronicUtil.medtronicPumpModel = MedtronicDeviceType.Medtronic_723_Revel medtronicUtil.isModelSet = true val historyPage = RawHistoryPage(aapsLogger) @@ -152,7 +119,7 @@ class MedtronicHistoryDataUTest : TestBase() { val pumpHistoryEntries: MutableList = decoder.processPageAndCreateRecords(historyPage) println("PumpHistoryEntries: " + pumpHistoryEntries.size) - val rewindRecords: MutableList = medtronicHistoryData.getFilteredItems(pumpHistoryEntries, PumpHistoryEntryType.Rewind) + val rewindRecords: MutableList = medtronicHistoryData.getFilteredItems(pumpHistoryEntries, PumpHistoryEntryType.Rewind) preProcessListTBR(pumpHistoryEntries) @@ -172,7 +139,7 @@ class MedtronicHistoryDataUTest : TestBase() { println("PumpHistoryEntries: getFilteredItems: " + tbrs.size) - println("PumpHistoryEntries: getRewindItems: $rewindRecords.size : " + gson.toJson(rewindRecords) ) + println("PumpHistoryEntries: getRewindItems: $rewindRecords.size : " + gson.toJson(rewindRecords)) val processList: MutableList = medtronicHistoryData.createTBRProcessList(tbrs, rewindRecords) diff --git a/medtronic/src/test/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/history/pump/MedtronicPumpHistoryDecoderUTest.kt b/medtronic/src/test/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/history/pump/MedtronicPumpHistoryDecoderUTest.kt index 9b0a05ebf9..dea31405f6 100644 --- a/medtronic/src/test/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/history/pump/MedtronicPumpHistoryDecoderUTest.kt +++ b/medtronic/src/test/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/history/pump/MedtronicPumpHistoryDecoderUTest.kt @@ -2,19 +2,14 @@ package info.nightscout.androidaps.plugins.pump.medtronic.comm.history.pump //import dagger.android.HasAndroidInjector import info.nightscout.androidaps.TestBase -import info.nightscout.androidaps.plugins.bus.RxBus -import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkUtil import info.nightscout.androidaps.plugins.pump.common.utils.ByteUtil import info.nightscout.androidaps.plugins.pump.medtronic.comm.history.RawHistoryPage import info.nightscout.androidaps.plugins.pump.medtronic.defs.MedtronicDeviceType import info.nightscout.androidaps.plugins.pump.medtronic.driver.MedtronicPumpStatus import info.nightscout.androidaps.plugins.pump.medtronic.util.MedtronicUtil -import info.nightscout.androidaps.utils.rx.TestAapsSchedulers import org.junit.Assert import org.junit.Before -import org.junit.Ignore import org.junit.Test -import org.mockito.Mock /** * Created by andy on 11/1/18. @@ -28,17 +23,17 @@ class MedtronicPumpHistoryDecoderUTest : TestBase() { //@Mock lateinit var rileyLinkUtil: RileyLinkUtil //@Mock lateinit var sp: SP - private var medtronicPumpStatus: MedtronicPumpStatus? = null + private lateinit var medtronicPumpStatus: MedtronicPumpStatus + //private var medtronicUtil: MedtronicUtil? = null //private var decoder: MedtronicPumpHistoryDecoder? = null - var rxBusWrapper = RxBus(TestAapsSchedulers(), aapsLogger) @Before fun setup() { medtronicPumpStatus = - MedtronicPumpStatus(rh, sp, rxBusWrapper, rileyLinkUtil) + MedtronicPumpStatus(rh, sp, rxBus, rileyLinkUtil) medtronicUtil = - MedtronicUtil(aapsLogger, rxBusWrapper, rileyLinkUtil, medtronicPumpStatus!!) - decoder = MedtronicPumpHistoryDecoder(aapsLogger, medtronicUtil!!, ByteUtil()) + MedtronicUtil(aapsLogger, rxBus, rileyLinkUtil, medtronicPumpStatus) + decoder = MedtronicPumpHistoryDecoder(aapsLogger, medtronicUtil, ByteUtil()) } /* @@ -191,12 +186,11 @@ class MedtronicPumpHistoryDecoderUTest : TestBase() { ): List { val historyPageData = ByteUtil.createByteArrayFromString(historyPageString) aapsLogger.debug("History Page Length:" + historyPageData.size) - medtronicUtil!!.medtronicPumpModel = medtronicDeviceType - medtronicUtil!!.isModelSet = true + medtronicUtil.medtronicPumpModel = medtronicDeviceType + medtronicUtil.isModelSet = true val historyPage = RawHistoryPage(aapsLogger) historyPage.appendData(historyPageData) - val pumpHistoryEntries: List = - decoder!!.processPageAndCreateRecords(historyPage) + val pumpHistoryEntries: List = decoder.processPageAndCreateRecords(historyPage) displayHistoryRecords(pumpHistoryEntries) return pumpHistoryEntries } diff --git a/medtronic/src/test/java/info/nightscout/androidaps/plugins/pump/medtronic/data/MedtronicHistoryDataUTest.kt b/medtronic/src/test/java/info/nightscout/androidaps/plugins/pump/medtronic/data/MedtronicHistoryDataUTest.kt index a985f6d615..f880537198 100644 --- a/medtronic/src/test/java/info/nightscout/androidaps/plugins/pump/medtronic/data/MedtronicHistoryDataUTest.kt +++ b/medtronic/src/test/java/info/nightscout/androidaps/plugins/pump/medtronic/data/MedtronicHistoryDataUTest.kt @@ -1,70 +1,37 @@ package info.nightscout.androidaps.plugins.pump.medtronic.data -import java.lang.reflect.Type -import com.google.gson.reflect.TypeToken import com.google.gson.Gson import com.google.gson.internal.LinkedTreeMap -// import dagger.android.AndroidInjector -// import dagger.android.HasAndroidInjector +import com.google.gson.reflect.TypeToken import info.nightscout.androidaps.TestBase -import info.nightscout.androidaps.interfaces.ActivePlugin -import info.nightscout.androidaps.interfaces.PumpSync -import info.nightscout.androidaps.plugins.bus.RxBus -import info.nightscout.androidaps.plugins.pump.common.sync.PumpSyncStorage import info.nightscout.androidaps.plugins.pump.medtronic.comm.history.pump.MedtronicPumpHistoryDecoder import info.nightscout.androidaps.plugins.pump.medtronic.comm.history.pump.PumpHistoryEntry import info.nightscout.androidaps.plugins.pump.medtronic.data.dto.TempBasalPair import info.nightscout.androidaps.plugins.pump.medtronic.driver.MedtronicPumpStatus import info.nightscout.androidaps.plugins.pump.medtronic.util.MedtronicUtil -import info.nightscout.androidaps.interfaces.ResourceHelper -import info.nightscout.shared.sharedPreferences.SP import org.junit.Before -import org.junit.Ignore - import org.junit.Test import org.mockito.Mock +import java.lang.reflect.Type -@Suppress("UNCHECKED_CAST") +@Suppress("UNCHECKED_CAST") class MedtronicHistoryDataUTest : TestBase() { - //@Mock lateinit var activePlugin: ActivePlugin - //@Mock lateinit var medtronicUtil: MedtronicUtil - //@Mock lateinit var medtronicPumpHistoryDecoder: MedtronicPumpHistoryDecoder @Mock lateinit var medtronicPumpStatus: MedtronicPumpStatus - // @Mock lateinit var pumpSync: PumpSync - // @Mock lateinit var pumpSyncStorage: PumpSyncStorage - - //@Mock lateinit var rxBus: RxBus - - // val packetInjector = HasAndroidInjector { - // AndroidInjector { - // - // } - // } @Before fun setUp() { - medtronicUtil = MedtronicUtil( - aapsLogger, rxBus, rileyLinkUtil, - medtronicPumpStatus - ) - - decoder = MedtronicPumpHistoryDecoder( - aapsLogger, - medtronicUtil, byteUtil - ) + medtronicUtil = MedtronicUtil(aapsLogger, rxBus, rileyLinkUtil, medtronicPumpStatus) + decoder = MedtronicPumpHistoryDecoder(aapsLogger, medtronicUtil, byteUtil) } - - @Test fun createTBRProcessList() { - var unitToTest = MedtronicHistoryData(packetInjector, aapsLogger, sp, rh, rxBus, activePlugin, - medtronicUtil, decoder, - medtronicPumpStatus, - pumpSync, - pumpSyncStorage) + val unitToTest = MedtronicHistoryData( + packetInjector, aapsLogger, sp, rh, rxBus, activePlugin, + medtronicUtil, decoder, medtronicPumpStatus, pumpSync, pumpSyncStorage + ) val gson = Gson() @@ -74,26 +41,26 @@ class MedtronicHistoryDataUTest : TestBase() { val yourClassList: MutableList = gson.fromJson(fileText, listType) for (pumpHistoryEntry in yourClassList) { - val stringObject = pumpHistoryEntry.decodedData["Object"] as LinkedTreeMap + val stringObject = pumpHistoryEntry.decodedData["Object"] as LinkedTreeMap - val rate : Double = stringObject.get("insulinRate") as Double - val durationMinutes: Double = stringObject.get("durationMinutes") as Double - val durationMinutesInt : Int = durationMinutes.toInt() + val rate: Double = stringObject["insulinRate"] as Double + val durationMinutes: Double = stringObject["durationMinutes"] as Double + val durationMinutesInt: Int = durationMinutes.toInt() - var tmbPair = TempBasalPair(rate, false, durationMinutesInt) + val tmbPair = TempBasalPair(rate, false, durationMinutesInt) pumpHistoryEntry.decodedData.remove("Object") pumpHistoryEntry.addDecodedData("Object", tmbPair) } - System.out.println("TBR Pre-Process List: " + gson.toJson(yourClassList)) + println("TBR Pre-Process List: " + gson.toJson(yourClassList)) val createTBRProcessList = unitToTest.createTBRProcessList(yourClassList, mutableListOf()) - System.out.println("TBR Process List: " + createTBRProcessList.size) + println("TBR Process List: " + createTBRProcessList.size) for (tempBasalProcessDTO in createTBRProcessList) { - System.out.println(tempBasalProcessDTO.toTreatmentString()) + println(tempBasalProcessDTO.toTreatmentString()) } } @@ -101,11 +68,13 @@ class MedtronicHistoryDataUTest : TestBase() { @Test fun createTBRProcessList_SpecialCase() { - var unitToTest = MedtronicHistoryData(packetInjector, aapsLogger, sp, rh, rxBus, activePlugin, - medtronicUtil, decoder, - medtronicPumpStatus, - pumpSync, - pumpSyncStorage) + val unitToTest = MedtronicHistoryData( + packetInjector, aapsLogger, sp, rh, rxBus, activePlugin, + medtronicUtil, decoder, + medtronicPumpStatus, + pumpSync, + pumpSyncStorage + ) val gson = Gson() @@ -115,26 +84,26 @@ class MedtronicHistoryDataUTest : TestBase() { val yourClassList: MutableList = gson.fromJson(fileText, listType) for (pumpHistoryEntry in yourClassList) { - val stringObject = pumpHistoryEntry.decodedData["Object"] as LinkedTreeMap + val stringObject = pumpHistoryEntry.decodedData["Object"] as LinkedTreeMap - val rate : Double = stringObject.get("insulinRate") as Double - val durationMinutes: Double = stringObject.get("durationMinutes") as Double - val durationMinutesInt : Int = durationMinutes.toInt() + val rate: Double = stringObject["insulinRate"] as Double + val durationMinutes: Double = stringObject["durationMinutes"] as Double + val durationMinutesInt: Int = durationMinutes.toInt() - var tmbPair = TempBasalPair(rate, false, durationMinutesInt) + val tmbPair = TempBasalPair(rate, false, durationMinutesInt) pumpHistoryEntry.decodedData.remove("Object") pumpHistoryEntry.addDecodedData("Object", tmbPair) } - System.out.println("TBR Pre-Process List (Special): " + gson.toJson(yourClassList)) + println("TBR Pre-Process List (Special): " + gson.toJson(yourClassList)) val createTBRProcessList = unitToTest.createTBRProcessList(yourClassList, mutableListOf()) - System.out.println("TBR Process List (Special): " + createTBRProcessList.size) + println("TBR Process List (Special): " + createTBRProcessList.size) for (tempBasalProcessDTO in createTBRProcessList) { - System.out.println(tempBasalProcessDTO.toTreatmentString()) + println(tempBasalProcessDTO.toTreatmentString()) } } diff --git a/omnipod-common/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/common/dagger/OmnipodInjectHelpers.kt b/omnipod-common/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/common/di/OmnipodInjectHelpers.kt similarity index 99% rename from omnipod-common/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/common/dagger/OmnipodInjectHelpers.kt rename to omnipod-common/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/common/di/OmnipodInjectHelpers.kt index 906d0f3413..8e0bf4b0b2 100644 --- a/omnipod-common/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/common/dagger/OmnipodInjectHelpers.kt +++ b/omnipod-common/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/common/di/OmnipodInjectHelpers.kt @@ -1,4 +1,4 @@ -package info.nightscout.androidaps.plugins.pump.omnipod.common.dagger +package info.nightscout.androidaps.plugins.pump.omnipod.common.di import androidx.lifecycle.ViewModel import androidx.lifecycle.ViewModelProvider diff --git a/omnipod-common/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/common/dagger/OmnipodWizardModule.kt b/omnipod-common/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/common/di/OmnipodWizardModule.kt similarity index 99% rename from omnipod-common/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/common/dagger/OmnipodWizardModule.kt rename to omnipod-common/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/common/di/OmnipodWizardModule.kt index 4c4d1e3643..6458a777bf 100644 --- a/omnipod-common/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/common/dagger/OmnipodWizardModule.kt +++ b/omnipod-common/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/common/di/OmnipodWizardModule.kt @@ -1,4 +1,4 @@ -package info.nightscout.androidaps.plugins.pump.omnipod.common.dagger +package info.nightscout.androidaps.plugins.pump.omnipod.common.di import androidx.lifecycle.ViewModel import androidx.lifecycle.ViewModelProvider diff --git a/omnipod-common/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/common/ui/wizard/activation/fragment/action/InitializePodFragment.kt b/omnipod-common/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/common/ui/wizard/activation/fragment/action/InitializePodFragment.kt index eced08a2b3..4f1d2bf1ba 100644 --- a/omnipod-common/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/common/ui/wizard/activation/fragment/action/InitializePodFragment.kt +++ b/omnipod-common/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/common/ui/wizard/activation/fragment/action/InitializePodFragment.kt @@ -5,7 +5,7 @@ import androidx.annotation.IdRes import androidx.fragment.app.viewModels import androidx.lifecycle.ViewModelProvider import info.nightscout.androidaps.plugins.pump.omnipod.common.R -import info.nightscout.androidaps.plugins.pump.omnipod.common.dagger.OmnipodPluginQualifier +import info.nightscout.androidaps.plugins.pump.omnipod.common.di.OmnipodPluginQualifier import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.activation.viewmodel.action.InitializePodViewModel import javax.inject.Inject diff --git a/omnipod-common/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/common/ui/wizard/activation/fragment/action/InsertCannulaFragment.kt b/omnipod-common/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/common/ui/wizard/activation/fragment/action/InsertCannulaFragment.kt index 12483400e6..982587bcbc 100644 --- a/omnipod-common/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/common/ui/wizard/activation/fragment/action/InsertCannulaFragment.kt +++ b/omnipod-common/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/common/ui/wizard/activation/fragment/action/InsertCannulaFragment.kt @@ -5,7 +5,7 @@ import androidx.annotation.IdRes import androidx.fragment.app.viewModels import androidx.lifecycle.ViewModelProvider import info.nightscout.androidaps.plugins.pump.omnipod.common.R -import info.nightscout.androidaps.plugins.pump.omnipod.common.dagger.OmnipodPluginQualifier +import info.nightscout.androidaps.plugins.pump.omnipod.common.di.OmnipodPluginQualifier import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.activation.viewmodel.action.InsertCannulaViewModel import javax.inject.Inject diff --git a/omnipod-common/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/common/ui/wizard/activation/fragment/info/AttachPodFragment.kt b/omnipod-common/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/common/ui/wizard/activation/fragment/info/AttachPodFragment.kt index 8d693aa934..f3517705d6 100644 --- a/omnipod-common/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/common/ui/wizard/activation/fragment/info/AttachPodFragment.kt +++ b/omnipod-common/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/common/ui/wizard/activation/fragment/info/AttachPodFragment.kt @@ -9,7 +9,7 @@ import androidx.fragment.app.viewModels import androidx.lifecycle.ViewModelProvider import androidx.navigation.fragment.findNavController import info.nightscout.androidaps.plugins.pump.omnipod.common.R -import info.nightscout.androidaps.plugins.pump.omnipod.common.dagger.OmnipodPluginQualifier +import info.nightscout.androidaps.plugins.pump.omnipod.common.di.OmnipodPluginQualifier import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.activation.viewmodel.info.AttachPodViewModel import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.common.fragment.InfoFragmentBase import javax.inject.Inject diff --git a/omnipod-common/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/common/ui/wizard/activation/fragment/info/PodActivatedFragment.kt b/omnipod-common/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/common/ui/wizard/activation/fragment/info/PodActivatedFragment.kt index 2bb2ea443d..d31bc47477 100644 --- a/omnipod-common/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/common/ui/wizard/activation/fragment/info/PodActivatedFragment.kt +++ b/omnipod-common/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/common/ui/wizard/activation/fragment/info/PodActivatedFragment.kt @@ -4,7 +4,7 @@ import android.os.Bundle import androidx.annotation.IdRes import androidx.fragment.app.viewModels import androidx.lifecycle.ViewModelProvider -import info.nightscout.androidaps.plugins.pump.omnipod.common.dagger.OmnipodPluginQualifier +import info.nightscout.androidaps.plugins.pump.omnipod.common.di.OmnipodPluginQualifier import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.activation.viewmodel.info.PodActivatedViewModel import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.common.fragment.InfoFragmentBase import javax.inject.Inject diff --git a/omnipod-common/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/common/ui/wizard/activation/fragment/info/StartPodActivationFragment.kt b/omnipod-common/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/common/ui/wizard/activation/fragment/info/StartPodActivationFragment.kt index 477f740b85..704b2e446d 100644 --- a/omnipod-common/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/common/ui/wizard/activation/fragment/info/StartPodActivationFragment.kt +++ b/omnipod-common/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/common/ui/wizard/activation/fragment/info/StartPodActivationFragment.kt @@ -5,7 +5,7 @@ import androidx.annotation.IdRes import androidx.fragment.app.viewModels import androidx.lifecycle.ViewModelProvider import info.nightscout.androidaps.plugins.pump.omnipod.common.R -import info.nightscout.androidaps.plugins.pump.omnipod.common.dagger.OmnipodPluginQualifier +import info.nightscout.androidaps.plugins.pump.omnipod.common.di.OmnipodPluginQualifier import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.activation.viewmodel.info.StartPodActivationViewModel import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.common.fragment.InfoFragmentBase import javax.inject.Inject diff --git a/omnipod-common/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/common/ui/wizard/deactivation/fragment/action/DeactivatePodFragment.kt b/omnipod-common/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/common/ui/wizard/deactivation/fragment/action/DeactivatePodFragment.kt index 1003744903..0d048c2a21 100644 --- a/omnipod-common/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/common/ui/wizard/deactivation/fragment/action/DeactivatePodFragment.kt +++ b/omnipod-common/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/common/ui/wizard/deactivation/fragment/action/DeactivatePodFragment.kt @@ -9,7 +9,7 @@ import androidx.fragment.app.viewModels import androidx.lifecycle.ViewModelProvider import androidx.navigation.fragment.findNavController import info.nightscout.androidaps.plugins.pump.omnipod.common.R -import info.nightscout.androidaps.plugins.pump.omnipod.common.dagger.OmnipodPluginQualifier +import info.nightscout.androidaps.plugins.pump.omnipod.common.di.OmnipodPluginQualifier import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.common.fragment.ActionFragmentBase import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.deactivation.viewmodel.action.DeactivatePodViewModel import javax.inject.Inject diff --git a/omnipod-common/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/common/ui/wizard/deactivation/fragment/info/PodDeactivatedFragment.kt b/omnipod-common/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/common/ui/wizard/deactivation/fragment/info/PodDeactivatedFragment.kt index 096c29faf9..64a755a2dc 100644 --- a/omnipod-common/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/common/ui/wizard/deactivation/fragment/info/PodDeactivatedFragment.kt +++ b/omnipod-common/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/common/ui/wizard/deactivation/fragment/info/PodDeactivatedFragment.kt @@ -4,7 +4,7 @@ import android.os.Bundle import androidx.annotation.IdRes import androidx.fragment.app.viewModels import androidx.lifecycle.ViewModelProvider -import info.nightscout.androidaps.plugins.pump.omnipod.common.dagger.OmnipodPluginQualifier +import info.nightscout.androidaps.plugins.pump.omnipod.common.di.OmnipodPluginQualifier import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.common.fragment.InfoFragmentBase import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.deactivation.viewmodel.info.PodDeactivatedViewModel import javax.inject.Inject diff --git a/omnipod-common/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/common/ui/wizard/deactivation/fragment/info/PodDiscardedFragment.kt b/omnipod-common/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/common/ui/wizard/deactivation/fragment/info/PodDiscardedFragment.kt index 6ec5245c1c..171850f7eb 100644 --- a/omnipod-common/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/common/ui/wizard/deactivation/fragment/info/PodDiscardedFragment.kt +++ b/omnipod-common/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/common/ui/wizard/deactivation/fragment/info/PodDiscardedFragment.kt @@ -4,7 +4,7 @@ import android.os.Bundle import androidx.annotation.IdRes import androidx.fragment.app.viewModels import androidx.lifecycle.ViewModelProvider -import info.nightscout.androidaps.plugins.pump.omnipod.common.dagger.OmnipodPluginQualifier +import info.nightscout.androidaps.plugins.pump.omnipod.common.di.OmnipodPluginQualifier import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.common.fragment.InfoFragmentBase import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.deactivation.viewmodel.info.PodDiscardedViewModel import javax.inject.Inject diff --git a/omnipod-common/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/common/ui/wizard/deactivation/fragment/info/StartPodDeactivationFragment.kt b/omnipod-common/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/common/ui/wizard/deactivation/fragment/info/StartPodDeactivationFragment.kt index 6e41a6c928..fe355de393 100644 --- a/omnipod-common/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/common/ui/wizard/deactivation/fragment/info/StartPodDeactivationFragment.kt +++ b/omnipod-common/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/common/ui/wizard/deactivation/fragment/info/StartPodDeactivationFragment.kt @@ -5,7 +5,7 @@ import androidx.annotation.IdRes import androidx.fragment.app.viewModels import androidx.lifecycle.ViewModelProvider import info.nightscout.androidaps.plugins.pump.omnipod.common.R -import info.nightscout.androidaps.plugins.pump.omnipod.common.dagger.OmnipodPluginQualifier +import info.nightscout.androidaps.plugins.pump.omnipod.common.di.OmnipodPluginQualifier import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.common.fragment.InfoFragmentBase import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.deactivation.viewmodel.info.StartPodDeactivationViewModel import javax.inject.Inject diff --git a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/dagger/OmnipodDashHistoryModule.kt b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/di/OmnipodDashHistoryModule.kt similarity index 94% rename from omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/dagger/OmnipodDashHistoryModule.kt rename to omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/di/OmnipodDashHistoryModule.kt index 574ea7b7d3..a4000d6680 100644 --- a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/dagger/OmnipodDashHistoryModule.kt +++ b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/di/OmnipodDashHistoryModule.kt @@ -1,4 +1,4 @@ -package info.nightscout.androidaps.plugins.pump.omnipod.dash.dagger +package info.nightscout.androidaps.plugins.pump.omnipod.dash.di import android.content.Context import dagger.Module diff --git a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/dagger/OmnipodDashModule.kt b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/di/OmnipodDashModule.kt similarity index 91% rename from omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/dagger/OmnipodDashModule.kt rename to omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/di/OmnipodDashModule.kt index c565d67abc..ffb02cc03c 100644 --- a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/dagger/OmnipodDashModule.kt +++ b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/di/OmnipodDashModule.kt @@ -1,10 +1,10 @@ -package info.nightscout.androidaps.plugins.pump.omnipod.dash.dagger +package info.nightscout.androidaps.plugins.pump.omnipod.dash.di import dagger.Binds import dagger.Module import dagger.android.ContributesAndroidInjector -import info.nightscout.androidaps.plugins.pump.omnipod.common.dagger.ActivityScope -import info.nightscout.androidaps.plugins.pump.omnipod.common.dagger.OmnipodWizardModule +import info.nightscout.androidaps.plugins.pump.omnipod.common.di.ActivityScope +import info.nightscout.androidaps.plugins.pump.omnipod.common.di.OmnipodWizardModule import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.OmnipodDashManager import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.OmnipodDashManagerImpl import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.comm.OmnipodDashBleManager diff --git a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/dagger/OmnipodDashWizardViewModelsModule.kt b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/di/OmnipodDashWizardViewModelsModule.kt similarity index 94% rename from omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/dagger/OmnipodDashWizardViewModelsModule.kt rename to omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/di/OmnipodDashWizardViewModelsModule.kt index fc0f0f4e52..1426822dc8 100644 --- a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/dagger/OmnipodDashWizardViewModelsModule.kt +++ b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/di/OmnipodDashWizardViewModelsModule.kt @@ -1,11 +1,11 @@ -package info.nightscout.androidaps.plugins.pump.omnipod.dash.dagger +package info.nightscout.androidaps.plugins.pump.omnipod.dash.di import androidx.lifecycle.ViewModel import dagger.Binds import dagger.Module import dagger.multibindings.IntoMap -import info.nightscout.androidaps.plugins.pump.omnipod.common.dagger.OmnipodPluginQualifier -import info.nightscout.androidaps.plugins.pump.omnipod.common.dagger.ViewModelKey +import info.nightscout.androidaps.plugins.pump.omnipod.common.di.OmnipodPluginQualifier +import info.nightscout.androidaps.plugins.pump.omnipod.common.di.ViewModelKey import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.activation.viewmodel.action.InitializePodViewModel import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.activation.viewmodel.action.InsertCannulaViewModel import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.activation.viewmodel.info.AttachPodViewModel diff --git a/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/dagger/OmnipodErosHistoryModule.kt b/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/di/OmnipodErosHistoryModule.kt similarity index 92% rename from omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/dagger/OmnipodErosHistoryModule.kt rename to omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/di/OmnipodErosHistoryModule.kt index ca0b026731..f88570a91d 100644 --- a/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/dagger/OmnipodErosHistoryModule.kt +++ b/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/di/OmnipodErosHistoryModule.kt @@ -1,4 +1,4 @@ -package info.nightscout.androidaps.plugins.pump.omnipod.eros.dagger +package info.nightscout.androidaps.plugins.pump.omnipod.eros.di import android.content.Context import dagger.Module diff --git a/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/dagger/OmnipodErosModule.kt b/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/di/OmnipodErosModule.kt similarity index 91% rename from omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/dagger/OmnipodErosModule.kt rename to omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/di/OmnipodErosModule.kt index ead789180a..41c4104d35 100644 --- a/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/dagger/OmnipodErosModule.kt +++ b/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/di/OmnipodErosModule.kt @@ -1,10 +1,10 @@ -package info.nightscout.androidaps.plugins.pump.omnipod.eros.dagger +package info.nightscout.androidaps.plugins.pump.omnipod.eros.di import dagger.Module import dagger.Provides import dagger.android.ContributesAndroidInjector -import info.nightscout.androidaps.plugins.pump.omnipod.common.dagger.ActivityScope -import info.nightscout.androidaps.plugins.pump.omnipod.common.dagger.OmnipodWizardModule +import info.nightscout.androidaps.plugins.pump.omnipod.common.di.ActivityScope +import info.nightscout.androidaps.plugins.pump.omnipod.common.di.OmnipodWizardModule import info.nightscout.androidaps.plugins.pump.omnipod.eros.data.RLHistoryItemOmnipod import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.manager.ErosPodStateManager import info.nightscout.androidaps.plugins.pump.omnipod.eros.manager.AapsErosPodStateManager diff --git a/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/dagger/OmnipodErosWizardViewModelsModule.kt b/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/di/OmnipodErosWizardViewModelsModule.kt similarity index 94% rename from omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/dagger/OmnipodErosWizardViewModelsModule.kt rename to omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/di/OmnipodErosWizardViewModelsModule.kt index 8b46fee7f1..494dbf401a 100644 --- a/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/dagger/OmnipodErosWizardViewModelsModule.kt +++ b/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/di/OmnipodErosWizardViewModelsModule.kt @@ -1,11 +1,11 @@ -package info.nightscout.androidaps.plugins.pump.omnipod.eros.dagger +package info.nightscout.androidaps.plugins.pump.omnipod.eros.di import androidx.lifecycle.ViewModel import dagger.Binds import dagger.Module import dagger.multibindings.IntoMap -import info.nightscout.androidaps.plugins.pump.omnipod.common.dagger.OmnipodPluginQualifier -import info.nightscout.androidaps.plugins.pump.omnipod.common.dagger.ViewModelKey +import info.nightscout.androidaps.plugins.pump.omnipod.common.di.OmnipodPluginQualifier +import info.nightscout.androidaps.plugins.pump.omnipod.common.di.ViewModelKey import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.activation.viewmodel.action.InitializePodViewModel import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.activation.viewmodel.action.InsertCannulaViewModel import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.activation.viewmodel.info.AttachPodViewModel diff --git a/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/ui/OmnipodErosOverviewFragment.kt b/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/ui/OmnipodErosOverviewFragment.kt index d67636cda0..429301d62c 100644 --- a/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/ui/OmnipodErosOverviewFragment.kt +++ b/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/ui/OmnipodErosOverviewFragment.kt @@ -1,7 +1,6 @@ package info.nightscout.androidaps.plugins.pump.omnipod.eros.ui import android.content.Intent -import android.graphics.Color import android.os.Bundle import android.os.Handler import android.os.HandlerThread @@ -15,6 +14,7 @@ import info.nightscout.androidaps.activities.ErrorHelperActivity import info.nightscout.androidaps.events.EventPreferenceChange import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.interfaces.CommandQueue +import info.nightscout.androidaps.interfaces.ResourceHelper import info.nightscout.androidaps.plugins.bus.RxBus import info.nightscout.androidaps.plugins.general.overview.events.EventDismissNotification import info.nightscout.androidaps.plugins.general.overview.notifications.Notification @@ -48,10 +48,9 @@ import info.nightscout.androidaps.utils.DateUtil import info.nightscout.androidaps.utils.FabricPrivacy import info.nightscout.androidaps.utils.alertDialogs.OKDialog import info.nightscout.androidaps.utils.protection.ProtectionCheck -import info.nightscout.androidaps.interfaces.ResourceHelper import info.nightscout.androidaps.utils.rx.AapsSchedulers -import info.nightscout.shared.sharedPreferences.SP import info.nightscout.androidaps.utils.ui.UIRunnable +import info.nightscout.shared.sharedPreferences.SP import io.reactivex.rxjava3.disposables.CompositeDisposable import io.reactivex.rxjava3.kotlin.plusAssign import org.apache.commons.lang3.StringUtils @@ -59,7 +58,6 @@ import org.joda.time.DateTime import org.joda.time.Duration import java.util.* import javax.inject.Inject -import kotlin.collections.ArrayList class OmnipodErosOverviewFragment : DaggerFragment() { companion object { @@ -96,17 +94,17 @@ class OmnipodErosOverviewFragment : DaggerFragment() { } } - var _binding: OmnipodErosOverviewBinding? = null - var _rileyLinkStatusBinding: OmnipodErosOverviewRileyLinkStatusBinding? = null - var _podInfoBinding: OmnipodCommonOverviewPodInfoBinding? = null - var _buttonBinding: OmnipodCommonOverviewButtonsBinding? = null + private var _binding: OmnipodErosOverviewBinding? = null + private var _rileyLinkStatusBinding: OmnipodErosOverviewRileyLinkStatusBinding? = null + private var _podInfoBinding: OmnipodCommonOverviewPodInfoBinding? = null + private var _buttonBinding: OmnipodCommonOverviewButtonsBinding? = null // These properties are only valid between onCreateView and // onDestroyView. - val binding get() = _binding!! - val rileyLinkStatusBinding get() = _rileyLinkStatusBinding!! - val podInfoBinding get() = _podInfoBinding!! - val buttonBinding get() = _buttonBinding!! + private val binding get() = _binding!! + private val rileyLinkStatusBinding get() = _rileyLinkStatusBinding!! + private val podInfoBinding get() = _podInfoBinding!! + private val buttonBinding get() = _buttonBinding!! override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View = OmnipodErosOverviewBinding.inflate(inflater, container, false).also { @@ -256,9 +254,9 @@ class OmnipodErosOverviewFragment : DaggerFragment() { val errors = ArrayList() if (omnipodErosPumpPlugin.rileyLinkService != null) { - val rileyLinkErrorDescription = omnipodErosPumpPlugin.rileyLinkService.errorDescription + val rileyLinkErrorDescription = omnipodErosPumpPlugin.rileyLinkService?.errorDescription if (StringUtils.isNotEmpty(rileyLinkErrorDescription)) { - errors.add(rileyLinkErrorDescription) + errors.add(rileyLinkErrorDescription!!) } } diff --git a/openhumans/src/main/java/info/nightscout/androidaps/plugin/general/openhumans/OpenHumansAPI.kt b/openhumans/src/main/java/info/nightscout/androidaps/plugin/general/openhumans/OpenHumansAPI.kt index 1c1a8376f2..18be8d0335 100644 --- a/openhumans/src/main/java/info/nightscout/androidaps/plugin/general/openhumans/OpenHumansAPI.kt +++ b/openhumans/src/main/java/info/nightscout/androidaps/plugin/general/openhumans/OpenHumansAPI.kt @@ -2,10 +2,10 @@ package info.nightscout.androidaps.plugin.general.openhumans import android.annotation.SuppressLint import android.util.Base64 -import info.nightscout.androidaps.plugin.general.openhumans.dagger.BaseUrl -import info.nightscout.androidaps.plugin.general.openhumans.dagger.ClientId -import info.nightscout.androidaps.plugin.general.openhumans.dagger.ClientSecret -import info.nightscout.androidaps.plugin.general.openhumans.dagger.RedirectUrl +import info.nightscout.androidaps.plugin.general.openhumans.di.BaseUrl +import info.nightscout.androidaps.plugin.general.openhumans.di.ClientId +import info.nightscout.androidaps.plugin.general.openhumans.di.ClientSecret +import info.nightscout.androidaps.plugin.general.openhumans.di.RedirectUrl import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.suspendCancellableCoroutine import okhttp3.* diff --git a/openhumans/src/main/java/info/nightscout/androidaps/plugin/general/openhumans/dagger/Helpers.kt b/openhumans/src/main/java/info/nightscout/androidaps/plugin/general/openhumans/di/Helpers.kt similarity index 94% rename from openhumans/src/main/java/info/nightscout/androidaps/plugin/general/openhumans/dagger/Helpers.kt rename to openhumans/src/main/java/info/nightscout/androidaps/plugin/general/openhumans/di/Helpers.kt index 807bd04e92..5e6f855c59 100644 --- a/openhumans/src/main/java/info/nightscout/androidaps/plugin/general/openhumans/dagger/Helpers.kt +++ b/openhumans/src/main/java/info/nightscout/androidaps/plugin/general/openhumans/di/Helpers.kt @@ -1,4 +1,4 @@ -package info.nightscout.androidaps.plugin.general.openhumans.dagger +package info.nightscout.androidaps.plugin.general.openhumans.di import androidx.lifecycle.ViewModel import androidx.lifecycle.ViewModelProvider diff --git a/openhumans/src/main/java/info/nightscout/androidaps/plugin/general/openhumans/dagger/OpenHumansModule.kt b/openhumans/src/main/java/info/nightscout/androidaps/plugin/general/openhumans/di/OpenHumansModule.kt similarity index 96% rename from openhumans/src/main/java/info/nightscout/androidaps/plugin/general/openhumans/dagger/OpenHumansModule.kt rename to openhumans/src/main/java/info/nightscout/androidaps/plugin/general/openhumans/di/OpenHumansModule.kt index 41ac8a53e3..41f6c2e2a9 100644 --- a/openhumans/src/main/java/info/nightscout/androidaps/plugin/general/openhumans/dagger/OpenHumansModule.kt +++ b/openhumans/src/main/java/info/nightscout/androidaps/plugin/general/openhumans/di/OpenHumansModule.kt @@ -1,4 +1,4 @@ -package info.nightscout.androidaps.plugin.general.openhumans.dagger +package info.nightscout.androidaps.plugin.general.openhumans.di import androidx.lifecycle.ViewModel import dagger.Binds diff --git a/openhumans/src/main/java/info/nightscout/androidaps/plugin/general/openhumans/ui/OHLoginActivity.kt b/openhumans/src/main/java/info/nightscout/androidaps/plugin/general/openhumans/ui/OHLoginActivity.kt index a2972976a6..5a44d3fc84 100644 --- a/openhumans/src/main/java/info/nightscout/androidaps/plugin/general/openhumans/ui/OHLoginActivity.kt +++ b/openhumans/src/main/java/info/nightscout/androidaps/plugin/general/openhumans/ui/OHLoginActivity.kt @@ -17,8 +17,8 @@ import com.google.android.material.appbar.MaterialToolbar import com.google.android.material.button.MaterialButton import dagger.android.support.DaggerAppCompatActivity import info.nightscout.androidaps.plugin.general.openhumans.R -import info.nightscout.androidaps.plugin.general.openhumans.dagger.AuthUrl -import info.nightscout.androidaps.plugin.general.openhumans.dagger.ViewModelFactory +import info.nightscout.androidaps.plugin.general.openhumans.di.AuthUrl +import info.nightscout.androidaps.plugin.general.openhumans.di.ViewModelFactory import javax.inject.Inject class OHLoginActivity : DaggerAppCompatActivity() { From bbcbf3f90535c719fb70bbcb41c486cc7bf475ad Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Tue, 21 Jun 2022 18:51:55 +0200 Subject: [PATCH 20/44] fix BolusProgressDialog closing --- .../queue/CommandQueueImplementation.kt | 8 ++--- .../androidaps/queue/commands/CommandBolus.kt | 2 +- .../plugins/pump/combo/ComboPlugin.java | 2 +- .../activities/BolusProgressHelperActivity.kt | 2 +- .../androidaps/data/DetailedBolusInfo.kt | 2 ++ .../androidaps/dialogs/BolusProgressDialog.kt | 32 ++++++++++--------- .../androidaps/interfaces/CommandQueue.kt | 2 +- .../EventDismissBolusProgressIfRunning.kt | 2 +- .../events/EventOverviewBolusProgress.kt | 2 +- .../danaRKorean/DanaRKoreanPlugin.kt | 2 +- .../services/DanaRKoreanExecutionService.java | 2 +- .../androidaps/danaRv2/DanaRv2Plugin.java | 9 +++--- .../services/DanaRv2ExecutionService.java | 2 +- .../androidaps/danar/DanaRPlugin.java | 10 +++--- .../AbstractDanaRExecutionService.java | 2 +- .../danar/services/DanaRExecutionService.java | 6 ++-- .../pump/danaR/comm/MsgBolusProgressTest.kt | 2 +- .../pump/danaR/comm/MsgBolusStopTest.kt | 2 +- .../androidaps/danars/DanaRSPlugin.kt | 2 +- .../DanaRSPacketNotifyDeliveryCompleteTest.kt | 2 +- .../DanaRsPacketBolusSetStepBolusStopTest.kt | 2 +- ...naRsPacketNotifyDeliveryRateDisplayTest.kt | 2 +- .../androidaps/diaconn/DiaconnG8Plugin.kt | 2 +- .../pump/insight/LocalInsightPlugin.java | 2 +- .../plugins/pump/common/PumpPluginAbstract.kt | 2 +- 25 files changed, 55 insertions(+), 50 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/queue/CommandQueueImplementation.kt b/app/src/main/java/info/nightscout/androidaps/queue/CommandQueueImplementation.kt index 3f2e2de469..e08da60f0f 100644 --- a/app/src/main/java/info/nightscout/androidaps/queue/CommandQueueImplementation.kt +++ b/app/src/main/java/info/nightscout/androidaps/queue/CommandQueueImplementation.kt @@ -321,9 +321,9 @@ class CommandQueueImplementation @Inject constructor( } @Synchronized - override fun cancelAllBoluses(timestamp: Long) { + override fun cancelAllBoluses(id: Long) { if (!isRunning(CommandType.BOLUS)) { - rxBus.send(EventDismissBolusProgressIfRunning(PumpEnactResult(injector).success(true).enacted(false), timestamp)) + rxBus.send(EventDismissBolusProgressIfRunning(PumpEnactResult(injector).success(true).enacted(false), id)) } removeAll(CommandType.BOLUS) removeAll(CommandType.SMB_BOLUS) @@ -598,12 +598,12 @@ class CommandQueueImplementation @Inject constructor( if (detailedBolusInfo.context != null) { val bolusProgressDialog = BolusProgressDialog() bolusProgressDialog.setInsulin(detailedBolusInfo.insulin) - bolusProgressDialog.setTimestamp(detailedBolusInfo.timestamp) + bolusProgressDialog.setId(detailedBolusInfo.id) bolusProgressDialog.show((detailedBolusInfo.context as AppCompatActivity).supportFragmentManager, "BolusProgress") } else { val i = Intent() i.putExtra("insulin", detailedBolusInfo.insulin) - i.putExtra("timestamp", detailedBolusInfo.timestamp) + i.putExtra("id", detailedBolusInfo.id) i.setClass(context, BolusProgressHelperActivity::class.java) i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK) context.startActivity(i) diff --git a/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandBolus.kt b/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandBolus.kt index d00cfb9857..03c852754d 100644 --- a/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandBolus.kt +++ b/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandBolus.kt @@ -26,7 +26,7 @@ class CommandBolus( val r = activePlugin.activePump.deliverTreatment(detailedBolusInfo) if (r.success) carbsRunnable.run() BolusProgressDialog.bolusEnded = true - rxBus.send(EventDismissBolusProgressIfRunning(r, detailedBolusInfo.timestamp)) + rxBus.send(EventDismissBolusProgressIfRunning(r, detailedBolusInfo.id)) aapsLogger.debug(LTag.PUMPQUEUE, "Result success: ${r.success} enacted: ${r.enacted}") callback?.result(r)?.run() } diff --git a/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ComboPlugin.java b/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ComboPlugin.java index c0d416679a..0c70619feb 100644 --- a/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ComboPlugin.java +++ b/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ComboPlugin.java @@ -566,7 +566,7 @@ public class ComboPlugin extends PumpPluginBase implements Pump, Constraints { return new PumpEnactResult(getInjector()).success(true).enacted(false); } - EventOverviewBolusProgress.Treatment treatment = new EventOverviewBolusProgress.Treatment(0.0, 0, detailedBolusInfo.getBolusType() == DetailedBolusInfo.BolusType.SMB); + EventOverviewBolusProgress.Treatment treatment = new EventOverviewBolusProgress.Treatment(0.0, 0,detailedBolusInfo.getBolusType() == DetailedBolusInfo.BolusType.SMB, detailedBolusInfo.getId()); EventOverviewBolusProgress.INSTANCE.setT(treatment); // start bolus delivery diff --git a/core/src/main/java/info/nightscout/androidaps/activities/BolusProgressHelperActivity.kt b/core/src/main/java/info/nightscout/androidaps/activities/BolusProgressHelperActivity.kt index 063ebe0d7d..9849f642b9 100644 --- a/core/src/main/java/info/nightscout/androidaps/activities/BolusProgressHelperActivity.kt +++ b/core/src/main/java/info/nightscout/androidaps/activities/BolusProgressHelperActivity.kt @@ -9,7 +9,7 @@ class BolusProgressHelperActivity : DialogAppCompatActivity() { BolusProgressDialog() .setHelperActivity(this) .setInsulin(intent.getDoubleExtra("insulin", 0.0)) - .setTimestamp(intent.getLongExtra("timestamp", 0L)) + .setId(intent.getLongExtra("id", 0L)) .show(supportFragmentManager, "BolusProgress") } } \ No newline at end of file diff --git a/core/src/main/java/info/nightscout/androidaps/data/DetailedBolusInfo.kt b/core/src/main/java/info/nightscout/androidaps/data/DetailedBolusInfo.kt index 07be899e6d..36eb63de96 100644 --- a/core/src/main/java/info/nightscout/androidaps/data/DetailedBolusInfo.kt +++ b/core/src/main/java/info/nightscout/androidaps/data/DetailedBolusInfo.kt @@ -14,6 +14,8 @@ import info.nightscout.androidaps.utils.T class DetailedBolusInfo { + val id = System.currentTimeMillis() + // Requesting parameters for driver @JvmField var insulin = 0.0 @JvmField var carbs = 0.0 diff --git a/core/src/main/java/info/nightscout/androidaps/dialogs/BolusProgressDialog.kt b/core/src/main/java/info/nightscout/androidaps/dialogs/BolusProgressDialog.kt index c19f869a71..fd677e751c 100644 --- a/core/src/main/java/info/nightscout/androidaps/dialogs/BolusProgressDialog.kt +++ b/core/src/main/java/info/nightscout/androidaps/dialogs/BolusProgressDialog.kt @@ -48,12 +48,12 @@ class BolusProgressDialog : DaggerDialogFragment() { private var running = true private var amount = 0.0 - var timestamp: Long = 0L + var id: Long = 0L private var state: String? = null private var helpActivity: BolusProgressHelperActivity? = null - fun setTimestamp(timestamp: Long): BolusProgressDialog { - this.timestamp = timestamp + fun setId(id: Long): BolusProgressDialog { + this.id = id return this } @@ -88,7 +88,7 @@ class BolusProgressDialog : DaggerDialogFragment() { override fun onViewCreated(view: View, savedInstanceState: Bundle?) { savedInstanceState?.let { amount = it.getDouble("amount") - timestamp = it.getLong("timestamp") + id = it.getLong("id") state = it.getString("state") ?: rh.gs(R.string.waitingforpump) } binding.title.text = rh.gs(R.string.goingtodeliver, amount) @@ -98,7 +98,7 @@ class BolusProgressDialog : DaggerDialogFragment() { binding.stoppressed.visibility = View.VISIBLE binding.stop.visibility = View.INVISIBLE uel.log(Action.CANCEL_BOLUS, Sources.Overview, state) - commandQueue.cancelAllBoluses(timestamp) + commandQueue.cancelAllBoluses(id) } binding.progressbar.max = 100 binding.status.text = state @@ -127,22 +127,24 @@ class BolusProgressDialog : DaggerDialogFragment() { .toObservable(EventDismissBolusProgressIfRunning::class.java) .observeOn(aapsSchedulers.main) .subscribe({ - aapsLogger.debug(LTag.PUMP, "Running timestamp $timestamp. Close request timestamp ${it.bolusTimestamp}") - if (it.bolusTimestamp == null || it.bolusTimestamp == timestamp) + aapsLogger.debug(LTag.PUMP, "Running id $id. Close request id ${it.id}") + if (it.id == null || it.id == id) if (running) dismiss() }, fabricPrivacy::logException) disposable += rxBus .toObservable(EventOverviewBolusProgress::class.java) .observeOn(aapsSchedulers.main) .subscribe({ - aapsLogger.debug(LTag.UI, "Status: ${it.status} Percent: ${it.percent}") - binding.status.text = it.status - binding.progressbar.progress = it.percent - if (it.percent == 100) { - binding.stop.visibility = View.INVISIBLE - scheduleDismiss() + if (it.t?.id == id) { + aapsLogger.debug(LTag.UI, "Status: ${it.status} Percent: ${it.percent}") + binding.status.text = it.status + binding.progressbar.progress = it.percent + if (it.percent == 100) { + binding.stop.visibility = View.INVISIBLE + scheduleDismiss() + } + state = it.status } - state = it.status }, fabricPrivacy::logException) } @@ -170,7 +172,7 @@ class BolusProgressDialog : DaggerDialogFragment() { super.onSaveInstanceState(outState) outState.putString("state", state) outState.putDouble("amount", amount) - outState.putLong("timestamp", timestamp) + outState.putLong("id", id) } override fun onDestroyView() { diff --git a/core/src/main/java/info/nightscout/androidaps/interfaces/CommandQueue.kt b/core/src/main/java/info/nightscout/androidaps/interfaces/CommandQueue.kt index 8619f43a3a..b81f4fa0fe 100644 --- a/core/src/main/java/info/nightscout/androidaps/interfaces/CommandQueue.kt +++ b/core/src/main/java/info/nightscout/androidaps/interfaces/CommandQueue.kt @@ -17,7 +17,7 @@ interface CommandQueue { fun independentConnect(reason: String, callback: Callback?) fun bolusInQueue(): Boolean fun bolus(detailedBolusInfo: DetailedBolusInfo, callback: Callback?): Boolean - fun cancelAllBoluses(running: Long) + fun cancelAllBoluses(id: Long) fun stopPump(callback: Callback?) fun startPump(callback: Callback?) fun setTBROverNotification(callback: Callback?, enable: Boolean) diff --git a/core/src/main/java/info/nightscout/androidaps/plugins/general/overview/events/EventDismissBolusProgressIfRunning.kt b/core/src/main/java/info/nightscout/androidaps/plugins/general/overview/events/EventDismissBolusProgressIfRunning.kt index dfde13b932..f368691c3b 100644 --- a/core/src/main/java/info/nightscout/androidaps/plugins/general/overview/events/EventDismissBolusProgressIfRunning.kt +++ b/core/src/main/java/info/nightscout/androidaps/plugins/general/overview/events/EventDismissBolusProgressIfRunning.kt @@ -3,4 +3,4 @@ package info.nightscout.androidaps.plugins.general.overview.events import info.nightscout.androidaps.data.PumpEnactResult import info.nightscout.androidaps.events.Event -class EventDismissBolusProgressIfRunning(val result: PumpEnactResult?, val bolusTimestamp: Long?) : Event() \ No newline at end of file +class EventDismissBolusProgressIfRunning(val result: PumpEnactResult?, val id: Long?) : Event() \ No newline at end of file diff --git a/core/src/main/java/info/nightscout/androidaps/plugins/general/overview/events/EventOverviewBolusProgress.kt b/core/src/main/java/info/nightscout/androidaps/plugins/general/overview/events/EventOverviewBolusProgress.kt index 5230bc979c..ba66ac32c0 100644 --- a/core/src/main/java/info/nightscout/androidaps/plugins/general/overview/events/EventOverviewBolusProgress.kt +++ b/core/src/main/java/info/nightscout/androidaps/plugins/general/overview/events/EventOverviewBolusProgress.kt @@ -4,7 +4,7 @@ import info.nightscout.androidaps.events.Event object EventOverviewBolusProgress : Event() { - data class Treatment constructor(@JvmField var insulin: Double = 0.0, @JvmField var carbs: Int = 0, @JvmField var isSMB: Boolean) + data class Treatment constructor(var insulin: Double = 0.0, var carbs: Int = 0, var isSMB: Boolean, var id: Long) var status = "" var t: Treatment? = null diff --git a/danar/src/main/java/info/nightscout/androidaps/danaRKorean/DanaRKoreanPlugin.kt b/danar/src/main/java/info/nightscout/androidaps/danaRKorean/DanaRKoreanPlugin.kt index 55e4139aae..88609dbc9b 100644 --- a/danar/src/main/java/info/nightscout/androidaps/danaRKorean/DanaRKoreanPlugin.kt +++ b/danar/src/main/java/info/nightscout/androidaps/danaRKorean/DanaRKoreanPlugin.kt @@ -122,7 +122,7 @@ class DanaRKoreanPlugin @Inject constructor( detailedBolusInfo.insulin = constraintChecker.applyBolusConstraints(Constraint(detailedBolusInfo.insulin)).value() if (detailedBolusInfo.carbs > 0) throw IllegalArgumentException() return if (detailedBolusInfo.insulin > 0) { - val t = EventOverviewBolusProgress.Treatment(0.0, 0, detailedBolusInfo.bolusType == DetailedBolusInfo.BolusType.SMB) + val t = EventOverviewBolusProgress.Treatment(0.0, 0, detailedBolusInfo.bolusType == DetailedBolusInfo.BolusType.SMB, detailedBolusInfo.id) var connectionOK = false if (detailedBolusInfo.insulin > 0) connectionOK = sExecutionService.bolus(detailedBolusInfo.insulin, detailedBolusInfo.carbs.toInt(), detailedBolusInfo.carbsTimestamp diff --git a/danar/src/main/java/info/nightscout/androidaps/danaRKorean/services/DanaRKoreanExecutionService.java b/danar/src/main/java/info/nightscout/androidaps/danaRKorean/services/DanaRKoreanExecutionService.java index 56efea9bea..75c5ec5079 100644 --- a/danar/src/main/java/info/nightscout/androidaps/danaRKorean/services/DanaRKoreanExecutionService.java +++ b/danar/src/main/java/info/nightscout/androidaps/danaRKorean/services/DanaRKoreanExecutionService.java @@ -278,7 +278,7 @@ public class DanaRKoreanExecutionService extends AbstractDanaRExecutionService { if (!danaPump.getBolusStopped()) { mSerialIOThread.sendMessage(start); } else { - t.insulin = 0d; + t.setInsulin(0d); return false; } while (!danaPump.getBolusStopped() && !start.getFailed()) { diff --git a/danar/src/main/java/info/nightscout/androidaps/danaRv2/DanaRv2Plugin.java b/danar/src/main/java/info/nightscout/androidaps/danaRv2/DanaRv2Plugin.java index 5594689077..1253ef889a 100644 --- a/danar/src/main/java/info/nightscout/androidaps/danaRv2/DanaRv2Plugin.java +++ b/danar/src/main/java/info/nightscout/androidaps/danaRv2/DanaRv2Plugin.java @@ -185,16 +185,17 @@ public class DanaRv2Plugin extends AbstractDanaRPlugin { detailedBolusInfoStorage.add(detailedBolusInfo); // will be picked up on reading history - EventOverviewBolusProgress.Treatment t = new EventOverviewBolusProgress.Treatment(0, 0, detailedBolusInfo.getBolusType() == DetailedBolusInfo.BolusType.SMB); + EventOverviewBolusProgress.Treatment t = new EventOverviewBolusProgress.Treatment(0, 0, detailedBolusInfo.getBolusType() == DetailedBolusInfo.BolusType.SMB, detailedBolusInfo.getId()); boolean connectionOK = false; if (detailedBolusInfo.insulin > 0 || carbs > 0) connectionOK = sExecutionService.bolus(detailedBolusInfo.insulin, (int) carbs, carbTimeStamp, t); PumpEnactResult result = new PumpEnactResult(getInjector()); - result.success(connectionOK && Math.abs(detailedBolusInfo.insulin - t.insulin) < pumpDescription.getBolusStep()) - .bolusDelivered(t.insulin) + result.success(connectionOK && Math.abs(detailedBolusInfo.insulin - t.getInsulin()) < pumpDescription.getBolusStep()) + .bolusDelivered(t.getInsulin()) .carbsDelivered(detailedBolusInfo.carbs); if (!result.getSuccess()) - result.comment(rh.gs(R.string.boluserrorcode, detailedBolusInfo.insulin, t.insulin, danaPump.getBolusStartErrorCode())); + result.comment(rh.gs(R.string.boluserrorcode, detailedBolusInfo.insulin, t.getInsulin(), + danaPump.getBolusStartErrorCode())); else result.comment(R.string.ok); aapsLogger.debug(LTag.PUMP, "deliverTreatment: OK. Asked: " + detailedBolusInfo.insulin + " Delivered: " + result.getBolusDelivered()); diff --git a/danar/src/main/java/info/nightscout/androidaps/danaRv2/services/DanaRv2ExecutionService.java b/danar/src/main/java/info/nightscout/androidaps/danaRv2/services/DanaRv2ExecutionService.java index 19debd1571..ac134cbf4a 100644 --- a/danar/src/main/java/info/nightscout/androidaps/danaRv2/services/DanaRv2ExecutionService.java +++ b/danar/src/main/java/info/nightscout/androidaps/danaRv2/services/DanaRv2ExecutionService.java @@ -362,7 +362,7 @@ public class DanaRv2ExecutionService extends AbstractDanaRExecutionService { if (!danaPump.getBolusStopped()) { mSerialIOThread.sendMessage(start); } else { - t.insulin = 0d; + t.setInsulin(0d); return false; } while (!danaPump.getBolusStopped() && !start.getFailed()) { diff --git a/danar/src/main/java/info/nightscout/androidaps/danar/DanaRPlugin.java b/danar/src/main/java/info/nightscout/androidaps/danar/DanaRPlugin.java index 9640c86b00..1a2e573be2 100644 --- a/danar/src/main/java/info/nightscout/androidaps/danar/DanaRPlugin.java +++ b/danar/src/main/java/info/nightscout/androidaps/danar/DanaRPlugin.java @@ -161,20 +161,20 @@ public class DanaRPlugin extends AbstractDanaRPlugin { public PumpEnactResult deliverTreatment(DetailedBolusInfo detailedBolusInfo) { detailedBolusInfo.insulin = constraintChecker.applyBolusConstraints(new Constraint<>(detailedBolusInfo.insulin)).value(); if (detailedBolusInfo.insulin > 0 || detailedBolusInfo.carbs > 0) { - EventOverviewBolusProgress.Treatment t = new EventOverviewBolusProgress.Treatment(0, 0, detailedBolusInfo.getBolusType() == DetailedBolusInfo.BolusType.SMB); + EventOverviewBolusProgress.Treatment t = new EventOverviewBolusProgress.Treatment(0, 0, detailedBolusInfo.getBolusType() == DetailedBolusInfo.BolusType.SMB, detailedBolusInfo.getId()); boolean connectionOK = false; if (detailedBolusInfo.insulin > 0 || detailedBolusInfo.carbs > 0) connectionOK = sExecutionService.bolus(detailedBolusInfo.insulin, (int) detailedBolusInfo.carbs, detailedBolusInfo.getCarbsTimestamp() != null ? detailedBolusInfo.getCarbsTimestamp() : detailedBolusInfo.timestamp, t); PumpEnactResult result = new PumpEnactResult(getInjector()); - result.success(connectionOK && Math.abs(detailedBolusInfo.insulin - t.insulin) < pumpDescription.getBolusStep()) - .bolusDelivered(t.insulin) + result.success(connectionOK && Math.abs(detailedBolusInfo.insulin - t.getInsulin()) < pumpDescription.getBolusStep()) + .bolusDelivered(t.getInsulin()) .carbsDelivered(detailedBolusInfo.carbs); if (!result.getSuccess()) - result.comment(rh.gs(R.string.boluserrorcode, detailedBolusInfo.insulin, t.insulin, danaPump.getBolusStartErrorCode())); + result.comment(rh.gs(R.string.boluserrorcode, detailedBolusInfo.insulin, t.getInsulin(), danaPump.getBolusStartErrorCode())); else result.comment(R.string.ok); aapsLogger.debug(LTag.PUMP, "deliverTreatment: OK. Asked: " + detailedBolusInfo.insulin + " Delivered: " + result.getBolusDelivered()); - detailedBolusInfo.insulin = t.insulin; + detailedBolusInfo.insulin = t.getInsulin(); detailedBolusInfo.timestamp = System.currentTimeMillis(); if (detailedBolusInfo.insulin > 0) pumpSync.syncBolusWithPumpId( diff --git a/danar/src/main/java/info/nightscout/androidaps/danar/services/AbstractDanaRExecutionService.java b/danar/src/main/java/info/nightscout/androidaps/danar/services/AbstractDanaRExecutionService.java index a1b7cbf09a..2e0b01350c 100644 --- a/danar/src/main/java/info/nightscout/androidaps/danar/services/AbstractDanaRExecutionService.java +++ b/danar/src/main/java/info/nightscout/androidaps/danar/services/AbstractDanaRExecutionService.java @@ -219,7 +219,7 @@ public abstract class AbstractDanaRExecutionService extends DaggerService { } public void bolusStop() { - aapsLogger.debug(LTag.PUMP, "bolusStop >>>>> @ " + (danaPump.getBolusingTreatment() == null ? "" : danaPump.getBolusingTreatment().insulin)); + aapsLogger.debug(LTag.PUMP, "bolusStop >>>>> @ " + (danaPump.getBolusingTreatment() == null ? "" : danaPump.getBolusingTreatment().getInsulin())); MsgBolusStop stop = new MsgBolusStop(injector); danaPump.setBolusStopForced(true); if (isConnected()) { diff --git a/danar/src/main/java/info/nightscout/androidaps/danar/services/DanaRExecutionService.java b/danar/src/main/java/info/nightscout/androidaps/danar/services/DanaRExecutionService.java index 623eae8ec5..e920f2205f 100644 --- a/danar/src/main/java/info/nightscout/androidaps/danar/services/DanaRExecutionService.java +++ b/danar/src/main/java/info/nightscout/androidaps/danar/services/DanaRExecutionService.java @@ -290,7 +290,7 @@ public class DanaRExecutionService extends AbstractDanaRExecutionService { if (!danaPump.getBolusStopped()) { mSerialIOThread.sendMessage(start); } else { - t.insulin = 0d; + t.setInsulin(0d); return false; } while (!danaPump.getBolusStopped() && !start.getFailed()) { @@ -322,7 +322,7 @@ public class DanaRExecutionService extends AbstractDanaRExecutionService { break; } // try to find real amount if bolusing was interrupted or comm failed - if (t.insulin != amount) { + if (t.getInsulin() != amount) { disconnect("bolusingInterrupted"); long bolusDurationInMSec = (long) (amount * speed * 1000); long expectedEnd = bolusStart + bolusDurationInMSec + 3000; @@ -340,7 +340,7 @@ public class DanaRExecutionService extends AbstractDanaRExecutionService { @Override public void run() { if (danaPump.getLastBolusTime() > System.currentTimeMillis() - 60 * 1000L) { // last bolus max 1 min old - t.insulin = danaPump.getLastBolusAmount(); + t.setInsulin(danaPump.getLastBolusAmount()); aapsLogger.debug(LTag.PUMP, "Used bolus amount from history: " + danaPump.getLastBolusAmount()); } else { aapsLogger.debug(LTag.PUMP, "Bolus amount in history too old: " + dateUtil.dateAndTimeString(danaPump.getLastBolusTime())); diff --git a/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgBolusProgressTest.kt b/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgBolusProgressTest.kt index 71d5020152..d1ba83f466 100644 --- a/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgBolusProgressTest.kt +++ b/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgBolusProgressTest.kt @@ -12,7 +12,7 @@ class MsgBolusProgressTest : DanaRTestBase() { @Test fun runTest() { `when`(rh.gs(ArgumentMatchers.eq(R.string.bolusdelivering), ArgumentMatchers.anyDouble())).thenReturn("Delivering %1\$.2fU") - danaPump.bolusingTreatment = EventOverviewBolusProgress.Treatment(0.0, 0, true) + danaPump.bolusingTreatment = EventOverviewBolusProgress.Treatment(0.0, 0, true, 0) danaPump.bolusAmountToBeDelivered = 3.0 val packet = MsgBolusProgress(injector) diff --git a/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgBolusStopTest.kt b/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgBolusStopTest.kt index fa8bdfeb8d..e214357aa8 100644 --- a/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgBolusStopTest.kt +++ b/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgBolusStopTest.kt @@ -11,7 +11,7 @@ class MsgBolusStopTest : DanaRTestBase() { @Test fun runTest() { `when`(rh.gs(R.string.overview_bolusprogress_delivered)).thenReturn("Delivered") - danaPump.bolusingTreatment = EventOverviewBolusProgress.Treatment(0.0, 0, true) + danaPump.bolusingTreatment = EventOverviewBolusProgress.Treatment(0.0, 0, true, 0) val packet = MsgBolusStop(injector) // test message decoding diff --git a/danars/src/main/java/info/nightscout/androidaps/danars/DanaRSPlugin.kt b/danars/src/main/java/info/nightscout/androidaps/danars/DanaRSPlugin.kt index 8d7a08cce6..cfc4e85911 100644 --- a/danars/src/main/java/info/nightscout/androidaps/danars/DanaRSPlugin.kt +++ b/danars/src/main/java/info/nightscout/androidaps/danars/DanaRSPlugin.kt @@ -286,7 +286,7 @@ class DanaRSPlugin @Inject constructor( var carbTimeStamp = detailedBolusInfo.carbsTimestamp ?: detailedBolusInfo.timestamp if (carbTimeStamp == detailedBolusInfo.timestamp) carbTimeStamp -= T.mins(1).msecs() // better set 1 min back to prevents clash with insulin detailedBolusInfoStorage.add(detailedBolusInfo) // will be picked up on reading history - val t = EventOverviewBolusProgress.Treatment(0.0, 0, detailedBolusInfo.bolusType == DetailedBolusInfo.BolusType.SMB) + val t = EventOverviewBolusProgress.Treatment(0.0, 0, detailedBolusInfo.bolusType == DetailedBolusInfo.BolusType.SMB, detailedBolusInfo.id) var connectionOK = false if (detailedBolusInfo.insulin > 0 || carbs > 0) connectionOK = danaRSService?.bolus(detailedBolusInfo.insulin, carbs.toInt(), carbTimeStamp, t) ?: false diff --git a/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRSPacketNotifyDeliveryCompleteTest.kt b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRSPacketNotifyDeliveryCompleteTest.kt index 1728dd08ef..53a1918902 100644 --- a/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRSPacketNotifyDeliveryCompleteTest.kt +++ b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRSPacketNotifyDeliveryCompleteTest.kt @@ -30,7 +30,7 @@ class DanaRSPacketNotifyDeliveryCompleteTest : DanaRSTestBase() { @Test fun runTest() { `when`(rh.gs(anyInt(), anyDouble())).thenReturn("SomeString") - danaPump.bolusingTreatment = EventOverviewBolusProgress.Treatment(0.0, 0, true) + danaPump.bolusingTreatment = EventOverviewBolusProgress.Treatment(0.0, 0, true, 0) val packet = DanaRSPacketNotifyDeliveryComplete(packetInjector) // test params Assert.assertEquals(0, packet.getRequestParams().size) diff --git a/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBolusSetStepBolusStopTest.kt b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBolusSetStepBolusStopTest.kt index 8a980fb52e..9e6c0872c4 100644 --- a/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBolusSetStepBolusStopTest.kt +++ b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBolusSetStepBolusStopTest.kt @@ -29,7 +29,7 @@ class DanaRsPacketBolusSetStepBolusStopTest : DanaRSTestBase() { @Test fun runTest() { `when`(rh.gs(Mockito.anyInt())).thenReturn("SomeString") - danaPump.bolusingTreatment = EventOverviewBolusProgress.Treatment(0.0, 0, true) + danaPump.bolusingTreatment = EventOverviewBolusProgress.Treatment(0.0, 0, true, 0) val testPacket = DanaRSPacketBolusSetStepBolusStop(packetInjector) // test message decoding testPacket.handleMessage(byteArrayOf(0.toByte(), 0.toByte(), 0.toByte())) diff --git a/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketNotifyDeliveryRateDisplayTest.kt b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketNotifyDeliveryRateDisplayTest.kt index de504cf613..61f6ac97a0 100644 --- a/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketNotifyDeliveryRateDisplayTest.kt +++ b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketNotifyDeliveryRateDisplayTest.kt @@ -61,6 +61,6 @@ class DanaRsPacketNotifyDeliveryRateDisplayTest : DanaRSTestBase() { @Before fun mock() { danaRSPlugin = DanaRSPlugin(packetInjector, aapsLogger, aapsSchedulers, rxBus, context, rh, constraintChecker, profileFunction, sp, commandQueue, danaPump, pumpSync, detailedBolusInfoStorage, temporaryBasalStorage, fabricPrivacy, dateUtil) - danaPump.bolusingTreatment = EventOverviewBolusProgress.Treatment(0.0, 0, true) + danaPump.bolusingTreatment = EventOverviewBolusProgress.Treatment(0.0, 0, true, 0) } } \ No newline at end of file diff --git a/diaconn/src/main/java/info/nightscout/androidaps/diaconn/DiaconnG8Plugin.kt b/diaconn/src/main/java/info/nightscout/androidaps/diaconn/DiaconnG8Plugin.kt index 86bb00221a..4bd3d07f22 100644 --- a/diaconn/src/main/java/info/nightscout/androidaps/diaconn/DiaconnG8Plugin.kt +++ b/diaconn/src/main/java/info/nightscout/androidaps/diaconn/DiaconnG8Plugin.kt @@ -256,7 +256,7 @@ class DiaconnG8Plugin @Inject constructor( var carbTimeStamp = detailedBolusInfo.carbsTimestamp ?: detailedBolusInfo.timestamp if (carbTimeStamp == detailedBolusInfo.timestamp) carbTimeStamp -= T.mins(1).msecs() // better set 1 min back to prevents clash with insulin detailedBolusInfoStorage.add(detailedBolusInfo) // will be picked up on reading history - val t = EventOverviewBolusProgress.Treatment(0.0, 0, detailedBolusInfo.bolusType == DetailedBolusInfo.BolusType.SMB) + val t = EventOverviewBolusProgress.Treatment(0.0, 0, detailedBolusInfo.bolusType == DetailedBolusInfo.BolusType.SMB, detailedBolusInfo.id) var connectionOK = false if (detailedBolusInfo.insulin > 0 || carbs > 0) connectionOK = diaconnG8Service?.bolus(detailedBolusInfo.insulin, carbs.toInt(), carbTimeStamp, t) ?: false diff --git a/insight/src/main/java/info/nightscout/androidaps/plugins/pump/insight/LocalInsightPlugin.java b/insight/src/main/java/info/nightscout/androidaps/plugins/pump/insight/LocalInsightPlugin.java index 65ee805c6a..517d1c7ec4 100644 --- a/insight/src/main/java/info/nightscout/androidaps/plugins/pump/insight/LocalInsightPlugin.java +++ b/insight/src/main/java/info/nightscout/androidaps/plugins/pump/insight/LocalInsightPlugin.java @@ -587,7 +587,7 @@ public class LocalInsightPlugin extends PumpPluginBase implements Pump, Constrai bolusCancelled = false; } result.success(true).enacted(true); - EventOverviewBolusProgress.Treatment t = new EventOverviewBolusProgress.Treatment(0, 0, detailedBolusInfo.getBolusType() == DetailedBolusInfo.BolusType.SMB); + EventOverviewBolusProgress.Treatment t = new EventOverviewBolusProgress.Treatment(0, 0, detailedBolusInfo.getBolusType() == DetailedBolusInfo.BolusType.SMB, detailedBolusInfo.getId()); final EventOverviewBolusProgress bolusingEvent = EventOverviewBolusProgress.INSTANCE; bolusingEvent.setT(t); bolusingEvent.setStatus(rh.gs(R.string.insight_delivered, 0d, insulin)); diff --git a/pump-common/src/main/java/info/nightscout/androidaps/plugins/pump/common/PumpPluginAbstract.kt b/pump-common/src/main/java/info/nightscout/androidaps/plugins/pump/common/PumpPluginAbstract.kt index 85dc56b946..00ee367a8c 100644 --- a/pump-common/src/main/java/info/nightscout/androidaps/plugins/pump/common/PumpPluginAbstract.kt +++ b/pump-common/src/main/java/info/nightscout/androidaps/plugins/pump/common/PumpPluginAbstract.kt @@ -329,7 +329,7 @@ abstract class PumpPluginAbstract protected constructor( pumpSyncStorage.addCarbs(PumpDbEntryCarbs(detailedBolusInfo, this)) val bolusingEvent = EventOverviewBolusProgress - bolusingEvent.t = EventOverviewBolusProgress.Treatment(0.0, detailedBolusInfo.carbs.toInt(), detailedBolusInfo.bolusType === DetailedBolusInfo.BolusType.SMB) + bolusingEvent.t = EventOverviewBolusProgress.Treatment(0.0, detailedBolusInfo.carbs.toInt(), detailedBolusInfo.bolusType === DetailedBolusInfo.BolusType.SMB, detailedBolusInfo.id) bolusingEvent.percent = 100 rxBus.send(bolusingEvent) aapsLogger.debug(LTag.PUMP, "deliverTreatment: Carb only treatment.") From a1f9d3a75db89b4eb5084c08de92e39cfdcec225 Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Tue, 21 Jun 2022 21:59:54 +0200 Subject: [PATCH 21/44] Omni: fix BolusProgress --- .../plugins/pump/omnipod/dash/OmnipodDashPumpPlugin.kt | 2 +- .../pump/omnipod/eros/manager/AapsOmnipodErosManager.java | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/OmnipodDashPumpPlugin.kt b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/OmnipodDashPumpPlugin.kt index a7572cf244..739bc204a1 100644 --- a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/OmnipodDashPumpPlugin.kt +++ b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/OmnipodDashPumpPlugin.kt @@ -16,7 +16,6 @@ import info.nightscout.androidaps.extensions.convertedToAbsolute import info.nightscout.androidaps.extensions.plannedRemainingMinutes import info.nightscout.androidaps.extensions.toStringFull import info.nightscout.androidaps.interfaces.* -import info.nightscout.androidaps.interfaces.ResourceHelper import info.nightscout.androidaps.plugins.bus.RxBus import info.nightscout.androidaps.plugins.common.ManufacturerType import info.nightscout.androidaps.plugins.general.actions.defs.CustomAction @@ -577,6 +576,7 @@ class OmnipodDashPumpPlugin @Inject constructor( .comment(rh.gs(R.string.omnipod_dash_bolus_already_in_progress)) } + EventOverviewBolusProgress.t = EventOverviewBolusProgress.Treatment(detailedBolusInfo.insulin, 0, detailedBolusInfo.bolusType == DetailedBolusInfo.BolusType.SMB, detailedBolusInfo.id) var deliveredBolusAmount = 0.0 val beepsConfigurationKey = if (detailedBolusInfo.bolusType == DetailedBolusInfo.BolusType.SMB) diff --git a/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/manager/AapsOmnipodErosManager.java b/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/manager/AapsOmnipodErosManager.java index 04fb055951..faa58d345d 100644 --- a/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/manager/AapsOmnipodErosManager.java +++ b/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/manager/AapsOmnipodErosManager.java @@ -363,6 +363,8 @@ public class AapsOmnipodErosManager { boolean beepsEnabled = detailedBolusInfo.getBolusType() == DetailedBolusInfo.BolusType.SMB ? isSmbBeepsEnabled() : isBolusBeepsEnabled(); + EventOverviewBolusProgress.INSTANCE.setT(new EventOverviewBolusProgress.Treatment(detailedBolusInfo.insulin, 0,detailedBolusInfo.getBolusType() == DetailedBolusInfo.BolusType.SMB, detailedBolusInfo.getId())); + Date bolusStarted; try { bolusCommandResult = executeCommand(() -> delegate.bolus(PumpType.OMNIPOD_EROS.determineCorrectBolusSize(detailedBolusInfo.insulin), beepsEnabled, beepsEnabled, detailedBolusInfo.getBolusType() == DetailedBolusInfo.BolusType.SMB ? null : From 5b383d5201f8e2321cc25d53cc1a433827139c38 Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Wed, 22 Jun 2022 10:05:03 +0200 Subject: [PATCH 22/44] resolve ANR in AutomationPlugin --- .../general/automation/AutomationPlugin.kt | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/automation/src/main/java/info/nightscout/androidaps/plugins/general/automation/AutomationPlugin.kt b/automation/src/main/java/info/nightscout/androidaps/plugins/general/automation/AutomationPlugin.kt index aaa0bf3363..fd941dd6ca 100644 --- a/automation/src/main/java/info/nightscout/androidaps/plugins/general/automation/AutomationPlugin.kt +++ b/automation/src/main/java/info/nightscout/androidaps/plugins/general/automation/AutomationPlugin.kt @@ -148,7 +148,7 @@ class AutomationPlugin @Inject constructor( private fun storeToSP() { val array = JSONArray() - val iterator = ArrayList(automationEvents).iterator() + val iterator = synchronized(this) { automationEvents.toMutableList().iterator() } try { while (iterator.hasNext()) { val event = iterator.next() @@ -161,6 +161,7 @@ class AutomationPlugin @Inject constructor( sp.putString(keyAutomationEvents, array.toString()) } + @Synchronized private fun loadFromSP() { automationEvents.clear() val data = sp.getString(keyAutomationEvents, "") @@ -179,7 +180,7 @@ class AutomationPlugin @Inject constructor( automationEvents.add(AutomationEvent(injector).fromJSON(event, 0)) } - @Synchronized internal fun processActions() { + internal fun processActions() { var commonEventsEnabled = true if (loop.isSuspended || !(loop as PluginBase).isEnabled()) { aapsLogger.debug(LTag.AUTOMATION, "Loop deactivated") @@ -207,7 +208,7 @@ class AutomationPlugin @Inject constructor( } aapsLogger.debug(LTag.AUTOMATION, "processActions") - val iterator: MutableIterator = automationEvents.iterator() + val iterator = synchronized(this) { automationEvents.toMutableList().iterator() } while (iterator.hasNext()) { val event = iterator.next() if (event.isEnabled && !event.userAction && event.shouldRun()) @@ -254,7 +255,7 @@ class AutomationPlugin @Inject constructor( } SystemClock.sleep(1100) event.lastRun = dateUtil.now() - if (event.autoRemove) automationEvents.remove(event) + if (event.autoRemove) remove(event) } } @@ -299,9 +300,12 @@ class AutomationPlugin @Inject constructor( } @Synchronized + fun remove(event: AutomationEvent) { + automationEvents.remove(event) + } + fun at(index: Int) = automationEvents[index] - @Synchronized fun size() = automationEvents.size @Synchronized @@ -309,10 +313,9 @@ class AutomationPlugin @Inject constructor( Collections.swap(automationEvents, fromPosition, toPosition) } - @Synchronized fun userEvents(): List { val list = mutableListOf() - val iterator: MutableIterator = automationEvents.iterator() + val iterator = synchronized(this) { automationEvents.toMutableList().iterator() } while (iterator.hasNext()) { val event = iterator.next() if (event.userAction && event.isEnabled) list.add(event) From ca5fd58ec6f45f14b3a485d7f53bc91d41279259 Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Wed, 22 Jun 2022 10:26:00 +0200 Subject: [PATCH 23/44] NSClient: resolve ConcurrentModificationException --- .../plugins/general/nsclient/NSClientAddUpdateWorker.kt | 3 +++ .../plugins/general/nsclient/services/NSClientService.kt | 7 +------ .../androidaps/plugins/profile/local/LocalProfilePlugin.kt | 2 ++ .../androidaps/plugins/source/NSClientSourcePlugin.kt | 6 +++--- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/NSClientAddUpdateWorker.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/NSClientAddUpdateWorker.kt index 5abed9f9f2..c0b1210cb9 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/NSClientAddUpdateWorker.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/NSClientAddUpdateWorker.kt @@ -28,6 +28,7 @@ import info.nightscout.androidaps.utils.DateUtil import info.nightscout.androidaps.utils.JsonHelper import info.nightscout.androidaps.utils.JsonHelper.safeGetLong import info.nightscout.androidaps.interfaces.BuildHelper +import info.nightscout.androidaps.utils.XDripBroadcast import info.nightscout.shared.sharedPreferences.SP import java.util.concurrent.TimeUnit import javax.inject.Inject @@ -49,6 +50,7 @@ class NSClientAddUpdateWorker( @Inject lateinit var rxBus: RxBus @Inject lateinit var uel: UserEntryLogger @Inject lateinit var virtualPumpPlugin: VirtualPumpPlugin + @Inject lateinit var xDripBroadcast: XDripBroadcast override fun doWork(): Result { val treatments = dataWorker.pickupJSONArray(inputData.getLong(DataWorker.STORE_KEY, -1)) @@ -508,6 +510,7 @@ class NSClientAddUpdateWorker( } } nsClientPlugin.updateLatestDateReceivedIfNewer(latestDateInReceivedData) + xDripBroadcast.sendTreatments(treatments) return ret } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/services/NSClientService.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/services/NSClientService.kt index cd08db55fe..6b12dff07f 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/services/NSClientService.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/services/NSClientService.kt @@ -14,6 +14,7 @@ import info.nightscout.androidaps.database.AppRepository import info.nightscout.androidaps.events.EventAppExit import info.nightscout.androidaps.events.EventConfigBuilderChange import info.nightscout.androidaps.events.EventPreferenceChange +import info.nightscout.androidaps.interfaces.BuildHelper import info.nightscout.androidaps.interfaces.Config import info.nightscout.androidaps.interfaces.DataSyncSelector import info.nightscout.androidaps.interfaces.ResourceHelper @@ -47,8 +48,6 @@ import info.nightscout.androidaps.utils.FabricPrivacy import info.nightscout.androidaps.utils.JsonHelper.safeGetString import info.nightscout.androidaps.utils.JsonHelper.safeGetStringAllowNull import info.nightscout.androidaps.utils.T.Companion.mins -import info.nightscout.androidaps.utils.XDripBroadcast -import info.nightscout.androidaps.interfaces.BuildHelper import info.nightscout.androidaps.utils.rx.AapsSchedulers import info.nightscout.shared.logging.AAPSLogger import info.nightscout.shared.logging.LTag @@ -83,7 +82,6 @@ class NSClientService : DaggerService() { @Inject lateinit var dataWorker: DataWorker @Inject lateinit var dataSyncSelector: DataSyncSelector @Inject lateinit var repository: AppRepository - @Inject lateinit var xDripBroadcast: XDripBroadcast companion object { @@ -473,7 +471,6 @@ class NSClientService : DaggerService() { .setInputData(dataWorker.storeInputData(profileStoreJson)) .build() ) - xDripBroadcast.sendProfile(profileStoreJson) } } if (data.has("treatments")) { @@ -492,7 +489,6 @@ class NSClientService : DaggerService() { .setInputData(dataWorker.storeInputData(addedOrUpdatedTreatments)) .build() ) - xDripBroadcast.sendTreatments(addedOrUpdatedTreatments) } } if (data.has("devicestatus")) { @@ -536,7 +532,6 @@ class NSClientService : DaggerService() { .setInputData(dataWorker.storeInputData(sgvs)) .build() ) - xDripBroadcast.sendSgvs(sgvs) } } rxBus.send(EventNSClientNewLog("LAST", dateUtil.dateAndTimeString(latestDateInReceivedData))) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/profile/local/LocalProfilePlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/profile/local/LocalProfilePlugin.kt index 687ca5adc3..1908e1ef39 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/profile/local/LocalProfilePlugin.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/profile/local/LocalProfilePlugin.kt @@ -461,6 +461,7 @@ class LocalProfilePlugin @Inject constructor( @Inject lateinit var sp: SP @Inject lateinit var config: Config @Inject lateinit var localProfilePlugin: LocalProfilePlugin + @Inject lateinit var xDripBroadcast: XDripBroadcast init { (context.applicationContext as HasAndroidInjector).androidInjector().inject(this) @@ -469,6 +470,7 @@ class LocalProfilePlugin @Inject constructor( override fun doWork(): Result { val profileJson = dataWorker.pickupJSONObject(inputData.getLong(DataWorker.STORE_KEY, -1)) ?: return Result.failure(workDataOf("Error" to "missing input data")) + xDripBroadcast.sendProfile(profileJson) if (sp.getBoolean(R.string.key_ns_receive_profile_store, true) || config.NSCLIENT) { val store = ProfileStore(injector, profileJson, dateUtil) val createdAt = store.getStartDate() diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/source/NSClientSourcePlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/source/NSClientSourcePlugin.kt index 91d313b5a7..6ada149c6d 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/source/NSClientSourcePlugin.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/source/NSClientSourcePlugin.kt @@ -115,11 +115,11 @@ class NSClientSourcePlugin @Inject constructor( @Suppress("SpellCheckingInspection") override fun doWork(): Result { var ret = Result.success() - - if (!nsClientSourcePlugin.isEnabled() && !sp.getBoolean(R.string.key_ns_receive_cgm, false)) return Result.success(workDataOf("Result" to "Sync not enabled")) - val sgvs = dataWorker.pickupJSONArray(inputData.getLong(DataWorker.STORE_KEY, -1)) ?: return Result.failure(workDataOf("Error" to "missing input data")) + xDripBroadcast.sendSgvs(sgvs) + if (!nsClientSourcePlugin.isEnabled() && !sp.getBoolean(R.string.key_ns_receive_cgm, false)) + return Result.success(workDataOf("Result" to "Sync not enabled")) try { var latestDateInReceivedData: Long = 0 From 84cc966e300c4d5ac884c2be42b84fdac8de3162 Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Wed, 22 Jun 2022 14:31:22 +0200 Subject: [PATCH 24/44] revert RandomBgPlugin --- .../androidaps/plugins/source/RandomBgPlugin.kt | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/source/RandomBgPlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/source/RandomBgPlugin.kt index 6558d1a71a..c2115d53e3 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/source/RandomBgPlugin.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/source/RandomBgPlugin.kt @@ -8,15 +8,13 @@ import info.nightscout.androidaps.R import info.nightscout.androidaps.database.AppRepository import info.nightscout.androidaps.database.entities.GlucoseValue import info.nightscout.androidaps.database.transactions.CgmSourceTransaction -import info.nightscout.androidaps.interfaces.BgSource -import info.nightscout.androidaps.interfaces.PluginBase -import info.nightscout.androidaps.interfaces.PluginDescription -import info.nightscout.androidaps.interfaces.PluginType +import info.nightscout.androidaps.interfaces.* import info.nightscout.shared.logging.AAPSLogger import info.nightscout.shared.logging.LTag import info.nightscout.androidaps.utils.T import info.nightscout.androidaps.utils.XDripBroadcast -import info.nightscout.androidaps.interfaces.ResourceHelper +import info.nightscout.androidaps.plugins.pump.virtual.VirtualPumpPlugin +import info.nightscout.androidaps.utils.extensions.isRunningTest import info.nightscout.shared.sharedPreferences.SP import io.reactivex.rxjava3.disposables.CompositeDisposable import io.reactivex.rxjava3.kotlin.plusAssign @@ -33,7 +31,9 @@ class RandomBgPlugin @Inject constructor( aapsLogger: AAPSLogger, private val sp: SP, private val repository: AppRepository, - private val xDripBroadcast: XDripBroadcast + private val xDripBroadcast: XDripBroadcast, + private val virtualPumpPlugin: VirtualPumpPlugin, + private val buildHelper: BuildHelper ) : PluginBase( PluginDescription() .mainType(PluginType.BGSOURCE) @@ -89,8 +89,8 @@ class RandomBgPlugin @Inject constructor( } override fun specialEnableCondition(): Boolean { -// return isRunningTest() || virtualPumpPlugin.isEnabled() && buildHelper.isEngineeringMode() - return true + return isRunningTest() || virtualPumpPlugin.isEnabled() && buildHelper.isEngineeringMode() +// return true } private fun handleNewData() { From 15f48e5c51527f2ba16e7e7e04d00e672c848971 Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Wed, 22 Jun 2022 15:08:37 +0200 Subject: [PATCH 25/44] 3.0.0.2-dev-n --- app/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/build.gradle b/app/build.gradle index 132de499a8..9d2b1a8d80 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -111,7 +111,7 @@ android { defaultConfig { multiDexEnabled true versionCode 1500 - version "3.0.0.2-dev-m" + version "3.0.0.2-dev-n" buildConfigField "String", "VERSION", '"' + version + '"' buildConfigField "String", "BUILDVERSION", '"' + generateGitBuild() + '-' + generateDate() + '"' buildConfigField "String", "REMOTE", '"' + generateGitRemote() + '"' From 43a098ed0919e49156b3c85dc132b45eb1718926 Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Wed, 22 Jun 2022 20:54:40 +0200 Subject: [PATCH 26/44] add BG upload option to NSClient prefs --- app/src/main/res/xml/pref_nsclientinternal.xml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/src/main/res/xml/pref_nsclientinternal.xml b/app/src/main/res/xml/pref_nsclientinternal.xml index bc0a0b3143..bf7ef4678e 100644 --- a/app/src/main/res/xml/pref_nsclientinternal.xml +++ b/app/src/main/res/xml/pref_nsclientinternal.xml @@ -36,6 +36,11 @@ android:summary="@string/ns_upload_summary" android:title="@string/ns_upload" /> + + Date: Thu, 23 Jun 2022 08:35:24 +0200 Subject: [PATCH 27/44] icon color in light theme --- core/src/main/res/values/styles.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/main/res/values/styles.xml b/core/src/main/res/values/styles.xml index a037f3eb49..92c284f9b5 100644 --- a/core/src/main/res/values/styles.xml +++ b/core/src/main/res/values/styles.xml @@ -245,7 +245,7 @@ @color/defaultText - @color/white + @color/black @color/white From cec6595d0b0ea34fbcf6fe9c34500754a88f2933 Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Thu, 23 Jun 2022 10:34:24 +0200 Subject: [PATCH 28/44] RL: tasks -> kt, prevent NPE --- .../tasks/DiscoverGattServicesTask.java | 46 ------- .../service/tasks/DiscoverGattServicesTask.kt | 16 +++ .../tasks/InitializePumpManagerTask.java | 126 ------------------ .../tasks/InitializePumpManagerTask.kt | 65 +++++++++ .../hw/rileylink/service/tasks/PumpTask.java | 19 --- .../hw/rileylink/service/tasks/PumpTask.kt | 7 + .../ResetRileyLinkConfigurationTask.java | 43 ------ .../tasks/ResetRileyLinkConfigurationTask.kt | 22 +++ .../rileylink/service/tasks/ServiceTask.java | 71 ---------- .../hw/rileylink/service/tasks/ServiceTask.kt | 34 +++++ .../service/tasks/ServiceTaskExecutor.java | 53 -------- .../service/tasks/ServiceTaskExecutor.kt | 45 +++++++ .../service/tasks/WakeAndTuneTask.java | 37 ----- .../service/tasks/WakeAndTuneTask.kt | 19 +++ 14 files changed, 208 insertions(+), 395 deletions(-) delete mode 100644 rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/DiscoverGattServicesTask.java create mode 100644 rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/DiscoverGattServicesTask.kt delete mode 100644 rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/InitializePumpManagerTask.java create mode 100644 rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/InitializePumpManagerTask.kt delete mode 100644 rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/PumpTask.java create mode 100644 rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/PumpTask.kt delete mode 100644 rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/ResetRileyLinkConfigurationTask.java create mode 100644 rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/ResetRileyLinkConfigurationTask.kt delete mode 100644 rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/ServiceTask.java create mode 100644 rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/ServiceTask.kt delete mode 100644 rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/ServiceTaskExecutor.java create mode 100644 rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/ServiceTaskExecutor.kt delete mode 100644 rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/WakeAndTuneTask.java create mode 100644 rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/WakeAndTuneTask.kt diff --git a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/DiscoverGattServicesTask.java b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/DiscoverGattServicesTask.java deleted file mode 100644 index 38290e3e60..0000000000 --- a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/DiscoverGattServicesTask.java +++ /dev/null @@ -1,46 +0,0 @@ -package info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.tasks; - -import javax.inject.Inject; - -import dagger.android.HasAndroidInjector; -import info.nightscout.shared.logging.AAPSLogger; -import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkPumpDevice; - -/** - * Created by geoff on 7/9/16. - */ -public class DiscoverGattServicesTask extends ServiceTask { - - - @Inject AAPSLogger aapsLogger; - - public boolean needToConnect = false; - - - public DiscoverGattServicesTask(HasAndroidInjector injector) { - super(injector); - } - - - public DiscoverGattServicesTask(HasAndroidInjector injector, boolean needToConnect) { - super(injector); - this.needToConnect = needToConnect; - } - - - @Override - public void run() { - - if (!isRileyLinkDevice()) { - return; - } - - RileyLinkPumpDevice pumpDevice = (RileyLinkPumpDevice) activePlugin.getActivePump(); - - if (needToConnect) { - pumpDevice.getRileyLinkService().getRileyLinkBLE().connectGatt(); - } - - pumpDevice.getRileyLinkService().getRileyLinkBLE().discoverServices(); - } -} \ No newline at end of file diff --git a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/DiscoverGattServicesTask.kt b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/DiscoverGattServicesTask.kt new file mode 100644 index 0000000000..b0a6123970 --- /dev/null +++ b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/DiscoverGattServicesTask.kt @@ -0,0 +1,16 @@ +package info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.tasks + +import dagger.android.HasAndroidInjector +import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.data.ServiceTransport +import info.nightscout.shared.logging.AAPSLogger +import javax.inject.Inject + +class DiscoverGattServicesTask(injector: HasAndroidInjector, private val needToConnect: Boolean = false) : ServiceTask(injector) { + + @Inject lateinit var aapsLogger: AAPSLogger + + override fun run() { + if (needToConnect) pumpDevice?.rileyLinkService?.rileyLinkBLE?.connectGatt() + pumpDevice?.rileyLinkService?.rileyLinkBLE?.discoverServices() + } +} \ No newline at end of file diff --git a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/InitializePumpManagerTask.java b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/InitializePumpManagerTask.java deleted file mode 100644 index 703cd1c211..0000000000 --- a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/InitializePumpManagerTask.java +++ /dev/null @@ -1,126 +0,0 @@ -package info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.tasks; - -import android.content.Context; - -import java.util.Locale; - -import javax.inject.Inject; - -import dagger.android.HasAndroidInjector; -import info.nightscout.shared.logging.AAPSLogger; -import info.nightscout.shared.logging.LTag; -import info.nightscout.androidaps.plugins.common.ManufacturerType; -import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkCommunicationManager; -import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkConst; -import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkUtil; -import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.defs.RileyLinkTargetFrequency; -import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkError; -import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkPumpDevice; -import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkServiceState; -import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.RileyLinkServiceData; -import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.data.ServiceTransport; -import info.nightscout.androidaps.utils.Round; -import info.nightscout.shared.sharedPreferences.SP; - -/** - * Created by geoff on 7/9/16. - *

- * This class is intended to be run by the Service, for the Service. Not intended for clients to run. - */ -public class InitializePumpManagerTask extends ServiceTask { - - @Inject AAPSLogger aapsLogger; - //@Inject ActivePluginProvider activePlugin; - @Inject SP sp; - @Inject RileyLinkServiceData rileyLinkServiceData; - @Inject RileyLinkUtil rileyLinkUtil; - - private final Context context; - - public InitializePumpManagerTask(HasAndroidInjector injector, Context context) { - super(injector); - this.context = context; - } - - public InitializePumpManagerTask(HasAndroidInjector injector, Context context, ServiceTransport transport) { - super(injector, transport); - this.context = context; - } - - @Override - public void run() { - - if (!isRileyLinkDevice()) { - return; - } - - double lastGoodFrequency; - - if (rileyLinkServiceData.lastGoodFrequency == null) { - - lastGoodFrequency = sp.getDouble(RileyLinkConst.Prefs.LastGoodDeviceFrequency, 0.0d); - lastGoodFrequency = Math.round(lastGoodFrequency * 1000d) / 1000d; - - rileyLinkServiceData.lastGoodFrequency = lastGoodFrequency; - -// if (RileyLinkUtil.getRileyLinkTargetFrequency() == null) { -// String pumpFrequency = SP.getString(MedtronicConst.Prefs.PumpFrequency, null); -// } - } else { - lastGoodFrequency = rileyLinkServiceData.lastGoodFrequency; - } - - /* FIXME this can apparently crash: - Fatal Exception: java.lang.ClassCastException - info.nightscout.androidaps.plugins.pump.virtual.VirtualPumpPlugin - cannot be cast to info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkPumpDevice - */ - RileyLinkCommunicationManager rileyLinkCommunicationManager = ((RileyLinkPumpDevice) activePlugin.getActivePump()).getRileyLinkService().getDeviceCommunicationManager(); - - if (activePlugin.getActivePump().manufacturer() == ManufacturerType.Medtronic) { - - if ((lastGoodFrequency > 0.0d) - && rileyLinkCommunicationManager.isValidFrequency(lastGoodFrequency)) { - - rileyLinkServiceData.setRileyLinkServiceState(RileyLinkServiceState.RileyLinkReady); - - aapsLogger.info(LTag.PUMPBTCOMM, String.format(Locale.ENGLISH, "Setting radio frequency to %.3f MHz", lastGoodFrequency)); - - rileyLinkCommunicationManager.setRadioFrequencyForPump(lastGoodFrequency); - - boolean foundThePump = rileyLinkCommunicationManager.tryToConnectToDevice(); - - if (foundThePump) { - rileyLinkServiceData.setRileyLinkServiceState(RileyLinkServiceState.PumpConnectorReady); - } else { - rileyLinkServiceData.setServiceState(RileyLinkServiceState.PumpConnectorError, - RileyLinkError.NoContactWithDevice); - rileyLinkUtil.sendBroadcastMessage(RileyLinkConst.IPC.MSG_PUMP_tunePump, context); - } - - } else { - rileyLinkUtil.sendBroadcastMessage(RileyLinkConst.IPC.MSG_PUMP_tunePump, context); - } - } else { - - if (!Round.INSTANCE.isSame(lastGoodFrequency, - RileyLinkTargetFrequency.Omnipod.getScanFrequencies()[0])) { - lastGoodFrequency = RileyLinkTargetFrequency.Omnipod.getScanFrequencies()[0]; - lastGoodFrequency = Math.round(lastGoodFrequency * 1000d) / 1000d; - - rileyLinkServiceData.lastGoodFrequency = lastGoodFrequency; - } - - rileyLinkServiceData.setRileyLinkServiceState(RileyLinkServiceState.RileyLinkReady); - rileyLinkServiceData.rileyLinkTargetFrequency = RileyLinkTargetFrequency.Omnipod; // TODO shouldn't be needed - - aapsLogger.info(LTag.PUMPBTCOMM, String.format(Locale.ENGLISH, "Setting radio frequency to %.3f MHz", lastGoodFrequency)); - - rileyLinkCommunicationManager.setRadioFrequencyForPump(lastGoodFrequency); - - rileyLinkServiceData.setRileyLinkServiceState(RileyLinkServiceState.PumpConnectorReady); - - } - } - -} diff --git a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/InitializePumpManagerTask.kt b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/InitializePumpManagerTask.kt new file mode 100644 index 0000000000..2b43ea0ea3 --- /dev/null +++ b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/InitializePumpManagerTask.kt @@ -0,0 +1,65 @@ +package info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.tasks + +import android.content.Context +import dagger.android.HasAndroidInjector +import info.nightscout.androidaps.plugins.common.ManufacturerType +import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkConst +import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkUtil +import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.defs.RileyLinkTargetFrequency +import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkError +import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkServiceState +import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.RileyLinkServiceData +import info.nightscout.androidaps.utils.Round.isSame +import info.nightscout.shared.logging.AAPSLogger +import info.nightscout.shared.logging.LTag +import info.nightscout.shared.sharedPreferences.SP +import javax.inject.Inject +import kotlin.math.roundToLong + +/** + * This class is intended to be run by the Service, for the Service. Not intended for clients to run. + */ +class InitializePumpManagerTask(injector: HasAndroidInjector, private val context: Context) : ServiceTask(injector) { + + @Inject lateinit var aapsLogger: AAPSLogger + @Inject lateinit var sp: SP + @Inject lateinit var rileyLinkServiceData: RileyLinkServiceData + @Inject lateinit var rileyLinkUtil: RileyLinkUtil + + override fun run() { + if (!isRileyLinkDevice) return + + var lastGoodFrequency: Double + if (rileyLinkServiceData.lastGoodFrequency == null) { + lastGoodFrequency = sp.getDouble(RileyLinkConst.Prefs.LastGoodDeviceFrequency, 0.0) + lastGoodFrequency = (lastGoodFrequency * 1000.0).roundToLong() / 1000.0 + rileyLinkServiceData.lastGoodFrequency = lastGoodFrequency + + } else lastGoodFrequency = rileyLinkServiceData.lastGoodFrequency + + val rileyLinkCommunicationManager = pumpDevice?.rileyLinkService?.deviceCommunicationManager + if (activePlugin.activePump.manufacturer() === ManufacturerType.Medtronic) { + if (lastGoodFrequency > 0.0 && rileyLinkCommunicationManager?.isValidFrequency(lastGoodFrequency) == true) { + rileyLinkServiceData.setRileyLinkServiceState(RileyLinkServiceState.RileyLinkReady) + aapsLogger.info(LTag.PUMPBTCOMM, "Setting radio frequency to $lastGoodFrequency MHz") + rileyLinkCommunicationManager.setRadioFrequencyForPump(lastGoodFrequency) + if (rileyLinkCommunicationManager.tryToConnectToDevice()) rileyLinkServiceData.setRileyLinkServiceState(RileyLinkServiceState.PumpConnectorReady) + else { + rileyLinkServiceData.setServiceState(RileyLinkServiceState.PumpConnectorError, RileyLinkError.NoContactWithDevice) + rileyLinkUtil.sendBroadcastMessage(RileyLinkConst.IPC.MSG_PUMP_tunePump, context) + } + } else rileyLinkUtil.sendBroadcastMessage(RileyLinkConst.IPC.MSG_PUMP_tunePump, context) + } else { + if (!isSame(lastGoodFrequency, RileyLinkTargetFrequency.Omnipod.scanFrequencies[0])) { + lastGoodFrequency = RileyLinkTargetFrequency.Omnipod.scanFrequencies[0] + lastGoodFrequency = (lastGoodFrequency * 1000.0).roundToLong() / 1000.0 + rileyLinkServiceData.lastGoodFrequency = lastGoodFrequency + } + rileyLinkServiceData.setRileyLinkServiceState(RileyLinkServiceState.RileyLinkReady) + rileyLinkServiceData.rileyLinkTargetFrequency = RileyLinkTargetFrequency.Omnipod // TODO shouldn't be needed + aapsLogger.info(LTag.PUMPBTCOMM, "Setting radio frequency to $lastGoodFrequency MHz") + rileyLinkCommunicationManager?.setRadioFrequencyForPump(lastGoodFrequency) + rileyLinkServiceData.setRileyLinkServiceState(RileyLinkServiceState.PumpConnectorReady) + } + } +} \ No newline at end of file diff --git a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/PumpTask.java b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/PumpTask.java deleted file mode 100644 index 66aeb7ae07..0000000000 --- a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/PumpTask.java +++ /dev/null @@ -1,19 +0,0 @@ -package info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.tasks; - -import dagger.android.HasAndroidInjector; -import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.data.ServiceTransport; - -/** - * Created by geoff on 7/10/16. - */ -public class PumpTask extends ServiceTask { - - public PumpTask(HasAndroidInjector injector) { - super(injector); - } - - - public PumpTask(HasAndroidInjector injector, ServiceTransport transport) { - super(injector, transport); - } -} diff --git a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/PumpTask.kt b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/PumpTask.kt new file mode 100644 index 0000000000..b32b36b338 --- /dev/null +++ b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/PumpTask.kt @@ -0,0 +1,7 @@ +package info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.tasks + +import dagger.android.HasAndroidInjector +import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.data.ServiceTransport + +open class PumpTask(injector: HasAndroidInjector) : ServiceTask(injector) + diff --git a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/ResetRileyLinkConfigurationTask.java b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/ResetRileyLinkConfigurationTask.java deleted file mode 100644 index 88d1c612f4..0000000000 --- a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/ResetRileyLinkConfigurationTask.java +++ /dev/null @@ -1,43 +0,0 @@ -package info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.tasks; - -import javax.inject.Inject; - -import dagger.android.HasAndroidInjector; -import info.nightscout.androidaps.interfaces.ActivePlugin; -import info.nightscout.androidaps.plugins.bus.RxBus; -import info.nightscout.androidaps.plugins.pump.common.events.EventRefreshButtonState; -import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.RFSpy; -import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkPumpDevice; - -/** - * Created by andy on 9/16/18. - */ -public class ResetRileyLinkConfigurationTask extends PumpTask { - - @Inject ActivePlugin activePlugin; - @Inject RxBus rxBus; - @Inject RFSpy rfSpy; - - public ResetRileyLinkConfigurationTask(HasAndroidInjector injector) { - super(injector); - } - - @Override - public void run() { - - if (!isRileyLinkDevice()) { - return; - } - - RileyLinkPumpDevice rileyLinkPumpDevice = (RileyLinkPumpDevice) activePlugin.getActivePump(); - - rxBus.send(new EventRefreshButtonState(false)); - - rileyLinkPumpDevice.setBusy(true); - rfSpy.resetRileyLinkConfiguration(); - rileyLinkPumpDevice.setBusy(false); - - rxBus.send(new EventRefreshButtonState(true)); - } - -} diff --git a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/ResetRileyLinkConfigurationTask.kt b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/ResetRileyLinkConfigurationTask.kt new file mode 100644 index 0000000000..c0d7e6e136 --- /dev/null +++ b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/ResetRileyLinkConfigurationTask.kt @@ -0,0 +1,22 @@ +package info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.tasks + +import dagger.android.HasAndroidInjector +import info.nightscout.androidaps.plugins.bus.RxBus +import info.nightscout.androidaps.plugins.pump.common.events.EventRefreshButtonState +import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.RFSpy +import javax.inject.Inject + +class ResetRileyLinkConfigurationTask(injector: HasAndroidInjector) : PumpTask(injector) { + + @Inject lateinit var rxBus: RxBus + @Inject lateinit var rfSpy: RFSpy + + override fun run() { + if (!isRileyLinkDevice) return + rxBus.send(EventRefreshButtonState(false)) + pumpDevice?.setBusy(true) + rfSpy.resetRileyLinkConfiguration() + pumpDevice?.setBusy(false) + rxBus.send(EventRefreshButtonState(true)) + } +} \ No newline at end of file diff --git a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/ServiceTask.java b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/ServiceTask.java deleted file mode 100644 index 498344913b..0000000000 --- a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/ServiceTask.java +++ /dev/null @@ -1,71 +0,0 @@ -package info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.tasks; - -import javax.inject.Inject; - -import dagger.android.HasAndroidInjector; -import info.nightscout.androidaps.interfaces.ActivePlugin; -import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkPumpDevice; -import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.data.ServiceTransport; - -/** - * Created by geoff on 7/9/16. - */ -public class ServiceTask implements Runnable { - - @Inject protected ActivePlugin activePlugin; - - public boolean completed = false; - protected ServiceTransport mTransport; - protected HasAndroidInjector injector; - - - public ServiceTask(HasAndroidInjector injector) { - this.injector = injector; - injector.androidInjector().inject(this); - init(new ServiceTransport()); - } - - - public ServiceTask(HasAndroidInjector injector, ServiceTransport transport) { - this.injector = injector; - injector.androidInjector().inject(this); - init(transport); - } - - - public void init(ServiceTransport transport) { - mTransport = transport; - } - - - @Override - public void run() { - } - - - public void preOp() { - // This function is called by UI thread before running asynch thread. - } - - - public void postOp() { - // This function is called by UI thread after running asynch thread. - } - - - public ServiceTransport getServiceTransport() { - return mTransport; - } - - /* - * protected void sendResponse(ServiceResult result) { - * RoundtripService.getInstance().sendServiceTransportResponse(mTransport,result); - * } - */ - - public boolean isRileyLinkDevice() { - return (activePlugin.getActivePump() instanceof RileyLinkPumpDevice); - } - - -} diff --git a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/ServiceTask.kt b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/ServiceTask.kt new file mode 100644 index 0000000000..81e1024244 --- /dev/null +++ b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/ServiceTask.kt @@ -0,0 +1,34 @@ +package info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.tasks + +import dagger.android.HasAndroidInjector +import info.nightscout.androidaps.interfaces.ActivePlugin +import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkPumpDevice +import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.data.ServiceTransport +import javax.inject.Inject + +@Suppress("LeakingThis") +open class ServiceTask constructor(val injector: HasAndroidInjector, val serviceTransport: ServiceTransport = ServiceTransport()) : Runnable { + + @Inject lateinit var activePlugin: ActivePlugin + + var completed = false + + init { + injector.androidInjector().inject(this) + } + + override fun run() {} + + // This function is called by UI thread before running async thread. + fun preOp() {} + + // This function is called by UI thread after running async thread. + fun postOp() {} + + val isRileyLinkDevice: Boolean + get() = activePlugin.activePump is RileyLinkPumpDevice + + val pumpDevice: RileyLinkPumpDevice? + get() = if (isRileyLinkDevice) activePlugin.activePump as RileyLinkPumpDevice else null + +} \ No newline at end of file diff --git a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/ServiceTaskExecutor.java b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/ServiceTaskExecutor.java deleted file mode 100644 index 609b586437..0000000000 --- a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/ServiceTaskExecutor.java +++ /dev/null @@ -1,53 +0,0 @@ -package info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.tasks; - -import java.util.concurrent.LinkedBlockingQueue; -import java.util.concurrent.ThreadPoolExecutor; -import java.util.concurrent.TimeUnit; - -import javax.inject.Inject; -import javax.inject.Singleton; - -import info.nightscout.shared.logging.AAPSLogger; -import info.nightscout.shared.logging.LTag; -import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkUtil; - -/** - * Created by geoff on 7/9/16. - */ -@Singleton -public class ServiceTaskExecutor extends ThreadPoolExecutor { - - @Inject RileyLinkUtil rileyLinkUtil; - @Inject AAPSLogger aapsLogger; - - private static final LinkedBlockingQueue taskQueue = new LinkedBlockingQueue<>(); - - @Inject - public ServiceTaskExecutor() { - super(1, 1, 10000, TimeUnit.MILLISECONDS, taskQueue); - } - - public ServiceTask startTask(ServiceTask task) { - execute(task); // task will be run on async thread from pool. - return task; - } - - // FIXME - @Override protected void beforeExecute(Thread t, Runnable r) { - // This is run on either caller UI thread or Service UI thread. - ServiceTask task = (ServiceTask) r; - aapsLogger.debug(LTag.PUMPBTCOMM, "About to run task " + task.getClass().getSimpleName()); - rileyLinkUtil.setCurrentTask(task); - task.preOp(); - } - - - // FIXME - @Override protected void afterExecute(Runnable r, Throwable t) { - // This is run on either caller UI thread or Service UI thread. - ServiceTask task = (ServiceTask) r; - task.postOp(); - aapsLogger.debug(LTag.PUMPBTCOMM, "Finishing task " + task.getClass().getSimpleName()); - rileyLinkUtil.finishCurrentTask(task); - } -} diff --git a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/ServiceTaskExecutor.kt b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/ServiceTaskExecutor.kt new file mode 100644 index 0000000000..704439a490 --- /dev/null +++ b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/ServiceTaskExecutor.kt @@ -0,0 +1,45 @@ +package info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.tasks + +import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkUtil +import info.nightscout.shared.logging.AAPSLogger +import info.nightscout.shared.logging.LTag +import java.util.concurrent.LinkedBlockingQueue +import java.util.concurrent.ThreadPoolExecutor +import java.util.concurrent.TimeUnit +import javax.inject.Inject +import javax.inject.Singleton + +@Singleton +class ServiceTaskExecutor @Inject constructor() : ThreadPoolExecutor(1, 1, 10000, TimeUnit.MILLISECONDS, taskQueue) { + + @Inject lateinit var rileyLinkUtil: RileyLinkUtil + @Inject lateinit var aapsLogger: AAPSLogger + + companion object { + + private val taskQueue = LinkedBlockingQueue() + } + + fun startTask(task: ServiceTask): ServiceTask { + execute(task) // task will be run on async thread from pool. + return task + } + + // FIXME + override fun beforeExecute(t: Thread, r: Runnable) { + // This is run on either caller UI thread or Service UI thread. + val task = r as ServiceTask + aapsLogger.debug(LTag.PUMPBTCOMM, "About to run task ${task.javaClass.simpleName}") + rileyLinkUtil.setCurrentTask(task) + task.preOp() + } + + // FIXME + override fun afterExecute(r: Runnable, t: Throwable) { + // This is run on either caller UI thread or Service UI thread. + val task = r as ServiceTask + task.postOp() + aapsLogger.debug(LTag.PUMPBTCOMM, "Finishing task ${task.javaClass.simpleName}") + rileyLinkUtil.finishCurrentTask(task) + } +} \ No newline at end of file diff --git a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/WakeAndTuneTask.java b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/WakeAndTuneTask.java deleted file mode 100644 index 67adcd18eb..0000000000 --- a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/WakeAndTuneTask.java +++ /dev/null @@ -1,37 +0,0 @@ -package info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.tasks; - -import javax.inject.Inject; - -import dagger.android.HasAndroidInjector; -import info.nightscout.androidaps.plugins.bus.RxBus; -import info.nightscout.androidaps.plugins.pump.common.events.EventRefreshButtonState; -import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkPumpDevice; - -/** - * Created by geoff on 7/16/16. - */ -public class WakeAndTuneTask extends PumpTask { - - //@Inject ActivePluginProvider activePlugin; - @Inject RxBus rxBus; - - private static final String TAG = "WakeAndTuneTask"; - - public WakeAndTuneTask(HasAndroidInjector injector) { - super(injector); - } - - @Override - public void run() { - if (!isRileyLinkDevice()) { - return; - } - - RileyLinkPumpDevice pumpDevice = (RileyLinkPumpDevice) activePlugin.getActivePump(); - rxBus.send(new EventRefreshButtonState(false)); - pumpDevice.setBusy(true); - pumpDevice.getRileyLinkService().doTuneUpDevice(); - pumpDevice.setBusy(false); - rxBus.send(new EventRefreshButtonState(true)); - } -} diff --git a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/WakeAndTuneTask.kt b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/WakeAndTuneTask.kt new file mode 100644 index 0000000000..dfc3bcd91d --- /dev/null +++ b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/WakeAndTuneTask.kt @@ -0,0 +1,19 @@ +package info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.tasks + +import dagger.android.HasAndroidInjector +import info.nightscout.androidaps.plugins.bus.RxBus +import info.nightscout.androidaps.plugins.pump.common.events.EventRefreshButtonState +import javax.inject.Inject + +class WakeAndTuneTask(injector: HasAndroidInjector) : PumpTask(injector) { + + @Inject lateinit var rxBus: RxBus + + override fun run() { + rxBus.send(EventRefreshButtonState(false)) + pumpDevice?.setBusy(true) + pumpDevice?.rileyLinkService?.doTuneUpDevice() + pumpDevice?.setBusy(false) + rxBus.send(EventRefreshButtonState(true)) + } +} \ No newline at end of file From 1b7ae4e70449b1f9eb6f7ff882ac86d8665899e2 Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Thu, 23 Jun 2022 10:58:29 +0200 Subject: [PATCH 29/44] RL: code cleanup --- .../common/hw/rileylink/RileyLinkUtil.java | 38 ----- .../service/data/ServiceCommand.java | 67 -------- .../service/data/ServiceMessage.java | 40 ----- .../service/data/ServiceNotification.java | 48 ------ .../rileylink/service/data/ServiceResult.java | 96 ----------- .../service/data/ServiceTransport.java | 150 ------------------ .../service/data/ServiceTransportType.java | 15 -- .../service/tasks/DiscoverGattServicesTask.kt | 1 - .../hw/rileylink/service/tasks/PumpTask.kt | 1 - .../hw/rileylink/service/tasks/ServiceTask.kt | 3 +- .../service/tasks/ServiceTaskExecutor.kt | 6 - 11 files changed, 1 insertion(+), 464 deletions(-) delete mode 100644 rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/data/ServiceCommand.java delete mode 100644 rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/data/ServiceMessage.java delete mode 100644 rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/data/ServiceNotification.java delete mode 100644 rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/data/ServiceResult.java delete mode 100644 rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/data/ServiceTransport.java delete mode 100644 rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/data/ServiceTransportType.java diff --git a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/RileyLinkUtil.java b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/RileyLinkUtil.java index 7d80b7d907..8f478d36f2 100644 --- a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/RileyLinkUtil.java +++ b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/RileyLinkUtil.java @@ -20,9 +20,6 @@ import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.data.enco import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.defs.RileyLinkEncodingType; import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.data.BleAdvertisedData; import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.data.RLHistoryItem; -import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.data.ServiceResult; -import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.data.ServiceTransport; -import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.tasks.ServiceTask; import info.nightscout.shared.logging.AAPSLogger; /** @@ -33,7 +30,6 @@ import info.nightscout.shared.logging.AAPSLogger; public class RileyLinkUtil { private final List historyRileyLink = new ArrayList<>(); - private ServiceTask currentTask; private RileyLinkEncodingType encoding; private Encoding4b6b encoding4b6b; @@ -63,40 +59,6 @@ public class RileyLinkUtil { LocalBroadcastManager.getInstance(context).sendBroadcast(intent); } - // FIXME remove ? - public void setCurrentTask(ServiceTask task) { - if (currentTask == null) { - currentTask = task; - } else { - //LOG.error("setCurrentTask: Cannot replace current task"); - } - } - - - public void finishCurrentTask(ServiceTask task) { - if (task != currentTask) { - //LOG.error("finishCurrentTask: task does not match"); - } - // hack to force deep copy of transport contents - ServiceTransport transport = task.getServiceTransport().clone(); - - if (transport.hasServiceResult()) { - sendServiceTransportResponse(transport, transport.getServiceResult()); - } - currentTask = null; - } - - - private static void sendServiceTransportResponse(ServiceTransport transport, ServiceResult serviceResult) { - // get the key (hashcode) of the client who requested this - Integer clientHashcode = transport.getSenderHashcode(); - // make a new bundle to send as the message data - transport.setServiceResult(serviceResult); - // FIXME - // transport.setTransportType(RT2Const.IPC.MSG_ServiceResult); - // rileyLinkIPCConnection.sendTransport(transport, clientHashcode); - } - public static boolean isSame(Double d1, Double d2) { double diff = d1 - d2; diff --git a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/data/ServiceCommand.java b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/data/ServiceCommand.java deleted file mode 100644 index 4f43013328..0000000000 --- a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/data/ServiceCommand.java +++ /dev/null @@ -1,67 +0,0 @@ -package info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.data; - -import android.os.Bundle; - -/** - * Created by geoff on 6/25/16. - */ -public class ServiceCommand extends ServiceMessage { - - public ServiceCommand() { - map = new Bundle(); - } - - - // commandID is a string that the client can set on the message. - // The service does not use this value, but passes it back with the result - // so that the client can identify it. - public ServiceCommand(String commandName, String commandID) { - init(); - map.putString("command", commandName); - map.putString("commandID", commandID); - } - - - public ServiceCommand(Bundle commandBundle) { - if (commandBundle != null) { - map = commandBundle; - } else { - map = new Bundle(); - init(); - map.putString("command", "(null)"); - map.putString("commandID", "(null"); - } - } - - - @Override - public void init() { - map.putString("ServiceMessageType", "ServiceCommand"); - } - - - public String getCommandID() { - return map.getString("commandID"); - } - - - public String getCommandName() { - return map.getString("command"); - } - - - public boolean isPumpCommand() { - switch (getCommandName()) { - case "FetchPumpHistory": - case "ReadPumpClock": - case "RetrieveHistoryPage": - case "ReadISFProfile": - case "ReadBolusWizardCarbProfile": - case "UpdatePumpStatus": - case "WakeAndTune": - return true; - default: - return false; - } - } -} diff --git a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/data/ServiceMessage.java b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/data/ServiceMessage.java deleted file mode 100644 index 83e2f57ade..0000000000 --- a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/data/ServiceMessage.java +++ /dev/null @@ -1,40 +0,0 @@ -package info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.data; - -import android.os.Bundle; - -/** - * Created by geoff on 7/4/16. - *

- * Base class for all messages passed between service and client - */ -public class ServiceMessage { - - protected Bundle map = new Bundle(); - - - public ServiceMessage() { - init(); - } - - - public void init() { - map.putString("ServiceMessageClass", this.getClass().getCanonicalName()); - map.putString("ServiceMessageType", this.getClass().getSimpleName()); - } - - - public Bundle getMap() { - return map; - } - - - public void setMap(Bundle map) { - this.map = map; - } - - - public String getServiceMessageType() { - return map.getString("ServiceMessageType"); - } - -} diff --git a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/data/ServiceNotification.java b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/data/ServiceNotification.java deleted file mode 100644 index aad45093f1..0000000000 --- a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/data/ServiceNotification.java +++ /dev/null @@ -1,48 +0,0 @@ -package info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.data; - -import android.os.Bundle; - -/** - * Created by geoff on 7/6/16. - *

- * These are "one liner" messages between client and service. Must still be contained within ServiceTransports - */ -public class ServiceNotification extends ServiceMessage { - - public ServiceNotification() { - } - - - public ServiceNotification(Bundle b) { - if (b != null) { - if ("ServiceNotification".equals(b.getString("ServiceMessageType"))) { - setMap(b); - } else { - throw new IllegalArgumentException(); - } - } - } - - - public ServiceNotification(String notificationType) { - setNotificationType(notificationType); - } - - - @Override - public void init() { - super.init(); - map.putString("ServiceMessageType", "ServiceNotification"); - } - - - public String getNotificationType() { - return map.getString("NotificationType", ""); - } - - - public void setNotificationType(String notificationType) { - map.putString("NotificationType", notificationType); - } - -} diff --git a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/data/ServiceResult.java b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/data/ServiceResult.java deleted file mode 100644 index ecf7d54f99..0000000000 --- a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/data/ServiceResult.java +++ /dev/null @@ -1,96 +0,0 @@ -package info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.data; - -import android.os.Bundle; - -/** - * Created by geoff on 6/25/16. - */ -public class ServiceResult extends ServiceMessage { - - public static final int ERROR_MALFORMED_PUMP_RESPONSE = 1; - public static final int ERROR_NULL_PUMP_RESPONSE = 2; - public static final int ERROR_INVALID_PUMP_RESPONSE = 3; - public static final int ERROR_PUMP_BUSY = 4; - - - public ServiceResult() { - init(); - } - - - public ServiceResult(Bundle resultBundle) { - if (resultBundle != null) { - setMap(resultBundle); - } else { - init(); - } - } - - - public static final String getErrorDescription(int errorCode) { - switch (errorCode) { - case ERROR_MALFORMED_PUMP_RESPONSE: - return "Malformed Pump Response"; - case ERROR_NULL_PUMP_RESPONSE: - return "Null pump response"; - case ERROR_INVALID_PUMP_RESPONSE: - return "Invalid pump response"; - case ERROR_PUMP_BUSY: - return "A pump command session is already in progress"; - default: - return "Unknown error code (" + errorCode + ")"; - } - } - - - @Override - public void init() { - super.init(); - map.putString("ServiceMessageType", "ServiceResult"); - setServiceResultType(this.getClass().getSimpleName()); - setResultError(0, "Uninitialized ServiceResult"); - } - - - public String getServiceResultType() { - return map.getString("ServiceResultType", "ServiceResult"); - } - - - public void setServiceResultType(String serviceResultType) { - map.putString("ServiceResultType", serviceResultType); - } - - - public void setResultOK() { - map.putString("result", "OK"); - } - - - public void setResultError(int errorCode) { - setResultError(errorCode, getErrorDescription(errorCode)); - } - - - public void setResultError(int errorCode, String errorDescription) { - map.putString("result", "error"); - map.putInt("errorCode", errorCode); - map.putString("errorDescription", errorDescription); - } - - - public boolean resultIsOK() { - return ("OK".equals(map.getString("result", ""))); - } - - - public String getErrorDescription() { - return map.getString("errorDescription", ""); - } - - - public String getResult() { - return map.getString("result", ""); - } - -} diff --git a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/data/ServiceTransport.java b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/data/ServiceTransport.java deleted file mode 100644 index 99fa32f5e9..0000000000 --- a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/data/ServiceTransport.java +++ /dev/null @@ -1,150 +0,0 @@ -package info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.data; - -import android.os.Bundle; -import android.os.Parcel; - -/** - * Created by geoff on 7/6/16. - *

- * This class exists to hold a ServiceCommand along with transport variables such as time sent, time received, sender. - * May also contain result, if the command is completed. - */ -public class ServiceTransport extends ServiceMessage { - - private ServiceTransportType serviceTransportType = ServiceTransportType.Undefined; - - - public ServiceTransport() { - } - - - public ServiceTransport(Bundle b) { - if (b != null) { - if ("ServiceTransport".equals(b.getString("ServiceMessageType"))) { - setMap(b); - } else { - throw new IllegalArgumentException(); - } - } - } - - - @Override - public void init() { - super.init(); - map.putString("ServiceMessageType", "ServiceTransport"); - setTransportType("unknown"); - setSenderHashcode(0); - } - - - public Integer getSenderHashcode() { - return map.getInt("senderHashCode", 0); - } - - - public void setSenderHashcode(Integer senderHashcode) { - map.putInt("senderHashcode", senderHashcode); - } - - - public ServiceCommand getServiceCommand() { - return new ServiceCommand(map.getBundle("ServiceCommand")); - } - - - public void setServiceCommand(ServiceCommand serviceCommand) { - map.putBundle("ServiceCommand", serviceCommand.getMap()); - this.serviceTransportType = ServiceTransportType.ServiceCommand; - } - - - public boolean hasServiceCommand() { - return (getMap().containsKey("ServiceCommand")); - } - - - public String getTransportType() { - return map.getString("transportType", "unknown"); - } - - - // On remote end, this will be converted to the "action" of a local Intent, - // so can be used for separating types of messages to different internal handlers. - public void setTransportType(String transportType) { - map.putString("transportType", transportType); - } - - - public ServiceResult getServiceResult() { - return new ServiceResult(map.getBundle("ServiceResult")); - } - - - public void setServiceResult(ServiceResult serviceResult) { - map.putBundle("ServiceResult", serviceResult.getMap()); - this.serviceTransportType = ServiceTransportType.ServiceResult; - } - - - public boolean hasServiceResult() { - return (getMap().containsKey("ServiceResult")); - } - - - public ServiceNotification getServiceNotification() { - return new ServiceNotification(map.getBundle("ServiceNotification")); - } - - - public void setServiceNotification(ServiceNotification notification) { - map.putBundle("ServiceNotification", notification.getMap()); - this.serviceTransportType = ServiceTransportType.ServiceNotification; - } - - - public boolean hasServiceNotification() { - return (map.containsKey("ServiceNotification")); - } - - - public boolean commandDidCompleteOK() { - return getServiceResult().resultIsOK(); - } - - - public String getOriginalCommandName() { - return getServiceCommand().getCommandName(); - } - - - public String describeContentsShort() { - String rval = ""; - rval += getTransportType(); - - if (this.serviceTransportType == ServiceTransportType.ServiceNotification) { - rval += "note: " + getServiceNotification().getNotificationType(); - } else if (this.serviceTransportType == ServiceTransportType.ServiceCommand) { - rval += ", cmd=" + getOriginalCommandName(); - } else if (this.serviceTransportType == ServiceTransportType.ServiceResult) { - rval += ", cmd=" + getOriginalCommandName(); - rval += ", rslt=" + getServiceResult().getResult(); - rval += ", err=" + getServiceResult().getErrorDescription(); - } - return rval; - } - - - @Override public ServiceTransport clone() { - Parcel p = Parcel.obtain(); - Parcel p2 = Parcel.obtain(); - getMap().writeToParcel(p, 0); - byte[] bytes = p.marshall(); - p2.unmarshall(bytes, 0, bytes.length); - p2.setDataPosition(0); - Bundle b = p2.readBundle(); - ServiceTransport rval = new ServiceTransport(); - rval.setMap(b); - return rval; - } -} diff --git a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/data/ServiceTransportType.java b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/data/ServiceTransportType.java deleted file mode 100644 index 135c217996..0000000000 --- a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/data/ServiceTransportType.java +++ /dev/null @@ -1,15 +0,0 @@ -package info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.data; - -/** - * Created by andy on 31/05/18. - */ - -public enum ServiceTransportType { - - Undefined, // - ServiceNotification, // - - ServiceCommand, // - ServiceResult - -} diff --git a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/DiscoverGattServicesTask.kt b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/DiscoverGattServicesTask.kt index b0a6123970..e3d5a121b7 100644 --- a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/DiscoverGattServicesTask.kt +++ b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/DiscoverGattServicesTask.kt @@ -1,7 +1,6 @@ package info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.tasks import dagger.android.HasAndroidInjector -import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.data.ServiceTransport import info.nightscout.shared.logging.AAPSLogger import javax.inject.Inject diff --git a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/PumpTask.kt b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/PumpTask.kt index b32b36b338..53cca2a306 100644 --- a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/PumpTask.kt +++ b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/PumpTask.kt @@ -1,7 +1,6 @@ package info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.tasks import dagger.android.HasAndroidInjector -import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.data.ServiceTransport open class PumpTask(injector: HasAndroidInjector) : ServiceTask(injector) diff --git a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/ServiceTask.kt b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/ServiceTask.kt index 81e1024244..34fdf4e050 100644 --- a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/ServiceTask.kt +++ b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/ServiceTask.kt @@ -3,11 +3,10 @@ package info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.task import dagger.android.HasAndroidInjector import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkPumpDevice -import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.data.ServiceTransport import javax.inject.Inject @Suppress("LeakingThis") -open class ServiceTask constructor(val injector: HasAndroidInjector, val serviceTransport: ServiceTransport = ServiceTransport()) : Runnable { +open class ServiceTask constructor(val injector: HasAndroidInjector) : Runnable { @Inject lateinit var activePlugin: ActivePlugin diff --git a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/ServiceTaskExecutor.kt b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/ServiceTaskExecutor.kt index 704439a490..36494bb17b 100644 --- a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/ServiceTaskExecutor.kt +++ b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/ServiceTaskExecutor.kt @@ -1,6 +1,5 @@ package info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.tasks -import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkUtil import info.nightscout.shared.logging.AAPSLogger import info.nightscout.shared.logging.LTag import java.util.concurrent.LinkedBlockingQueue @@ -12,7 +11,6 @@ import javax.inject.Singleton @Singleton class ServiceTaskExecutor @Inject constructor() : ThreadPoolExecutor(1, 1, 10000, TimeUnit.MILLISECONDS, taskQueue) { - @Inject lateinit var rileyLinkUtil: RileyLinkUtil @Inject lateinit var aapsLogger: AAPSLogger companion object { @@ -25,21 +23,17 @@ class ServiceTaskExecutor @Inject constructor() : ThreadPoolExecutor(1, 1, 10000 return task } - // FIXME override fun beforeExecute(t: Thread, r: Runnable) { // This is run on either caller UI thread or Service UI thread. val task = r as ServiceTask aapsLogger.debug(LTag.PUMPBTCOMM, "About to run task ${task.javaClass.simpleName}") - rileyLinkUtil.setCurrentTask(task) task.preOp() } - // FIXME override fun afterExecute(r: Runnable, t: Throwable) { // This is run on either caller UI thread or Service UI thread. val task = r as ServiceTask task.postOp() aapsLogger.debug(LTag.PUMPBTCOMM, "Finishing task ${task.javaClass.simpleName}") - rileyLinkUtil.finishCurrentTask(task) } } \ No newline at end of file From f0a37d64f36f5c62787d6294ccbda880ce1485c2 Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Thu, 23 Jun 2022 15:25:17 +0200 Subject: [PATCH 30/44] Eliminate use of Date() --- .../general/maintenance/MaintenancePlugin.kt | 2 +- .../nsclient/events/EventNSClientNewLog.kt | 2 +- .../omnipod/dash/OmnipodDashPumpPlugin.kt | 91 ++++++++----------- .../driver/pod/definition/BasalProgram.kt | 4 +- .../dash/ui/OmnipodDashOverviewFragment.kt | 41 ++++----- .../general/openhumans/OpenHumansUploader.kt | 6 +- 6 files changed, 65 insertions(+), 81 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/MaintenancePlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/MaintenancePlugin.kt index 0c466e7027..e02c373bde 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/MaintenancePlugin.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/MaintenancePlugin.kt @@ -148,7 +148,7 @@ class MaintenancePlugin @Inject constructor( * @return */ private fun constructName(): String { - return "AndroidAPS_LOG_" + Date().time + loggerUtils.suffix + return "AndroidAPS_LOG_" + System.currentTimeMillis() + loggerUtils.suffix } private fun zip(zipFile: File?, files: List) { diff --git a/core/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/events/EventNSClientNewLog.kt b/core/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/events/EventNSClientNewLog.kt index 72d36e4a84..8d0aa9fac2 100644 --- a/core/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/events/EventNSClientNewLog.kt +++ b/core/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/events/EventNSClientNewLog.kt @@ -5,7 +5,7 @@ import java.text.SimpleDateFormat import java.util.* class EventNSClientNewLog(var action: String, var logText: String) : Event() { - var date = Date() + var date = System.currentTimeMillis() private var timeFormat = SimpleDateFormat("HH:mm:ss", Locale.getDefault()) diff --git a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/OmnipodDashPumpPlugin.kt b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/OmnipodDashPumpPlugin.kt index 739bc204a1..84aa19951d 100644 --- a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/OmnipodDashPumpPlugin.kt +++ b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/OmnipodDashPumpPlugin.kt @@ -85,6 +85,7 @@ class OmnipodDashPumpPlugin @Inject constructor( rh: ResourceHelper, commandQueue: CommandQueue ) : PumpPluginBase(pluginDescription, injector, aapsLogger, rh, commandQueue), Pump { + @Volatile var bolusCanceled = false @Volatile var bolusDeliveryInProgress = false @@ -95,6 +96,7 @@ class OmnipodDashPumpPlugin @Inject constructor( private var disposables: CompositeDisposable = CompositeDisposable() companion object { + private const val BOLUS_RETRY_INTERVAL_MS = 2000.toLong() private const val BOLUS_RETRIES = 5 // number of retries for cancel/get bolus status private const val STATUS_CHECK_INTERVAL_MS = (60L * 1000) @@ -460,22 +462,10 @@ class OmnipodDashPumpPlugin @Inject constructor( .observeOn(aapsSchedulers.main) .subscribe( { - if (it.isChanged( - rh, - R.string.key_omnipod_common_expiration_reminder_enabled - ) || - it.isChanged( - rh, - R.string.key_omnipod_common_expiration_reminder_hours_before_shutdown - ) || - it.isChanged( - rh, - R.string.key_omnipod_common_low_reservoir_alert_enabled - ) || - it.isChanged( - rh, - R.string.key_omnipod_common_low_reservoir_alert_units - ) + if (it.isChanged(rh, R.string.key_omnipod_common_expiration_reminder_enabled) || + it.isChanged(rh, R.string.key_omnipod_common_expiration_reminder_hours_before_shutdown) || + it.isChanged(rh, R.string.key_omnipod_common_low_reservoir_alert_enabled) || + it.isChanged(rh, R.string.key_omnipod_common_low_reservoir_alert_units) ) { commandQueue.customCommand(CommandUpdateAlertConfiguration(), null) } @@ -519,7 +509,7 @@ class OmnipodDashPumpPlugin @Inject constructor( override val baseBasalRate: Double get() { - val date = Date() + val date = System.currentTimeMillis() val ret = podStateManager.basalProgram?.rateAt(date) ?: 0.0 aapsLogger.info(LTag.PUMP, "baseBasalRate: $ret at $date}") return if (podStateManager.alarmType != null) { @@ -626,20 +616,15 @@ class OmnipodDashPumpPlugin @Inject constructor( ) } else { if (podStateManager.activeCommand != null) { - val sound = if (sp.getBoolean( - R.string - .key_omnipod_common_notification_uncertain_bolus_sound_enabled, - true - ) - ) - R.raw.boluserror - else - 0 + val sound = + if (sp.getBoolean( + R.string + .key_omnipod_common_notification_uncertain_bolus_sound_enabled, true + ) + ) R.raw.boluserror + else 0 - showErrorDialog( - "Bolus delivery status uncertain. Refresh pod status to confirm or deny.", - sound - ) + showErrorDialog("Bolus delivery status uncertain. Refresh pod status to confirm or deny.", sound) } } }.toSingle { @@ -1000,12 +985,9 @@ class OmnipodDashPumpPlugin @Inject constructor( val extended = JSONObject() try { val podStatus = when { - podStateManager.isPodRunning && podStateManager.isSuspended -> - "suspended" - podStateManager.isPodRunning -> - "normal" - else -> - "no active Pod" + podStateManager.isPodRunning && podStateManager.isSuspended -> "suspended" + podStateManager.isPodRunning -> "normal" + else -> "no active Pod" } status.put("status", podStatus) status.put("timestamp", dateUtil.toISOString(podStateManager.lastUpdatedSystem)) @@ -1108,21 +1090,22 @@ class OmnipodDashPumpPlugin @Inject constructor( override fun executeCustomCommand(customCommand: CustomCommand): PumpEnactResult { return when (customCommand) { - is CommandSilenceAlerts -> + is CommandSilenceAlerts -> silenceAlerts() - is CommandResumeDelivery -> + is CommandResumeDelivery -> resumeDelivery() - is CommandDeactivatePod -> + is CommandDeactivatePod -> deactivatePod() - is CommandHandleTimeChange -> + is CommandHandleTimeChange -> handleTimeChange() is CommandUpdateAlertConfiguration -> updateAlertConfiguration() - is CommandPlayTestBeep -> + is CommandPlayTestBeep -> playTestBeep() - is CommandDisableSuspendAlerts -> + is CommandDisableSuspendAlerts -> disableSuspendAlerts() - else -> { + + else -> { aapsLogger.warn(LTag.PUMP, "Unsupported custom command: " + customCommand.javaClass.name) PumpEnactResult(injector).success(false).enacted(false).comment( rh.gs( @@ -1231,10 +1214,11 @@ class OmnipodDashPumpPlugin @Inject constructor( expirationHours, lowReservoirAlertEnabled, lowReservoirAlertUnits - ) -> { + ) -> { aapsLogger.debug(LTag.PUMP, "Ignoring updateAlertConfiguration because the settings did not change") return PumpEnactResult(injector).success(true).enacted(false) } + !podStateManager.isPodRunning -> { aapsLogger.debug(LTag.PUMP, "Ignoring updateAlertConfiguration because there is no active pod") return PumpEnactResult(injector).success(true).enacted(false) @@ -1356,7 +1340,8 @@ class OmnipodDashPumpPlugin @Inject constructor( } rxBus.send(EventDismissNotification(Notification.OMNIPOD_TBR_ALERTS)) } - OmnipodCommandType.RESUME_DELIVERY -> { + + OmnipodCommandType.RESUME_DELIVERY -> { // We can't invalidate this command, // and this is why it is pumpSync-ed at this point if (confirmation.success) { @@ -1375,7 +1360,7 @@ class OmnipodDashPumpPlugin @Inject constructor( } } - OmnipodCommandType.SET_BASAL_PROFILE -> { + OmnipodCommandType.SET_BASAL_PROFILE -> { if (confirmation.success) { podStateManager.basalProgram = command.basalProgram if (podStateManager.basalProgram == null) { @@ -1399,7 +1384,7 @@ class OmnipodDashPumpPlugin @Inject constructor( } } - OmnipodCommandType.SET_TEMPORARY_BASAL -> { + OmnipodCommandType.SET_TEMPORARY_BASAL -> { // This treatment was synced before sending the command if (!confirmation.success) { aapsLogger.info(LTag.PUMPCOMM, "temporary basal denied. PumpId: ${historyEntry.pumpId()}") @@ -1414,7 +1399,7 @@ class OmnipodDashPumpPlugin @Inject constructor( rxBus.send(EventDismissNotification(Notification.OMNIPOD_TBR_ALERTS)) } - OmnipodCommandType.SUSPEND_DELIVERY -> { + OmnipodCommandType.SUSPEND_DELIVERY -> { if (!confirmation.success) { pumpSync.invalidateTemporaryBasalWithPumpId( historyEntry.pumpId(), @@ -1426,7 +1411,7 @@ class OmnipodDashPumpPlugin @Inject constructor( } } - OmnipodCommandType.SET_BOLUS -> { + OmnipodCommandType.SET_BOLUS -> { if (confirmation.success) { if (command.requestedBolus == null) { aapsLogger.error(LTag.PUMP, "Requested bolus not found: $command") @@ -1459,7 +1444,7 @@ class OmnipodDashPumpPlugin @Inject constructor( rxBus.send(EventDismissNotification(Notification.OMNIPOD_UNCERTAIN_SMB)) } - OmnipodCommandType.CANCEL_BOLUS -> { + OmnipodCommandType.CANCEL_BOLUS -> { if (confirmation.success) { podStateManager.lastBolus?.run { val deliveredUnits = markComplete() @@ -1481,7 +1466,7 @@ class OmnipodDashPumpPlugin @Inject constructor( } } - else -> + else -> aapsLogger.warn( LTag.PUMP, "Will not sync confirmed command of type: $historyEntry and " + @@ -1508,13 +1493,13 @@ class OmnipodDashPumpPlugin @Inject constructor( private fun soundEnabledForNotificationType(notificationType: Int): Boolean { return when (notificationType) { - Notification.OMNIPOD_TBR_ALERTS -> + Notification.OMNIPOD_TBR_ALERTS -> sp.getBoolean(R.string.key_omnipod_common_notification_uncertain_tbr_sound_enabled, true) Notification.OMNIPOD_UNCERTAIN_SMB -> sp.getBoolean(R.string.key_omnipod_common_notification_uncertain_smb_sound_enabled, true) Notification.OMNIPOD_POD_SUSPENDED -> sp.getBoolean(R.string.key_omnipod_common_notification_delivery_suspended_sound_enabled, true) - else -> true + else -> true } } } diff --git a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/definition/BasalProgram.kt b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/definition/BasalProgram.kt index 993874b5e3..69e9037c28 100644 --- a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/definition/BasalProgram.kt +++ b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/definition/BasalProgram.kt @@ -15,9 +15,9 @@ class BasalProgram( fun hasZeroUnitSegments() = segments.any { it.basalRateInHundredthUnitsPerHour == 0 } - fun rateAt(date: Date): Double { + fun rateAt(date: Long): Double { val instance = Calendar.getInstance() - instance.time = date + instance.timeInMillis = date val hourOfDay = instance[Calendar.HOUR_OF_DAY] val minuteOfHour = instance[Calendar.MINUTE] val slotIndex = hourOfDay * 2 + minuteOfHour.div(30) diff --git a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/ui/OmnipodDashOverviewFragment.kt b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/ui/OmnipodDashOverviewFragment.kt index 49e03984fe..9d28dc6485 100644 --- a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/ui/OmnipodDashOverviewFragment.kt +++ b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/ui/OmnipodDashOverviewFragment.kt @@ -13,6 +13,7 @@ import info.nightscout.androidaps.Constants import info.nightscout.androidaps.activities.ErrorHelperActivity import info.nightscout.androidaps.events.EventPreferenceChange import info.nightscout.androidaps.events.EventPumpStatusChanged +import info.nightscout.androidaps.interfaces.BuildHelper import info.nightscout.androidaps.interfaces.CommandQueue import info.nightscout.androidaps.interfaces.PumpSync import info.nightscout.androidaps.interfaces.ResourceHelper @@ -39,7 +40,6 @@ import info.nightscout.androidaps.queue.events.EventQueueChanged import info.nightscout.androidaps.utils.DateUtil import info.nightscout.androidaps.utils.FabricPrivacy import info.nightscout.androidaps.utils.alertDialogs.OKDialog -import info.nightscout.androidaps.interfaces.BuildHelper import info.nightscout.androidaps.utils.protection.ProtectionCheck import info.nightscout.androidaps.utils.rx.AapsSchedulers import info.nightscout.androidaps.utils.ui.UIRunnable @@ -52,7 +52,6 @@ import java.time.ZonedDateTime import java.util.* import java.util.concurrent.TimeUnit import javax.inject.Inject -import kotlin.collections.ArrayList // TODO generify; see OmnipodErosOverviewFragment class OmnipodDashOverviewFragment : DaggerFragment() { @@ -274,7 +273,7 @@ class OmnipodDashOverviewFragment : DaggerFragment() { R.attr.warningColor connectionSuccessPercentage < 90 && podStateManager.successfulConnectionAttemptsAfterRetries > 50 -> R.attr.omniYellowColor - else -> + else -> R.attr.defaultTextColor } ) @@ -343,9 +342,9 @@ class OmnipodDashOverviewFragment : DaggerFragment() { when { !podStateManager.sameTimeZone -> R.attr.omniMagentaColor - timeDeviationTooBig -> + timeDeviationTooBig -> R.attr.omniYellowColor - else -> + else -> R.attr.defaultTextColor } ) @@ -361,11 +360,11 @@ class OmnipodDashOverviewFragment : DaggerFragment() { rh.gac( context, when { - expiresAt != null && ZonedDateTime.now().isAfter(expiresAt) -> + expiresAt != null && ZonedDateTime.now().isAfter(expiresAt) -> R.attr.warningColor expiresAt != null && ZonedDateTime.now().isAfter(expiresAt.minusHours(4)) -> R.attr.omniYellowColor - else -> + else -> R.attr.defaultTextColor } ) @@ -387,7 +386,7 @@ class OmnipodDashOverviewFragment : DaggerFragment() { rh.gs( R.string.pump_basebasalrate, omnipodDashPumpPlugin.model() - .determineCorrectBasalSize(podStateManager.basalProgram!!.rateAt(Date())) + .determineCorrectBasalSize(podStateManager.basalProgram!!.rateAt(System.currentTimeMillis())) ) } else { PLACEHOLDER @@ -447,21 +446,21 @@ class OmnipodDashOverviewFragment : DaggerFragment() { private fun translatedActiveAlert(alert: AlertType): String { val id = when (alert) { - AlertType.LOW_RESERVOIR -> + AlertType.LOW_RESERVOIR -> R.string.omnipod_common_alert_low_reservoir - AlertType.EXPIRATION -> + AlertType.EXPIRATION -> R.string.omnipod_common_alert_expiration_advisory AlertType.EXPIRATION_IMMINENT -> R.string.omnipod_common_alert_expiration AlertType.USER_SET_EXPIRATION -> R.string.omnipod_common_alert_expiration_advisory - AlertType.AUTO_OFF -> + AlertType.AUTO_OFF -> R.string.omnipod_common_alert_shutdown_imminent AlertType.SUSPEND_IN_PROGRESS -> R.string.omnipod_common_alert_delivery_suspended - AlertType.SUSPEND_ENDED -> + AlertType.SUSPEND_ENDED -> R.string.omnipod_common_alert_delivery_suspended - else -> + else -> R.string.omnipod_common_alert_unknown_alert } return rh.gs(id) @@ -474,7 +473,7 @@ class OmnipodDashOverviewFragment : DaggerFragment() { System.currentTimeMillis() - podStateManager.lastUpdatedSystem, - ) + ) ) val lastConnectionColor = rh.gac( @@ -528,9 +527,9 @@ class OmnipodDashOverviewFragment : DaggerFragment() { when { !podStateManager.isActivationCompleted || podStateManager.isPodKaput || podStateManager.isSuspended -> R.attr.warningColor - podStateManager.activeCommand != null -> + podStateManager.activeCommand != null -> R.attr.omniYellowColor - else -> + else -> R.attr.defaultTextColor } ) @@ -628,7 +627,7 @@ class OmnipodDashOverviewFragment : DaggerFragment() { private fun updateRefreshStatusButton() { buttonBinding.buttonRefreshStatus.isEnabled = podStateManager.isUniqueIdSet && - isQueueEmpty() + isQueueEmpty() } private fun updateResumeDeliveryButton() { @@ -695,15 +694,15 @@ class OmnipodDashOverviewFragment : DaggerFragment() { val minutes = duration.toMinutes().toInt() val seconds = duration.seconds when { - seconds < 10 -> { + seconds < 10 -> { return rh.gs(R.string.omnipod_common_moments_ago) } - seconds < 60 -> { + seconds < 60 -> { return rh.gs(R.string.omnipod_common_less_than_a_minute_ago) } - seconds < 60 * 60 -> { // < 1 hour + seconds < 60 * 60 -> { // < 1 hour return rh.gs( R.string.omnipod_common_time_ago, rh.gq(R.plurals.omnipod_common_minutes, minutes, minutes) @@ -727,7 +726,7 @@ class OmnipodDashOverviewFragment : DaggerFragment() { ) } - else -> { + else -> { val days = hours / 24 val hoursLeft = hours % 24 if (hoursLeft > 0) diff --git a/openhumans/src/main/java/info/nightscout/androidaps/plugin/general/openhumans/OpenHumansUploader.kt b/openhumans/src/main/java/info/nightscout/androidaps/plugin/general/openhumans/OpenHumansUploader.kt index b9ff7329bf..26d5657f8e 100644 --- a/openhumans/src/main/java/info/nightscout/androidaps/plugin/general/openhumans/OpenHumansUploader.kt +++ b/openhumans/src/main/java/info/nightscout/androidaps/plugin/general/openhumans/OpenHumansUploader.kt @@ -247,12 +247,12 @@ class OpenHumansUploader @Inject internal constructor( tags.add("DisplayInfo") val uploadNumber = this.uploadCounter++ - val uploadDate = Date() + val uploadDate = System.currentTimeMillis() val uploadInfo = JSONObject() uploadInfo.put("fileVersion", 2) uploadInfo.put("counter", uploadNumber) uploadInfo.put("timestamp", until) - uploadInfo.put("utcOffset", TimeZone.getDefault().getOffset(uploadDate.time)) + uploadInfo.put("utcOffset", TimeZone.getDefault().getOffset(uploadDate)) zos.writeFile("UploadInfo.json", uploadInfo.toString().toByteArray()) tags.add("UploadInfo") @@ -521,7 +521,7 @@ class OpenHumansUploader @Inject internal constructor( tags = tags, description = "AndroidAPS Database Upload", md5 = MessageDigest.getInstance("MD5").digest(bytes).toHexString(), - creationDate = uploadDate.time + creationDate = uploadDate ) refreshAccessTokenIfNeeded() From 1add8207420e1cfae2d109a72960a791ba12f11d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 24 Jun 2022 08:26:59 +0000 Subject: [PATCH 31/44] Bump firebase-crashlytics-gradle from 2.9.0 to 2.9.1 Bumps firebase-crashlytics-gradle from 2.9.0 to 2.9.1. --- updated-dependencies: - dependency-name: com.google.firebase:firebase-crashlytics-gradle dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 2c78775b78..f4ac0a131f 100644 --- a/build.gradle +++ b/build.gradle @@ -50,7 +50,7 @@ buildscript { dependencies { classpath 'com.android.tools.build:gradle:7.2.1' classpath 'com.google.gms:google-services:4.3.10' - classpath 'com.google.firebase:firebase-crashlytics-gradle:2.9.0' + classpath 'com.google.firebase:firebase-crashlytics-gradle:2.9.1' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files From 0f92e5409d22324f739c4b68e46e8043ff3f7b7a Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Fri, 24 Jun 2022 13:34:11 +0200 Subject: [PATCH 32/44] fix strings %% --- app/src/main/res/values/strings.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 269dd9a883..cb0b891cfe 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -520,8 +520,8 @@ OpenAPS SMB Dynamic ISF DynISFAdjust - DynamicISF Adjustment Factor %% - Adjustment factor for DynamicISF. Set more than 100%% for more aggressive correction doses, and less than 100%% for less aggressive corrections. + DynamicISF Adjustment Factor % + Adjustment factor for DynamicISF. Set more than 100% for more aggressive correction doses, and less than 100% for less aggressive corrections. use_smb use_uam smb_enable_carbs_suggestions_threshold From 0774aa46d0afec7140f6913e1845415cee5ee025 Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Sat, 25 Jun 2022 10:17:59 +0200 Subject: [PATCH 33/44] prevent NPE --- .../nightscout/androidaps/dialogs/CarbsDialog.kt | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/dialogs/CarbsDialog.kt b/app/src/main/java/info/nightscout/androidaps/dialogs/CarbsDialog.kt index cd9eedaeb5..7c73776689 100644 --- a/app/src/main/java/info/nightscout/androidaps/dialogs/CarbsDialog.kt +++ b/app/src/main/java/info/nightscout/androidaps/dialogs/CarbsDialog.kt @@ -143,7 +143,7 @@ class CarbsDialog : DialogFragmentWithDate() { ) val plus1text = toSignedString(sp.getInt(R.string.key_carbs_button_increment_1, FAV1_DEFAULT)) binding.plus1.text = plus1text - binding.plus1.contentDescription = rh.gs(R.string.treatments_wizard_carbs_label) + " " + plus1text + binding.plus1.contentDescription = rh.gs(R.string.treatments_wizard_carbs_label) + " " + plus1text binding.plus1.setOnClickListener { binding.carbs.value = max( 0.0, binding.carbs.value @@ -155,7 +155,7 @@ class CarbsDialog : DialogFragmentWithDate() { val plus2text = toSignedString(sp.getInt(R.string.key_carbs_button_increment_2, FAV2_DEFAULT)) binding.plus2.text = plus2text - binding.plus2.contentDescription = rh.gs(R.string.treatments_wizard_carbs_label) + " " + plus2text + binding.plus2.contentDescription = rh.gs(R.string.treatments_wizard_carbs_label) + " " + plus2text binding.plus2.setOnClickListener { binding.carbs.value = max( 0.0, binding.carbs.value @@ -166,7 +166,7 @@ class CarbsDialog : DialogFragmentWithDate() { } val plus3text = toSignedString(sp.getInt(R.string.key_carbs_button_increment_3, FAV3_DEFAULT)) binding.plus3.text = plus3text - binding.plus2.contentDescription = rh.gs(R.string.treatments_wizard_carbs_label) + " " + plus3text + binding.plus2.contentDescription = rh.gs(R.string.treatments_wizard_carbs_label) + " " + plus3text binding.plus3.setOnClickListener { binding.carbs.value = max( 0.0, binding.carbs.value @@ -179,7 +179,7 @@ class CarbsDialog : DialogFragmentWithDate() { setOnValueChangedListener { eventTime: Long -> run { val timeOffset = ((eventTime - eventTimeOriginal) / (1000 * 60)).toDouble() - binding.time.value = timeOffset + if (_binding != null) binding.time.value = timeOffset } } @@ -250,7 +250,8 @@ class CarbsDialog : DialogFragmentWithDate() { val hypoSelected = binding.hypoTt.isChecked if (hypoSelected) actions.add( - rh.gs(R.string.temptargetshort) + ": " + (DecimalFormatter.to1Decimal(hypoTT) + " " + unitLabel + " (" + rh.gs(R.string.format_mins, hypoTTDuration) + ")").formatColor( context, + rh.gs(R.string.temptargetshort) + ": " + (DecimalFormatter.to1Decimal(hypoTT) + " " + unitLabel + " (" + rh.gs(R.string.format_mins, hypoTTDuration) + ")").formatColor( + context, rh, R.attr.tempTargetConfirmation ) @@ -258,7 +259,7 @@ class CarbsDialog : DialogFragmentWithDate() { val timeOffset = binding.time.value.toInt() if (useAlarm && carbs > 0 && timeOffset > 0) - actions.add(rh.gs(R.string.alarminxmin, timeOffset).formatColor(context , rh, R.attr.infoColor)) + actions.add(rh.gs(R.string.alarminxmin, timeOffset).formatColor(context, rh, R.attr.infoColor)) val duration = binding.duration.value.toInt() if (duration > 0) actions.add(rh.gs(R.string.duration) + ": " + duration + rh.gs(R.string.shorthour)) @@ -385,7 +386,7 @@ class CarbsDialog : DialogFragmentWithDate() { override fun onResume() { super.onResume() - if(!queryingProtection) { + if (!queryingProtection) { queryingProtection = true activity?.let { activity -> val cancelFail = { From 530004fb57f557330e1f7487dfddd86ab72c5a8b Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Sat, 25 Jun 2022 10:27:28 +0200 Subject: [PATCH 34/44] remove unused code, prevent root blocking --- .../plugins/general/overview/OverviewFragment.kt | 13 ++++++------- .../events/EventUpdateOverviewPumpStatus.kt | 5 ----- 2 files changed, 6 insertions(+), 12 deletions(-) delete mode 100644 app/src/main/java/info/nightscout/androidaps/plugins/general/overview/events/EventUpdateOverviewPumpStatus.kt diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewFragment.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewFragment.kt index 4374fd0c05..8ecba9d5ad 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewFragment.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewFragment.kt @@ -51,7 +51,11 @@ import info.nightscout.androidaps.plugins.constraints.bgQualityCheck.BgQualityCh import info.nightscout.androidaps.plugins.general.automation.AutomationPlugin import info.nightscout.androidaps.plugins.general.nsclient.data.NSDeviceStatus import info.nightscout.androidaps.plugins.general.overview.activities.QuickWizardListActivity -import info.nightscout.androidaps.plugins.general.overview.events.* +import info.nightscout.androidaps.plugins.general.overview.events.EventUpdateOverviewCalcProgress +import info.nightscout.androidaps.plugins.general.overview.events.EventUpdateOverviewGraph +import info.nightscout.androidaps.plugins.general.overview.events.EventUpdateOverviewIobCob +import info.nightscout.androidaps.plugins.general.overview.events.EventUpdateOverviewNotification +import info.nightscout.androidaps.plugins.general.overview.events.EventUpdateOverviewSensitivity import info.nightscout.androidaps.plugins.general.overview.graphData.GraphData import info.nightscout.androidaps.plugins.general.overview.notifications.NotificationStore import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatusProvider @@ -66,7 +70,6 @@ import info.nightscout.androidaps.utils.FabricPrivacy import info.nightscout.androidaps.utils.ToastUtils import info.nightscout.androidaps.utils.TrendCalculator import info.nightscout.androidaps.utils.alertDialogs.OKDialog -import info.nightscout.androidaps.interfaces.BuildHelper import info.nightscout.androidaps.utils.protection.ProtectionCheck import info.nightscout.androidaps.utils.rx.AapsSchedulers import info.nightscout.androidaps.utils.ui.SingleClickButton @@ -236,10 +239,6 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList .debounce(1L, TimeUnit.SECONDS) .observeOn(aapsSchedulers.main) .subscribe({ updateGraph() }, fabricPrivacy::logException) - disposable += activePlugin.activeOverview.overviewBus - .toObservable(EventUpdateOverviewPumpStatus::class.java) - .observeOn(aapsSchedulers.main) - .subscribe({ updatePumpStatus() }, fabricPrivacy::logException) disposable += activePlugin.activeOverview.overviewBus .toObservable(EventUpdateOverviewNotification::class.java) .observeOn(aapsSchedulers.main) @@ -308,7 +307,7 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList } handler.postDelayed(refreshLoop, 60 * 1000L) - refreshAll() + handler.post { refreshAll() } updatePumpStatus() updateCalcProgress() } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/events/EventUpdateOverviewPumpStatus.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/events/EventUpdateOverviewPumpStatus.kt deleted file mode 100644 index 30ad6b7507..0000000000 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/events/EventUpdateOverviewPumpStatus.kt +++ /dev/null @@ -1,5 +0,0 @@ -package info.nightscout.androidaps.plugins.general.overview.events - -import info.nightscout.androidaps.events.Event - -class EventUpdateOverviewPumpStatus(val from: String) : Event() \ No newline at end of file From d71cc391fef3a37405e465a0b2d88a71e09356cb Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Sat, 25 Jun 2022 10:29:20 +0200 Subject: [PATCH 35/44] RL: resolve crash on nullable object --- .../common/hw/rileylink/service/tasks/ServiceTaskExecutor.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/ServiceTaskExecutor.kt b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/ServiceTaskExecutor.kt index 36494bb17b..f0623eaf92 100644 --- a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/ServiceTaskExecutor.kt +++ b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/ServiceTaskExecutor.kt @@ -30,7 +30,7 @@ class ServiceTaskExecutor @Inject constructor() : ThreadPoolExecutor(1, 1, 10000 task.preOp() } - override fun afterExecute(r: Runnable, t: Throwable) { + override fun afterExecute(r: Runnable, t: Throwable?) { // This is run on either caller UI thread or Service UI thread. val task = r as ServiceTask task.postOp() From 991f2c95b7ee5ffe351f21957a0d3f934069dc12 Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Sat, 25 Jun 2022 13:51:44 +0200 Subject: [PATCH 36/44] Exception on NaN --- .../plugins/general/overview/OverviewData.kt | 4 +- .../general/overview/OverviewPlugin.kt | 49 +------------------ .../xdripStatusline/StatusLinePlugin.kt | 7 ++- .../plugins/insulin/InsulinLyumjevPlugin.kt | 6 ++- .../plugins/insulin/InsulinOrefBasePlugin.kt | 35 ++++++------- .../insulin/InsulinOrefFreePeakPlugin.kt | 6 ++- .../insulin/InsulinOrefRapidActingPlugin.kt | 6 ++- .../InsulinOrefUltraRapidActingPlugin.kt | 6 ++- .../IobCobCalculatorPlugin.kt | 1 + .../insulin/InsulinLyumjevPluginTest.kt | 8 +-- .../insulin/InsulinOrefBasePluginTest.kt | 38 ++++++-------- .../insulin/InsulinOrefFreePeakPluginTest.kt | 6 ++- .../InsulinOrefRapidActingPluginTest.kt | 8 +-- .../InsulinOrefUltraRapidActingPluginTest.kt | 8 +-- .../nightscout/androidaps/data/IobTotal.kt | 20 ++++---- .../info/nightscout/androidaps/utils/Round.kt | 13 ++--- .../androidaps/danaRv2/DanaRv2Plugin.java | 3 +- .../androidaps/danar/AbstractDanaRPlugin.java | 3 +- .../androidaps/danar/DanaRPlugin.java | 3 +- 19 files changed, 90 insertions(+), 140 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewData.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewData.kt index d114f19847..6f0b64bc6d 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewData.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewData.kt @@ -207,8 +207,8 @@ class OverviewData @Inject constructor( * IOB, COB */ - fun bolusIob(iobCobCalculator: IobCobCalculator): IobTotal = iobCobCalculator.calculateIobFromBolus().round(fabricPrivacy) - fun basalIob(iobCobCalculator: IobCobCalculator): IobTotal = iobCobCalculator.calculateIobFromTempBasalsIncludingConvertedExtended().round(fabricPrivacy) + fun bolusIob(iobCobCalculator: IobCobCalculator): IobTotal = iobCobCalculator.calculateIobFromBolus().round() + fun basalIob(iobCobCalculator: IobCobCalculator): IobTotal = iobCobCalculator.calculateIobFromTempBasalsIncludingConvertedExtended().round() fun cobInfo(iobCobCalculator: IobCobCalculator): CobInfo = iobCobCalculator.getCobInfo(true, "Overview COB") val lastCarbsTime: Long diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewPlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewPlugin.kt index 50bf49c812..58b2de95d6 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewPlugin.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewPlugin.kt @@ -6,11 +6,7 @@ import dagger.android.HasAndroidInjector import info.nightscout.androidaps.R import info.nightscout.androidaps.events.EventPumpStatusChanged import info.nightscout.androidaps.extensions.* -import info.nightscout.androidaps.interfaces.Config -import info.nightscout.androidaps.interfaces.Overview -import info.nightscout.androidaps.interfaces.PluginBase -import info.nightscout.androidaps.interfaces.PluginDescription -import info.nightscout.androidaps.interfaces.PluginType +import info.nightscout.androidaps.interfaces.* import info.nightscout.androidaps.plugins.bus.RxBus import info.nightscout.androidaps.plugins.general.overview.events.EventDismissNotification import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification @@ -21,7 +17,6 @@ import info.nightscout.androidaps.plugins.general.overview.graphExtensions.Scale import info.nightscout.androidaps.plugins.general.overview.notifications.NotificationStore import info.nightscout.androidaps.plugins.iob.iobCobCalculator.events.EventIobCalculationProgress import info.nightscout.androidaps.utils.FabricPrivacy -import info.nightscout.androidaps.interfaces.ResourceHelper import info.nightscout.androidaps.utils.rx.AapsSchedulers import info.nightscout.shared.logging.AAPSLogger import info.nightscout.shared.sharedPreferences.SP @@ -175,46 +170,4 @@ class OverviewPlugin @Inject constructor( .storeDouble(R.string.key_statuslights_bat_critical, sp, rh) .storeInt(R.string.key_boluswizard_percentage, sp, rh) } -/* - @Volatile - var runningRefresh = false - override fun refreshLoop(from: String) { - if (runningRefresh) return - runningRefresh = true - overviewBus.send(EventUpdateOverviewNotification(from)) - loadIobCobResults(from) - overviewBus.send(EventUpdateOverviewProfile(from)) - overviewBus.send(EventUpdateOverviewBg(from)) - overviewBus.send(EventUpdateOverviewTime(from)) - overviewBus.send(EventUpdateOverviewTemporaryBasal(from)) - overviewBus.send(EventUpdateOverviewExtendedBolus(from)) - overviewBus.send(EventUpdateOverviewTemporaryTarget(from)) - loadAsData(from) - overviewData.preparePredictions(from) - overviewData.prepareBasalData(from) - overviewData.prepareTemporaryTargetData(from) - overviewData.prepareTreatmentsData(from) - overviewData.prepareIobAutosensData(from) - overviewBus.send(EventUpdateOverviewGraph(from)) - overviewBus.send(EventUpdateOverviewIobCob(from)) - aapsLogger.debug(LTag.UI, "refreshLoop finished") - runningRefresh = false - } - - @Suppress("SameParameterValue") - private fun loadAll(from: String) { - loadBg(from) - loadProfile(from) - loadTemporaryTarget(from) - loadIobCobResults(from) - loadAsData(from) - overviewData.prepareBasalData(from) - overviewData.prepareTemporaryTargetData(from) - overviewData.prepareTreatmentsData(from) -// prepareIobAutosensData(from) -// preparePredictions(from) - overviewBus.send(EventUpdateOverviewGraph(from)) - aapsLogger.debug(LTag.UI, "loadAll finished") - } -*/ } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/xdripStatusline/StatusLinePlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/xdripStatusline/StatusLinePlugin.kt index 1c54ea4feb..e0106a49d5 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/xdripStatusline/StatusLinePlugin.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/xdripStatusline/StatusLinePlugin.kt @@ -8,12 +8,11 @@ import info.nightscout.androidaps.R import info.nightscout.androidaps.events.* import info.nightscout.androidaps.extensions.toStringShort import info.nightscout.androidaps.interfaces.* -import info.nightscout.shared.logging.AAPSLogger import info.nightscout.androidaps.plugins.bus.RxBus import info.nightscout.androidaps.utils.DecimalFormatter import info.nightscout.androidaps.utils.FabricPrivacy -import info.nightscout.androidaps.interfaces.ResourceHelper import info.nightscout.androidaps.utils.rx.AapsSchedulers +import info.nightscout.shared.logging.AAPSLogger import info.nightscout.shared.sharedPreferences.SP import io.reactivex.rxjava3.disposables.CompositeDisposable import io.reactivex.rxjava3.kotlin.plusAssign @@ -123,8 +122,8 @@ class StatusLinePlugin @Inject constructor( status += activeTemp.toStringShort() + " " } //IOB - val bolusIob = iobCobCalculator.calculateIobFromBolus().round(fabricPrivacy) - val basalIob = iobCobCalculator.calculateIobFromTempBasalsIncludingConvertedExtended().round(fabricPrivacy) + val bolusIob = iobCobCalculator.calculateIobFromBolus().round() + val basalIob = iobCobCalculator.calculateIobFromTempBasalsIncludingConvertedExtended().round() status += DecimalFormatter.to2Decimal(bolusIob.iob + basalIob.basaliob) + "U" if (sp.getBoolean(R.string.key_xdripstatus_detailediob, true)) { status += ("(" diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/insulin/InsulinLyumjevPlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/insulin/InsulinLyumjevPlugin.kt index 4ca7c6f91e..e13bb47b6f 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/insulin/InsulinLyumjevPlugin.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/insulin/InsulinLyumjevPlugin.kt @@ -8,6 +8,7 @@ import info.nightscout.androidaps.interfaces.ProfileFunction import info.nightscout.shared.logging.AAPSLogger import info.nightscout.androidaps.plugins.bus.RxBus import info.nightscout.androidaps.interfaces.ResourceHelper +import info.nightscout.androidaps.utils.HardLimits import org.json.JSONObject import javax.inject.Inject import javax.inject.Singleton @@ -19,8 +20,9 @@ class InsulinLyumjevPlugin @Inject constructor( profileFunction: ProfileFunction, rxBus: RxBus, aapsLogger: AAPSLogger, - config: Config -) : InsulinOrefBasePlugin(injector, rh, profileFunction, rxBus, aapsLogger, config) { + config: Config, + hardLimits: HardLimits +) : InsulinOrefBasePlugin(injector, rh, profileFunction, rxBus, aapsLogger, config, hardLimits) { override val id get(): Insulin.InsulinType = Insulin.InsulinType.OREF_LYUMJEV override val friendlyName get(): String = rh.gs(R.string.lyumjev) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/insulin/InsulinOrefBasePlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/insulin/InsulinOrefBasePlugin.kt index a13f3e467e..f84d23f531 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/insulin/InsulinOrefBasePlugin.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/insulin/InsulinOrefBasePlugin.kt @@ -6,12 +6,12 @@ import info.nightscout.androidaps.data.Iob import info.nightscout.androidaps.database.embedments.InsulinConfiguration import info.nightscout.androidaps.database.entities.Bolus import info.nightscout.androidaps.interfaces.* -import info.nightscout.shared.logging.AAPSLogger import info.nightscout.androidaps.plugins.bus.RxBus import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification import info.nightscout.androidaps.plugins.general.overview.notifications.Notification +import info.nightscout.androidaps.utils.HardLimits import info.nightscout.androidaps.utils.T -import info.nightscout.androidaps.interfaces.ResourceHelper +import info.nightscout.shared.logging.AAPSLogger import kotlin.math.exp import kotlin.math.pow @@ -27,7 +27,8 @@ abstract class InsulinOrefBasePlugin( val profileFunction: ProfileFunction, val rxBus: RxBus, aapsLogger: AAPSLogger, - config: Config + config: Config, + val hardLimits: HardLimits ) : PluginBase( PluginDescription() .mainType(PluginType.INSULIN) @@ -43,18 +44,18 @@ abstract class InsulinOrefBasePlugin( override val dia get(): Double { val dia = userDefinedDia - return if (dia >= MIN_DIA) { + return if (dia >= hardLimits.minDia()) { dia } else { sendShortDiaNotification(dia) - MIN_DIA + hardLimits.minDia() } } open fun sendShortDiaNotification(dia: Double) { if (System.currentTimeMillis() - lastWarned > 60 * 1000) { lastWarned = System.currentTimeMillis() - val notification = Notification(Notification.SHORT_DIA, String.format(notificationPattern, dia, MIN_DIA), Notification.URGENT) + val notification = Notification(Notification.SHORT_DIA, String.format(notificationPattern, dia, hardLimits.minDia()), Notification.URGENT) rxBus.send(EventNewNotification(notification)) } } @@ -65,12 +66,13 @@ abstract class InsulinOrefBasePlugin( open val userDefinedDia: Double get() { val profile = profileFunction.getProfile() - return profile?.dia ?: MIN_DIA + return profile?.dia ?: hardLimits.minDia() } override fun iobCalcForTreatment(bolus: Bolus, time: Long, dia: Double): Iob { + assert(dia != 0.0) + assert(peak != 0) val result = Iob() - val peak = peak if (bolus.amount != 0.0) { val bolusTime = bolus.timestamp val t = (time - bolusTime) / 1000.0 / 60.0 @@ -80,9 +82,9 @@ abstract class InsulinOrefBasePlugin( if (t < td) { val tau = tp * (1 - tp / td) / (1 - 2 * tp / td) val a = 2 * tau / td - val S = 1 / (1 - a + (1 + a) * exp(-td / tau)) - result.activityContrib = bolus.amount * (S / tau.pow(2.0)) * t * (1 - t / td) * exp(-t / tau) - result.iobContrib = bolus.amount * (1 - S * (1 - a) * ((t.pow(2.0) / (tau * td * (1 - a)) - t / tau - 1) * Math.exp(-t / tau) + 1)) + val s = 1 / (1 - a + (1 + a) * exp(-td / tau)) + result.activityContrib = bolus.amount * (s / tau.pow(2.0)) * t * (1 - t / td) * exp(-t / tau) + result.iobContrib = bolus.amount * (1 - s * (1 - a) * ((t.pow(2.0) / (tau * td * (1 - a)) - t / tau - 1) * exp(-t / tau) + 1)) } } return result @@ -95,17 +97,12 @@ abstract class InsulinOrefBasePlugin( get(): String { var comment = commentStandardText() val userDia = userDefinedDia - if (userDia < MIN_DIA) { - comment += "\n" + rh.gs(R.string.dia_too_short, userDia, MIN_DIA) + if (userDia < hardLimits.minDia()) { + comment += "\n" + rh.gs(R.string.dia_too_short, userDia, hardLimits.minDia()) } return comment } - override abstract val peak: Int + abstract override val peak: Int abstract fun commentStandardText(): String - - companion object { - - const val MIN_DIA = 5.0 - } } \ No newline at end of file diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/insulin/InsulinOrefFreePeakPlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/insulin/InsulinOrefFreePeakPlugin.kt index c9588c493b..3b3150cca7 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/insulin/InsulinOrefFreePeakPlugin.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/insulin/InsulinOrefFreePeakPlugin.kt @@ -10,6 +10,7 @@ import info.nightscout.androidaps.interfaces.ProfileFunction import info.nightscout.shared.logging.AAPSLogger import info.nightscout.androidaps.plugins.bus.RxBus import info.nightscout.androidaps.interfaces.ResourceHelper +import info.nightscout.androidaps.utils.HardLimits import info.nightscout.shared.sharedPreferences.SP import org.json.JSONObject import javax.inject.Inject @@ -26,8 +27,9 @@ class InsulinOrefFreePeakPlugin @Inject constructor( profileFunction: ProfileFunction, rxBus: RxBus, aapsLogger: AAPSLogger, - config: Config -) : InsulinOrefBasePlugin(injector, rh, profileFunction, rxBus, aapsLogger, config) { + config: Config, + hardLimits: HardLimits +) : InsulinOrefBasePlugin(injector, rh, profileFunction, rxBus, aapsLogger, config, hardLimits) { override val id get(): Insulin.InsulinType = Insulin.InsulinType.OREF_FREE_PEAK diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/insulin/InsulinOrefRapidActingPlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/insulin/InsulinOrefRapidActingPlugin.kt index 8abb4619cc..76bceef9f2 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/insulin/InsulinOrefRapidActingPlugin.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/insulin/InsulinOrefRapidActingPlugin.kt @@ -8,6 +8,7 @@ import info.nightscout.androidaps.interfaces.ProfileFunction import info.nightscout.shared.logging.AAPSLogger import info.nightscout.androidaps.plugins.bus.RxBus import info.nightscout.androidaps.interfaces.ResourceHelper +import info.nightscout.androidaps.utils.HardLimits import org.json.JSONObject import javax.inject.Inject import javax.inject.Singleton @@ -22,8 +23,9 @@ class InsulinOrefRapidActingPlugin @Inject constructor( profileFunction: ProfileFunction, rxBus: RxBus, aapsLogger: AAPSLogger, - config: Config -) : InsulinOrefBasePlugin(injector, rh, profileFunction, rxBus, aapsLogger, config) { + config: Config, + hardLimits: HardLimits +) : InsulinOrefBasePlugin(injector, rh, profileFunction, rxBus, aapsLogger, config, hardLimits) { override val id get(): Insulin.InsulinType = Insulin.InsulinType.OREF_RAPID_ACTING override val friendlyName get(): String = rh.gs(R.string.rapid_acting_oref) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/insulin/InsulinOrefUltraRapidActingPlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/insulin/InsulinOrefUltraRapidActingPlugin.kt index 4f944b4674..631d495943 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/insulin/InsulinOrefUltraRapidActingPlugin.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/insulin/InsulinOrefUltraRapidActingPlugin.kt @@ -8,6 +8,7 @@ import info.nightscout.androidaps.interfaces.ProfileFunction import info.nightscout.shared.logging.AAPSLogger import info.nightscout.androidaps.plugins.bus.RxBus import info.nightscout.androidaps.interfaces.ResourceHelper +import info.nightscout.androidaps.utils.HardLimits import org.json.JSONObject import javax.inject.Inject import javax.inject.Singleton @@ -22,8 +23,9 @@ class InsulinOrefUltraRapidActingPlugin @Inject constructor( profileFunction: ProfileFunction, rxBus: RxBus, aapsLogger: AAPSLogger, - config: Config -) : InsulinOrefBasePlugin(injector, rh, profileFunction, rxBus, aapsLogger, config) { + config: Config, + hardLimits: HardLimits +) : InsulinOrefBasePlugin(injector, rh, profileFunction, rxBus, aapsLogger, config, hardLimits) { override val id get(): Insulin.InsulinType = Insulin.InsulinType.OREF_ULTRA_RAPID_ACTING override val friendlyName get(): String = rh.gs(R.string.ultrarapid_oref) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/IobCobCalculatorPlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/IobCobCalculatorPlugin.kt index 00fa1dd6dd..30c05b1f32 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/IobCobCalculatorPlugin.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/IobCobCalculatorPlugin.kt @@ -481,6 +481,7 @@ class IobCobCalculatorPlugin @Inject constructor( val profile = profileFunction.getProfile() ?: return total val dia = profile.dia val divisor = sp.getDouble(R.string.key_openapsama_bolussnooze_dia_divisor, 2.0) + assert(divisor > 0) val boluses = repository.getBolusesDataFromTime(toTime - range(), true).blockingGet() diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/insulin/InsulinLyumjevPluginTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/insulin/InsulinLyumjevPluginTest.kt index c906ad4b27..27f3b16011 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/insulin/InsulinLyumjevPluginTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/insulin/InsulinLyumjevPluginTest.kt @@ -6,9 +6,10 @@ import info.nightscout.androidaps.R import info.nightscout.androidaps.interfaces.Config import info.nightscout.androidaps.interfaces.Insulin import info.nightscout.androidaps.interfaces.ProfileFunction -import info.nightscout.shared.logging.AAPSLogger -import info.nightscout.androidaps.plugins.bus.RxBus import info.nightscout.androidaps.interfaces.ResourceHelper +import info.nightscout.androidaps.plugins.bus.RxBus +import info.nightscout.androidaps.utils.HardLimits +import info.nightscout.shared.logging.AAPSLogger import org.junit.Assert.assertEquals import org.junit.Before import org.junit.Rule @@ -31,6 +32,7 @@ class InsulinLyumjevPluginTest { @Mock lateinit var profileFunction: ProfileFunction @Mock lateinit var aapsLogger: AAPSLogger @Mock lateinit var config: Config + @Mock lateinit var hardLimits: HardLimits private var injector: HasAndroidInjector = HasAndroidInjector { AndroidInjector { @@ -39,7 +41,7 @@ class InsulinLyumjevPluginTest { @Before fun setup() { - sut = InsulinLyumjevPlugin(injector, rh, profileFunction, rxBus, aapsLogger, config) + sut = InsulinLyumjevPlugin(injector, rh, profileFunction, rxBus, aapsLogger, config, hardLimits) } @Test diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/insulin/InsulinOrefBasePluginTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/insulin/InsulinOrefBasePluginTest.kt index 1aada50c74..254974283b 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/insulin/InsulinOrefBasePluginTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/insulin/InsulinOrefBasePluginTest.kt @@ -9,17 +9,17 @@ import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.interfaces.Config import info.nightscout.androidaps.interfaces.Insulin import info.nightscout.androidaps.interfaces.ProfileFunction -import info.nightscout.shared.logging.AAPSLogger -import info.nightscout.androidaps.plugins.bus.RxBus -import info.nightscout.androidaps.plugins.insulin.InsulinOrefBasePlugin.Companion.MIN_DIA -import info.nightscout.androidaps.utils.DefaultValueHelper import info.nightscout.androidaps.interfaces.ResourceHelper +import info.nightscout.androidaps.plugins.bus.RxBus +import info.nightscout.androidaps.utils.HardLimits +import info.nightscout.shared.logging.AAPSLogger import org.json.JSONObject import org.junit.Assert import org.junit.Before import org.junit.Rule import org.junit.Test import org.mockito.Mock +import org.mockito.Mockito.`when` import org.mockito.junit.MockitoJUnit import org.mockito.junit.MockitoRule @@ -35,10 +35,9 @@ class InsulinOrefBasePluginTest { profileFunction: ProfileFunction, rxBus: RxBus, aapsLogger: AAPSLogger, - config: Config - ) : InsulinOrefBasePlugin( - injector, rh, profileFunction, rxBus, aapsLogger, config - ) { + config: Config, + hardLimits: HardLimits + ) : InsulinOrefBasePlugin(injector, rh, profileFunction, rxBus, aapsLogger, config, hardLimits) { override fun sendShortDiaNotification(dia: Double) { shortDiaNotificationSend = true @@ -62,13 +61,13 @@ class InsulinOrefBasePluginTest { private lateinit var sut: InsulinBaseTest - @Mock lateinit var defaultValueHelper: DefaultValueHelper @Mock lateinit var rh: ResourceHelper @Mock lateinit var profileFunction: ProfileFunction @Mock lateinit var rxBus: RxBus @Mock lateinit var aapsLogger: AAPSLogger @Mock lateinit var activePlugin: ActivePlugin @Mock lateinit var config: Config + @Mock lateinit var hardLimits: HardLimits private var injector: HasAndroidInjector = HasAndroidInjector { AndroidInjector { @@ -77,30 +76,23 @@ class InsulinOrefBasePluginTest { @Before fun setUp() { - sut = InsulinBaseTest(injector, rh, profileFunction, rxBus, aapsLogger, config) + sut = InsulinBaseTest(injector, rh, profileFunction, rxBus, aapsLogger, config, hardLimits) + `when`(hardLimits.minDia()).thenReturn(5.0) } @Test fun testGetDia() { - Assert.assertEquals(MIN_DIA, sut.dia, 0.0) - testUserDefinedDia = MIN_DIA + 1 - Assert.assertEquals(MIN_DIA + 1, sut.dia, 0.0) - testUserDefinedDia = MIN_DIA - 1 - Assert.assertEquals(MIN_DIA, sut.dia, 0.0) + Assert.assertEquals(5.0, sut.dia, 0.0) + testUserDefinedDia = 5.0 + 1 + Assert.assertEquals(5.0 + 1, sut.dia, 0.0) + testUserDefinedDia = 5.0 - 1 + Assert.assertEquals(5.0, sut.dia, 0.0) Assert.assertTrue(shortDiaNotificationSend) } - @Test - fun minDiaTes() { - Assert.assertEquals(5.0, MIN_DIA, 0.0001) - } - @Test fun testIobCalcForTreatment() { val treatment = Bolus(timestamp = 0, amount = 10.0, type = Bolus.Type.NORMAL) - val expected = Iob() - Assert.assertEquals(expected.iobContrib, sut.iobCalcForTreatment(treatment, 0, 0.0).iobContrib, 0.001) - Assert.assertEquals(expected.activityContrib, sut.iobCalcForTreatment(treatment, 0, 0.0).activityContrib, 0.001) testPeak = 30 testUserDefinedDia = 4.0 val time = System.currentTimeMillis() diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/insulin/InsulinOrefFreePeakPluginTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/insulin/InsulinOrefFreePeakPluginTest.kt index c71c61655b..75d996285d 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/insulin/InsulinOrefFreePeakPluginTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/insulin/InsulinOrefFreePeakPluginTest.kt @@ -7,8 +7,9 @@ import info.nightscout.androidaps.TestBase import info.nightscout.androidaps.interfaces.Config import info.nightscout.androidaps.interfaces.Insulin import info.nightscout.androidaps.interfaces.ProfileFunction -import info.nightscout.androidaps.plugins.bus.RxBus import info.nightscout.androidaps.interfaces.ResourceHelper +import info.nightscout.androidaps.plugins.bus.RxBus +import info.nightscout.androidaps.utils.HardLimits import info.nightscout.shared.sharedPreferences.SP import org.junit.Assert.assertEquals import org.junit.Before @@ -31,6 +32,7 @@ class InsulinOrefFreePeakPluginTest : TestBase() { @Mock lateinit var rxBus: RxBus @Mock lateinit var profileFunction: ProfileFunction @Mock lateinit var config: Config + @Mock lateinit var hardLimits: HardLimits private var injector: HasAndroidInjector = HasAndroidInjector { AndroidInjector { @@ -39,7 +41,7 @@ class InsulinOrefFreePeakPluginTest : TestBase() { @Before fun setup() { - sut = InsulinOrefFreePeakPlugin( injector, sp, rh, profileFunction, rxBus, aapsLogger, config) + sut = InsulinOrefFreePeakPlugin(injector, sp, rh, profileFunction, rxBus, aapsLogger, config, hardLimits) } @Test diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/insulin/InsulinOrefRapidActingPluginTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/insulin/InsulinOrefRapidActingPluginTest.kt index fb2a5f91da..317ccabf5f 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/insulin/InsulinOrefRapidActingPluginTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/insulin/InsulinOrefRapidActingPluginTest.kt @@ -6,9 +6,10 @@ import info.nightscout.androidaps.R import info.nightscout.androidaps.interfaces.Config import info.nightscout.androidaps.interfaces.Insulin import info.nightscout.androidaps.interfaces.ProfileFunction -import info.nightscout.shared.logging.AAPSLogger -import info.nightscout.androidaps.plugins.bus.RxBus import info.nightscout.androidaps.interfaces.ResourceHelper +import info.nightscout.androidaps.plugins.bus.RxBus +import info.nightscout.androidaps.utils.HardLimits +import info.nightscout.shared.logging.AAPSLogger import org.junit.Assert.assertEquals import org.junit.Before import org.junit.Rule @@ -31,6 +32,7 @@ class InsulinOrefRapidActingPluginTest { @Mock lateinit var profileFunction: ProfileFunction @Mock lateinit var aapsLogger: AAPSLogger @Mock lateinit var config: Config + @Mock lateinit var hardLimits: HardLimits private var injector: HasAndroidInjector = HasAndroidInjector { AndroidInjector { @@ -39,7 +41,7 @@ class InsulinOrefRapidActingPluginTest { @Before fun setup() { - sut = InsulinOrefRapidActingPlugin(injector, rh, profileFunction, rxBus, aapsLogger, config) + sut = InsulinOrefRapidActingPlugin(injector, rh, profileFunction, rxBus, aapsLogger, config, hardLimits) } @Test diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/insulin/InsulinOrefUltraRapidActingPluginTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/insulin/InsulinOrefUltraRapidActingPluginTest.kt index 2de46cf16b..1944d0a0f0 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/insulin/InsulinOrefUltraRapidActingPluginTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/insulin/InsulinOrefUltraRapidActingPluginTest.kt @@ -6,9 +6,10 @@ import info.nightscout.androidaps.R import info.nightscout.androidaps.interfaces.Config import info.nightscout.androidaps.interfaces.Insulin import info.nightscout.androidaps.interfaces.ProfileFunction -import info.nightscout.shared.logging.AAPSLogger -import info.nightscout.androidaps.plugins.bus.RxBus import info.nightscout.androidaps.interfaces.ResourceHelper +import info.nightscout.androidaps.plugins.bus.RxBus +import info.nightscout.androidaps.utils.HardLimits +import info.nightscout.shared.logging.AAPSLogger import org.junit.Assert.assertEquals import org.junit.Before import org.junit.Rule @@ -31,6 +32,7 @@ class InsulinOrefUltraRapidActingPluginTest { @Mock lateinit var profileFunction: ProfileFunction @Mock lateinit var aapsLogger: AAPSLogger @Mock lateinit var config: Config + @Mock lateinit var hardLimits: HardLimits private var injector: HasAndroidInjector = HasAndroidInjector { AndroidInjector { @@ -39,7 +41,7 @@ class InsulinOrefUltraRapidActingPluginTest { @Before fun setup() { - sut = InsulinOrefUltraRapidActingPlugin(injector, rh, profileFunction, rxBus, aapsLogger, config) + sut = InsulinOrefUltraRapidActingPlugin(injector, rh, profileFunction, rxBus, aapsLogger, config, hardLimits) } @Test diff --git a/core/src/main/java/info/nightscout/androidaps/data/IobTotal.kt b/core/src/main/java/info/nightscout/androidaps/data/IobTotal.kt index eb5f46428d..44540e1e27 100644 --- a/core/src/main/java/info/nightscout/androidaps/data/IobTotal.kt +++ b/core/src/main/java/info/nightscout/androidaps/data/IobTotal.kt @@ -10,7 +10,7 @@ import org.json.JSONException import org.json.JSONObject @Suppress("SpellCheckingInspection") -class IobTotal(val time: Long) : DataPointWithLabelInterface { +class IobTotal(val time: Long) : DataPointWithLabelInterface { var iob = 0.0 var activity = 0.0 @@ -51,15 +51,15 @@ class IobTotal(val time: Long) : DataPointWithLabelInterface { return this } - fun round(fabricPrivacy: FabricPrivacy? = null): IobTotal { - iob = Round.roundTo(iob, 0.001, fabricPrivacy) - activity = Round.roundTo(activity, 0.0001, fabricPrivacy) - bolussnooze = Round.roundTo(bolussnooze, 0.0001, fabricPrivacy) - basaliob = Round.roundTo(basaliob, 0.001, fabricPrivacy) - netbasalinsulin = Round.roundTo(netbasalinsulin, 0.001, fabricPrivacy) - hightempinsulin = Round.roundTo(hightempinsulin, 0.001, fabricPrivacy) - netInsulin = Round.roundTo(netInsulin, 0.001, fabricPrivacy) - extendedBolusInsulin = Round.roundTo(extendedBolusInsulin, 0.001, fabricPrivacy) + fun round(): IobTotal { + iob = Round.roundTo(iob, 0.001) + activity = Round.roundTo(activity, 0.0001) + bolussnooze = Round.roundTo(bolussnooze, 0.0001) + basaliob = Round.roundTo(basaliob, 0.001) + netbasalinsulin = Round.roundTo(netbasalinsulin, 0.001) + hightempinsulin = Round.roundTo(hightempinsulin, 0.001) + netInsulin = Round.roundTo(netInsulin, 0.001) + extendedBolusInsulin = Round.roundTo(extendedBolusInsulin, 0.001) return this } diff --git a/core/src/main/java/info/nightscout/androidaps/utils/Round.kt b/core/src/main/java/info/nightscout/androidaps/utils/Round.kt index 3f854d4979..e7ca2f5fd8 100644 --- a/core/src/main/java/info/nightscout/androidaps/utils/Round.kt +++ b/core/src/main/java/info/nightscout/androidaps/utils/Round.kt @@ -2,6 +2,7 @@ package info.nightscout.androidaps.utils import android.os.Bundle import java.math.BigDecimal +import java.security.InvalidParameterException import kotlin.math.abs import kotlin.math.ceil import kotlin.math.floor @@ -12,16 +13,10 @@ import kotlin.math.roundToLong */ object Round { - fun roundTo(x: Double, step: Double, fabricPrivacy: FabricPrivacy? = null): Double = try { - if (x == 0.0) 0.0 + fun roundTo(x: Double, step: Double): Double { + if (x.isNaN()) throw InvalidParameterException("Parameter is NaN") + return if (x == 0.0) 0.0 else BigDecimal.valueOf((x / step).roundToLong()).multiply(BigDecimal.valueOf(step)).toDouble() - } catch (e: Exception) { - fabricPrivacy?.logCustom("Error_roundTo", Bundle().apply { - putDouble("x", x) - putDouble("step", step) - putString("stacktrace", e.stackTraceToString()) - }) - 0.0 } fun floorTo(x: Double, step: Double): Double = diff --git a/danar/src/main/java/info/nightscout/androidaps/danaRv2/DanaRv2Plugin.java b/danar/src/main/java/info/nightscout/androidaps/danaRv2/DanaRv2Plugin.java index 1253ef889a..40e9688199 100644 --- a/danar/src/main/java/info/nightscout/androidaps/danaRv2/DanaRv2Plugin.java +++ b/danar/src/main/java/info/nightscout/androidaps/danaRv2/DanaRv2Plugin.java @@ -354,8 +354,7 @@ public class DanaRv2Plugin extends AbstractDanaRPlugin { insulin = constraintChecker.applyExtendedBolusConstraints(new Constraint<>(insulin)).value(); // needs to be rounded int durationInHalfHours = Math.max(durationInMinutes / 30, 1); - insulin = Round.INSTANCE.roundTo(insulin, getPumpDescription().getExtendedBolusStep(), - null); + insulin = Round.INSTANCE.roundTo(insulin, getPumpDescription().getExtendedBolusStep()); PumpEnactResult result = new PumpEnactResult(getInjector()); if (danaPump.isExtendedInProgress() && Math.abs(danaPump.getExtendedBolusAmount() - insulin) < pumpDescription.getExtendedBolusStep()) { diff --git a/danar/src/main/java/info/nightscout/androidaps/danar/AbstractDanaRPlugin.java b/danar/src/main/java/info/nightscout/androidaps/danar/AbstractDanaRPlugin.java index f2dbf782a6..77588a77bf 100644 --- a/danar/src/main/java/info/nightscout/androidaps/danar/AbstractDanaRPlugin.java +++ b/danar/src/main/java/info/nightscout/androidaps/danar/AbstractDanaRPlugin.java @@ -267,8 +267,7 @@ public abstract class AbstractDanaRPlugin extends PumpPluginBase implements Pump insulin = constraintChecker.applyExtendedBolusConstraints(new Constraint<>(insulin)).value(); // needs to be rounded int durationInHalfHours = Math.max(durationInMinutes / 30, 1); - insulin = Round.INSTANCE.roundTo(insulin, getPumpDescription().getExtendedBolusStep(), - null); + insulin = Round.INSTANCE.roundTo(insulin, getPumpDescription().getExtendedBolusStep()); PumpEnactResult result = new PumpEnactResult(getInjector()); if (danaPump.isExtendedInProgress() && Math.abs(danaPump.getExtendedBolusAmount() - insulin) < getPumpDescription().getExtendedBolusStep()) { diff --git a/danar/src/main/java/info/nightscout/androidaps/danar/DanaRPlugin.java b/danar/src/main/java/info/nightscout/androidaps/danar/DanaRPlugin.java index 1a2e573be2..10c8b58fa2 100644 --- a/danar/src/main/java/info/nightscout/androidaps/danar/DanaRPlugin.java +++ b/danar/src/main/java/info/nightscout/androidaps/danar/DanaRPlugin.java @@ -288,8 +288,7 @@ public class DanaRPlugin extends AbstractDanaRPlugin { double extendedRateToSet = absoluteRate - getBaseBasalRate(); extendedRateToSet = constraintChecker.applyBasalConstraints(new Constraint<>(extendedRateToSet), profile).value(); // needs to be rounded to 0.1 - extendedRateToSet = Round.INSTANCE.roundTo(extendedRateToSet, - pumpDescription.getExtendedBolusStep() * 2, null); // *2 because of half hours + extendedRateToSet = Round.INSTANCE.roundTo(extendedRateToSet, pumpDescription.getExtendedBolusStep() * 2); // *2 because of half hours // What is current rate of extended bolusing in u/h? aapsLogger.debug(LTag.PUMP, "setTempBasalAbsolute: Extended bolus in progress: " + (danaPump.isExtendedInProgress()) + " rate: " + danaPump.getExtendedBolusAbsoluteRate() + "U/h duration remaining: " + danaPump.getExtendedBolusRemainingMinutes() + "min"); From 9cfcf238a16f1cc7e494ff6510bb749b84f8406e Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Sat, 25 Jun 2022 13:57:37 +0200 Subject: [PATCH 37/44] fix typo --- app/src/main/res/values/strings.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index cb0b891cfe..d33d543dd9 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1175,7 +1175,7 @@ Max-BG out of range! Temptarget:\nMin: %1$s\nMax: %2$s\nDuration: %3$s Temptarget:\nTarget: %1$s\nDuration: %2$s - Temptarget:\Reason: %1$s\nTarget: %2$s\nDuration: %3$s + Temptarget:\nReason: %1$s\nTarget: %2$s\nDuration: %3$s QuickWizard: %1$s\nInsulin: %2$.2fU\nCarbs: %3$dg Calc. Wizard:\nInsulin: %1$.2fU\nCarbs: %2$dg Show entry on device: From 00f0446c21e059f1287333fc72578daeb6f8c8c2 Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Sat, 25 Jun 2022 15:53:40 +0200 Subject: [PATCH 38/44] EROS: show discard button in engineering mode --- .../pump/omnipod/eros/ui/ErosPodManagementActivity.kt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/ui/ErosPodManagementActivity.kt b/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/ui/ErosPodManagementActivity.kt index 0aa199eabc..5e55c7d612 100644 --- a/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/ui/ErosPodManagementActivity.kt +++ b/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/ui/ErosPodManagementActivity.kt @@ -32,6 +32,7 @@ import info.nightscout.androidaps.queue.events.EventQueueChanged import info.nightscout.androidaps.utils.FabricPrivacy import info.nightscout.androidaps.utils.alertDialogs.OKDialog import info.nightscout.androidaps.extensions.toVisibility +import info.nightscout.androidaps.interfaces.BuildHelper import info.nightscout.androidaps.utils.rx.AapsSchedulers import info.nightscout.androidaps.utils.ui.UIRunnable import io.reactivex.rxjava3.disposables.CompositeDisposable @@ -53,6 +54,7 @@ class ErosPodManagementActivity : NoSplashAppCompatActivity() { @Inject lateinit var omnipodErosPumpPlugin: OmnipodErosPumpPlugin @Inject lateinit var serviceTaskExecutor: ServiceTaskExecutor @Inject lateinit var aapsSchedulers: AapsSchedulers + @Inject lateinit var buildHelper: BuildHelper private var disposables: CompositeDisposable = CompositeDisposable() private val handler = Handler(HandlerThread(this::class.simpleName + "Handler").also { it.start() }.looper) @@ -160,7 +162,8 @@ class ErosPodManagementActivity : NoSplashAppCompatActivity() { // Only show the discard button to reset a cached Pod address before the Pod has actually been initialized // Otherwise, users should use the Deactivate Pod Wizard. In case proper deactivation fails, // they will get an option to discard the Pod state there - val discardButtonEnabled = podStateManager.hasPodState() && !podStateManager.isPodInitialized + // Milos Kozak: allow to show button by activating engineering mode + val discardButtonEnabled = podStateManager.hasPodState() && (!podStateManager.isPodInitialized || buildHelper.isEngineeringMode()) binding.buttonDiscardPod.visibility = discardButtonEnabled.toVisibility() val pulseLogButtonEnabled = aapsOmnipodManager.isPulseLogButtonEnabled From 37aebc1575657a03aab81ee136c1fec5fde69c3a Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Sat, 25 Jun 2022 17:20:49 +0200 Subject: [PATCH 39/44] New Crowdin updates (#1844) * New translations strings.xml (Norwegian) * New translations strings.xml (Dutch) * New translations strings.xml (Dutch) * New translations exam.xml (Dutch) * New translations strings.xml (Dutch) * New translations strings.xml (Dutch) * New translations strings.xml (Dutch) * New translations strings.xml (Dutch) * New translations strings.xml (Dutch) * New translations strings.xml (Dutch) * New translations strings.xml (Dutch) * New translations strings.xml (Dutch) * New translations strings.xml (Portuguese, Brazilian) * New translations strings.xml (Chinese Simplified) * New translations strings.xml (Turkish) * New translations strings.xml (Slovak) * New translations strings.xml (Russian) * New translations strings.xml (Norwegian) * New translations strings.xml (Dutch) * New translations strings.xml (Italian) * New translations strings.xml (French) * New translations strings.xml (Hebrew) * New translations strings.xml (Danish) * New translations strings.xml (Czech) * New translations strings.xml (Spanish) * Update source file strings.xml * New translations strings.xml (Dutch) * New translations strings.xml (Turkish) * New translations exam.xml (Hebrew) * New translations strings.xml (Hebrew) * New translations strings.xml (Hebrew) * New translations strings.xml (Czech) * New translations strings.xml (Hebrew) * New translations strings.xml (Slovak) * New translations strings.xml (Hebrew) * New translations strings.xml (Italian) * New translations strings.xml (Italian) * New translations strings.xml (Italian) * New translations strings.xml (Italian) * New translations strings.xml (Italian) * New translations strings.xml (Italian) * New translations exam.xml (Italian) * New translations strings.xml (Italian) * New translations strings.xml (Italian) * New translations strings.xml (Italian) * New translations strings.xml (Italian) * New translations strings.xml (Italian) * New translations strings.xml (Italian) * New translations strings.xml (Italian) * New translations strings.xml (Italian) * New translations strings.xml (Italian) * New translations strings.xml (Portuguese, Brazilian) * New translations strings.xml (Chinese Simplified) * New translations strings.xml (Turkish) * New translations strings.xml (Swedish) * New translations strings.xml (Slovak) * New translations strings.xml (Russian) * New translations strings.xml (Norwegian) * New translations strings.xml (Dutch) * New translations strings.xml (Italian) * New translations strings.xml (French) * New translations strings.xml (Hebrew) * New translations strings.xml (Danish) * New translations strings.xml (Czech) * New translations strings.xml (Spanish) * Update source file strings.xml * New translations strings.xml (Czech) * Update source file strings.xml * New translations strings.xml (Spanish) --- app/src/main/res/values-cs-rCZ/strings.xml | 4 +- app/src/main/res/values-da-rDK/strings.xml | 3 - app/src/main/res/values-es-rES/strings.xml | 6 +- app/src/main/res/values-fr-rFR/strings.xml | 3 - app/src/main/res/values-it-rIT/exam.xml | 1 + app/src/main/res/values-it-rIT/strings.xml | 34 +++++++++++- app/src/main/res/values-iw-rIL/exam.xml | 1 + app/src/main/res/values-iw-rIL/strings.xml | 55 ++++++++++++++++++- app/src/main/res/values-nl-rNL/exam.xml | 1 + app/src/main/res/values-nl-rNL/strings.xml | 25 ++++++++- app/src/main/res/values-no-rNO/strings.xml | 5 +- app/src/main/res/values-pt-rBR/strings.xml | 3 - app/src/main/res/values-ru-rRU/strings.xml | 3 - app/src/main/res/values-sk-rSK/strings.xml | 7 ++- app/src/main/res/values-sv-rSE/strings.xml | 1 - app/src/main/res/values-tr-rTR/strings.xml | 5 +- app/src/main/res/values-zh-rCN/strings.xml | 3 - .../src/main/res/values-it-rIT/strings.xml | 3 + .../src/main/res/values-nl-rNL/strings.xml | 3 + core/src/main/res/values-it-rIT/strings.xml | 47 ++++++++++++++++ core/src/main/res/values-nl-rNL/strings.xml | 43 +++++++++++++++ danar/src/main/res/values-it-rIT/strings.xml | 4 +- danar/src/main/res/values-nl-rNL/strings.xml | 4 +- .../src/main/res/values-it-rIT/strings.xml | 2 + .../src/main/res/values-nl-rNL/strings.xml | 2 + .../src/main/res/values-it-rIT/strings.xml | 38 +++++++++++++ .../src/main/res/values-nl-rNL/strings.xml | 38 +++++++++++++ .../src/main/res/values-it-rIT/strings.xml | 21 +++++++ .../src/main/res/values-nl-rNL/strings.xml | 21 +++++++ shared/src/main/res/values-iw-rIL/strings.xml | 26 +++++++++ shared/src/main/res/values-nl-rNL/strings.xml | 26 +++++++++ wear/src/main/res/values-it-rIT/strings.xml | 28 ++++++++++ wear/src/main/res/values-iw-rIL/strings.xml | 28 ++++++++++ wear/src/main/res/values-nl-rNL/strings.xml | 28 ++++++++++ wear/src/main/res/values/strings.xml | 19 +------ 35 files changed, 483 insertions(+), 58 deletions(-) diff --git a/app/src/main/res/values-cs-rCZ/strings.xml b/app/src/main/res/values-cs-rCZ/strings.xml index 5fbe88be2f..c577d77db7 100644 --- a/app/src/main/res/values-cs-rCZ/strings.xml +++ b/app/src/main/res/values-cs-rCZ/strings.xml @@ -433,8 +433,8 @@ Povolení odesílaní OpenAPS SMB Dynamická ISF - Korekční faktor pro DynamicISF v %% - Korekční faktor pro DynamicISF. Pro agresivnější korekční dávky nastavte hodnoty větší než 100%%, a pro méně agresivní korekce menší než 100%%. + Korekční faktor pro DynamicISF v % + Korekční faktor pro DynamicISF. Pro agresivnější korekční dávky nastavte hodnoty vyšší než 100 %, pro méně agresivní korekce nižší než 100 %. Povolit UAM Povolit SMB Použít super mikro bolusy místo dočasných bazálů pro zrychlení účinku diff --git a/app/src/main/res/values-da-rDK/strings.xml b/app/src/main/res/values-da-rDK/strings.xml index c906acf229..0f64e595f1 100644 --- a/app/src/main/res/values-da-rDK/strings.xml +++ b/app/src/main/res/values-da-rDK/strings.xml @@ -432,8 +432,6 @@ Aktiver lokale udsendelser. OpenAPS SMB Dynamisk ISF - DynamicISF-justeringsfaktor %% - Justeringsfaktor for Dynamisk ISF. Indstil mere end 100%% for mere aggressive korrektionsdoser og mindre end 100%% for mindre aggressive korrektioner. Aktiver UAM Aktiver SMB Brug Super Mikro Boluser i stedet for midlertidig basal for hurtigere handling @@ -956,7 +954,6 @@ Max-BS udenfor området! Midlertidigt mål:\nMin: %1$s\nMax: %2$s\nVarighed: %3$s Midlertigt mål:\nMål: %1$s\nVarighed: %2$s - Midlertigt mål:\Grund: %1$s\nMål: %2$s\nVarighed: %3$s Hurtigguide: %1$s\nInsulin: %2$.2fE\nKH: %3$dg Guide:\nInsulin: %1$.2fE\nKH: %2$dg Vis post på enhed: diff --git a/app/src/main/res/values-es-rES/strings.xml b/app/src/main/res/values-es-rES/strings.xml index 0f21604eb6..d80010a14a 100644 --- a/app/src/main/res/values-es-rES/strings.xml +++ b/app/src/main/res/values-es-rES/strings.xml @@ -433,8 +433,8 @@ Habilitar la emisión de mensajes localmente. OpenAPS SMB ISF Dinámico - Factor de ajuste de ISF Dinámico % - Porcentaje del factor de ajuste de ISF Dinámico\nValor predeterminado: 100\nEstablecer valores por encima del 100%% para que el algoritmo aplique correcciones más agresivas y valores por debajo del 100%% para correcciones menos agresivas. + Factor de ajuste de ISF Dinámico % + Porcentaje del factor de ajuste de ISF Dinámico\nValor predeterminado: 100\nEstablecer valores por encima del 100% para que el algoritmo aplique correcciones más agresivas y valores por debajo del 100% para correcciones menos agresivas. Activar UAM Activar SMB Usar microbolos en lugar de basales temporales, para corregir más rápidamente @@ -970,7 +970,7 @@ ¡Glucosa máxima fuera de rango! Objetivo temporal:\nMin: %1$s\nMax: %2$s\nDuración: %3$s Objetivo temporal:\nObjetivo: %1$s\nDuración: %2$s - ObjetivoTemporal:\Razón: %1$s\nObjetivo: %2$s\nDuración: %3$s + ObjetivoTemporal:\nRazón: %1$s\nObjetivo: %2$s\nDuración: %3$s Asistente Rápido: %1$s\nInsulina: %2$.2fU\nCarbohidratos: %3$dg Calc. Asistente:\nInsulina: %1$.2fU\nCarbohidratos: %2$dg Mostrar entrada en dispositivo: diff --git a/app/src/main/res/values-fr-rFR/strings.xml b/app/src/main/res/values-fr-rFR/strings.xml index e160225133..a278365845 100644 --- a/app/src/main/res/values-fr-rFR/strings.xml +++ b/app/src/main/res/values-fr-rFR/strings.xml @@ -434,8 +434,6 @@ L\'ENSEMBLE DES RISQUES LIÉS À LA QUALITÉ ET À LA PERFORMANCE DU PROGRAMME S Activer les transmissions locales OpenAPS SMB SI dynamique - Facteur d\'ajustement SI dynamique %% - Facteur d\'ajustement pour SI dynamique. Définissez plus de 100 %% pour des corrections plus agressives et moins de 100 %% pour des corrections moins agressives. Activer RNS Activer SMB Utiliser les Super Micro Bolus au lieu des débits de base temporaires pour une action rapide @@ -970,7 +968,6 @@ L\'ENSEMBLE DES RISQUES LIÉS À LA QUALITÉ ET À LA PERFORMANCE DU PROGRAMME S Gly maxi hors limite! Cible temporaire:\nMin: %1$s\nMax : %2$s\nDurée : %3$s Cible temporaire:\nCible: %1$s\nDurée: %2$s - Cible temporaire:\nRaison: %1$s\nCible : %2$s\nDurée : %3$s Assistant: %1$s\nInsuline : %2$.2fU\nGlucides : %3$dg Assistant Calc :\nInsuline : %1$.2fU\nGlucides : %2$dg Afficher l\'entrée sur l\'appareil : diff --git a/app/src/main/res/values-it-rIT/exam.xml b/app/src/main/res/values-it-rIT/exam.xml index 3f3d10cbfa..c91b576f44 100644 --- a/app/src/main/res/values-it-rIT/exam.xml +++ b/app/src/main/res/values-it-rIT/exam.xml @@ -123,6 +123,7 @@ La registrazione di un cambio cannula ripristinerà il rapporto Autosens al 100%. Alcune opzioni del plugin hanno intervalli di tempo configurabili che possono essere impostati dall\'utente. https://androidaps.readthedocs.io/en/latest/EN/Configuration/Sensitivity-detection-and-COB.html + https://androidaps.readthedocs.io/en/latest/Usage/Open-APS-features.html?highlight=Autosens#autosens Errori inserimento CHO Cosa dovresti fare se hai fatto un inserimento non corretto di carboidrati? Eliminare nei Trattamenti l\'inserimento non corretto e immettere il nuovo valore CHO. diff --git a/app/src/main/res/values-it-rIT/strings.xml b/app/src/main/res/values-it-rIT/strings.xml index eb81d05f9f..4bcbd2d112 100644 --- a/app/src/main/res/values-it-rIT/strings.xml +++ b/app/src/main/res/values-it-rIT/strings.xml @@ -6,6 +6,7 @@ Sicurezza trattamenti Max bolo consentito [U] Max CHO consentiti [g] + Glicemia sotto la quale si attiva la sospensione per glicemia bassa %1$s Preferenze Preferenze Aggiorna trattamenti da NS @@ -432,14 +433,15 @@ Abilita trasmissioni locali OpenAPS SMB ISF Dinamico - %% fattore di regolazione ISF dinamico - Fattore di regolazione per ISF dinamico. Imposta più del 100%% per correzioni più aggressive, meno del 100%% per correzioni meno aggressive. + Fattore di regolazione per ISF Dinamico (%) + Fattore di regolazione per ISF Dinamico. Imposta più del 100% per dosi di correzione più aggressive e meno del 100% per correzioni meno aggressive. Abilita UAM Abilita SMB Usa super-micro-boli al posto della basale temporanea per un\'azione più veloce Rilevamento dei pasti non annunciati Tempo picco Curva IOB Tempo del picco [min] + Picco Free-Peak Oref Rapid-Acting Oref Ultra-Rapid Oref @@ -591,6 +593,7 @@ Questo valore è chiamato Max IOB nel contesto OpenAPS\nOpenAPS non aggiungerà ulteriore insulina se IOB corrente è maggiore di questo valore Max tempo assorbimento pasto [h] Tempo entro il quale ogni pasto si considera assorbito. Eventuali carboidrati rimanenti verranno tagliati fuori. + Glicemia sotto la quale l\'erogazione d\'insulina è sospesa. Il valore predefinito utilizza il modello target standard. L\'utente può impostare un valore compreso tra 60 mg/dl (3.3mmol/l) e 100mg/dl (5.5mmol/l). Con valori inferiori a 65/3.6 viene usato il modello predefinito Finestre tratt.nto: mostra campo note Avanti Indietro @@ -603,7 +606,11 @@ Secondo incremento di CHO Terzo incremento di CHO CGM + Usa connessione cellulare + Usa connessione WiFi WiFi SSID + Durante la ricarica + Utilizzo batteria Impostazioni connessione SSID ammessi (separati da punto e virgola) Consenti connessione in roaming @@ -678,6 +685,8 @@ Un trattamento (insulina: %1$.2f, carboidrati: %2$d, a: %3$s) non può essere aggiunto ai trattamenti. Controlla e aggiungi il record necessario. eCarbs: %1$d g (%2$d h), ritardo: %3$d m Nessun dato autosens disponibile + File di log + Miscellanea Impostazioni Log Ripristina valori predefiniti Malfunzionamento NSClient. Considera il riavvio di NS e NSClient. @@ -770,6 +779,11 @@ Inserimento % non valido Media TIR + TIR giorno + TIR notte + Dettaglio 14 giorni + SD: %1$s + HbA1c: Monitor attività Vuoi resettare le statistiche sull\'attività? Statistiche @@ -956,7 +970,6 @@ Max-BG fuori range! Temptarget:\nMin: %1$s\nMax: %2$s\nDurata: %3$s Temptarget:\nTarget: %1$s\nDurata: %2$s - Temptarget:\Motivo: %1$s\nTarget: %2$s\nDurata: %3$s QuickWizard: %1$s\nInsulina: %2$.2fU\nCHO: %3$dg Calc. Wizard:\nInsulina: %1$.2fU\nCHO: %2$dg Mostra voce sul dispositivo: @@ -965,9 +978,11 @@ Nessun profilo attivo! Valore COB sconosciuto! Lettura BG mancante o recente riavvio dell\'app? Violazione vincolo CHO! + Calc (IC: %1$.1f, ISF: %2$.1f) CHO: %1$.2fU COB: %1$.0fg %2$.2fU BG: %1$.2fU + IOB: %1$.2fU Superbolo: %1$.2fU Trend di 15\': %1$.2fU Percentuale: %1$.2fU x %2$d%% ≈ %3$.2fU @@ -994,6 +1009,10 @@ %1$d selezionati Ordina Finestra di dialogo cancellata + Molto basso + Basso + Alto + Molto alto Sotto In range Sopra @@ -1001,6 +1020,13 @@ Nascondi record di loop Widget di AndroidAPS Configura opacità + Stato loop + Scala del grafico + Profilo 1 + Profilo 2 + Login + Rimuovi tutto + Avvio reset Codice QR per configurare OTP apri impostazioni imposta allarme timer CHO @@ -1014,4 +1040,6 @@ GlucoRx Aidex GlucoRx Aidex Ricevi valori glicemia da CGM GlucoRx Aidex. + Bloccato dalle opzioni di ricarica + Bloccato dalle opzioni di connettività diff --git a/app/src/main/res/values-iw-rIL/exam.xml b/app/src/main/res/values-iw-rIL/exam.xml index ef3818b091..e4f2d5dd9e 100644 --- a/app/src/main/res/values-iw-rIL/exam.xml +++ b/app/src/main/res/values-iw-rIL/exam.xml @@ -123,6 +123,7 @@ רישום החלפת צינורית יאפס את היחס של Autosens בחזרה ל-100%. חלק מאפשרויות התוסף כוללות טווחי זמן הניתנים להגדרה ע\"י המשתמש. https://androidaps.readthedocs.io/en/latest/EN/Configuration/Sensitivity-detection-and-COB.html + https://androidaps.readthedocs.io/en/latest/Usage/Open-APS-features.html?highlight=Autosens#autosens שגיאות רישום פחמימות מה לעשות אם טעיתם ברישום הפחמימות? מחקו את הרשומה השגויה בטיפולים וציינו את ערך הפחמימות הנכון. diff --git a/app/src/main/res/values-iw-rIL/strings.xml b/app/src/main/res/values-iw-rIL/strings.xml index df974a2eec..498f502fc0 100644 --- a/app/src/main/res/values-iw-rIL/strings.xml +++ b/app/src/main/res/values-iw-rIL/strings.xml @@ -6,6 +6,7 @@ בטיחות טיפולים בולוס מקסימלי מותר [U] מקסימום פחמימות מותר [g] + רמת הסוכר נמוכה מסף ההשהיה עקב סוכר נמוך העדפות %1$s העדפות רענן טיפול מ-Nightscout @@ -432,14 +433,15 @@ אפשר שידורים מקומיים. OpenAPS SMB רגישות דינאמית - כיוונון פקטור הרגישות הדינאמית %% - כיוונון פקטור הרגישות הדינאמית. קבעו יותר מ-100%% לקבלת תיקונים אגרסיביים יותר ופחות מ-100%% לקבלת תיקונים עדינים יותר. + כיוונון פקטור הרגישות הדינאמית % + כיוונון פקטור הרגישות הדינאמית. הגדירו יותר מ-100% לקבלת תיקונים אגרסיביים יותר ופחות מ-100% לקבלת תיקונים עדינים יותר. הפעלת UAM אפשר SMB השתמש בסופר מיקרו בולוסים במקום בבזאלי זמני לפעילות מהירה יותר זיהוי של ארוחות לא מוכרזות שעת שיא של עקומת IOB זמן שיא [min] + שיא Oref שיא חופשי Oref אינסולין מהיר Oref אינסולין אולטרה מהיר @@ -591,6 +593,7 @@ ב-OpenAPS ערך זה נקרא מקסימום אינסולין פעיל (maxIOB). \nלא יוזרק עוד אינסולין אם כמות האינסולין הפעיל הנוכחי גדול מערך זה זמן ספיגה מקסימלי של הארוחה [h] משך זמן בו כל ארוחה תחשב כנספגה. לא תהיה התחשבות בפחמימות שנותרו. + ערך הסוכר שמתחתיו מושעה הזרקת אינסולין. ערך ברירת המחדל משתמש במודל מטרה סטנדרטי. המשתמש יכול להגדיר ערך בין 60 ל-100 מג\"\\ד\"ל. ערכים מתחת ל-65 מביאים לשימוש במודל ברירת המחדל הצגת שדות הערות בתיבות דו-שיח של טיפול הבא הקודם @@ -603,7 +606,11 @@ תוספת פחמימות שניה תוספת פחמימות שלישית סנסור + השתמש באינטרנט סלולרי + השתמש בחיבור WiFi WiFi SSID + בזמן טעינה + משתמש בסוללה הגדרות חיבור SSID מורשים (מופרדים בנקודה-פסיק) אפשר חיבור בנדידה @@ -770,6 +777,11 @@ רשומת אחוזים לא חוקית ממוצע זמן בטווח + זמן בטווח ביום + זמן בטווח בלילה + פירוט 14 יום + סטיית תקן: %1$s + HbA1c: מוניטור פעילות האם ברצונכם לאפס את הסטטיסטיקות הפעילות? סטטיסטיקה @@ -880,6 +892,8 @@ קבלת החלפות פרופיל שהוגדרו בנייטסקאוט או ב-NSClient אחזר אירועים לא מקוונים קבל אירועים לא מקוונים שנרשמו דרך נייטסקאוט או NSClient + קבל מינון בזאלי זמני ובולוס מושהה + קבל מינוני בזאלי זמני ובולוסים מושהים שהופעלו ממכשיר עוקב קבלת אינסולין קבלת אינסולין שהוזן באמצעות נייטסקאוט או NSClient (הוא לא מוזרק, רק מחושב רק כאינסולין פעיל) קבלת פחמימות @@ -946,12 +960,33 @@ ערכת נושא בהירה השתמש בערכת הנושא של המכשיר + מבטל ערך מטרה זמני נוכחי + יחידות המידה שונות בין הטלפון והשעון! + ערך הסוכר המינימלי מחוץ לטווח! + ערך הסוכר המקסימלי מחוץ לטווח! + ע\' מטרה זמני:\nמינ\': %1$s\nמקס\': %2$s\nמשך: %3$s + ע\' מטרה זמני:\nמטרה: %1$s\n משך: %2$s + אשף מהיר: %1$s\n אינס\': %2$.2f יח\'\nפחמ\': %3$d גר\' + מחשבון: %1$s\n אינס\': %2$.2f יח\'\nפחמ\': %3$d גר\' + הצג רשומה על המכשיר: + האשף המהיר שנבחר אינו זמין, נא לרענן את האריח + אין נתוני סוכר לביסוס חישוב! + לא הופעל פרופיל! + הפחמימות הפעילות לא ידועות! חסרות קריאות סוכר או שאותחל היישום לאחרונה? הפרת מגבלות פחמימה! + מחשבון (IC: %1$.1f, ISF: %2$.1f) פחמ\': %1$.2f יח\' פחמ\': %1$.0f גר\' %2$.2f יח\' סוכר: %1$.2f יח\' + אינ\' פעיל: %1$.2f יח\' סופר בולוס: %1$.2f יח\' מגמת 15 דק\': %1$.2f יח\' + אחוזים: %1$.2f יח\' x %2$d%% ≈ %3$.2f יח\' + הופעלה מגבלת אינסולין!\nלא ניתן להזריק %1$.2f יח\' + ע\' מטרה זמני: %1$s + %1$s ל-%2$s + המשאבה אינה זמינה! + פקודה לא ידועה: אחוזים ברירת המחדל של היישום הצג רשומות מבוטלות\\מחוקות @@ -970,6 +1005,10 @@ %1$d נבחרו מיין דו-שיח בוטל + נמוך מאוד + נמוך + גבוה + גבוה מאוד מתחת בטווח מעל @@ -977,7 +1016,17 @@ החבא רשומות לולאה ווידג\'ט AndroidAPS הגדרת אטימות + סטטוס הלולאה קנה מידה של הגרף + פרופיל 1 + פרופיל 2 + התחברות + הסר הכל + אתחל התחלה + ברקוד QR ליצירת סיסמה חד פעמית + פתח הגדרות + הגדרת אזעקה טיימר פחמימות + הכול טלפון שעון על השעון בלבד @@ -987,4 +1036,6 @@ GlucoRx Aidex Aidex קבלת נתוני סוכר מחיישני GlucoRx Aidex. + חסום ע\"י הגדרות טעינה + חסום ע\"י הגדרות חיבור diff --git a/app/src/main/res/values-nl-rNL/exam.xml b/app/src/main/res/values-nl-rNL/exam.xml index 8e8c00900e..5a64cd78c6 100644 --- a/app/src/main/res/values-nl-rNL/exam.xml +++ b/app/src/main/res/values-nl-rNL/exam.xml @@ -123,6 +123,7 @@ Het vastleggen van een canulewissel zet de Autosens-ratio terug naar 100%. Sommige van de plugins hebben configureerbare tijdbereiken die kunnen worden ingesteld door de gebruiker. https://androidaps.readthedocs.io/en/latest/CROWDIN/nl/Configuration/Sensitivity-detection-and-COB.html + https://androidaps.readthedocs.io/nl/latest/Usage/Open-APS-features.html?highlight=Autosens#autosens Koolhydraatinvoerfouten Wat moet u doen als u een onjuiste hoeveelheid koolhydraten hebt ingevoerd? Verwijder het onjuiste record in Behandelingen en voer de juiste koolhydraten opnieuw in. diff --git a/app/src/main/res/values-nl-rNL/strings.xml b/app/src/main/res/values-nl-rNL/strings.xml index dc28fa97db..059181d347 100644 --- a/app/src/main/res/values-nl-rNL/strings.xml +++ b/app/src/main/res/values-nl-rNL/strings.xml @@ -6,6 +6,7 @@ Behandelingen veiligheid Max toegestane bolus [E] Max toegestane koolhydraten [g] + BG niveau waarbij lage glucose onderbreking wordt geactiveerd %1$s Instellingen Instellingen Haal behandelingen op van NS @@ -432,8 +433,8 @@ Activeer locaal delen. OpenAPS SMB Dynamische ISF - Dynamische ISF aanpassingsfactor %% - Aanpassingsfactor voor Dynamische ISF. Stel meer dan 100%% in voor een agressievere correctie dosis en minder dan 100%% voor minder agressieve correcties. + Dynamische Isf aanpassingsfactor % + Aanpassingsfactor voor DynamicISF. Stel meer dan 100% in voor een agressievere correctie en minder dan 100% voor minder agressieve correctie. Activeer UAM Activeer SMB SMB in plaats van tijdelijke basalen voor snellere reactie @@ -592,6 +593,7 @@ Deze waarde heet MAX IOB in OpenAPS context\nOpenAPS zal geen extra insuline toedienen als de actuele IOB onderstaande waarde overschreden heeft Maximum maaltijd absorptie tijd [uur] Tijdspanne waarbinnen elke maaltijd volledig is opgenomen. Resterende KH worden niet mee gerekend. + BG waarde waarbij insuline afgifte wordt onderbroken. De standaard waarde gebruikt het standaard doelmodel. Gebruiker kan waarde instellen tussen 60 mg/dl (3.3 mmol/l) en 100mg/dl(5.6mmol/l). Waarden lager dan 65/3.6 resulteren in gebruik van het standaard model Toon notities veld in behandeling dialoogvensters Volgende Vorige @@ -604,7 +606,11 @@ Tweede koolhydraten increment Derde koolhydraten increment CGM + Mobiele verbinding gebruiken + Gebruik WiFi verbinding WiFi SSID + Tijdens opladen + Op batterij Verbindings instellingen Toegelaten SSIDs (gescheiden door puntkomma) Sta verbinding tijdens roaming toe @@ -679,6 +685,8 @@ Een Behandeling (insuline: %1$.2f, koolhydraten: %2$d, in: %3$s) niet konden worden toegevoegd aan Behandelingen. Gelieve te controleren en handmatig een record toe te voegen indien nodig. eCarbs: %1$d g (%2$d h), vertraging: %3$d m Geen autosens-gegevens beschikbaar + Logbestanden + Overige Log instellingen Terug naar standaardinstellingen NSClient werkt niet goed. Overweg een herstart van NS en NSClient. @@ -771,6 +779,11 @@ Ongeldig % invoer Gemiddelde TIR + TIR overdag + TIR s\'nachts + 14 dagen details + SD: %1$s + HbA1c: Activiteitsmonitor Wil je de activiteitenstatistieken resetten? Statistieken @@ -957,7 +970,6 @@ Max BG buiten bereik! Tijdelijk streefdoel:\nMin: %1$s\nMax: %2$s\nDuur: %3$s Tijdelijk streefdoel:\nDoel: %1$s\nDuur: %2$s - Tijdelijk streefdoel:\Reden: %1$s\nDoel: %2$s\nDuur: %3$s QuickWizard: %1$s\nInsuline: %2$.2fE\nKoolhy.: %3$dg Reken. Wizard:\nInsuline: %1$.2fE\nKoolhy.: %2$dg Toon invoer op apparaat: @@ -997,6 +1009,10 @@ %1$d geselecteerd Sorteren Dialoog geannuleerd + Zeer laag + Laag + Hoog + Zeer hoog Onder Binnen bereik Boven @@ -1004,6 +1020,7 @@ Verberg loop records AndroidAPS widget Configureer transparantie + Loop status Grafiek schaal Profiel 1 Profiel 2 @@ -1023,4 +1040,6 @@ GlucoRx Aidex Aidex Ontvang BG waarden van GlucoRx Aidex CGMS. + Geblokkeerd door oplaad instellingen + Geblokkeerd door verbindings instellingen diff --git a/app/src/main/res/values-no-rNO/strings.xml b/app/src/main/res/values-no-rNO/strings.xml index 7e12b4f62e..c81f69586e 100644 --- a/app/src/main/res/values-no-rNO/strings.xml +++ b/app/src/main/res/values-no-rNO/strings.xml @@ -6,6 +6,7 @@ Sikkerhet ved behandlinger Maks tillat bolus [U] Maks tillat karbo [g] + BS er under terskelverdi slik at all insulintilførsel stoppes %1$s innstillinger Innstillinger Oppdater behandlinger fra NS @@ -432,8 +433,6 @@ Aktiver lokale sendinger. OpenAPS SMB Dynamisk ISF - DynamiskISF justeringsfaktor %% - Justeringsfaktor for dynamisk ISF. Verdier over 100%% vil gi mer aggressive korreksjonsdoser, mens verdier under 100%% vil gi mildere korreksjonsdoser. Aktiver UAM Aktiver SMB Bruk Super Mikro Solen i stedet for temp basal for raskere resultat @@ -592,6 +591,7 @@ Denne verdien kalles Maks IOB av OpenAPS\nOpenAPS vil ikke gi mere insulin hvis mengden insulin ombord (IOB) overstiger denne verdien Maks absorpsjonstid for måltid [h] Etter denne tiden forventes det at måltidet er absorbert. Eventuelle gjenværende karbo vil tas ut av beregninger. + BS er under terskelverdi slik at all insulintilførsel stoppes. Mulighet for bruker å definere verdier mellom 3.3mmol/l (60mg/dl) og 5.5mmol/l (100mg/dl). Verdier under 3.6/65 bruker standard målverdier Vis merknadsfelt i dialogvindu for Behandlinger Neste Forrige @@ -968,7 +968,6 @@ Maks-BS utenfor område! Temp target:\nMin: %1$s\nMaks: %2$s\nVarighet: %3$s TempTarget:\nMål: %1$s\nVarighet: %2$s - TempTarget:\nMin: %1$s\nMål: %2$s\nVarighet: %3$s QuickWizard: %1$s\ninsulin: %2$.2fE\nKarbo: %3$dg Kalk. Wizard:\nInsulin: %1$.2fE\nKarbo: %2$dg Vis oppføring på enhet: diff --git a/app/src/main/res/values-pt-rBR/strings.xml b/app/src/main/res/values-pt-rBR/strings.xml index cc897fcb4c..fc2d50ec62 100644 --- a/app/src/main/res/values-pt-rBR/strings.xml +++ b/app/src/main/res/values-pt-rBR/strings.xml @@ -413,8 +413,6 @@ Ativar partilha local. SMB OpenAPS FSI Dinâmico - Fator de Ajuste FSI dinâmico %% - Fator de ajuste para FSI dinâmico. Defina mais de 100%% para doses de correção mais agressivas e menos de 100%% para correções menos agressivas. Ativar UAM Ativar SMB Use Super Micro Boluses em vez de basal temp para uma ação mais rápida @@ -865,7 +863,6 @@ Glicemia maxima fora da meta! Alvo temporário:\nMin: %1$s\nMax: %2$s\nDuração: %3$s Alvo temporário:\nTarget: %1$s\nDuration: %2$s - Alvo temporário:\Reason: %1$s\nTarget: %2$s\nDuration: %3$s Assistente rápido: %1$s\nInsulin: %2$.2fU\nCarbs: %3$dg Calculadora:\nInsulin: %1$.2fU\nCarbs: %2$dg Mostrar entrada no dispositivo: diff --git a/app/src/main/res/values-ru-rRU/strings.xml b/app/src/main/res/values-ru-rRU/strings.xml index d41d36c2e4..9baf342a88 100644 --- a/app/src/main/res/values-ru-rRU/strings.xml +++ b/app/src/main/res/values-ru-rRU/strings.xml @@ -432,8 +432,6 @@ Активировать локальную передачу Супер микро болюс OpenAPS Динамический ISF - Коэффициент регулировки динамического диапазона чувствительности ISF %% - Коэффициент корректировки динамического диапазона чувствительности ISF. Установите более 100%% для более агрессивных доз коррекции и менее 100%% для менее агрессивной коррекции. Включить непредвиденный прием пищи UAM Включить супер микро болюс SMB Для ускорения действия используйте супер микро болюсы SMB вместо временного базала @@ -967,7 +965,6 @@ Макс ГК вне диапазона! ВремЦель:\nМин: %1$s\nМакс.: %2$s\nДлительность: %3$s ВремЦель:\nЦель: %1$s\nДлительность: %2$s - ВремЦель:\Причина: %1$s\nЦель.: %2$s\nДлительность: %3$s Мастер: %1$s\nИнсулин: %2$.2fЕд\nУгл: %3$dg Мастер:\nИнсулин: %1$.2fЕд\nУгл: %2$dg Показать запись на устройстве: diff --git a/app/src/main/res/values-sk-rSK/strings.xml b/app/src/main/res/values-sk-rSK/strings.xml index b0e22b54b4..d0a550b70c 100644 --- a/app/src/main/res/values-sk-rSK/strings.xml +++ b/app/src/main/res/values-sk-rSK/strings.xml @@ -6,6 +6,7 @@ Bezpečnosť zadania ošetrenia Maximálny povolený bolus [JI] Maximálne povolené množstvo sacharidov [g] + Hodnota glykémie, pri ktorej sa aktivuje LGS Nastavenie pluginu %1$s Nastavenia Obnoviť ošetrenia z NS @@ -432,8 +433,8 @@ Povoliť lokálne vysielanie. OpenAPS SMB Dynamická ISF - Korekčný faktor pre Dynamickú ISF v %% - Korekčný faktor pre dynamickú ISF. Pre agresivnejšie korekčné dávky nastavte hodnoty väčšie ako 100%% a pre menej agresivne korekcie menšie než 100%%. + Korekčný faktor pre Dynamickú ISF v % + Korekčný faktor pre dynamickú ISF. Pre agresivnejšie korekčné dávky nastavte hodnoty väčšie ako 100%, pre menej agresívne korekcie, menšie než 100%. Povoliť UAM Povoliť SMB Použiť Super Mikro Bolusy namiesto dočasných bazálov, pre zrýchleniu účinku @@ -592,6 +593,7 @@ Táto hodnota je v kontexte OpenAPS nazývaná Max IOB.\nOpenAPS nikdy nepridá inzulín, pokiaľ je súčasné IOB väčšie, ako táto hodnota Maximálna doba vstrebávania sacharidov [h] Doba, po ktorej sú všetky sacharidy považované za vstrebané. Zvyšné budú orezané. + Hodnota glykémie, pri ktorej bude podávanie inzulínu zastavené. Východzia hodnota využíva štandardný cieľový model. Užívateľ môže nastaviť hodnoty od 3,3 mmol/l do 5,5 mmol/l. Pri hodnotách pod 3,6 mmol/l se použije východzí model. Zobrazovať kolónku poznámky v dialógoch ošetrení Ďalšia Späť @@ -968,7 +970,6 @@ Maximálna glykémia mimo rozsah! Doč. cieľ:\nMin: %1$s\nMax: %2$s\nTrvanie: %3$s Doč. cieľ:\nCieľ: %1$s\nTrvanie: %2$s - Doč. cieľ:\nDôvod: %1$s\nCieľ: %2$s\nTrvanie: %3$s Rýchly bolus: %1$s\nInzulín: %2$.2fJI\nSacharidy: %3$dg Kalkulačka: \nInzulín: %1$.2fJI\nSacharidy: %2$dg Zobraziť záznam na zariadení: diff --git a/app/src/main/res/values-sv-rSE/strings.xml b/app/src/main/res/values-sv-rSE/strings.xml index ee5c7d8905..a85a2e4cb2 100644 --- a/app/src/main/res/values-sv-rSE/strings.xml +++ b/app/src/main/res/values-sv-rSE/strings.xml @@ -941,7 +941,6 @@ Eversense-appen. Ogiltigt maximum BG! Temp-mål:\nMin: %1$s\nMax: %2$s\nVaraktighet: %3$s Temp-mål:\nMål: %1$s\nDuration: %2$s - Temp-mål:\Orsak: %1$s\nMål: %2$s\nVaraktighet: %3$s Snabbsteg: %1$s\nInsulin: %2$.2fU\nKolhydrater: %3$dg Kalkylator:\nInsulin: %1$.2fU\nKolhydrater: %2$dg Visa post på enhet: diff --git a/app/src/main/res/values-tr-rTR/strings.xml b/app/src/main/res/values-tr-rTR/strings.xml index f0383b2d42..7737bbb046 100644 --- a/app/src/main/res/values-tr-rTR/strings.xml +++ b/app/src/main/res/values-tr-rTR/strings.xml @@ -433,8 +433,8 @@ Aktif Karbonhidratın ne kadar hızlı sindirildiğine ve KŞ\'nin beklenenden d Yerel yayınları etkinleştirin. OpenAPS SMB Dinamik İDF - DinamikİDF ayarlama faktörü %% - DinamikİDF için ayarlama faktörü. Daha agresif düzeltme dozları için %%100\'den fazla ve de az agresif düzeltmeler için %%100\'den az ayarlayın. + DinamikİDF Ayar Faktörü % + DinamikİDF için ayarlama faktörü. Daha agresif düzeltme dozları için %100\'den fazla ve daha az agresif düzeltmeler için %100\'den az ayarlayın. UAM etkinleştir SMB (Super Micro Bolus) etkinleştir Daha hızlı bir etki için geçici bazal yerine Super Micro Bolus kullanın @@ -970,7 +970,6 @@ Aktif Karbonhidratın ne kadar hızlı sindirildiğine ve KŞ\'nin beklenenden d Maks-KŞ aralık dışında! Geçici Hedef:\nMin: %1$s\nMaks: %2$s\nSüre: %3$s Geçici Hedef:\nHedef: %1$s\nSüre: %2$s - Geçici Hedef:\Neden: %1$s\nHedef: %2$s\nSüre: %3$s Hızlı Asistan: %1$s\nİnsülin: %2$.2fU\nKarb: %3$dg Hesap Mak.:\nİnsulin: %1$.2fÜ\nKarb: %2$dg Girişi cihazda göster: diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index 0258e545fb..642148ddb4 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -432,8 +432,6 @@ 启用本地广播。 OpenAPS SMB 动态ISF(胰岛素敏感系数) - 动态ISF胰岛素敏系数调整比例 %% - 动态ISF的调整因子。设置100%%以上用于更积极的校正,100%%以下则不那么积极校正。 启用 UAM 启用微型大剂量 使用微型大剂量代替使用临时基础率,更快的干预 @@ -957,7 +955,6 @@ 目标血糖最大值超出范围! 临时目标:\n最小: %1$s\n最大: %2$s\n持续时间: %3$s 临时目标:\n目标: %1$s\n持续时间: %2$s - 临时目标:\原因: %1$s\n目标: %2$s\n持续时间: %3$s 快速向导: %1$s\n胰岛素: %2$.2fU\n碳水: %3$d克 计算. 向导:\n胰岛素: %1$.2fU\n碳水: %2$d克 在设备上显示条目: diff --git a/automation/src/main/res/values-it-rIT/strings.xml b/automation/src/main/res/values-it-rIT/strings.xml index 01f8733efa..926f76ebc6 100644 --- a/automation/src/main/res/values-it-rIT/strings.xml +++ b/automation/src/main/res/values-it-rIT/strings.xml @@ -120,4 +120,7 @@ Sicuro di voler eliminare %1$d elementi Ordina Automazione sistema + Esegui automazioni + Aggiungi regola + Rimuovi/ordina diff --git a/automation/src/main/res/values-nl-rNL/strings.xml b/automation/src/main/res/values-nl-rNL/strings.xml index cf5f20fb24..d4815fd566 100644 --- a/automation/src/main/res/values-nl-rNL/strings.xml +++ b/automation/src/main/res/values-nl-rNL/strings.xml @@ -120,4 +120,7 @@ Weet je zeker dat je %1$d items wilt verwijderen Sorteren Systeem automatisering + Automatisering uitvoeren + Regel toevoegen + Verwijderen/sorteren diff --git a/core/src/main/res/values-it-rIT/strings.xml b/core/src/main/res/values-it-rIT/strings.xml index 5ac31e2345..0f86119b89 100644 --- a/core/src/main/res/values-it-rIT/strings.xml +++ b/core/src/main/res/values-it-rIT/strings.xml @@ -42,6 +42,7 @@ CHO Profilo non valido !!! NESSUN PROFILO IMPOSTATO + ]]> Data Unità DIA @@ -441,6 +442,52 @@ file utente + Autotune + Aiuto per potenziali regolazioni del profilo (ISF, rapporto CHO e velocità basali) + AT + Impostazioni Autotune + Automazione cambio profilo + Se abilitato, Autotune si aggiornerà automaticamente e passerà al profilo di input dopo il calcolo da una regola di automazione. + Classifica UAM come basale + Abilita solo se hai inserito in modo affidabile tutti i carboidrati assunti, con questa opzione aumenti improvvisi individuati da Autotune verranno usati per consigliare modifiche alla velocità basale. + Regola la curva dell\'insulina + Abilita solo se usi free-peak. Questa opzione regolerà la durata di picco e DIA + Numero di giorni di dati + Applica il risultato medio in IC/ISF circadiano + Autotune non regolerà le variazioni circadiane, questa opzione applica solo la regolazione media di IC e ISF al tuo profilo di input circadiano + Includi più informazioni di log per il debug + Attiva solo se richiesto dallo sviluppatore per inviare ulteriori informazioni di log per aiutare il debug del plugin Autotune + Numero predefinito di giorni di dati da elaborare da Autotune (fino a 30) + Regolato + Profilo : + Giorni regolazione : + Ultima esecuzione : + Avviso : + Seleziona il profilo da regolare + Il profilo selezionato ha %1$d valori IC. Autotune userà %2$.2f g/U + Il profilo selezionato ha %1$d valori ISF. Autotune userà %2$.1f %3$s/U + Errore nei dati di input, prova a eseguire di nuovo Autotune o ridurre il numero di giorni + Il calcolo di Autotune è iniziato, attendi + Controlla attentamente i risultati prima di utilizzarli! + Risultato parziale giorno %1$d / %2$d regolato + Risultato: %1$s + Param + % + Mancante + Profilo Autotune %1$s + Esegui Autotune + Controlla il profilo di input + Compara profili + Copia nel profilo locale + Aggiorna il profilo di input + Ripristina il profilo di input + Creare un nuovo profilo locale da questo profilo Autotune? + Aggiornare il profilo %1$s con il profilo Autotune? + Ripristinare il profilo %1$s con il profilo di input? + Profilo non valido + Autotune eseguito senza cambio profilo + Autotune eseguito e profilo cambiato automaticamente + Errore durante l\'ultima esecuzione di Autotune %1$d giorno %1$d giorni diff --git a/core/src/main/res/values-nl-rNL/strings.xml b/core/src/main/res/values-nl-rNL/strings.xml index 28fccb7843..9a314f98f1 100644 --- a/core/src/main/res/values-nl-rNL/strings.xml +++ b/core/src/main/res/values-nl-rNL/strings.xml @@ -42,6 +42,7 @@ Koolhydraten Ongeldig profiel !!! Geen profiel ingesteld + ]]> Datum Eenheden DIA @@ -441,10 +442,52 @@ bestand gebruiker + Autotune + Hulp voor potentiële aanpassingen van het profiel (ISF, koolhydraten en basale koersen) + AT + Autotune instellingen + Automatisering Profiel Wissel + Indien ingeschakeld, wordt Autotune automatisch bijgewerkt en overschakelen naar invoerprofiel na de berekening van een automatiseringsregel. + UAM als basaal categoriseren + Alleen inschakelen als u betrouwbaar alle koolhydraten ingevoerd en hebt opgegeten, met deze optie zullen plotselinge stijgingen van Autotune worden gebruikt om wijzigingen in de basaalstand aan te bevelen. Insuline curve afstemmen Alleen inschakelen als je vrije piek gebruikt. Deze optie zal piek en DIA duur afstemmen + Aantal dagen data + Gemiddelde resultaat toepassen in circadiaan IC/ISF + Autotune zal de circadiaanse variaties niet afstemmen, deze optie past alleen de gemiddelde tuning van IC en ISF toe op uw circadiaanse invoerprofiel + Meer log-informatie voor foutopsporing toevoegen + Schakel alleen in op verzoek van een onwikkelaar om meer log-informatie te sturen om Autotune plugin te helpen debuggen Standaard aantal dagen aan gegevens dat Autotune moet verwerken (tot 30) + Tuned + Profiel : + Afstemmen dagen : + Laatste berekening : + Waarschuwing : + Selecteer profiel om aan te passen + Het geselecteerde profiel heeft %1$d IC waarden. Autotune gebruikt %2$.2f g/E + Het geselecteerde profiel heeft %1$d ISF waarden. Autotune gebruikt %2$.1f %3$s/E Fout in invoergegevens, probeer autotune opnieuw te starten of het aantal dagen te verminderen + Autotune berekening gestart, even geduld a.u.b. + Controleer de resultaten zorgvuldig voordat u het gebruikt! + Gedeeltelijk resultaat dag %1$d / %2$d afgestemd + Resultaat: %1$s + Parameter + % + Ontbreekt + Autotune profiel %1$s + Autotune uitvoeren + Controleer invoerprofiel + Vergelijk profielen + Kopiëren naar lokaal profiel + Invoerprofiel bijwerken + Invoerprofiel ongedaan maken + Een lokaal profiel van dit Autotune profiel aanmaken? + Profiel %1$s bijwerken met Autotune Profiel? + Profiel %1$s terugzetten met invoerprofiel? + Profiel ongeldig + Autotune uitgevoerd zonder profiel aanpassing + Autotune uitgevoerd en profiel automatisch gewisseld + Fout tijdens laatste Autotune uitvoeren %1$d dag %1$d dagen diff --git a/danar/src/main/res/values-it-rIT/strings.xml b/danar/src/main/res/values-it-rIT/strings.xml index 3ea04e700d..5a4de59455 100644 --- a/danar/src/main/res/values-it-rIT/strings.xml +++ b/danar/src/main/res/values-it-rIT/strings.xml @@ -1,2 +1,4 @@ - + + Azione non supportata nel micro. Usa solo l\'interfaccia di AndroidAPS! + diff --git a/danar/src/main/res/values-nl-rNL/strings.xml b/danar/src/main/res/values-nl-rNL/strings.xml index 3ea04e700d..ff920b8ec5 100644 --- a/danar/src/main/res/values-nl-rNL/strings.xml +++ b/danar/src/main/res/values-nl-rNL/strings.xml @@ -1,2 +1,4 @@ - + + Niet-ondersteunde actie in pomp. Gebruik alleen AndroidAPS gebruikersinterface! + diff --git a/diaconn/src/main/res/values-it-rIT/strings.xml b/diaconn/src/main/res/values-it-rIT/strings.xml index c4c7b80b16..2aad15a22a 100644 --- a/diaconn/src/main/res/values-it-rIT/strings.xml +++ b/diaconn/src/main/res/values-it-rIT/strings.xml @@ -152,4 +152,6 @@ Stato LGS già su OFF. Comando di disattivazione rifiutato. L\'avvio della basale temporanea viene rifiutato quando è già in esecuzione una basale temporanea Lo stop della basale temporanea viene rifiutato quando non è in esecuzione alcuna basale temporanea + Invia i log del micro a Diaconn Cloud. + Sincronizzazione Diaconn Cloud diff --git a/diaconn/src/main/res/values-nl-rNL/strings.xml b/diaconn/src/main/res/values-nl-rNL/strings.xml index acee82d0a6..ab90c38045 100644 --- a/diaconn/src/main/res/values-nl-rNL/strings.xml +++ b/diaconn/src/main/res/values-nl-rNL/strings.xml @@ -152,4 +152,6 @@ LGS status UIT, UIT Commando is geweigerd. Tijdelijk basaal start geweigerd als tijdelijk basaal wordt uitgevoerd Tijdelijk basaal stop geweigerd als tijdelijk basaal niet wordt uitgevoerd + Stuur pomp logs naar de Diaconn Cloud. + Diaconn Cloud Sync diff --git a/openhumans/src/main/res/values-it-rIT/strings.xml b/openhumans/src/main/res/values-it-rIT/strings.xml index 6ef4309f8e..54f578f9b4 100644 --- a/openhumans/src/main/res/values-it-rIT/strings.xml +++ b/openhumans/src/main/res/values-it-rIT/strings.xml @@ -16,4 +16,42 @@ Sei stato disconnesso da Open Humans Fare click qui per accedere di nuovo. Carica adesso + Avanti + Benvenuto in Open Humans + Per configurare il caricamento dei dati, fai click su \'Avanti\'. + Consenso + Termini d\'uso + Leggi attentamente le seguenti informazioni e accetta i termini d\'uso per procedere. + Questo è uno strumento open source che copierà i tuoi dati su Open Humans. Non ci riserviamo alcun diritto di condividere i tuoi dati con terze parti senza la tua esplicita autorizzazione. I dati che il progetto e l\'app ricevono vengono identificati tramite un ID utente casuale e verranno trasmessi in modo sicuro a un account Open Humans solo con la tua autorizzazione per tale processo. Puoi interrompere il caricamento ed eliminare i dati di caricamento in qualsiasi momento tramite www.openhumans.org. + Dati caricati + Valori glicemia + Boli + Boli estesi + Carboidrati + Eventi Portale (eccetto le note) + Cambi profilo + Dosi giornaliere totali + Velocità basali temporanee + Target temporanei + Impostazioni + Versione applicazione + Modello dispositivo + Dimensioni schermo + Dati di debug dell\'algoritmo + Dati NON caricati + Password + URL di Nightscout + API Secret di Nightscout + Campi di testo libero + Comprendo e accetto. + Accesso a Open Humans + Tocchi finali + Sei a solo un passo dal caricare i tuoi dati su Open Humans. Vuoi procedere? + Annulla + Continua + Completamento... + Potrebbe richiedere alcuni secondi. + Abbiamo fatto! + D\'ora in poi, il tuo telefono caricherà i dati in background di tanto in tanto. + Chiudi diff --git a/openhumans/src/main/res/values-nl-rNL/strings.xml b/openhumans/src/main/res/values-nl-rNL/strings.xml index 39127a1a5e..9a35bba7e0 100644 --- a/openhumans/src/main/res/values-nl-rNL/strings.xml +++ b/openhumans/src/main/res/values-nl-rNL/strings.xml @@ -16,4 +16,42 @@ Je bent uitgelogd van Open Humans Klik hier om opnieuw in te loggen als dit niet opzettelijk was. Nu Uploaden + Volgende + Welkom bij Open Humans + Klik op \'Volgende\' om gegevens te uploaden. + Toestemming + Gebruiksvoorwaarden + Lees zorgvuldig de volgende informatie en accepteer de gebruiksvoorwaarden om verder te gaan. + Dit is een open source tool die jouw gegevens zal kopiëren naar Open Humans. We behouden geen rechten om je gegevens met derden te delen zonder je expliciete toestemming. De gegevens die het project en de app ontvangen worden geïdentificeerd via een willekeurige gebruikers-ID en zullen alleen veilig worden verzonden naar een Open Humans account met uw toestemming voor dat proces. U kunt op elk gewenst moment stoppen met uploaden en uw upload gegevens verwijderen via www.openhumans.org. + Gegevensupload + Glucose waarden + Bolussen + Vertraagde bolus + Koolhydraten + Careportal gebeurtenissen (behalve notities) + Profiel wisselingen + Totaal Dagelijkse Doses + Tijdelijke basaalstanden + Tijdelijke streefdoelen + Instellingen + Applicatie versie + Apparaat model + Scherm afmetingen + Algoritme debug data + Gegevens NIET ge-upload + Wachtwoorden + Nightscout URL + Nightscout API Secret + Vrije tekstvelden + Ik begrijp het en ga akkoord. + Aanmelden bij Open Humans + Laatste details + U bent slechts één stap verwijderd van het uploaden van uw gegevens naar Open Humans. Wilt u doorgaan? + Afbreken + Ga verder + Voltooien... + Dit kan enkele seconden duren. + We zijn klaar! + Voortaan zal je telefoon zo nu en dan op de achtergrond gegevens uploaden. + Sluiten diff --git a/pump-common/src/main/res/values-it-rIT/strings.xml b/pump-common/src/main/res/values-it-rIT/strings.xml index 55baa3f071..37d4766e94 100644 --- a/pump-common/src/main/res/values-it-rIT/strings.xml +++ b/pump-common/src/main/res/values-it-rIT/strings.xml @@ -1,6 +1,27 @@ + Operazione non supportata dal micro e/o dal driver. + Operazione NON ANCORA supportata dal micro. + OK + Mai connesso + Risveglio + Errore nella comunicazione + Timeout della comunicazione + Micro irraggiungibile + Configurazione non valida + Attivo + In sospensione + Basali + Configurazioni + Notifiche + Statistiche + Sconosciuti + Tutto + Boli + Caricamento + Allarmi + Glicemia diff --git a/pump-common/src/main/res/values-nl-rNL/strings.xml b/pump-common/src/main/res/values-nl-rNL/strings.xml index 55baa3f071..98c757c2f2 100644 --- a/pump-common/src/main/res/values-nl-rNL/strings.xml +++ b/pump-common/src/main/res/values-nl-rNL/strings.xml @@ -1,6 +1,27 @@ + Bewerking niet ondersteund door pomp en/of driver. + Operatie NOG niet ondersteund door de pomp. + OK + Nooit verbonden + Actief worden + Communicatiefout + Time-out bij communicatie + Pomp niet beschikbaar + Ongeldige configuratie + Actief + Slapen + Basaalstanden + Instellingen + Meldingen + Statistieken + Onbekend + Alle + Bolussen + Vullen + Alarmen + Glucose diff --git a/shared/src/main/res/values-iw-rIL/strings.xml b/shared/src/main/res/values-iw-rIL/strings.xml index 554d7a16e3..c1a2923953 100644 --- a/shared/src/main/res/values-iw-rIL/strings.xml +++ b/shared/src/main/res/values-iw-rIL/strings.xml @@ -1,4 +1,30 @@ + לפני %1$d דקות + לפני %1$d דקות + לפני %1$.1f שעות + לפני %1$.1f ימים + לפני %1$.0f ימים + בעוד %1$.0f ימים + בעוד %1$.0f ימים + ש\' + ימים + שעות + שניה + דקה + שעה + יום + שבוע + שניות + דקות + שעות + ימים + שבועות + דק\' + י\' + מאוחר יותר היום + מחר + היום + אתמול diff --git a/shared/src/main/res/values-nl-rNL/strings.xml b/shared/src/main/res/values-nl-rNL/strings.xml index 554d7a16e3..b927c43d0b 100644 --- a/shared/src/main/res/values-nl-rNL/strings.xml +++ b/shared/src/main/res/values-nl-rNL/strings.xml @@ -1,4 +1,30 @@ + %1$d m geleden + %1$d minuten geleden + %1$.1f uur geleden + %1$.1f dagen geleden + %1$.0f dagen geleden + over %1$.0f dagen + over %1$.0f dagen + u + dagen + uren + seconde + minuut + uur + dag + week + seconden + minuten + uren + dagen + weken + m + d + Later vandaag + Morgen + Vandaag + Gisteren diff --git a/wear/src/main/res/values-it-rIT/strings.xml b/wear/src/main/res/values-it-rIT/strings.xml index f4a184765a..b6a8e15f35 100644 --- a/wear/src/main/res/values-it-rIT/strings.xml +++ b/wear/src/main/res/values-it-rIT/strings.xml @@ -2,6 +2,15 @@ AAPS AAPS + AAPS + AAPS(Large) + AAPS(BigChart) + AAPS(NoChart) + AAPS(Circle) + AAPS(v2) + AAPS(Cockpit) + AAPS(Steampunk) + AAPS(DigitalStyle) AAPS(azioni) AAPS(Temp Target) AAPS(Quick Wizard) @@ -55,6 +64,7 @@ Complication Tap Action Unicode in Complications Versione: + Più impostazioni watchface Controlla configurazione watchface. TempT Calcolatore @@ -80,6 +90,7 @@ Calcolo richiesto Riempimento richiesto CHO richiesti + Cambio profilo richiesto Target Basso Alto @@ -101,6 +112,7 @@ CANCELLA BOLO Micro Loop + Cambio profilo TDD CHO IOB @@ -156,4 +168,20 @@ Nessuna configurazione disponibile Controlli smartwatch disabilitati Nessun dato disponibile + incremento + decremento + H + L + media + --U + --g + -.--U/h + Caricamento: ---% + S: nessuno stato + -- Minuti fa + --- mg/dl + Nessun stato di loop + 000g + 00,0 + 0,00U diff --git a/wear/src/main/res/values-iw-rIL/strings.xml b/wear/src/main/res/values-iw-rIL/strings.xml index 0fab8bcc3e..d2a3183b5d 100644 --- a/wear/src/main/res/values-iw-rIL/strings.xml +++ b/wear/src/main/res/values-iw-rIL/strings.xml @@ -2,6 +2,15 @@ AAPS AAPS + AAPS + AAPS (גדול) + AAPS (תרשים גדול) + AAPS (ללא תרשים) + AAPS (עיגול) + AAPS (v2) + AAPS (תא טייס) + AAPS (סטימפאנק) + AAPS (דיגיטלי) AAPS (פעולות) AAPS (מטרה זמנית) AAPS (אשף מהיר) @@ -55,6 +64,7 @@ פעולת הקשה על סיבוך יוניקוד בסיבוכים גירסה: + עוד הגדרות פני שעון עיינו בהגדרות פני השעון בבקשה. מטרה זמנית מחשבון @@ -80,6 +90,7 @@ התבקש חישוב התבקש מילוי נדרשו פחמימות + התבקשה החלפת פרופיל ערך מטרה נמוך גבוה @@ -101,6 +112,7 @@ ביטול בולוס משאבה לולאה + החלפת פרופיל סה\"כ מינון אינסולין יומי TDD פחמימות כמות אינסולין פעילה @@ -156,4 +168,20 @@ אין הגדרה שליטה משעון Wear אינה מאופשרת אין נתונים זמינים + תוספת + הפחתה + גב\' + נמ\' + ממוצע + -- יח\' + -- גר\' + -.--יח\' לשעה + מעלה: --- % + אין סטטוס + לפני -- דקות + --- mg/dl + חסר סטטוס לולאה + 000 גר\' + 00,0 + 0,00 יח\' diff --git a/wear/src/main/res/values-nl-rNL/strings.xml b/wear/src/main/res/values-nl-rNL/strings.xml index 56deef316c..47492205a0 100644 --- a/wear/src/main/res/values-nl-rNL/strings.xml +++ b/wear/src/main/res/values-nl-rNL/strings.xml @@ -2,6 +2,15 @@ AAPS AAPS + AAPS + AAPS(Groot) + AAPS(GroteGrafiek) + AAPS(GeenGrafiek) + AAPS(Cirkel) + AAPS(v2) + AAPS(Cockpit) + AAPS(Steampunk) + AAPS(DigitaleStijl) AAPS(Acties) AAPS(Tijdelijk Streefdoel) AAPS(Quick Wizard) @@ -55,6 +64,7 @@ Complicatie tik voor actie Unicode in complicaties Versie: + Meer Watchface instellingen Kijk naar de Watchface configuratie, alsjeblieft. TijdStreefd Calculator @@ -80,6 +90,7 @@ Berekening aangevraagd Vullen aangevraagd Koolhydraten aangevraagd + Profiel wisselen aangevraagd Doel Laag Hoog @@ -101,6 +112,7 @@ BOLUS ANNULEREN Pomp Loop + Profiel wissel TDD Khd IOB @@ -156,4 +168,20 @@ Geen configuratie beschikbaar Wear OS besturing uitgeschakeld Geen data beschikbaar + verhoog + verlaag + H + L + gem + --E + --g + -.--E/uur + Uploader: ---% + S: geen status + -- Minuten geleden + --- mg/dl + Geen Loop Status + 000g + 00,0 + 0,00E diff --git a/wear/src/main/res/values/strings.xml b/wear/src/main/res/values/strings.xml index d5331aa883..2387f2ed94 100644 --- a/wear/src/main/res/values/strings.xml +++ b/wear/src/main/res/values/strings.xml @@ -1,9 +1,7 @@ - AAPS AAPS - AAPS AAPS(Large) AAPS(BigChart) @@ -13,19 +11,15 @@ AAPS(Cockpit) AAPS(Steampunk) AAPS(DigitalStyle) - AAPS(Actions) AAPS(Temp Target) AAPS(Quick Wizard) - No data! Old data! Since %1$s Sync with AAPS! - No data received since %1$s! Check if AAPS on the phone sends data to watch AAPS data is %1$s old! Check your sensor, xDrip+, NS, AAPS config or other! - Vibrate on Bolus Units for Actions Show Date @@ -72,7 +66,6 @@ Version: More Watchface settings Look into Watchface configuration, please. - TempT Calculator Calc @@ -89,7 +82,6 @@ Default Menu XL - Duration Temp Target Requested Quick Wizard Requested @@ -115,20 +107,16 @@ CONFIRM timeshift Bolus - Bolus Progress press to cancel CANCEL BOLUS - Pump Loop Profile switch TDD - Carb IOB no status - red pink purple @@ -153,16 +141,13 @@ multicolor Simplify UI Only show time and BG - Vibrate hourly Show Week number - Your style: no style minimal style shape style full style - Your color: Your color saturation: Your color opacity: @@ -183,7 +168,6 @@ No config available Wear controls disabled No data available - QuickWizard wearcontrol units_mgdl @@ -236,7 +220,6 @@ --- mg/dl No Loop Status 000g - 00,0 + 00,0 0,00U - From 072324d1069ed8baa9286e4acc4c718c9155b803 Mon Sep 17 00:00:00 2001 From: Andries Smit Date: Tue, 21 Jun 2022 20:05:53 +0200 Subject: [PATCH 40/44] fear: wear mute alarm --- .../wear/wearintegration/DataHandlerMobile.kt | 11 +++- .../nightscout/shared/weardata/EventData.kt | 5 +- wear/src/main/AndroidManifest.xml | 12 ++++ .../androidaps/di/WearActivitiesModule.kt | 4 +- .../actions/QuickSnoozeActivity.kt | 52 ++++++++++++++++++ wear/src/main/res/drawable/ic_icon_snooze.png | Bin 0 -> 3919 bytes wear/src/main/res/values/strings.xml | 3 + 7 files changed, 84 insertions(+), 3 deletions(-) create mode 100644 wear/src/main/java/info/nightscout/androidaps/interaction/actions/QuickSnoozeActivity.kt create mode 100644 wear/src/main/res/drawable/ic_icon_snooze.png diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/wear/wearintegration/DataHandlerMobile.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/wear/wearintegration/DataHandlerMobile.kt index cb21aeb5ba..a0ccacf982 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/wear/wearintegration/DataHandlerMobile.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/wear/wearintegration/DataHandlerMobile.kt @@ -27,6 +27,7 @@ import info.nightscout.androidaps.plugins.general.overview.graphExtensions.Gluco import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatusProvider import info.nightscout.androidaps.queue.Callback import info.nightscout.androidaps.receivers.ReceiverStatusStore +import info.nightscout.androidaps.services.AlarmSoundServiceHelper import info.nightscout.androidaps.utils.* import info.nightscout.androidaps.utils.rx.AapsSchedulers import info.nightscout.androidaps.utils.wizard.BolusWizard @@ -73,7 +74,8 @@ class DataHandlerMobile @Inject constructor( private val uel: UserEntryLogger, private val activePlugin: ActivePlugin, private val commandQueue: CommandQueue, - private val fabricPrivacy: FabricPrivacy + private val fabricPrivacy: FabricPrivacy, + private val alarmSoundServiceHelper: AlarmSoundServiceHelper ) { private val disposable = CompositeDisposable() @@ -260,6 +262,13 @@ class DataHandlerMobile @Inject constructor( } lastBolusWizard = null }, fabricPrivacy::logException) + disposable += rxBus + .toObservable(EventData.SnoozeAlert::class.java) + .observeOn(aapsSchedulers.io) + .subscribe({ + aapsLogger.debug(LTag.WEAR, "SnoozeAlert received $it from ${it.sourceNodeId}") + alarmSoundServiceHelper.stopService(context, "Muted from wear") + }, fabricPrivacy::logException) } private fun handleTddStatus() { diff --git a/shared/src/main/java/info/nightscout/shared/weardata/EventData.kt b/shared/src/main/java/info/nightscout/shared/weardata/EventData.kt index f570743aa6..aca2303c89 100644 --- a/shared/src/main/java/info/nightscout/shared/weardata/EventData.kt +++ b/shared/src/main/java/info/nightscout/shared/weardata/EventData.kt @@ -234,4 +234,7 @@ sealed class EventData : Event() { @Serializable // returnCommand is sent back to Mobile after confirmation data class ConfirmAction(val title: String, val message: String, val returnCommand: EventData?) : EventData() -} \ No newline at end of file + + @Serializable + data class SnoozeAlert(val timeStamp: Long) : EventData() +} diff --git a/wear/src/main/AndroidManifest.xml b/wear/src/main/AndroidManifest.xml index 88b52fc779..3d10810e37 100644 --- a/wear/src/main/AndroidManifest.xml +++ b/wear/src/main/AndroidManifest.xml @@ -629,5 +629,17 @@ + + + + + + + + diff --git a/wear/src/main/java/info/nightscout/androidaps/di/WearActivitiesModule.kt b/wear/src/main/java/info/nightscout/androidaps/di/WearActivitiesModule.kt index 18a63adb66..7055b32be0 100644 --- a/wear/src/main/java/info/nightscout/androidaps/di/WearActivitiesModule.kt +++ b/wear/src/main/java/info/nightscout/androidaps/di/WearActivitiesModule.kt @@ -2,6 +2,7 @@ package info.nightscout.androidaps.di import dagger.Module import dagger.android.ContributesAndroidInjector +import info.nightscout.androidaps.interaction.actions.QuickSnoozeActivity import info.nightscout.androidaps.interaction.ConfigurationActivity import info.nightscout.androidaps.interaction.TileConfigurationActivity import info.nightscout.androidaps.interaction.actions.* @@ -34,4 +35,5 @@ abstract class WearActivitiesModule { @ContributesAndroidInjector abstract fun contributesFillMenuActivity(): FillMenuActivity @ContributesAndroidInjector abstract fun contributesMainMenuActivity(): MainMenuActivity @ContributesAndroidInjector abstract fun contributesStatusMenuActivity(): StatusMenuActivity -} \ No newline at end of file + @ContributesAndroidInjector abstract fun contributesQuickSnoozeActivity(): QuickSnoozeActivity +} diff --git a/wear/src/main/java/info/nightscout/androidaps/interaction/actions/QuickSnoozeActivity.kt b/wear/src/main/java/info/nightscout/androidaps/interaction/actions/QuickSnoozeActivity.kt new file mode 100644 index 0000000000..bb36a43221 --- /dev/null +++ b/wear/src/main/java/info/nightscout/androidaps/interaction/actions/QuickSnoozeActivity.kt @@ -0,0 +1,52 @@ +package info.nightscout.androidaps.interaction.actions + +import android.content.Intent +import android.content.pm.PackageManager +import android.os.Bundle +import android.util.Log +import android.widget.Toast +import dagger.android.DaggerActivity +import info.nightscout.androidaps.R +import info.nightscout.androidaps.events.EventWearToMobile +import info.nightscout.androidaps.plugins.bus.RxBus +import info.nightscout.shared.weardata.EventData +import javax.inject.Inject + +/** + * Send a snooze request to silence any alarm. Designed to be bound to a button for fast access + */ + +class QuickSnoozeActivity : DaggerActivity() { + + @Inject lateinit var rxBus: RxBus + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + Toast.makeText(this, R.string.sending_snooze, Toast.LENGTH_LONG).show() + rxBus.send(EventWearToMobile(EventData.SnoozeAlert(System.currentTimeMillis()))) + + val xDripPackageName = "com.eveningoutpost.dexdrip" + if (isPackageExisted(xDripPackageName)) { + try { + val i = Intent() + i.setClassName(xDripPackageName, "$xDripPackageName.QuickSnooze") + startActivity(i) + } catch (e : Exception) { + Log.e("WEAR", "failed to snooze xDrip: ", e) + } + } else { + Log.d("WEAR", "Package $xDripPackageName not available for snooze") + } + + finish() + } + + private fun isPackageExisted(targetPackage: String?): Boolean { + try { + packageManager.getPackageInfo(targetPackage!!, PackageManager.GET_META_DATA) + } catch (e: PackageManager.NameNotFoundException) { + return false + } + return true + } +} diff --git a/wear/src/main/res/drawable/ic_icon_snooze.png b/wear/src/main/res/drawable/ic_icon_snooze.png new file mode 100644 index 0000000000000000000000000000000000000000..78334d1d78c13cfac185deba07b8280d1bcbf33a GIT binary patch literal 3919 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 00,0 0,00U + AAPS Snooze Alert + Sending Snooze to AAPS + From 506b6dd2134699235c52519868e3b2de66038ed3 Mon Sep 17 00:00:00 2001 From: Andries Smit Date: Sun, 26 Jun 2022 13:16:40 +0200 Subject: [PATCH 41/44] chore: update snooze icon --- wear/src/main/res/drawable/ic_icon_snooze.png | Bin 3919 -> 24861 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/wear/src/main/res/drawable/ic_icon_snooze.png b/wear/src/main/res/drawable/ic_icon_snooze.png index 78334d1d78c13cfac185deba07b8280d1bcbf33a..31b80685be1ddc6ae6e41d146641773bb06a122c 100644 GIT binary patch literal 24861 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

  • WCP>YCs0-i346K*v=7@B;)D`5Cu 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 literal 3919 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 Date: Mon, 27 Jun 2022 08:00:02 +0200 Subject: [PATCH 42/44] chore: remove optionalality parameter --- .../androidaps/interaction/actions/QuickSnoozeActivity.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wear/src/main/java/info/nightscout/androidaps/interaction/actions/QuickSnoozeActivity.kt b/wear/src/main/java/info/nightscout/androidaps/interaction/actions/QuickSnoozeActivity.kt index bb36a43221..40a8f690e9 100644 --- a/wear/src/main/java/info/nightscout/androidaps/interaction/actions/QuickSnoozeActivity.kt +++ b/wear/src/main/java/info/nightscout/androidaps/interaction/actions/QuickSnoozeActivity.kt @@ -41,9 +41,9 @@ class QuickSnoozeActivity : DaggerActivity() { finish() } - private fun isPackageExisted(targetPackage: String?): Boolean { + private fun isPackageExisted(targetPackage: String): Boolean { try { - packageManager.getPackageInfo(targetPackage!!, PackageManager.GET_META_DATA) + packageManager.getPackageInfo(targetPackage, PackageManager.GET_META_DATA) } catch (e: PackageManager.NameNotFoundException) { return false } From 951b33ded7741aa2c7fd5d47a23eddcd93f3d62e Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Tue, 28 Jun 2022 11:25:14 +0200 Subject: [PATCH 43/44] Autotune: resolve NPE --- .../activities/MyPreferenceFragment.kt | 2 +- .../general/autotune/AutotuneFragment.kt | 101 ++++++++++-------- .../general/nsclient/NSClientFragment.kt | 28 +++++ 3 files changed, 83 insertions(+), 48 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/activities/MyPreferenceFragment.kt b/app/src/main/java/info/nightscout/androidaps/activities/MyPreferenceFragment.kt index ccd6b6f484..c0f577d427 100644 --- a/app/src/main/java/info/nightscout/androidaps/activities/MyPreferenceFragment.kt +++ b/app/src/main/java/info/nightscout/androidaps/activities/MyPreferenceFragment.kt @@ -350,7 +350,7 @@ class MyPreferenceFragment : PreferenceFragmentCompat(), OnSharedPreferenceChang } } if (pref is EditTextPreference) { - if (pref.getKey().contains("password") || pref.getKey().contains("pin") || pref.getKey().contains("secret")) { + if (pref.getKey().contains("password") || pref.getKey().contains("pin") || pref.getKey().contains("secret") || pref.getKey().contains("token")) { pref.setSummary("******") } else if (pref.text != null) { pref.dialogMessage = pref.dialogMessage diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/autotune/AutotuneFragment.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/autotune/AutotuneFragment.kt index 2b467cb500..b0f3303c4e 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/autotune/AutotuneFragment.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/autotune/AutotuneFragment.kt @@ -18,37 +18,37 @@ import dagger.android.HasAndroidInjector import dagger.android.support.DaggerFragment import info.nightscout.androidaps.Constants import info.nightscout.androidaps.R +import info.nightscout.androidaps.data.LocalInsulin +import info.nightscout.androidaps.data.ProfileSealed +import info.nightscout.androidaps.database.entities.UserEntry +import info.nightscout.androidaps.database.entities.ValueWithUnit import info.nightscout.androidaps.databinding.AutotuneFragmentBinding import info.nightscout.androidaps.dialogs.ProfileViewerDialog +import info.nightscout.androidaps.extensions.runOnUiThread +import info.nightscout.androidaps.extensions.toVisibility +import info.nightscout.androidaps.interfaces.* +import info.nightscout.androidaps.logging.UserEntryLogger import info.nightscout.androidaps.plugins.bus.RxBus import info.nightscout.androidaps.plugins.general.autotune.data.ATProfile import info.nightscout.androidaps.plugins.general.autotune.events.EventAutotuneUpdateGui import info.nightscout.androidaps.plugins.profile.local.LocalProfilePlugin import info.nightscout.androidaps.plugins.profile.local.events.EventLocalProfileChanged -import info.nightscout.androidaps.data.LocalInsulin -import info.nightscout.androidaps.data.ProfileSealed -import info.nightscout.androidaps.database.entities.UserEntry -import info.nightscout.androidaps.database.entities.ValueWithUnit -import info.nightscout.androidaps.extensions.runOnUiThread -import info.nightscout.androidaps.interfaces.* -import info.nightscout.androidaps.logging.UserEntryLogger import info.nightscout.androidaps.utils.DateUtil import info.nightscout.androidaps.utils.FabricPrivacy import info.nightscout.androidaps.utils.MidnightTime import info.nightscout.androidaps.utils.Round import info.nightscout.androidaps.utils.alertDialogs.OKDialog.showConfirmation +import info.nightscout.androidaps.utils.rx.AapsSchedulers import info.nightscout.shared.SafeParse import info.nightscout.shared.sharedPreferences.SP -import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers import io.reactivex.rxjava3.disposables.CompositeDisposable import io.reactivex.rxjava3.kotlin.plusAssign import org.json.JSONObject -//import org.slf4j.LoggerFactory import java.text.DecimalFormat -import java.util.* import javax.inject.Inject class AutotuneFragment : DaggerFragment() { + @Inject lateinit var profileFunction: ProfileFunction @Inject lateinit var autotunePlugin: AutotunePlugin @Inject lateinit var autotuneFS: AutotuneFS @@ -61,13 +61,16 @@ class AutotuneFragment : DaggerFragment() { @Inject lateinit var rh: ResourceHelper @Inject lateinit var rxBus: RxBus @Inject lateinit var injector: HasAndroidInjector + @Inject lateinit var aapsSchedulers: AapsSchedulers private var disposable: CompositeDisposable = CompositeDisposable() + //private val log = LoggerFactory.getLogger(AutotunePlugin::class.java) private var _binding: AutotuneFragmentBinding? = null private lateinit var profileStore: ProfileStore private var profileName = "" - private lateinit var profile: ATProfile + private var profile: ATProfile? = null + // This property is only valid between onCreateView and // onDestroyView. private val binding get() = _binding!! @@ -88,12 +91,13 @@ class AutotuneFragment : DaggerFragment() { profileStore = activePlugin.activeProfileSource.profile ?: ProfileStore(injector, JSONObject(), dateUtil) profileName = if (binding.profileList.text.toString() == rh.gs(R.string.active)) "" else binding.profileList.text.toString() profileFunction.getProfile()?.let { currentProfile -> - profile = ATProfile(profileStore.getSpecificProfile(profileName)?.let { ProfileSealed.Pure(it) } ?:currentProfile, LocalInsulin(""), injector) + profile = ATProfile(profileStore.getSpecificProfile(profileName)?.let { ProfileSealed.Pure(it) } ?: currentProfile, LocalInsulin(""), injector) } binding.tuneDays.setParams( savedInstanceState?.getDouble("tunedays") - ?: defaultValue, 1.0, 30.0, 1.0, DecimalFormat("0"), false, null, textWatcher) + ?: defaultValue, 1.0, 30.0, 1.0, DecimalFormat("0"), false, null, textWatcher + ) binding.autotuneRun.setOnClickListener { val daysBack = SafeParse.stringToInt(binding.tuneDays.text) autotunePlugin.calculationRunning = true @@ -105,11 +109,10 @@ class AutotuneFragment : DaggerFragment() { updateGui() } binding.profileList.onItemClickListener = AdapterView.OnItemClickListener { _, _, _, _ -> - if (!autotunePlugin.calculationRunning) - { + if (!autotunePlugin.calculationRunning) { profileName = if (binding.profileList.text.toString() == rh.gs(R.string.active)) "" else binding.profileList.text.toString() profileFunction.getProfile()?.let { currentProfile -> - profile = ATProfile(profileStore.getSpecificProfile(profileName)?.let { ProfileSealed.Pure(it) } ?:currentProfile, LocalInsulin(""), injector) + profile = ATProfile(profileStore.getSpecificProfile(profileName)?.let { ProfileSealed.Pure(it) } ?: currentProfile, LocalInsulin(""), injector) } autotunePlugin.selectedProfile = profileName resetParam() @@ -120,7 +123,7 @@ class AutotuneFragment : DaggerFragment() { binding.autotuneCopylocal.setOnClickListener { val localName = rh.gs(R.string.autotune_tunedprofile_name) + " " + dateUtil.dateAndTimeString(autotunePlugin.lastRun) val circadian = sp.getBoolean(R.string.key_autotune_circadian_ic_isf, false) - autotunePlugin.tunedProfile?.let { tunedProfile -> + autotunePlugin.tunedProfile?.let { tunedProfile -> showConfirmation(requireContext(), rh.gs(R.string.autotune_copy_localprofile_button), rh.gs(R.string.autotune_copy_local_profile_message) + "\n" + localName + " " + dateUtil.dateAndTimeString(autotunePlugin.lastRun), @@ -204,13 +207,13 @@ class AutotuneFragment : DaggerFragment() { binding.autotuneCompare.setOnClickListener { val pumpProfile = autotunePlugin.pumpProfile val circadian = sp.getBoolean(R.string.key_autotune_circadian_ic_isf, false) - val tunedprofile = if (circadian) autotunePlugin.tunedProfile?.circadianProfile else autotunePlugin.tunedProfile?.profile + val tunedProfile = if (circadian) autotunePlugin.tunedProfile?.circadianProfile else autotunePlugin.tunedProfile?.profile ProfileViewerDialog().also { pvd -> pvd.arguments = Bundle().also { it.putLong("time", dateUtil.now()) it.putInt("mode", ProfileViewerDialog.Mode.PROFILE_COMPARE.ordinal) it.putString("customProfile", pumpProfile.profile.toPureNsJson(dateUtil).toString()) - it.putString("customProfile2", tunedprofile?.toPureNsJson(dateUtil).toString()) + it.putString("customProfile2", tunedProfile?.toPureNsJson(dateUtil).toString()) it.putString("customProfileUnits", profileFunction.getUnits().asText) it.putString("customProfileName", pumpProfile.profilename + "\n" + rh.gs(R.string.autotune_tunedprofile_name)) } @@ -270,10 +273,8 @@ class AutotuneFragment : DaggerFragment() { super.onResume() disposable += rxBus .toObservable(EventAutotuneUpdateGui::class.java) - .observeOn(AndroidSchedulers.mainThread()) - .subscribe({ - updateGui() - }, { fabricPrivacy.logException(it) }) + .observeOn(aapsSchedulers.main) + .subscribe({ updateGui() }, fabricPrivacy::logException) checkNewDay() updateGui() } @@ -291,7 +292,7 @@ class AutotuneFragment : DaggerFragment() { profileStore = activePlugin.activeProfileSource.profile ?: ProfileStore(injector, JSONObject(), dateUtil) profileName = if (binding.profileList.text.toString() == rh.gs(R.string.active)) "" else binding.profileList.text.toString() profileFunction.getProfile()?.let { currentProfile -> - profile = ATProfile(profileStore.getSpecificProfile(profileName)?.let { ProfileSealed.Pure(it) } ?:currentProfile, LocalInsulin(""), injector) + profile = ATProfile(profileStore.getSpecificProfile(profileName)?.let { ProfileSealed.Pure(it) } ?: currentProfile, LocalInsulin(""), injector) } val profileList: ArrayList = profileStore.getProfileList() profileList.add(0, rh.gs(R.string.active)) @@ -315,17 +316,18 @@ class AutotuneFragment : DaggerFragment() { autotunePlugin.calculationRunning -> { binding.tuneWarning.text = rh.gs(R.string.autotune_warning_during_run) } + autotunePlugin.lastRunSuccess -> { - binding.autotuneCopylocal.visibility = View.VISIBLE - binding.autotuneUpdateProfile.visibility = autotunePlugin.updateButtonVisibility - binding.autotuneRevertProfile.visibility = if (autotunePlugin.updateButtonVisibility == View.VISIBLE) View.GONE else View.VISIBLE - binding.autotuneProfileswitch.visibility = View.VISIBLE - binding.tuneWarning.text = rh.gs(R.string.autotune_warning_after_run) + binding.autotuneCopylocal.visibility = View.VISIBLE + binding.autotuneUpdateProfile.visibility = autotunePlugin.updateButtonVisibility + binding.autotuneRevertProfile.visibility = if (autotunePlugin.updateButtonVisibility == View.VISIBLE) View.GONE else View.VISIBLE + binding.autotuneProfileswitch.visibility = View.VISIBLE + binding.tuneWarning.text = rh.gs(R.string.autotune_warning_after_run) binding.autotuneCompare.visibility = View.VISIBLE } + else -> { - if (profile.isValid) - binding.autotuneRun.visibility = View.VISIBLE + binding.autotuneRun.visibility = (profile?.isValid == true).toVisibility() binding.autotuneCheckInputProfile.visibility = View.VISIBLE } } @@ -335,10 +337,9 @@ class AutotuneFragment : DaggerFragment() { private fun checkNewDay() { val runToday = autotunePlugin.lastRun > MidnightTime.calc(dateUtil.now() - autotunePlugin.autotuneStartHour * 3600 * 1000L) + autotunePlugin.autotuneStartHour * 3600 * 1000L - if (runToday && autotunePlugin.result != "") - { + if (runToday && autotunePlugin.result != "") { binding.tuneWarning.text = rh.gs(R.string.autotune_warning_after_run) - } else if (!runToday || autotunePlugin.result.isEmpty()) { //if new day reinit result, default days, warning and button's visibility + } else if (!runToday || autotunePlugin.result.isEmpty()) { //if new day re-init result, default days, warning and button's visibility resetParam(!runToday) } } @@ -348,17 +349,18 @@ class AutotuneFragment : DaggerFragment() { var nl = "" if (profileFunction.getProfile() == null) { warning = rh.gs(R.string.profileswitch_ismissing) - return warning + return warning } profileFunction.getProfile()?.let { currentProfile -> - profile = ATProfile(profileStore.getSpecificProfile(profileName)?.let { ProfileSealed.Pure(it) } ?:currentProfile, LocalInsulin(""), injector) - if (!profile.isValid) return rh.gs(R.string.autotune_profile_invalid) - if (profile.icSize > 1) { - warning += nl + rh.gs(R.string.autotune_ic_warning, profile.icSize, profile.ic) - nl = "\n" - } - if (profile.isfSize > 1) { - warning += nl + rh.gs(R.string.autotune_isf_warning, profile.isfSize, Profile.fromMgdlToUnits(profile.isf, profileFunction.getUnits()), profileFunction.getUnits().asText) + profile = ATProfile(profileStore.getSpecificProfile(profileName)?.let { ProfileSealed.Pure(it) } ?: currentProfile, LocalInsulin(""), injector).also { profile -> + if (!profile.isValid) return rh.gs(R.string.autotune_profile_invalid) + if (profile.icSize > 1) { + warning += nl + rh.gs(R.string.autotune_ic_warning, profile.icSize, profile.ic) + nl = "\n" + } + if (profile.isfSize > 1) { + warning += nl + rh.gs(R.string.autotune_isf_warning, profile.isfSize, Profile.fromMgdlToUnits(profile.isf, profileFunction.getUnits()), profileFunction.getUnits().asText) + } } } return warning @@ -376,7 +378,10 @@ class AutotuneFragment : DaggerFragment() { } private val textWatcher = object : TextWatcher { - override fun afterTextChanged(s: Editable) { updateGui() } + override fun afterTextChanged(s: Editable) { + updateGui() + } + override fun beforeTextChanged(s: CharSequence, start: Int, count: Int, after: Int) {} override fun onTextChanged(s: CharSequence, start: Int, before: Int, count: Int) { if (binding.tuneDays.text.isNotEmpty()) { @@ -387,7 +392,9 @@ class AutotuneFragment : DaggerFragment() { autotunePlugin.lastNbDays = binding.tuneDays.text resetParam(false) } - } catch (e:Exception) { } + } catch (e: Exception) { + fabricPrivacy.logException(e) + } } } } @@ -469,7 +476,7 @@ class AutotuneFragment : DaggerFragment() { } } - private fun toTableRowHeader(basal:Boolean = false): TableRow = + private fun toTableRowHeader(basal: Boolean = false): TableRow = TableRow(context).also { header -> val lp = TableRow.LayoutParams(TableRow.LayoutParams.WRAP_CONTENT, TableRow.LayoutParams.WRAP_CONTENT).apply { weight = 1f } header.layoutParams = TableRow.LayoutParams(TableRow.LayoutParams.MATCH_PARENT, TableRow.LayoutParams.WRAP_CONTENT).apply { gravity = Gravity.CENTER_HORIZONTAL } @@ -500,7 +507,7 @@ class AutotuneFragment : DaggerFragment() { }) } - private fun toTableRowValue(hour: String, inputValue: Double, tunedValue: Double, format:String = "%.3f", missing: String = ""): TableRow = + private fun toTableRowValue(hour: String, inputValue: Double, tunedValue: Double, format: String = "%.3f", missing: String = ""): TableRow = TableRow(context).also { row -> val percentValue = Round.roundTo(tunedValue / inputValue * 100 - 100, 1.0).toInt().toString() + "%" val lp = TableRow.LayoutParams(TableRow.LayoutParams.WRAP_CONTENT, TableRow.LayoutParams.WRAP_CONTENT).apply { weight = 1f } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/NSClientFragment.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/NSClientFragment.kt index 43061ed25f..a8049910f8 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/NSClientFragment.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/NSClientFragment.kt @@ -17,9 +17,15 @@ import info.nightscout.androidaps.plugins.general.nsclient.events.EventNSClientU import info.nightscout.androidaps.utils.FabricPrivacy import info.nightscout.androidaps.utils.alertDialogs.OKDialog import info.nightscout.androidaps.utils.rx.AapsSchedulers +import info.nightscout.sdk.NSAndroidClient +import info.nightscout.shared.logging.AAPSLogger import info.nightscout.shared.sharedPreferences.SP import io.reactivex.rxjava3.disposables.CompositeDisposable import io.reactivex.rxjava3.kotlin.plusAssign +import kotlinx.coroutines.CoroutineScope +import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.SupervisorJob +import kotlinx.coroutines.launch import javax.inject.Inject class NSClientFragment : DaggerFragment() { @@ -32,6 +38,7 @@ class NSClientFragment : DaggerFragment() { @Inject lateinit var aapsSchedulers: AapsSchedulers @Inject lateinit var dataSyncSelector: DataSyncSelector @Inject lateinit var uel: UserEntryLogger + @Inject lateinit var aapsLogger: AAPSLogger companion object { @@ -39,6 +46,7 @@ class NSClientFragment : DaggerFragment() { const val ID_MENU_RESTART = 7 const val ID_MENU_SEND_NOW = 8 const val ID_MENU_FULL_SYNC = 9 + const val ID_MENU_STATUS = 10 } private val disposable = CompositeDisposable() @@ -80,6 +88,7 @@ class NSClientFragment : DaggerFragment() { menu.add(Menu.FIRST, ID_MENU_RESTART, 0, rh.gs(R.string.restart)).setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER) menu.add(Menu.FIRST, ID_MENU_SEND_NOW, 0, rh.gs(R.string.deliver_now)).setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER) menu.add(Menu.FIRST, ID_MENU_FULL_SYNC, 0, rh.gs(R.string.full_sync)).setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER) + menu.add(Menu.FIRST, ID_MENU_STATUS, 0, "TEST STATUS").setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER) menu.setGroupDividerEnabled(true) } } @@ -111,6 +120,25 @@ class NSClientFragment : DaggerFragment() { true } + ID_MENU_STATUS -> { + context?.let { context -> + val scope = CoroutineScope(Dispatchers.IO + SupervisorJob()) + scope.launch { + val client = NSAndroidClient( + baseUrl = sp.getString(R.string.key_nsclientinternal_url, "").lowercase().replace("https://", ""), + accessToken = sp.getString(R.string.key_nsclient_token, ""), + context = context, + logging = true + ) + val status = client.getStatus() + aapsLogger.debug(status.toString()) + val svgs = client.getSgvs() + aapsLogger.debug(svgs.toString()) + } + } + true + } + else -> false } From b223dfbaf023df2a8cc2182bd1393274642b7e02 Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Tue, 28 Jun 2022 18:07:59 +0200 Subject: [PATCH 44/44] fix NSClientFragment --- .../general/nsclient/NSClientFragment.kt | 28 ------------------- 1 file changed, 28 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/NSClientFragment.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/NSClientFragment.kt index a8049910f8..43061ed25f 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/NSClientFragment.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/NSClientFragment.kt @@ -17,15 +17,9 @@ import info.nightscout.androidaps.plugins.general.nsclient.events.EventNSClientU import info.nightscout.androidaps.utils.FabricPrivacy import info.nightscout.androidaps.utils.alertDialogs.OKDialog import info.nightscout.androidaps.utils.rx.AapsSchedulers -import info.nightscout.sdk.NSAndroidClient -import info.nightscout.shared.logging.AAPSLogger import info.nightscout.shared.sharedPreferences.SP import io.reactivex.rxjava3.disposables.CompositeDisposable import io.reactivex.rxjava3.kotlin.plusAssign -import kotlinx.coroutines.CoroutineScope -import kotlinx.coroutines.Dispatchers -import kotlinx.coroutines.SupervisorJob -import kotlinx.coroutines.launch import javax.inject.Inject class NSClientFragment : DaggerFragment() { @@ -38,7 +32,6 @@ class NSClientFragment : DaggerFragment() { @Inject lateinit var aapsSchedulers: AapsSchedulers @Inject lateinit var dataSyncSelector: DataSyncSelector @Inject lateinit var uel: UserEntryLogger - @Inject lateinit var aapsLogger: AAPSLogger companion object { @@ -46,7 +39,6 @@ class NSClientFragment : DaggerFragment() { const val ID_MENU_RESTART = 7 const val ID_MENU_SEND_NOW = 8 const val ID_MENU_FULL_SYNC = 9 - const val ID_MENU_STATUS = 10 } private val disposable = CompositeDisposable() @@ -88,7 +80,6 @@ class NSClientFragment : DaggerFragment() { menu.add(Menu.FIRST, ID_MENU_RESTART, 0, rh.gs(R.string.restart)).setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER) menu.add(Menu.FIRST, ID_MENU_SEND_NOW, 0, rh.gs(R.string.deliver_now)).setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER) menu.add(Menu.FIRST, ID_MENU_FULL_SYNC, 0, rh.gs(R.string.full_sync)).setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER) - menu.add(Menu.FIRST, ID_MENU_STATUS, 0, "TEST STATUS").setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER) menu.setGroupDividerEnabled(true) } } @@ -120,25 +111,6 @@ class NSClientFragment : DaggerFragment() { true } - ID_MENU_STATUS -> { - context?.let { context -> - val scope = CoroutineScope(Dispatchers.IO + SupervisorJob()) - scope.launch { - val client = NSAndroidClient( - baseUrl = sp.getString(R.string.key_nsclientinternal_url, "").lowercase().replace("https://", ""), - accessToken = sp.getString(R.string.key_nsclient_token, ""), - context = context, - logging = true - ) - val status = client.getStatus() - aapsLogger.debug(status.toString()) - val svgs = client.getSgvs() - aapsLogger.debug(svgs.toString()) - } - } - true - } - else -> false }