Merge pull request #62 from AdrianLxM/profileprefix
Show DanaR as part of profile name
This commit is contained in:
commit
33100ea6b8
2 changed files with 9 additions and 7 deletions
|
@ -22,6 +22,8 @@ public class DanaRPump {
|
|||
public static final int UNITS_MGDL = 0;
|
||||
public static final int UNITS_MMOL = 1;
|
||||
|
||||
public static final String PROFILE_PREFIX = "DanaR-";
|
||||
|
||||
public Date lastConnection = new Date(0);
|
||||
public Date lastSettingsRead = new Date(0);
|
||||
|
||||
|
@ -106,7 +108,7 @@ public class DanaRPump {
|
|||
double car = SafeParse.stringToDouble(SP.getString("danarprofile_car", "20"));
|
||||
|
||||
try {
|
||||
json.put("defaultProfile", "" + (activeProfile + 1));
|
||||
json.put("defaultProfile", PROFILE_PREFIX + (activeProfile + 1));
|
||||
json.put("store", store);
|
||||
profile.put("dia", dia);
|
||||
|
||||
|
@ -146,13 +148,13 @@ public class DanaRPump {
|
|||
profile.put("target_low", new JSONArray().put(new JSONObject().put("time", "00:00").put("timeAsSeconds", 0).put("value", currentTarget)));
|
||||
profile.put("target_high", new JSONArray().put(new JSONObject().put("time", "00:00").put("timeAsSeconds", 0).put("value", currentTarget)));
|
||||
profile.put("units", units == UNITS_MGDL ? Constants.MGDL : Constants.MMOL);
|
||||
store.put("" + (activeProfile + 1), profile);
|
||||
store.put(PROFILE_PREFIX + (activeProfile + 1), profile);
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
return new NSProfile(json, "" + (activeProfile + 1));
|
||||
return new NSProfile(json, PROFILE_PREFIX + (activeProfile + 1));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -217,7 +217,7 @@ public class SimpleProfilePlugin implements PluginBase, ProfileInterface {
|
|||
JSONObject profile = new JSONObject();
|
||||
|
||||
try {
|
||||
json.put("defaultProfile", "Profile");
|
||||
json.put("defaultProfile", "SimpleProfile");
|
||||
json.put("store", store);
|
||||
profile.put("dia", dia);
|
||||
profile.put("carbratio", new JSONArray().put(new JSONObject().put("timeAsSeconds", 0).put("value", ic)));
|
||||
|
@ -227,11 +227,11 @@ public class SimpleProfilePlugin implements PluginBase, ProfileInterface {
|
|||
profile.put("target_low", new JSONArray().put(new JSONObject().put("timeAsSeconds", 0).put("value", targetLow)));
|
||||
profile.put("target_high", new JSONArray().put(new JSONObject().put("timeAsSeconds", 0).put("value", targetHigh)));
|
||||
profile.put("units", mgdl ? Constants.MGDL : Constants.MMOL);
|
||||
store.put("Profile", profile);
|
||||
store.put("SimpleProfile", profile);
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
convertedProfile = new NSProfile(json, null);
|
||||
convertedProfile = new NSProfile(json, "SimpleProfile");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in a new issue