Merge remote-tracking branch 'origin/dev' into combo-v2

* origin/dev: (26 commits)
  fix RS response code
  use max absorption time for AAPS and weighted average sensitivity detection
  log.debug -> log.error on RS comm
  read status after bolus
  RS connectivity & bolus improvement
  Better bolusing with different speeds (R & Rv2)
  Detailed onscreen history logging
  Split to smaller pieces
  Update strings.xml
  Sensitivity logging optional
  RS synchronized change
  fix displaying XX:30 time intervals
  CS translations
  allow to use actual profile in wizard
  getUnits from active profile not interface
  Update strings.xml
  Update strings.xml
  Update dutch
  Update strings.xml
  Update strings.xml
  ...
This commit is contained in:
Johannes Mockenhaupt 2017-10-27 22:24:38 +02:00
commit d237c46ca8
No known key found for this signature in database
GPG key ID: 9E1EA6AF7BBBB0D1
51 changed files with 562 additions and 232 deletions

View file

@ -50,7 +50,6 @@ android {
buildConfigField "String", "BUILDVERSION", generateGitBuild()
ndk {
abiFilters "armeabi-v7a", "x86", "armeabi", "mips"
moduleName "BleCommandUtil"
}
}
@ -152,7 +151,6 @@ dependencies {
}
compile 'org.slf4j:slf4j-api:1.7.12'
compile 'com.jjoe64:graphview:4.0.1'
compile 'com.eclipsesource.j2v8:j2v8:3.1.6@aar'
compile 'com.joanzapata.iconify:android-iconify-fontawesome:2.1.1'
compile 'com.google.android.gms:play-services-wearable:7.5.0'
compile 'junit:junit:4.12'

View file

@ -29,4 +29,14 @@ public class DetailedBolusInfo {
public Context context = null; // context for progress dialog
public long pumpId = 0; // id of record if comming from pump history (not a newly created treatment)
public boolean isSMB = false; // is a Super-MicroBolus
@Override
public String toString() {
return new Date(date).toLocaleString() +
" insulin: " + insulin +
" carbs: " + carbs +
" isValid: " + isValid +
" carbTime: " + carbTime +
" isSMB: " + isSMB;
}
}

View file

@ -256,7 +256,7 @@ public class Profile {
private String format_HH_MM(Integer timeAsSeconds) {
String time;
int hour = timeAsSeconds / 60 / 60;
int minutes = timeAsSeconds - hour * 60 * 60;
int minutes = (timeAsSeconds - hour * 60 * 60) / 60;
DecimalFormat df = new DecimalFormat("00");
time = df.format(hour) + ":" + df.format(minutes);
return time;

View file

@ -961,7 +961,7 @@ public class ConfigBuilderPlugin implements PluginBase, PumpInterface, Constrain
}
public String getProfileUnits() {
return activeProfile.getUnits();
return getProfile().getUnits();
}
public Profile getProfile(long time) {

View file

@ -20,7 +20,7 @@ public class DetailedBolusInfoStorage {
private static List<DetailedBolusInfo> store = new ArrayList<>();
public static void add(DetailedBolusInfo detailedBolusInfo) {
log.debug("Bolus info stored: " + new Date(detailedBolusInfo.date).toLocaleString());
log.debug("Stored bolus info: " + detailedBolusInfo);
store.add(detailedBolusInfo);
}
@ -29,7 +29,7 @@ public class DetailedBolusInfoStorage {
DetailedBolusInfo found = null;
for (int i = 0; i < store.size(); i++) {
long infoTime = store.get(i).date;
log.debug("Existing info: " + new Date(infoTime).toLocaleString());
log.debug("Existing bolus info: " + store.get(i));
if (bolustime > infoTime - 60 * 1000 && bolustime < infoTime + 60 * 1000) {
found = store.get(i);
break;
@ -42,7 +42,7 @@ public class DetailedBolusInfoStorage {
for (int i = 0; i < store.size(); i++) {
long infoTime = store.get(i).date;
if (bolustime > infoTime - 60 * 1000 && bolustime < infoTime + 60 * 1000) {
log.debug("Removing info: " + new Date(infoTime).toLocaleString());
log.debug("Removing bolus info: " + store.get(i));
store.remove(i);
break;
}

View file

@ -13,6 +13,7 @@ import info.nightscout.androidaps.data.Profile;
import info.nightscout.androidaps.db.Treatment;
import info.nightscout.androidaps.interfaces.PluginBase;
import info.nightscout.androidaps.plugins.SensitivityAAPS.SensitivityAAPSPlugin;
import info.nightscout.androidaps.plugins.SensitivityWeightedAverage.SensitivityWeightedAveragePlugin;
import info.nightscout.utils.SP;
/**
@ -32,7 +33,7 @@ public class AutosensData {
time = t.date;
carbs = t.carbs;
remaining = t.carbs;
if (MainApp.getSpecificPlugin(SensitivityAAPSPlugin.class) != null && MainApp.getSpecificPlugin(SensitivityAAPSPlugin.class).isEnabled(PluginBase.SENSITIVITY)) {
if (SensitivityAAPSPlugin.getPlugin().isEnabled(PluginBase.SENSITIVITY) || SensitivityWeightedAveragePlugin.getPlugin().isEnabled(PluginBase.SENSITIVITY)) {
double maxAbsorptionHours = SP.getDouble(R.string.key_absorption_maxtime, 4d);
Profile profile = MainApp.getConfigBuilder().getProfile(t.date);
double sens = Profile.toMgdl(profile.getIsf(t.date), profile.getUnits());

View file

@ -366,6 +366,9 @@ public class IobCobCalculatorPlugin implements PluginBase {
continue;
}
if (profile.getIsf(bgTime) == null)
return; // profile not set yet
double sens = Profile.toMgdl(profile.getIsf(bgTime), profile.getUnits());
AutosensData autosensData = new AutosensData();

View file

@ -183,7 +183,7 @@ public class BroadcastTreatment {
ret.add(newarr);
}
newarr = new JSONArray();
count = 50;
count = 20;
}
newarr.put(array.get(i));
--count;

View file

@ -254,7 +254,7 @@ public class NSDeviceStatus {
long clockEnacted = 0L;
JSONObject suggested = null;
JSONObject enacted = null;
public JSONObject enacted = null;
}
public void updateOpenApsData(JSONObject object) {

View file

@ -1,7 +1,5 @@
package info.nightscout.androidaps.plugins.OpenAPSAMA;
import com.eclipsesource.v8.V8Object;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

View file

@ -32,6 +32,7 @@ import com.squareup.otto.Subscribe;
import org.json.JSONException;
import org.json.JSONObject;
import org.mozilla.javascript.tools.debugger.Main;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -401,15 +402,11 @@ public class WizardDialog extends DialogFragment implements OnClickListener, Com
ArrayList<CharSequence> profileList;
profileList = profileStore.getProfileList();
profileList.add(0, MainApp.sResources.getString(R.string.active));
ArrayAdapter<CharSequence> adapter = new ArrayAdapter<CharSequence>(getContext(),
R.layout.spinner_centered, profileList);
profileSpinner.setAdapter(adapter);
// set selected to actual profile
for (int p = 0; p < profileList.size(); p++) {
if (profileList.get(p).equals(MainApp.getConfigBuilder().getProfileName()))
profileSpinner.setSelection(p);
}
String units = profile.getUnits();
bgUnits.setText(units);
@ -451,7 +448,11 @@ public class WizardDialog extends DialogFragment implements OnClickListener, Com
if (profileSpinner == null || profileSpinner.getSelectedItem() == null)
return; // not initialized yet
String selectedAlternativeProfile = profileSpinner.getSelectedItem().toString();
Profile specificProfile = profile.getSpecificProfile(selectedAlternativeProfile);
Profile specificProfile;
if (selectedAlternativeProfile.equals(MainApp.sResources.getString(R.string.active)))
specificProfile = MainApp.getConfigBuilder().getProfile();
else
specificProfile = profile.getSpecificProfile(selectedAlternativeProfile);
// Entered values
Double c_bg = SafeParse.stringToDouble(editBg.getText());

View file

@ -187,12 +187,12 @@ public class SerialIOThread extends Thread {
scheduledDisconnection = null;
}
}
// prepare task for execution in 5 sec
// prepare task for execution in 10 sec
// cancel waiting task to prevent sending multiple disconnections
if (scheduledDisconnection != null)
scheduledDisconnection.cancel(false);
Runnable task = new DisconnectRunnable();
final int sec = 5;
final int sec = 10;
scheduledDisconnection = worker.schedule(task, sec, TimeUnit.SECONDS);
}

View file

@ -34,6 +34,7 @@ import info.nightscout.androidaps.events.EventPreferenceChange;
import info.nightscout.androidaps.events.EventPumpStatusChanged;
import info.nightscout.androidaps.interfaces.PluginBase;
import info.nightscout.androidaps.data.Profile;
import info.nightscout.androidaps.plugins.Overview.events.EventOverviewBolusProgress;
import info.nightscout.androidaps.plugins.PumpDanaR.DanaRPlugin;
import info.nightscout.androidaps.plugins.PumpDanaR.DanaRPump;
import info.nightscout.androidaps.plugins.PumpDanaR.SerialIOThread;
@ -410,12 +411,12 @@ public class DanaRExecutionService extends Service {
public boolean bolus(double amount, int carbs, Treatment t) {
bolusingTreatment = t;
int speed = SP.getInt(R.string.key_danars_bolusspeed, 0);
int preferencesSpeed = SP.getInt(R.string.key_danars_bolusspeed, 0);
MessageBase start;
if (speed == 0)
if (preferencesSpeed == 0)
start = new MsgBolusStart(amount);
else
start = new MsgBolusStartWithSpeed(amount, speed);
start = new MsgBolusStartWithSpeed(amount, preferencesSpeed);
MsgBolusStop stop = new MsgBolusStop(amount, t);
connect("bolus");
@ -426,7 +427,7 @@ public class DanaRExecutionService extends Service {
}
MsgBolusProgress progress = new MsgBolusProgress(amount, t); // initialize static variables
long startTime = System.currentTimeMillis();
long bolusStart = System.currentTimeMillis();
if (!stop.stopped) {
mSerialIOThread.sendMessage(start);
@ -436,23 +437,47 @@ public class DanaRExecutionService extends Service {
}
while (!stop.stopped && !start.failed) {
waitMsec(100);
if ((System.currentTimeMillis() - progress.lastReceive) > 5 * 1000L) { // if i didn't receive status for more than 5 sec expecting broken comm
if ((System.currentTimeMillis() - progress.lastReceive) > 15 * 1000L) { // if i didn't receive status for more than 5 sec expecting broken comm
stop.stopped = true;
stop.forced = true;
log.debug("Communication stopped");
}
}
waitMsec(300);
EventOverviewBolusProgress bolusingEvent = EventOverviewBolusProgress.getInstance();
bolusingEvent.t = t;
bolusingEvent.percent = 99;
bolusingTreatment = null;
int speed = 12;
switch (preferencesSpeed) {
case 0:
speed = 12;
break;
case 1:
speed = 30;
break;
case 2:
speed = 60;
break;
}
// try to find real amount if bolusing was interrupted or comm failed
if (t.insulin != amount) {
disconnect("bolusingInterrupted");
long now = System.currentTimeMillis();
long estimatedBolusEnd = (long) (startTime + amount / 5d * 60 * 1000); // std delivery rate 5 U/min
waitMsec(Math.max(5000, estimatedBolusEnd - now + 3000));
long bolusDurationInMSec = (long) (amount * speed * 1000);
long expectedEnd = bolusStart + bolusDurationInMSec + 3000;
while (System.currentTimeMillis() < expectedEnd) {
long waitTime = expectedEnd - System.currentTimeMillis();
bolusingEvent.status = String.format(MainApp.sResources.getString(R.string.waitingforestimatedbolusend), waitTime / 1000);
MainApp.bus().post(bolusingEvent);
SystemClock.sleep(1000);
}
connect("bolusingInterrupted");
getPumpStatus();
if (danaRPump.lastBolusTime.getTime() > now - 60 * 1000L) { // last bolus max 1 min old
if (danaRPump.lastBolusTime.getTime() > System.currentTimeMillis() - 60 * 1000L) { // last bolus max 1 min old
t.insulin = danaRPump.lastBolusAmount;
log.debug("Used bolus amount from history: " + danaRPump.lastBolusAmount);
} else {

View file

@ -49,6 +49,7 @@ import info.nightscout.androidaps.events.EventAppExit;
import info.nightscout.androidaps.plugins.PumpDanaRS.events.EventDanaRSDeviceChange;
import info.nightscout.androidaps.plugins.PumpDanaRS.services.DanaRSService;
import info.nightscout.utils.DateUtil;
import info.nightscout.utils.DecimalFormatter;
import info.nightscout.utils.Round;
import info.nightscout.utils.SP;
@ -218,7 +219,7 @@ public class DanaRSPlugin implements PluginBase, PumpInterface, DanaRInterface,
connect(from);
}
public static synchronized void connect(String from) {
public static void connect(String from) {
log.debug("RS connect from: " + from);
if (danaRSService != null && !mDeviceAddress.equals("") && !mDeviceName.equals("")) {
final Object o = new Object();
@ -264,7 +265,9 @@ public class DanaRSPlugin implements PluginBase, PumpInterface, DanaRInterface,
@Override
public boolean loadHistory(byte type) {
connectIfNotConnected("loadHistory");
return danaRSService.loadHistory(type);
danaRSService.loadHistory(type);
disconnect("LoadHistory");
return true;
}
// Constraints interface
@ -374,7 +377,7 @@ public class DanaRSPlugin implements PluginBase, PumpInterface, DanaRInterface,
}
@Override
public int setNewBasalProfile(Profile profile) {
public synchronized int setNewBasalProfile(Profile profile) {
if (danaRSService == null) {
log.error("setNewBasalProfile sExecutionService is null");
return FAILED;
@ -391,10 +394,12 @@ public class DanaRSPlugin implements PluginBase, PumpInterface, DanaRInterface,
if (!danaRSService.updateBasalsInPump(profile)) {
Notification notification = new Notification(Notification.FAILED_UDPATE_PROFILE, MainApp.sResources.getString(R.string.failedupdatebasalprofile), Notification.URGENT);
MainApp.bus().post(new EventNewNotification(notification));
disconnect("SetNewBasalProfile");
return FAILED;
} else {
MainApp.bus().post(new EventDismissNotification(Notification.PROFILE_NOT_SET_NOT_INITIALIZED));
MainApp.bus().post(new EventDismissNotification(Notification.FAILED_UDPATE_PROFILE));
disconnect("SetNewBasalProfile");
return SUCCESS;
}
}
@ -425,10 +430,11 @@ public class DanaRSPlugin implements PluginBase, PumpInterface, DanaRInterface,
}
@Override
public void refreshDataFromPump(String reason) {
public synchronized void refreshDataFromPump(String reason) {
log.debug("Refreshing data from pump");
if (!isConnected() && !isConnecting()) {
connect(reason);
disconnect("RefreshDataFromPump");
} else
log.debug("Already connecting ...");
}
@ -439,11 +445,10 @@ public class DanaRSPlugin implements PluginBase, PumpInterface, DanaRInterface,
}
@Override
public PumpEnactResult deliverTreatment(DetailedBolusInfo detailedBolusInfo) {
public synchronized PumpEnactResult deliverTreatment(DetailedBolusInfo detailedBolusInfo) {
ConfigBuilderPlugin configBuilderPlugin = MainApp.getConfigBuilder();
detailedBolusInfo.insulin = configBuilderPlugin.applyBolusConstraints(detailedBolusInfo.insulin);
if (detailedBolusInfo.insulin > 0 || detailedBolusInfo.carbs > 0) {
DetailedBolusInfoStorage.add(detailedBolusInfo); // will be picked up on reading history
int preferencesSpeed = SP.getInt(R.string.key_danars_bolusspeed, 0);
int speed = 12;
switch (preferencesSpeed) {
@ -458,8 +463,8 @@ public class DanaRSPlugin implements PluginBase, PumpInterface, DanaRInterface,
break;
}
// v2 stores end time for bolus, we need to adjust time
// default delivery speed is 12 U/min
detailedBolusInfo.date += detailedBolusInfo.insulin / speed * 60d * 1000;
// default delivery speed is 12 sec/U
detailedBolusInfo.date += detailedBolusInfo.insulin * speed * 1000;
// clean carbs to prevent counting them as twice because they will picked up as another record
// I don't think it's necessary to copy DetailedBolusInfo right now for carbs records
double carbs = detailedBolusInfo.carbs;
@ -467,6 +472,8 @@ public class DanaRSPlugin implements PluginBase, PumpInterface, DanaRInterface,
int carbTime = detailedBolusInfo.carbTime;
detailedBolusInfo.carbTime = 0;
DetailedBolusInfoStorage.add(detailedBolusInfo); // will be picked up on reading history
Treatment t = new Treatment();
boolean connectionOK = false;
connectIfNotConnected("bolus");
@ -479,7 +486,7 @@ public class DanaRSPlugin implements PluginBase, PumpInterface, DanaRInterface,
result.comment = MainApp.instance().getString(R.string.virtualpump_resultok);
if (Config.logPumpActions)
log.debug("deliverTreatment: OK. Asked: " + detailedBolusInfo.insulin + " Delivered: " + result.bolusDelivered);
// remove carbs because it's get from history seprately
disconnect("DeliverTreatment");
return result;
} else {
PumpEnactResult result = new PumpEnactResult();
@ -503,7 +510,7 @@ public class DanaRSPlugin implements PluginBase, PumpInterface, DanaRInterface,
// This is called from APS
@Override
public PumpEnactResult setTempBasalAbsolute(Double absoluteRate, Integer durationInMinutes, boolean enforceNew) {
public synchronized PumpEnactResult setTempBasalAbsolute(Double absoluteRate, Integer durationInMinutes, boolean enforceNew) {
// Recheck pump status if older than 30 min
if (pump.lastConnection.getTime() + 30 * 60 * 1000L < System.currentTimeMillis()) {
connect("setTempBasalAbsolute old data");
@ -580,7 +587,7 @@ public class DanaRSPlugin implements PluginBase, PumpInterface, DanaRInterface,
}
@Override
public PumpEnactResult setTempBasalPercent(Integer percent, Integer durationInMinutes) {
public synchronized PumpEnactResult setTempBasalPercent(Integer percent, Integer durationInMinutes) {
PumpEnactResult result = new PumpEnactResult();
ConfigBuilderPlugin configBuilderPlugin = MainApp.getConfigBuilder();
percent = configBuilderPlugin.applyBasalConstraints(percent);
@ -622,6 +629,7 @@ public class DanaRSPlugin implements PluginBase, PumpInterface, DanaRInterface,
result.isPercent = true;
if (Config.logPumpActions)
log.debug("setTempBasalPercent: OK");
disconnect("setTempBasalPercent");
return result;
}
result.enacted = false;
@ -631,7 +639,7 @@ public class DanaRSPlugin implements PluginBase, PumpInterface, DanaRInterface,
return result;
}
public PumpEnactResult setHighTempBasalPercent(Integer percent) {
public synchronized PumpEnactResult setHighTempBasalPercent(Integer percent) {
PumpEnactResult result = new PumpEnactResult();
connectIfNotConnected("hightempbasal");
boolean connectionOK = danaRSService.highTempBasal(percent);
@ -645,6 +653,7 @@ public class DanaRSPlugin implements PluginBase, PumpInterface, DanaRInterface,
result.isPercent = true;
if (Config.logPumpActions)
log.debug("setHighTempBasalPercent: OK");
disconnect("setHighTempBasalPercent");
return result;
}
result.enacted = false;
@ -655,7 +664,7 @@ public class DanaRSPlugin implements PluginBase, PumpInterface, DanaRInterface,
}
@Override
public PumpEnactResult setExtendedBolus(Double insulin, Integer durationInMinutes) {
public synchronized PumpEnactResult setExtendedBolus(Double insulin, Integer durationInMinutes) {
ConfigBuilderPlugin configBuilderPlugin = MainApp.getConfigBuilder();
insulin = configBuilderPlugin.applyBolusConstraints(insulin);
// needs to be rounded
@ -688,6 +697,7 @@ public class DanaRSPlugin implements PluginBase, PumpInterface, DanaRInterface,
result.isPercent = false;
if (Config.logPumpActions)
log.debug("setExtendedBolus: OK");
disconnect("setExtendedBolus");
return result;
}
result.enacted = false;
@ -698,7 +708,7 @@ public class DanaRSPlugin implements PluginBase, PumpInterface, DanaRInterface,
}
@Override
public PumpEnactResult cancelTempBasal(boolean force) {
public synchronized PumpEnactResult cancelTempBasal(boolean force) {
PumpEnactResult result = new PumpEnactResult();
TemporaryBasal runningTB = MainApp.getConfigBuilder().getTempBasalFromHistory(System.currentTimeMillis());
if (runningTB != null) {
@ -706,6 +716,7 @@ public class DanaRSPlugin implements PluginBase, PumpInterface, DanaRInterface,
danaRSService.tempBasalStop();
result.enacted = true;
result.isTempCancel = true;
disconnect("cancelTempBasal");
}
if (!pump.isTempBasalInProgress) {
result.success = true;
@ -724,7 +735,7 @@ public class DanaRSPlugin implements PluginBase, PumpInterface, DanaRInterface,
}
@Override
public PumpEnactResult cancelExtendedBolus() {
public synchronized PumpEnactResult cancelExtendedBolus() {
PumpEnactResult result = new PumpEnactResult();
ExtendedBolus runningEB = MainApp.getConfigBuilder().getExtendedBolusFromHistory(System.currentTimeMillis());
if (runningEB != null) {
@ -732,6 +743,7 @@ public class DanaRSPlugin implements PluginBase, PumpInterface, DanaRInterface,
danaRSService.extendedBolusStop();
result.enacted = true;
result.isTempCancel = true;
disconnect("extendedBolusStop");
}
if (!pump.isExtendedInProgress) {
result.success = true;
@ -807,7 +819,28 @@ public class DanaRSPlugin implements PluginBase, PumpInterface, DanaRInterface,
@Override
public String shortStatus(boolean veryShort) {
return null;
String ret = "";
if (pump.lastConnection.getTime() != 0) {
Long agoMsec = System.currentTimeMillis() - pump.lastConnection.getTime();
int agoMin = (int) (agoMsec / 60d / 1000d);
ret += "LastConn: " + agoMin + " minago\n";
}
if (pump.lastBolusTime.getTime() != 0) {
ret += "LastBolus: " + DecimalFormatter.to2Decimal(pump.lastBolusAmount) + "U @" + android.text.format.DateFormat.format("HH:mm", pump.lastBolusTime) + "\n";
}
if (MainApp.getConfigBuilder().isInHistoryRealTempBasalInProgress()) {
ret += "Temp: " + MainApp.getConfigBuilder().getRealTempBasalFromHistory(System.currentTimeMillis()).toStringFull() + "\n";
}
if (MainApp.getConfigBuilder().isInHistoryExtendedBoluslInProgress()) {
ret += "Extended: " + MainApp.getConfigBuilder().getExtendedBolusFromHistory(System.currentTimeMillis()).toString() + "\n";
}
if (!veryShort) {
ret += "TDD: " + DecimalFormatter.to0Decimal(pump.dailyTotalUnits) + " / " + pump.maxDailyTotalUnits + " U\n";
}
ret += "IOB: " + pump.iob + "U\n";
ret += "Reserv: " + DecimalFormatter.to0Decimal(pump.reservoirRemainingUnits) + "U\n";
ret += "Batt: " + pump.batteryRemaining + "\n";
return ret;
}
@Override

View file

@ -51,9 +51,9 @@ public class DanaRS_Packet_APS_Basal_Set_Temporary_Basal extends DanaRS_Packet {
@Override
public void handleMessage(byte[] data) {
int result = byteArrayToInt(getBytes(data, DATA_START, 1));
if (result != 1) {
if (result != 0) {
failed = true;
log.debug("Set APS temp basal start result: " + result + " FAILED!!!");
log.error("Set APS temp basal start result: " + result + " FAILED!!!");
} else {
if (Config.logDanaMessageDetail)
log.debug("Set APS temp basal start result: " + result);

View file

@ -10,15 +10,14 @@ import java.util.Date;
import java.util.GregorianCalendar;
import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R;
import info.nightscout.androidaps.data.DetailedBolusInfo;
import info.nightscout.androidaps.db.DanaRHistoryRecord;
import info.nightscout.androidaps.db.ExtendedBolus;
import info.nightscout.androidaps.db.Source;
import info.nightscout.androidaps.db.TemporaryBasal;
import info.nightscout.androidaps.events.EventPumpStatusChanged;
import info.nightscout.androidaps.plugins.ConfigBuilder.DetailedBolusInfoStorage;
import info.nightscout.androidaps.plugins.PumpDanaR.DanaRPump;
import info.nightscout.androidaps.plugins.PumpDanaR.comm.RecordTypes;
import info.nightscout.androidaps.plugins.PumpDanaR.events.EventDanaRSyncStatus;
import info.nightscout.utils.DateUtil;
public class DanaRS_Packet_APS_History_Events extends DanaRS_Packet {
@ -32,11 +31,11 @@ public class DanaRS_Packet_APS_History_Events extends DanaRS_Packet {
private int sec = 0;
public boolean done;
public int totalCount;
private int totalCount;
public static long lastEventTimeLoaded = 0;
public DanaRS_Packet_APS_History_Events() {
DanaRS_Packet_APS_History_Events() {
super();
opCode = BleCommandUtil.DANAR_PACKET__OPCODE__APS_HISTORY_EVENTS;
done = false;
@ -97,70 +96,87 @@ public class DanaRS_Packet_APS_History_Events extends DanaRS_Packet {
DetailedBolusInfo detailedBolusInfo = DetailedBolusInfoStorage.findDetailedBolusInfo(datetime.getTime());
if (detailedBolusInfo == null) {
log.debug("DetailedBolusInfo not found for " + datetime.toLocaleString());
log.debug("Detailed bolus info not found for " + datetime.toLocaleString());
detailedBolusInfo = new DetailedBolusInfo();
} else {
log.debug("Detailed bolus info found: " + detailedBolusInfo);
}
detailedBolusInfo.date = datetime.getTime();
detailedBolusInfo.source = Source.PUMP;
detailedBolusInfo.pumpId = datetime.getTime();
String status;
switch (recordCode) {
case DanaRPump.TEMPSTART:
log.debug("EVENT TEMPSTART (" + recordCode + ") " + datetime.toLocaleString() + " Ratio: " + param1 + "% Duration: " + param2 + "min");
temporaryBasal.percentRate = param1;
temporaryBasal.durationInMinutes = param2;
MainApp.getConfigBuilder().addToHistoryTempBasal(temporaryBasal);
status = "TEMPSTART " + DateUtil.timeString(datetime);
break;
case DanaRPump.TEMPSTOP:
log.debug("EVENT TEMPSTOP (" + recordCode + ") " + datetime.toLocaleString());
MainApp.getConfigBuilder().addToHistoryTempBasal(temporaryBasal);
status = "TEMPSTOP " + DateUtil.timeString(datetime);
break;
case DanaRPump.EXTENDEDSTART:
log.debug("EVENT EXTENDEDSTART (" + recordCode + ") " + datetime.toLocaleString() + " Amount: " + (param1 / 100d) + "U Duration: " + param2 + "min");
extendedBolus.insulin = param1 / 100d;
extendedBolus.durationInMinutes = param2;
MainApp.getConfigBuilder().addToHistoryExtendedBolus(extendedBolus);
status = "EXTENDEDSTART " + DateUtil.timeString(datetime);
break;
case DanaRPump.EXTENDEDSTOP:
log.debug("EVENT EXTENDEDSTOP (" + recordCode + ") " + datetime.toLocaleString() + " Delivered: " + (param1 / 100d) + "U RealDuration: " + param2 + "min");
MainApp.getConfigBuilder().addToHistoryExtendedBolus(extendedBolus);
status = "EXTENDEDSTOP " + DateUtil.timeString(datetime);
break;
case DanaRPump.BOLUS:
detailedBolusInfo.insulin = param1 / 100d;
boolean newRecord = MainApp.getConfigBuilder().addToHistoryTreatment(detailedBolusInfo);
log.debug((newRecord ? "**NEW** " : "") + "EVENT BOLUS (" + recordCode + ") " + datetime.toLocaleString() + " Bolus: " + (param1 / 100d) + "U Duration: " + param2 + "min");
DetailedBolusInfoStorage.remove(detailedBolusInfo.date);
status = "BOLUS " + DateUtil.timeString(datetime);
break;
case DanaRPump.DUALBOLUS:
detailedBolusInfo.insulin = param1 / 100d;
newRecord = MainApp.getConfigBuilder().addToHistoryTreatment(detailedBolusInfo);
log.debug((newRecord ? "**NEW** " : "") + "EVENT DUALBOLUS (" + recordCode + ") " + datetime.toLocaleString() + " Bolus: " + (param1 / 100d) + "U Duration: " + param2 + "min");
DetailedBolusInfoStorage.remove(detailedBolusInfo.date);
status = "DUALBOLUS " + DateUtil.timeString(datetime);
break;
case DanaRPump.DUALEXTENDEDSTART:
log.debug("EVENT DUALEXTENDEDSTART (" + recordCode + ") " + datetime.toLocaleString() + " Amount: " + (param1 / 100d) + "U Duration: " + param2 + "min");
extendedBolus.insulin = param1 / 100d;
extendedBolus.durationInMinutes = param2;
MainApp.getConfigBuilder().addToHistoryExtendedBolus(extendedBolus);
status = "DUALEXTENDEDSTART " + DateUtil.timeString(datetime);
break;
case DanaRPump.DUALEXTENDEDSTOP:
log.debug("EVENT DUALEXTENDEDSTOP (" + recordCode + ") " + datetime.toLocaleString() + " Delivered: " + (param1 / 100d) + "U RealDuration: " + param2 + "min");
MainApp.getConfigBuilder().addToHistoryExtendedBolus(extendedBolus);
status = "DUALEXTENDEDSTOP " + DateUtil.timeString(datetime);
break;
case DanaRPump.SUSPENDON:
log.debug("EVENT SUSPENDON (" + recordCode + ") " + datetime.toLocaleString());
status = "SUSPENDON " + DateUtil.timeString(datetime);
break;
case DanaRPump.SUSPENDOFF:
log.debug("EVENT SUSPENDOFF (" + recordCode + ") " + datetime.toLocaleString());
status = "SUSPENDOFF " + DateUtil.timeString(datetime);
break;
case DanaRPump.REFILL:
log.debug("EVENT REFILL (" + recordCode + ") " + datetime.toLocaleString() + " Amount: " + param1 / 100d + "U");
status = "REFILL " + DateUtil.timeString(datetime);
break;
case DanaRPump.PRIME:
log.debug("EVENT PRIME (" + recordCode + ") " + datetime.toLocaleString() + " Amount: " + param1 / 100d + "U");
status = "PRIME " + DateUtil.timeString(datetime);
break;
case DanaRPump.PROFILECHANGE:
log.debug("EVENT PROFILECHANGE (" + recordCode + ") " + datetime.toLocaleString() + " No: " + param1 + " CurrentRate: " + (param2 / 100d) + "U/h");
status = "PROFILECHANGE " + DateUtil.timeString(datetime);
break;
case DanaRPump.CARBS:
DetailedBolusInfo emptyCarbsInfo = new DetailedBolusInfo();
@ -170,17 +186,22 @@ public class DanaRS_Packet_APS_History_Events extends DanaRS_Packet {
emptyCarbsInfo.pumpId = datetime.getTime();
newRecord = MainApp.getConfigBuilder().addToHistoryTreatment(emptyCarbsInfo);
log.debug((newRecord ? "**NEW** " : "") + "EVENT CARBS (" + recordCode + ") " + datetime.toLocaleString() + " Carbs: " + param1 + "g");
status = "CARBS " + DateUtil.timeString(datetime);
break;
case DanaRPump.PRIMECANNULA:
log.debug("EVENT PRIME CANNULA(" + recordCode + ") " + datetime.toLocaleString() + " Amount: " + param1 / 100d + "U");
log.debug("EVENT PRIMECANNULA(" + recordCode + ") " + datetime.toLocaleString() + " Amount: " + param1 / 100d + "U");
status = "PRIMECANNULA " + DateUtil.timeString(datetime);
break;
default:
log.debug("Event: " + recordCode + " " + datetime.toLocaleString() + " Param1: " + param1 + " Param2: " + param2);
status = "UNKNOWN " + DateUtil.timeString(datetime);
break;
}
if (datetime.getTime() > lastEventTimeLoaded)
lastEventTimeLoaded = datetime.getTime();
MainApp.bus().post(new EventPumpStatusChanged(MainApp.sResources.getString(R.string.processinghistory) + ": " + status));
}
@Override

View file

@ -61,9 +61,9 @@ public class DanaRS_Packet_APS_Set_Event_History extends DanaRS_Packet {
@Override
public void handleMessage(byte[] data) {
int result = intFromBuff(data, 0, 1);
if (result != 1) {
if (result != 0) {
failed = true;
log.debug("Set history entry result: " + result + " FAILED!!!");
log.error("Set history entry result: " + result + " FAILED!!!");
} else {
if (Config.logDanaMessageDetail)
log.debug("Set history entry result: " + result);

View file

@ -4,13 +4,13 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import info.nightscout.androidaps.Config;
import com.cozmo.danar.util.BleCommandUtil;
public class DanaRS_Packet_Basal_Set_Basal_Rate extends DanaRS_Packet {
private static Logger log = LoggerFactory.getLogger(DanaRS_Packet_Basal_Set_Basal_Rate.class);
private double[] profileBasalRate;
public int error;
public DanaRS_Packet_Basal_Set_Basal_Rate() {
super();
@ -38,11 +38,12 @@ public class DanaRS_Packet_Basal_Set_Basal_Rate extends DanaRS_Packet {
@Override
public void handleMessage(byte[] data) {
int dataIndex = DATA_START;
int dataSize = 1;
error = byteArrayToInt(getBytes(data, dataIndex, dataSize));
int result = intFromBuff(data, 0, 1);
if (Config.logDanaMessageDetail) {
log.debug("Result: " + error);
if (result == 0)
log.debug("Result OK");
else
log.error("Result Error: " + result);
}
}

View file

@ -10,8 +10,6 @@ import com.cozmo.danar.util.BleCommandUtil;
public class DanaRS_Packet_Basal_Set_Cancel_Temporary_Basal extends DanaRS_Packet {
private static Logger log = LoggerFactory.getLogger(DanaRS_Packet_Basal_Set_Cancel_Temporary_Basal.class);
public int error;
public DanaRS_Packet_Basal_Set_Cancel_Temporary_Basal() {
super();
opCode = BleCommandUtil.DANAR_PACKET__OPCODE_BASAL__CANCEL_TEMPORARY_BASAL;
@ -22,9 +20,12 @@ public class DanaRS_Packet_Basal_Set_Cancel_Temporary_Basal extends DanaRS_Packe
@Override
public void handleMessage(byte[] data) {
error = byteArrayToInt(getBytes(data, DATA_START, 1));
int result = intFromBuff(data, 0, 1);
if (Config.logDanaMessageDetail) {
log.debug("Result " + error);
if (result == 0)
log.debug("Result OK");
else
log.error("Result Error: " + result);
}
}

View file

@ -11,7 +11,6 @@ public class DanaRS_Packet_Basal_Set_Profile_Basal_Rate extends DanaRS_Packet {
private int profileNumber; // 0 - 4
private double[] profileBasalRate;
public int error;
public DanaRS_Packet_Basal_Set_Profile_Basal_Rate() {
super();
@ -41,11 +40,12 @@ public class DanaRS_Packet_Basal_Set_Profile_Basal_Rate extends DanaRS_Packet {
@Override
public void handleMessage(byte[] data) {
int dataIndex = DATA_START;
int dataSize = 1;
error = byteArrayToInt(getBytes(data, dataIndex, dataSize));
int result = intFromBuff(data, 0, 1);
if (Config.logDanaMessageDetail) {
log.debug("Result: " + error);
if (result == 0)
log.debug("Result OK");
else
log.error("Result Error: " + result);
}
}

View file

@ -10,7 +10,6 @@ import com.cozmo.danar.util.BleCommandUtil;
public class DanaRS_Packet_Basal_Set_Profile_Number extends DanaRS_Packet {
private static Logger log = LoggerFactory.getLogger(DanaRS_Packet_Basal_Set_Profile_Number.class);
private int profileNumber;
public int error;
public DanaRS_Packet_Basal_Set_Profile_Number() {
super();
@ -33,11 +32,12 @@ public class DanaRS_Packet_Basal_Set_Profile_Number extends DanaRS_Packet {
@Override
public void handleMessage(byte[] data) {
int dataIndex = DATA_START;
int dataSize = 1;
error = byteArrayToInt(getBytes(data, dataIndex, dataSize));
int result = intFromBuff(data, 0, 1);
if (Config.logDanaMessageDetail) {
log.debug("Result: " + error);
if (result == 0)
log.debug("Result OK");
else
log.error("Result Error: " + result);
}
}

View file

@ -8,7 +8,6 @@ import com.cozmo.danar.util.BleCommandUtil;
public class DanaRS_Packet_Basal_Set_Suspend_Off extends DanaRS_Packet {
private static Logger log = LoggerFactory.getLogger(DanaRS_Packet_Basal_Set_Suspend_Off.class);
public int error;
public DanaRS_Packet_Basal_Set_Suspend_Off() {
super();
@ -20,11 +19,12 @@ public class DanaRS_Packet_Basal_Set_Suspend_Off extends DanaRS_Packet {
@Override
public void handleMessage(byte[] data) {
int dataIndex = DATA_START;
int dataSize = 1;
error = byteArrayToInt(getBytes(data, dataIndex, dataSize));
int result = intFromBuff(data, 0, 1);
if (Config.logDanaMessageDetail) {
log.debug("Result: " + error);
if (result == 0)
log.debug("Result OK");
else
log.error("Result Error: " + result);
}
}

View file

@ -8,7 +8,6 @@ import com.cozmo.danar.util.BleCommandUtil;
public class DanaRS_Packet_Basal_Set_Suspend_On extends DanaRS_Packet {
private static Logger log = LoggerFactory.getLogger(DanaRS_Packet_Basal_Set_Suspend_On.class);
public int error;
public DanaRS_Packet_Basal_Set_Suspend_On() {
super();
@ -20,11 +19,12 @@ public class DanaRS_Packet_Basal_Set_Suspend_On extends DanaRS_Packet {
@Override
public void handleMessage(byte[] data) {
int dataIndex = DATA_START;
int dataSize = 1;
error = byteArrayToInt(getBytes(data, dataIndex, dataSize));
int result = intFromBuff(data, 0, 1);
if (Config.logDanaMessageDetail) {
log.debug("Result: " + error);
if (result == 0)
log.debug("Result OK");
else
log.error("Result Error: " + result);
}
}

View file

@ -11,7 +11,6 @@ public class DanaRS_Packet_Basal_Set_Temporary_Basal extends DanaRS_Packet {
private int temporaryBasalRatio;
private int temporaryBasalDuration;
public int error;
public DanaRS_Packet_Basal_Set_Temporary_Basal() {
super();
@ -37,11 +36,12 @@ public class DanaRS_Packet_Basal_Set_Temporary_Basal extends DanaRS_Packet {
@Override
public void handleMessage(byte[] data) {
int dataIndex = DATA_START;
int dataSize = 1;
error = byteArrayToInt(getBytes(data, dataIndex, dataSize));
int result = intFromBuff(data, 0, 1);
if (Config.logDanaMessageDetail) {
log.debug("Result: " + error);
if (result == 0)
log.debug("Result OK");
else
log.error("Result Error: " + result);
}
}

View file

@ -111,12 +111,12 @@ public class DanaRS_Packet_Bolus_Set_Bolus_Option extends DanaRS_Packet {
@Override
public void handleMessage(byte[] data) {
int dataIndex = DATA_START;
int dataSize = 1;
int status = byteArrayToInt(getBytes(data, dataIndex, dataSize));
int result = intFromBuff(data, 0, 1);
if (Config.logDanaMessageDetail) {
log.debug("Result: " + status);
if (result == 0)
log.debug("Result OK");
else
log.error("Result Error: " + result);
}
}

View file

@ -83,12 +83,12 @@ public class DanaRS_Packet_Bolus_Set_CIR_CF_Array extends DanaRS_Packet {
@Override
public void handleMessage(byte[] data) {
int dataIndex = DATA_START;
int dataSize = 1;
int status = byteArrayToInt(getBytes(data, dataIndex, dataSize));
int result = intFromBuff(data, 0, 1);
if (Config.logDanaMessageDetail) {
log.debug("Result: " + status);
if (result == 0)
log.debug("Result OK");
else
log.error("Result Error: " + result);
}
}

View file

@ -44,12 +44,12 @@ public class DanaRS_Packet_Bolus_Set_Dual_Bolus extends DanaRS_Packet {
@Override
public void handleMessage(byte[] data) {
int dataIndex = DATA_START;
int dataSize = 1;
int status = byteArrayToInt(getBytes(data, dataIndex, dataSize));
int result = intFromBuff(data, 0, 1);
if (Config.logDanaMessageDetail) {
log.debug("Result: " + status);
if (result == 0)
log.debug("Result OK");
else
log.error("Result Error: " + result);
}
}

View file

@ -40,12 +40,12 @@ public class DanaRS_Packet_Bolus_Set_Extended_Bolus extends DanaRS_Packet {
@Override
public void handleMessage(byte[] data) {
int dataIndex = DATA_START;
int dataSize = 1;
int status = byteArrayToInt(getBytes(data, dataIndex, dataSize));
int result = intFromBuff(data, 0, 1);
if (Config.logDanaMessageDetail) {
log.debug("Result: " + status);
if (result == 0)
log.debug("Result OK");
else
log.error("Result Error: " + result);
}
}

View file

@ -19,12 +19,12 @@ public class DanaRS_Packet_Bolus_Set_Extended_Bolus_Cancel extends DanaRS_Packet
@Override
public void handleMessage(byte[] data) {
int dataIndex = DATA_START;
int dataSize = 1;
int status = byteArrayToInt(getBytes(data, dataIndex, dataSize));
int result = intFromBuff(data, 0, 1);
if (Config.logDanaMessageDetail) {
log.debug("Result: " + status);
if (result == 0)
log.debug("Result OK");
else
log.error("Result Error: " + result);
}
}

View file

@ -44,12 +44,12 @@ public class DanaRS_Packet_Bolus_Set_Initial_Bolus extends DanaRS_Packet {
@Override
public void handleMessage(byte[] data) {
int dataIndex = DATA_START;
int dataSize = 1;
int status = byteArrayToInt(getBytes(data, dataIndex, dataSize));
int result = intFromBuff(data, 0, 1);
if (Config.logDanaMessageDetail) {
log.debug("Result: " + status);
if (result == 0)
log.debug("Result OK");
else
log.error("Result Error: " + result);
}
}

View file

@ -48,14 +48,12 @@ public class DanaRS_Packet_Bolus_Set_Step_Bolus_Start extends DanaRS_Packet {
}
@Override
public void handleMessage(byte[] data) {
int dataIndex = DATA_START;
int dataSize = 1;
int status = byteArrayToInt(getBytes(data, dataIndex, dataSize));
failed = status != 0x00;
int result = intFromBuff(data, 0, 1);
if (Config.logDanaMessageDetail) {
log.debug("Result: " + status);
if (result == 0)
log.debug("Result OK");
else
log.error("Result Error: " + result);
}
}

View file

@ -35,13 +35,14 @@ public class DanaRS_Packet_Bolus_Set_Step_Bolus_Stop extends DanaRS_Packet {
@Override
public void handleMessage(byte[] data) {
int dataIndex = DATA_START;
int dataSize = 1;
int status = byteArrayToInt(getBytes(data, dataIndex, dataSize));
int result = intFromBuff(data, 0, 1);
if (Config.logDanaMessageDetail) {
log.debug("Result: " + status);
if (result == 0)
log.debug("Result OK");
else
log.error("Result Error: " + result);
}
EventOverviewBolusProgress bolusingEvent = EventOverviewBolusProgress.getInstance();
stopped = true;
if (!forced) {

View file

@ -31,12 +31,12 @@ public class DanaRS_Packet_General_Set_History_Upload_Mode extends DanaRS_Packet
@Override
public void handleMessage(byte[] data) {
int dataIndex = DATA_START;
int dataSize = 1;
int status = byteArrayToInt(getBytes(data, dataIndex, dataSize));
int result = intFromBuff(data, 0, 1);
if (Config.logDanaMessageDetail) {
log.debug("Result: " + status);
if (result == 0)
log.debug("Result OK");
else
log.error("Result Error: " + result);
}
}

View file

@ -17,12 +17,12 @@ public class DanaRS_Packet_General_Set_User_Time_Change_Flag_Clear extends DanaR
@Override
public void handleMessage(byte[] data) {
int dataIndex = DATA_START;
int dataSize = 1;
int status = byteArrayToInt(getBytes(data, dataIndex, dataSize));
int result = intFromBuff(data, 0, 1);
if (Config.logDanaMessageDetail) {
log.debug("Result: " + status);
if (result == 0)
log.debug("Result OK");
else
log.error("Result Error: " + result);
}
}

View file

@ -45,7 +45,10 @@ public class DanaRS_Packet_Option_Set_Pump_Time extends DanaRS_Packet {
int dataSize = 1;
error = byteArrayToInt(getBytes(data, dataIndex, dataSize));
if (Config.logDanaMessageDetail) {
log.debug("Result: " + error);
if (error == 0)
log.debug("Result OK");
else
log.error("Result Error: " + error);
}
}

View file

@ -47,7 +47,10 @@ public class DanaRS_Packet_Option_Set_User_Option extends DanaRS_Packet {
int dataSize = 1;
error = byteArrayToInt(getBytes(data, dataIndex, dataSize));
if (Config.logDanaMessageDetail) {
log.debug("Result: " + error);
if (error == 0)
log.debug("Result OK");
else
log.error("Result Error: " + error);
}
}

View file

@ -165,19 +165,6 @@ public class BLEComm {
MainApp.bus().post(new EventPumpStatusChanged(EventPumpStatusChanged.CONNECTING));
isConnecting = true;
// Following should be removed later because we close Gatt on disconnect and this should never happen
if ((mBluetoothDeviceAddress != null) && (address.equals(mBluetoothDeviceAddress)) && (mBluetoothGatt != null)) {
log.debug("Trying to use an existing mBluetoothGatt for connection.");
sHandler.post(updateProgress);
if (mBluetoothGatt.connect()) {
setCharacteristicNotification(getUARTReadBTGattChar(), true);
return true;
}
sHandler.removeCallbacks(updateProgress);
return false;
}
// end
BluetoothDevice device = mBluetoothAdapter.getRemoteDevice(address);
if (device == null) {
log.debug("Device not found. Unable to connect.");
@ -201,12 +188,19 @@ public class BLEComm {
public void disconnect(String from) {
log.debug("disconnect from: " + from);
// cancel previous scheduled disconnection to prevent closing upcomming connection
if (scheduledDisconnection != null)
scheduledDisconnection.cancel(false);
scheduledDisconnection = null;
if ((mBluetoothAdapter == null) || (mBluetoothGatt == null)) {
return;
}
setCharacteristicNotification(getUARTReadBTGattChar(), false);
mBluetoothGatt.disconnect();
isConnected = false;
SystemClock.sleep(2000);
}
public void close() {
@ -214,6 +208,7 @@ public class BLEComm {
if (mBluetoothGatt == null) {
return;
}
mBluetoothGatt.close();
mBluetoothGatt = null;
}
@ -687,18 +682,19 @@ public class BLEComm {
}
public void scheduleDisconnection() {
class DisconnectRunnable implements Runnable {
public void run() {
disconnect("scheduleDisconnection");
scheduledDisconnection = null;
}
}
// prepare task for execution in 5 sec
// prepare task for execution in 30 sec
// cancel waiting task to prevent sending multiple disconnections
if (scheduledDisconnection != null)
scheduledDisconnection.cancel(false);
Runnable task = new DisconnectRunnable();
final int sec = 5;
final int sec = 30;
scheduledDisconnection = worker.schedule(task, sec, TimeUnit.SECONDS);
log.debug("Disconnection scheduled");
}

View file

@ -26,6 +26,7 @@ import info.nightscout.androidaps.events.EventInitializationChanged;
import info.nightscout.androidaps.events.EventPumpStatusChanged;
import info.nightscout.androidaps.plugins.Overview.Notification;
import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification;
import info.nightscout.androidaps.plugins.Overview.events.EventOverviewBolusProgress;
import info.nightscout.androidaps.plugins.PumpDanaR.DanaRPump;
import info.nightscout.androidaps.plugins.PumpDanaR.comm.RecordTypes;
import info.nightscout.androidaps.plugins.PumpDanaR.events.EventDanaRNewStatus;
@ -188,16 +189,16 @@ public class DanaRSService extends Service {
while (!msg.done && bleComm.isConnected()) {
SystemClock.sleep(100);
}
SystemClock.sleep(200);
lastHistoryFetched = DanaRS_Packet_APS_History_Events.lastEventTimeLoaded;
return true;
}
public boolean bolus(double insulin, int carbs, long carbtime, Treatment t) {
public boolean bolus(final double insulin, int carbs, long carbtime, Treatment t) {
MainApp.bus().post(new EventPumpStatusChanged(MainApp.sResources.getString(R.string.startingbolus)));
bolusingTreatment = t;
int speed = SP.getInt(R.string.key_danars_bolusspeed, 0);
DanaRS_Packet_Bolus_Set_Step_Bolus_Start start = new DanaRS_Packet_Bolus_Set_Step_Bolus_Start(insulin, speed);
final int preferencesSpeed = SP.getInt(R.string.key_danars_bolusspeed, 0);
DanaRS_Packet_Bolus_Set_Step_Bolus_Start start = new DanaRS_Packet_Bolus_Set_Step_Bolus_Start(insulin, preferencesSpeed);
DanaRS_Packet_Bolus_Set_Step_Bolus_Stop stop = new DanaRS_Packet_Bolus_Set_Step_Bolus_Stop(insulin, t); // initialize static variables
DanaRS_Packet_Notify_Delivery_Complete complete = new DanaRS_Packet_Notify_Delivery_Complete(insulin, t); // initialize static variables
@ -210,28 +211,60 @@ public class DanaRSService extends Service {
bleComm.sendMessage(msgSetHistoryEntry_v2);
lastHistoryFetched = carbtime - 60000;
}
if (insulin > 0) {
DanaRS_Packet_Notify_Delivery_Rate_Display progress = new DanaRS_Packet_Notify_Delivery_Rate_Display(insulin, t); // initialize static variables
final long bolusStart = System.currentTimeMillis();
if (insulin > 0) {
if (!stop.stopped) {
bleComm.sendMessage(start);
} else {
t.insulin = 0d;
return false;
}
DanaRS_Packet_Notify_Delivery_Rate_Display progress = new DanaRS_Packet_Notify_Delivery_Rate_Display(insulin, t); // initialize static variables
while (!stop.stopped && !start.failed && !complete.done) {
SystemClock.sleep(100);
if ((System.currentTimeMillis() - progress.lastReceive) > 5 * 1000L) { // if i didn't receive status for more than 5 sec expecting broken comm
if ((System.currentTimeMillis() - progress.lastReceive) > 15 * 1000L) { // if i didn't receive status for more than 20 sec expecting broken comm
stop.stopped = true;
stop.forced = true;
log.debug("Communication stopped");
}
}
}
SystemClock.sleep(3000);
EventOverviewBolusProgress bolusingEvent = EventOverviewBolusProgress.getInstance();
bolusingEvent.t = t;
bolusingEvent.percent = 99;
bolusingTreatment = null;
DanaRSPlugin.connectIfNotConnected("ReadHistoryAfterBolus");
int speed = 12;
switch (preferencesSpeed) {
case 0:
speed = 12;
break;
case 1:
speed = 30;
break;
case 2:
speed = 60;
break;
}
long bolusDurationInMSec = (long) (insulin * speed * 1000);
long expectedEnd = bolusStart + bolusDurationInMSec + 2000;
while (System.currentTimeMillis() < expectedEnd) {
long waitTime = expectedEnd - System.currentTimeMillis();
bolusingEvent.status = String.format(MainApp.sResources.getString(R.string.waitingforestimatedbolusend), waitTime / 1000);
MainApp.bus().post(bolusingEvent);
SystemClock.sleep(1000);
}
if (!(isConnected()))
DanaRSPlugin.getPlugin().connect("loadEvents");
loadEvents();
// reread bolus status
MainApp.bus().post(new EventPumpStatusChanged(MainApp.sResources.getString(R.string.gettingbolusstatus)));
bleComm.sendMessage(new DanaRS_Packet_Bolus_Get_Step_Bolus_Information()); // last bolus
bolusingEvent.percent = 100;
MainApp.bus().post(new EventPumpStatusChanged(MainApp.sResources.getString(R.string.disconnecting)));
return true;
}

View file

@ -293,9 +293,8 @@ public class DanaRv2Plugin implements PluginBase, PumpInterface, DanaRInterface,
ConfigBuilderPlugin configBuilderPlugin = MainApp.getConfigBuilder();
detailedBolusInfo.insulin = configBuilderPlugin.applyBolusConstraints(detailedBolusInfo.insulin);
if (detailedBolusInfo.insulin > 0 || detailedBolusInfo.carbs > 0) {
DetailedBolusInfoStorage.add(detailedBolusInfo); // will be picked up on reading history
// v2 stores end time for bolus, we need to adjust time
// default delivery speed is 12 U/min
// default delivery speed is 12 sec/U
int preferencesSpeed = SP.getInt(R.string.key_danars_bolusspeed, 0);
int speed = 12;
switch (preferencesSpeed) {
@ -309,7 +308,7 @@ public class DanaRv2Plugin implements PluginBase, PumpInterface, DanaRInterface,
speed = 60;
break;
}
detailedBolusInfo.date += detailedBolusInfo.insulin / speed * 60d * 1000;
detailedBolusInfo.date += speed * detailedBolusInfo.insulin * 1000;
// clean carbs to prevent counting them as twice because they will picked up as another record
// I don't think it's necessary to copy DetailedBolusInfo right now for carbs records
double carbs = detailedBolusInfo.carbs;
@ -317,6 +316,8 @@ public class DanaRv2Plugin implements PluginBase, PumpInterface, DanaRInterface,
int carbTime = detailedBolusInfo.carbTime;
detailedBolusInfo.carbTime = 0;
DetailedBolusInfoStorage.add(detailedBolusInfo); // will be picked up on reading history
Treatment t = new Treatment();
boolean connectionOK = false;
if (detailedBolusInfo.insulin > 0 || carbs > 0)

View file

@ -188,12 +188,12 @@ public class SerialIOThread extends Thread {
scheduledDisconnection = null;
}
}
// prepare task for execution in 5 sec
// prepare task for execution in 10 sec
// cancel waiting task to prevent sending multiple disconnections
if (scheduledDisconnection != null)
scheduledDisconnection.cancel(false);
Runnable task = new DisconnectRunnable();
final int sec = 5;
final int sec = 10;
scheduledDisconnection = worker.schedule(task, sec, TimeUnit.SECONDS);
}

View file

@ -7,13 +7,16 @@ import java.util.Date;
import java.util.GregorianCalendar;
import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R;
import info.nightscout.androidaps.data.DetailedBolusInfo;
import info.nightscout.androidaps.db.ExtendedBolus;
import info.nightscout.androidaps.db.Source;
import info.nightscout.androidaps.db.TemporaryBasal;
import info.nightscout.androidaps.events.EventPumpStatusChanged;
import info.nightscout.androidaps.plugins.ConfigBuilder.DetailedBolusInfoStorage;
import info.nightscout.androidaps.plugins.PumpDanaR.DanaRPump;
import info.nightscout.androidaps.plugins.PumpDanaR.comm.MessageBase;
import info.nightscout.utils.DateUtil;
public class MsgHistoryEvents_v2 extends MessageBase {
private static Logger log = LoggerFactory.getLogger(MsgHistoryEvents_v2.class);
@ -65,70 +68,87 @@ public class MsgHistoryEvents_v2 extends MessageBase {
DetailedBolusInfo detailedBolusInfo = DetailedBolusInfoStorage.findDetailedBolusInfo(datetime.getTime());
if (detailedBolusInfo == null) {
log.debug("DetailedBolusInfo not found for " + datetime.toLocaleString());
log.debug("Detailed bolus info not found for " + datetime.toLocaleString());
detailedBolusInfo = new DetailedBolusInfo();
} else {
log.debug("Detailed bolus info found: " + detailedBolusInfo);
}
detailedBolusInfo.date = datetime.getTime();
detailedBolusInfo.source = Source.PUMP;
detailedBolusInfo.pumpId = datetime.getTime();
String status = "";
switch (recordCode) {
case DanaRPump.TEMPSTART:
log.debug("EVENT TEMPSTART (" + recordCode + ") " + datetime.toLocaleString() + " Ratio: " + param1 + "% Duration: " + param2 + "min");
temporaryBasal.percentRate = param1;
temporaryBasal.durationInMinutes = param2;
MainApp.getConfigBuilder().addToHistoryTempBasal(temporaryBasal);
status = "TEMPSTART " + DateUtil.timeString(datetime);
break;
case DanaRPump.TEMPSTOP:
log.debug("EVENT TEMPSTOP (" + recordCode + ") " + datetime.toLocaleString());
MainApp.getConfigBuilder().addToHistoryTempBasal(temporaryBasal);
status = "TEMPSTOP " + DateUtil.timeString(datetime);
break;
case DanaRPump.EXTENDEDSTART:
log.debug("EVENT EXTENDEDSTART (" + recordCode + ") " + datetime.toLocaleString() + " Amount: " + (param1 / 100d) + "U Duration: " + param2 + "min");
extendedBolus.insulin = param1 / 100d;
extendedBolus.durationInMinutes = param2;
MainApp.getConfigBuilder().addToHistoryExtendedBolus(extendedBolus);
status = "EXTENDEDSTART " + DateUtil.timeString(datetime);
break;
case DanaRPump.EXTENDEDSTOP:
log.debug("EVENT EXTENDEDSTOP (" + recordCode + ") " + datetime.toLocaleString() + " Delivered: " + (param1 / 100d) + "U RealDuration: " + param2 + "min");
MainApp.getConfigBuilder().addToHistoryExtendedBolus(extendedBolus);
status = "EXTENDEDSTOP " + DateUtil.timeString(datetime);
break;
case DanaRPump.BOLUS:
detailedBolusInfo.insulin = param1 / 100d;
boolean newRecord = MainApp.getConfigBuilder().addToHistoryTreatment(detailedBolusInfo);
log.debug((newRecord ? "**NEW** " : "") + "EVENT BOLUS (" + recordCode + ") " + datetime.toLocaleString() + " Bolus: " + (param1 / 100d) + "U Duration: " + param2 + "min");
DetailedBolusInfoStorage.remove(detailedBolusInfo.date);
status = "BOLUS " + DateUtil.timeString(datetime);
break;
case DanaRPump.DUALBOLUS:
detailedBolusInfo.insulin = param1 / 100d;
newRecord = MainApp.getConfigBuilder().addToHistoryTreatment(detailedBolusInfo);
log.debug((newRecord ? "**NEW** " : "") + "EVENT DUALBOLUS (" + recordCode + ") " + datetime.toLocaleString() + " Bolus: " + (param1 / 100d) + "U Duration: " + param2 + "min");
DetailedBolusInfoStorage.remove(detailedBolusInfo.date);
status = "DUALBOLUS " + DateUtil.timeString(datetime);
break;
case DanaRPump.DUALEXTENDEDSTART:
log.debug("EVENT DUALEXTENDEDSTART (" + recordCode + ") " + datetime.toLocaleString() + " Amount: " + (param1 / 100d) + "U Duration: " + param2 + "min");
extendedBolus.insulin = param1 / 100d;
extendedBolus.durationInMinutes = param2;
MainApp.getConfigBuilder().addToHistoryExtendedBolus(extendedBolus);
status = "DUALEXTENDEDSTART " + DateUtil.timeString(datetime);
break;
case DanaRPump.DUALEXTENDEDSTOP:
log.debug("EVENT DUALEXTENDEDSTOP (" + recordCode + ") " + datetime.toLocaleString() + " Delivered: " + (param1 / 100d) + "U RealDuration: " + param2 + "min");
MainApp.getConfigBuilder().addToHistoryExtendedBolus(extendedBolus);
status = "DUALEXTENDEDSTOP " + DateUtil.timeString(datetime);
break;
case DanaRPump.SUSPENDON:
log.debug("EVENT SUSPENDON (" + recordCode + ") " + datetime.toLocaleString());
status = "SUSPENDON " + DateUtil.timeString(datetime);
break;
case DanaRPump.SUSPENDOFF:
log.debug("EVENT SUSPENDOFF (" + recordCode + ") " + datetime.toLocaleString());
status = "SUSPENDOFF " + DateUtil.timeString(datetime);
break;
case DanaRPump.REFILL:
log.debug("EVENT REFILL (" + recordCode + ") " + datetime.toLocaleString() + " Amount: " + param1 / 100d + "U");
status = "REFILL " + DateUtil.timeString(datetime);
break;
case DanaRPump.PRIME:
log.debug("EVENT PRIME (" + recordCode + ") " + datetime.toLocaleString() + " Amount: " + param1 / 100d + "U");
status = "PRIME " + DateUtil.timeString(datetime);
break;
case DanaRPump.PROFILECHANGE:
log.debug("EVENT PROFILECHANGE (" + recordCode + ") " + datetime.toLocaleString() + " No: " + param1 + " CurrentRate: " + (param2 / 100d) + "U/h");
status = "PROFILECHANGE " + DateUtil.timeString(datetime);
break;
case DanaRPump.CARBS:
DetailedBolusInfo emptyCarbsInfo = new DetailedBolusInfo();
@ -138,14 +158,17 @@ public class MsgHistoryEvents_v2 extends MessageBase {
emptyCarbsInfo.pumpId = datetime.getTime();
newRecord = MainApp.getConfigBuilder().addToHistoryTreatment(emptyCarbsInfo);
log.debug((newRecord ? "**NEW** " : "") + "EVENT CARBS (" + recordCode + ") " + datetime.toLocaleString() + " Carbs: " + param1 + "g");
status = "CARBS " + DateUtil.timeString(datetime);
break;
default:
log.debug("Event: " + recordCode + " " + datetime.toLocaleString() + " Param1: " + param1 + " Param2: " + param2);
status = "UNKNOWN " + DateUtil.timeString(datetime);
break;
}
if (datetime.getTime() > lastEventTimeLoaded)
lastEventTimeLoaded = datetime.getTime();
MainApp.bus().post(new EventPumpStatusChanged(MainApp.sResources.getString(R.string.processinghistory) + ": " + status));
}
}

View file

@ -36,6 +36,7 @@ import info.nightscout.androidaps.interfaces.PluginBase;
import info.nightscout.androidaps.data.Profile;
import info.nightscout.androidaps.plugins.Overview.Notification;
import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification;
import info.nightscout.androidaps.plugins.Overview.events.EventOverviewBolusProgress;
import info.nightscout.androidaps.plugins.PumpDanaR.DanaRPump;
import info.nightscout.androidaps.plugins.PumpDanaR.comm.*;
import info.nightscout.androidaps.plugins.PumpDanaR.events.EventDanaRNewStatus;
@ -261,13 +262,13 @@ public class DanaRv2ExecutionService extends Service {
}
}
MainApp.bus().post(new EventPumpStatusChanged(MainApp.sResources.getString(R.string.gettingbolusstatus)));
mSerialIOThread.sendMessage(statusMsg);
mSerialIOThread.sendMessage(statusBasicMsg);
MainApp.bus().post(new EventPumpStatusChanged(MainApp.sResources.getString(R.string.gettingtempbasalstatus)));
mSerialIOThread.sendMessage(tempStatusMsg);
MainApp.bus().post(new EventPumpStatusChanged(MainApp.sResources.getString(R.string.gettingextendedbolusstatus)));
mSerialIOThread.sendMessage(exStatusMsg);
MainApp.bus().post(new EventPumpStatusChanged(MainApp.sResources.getString(R.string.gettingbolusstatus)));
if (!statusMsg.received) {
mSerialIOThread.sendMessage(statusMsg);
@ -400,14 +401,15 @@ public class DanaRv2ExecutionService extends Service {
return true;
}
public boolean bolus(double amount, int carbs, long carbtime, Treatment t) {
public boolean bolus(final double amount, int carbs, long carbtime, Treatment t) {
MainApp.bus().post(new EventPumpStatusChanged(MainApp.sResources.getString(R.string.startingbolus)));
bolusingTreatment = t;
int speed = SP.getInt(R.string.key_danars_bolusspeed, 0);
final int preferencesSpeed = SP.getInt(R.string.key_danars_bolusspeed, 0);
MessageBase start;
if (speed == 0)
if (preferencesSpeed == 0)
start = new MsgBolusStart(amount);
else
start = new MsgBolusStartWithSpeed(amount, speed);
start = new MsgBolusStartWithSpeed(amount, preferencesSpeed);
MsgBolusStop stop = new MsgBolusStop(amount, t);
connect("bolus");
@ -420,6 +422,8 @@ public class DanaRv2ExecutionService extends Service {
mSerialIOThread.sendMessage(msgSetHistoryEntry_v2);
lastHistoryFetched = carbtime - 60000;
}
final long bolusStart = System.currentTimeMillis();
if (amount > 0) {
MsgBolusProgress progress = new MsgBolusProgress(amount, t); // initialize static variables
@ -431,26 +435,49 @@ public class DanaRv2ExecutionService extends Service {
}
while (!stop.stopped && !start.failed) {
waitMsec(100);
if ((System.currentTimeMillis() - progress.lastReceive) > 5 * 1000L) { // if i didn't receive status for more than 5 sec expecting broken comm
if ((System.currentTimeMillis() - progress.lastReceive) > 15 * 1000L) { // if i didn't receive status for more than 5 sec expecting broken comm
stop.stopped = true;
stop.forced = true;
log.debug("Communication stopped");
}
}
}
EventOverviewBolusProgress bolusingEvent = EventOverviewBolusProgress.getInstance();
bolusingEvent.t = t;
bolusingEvent.percent = 99;
bolusingTreatment = null;
// run loading history in separate thread and allow bolus dialog to be closed
new Thread(new Runnable() {
@Override
public void run() {
waitMsec(4000);
if (!(isConnected()))
connect("loadEvents");
loadEvents();
}
}).start();
int speed = 12;
switch (preferencesSpeed) {
case 0:
speed = 12;
break;
case 1:
speed = 30;
break;
case 2:
speed = 60;
break;
}
long bolusDurationInMSec = (long) (amount * speed * 1000);
long expectedEnd = bolusStart + bolusDurationInMSec + 2000;
while (System.currentTimeMillis() < expectedEnd) {
long waitTime = expectedEnd - System.currentTimeMillis();
bolusingEvent.status = String.format(MainApp.sResources.getString(R.string.waitingforestimatedbolusend), waitTime / 1000);
MainApp.bus().post(bolusingEvent);
SystemClock.sleep(1000);
}
if (!(isConnected()))
connect("loadEvents");
loadEvents();
// load last bolus status
MainApp.bus().post(new EventPumpStatusChanged(MainApp.sResources.getString(R.string.gettingbolusstatus)));
mSerialIOThread.sendMessage(new MsgStatus());
bolusingEvent.percent = 100;
MainApp.bus().post(new EventPumpStatusChanged(MainApp.sResources.getString(R.string.disconnecting)));
return true;
}
}
public void bolusStop() {
if (Config.logDanaBTComm)

View file

@ -5,11 +5,9 @@ import android.support.v4.util.LongSparseArray;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import info.nightscout.androidaps.Config;
import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R;
import info.nightscout.androidaps.data.Profile;
@ -32,7 +30,7 @@ public class SensitivityWeightedAveragePlugin implements PluginBase, Sensitivity
private boolean fragmentEnabled = true;
private boolean fragmentVisible = false;
static SensitivityWeightedAveragePlugin plugin = null;
private static SensitivityWeightedAveragePlugin plugin = null;
public static SensitivityWeightedAveragePlugin getPlugin() {
if (plugin == null)
@ -108,13 +106,15 @@ public class SensitivityWeightedAveragePlugin implements PluginBase, Sensitivity
int hoursForDetection = SP.getInt(R.string.key_openapsama_autosens_period, defaultHours);
if (autosensDataTable == null || autosensDataTable.size() < 4) {
log.debug("No autosens data available");
if (Config.logAutosensData)
log.debug("No autosens data available");
return new AutosensResult();
}
AutosensData current = IobCobCalculatorPlugin.getAutosensData(toTime);
if (current == null) {
log.debug("No autosens data available");
if (Config.logAutosensData)
log.debug("No autosens data available");
return new AutosensResult();
}
@ -181,9 +181,10 @@ public class SensitivityWeightedAveragePlugin implements PluginBase, Sensitivity
double sens = profile.getIsf();
String ratioLimit = "";
String sensResult = "";
String sensResult;
log.debug("Records: " + index + " " + pastSensitivity);
if (Config.logAutosensData)
log.debug("Records: " + index + " " + pastSensitivity);
double average = weightedsum / weights;
double basalOff = average * (60 / 5) / Profile.toMgdl(sens, profile.getUnits());
@ -197,7 +198,8 @@ public class SensitivityWeightedAveragePlugin implements PluginBase, Sensitivity
sensResult = "Sensitivity normal";
}
log.debug(sensResult);
if (Config.logAutosensData)
log.debug(sensResult);
double rawRatio = ratio;
ratio = Math.max(ratio, SafeParse.stringToDouble(SP.getString("openapsama_autosens_min", "0.7")));
@ -205,10 +207,12 @@ public class SensitivityWeightedAveragePlugin implements PluginBase, Sensitivity
if (ratio != rawRatio) {
ratioLimit = "Ratio limited from " + rawRatio + " to " + ratio;
log.debug(ratioLimit);
if (Config.logAutosensData)
log.debug(ratioLimit);
}
log.debug("Sensitivity to: " + new Date(toTime).toLocaleString() + " weightedaverage: " + average + " ratio: " + ratio);
if (Config.logAutosensData)
log.debug("Sensitivity to: " + new Date(toTime).toLocaleString() + " weightedaverage: " + average + " ratio: " + ratio);
AutosensResult output = new AutosensResult();
output.ratio = Round.roundTo(ratio, 0.01);

View file

@ -11,7 +11,7 @@
<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="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="objectives_objective_label_string">Цел:</string>
@ -71,10 +71,10 @@
<string name="rate">Стойност</string>
<string name="duration">Срок</string>
<string name="reason">Основание</string>
<string name="glucose">КЗ</string>
<string name="delta">Промяна</string>
<string name="glucose">Кръвна захар</string>
<string name="delta">Изменение (Δ)</string>
<string name="sms_delta">Delta:</string>
<string name="avgdelta">Средна промяна</string>
<string name="avgdelta">Средно изменение (Δ),</string>
<string name="configbuilder">Конфигурация</string>
<string name="objectives">Цели</string>
<string name="openapsma">OpenAPS MA</string>
@ -85,8 +85,6 @@
<string name="treatments">Лечения</string>
<string name="virtualpump">Виртуална помпа</string>
<string name="careportal">Careportal</string>
<string name="configbuilder_pump">Помпа</string>
<string name="configbuilder_treatments">Treatments</string>
<string name="configbuilder_tempbasals">Временен базал</string>
@ -140,7 +138,7 @@
<string name="unsupportednsversion">Несъвместима версия на Nightscout</string>
<string name="nsclientnotinstalled">NSClient не е открит. Записът е загубен!</string>
<string name="objectives_bgavailableinns">КЗ да се вижда в NS</string>
<string name="objectives_pumpstatusavailableinns">Статуса на помпа да е достъпен в NS</string>
<string name="objectives_pumpstatusavailableinns">Статуса на помпата да е достъпен в NS</string>
<string name="objectives_manualenacts">Ръчно приложени</string>
<string name="loopdisabled">LOOP Е СПРЯН ОТ ОГРАНИЧЕНИЯТА</string>
<string name="cs_lang">Czech</string>
@ -370,7 +368,7 @@
<string name="open_settings_on_wear">Отвори настройките на часовника</string>
<string name="pumperror">Грешка в промпата</string>
<string name="lowbattery">Изтощена батерия</string>
<string name="pumpshutdown">Помпа изключена</string>
<string name="pumpshutdown">Помпата е изключена</string>
<string name="batterydischarged">Батерията на помпата е изтощена</string>
<string name="danarkoreanpump">DanaR Korean</string>
<string name="wrongpumpdriverselected">Избран е грешен тип помпа</string>
@ -448,7 +446,7 @@
<string name="openapsama_autosens_adjusttargets_summary">По подразбиране: разрешено\nТова позволява на autosens да променя и целевите КЗ(освен чувствителност и базал).</string>
<string name="openapsama_bolussnooze_dia_divisor_summary">По подразбиране: 2\nBolus snooze се активира след като поставите болус за основно хранене, така Loop няма да пуснка/намаля базалите веднага след като сте се хранили. Примерът тук е с 2; така при 3 часа DIA това ще означава че bolus snooze ще бъде внимателно изместен 1.5 часа (3DIA/2).</string>
<string name="openapsama_min_5m_carbimpact_summary">По подразбиране: 3.0\nТова е настройка на количеството на покачване на КЗ при усвояване на въглехидратите за всеки 5 минути. По подразбиране 3мг/дл/5мин. Това се отразява на това колко бързо се усвояват COB според алгоритъма, и как това се отразява в предвиждането на КЗ, когато тя не се покачва или пада с различен темп от очакваното.</string>
<string name="openapsama_link_to_preferncejson_doc_txt">Attention!\nNormally you do not have to change these values below. Please CLICK HERE and READ the text and make sure you UNDERSTAND it before change any of these values.</string>
<string name="openapsama_link_to_preferncejson_doc_txt">Внимание! Обикновено Вие не трябва да променяте тези стойности. Моля НАТИСНЕТЕ ТУК, прочетете текста и бъдете сигурни, че го РАЗБИРАТЕ преди да направите каквито и да е промени!</string>
<string name="openapsama_link_to_preferncejson_doc">http://openaps.readthedocs.io/en/latest/docs/walkthrough/phase-3/beyond-low-glucose-suspend.html</string>
<string name="error_only_numeric_digits_allowed">Позволени са само числа</string>
<string name="error_only_numeric_digits_range_allowed" formatted="false">Позволени са числа между %1$s - %2$s</string>
@ -529,7 +527,7 @@
<string name="smscommunicator_wrongduration">Wrong duration</string>
<string name="smscommunicator_loopsuspended">Loop suspended</string>
<string name="smscommunicator_loopresumed">Loop resumed</string>
<string name="treatments_wizard_bgtrend_label">промяна за 15мин</string>
<string name="treatments_wizard_bgtrend_label">Δ за 15мин</string>
<string name="treatments_wizard_cob_label">COB</string>
<string name="superbolus">Суперболус</string>
<string name="ns_logappstartedevent">Записвай всяко стартиране на AndroidAPS в NS</string>
@ -649,4 +647,36 @@
<string name="sv_lang">Swedish</string>
<string name="ultrafastactinginsulincomment">Fiasp</string>
<string name="ultrarapid_oref">Ултра бързодействащ по Oref</string>
<string name="activity_duration">време за физ. активност</string>
<string name="activity_target">Целева КЗ при физ. активност</string>
<string name="bolusspeed">Скорост на болус</string>
<string name="careportal_newnstreatment_percentage_label">% от профила</string>
<string name="careportal_newnstreatment_timeshift_label">Време на отместване</string>
<string name="danars_nodeviceavailable">Все още устройството не е намерено</string>
<string name="danarspump">DanaRS</string>
<string name="danarspump_shortname">Dana</string>
<string name="default_temptargets">Временна цел по подразбиране</string>
<string name="eatingsoon_duration">Време за \"Преди хранене\"</string>
<string name="eatingsoon_target">Цел за \"Преди хранене\"</string>
<string name="emptyreservoir">Празен резервоар</string>
<string name="gettingbolusstatus">Получава болус статус</string>
<string name="gettingextendedbolusstatus">Получава статус на удължен болус</string>
<string name="gettingpumpsettings">Получава настройките на помпата</string>
<string name="gettingpumptime">Получава времето на помпата</string>
<string name="gettingtempbasalstatus">Получава статус на временен базал</string>
<string name="pairing">СДВОЯВАНЕ</string>
<string name="pairingok">Сдвоени</string>
<string name="pairingtimedout">Времето за сдвояване изтече</string>
<string name="pairpump">Сдвояване с нова помпа</string>
<string name="reuse">отново</string>
<string name="selectedpump">Избрана помпа</string>
<string name="serialnumber">Сериен номер</string>
<string name="treatments_wizard_tt_label">ЛЕЧ</string>
<string name="waitingforpairing">Очаква сдвояване с помпа</string>
<string name="connectiontimedout">Времето за връзка изтече</string>
<string name="wear_overviewnotifications">Преглед на известията</string>
<string name="wear_overviewnotifications_summary">Изпращай известията като съобщения към часовника</string>
<string name="wear_settings">Настройки на часовник</string>
<string name="wearcontrol_summary">Задаване временни цели и въвеждане Лечения от часовник Android wear</string>
<string name="wearcontrol_title">Контролиране от часовник</string>
</resources>

View file

@ -659,4 +659,8 @@
<string name="wearcontrol_summary">Nastavování dočasných cílů a vkládání ošetření na hodinkách Wear</string>
<string name="wearcontrol_title">Řízení z hodinek Wear</string>
<string name="danar_model" formatted="false">Model: %02X Protokol: %02X Kód: %02X</string>
<string name="active"><![CDATA[<Aktivní>]]></string>
<string name="bloodsugarmeasurementalert">Výstraha měření glykémie</string>
<string name="connectiontimedout">Vypršel čas připojování</string>
<string name="treatments_wizard_tt_label">DC</string>
</resources>

View file

@ -165,7 +165,7 @@
<string name="loopdisabled">LOOP DEAKTIVIERT DURCH DIE BESCHRÄNKUNG</string>
<string name="loop_constraintsprocessed_label">Nach Beschränkungen</string>
<string name="loop">Loop</string>
<string name="objectives_manualenacts">Manual enacts</string>
<string name="objectives_manualenacts">Manuelle Eingriffe</string>
<string name="carbsconstraintapplied">Kohlenhydrate Beschränkung erreicht</string>
<string name="nav_resetdb">Reset Datenbanken</string>
<string name="objectives_minimalduration">Minimale Dauer</string>
@ -314,8 +314,8 @@
<string name="loop_shortname">LOOP</string>
<string name="localprofile_shortname">LP</string>
<string name="danarpump_shortname">DANA</string>
<string name="configbuilder_shortname">"CONF"</string>
<string name="circadian_percentage_profile_shortname">"CPP"</string>
<string name="configbuilder_shortname">CONF</string>
<string name="circadian_percentage_profile_shortname">CPP</string>
<string name="careportal_shortname">CP</string>
<string name="error_only_numeric_digits_allowed">Bitte verwenden Sie nur Ziffern.</string>
<string name="error_field_must_not_be_empty">Pflichtfeld</string>
@ -512,7 +512,7 @@
<string name="restart">Restart</string>
<string name="restartingapp">Beende Applikation um neue Einstellungen zu laden.</string>
<string name="resume">Fortsetzten</string>
<string name="ru_lang">Russian</string>
<string name="ru_lang">Russisch</string>
<string name="send_calibration">Kalibrierung %.1f an xDrip senden?</string>
<string name="settings_password">Passwort für die Einstellungen</string>
<string name="settingtempbasal">Setzte temp Basal</string>
@ -591,7 +591,7 @@
<string name="configbuilder_sensitivity">Empfindlichkeitserkennung</string>
<string name="cob">COB</string>
<string name="enablesuperbolus_summary">Aktiviere die SuperBolus-Funktion im Wizard. Nicht aktivieren, wenn du nicht weißt, was es macht! ES KANN ZU EINER ÜBERDOSIERUNG AN INSULIN KOMMEN, WENN DU ES BLIND BENUTZT!</string>
<string name="objectives_2_objective">"Verstehen des OpenLoops und der Temp-Basal-Empfehlungen</string>
<string name="objectives_2_objective">Verstehen des OpenLoops und der Temp-Basal-Empfehlungen</string>
<string name="openapsama_useautosens">Verwende AMA Autosense</string>
<string formatted="false" name="smscommunicator_basalreplywithcode">Um Basal mit %.2fU/h zu starten, antworte mit dem Code %s</string>
<string name="ultrafastactinginsulincomment">Fiasp</string>
@ -619,6 +619,60 @@
<string formatted="false" name="dia_too_short">DIA von %s ist zu kurz - aaps nutzt stattdessen %s!</string>
<string name="danar_stats_warning_Message">Möglicherweise ungenau, wenn zum Befüllen ein Bolus verwendet wurde!</string>
<string name="danar_stats_ratio">Verhältnis</string>
<string name="activate_profile">aktiviere Profil</string>
<string name="activity_duration">Aktivitätsdauer</string>
<string name="activity_target">Aktivitätsziel</string>
<string name="bloodsugarmeasurementalert">BZ-Messung</string>
<string name="bolusspeed">Bolus Geschwindigkeit</string>
<string name="careportal_newnstreatment_percentage_label">Prozentsatz</string>
<string name="careportal_newnstreatment_timeshift_label">Zeitverschiebung</string>
<string name="careportal_pbage_label_short">BAT</string>
<string name="circadian_percentage_profile">CircadianPercantage</string>
<string name="connectiontimedout">Verbindungs-Unterbrechungs-Dauer</string>
<string name="danar_history_prime">Füllen</string>
<string name="danar_debolus">DE Bolus</string>
<string name="danar_dsbolus">DS Bolus</string>
<string name="danar_ebolus">E Bolus</string>
<string name="danar_setbasalstep001">Basalschritt setzen zu 0.01 U/h</string>
<string name="danar_stats_tbb">Tägl. Basalmenge</string>
<string name="danar_stats_tbb2">Tägl. Basalmenge * 2</string>
<string name="danar_stats_tdd">Tägl. Gesamtdosis</string>
<string name="danars_nodeviceavailable">Gerät nicht gefunden</string>
<string name="danarspump">DanaRS</string>
<string name="danarspump_shortname">Dana</string>
<string name="date">Datum</string>
<string name="default_temptargets">Standard Temp. Ziele</string>
<string name="eatingsoon_duration">Eating Soon Dauer</string>
<string name="eatingsoon_target">Eating Soon Ziel</string>
<string name="emptyreservoir">Reservoir leer</string>
<string name="enacted">Ausgeführt</string>
<string name="gettingbolusstatus">Ermittle Bolus Status</string>
<string name="gettingextendedbolusstatus">Ermittle verz. Bolus Status</string>
<string name="gettingpumpsettings">Ermittle Pumpen Einstell.</string>
<string name="gettingpumptime">Ermittle Pumpenzeit</string>
<string name="gettingtempbasalstatus">Ermittle temp. Basal Status</string>
<string name="invalid">Ungültig</string>
<string name="long_avgdelta">Langes durchschn. Delta</string>
<string name="mdi">ICT</string>
<string name="nsclientinternal">integrierter NSClient</string>
<string name="overview_newtempbasal_basaltype_label">Basaltyp</string>
<string name="pairingtimedout">Verbindung Zeit überschritten</string>
<string name="pairpump">Verbinde neue Pumpe</string>
<string name="prefs_delta_title">Delta Einstellungen</string>
<string name="remaininsulinalert">Restinsulin</string>
<string name="reuse">erneut verwenden</string>
<string name="selectedpump">ausgewählte Pumpe</string>
<string name="serialnumber">Seriennummer</string>
<string name="waitingforpairing">auf Verbindung warten</string>
<string name="wearcontrol_summary">Setze temp. Ziele und Behandlungen auf Uhr</string>
<string name="wearcontrol_title">Steuerung von der Uhr</string>
<string name="sensitivity_shortname">SENS</string>
<string name="ratio_short">SEN</string>
<string name="pairingok">Verbindung OK</string>
<string name="pairing">Verbindung</string>
<string name="predictionshortlabel">PRE</string>
<string name="nsclientinternal_title">Interner NSClient</string>
<string name="nsclientinternal_shortname">NSCI</string>
<string name="combo_refresh">Aktualisieren</string>
<string name="combo_pump_activity">Aktivität</string>
<string name="combo_tbr_remaining">%d%% (%d verbleibend)</string>

View file

@ -342,10 +342,10 @@
<string name="ns_upload_only_summary">NS에 업로드만 하기. 로컬소스(xDrip)가 선택되지 않으면 SGV에는 효력이 없습니다. NS프로파일이 사용중이라면 프로파일에는 효력이 없습니다.</string>
<string name="pumpNotInitialized">펌프가 초기화 되지 않았습니다!</string>
<string name="pumpNotInitializedProfileNotSet">펌프가 초기화와 프로파일 설정이 되지 않았습니다!</string>
<string name="primefill">공기/채움</string>
<string name="primefill">교체/채움</string>
<string name="fillwarning">양이 인퓨전세트의 사양과 일치하는지 확인하세요!</string>
<string name="othersettings_title">기타</string>
<string name="fillbolus_title">공기/채움 기본 인슐린양</string>
<string name="fillbolus_title">교체/채움 기본 인슐린양</string>
<string name="button1">버튼1</string>
<string name="button2">버튼2</string>
<string name="button3">버튼3</string>
@ -411,7 +411,7 @@
<string name="danar_stats_ratio">비율</string>
<string name="danar_stats_amount_days">#일</string>
<string name="danar_stats_weight">가중</string>
<string name="danar_stats_warning_Message">공기/채움을 위해 식사주입을 사용한 경우 부정확할 수 있습니다!!</string>
<string name="danar_stats_warning_Message">교체/채움을 위해 식사주입을 사용한 경우 부정확할 수 있습니다!!</string>
<string name="danar_stats_olddata_Message">오래된 데이터입니다. "새로고침"을 누르세요.</string>
<string name="danar_stats_tbb">총기초량</string>
<string name="danar_stats_tbb2">총기초량 * 2</string>
@ -541,7 +541,7 @@
<string name="superbolus">Superbolus</string>
<string name="ns_logappstartedevent">앱시작을 NS에 기록하기</string>
<string name="restartingapp">설정을 적용하기위해 앱을 종료합니다.</string>
<string name="danarv2pump">DanaRv2</string>
<string name="danarv2pump">다나Rv2</string>
<string name="configbuilder_insulin">인슐린</string>
<string name="fastactinginsulin">Fast Acting Insulin</string>
<string name="fastactinginsulincomment">Novorapid, Novolog, Humalog</string>
@ -557,7 +557,7 @@
<string name="virtualpump_firmware_label">펌웨어</string>
<string name="pump_lastconnection_label">최근 연결</string>
<string name="pump_bluetooth_status">블루투스 상태</string>
<string name="nav_about">About</string>
<string name="nav_about">버전정보</string>
<string name="smscommunicator_missingsmspermission">SMS 권한 누락</string>
<string name="dev">DEV</string>
<string name="xdripstatus_settings">xDrip 상태(워치)</string>
@ -648,8 +648,7 @@
<string name="activate_profile">ACTIVATE PROFILE</string>
<string name="date">Date</string>
<string name="invalid">INVALID</string>
<string name="waitingforpairing">펌프연동 대기중</string>
<string name="waitingforpairing">펌프연동 대기중</string>
<string name="pairingok">연동완료</string>
<string name="pairingtimedout">연동시간초과</string>
<string name="pairing">연동중</string>
@ -680,7 +679,35 @@
<string name="reuse">재사용</string>
<string name="wearcontrol_title">워치로 작동하기</string>
<string name="wearcontrol_summary">임시목표와 관리입력을 워치로 설정합니다.</string>
<string name="connectiontimedout">연결시간초과</string> <string name="waitingforpairing">펌프연동 대기중</string><string name="pairingok">연동완료</string>
<string name="pairingtimedout">연동시간초과</string>
<string name="pairing">연동중</string>
<string name="danars_nodeviceavailable">현재까지 발견된 기기가 없습니다.</string>
<string name="emptyreservoir">빈 주사기</string>
<string name="bloodsugarmeasurementalert">혈당측정알람</string>
<string name="remaininsulinalert">남은 인슐린 양</string>
<string name="danarspump">다나RS</string>
<string name="danarspump_shortname">Dana</string>
<string name="selectedpump">선택된 펌프</string>
<string name="pairpump">새 펌프와 연동</string>
<string name="bolusspeed">식사주입 속도</string>
<string name="danar_setbasalstep001">기초주입 단위를 0.01 U/h로 설정하세요</string>
<string name="serialnumber">시리얼번호</string>
<string name="careportal_newnstreatment_percentage_label">퍼센트</string>
<string name="careportal_newnstreatment_timeshift_label">시간 이동</string>
<string name="default_temptargets">임시목표 기본값</string>
<string name="eatingsoon_duration">eatingsoon 기간</string>
<string name="eatingsoon_target">eatingsoon 목표</string>
<string name="activity_duration">activity 기간</string>
<string name="activity_target">activity 목표</string>
<string name="danar_history_prime">교체</string>
<string name="gettingextendedbolusstatus">확장식사주입 상태 가져오는중</string>
<string name="gettingbolusstatus">식사주입상태 가져오는중</string>
<string name="gettingtempbasalstatus">임시기초주입상태 가져오는중</string>
<string name="gettingpumpsettings">펌프설정 가져오는중</string>
<string name="gettingpumptime">펌프시간 가져오는중</string>
<string name="reuse">재사용</string>
<string name="wearcontrol_title">워치로 작동하기</string>
<string name="wearcontrol_summary">임시목표와 관리입력을 워치로 설정합니다.</string>
<string name="connectiontimedout">연결시간초과</string>
<string name="app_name">AndroidAPS</string>
</resources>

View file

@ -649,4 +649,36 @@
<string name="rapid_acting_oref">Snel-werkende Oref</string>
<string name="ultrafastactinginsulincomment">Fiasp</string>
<string name="ultrarapid_oref">Ultra-Rapid Oref</string>
<string name="activity_duration">Periode van inspanning</string>
<string name="activity_target">Activiteits doel</string>
<string name="bloodsugarmeasurementalert">Bloed glucose meetpunt alarm</string>
<string name="bolusspeed">Bolus snelheid</string>
<string name="careportal_newnstreatment_percentage_label">Percentage</string>
<string name="careportal_newnstreatment_timeshift_label">Tijd verschuiving</string>
<string name="connectiontimedout">Connectie verlopen</string>
<string name="danar_history_prime">Vullen</string>
<string name="danar_setbasalstep001">Zet de basale stap op 0,01 E/u</string>
<string name="danars_nodeviceavailable">Geen toestel gevonden</string>
<string name="danarspump">DanaRS</string>
<string name="danarspump_shortname">Dana</string>
<string name="default_temptargets">Standaart tijdelijk basaal</string>
<string name="eatingsoon_duration">Eet binnenkort periode</string>
<string name="eatingsoon_target">Eet binnenkort doel</string>
<string name="gettingbolusstatus">Bolus status ophalen</string>
<string name="gettingextendedbolusstatus">Vertraagde bolus status ophalen</string>
<string name="gettingpumpsettings">Pomp instellingen ophalen</string>
<string name="gettingpumptime">Pomp tijd ophalen</string>
<string name="gettingtempbasalstatus">Ophalen van tijdelijke basaal status</string>
<string name="pairing">Koppelen</string>
<string name="pairingok">Koppeling geslaagd</string>
<string name="pairingtimedout">Koppeling verlopen</string>
<string name="pairpump">Koppel nieuwe pomp</string>
<string name="remaininsulinalert">Resterende insuline hoeveelheid</string>
<string name="reuse">Herbruik</string>
<string name="selectedpump">Geselecteerde pomp</string>
<string name="serialnumber">Serie nummer</string>
<string name="wearcontrol_summary">Stel tijdelijke doelen en bolussen in vanop je horloge.</string>
<string name="wearcontrol_title">Bedieningen via horloge</string>
<string name="emptyreservoir">Ampull leeg</string>
<string name="waitingforpairing">Wachten op koppelen van de pomp</string>
</resources>

View file

@ -49,9 +49,9 @@
</string-array>
<string-array name="danaSpeedArray">
<item>12s 1U</item>
<item>30s 1U</item>
<item>60s 1U</item>
<item>12 s/U</item>
<item>30 s/U</item>
<item>60 s/U</item>
</string-array>
<string-array name="danaSpeedValues">
<item>0</item>

View file

@ -750,6 +750,10 @@
<string name="wearcontrol_summary">Set Temp-Targets and enter Treatments from the watch.</string>
<!-- TODO combo: still needed? -->
<string name="connectiontimedout">Connection timed out</string>
<string name="active"><![CDATA[<Active>]]></string>
<string name="waitingforestimatedbolusend" formatted="false">Waiting for estimated bolus end. Remaining %d sec.</string>
<string name="processinghistory">Processing event</string>
<string name="startingbolus">Starting bolus delivery</string>
<string name="bolusstopping">Stopping bolus delivery</string>
<string name="bolusstopped">Bolus delivery stopped</string>

View file

@ -16,5 +16,3 @@
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
android.useDeprecatedNdk=true