ajdust some danar pump comm params

This commit is contained in:
Milos Kozak 2016-08-12 20:22:44 +02:00
parent b1d5b12f55
commit 40aada0eb4
8 changed files with 24 additions and 10 deletions

View file

@ -139,7 +139,7 @@ public class DanaRPump {
} else {
time = df.format(h) + ":00";
}
basals.put(new JSONObject().put("time", time).put("timeAsSeconds", h * basalIncrement).put("value", pumpProfiles[activeProfile][h]));
basals.put(new JSONObject().put("time", time).put("timeAsSeconds", h * basalIncrement).put("value", pumpProfiles[activeProfile][h]));
}
profile.put("basal", basals);
@ -149,6 +149,8 @@ public class DanaRPump {
store.put("" + (activeProfile + 1), profile);
} catch (JSONException e) {
e.printStackTrace();
} catch (Exception e) {
return null;
}
return new NSProfile(json, "" + (activeProfile + 1));
}

View file

@ -175,7 +175,7 @@ public class ExecutionService extends Service {
}
public void connect(String from) {
if (danaRPump.isNewPump && danaRPump.password != SafeParse.stringToInt(SP.getString("danar_password", "-1"))) {
if (danaRPump.password != -1 && danaRPump.password != SafeParse.stringToInt(SP.getString("danar_password", "-1"))) {
ToastUtils.showToastInUiThread(MainApp.instance().getApplicationContext(), MainApp.sResources.getString(R.string.wrongpumppassword), R.raw.error);
return;
}

View file

@ -29,7 +29,6 @@ public class MsgInitConnStatusOption extends MessageBase {
int i = intFromBuff(bytes, 8, 1);
if (bytes.length >= 21) {
DanaRPlugin.getDanaRPump().password = intFromBuff(bytes, 9, 2) ^ 0x3463;
DanaRPlugin.getDanaRPump().isNewPump = true;
if (Config.logDanaMessageDetail)
log.debug("Pump password: " + DanaRPlugin.getDanaRPump().password);
}

View file

@ -3,6 +3,8 @@ package info.nightscout.androidaps.plugins.DanaR.comm;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.Date;
import info.nightscout.androidaps.Config;
import info.nightscout.androidaps.plugins.DanaR.DanaRPlugin;
@ -20,6 +22,9 @@ public class MsgSettingShippingInfo extends MessageBase {
DanaRPlugin.getDanaRPump().serialNumber = stringFromBuff(bytes, 0, 10);
DanaRPlugin.getDanaRPump().shippingDate = dateFromBuff(bytes, 10);
DanaRPlugin.getDanaRPump().shippingCountry = asciiStringFromBuff(bytes, 13, 3);
if (DanaRPlugin.getDanaRPump().shippingDate.getTime() > new Date(116, 4, 1).getTime()) {
DanaRPlugin.getDanaRPump().isNewPump = true;
}
if (Config.logDanaMessageDetail) {
log.debug("Serial number: " + DanaRPlugin.getDanaRPump().serialNumber);
log.debug("Shipping date: " + DanaRPlugin.getDanaRPump().shippingDate);

View file

@ -196,12 +196,20 @@ public class ObjectivesPlugin implements PluginBase, ConstraintsInterface {
SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(MainApp.instance().getApplicationContext());
for (int num = 0; num < objectives.size(); num++) {
Objective o = objectives.get(num);
o.started = new Date(settings.getLong("Objectives" + num + "started", 0));
o.accomplished = new Date(settings.getLong("Objectives" + num + "accomplished", 0));
try {
o.started = new Date(settings.getLong("Objectives" + num + "started", 0));
o.accomplished = new Date(settings.getLong("Objectives" + num + "accomplished", 0));
} catch (Exception e) {
e.printStackTrace();
}
}
bgIsAvailableInNS = settings.getBoolean("Objectives" + "bgIsAvailableInNS", false);
pumpStatusIsAvailableInNS = settings.getBoolean("Objectives" + "pumpStatusIsAvailableInNS", false);
manualEnacts = settings.getInt("Objectives" + "manualEnacts", 0);
try {
manualEnacts = settings.getInt("Objectives" + "manualEnacts", 0);
} catch (Exception e) {
e.printStackTrace();
}
if (Config.logPrefsChange)
log.debug("Objectives loaded");
}

View file

@ -277,7 +277,7 @@
<string name="danar_history_syspend">Прекъсване</string>
<string name="danar_historyreload">Презареждане</string>
<string name="danar_iob_label">IOB на помпата</string>
<string name="danar_password">Парола за помпа след 2016г</string>
<string name="danar_password">Парола за помпа</string>
<string name="danar_refill">пълнене</string>
<string name="danar_totaluploaded" formatted="false">Общо %d записа са изпратени</string>
<string name="enacted">Приложено</string>

View file

@ -278,7 +278,7 @@
<string name="pumpbusy">Pumpa je zaneprázdněna</string>
<string name="wrongpumppassword">Špatné heslo k pumpě</string>
<string name="mm640g">MM 640g</string>
<string name="danar_password">Heslo k pumpě (pouze verze 2016)</string>
<string name="danar_password">Heslo k pumpě</string>
<string name="overview_bolusiprogress_occlusion">Okluze</string>
<string name="overview_bolusprogress_delivered">Podáno</string>
<string name="overview_bolusprogress_stop">Stop</string>

View file

@ -279,7 +279,7 @@
<string name="danar_history_refill">Refill</string>
<string name="danar_history_syspend">Suspend</string>
<string name="danar_history_connectingfor" formatted="false">Connecting for %d s</string>
<string name="danar_password">Pump password (2016 pump only)</string>
<string name="danar_password">Pump password</string>
<string name="wrongpumppassword">Wrong pump password!</string>
<string name="pumpbusy">Pump is busy</string>
<string name="overview_bolusprogress_delivered">Delivered</string>
@ -304,6 +304,6 @@
<string name="objectives_6_objective">Enabling additional features for daytime use, such as advanced meal assist</string>
<string name="youareonallowedlimit">You reached allowed limit</string>
<string name="openapsma_target_bg">Target value for calculations</string>
<string name="noprofileselected">No profile seselcted</string>
<string name="noprofileselected">No profile selected</string>
</resources>