Merge branch 'dev' into insightfix

This commit is contained in:
Milos Kozak 2018-08-28 14:11:34 +02:00
commit abc374193a
25 changed files with 157 additions and 234 deletions

View file

@ -29,9 +29,7 @@ repositories {
}
def generateGitBuild = { ->
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append('"')
try {
def stdout = new ByteArrayOutputStream()
exec {
@ -43,9 +41,12 @@ def generateGitBuild = { ->
} catch (ignored) {
stringBuilder.append('NoGitSystemAvailable')
}
stringBuilder.append('-')
return stringBuilder.toString()
}
def generateDate = { ->
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append((new Date()).format('yyyy.MM.dd-HH:mm'))
stringBuilder.append('"')
return stringBuilder.toString()
}
@ -62,9 +63,10 @@ android {
targetSdkVersion 25
multiDexEnabled true
versionCode 1500
version "2.0e-dev"
version "2.0f-dev"
buildConfigField "String", "VERSION", '"' + version + '"'
buildConfigField "String", "BUILDVERSION", generateGitBuild()
buildConfigField "String", "BUILDVERSION", '"' + generateGitBuild() + '-' + generateDate() + '"'
buildConfigField "String", "HEAD", '"' + generateGitBuild() + '"'
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
ndk {

View file

@ -321,7 +321,7 @@ public class NewNSTreatmentDialog extends DialogFragment implements View.OnClick
if (profile != null)
maxPercent = MainApp.getConstraintChecker().getMaxBasalPercentAllowed(profile).value();
editPercent = (NumberPicker) view.findViewById(R.id.careportal_newnstreatment_percentinput);
editPercent.setParams(0d, 0d, (double) maxPercent, 5d, new DecimalFormat("0"), true, percentTextWatcher);
editPercent.setParams(0d, -100d, (double) maxPercent, 5d, new DecimalFormat("0"), true, percentTextWatcher);
TextWatcher absoluteTextWatcher = new TextWatcher() {
@Override

View file

@ -135,18 +135,21 @@ public class IobCobCalculatorPlugin extends PluginBase {
long bgTime = bgReadings.get(i).date;
long lastbgTime = bgReadings.get(i - 1).date;
long diff = lastbgTime - bgTime;
diff %= T.mins(5).msecs();
if (diff > T.mins(2).plus(T.secs(30)).msecs())
diff = diff - T.mins(5).msecs();
totalDiff += diff;
if (diff > T.secs(30).msecs() && diff < T.secs(270).msecs()) { // 0:30 - 4:30
diff = Math.abs(diff);
if (diff > T.secs(30).msecs()) {
if (L.isEnabled(L.AUTOSENS))
log.debug("Interval detection: values: " + bgReadings.size() + " diff: " + (diff / 1000) + "sec is5minData: " + false);
log.debug("Interval detection: values: " + bgReadings.size() + " diff: " + (diff / 1000) + "[s] is5minData: " + false);
return false;
}
}
double intervals = totalDiff / (5 * 60 * 1000d);
double variability = Math.abs(intervals - Math.round(intervals));
boolean is5mindata = variability < 0.02;
double averageDiff = totalDiff / (bgReadings.size() -1) / 1000d;
boolean is5mindata = averageDiff < 10;
if (L.isEnabled(L.AUTOSENS))
log.debug("Interval detection: values: " + bgReadings.size() + " variability: " + variability + " is5minData: " + is5mindata);
log.debug("Interval detection: values: " + bgReadings.size() + " averageDiff: " + averageDiff + "[s] is5minData: " + is5mindata);
return is5mindata;
}
}
@ -281,7 +284,7 @@ public class IobCobCalculatorPlugin extends PluginBase {
}
// Normalize bucketed data
for (int i = bucketed_data.size() - 2; i > 0; i--) {
for (int i = bucketed_data.size() - 2; i >= 0; i--) {
BgReading current = bucketed_data.get(i);
BgReading previous = bucketed_data.get(i + 1);
long msecDiff = current.date - previous.date;

View file

@ -30,6 +30,8 @@ import info.nightscout.androidaps.plugins.ConfigBuilder.ProfileFunctions;
import info.nightscout.androidaps.plugins.IobCobCalculator.events.EventAutosensCalculationFinished;
import info.nightscout.androidaps.plugins.IobCobCalculator.events.EventIobCalculationProgress;
import info.nightscout.androidaps.plugins.OpenAPSSMB.SMBDefaults;
import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification;
import info.nightscout.androidaps.plugins.Overview.notifications.Notification;
import info.nightscout.androidaps.plugins.Treatments.Treatment;
import info.nightscout.androidaps.plugins.Treatments.TreatmentsPlugin;
import info.nightscout.utils.DateUtil;
@ -182,13 +184,20 @@ public class IobCobOref1Thread extends Thread {
if (L.isEnabled(L.AUTOSENS))
log.debug(">>>>> bucketed_data.size()=" + bucketed_data.size() + " i=" + i + " hourAgoData=" + hourAgoData.toString());
int past = 1;
// try {
try {
for (; past < 12; past++) {
AutosensData ad = autosensDataTable.valueAt(initialIndex + past);
if (L.isEnabled(L.AUTOSENS)) {
log.debug(">>>>> past=" + past + " ad=" + (ad != null ? ad.toString() : null));
if (ad == null)
autosensDataTable.toString();
if (ad == null) {
log.debug(autosensDataTable.toString());
log.debug(bucketed_data.toString());
log.debug(IobCobCalculatorPlugin.getPlugin().getBgReadings().toString());
Notification notification = new Notification(Notification.SENDLOGFILES, MainApp.gs(R.string.sendlogfiles), Notification.LOW);
MainApp.bus().post(new EventNewNotification(notification));
SP.putBoolean("log_AUTOSENS", true);
break;
}
}
// let it here crash on NPE to get more data as i cannot reproduce this bug
double deviationSlope = (ad.avgDeviation - avgDeviation) / (ad.time - bgTime) * 1000 * 60 * 5;
@ -204,17 +213,24 @@ public class IobCobOref1Thread extends Thread {
//if (Config.isEnabled(L.AUTOSENS))
// log.debug("Deviations: " + new Date(bgTime) + new Date(ad.time) + " avgDeviation=" + avgDeviation + " deviationSlope=" + deviationSlope + " slopeFromMaxDeviation=" + slopeFromMaxDeviation + " slopeFromMinDeviation=" + slopeFromMinDeviation);
}
// } catch (Exception e) {
// log.error("Unhandled exception", e);
// FabricPrivacy.logException(e);
// FabricPrivacy.getInstance().logCustom(new CustomEvent("CatchedError")
// .putCustomAttribute("buildversion", BuildConfig.BUILDVERSION)
// .putCustomAttribute("version", BuildConfig.VERSION)
// .putCustomAttribute("autosensDataTable", iobCobCalculatorPlugin.getAutosensDataTable().toString())
// .putCustomAttribute("for_data", ">>>>> bucketed_data.size()=" + bucketed_data.size() + " i=" + i + "hourAgoData=" + hourAgoData.toString())
// .putCustomAttribute("past", past)
// );
// }
} catch (Exception e) {
log.error("Unhandled exception", e);
FabricPrivacy.logException(e);
FabricPrivacy.getInstance().logCustom(new CustomEvent("CatchedError")
.putCustomAttribute("buildversion", BuildConfig.BUILDVERSION)
.putCustomAttribute("version", BuildConfig.VERSION)
.putCustomAttribute("autosensDataTable", iobCobCalculatorPlugin.getAutosensDataTable().toString())
.putCustomAttribute("for_data", ">>>>> bucketed_data.size()=" + bucketed_data.size() + " i=" + i + "hourAgoData=" + hourAgoData.toString())
.putCustomAttribute("past", past)
);
log.debug(autosensDataTable.toString());
log.debug(bucketed_data.toString());
log.debug(IobCobCalculatorPlugin.getPlugin().getBgReadings().toString());
Notification notification = new Notification(Notification.SENDLOGFILES, MainApp.gs(R.string.sendlogfiles), Notification.LOW);
MainApp.bus().post(new EventNewNotification(notification));
SP.putBoolean("log_AUTOSENS", true);
break;
}
} else {
if (L.isEnabled(L.AUTOSENS))
log.debug(">>>>> bucketed_data.size()=" + bucketed_data.size() + " i=" + i + " hourAgoData=" + "null");

View file

@ -28,6 +28,8 @@ import info.nightscout.androidaps.plugins.ConfigBuilder.ProfileFunctions;
import info.nightscout.androidaps.plugins.IobCobCalculator.events.EventAutosensCalculationFinished;
import info.nightscout.androidaps.plugins.IobCobCalculator.events.EventIobCalculationProgress;
import info.nightscout.androidaps.plugins.OpenAPSSMB.SMBDefaults;
import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification;
import info.nightscout.androidaps.plugins.Overview.notifications.Notification;
import info.nightscout.androidaps.plugins.Sensitivity.SensitivityAAPSPlugin;
import info.nightscout.androidaps.plugins.Sensitivity.SensitivityWeightedAveragePlugin;
import info.nightscout.androidaps.plugins.Treatments.Treatment;
@ -181,13 +183,20 @@ public class IobCobThread extends Thread {
if (L.isEnabled(L.AUTOSENS))
log.debug(">>>>> bucketed_data.size()=" + bucketed_data.size() + " i=" + i + " hourAgoData=" + hourAgoData.toString());
int past = 1;
// try {
try {
for (; past < 12; past++) {
AutosensData ad = autosensDataTable.valueAt(initialIndex + past);
if (L.isEnabled(L.AUTOSENS)) {
log.debug(">>>>> past=" + past + " ad=" + (ad != null ? ad.toString() : null));
if (ad == null)
autosensDataTable.toString();
if (ad == null) {
log.debug(autosensDataTable.toString());
log.debug(bucketed_data.toString());
log.debug(IobCobCalculatorPlugin.getPlugin().getBgReadings().toString());
Notification notification = new Notification(Notification.SENDLOGFILES, MainApp.gs(R.string.sendlogfiles), Notification.LOW);
MainApp.bus().post(new EventNewNotification(notification));
SP.putBoolean("log_AUTOSENS", true);
break;
}
}
// let it here crash on NPE to get more data as i cannot reproduce this bug
double deviationSlope = (ad.avgDeviation - avgDeviation) / (ad.time - bgTime) * 1000 * 60 * 5;
@ -203,17 +212,24 @@ public class IobCobThread extends Thread {
//if (Config.isEnabled(L.AUTOSENS))
// log.debug("Deviations: " + new Date(bgTime) + new Date(ad.time) + " avgDeviation=" + avgDeviation + " deviationSlope=" + deviationSlope + " slopeFromMaxDeviation=" + slopeFromMaxDeviation + " slopeFromMinDeviation=" + slopeFromMinDeviation);
}
// } catch (Exception e) {
// log.error("Unhandled exception", e);
// FabricPrivacy.logException(e);
// FabricPrivacy.getInstance().logCustom(new CustomEvent("CatchedError")
// .putCustomAttribute("buildversion", BuildConfig.BUILDVERSION)
// .putCustomAttribute("version", BuildConfig.VERSION)
// .putCustomAttribute("autosensDataTable", iobCobCalculatorPlugin.getAutosensDataTable().toString())
// .putCustomAttribute("for_data", ">>>>> bucketed_data.size()=" + bucketed_data.size() + " i=" + i + "hourAgoData=" + hourAgoData.toString())
// .putCustomAttribute("past", past)
// );
// }
} catch (Exception e) {
log.error("Unhandled exception", e);
FabricPrivacy.logException(e);
FabricPrivacy.getInstance().logCustom(new CustomEvent("CatchedError")
.putCustomAttribute("buildversion", BuildConfig.BUILDVERSION)
.putCustomAttribute("version", BuildConfig.VERSION)
.putCustomAttribute("autosensDataTable", iobCobCalculatorPlugin.getAutosensDataTable().toString())
.putCustomAttribute("for_data", ">>>>> bucketed_data.size()=" + bucketed_data.size() + " i=" + i + "hourAgoData=" + hourAgoData.toString())
.putCustomAttribute("past", past)
);
log.debug(autosensDataTable.toString());
log.debug(bucketed_data.toString());
log.debug(IobCobCalculatorPlugin.getPlugin().getBgReadings().toString());
Notification notification = new Notification(Notification.SENDLOGFILES, MainApp.gs(R.string.sendlogfiles), Notification.LOW);
MainApp.bus().post(new EventNewNotification(notification));
SP.putBoolean("log_AUTOSENS", true);
break;
}
} else {
if (L.isEnabled(L.AUTOSENS))
log.debug(">>>>> bucketed_data.size()=" + bucketed_data.size() + " i=" + i + " hourAgoData=" + "null");

View file

@ -1264,14 +1264,14 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
treatmentButton.setVisibility(View.GONE);
}
}
if (wizardButton != null) {
if (pump.isInitialized() && !pump.isSuspended() && wizardButton != null) {
if (SP.getBoolean(R.string.key_show_wizard_button, true)) {
wizardButton.setVisibility(View.VISIBLE);
} else {
wizardButton.setVisibility(View.GONE);
}
}
if (insulinButton != null) {
if (pump.isInitialized() && !pump.isSuspended() && insulinButton != null) {
if (SP.getBoolean(R.string.key_show_insulin_button, true)) {
insulinButton.setVisibility(View.VISIBLE);
} else {

View file

@ -67,6 +67,7 @@ public class Notification {
public static final int MAXIMUM_BASAL_VALUE_REPLACED = 39;
public static final int NSMALFUNCTION = 40;
public static final int NEWVERSIONDETECTED = 41;
public static final int SENDLOGFILES = 42;
public int id;

View file

@ -7,8 +7,6 @@ import android.support.annotation.Nullable;
import android.support.v4.app.FragmentActivity;
import android.support.v7.app.AlertDialog;
import com.crashlytics.android.answers.CustomEvent;
import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -66,7 +64,6 @@ import info.nightscout.androidaps.plugins.PumpCommon.utils.PumpUtil;
import info.nightscout.androidaps.plugins.Treatments.Treatment;
import info.nightscout.androidaps.plugins.Treatments.TreatmentsPlugin;
import info.nightscout.utils.DateUtil;
import info.nightscout.utils.FabricPrivacy;
import info.nightscout.utils.SP;
/**
@ -329,7 +326,6 @@ public class ComboPlugin extends PluginBase implements PumpInterface, Constraint
return basalProfile;
}
@NonNull
@Override
public long lastDataTime() {
return pump.lastSuccessfulCmdTime;
@ -556,10 +552,6 @@ public class ComboPlugin extends PluginBase implements PumpInterface, Constraint
}
if (waitLoops > 0) {
long waitDuration = (System.currentTimeMillis() - waitStartTime) / 1000;
FabricPrivacy.getInstance().logCustom(new CustomEvent("ComboBolusTimestampWait")
.putCustomAttribute("buildversion", BuildConfig.BUILDVERSION)
.putCustomAttribute("version", BuildConfig.VERSION)
.putCustomAttribute("waitTimeSecs", String.valueOf(waitDuration)));
if (L.isEnabled(L.PUMP))
log.debug("Waited " + waitDuration + "s for pump to switch to a fresh minute before bolusing");
}
@ -681,11 +673,6 @@ public class ComboPlugin extends PluginBase implements PumpInterface, Constraint
Notification notification = new Notification(Notification.COMBO_PUMP_ALARM, MainApp.gs(R.string.combo_error_updating_treatment_record), Notification.URGENT);
MainApp.bus().post(new EventNewNotification(notification));
}
FabricPrivacy.getInstance().logCustom(new CustomEvent("ComboBolusToDbError")
.putCustomAttribute("buildversion", BuildConfig.BUILDVERSION)
.putCustomAttribute("version", BuildConfig.VERSION)
.putCustomAttribute("bolus", String.valueOf(lastPumpBolus.amount))
.putCustomAttribute("issue", "record with same timestamp existed and was overridden"));
return false;
}
} catch (Exception e) {
@ -693,11 +680,6 @@ public class ComboPlugin extends PluginBase implements PumpInterface, Constraint
if (dbi.isSMB) {
Notification notification = new Notification(Notification.COMBO_PUMP_ALARM, MainApp.gs(R.string.combo_error_updating_treatment_record), Notification.URGENT);
MainApp.bus().post(new EventNewNotification(notification));
FabricPrivacy.getInstance().logCustom(new CustomEvent("ComboBolusToDbError")
.putCustomAttribute("buildversion", BuildConfig.BUILDVERSION)
.putCustomAttribute("version", BuildConfig.VERSION)
.putCustomAttribute("bolus", String.valueOf(lastPumpBolus.amount))
.putCustomAttribute("issue", "adding record caused exception"));
}
return false;
}
@ -1111,10 +1093,6 @@ public class ComboPlugin extends PluginBase implements PumpInterface, Constraint
if (aapsTbr == null && state.tbrActive && state.tbrRemainingDuration > 2) {
if (L.isEnabled(L.PUMP))
log.debug("Creating temp basal from pump TBR");
FabricPrivacy.getInstance().logCustom(new CustomEvent("ComboTbrMismatch")
.putCustomAttribute("buildversion", BuildConfig.BUILDVERSION)
.putCustomAttribute("version", BuildConfig.VERSION)
.putCustomAttribute("type", "new TBR on pump"));
TemporaryBasal newTempBasal = new TemporaryBasal()
.date(now)
.percent(state.tbrPercent)
@ -1124,10 +1102,6 @@ public class ComboPlugin extends PluginBase implements PumpInterface, Constraint
} else if (aapsTbr != null && aapsTbr.getPlannedRemainingMinutes() > 2 && !state.tbrActive) {
if (L.isEnabled(L.PUMP))
log.debug("Ending AAPS-TBR since pump has no TBR active");
FabricPrivacy.getInstance().logCustom(new CustomEvent("ComboTbrMismatch")
.putCustomAttribute("buildversion", BuildConfig.BUILDVERSION)
.putCustomAttribute("version", BuildConfig.VERSION)
.putCustomAttribute("type", "TBR cancelled on pump"));
TemporaryBasal tempStop = new TemporaryBasal()
.date(now)
.duration(0)
@ -1138,10 +1112,6 @@ public class ComboPlugin extends PluginBase implements PumpInterface, Constraint
Math.abs(aapsTbr.getPlannedRemainingMinutes() - state.tbrRemainingDuration) > 2)) {
if (L.isEnabled(L.PUMP))
log.debug("AAPSs and pump-TBR differ; ending AAPS-TBR and creating new TBR based on pump TBR");
FabricPrivacy.getInstance().logCustom(new CustomEvent("ComboTbrMismatch")
.putCustomAttribute("buildversion", BuildConfig.BUILDVERSION)
.putCustomAttribute("version", BuildConfig.VERSION)
.putCustomAttribute("type", "TBR on pump differs from AAPS TBR"));
TemporaryBasal tempStop = new TemporaryBasal()
.date(now - 1000)
.duration(0)
@ -1262,19 +1232,13 @@ public class ComboPlugin extends PluginBase implements PumpInterface, Constraint
if (bolusSet.size() != historyResult.history.bolusHistory.size()) {
if (L.isEnabled(L.PUMP))
log.debug("Bolus with same amount within the same minute imported. Only one will make it to the DB.");
FabricPrivacy.getInstance().logCustom(new CustomEvent("ComboBolusToDbError")
.putCustomAttribute("buildversion", BuildConfig.BUILDVERSION)
.putCustomAttribute("version", BuildConfig.VERSION)
.putCustomAttribute("bolus", "")
.putCustomAttribute("issue", "multiple pump history records with the same time and amount"));
Notification notification = new Notification(Notification.COMBO_PUMP_ALARM, MainApp.gs(R.string.
combo_error_multiple_boluses_with_identical_timestamp), Notification.URGENT);
MainApp.bus().post(new EventNewNotification(notification));
}
pumpHistoryChanged = updateDbFromPumpHistory(historyResult.history);
if (pumpHistoryChanged) {
if (L.isEnabled(L.PUMP))
if (L.isEnabled(L.PUMP) && pumpHistoryChanged) {
log.debug("Setting 'pumpHistoryChanged' true");
}

View file

@ -10,7 +10,6 @@ import android.os.SystemClock;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import com.crashlytics.android.answers.CustomEvent;
import com.google.common.base.Joiner;
import org.monkey.d.ruffy.ruffy.driver.IRTHandler;
@ -39,8 +38,6 @@ import info.nightscout.androidaps.plugins.PumpCombo.ruffyscripter.commands.ReadH
import info.nightscout.androidaps.plugins.PumpCombo.ruffyscripter.commands.ReadPumpStateCommand;
import info.nightscout.androidaps.plugins.PumpCombo.ruffyscripter.commands.SetBasalProfileCommand;
import info.nightscout.androidaps.plugins.PumpCombo.ruffyscripter.commands.SetTbrCommand;
import info.nightscout.androidaps.BuildConfig;
import info.nightscout.utils.FabricPrivacy;
/**
* Provides scripting 'runtime' and operations. consider moving operations into a separate
@ -57,8 +54,6 @@ public class RuffyScripter implements RuffyCommands {
private volatile long menuLastUpdated = 0;
private volatile boolean unparsableMenuEncountered;
private String previousCommand = "<none>";
private volatile Command activeCmd = null;
private boolean started = false;
@ -67,51 +62,43 @@ public class RuffyScripter implements RuffyCommands {
private IRTHandler mHandler = new IRTHandler.Stub() {
@Override
public void log(String message) throws RemoteException {
public void log(String message) {
if (log.isTraceEnabled()) {
log.trace("Ruffy says: " + message);
}
}
@Override
public void fail(String message) throws RemoteException {
public void fail(String message) {
log.warn("Ruffy warns: " + message);
if (message.startsWith("no connection possible"))
FabricPrivacy.getInstance().logCustom(new CustomEvent("ComboRuffyWarning").putCustomAttribute("message", "no connection possible"));
else if (message.startsWith("Error sending keep alive while rtModeRunning is still true"))
FabricPrivacy.getInstance().logCustom(new CustomEvent("ComboRuffyWarning").putCustomAttribute("message", "Error sending keep alive while rtModeRunning is still true"));
else if (message.startsWith("Error sending keep alive. rtModeRunning is false, so this is most likely a race condition during disconnect"))
FabricPrivacy.getInstance().logCustom(new CustomEvent("ComboRuffyWarning").putCustomAttribute("message", "Error sending keep alive. rtModeRunning is false, so this is most likely a race condition during disconnect"));
else
FabricPrivacy.getInstance().logCustom(new CustomEvent("ComboRuffyWarning").putCustomAttribute("message", message.substring(0, 98)));
}
@Override
public void requestBluetooth() throws RemoteException {
public void requestBluetooth() {
log.trace("Ruffy invoked requestBluetooth callback");
}
@Override
public void rtStopped() throws RemoteException {
public void rtStopped() {
log.debug("rtStopped callback invoked");
currentMenu = null;
}
@Override
public void rtStarted() throws RemoteException {
public void rtStarted() {
log.debug("rtStarted callback invoked");
}
@Override
public void rtClearDisplay() throws RemoteException {
public void rtClearDisplay() {
}
@Override
public void rtUpdateDisplay(byte[] quarter, int which) throws RemoteException {
public void rtUpdateDisplay(byte[] quarter, int which) {
}
@Override
public void rtDisplayHandleMenu(Menu menu) throws RemoteException {
public void rtDisplayHandleMenu(Menu menu) {
// method is called every ~500ms
log.debug("rtDisplayHandleMenu: " + menu);
@ -124,7 +111,7 @@ public class RuffyScripter implements RuffyCommands {
}
@Override
public void rtDisplayHandleNoMenu() throws RemoteException {
public void rtDisplayHandleNoMenu() {
log.warn("rtDisplayHandleNoMenu callback invoked");
unparsableMenuEncountered = true;
}
@ -173,10 +160,6 @@ public class RuffyScripter implements RuffyCommands {
if (!boundSucceeded) {
log.error("No connection to ruffy. Pump control unavailable.");
} else {
FabricPrivacy.getInstance().logCustom(new CustomEvent("ComboScripterInit")
.putCustomAttribute("buildversion", BuildConfig.BUILDVERSION)
.putCustomAttribute("version", BuildConfig.VERSION));
}
}
@ -227,9 +210,6 @@ public class RuffyScripter implements RuffyCommands {
@Override
public CommandResult readQuickInfo(int numberOfBolusRecordsToRetrieve) {
FabricPrivacy.getInstance().logCustom(new CustomEvent("ComboReadQuickInfoCmd")
.putCustomAttribute("buildversion", BuildConfig.BUILDVERSION)
.putCustomAttribute("version", BuildConfig.VERSION));
return runCommand(new ReadQuickInfoCommand(numberOfBolusRecordsToRetrieve));
}
@ -366,7 +346,6 @@ public class RuffyScripter implements RuffyCommands {
// ignore
}
}
previousCommand = "" + activeCmd;
activeCmd = null;
}
}
@ -435,11 +414,6 @@ public class RuffyScripter implements RuffyCommands {
}
}
log.debug("Recovery from connection loss " + (connected ? "succeeded" : "failed"));
FabricPrivacy.getInstance().logCustom(new CustomEvent("ComboRecoveryFromConnectionLoss")
.putCustomAttribute("buildversion", BuildConfig.BUILDVERSION)
.putCustomAttribute("version", BuildConfig.VERSION)
.putCustomAttribute("activeCommand", "" + (activeCmd != null ? activeCmd.getClass().getSimpleName() : ""))
.putCustomAttribute("success", connected ? "true" : "else"));
return connected;
}
@ -450,12 +424,6 @@ public class RuffyScripter implements RuffyCommands {
private PumpState recoverFromCommandFailure() {
Menu menu = this.currentMenu;
if (menu == null) {
FabricPrivacy.getInstance().logCustom(new CustomEvent("ComboRecoveryFromCommandFailure")
.putCustomAttribute("buildversion", BuildConfig.BUILDVERSION)
.putCustomAttribute("version", BuildConfig.VERSION)
.putCustomAttribute("activeCommand", "" + (activeCmd != null ? activeCmd.getClass().getSimpleName() : ""))
.putCustomAttribute("exit", "1")
.putCustomAttribute("success", "false"));
return new PumpState();
}
MenuType type = menu.getType();
@ -469,21 +437,8 @@ public class RuffyScripter implements RuffyCommands {
}
try {
PumpState pumpState = readPumpStateInternal();
FabricPrivacy.getInstance().logCustom(new CustomEvent("ComboRecoveryFromCommandFailure")
.putCustomAttribute("buildversion", BuildConfig.BUILDVERSION)
.putCustomAttribute("version", BuildConfig.VERSION)
.putCustomAttribute("activeCommand", "" + (activeCmd != null ? activeCmd.getClass().getSimpleName() : ""))
.putCustomAttribute("exit", "2")
.putCustomAttribute("success", "true"));
return pumpState;
} catch (Exception e) {
FabricPrivacy.getInstance().logCustom(new CustomEvent("ComboRecoveryFromCommandFailure")
.putCustomAttribute("buildversion", BuildConfig.BUILDVERSION)
.putCustomAttribute("version", BuildConfig.VERSION)
.putCustomAttribute("exit", "3")
.putCustomAttribute("activeCommand", "" + (activeCmd != null ? activeCmd.getClass().getSimpleName() : ""))
.putCustomAttribute("success", "false"));
log.debug("Reading pump state during recovery failed", e);
return new PumpState();
}
@ -505,11 +460,6 @@ public class RuffyScripter implements RuffyCommands {
long initialUpdateTime = menuLastUpdated;
while (initialUpdateTime == menuLastUpdated) {
if (System.currentTimeMillis() > timeoutExpired) {
FabricPrivacy.getInstance().logCustom(new CustomEvent("ComboConnectTimeout")
.putCustomAttribute("buildversion", BuildConfig.BUILDVERSION)
.putCustomAttribute("version", BuildConfig.VERSION)
.putCustomAttribute("activeCommand", "" + (activeCmd != null ? activeCmd.getClass().getSimpleName() : ""))
.putCustomAttribute("previousCommand", previousCommand));
throw new CommandException("Timeout connecting to pump");
}
SystemClock.sleep(50);
@ -818,18 +768,12 @@ public class RuffyScripter implements RuffyCommands {
@Override
public CommandResult deliverBolus(double amount, BolusProgressReporter bolusProgressReporter) {
FabricPrivacy.getInstance().logCustom(new CustomEvent("ComboBolusCmd")
.putCustomAttribute("buildversion", BuildConfig.BUILDVERSION)
.putCustomAttribute("version", BuildConfig.VERSION));
return runCommand(new BolusCommand(amount, bolusProgressReporter));
}
@Override
public void cancelBolus() {
if (activeCmd instanceof BolusCommand) {
FabricPrivacy.getInstance().logCustom(new CustomEvent("ComboBolusCmdCancel")
.putCustomAttribute("buildversion", BuildConfig.BUILDVERSION)
.putCustomAttribute("version", BuildConfig.VERSION));
((BolusCommand) activeCmd).requestCancellation();
} else {
log.error("cancelBolus called, but active command is not a bolus:" + activeCmd);
@ -838,49 +782,31 @@ public class RuffyScripter implements RuffyCommands {
@Override
public CommandResult setTbr(int percent, int duration) {
FabricPrivacy.getInstance().logCustom(new CustomEvent("ComboSetTbrCmd")
.putCustomAttribute("buildversion", BuildConfig.BUILDVERSION)
.putCustomAttribute("version", BuildConfig.VERSION));
return runCommand(new SetTbrCommand(percent, duration));
}
@Override
public CommandResult cancelTbr() {
FabricPrivacy.getInstance().logCustom(new CustomEvent("ComboCancelTbrCmd")
.putCustomAttribute("buildversion", BuildConfig.BUILDVERSION)
.putCustomAttribute("version", BuildConfig.VERSION));
return runCommand(new CancelTbrCommand());
}
@Override
public CommandResult confirmAlert(int warningCode) {
FabricPrivacy.getInstance().logCustom(new CustomEvent("ComboConfirmAlertCmd")
.putCustomAttribute("buildversion", BuildConfig.BUILDVERSION)
.putCustomAttribute("version", BuildConfig.VERSION));
return runCommand(new ConfirmAlertCommand(warningCode));
}
@Override
public CommandResult readHistory(PumpHistoryRequest request) {
FabricPrivacy.getInstance().logCustom(new CustomEvent("ComboReadHistoryCmd")
.putCustomAttribute("buildversion", BuildConfig.BUILDVERSION)
.putCustomAttribute("version", BuildConfig.VERSION));
return runCommand(new ReadHistoryCommand(request));
}
@Override
public CommandResult readBasalProfile() {
FabricPrivacy.getInstance().logCustom(new CustomEvent("ComboReadBasalProfileCmd")
.putCustomAttribute("buildversion", BuildConfig.BUILDVERSION)
.putCustomAttribute("version", BuildConfig.VERSION));
return runCommand(new ReadBasalProfileCommand());
}
@Override
public CommandResult setBasalProfile(BasalProfile basalProfile) {
FabricPrivacy.getInstance().logCustom(new CustomEvent("ComboSetBasalProfileCmd")
.putCustomAttribute("buildversion", BuildConfig.BUILDVERSION)
.putCustomAttribute("version", BuildConfig.VERSION));
return runCommand(new SetBasalProfileCommand(basalProfile));
}

View file

@ -145,7 +145,7 @@ public class DanaRPlugin extends AbstractDanaRPlugin {
@Override
public boolean isInitialized() {
DanaRPump pump = DanaRPump.getInstance();
return pump.lastConnection > 0 && pump.isExtendedBolusEnabled && pump.maxBasal > 0;
return pump.lastConnection > 0 && pump.isExtendedBolusEnabled && pump.maxBasal > 0 && pump.isPasswordOK();
}
@Override

View file

@ -249,4 +249,10 @@ public class DanaRPump {
return record;
}
public boolean isPasswordOK() {
if (password != -1 && password != SP.getInt(R.string.key_danar_password, -1)) {
return false;
}
return true;
}
}

View file

@ -3,8 +3,13 @@ package info.nightscout.androidaps.plugins.PumpDanaR.comm;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R;
import info.nightscout.androidaps.logging.L;
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
import info.nightscout.androidaps.plugins.Overview.events.EventDismissNotification;
import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification;
import info.nightscout.androidaps.plugins.Overview.notifications.Notification;
import info.nightscout.androidaps.plugins.PumpDanaR.DanaRPump;
/**
@ -36,6 +41,13 @@ public class MsgInitConnStatusOption extends MessageBase {
log.debug("Pump password: " + DanaRPump.getInstance().password);
}
if (!DanaRPump.getInstance().isPasswordOK()) {
Notification notification = new Notification(Notification.WRONG_PUMP_PASSWORD, MainApp.gs(R.string.wrongpumppassword), Notification.URGENT);
MainApp.bus().post(new EventNewNotification(notification));
} else {
MainApp.bus().post(new EventDismissNotification(Notification.WRONG_PUMP_PASSWORD));
}
// This is last message of initial sequence
ConfigBuilderPlugin.getPlugin().getActivePump().finishHandshaking();
}

View file

@ -67,8 +67,6 @@ public abstract class AbstractDanaRExecutionService extends Service {
protected final UUID SPP_UUID = UUID.fromString("00001101-0000-1000-8000-00805f9b34fb");
protected long lastWrongPumpPassword = 0;
protected long lastApproachingDailyLimit = 0;
@ -239,6 +237,4 @@ public abstract class AbstractDanaRExecutionService extends Service {
result.comment = "OK";
return result;
}
}

View file

@ -98,15 +98,6 @@ public class DanaRExecutionService extends AbstractDanaRExecutionService {
}
public void connect() {
if (mDanaRPump.password != -1 && mDanaRPump.password != SP.getInt(R.string.key_danar_password, -1)) {
if (System.currentTimeMillis() > lastWrongPumpPassword + 30 * 1000) {
Notification notification = new Notification(Notification.WRONG_PUMP_PASSWORD, MainApp.gs(R.string.wrongpumppassword), Notification.URGENT);
notification.soundId = R.raw.error;
lastWrongPumpPassword = System.currentTimeMillis();
}
return;
}
if (mConnectionInProgress)
return;

View file

@ -149,7 +149,7 @@ public class DanaRKoreanPlugin extends AbstractDanaRPlugin {
@Override
public boolean isInitialized() {
DanaRPump pump = DanaRPump.getInstance();
return pump.lastConnection > 0 && pump.maxBasal > 0 && !pump.isConfigUD && !pump.isEasyModeEnabled && pump.isExtendedBolusEnabled;
return pump.lastConnection > 0 && pump.maxBasal > 0 && !pump.isConfigUD && !pump.isEasyModeEnabled && pump.isExtendedBolusEnabled && pump.isPasswordOK();
}
@Override

View file

@ -46,5 +46,12 @@ public class MsgInitConnStatusBasic_k extends MessageBase {
} else {
MainApp.bus().post(new EventDismissNotification(Notification.EASYMODE_ENABLED));
}
if (!DanaRPump.getInstance().isPasswordOK()) {
Notification notification = new Notification(Notification.WRONG_PUMP_PASSWORD, MainApp.gs(R.string.wrongpumppassword), Notification.URGENT);
MainApp.bus().post(new EventNewNotification(notification));
} else {
MainApp.bus().post(new EventDismissNotification(Notification.WRONG_PUMP_PASSWORD));
}
}
}

View file

@ -102,15 +102,6 @@ public class DanaRKoreanExecutionService extends AbstractDanaRExecutionService {
}
public void connect() {
if (mDanaRPump.password != -1 && mDanaRPump.password != SP.getInt(R.string.key_danar_password, -1)) {
if (System.currentTimeMillis() > lastWrongPumpPassword + 30 * 1000) {
Notification notification = new Notification(Notification.WRONG_PUMP_PASSWORD, MainApp.gs(R.string.wrongpumppassword), Notification.URGENT);
notification.soundId = R.raw.error;
lastWrongPumpPassword = System.currentTimeMillis();
}
return;
}
if (mConnectionInProgress)
return;

View file

@ -112,7 +112,7 @@ public class DanaRv2Plugin extends AbstractDanaRPlugin {
@Override
public boolean isInitialized() {
return DanaRPump.getInstance().lastConnection > 0 && DanaRPump.getInstance().maxBasal > 0;
return DanaRPump.getInstance().lastConnection > 0 && DanaRPump.getInstance().maxBasal > 0 && DanaRPump.getInstance().isPasswordOK();
}
@Override

View file

@ -121,15 +121,6 @@ public class DanaRv2ExecutionService extends AbstractDanaRExecutionService {
}
public void connect() {
if (mDanaRPump.password != -1 && mDanaRPump.password != SP.getInt(R.string.key_danar_password, -1)) {
if (System.currentTimeMillis() > lastWrongPumpPassword + 30 * 1000) {
Notification notification = new Notification(Notification.WRONG_PUMP_PASSWORD, MainApp.gs(R.string.wrongpumppassword), Notification.URGENT);
notification.soundId = R.raw.error;
lastWrongPumpPassword = System.currentTimeMillis();
}
return;
}
if (mConnectionInProgress)
return;

View file

@ -70,6 +70,6 @@ public class SourceXdripPlugin extends PluginBase implements BgSourceInterface {
}
public void setSource(String source) {
this.advancedFiltering = source.contains("G5 Native");
this.advancedFiltering = source.contains("G5 Native")||source.contains("G6 Native");
}
}

View file

@ -109,6 +109,7 @@ public class FabricPrivacy {
private static void uploadPluginStats() {
CustomEvent pluginStats = new CustomEvent("PluginStats");
pluginStats.putCustomAttribute("version", BuildConfig.VERSION);
pluginStats.putCustomAttribute("HEAD", BuildConfig.HEAD);
for (PluginBase plugin : MainApp.getPluginsList()) {
if (!plugin.pluginDescription.alwaysEnabled) {
if (plugin.isEnabled(plugin.getType()))

View file

@ -21,13 +21,10 @@
<string name="description_insulin_rapid">Действие на инсулините Humalog и NovoRapid / NovoLog</string>
<string name="description_insulin_ultra_rapid">Действие на инсулин Fiasp</string>
<string name="description_insulin_free_peak">Позволява да зададете сами пика на инсулиновата активност (не използвайте, ако сте нови потребители)</string>
<string name="description_loop">Включва или изключва цикъла (loop).</string>
<string name="description_ns_client">Синхронизира локалните данни с Nightscout</string>
<string name="description_ma">Алгоритъма, какъвто е бил през 2016</string>
<string name="description_ama">Алгоритъма, какъвто е бил през 2017</string>
<string name="description_smb">Най-новият алгоритъм (само за напреднали потребители)</string>
<string name="description_overview">Показва текущото състояние на вашия цикъл и бутони за най-често използваните действия</string>
<string name="description_persistent_notification">Показва известие с резюме на това, което прави вашия цикъл</string>
<string name="description_profile_local">Работа с профил, който е наличен само на този телефон (локален).</string>
<string name="description_profile_nightscout">Работа с профила, които сте дефинирали в Nightscout</string>
<string name="description_profile_simple">Работа с профил със само една стойност за всички часове.</string>
@ -50,7 +47,6 @@
<string name="description_source_xdrip">Получава данни за КЗ от xDrip.</string>
<string name="description_treatments">Записва всички процедури, които са били направени</string>
<string name="description_wear">Наблюдавайте и контролирайте AndroidAPS, от вашия WearOS часовник.</string>
<string name="description_xdrip_status_line">Покажи информация за вашия цикъл на xDrip + watchface.</string>
<string name="description_sms_communicator">Дистанционно управление AndroidAPS чрез използване на SMS команди.</string>
<string name="objectives_button_start">Стартирай</string>
<string name="objectives_button_verify">Провери</string>
@ -129,8 +125,6 @@
<string name="configbuilder_constraints_description">Кои ограничения да се прилагат?</string>
<string name="days">дни</string>
<string name="constraints">Ограничения</string>
<string name="loop">Цикъл - Loop</string>
<string name="configbuilder_loop">Цикъл - Loop</string>
<string name="configbuilder_loop_description">Използвайте това, за да активирате loop интеграцията в \'AndroidAPS.</string>
<string name="loop_aps_label">Алгоритъм за APS</string>
<string name="loop_constraintsprocessed_label">След ограничения</string>
@ -163,8 +157,6 @@
<string name="configbuilder_bgsource_description">От къде трябва да AndroidAPS да си взима данни?</string>
<string name="xdrip">xDrip</string>
<string name="apsmode_title">APS режим</string>
<string name="closedloop">Затворен цикъл</string>
<string name="openloop">Отворен цикъл</string>
<string name="disabledloop">Loop изключен</string>
<string name="disableloop">Изключи Loop</string>
<string name="enableloop">Включи Loop</string>
@ -315,13 +307,7 @@
<string name="overview_bolusprogress_goingtodeliver" formatted="false">Ще достави %.2fЕ</string>
<string name="objectives_0_objective">Настройка на визуализацията и наблюдението, а също и анализиране на базалните нужди и коефициенти</string>
<string name="objectives_0_gate">Потвърждаване, че КЗ е достъпна в Найтскаут и данните за помпата се качват там</string>
<string name="objectives_1_objective">Стартиране в режим Отворен цикъл</string>
<string name="objectives_1_gate">Работа в режим \"Отворен цикъл\" за няколко дни и ръчно въвеждане на много временни базали. Настройте и използвайте временни и стандартни временни цели (напр. за активни или хипо-третирани въглехидрати)</string>
<string name="objectives_2_objective">Опитайте се да разбирате по-добре вашият Отворен цикъл, включително препоръчваните временни базали</string>
<string name="objectives_2_gate">Определяне на макс. лимит на базалния инсулин и настройване в помпата и програмата</string>
<string name="objectives_3_objective">Стартиране на \"Затворен цикъл\" с изключване на базал при ниска КЗ</string>
<string name="objectives_3_gate">Стартиране на \"Затворен цикъл\" с макс. IOB=0 без твърде много събития тип ниска КЗ</string>
<string name="objectives_4_objective">Настройване на \"Затворен цикъл\" чрез повишаване на максималният IOB над 0 и понижаване на целевите нива на КЗ</string>
<string name="objectives_4_gate">Прекарайте няколко дни по този начин, като поне една нощ нямате аларма за ниска КЗ.</string>
<string name="objectives_5_objective">Настройване на базалния инсулин и коефициенти ако е необходимо и активиране на auto-sens</string>
<string name="objectives_5_gate">Една седмица успешно дневно използване с редовно въвеждане на въглехидрати</string>
@ -330,16 +316,11 @@
<string name="objectives_7_gate">Вие трябва да прочетете wiki и увеличите maxIOB за да може SMB да работи добре! Добро начало е maxIOB = средния болус за хранене + 3 x най-големия базал от профила</string>
<string name="youareonallowedlimit">Достигнахте лимита</string>
<string name="noprofileselected">Няма избран профил</string>
<string name="smscommunicator_loophasbeendisabled">Цикъла е деактивиран</string>
<string name="smscommunicator_loophasbeenenabled">Цикъла е активиен</string>
<string name="smscommunicator_loopisdisabled">Цикъла е изключен</string>
<string name="smscommunicator_loopisenabled">Цикъла е включен</string>
<string name="valuelimitedto">%1$.2f ограничен до %2$.2f</string>
<string name="valueoutofrange" formatted="false">Стойността %s е извън границите</string>
<string name="smscommunicator_remotebasalnotallowed">Отдалечено прилагане на базал е забранено</string>
<string name="smscommunicator_remotecommandnotallowed">Отдалеченото управление е забранено</string>
<string name="smscommunicator_basalreplywithcode">За да стартирате базал от %1$.2fЕ отговорете с код %2$s</string>
<string name="smscommunicator_suspendreplywithcode">За да спрете цикъла за %1$d минути отговорете с код %2$s</string>
<string name="smscommunicator_tempbasalset">Временен базал от %1$.2fЕ/ч за %2$d мин стартиран успешно</string>
<string name="smscommunicator_tempbasalfailed">Неуспешно стартиране на временен базал</string>
<string name="smscommunicator_basalstopreplywithcode" formatted="false">За да спрете времен базал отговорете с код %s</string>
@ -522,10 +503,6 @@
<string name="loopsuspended">Loop изключен</string>
<string name="loopsuspendedfor">Изключен (%1$d мин)</string>
<string name="loopsuperbolusfor">Суперболус (%1$d мин)</string>
<string name="suspendloopfor1h">Изключи цикъла за 1ч</string>
<string name="suspendloopfor2h">Изключи цикъла за 2ч</string>
<string name="suspendloopfor3h">Изключи цикъла за 3ч</string>
<string name="suspendloopfor10h">Изключи цикъла за 10 ч</string>
<string name="disconnectpumpfor15m">Изключи помпата за 15 мин.</string>
<string name="disconnectpumpfor30m">Изключи помпата за 30 мин.</string>
<string name="disconnectpumpfor1h">Изключи помпата за 1 ч</string>
@ -533,8 +510,6 @@
<string name="disconnectpumpfor3h">Изключи помпата за 3 ч</string>
<string name="resume">Възстанови</string>
<string name="smscommunicator_wrongduration">Грешна продължителност</string>
<string name="smscommunicator_loopsuspended">Цикъла забранен</string>
<string name="smscommunicator_loopresumed">Цикъла възобновенн</string>
<string name="treatments_wizard_bgtrend_label">Δ за 15мин</string>
<string name="treatments_wizard_cob_label">СОВ</string>
<string name="superbolus">Суперболус</string>
@ -725,10 +700,8 @@
<string name="negativeonly">Само отрицателни</string>
<string name="overview_editquickwizard_usecob">Калкулиране на COB</string>
<string name="overview_editquickwizard_usetemptarget">Калкулиране на временни цели</string>
<string name="loopenabled">Цикъл разрешен</string>
<string name="apsselected">Избран APS</string>
<string name="nsclienthaswritepermission">NSClient има права за запис</string>
<string name="closedmodeenabled">Затворен цикъл е позволен</string>
<string name="maxiobset">Максимален IOB е зададен правилно</string>
<string name="hasbgdata">Има данни за КЗ от избрания източник</string>
<string name="basalprofilenotaligned" formatted="false">Няма базални стойности за някои часове: %s</string>
@ -862,7 +835,6 @@
<string name="overview_show_basals">Базали</string>
<string name="no_action_selected">Няма избрано действие, нищо няма да се изпълни</string>
<string name="start_hypo_tt">Старт на вр. цел при хипо</string>
<string name="closed_loop_disabled_on_dev_branch">Използвате dev версия. Затворения цикъл е деактивиран.</string>
<string name="engineering_mode_enabled">Режим за раработчици (Engineering mode) включен</string>
<string name="not_eng_mode_or_release">Режим за раработчици (Engineering mode) не е активиран и не е release версия</string>
<string name="pump_basebasalrate">%.2f Е</string>
@ -885,7 +857,6 @@
<string name="objectivenotfinished">ЦЕЛ %1$d не е завършена</string>
<string name="pumpisnottempbasalcapable">Помпата не поддържа временен базал</string>
<string name="novalidbasalrate">Няма валиден базал в помпата</string>
<string name="closedmodedisabledinpreferences">Цикъла е забранен в настройките</string>
<string name="autosensdisabledinpreferences">Аутосенс е забранен в настройките</string>
<string name="smbdisabledinpreferences">SMB е забранен в настройките</string>
<string name="limitingbasalratio">Ограничаване на макс. базална стойност до %1$.2f Е/ч поради %2$s</string>
@ -907,7 +878,6 @@
<string name="record_pump_site_change">Запис смяна на сет</string>
<string name="record_insulin_cartridge_change">Запис смяна на резервоар</string>
<string name="smbalwaysdisabled">SMB \"винаги включен\" и \"след въглехидрати\" е забранен, защото е активен източник на КЗ, който не поддържа необходимата филтрация</string>
<string name="smbnotallowedinopenloopmode">SMB не е позволен в режим Отворен цикъл</string>
<string name="food_short">Храна</string>
<string name="reset">нулиране</string>
<string name="waitingfortimesynchronization">Изчаква синхронизация на времето (%1$d сек)</string>
@ -948,6 +918,10 @@
<string name="openapsama_max_daily_safety_multiplier">Макс. множител за най-големия базал за денонощието</string>
<string name="openapsama_current_basal_safety_multiplier">Макс. множител за настоящ базал</string>
<string name="value_unavailable_short">---</string>
<string name="virtualpump_type">Виртуална помпа тип</string>
<string name="virtualpump_definition">Описание на помпата</string>
<string name="virtualpump_pump_def">Болус: Стъпка =%1$s\Удължен болус: [стъпка =%2$s, продължителност =%3$smin -%4$sh] \nБазал: стъпка =%5$s\ nTBR: %6$s (от %7$s), продължителност =%8$sмин -%9$sh\n%10$s</string>
<string name="virtualpump_pump_def_extended_note">* Диапазонни стойности за базал/болус не се поддържат от Виртиална Помпа.</string>
<string name="ns_autobackfill_title">Изтегляне КЗ от Найтскаут</string>
<string name="wear_wizard_settings">Настройки на съветник</string>
<string name="wear_wizard_settings_summary">Изчисления, включени в резултата на съветника:</string>
@ -1011,7 +985,6 @@
<string name="combo_invalid_setup">Невалидни настройки на помпата, проверете wiki и се уверете че меню Quick Info се казва QUICK INFO, с помощта на 360 софтуера.</string>
<string name="custom">По избор</string>
<string name="largetimedifftitle">Голяма времева разлика</string>
<string name="largetimediff">Голяма времева разлика: Помпата е изключена за повече от 1,5 часа. Моля, регулирайте ръчно времето на помпата и се уверете, че четенето на историята от помпата не води до неочаквано поведение. Ако е възможно, премахнете историята от помпата, преди да промените времето или да изключите затворения цикъл за едно DIA след последното погрешно влизане в историята, но поне едно DIA отсега.</string>
<string name="careportal_removestartedevents"> AndroidAPS стартира</string>
<string name="storedsettingsfound">Открити са предишни настройки</string>
<string name="allow_hardware_pump_text">Внимание: Ако активирате и свържете с хардуерна помпа, AndroidAPS ще копира основните настройки от профила в помпата, като презапише съществуващата базова скорост, съхранявана на помпата. Уверете се, че имате правилните основни настройки в AndroidAPS. Ако не сте сигурни или не искате да презапишете основните настройки на помпата, натиснете Cancel и повторете превключването към помпата по-късно.</string>
@ -1036,6 +1009,9 @@
<string name="versionavailable">Има налично обновяване до версия %1$s </string>
<string name="time_offset">времево отместване</string>
<string name="setupwizard_preferred_aps_mode">Предпочитаният режим на APS</string>
<string name="treatments_wizard_total_label">Общо</string>
<string name="calculation_short">Калк</string>
<string name="handshaking">Сдвояване</string>
<plurals name="objective_days">
<item quantity="one">%1$d дeн</item>
<item quantity="other">%1$d дни</item>

View file

@ -1042,6 +1042,7 @@
<string name="treatments_wizard_total_label">Výsledek</string>
<string name="calculation_short">Kalk</string>
<string name="handshaking">Navazování spojení</string>
<string name="sendlogfiles">Odešlete dnešní soubory protokolů vývojářům spolu s tímto časem. Neočekávaná situace.</string>
<plurals name="objective_days">
<item quantity="one">%1$d den</item>
<item quantity="few">%1$d dnů</item>

View file

@ -1194,6 +1194,7 @@
<string name="treatments_wizard_total_label">Total</string>
<string name="calculation_short">Calc</string>
<string name="handshaking">Handshaking</string>
<string name="sendlogfiles">Send today\'s log files to developers along with this time. Unexpected situation.</string>
<plurals name="objective_days">
<item quantity="one">%1$d day</item>

View file

@ -63,6 +63,27 @@ public class IobCobCalculatorPluginTest {
Assert.assertEquals(false, iobCobCalculatorPlugin.isAbout5minData());
// too much shifted and missing data should return false
bgReadingList.clear();
bgReadingList.add(new BgReading().date(T.mins(83).plus(T.secs(40)).msecs()).value(100));
bgReadingList.add(new BgReading().date(T.mins(78).plus(T.secs(40)).msecs()).value(100));
bgReadingList.add(new BgReading().date(T.mins(73).plus(T.secs(40)).msecs()).value(100));
bgReadingList.add(new BgReading().date(T.mins(68).plus(T.secs(40)).msecs()).value(100));
bgReadingList.add(new BgReading().date(T.mins(63).plus(T.secs(40)).msecs()).value(100));
bgReadingList.add(new BgReading().date(T.mins(58).plus(T.secs(40)).msecs()).value(100));
bgReadingList.add(new BgReading().date(T.mins(53).plus(T.secs(40)).msecs()).value(100));
bgReadingList.add(new BgReading().date(T.mins(48).plus(T.secs(40)).msecs()).value(100));
bgReadingList.add(new BgReading().date(T.mins(43).plus(T.secs(40)).msecs()).value(100));
bgReadingList.add(new BgReading().date(T.mins(38).plus(T.secs(33)).msecs()).value(100));
bgReadingList.add(new BgReading().date(T.mins(33).plus(T.secs(1)).msecs()).value(100));
bgReadingList.add(new BgReading().date(T.mins(28).plus(T.secs(0)).msecs()).value(100));
bgReadingList.add(new BgReading().date(T.mins(23).plus(T.secs(0)).msecs()).value(100));
bgReadingList.add(new BgReading().date(T.mins(16).plus(T.secs(36)).msecs()).value(100));
iobCobCalculatorPlugin.setBgReadings(bgReadingList);
Assert.assertEquals(false, iobCobCalculatorPlugin.isAbout5minData());
// slighly shifted data should return true
bgReadingList.clear();
bgReadingList.add(new BgReading().date(T.mins(20).msecs()).value(100));
@ -125,11 +146,12 @@ public class IobCobCalculatorPluginTest {
bgReadingList.add(new BgReading().date(T.mins(15).msecs() + T.secs(10).msecs()).value(100));
bgReadingList.add(new BgReading().date(T.mins(10).msecs() + T.secs(10).msecs()).value(100));
bgReadingList.add(new BgReading().date(T.mins(5).msecs() - T.secs(10).msecs()).value(100));
bgReadingList.add(new BgReading().date(T.mins(0).msecs()).value(100));
iobCobCalculatorPlugin.setBgReadings(bgReadingList);
iobCobCalculatorPlugin.createBucketedData();
Assert.assertEquals(false, iobCobCalculatorPlugin.isAbout5minData()); // too much drift
Assert.assertEquals(true, iobCobCalculatorPlugin.isAbout5minData());
Assert.assertEquals(T.mins(20).msecs(), iobCobCalculatorPlugin.getBucketedData().get(0).date);
Assert.assertEquals(T.mins(15).msecs(), iobCobCalculatorPlugin.getBucketedData().get(1).date);
Assert.assertEquals(T.mins(10).msecs(), iobCobCalculatorPlugin.getBucketedData().get(2).date);