Merge branch 'dev' of https://github.com/MilosKozak/AndroidAPS into dev
This commit is contained in:
commit
54930fee02
|
@ -5,7 +5,10 @@
|
||||||
|
|
||||||
[![Gitter](https://badges.gitter.im/MilosKozak/AndroidAPS.svg)](https://gitter.im/MilosKozak/AndroidAPS?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
[![Gitter](https://badges.gitter.im/MilosKozak/AndroidAPS.svg)](https://gitter.im/MilosKozak/AndroidAPS?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
||||||
[![Build status](https://travis-ci.org/MilosKozak/AndroidAPS.svg?branch=master)](https://travis-ci.org/MilosKozak/AndroidAPS)
|
[![Build status](https://travis-ci.org/MilosKozak/AndroidAPS.svg?branch=master)](https://travis-ci.org/MilosKozak/AndroidAPS)
|
||||||
|
[![Crowdin](https://d322cqt584bo4o.cloudfront.net/androidaps/localized.svg)](https://translations.androidaps.org/project/androidaps)
|
||||||
|
[![Documentation Status](https://readthedocs.org/projects/androidaps/badge/?version=latest)](https://androidaps.readthedocs.io/en/latest/?badge=latest)
|
||||||
[![codecov](https://codecov.io/gh/MilosKozak/AndroidAPS/branch/master/graph/badge.svg)](https://codecov.io/gh/MilosKozak/AndroidAPS)
|
[![codecov](https://codecov.io/gh/MilosKozak/AndroidAPS/branch/master/graph/badge.svg)](https://codecov.io/gh/MilosKozak/AndroidAPS)
|
||||||
dev: [![codecov](https://codecov.io/gh/MilosKozak/AndroidAPS/branch/dev/graph/badge.svg)](https://codecov.io/gh/MilosKozak/AndroidAPS)
|
dev: [![codecov](https://codecov.io/gh/MilosKozak/AndroidAPS/branch/dev/graph/badge.svg)](https://codecov.io/gh/MilosKozak/AndroidAPS)
|
||||||
|
|
||||||
|
|
||||||
[![Donate via PayPal](https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=Y4LHGJJESAVB8)
|
[![Donate via PayPal](https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=Y4LHGJJESAVB8)
|
||||||
|
|
|
@ -174,16 +174,11 @@ public class MainApp extends Application {
|
||||||
pluginsList.add(TreatmentsPlugin.getPlugin());
|
pluginsList.add(TreatmentsPlugin.getPlugin());
|
||||||
if (Config.SAFETY) pluginsList.add(SafetyPlugin.getPlugin());
|
if (Config.SAFETY) pluginsList.add(SafetyPlugin.getPlugin());
|
||||||
if (Config.APS) pluginsList.add(ObjectivesPlugin.getPlugin());
|
if (Config.APS) pluginsList.add(ObjectivesPlugin.getPlugin());
|
||||||
if (!Config.NSCLIENT)
|
|
||||||
pluginsList.add(SourceXdripPlugin.getPlugin());
|
pluginsList.add(SourceXdripPlugin.getPlugin());
|
||||||
pluginsList.add(SourceNSClientPlugin.getPlugin());
|
pluginsList.add(SourceNSClientPlugin.getPlugin());
|
||||||
if (!Config.NSCLIENT)
|
|
||||||
pluginsList.add(SourceMM640gPlugin.getPlugin());
|
pluginsList.add(SourceMM640gPlugin.getPlugin());
|
||||||
if (!Config.NSCLIENT)
|
|
||||||
pluginsList.add(SourceGlimpPlugin.getPlugin());
|
pluginsList.add(SourceGlimpPlugin.getPlugin());
|
||||||
if (!Config.NSCLIENT)
|
|
||||||
pluginsList.add(SourceDexcomG5Plugin.getPlugin());
|
pluginsList.add(SourceDexcomG5Plugin.getPlugin());
|
||||||
if (!Config.NSCLIENT)
|
|
||||||
pluginsList.add(SourcePoctechPlugin.getPlugin());
|
pluginsList.add(SourcePoctechPlugin.getPlugin());
|
||||||
if (Config.SMSCOMMUNICATORENABLED) pluginsList.add(SmsCommunicatorPlugin.getPlugin());
|
if (Config.SMSCOMMUNICATORENABLED) pluginsList.add(SmsCommunicatorPlugin.getPlugin());
|
||||||
pluginsList.add(FoodPlugin.getPlugin());
|
pluginsList.add(FoodPlugin.getPlugin());
|
||||||
|
|
|
@ -57,7 +57,7 @@ public class SafetyPlugin extends PluginBase implements ConstraintsInterface {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Constraint<Boolean> isClosedLoopAllowed(Constraint<Boolean> value) {
|
public Constraint<Boolean> isClosedLoopAllowed(Constraint<Boolean> value) {
|
||||||
String mode = SP.getString("aps_mode", "open");
|
String mode = SP.getString(R.string.key_aps_mode, "open");
|
||||||
if (!mode.equals("closed"))
|
if (!mode.equals("closed"))
|
||||||
value.set(false, MainApp.gs(R.string.closedmodedisabledinpreferences), this);
|
value.set(false, MainApp.gs(R.string.closedmodedisabledinpreferences), this);
|
||||||
|
|
||||||
|
|
|
@ -108,7 +108,7 @@ public class NSClientService extends Service {
|
||||||
|
|
||||||
private ArrayList<Long> reconnections = new ArrayList<>();
|
private ArrayList<Long> reconnections = new ArrayList<>();
|
||||||
private int WATCHDOG_INTERVAL_MINUTES = 2;
|
private int WATCHDOG_INTERVAL_MINUTES = 2;
|
||||||
private int WATCHDOG_RECONNECT_IN = 1;
|
private int WATCHDOG_RECONNECT_IN = 15;
|
||||||
private int WATCHDOG_MAXCONNECTIONS = 5;
|
private int WATCHDOG_MAXCONNECTIONS = 5;
|
||||||
|
|
||||||
public NSClientService() {
|
public NSClientService() {
|
||||||
|
@ -250,6 +250,7 @@ public class NSClientService extends Service {
|
||||||
connectCounter++;
|
connectCounter++;
|
||||||
String socketId = mSocket != null ? mSocket.id() : "NULL";
|
String socketId = mSocket != null ? mSocket.id() : "NULL";
|
||||||
MainApp.bus().post(new EventNSClientNewLog("NSCLIENT", "connect #" + connectCounter + " event. ID: " + socketId));
|
MainApp.bus().post(new EventNSClientNewLog("NSCLIENT", "connect #" + connectCounter + " event. ID: " + socketId));
|
||||||
|
if (mSocket != null)
|
||||||
sendAuthMessage(new NSAuthAck());
|
sendAuthMessage(new NSAuthAck());
|
||||||
watchdog();
|
watchdog();
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@ import java.util.Calendar;
|
||||||
import java.util.GregorianCalendar;
|
import java.util.GregorianCalendar;
|
||||||
|
|
||||||
import info.nightscout.androidaps.logging.L;
|
import info.nightscout.androidaps.logging.L;
|
||||||
|
import info.nightscout.androidaps.plugins.PumpDanaR.DanaRPump;
|
||||||
import info.nightscout.utils.DateUtil;
|
import info.nightscout.utils.DateUtil;
|
||||||
|
|
||||||
public class DanaRS_Packet_APS_Set_Event_History extends DanaRS_Packet {
|
public class DanaRS_Packet_APS_Set_Event_History extends DanaRS_Packet {
|
||||||
|
@ -31,6 +32,8 @@ public class DanaRS_Packet_APS_Set_Event_History extends DanaRS_Packet {
|
||||||
this.time = time;
|
this.time = time;
|
||||||
this.param1 = param1;
|
this.param1 = param1;
|
||||||
this.param2 = param2;
|
this.param2 = param2;
|
||||||
|
if ((type == DanaRPump.CARBS || type == DanaRPump.BOLUS) && param1 <= 0)
|
||||||
|
this.param1 = 0;
|
||||||
if (L.isEnabled(L.PUMPCOMM))
|
if (L.isEnabled(L.PUMPCOMM))
|
||||||
log.debug("Set history entry: " + DateUtil.dateAndTimeString(time) + " type: " + type + " param1: " + param1 + " param2: " + param2);
|
log.debug("Set history entry: " + DateUtil.dateAndTimeString(time) + " type: " + type + " param1: " + param1 + " param2: " + param2);
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,6 +53,7 @@ public class DanaRS_Packet_Basal_Get_Basal_Rate extends DanaRS_Packet {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pump.basalStep != 0.01d) {
|
if (pump.basalStep != 0.01d) {
|
||||||
|
failed = true;
|
||||||
Notification notification = new Notification(Notification.WRONGBASALSTEP, MainApp.gs(R.string.danar_setbasalstep001), Notification.URGENT);
|
Notification notification = new Notification(Notification.WRONGBASALSTEP, MainApp.gs(R.string.danar_setbasalstep001), Notification.URGENT);
|
||||||
MainApp.bus().post(new EventNewNotification(notification));
|
MainApp.bus().post(new EventNewNotification(notification));
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -13,6 +13,8 @@ public class DanaRS_Packet_Basal_Get_Profile_Basal_Rate extends DanaRS_Packet {
|
||||||
|
|
||||||
private int profileNumber;
|
private int profileNumber;
|
||||||
|
|
||||||
|
DanaRPump pump = DanaRPump.getInstance();
|
||||||
|
|
||||||
public DanaRS_Packet_Basal_Get_Profile_Basal_Rate() {
|
public DanaRS_Packet_Basal_Get_Profile_Basal_Rate() {
|
||||||
super();
|
super();
|
||||||
opCode = BleCommandUtil.DANAR_PACKET__OPCODE_BASAL__GET_PROFILE_BASAL_RATE;
|
opCode = BleCommandUtil.DANAR_PACKET__OPCODE_BASAL__GET_PROFILE_BASAL_RATE;
|
||||||
|
@ -36,7 +38,6 @@ public class DanaRS_Packet_Basal_Get_Profile_Basal_Rate extends DanaRS_Packet {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void handleMessage(byte[] data) {
|
public void handleMessage(byte[] data) {
|
||||||
DanaRPump pump = DanaRPump.getInstance();
|
|
||||||
|
|
||||||
int dataIndex = DATA_START;
|
int dataIndex = DATA_START;
|
||||||
int dataSize = 2;
|
int dataSize = 2;
|
||||||
|
|
|
@ -31,6 +31,9 @@ public class DanaRS_Packet_Basal_Get_Temporary_Basal_State extends DanaRS_Packet
|
||||||
int dataSize = 1;
|
int dataSize = 1;
|
||||||
int error = byteArrayToInt(getBytes(data, dataIndex, dataSize));
|
int error = byteArrayToInt(getBytes(data, dataIndex, dataSize));
|
||||||
|
|
||||||
|
if (error == 1)
|
||||||
|
failed = true;
|
||||||
|
|
||||||
dataIndex += dataSize;
|
dataIndex += dataSize;
|
||||||
dataSize = 1;
|
dataSize = 1;
|
||||||
pump.isTempBasalInProgress = byteArrayToInt(getBytes(data, dataIndex, dataSize)) == 0x01;
|
pump.isTempBasalInProgress = byteArrayToInt(getBytes(data, dataIndex, dataSize)) == 0x01;
|
||||||
|
|
|
@ -39,6 +39,8 @@ public class DanaRS_Packet_Basal_Set_Basal_Rate extends DanaRS_Packet {
|
||||||
@Override
|
@Override
|
||||||
public void handleMessage(byte[] data) {
|
public void handleMessage(byte[] data) {
|
||||||
int result = intFromBuff(data, 0, 1);
|
int result = intFromBuff(data, 0, 1);
|
||||||
|
if(result != 0)
|
||||||
|
failed = true;
|
||||||
if (L.isEnabled(L.PUMPCOMM)) {
|
if (L.isEnabled(L.PUMPCOMM)) {
|
||||||
if (result == 0)
|
if (result == 0)
|
||||||
log.debug("Result OK");
|
log.debug("Result OK");
|
||||||
|
|
|
@ -24,8 +24,10 @@ public class DanaRS_Packet_Basal_Set_Cancel_Temporary_Basal extends DanaRS_Packe
|
||||||
if (L.isEnabled(L.PUMPCOMM)) {
|
if (L.isEnabled(L.PUMPCOMM)) {
|
||||||
if (result == 0)
|
if (result == 0)
|
||||||
log.debug("Result OK");
|
log.debug("Result OK");
|
||||||
else
|
else {
|
||||||
log.error("Result Error: " + result);
|
log.error("Result Error: " + result);
|
||||||
|
failed = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -42,6 +42,8 @@ public class DanaRS_Packet_Basal_Set_Profile_Basal_Rate extends DanaRS_Packet {
|
||||||
@Override
|
@Override
|
||||||
public void handleMessage(byte[] data) {
|
public void handleMessage(byte[] data) {
|
||||||
int result = intFromBuff(data, 0, 1);
|
int result = intFromBuff(data, 0, 1);
|
||||||
|
if (result != 0)
|
||||||
|
failed = true;
|
||||||
if (L.isEnabled(L.PUMPCOMM)) {
|
if (L.isEnabled(L.PUMPCOMM)) {
|
||||||
if (result == 0)
|
if (result == 0)
|
||||||
log.debug("Result OK");
|
log.debug("Result OK");
|
||||||
|
|
|
@ -34,6 +34,8 @@ public class DanaRS_Packet_Basal_Set_Profile_Number extends DanaRS_Packet {
|
||||||
@Override
|
@Override
|
||||||
public void handleMessage(byte[] data) {
|
public void handleMessage(byte[] data) {
|
||||||
int result = intFromBuff(data, 0, 1);
|
int result = intFromBuff(data, 0, 1);
|
||||||
|
if (result != 0)
|
||||||
|
failed = true;
|
||||||
if (L.isEnabled(L.PUMPCOMM)) {
|
if (L.isEnabled(L.PUMPCOMM)) {
|
||||||
if (result == 0)
|
if (result == 0)
|
||||||
log.debug("Result OK");
|
log.debug("Result OK");
|
||||||
|
|
|
@ -24,8 +24,10 @@ public class DanaRS_Packet_Basal_Set_Suspend_Off extends DanaRS_Packet {
|
||||||
if (L.isEnabled(L.PUMPCOMM)) {
|
if (L.isEnabled(L.PUMPCOMM)) {
|
||||||
if (result == 0)
|
if (result == 0)
|
||||||
log.debug("Result OK");
|
log.debug("Result OK");
|
||||||
else
|
else {
|
||||||
log.error("Result Error: " + result);
|
log.error("Result Error: " + result);
|
||||||
|
failed = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,11 +21,13 @@ public class DanaRS_Packet_Basal_Set_Suspend_On extends DanaRS_Packet {
|
||||||
@Override
|
@Override
|
||||||
public void handleMessage(byte[] data) {
|
public void handleMessage(byte[] data) {
|
||||||
int result = intFromBuff(data, 0, 1);
|
int result = intFromBuff(data, 0, 1);
|
||||||
|
if(result != 0)
|
||||||
|
failed = true;
|
||||||
if (L.isEnabled(L.PUMPCOMM)) {
|
if (L.isEnabled(L.PUMPCOMM)) {
|
||||||
if (result == 0)
|
if (result == 0)
|
||||||
log.debug("Result OK");
|
log.debug("Result OK");
|
||||||
else
|
else
|
||||||
log.error("Result Error: " + result);
|
failed = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -38,6 +38,8 @@ public class DanaRS_Packet_Basal_Set_Temporary_Basal extends DanaRS_Packet {
|
||||||
@Override
|
@Override
|
||||||
public void handleMessage(byte[] data) {
|
public void handleMessage(byte[] data) {
|
||||||
int result = intFromBuff(data, 0, 1);
|
int result = intFromBuff(data, 0, 1);
|
||||||
|
if (result != 0)
|
||||||
|
failed = true;
|
||||||
if (L.isEnabled(L.PUMPCOMM)) {
|
if (L.isEnabled(L.PUMPCOMM)) {
|
||||||
if (result == 0)
|
if (result == 0)
|
||||||
log.debug("Result OK");
|
log.debug("Result OK");
|
||||||
|
|
|
@ -106,6 +106,7 @@ public class DanaRS_Packet_Bolus_Get_Bolus_Option extends DanaRS_Packet {
|
||||||
if (!pump.isExtendedBolusEnabled) {
|
if (!pump.isExtendedBolusEnabled) {
|
||||||
Notification notification = new Notification(Notification.EXTENDED_BOLUS_DISABLED, MainApp.gs(R.string.danar_enableextendedbolus), Notification.URGENT);
|
Notification notification = new Notification(Notification.EXTENDED_BOLUS_DISABLED, MainApp.gs(R.string.danar_enableextendedbolus), Notification.URGENT);
|
||||||
MainApp.bus().post(new EventNewNotification(notification));
|
MainApp.bus().post(new EventNewNotification(notification));
|
||||||
|
failed = true;
|
||||||
} else {
|
} else {
|
||||||
MainApp.bus().post(new EventDismissNotification(Notification.EXTENDED_BOLUS_DISABLED));
|
MainApp.bus().post(new EventDismissNotification(Notification.EXTENDED_BOLUS_DISABLED));
|
||||||
}
|
}
|
||||||
|
@ -136,4 +137,6 @@ public class DanaRS_Packet_Bolus_Get_Bolus_Option extends DanaRS_Packet {
|
||||||
public String getFriendlyName() {
|
public String getFriendlyName() {
|
||||||
return "BOLUS__GET_BOLUS_OPTION";
|
return "BOLUS__GET_BOLUS_OPTION";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -118,7 +118,8 @@ public class DanaRS_Packet_Bolus_Get_CIR_CF_Array extends DanaRS_Packet {
|
||||||
dataSize = 2;
|
dataSize = 2;
|
||||||
pump.nightCF = byteArrayToInt(getBytes(data, dataIndex, dataSize)) / 100d;
|
pump.nightCF = byteArrayToInt(getBytes(data, dataIndex, dataSize)) / 100d;
|
||||||
}
|
}
|
||||||
|
if (pump.units < 0 || pump.units > 1)
|
||||||
|
failed = true;
|
||||||
if (L.isEnabled(L.PUMPCOMM)) {
|
if (L.isEnabled(L.PUMPCOMM)) {
|
||||||
log.debug("Language: " + language);
|
log.debug("Language: " + language);
|
||||||
log.debug("Pump units: " + (pump.units == DanaRPump.UNITS_MGDL ? "MGDL" : "MMOL"));
|
log.debug("Pump units: " + (pump.units == DanaRPump.UNITS_MGDL ? "MGDL" : "MMOL"));
|
||||||
|
|
|
@ -59,6 +59,8 @@ public class DanaRS_Packet_Bolus_Get_Calculation_Information extends DanaRS_Pack
|
||||||
pump.currentTarget = pump.currentTarget / 100d;
|
pump.currentTarget = pump.currentTarget / 100d;
|
||||||
currentBG = currentBG / 100d;
|
currentBG = currentBG / 100d;
|
||||||
}
|
}
|
||||||
|
if (error != 0)
|
||||||
|
failed = true;
|
||||||
if (L.isEnabled(L.PUMPCOMM)) {
|
if (L.isEnabled(L.PUMPCOMM)) {
|
||||||
log.debug("Result: " + error);
|
log.debug("Result: " + error);
|
||||||
log.debug("Pump units: " + (pump.units == DanaRPump.UNITS_MGDL ? "MGDL" : "MMOL"));
|
log.debug("Pump units: " + (pump.units == DanaRPump.UNITS_MGDL ? "MGDL" : "MMOL"));
|
||||||
|
|
|
@ -33,7 +33,8 @@ public class DanaRS_Packet_Bolus_Get_Carbohydrate_Calculation_Information extend
|
||||||
dataIndex += dataSize;
|
dataIndex += dataSize;
|
||||||
dataSize = 2;
|
dataSize = 2;
|
||||||
pump.currentCIR = byteArrayToInt(getBytes(data, dataIndex, dataSize));
|
pump.currentCIR = byteArrayToInt(getBytes(data, dataIndex, dataSize));
|
||||||
|
if (error != 0)
|
||||||
|
failed = true;
|
||||||
if (L.isEnabled(L.PUMPCOMM)) {
|
if (L.isEnabled(L.PUMPCOMM)) {
|
||||||
log.debug("Result: " + error);
|
log.debug("Result: " + error);
|
||||||
log.debug("Carbs: " + carbs);
|
log.debug("Carbs: " + carbs);
|
||||||
|
|
|
@ -41,7 +41,8 @@ public class DanaRS_Packet_Bolus_Get_Dual_Bolus extends DanaRS_Packet {
|
||||||
dataIndex += dataSize;
|
dataIndex += dataSize;
|
||||||
dataSize = 1;
|
dataSize = 1;
|
||||||
double bolusIncrement = byteArrayToInt(getBytes(data, dataIndex, dataSize)) / 100d;
|
double bolusIncrement = byteArrayToInt(getBytes(data, dataIndex, dataSize)) / 100d;
|
||||||
|
if (error != 0)
|
||||||
|
failed = true;
|
||||||
if (L.isEnabled(L.PUMPCOMM)) {
|
if (L.isEnabled(L.PUMPCOMM)) {
|
||||||
log.debug("Result: " + error);
|
log.debug("Result: " + error);
|
||||||
log.debug("Bolus step: " + pump.bolusStep + " U");
|
log.debug("Bolus step: " + pump.bolusStep + " U");
|
||||||
|
|
|
@ -37,7 +37,8 @@ public class DanaRS_Packet_Bolus_Get_Extended_Bolus extends DanaRS_Packet {
|
||||||
dataIndex += dataSize;
|
dataIndex += dataSize;
|
||||||
dataSize = 1;
|
dataSize = 1;
|
||||||
pump.bolusStep = byteArrayToInt(getBytes(data, dataIndex, dataSize)) / 100d;
|
pump.bolusStep = byteArrayToInt(getBytes(data, dataIndex, dataSize)) / 100d;
|
||||||
|
if (error != 0)
|
||||||
|
failed = true;
|
||||||
if (L.isEnabled(L.PUMPCOMM)) {
|
if (L.isEnabled(L.PUMPCOMM)) {
|
||||||
log.debug("Result: " + error);
|
log.debug("Result: " + error);
|
||||||
log.debug("Extended bolus running: " + pump.extendedBolusAbsoluteRate + " U/h");
|
log.debug("Extended bolus running: " + pump.extendedBolusAbsoluteRate + " U/h");
|
||||||
|
|
|
@ -45,7 +45,8 @@ public class DanaRS_Packet_Bolus_Get_Extended_Bolus_State extends DanaRS_Packet
|
||||||
dataIndex += dataSize;
|
dataIndex += dataSize;
|
||||||
dataSize = 2;
|
dataSize = 2;
|
||||||
pump.extendedBolusDeliveredSoFar = byteArrayToInt(getBytes(data, dataIndex, dataSize)) / 100d;
|
pump.extendedBolusDeliveredSoFar = byteArrayToInt(getBytes(data, dataIndex, dataSize)) / 100d;
|
||||||
|
if (error != 0)
|
||||||
|
failed = true;
|
||||||
if (L.isEnabled(L.PUMPCOMM)) {
|
if (L.isEnabled(L.PUMPCOMM)) {
|
||||||
log.debug("Result: " + error);
|
log.debug("Result: " + error);
|
||||||
log.debug("Is extended bolus running: " + pump.isExtendedInProgress);
|
log.debug("Is extended bolus running: " + pump.isExtendedInProgress);
|
||||||
|
|
|
@ -9,6 +9,10 @@ import info.nightscout.androidaps.logging.L;
|
||||||
|
|
||||||
public class DanaRS_Packet_Bolus_Get_Initial_Bolus extends DanaRS_Packet {
|
public class DanaRS_Packet_Bolus_Get_Initial_Bolus extends DanaRS_Packet {
|
||||||
private Logger log = LoggerFactory.getLogger(L.PUMPCOMM);
|
private Logger log = LoggerFactory.getLogger(L.PUMPCOMM);
|
||||||
|
private double initialBolusValue01;
|
||||||
|
private double initialBolusValue02;
|
||||||
|
private double initialBolusValue03;
|
||||||
|
double initialBolusValue04;
|
||||||
|
|
||||||
public DanaRS_Packet_Bolus_Get_Initial_Bolus() {
|
public DanaRS_Packet_Bolus_Get_Initial_Bolus() {
|
||||||
super();
|
super();
|
||||||
|
@ -21,19 +25,24 @@ public class DanaRS_Packet_Bolus_Get_Initial_Bolus extends DanaRS_Packet {
|
||||||
public void handleMessage(byte[] data) {
|
public void handleMessage(byte[] data) {
|
||||||
int dataIndex = DATA_START;
|
int dataIndex = DATA_START;
|
||||||
int dataSize = 2;
|
int dataSize = 2;
|
||||||
double initialBolusValue01 = byteArrayToInt(getBytes(data, dataIndex, dataSize)) / 100d;
|
initialBolusValue01 = byteArrayToInt(getBytes(data, dataIndex, dataSize)) / 100d;
|
||||||
|
|
||||||
dataIndex += dataSize;
|
dataIndex += dataSize;
|
||||||
dataSize = 2;
|
dataSize = 2;
|
||||||
double initialBolusValue02 = byteArrayToInt(getBytes(data, dataIndex, dataSize)) / 100d;
|
initialBolusValue02 = byteArrayToInt(getBytes(data, dataIndex, dataSize)) / 100d;
|
||||||
|
|
||||||
dataIndex += dataSize;
|
dataIndex += dataSize;
|
||||||
dataSize = 2;
|
dataSize = 2;
|
||||||
double initialBolusValue03 = byteArrayToInt(getBytes(data, dataIndex, dataSize)) / 100d;
|
initialBolusValue03 = byteArrayToInt(getBytes(data, dataIndex, dataSize)) / 100d;
|
||||||
|
|
||||||
dataIndex += dataSize;
|
dataIndex += dataSize;
|
||||||
dataSize = 2;
|
dataSize = 2;
|
||||||
double initialBolusValue04 = byteArrayToInt(getBytes(data, dataIndex, dataSize)) / 100d;
|
initialBolusValue04 = byteArrayToInt(getBytes(data, dataIndex, dataSize)) / 100d;
|
||||||
|
if (initialBolusValue01 == 0d && initialBolusValue02 == 0d && initialBolusValue03 == 0d && initialBolusValue04 == 0d)
|
||||||
|
failed = true;
|
||||||
|
else
|
||||||
|
failed = false;
|
||||||
|
|
||||||
if (L.isEnabled(L.PUMPCOMM)) {
|
if (L.isEnabled(L.PUMPCOMM)) {
|
||||||
log.debug("Initial bolus amount 01: " + initialBolusValue01);
|
log.debug("Initial bolus amount 01: " + initialBolusValue01);
|
||||||
log.debug("Initial bolus amount 02: " + initialBolusValue02);
|
log.debug("Initial bolus amount 02: " + initialBolusValue02);
|
||||||
|
|
|
@ -56,7 +56,8 @@ public class DanaRS_Packet_Bolus_Get_Step_Bolus_Information extends DanaRS_Packe
|
||||||
dataIndex += dataSize;
|
dataIndex += dataSize;
|
||||||
dataSize = 1;
|
dataSize = 1;
|
||||||
pump.bolusStep = byteArrayToInt(getBytes(data, dataIndex, dataSize)) / 100d;
|
pump.bolusStep = byteArrayToInt(getBytes(data, dataIndex, dataSize)) / 100d;
|
||||||
|
if ( error != 0)
|
||||||
|
failed = true;
|
||||||
if (L.isEnabled(L.PUMPCOMM)) {
|
if (L.isEnabled(L.PUMPCOMM)) {
|
||||||
log.debug("Result: " + error);
|
log.debug("Result: " + error);
|
||||||
log.debug("BolusType: " + bolusType);
|
log.debug("BolusType: " + bolusType);
|
||||||
|
|
|
@ -113,6 +113,8 @@ public class DanaRS_Packet_Bolus_Set_Bolus_Option extends DanaRS_Packet {
|
||||||
@Override
|
@Override
|
||||||
public void handleMessage(byte[] data) {
|
public void handleMessage(byte[] data) {
|
||||||
int result = intFromBuff(data, 0, 1);
|
int result = intFromBuff(data, 0, 1);
|
||||||
|
if ( result != 0)
|
||||||
|
failed = true;
|
||||||
if (L.isEnabled(L.PUMPCOMM)) {
|
if (L.isEnabled(L.PUMPCOMM)) {
|
||||||
if (result == 0)
|
if (result == 0)
|
||||||
log.debug("Result OK");
|
log.debug("Result OK");
|
||||||
|
|
|
@ -87,6 +87,8 @@ public class DanaRS_Packet_Bolus_Set_CIR_CF_Array extends DanaRS_Packet {
|
||||||
@Override
|
@Override
|
||||||
public void handleMessage(byte[] data) {
|
public void handleMessage(byte[] data) {
|
||||||
int result = intFromBuff(data, 0, 1);
|
int result = intFromBuff(data, 0, 1);
|
||||||
|
if (result != 0)
|
||||||
|
failed = true;
|
||||||
if (L.isEnabled(L.PUMPCOMM)) {
|
if (L.isEnabled(L.PUMPCOMM)) {
|
||||||
if (result == 0)
|
if (result == 0)
|
||||||
log.debug("Result OK");
|
log.debug("Result OK");
|
||||||
|
|
|
@ -46,6 +46,8 @@ public class DanaRS_Packet_Bolus_Set_Dual_Bolus extends DanaRS_Packet {
|
||||||
@Override
|
@Override
|
||||||
public void handleMessage(byte[] data) {
|
public void handleMessage(byte[] data) {
|
||||||
int result = intFromBuff(data, 0, 1);
|
int result = intFromBuff(data, 0, 1);
|
||||||
|
if (result!=0)
|
||||||
|
failed = true;
|
||||||
if (L.isEnabled(L.PUMPCOMM)) {
|
if (L.isEnabled(L.PUMPCOMM)) {
|
||||||
if (result == 0)
|
if (result == 0)
|
||||||
log.debug("Result OK");
|
log.debug("Result OK");
|
||||||
|
|
|
@ -41,6 +41,8 @@ public class DanaRS_Packet_Bolus_Set_Extended_Bolus extends DanaRS_Packet {
|
||||||
@Override
|
@Override
|
||||||
public void handleMessage(byte[] data) {
|
public void handleMessage(byte[] data) {
|
||||||
int result = intFromBuff(data, 0, 1);
|
int result = intFromBuff(data, 0, 1);
|
||||||
|
if (result!=0)
|
||||||
|
failed=true;
|
||||||
if (L.isEnabled(L.PUMPCOMM)) {
|
if (L.isEnabled(L.PUMPCOMM)) {
|
||||||
if (result == 0)
|
if (result == 0)
|
||||||
log.debug("Result OK");
|
log.debug("Result OK");
|
||||||
|
|
|
@ -21,6 +21,8 @@ public class DanaRS_Packet_Bolus_Set_Extended_Bolus_Cancel extends DanaRS_Packet
|
||||||
@Override
|
@Override
|
||||||
public void handleMessage(byte[] data) {
|
public void handleMessage(byte[] data) {
|
||||||
int result = intFromBuff(data, 0, 1);
|
int result = intFromBuff(data, 0, 1);
|
||||||
|
if (result != 0)
|
||||||
|
failed = true;
|
||||||
if (L.isEnabled(L.PUMPCOMM)) {
|
if (L.isEnabled(L.PUMPCOMM)) {
|
||||||
if (result == 0)
|
if (result == 0)
|
||||||
log.debug("Result OK");
|
log.debug("Result OK");
|
||||||
|
|
|
@ -47,6 +47,8 @@ public class DanaRS_Packet_Bolus_Set_Initial_Bolus extends DanaRS_Packet {
|
||||||
@Override
|
@Override
|
||||||
public void handleMessage(byte[] data) {
|
public void handleMessage(byte[] data) {
|
||||||
int result = intFromBuff(data, 0, 1);
|
int result = intFromBuff(data, 0, 1);
|
||||||
|
if (result!=0)
|
||||||
|
failed = true;
|
||||||
if (L.isEnabled(L.PUMPCOMM)) {
|
if (L.isEnabled(L.PUMPCOMM)) {
|
||||||
if (result == 0)
|
if (result == 0)
|
||||||
log.debug("Result OK");
|
log.debug("Result OK");
|
||||||
|
|
|
@ -6,6 +6,7 @@ import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import info.nightscout.androidaps.MainApp;
|
import info.nightscout.androidaps.MainApp;
|
||||||
|
import info.nightscout.androidaps.data.ConstraintChecker;
|
||||||
import info.nightscout.androidaps.interfaces.Constraint;
|
import info.nightscout.androidaps.interfaces.Constraint;
|
||||||
import info.nightscout.androidaps.logging.L;
|
import info.nightscout.androidaps.logging.L;
|
||||||
|
|
||||||
|
@ -27,7 +28,7 @@ public class DanaRS_Packet_Bolus_Set_Step_Bolus_Start extends DanaRS_Packet {
|
||||||
public DanaRS_Packet_Bolus_Set_Step_Bolus_Start(double amount, int speed) {
|
public DanaRS_Packet_Bolus_Set_Step_Bolus_Start(double amount, int speed) {
|
||||||
this();
|
this();
|
||||||
|
|
||||||
// HARDCODED LIMIT
|
// HARDCODED LIMIT - if there is one that could be created
|
||||||
amount = MainApp.getConstraintChecker().applyBolusConstraints(new Constraint<>(amount)).value();
|
amount = MainApp.getConstraintChecker().applyBolusConstraints(new Constraint<>(amount)).value();
|
||||||
|
|
||||||
this.amount = amount;
|
this.amount = amount;
|
||||||
|
@ -50,12 +51,12 @@ public class DanaRS_Packet_Bolus_Set_Step_Bolus_Start extends DanaRS_Packet {
|
||||||
@Override
|
@Override
|
||||||
public void handleMessage(byte[] data) {
|
public void handleMessage(byte[] data) {
|
||||||
errorCode = intFromBuff(data, 0, 1);
|
errorCode = intFromBuff(data, 0, 1);
|
||||||
|
if (errorCode != 0)
|
||||||
|
failed = true;
|
||||||
if (L.isEnabled(L.PUMPCOMM)) {
|
if (L.isEnabled(L.PUMPCOMM)) {
|
||||||
if (errorCode == 0) {
|
if (errorCode == 0) {
|
||||||
log.debug("Result OK");
|
log.debug("Result OK");
|
||||||
failed = false;
|
|
||||||
} else {
|
} else {
|
||||||
failed = true;
|
|
||||||
log.error("Result Error: " + errorCode);
|
log.error("Result Error: " + errorCode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,8 +41,10 @@ public class DanaRS_Packet_Bolus_Set_Step_Bolus_Stop extends DanaRS_Packet {
|
||||||
if (L.isEnabled(L.PUMPCOMM)) {
|
if (L.isEnabled(L.PUMPCOMM)) {
|
||||||
if (result == 0)
|
if (result == 0)
|
||||||
log.debug("Result OK");
|
log.debug("Result OK");
|
||||||
else
|
else {
|
||||||
log.error("Result Error: " + result);
|
log.error("Result Error: " + result);
|
||||||
|
failed = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
EventOverviewBolusProgress bolusingEvent = EventOverviewBolusProgress.getInstance();
|
EventOverviewBolusProgress bolusingEvent = EventOverviewBolusProgress.getInstance();
|
||||||
|
|
|
@ -22,6 +22,8 @@ public class DanaRS_Packet_Etc_Keep_Connection extends DanaRS_Packet {
|
||||||
int dataIndex = DATA_START;
|
int dataIndex = DATA_START;
|
||||||
int dataSize = 1;
|
int dataSize = 1;
|
||||||
int error = byteArrayToInt(getBytes(data, dataIndex, dataSize));
|
int error = byteArrayToInt(getBytes(data, dataIndex, dataSize));
|
||||||
|
if (error!=0)
|
||||||
|
failed=true;
|
||||||
if (L.isEnabled(L.PUMPCOMM)) {
|
if (L.isEnabled(L.PUMPCOMM)) {
|
||||||
log.debug("Result: " + error);
|
log.debug("Result: " + error);
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,6 +61,8 @@ public class DanaRS_Packet_Etc_Set_History_Save extends DanaRS_Packet {
|
||||||
int dataIndex = DATA_START;
|
int dataIndex = DATA_START;
|
||||||
int dataSize = 1;
|
int dataSize = 1;
|
||||||
int error = byteArrayToInt(getBytes(data, dataIndex, dataSize));
|
int error = byteArrayToInt(getBytes(data, dataIndex, dataSize));
|
||||||
|
if (error != 0)
|
||||||
|
failed = true;
|
||||||
if (L.isEnabled(L.PUMPCOMM)) {
|
if (L.isEnabled(L.PUMPCOMM)) {
|
||||||
log.debug("Result: " + error);
|
log.debug("Result: " + error);
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,8 @@ public class DanaRS_Packet_General_Delivery_Status extends DanaRS_Packet {
|
||||||
int dataIndex = DATA_START;
|
int dataIndex = DATA_START;
|
||||||
int dataSize = 1;
|
int dataSize = 1;
|
||||||
int status = byteArrayToInt(getBytes(data, dataIndex, dataSize));
|
int status = byteArrayToInt(getBytes(data, dataIndex, dataSize));
|
||||||
|
if (status != 0)
|
||||||
|
failed = true;
|
||||||
if (L.isEnabled(L.PUMPCOMM)) {
|
if (L.isEnabled(L.PUMPCOMM)) {
|
||||||
log.debug("Status: " + status);
|
log.debug("Status: " + status);
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,10 @@ public class DanaRS_Packet_General_Get_More_Information extends DanaRS_Packet {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void handleMessage(byte[] data) {
|
public void handleMessage(byte[] data) {
|
||||||
|
if (data.length < 15){
|
||||||
|
failed = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
DanaRPump pump = DanaRPump.getInstance();
|
DanaRPump pump = DanaRPump.getInstance();
|
||||||
|
|
||||||
int dataIndex = DATA_START;
|
int dataIndex = DATA_START;
|
||||||
|
@ -56,7 +60,9 @@ public class DanaRS_Packet_General_Get_More_Information extends DanaRS_Packet {
|
||||||
dataIndex += dataSize;
|
dataIndex += dataSize;
|
||||||
dataSize = 2;
|
dataSize = 2;
|
||||||
pump.lastBolusAmount = byteArrayToInt(getBytes(data, dataIndex, dataSize));
|
pump.lastBolusAmount = byteArrayToInt(getBytes(data, dataIndex, dataSize));
|
||||||
|
// On DanaRS DailyUnits can't be more than 160
|
||||||
|
if(pump.dailyTotalUnits > 160)
|
||||||
|
failed = true;
|
||||||
if (L.isEnabled(L.PUMPCOMM)) {
|
if (L.isEnabled(L.PUMPCOMM)) {
|
||||||
log.debug("Daily total units: " + pump.dailyTotalUnits + " U");
|
log.debug("Daily total units: " + pump.dailyTotalUnits + " U");
|
||||||
log.debug("Is extended in progress: " + pump.isExtendedInProgress);
|
log.debug("Is extended in progress: " + pump.isExtendedInProgress);
|
||||||
|
|
|
@ -20,6 +20,11 @@ public class DanaRS_Packet_General_Get_Password extends DanaRS_Packet {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void handleMessage(byte[] data) {
|
public void handleMessage(byte[] data) {
|
||||||
|
if (data.length < 2){
|
||||||
|
// returned data size is too small
|
||||||
|
failed = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
DanaRPump pump = DanaRPump.getInstance();
|
DanaRPump pump = DanaRPump.getInstance();
|
||||||
|
|
||||||
int pass = ((data[DATA_START + 1] & 0x000000FF) << 8) + (data[DATA_START + 0] & 0x000000FF);
|
int pass = ((data[DATA_START + 1] & 0x000000FF) << 8) + (data[DATA_START + 0] & 0x000000FF);
|
||||||
|
|
|
@ -24,6 +24,10 @@ public class DanaRS_Packet_General_Get_Pump_Check extends DanaRS_Packet {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void handleMessage(byte[] data) {
|
public void handleMessage(byte[] data) {
|
||||||
|
if (data.length <5){
|
||||||
|
failed = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
DanaRPump pump = DanaRPump.getInstance();
|
DanaRPump pump = DanaRPump.getInstance();
|
||||||
|
|
||||||
int dataIndex = DATA_START;
|
int dataIndex = DATA_START;
|
||||||
|
|
|
@ -20,6 +20,10 @@ public class DanaRS_Packet_General_Get_Shipping_Information extends DanaRS_Packe
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void handleMessage(byte[] data) {
|
public void handleMessage(byte[] data) {
|
||||||
|
if (data.length < 18){
|
||||||
|
failed = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
DanaRPump pump = DanaRPump.getInstance();
|
DanaRPump pump = DanaRPump.getInstance();
|
||||||
|
|
||||||
int dataIndex = DATA_START;
|
int dataIndex = DATA_START;
|
||||||
|
|
|
@ -20,6 +20,10 @@ public class DanaRS_Packet_General_Get_Today_Delivery_Total extends DanaRS_Packe
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void handleMessage(byte[] data) {
|
public void handleMessage(byte[] data) {
|
||||||
|
if (data.length < 8){
|
||||||
|
failed = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
DanaRPump pump = DanaRPump.getInstance();
|
DanaRPump pump = DanaRPump.getInstance();
|
||||||
|
|
||||||
int dataIndex = DATA_START;
|
int dataIndex = DATA_START;
|
||||||
|
|
|
@ -19,6 +19,10 @@ public class DanaRS_Packet_General_Get_User_Time_Change_Flag extends DanaRS_Pack
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void handleMessage(byte[] data) {
|
public void handleMessage(byte[] data) {
|
||||||
|
if (data.length < 3){
|
||||||
|
failed = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
int dataIndex = DATA_START;
|
int dataIndex = DATA_START;
|
||||||
int dataSize = 1;
|
int dataSize = 1;
|
||||||
int userTimeChangeFlag = byteArrayToInt(getBytes(data, dataIndex, dataSize));
|
int userTimeChangeFlag = byteArrayToInt(getBytes(data, dataIndex, dataSize));
|
||||||
|
|
|
@ -21,6 +21,10 @@ public class DanaRS_Packet_General_Initial_Screen_Information extends DanaRS_Pac
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void handleMessage(byte[] data) {
|
public void handleMessage(byte[] data) {
|
||||||
|
if (data.length < 17) {
|
||||||
|
failed = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
DanaRPump pump = DanaRPump.getInstance();
|
DanaRPump pump = DanaRPump.getInstance();
|
||||||
|
|
||||||
int dataIndex = DATA_START;
|
int dataIndex = DATA_START;
|
||||||
|
|
|
@ -35,6 +35,8 @@ public class DanaRS_Packet_General_Set_History_Upload_Mode extends DanaRS_Packet
|
||||||
@Override
|
@Override
|
||||||
public void handleMessage(byte[] data) {
|
public void handleMessage(byte[] data) {
|
||||||
int result = intFromBuff(data, 0, 1);
|
int result = intFromBuff(data, 0, 1);
|
||||||
|
if (result != 0)
|
||||||
|
failed = true;
|
||||||
if (L.isEnabled(L.PUMPCOMM)) {
|
if (L.isEnabled(L.PUMPCOMM)) {
|
||||||
if (result == 0)
|
if (result == 0)
|
||||||
log.debug("Result OK");
|
log.debug("Result OK");
|
||||||
|
|
|
@ -20,6 +20,8 @@ public class DanaRS_Packet_General_Set_User_Time_Change_Flag_Clear extends DanaR
|
||||||
@Override
|
@Override
|
||||||
public void handleMessage(byte[] data) {
|
public void handleMessage(byte[] data) {
|
||||||
int result = intFromBuff(data, 0, 1);
|
int result = intFromBuff(data, 0, 1);
|
||||||
|
if (result != 0)
|
||||||
|
failed = true;
|
||||||
if (L.isEnabled(L.PUMPCOMM)) {
|
if (L.isEnabled(L.PUMPCOMM)) {
|
||||||
if (result == 0)
|
if (result == 0)
|
||||||
log.debug("Result OK");
|
log.debug("Result OK");
|
||||||
|
|
|
@ -76,9 +76,14 @@ public class DanaRS_Packet_Notify_Alarm extends DanaRS_Packet {
|
||||||
errorString = "Blood sugar check miss alarm ???";
|
errorString = "Blood sugar check miss alarm ???";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
// No error no need to upload anything
|
||||||
|
if(errorString == "") {
|
||||||
|
failed = true;
|
||||||
|
|
||||||
if (L.isEnabled(L.PUMPCOMM))
|
if (L.isEnabled(L.PUMPCOMM))
|
||||||
log.debug("Error detected: " + errorString);
|
log.debug("Error detected: " + errorString);
|
||||||
|
return;
|
||||||
|
}
|
||||||
NSUpload.uploadError(errorString);
|
NSUpload.uploadError(errorString);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,6 @@ import info.nightscout.androidaps.plugins.Treatments.Treatment;
|
||||||
|
|
||||||
public class DanaRS_Packet_Notify_Delivery_Rate_Display extends DanaRS_Packet {
|
public class DanaRS_Packet_Notify_Delivery_Rate_Display extends DanaRS_Packet {
|
||||||
private Logger log = LoggerFactory.getLogger(L.PUMPCOMM);
|
private Logger log = LoggerFactory.getLogger(L.PUMPCOMM);
|
||||||
|
|
||||||
private static Treatment t;
|
private static Treatment t;
|
||||||
private static double amount;
|
private static double amount;
|
||||||
|
|
||||||
|
@ -45,6 +44,7 @@ public class DanaRS_Packet_Notify_Delivery_Rate_Display extends DanaRS_Packet {
|
||||||
bolusingEvent.status = String.format(MainApp.gs(R.string.bolusdelivering), deliveredInsulin);
|
bolusingEvent.status = String.format(MainApp.gs(R.string.bolusdelivering), deliveredInsulin);
|
||||||
bolusingEvent.t = t;
|
bolusingEvent.t = t;
|
||||||
bolusingEvent.percent = Math.min((int) (deliveredInsulin / amount * 100), 100);
|
bolusingEvent.percent = Math.min((int) (deliveredInsulin / amount * 100), 100);
|
||||||
|
failed = bolusingEvent.percent < 100? true: false;
|
||||||
MainApp.bus().post(bolusingEvent);
|
MainApp.bus().post(bolusingEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -40,6 +40,10 @@ public class DanaRS_Packet_Notify_Missed_Bolus_Alarm extends DanaRS_Packet {
|
||||||
dataIndex += dataSize;
|
dataIndex += dataSize;
|
||||||
dataSize = 1;
|
dataSize = 1;
|
||||||
endMin = byteArrayToInt(getBytes(data, dataIndex, dataSize));
|
endMin = byteArrayToInt(getBytes(data, dataIndex, dataSize));
|
||||||
|
|
||||||
|
if(endMin == 1 && endMin == endHour && startHour == endHour &&startHour == startMin )
|
||||||
|
failed = true;
|
||||||
|
|
||||||
if (L.isEnabled(L.PUMPCOMM)) {
|
if (L.isEnabled(L.PUMPCOMM)) {
|
||||||
log.debug("Start hour: " + startHour);
|
log.debug("Start hour: " + startHour);
|
||||||
log.debug("Start min: " + startMin);
|
log.debug("Start min: " + startMin);
|
||||||
|
|
|
@ -50,6 +50,9 @@ public class DanaRS_Packet_Option_Get_Pump_Time extends DanaRS_Packet {
|
||||||
Date time = new Date(100 + year, month - 1, day, hour, min, sec);
|
Date time = new Date(100 + year, month - 1, day, hour, min, sec);
|
||||||
DanaRPump.getInstance().pumpTime = time;
|
DanaRPump.getInstance().pumpTime = time;
|
||||||
|
|
||||||
|
if ( year == month && month == day && day == hour && hour == min && min == sec && sec == 1)
|
||||||
|
failed = true;
|
||||||
|
|
||||||
if (L.isEnabled(L.PUMPCOMM)) {
|
if (L.isEnabled(L.PUMPCOMM)) {
|
||||||
log.debug("Pump time " + time.toLocaleString());
|
log.debug("Pump time " + time.toLocaleString());
|
||||||
}
|
}
|
||||||
|
|
|
@ -87,6 +87,8 @@ public class DanaRS_Packet_Option_Get_User_Option extends DanaRS_Packet {
|
||||||
dataIndex += dataSize;
|
dataIndex += dataSize;
|
||||||
dataSize = 1;
|
dataSize = 1;
|
||||||
int selectableLanguage5 = byteArrayToInt(getBytes(data, dataIndex, dataSize));
|
int selectableLanguage5 = byteArrayToInt(getBytes(data, dataIndex, dataSize));
|
||||||
|
// Pump's screen on time can't be less than 5
|
||||||
|
failed = pump.lcdOnTimeSec < 5 ? true : false;
|
||||||
|
|
||||||
if (L.isEnabled(L.PUMPCOMM)) {
|
if (L.isEnabled(L.PUMPCOMM)) {
|
||||||
log.debug("timeDisplayType: " + pump.timeDisplayType);
|
log.debug("timeDisplayType: " + pump.timeDisplayType);
|
||||||
|
|
|
@ -44,6 +44,7 @@ public class DanaRS_Packet_Option_Set_Pump_Time extends DanaRS_Packet {
|
||||||
int dataIndex = DATA_START;
|
int dataIndex = DATA_START;
|
||||||
int dataSize = 1;
|
int dataSize = 1;
|
||||||
error = byteArrayToInt(getBytes(data, dataIndex, dataSize));
|
error = byteArrayToInt(getBytes(data, dataIndex, dataSize));
|
||||||
|
failed = error != 0;
|
||||||
if (L.isEnabled(L.PUMPCOMM)) {
|
if (L.isEnabled(L.PUMPCOMM)) {
|
||||||
if (error == 0)
|
if (error == 0)
|
||||||
log.debug("Result OK");
|
log.debug("Result OK");
|
||||||
|
|
|
@ -55,6 +55,7 @@ public class DanaRS_Packet_Option_Set_User_Option extends DanaRS_Packet {
|
||||||
int dataIndex = DATA_START;
|
int dataIndex = DATA_START;
|
||||||
int dataSize = 1;
|
int dataSize = 1;
|
||||||
error = byteArrayToInt(getBytes(data, dataIndex, dataSize));
|
error = byteArrayToInt(getBytes(data, dataIndex, dataSize));
|
||||||
|
failed = error != 0;
|
||||||
if (L.isEnabled(L.PUMPCOMM)) {
|
if (L.isEnabled(L.PUMPCOMM)) {
|
||||||
if (error == 0)
|
if (error == 0)
|
||||||
log.debug("Result OK");
|
log.debug("Result OK");
|
||||||
|
|
|
@ -38,6 +38,10 @@ public class DanaRS_Packet_Review_Bolus_Avg extends DanaRS_Packet {
|
||||||
dataIndex += dataSize;
|
dataIndex += dataSize;
|
||||||
dataSize = 2;
|
dataSize = 2;
|
||||||
double bolusAvg28 = byteArrayToInt(getBytes(data, dataIndex, dataSize)) / 100d;
|
double bolusAvg28 = byteArrayToInt(getBytes(data, dataIndex, dataSize)) / 100d;
|
||||||
|
double required = (((1 & 0x000000FF) << 8) + (1 & 0x000000FF)) / 100d;
|
||||||
|
if ( bolusAvg03 == bolusAvg07 && bolusAvg07 == bolusAvg14 && bolusAvg14 == bolusAvg21 && bolusAvg21 == bolusAvg28 && bolusAvg28 == required )
|
||||||
|
failed = true;
|
||||||
|
|
||||||
if (L.isEnabled(L.PUMPCOMM)) {
|
if (L.isEnabled(L.PUMPCOMM)) {
|
||||||
log.debug("Bolus average 3d: " + bolusAvg03 + " U");
|
log.debug("Bolus average 3d: " + bolusAvg03 + " U");
|
||||||
log.debug("Bolus average 7d: " + bolusAvg07 + " U");
|
log.debug("Bolus average 7d: " + bolusAvg07 + " U");
|
||||||
|
|
|
@ -42,7 +42,6 @@ public class SourceDexcomG5Plugin extends PluginBase implements BgSourceInterfac
|
||||||
.fragmentClass(BGSourceFragment.class.getName())
|
.fragmentClass(BGSourceFragment.class.getName())
|
||||||
.pluginName(R.string.DexcomG5)
|
.pluginName(R.string.DexcomG5)
|
||||||
.shortName(R.string.dexcomG5_shortname)
|
.shortName(R.string.dexcomG5_shortname)
|
||||||
.showInList(!Config.NSCLIENT)
|
|
||||||
.preferencesId(R.xml.pref_dexcomg5)
|
.preferencesId(R.xml.pref_dexcomg5)
|
||||||
.description(R.string.description_source_dexcom_g5)
|
.description(R.string.description_source_dexcom_g5)
|
||||||
);
|
);
|
||||||
|
|
|
@ -44,8 +44,6 @@ public class SourceNSClientPlugin extends PluginBase implements BgSourceInterfac
|
||||||
.mainType(PluginType.BGSOURCE)
|
.mainType(PluginType.BGSOURCE)
|
||||||
.fragmentClass(BGSourceFragment.class.getName())
|
.fragmentClass(BGSourceFragment.class.getName())
|
||||||
.pluginName(R.string.nsclientbg)
|
.pluginName(R.string.nsclientbg)
|
||||||
.showInList(!Config.NSCLIENT)
|
|
||||||
.alwaysEnabled(Config.NSCLIENT)
|
|
||||||
.description(R.string.description_source_ns_client)
|
.description(R.string.description_source_ns_client)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -96,7 +94,7 @@ public class SourceNSClientPlugin extends PluginBase implements BgSourceInterfac
|
||||||
NSSgv nsSgv = new NSSgv(sgvJson);
|
NSSgv nsSgv = new NSSgv(sgvJson);
|
||||||
BgReading bgReading = new BgReading(nsSgv);
|
BgReading bgReading = new BgReading(nsSgv);
|
||||||
MainApp.getDbHelper().createIfNotExists(bgReading, "NS");
|
MainApp.getDbHelper().createIfNotExists(bgReading, "NS");
|
||||||
SourceNSClientPlugin.getPlugin().detectSource(JsonHelper.safeGetString(sgvJson, "device"), JsonHelper.safeGetLong(sgvJson, "mills"));
|
SourceNSClientPlugin.getPlugin().detectSource(JsonHelper.safeGetString(sgvJson, "device", "none"), JsonHelper.safeGetLong(sgvJson, "mills"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void detectSource(String source, long timeStamp) {
|
public void detectSource(String source, long timeStamp) {
|
||||||
|
|
|
@ -42,7 +42,6 @@ public class SourcePoctechPlugin extends PluginBase implements BgSourceInterface
|
||||||
.mainType(PluginType.BGSOURCE)
|
.mainType(PluginType.BGSOURCE)
|
||||||
.fragmentClass(BGSourceFragment.class.getName())
|
.fragmentClass(BGSourceFragment.class.getName())
|
||||||
.pluginName(R.string.poctech)
|
.pluginName(R.string.poctech)
|
||||||
.showInList(!Config.NSCLIENT)
|
|
||||||
.preferencesId(R.xml.pref_poctech)
|
.preferencesId(R.xml.pref_poctech)
|
||||||
.description(R.string.description_source_poctech)
|
.description(R.string.description_source_poctech)
|
||||||
);
|
);
|
||||||
|
|
|
@ -21,6 +21,9 @@ public class ChargingStateReceiver extends BroadcastReceiver {
|
||||||
public EventChargingState grabChargingState(Context context) {
|
public EventChargingState grabChargingState(Context context) {
|
||||||
BatteryManager bm = (BatteryManager) context.getSystemService(Context.BATTERY_SERVICE);
|
BatteryManager bm = (BatteryManager) context.getSystemService(Context.BATTERY_SERVICE);
|
||||||
|
|
||||||
|
if (bm == null)
|
||||||
|
return new EventChargingState(false);
|
||||||
|
|
||||||
int status = bm.getIntProperty(BatteryManager.BATTERY_PROPERTY_STATUS);
|
int status = bm.getIntProperty(BatteryManager.BATTERY_PROPERTY_STATUS);
|
||||||
boolean isCharging = status == BatteryManager.BATTERY_STATUS_CHARGING
|
boolean isCharging = status == BatteryManager.BATTERY_STATUS_CHARGING
|
||||||
|| status == BatteryManager.BATTERY_STATUS_FULL;
|
|| status == BatteryManager.BATTERY_STATUS_FULL;
|
||||||
|
|
|
@ -21,6 +21,7 @@ import info.nightscout.androidaps.logging.L;
|
||||||
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
|
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
|
||||||
import info.nightscout.androidaps.plugins.ConfigBuilder.ProfileFunctions;
|
import info.nightscout.androidaps.plugins.ConfigBuilder.ProfileFunctions;
|
||||||
import info.nightscout.androidaps.queue.commands.Command;
|
import info.nightscout.androidaps.queue.commands.Command;
|
||||||
|
import info.nightscout.utils.DateUtil;
|
||||||
import info.nightscout.utils.FabricPrivacy;
|
import info.nightscout.utils.FabricPrivacy;
|
||||||
import info.nightscout.utils.LocalAlertUtils;
|
import info.nightscout.utils.LocalAlertUtils;
|
||||||
|
|
||||||
|
@ -63,6 +64,8 @@ public class KeepAliveReceiver extends BroadcastReceiver {
|
||||||
boolean isStatusOutdated = lastConnection.getTime() + STATUS_UPDATE_FREQUENCY < System.currentTimeMillis();
|
boolean isStatusOutdated = lastConnection.getTime() + STATUS_UPDATE_FREQUENCY < System.currentTimeMillis();
|
||||||
boolean isBasalOutdated = Math.abs(profile.getBasal() - pump.getBaseBasalRate()) > pump.getPumpDescription().basalStep;
|
boolean isBasalOutdated = Math.abs(profile.getBasal() - pump.getBaseBasalRate()) > pump.getPumpDescription().basalStep;
|
||||||
|
|
||||||
|
if (L.isEnabled(L.CORE))
|
||||||
|
log.debug("Last connection: " + DateUtil.dateAndTimeString(lastConnection));
|
||||||
LocalAlertUtils.checkPumpUnreachableAlarm(lastConnection, isStatusOutdated);
|
LocalAlertUtils.checkPumpUnreachableAlarm(lastConnection, isStatusOutdated);
|
||||||
|
|
||||||
if (!pump.isThisProfileSet(profile) && !ConfigBuilderPlugin.getCommandQueue().isRunning(Command.CommandType.BASALPROFILE)) {
|
if (!pump.isThisProfileSet(profile) && !ConfigBuilderPlugin.getCommandQueue().isRunning(Command.CommandType.BASALPROFILE)) {
|
||||||
|
|
|
@ -58,14 +58,11 @@ import info.nightscout.utils.SP;
|
||||||
public class SWDefinition {
|
public class SWDefinition {
|
||||||
private static Logger log = LoggerFactory.getLogger(SWDefinition.class);
|
private static Logger log = LoggerFactory.getLogger(SWDefinition.class);
|
||||||
|
|
||||||
private String packageName;
|
|
||||||
|
|
||||||
private AppCompatActivity activity;
|
private AppCompatActivity activity;
|
||||||
private List<SWScreen> screens = new ArrayList<>();
|
private List<SWScreen> screens = new ArrayList<>();
|
||||||
|
|
||||||
public void setActivity(AppCompatActivity activity) {
|
public void setActivity(AppCompatActivity activity) {
|
||||||
this.activity = activity;
|
this.activity = activity;
|
||||||
packageName = activity.getPackageName();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public AppCompatActivity getActivity() {
|
public AppCompatActivity getActivity() {
|
||||||
|
@ -184,11 +181,13 @@ public class SWDefinition {
|
||||||
.visibility(() -> !NSClientPlugin.getPlugin().isEnabled(PluginType.GENERAL)))
|
.visibility(() -> !NSClientPlugin.getPlugin().isEnabled(PluginType.GENERAL)))
|
||||||
.add(new SWEditUrl()
|
.add(new SWEditUrl()
|
||||||
.preferenceId(R.string.key_nsclientinternal_url)
|
.preferenceId(R.string.key_nsclientinternal_url)
|
||||||
|
.updateDelay(5)
|
||||||
.label(R.string.nsclientinternal_url_title)
|
.label(R.string.nsclientinternal_url_title)
|
||||||
.comment(R.string.nsclientinternal_url_dialogmessage))
|
.comment(R.string.nsclientinternal_url_dialogmessage))
|
||||||
.add(new SWEditString()
|
.add(new SWEditString()
|
||||||
.validator(text -> text.length() >= 12)
|
.validator(text -> text.length() >= 12)
|
||||||
.preferenceId(R.string.key_nsclientinternal_api_secret)
|
.preferenceId(R.string.key_nsclientinternal_api_secret)
|
||||||
|
.updateDelay(5)
|
||||||
.label(R.string.nsclientinternal_secret_dialogtitle)
|
.label(R.string.nsclientinternal_secret_dialogtitle)
|
||||||
.comment(R.string.nsclientinternal_secret_dialogmessage))
|
.comment(R.string.nsclientinternal_secret_dialogmessage))
|
||||||
.add(new SWBreak())
|
.add(new SWBreak())
|
||||||
|
@ -365,6 +364,14 @@ public class SWDefinition {
|
||||||
.validator(() -> MainApp.getConfigBuilder().getActiveAPS() != null)
|
.validator(() -> MainApp.getConfigBuilder().getActiveAPS() != null)
|
||||||
.visibility(() -> Config.APS)
|
.visibility(() -> Config.APS)
|
||||||
)
|
)
|
||||||
|
.add(new SWScreen(R.string.apsmode_title)
|
||||||
|
.skippable(false)
|
||||||
|
.add(new SWRadioButton()
|
||||||
|
.option(R.array.aps_modeArray, R.array.aps_modeValues)
|
||||||
|
.preferenceId(R.string.key_aps_mode).label(R.string.apsmode_title)
|
||||||
|
.comment(R.string.setupwizard_preferred_aps_mode))
|
||||||
|
.validator(() -> SP.contains(R.string.key_aps_mode))
|
||||||
|
)
|
||||||
.add(new SWScreen(R.string.configbuilder_loop)
|
.add(new SWScreen(R.string.configbuilder_loop)
|
||||||
.skippable(false)
|
.skippable(false)
|
||||||
.add(new SWInfotext()
|
.add(new SWInfotext()
|
||||||
|
@ -523,10 +530,12 @@ public class SWDefinition {
|
||||||
.visibility(() -> !NSClientPlugin.getPlugin().isEnabled(PluginType.GENERAL)))
|
.visibility(() -> !NSClientPlugin.getPlugin().isEnabled(PluginType.GENERAL)))
|
||||||
.add(new SWEditUrl()
|
.add(new SWEditUrl()
|
||||||
.preferenceId(R.string.key_nsclientinternal_url)
|
.preferenceId(R.string.key_nsclientinternal_url)
|
||||||
|
.updateDelay(5)
|
||||||
.label(R.string.nsclientinternal_url_title)
|
.label(R.string.nsclientinternal_url_title)
|
||||||
.comment(R.string.nsclientinternal_url_dialogmessage))
|
.comment(R.string.nsclientinternal_url_dialogmessage))
|
||||||
.add(new SWEditString()
|
.add(new SWEditString()
|
||||||
.validator(text -> text.length() >= 12)
|
.validator(text -> text.length() >= 12)
|
||||||
|
.updateDelay(5)
|
||||||
.preferenceId(R.string.key_nsclientinternal_api_secret)
|
.preferenceId(R.string.key_nsclientinternal_api_secret)
|
||||||
.label(R.string.nsclientinternal_secret_dialogtitle)
|
.label(R.string.nsclientinternal_secret_dialogtitle)
|
||||||
.comment(R.string.nsclientinternal_secret_dialogmessage))
|
.comment(R.string.nsclientinternal_secret_dialogmessage))
|
||||||
|
@ -545,6 +554,25 @@ public class SWDefinition {
|
||||||
.validator(() -> NSClientPlugin.getPlugin().nsClientService != null && NSClientPlugin.getPlugin().nsClientService.isConnected && NSClientPlugin.getPlugin().nsClientService.hasWriteAuth)
|
.validator(() -> NSClientPlugin.getPlugin().nsClientService != null && NSClientPlugin.getPlugin().nsClientService.isConnected && NSClientPlugin.getPlugin().nsClientService.hasWriteAuth)
|
||||||
.visibility(() -> !(NSClientPlugin.getPlugin().nsClientService != null && NSClientPlugin.getPlugin().nsClientService.isConnected && NSClientPlugin.getPlugin().nsClientService.hasWriteAuth))
|
.visibility(() -> !(NSClientPlugin.getPlugin().nsClientService != null && NSClientPlugin.getPlugin().nsClientService.isConnected && NSClientPlugin.getPlugin().nsClientService.hasWriteAuth))
|
||||||
)
|
)
|
||||||
|
.add(new SWScreen(R.string.configbuilder_bgsource)
|
||||||
|
.skippable(false)
|
||||||
|
.add(new SWPlugin()
|
||||||
|
.option(PluginType.BGSOURCE, R.string.configbuilder_bgsource_description)
|
||||||
|
.label(R.string.configbuilder_bgsource))
|
||||||
|
.add(new SWBreak())
|
||||||
|
.add(new SWButton()
|
||||||
|
.text(R.string.bgsourcesetup)
|
||||||
|
.action(() -> {
|
||||||
|
final PluginBase plugin = (PluginBase) MainApp.getConfigBuilder().getActiveBgSource();
|
||||||
|
PasswordProtection.QueryPassword(activity, R.string.settings_password, "settings_password", () -> {
|
||||||
|
Intent i = new Intent(activity, PreferencesActivity.class);
|
||||||
|
i.putExtra("id", plugin.getPreferencesId());
|
||||||
|
activity.startActivity(i);
|
||||||
|
}, null);
|
||||||
|
})
|
||||||
|
.visibility(() -> MainApp.getConfigBuilder().getActiveBgSource()!= null && ((PluginBase) MainApp.getConfigBuilder().getActiveBgSource()).getPreferencesId() > 0))
|
||||||
|
.validator(() -> MainApp.getConfigBuilder().getActiveBgSource() != null)
|
||||||
|
)
|
||||||
.add(new SWScreen(R.string.patientage)
|
.add(new SWScreen(R.string.patientage)
|
||||||
.skippable(false)
|
.skippable(false)
|
||||||
.add(new SWInfotext()
|
.add(new SWInfotext()
|
||||||
|
|
|
@ -21,6 +21,7 @@ public class SWEditString extends SWItem {
|
||||||
private static Logger log = LoggerFactory.getLogger(SWEditString.class);
|
private static Logger log = LoggerFactory.getLogger(SWEditString.class);
|
||||||
|
|
||||||
private SWTextValidator validator = null;
|
private SWTextValidator validator = null;
|
||||||
|
private int updateDelay = 0;
|
||||||
|
|
||||||
public SWEditString() {
|
public SWEditString() {
|
||||||
super(Type.STRING);
|
super(Type.STRING);
|
||||||
|
@ -58,7 +59,7 @@ public class SWEditString extends SWItem {
|
||||||
@Override
|
@Override
|
||||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||||
if (validator != null && validator.isValid(s.toString()))
|
if (validator != null && validator.isValid(s.toString()))
|
||||||
save(s.toString());
|
save(s.toString(), updateDelay);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -76,4 +77,9 @@ public class SWEditString extends SWItem {
|
||||||
this.validator = validator;
|
this.validator = validator;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public SWEditString updateDelay(int updateDelay) {
|
||||||
|
this.updateDelay = updateDelay;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,8 @@ import info.nightscout.utils.SP;
|
||||||
public class SWEditUrl extends SWItem {
|
public class SWEditUrl extends SWItem {
|
||||||
private static Logger log = LoggerFactory.getLogger(SWEditUrl.class);
|
private static Logger log = LoggerFactory.getLogger(SWEditUrl.class);
|
||||||
|
|
||||||
|
private int updateDelay = 0;
|
||||||
|
|
||||||
public SWEditUrl() {
|
public SWEditUrl() {
|
||||||
super(Type.URL);
|
super(Type.URL);
|
||||||
}
|
}
|
||||||
|
@ -58,7 +60,7 @@ public class SWEditUrl extends SWItem {
|
||||||
@Override
|
@Override
|
||||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||||
if (Patterns.WEB_URL.matcher(s).matches())
|
if (Patterns.WEB_URL.matcher(s).matches())
|
||||||
save(s.toString());
|
save(s.toString(), updateDelay);
|
||||||
else
|
else
|
||||||
MainApp.bus().post(new EventSWLabel(MainApp.gs(R.string.error_url_not_valid)));
|
MainApp.bus().post(new EventSWLabel(MainApp.gs(R.string.error_url_not_valid)));
|
||||||
}
|
}
|
||||||
|
@ -74,4 +76,9 @@ public class SWEditUrl extends SWItem {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public SWEditUrl updateDelay(int updateDelay) {
|
||||||
|
this.updateDelay = updateDelay;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,14 +6,23 @@ import android.widget.LinearLayout;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
import java.util.concurrent.Executors;
|
||||||
|
import java.util.concurrent.ScheduledExecutorService;
|
||||||
|
import java.util.concurrent.ScheduledFuture;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import info.nightscout.androidaps.MainApp;
|
import info.nightscout.androidaps.MainApp;
|
||||||
import info.nightscout.androidaps.events.EventPreferenceChange;
|
import info.nightscout.androidaps.events.EventPreferenceChange;
|
||||||
|
import info.nightscout.androidaps.logging.L;
|
||||||
import info.nightscout.androidaps.setupwizard.events.EventSWUpdate;
|
import info.nightscout.androidaps.setupwizard.events.EventSWUpdate;
|
||||||
import info.nightscout.utils.SP;
|
import info.nightscout.utils.SP;
|
||||||
|
|
||||||
public class SWItem {
|
public class SWItem {
|
||||||
private static Logger log = LoggerFactory.getLogger(SWItem.class);
|
private static Logger log = LoggerFactory.getLogger(SWItem.class);
|
||||||
|
|
||||||
|
private static final ScheduledExecutorService eventWorker = Executors.newSingleThreadScheduledExecutor();
|
||||||
|
private static ScheduledFuture<?> scheduledEventPost = null;
|
||||||
|
|
||||||
public enum Type {
|
public enum Type {
|
||||||
NONE,
|
NONE,
|
||||||
TEXT,
|
TEXT,
|
||||||
|
@ -66,10 +75,9 @@ public class SWItem {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void save(String value) {
|
public void save(String value, int updateDelay) {
|
||||||
SP.putString(preferenceId, value);
|
SP.putString(preferenceId, value);
|
||||||
MainApp.bus().post(new EventPreferenceChange(preferenceId));
|
scheduleChange(updateDelay);
|
||||||
MainApp.bus().post(new EventSWUpdate());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static LinearLayout generateLayout(View view) {
|
public static LinearLayout generateLayout(View view) {
|
||||||
|
@ -83,4 +91,22 @@ public class SWItem {
|
||||||
|
|
||||||
public void processVisibility() {
|
public void processVisibility() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void scheduleChange(int updateDelay) {
|
||||||
|
class PostRunnable implements Runnable {
|
||||||
|
public void run() {
|
||||||
|
if (L.isEnabled(L.CORE))
|
||||||
|
log.debug("Firing EventPreferenceChange");
|
||||||
|
MainApp.bus().post(new EventPreferenceChange(preferenceId));
|
||||||
|
MainApp.bus().post(new EventSWUpdate());
|
||||||
|
scheduledEventPost = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// cancel waiting task to prevent sending multiple posts
|
||||||
|
if (scheduledEventPost != null)
|
||||||
|
scheduledEventPost.cancel(false);
|
||||||
|
Runnable task = new PostRunnable();
|
||||||
|
final int sec = updateDelay;
|
||||||
|
scheduledEventPost = eventWorker.schedule(task, sec, TimeUnit.SECONDS);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,9 +2,11 @@ package info.nightscout.androidaps.setupwizard.elements;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
import android.widget.RadioButton;
|
import android.widget.RadioButton;
|
||||||
import android.widget.RadioGroup;
|
import android.widget.RadioGroup;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
@ -40,6 +42,14 @@ public class SWRadioButton extends SWItem {
|
||||||
@Override
|
@Override
|
||||||
public void generateDialog(LinearLayout layout) {
|
public void generateDialog(LinearLayout layout) {
|
||||||
Context context = layout.getContext();
|
Context context = layout.getContext();
|
||||||
|
|
||||||
|
TextView pdesc = new TextView(context);
|
||||||
|
pdesc.setText(getComment());
|
||||||
|
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||||
|
params.setMargins(0, 0, 0, 40);
|
||||||
|
pdesc.setLayoutParams(params);
|
||||||
|
layout.addView(pdesc);
|
||||||
|
|
||||||
// Get if there is already value in SP
|
// Get if there is already value in SP
|
||||||
String previousValue = SP.getString(preferenceId, "none");
|
String previousValue = SP.getString(preferenceId, "none");
|
||||||
radioGroup = new RadioGroup(context);
|
radioGroup = new RadioGroup(context);
|
||||||
|
@ -59,9 +69,10 @@ public class SWRadioButton extends SWItem {
|
||||||
|
|
||||||
radioGroup.setOnCheckedChangeListener((group, checkedId) -> {
|
radioGroup.setOnCheckedChangeListener((group, checkedId) -> {
|
||||||
int i = (int) group.findViewById(checkedId).getTag();
|
int i = (int) group.findViewById(checkedId).getTag();
|
||||||
save(values()[i]);
|
save(values()[i], 0);
|
||||||
});
|
});
|
||||||
layout.addView(radioGroup);
|
layout.addView(radioGroup);
|
||||||
|
|
||||||
super.generateDialog(layout);
|
super.generateDialog(layout);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
BIN
app/src/main/res/drawable/ic_notification.png
Normal file
BIN
app/src/main/res/drawable/ic_notification.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1,001 B |
|
@ -5,12 +5,99 @@
|
||||||
<string name="treatmentssafety_maxbolus_title">Максимален инсулин при болус [единици]</string>
|
<string name="treatmentssafety_maxbolus_title">Максимален инсулин при болус [единици]</string>
|
||||||
<string name="treatmentssafety_maxcarbs_title">Максимални въглехидрати [гр]</string>
|
<string name="treatmentssafety_maxcarbs_title">Максимални въглехидрати [гр]</string>
|
||||||
<string name="nav_preferences">Опции</string>
|
<string name="nav_preferences">Опции</string>
|
||||||
|
<string name="nav_refreshtreatments">Обнови леченията от NS</string>
|
||||||
|
<string name="nav_resetdb">Нулирай базата данни</string>
|
||||||
|
<string name="reset_db_confirm">Сигурни ли сте че искате да изтриете всички данни?</string>
|
||||||
|
<string name="nav_exit">Изход</string>
|
||||||
|
<string name="danar_useextended_title">Използвай удължен болус за над 200%</string>
|
||||||
|
<string name="danar_bt_name_title">DanaR Bluetooth устройство</string>
|
||||||
|
<string name="ns_sync_use_absolute_title">Използване на абсолютни стойности за базал</string>
|
||||||
|
<string name="alert_dialog_storage_permission_text">Рестартирайте телефона или AndroidAPS от системните настройки или Android APS няма да записва проблемите (което е важно за работата на алгоритъма)!</string>
|
||||||
|
<string name="description_actions">Бутони за бърз достъп до основни функции</string>
|
||||||
<string name="description_careportal">Въвеждане на разширени записи в логовете.</string>
|
<string name="description_careportal">Въвеждане на разширени записи в логовете.</string>
|
||||||
|
<string name="description_config_builder">За конфигурация на активните плъгини</string>
|
||||||
|
<string name="description_objectives">Разучаване на програмата</string>
|
||||||
|
<string name="description_food">Показва въведените в Nightscout храни</string>
|
||||||
|
<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>
|
||||||
|
<string name="description_pump_combo">Поддръжка за Accu-Chek Combo помпи, изискваща инсталиран ruffy</string>
|
||||||
|
<string name="description_pump_dana_r">Поддръжка за Dana Diabecare R помпи</string>
|
||||||
|
<string name="description_pump_dana_r_korean">Поддръжка за корейски Dana Diabecare R помпи</string>
|
||||||
|
<string name="description_pump_dana_r_v2">Поддръжка за Dana Diabecare R помпи с обновен софтуер</string>
|
||||||
|
<string name="description_pump_dana_rs">Поддръжка за Dana Diabecare RS помпи</string>
|
||||||
|
<string name="description_pump_insight">Поддръжка за Accu-Chek Insight pumps помпи, изискваща инсталиран SightRemote</string>
|
||||||
|
<string name="description_pump_mdi">Писалки - За хората, които правят множество ежедневни инжекции ( интензифицирано лечение с писалки)</string>
|
||||||
|
<string name="description_pump_virtual">За помпи, който все още не работят с AndroidAPS(Open Loop)</string>
|
||||||
|
<string name="description_sensitivity_aaps">Чувствителността се изчислява по същия начин като в Oref0, но можете да зададете времева рамка. Минимална въглехидрати абсорбция се изчислява от Макс време за усвояване на въглехидратите в опциите.</string>
|
||||||
|
<string name="description_sensitivity_oref0">Чувствителността се изчислява за 24 часа назад в миналото, а въглехидрати (ако не са се абсорбирали) изчезват след изтичане на срока от настройките.</string>
|
||||||
|
<string name="description_sensitivity_oref1">Чувствителността се изчислява за 8 часа назад в миналото, а въглехидрати (ако не са се абсорбирали) изчезват след изтичане на срока от настройките. Също така се изчисляват и необявени хранения (UAM).</string>
|
||||||
|
<string name="description_sensitivity_weighted_average">Чувствителността се изчислява като среднопретеглена стойност от отклоненията. По-новите отклонения имат по-високо тегло. Минималната абсорбция на въглехидрати се изчислява от Време за макс усвояване на въглехидрати от опциите. Този алгоритъм е най-бързият при проследяването на промени в чувствителността.</string>
|
||||||
|
<string name="description_source_dexcom_g5">Получава данни за КЗ от модифицираното приложение на Dexcom.</string>
|
||||||
|
<string name="description_source_glimp">Получава данни за КЗ от Glimp.</string>
|
||||||
|
<string name="description_source_mm640g">Получават стойности на КЗ от 600SeriesAndroidUploader.</string>
|
||||||
|
<string name="description_source_ns_client">Изтегля стойности на КЗ от Nightscout</string>
|
||||||
|
<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>
|
||||||
|
<string name="nsprofileview_units_label">Единици</string>
|
||||||
|
<string name="nsprofileview_dia_label">DIA (Време на действие на инсулина):</string>
|
||||||
|
<string name="nsprofileview_ic_label">IC (Инсулин/въглехидр.):</string>
|
||||||
|
<string name="nsprofileview_isf_label">ISF (Инс.чувствителност):</string>
|
||||||
|
<string name="nsprofileview_basal_label">Базал</string>
|
||||||
|
<string name="nsprofileview_target_label">Целeва КЗ:</string>
|
||||||
|
<string name="noprofileset">НЕ Е ЗАДАДЕН ПРОФИЛ</string>
|
||||||
|
<string name="treatments_insulin_label_string">Инсулин:</string>
|
||||||
|
<string name="treatments_carbs_label_string">Вълехидрати:</string>
|
||||||
|
<string name="treatments_iob_label_string">IOB:</string>
|
||||||
|
<string name="sms_iob">IOB:</string>
|
||||||
<string name="treatments_activity_string">Активен:</string>
|
<string name="treatments_activity_string">Активен:</string>
|
||||||
|
<string name="treatments_iobtotal_label_string">Общо IOB:</string>
|
||||||
|
<string name="treatments_iobactivitytotal_label_string">Общо активен IOB:</string>
|
||||||
|
<string name="tempbasals_realduration_label_string">Прод.:</string>
|
||||||
|
<string name="tempbasals_netratio_label_string">Съотношение:</string>
|
||||||
|
<string name="tempbasals_netinsulin_label_string">Инс:</string>
|
||||||
|
<string name="tempbasals_iob_label_string">IOB:</string>
|
||||||
|
<string name="tempbasals_iobtotal_label_string">Общо IOB:</string>
|
||||||
|
<string name="treatments_newtreatment_insulinamount_label">Инсулин (ед.):</string>
|
||||||
|
<string name="treatments_newtreatment_carbsamount_label">Въглехидрати (гр.):</string>
|
||||||
|
<string name="treatments_wizard_bg_label">КЗ</string>
|
||||||
|
<string name="treatments_wizard_tt_label">Вр.цел</string>
|
||||||
|
<string name="treatments_wizard_carbs_label">ВХ</string>
|
||||||
|
<string name="treatments_wizard_correction_label">Корекция</string>
|
||||||
|
<string name="insulin_unit_shortname">Ед.</string>
|
||||||
|
<string name="treatments_wizard_bolusiob_label">IOB от болуси</string>
|
||||||
|
<string name="openapsma_run">Старт сега</string>
|
||||||
|
<string name="vitualpump_label">ВИРТУАЛНА ПОМПА</string>
|
||||||
|
<string name="pump_basebasalrate_label">Базова базална стойност</string>
|
||||||
|
<string name="pump_tempbasal_label">Временен базал</string>
|
||||||
|
<string name="virtualpump_extendedbolus_label">Удължен болус</string>
|
||||||
|
<string name="pump_battery_label">Батерия</string>
|
||||||
|
<string name="pump_reservoir_label">Резервоар</string>
|
||||||
|
<string name="virtualpump_resultok">ОК</string>
|
||||||
|
<string name="openapsma_lastrun_label">Последно изпълнение</string>
|
||||||
<string name="openapsma_inputparameters_label">Параметри на входа</string>
|
<string name="openapsma_inputparameters_label">Параметри на входа</string>
|
||||||
|
<string name="openapsma_glucosestatus_label">КЗ стастус</string>
|
||||||
|
<string name="openapsma_currenttemp_label">Настоящ базал</string>
|
||||||
|
<string name="openapsma_iobdata_label">IOB данни</string>
|
||||||
<string name="openapsma_profile_label">Профил</string>
|
<string name="openapsma_profile_label">Профил</string>
|
||||||
<string name="openapsma_mealdata_label">Данни за хранене</string>
|
<string name="openapsma_mealdata_label">Данни за хранене</string>
|
||||||
<string name="result">Резултат</string>
|
<string name="result">Резултат</string>
|
||||||
|
<string name="openapsma_noglucosedata">Няма данни за КЗ</string>
|
||||||
<string name="nochangerequested">Не се изисква промяна</string>
|
<string name="nochangerequested">Не се изисква промяна</string>
|
||||||
<string name="openapsma_request_label">Искане</string>
|
<string name="openapsma_request_label">Искане</string>
|
||||||
<string name="rate">Стойност</string>
|
<string name="rate">Стойност</string>
|
||||||
|
@ -898,6 +985,7 @@
|
||||||
<string name="danar_pumpalarm_vibrate">Вибрация</string>
|
<string name="danar_pumpalarm_vibrate">Вибрация</string>
|
||||||
<string name="danar_pumpalarm_both">И двете</string>
|
<string name="danar_pumpalarm_both">И двете</string>
|
||||||
<string name="danar_screentimeout">Включен екран за [сек]</string>
|
<string name="danar_screentimeout">Включен екран за [сек]</string>
|
||||||
|
<string name="danar_backlight">Подсветка за [сек]</string>
|
||||||
<string name="danar_glucoseunits">Единици на КЗ</string>
|
<string name="danar_glucoseunits">Единици на КЗ</string>
|
||||||
<string name="danar_shutdown">Изключване след(часа)</string>
|
<string name="danar_shutdown">Изключване след(часа)</string>
|
||||||
<string name="danar_lowreservoir">Минимален инсулин в резервоара (единици)</string>
|
<string name="danar_lowreservoir">Минимален инсулин в резервоара (единици)</string>
|
||||||
|
@ -910,7 +998,7 @@
|
||||||
<string name="completed_well_done">Приключихме, Браво!</string>
|
<string name="completed_well_done">Приключихме, Браво!</string>
|
||||||
<string name="not_completed_yet">Все още не сме неприключили</string>
|
<string name="not_completed_yet">Все още не сме неприключили</string>
|
||||||
<string name="time_elapsed">Изминало време</string>
|
<string name="time_elapsed">Изминало време</string>
|
||||||
<string name="nth_objective">%1$дни. Цел</string>
|
<string name="nth_objective">%1$d. Цел</string>
|
||||||
<string name="poctech">Poctech</string>
|
<string name="poctech">Poctech</string>
|
||||||
<string name="description_source_poctech">Получавай данни за КЗ от Poctech апликацията.</string>
|
<string name="description_source_poctech">Получавай данни за КЗ от Poctech апликацията.</string>
|
||||||
<string name="high_temptarget_raises_sensitivity_title">Високите временни цели да вдигат ли чувствителността?</string>
|
<string name="high_temptarget_raises_sensitivity_title">Високите временни цели да вдигат ли чувствителността?</string>
|
||||||
|
@ -925,6 +1013,34 @@
|
||||||
<string name="storedsettingsfound">Открити са предишни настройки</string>
|
<string name="storedsettingsfound">Открити са предишни настройки</string>
|
||||||
<string name="allow_hardware_pump_text">Внимание: Ако активирате и свържете с хардуерна помпа, AndroidAPS ще копира основните настройки от профила в помпата, като презапише съществуващата базова скорост, съхранявана на помпата. Уверете се, че имате правилните основни настройки в AndroidAPS. Ако не сте сигурни или не искате да презапишете основните настройки на помпата, натиснете Cancel и повторете превключването към помпата по-късно.</string>
|
<string name="allow_hardware_pump_text">Внимание: Ако активирате и свържете с хардуерна помпа, AndroidAPS ще копира основните настройки от профила в помпата, като презапише съществуващата базова скорост, съхранявана на помпата. Уверете се, че имате правилните основни настройки в AndroidAPS. Ако не сте сигурни или не искате да презапишете основните настройки на помпата, натиснете Cancel и повторете превключването към помпата по-късно.</string>
|
||||||
<string name="error_adding_treatment_title">Данните за лечението не са пълни</string>
|
<string name="error_adding_treatment_title">Данните за лечението не са пълни</string>
|
||||||
|
<string name="maintenance_settings">Настройки за поддръжка</string>
|
||||||
|
<string name="maintenance_email">Имейл</string>
|
||||||
|
<string name="invalid_email_message">Невалиден e-mail</string>
|
||||||
|
<string name="maintenance_amount">Брой логове за изпращане</string>
|
||||||
|
<string name="maintenance">Поддръжка</string>
|
||||||
|
<string name="maintenance_shortname">ПОДДР</string>
|
||||||
|
<string name="description_maintenance">Предоставя няколко функции за поддръжка (напр. изпращане и изтриване на логовете).</string>
|
||||||
|
<string name="send_all_logs">Изпратщане на логове чрез ел. поща</string>
|
||||||
|
<string name="delete_logs">Изтрий логове</string>
|
||||||
<string name="error_adding_treatment_message">Събитие (инсулин: %1$.2f, въглехидрати: %2$d, в: %3$s) не може да бъде добавено към събития. Моля уверете се, че е правилно и го добавете ръчно.</string>
|
<string name="error_adding_treatment_message">Събитие (инсулин: %1$.2f, въглехидрати: %2$d, в: %3$s) не може да бъде добавено към събития. Моля уверете се, че е правилно и го добавете ръчно.</string>
|
||||||
<string name="openaps_noasdata">Няма налични данни за авточувствителност</string>
|
<string name="openaps_noasdata">Няма налични данни за авточувствителност</string>
|
||||||
|
<string name="nav_logsettings">Настройки на логовете</string>
|
||||||
|
<string name="resettodefaults">Възстанови настройките по подразбиране</string>
|
||||||
|
<string name="nsmalfunction">Грешка в NSClient. Рестартирайте Nightscout и NSClient</string>
|
||||||
|
<string name="as">като
|
||||||
|
</string>
|
||||||
|
<string name="versionavailable">Има налично обновяване до версия %1$s </string>
|
||||||
|
<string name="time_offset">времево отместване</string>
|
||||||
|
<plurals name="objective_days">
|
||||||
|
<item quantity="one">%1$d дeн</item>
|
||||||
|
<item quantity="other">%1$d дни</item>
|
||||||
|
</plurals>
|
||||||
|
<plurals name="objective_hours">
|
||||||
|
<item quantity="one">%1$d часа</item>
|
||||||
|
<item quantity="other">%1$d часа</item>
|
||||||
|
</plurals>
|
||||||
|
<plurals name="objective_minutes">
|
||||||
|
<item quantity="one">%1$d минута</item>
|
||||||
|
<item quantity="other">%1$d минутa</item>
|
||||||
|
</plurals>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
<string name="treatmentssafety_title">Bezpečnost zadání ošetřeni</string>
|
<string name="treatmentssafety_title">Bezpečnost zadání ošetřeni</string>
|
||||||
<string name="treatmentssafety_maxbolus_title">Maximální povolený bolus [U]</string>
|
<string name="treatmentssafety_maxbolus_title">Maximální povolený bolus [U]</string>
|
||||||
<string name="treatmentssafety_maxcarbs_title">Maximální počet sacharidů [g]</string>
|
<string name="treatmentssafety_maxcarbs_title">Maximální počet sacharidů [g]</string>
|
||||||
<string name="nav_preferences">Předvolby</string>
|
<string name="nav_preferences">Nastavení</string>
|
||||||
<string name="nav_refreshtreatments">Obnovit ošetření z NS</string>
|
<string name="nav_refreshtreatments">Obnovit ošetření z NS</string>
|
||||||
<string name="nav_resetdb">Inicializovat databáze</string>
|
<string name="nav_resetdb">Inicializovat databáze</string>
|
||||||
<string name="reset_db_confirm">Opravdu resetovat všechny databáze?</string>
|
<string name="reset_db_confirm">Opravdu resetovat všechny databáze?</string>
|
||||||
|
|
|
@ -1027,7 +1027,6 @@ maxIOB = durchschnittlicher Essensbolus + 3 x maximale Basalrate</string>
|
||||||
<string name="send_all_logs">Logs als E-Mail versenden</string>
|
<string name="send_all_logs">Logs als E-Mail versenden</string>
|
||||||
<string name="delete_logs">Logs löschen</string>
|
<string name="delete_logs">Logs löschen</string>
|
||||||
<string name="error_adding_treatment_message">Der Eintrag (Insulin: %1$.2f, Kohlenhydrate: %2$d, um: %3$s) konnte nicht als Behandlung gespeichert werden. Bitte überprüfe die aktuelle Liste und füge, falls notwendig, den Datensatz manuell hinzu.</string>
|
<string name="error_adding_treatment_message">Der Eintrag (Insulin: %1$.2f, Kohlenhydrate: %2$d, um: %3$s) konnte nicht als Behandlung gespeichert werden. Bitte überprüfe die aktuelle Liste und füge, falls notwendig, den Datensatz manuell hinzu.</string>
|
||||||
<string name="generated_ecarbs_note">eCarbs: %1$d g (%2$d h), Start: %3$d m</string>
|
|
||||||
<string name="openaps_noasdata">Keine Autosens-Daten verfügbar</string>
|
<string name="openaps_noasdata">Keine Autosens-Daten verfügbar</string>
|
||||||
<string name="nav_logsettings">Log-Einstellungen</string>
|
<string name="nav_logsettings">Log-Einstellungen</string>
|
||||||
<string name="resettodefaults">Auf Standardwerte zurücksetzen</string>
|
<string name="resettodefaults">Auf Standardwerte zurücksetzen</string>
|
||||||
|
|
|
@ -712,6 +712,8 @@
|
||||||
<string name="dexcomg5_xdripupload_title">Mandar datos BG a xDrip+</string>
|
<string name="dexcomg5_xdripupload_title">Mandar datos BG a xDrip+</string>
|
||||||
<string name="dexcomg5_xdripupload_summary">En xDrip+ elige 640g/Eversense como fuente de datos</string>
|
<string name="dexcomg5_xdripupload_summary">En xDrip+ elige 640g/Eversense como fuente de datos</string>
|
||||||
<string name="nsclientbg">NSClient BG</string>
|
<string name="nsclientbg">NSClient BG</string>
|
||||||
|
<string name="minimalbasalvaluereplaced">Valor basal reemplazado por el valor mínimo soportado: %s</string>
|
||||||
|
<string name="maximumbasalvaluereplaced">Valor basal reemplazado por valor máximo soportado: %s</string>
|
||||||
<string name="overview_editquickwizard_usebg">Cálculo BG</string>
|
<string name="overview_editquickwizard_usebg">Cálculo BG</string>
|
||||||
<string name="overview_editquickwizard_usebolusiob">Cálculo bolo IOB</string>
|
<string name="overview_editquickwizard_usebolusiob">Cálculo bolo IOB</string>
|
||||||
<string name="overview_editquickwizard_usebasaliob">Cálculo basal IOB</string>
|
<string name="overview_editquickwizard_usebasaliob">Cálculo basal IOB</string>
|
||||||
|
@ -765,6 +767,7 @@
|
||||||
<string name="combo_error_no_connection_no_bolus_delivered">Bomba inalcanzable. No se administró ningún Bolo</string>
|
<string name="combo_error_no_connection_no_bolus_delivered">Bomba inalcanzable. No se administró ningún Bolo</string>
|
||||||
<string name="combo_error_no_bolus_delivered">Emisión del bolo fallada. Ningún bolo se ha emitido. Para asegurarse, por favor controle la bomba para evitar bolo doble. Para evitar bugs no se reinician bolos automáticamente.</string>
|
<string name="combo_error_no_bolus_delivered">Emisión del bolo fallada. Ningún bolo se ha emitido. Para asegurarse, por favor controle la bomba para evitar bolo doble. Para evitar bugs no se reinician bolos automáticamente.</string>
|
||||||
<string name="combo_error_partial_bolus_delivered">Sólo %1$.2f U del bolo mandado de %2$.2f U ha sido suministrado a causa de un error. Por favor verifica esto en la bomba y toma las acciones apropiadas.</string>
|
<string name="combo_error_partial_bolus_delivered">Sólo %1$.2f U del bolo mandado de %2$.2f U ha sido suministrado a causa de un error. Por favor verifica esto en la bomba y toma las acciones apropiadas.</string>
|
||||||
|
<string name="combo_error_bolus_verification_failed">Entrega del bolo y verificación del historial de la bomba falló, por favor, revise la bomba. Si un bolo fue puesto por la bomba, se añadirá a los tratamientos en la próxima conexión a la bomba.</string>
|
||||||
<string name="combo_reservoir_level_insufficient_for_bolus">No hay suficiente insulina en el depósito para emitir bolo</string>
|
<string name="combo_reservoir_level_insufficient_for_bolus">No hay suficiente insulina en el depósito para emitir bolo</string>
|
||||||
<string name="extendedbolusdeliveryerror">Error al emitir bolo extendido</string>
|
<string name="extendedbolusdeliveryerror">Error al emitir bolo extendido</string>
|
||||||
<string name="insightpump_shortname">Insight</string>
|
<string name="insightpump_shortname">Insight</string>
|
||||||
|
@ -1023,7 +1026,6 @@
|
||||||
<string name="send_all_logs">Enviar registros por email</string>
|
<string name="send_all_logs">Enviar registros por email</string>
|
||||||
<string name="delete_logs">Borrar registros</string>
|
<string name="delete_logs">Borrar registros</string>
|
||||||
<string name="error_adding_treatment_message">Un tratamiento (insulina: %1$.2f, carbs: %2$d, at: %3$s) no ha podido ser añadido a tratamientos. Por favor compruebe y añada manualmente el registro apropiadamente.</string>
|
<string name="error_adding_treatment_message">Un tratamiento (insulina: %1$.2f, carbs: %2$d, at: %3$s) no ha podido ser añadido a tratamientos. Por favor compruebe y añada manualmente el registro apropiadamente.</string>
|
||||||
<string name="generated_ecarbs_note">eCarbs: %1$d g (%2$d h), inicio: %3$d m</string>
|
|
||||||
<string name="openaps_noasdata">Sin datos autosens disponibles</string>
|
<string name="openaps_noasdata">Sin datos autosens disponibles</string>
|
||||||
<string name="nav_logsettings">Ajustes del registro</string>
|
<string name="nav_logsettings">Ajustes del registro</string>
|
||||||
<string name="resettodefaults">Restablecer valores predeterminados</string>
|
<string name="resettodefaults">Restablecer valores predeterminados</string>
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<!--Generated by crowdin.com-->
|
<!--Generated by crowdin.com-->
|
||||||
<resources>
|
<resources>
|
||||||
<string name="treatmentssafety_title">Behandeling veiligheid</string>
|
<string name="treatmentssafety_title">Behandeling veiligheid</string>
|
||||||
<string name="treatmentssafety_maxbolus_title">Max toegestane bolus [U]</string>
|
<string name="treatmentssafety_maxbolus_title">Max toegestane bolus [E]</string>
|
||||||
<string name="treatmentssafety_maxcarbs_title">Max toegestane koolhydraten [g]</string>
|
<string name="treatmentssafety_maxcarbs_title">Max toegestane koolhydraten [g]</string>
|
||||||
<string name="nav_preferences">Instellingen</string>
|
<string name="nav_preferences">Instellingen</string>
|
||||||
<string name="nav_refreshtreatments">Haal behandelingen op van NS</string>
|
<string name="nav_refreshtreatments">Haal behandelingen op van NS</string>
|
||||||
|
@ -225,10 +225,10 @@
|
||||||
<string name="filenotfound">Bestand niet gevonden</string>
|
<string name="filenotfound">Bestand niet gevonden</string>
|
||||||
<string name="nav_export">Exporteer instellingen</string>
|
<string name="nav_export">Exporteer instellingen</string>
|
||||||
<string name="nav_import">Importeer instellingen</string>
|
<string name="nav_import">Importeer instellingen</string>
|
||||||
<string name="openapsma_maxbasal_title">Maximale E/hr dat OpenAPS kan toedienen</string>
|
<string name="openapsma_maxbasal_title">Maximale E/uur dat OpenAPS kan toedienen</string>
|
||||||
<string name="openapsma_maxbasal_summary">Dit is de maximale waarde waarop het basaal door OpenAPS ingesteld kan worden</string>
|
<string name="openapsma_maxbasal_summary">Dit is de maximale waarde waarop het basaal door OpenAPS ingesteld kan worden</string>
|
||||||
<string name="openapsma_maxiob_title">Maximaal basaal IOB OpenAPS kan toedienen [U]</string>
|
<string name="openapsma_maxiob_title">Maximale basaal IOB, dat OpenAPS kan toedienen [E]</string>
|
||||||
<string name="openapsma_maxiob_summary">Deze waarde wordt de Max IOB genoemd in OpenAPS context\nDit is de maximale insuline hoeveelheid in [U] dat APS in één keer kan toedienen.</string>
|
<string name="openapsma_maxiob_summary">Deze waarde wordt de Max IOB genoemd in OpenAPS context\nDit is de maximale insuline hoeveelheid in [E] dat APS in één keer kan toedienen.</string>
|
||||||
<string name="dismiss">NEGEER</string>
|
<string name="dismiss">NEGEER</string>
|
||||||
<string name="danarpump">DanaR</string>
|
<string name="danarpump">DanaR</string>
|
||||||
<string name="connecting">Verbinden</string>
|
<string name="connecting">Verbinden</string>
|
||||||
|
@ -275,7 +275,7 @@
|
||||||
<string name="careportal_temporarytarget">Tijd. streefdoel</string>
|
<string name="careportal_temporarytarget">Tijd. streefdoel</string>
|
||||||
<string name="careportal_temporarytargetcancel">Tijdelijk streefdoel annuleren</string>
|
<string name="careportal_temporarytargetcancel">Tijdelijk streefdoel annuleren</string>
|
||||||
<string name="danarprofile">DanaR profiel instellingen</string>
|
<string name="danarprofile">DanaR profiel instellingen</string>
|
||||||
<string name="danarprofile_dia">DIA [h]</string>
|
<string name="danarprofile_dia">DIA [uur]</string>
|
||||||
<string name="danarprofile_dia_summary">Duur van insuline activiteit</string>
|
<string name="danarprofile_dia_summary">Duur van insuline activiteit</string>
|
||||||
<string name="failedupdatebasalprofile">Update basaal profiel mislukt</string>
|
<string name="failedupdatebasalprofile">Update basaal profiel mislukt</string>
|
||||||
<string name="danar_historyreload">Vernieuw</string>
|
<string name="danar_historyreload">Vernieuw</string>
|
||||||
|
@ -339,7 +339,7 @@ Stel in en gebruik tijdelijk en standaard tijdelijke streefdoelen (bv. bij sport
|
||||||
<string name="valueoutofrange" formatted="false">Waarde %s is buiten de toegestane limieten</string>
|
<string name="valueoutofrange" formatted="false">Waarde %s is buiten de toegestane limieten</string>
|
||||||
<string name="smscommunicator_remotebasalnotallowed">Basale instellingen op afstand zijn niet toegestaan</string>
|
<string name="smscommunicator_remotebasalnotallowed">Basale instellingen op afstand zijn niet toegestaan</string>
|
||||||
<string name="smscommunicator_remotecommandnotallowed">Commando\'s op afstand zijn niet toegestaan</string>
|
<string name="smscommunicator_remotecommandnotallowed">Commando\'s op afstand zijn niet toegestaan</string>
|
||||||
<string name="smscommunicator_basalreplywithcode">Om het basaal %1$.2fU/hr te starten antwoord met de code %2$s</string>
|
<string name="smscommunicator_basalreplywithcode">Om het basaal %1$.2fE/uur te starten antwoord met de code %2$s</string>
|
||||||
<string name="smscommunicator_suspendreplywithcode">Om de loop te onderbreken voor %1$d minuten antwoord met de code %2$s</string>
|
<string name="smscommunicator_suspendreplywithcode">Om de loop te onderbreken voor %1$d minuten antwoord met de code %2$s</string>
|
||||||
<string name="smscommunicator_tempbasalset">Tijdelijk basaal %1$.2fE/u voor %2$d minuten succesvol gestart</string>
|
<string name="smscommunicator_tempbasalset">Tijdelijk basaal %1$.2fE/u voor %2$d minuten succesvol gestart</string>
|
||||||
<string name="smscommunicator_tempbasalfailed">Start tijdelijk basaal mislukt</string>
|
<string name="smscommunicator_tempbasalfailed">Start tijdelijk basaal mislukt</string>
|
||||||
|
@ -392,7 +392,7 @@ Stel in en gebruik tijdelijk en standaard tijdelijke streefdoelen (bv. bij sport
|
||||||
<string name="profile_set_ok">Basaal profiel in pomp bijgewerkt</string>
|
<string name="profile_set_ok">Basaal profiel in pomp bijgewerkt</string>
|
||||||
<string name="danar_disableeasymode">EasyUI modus in pomp deactiveren</string>
|
<string name="danar_disableeasymode">EasyUI modus in pomp deactiveren</string>
|
||||||
<string name="danar_enableextendedbolus">Activeer vertraagde bolussen op de pomp</string>
|
<string name="danar_enableextendedbolus">Activeer vertraagde bolussen op de pomp</string>
|
||||||
<string name="danar_switchtouhmode">Wijzig de mudus U/d naar U/u op de pomp</string>
|
<string name="danar_switchtouhmode">Wijzig de modus E/dag naar E/uur op de pomp</string>
|
||||||
<string name="basalvaluebelowminimum">Basaalwaarde onder minimum. Profiel niet ingesteld!</string>
|
<string name="basalvaluebelowminimum">Basaalwaarde onder minimum. Profiel niet ingesteld!</string>
|
||||||
<string name="sms_actualbg">BG:</string>
|
<string name="sms_actualbg">BG:</string>
|
||||||
<string name="sms_lastbg">Laatste BG:</string>
|
<string name="sms_lastbg">Laatste BG:</string>
|
||||||
|
@ -587,7 +587,7 @@ Stel in en gebruik tijdelijk en standaard tijdelijke streefdoelen (bv. bij sport
|
||||||
<string name="nsalarm_urgentstaledata">Dringend oude gegevens vernieuwen</string>
|
<string name="nsalarm_urgentstaledata">Dringend oude gegevens vernieuwen</string>
|
||||||
<string name="nsalarm_staledatavalue_label">Oude gegevens sinds [min]</string>
|
<string name="nsalarm_staledatavalue_label">Oude gegevens sinds [min]</string>
|
||||||
<string name="nsalarm_urgent_staledatavalue_label">Alarm oude gegevens sinds [min]</string>
|
<string name="nsalarm_urgent_staledatavalue_label">Alarm oude gegevens sinds [min]</string>
|
||||||
<string name="openapsama_autosens_period">Interval voor autosens [h]</string>
|
<string name="openapsama_autosens_period">Interval voor autosens [uur]</string>
|
||||||
<string name="openapsama_autosens_period_summary">Aantal uren in het verleden voor gevoeligheids detectie (koolhy. absorbtie tijd niet meegerekend)</string>
|
<string name="openapsama_autosens_period_summary">Aantal uren in het verleden voor gevoeligheids detectie (koolhy. absorbtie tijd niet meegerekend)</string>
|
||||||
<string name="pump">Pomp</string>
|
<string name="pump">Pomp</string>
|
||||||
<string name="openaps">OpenAPS</string>
|
<string name="openaps">OpenAPS</string>
|
||||||
|
@ -599,7 +599,7 @@ Stel in en gebruik tijdelijk en standaard tijdelijke streefdoelen (bv. bij sport
|
||||||
<string name="sensitivityoref1">Gevoeligheid Oref1</string>
|
<string name="sensitivityoref1">Gevoeligheid Oref1</string>
|
||||||
<string name="sensitivityaaps">Gevoeligheid AAPS</string>
|
<string name="sensitivityaaps">Gevoeligheid AAPS</string>
|
||||||
<string name="absorptionsettings_title">Opname instellingen</string>
|
<string name="absorptionsettings_title">Opname instellingen</string>
|
||||||
<string name="absorption_maxtime_title">Max absorbtietijd maaltijd [h]</string>
|
<string name="absorption_maxtime_title">Max absorptietijd maaltijd [uur]</string>
|
||||||
<string name="absorption_maxtime_summary">Verwachte tijd in uren totdat alle koolhydraten opgenomen zijn</string>
|
<string name="absorption_maxtime_summary">Verwachte tijd in uren totdat alle koolhydraten opgenomen zijn</string>
|
||||||
<string name="danar_visualizeextendedaspercentage_title">Toon vertraagde bolussen in % aan</string>
|
<string name="danar_visualizeextendedaspercentage_title">Toon vertraagde bolussen in % aan</string>
|
||||||
<string name="careportal_sensorage_label_short">SAGE</string>
|
<string name="careportal_sensorage_label_short">SAGE</string>
|
||||||
|
@ -624,7 +624,7 @@ Stel in en gebruik tijdelijk en standaard tijdelijke streefdoelen (bv. bij sport
|
||||||
<string name="careportal_carbsandbolus_label">KOOLHYDRATEN & BOLUS</string>
|
<string name="careportal_carbsandbolus_label">KOOLHYDRATEN & BOLUS</string>
|
||||||
<string name="careportal_cgm_label">CGM & OPENAPS</string>
|
<string name="careportal_cgm_label">CGM & OPENAPS</string>
|
||||||
<string name="careportal_pump_label">POMO</string>
|
<string name="careportal_pump_label">POMO</string>
|
||||||
<string name="overview_newtempbasal_basalabsolute">Basale waarde [E/hr]</string>
|
<string name="overview_newtempbasal_basalabsolute">Basale waarde [E/uur]</string>
|
||||||
<string name="careportal_newnstreatment_duration_min_label">Tijdsduur [min]</string>
|
<string name="careportal_newnstreatment_duration_min_label">Tijdsduur [min]</string>
|
||||||
<string name="openapssmb">OpenAPS SMB</string>
|
<string name="openapssmb">OpenAPS SMB</string>
|
||||||
<string name="smb_shortname">SMB</string>
|
<string name="smb_shortname">SMB</string>
|
||||||
|
@ -654,7 +654,7 @@ Stel in en gebruik tijdelijk en standaard tijdelijke streefdoelen (bv. bij sport
|
||||||
<string name="selectedpump">Geselecteerde pomp</string>
|
<string name="selectedpump">Geselecteerde pomp</string>
|
||||||
<string name="pairpump">Koppel nieuwe pomp</string>
|
<string name="pairpump">Koppel nieuwe pomp</string>
|
||||||
<string name="bolusspeed">Bolus snelheid</string>
|
<string name="bolusspeed">Bolus snelheid</string>
|
||||||
<string name="danar_setbasalstep001">Zet de basale stap op 0,01 E/u</string>
|
<string name="danar_setbasalstep001">Zet de basale stap op 0,01 E/uur</string>
|
||||||
<string name="serialnumber">Serie nummer</string>
|
<string name="serialnumber">Serie nummer</string>
|
||||||
<string name="careportal_newnstreatment_percentage_label">Percentage</string>
|
<string name="careportal_newnstreatment_percentage_label">Percentage</string>
|
||||||
<string name="careportal_newnstreatment_timeshift_label">Tijd verschuiving</string>
|
<string name="careportal_newnstreatment_timeshift_label">Tijd verschuiving</string>
|
||||||
|
@ -770,9 +770,9 @@ Stel in en gebruik tijdelijk en standaard tijdelijke streefdoelen (bv. bij sport
|
||||||
<string name="combo_error_partial_bolus_delivered">Maar %1$.2f E van de gevraagde %2$.2f E zijn toegediend door een storing. Gelieve op de pomp te controleren en het gepaste gevolg uit te voeren.</string>
|
<string name="combo_error_partial_bolus_delivered">Maar %1$.2f E van de gevraagde %2$.2f E zijn toegediend door een storing. Gelieve op de pomp te controleren en het gepaste gevolg uit te voeren.</string>
|
||||||
<string name="combo_error_bolus_verification_failed">Het toedienen van de bolus en het controleren van de geschiedenis van de pomp is mislukt, controleer de pomp. Als een bolus is toegediend, wordt deze toegevoegd aan Behandelingen tijdens de volgende verbinding met de pomp.</string>
|
<string name="combo_error_bolus_verification_failed">Het toedienen van de bolus en het controleren van de geschiedenis van de pomp is mislukt, controleer de pomp. Als een bolus is toegediend, wordt deze toegevoegd aan Behandelingen tijdens de volgende verbinding met de pomp.</string>
|
||||||
<string name="combo_reservoir_level_insufficient_for_bolus">Niet genoeg insuline aanwezig in reservoir voor de bolus</string>
|
<string name="combo_reservoir_level_insufficient_for_bolus">Niet genoeg insuline aanwezig in reservoir voor de bolus</string>
|
||||||
<string name="extendedbolusdeliveryerror">Vertraagde bolus toedien storing</string>
|
<string name="extendedbolusdeliveryerror">Vertraagde bolus toedieningsfout</string>
|
||||||
<string name="insightpump_shortname">Inzicht</string>
|
<string name="insightpump_shortname">Insight</string>
|
||||||
<string name="insightpump">Inzicht pomp</string>
|
<string name="insightpump">Insight pomp</string>
|
||||||
<string name="status_no_colon">Status</string>
|
<string name="status_no_colon">Status</string>
|
||||||
<string name="changed">Verwisseld</string>
|
<string name="changed">Verwisseld</string>
|
||||||
<string name="pump_stopped_uppercase">Pomp Gestopt</string>
|
<string name="pump_stopped_uppercase">Pomp Gestopt</string>
|
||||||
|
@ -866,7 +866,7 @@ Stel in en gebruik tijdelijk en standaard tijdelijke streefdoelen (bv. bij sport
|
||||||
<string name="closed_loop_disabled_on_dev_branch">Dev versie actief. Closed loop gedeactiveerd</string>
|
<string name="closed_loop_disabled_on_dev_branch">Dev versie actief. Closed loop gedeactiveerd</string>
|
||||||
<string name="engineering_mode_enabled">Engineering modus is geactiveerd</string>
|
<string name="engineering_mode_enabled">Engineering modus is geactiveerd</string>
|
||||||
<string name="not_eng_mode_or_release">Engineering modus is niet geactiveerd en dit is niet de release branche</string>
|
<string name="not_eng_mode_or_release">Engineering modus is niet geactiveerd en dit is niet de release branche</string>
|
||||||
<string name="pump_basebasalrate">%.2f E/u</string>
|
<string name="pump_basebasalrate">%.2f E/uur</string>
|
||||||
<string name="combo_actvity_reading_basal_profile">Basaal profiel wordt gelezen</string>
|
<string name="combo_actvity_reading_basal_profile">Basaal profiel wordt gelezen</string>
|
||||||
<string name="combo_bolus_rejected_due_to_pump_history_change">De pomp historiek is gewijzigd nadat de bolus berekend was. De bolus is Niet toegediend. Programmeer een nieuwe bolus indien nodig.</string>
|
<string name="combo_bolus_rejected_due_to_pump_history_change">De pomp historiek is gewijzigd nadat de bolus berekend was. De bolus is Niet toegediend. Programmeer een nieuwe bolus indien nodig.</string>
|
||||||
<string name="combo_error_updating_treatment_record">Bolus succesvol toegediend, maar toevoegen van de behandeling is gefaald. Dit kan voorvallen wanneer twee kleine bolussen van dezelfde grote gekozen waren gedurende de laatste 2 minuten. Controleer aub de pomphistoriek en de behandelingen, voeg de ontbrekende toe via het Careportal. Let op dat je geen 2 dezelfde hoeveelheden hebt op hetzelfde ogenblik.</string>
|
<string name="combo_error_updating_treatment_record">Bolus succesvol toegediend, maar toevoegen van de behandeling is gefaald. Dit kan voorvallen wanneer twee kleine bolussen van dezelfde grote gekozen waren gedurende de laatste 2 minuten. Controleer aub de pomphistoriek en de behandelingen, voeg de ontbrekende toe via het Careportal. Let op dat je geen 2 dezelfde hoeveelheden hebt op hetzelfde ogenblik.</string>
|
||||||
|
@ -889,7 +889,7 @@ Stel in en gebruik tijdelijk en standaard tijdelijke streefdoelen (bv. bij sport
|
||||||
<string name="closedmodedisabledinpreferences">Closed Loop modus gedeactiveerd in de voorkeuren</string>
|
<string name="closedmodedisabledinpreferences">Closed Loop modus gedeactiveerd in de voorkeuren</string>
|
||||||
<string name="autosensdisabledinpreferences">Autosens gedeactiveerd in de voorkeuren</string>
|
<string name="autosensdisabledinpreferences">Autosens gedeactiveerd in de voorkeuren</string>
|
||||||
<string name="smbdisabledinpreferences">SMB gedeactiveerd in de voorkeuren</string>
|
<string name="smbdisabledinpreferences">SMB gedeactiveerd in de voorkeuren</string>
|
||||||
<string name="limitingbasalratio">Beperken van basaal tot max %1$.2f E/U wegens de %2$s</string>
|
<string name="limitingbasalratio">Beperken van basaal tot max %1$.2f E/uur wegens de %2$s</string>
|
||||||
<string name="pumplimit">Pomp limiet</string>
|
<string name="pumplimit">Pomp limiet</string>
|
||||||
<string name="itmustbepositivevalue">dit moet een positieve waarde zijn</string>
|
<string name="itmustbepositivevalue">dit moet een positieve waarde zijn</string>
|
||||||
<string name="maxbasalmultiplier">Max basaal vermenigvuldiger</string>
|
<string name="maxbasalmultiplier">Max basaal vermenigvuldiger</string>
|
||||||
|
@ -915,12 +915,12 @@ Stel in en gebruik tijdelijk en standaard tijdelijke streefdoelen (bv. bij sport
|
||||||
<string name="loopdisconnectedfor">Verbinding verbroken (%1$d m)</string>
|
<string name="loopdisconnectedfor">Verbinding verbroken (%1$d m)</string>
|
||||||
<string name="automatic_careportal_events">Automatische Careportal gebeurtenissen</string>
|
<string name="automatic_careportal_events">Automatische Careportal gebeurtenissen</string>
|
||||||
<string name="automatically_upload_insulin_cannula_and_battery_changes_to_nightscout">Automatische Insuline, infusieset wissels, batterij wissels en pomp alarmen naar NS uploaden</string>
|
<string name="automatically_upload_insulin_cannula_and_battery_changes_to_nightscout">Automatische Insuline, infusieset wissels, batterij wissels en pomp alarmen naar NS uploaden</string>
|
||||||
<string name="openapssmb_maxiob_title">Max totaal IOB dat OpenAPS niet groter dan [U]</string>
|
<string name="openapssmb_maxiob_title">Max totaal IOB dat OpenAPS niet kan overschrijden [E]</string>
|
||||||
<string name="openapssmb_maxiob_summary">Deze waarde heet MAX IOB in OpenAPS context\nOpenAPS zal geen extra insuline toedienen als de actuele IOB onderstaande waarde overschreden heeft</string>
|
<string name="openapssmb_maxiob_summary">Deze waarde heet MAX IOB in OpenAPS context\nOpenAPS zal geen extra insuline toedienen als de actuele IOB onderstaande waarde overschreden heeft</string>
|
||||||
<string name="pump_stopped">Pomp gestopt</string>
|
<string name="pump_stopped">Pomp gestopt</string>
|
||||||
<string name="pump_started">Pomp gestart</string>
|
<string name="pump_started">Pomp gestart</string>
|
||||||
<string name="pump_paused">Pomp gepauzeerd</string>
|
<string name="pump_paused">Pomp gepauzeerd</string>
|
||||||
<string name="absorption_cutoff_title">Maximum maaltijd absorptie tijd [h]</string>
|
<string name="absorption_cutoff_title">Maximum maaltijd absorptie tijd [uur]</string>
|
||||||
<string name="absorption_cutoff_summary">Tijdspanne waarbinnen elke maaltijd volledig is opgenomen. Resterende KH worden niet mee gerekend.</string>
|
<string name="absorption_cutoff_summary">Tijdspanne waarbinnen elke maaltijd volledig is opgenomen. Resterende KH worden niet mee gerekend.</string>
|
||||||
<string name="time">Tijd</string>
|
<string name="time">Tijd</string>
|
||||||
<string name="overview_show_notes_field_in_dialogs_title">Toon het notities veld in het behandeling dialoog</string>
|
<string name="overview_show_notes_field_in_dialogs_title">Toon het notities veld in het behandeling dialoog</string>
|
||||||
|
@ -1027,7 +1027,6 @@ Stel in en gebruik tijdelijk en standaard tijdelijke streefdoelen (bv. bij sport
|
||||||
<string name="send_all_logs">Verstuur Logs per e-mail</string>
|
<string name="send_all_logs">Verstuur Logs per e-mail</string>
|
||||||
<string name="delete_logs">Verwijder Logs</string>
|
<string name="delete_logs">Verwijder Logs</string>
|
||||||
<string name="error_adding_treatment_message">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.</string>
|
<string name="error_adding_treatment_message">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.</string>
|
||||||
<string name="generated_ecarbs_note">eCarbs: %1$d g (%2$d h), start: %3$d m</string>
|
|
||||||
<string name="openaps_noasdata">Geen autosens-gegevens beschikbaar</string>
|
<string name="openaps_noasdata">Geen autosens-gegevens beschikbaar</string>
|
||||||
<string name="nav_logsettings">Log instellingen</string>
|
<string name="nav_logsettings">Log instellingen</string>
|
||||||
<string name="resettodefaults">Terug naar standaardinstellingen</string>
|
<string name="resettodefaults">Terug naar standaardinstellingen</string>
|
||||||
|
|
|
@ -1026,7 +1026,7 @@
|
||||||
<string name="send_all_logs">Trimite un email cu loguri</string>
|
<string name="send_all_logs">Trimite un email cu loguri</string>
|
||||||
<string name="delete_logs">Șterge logurile</string>
|
<string name="delete_logs">Șterge logurile</string>
|
||||||
<string name="error_adding_treatment_message">Un tratament (insulină: %1$.2f, carbohidrați: %2$d, la: %3$s) nu a putut fi înregistrat. Reverificați și apoi adăugați manual înregistrarea corectă.</string>
|
<string name="error_adding_treatment_message">Un tratament (insulină: %1$.2f, carbohidrați: %2$d, la: %3$s) nu a putut fi înregistrat. Reverificați și apoi adăugați manual înregistrarea corectă.</string>
|
||||||
<string name="generated_ecarbs_note">eCarbohidrați: %1$d g (%2$d o), start: %3$d m</string>
|
<string name="generated_ecarbs_note">eCarbohidrați: %1$d g (%2$d h), întârziere: %3$d m</string>
|
||||||
<string name="openaps_noasdata">Nu există date disponibile privind autosens</string>
|
<string name="openaps_noasdata">Nu există date disponibile privind autosens</string>
|
||||||
<string name="nav_logsettings">Setări loguri</string>
|
<string name="nav_logsettings">Setări loguri</string>
|
||||||
<string name="resettodefaults">Resetare la setările implicite</string>
|
<string name="resettodefaults">Resetare la setările implicite</string>
|
||||||
|
|
|
@ -1028,7 +1028,7 @@ Context | Edit Context</string>
|
||||||
<string name="send_all_logs">Отправить журналы (логи) по email</string>
|
<string name="send_all_logs">Отправить журналы (логи) по email</string>
|
||||||
<string name="delete_logs">Удалить записи журнала</string>
|
<string name="delete_logs">Удалить записи журнала</string>
|
||||||
<string name="error_adding_treatment_message">Назначение (инсулин: %1$.2f, углеводы: %2$d, в: %3$s) не было добавлено. Пожалуйста, проверьте и при необходимости добавьте запись вручную.</string>
|
<string name="error_adding_treatment_message">Назначение (инсулин: %1$.2f, углеводы: %2$d, в: %3$s) не было добавлено. Пожалуйста, проверьте и при необходимости добавьте запись вручную.</string>
|
||||||
<string name="generated_ecarbs_note">eCarbs: %1$d г. (%2$d h), начало: %3$d m</string>
|
<string name="generated_ecarbs_note">eCarbs: %1$d г. (%2$d h), задержка: %3$d m</string>
|
||||||
<string name="openaps_noasdata">Данные autosens недоступны</string>
|
<string name="openaps_noasdata">Данные autosens недоступны</string>
|
||||||
<string name="nav_logsettings">Настройки журнала</string>
|
<string name="nav_logsettings">Настройки журнала</string>
|
||||||
<string name="resettodefaults">Восстановить значения по умолчанию</string>
|
<string name="resettodefaults">Восстановить значения по умолчанию</string>
|
||||||
|
|
|
@ -1024,7 +1024,6 @@
|
||||||
<string name="send_all_logs">Zasielať logy E-mailom</string>
|
<string name="send_all_logs">Zasielať logy E-mailom</string>
|
||||||
<string name="delete_logs">Vymazať logy</string>
|
<string name="delete_logs">Vymazať logy</string>
|
||||||
<string name="error_adding_treatment_message">Ošetrenie (inzulín: %1$.2f, sacharidy: %2$d, čas: %3$s) nie je možné pridať. Skontrolujte a podľa potreby manuálne pridajte záznam.</string>
|
<string name="error_adding_treatment_message">Ošetrenie (inzulín: %1$.2f, sacharidy: %2$d, čas: %3$s) nie je možné pridať. Skontrolujte a podľa potreby manuálne pridajte záznam.</string>
|
||||||
<string name="generated_ecarbs_note">eCarbs: %1$d g (%2$d h), Štart: %3$d m</string>
|
|
||||||
<string name="openaps_noasdata">Nedostupné dáta o glykémiách</string>
|
<string name="openaps_noasdata">Nedostupné dáta o glykémiách</string>
|
||||||
<string name="nav_logsettings">Nastavenie logovania</string>
|
<string name="nav_logsettings">Nastavenie logovania</string>
|
||||||
<string name="resettodefaults">Obnoviť predvolené</string>
|
<string name="resettodefaults">Obnoviť predvolené</string>
|
||||||
|
|
|
@ -684,7 +684,7 @@
|
||||||
<string name="shortprotein">Pr</string>
|
<string name="shortprotein">Pr</string>
|
||||||
<string name="shortfat">Fett</string>
|
<string name="shortfat">Fett</string>
|
||||||
<string name="active"><![CDATA[<Aktiv>]]></string>
|
<string name="active"><![CDATA[<Aktiv>]]></string>
|
||||||
<string name="waitingforestimatedbolusend">Väntar på att bolus ska slutföras (%1$d sek).</string>
|
<string name="waitingforestimatedbolusend">Slutför bolus (%1$d sek)</string>
|
||||||
<string name="processinghistory">Behandlar</string>
|
<string name="processinghistory">Behandlar</string>
|
||||||
<string name="startingbolus">Påbörjar bolus</string>
|
<string name="startingbolus">Påbörjar bolus</string>
|
||||||
<string name="executingrightnow">Kommando körs just nu</string>
|
<string name="executingrightnow">Kommando körs just nu</string>
|
||||||
|
@ -712,6 +712,8 @@
|
||||||
<string name="dexcomg5_xdripupload_title">Skicka BG-data till xDrip+</string>
|
<string name="dexcomg5_xdripupload_title">Skicka BG-data till xDrip+</string>
|
||||||
<string name="dexcomg5_xdripupload_summary">Välj \"640G/Eversense\" som datakälla i xDrip+</string>
|
<string name="dexcomg5_xdripupload_summary">Välj \"640G/Eversense\" som datakälla i xDrip+</string>
|
||||||
<string name="nsclientbg">NSClient BG</string>
|
<string name="nsclientbg">NSClient BG</string>
|
||||||
|
<string name="minimalbasalvaluereplaced">Basalvärdet ersatt med det lägsta tillåtna: %s</string>
|
||||||
|
<string name="maximumbasalvaluereplaced">Basalvärdet ersatt med det maximala tillåtna: %s</string>
|
||||||
<string name="overview_editquickwizard_usebg">Använd BG</string>
|
<string name="overview_editquickwizard_usebg">Använd BG</string>
|
||||||
<string name="overview_editquickwizard_usebolusiob">Använd bolus-IOB</string>
|
<string name="overview_editquickwizard_usebolusiob">Använd bolus-IOB</string>
|
||||||
<string name="overview_editquickwizard_usebasaliob">Använd basal-IOB</string>
|
<string name="overview_editquickwizard_usebasaliob">Använd basal-IOB</string>
|
||||||
|
@ -1024,7 +1026,7 @@
|
||||||
<string name="send_all_logs">Skicka loggar per e-post</string>
|
<string name="send_all_logs">Skicka loggar per e-post</string>
|
||||||
<string name="delete_logs">Radera loggar</string>
|
<string name="delete_logs">Radera loggar</string>
|
||||||
<string name="error_adding_treatment_message">En behandling (insulin: %1$.2f, kolhydrater: %2$d, tid: %3$s) kunde inte läggas till listan i Behandlingar. Vänligen kontrollera och lägg till en post manuellt vid behov.</string>
|
<string name="error_adding_treatment_message">En behandling (insulin: %1$.2f, kolhydrater: %2$d, tid: %3$s) kunde inte läggas till listan i Behandlingar. Vänligen kontrollera och lägg till en post manuellt vid behov.</string>
|
||||||
<string name="generated_ecarbs_note">eCarbs: %1$d g fördelat över %2$d tim, förskjutet %3$d m</string>
|
<string name="generated_ecarbs_note">eCarbs: %1$d g (%2$d h), fördröjd i %3$d m</string>
|
||||||
<string name="openaps_noasdata">Ingen data tillgänglig för autosens</string>
|
<string name="openaps_noasdata">Ingen data tillgänglig för autosens</string>
|
||||||
<string name="nav_logsettings">Loggningsinställningar</string>
|
<string name="nav_logsettings">Loggningsinställningar</string>
|
||||||
<string name="resettodefaults">Återställ standardinställningar</string>
|
<string name="resettodefaults">Återställ standardinställningar</string>
|
||||||
|
|
|
@ -1174,7 +1174,7 @@
|
||||||
<string name="delete_logs">Delete Logs</string>
|
<string name="delete_logs">Delete Logs</string>
|
||||||
|
|
||||||
<string name="error_adding_treatment_message">A treatment (insulin: %1$.2f, carbs: %2$d, at: %3$s) could not be added to treatments. Please check and manually add a record as appropriate.</string>
|
<string name="error_adding_treatment_message">A treatment (insulin: %1$.2f, carbs: %2$d, at: %3$s) could not be added to treatments. Please check and manually add a record as appropriate.</string>
|
||||||
<string name="generated_ecarbs_note">eCarbs: %1$d g (%2$d h), start: %3$d m</string>
|
<string name="generated_ecarbs_note">eCarbs: %1$d g (%2$d h), delay: %3$d m</string>
|
||||||
<string name="key_plugin_stats_report_timestamp" translatable="false">key_plugin_stats_report_timestamp</string>
|
<string name="key_plugin_stats_report_timestamp" translatable="false">key_plugin_stats_report_timestamp</string>
|
||||||
<string name="openaps_noasdata">No autosens data available</string>
|
<string name="openaps_noasdata">No autosens data available</string>
|
||||||
<string name="nav_logsettings">Log settings</string>
|
<string name="nav_logsettings">Log settings</string>
|
||||||
|
@ -1183,6 +1183,8 @@
|
||||||
<string name="as">AS</string>
|
<string name="as">AS</string>
|
||||||
<string name="versionavailable">Version %1$s available</string>
|
<string name="versionavailable">Version %1$s available</string>
|
||||||
<string name="time_offset">Time offset</string>
|
<string name="time_offset">Time offset</string>
|
||||||
|
<string name="key_aps_mode" translatable="false">aps_mode</string>
|
||||||
|
<string name="setupwizard_preferred_aps_mode">Preferred APS mode</string>
|
||||||
|
|
||||||
<plurals name="objective_days">
|
<plurals name="objective_days">
|
||||||
<item quantity="one">%1$d day</item>
|
<item quantity="one">%1$d day</item>
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
<ListPreference
|
<ListPreference
|
||||||
android:title="@string/apsmode_title"
|
android:title="@string/apsmode_title"
|
||||||
android:key="aps_mode"
|
android:key="@string/key_aps_mode"
|
||||||
android:defaultValue="open"
|
android:defaultValue="open"
|
||||||
android:entries="@array/aps_modeArray"
|
android:entries="@array/aps_modeArray"
|
||||||
android:entryValues="@array/aps_modeValues"/>
|
android:entryValues="@array/aps_modeValues"/>
|
||||||
|
|
|
@ -2,6 +2,7 @@ package info;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.content.res.Resources;
|
||||||
|
|
||||||
import com.squareup.otto.Bus;
|
import com.squareup.otto.Bus;
|
||||||
|
|
||||||
|
@ -9,6 +10,7 @@ import org.json.JSONException;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.powermock.api.mockito.PowerMockito;
|
import org.powermock.api.mockito.PowerMockito;
|
||||||
|
import org.powermock.modules.junit4.PowerMockRunner;
|
||||||
|
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
|
@ -19,16 +21,22 @@ import info.nightscout.androidaps.data.ConstraintChecker;
|
||||||
import info.nightscout.androidaps.data.Profile;
|
import info.nightscout.androidaps.data.Profile;
|
||||||
import info.nightscout.androidaps.data.ProfileStore;
|
import info.nightscout.androidaps.data.ProfileStore;
|
||||||
import info.nightscout.androidaps.db.DatabaseHelper;
|
import info.nightscout.androidaps.db.DatabaseHelper;
|
||||||
|
import info.nightscout.androidaps.interfaces.Constraint;
|
||||||
import info.nightscout.androidaps.logging.L;
|
import info.nightscout.androidaps.logging.L;
|
||||||
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
|
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
|
||||||
|
import info.nightscout.androidaps.plugins.NSClientInternal.NSUpload;
|
||||||
|
import info.nightscout.androidaps.plugins.NSClientInternal.data.DbLogger;
|
||||||
import info.nightscout.androidaps.plugins.Treatments.TreatmentService;
|
import info.nightscout.androidaps.plugins.Treatments.TreatmentService;
|
||||||
|
import info.nightscout.androidaps.plugins.Treatments.TreatmentsPlugin;
|
||||||
import info.nightscout.androidaps.queue.CommandQueue;
|
import info.nightscout.androidaps.queue.CommandQueue;
|
||||||
import info.nightscout.utils.SP;
|
import info.nightscout.utils.SP;
|
||||||
|
|
||||||
import static org.mockito.ArgumentMatchers.any;
|
import static org.mockito.ArgumentMatchers.any;
|
||||||
import static org.mockito.ArgumentMatchers.anyBoolean;
|
import static org.mockito.ArgumentMatchers.anyBoolean;
|
||||||
|
import static org.mockito.ArgumentMatchers.anyDouble;
|
||||||
import static org.mockito.ArgumentMatchers.anyInt;
|
import static org.mockito.ArgumentMatchers.anyInt;
|
||||||
import static org.mockito.ArgumentMatchers.anyLong;
|
import static org.mockito.ArgumentMatchers.anyLong;
|
||||||
|
import static org.mockito.ArgumentMatchers.anyString;
|
||||||
import static org.mockito.Mockito.mock;
|
import static org.mockito.Mockito.mock;
|
||||||
import static org.mockito.Mockito.when;
|
import static org.mockito.Mockito.when;
|
||||||
|
|
||||||
|
@ -93,6 +101,7 @@ public class AAPSMocker {
|
||||||
when(MainApp.gs(R.string.hoursago)).thenReturn("%.1fh ago");
|
when(MainApp.gs(R.string.hoursago)).thenReturn("%.1fh ago");
|
||||||
when(MainApp.gs(R.string.careportal_profileswitch)).thenReturn("Profile Switch");
|
when(MainApp.gs(R.string.careportal_profileswitch)).thenReturn("Profile Switch");
|
||||||
when(MainApp.gs(R.string.configbuilder_insulin)).thenReturn("Insulin");
|
when(MainApp.gs(R.string.configbuilder_insulin)).thenReturn("Insulin");
|
||||||
|
when(MainApp.gs(R.string.bolusdelivering)).thenReturn("Delivering 0.0U");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static MainApp mockMainApp() {
|
public static MainApp mockMainApp() {
|
||||||
|
@ -130,6 +139,10 @@ public class AAPSMocker {
|
||||||
when(L.isEnabled(any())).thenReturn(true);
|
when(L.isEnabled(any())).thenReturn(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void mockNSUpload(){
|
||||||
|
PowerMockito.mockStatic(NSUpload.class);
|
||||||
|
}
|
||||||
|
|
||||||
public static void mockApplicationContext() {
|
public static void mockApplicationContext() {
|
||||||
Context context = mock(Context.class);
|
Context context = mock(Context.class);
|
||||||
when(MainApp.instance().getApplicationContext()).thenReturn(context);
|
when(MainApp.instance().getApplicationContext()).thenReturn(context);
|
||||||
|
@ -147,7 +160,9 @@ public class AAPSMocker {
|
||||||
|
|
||||||
public static void mockTreatmentService() throws Exception {
|
public static void mockTreatmentService() throws Exception {
|
||||||
TreatmentService treatmentService = PowerMockito.mock(TreatmentService.class);
|
TreatmentService treatmentService = PowerMockito.mock(TreatmentService.class);
|
||||||
|
TreatmentsPlugin treatmentsPlugin = PowerMockito.mock(TreatmentsPlugin.class);
|
||||||
PowerMockito.whenNew(TreatmentService.class).withNoArguments().thenReturn(treatmentService);
|
PowerMockito.whenNew(TreatmentService.class).withNoArguments().thenReturn(treatmentService);
|
||||||
|
when(TreatmentsPlugin.getPlugin()).thenReturn(treatmentsPlugin);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Profile getValidProfile() {
|
public static Profile getValidProfile() {
|
||||||
|
|
|
@ -75,7 +75,7 @@ public class ConstraintsCheckerTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void isClosedLoopAllowedTest() throws Exception {
|
public void isClosedLoopAllowedTest() throws Exception {
|
||||||
when(SP.getString("aps_mode", "open")).thenReturn("closed");
|
when(SP.getString(R.string.key_aps_mode, "open")).thenReturn("closed");
|
||||||
objectivesPlugin.objectives.get(3).setStartedOn(null);
|
objectivesPlugin.objectives.get(3).setStartedOn(null);
|
||||||
|
|
||||||
Constraint<Boolean> c = constraintChecker.isClosedLoopAllowed();
|
Constraint<Boolean> c = constraintChecker.isClosedLoopAllowed();
|
||||||
|
@ -83,7 +83,7 @@ public class ConstraintsCheckerTest {
|
||||||
Assert.assertEquals(true, c.getMostLimitedReasonList().size() == 2); // Safety & Objectives
|
Assert.assertEquals(true, c.getMostLimitedReasonList().size() == 2); // Safety & Objectives
|
||||||
Assert.assertEquals(Boolean.FALSE, c.value());
|
Assert.assertEquals(Boolean.FALSE, c.value());
|
||||||
|
|
||||||
when(SP.getString("aps_mode", "open")).thenReturn("open");
|
when(SP.getString(R.string.key_aps_mode, "open")).thenReturn("open");
|
||||||
c = constraintChecker.isClosedLoopAllowed();
|
c = constraintChecker.isClosedLoopAllowed();
|
||||||
Assert.assertEquals(true, c.getReasonList().size() == 3); // 2x Safety & Objectives
|
Assert.assertEquals(true, c.getReasonList().size() == 3); // 2x Safety & Objectives
|
||||||
Assert.assertEquals(true, c.getMostLimitedReasonList().size() == 3); // 2x Safety & Objectives
|
Assert.assertEquals(true, c.getMostLimitedReasonList().size() == 3); // 2x Safety & Objectives
|
||||||
|
|
|
@ -58,14 +58,6 @@ public class NewNSTreatmentDialogTest {
|
||||||
Assert.assertEquals(AAPSMocker.TESTPROFILENAME, profileSwitchUpload.profileName);
|
Assert.assertEquals(AAPSMocker.TESTPROFILENAME, profileSwitchUpload.profileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
public void doProfileSwitch() {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void doProfileSwitch1() {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void prepareMock() throws Exception {
|
public void prepareMock() throws Exception {
|
||||||
AAPSMocker.mockMainApp();
|
AAPSMocker.mockMainApp();
|
||||||
|
|
|
@ -47,8 +47,8 @@ public class SafetyPluginTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void disabledEngineeringModeShouldLimitClosedLoop() throws Exception {
|
public void disabledEngineeringModeShouldLimitClosedLoop() {
|
||||||
when(SP.getString("aps_mode", "open")).thenReturn("closed");
|
when(SP.getString(R.string.key_aps_mode, "open")).thenReturn("closed");
|
||||||
when(MainApp.isEngineeringModeOrRelease()).thenReturn(false);
|
when(MainApp.isEngineeringModeOrRelease()).thenReturn(false);
|
||||||
|
|
||||||
Constraint<Boolean> c = new Constraint<>(true);
|
Constraint<Boolean> c = new Constraint<>(true);
|
||||||
|
@ -58,8 +58,8 @@ public class SafetyPluginTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void setOpenLoopInPreferencesShouldLimitClosedLoop() throws Exception {
|
public void setOpenLoopInPreferencesShouldLimitClosedLoop() {
|
||||||
when(SP.getString("aps_mode", "open")).thenReturn("open");
|
when(SP.getString(R.string.key_aps_mode, "open")).thenReturn("open");
|
||||||
|
|
||||||
Constraint<Boolean> c = new Constraint<>(true);
|
Constraint<Boolean> c = new Constraint<>(true);
|
||||||
c = safetyPlugin.isClosedLoopAllowed(c);
|
c = safetyPlugin.isClosedLoopAllowed(c);
|
||||||
|
|
|
@ -0,0 +1,36 @@
|
||||||
|
package info.nightscout.androidaps.plugins.PumpDanaRS.comm;
|
||||||
|
|
||||||
|
|
||||||
|
import com.cozmo.danar.util.BleCommandUtil;
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
import org.powermock.core.classloader.annotations.PrepareForTest;
|
||||||
|
import org.powermock.modules.junit4.PowerMockRunner;
|
||||||
|
|
||||||
|
import info.AAPSMocker;
|
||||||
|
import info.nightscout.androidaps.MainApp;
|
||||||
|
import info.nightscout.androidaps.logging.L;
|
||||||
|
import info.nightscout.utils.SP;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertEquals;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Rumen Georgiev on 8/9/2018.
|
||||||
|
*/
|
||||||
|
@RunWith(PowerMockRunner.class)
|
||||||
|
@PrepareForTest({MainApp.class, SP.class, L.class, DanaRSMessageHashTable.class})
|
||||||
|
public class DanaRSMessageHashTableTest {
|
||||||
|
@Test
|
||||||
|
public void runTest() {
|
||||||
|
AAPSMocker.mockMainApp();
|
||||||
|
AAPSMocker.mockApplicationContext();
|
||||||
|
AAPSMocker.mockSP();
|
||||||
|
AAPSMocker.mockL();
|
||||||
|
// HashMap<Integer, DanaRS_Packet> messages = new DanaRSMessageHashTable().messages;
|
||||||
|
DanaRS_Packet forTesting = new DanaRS_Packet_APS_Set_Event_History();
|
||||||
|
DanaRS_Packet testPacket = DanaRSMessageHashTable.findMessage(forTesting.getCommand());
|
||||||
|
assertEquals(BleCommandUtil.DANAR_PACKET__OPCODE__APS_SET_EVENT_HISTORY, testPacket.getOpCode());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -12,7 +12,6 @@ import info.nightscout.androidaps.logging.L;
|
||||||
import info.nightscout.utils.SP;
|
import info.nightscout.utils.SP;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
import static org.mockito.Mockito.when;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by mike on 20.11.2017.
|
* Created by mike on 20.11.2017.
|
||||||
|
|
|
@ -0,0 +1,98 @@
|
||||||
|
package info.nightscout.androidaps.plugins.PumpDanaRS.comm;
|
||||||
|
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
import org.powermock.api.mockito.PowerMockito;
|
||||||
|
import org.powermock.core.classloader.annotations.PrepareForTest;
|
||||||
|
import org.powermock.modules.junit4.PowerMockRunner;
|
||||||
|
|
||||||
|
import java.util.Calendar;
|
||||||
|
import java.util.GregorianCalendar;
|
||||||
|
|
||||||
|
import info.AAPSMocker;
|
||||||
|
import info.SPMocker;
|
||||||
|
import info.nightscout.androidaps.MainApp;
|
||||||
|
import info.nightscout.androidaps.db.DatabaseHelper;
|
||||||
|
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
|
||||||
|
import info.nightscout.androidaps.plugins.NSClientInternal.NSUpload;
|
||||||
|
import info.nightscout.androidaps.plugins.Treatments.TreatmentService;
|
||||||
|
import info.nightscout.androidaps.plugins.Treatments.TreatmentsPlugin;
|
||||||
|
import info.nightscout.utils.SP;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertEquals;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Rumen on 31.07.2018.
|
||||||
|
*/
|
||||||
|
|
||||||
|
@RunWith(PowerMockRunner.class)
|
||||||
|
@PrepareForTest({SP.class, MainApp.class, ConfigBuilderPlugin.class, Context.class, NSUpload.class, TreatmentsPlugin.class, TreatmentService.class, DatabaseHelper.class})
|
||||||
|
public class DanaRS_Packet_APS_History_EventsTest extends DanaRS_Packet_APS_History_Events {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void runTest() {
|
||||||
|
AAPSMocker.mockMainApp();
|
||||||
|
AAPSMocker.mockApplicationContext();
|
||||||
|
AAPSMocker.mockSP();
|
||||||
|
AAPSMocker.mockBus();
|
||||||
|
SPMocker.prepareMock();
|
||||||
|
SP.putString("profile", AAPSMocker.getValidProfileStore().getData().toString());
|
||||||
|
AAPSMocker.mockConfigBuilder();
|
||||||
|
AAPSMocker.mockStrings();
|
||||||
|
PowerMockito.mockStatic(NSUpload.class);
|
||||||
|
AAPSMocker.mockDatabaseHelper();
|
||||||
|
DanaRS_Packet_APS_History_Events testPacket = new DanaRS_Packet_APS_History_Events(System.currentTimeMillis());
|
||||||
|
// test getRequestedParams
|
||||||
|
byte[] returnedValues = testPacket.getRequestParams();
|
||||||
|
byte[] expectedValues = getCalender(System.currentTimeMillis());
|
||||||
|
//year
|
||||||
|
assertEquals(expectedValues[0], returnedValues[0]);
|
||||||
|
//month
|
||||||
|
assertEquals(expectedValues[1], returnedValues[1]);
|
||||||
|
//day of month
|
||||||
|
assertEquals(expectedValues[2], returnedValues[2]);
|
||||||
|
// hour
|
||||||
|
assertEquals(expectedValues[3], returnedValues[3]);
|
||||||
|
// minute
|
||||||
|
assertEquals(expectedValues[4], returnedValues[4]);
|
||||||
|
// second
|
||||||
|
assertEquals(expectedValues[5], returnedValues[5]);
|
||||||
|
|
||||||
|
// test message decoding
|
||||||
|
testPacket.handleMessage(createArray(50, (byte) 0));
|
||||||
|
assertEquals(false, failed);
|
||||||
|
// testPacket.handleMessage(createArray(50, (byte) 1));
|
||||||
|
// assertEquals(true, done);
|
||||||
|
|
||||||
|
assertEquals("APS_HISTORY_EVENTS", getFriendlyName());
|
||||||
|
}
|
||||||
|
|
||||||
|
byte[] createArray(int length, byte fillWith){
|
||||||
|
byte[] ret = new byte[length];
|
||||||
|
for(int i = 0; i<length; i++){
|
||||||
|
ret[i] = fillWith;
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
public byte[] getCalender(long from){
|
||||||
|
GregorianCalendar cal = new GregorianCalendar();
|
||||||
|
if (from != 0)
|
||||||
|
cal.setTimeInMillis(from);
|
||||||
|
else
|
||||||
|
cal.set(2000, 0, 1, 0, 0, 0);
|
||||||
|
byte[] ret = new byte[6];
|
||||||
|
ret[0] = (byte) ((cal.get(Calendar.YEAR) - 1900 - 100) & 0xff);
|
||||||
|
ret[1] = (byte) ((cal.get(Calendar.MONTH) + 1) & 0xff);
|
||||||
|
ret[2] = (byte) ((cal.get(Calendar.DAY_OF_MONTH)) & 0xff);
|
||||||
|
ret[3] = (byte) ((cal.get(Calendar.HOUR_OF_DAY)) & 0xff);
|
||||||
|
ret[4] = (byte) ((cal.get(Calendar.MINUTE)) & 0xff);
|
||||||
|
ret[5] = (byte) ((cal.get(Calendar.SECOND)) & 0xff);
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,63 @@
|
||||||
|
package info.nightscout.androidaps.plugins.PumpDanaRS.comm;
|
||||||
|
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
import org.powermock.core.classloader.annotations.PrepareForTest;
|
||||||
|
import org.powermock.modules.junit4.PowerMockRunner;
|
||||||
|
|
||||||
|
import info.AAPSMocker;
|
||||||
|
import info.nightscout.androidaps.MainApp;
|
||||||
|
import info.nightscout.androidaps.logging.L;
|
||||||
|
import info.nightscout.androidaps.plugins.PumpDanaR.DanaRPump;
|
||||||
|
import info.nightscout.utils.SP;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertEquals;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Rumen on 31.07.2018.
|
||||||
|
*/
|
||||||
|
|
||||||
|
@RunWith(PowerMockRunner.class)
|
||||||
|
@PrepareForTest({MainApp.class, SP.class, L.class})
|
||||||
|
public class DanaRS_Packet_APS_Set_Event_HistoryTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void runTest() {
|
||||||
|
AAPSMocker.mockMainApp();
|
||||||
|
AAPSMocker.mockApplicationContext();
|
||||||
|
AAPSMocker.mockSP();
|
||||||
|
AAPSMocker.mockL();
|
||||||
|
|
||||||
|
// test for negative carbs
|
||||||
|
DanaRS_Packet_APS_Set_Event_History historyTest = new DanaRS_Packet_APS_Set_Event_History(DanaRPump.CARBS, System.currentTimeMillis(), -1, 0);
|
||||||
|
byte[] testparams = historyTest.getRequestParams();
|
||||||
|
assertEquals((byte) 0, testparams[8]);
|
||||||
|
// 5g carbs
|
||||||
|
historyTest = new DanaRS_Packet_APS_Set_Event_History(DanaRPump.CARBS, System.currentTimeMillis(), 5, 0);
|
||||||
|
testparams = historyTest.getRequestParams();
|
||||||
|
assertEquals((byte) 5, testparams[8]);
|
||||||
|
// 150g carbs
|
||||||
|
historyTest = new DanaRS_Packet_APS_Set_Event_History(DanaRPump.CARBS, System.currentTimeMillis(), 150, 0);
|
||||||
|
testparams = historyTest.getRequestParams();
|
||||||
|
assertEquals((byte) 150, testparams[8]);
|
||||||
|
// test low hard limit
|
||||||
|
// test high hard limit
|
||||||
|
|
||||||
|
// test message generation
|
||||||
|
historyTest = new DanaRS_Packet_APS_Set_Event_History(DanaRPump.CARBS, System.currentTimeMillis(), 5, 0);
|
||||||
|
testparams = historyTest.getRequestParams();
|
||||||
|
assertEquals((byte) 5, testparams[8]);
|
||||||
|
assertEquals(11 , testparams.length);
|
||||||
|
assertEquals((byte)DanaRPump.CARBS, testparams[0]);
|
||||||
|
|
||||||
|
// test message decoding
|
||||||
|
historyTest.handleMessage(new byte[]{(byte) 0, (byte) 0, (byte) 0});
|
||||||
|
assertEquals(false, historyTest.failed);
|
||||||
|
historyTest.handleMessage(new byte[]{(byte) 0, (byte) 0, (byte) 1});
|
||||||
|
assertEquals(true, historyTest.failed);
|
||||||
|
|
||||||
|
assertEquals("APS_SET_EVENT_HISTORY", historyTest.getFriendlyName());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,51 @@
|
||||||
|
package info.nightscout.androidaps.plugins.PumpDanaRS.comm;
|
||||||
|
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
import org.powermock.core.classloader.annotations.PrepareForTest;
|
||||||
|
import org.powermock.modules.junit4.PowerMockRunner;
|
||||||
|
|
||||||
|
import info.AAPSMocker;
|
||||||
|
import info.nightscout.androidaps.MainApp;
|
||||||
|
import info.nightscout.androidaps.logging.L;
|
||||||
|
import info.nightscout.utils.SP;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertEquals;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Rumen on 01.08.2018
|
||||||
|
*/
|
||||||
|
|
||||||
|
@RunWith(PowerMockRunner.class)
|
||||||
|
@PrepareForTest({MainApp.class, SP.class, L.class})
|
||||||
|
public class DanaRS_Packet_Basal_Get_Basal_RateTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void runTest() {
|
||||||
|
AAPSMocker.mockMainApp();
|
||||||
|
AAPSMocker.mockApplicationContext();
|
||||||
|
AAPSMocker.mockSP();
|
||||||
|
AAPSMocker.mockBus();
|
||||||
|
AAPSMocker.mockL();
|
||||||
|
|
||||||
|
DanaRS_Packet_Basal_Get_Basal_Rate packet = new DanaRS_Packet_Basal_Get_Basal_Rate();
|
||||||
|
|
||||||
|
// test message decoding
|
||||||
|
// rate is 0.01
|
||||||
|
packet.handleMessage(createArray(100, (byte) 1));
|
||||||
|
assertEquals(false, packet.failed);
|
||||||
|
packet.handleMessage(createArray(100, (byte) 5));
|
||||||
|
assertEquals(true, packet.failed);
|
||||||
|
|
||||||
|
assertEquals("BASAL__GET_BASAL_RATE", packet.getFriendlyName());
|
||||||
|
}
|
||||||
|
|
||||||
|
byte[] createArray(int length, byte fillWith){
|
||||||
|
byte[] ret = new byte[length];
|
||||||
|
for(int i = 0; i<length; i++){
|
||||||
|
ret[i] = fillWith;
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,63 @@
|
||||||
|
package info.nightscout.androidaps.plugins.PumpDanaRS.comm;
|
||||||
|
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
import org.powermock.core.classloader.annotations.PrepareForTest;
|
||||||
|
import org.powermock.modules.junit4.PowerMockRunner;
|
||||||
|
|
||||||
|
import info.AAPSMocker;
|
||||||
|
import info.nightscout.androidaps.MainApp;
|
||||||
|
import info.nightscout.androidaps.logging.L;
|
||||||
|
import info.nightscout.utils.SP;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertEquals;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Rumen on 31.07.2018.
|
||||||
|
*/
|
||||||
|
|
||||||
|
@RunWith(PowerMockRunner.class)
|
||||||
|
@PrepareForTest({MainApp.class, SP.class, L.class})
|
||||||
|
public class DanaRS_Packet_Basal_Get_Profile_Basal_RateTest extends DanaRS_Packet_Basal_Get_Profile_Basal_Rate {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void runTest() {
|
||||||
|
AAPSMocker.mockMainApp();
|
||||||
|
AAPSMocker.mockApplicationContext();
|
||||||
|
AAPSMocker.mockSP();
|
||||||
|
AAPSMocker.mockBus();
|
||||||
|
AAPSMocker.mockL();
|
||||||
|
|
||||||
|
// test if pumpRofile array is set right
|
||||||
|
double basal01 = byteArrayToInt(getBytes(createArray(50, (byte) 1), 2, 2)) / 100d;
|
||||||
|
double basal05 = byteArrayToInt(getBytes(createArray(50, (byte) 5), 2, 2)) / 100d;
|
||||||
|
double basal12 = byteArrayToInt(getBytes(createArray(50, (byte) 12), 2, 2)) / 100d;
|
||||||
|
// basal rate > 1U/hr
|
||||||
|
double basal120 = byteArrayToInt(getBytes(createArray(50, (byte) 120), 2, 2)) / 100d;
|
||||||
|
DanaRS_Packet_Basal_Get_Profile_Basal_Rate testPacket = new DanaRS_Packet_Basal_Get_Profile_Basal_Rate(1);
|
||||||
|
byte[] params = testPacket.getRequestParams();
|
||||||
|
assertEquals((byte) 1, params[0]);
|
||||||
|
testPacket.handleMessage(createArray(50, (byte) 0));
|
||||||
|
assertEquals(0.0d, testPacket.pump.pumpProfiles[1][1],0);
|
||||||
|
testPacket.handleMessage(createArray(50, (byte) 1));
|
||||||
|
assertEquals(basal01, testPacket.pump.pumpProfiles[1][2],0);
|
||||||
|
testPacket.handleMessage(createArray(50, (byte) 5));
|
||||||
|
assertEquals(basal05, testPacket.pump.pumpProfiles[1][1],0);
|
||||||
|
testPacket.handleMessage(createArray(50, (byte) 12));
|
||||||
|
assertEquals(basal12, testPacket.pump.pumpProfiles[1][1],0);
|
||||||
|
testPacket.handleMessage(createArray(50, (byte) 120));
|
||||||
|
assertEquals(basal120, testPacket.pump.pumpProfiles[1][1],0);
|
||||||
|
|
||||||
|
assertEquals("BASAL__GET_PROFILE_BASAL_RATE", getFriendlyName());
|
||||||
|
}
|
||||||
|
|
||||||
|
byte[] createArray(int length, byte fillWith){
|
||||||
|
byte[] ret = new byte[length];
|
||||||
|
for(int i = 0; i<length; i++){
|
||||||
|
ret[i] = fillWith;
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,41 @@
|
||||||
|
package info.nightscout.androidaps.plugins.PumpDanaRS.comm;
|
||||||
|
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
import org.powermock.core.classloader.annotations.PrepareForTest;
|
||||||
|
import org.powermock.modules.junit4.PowerMockRunner;
|
||||||
|
|
||||||
|
import info.AAPSMocker;
|
||||||
|
import info.nightscout.androidaps.MainApp;
|
||||||
|
import info.nightscout.androidaps.logging.L;
|
||||||
|
import info.nightscout.utils.SP;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertEquals;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Rumen on 01.08.2018.
|
||||||
|
*/
|
||||||
|
|
||||||
|
@RunWith(PowerMockRunner.class)
|
||||||
|
@PrepareForTest({MainApp.class, SP.class, L.class})
|
||||||
|
public class DanaRS_Packet_Basal_Get_Profile_NumberTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void runTest() {
|
||||||
|
AAPSMocker.mockMainApp();
|
||||||
|
AAPSMocker.mockApplicationContext();
|
||||||
|
AAPSMocker.mockSP();
|
||||||
|
AAPSMocker.mockL();
|
||||||
|
|
||||||
|
DanaRS_Packet_Basal_Get_Profile_Number packet = new DanaRS_Packet_Basal_Get_Profile_Number();
|
||||||
|
|
||||||
|
// test message decoding
|
||||||
|
packet.handleMessage(new byte[]{(byte) 0, (byte) 0, (byte) 0});
|
||||||
|
assertEquals(false, packet.failed);
|
||||||
|
// if data.length > 4 should return fail
|
||||||
|
|
||||||
|
assertEquals("BASAL__GET_PROFILE_NUMBER", packet.getFriendlyName());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,49 @@
|
||||||
|
package info.nightscout.androidaps.plugins.PumpDanaRS.comm;
|
||||||
|
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
import org.powermock.core.classloader.annotations.PrepareForTest;
|
||||||
|
import org.powermock.modules.junit4.PowerMockRunner;
|
||||||
|
|
||||||
|
import info.AAPSMocker;
|
||||||
|
import info.nightscout.androidaps.MainApp;
|
||||||
|
import info.nightscout.androidaps.logging.L;
|
||||||
|
import info.nightscout.utils.SP;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertEquals;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Rumen on 01.08.2018.
|
||||||
|
*/
|
||||||
|
|
||||||
|
@RunWith(PowerMockRunner.class)
|
||||||
|
@PrepareForTest({MainApp.class, SP.class, L.class})
|
||||||
|
public class DanaRS_Packet_Basal_Get_Temporary_Basal_StateTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void runTest() {
|
||||||
|
AAPSMocker.mockMainApp();
|
||||||
|
AAPSMocker.mockApplicationContext();
|
||||||
|
AAPSMocker.mockSP();
|
||||||
|
AAPSMocker.mockL();
|
||||||
|
|
||||||
|
DanaRS_Packet_Basal_Get_Temporary_Basal_State packet = new DanaRS_Packet_Basal_Get_Temporary_Basal_State();
|
||||||
|
|
||||||
|
// test message decoding
|
||||||
|
packet.handleMessage(createArray(50,(byte) 0));
|
||||||
|
assertEquals(false, packet.failed);
|
||||||
|
packet.handleMessage(createArray(50,(byte) 1));
|
||||||
|
assertEquals(true, packet.failed);
|
||||||
|
|
||||||
|
assertEquals("BASAL__TEMPORARY_BASAL_STATE", packet.getFriendlyName());
|
||||||
|
}
|
||||||
|
|
||||||
|
byte[] createArray(int length, byte fillWith) {
|
||||||
|
byte[] ret = new byte[length];
|
||||||
|
for (int i = 0; i < length; i++) {
|
||||||
|
ret[i] = fillWith;
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,61 @@
|
||||||
|
package info.nightscout.androidaps.plugins.PumpDanaRS.comm;
|
||||||
|
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
import org.powermock.core.classloader.annotations.PrepareForTest;
|
||||||
|
import org.powermock.modules.junit4.PowerMockRunner;
|
||||||
|
|
||||||
|
import info.AAPSMocker;
|
||||||
|
import info.nightscout.androidaps.MainApp;
|
||||||
|
import info.nightscout.androidaps.logging.L;
|
||||||
|
import info.nightscout.utils.SP;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertEquals;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Rumen on 01.08.2018
|
||||||
|
*/
|
||||||
|
|
||||||
|
@RunWith(PowerMockRunner.class)
|
||||||
|
@PrepareForTest({MainApp.class, SP.class, L.class})
|
||||||
|
public class DanaRS_Packet_Basal_Set_Basal_RateTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void runTest() {
|
||||||
|
AAPSMocker.mockMainApp();
|
||||||
|
AAPSMocker.mockApplicationContext();
|
||||||
|
AAPSMocker.mockSP();
|
||||||
|
AAPSMocker.mockL();
|
||||||
|
|
||||||
|
// test message decoding
|
||||||
|
DanaRS_Packet_Basal_Set_Basal_Rate packet = new DanaRS_Packet_Basal_Set_Basal_Rate(createArray(24, 5));
|
||||||
|
byte[] requested = packet.getRequestParams();
|
||||||
|
byte lookingFor = (byte) ((5 * 100) & 0xff);
|
||||||
|
assertEquals(lookingFor, requested[24]);
|
||||||
|
lookingFor = (byte) ((500 >>> 8) & 0xff);
|
||||||
|
assertEquals(lookingFor, requested[25]);
|
||||||
|
packet.handleMessage(createArray(3, (byte) 0));
|
||||||
|
assertEquals(false, packet.failed);
|
||||||
|
packet.handleMessage(createArray(3, (byte) 1));
|
||||||
|
assertEquals(true, packet.failed);
|
||||||
|
|
||||||
|
assertEquals("BASAL__SET_BASAL_RATE", packet.getFriendlyName());
|
||||||
|
}
|
||||||
|
|
||||||
|
double[] createArray(int length, double fillWith) {
|
||||||
|
double[] ret = new double[length];
|
||||||
|
for (int i = 0; i < length; i++) {
|
||||||
|
ret[i] = fillWith;
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
byte[] createArray(int length, byte fillWith) {
|
||||||
|
byte[] ret = new byte[length];
|
||||||
|
for (int i = 0; i < length; i++) {
|
||||||
|
ret[i] = fillWith;
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,49 @@
|
||||||
|
package info.nightscout.androidaps.plugins.PumpDanaRS.comm;
|
||||||
|
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
import org.powermock.core.classloader.annotations.PrepareForTest;
|
||||||
|
import org.powermock.modules.junit4.PowerMockRunner;
|
||||||
|
|
||||||
|
import info.AAPSMocker;
|
||||||
|
import info.nightscout.androidaps.MainApp;
|
||||||
|
import info.nightscout.androidaps.logging.L;
|
||||||
|
import info.nightscout.utils.SP;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertEquals;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Rumen on 01.08.2018.
|
||||||
|
*/
|
||||||
|
|
||||||
|
@RunWith(PowerMockRunner.class)
|
||||||
|
@PrepareForTest({MainApp.class, SP.class, L.class})
|
||||||
|
public class DanaRS_Packet_Basal_Set_Cancel_Temporary_BasalTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void runTest() {
|
||||||
|
AAPSMocker.mockMainApp();
|
||||||
|
AAPSMocker.mockApplicationContext();
|
||||||
|
AAPSMocker.mockSP();
|
||||||
|
AAPSMocker.mockL();
|
||||||
|
|
||||||
|
DanaRS_Packet_Basal_Set_Cancel_Temporary_Basal packet = new DanaRS_Packet_Basal_Set_Cancel_Temporary_Basal();
|
||||||
|
|
||||||
|
// test message decoding
|
||||||
|
packet.handleMessage(createArray(3,(byte) 0));
|
||||||
|
assertEquals(false, packet.failed);
|
||||||
|
packet.handleMessage(createArray(3,(byte) 1));
|
||||||
|
assertEquals(true, packet.failed);
|
||||||
|
|
||||||
|
assertEquals("BASAL__CANCEL_TEMPORARY_BASAL", packet.getFriendlyName());
|
||||||
|
}
|
||||||
|
|
||||||
|
byte[] createArray(int length, byte fillWith) {
|
||||||
|
byte[] ret = new byte[length];
|
||||||
|
for (int i = 0; i < length; i++) {
|
||||||
|
ret[i] = fillWith;
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,64 @@
|
||||||
|
package info.nightscout.androidaps.plugins.PumpDanaRS.comm;
|
||||||
|
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
import org.powermock.core.classloader.annotations.PrepareForTest;
|
||||||
|
import org.powermock.modules.junit4.PowerMockRunner;
|
||||||
|
|
||||||
|
import info.AAPSMocker;
|
||||||
|
import info.nightscout.androidaps.MainApp;
|
||||||
|
import info.nightscout.androidaps.logging.L;
|
||||||
|
import info.nightscout.utils.SP;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertEquals;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Rumen on 06.08.2018.
|
||||||
|
*/
|
||||||
|
|
||||||
|
@RunWith(PowerMockRunner.class)
|
||||||
|
@PrepareForTest({MainApp.class, SP.class, L.class})
|
||||||
|
public class DanaRS_Packet_Basal_Set_Profile_Basal_RateTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void runTest() {
|
||||||
|
AAPSMocker.mockMainApp();
|
||||||
|
AAPSMocker.mockApplicationContext();
|
||||||
|
AAPSMocker.mockSP();
|
||||||
|
AAPSMocker.mockL();
|
||||||
|
DanaRS_Packet_Basal_Set_Profile_Basal_Rate packet = new DanaRS_Packet_Basal_Set_Profile_Basal_Rate(1, createArray(24,1));
|
||||||
|
|
||||||
|
// test params
|
||||||
|
byte[] testparams =packet.getRequestParams();
|
||||||
|
// is profile 1
|
||||||
|
assertEquals((byte) 1, testparams[0]);
|
||||||
|
// is value 100
|
||||||
|
assertEquals((byte) 100, testparams[3]);
|
||||||
|
|
||||||
|
|
||||||
|
// test message decoding
|
||||||
|
packet.handleMessage(new byte[]{(byte) 0, (byte) 0, (byte) 0});
|
||||||
|
assertEquals(false, packet.failed);
|
||||||
|
packet.handleMessage(new byte[]{(byte) 0, (byte) 0, (byte) 1});
|
||||||
|
assertEquals(true, packet.failed);
|
||||||
|
|
||||||
|
assertEquals("BASAL__SET_PROFILE_BASAL_RATE", packet.getFriendlyName());
|
||||||
|
}
|
||||||
|
|
||||||
|
byte[] createArray(int length, byte fillWith){
|
||||||
|
byte[] ret = new byte[length];
|
||||||
|
for(int i = 0; i<length; i++){
|
||||||
|
ret[i] = fillWith;
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
double[] createArray(int length, double fillWith){
|
||||||
|
double[] ret = new double[length];
|
||||||
|
for(int i = 0; i<length; i++){
|
||||||
|
ret[i] = fillWith;
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,61 @@
|
||||||
|
package info.nightscout.androidaps.plugins.PumpDanaRS.comm;
|
||||||
|
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
import org.powermock.core.classloader.annotations.PrepareForTest;
|
||||||
|
import org.powermock.modules.junit4.PowerMockRunner;
|
||||||
|
|
||||||
|
import info.AAPSMocker;
|
||||||
|
import info.nightscout.androidaps.MainApp;
|
||||||
|
import info.nightscout.androidaps.logging.L;
|
||||||
|
import info.nightscout.utils.SP;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertEquals;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Rumen on 06.08.2018.
|
||||||
|
*/
|
||||||
|
|
||||||
|
@RunWith(PowerMockRunner.class)
|
||||||
|
@PrepareForTest({MainApp.class, SP.class, L.class})
|
||||||
|
public class DanaRS_Packet_Basal_Set_Profile_NumberTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void runTest() {
|
||||||
|
AAPSMocker.mockMainApp();
|
||||||
|
AAPSMocker.mockApplicationContext();
|
||||||
|
AAPSMocker.mockSP();
|
||||||
|
AAPSMocker.mockL();
|
||||||
|
DanaRS_Packet_Basal_Set_Profile_Number packet = new DanaRS_Packet_Basal_Set_Profile_Number(1);
|
||||||
|
|
||||||
|
// test params
|
||||||
|
byte[] testparams = packet.getRequestParams();
|
||||||
|
// is profile 1
|
||||||
|
assertEquals((byte) 1, testparams[0]);
|
||||||
|
|
||||||
|
// test message decoding
|
||||||
|
packet.handleMessage(new byte[]{(byte) 0, (byte) 0, (byte) 0});
|
||||||
|
assertEquals(false, packet.failed);
|
||||||
|
packet.handleMessage(new byte[]{(byte) 0, (byte) 0, (byte) 1});
|
||||||
|
assertEquals(true, packet.failed);
|
||||||
|
|
||||||
|
assertEquals("BASAL__SET_PROFILE_NUMBER", packet.getFriendlyName());
|
||||||
|
}
|
||||||
|
|
||||||
|
byte[] createArray(int length, byte fillWith){
|
||||||
|
byte[] ret = new byte[length];
|
||||||
|
for(int i = 0; i<length; i++){
|
||||||
|
ret[i] = fillWith;
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
double[] createArray(int length, double fillWith){
|
||||||
|
double[] ret = new double[length];
|
||||||
|
for(int i = 0; i<length; i++){
|
||||||
|
ret[i] = fillWith;
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,42 @@
|
||||||
|
package info.nightscout.androidaps.plugins.PumpDanaRS.comm;
|
||||||
|
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
import org.powermock.core.classloader.annotations.PrepareForTest;
|
||||||
|
import org.powermock.modules.junit4.PowerMockRunner;
|
||||||
|
|
||||||
|
import info.AAPSMocker;
|
||||||
|
import info.nightscout.androidaps.MainApp;
|
||||||
|
import info.nightscout.androidaps.logging.L;
|
||||||
|
import info.nightscout.utils.SP;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertEquals;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Rumen on 01.08.2018.
|
||||||
|
*/
|
||||||
|
|
||||||
|
@RunWith(PowerMockRunner.class)
|
||||||
|
@PrepareForTest({MainApp.class, SP.class, L.class})
|
||||||
|
public class DanaRS_Packet_Basal_Set_Suspend_OffTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void runTest() {
|
||||||
|
AAPSMocker.mockMainApp();
|
||||||
|
AAPSMocker.mockApplicationContext();
|
||||||
|
AAPSMocker.mockSP();
|
||||||
|
AAPSMocker.mockL();
|
||||||
|
|
||||||
|
DanaRS_Packet_Basal_Set_Suspend_Off packet = new DanaRS_Packet_Basal_Set_Suspend_Off();
|
||||||
|
|
||||||
|
// test message decoding
|
||||||
|
packet.handleMessage(new byte[]{(byte) 0, (byte) 0, (byte) 0});
|
||||||
|
assertEquals(false, packet.failed);
|
||||||
|
packet.handleMessage(new byte[]{(byte) 0, (byte) 0, (byte) 1});
|
||||||
|
assertEquals(true, packet.failed);
|
||||||
|
|
||||||
|
assertEquals("BASAL__SET_SUSPEND_OFF", packet.getFriendlyName());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,42 @@
|
||||||
|
package info.nightscout.androidaps.plugins.PumpDanaRS.comm;
|
||||||
|
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
import org.powermock.core.classloader.annotations.PrepareForTest;
|
||||||
|
import org.powermock.modules.junit4.PowerMockRunner;
|
||||||
|
|
||||||
|
import info.AAPSMocker;
|
||||||
|
import info.nightscout.androidaps.MainApp;
|
||||||
|
import info.nightscout.androidaps.logging.L;
|
||||||
|
import info.nightscout.utils.SP;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertEquals;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Rumen on 01.08.2018.
|
||||||
|
*/
|
||||||
|
|
||||||
|
@RunWith(PowerMockRunner.class)
|
||||||
|
@PrepareForTest({MainApp.class, SP.class, L.class})
|
||||||
|
public class DanaRS_Packet_Basal_Set_Suspend_OnTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void runTest() {
|
||||||
|
AAPSMocker.mockMainApp();
|
||||||
|
AAPSMocker.mockApplicationContext();
|
||||||
|
AAPSMocker.mockSP();
|
||||||
|
AAPSMocker.mockL();
|
||||||
|
|
||||||
|
DanaRS_Packet_Basal_Set_Suspend_On packet = new DanaRS_Packet_Basal_Set_Suspend_On();
|
||||||
|
|
||||||
|
// test message decoding
|
||||||
|
packet.handleMessage(new byte[]{(byte) 0, (byte) 0, (byte) 0});
|
||||||
|
assertEquals(false, packet.failed);
|
||||||
|
packet.handleMessage(new byte[]{(byte) 0, (byte) 0, (byte) 1});
|
||||||
|
assertEquals(true, packet.failed);
|
||||||
|
|
||||||
|
assertEquals("BASAL__SET_SUSPEND_ON", packet.getFriendlyName());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,49 @@
|
||||||
|
package info.nightscout.androidaps.plugins.PumpDanaRS.comm;
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
import org.powermock.core.classloader.annotations.PrepareForTest;
|
||||||
|
import org.powermock.core.classloader.annotations.SuppressStaticInitializationFor;
|
||||||
|
import org.powermock.modules.junit4.PowerMockRunner;
|
||||||
|
|
||||||
|
import info.AAPSMocker;
|
||||||
|
import info.nightscout.androidaps.MainApp;
|
||||||
|
import info.nightscout.androidaps.logging.L;
|
||||||
|
import info.nightscout.utils.SP;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertEquals;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Rumen on 02.08.2018.
|
||||||
|
*/
|
||||||
|
|
||||||
|
@RunWith(PowerMockRunner.class)
|
||||||
|
@SuppressStaticInitializationFor("info.nightscout.androidaps.logging.L")
|
||||||
|
@PrepareForTest({MainApp.class, SP.class, L.class})
|
||||||
|
public class DanaRS_Packet_Basal_Set_Temporary_BasalTest extends DanaRS_Packet_Basal_Set_Temporary_Basal {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void runTest() {
|
||||||
|
AAPSMocker.mockMainApp();
|
||||||
|
AAPSMocker.mockApplicationContext();
|
||||||
|
AAPSMocker.mockSP();
|
||||||
|
AAPSMocker.mockL();
|
||||||
|
|
||||||
|
DanaRS_Packet_Basal_Set_Temporary_Basal testPacket = new DanaRS_Packet_Basal_Set_Temporary_Basal(50, 20);
|
||||||
|
// params
|
||||||
|
byte[] params = testPacket.getRequestParams();
|
||||||
|
// is ratio 50
|
||||||
|
assertEquals(50, params[0]);
|
||||||
|
// is duration 20
|
||||||
|
assertEquals(20, params[1]);
|
||||||
|
|
||||||
|
// test message decoding
|
||||||
|
handleMessage(new byte[]{(byte) 0, (byte) 0, (byte) 0});
|
||||||
|
assertEquals(false, failed);
|
||||||
|
handleMessage(new byte[]{(byte) 0, (byte) 0, (byte) 1});
|
||||||
|
assertEquals(true, failed);
|
||||||
|
|
||||||
|
assertEquals("BASAL__SET_TEMPORARY_BASAL", getFriendlyName());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,60 @@
|
||||||
|
package info.nightscout.androidaps.plugins.PumpDanaRS.comm;
|
||||||
|
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
import org.powermock.core.classloader.annotations.PrepareForTest;
|
||||||
|
import org.powermock.modules.junit4.PowerMockRunner;
|
||||||
|
|
||||||
|
import info.AAPSMocker;
|
||||||
|
import info.nightscout.androidaps.MainApp;
|
||||||
|
import info.nightscout.androidaps.logging.L;
|
||||||
|
import info.nightscout.androidaps.plugins.PumpDanaR.DanaRPump;
|
||||||
|
import info.nightscout.utils.SP;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertEquals;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Rumen on 01.08.2018.
|
||||||
|
*/
|
||||||
|
|
||||||
|
@RunWith(PowerMockRunner.class)
|
||||||
|
@PrepareForTest({MainApp.class, SP.class, L.class})
|
||||||
|
public class DanaRS_Packet_Bolus_Get_Bolus_OptionTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void runTest() {
|
||||||
|
AAPSMocker.mockMainApp();
|
||||||
|
AAPSMocker.mockApplicationContext();
|
||||||
|
AAPSMocker.mockSP();
|
||||||
|
AAPSMocker.mockL();
|
||||||
|
AAPSMocker.mockBus();
|
||||||
|
|
||||||
|
DanaRS_Packet_Bolus_Get_Bolus_Option packet = new DanaRS_Packet_Bolus_Get_Bolus_Option();
|
||||||
|
|
||||||
|
// test message decoding
|
||||||
|
DanaRPump pump = DanaRPump.getInstance();
|
||||||
|
//if dataArray is 1 pump.isExtendedBolusEnabled should be true
|
||||||
|
packet.handleMessage(createArray(21,(byte) 1));
|
||||||
|
assertEquals(false, packet.failed);
|
||||||
|
//Are options saved to pump
|
||||||
|
assertEquals(false, !pump.isExtendedBolusEnabled);
|
||||||
|
assertEquals(1, pump.bolusCalculationOption);
|
||||||
|
assertEquals(1, pump.missedBolusConfig);
|
||||||
|
|
||||||
|
packet.handleMessage(createArray(21,(byte) 0));
|
||||||
|
assertEquals(true, packet.failed);
|
||||||
|
//Are options saved to pump
|
||||||
|
assertEquals(true, !pump.isExtendedBolusEnabled);
|
||||||
|
|
||||||
|
assertEquals("BOLUS__GET_BOLUS_OPTION", packet.getFriendlyName());
|
||||||
|
}
|
||||||
|
|
||||||
|
byte[] createArray(int length, byte fillWith) {
|
||||||
|
byte[] ret = new byte[length];
|
||||||
|
for (int i = 0; i < length; i++) {
|
||||||
|
ret[i] = fillWith;
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,65 @@
|
||||||
|
package info.nightscout.androidaps.plugins.PumpDanaRS.comm;
|
||||||
|
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
import org.powermock.core.classloader.annotations.PrepareForTest;
|
||||||
|
import org.powermock.modules.junit4.PowerMockRunner;
|
||||||
|
|
||||||
|
import info.AAPSMocker;
|
||||||
|
import info.nightscout.androidaps.MainApp;
|
||||||
|
import info.nightscout.androidaps.logging.L;
|
||||||
|
import info.nightscout.androidaps.plugins.PumpDanaR.DanaRPump;
|
||||||
|
import info.nightscout.utils.SP;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertEquals;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Rumen on 06.08.2018.
|
||||||
|
*/
|
||||||
|
|
||||||
|
@RunWith(PowerMockRunner.class)
|
||||||
|
@PrepareForTest({MainApp.class, SP.class, L.class})
|
||||||
|
public class DanaRS_Packet_Bolus_Get_CIR_CF_ArrayTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void runTest() {
|
||||||
|
AAPSMocker.mockMainApp();
|
||||||
|
AAPSMocker.mockApplicationContext();
|
||||||
|
AAPSMocker.mockSP();
|
||||||
|
AAPSMocker.mockL();
|
||||||
|
DanaRS_Packet_Bolus_Get_CIR_CF_Array packet = new DanaRS_Packet_Bolus_Get_CIR_CF_Array();
|
||||||
|
|
||||||
|
// test params
|
||||||
|
byte[] testparams = packet.getRequestParams();
|
||||||
|
assertEquals(null, packet.getRequestParams());
|
||||||
|
|
||||||
|
|
||||||
|
// test message decoding
|
||||||
|
packet.handleMessage(createArray(34, (byte) 0));
|
||||||
|
// are pump units MG/DL ???
|
||||||
|
DanaRPump testPump = DanaRPump.getInstance();
|
||||||
|
assertEquals(DanaRPump.UNITS_MGDL, testPump.units);
|
||||||
|
assertEquals(false, packet.failed);
|
||||||
|
packet.handleMessage(createArray(34, (byte) 3));
|
||||||
|
assertEquals(true, packet.failed);
|
||||||
|
|
||||||
|
assertEquals("BOLUS__GET_CIR_CF_ARRAY", packet.getFriendlyName());
|
||||||
|
}
|
||||||
|
|
||||||
|
byte[] createArray(int length, byte fillWith){
|
||||||
|
byte[] ret = new byte[length];
|
||||||
|
for(int i = 0; i<length; i++){
|
||||||
|
ret[i] = fillWith;
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
double[] createArray(int length, double fillWith){
|
||||||
|
double[] ret = new double[length];
|
||||||
|
for(int i = 0; i<length; i++){
|
||||||
|
ret[i] = fillWith;
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,61 @@
|
||||||
|
package info.nightscout.androidaps.plugins.PumpDanaRS.comm;
|
||||||
|
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
import org.powermock.core.classloader.annotations.PrepareForTest;
|
||||||
|
import org.powermock.modules.junit4.PowerMockRunner;
|
||||||
|
|
||||||
|
import info.AAPSMocker;
|
||||||
|
import info.nightscout.androidaps.MainApp;
|
||||||
|
import info.nightscout.androidaps.logging.L;
|
||||||
|
import info.nightscout.utils.SP;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertEquals;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Rumen on 06.08.2018.
|
||||||
|
*/
|
||||||
|
|
||||||
|
@RunWith(PowerMockRunner.class)
|
||||||
|
@PrepareForTest({MainApp.class, SP.class, L.class})
|
||||||
|
public class DanaRS_Packet_Bolus_Get_Calculation_InformationTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void runTest() {
|
||||||
|
AAPSMocker.mockMainApp();
|
||||||
|
AAPSMocker.mockApplicationContext();
|
||||||
|
AAPSMocker.mockSP();
|
||||||
|
AAPSMocker.mockL();
|
||||||
|
DanaRS_Packet_Bolus_Get_Calculation_Information packet = new DanaRS_Packet_Bolus_Get_Calculation_Information();
|
||||||
|
|
||||||
|
// test params
|
||||||
|
byte[] testparams = packet.getRequestParams();
|
||||||
|
assertEquals(null, packet.getRequestParams());
|
||||||
|
|
||||||
|
|
||||||
|
// test message decoding
|
||||||
|
packet.handleMessage(createArray(24, (byte) 0));
|
||||||
|
assertEquals(false, packet.failed);
|
||||||
|
packet.handleMessage(createArray(24, (byte) 1));
|
||||||
|
assertEquals(true, packet.failed);
|
||||||
|
|
||||||
|
assertEquals("BOLUS__GET_CALCULATION_INFORMATION", packet.getFriendlyName());
|
||||||
|
}
|
||||||
|
|
||||||
|
byte[] createArray(int length, byte fillWith){
|
||||||
|
byte[] ret = new byte[length];
|
||||||
|
for(int i = 0; i<length; i++){
|
||||||
|
ret[i] = fillWith;
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
double[] createArray(int length, double fillWith){
|
||||||
|
double[] ret = new double[length];
|
||||||
|
for(int i = 0; i<length; i++){
|
||||||
|
ret[i] = fillWith;
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,61 @@
|
||||||
|
package info.nightscout.androidaps.plugins.PumpDanaRS.comm;
|
||||||
|
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
import org.powermock.core.classloader.annotations.PrepareForTest;
|
||||||
|
import org.powermock.modules.junit4.PowerMockRunner;
|
||||||
|
|
||||||
|
import info.AAPSMocker;
|
||||||
|
import info.nightscout.androidaps.MainApp;
|
||||||
|
import info.nightscout.androidaps.logging.L;
|
||||||
|
import info.nightscout.utils.SP;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertEquals;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Rumen on 06.08.2018.
|
||||||
|
*/
|
||||||
|
|
||||||
|
@RunWith(PowerMockRunner.class)
|
||||||
|
@PrepareForTest({MainApp.class, SP.class, L.class})
|
||||||
|
public class DanaRS_Packet_Bolus_Get_Carbohydrate_Calculation_InformationTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void runTest() {
|
||||||
|
AAPSMocker.mockMainApp();
|
||||||
|
AAPSMocker.mockApplicationContext();
|
||||||
|
AAPSMocker.mockSP();
|
||||||
|
AAPSMocker.mockL();
|
||||||
|
DanaRS_Packet_Bolus_Get_Carbohydrate_Calculation_Information packet = new DanaRS_Packet_Bolus_Get_Carbohydrate_Calculation_Information();
|
||||||
|
|
||||||
|
// test params
|
||||||
|
byte[] testparams = packet.getRequestParams();
|
||||||
|
assertEquals(null, packet.getRequestParams());
|
||||||
|
|
||||||
|
|
||||||
|
// test message decoding
|
||||||
|
packet.handleMessage(createArray(24, (byte) 0));
|
||||||
|
assertEquals(false, packet.failed);
|
||||||
|
packet.handleMessage(createArray(24, (byte) 1));
|
||||||
|
assertEquals(true, packet.failed);
|
||||||
|
|
||||||
|
assertEquals("BOLUS__GET_CARBOHYDRATE_CALCULATION_INFORMATION", packet.getFriendlyName());
|
||||||
|
}
|
||||||
|
|
||||||
|
byte[] createArray(int length, byte fillWith){
|
||||||
|
byte[] ret = new byte[length];
|
||||||
|
for(int i = 0; i<length; i++){
|
||||||
|
ret[i] = fillWith;
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
double[] createArray(int length, double fillWith){
|
||||||
|
double[] ret = new double[length];
|
||||||
|
for(int i = 0; i<length; i++){
|
||||||
|
ret[i] = fillWith;
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,65 @@
|
||||||
|
package info.nightscout.androidaps.plugins.PumpDanaRS.comm;
|
||||||
|
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
import org.powermock.core.classloader.annotations.PrepareForTest;
|
||||||
|
import org.powermock.modules.junit4.PowerMockRunner;
|
||||||
|
|
||||||
|
import info.AAPSMocker;
|
||||||
|
import info.nightscout.androidaps.MainApp;
|
||||||
|
import info.nightscout.androidaps.logging.L;
|
||||||
|
import info.nightscout.androidaps.plugins.PumpDanaR.DanaRPump;
|
||||||
|
import info.nightscout.utils.SP;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertEquals;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Rumen on 06.08.2018.
|
||||||
|
*/
|
||||||
|
|
||||||
|
@RunWith(PowerMockRunner.class)
|
||||||
|
@PrepareForTest({MainApp.class, SP.class, L.class})
|
||||||
|
public class DanaRS_Packet_Bolus_Get_Dual_BolusTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void runTest() {
|
||||||
|
AAPSMocker.mockMainApp();
|
||||||
|
AAPSMocker.mockApplicationContext();
|
||||||
|
AAPSMocker.mockSP();
|
||||||
|
AAPSMocker.mockL();
|
||||||
|
DanaRS_Packet_Bolus_Get_Dual_Bolus packet = new DanaRS_Packet_Bolus_Get_Dual_Bolus();
|
||||||
|
|
||||||
|
// test params
|
||||||
|
assertEquals(null, packet.getRequestParams());
|
||||||
|
|
||||||
|
// test message decoding
|
||||||
|
double testValue = 0d;
|
||||||
|
packet.handleMessage(createArray(10, (byte) testValue));
|
||||||
|
assertEquals(testValue != 0d, packet.failed);
|
||||||
|
testValue = 1d;
|
||||||
|
packet.handleMessage(createArray(10, (byte) testValue));
|
||||||
|
// is pump.bolustep set to 1
|
||||||
|
DanaRPump pump = DanaRPump.getInstance();
|
||||||
|
assertEquals((((byte)testValue & 0x000000FF) << 8) + ((byte) testValue & 0x000000FF), pump.bolusStep, 0);
|
||||||
|
assertEquals(testValue != 0d, packet.failed);
|
||||||
|
|
||||||
|
assertEquals("BOLUS__GET_DUAL_BOLUS", packet.getFriendlyName());
|
||||||
|
}
|
||||||
|
|
||||||
|
byte[] createArray(int length, byte fillWith){
|
||||||
|
byte[] ret = new byte[length];
|
||||||
|
for(int i = 0; i<length; i++){
|
||||||
|
ret[i] = fillWith;
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
double[] createArray(int length, double fillWith){
|
||||||
|
double[] ret = new double[length];
|
||||||
|
for(int i = 0; i<length; i++){
|
||||||
|
ret[i] = fillWith;
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,65 @@
|
||||||
|
package info.nightscout.androidaps.plugins.PumpDanaRS.comm;
|
||||||
|
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
import org.powermock.core.classloader.annotations.PrepareForTest;
|
||||||
|
import org.powermock.modules.junit4.PowerMockRunner;
|
||||||
|
|
||||||
|
import info.AAPSMocker;
|
||||||
|
import info.nightscout.androidaps.MainApp;
|
||||||
|
import info.nightscout.androidaps.logging.L;
|
||||||
|
import info.nightscout.androidaps.plugins.PumpDanaR.DanaRPump;
|
||||||
|
import info.nightscout.utils.SP;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertEquals;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Rumen on 06.08.2018.
|
||||||
|
*/
|
||||||
|
|
||||||
|
@RunWith(PowerMockRunner.class)
|
||||||
|
@PrepareForTest({MainApp.class, SP.class, L.class})
|
||||||
|
public class DanaRS_Packet_Bolus_Get_Extended_BolusTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void runTest() {
|
||||||
|
AAPSMocker.mockMainApp();
|
||||||
|
AAPSMocker.mockApplicationContext();
|
||||||
|
AAPSMocker.mockSP();
|
||||||
|
AAPSMocker.mockL();
|
||||||
|
DanaRS_Packet_Bolus_Get_Extended_Bolus packet = new DanaRS_Packet_Bolus_Get_Extended_Bolus();
|
||||||
|
|
||||||
|
// test params
|
||||||
|
assertEquals(null, packet.getRequestParams());
|
||||||
|
|
||||||
|
// test message decoding
|
||||||
|
double testValue = 0d;
|
||||||
|
packet.handleMessage(createArray(10, (byte) testValue));
|
||||||
|
assertEquals(testValue != 0d, packet.failed);
|
||||||
|
testValue = 1d;
|
||||||
|
packet.handleMessage(createArray(10, (byte) testValue));
|
||||||
|
// is pump.bolustep set to 1
|
||||||
|
DanaRPump pump = DanaRPump.getInstance();
|
||||||
|
assertEquals(testValue / 100d, pump.bolusStep, 0);
|
||||||
|
assertEquals(testValue != 0d, packet.failed);
|
||||||
|
|
||||||
|
assertEquals("BOLUS__GET_EXTENDED_BOLUS", packet.getFriendlyName());
|
||||||
|
}
|
||||||
|
|
||||||
|
byte[] createArray(int length, byte fillWith){
|
||||||
|
byte[] ret = new byte[length];
|
||||||
|
for(int i = 0; i<length; i++){
|
||||||
|
ret[i] = fillWith;
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
double[] createArray(int length, double fillWith){
|
||||||
|
double[] ret = new double[length];
|
||||||
|
for(int i = 0; i<length; i++){
|
||||||
|
ret[i] = fillWith;
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,65 @@
|
||||||
|
package info.nightscout.androidaps.plugins.PumpDanaRS.comm;
|
||||||
|
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
import org.powermock.core.classloader.annotations.PrepareForTest;
|
||||||
|
import org.powermock.modules.junit4.PowerMockRunner;
|
||||||
|
|
||||||
|
import info.AAPSMocker;
|
||||||
|
import info.nightscout.androidaps.MainApp;
|
||||||
|
import info.nightscout.androidaps.logging.L;
|
||||||
|
import info.nightscout.androidaps.plugins.PumpDanaR.DanaRPump;
|
||||||
|
import info.nightscout.utils.SP;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertEquals;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Rumen on 06.08.2018.
|
||||||
|
*/
|
||||||
|
|
||||||
|
@RunWith(PowerMockRunner.class)
|
||||||
|
@PrepareForTest({MainApp.class, SP.class, L.class})
|
||||||
|
public class DanaRS_Packet_Bolus_Get_Extended_Bolus_StateTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void runTest() {
|
||||||
|
AAPSMocker.mockMainApp();
|
||||||
|
AAPSMocker.mockApplicationContext();
|
||||||
|
AAPSMocker.mockSP();
|
||||||
|
AAPSMocker.mockL();
|
||||||
|
DanaRS_Packet_Bolus_Get_Extended_Bolus_State packet = new DanaRS_Packet_Bolus_Get_Extended_Bolus_State();
|
||||||
|
|
||||||
|
// test params
|
||||||
|
assertEquals(null, packet.getRequestParams());
|
||||||
|
|
||||||
|
// test message decoding
|
||||||
|
double testValue = 0d;
|
||||||
|
packet.handleMessage(createArray(11, (byte) testValue));
|
||||||
|
assertEquals(testValue != 0d, packet.failed);
|
||||||
|
testValue = 1d;
|
||||||
|
packet.handleMessage(createArray(11, (byte) testValue));
|
||||||
|
// is extended bolus in progress
|
||||||
|
DanaRPump pump = DanaRPump.getInstance();
|
||||||
|
assertEquals(testValue == 1, pump.isExtendedInProgress);
|
||||||
|
assertEquals(testValue != 0d, packet.failed);
|
||||||
|
|
||||||
|
assertEquals("BOLUS__GET_EXTENDED_BOLUS_STATE", packet.getFriendlyName());
|
||||||
|
}
|
||||||
|
|
||||||
|
byte[] createArray(int length, byte fillWith){
|
||||||
|
byte[] ret = new byte[length];
|
||||||
|
for(int i = 0; i<length; i++){
|
||||||
|
ret[i] = fillWith;
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
double[] createArray(int length, double fillWith){
|
||||||
|
double[] ret = new double[length];
|
||||||
|
for(int i = 0; i<length; i++){
|
||||||
|
ret[i] = fillWith;
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
}
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue