array2, DecimalFormat format, String units) {
- String retValue = "";
-
- for (Integer index = 0; index < array.size(); index++) {
- retValue += dateUtil.format_HH_MM((int) array.keyAt(index));
- retValue += " ";
- retValue += format.format(array.valueAt(index));
- if (array2 != null) {
- retValue += " - ";
- retValue += format.format(array2.valueAt(index));
- }
- retValue += " " + units;
- if (index + 1 < array.size())
- retValue += "\n";
- }
- return retValue;
- }
-
- public double getIsfMgdl() {
- return info.nightscout.androidaps.interfaces.Profile.Companion.toMgdl(getIsfTimeFromMidnight(info.nightscout.androidaps.interfaces.Profile.Companion.secondsFromMidnight()), getUnits());
- }
-
- public double getIsfMgdl(long time) {
- return info.nightscout.androidaps.interfaces.Profile.Companion.toMgdl(getIsfTimeFromMidnight(info.nightscout.androidaps.interfaces.Profile.Companion.secondsFromMidnight(time)), getUnits());
- }
-
- public double getIsfMgdlTimeFromMidnight(int timeAsSeconds) {
- return info.nightscout.androidaps.interfaces.Profile.Companion.toMgdl(getIsfTimeFromMidnight(timeAsSeconds), getUnits());
- }
-
- public double getIsfTimeFromMidnight(int timeAsSeconds) {
- if (isf_v == null)
- isf_v = convertToSparseArray(isf);
- return getValueToTime(isf_v, timeAsSeconds);
- }
-
- public String getIsfList(ResourceHelper resourceHelper, DateUtil dateUtil) {
- if (isf_v == null)
- isf_v = convertToSparseArray(isf);
- return getValuesList(isf_v, null, new DecimalFormat("0.0"), getUnits().getAsText() + resourceHelper.gs(R.string.profile_per_unit));
- }
-
- public ProfileValue[] getIsfsMgdlValues() {
- if (isf_v == null)
- isf_v = convertToSparseArray(ic);
- ProfileValue[] ret = new ProfileValue[isf_v.size()];
-
- for (int index = 0; index < isf_v.size(); index++) {
- int tas = (int) isf_v.keyAt(index);
- double value = isf_v.valueAt(index);
- ret[index] = new ProfileValue(tas, info.nightscout.androidaps.interfaces.Profile.Companion.toMgdl(value, getUnits()));
- }
- return ret;
- }
-
- public double getIc() {
- return getIcTimeFromMidnight(info.nightscout.androidaps.interfaces.Profile.Companion.secondsFromMidnight());
- }
-
- public double getIc(long time) {
- return getIcTimeFromMidnight(info.nightscout.androidaps.interfaces.Profile.Companion.secondsFromMidnight(time));
- }
-
- public double getIcTimeFromMidnight(int timeAsSeconds) {
- if (ic_v == null)
- ic_v = convertToSparseArray(ic);
- return getValueToTime(ic_v, timeAsSeconds);
- }
-
- public String getIcList(ResourceHelper resourceHelper, DateUtil dateUtil) {
- if (ic_v == null)
- ic_v = convertToSparseArray(ic);
- return getValuesList(ic_v, null, new DecimalFormat("0.0"), resourceHelper.gs(R.string.profile_carbs_per_unit));
- }
-
- public ProfileValue[] getIcsValues() {
- if (ic_v == null)
- ic_v = convertToSparseArray(ic);
- ProfileValue[] ret = new ProfileValue[ic_v.size()];
-
- for (int index = 0; index < ic_v.size(); index++) {
- int tas = (int) ic_v.keyAt(index);
- double value = ic_v.valueAt(index);
- ret[index] = new ProfileValue(tas, value);
- }
- return ret;
- }
-
- public double getBasal() {
- return getBasalTimeFromMidnight(info.nightscout.androidaps.interfaces.Profile.Companion.secondsFromMidnight());
- }
-
- public double getBasal(long time) {
- return getBasalTimeFromMidnight(info.nightscout.androidaps.interfaces.Profile.Companion.secondsFromMidnight(time));
- }
-
- public synchronized double getBasalTimeFromMidnight(int timeAsSeconds) {
- if (basal_v == null) {
- basal_v = convertToSparseArray(basal);
- }
- return getValueToTime(basal_v, timeAsSeconds);
- }
-
- public String getBasalList(ResourceHelper resourceHelper, DateUtil dateUtil) {
- if (basal_v == null)
- basal_v = convertToSparseArray(basal);
- return getValuesList(basal_v, null, new DecimalFormat("0.00"), resourceHelper.gs(R.string.profile_ins_units_per_hour));
- }
-
- @NonNull @Override public JSONObject toPureNsJson(DateUtil dateUtil) {
- return getData();
- }
-
- public synchronized ProfileValue[] getBasalValues() {
- if (basal_v == null)
- basal_v = convertToSparseArray(basal);
- ProfileValue[] ret = new ProfileValue[basal_v.size()];
-
- for (int index = 0; index < basal_v.size(); index++) {
- int tas = (int) basal_v.keyAt(index);
- double value = basal_v.valueAt(index);
- ret[index] = new ProfileValue(tas, value);
- }
- return ret;
- }
-
- public double getTargetMgdl() {
- return getTargetMgdl(info.nightscout.androidaps.interfaces.Profile.Companion.secondsFromMidnight());
- }
-
- public double getTargetMgdl(int timeAsSeconds) {
- return info.nightscout.androidaps.interfaces.Profile.Companion.toMgdl((getTargetLowTimeFromMidnight(timeAsSeconds) + getTargetHighTimeFromMidnight(timeAsSeconds)) / 2, getUnits());
- }
-
- public double getTargetLowMgdl() {
- return info.nightscout.androidaps.interfaces.Profile.Companion.toMgdl(getTargetLowTimeFromMidnight(info.nightscout.androidaps.interfaces.Profile.Companion.secondsFromMidnight()), getUnits());
- }
-
- public double getTargetLowMgdl(long time) {
- return info.nightscout.androidaps.interfaces.Profile.Companion.toMgdl(getTargetLowTimeFromMidnight(info.nightscout.androidaps.interfaces.Profile.Companion.secondsFromMidnight(time)), getUnits());
- }
-
- double getTargetLowTimeFromMidnight(int timeAsSeconds) {
- if (targetLow_v == null)
- targetLow_v = convertToSparseArray(targetLow);
- return getValueToTime(targetLow_v, timeAsSeconds);
- }
-
- public double getTargetLowMgdlTimeFromMidnight(int timeAsSeconds) {
- return info.nightscout.androidaps.interfaces.Profile.Companion.toMgdl(getTargetLowTimeFromMidnight(timeAsSeconds), getUnits());
- }
-
- public double getTargetHighMgdl() {
- return info.nightscout.androidaps.interfaces.Profile.Companion.toMgdl(getTargetHighTimeFromMidnight(info.nightscout.androidaps.interfaces.Profile.Companion.secondsFromMidnight()), getUnits());
- }
-
- public double getTargetHighMgdl(long time) {
- return info.nightscout.androidaps.interfaces.Profile.Companion.toMgdl(getTargetHighTimeFromMidnight(info.nightscout.androidaps.interfaces.Profile.Companion.secondsFromMidnight(time)), getUnits());
- }
-
- public double getTargetHighTimeFromMidnight(int timeAsSeconds) {
- if (targetHigh_v == null)
- targetHigh_v = convertToSparseArray(targetHigh);
- return getValueToTime(targetHigh_v, timeAsSeconds);
- }
-
- public double getTargetHighMgdlTimeFromMidnight(int timeAsSeconds) {
- return info.nightscout.androidaps.interfaces.Profile.Companion.toMgdl(getTargetHighTimeFromMidnight(timeAsSeconds), getUnits());
- }
-
- public static class TargetValue {
- TargetValue(int timeAsSeconds, double low, double high) {
- this.timeAsSeconds = timeAsSeconds;
- this.low = low;
- this.high = high;
- }
-
- public int timeAsSeconds;
- public double low;
- public double high;
- }
-
- public TargetValue[] getTargets() {
- if (targetLow_v == null)
- targetLow_v = convertToSparseArray(targetLow);
- if (targetHigh_v == null)
- targetHigh_v = convertToSparseArray(targetHigh);
- TargetValue[] ret = new TargetValue[targetLow_v.size()];
-
- for (int index = 0; index < targetLow_v.size(); index++) {
- int tas = (int) targetLow_v.keyAt(index);
- double low = targetLow_v.valueAt(index);
- double high = targetHigh_v.valueAt(index);
- ret[index] = new TargetValue(tas, low, high);
- }
- return ret;
- }
-
- public ProfileValue[] getSingleTargetsMgdl() {
- if (targetLow_v == null)
- targetLow_v = convertToSparseArray(targetLow);
- if (targetHigh_v == null)
- targetHigh_v = convertToSparseArray(targetHigh);
- ProfileValue[] ret = new ProfileValue[targetLow_v.size()];
-
- for (int index = 0; index < targetLow_v.size(); index++) {
- int tas = (int) targetLow_v.keyAt(index);
- double target = (targetLow_v.valueAt(index) + targetHigh_v.valueAt(index)) / 2;
- ret[index] = new ProfileValue(tas, info.nightscout.androidaps.interfaces.Profile.Companion.toMgdl(target, getUnits()));
- }
- return ret;
- }
-
- @NonNull public String getTargetList(ResourceHelper resourceHelper, DateUtil dateUtil) {
- if (targetLow_v == null)
- targetLow_v = convertToSparseArray(targetLow);
- if (targetHigh_v == null)
- targetHigh_v = convertToSparseArray(targetHigh);
- return getValuesList(targetLow_v, targetHigh_v, new DecimalFormat("0.0"), getUnits().getAsText());
- }
-
- public double getMaxDailyBasal() {
- double max = 0d;
- for (int hour = 0; hour < 24; hour++) {
- double value = getBasalTimeFromMidnight(hour * 60 * 60);
- if (value > max) max = value;
- }
- return max;
- }
-
- public double percentageBasalSum() {
- double result = 0d;
- for (int i = 0; i < 24; i++) {
- result += getBasalTimeFromMidnight(i * 60 * 60);
- }
- return result;
- }
-
-
- public double baseBasalSum() {
- double result = 0d;
- for (int i = 0; i < 24; i++) {
- result += getBasalTimeFromMidnight(i * 60 * 60) / getMultiplier(basal_v);
- }
- return result;
- }
-
- public int getPercentage() {
- return percentage;
- }
-
- public int getTimeshift() {
- return timeshift;
- }
-
- public PureProfile convertToNonCustomizedProfile(DateUtil dateUtil) {
- JSONObject o = new JSONObject();
- try {
- o.put("units", jsonUnits);
- o.put("dia", dia);
- o.put("timezone", timeZone.getID());
- // SENS
- JSONArray sens = new JSONArray();
- double lastValue = -1d;
- for (int i = 0; i < 24; i++) {
- int timeAsSeconds = i * 60 * 60;
- double value = getIsfTimeFromMidnight(timeAsSeconds);
- if (value != lastValue) {
- JSONObject item = new JSONObject();
- String time;
- DecimalFormat df = new DecimalFormat("00");
- time = df.format(i) + ":00";
- item.put("time", time);
- item.put("timeAsSeconds", timeAsSeconds);
- item.put("value", value);
- lastValue = value;
- sens.put(item);
- }
- }
- o.put("sens", sens);
- // CARBRATIO
- JSONArray carbratio = new JSONArray();
- lastValue = -1d;
- for (int i = 0; i < 24; i++) {
- int timeAsSeconds = i * 60 * 60;
- double value = getIcTimeFromMidnight(timeAsSeconds);
- if (value != lastValue) {
- JSONObject item = new JSONObject();
- String time;
- DecimalFormat df = new DecimalFormat("00");
- time = df.format(i) + ":00";
- item.put("time", time);
- item.put("timeAsSeconds", timeAsSeconds);
- item.put("value", value);
- lastValue = value;
- carbratio.put(item);
- }
- }
- o.put("carbratio", carbratio);
- // BASAL
- JSONArray basal = new JSONArray();
- lastValue = -1d;
- for (int i = 0; i < 24; i++) {
- int timeAsSeconds = i * 60 * 60;
- double value = getBasalTimeFromMidnight(timeAsSeconds);
- if (value != lastValue) {
- JSONObject item = new JSONObject();
- String time;
- DecimalFormat df = new DecimalFormat("00");
- time = df.format(i) + ":00";
- item.put("time", time);
- item.put("timeAsSeconds", timeAsSeconds);
- item.put("value", value);
- lastValue = value;
- basal.put(item);
- }
- }
- o.put("basal", basal);
- // TARGET_LOW
- JSONArray target_low = new JSONArray();
- lastValue = -1d;
- for (int i = 0; i < 24; i++) {
- int timeAsSeconds = i * 60 * 60;
- double value = getTargetLowTimeFromMidnight(timeAsSeconds);
- if (value != lastValue) {
- JSONObject item = new JSONObject();
- String time;
- DecimalFormat df = new DecimalFormat("00");
- time = df.format(i) + ":00";
- item.put("time", time);
- item.put("timeAsSeconds", timeAsSeconds);
- item.put("value", value);
- lastValue = value;
- target_low.put(item);
- }
- }
- o.put("target_low", target_low);
- // TARGET_HIGH
- JSONArray target_high = new JSONArray();
- lastValue = -1d;
- for (int i = 0; i < 24; i++) {
- int timeAsSeconds = i * 60 * 60;
- double value = getTargetHighTimeFromMidnight(timeAsSeconds);
- if (value != lastValue) {
- JSONObject item = new JSONObject();
- String time;
- DecimalFormat df = new DecimalFormat("00");
- time = df.format(i) + ":00";
- item.put("time", time);
- item.put("timeAsSeconds", timeAsSeconds);
- item.put("value", value);
- lastValue = value;
- target_high.put(item);
- }
- }
- o.put("target_high", target_high);
-
- } catch (JSONException e) {
- aapsLogger.error("Unhandled exception" + e);
- }
- return pureProfileFromJson(o, dateUtil);
- }
-}
diff --git a/core/src/main/java/info/nightscout/androidaps/data/ProfileSealed.kt b/core/src/main/java/info/nightscout/androidaps/data/ProfileSealed.kt
index b308bd6132..50b39e896b 100644
--- a/core/src/main/java/info/nightscout/androidaps/data/ProfileSealed.kt
+++ b/core/src/main/java/info/nightscout/androidaps/data/ProfileSealed.kt
@@ -15,7 +15,6 @@ import info.nightscout.androidaps.interfaces.Profile.Companion.secondsFromMidnig
import info.nightscout.androidaps.interfaces.Profile.Companion.toMgdl
import info.nightscout.androidaps.interfaces.Profile.ProfileValue
import info.nightscout.androidaps.interfaces.Pump
-import info.nightscout.androidaps.interfaces.PumpDescription
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification
import info.nightscout.androidaps.plugins.general.overview.notifications.Notification
@@ -145,6 +144,19 @@ sealed class ProfileSealed(
override val timeshift: Int
get() = ts
+ override fun isEqual(profile: Profile): Boolean {
+ for (hour in 0..23) {
+ val seconds = T.hours(hour.toLong()).secs().toInt()
+ if (getBasalTimeFromMidnight(seconds) != profile.getBasalTimeFromMidnight(seconds)) return false
+ if (getIsfMgdlTimeFromMidnight(seconds) != profile.getIsfMgdlTimeFromMidnight(seconds)) return false
+ if (getIcTimeFromMidnight(seconds) != profile.getIcTimeFromMidnight(seconds)) return false
+ if (getTargetLowMgdlTimeFromMidnight(seconds) != profile.getTargetLowMgdlTimeFromMidnight(seconds)) return false
+ if (getTargetHighMgdlTimeFromMidnight(seconds) != profile.getTargetHighMgdlTimeFromMidnight(seconds)) return false
+ if (dia != profile.dia) return false
+ }
+ return true
+ }
+
override val percentage: Int
get() = pct
diff --git a/core/src/main/java/info/nightscout/androidaps/db/DanaRHistoryRecord.java b/core/src/main/java/info/nightscout/androidaps/db/DanaRHistoryRecord.java
deleted file mode 100644
index 2c161df1cc..0000000000
--- a/core/src/main/java/info/nightscout/androidaps/db/DanaRHistoryRecord.java
+++ /dev/null
@@ -1,77 +0,0 @@
-package info.nightscout.androidaps.db;
-
-import com.j256.ormlite.field.DatabaseField;
-import com.j256.ormlite.table.DatabaseTable;
-
-@DatabaseTable(tableName = "DanaRHistory")
-public class DanaRHistoryRecord {
-
- @DatabaseField
- public String _id;
-
- @DatabaseField
- public byte recordCode;
-
- @DatabaseField(id = true)
- public String bytes;
-
- @DatabaseField
- public long recordDate;
-
- @DatabaseField
- public double recordValue;
-
- @DatabaseField
- public String bolusType;
-
- @DatabaseField
- public String stringRecordValue;
-
- @DatabaseField
- public int recordDuration;
-
- @DatabaseField
- public double recordDailyBasal;
-
- @DatabaseField
- public double recordDailyBolus;
-
- @DatabaseField
- public String recordAlarm;
-
- public DanaRHistoryRecord() {
- this.recordDate = 0;
- this.recordValue = 0.0;
- this.bolusType = "None";
- this.recordCode = 0x0F;
- this.bytes = new String();
- this._id = null;
- }
-
- public int getRecordLevel(double dExLow, double dLow, double dHigh, double dExHigh) {
- if (this.recordValue < dExLow)
- return 0;
- if (this.recordValue < dLow)
- return 1;
- if (this.recordValue < dHigh)
- return 2;
- return this.recordValue < dExHigh ? 3 : 4;
- }
-
- public void setBytes(byte[] raw) {
- this.bytes = bytesToHex(raw);
- }
-
- final protected static char[] hexArray = "0123456789ABCDEF".toCharArray();
-
- public static String bytesToHex(byte[] bytes) {
- char[] hexChars = new char[bytes.length * 2];
- for (int j = 0; j < bytes.length; j++) {
- int v = bytes[j] & 0xFF;
- hexChars[j * 2] = hexArray[v >>> 4];
- hexChars[j * 2 + 1] = hexArray[v & 0x0F];
- }
- return new String(hexChars);
- }
-}
-
diff --git a/core/src/main/java/info/nightscout/androidaps/db/DbObjectBase.kt b/core/src/main/java/info/nightscout/androidaps/db/DbObjectBase.kt
deleted file mode 100644
index 76228abe9b..0000000000
--- a/core/src/main/java/info/nightscout/androidaps/db/DbObjectBase.kt
+++ /dev/null
@@ -1,7 +0,0 @@
-package info.nightscout.androidaps.db
-
-interface DbObjectBase {
-
- val date: Long
- val pumpId: Long
-}
\ No newline at end of file
diff --git a/core/src/main/java/info/nightscout/androidaps/db/DbRequest.java b/core/src/main/java/info/nightscout/androidaps/db/DbRequest.java
deleted file mode 100644
index 5adf814434..0000000000
--- a/core/src/main/java/info/nightscout/androidaps/db/DbRequest.java
+++ /dev/null
@@ -1,86 +0,0 @@
-package info.nightscout.androidaps.db;
-
-import com.j256.ormlite.field.DatabaseField;
-import com.j256.ormlite.table.DatabaseTable;
-
-import org.json.JSONException;
-import org.json.JSONObject;
-
-/**
- * Created by mike on 27.02.2016.
- *
- * Allowed actions "dbAdd" || "dbUpdate" || "dbUpdateUnset" || "dbRemove"
- */
-@DatabaseTable(tableName = "DBRequests")
-public class DbRequest {
-
- @DatabaseField(id = true)
- public String nsClientID = null;
-
- @DatabaseField
- public String action = null;
-
- @DatabaseField
- public String collection = null;
-
- @DatabaseField
- public String data = null;
-
- @DatabaseField
- public String _id = null;
-
- public DbRequest() {
- }
-
- // dbAdd
- public DbRequest(String action, String collection, JSONObject json, long nsClientId) {
- this.action = action;
- this.collection = collection;
- this.nsClientID = "" + nsClientId;
- try {
- json.put("NSCLIENT_ID", nsClientID);
- } catch (JSONException e) {
- e.printStackTrace();
- }
- this.data = json.toString();
- this._id = "";
- }
-
- // dbUpdate, dbUpdateUnset
- public DbRequest(String action, String collection, String _id, JSONObject json, long nsClientId) {
- this.action = action;
- this.collection = collection;
- this.nsClientID = "" + nsClientId;
- try {
- json.put("NSCLIENT_ID", nsClientID);
- } catch (JSONException e) {
- e.printStackTrace();
- }
- this.data = json.toString();
- this._id = _id;
- }
-
- // dbRemove
- public DbRequest(String action, String collection, String _id, long nsClientId) {
- JSONObject json = new JSONObject();
- this.action = action;
- this.collection = collection;
- this.nsClientID = "" + nsClientId;
- try {
- json.put("NSCLIENT_ID", nsClientID);
- } catch (JSONException e) {
- e.printStackTrace();
- }
- this.data = json.toString();
- this._id = _id;
- }
-
- public String log() {
- return
- "\nnsClientID:" + nsClientID +
- "\naction:" + action +
- "\ncollection:" + collection +
- "\ndata:" + data +
- "\n_id:" + _id;
- }
-}
diff --git a/core/src/main/java/info/nightscout/androidaps/db/ICallback.java b/core/src/main/java/info/nightscout/androidaps/db/ICallback.java
deleted file mode 100644
index 7a9360035f..0000000000
--- a/core/src/main/java/info/nightscout/androidaps/db/ICallback.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package info.nightscout.androidaps.db;
-
-import java.util.concurrent.ScheduledFuture;
-
-/**
- * Created by triplem on 05.01.18.
- */
-
-public interface ICallback {
-
- void setPost(ScheduledFuture> post);
-
- ScheduledFuture> getPost();
-
-}
diff --git a/core/src/main/java/info/nightscout/androidaps/db/OmnipodHistoryRecord.java b/core/src/main/java/info/nightscout/androidaps/db/OmnipodHistoryRecord.java
index 0f4b56b096..584f6cc150 100644
--- a/core/src/main/java/info/nightscout/androidaps/db/OmnipodHistoryRecord.java
+++ b/core/src/main/java/info/nightscout/androidaps/db/OmnipodHistoryRecord.java
@@ -9,7 +9,7 @@ import info.nightscout.androidaps.plugins.pump.common.utils.DateTimeUtil;
* Created by andy on 30.11.2019.
*/
@DatabaseTable(tableName = "PodHistory")
-public class OmnipodHistoryRecord implements DbObjectBase, Comparable {
+public class OmnipodHistoryRecord implements Comparable {
@DatabaseField(id = true)
public long date;
@@ -42,7 +42,6 @@ public class OmnipodHistoryRecord implements DbObjectBase, Comparable?
val ret = ArrayList(size)
try {
for (index in 0 until jsonArray.length() - 1) {
- val o: JSONObject = jsonArray.getJSONObject(index)
- val tas: Int = try {
- o.getInt("timeAsSeconds")
- } catch (e: JSONException) {
- val time = o.getString("time")
- dateUtil.toSeconds(time)
- }
- val next: JSONObject = jsonArray.getJSONObject(index + 1)
- val nextTas: Int = try {
- next.getInt("timeAsSeconds")
- } catch (e: JSONException) {
- val time = next.getString("time")
- dateUtil.toSeconds(time)
- }
- val value: Double = o.getDouble("value")
+ val o = jsonArray.getJSONObject(index)
+ val tas = dateUtil.toSeconds(o.getString("time"))
+ val next = jsonArray.getJSONObject(index + 1)
+ val nextTas = dateUtil.toSeconds(next.getString("time"))
+ val value = o.getDouble("value")
if (tas % 3600 != 0) return null
if (nextTas % 3600 != 0) return null
ret.add(index, Block((nextTas - tas) * 1000L, value))
}
val last: JSONObject = jsonArray.getJSONObject(jsonArray.length() - 1)
- val lastTas: Int = try {
- last.getInt("timeAsSeconds")
- } catch (e: JSONException) {
- val time = last.getString("time")
- dateUtil.toSeconds(time)
- }
- val value: Double = last.getDouble("value")
+ val lastTas = dateUtil.toSeconds(last.getString("time"))
+ val value = last.getDouble("value")
ret.add(jsonArray.length() - 1, Block((T.hours(24).secs() - lastTas) * 1000L, value))
} catch (e: Exception) {
return null
@@ -128,41 +112,23 @@ fun targetBlockFromJsonArray(jsonArray1: JSONArray?, jsonArray2: JSONArray?, dat
try {
for (index in 0 until jsonArray1.length() - 1) {
val o1: JSONObject = jsonArray1.getJSONObject(index)
- val tas1: Int = try {
- o1.getInt("timeAsSeconds")
- } catch (e: JSONException) {
- val time = o1.getString("time")
- dateUtil.toSeconds(time)
- }
- val value1: Double = o1.getDouble("value")
- val next1: JSONObject = jsonArray1.getJSONObject(index + 1)
- val nextTas1: Int = try {
- next1.getInt("timeAsSeconds")
- } catch (e: JSONException) {
- val time = next1.getString("time")
- dateUtil.toSeconds(time)
- }
- val o2: JSONObject = jsonArray2.getJSONObject(index)
- val tas2: Int = try {
- o2.getInt("timeAsSeconds")
- } catch (e: JSONException) {
- val time = o2.getString("time")
- dateUtil.toSeconds(time)
- }
- val value2: Double = o2.getDouble("value")
+ val tas1 = dateUtil.toSeconds(o1.getString("time"))
+ val value1 = o1.getDouble("value")
+ val next1 = jsonArray1.getJSONObject(index + 1)
+ val nextTas1 = dateUtil.toSeconds(next1.getString("time"))
+ val o2 = jsonArray2.getJSONObject(index)
+ val tas2 = dateUtil.toSeconds(o2.getString("time"))
+ val value2 = o2.getDouble("value")
if (tas1 != tas2) return null
+ if (tas1 % 3600 != 0) return null
+ if (nextTas1 % 3600 != 0) return null
ret.add(index, TargetBlock((nextTas1 - tas1) * 1000L, value1, value2))
}
- val last1: JSONObject = jsonArray1.getJSONObject(jsonArray1.length() - 1)
- val lastTas1: Int = try {
- last1.getInt("timeAsSeconds")
- } catch (e: JSONException) {
- val time = last1.getString("time")
- dateUtil.toSeconds(time)
- }
- val value1: Double = last1.getDouble("value")
- val last2: JSONObject = jsonArray2.getJSONObject(jsonArray2.length() - 1)
- val value2: Double = last2.getDouble("value")
+ val last1 = jsonArray1.getJSONObject(jsonArray1.length() - 1)
+ val lastTas1 = dateUtil.toSeconds(last1.getString("time"))
+ val value1 = last1.getDouble("value")
+ val last2 = jsonArray2.getJSONObject(jsonArray2.length() - 1)
+ val value2 = last2.getDouble("value")
ret.add(jsonArray1.length() - 1, TargetBlock((T.hours(24).secs() - lastTas1) * 1000L, value1, value2))
} catch (e: Exception) {
return null
diff --git a/core/src/main/java/info/nightscout/androidaps/extensions/BolusCalculatorResultExtension.kt b/core/src/main/java/info/nightscout/androidaps/extensions/BolusCalculatorResultExtension.kt
index 786f9c7d13..b1f49b603c 100644
--- a/core/src/main/java/info/nightscout/androidaps/extensions/BolusCalculatorResultExtension.kt
+++ b/core/src/main/java/info/nightscout/androidaps/extensions/BolusCalculatorResultExtension.kt
@@ -7,15 +7,14 @@ import info.nightscout.androidaps.database.entities.TherapyEvent
import info.nightscout.androidaps.utils.DateUtil
import org.json.JSONObject
-fun BolusCalculatorResult.toJson(dateUtil: DateUtil): JSONObject =
+fun BolusCalculatorResult.toJson(isAdd: Boolean, dateUtil: DateUtil): JSONObject =
JSONObject()
.put("eventType", TherapyEvent.Type.BOLUS_WIZARD.text)
.put("created_at", dateUtil.toISOString(timestamp))
+ .put("isValid", isValid)
.put("bolusCalculatorResult", Gson().toJson(this))
.put("date", timestamp)
.put("glucose", glucoseValue)
.put("units", Constants.MGDL)
.put("notes", note)
- .also {
- if (interfaceIDs.nightscoutId != null) it.put("_id", interfaceIDs.nightscoutId)
- }
+ .also { if (isAdd && interfaceIDs.nightscoutId != null) it.put("_id", interfaceIDs.nightscoutId) }
diff --git a/core/src/main/java/info/nightscout/androidaps/extensions/BolusExtension.kt b/core/src/main/java/info/nightscout/androidaps/extensions/BolusExtension.kt
index bef74006e9..c89a1c67f2 100644
--- a/core/src/main/java/info/nightscout/androidaps/extensions/BolusExtension.kt
+++ b/core/src/main/java/info/nightscout/androidaps/extensions/BolusExtension.kt
@@ -16,7 +16,7 @@ fun Bolus.iobCalc(activePlugin: ActivePlugin, time: Long, dia: Double): Iob {
return insulinInterface.iobCalcForTreatment(this, time, dia)
}
-fun Bolus.toJson(dateUtil: DateUtil): JSONObject =
+fun Bolus.toJson(isAdd: Boolean, dateUtil: DateUtil): JSONObject =
JSONObject()
.put("eventType", if (type == Bolus.Type.SMB) TherapyEvent.Type.CORRECTION_BOLUS.text else TherapyEvent.Type.MEAL_BOLUS.text)
.put("insulin", amount)
@@ -28,7 +28,7 @@ fun Bolus.toJson(dateUtil: DateUtil): JSONObject =
if (interfaceIDs.pumpId != null) it.put("pumpId", interfaceIDs.pumpId)
if (interfaceIDs.pumpType != null) it.put("pumpType", interfaceIDs.pumpType!!.name)
if (interfaceIDs.pumpSerial != null) it.put("pumpSerial", interfaceIDs.pumpSerial)
- if (interfaceIDs.nightscoutId != null) it.put("_id", interfaceIDs.nightscoutId)
+ if (isAdd && interfaceIDs.nightscoutId != null) it.put("_id", interfaceIDs.nightscoutId)
}
/*
diff --git a/core/src/main/java/info/nightscout/androidaps/extensions/CarbsExtension.kt b/core/src/main/java/info/nightscout/androidaps/extensions/CarbsExtension.kt
index 54d200e9f6..b3c6e6ac81 100644
--- a/core/src/main/java/info/nightscout/androidaps/extensions/CarbsExtension.kt
+++ b/core/src/main/java/info/nightscout/androidaps/extensions/CarbsExtension.kt
@@ -7,17 +7,18 @@ import info.nightscout.androidaps.utils.DateUtil
import info.nightscout.androidaps.utils.JsonHelper
import org.json.JSONObject
-fun Carbs.toJson(dateUtil: DateUtil): JSONObject =
+fun Carbs.toJson(isAdd: Boolean, dateUtil: DateUtil): JSONObject =
JSONObject()
.put("eventType", if (amount < 12) TherapyEvent.Type.CARBS_CORRECTION.text else TherapyEvent.Type.MEAL_BOLUS.text)
.put("carbs", amount)
.put("created_at", dateUtil.toISOString(timestamp))
+ .put("isValid", isValid)
.put("date", timestamp).also {
if (duration != 0L) it.put("duration", duration)
if (interfaceIDs.pumpId != null) it.put("pumpId", interfaceIDs.pumpId)
if (interfaceIDs.pumpType != null) it.put("pumpType", interfaceIDs.pumpType!!.name)
if (interfaceIDs.pumpSerial != null) it.put("pumpSerial", interfaceIDs.pumpSerial)
- if (interfaceIDs.nightscoutId != null) it.put("_id", interfaceIDs.nightscoutId)
+ if (isAdd && interfaceIDs.nightscoutId != null) it.put("_id", interfaceIDs.nightscoutId)
}
/*
diff --git a/core/src/main/java/info/nightscout/androidaps/extensions/DeviceStatusExtension.kt b/core/src/main/java/info/nightscout/androidaps/extensions/DeviceStatusExtension.kt
index 1d5d6dea9c..fcd53753ea 100644
--- a/core/src/main/java/info/nightscout/androidaps/extensions/DeviceStatusExtension.kt
+++ b/core/src/main/java/info/nightscout/androidaps/extensions/DeviceStatusExtension.kt
@@ -3,7 +3,7 @@ package info.nightscout.androidaps.extensions
import android.os.Build
import info.nightscout.androidaps.database.entities.DeviceStatus
import info.nightscout.androidaps.interfaces.IobCobCalculator
-import info.nightscout.androidaps.interfaces.LoopInterface
+import info.nightscout.androidaps.interfaces.Loop
import info.nightscout.androidaps.interfaces.ProfileFunction
import info.nightscout.androidaps.interfaces.Pump
import info.nightscout.androidaps.plugins.configBuilder.RunningConfiguration
@@ -28,7 +28,7 @@ fun DeviceStatus.toJson(dateUtil: DateUtil): JSONObject =
fun buildDeviceStatus(
dateUtil: DateUtil,
- loopPlugin: LoopInterface,
+ loopPlugin: Loop,
iobCobCalculatorPlugin: IobCobCalculator,
profileFunction: ProfileFunction,
pump: Pump,
diff --git a/core/src/main/java/info/nightscout/androidaps/extensions/ExtendedBolusExtension.kt b/core/src/main/java/info/nightscout/androidaps/extensions/ExtendedBolusExtension.kt
index a787bc3ccf..d64713d0ad 100644
--- a/core/src/main/java/info/nightscout/androidaps/extensions/ExtendedBolusExtension.kt
+++ b/core/src/main/java/info/nightscout/androidaps/extensions/ExtendedBolusExtension.kt
@@ -50,14 +50,14 @@ fun ExtendedBolus.toTemporaryBasal(profile: Profile): TemporaryBasal =
type = TemporaryBasal.Type.FAKE_EXTENDED
)
-fun ExtendedBolus.toJson(profile: Profile, dateUtil: DateUtil): JSONObject =
+fun ExtendedBolus.toJson(isAdd: Boolean, profile: Profile, dateUtil: DateUtil, useAbsolute: Boolean): JSONObject =
if (isEmulatingTempBasal)
toTemporaryBasal(profile)
- .toJson(profile, dateUtil)
- .put("extendedEmulated", toRealJson(dateUtil))
- else toRealJson(dateUtil)
+ .toJson(isAdd, profile, dateUtil, useAbsolute)
+ .put("extendedEmulated", toRealJson(isAdd, dateUtil))
+ else toRealJson(isAdd, dateUtil)
-fun ExtendedBolus.toRealJson(dateUtil: DateUtil): JSONObject =
+fun ExtendedBolus.toRealJson(isAdd: Boolean, dateUtil: DateUtil): JSONObject =
JSONObject()
.put("created_at", dateUtil.toISOString(timestamp))
.put("enteredBy", "openaps://" + "AndroidAPS")
@@ -74,7 +74,7 @@ fun ExtendedBolus.toRealJson(dateUtil: DateUtil): JSONObject =
if (interfaceIDs.endId != null) it.put("endId", interfaceIDs.endId)
if (interfaceIDs.pumpType != null) it.put("pumpType", interfaceIDs.pumpType!!.name)
if (interfaceIDs.pumpSerial != null) it.put("pumpSerial", interfaceIDs.pumpSerial)
- if (interfaceIDs.nightscoutId != null) it.put("_id", interfaceIDs.nightscoutId)
+ if (isAdd && interfaceIDs.nightscoutId != null) it.put("_id", interfaceIDs.nightscoutId)
}
/*
@@ -85,6 +85,7 @@ fun extendedBolusFromNsIdForInvalidating(nsId: String): ExtendedBolus =
JSONObject()
.put("mills", 1)
.put("amount", -1.0)
+ .put("enteredinsulin", -1.0)
.put("duration", -1.0)
.put("splitNow", 0)
.put("splitExt", 100)
diff --git a/core/src/main/java/info/nightscout/androidaps/extensions/FoodExtension.kt b/core/src/main/java/info/nightscout/androidaps/extensions/FoodExtension.kt
index dfda0de134..fe61aff11e 100644
--- a/core/src/main/java/info/nightscout/androidaps/extensions/FoodExtension.kt
+++ b/core/src/main/java/info/nightscout/androidaps/extensions/FoodExtension.kt
@@ -38,7 +38,7 @@ fun foodFromJson(jsonObject: JSONObject): Food? {
return null
}
-fun Food.toJson(): JSONObject =
+fun Food.toJson(isAdd: Boolean): JSONObject =
JSONObject()
.put("type", "food")
.put("name", name)
@@ -51,8 +51,6 @@ fun Food.toJson(): JSONObject =
.put("energy", energy)
.put("protein", protein)
.put("fat", fat)
- .put("isValid", isValid).also {
- if (interfaceIDs.nightscoutId != null) it
- .put("_id", interfaceIDs.nightscoutId)
- }
+ .put("isValid", isValid)
+ .also { if (isAdd && interfaceIDs.nightscoutId != null) it.put("_id", interfaceIDs.nightscoutId) }
diff --git a/core/src/main/java/info/nightscout/androidaps/extensions/GlucoseValueExtension.kt b/core/src/main/java/info/nightscout/androidaps/extensions/GlucoseValueExtension.kt
index 1d75c3e549..a74fdff40b 100644
--- a/core/src/main/java/info/nightscout/androidaps/extensions/GlucoseValueExtension.kt
+++ b/core/src/main/java/info/nightscout/androidaps/extensions/GlucoseValueExtension.kt
@@ -15,13 +15,13 @@ fun GlucoseValue.valueToUnitsString(units: GlucoseUnit): String =
if (units == GlucoseUnit.MGDL) DecimalFormatter.to0Decimal(value)
else DecimalFormatter.to1Decimal(value * Constants.MGDL_TO_MMOLL)
-fun GlucoseValue.toJson(dateUtil: DateUtil): JSONObject =
+fun GlucoseValue.toJson(isAdd : Boolean, dateUtil: DateUtil): JSONObject =
JSONObject()
.put("device", sourceSensor.text)
.put("date", timestamp)
.put("dateString", dateUtil.toISOString(timestamp))
+ .put("isValid", isValid)
.put("sgv", value)
.put("direction", trendArrow.text)
- .put("type", "sgv").also {
- if (interfaceIDs.nightscoutId != null) it.put("_id", interfaceIDs.nightscoutId)
- }
+ .put("type", "sgv")
+ .also { if (isAdd && interfaceIDs.nightscoutId != null) it.put("_id", interfaceIDs.nightscoutId) }
diff --git a/core/src/main/java/info/nightscout/androidaps/extensions/HexByteArrayConversion.kt b/core/src/main/java/info/nightscout/androidaps/extensions/HexByteArrayConversion.kt
index 8de21e6552..9976da33ba 100644
--- a/core/src/main/java/info/nightscout/androidaps/extensions/HexByteArrayConversion.kt
+++ b/core/src/main/java/info/nightscout/androidaps/extensions/HexByteArrayConversion.kt
@@ -18,11 +18,12 @@ fun ByteArray.toHex() : String{
return result.toString()
}
-fun String.hexStringToByteArray() : ByteArray {
+@kotlin.ExperimentalStdlibApi
+fun String.hexStringToByteArray(): ByteArray {
val result = ByteArray(length / 2)
- val lowerCased = this.toLowerCase(Locale.getDefault())
+ val lowerCased = this.lowercase(Locale.getDefault())
for (i in 0 until length step 2) {
val firstIndex = HEX_CHARS.indexOf(lowerCased[i])
val secondIndex = HEX_CHARS.indexOf(lowerCased[i + 1])
diff --git a/core/src/main/java/info/nightscout/androidaps/extensions/OfflineEventExtension.kt b/core/src/main/java/info/nightscout/androidaps/extensions/OfflineEventExtension.kt
new file mode 100644
index 0000000000..c18089c6c2
--- /dev/null
+++ b/core/src/main/java/info/nightscout/androidaps/extensions/OfflineEventExtension.kt
@@ -0,0 +1,64 @@
+package info.nightscout.androidaps.extensions
+
+import info.nightscout.androidaps.database.embedments.InterfaceIDs
+import info.nightscout.androidaps.database.entities.OfflineEvent
+import info.nightscout.androidaps.database.entities.TherapyEvent
+import info.nightscout.androidaps.utils.DateUtil
+import info.nightscout.androidaps.utils.JsonHelper
+import info.nightscout.androidaps.utils.T
+import org.json.JSONObject
+
+fun OfflineEvent.toJson(isAdd: Boolean, dateUtil: DateUtil): JSONObject =
+ JSONObject()
+ .put("created_at", dateUtil.toISOString(timestamp))
+ .put("enteredBy", "openaps://" + "AndroidAPS")
+ .put("eventType", TherapyEvent.Type.APS_OFFLINE.text)
+ .put("isValid", isValid)
+ .put("duration", T.msecs(duration).mins())
+ .put("reason", reason.name)
+ .also {
+ if (interfaceIDs.pumpId != null) it.put("pumpId", interfaceIDs.pumpId)
+ if (interfaceIDs.pumpType != null) it.put("pumpType", interfaceIDs.pumpType!!.name)
+ if (interfaceIDs.pumpSerial != null) it.put("pumpSerial", interfaceIDs.pumpSerial)
+ if (isAdd && interfaceIDs.nightscoutId != null) it.put("_id", interfaceIDs.nightscoutId)
+ }
+
+/* NS PS
+{
+ "enteredBy": "undefined",
+ "eventType": "OpenAPS Offline",
+ "duration": 60,
+ "created_at": "2021-05-27T15:11:52.230Z",
+ "utcOffset": 0,
+ "_id": "60afb6ba3c0d77e3e720f2fe",
+ "mills": 1622128312230,
+ "carbs": null,
+ "insulin": null
+}
+ */
+fun offlineEventFromJson(jsonObject: JSONObject): OfflineEvent? {
+ val timestamp = JsonHelper.safeGetLongAllowNull(jsonObject, "mills", null) ?: return null
+ val duration = JsonHelper.safeGetLong(jsonObject, "duration")
+ val isValid = JsonHelper.safeGetBoolean(jsonObject, "isValid", true)
+ val id = JsonHelper.safeGetStringAllowNull(jsonObject, "_id", null)
+ val pumpId = JsonHelper.safeGetLongAllowNull(jsonObject, "pumpId", null)
+ val pumpType = InterfaceIDs.PumpType.fromString(JsonHelper.safeGetStringAllowNull(jsonObject, "pumpType", null))
+ val pumpSerial = JsonHelper.safeGetStringAllowNull(jsonObject, "pumpSerial", null)
+ val reason = OfflineEvent.Reason.fromString(JsonHelper.safeGetString(jsonObject, "reason", OfflineEvent.Reason.OTHER.name))
+
+
+
+ return OfflineEvent(
+ timestamp = timestamp,
+ duration = T.mins(duration).msecs(),
+ isValid = isValid,
+ reason = reason
+ ).also {
+ it.interfaceIDs.nightscoutId = id
+ it.interfaceIDs.pumpId = pumpId
+ it.interfaceIDs.pumpType = pumpType
+ it.interfaceIDs.pumpSerial = pumpSerial
+ }
+}
+
+
diff --git a/core/src/main/java/info/nightscout/androidaps/extensions/ProfileSwitchExtension.kt b/core/src/main/java/info/nightscout/androidaps/extensions/ProfileSwitchExtension.kt
index 806e1b47f3..fcb480a87c 100644
--- a/core/src/main/java/info/nightscout/androidaps/extensions/ProfileSwitchExtension.kt
+++ b/core/src/main/java/info/nightscout/androidaps/extensions/ProfileSwitchExtension.kt
@@ -7,6 +7,7 @@ import info.nightscout.androidaps.database.embedments.InterfaceIDs
import info.nightscout.androidaps.database.entities.ProfileSwitch
import info.nightscout.androidaps.database.entities.TemporaryBasal
import info.nightscout.androidaps.database.entities.TherapyEvent
+import info.nightscout.androidaps.interfaces.ActivePlugin
import info.nightscout.androidaps.interfaces.GlucoseUnit
import info.nightscout.androidaps.interfaces.Profile
import info.nightscout.androidaps.utils.DateUtil
@@ -16,24 +17,38 @@ import info.nightscout.androidaps.utils.T
import org.json.JSONObject
import java.util.*
-fun ProfileSwitch.toJson(dateUtil: DateUtil): JSONObject =
+fun ProfileSwitch.toJson(isAdd: Boolean, dateUtil: DateUtil): JSONObject =
JSONObject()
.put("created_at", dateUtil.toISOString(timestamp))
.put("enteredBy", "openaps://" + "AndroidAPS")
+ .put("isValid", isValid)
.put("eventType", TherapyEvent.Type.PROFILE_SWITCH.text)
.put("duration", T.msecs(duration).mins())
.put("profile", getCustomizedName())
- .put("profileJson", ProfileSealed.PS(this).toPureNsJson(dateUtil))
- .put("timeshift", T.msecs(timeshift).hours())
- .put("percentage", percentage)
+ .put("profileJson", ProfileSealed.PS(this).toPureNsJson(dateUtil).toString())
+ .put("timeshift", 0)
+ .put("percentage", 100) // customization already applied to json
.also {
if (interfaceIDs.pumpId != null) it.put("pumpId", interfaceIDs.pumpId)
if (interfaceIDs.pumpType != null) it.put("pumpType", interfaceIDs.pumpType!!.name)
if (interfaceIDs.pumpSerial != null) it.put("pumpSerial", interfaceIDs.pumpSerial)
- if (interfaceIDs.nightscoutId != null) it.put("_id", interfaceIDs.nightscoutId)
+ if (isAdd && interfaceIDs.nightscoutId != null) it.put("_id", interfaceIDs.nightscoutId)
}
-fun profileSwitchFromJson(jsonObject: JSONObject, dateUtil: DateUtil): ProfileSwitch? {
+/* NS PS
+{
+ "_id":"608ffa268db0676196a772d7",
+ "enteredBy":"undefined",
+ "eventType":"Profile Switch",
+ "duration":10,
+ "profile":"LocalProfile0",
+ "created_at":"2021-05-03T13:26:58.537Z",
+ "utcOffset":0,
+ "mills":1620048418537,
+ "mgdl":98
+}
+ */
+fun profileSwitchFromJson(jsonObject: JSONObject, dateUtil: DateUtil, activePlugin: ActivePlugin): ProfileSwitch? {
val timestamp = JsonHelper.safeGetLongAllowNull(jsonObject, "mills", null) ?: return null
val duration = JsonHelper.safeGetLong(jsonObject, "duration")
val timeshift = JsonHelper.safeGetLong(jsonObject, "timeshift")
@@ -41,15 +56,21 @@ fun profileSwitchFromJson(jsonObject: JSONObject, dateUtil: DateUtil): ProfileSw
val isValid = JsonHelper.safeGetBoolean(jsonObject, "isValid", true)
val id = JsonHelper.safeGetStringAllowNull(jsonObject, "_id", null)
val profileName = JsonHelper.safeGetStringAllowNull(jsonObject, "profile", null) ?: return null
- val profileJson = JsonHelper.safeGetStringAllowNull(jsonObject, "profileJson", null) ?: return null
+ val profileJson = JsonHelper.safeGetStringAllowNull(jsonObject, "profileJson", null)
val pumpId = JsonHelper.safeGetLongAllowNull(jsonObject, "pumpId", null)
val pumpType = InterfaceIDs.PumpType.fromString(JsonHelper.safeGetStringAllowNull(jsonObject, "pumpType", null))
val pumpSerial = JsonHelper.safeGetStringAllowNull(jsonObject, "pumpSerial", null)
if (timestamp == 0L) return null
- val pureProfile = pureProfileFromJson(JSONObject(profileJson), dateUtil) ?: return null
+ val pureProfile =
+ if (profileJson == null) { // entered through NS, no JSON attached
+ val profilePlugin = activePlugin.activeProfileSource
+ val store = profilePlugin.profile ?: return null
+ store.getSpecificProfile(profileName) ?: return null
+ } else pureProfileFromJson(JSONObject(profileJson), dateUtil) ?: return null
val profileSealed = ProfileSealed.Pure(pureProfile)
+
return ProfileSwitch(
timestamp = timestamp,
basalBlocks = profileSealed.basalBlocks,
@@ -74,9 +95,9 @@ fun profileSwitchFromJson(jsonObject: JSONObject, dateUtil: DateUtil): ProfileSw
/**
* Pure profile doesn't contain timestamp, percentage, timeshift, profileName
*/
-fun pureProfileFromJson(jsonObject: JSONObject, dateUtil: DateUtil): PureProfile? {
+fun pureProfileFromJson(jsonObject: JSONObject, dateUtil: DateUtil, defaultUnits: String? = null): PureProfile? {
try {
- JsonHelper.safeGetStringAllowNull(jsonObject, "units", null) ?: return null
+ JsonHelper.safeGetStringAllowNull(jsonObject, "units", defaultUnits) ?: return null
val units = GlucoseUnit.fromText(JsonHelper.safeGetString(jsonObject, "units", Constants.MGDL))
val dia = JsonHelper.safeGetDoubleAllowNull(jsonObject, "dia") ?: return null
val timezone = TimeZone.getTimeZone(JsonHelper.safeGetString(jsonObject, "timezone", "UTC"))
diff --git a/core/src/main/java/info/nightscout/androidaps/extensions/TemporaryBasalExtension.kt b/core/src/main/java/info/nightscout/androidaps/extensions/TemporaryBasalExtension.kt
index e25a6284d1..391fd5fed6 100644
--- a/core/src/main/java/info/nightscout/androidaps/extensions/TemporaryBasalExtension.kt
+++ b/core/src/main/java/info/nightscout/androidaps/extensions/TemporaryBasalExtension.kt
@@ -62,22 +62,23 @@ fun TemporaryBasal.toStringFull(profile: Profile, dateUtil: DateUtil): String {
}
}
-fun TemporaryBasal.toJson(profile: Profile, dateUtil: DateUtil): JSONObject =
+fun TemporaryBasal.toJson(isAdd: Boolean, profile: Profile, dateUtil: DateUtil, useAbsolute: Boolean): JSONObject =
JSONObject()
.put("created_at", dateUtil.toISOString(timestamp))
.put("enteredBy", "openaps://" + "AndroidAPS")
.put("eventType", TherapyEvent.Type.TEMPORARY_BASAL.text)
+ .put("isValid", isValid)
.put("duration", T.msecs(duration).mins())
.put("rate", rate)
.put("type", type.name)
.also {
- if (isAbsolute) it.put("absolute", rate)
+ if (useAbsolute) it.put("absolute", convertedToAbsolute(timestamp, profile))
else it.put("percent", convertedToPercent(timestamp, profile) - 100)
if (interfaceIDs.pumpId != null) it.put("pumpId", interfaceIDs.pumpId)
if (interfaceIDs.endId != null) it.put("endId", interfaceIDs.endId)
if (interfaceIDs.pumpType != null) it.put("pumpType", interfaceIDs.pumpType!!.name)
if (interfaceIDs.pumpSerial != null) it.put("pumpSerial", interfaceIDs.pumpSerial)
- if (interfaceIDs.nightscoutId != null) it.put("_id", interfaceIDs.nightscoutId)
+ if (isAdd && interfaceIDs.nightscoutId != null) it.put("_id", interfaceIDs.nightscoutId)
}
/*
@@ -165,7 +166,6 @@ fun TemporaryBasal.iobCalc(time: Long, profile: Profile, insulinInterface: Insul
result.hightempinsulin += tempBolusPart.amount
}
}
- result.netRatio = netBasalRate // ratio at the end of interval
}
}
result.netInsulin = netBasalAmount
@@ -217,7 +217,6 @@ fun TemporaryBasal.iobCalc(time: Long, profile: Profile, lastAutosensResult: Aut
result.hightempinsulin += tempBolusPart.amount
}
}
- result.netRatio = netBasalRate // ratio at the end of interval
}
}
result.netInsulin = netBasalAmount
diff --git a/core/src/main/java/info/nightscout/androidaps/extensions/TemporaryTargetExtension.kt b/core/src/main/java/info/nightscout/androidaps/extensions/TemporaryTargetExtension.kt
index df7ee5a069..9c45de88ad 100644
--- a/core/src/main/java/info/nightscout/androidaps/extensions/TemporaryTargetExtension.kt
+++ b/core/src/main/java/info/nightscout/androidaps/extensions/TemporaryTargetExtension.kt
@@ -2,10 +2,10 @@ package info.nightscout.androidaps.extensions
import info.nightscout.androidaps.Constants
import info.nightscout.androidaps.core.R
-import info.nightscout.androidaps.interfaces.Profile
import info.nightscout.androidaps.database.entities.TemporaryTarget
import info.nightscout.androidaps.database.entities.TherapyEvent
import info.nightscout.androidaps.interfaces.GlucoseUnit
+import info.nightscout.androidaps.interfaces.Profile
import info.nightscout.androidaps.utils.DateUtil
import info.nightscout.androidaps.utils.DecimalFormatter
import info.nightscout.androidaps.utils.JsonHelper
@@ -14,6 +14,9 @@ import info.nightscout.androidaps.utils.resources.ResourceHelper
import org.json.JSONObject
import java.util.concurrent.TimeUnit
+fun TemporaryTarget.isInProgress(dateUtil: DateUtil): Boolean =
+ dateUtil.now() in timestamp..timestamp + duration
+
fun TemporaryTarget.lowValueToUnitsToString(units: GlucoseUnit): String =
if (units == GlucoseUnit.MGDL) DecimalFormatter.to0Decimal(this.lowTarget)
else DecimalFormatter.to1Decimal(this.lowTarget * Constants.MGDL_TO_MMOLL)
@@ -88,7 +91,7 @@ fun temporaryTargetFromJson(jsonObject: JSONObject): TemporaryTarget? {
return tt
}
-fun TemporaryTarget.toJson(units: GlucoseUnit, dateUtil: DateUtil): JSONObject =
+fun TemporaryTarget.toJson(isAdd: Boolean, units: GlucoseUnit, dateUtil: DateUtil): JSONObject =
JSONObject()
.put("eventType", TherapyEvent.Type.TEMPORARY_TARGET.text)
.put("duration", T.msecs(duration).mins())
@@ -100,5 +103,5 @@ fun TemporaryTarget.toJson(units: GlucoseUnit, dateUtil: DateUtil): JSONObject =
.put("targetBottom", Profile.fromMgdlToUnits(lowTarget, units))
.put("targetTop", Profile.fromMgdlToUnits(highTarget, units))
.put("units", units.asText)
- if (interfaceIDs.nightscoutId != null) it.put("_id", interfaceIDs.nightscoutId)
+ if (isAdd && interfaceIDs.nightscoutId != null) it.put("_id", interfaceIDs.nightscoutId)
}
diff --git a/core/src/main/java/info/nightscout/androidaps/extensions/TherapyEventExtension.kt b/core/src/main/java/info/nightscout/androidaps/extensions/TherapyEventExtension.kt
index f2f81192b6..898fa5f371 100644
--- a/core/src/main/java/info/nightscout/androidaps/extensions/TherapyEventExtension.kt
+++ b/core/src/main/java/info/nightscout/androidaps/extensions/TherapyEventExtension.kt
@@ -97,9 +97,10 @@ fun therapyEventFromJson(jsonObject: JSONObject): TherapyEvent? {
return te
}
-fun TherapyEvent.toJson(): JSONObject =
+fun TherapyEvent.toJson(isAdd: Boolean): JSONObject =
JSONObject()
.put("eventType", type.text)
+ .put("isValid", isValid)
.put("created_at", timestamp)
.put("enteredBy", enteredBy)
.put("units", if (glucoseUnit == TherapyEvent.GlucoseUnit.MGDL) Constants.MGDL else Constants.MMOL)
@@ -108,7 +109,7 @@ fun TherapyEvent.toJson(): JSONObject =
if (note != null) it.put("notes", note)
if (glucose != null) it.put("glucose", glucose)
if (glucoseType != null) it.put("glucoseType", glucoseType!!.text)
- if (interfaceIDs.nightscoutId != null) it.put("_id", interfaceIDs.nightscoutId)
+ if (isAdd && interfaceIDs.nightscoutId != null) it.put("_id", interfaceIDs.nightscoutId)
if (type == TherapyEvent.Type.ANNOUNCEMENT) it.put("isAnnouncement", true)
}
diff --git a/core/src/main/java/info/nightscout/androidaps/interfaces/CommandQueueProvider.kt b/core/src/main/java/info/nightscout/androidaps/interfaces/CommandQueueProvider.kt
index 5dce29d8dc..31fb77e6b1 100644
--- a/core/src/main/java/info/nightscout/androidaps/interfaces/CommandQueueProvider.kt
+++ b/core/src/main/java/info/nightscout/androidaps/interfaces/CommandQueueProvider.kt
@@ -38,5 +38,5 @@ interface CommandQueueProvider {
fun isCustomCommandRunning(customCommandType: Class): Boolean
fun isCustomCommandInQueue(customCommandType: Class): Boolean
fun spannedStatus(): Spanned
- fun isThisProfileSet(profile: Profile): Boolean
+ fun isThisProfileSet(requestedProfile: Profile): Boolean
}
\ No newline at end of file
diff --git a/core/src/main/java/info/nightscout/androidaps/interfaces/Constraints.kt b/core/src/main/java/info/nightscout/androidaps/interfaces/Constraints.kt
index c759b31ea4..95a901f626 100644
--- a/core/src/main/java/info/nightscout/androidaps/interfaces/Constraints.kt
+++ b/core/src/main/java/info/nightscout/androidaps/interfaces/Constraints.kt
@@ -1,7 +1,5 @@
package info.nightscout.androidaps.interfaces
-import info.nightscout.androidaps.interfaces.Profile
-
/**
* Constraints interface
*
@@ -15,20 +13,20 @@ import info.nightscout.androidaps.interfaces.Profile
*/
interface Constraints {
- @JvmDefault fun isLoopInvocationAllowed(value: Constraint): Constraint = value
- @JvmDefault fun isClosedLoopAllowed(value: Constraint): Constraint = value
- @JvmDefault fun isLgsAllowed(value: Constraint): Constraint = value
- @JvmDefault fun isAutosensModeEnabled(value: Constraint): Constraint = value
- @JvmDefault fun isAMAModeEnabled(value: Constraint): Constraint = value
- @JvmDefault fun isSMBModeEnabled(value: Constraint): Constraint = value
- @JvmDefault fun isUAMEnabled(value: Constraint): Constraint = value
- @JvmDefault fun isAdvancedFilteringEnabled(value: Constraint): Constraint = value
- @JvmDefault fun isSuperBolusEnabled(value: Constraint): Constraint = value
- @JvmDefault fun applyBasalConstraints(absoluteRate: Constraint, profile: Profile): Constraint = absoluteRate
- @JvmDefault fun applyBasalPercentConstraints(percentRate: Constraint, profile: Profile): Constraint = percentRate
- @JvmDefault fun applyBolusConstraints(insulin: Constraint): Constraint = insulin
- @JvmDefault fun applyExtendedBolusConstraints(insulin: Constraint): Constraint = insulin
- @JvmDefault fun applyCarbsConstraints(carbs: Constraint): Constraint = carbs
- @JvmDefault fun applyMaxIOBConstraints(maxIob: Constraint): Constraint = maxIob
- @JvmDefault fun isAutomationEnabled(value: Constraint): Constraint = value
+ fun isLoopInvocationAllowed(value: Constraint): Constraint = value
+ fun isClosedLoopAllowed(value: Constraint): Constraint = value
+ fun isLgsAllowed(value: Constraint): Constraint = value
+ fun isAutosensModeEnabled(value: Constraint): Constraint = value
+ fun isAMAModeEnabled(value: Constraint): Constraint = value
+ fun isSMBModeEnabled(value: Constraint): Constraint = value
+ fun isUAMEnabled(value: Constraint): Constraint = value
+ fun isAdvancedFilteringEnabled(value: Constraint): Constraint = value
+ fun isSuperBolusEnabled(value: Constraint): Constraint = value
+ fun applyBasalConstraints(absoluteRate: Constraint, profile: Profile): Constraint = absoluteRate
+ fun applyBasalPercentConstraints(percentRate: Constraint, profile: Profile): Constraint = percentRate
+ fun applyBolusConstraints(insulin: Constraint): Constraint = insulin
+ fun applyExtendedBolusConstraints(insulin: Constraint): Constraint = insulin
+ fun applyCarbsConstraints(carbs: Constraint): Constraint = carbs
+ fun applyMaxIOBConstraints(maxIob: Constraint): Constraint = maxIob
+ fun isAutomationEnabled(value: Constraint): Constraint = value
}
\ No newline at end of file
diff --git a/core/src/main/java/info/nightscout/androidaps/interfaces/DataSyncSelector.kt b/core/src/main/java/info/nightscout/androidaps/interfaces/DataSyncSelector.kt
index b4221f79bb..83f9e5e7bb 100644
--- a/core/src/main/java/info/nightscout/androidaps/interfaces/DataSyncSelector.kt
+++ b/core/src/main/java/info/nightscout/androidaps/interfaces/DataSyncSelector.kt
@@ -2,6 +2,7 @@ package info.nightscout.androidaps.interfaces
import info.nightscout.androidaps.database.entities.DeviceStatus
import info.nightscout.androidaps.database.entities.*
+import org.json.JSONObject
interface DataSyncSelector {
@@ -15,6 +16,10 @@ interface DataSyncSelector {
data class PairTemporaryBasal(val value: TemporaryBasal, val updateRecordId: Long)
data class PairExtendedBolus(val value: ExtendedBolus, val updateRecordId: Long)
data class PairProfileSwitch(val value: ProfileSwitch, val updateRecordId: Long)
+ data class PairOfflineEvent(val value: OfflineEvent, val updateRecordId: Long)
+ data class PairProfileStore(val value: JSONObject, val timestampSync: Long)
+
+ fun doUpload()
fun resetToNextFullSync()
@@ -72,4 +77,12 @@ interface DataSyncSelector {
fun changedProfileSwitch() : List
// Until NS v3
fun processChangedProfileSwitchesCompat(): Boolean
+
+ fun confirmLastOfflineEventIdIfGreater(lastSynced: Long)
+ fun changedOfflineEvents() : List
+ // Until NS v3
+ fun processChangedOfflineEventsCompat(): Boolean
+
+ fun confirmLastProfileStore(lastSynced: Long)
+ fun processChangedProfileStore()
}
\ No newline at end of file
diff --git a/core/src/main/java/info/nightscout/androidaps/interfaces/DatabaseHelperInterface.kt b/core/src/main/java/info/nightscout/androidaps/interfaces/DatabaseHelperInterface.kt
index e4a5582d49..fe783413a0 100644
--- a/core/src/main/java/info/nightscout/androidaps/interfaces/DatabaseHelperInterface.kt
+++ b/core/src/main/java/info/nightscout/androidaps/interfaces/DatabaseHelperInterface.kt
@@ -1,28 +1,14 @@
package info.nightscout.androidaps.interfaces
-import com.j256.ormlite.dao.CloseableIterator
import info.nightscout.androidaps.db.*
-import org.json.JSONObject
interface DatabaseHelperInterface {
fun resetDatabases()
- fun createOrUpdate(record: DanaRHistoryRecord)
fun createOrUpdate(record: OmnipodHistoryRecord)
- fun createOrUpdate(record: InsightBolusID)
- fun createOrUpdate(record: InsightPumpID)
- fun createOrUpdate(record: InsightHistoryOffset)
fun createOrUpdate(record: OHQueueItem)
- fun create(record: DbRequest)
- fun getDanaRHistoryRecordsByType(type: Byte): List
- fun size(table: String): Long
- fun deleteAllDbRequests()
- fun deleteDbRequest(id: String): Int
fun delete(extendedBolus: ExtendedBolus)
- fun deleteDbRequestbyMongoId(action: String, _id: String)
- fun getDbRequestIterator(): CloseableIterator
- fun roundDateToSec(date: Long): Long
fun createOrUpdate(tempBasal: TemporaryBasal): Boolean
@Deprecated("Use new DB")
fun findTempBasalByPumpId(id: Long): TemporaryBasal?
@@ -35,19 +21,9 @@ interface DatabaseHelperInterface {
fun getAllOHQueueItems(maxEntries: Long): List
// old DB model
- fun getInsightBolusID(pumpSerial: String, bolusID: Int, timestamp: Long): InsightBolusID?
- fun getInsightHistoryOffset(pumpSerial: String): InsightHistoryOffset?
- fun getPumpStoppedEvent(pumpSerial: String, before: Long): InsightPumpID?
fun getOHQueueSize(): Long
fun clearOpenHumansQueue()
- fun getCountOfAllRows(): Long
fun removeAllOHQueueItemsWithIdSmallerThan(id: Long)
- companion object {
-
- const val DATABASE_INSIGHT_HISTORY_OFFSETS = "InsightHistoryOffsets"
- const val DATABASE_INSIGHT_BOLUS_IDS = "InsightBolusIDs"
- const val DATABASE_INSIGHT_PUMP_IDS = "InsightPumpIDs"
- }
}
diff --git a/core/src/main/java/info/nightscout/androidaps/interfaces/IobCobCalculator.kt b/core/src/main/java/info/nightscout/androidaps/interfaces/IobCobCalculator.kt
index 7f505674eb..e0e3dfbb0a 100644
--- a/core/src/main/java/info/nightscout/androidaps/interfaces/IobCobCalculator.kt
+++ b/core/src/main/java/info/nightscout/androidaps/interfaces/IobCobCalculator.kt
@@ -2,7 +2,6 @@ package info.nightscout.androidaps.interfaces
import info.nightscout.androidaps.data.IobTotal
import info.nightscout.androidaps.data.MealData
-import info.nightscout.androidaps.interfaces.Profile
import info.nightscout.androidaps.database.entities.ExtendedBolus
import info.nightscout.androidaps.database.entities.TemporaryBasal
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.AutosensDataStore
@@ -19,8 +18,7 @@ interface IobCobCalculator {
fun getMealDataWithWaitingForCalculationFinish(): MealData
fun getLastAutosensDataWithWaitForCalculationFinish(reason: String): AutosensData?
- fun calculateAbsInsulinFromTreatmentsAndTemps(fromTime: Long): IobTotal
- fun calculateFromTreatmentsAndTemps(time: Long, profile: Profile): IobTotal
+ fun calculateFromTreatmentsAndTemps(toTime: Long, profile: Profile): IobTotal
fun getBasalData(profile: Profile, fromTime: Long): BasalData
@@ -72,14 +70,12 @@ interface IobCobCalculator {
fun getExtendedBolus(timestamp: Long): ExtendedBolus?
/**
- * Calculate IOB of all insulin in the body to the time
- *
- * Running basal is added to the IOB !!!
+ * Calculate IOB of base basal insulin (usualy not accounted towards IOB)
*
* @param toTime
* @return IobTotal
*/
- fun calculateAbsoluteIobTempBasals(toTime: Long): IobTotal
+ fun calculateAbsoluteIobFromBaseBasals(toTime: Long): IobTotal
/**
* Calculate IOB from Temporary basals and Extended boluses (if emulation is enabled) to the the time specified
diff --git a/core/src/main/java/info/nightscout/androidaps/interfaces/LoopInterface.kt b/core/src/main/java/info/nightscout/androidaps/interfaces/Loop.kt
similarity index 76%
rename from core/src/main/java/info/nightscout/androidaps/interfaces/LoopInterface.kt
rename to core/src/main/java/info/nightscout/androidaps/interfaces/Loop.kt
index fb6cb46594..a761e116b0 100644
--- a/core/src/main/java/info/nightscout/androidaps/interfaces/LoopInterface.kt
+++ b/core/src/main/java/info/nightscout/androidaps/interfaces/Loop.kt
@@ -1,9 +1,10 @@
package info.nightscout.androidaps.interfaces
import info.nightscout.androidaps.data.PumpEnactResult
+import info.nightscout.androidaps.database.entities.OfflineEvent
import info.nightscout.androidaps.plugins.aps.loop.APSResult
-interface LoopInterface {
+interface Loop {
class LastRun {
@@ -22,8 +23,9 @@ interface LoopInterface {
var lastRun: LastRun?
val isSuspended: Boolean
+ var enabled: Boolean
- fun suspendTo(endTime: Long)
- fun createOfflineEvent(durationInMinutes: Int)
+ fun minutesToEndOfSuspend(): Int
+ fun goToZeroTemp(durationInMinutes: Int, profile: Profile, reason: OfflineEvent.Reason)
fun suspendLoop(durationInMinutes: Int)
}
\ No newline at end of file
diff --git a/core/src/main/java/info/nightscout/androidaps/interfaces/Overview.kt b/core/src/main/java/info/nightscout/androidaps/interfaces/Overview.kt
index 23d43b35b0..1639ec79aa 100644
--- a/core/src/main/java/info/nightscout/androidaps/interfaces/Overview.kt
+++ b/core/src/main/java/info/nightscout/androidaps/interfaces/Overview.kt
@@ -1,3 +1,9 @@
package info.nightscout.androidaps.interfaces
-interface Overview : ConfigExportImport
\ No newline at end of file
+import info.nightscout.androidaps.plugins.bus.RxBusWrapper
+
+interface Overview : ConfigExportImport {
+
+ fun refreshLoop(from: String)
+ val overviewBus: RxBusWrapper
+}
\ No newline at end of file
diff --git a/core/src/main/java/info/nightscout/androidaps/interfaces/Profile.kt b/core/src/main/java/info/nightscout/androidaps/interfaces/Profile.kt
index 7e371284f1..3d43cdc60f 100644
--- a/core/src/main/java/info/nightscout/androidaps/interfaces/Profile.kt
+++ b/core/src/main/java/info/nightscout/androidaps/interfaces/Profile.kt
@@ -30,6 +30,11 @@ interface Profile {
*/
val timeshift: Int
+ /**
+ * is equal to another profile?
+ */
+ fun isEqual(profile: Profile): Boolean
+
/**
* Basal value according to "now"
*/
@@ -160,16 +165,20 @@ interface Profile {
if (units == GlucoseUnit.MGDL) (if (valueInMgdl > 0) "+" else "") + to0Decimal(valueInMgdl)
else (if (valueInMmol > 0) "+" else "") + to1Decimal(valueInMmol)
+ fun isMgdl(anyBg: Double) = anyBg >= 39
+ fun isMmol(anyBg: Double) = anyBg < 39
+ fun unit(anyBg: Double) = if (isMgdl(anyBg)) GlucoseUnit.MGDL else GlucoseUnit.MMOL
+
fun toCurrentUnits(profileFunction: ProfileFunction, anyBg: Double): Double =
- if (anyBg < 32) fromMmolToUnits(anyBg, profileFunction.getUnits())
+ if (isMmol(anyBg)) fromMmolToUnits(anyBg, profileFunction.getUnits())
else fromMgdlToUnits(anyBg, profileFunction.getUnits())
fun toCurrentUnits(units: GlucoseUnit, anyBg: Double): Double =
- if (anyBg < 32) fromMmolToUnits(anyBg, units)
+ if (isMmol(anyBg)) fromMmolToUnits(anyBg, units)
else fromMgdlToUnits(anyBg, units)
fun toCurrentUnitsString(profileFunction: ProfileFunction, anyBg: Double): String =
- if (anyBg < 32) toUnitsString(anyBg * Constants.MMOLL_TO_MGDL, anyBg, profileFunction.getUnits())
+ if (isMmol(anyBg)) toUnitsString(anyBg * Constants.MMOLL_TO_MGDL, anyBg, profileFunction.getUnits())
else toUnitsString(anyBg, anyBg * Constants.MGDL_TO_MMOLL, profileFunction.getUnits())
fun toMgdl(value: Double, units: GlucoseUnit): Double =
diff --git a/core/src/main/java/info/nightscout/androidaps/interfaces/ProfileStore.kt b/core/src/main/java/info/nightscout/androidaps/interfaces/ProfileStore.kt
index 13d8c008ff..5884128606 100644
--- a/core/src/main/java/info/nightscout/androidaps/interfaces/ProfileStore.kt
+++ b/core/src/main/java/info/nightscout/androidaps/interfaces/ProfileStore.kt
@@ -2,7 +2,6 @@ package info.nightscout.androidaps.interfaces
import androidx.collection.ArrayMap
import dagger.android.HasAndroidInjector
-import info.nightscout.androidaps.data.ProfileImplOld
import info.nightscout.androidaps.data.PureProfile
import info.nightscout.androidaps.extensions.pureProfileFromJson
import info.nightscout.androidaps.logging.AAPSLogger
@@ -32,6 +31,15 @@ class ProfileStore(val injector: HasAndroidInjector, val data: JSONObject, val d
return null
}
+ fun getStartDate(): Long {
+ val iso = JsonHelper.safeGetString(data, "startDate") ?: return 0
+ return try {
+ dateUtil.fromISODateString(iso)
+ } catch (e: Exception) {
+ 0
+ }
+ }
+
fun getDefaultProfile(): PureProfile? = getDefaultProfileName()?.let { getSpecificProfile(it) }
fun getDefaultProfileJson(): JSONObject? = getDefaultProfileName()?.let { getSpecificProfileJson(it) }
@@ -53,12 +61,13 @@ class ProfileStore(val injector: HasAndroidInjector, val data: JSONObject, val d
fun getSpecificProfile(profileName: String): PureProfile? {
var profile: PureProfile? = null
+ val defaultUnits = JsonHelper.safeGetStringAllowNull(data, "units", null)
getStore()?.let { store ->
if (store.has(profileName)) {
profile = cachedObjects[profileName]
if (profile == null) {
JsonHelper.safeGetJSONObject(store, profileName, null)?.let { profileObject ->
- profile = pureProfileFromJson(profileObject, dateUtil)
+ profile = pureProfileFromJson(profileObject, dateUtil, defaultUnits)
cachedObjects[profileName] = profile
}
}
@@ -67,8 +76,7 @@ class ProfileStore(val injector: HasAndroidInjector, val data: JSONObject, val d
return profile
}
- fun getSpecificProfileJson(profileName: String): JSONObject? {
- var profile: PureProfile? = null
+ private fun getSpecificProfileJson(profileName: String): JSONObject? {
getStore()?.let { store ->
if (store.has(profileName))
return JsonHelper.safeGetJSONObject(store, profileName, null)
diff --git a/core/src/main/java/info/nightscout/androidaps/interfaces/Pump.kt b/core/src/main/java/info/nightscout/androidaps/interfaces/Pump.kt
index 43941f21ae..969c85163c 100644
--- a/core/src/main/java/info/nightscout/androidaps/interfaces/Pump.kt
+++ b/core/src/main/java/info/nightscout/androidaps/interfaces/Pump.kt
@@ -1,7 +1,6 @@
package info.nightscout.androidaps.interfaces
import info.nightscout.androidaps.data.DetailedBolusInfo
-import info.nightscout.androidaps.interfaces.Profile
import info.nightscout.androidaps.data.PumpEnactResult
import info.nightscout.androidaps.plugins.common.ManufacturerType
import info.nightscout.androidaps.plugins.general.actions.defs.CustomAction
@@ -52,7 +51,7 @@ interface Pump {
/**
* set initial handshake completed (moved to connected state)
*/
- @JvmDefault fun finishHandshaking() {}
+ fun finishHandshaking() {}
/**
* Perform BT connect, there is new command waiting in queue
@@ -69,7 +68,7 @@ interface Pump {
/**
* @return # of second to wait before [disconnect] is send after last command
*/
- @JvmDefault fun waitForDisconnectionInSeconds(): Int = 5
+ fun waitForDisconnectionInSeconds(): Int = 5
/**
* Stop connection process
@@ -244,14 +243,14 @@ interface Pump {
*
* @return list of custom actions
*/
- @JvmDefault fun getCustomActions(): List? = null
+ fun getCustomActions(): List? = null
/**
* Executes a custom action. Please note that these actions will not be queued
*
* @param customActionType action to be executed
*/
- @JvmDefault fun executeCustomAction(customActionType: CustomActionType) {}
+ fun executeCustomAction(customActionType: CustomActionType) {}
/**
* Executes a custom queued command
@@ -260,22 +259,21 @@ interface Pump {
* @param customCommand the custom command to be executed
* @return PumpEnactResult that represents the command execution result
*/
- @JvmDefault fun executeCustomCommand(customCommand: CustomCommand): PumpEnactResult? = null
+ fun executeCustomCommand(customCommand: CustomCommand): PumpEnactResult? = null
/**
* This method will be called when time or Timezone changes, and pump driver can then do a specific action (for
* example update clock on pump).
*/
- @JvmDefault fun timezoneOrDSTChanged(timeChangeType: TimeChangeType) {}
+ fun timezoneOrDSTChanged(timeChangeType: TimeChangeType) {}
/**
* Only used for pump types where hasCustomUnreachableAlertCheck=true
*/
- @JvmDefault
fun isUnreachableAlertTimeoutExceeded(alertTimeoutMilliseconds: Long): Boolean = false
/**
* if true APS set 100% basal before full hour to avoid pump beeping
*/
- @JvmDefault fun setNeutralTempAtFullHour(): Boolean = false
+ fun setNeutralTempAtFullHour(): Boolean = false
}
\ No newline at end of file
diff --git a/core/src/main/java/info/nightscout/androidaps/interfaces/PumpDescription.kt b/core/src/main/java/info/nightscout/androidaps/interfaces/PumpDescription.kt
index 0aec8d7484..136e899a2c 100644
--- a/core/src/main/java/info/nightscout/androidaps/interfaces/PumpDescription.kt
+++ b/core/src/main/java/info/nightscout/androidaps/interfaces/PumpDescription.kt
@@ -7,7 +7,7 @@ import info.nightscout.androidaps.plugins.pump.common.defs.PumpType
class PumpDescription() {
constructor(pumpType: PumpType) : this() {
- setPumpDescription(pumpType)
+ fillFor(pumpType)
}
var pumpType = PumpType.GENERIC_AAPS
@@ -69,7 +69,7 @@ class PumpDescription() {
hasCustomUnreachableAlertCheck = false
}
- fun setPumpDescription(pumpType: PumpType) {
+ fun fillFor(pumpType: PumpType) {
resetSettings()
this.pumpType = pumpType
val pumpCapability = pumpType.pumpCapability ?: return
diff --git a/core/src/main/java/info/nightscout/androidaps/interfaces/PumpSync.kt b/core/src/main/java/info/nightscout/androidaps/interfaces/PumpSync.kt
index 0ac0080f34..ffc7c04d0a 100644
--- a/core/src/main/java/info/nightscout/androidaps/interfaces/PumpSync.kt
+++ b/core/src/main/java/info/nightscout/androidaps/interfaces/PumpSync.kt
@@ -77,7 +77,7 @@ interface PumpSync {
* USAGE:
* Generate unique temporaryId
* Call before bolus when no pumpId is known (provide timestamp, amount, temporaryId, type, pumpType, pumpSerial)
- * After reading record from history or completed bolus call syncBolusWithTempId with the same temporaryId provided
+ * After reading record from history or completed bolus call [syncBolusWithTempId] with the same temporaryId provided
* If syncBolusWithTempId is not called afterwards record remains valid and is calculated towards iob
*
* @param timestamp timestamp of event from pump history
@@ -276,6 +276,61 @@ interface PumpSync {
**/
fun syncStopTemporaryBasalWithPumpId(timestamp: Long, endPumpId: Long, pumpType: PumpType, pumpSerial: String): Boolean
+ /**
+ * Create temporary basal with temporary id
+ *
+ * Search for combination of temporaryId, PumpType, pumpSerial
+ *
+ * If db record doesn't exist, new record is created.
+ * If exists false is returned and data is ignored
+ *
+ * USAGE:
+ * Generate unique temporaryId
+ * Call on setting temporary basal when no pumpId is known (provide timestamp, temporaryId, type, pumpType, pumpSerial)
+ * After reading record from history or completed bolus call [syncTemporaryBasalWithTempId] with the same temporaryId provided
+ * If syncTemporaryBasalWithTempId is not called afterwards record remains valid and is calculated towards iob
+ *
+ * @param timestamp timestamp of event from pump history
+ * @param rate TBR rate in U/h or % (value of 100% is equal to no TBR)
+ * @param duration duration in milliseconds
+ * @param isAbsolute is TBR in U/h or % ?
+ * @param tempId pump id from history
+ * @param type type of TBR, from request sent to the driver
+ * @param pumpType pump type like PumpType.ACCU_CHEK_COMBO
+ * @param pumpSerial pump serial number
+ * @return true if new record is created
+ *
+ * see [info.nightscout.androidaps.database.transactions.InsertTemporaryBasalWithTempIdTransaction]
+ **/
+
+ fun addTemporaryBasalWithTempId(timestamp: Long, rate: Double, duration: Long, isAbsolute: Boolean, tempId: Long, type: TemporaryBasalType, pumpType: PumpType, pumpSerial: String): Boolean
+
+ /**
+ * Synchronization of temporary basal with temporary id
+ *
+ * Search for combination of temporaryId, PumpType, pumpSerial
+ *
+ * If db record doesn't exist data is ignored and false returned.
+ * If exists, data is updated, type and pumpId only if provided
+ * isValid field is preserved
+ *
+ * USAGE:
+ * After reading record from history or completed bolus call syncTemporaryBasalWithTempId and
+ * provide updated timestamp, rate, duration, pumpId (if known), type (if change needed) with the same temporaryId, pumpType, pumpSerial
+ *
+ * @param timestamp timestamp of event from pump history
+ * @param rate TBR rate in U/h or % (value of 100% is equal to no TBR)
+ * @param duration duration in milliseconds
+ * @param isAbsolute is TBR in U/h or % ?
+ * @param temporaryId temporary id generated when pump id in not know yet
+ * @param type type of TBR, from request sent to the driver
+ * @param pumpId pump id from history
+ * @param pumpType pump type like PumpType.ACCU_CHEK_COMBO
+ * @param pumpSerial pump serial number
+ * @return true if record is successfully updated
+ **/
+ fun syncTemporaryBasalWithTempId(timestamp: Long, rate: Double, duration: Long, isAbsolute: Boolean, temporaryId: Long, type: TemporaryBasalType?, pumpId: Long?, pumpType: PumpType, pumpSerial: String): Boolean
+
/**
* Invalidate of temporary basals that failed to start
* EROS specific, replace by setting duration to zero ????
@@ -284,13 +339,24 @@ interface PumpSync {
* If db record doesn't exist data is ignored and false returned
*
*
- * @param pumpId pump id of ending event from history
- * @param pumpType pump type like PumpType.ACCU_CHEK_COMBO
- * @param pumpSerial pump serial number
+ * @param id id of temporary basal
* @return true if running record is found and invalidated
**/
fun invalidateTemporaryBasal(id: Long): Boolean
+ /**
+ * Invalidate of temporary basals that failed to start
+ * MDT specific
+ *
+ * If exists, isValid is set false
+ * If db record doesn't exist data is ignored and false returned
+ *
+ *
+ * @param temporaryId temporary id of temporary basal
+ * @return true if running record is found and invalidated
+ **/
+ fun invalidateTemporaryBasalWithTempId(temporaryId: Long): Boolean
+
/**
* Synchronization of extended bolus
*
diff --git a/core/src/main/java/info/nightscout/androidaps/interfaces/UploadQueueAdminInterface.kt b/core/src/main/java/info/nightscout/androidaps/interfaces/UploadQueueAdminInterface.kt
deleted file mode 100644
index e749854c0a..0000000000
--- a/core/src/main/java/info/nightscout/androidaps/interfaces/UploadQueueAdminInterface.kt
+++ /dev/null
@@ -1,6 +0,0 @@
-package info.nightscout.androidaps.interfaces
-
-interface UploadQueueAdminInterface : UploadQueueInterface {
-
- fun clearQueue()
-}
\ No newline at end of file
diff --git a/core/src/main/java/info/nightscout/androidaps/interfaces/UploadQueueInterface.java b/core/src/main/java/info/nightscout/androidaps/interfaces/UploadQueueInterface.java
deleted file mode 100644
index 65e02dcdb8..0000000000
--- a/core/src/main/java/info/nightscout/androidaps/interfaces/UploadQueueInterface.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package info.nightscout.androidaps.interfaces;
-
-import org.json.JSONObject;
-
-import info.nightscout.androidaps.db.DbRequest;
-
-public interface UploadQueueInterface {
-
- long size();
-
- void add(DbRequest dbRequest);
-
- void removeByMongoId(final String action, final String _id);
-
- String textList();
-}
diff --git a/core/src/main/java/info/nightscout/androidaps/plugins/aps/loop/APSResult.kt b/core/src/main/java/info/nightscout/androidaps/plugins/aps/loop/APSResult.kt
index b19687a730..39202e1a4b 100644
--- a/core/src/main/java/info/nightscout/androidaps/plugins/aps/loop/APSResult.kt
+++ b/core/src/main/java/info/nightscout/androidaps/plugins/aps/loop/APSResult.kt
@@ -48,7 +48,6 @@ open class APSResult @Inject constructor(val injector: HasAndroidInjector) {
var usePercent = false
var duration = 0
var tempBasalRequested = false
- var bolusRequested = false
var iob: IobTotal? = null
var json: JSONObject? = JSONObject()
var hasPredictions = false
@@ -161,7 +160,6 @@ open class APSResult @Inject constructor(val injector: HasAndroidInjector) {
newResult.rate = rate
newResult.duration = duration
newResult.tempBasalRequested = tempBasalRequested
- newResult.bolusRequested = bolusRequested
newResult.iob = iob
newResult.json = JSONObject(json.toString())
newResult.hasPredictions = hasPredictions
@@ -309,11 +307,11 @@ open class APSResult @Inject constructor(val injector: HasAndroidInjector) {
// closed loop mode: handle change at driver level
if (closedLoopEnabled.value()) {
aapsLogger.debug(LTag.APS, "DEFAULT: Closed mode")
- return tempBasalRequested || bolusRequested
+ return tempBasalRequested || bolusRequested()
}
// open loop mode: try to limit request
- if (!tempBasalRequested && !bolusRequested) {
+ if (!tempBasalRequested && !bolusRequested()) {
aapsLogger.debug(LTag.APS, "FALSE: No request")
return false
}
@@ -399,4 +397,6 @@ open class APSResult @Inject constructor(val injector: HasAndroidInjector) {
}
}
}
+
+ fun bolusRequested(): Boolean = smb > 0.0
}
\ No newline at end of file
diff --git a/core/src/main/java/info/nightscout/androidaps/plugins/configBuilder/RunningConfiguration.kt b/core/src/main/java/info/nightscout/androidaps/plugins/configBuilder/RunningConfiguration.kt
index cf3b151d4d..7b5cb9c382 100644
--- a/core/src/main/java/info/nightscout/androidaps/plugins/configBuilder/RunningConfiguration.kt
+++ b/core/src/main/java/info/nightscout/androidaps/plugins/configBuilder/RunningConfiguration.kt
@@ -82,7 +82,7 @@ class RunningConfiguration @Inject constructor(
if (configuration.has("pump")) {
val pumpType = JsonHelper.safeGetString(configuration, "pump", PumpType.GENERIC_AAPS.description)
sp.putString(R.string.key_virtualpump_type, pumpType)
- activePlugin.activePump.pumpDescription.setPumpDescription(PumpType.getByDescription(pumpType))
+ activePlugin.activePump.pumpDescription.fillFor(PumpType.getByDescription(pumpType))
aapsLogger.debug(LTag.CORE, "Changing pump type to $pumpType")
}
diff --git a/core/src/main/java/info/nightscout/androidaps/plugins/general/actions/defs/CustomActionType.kt b/core/src/main/java/info/nightscout/androidaps/plugins/general/actions/defs/CustomActionType.kt
index fb472d5592..5ffbb25b6b 100644
--- a/core/src/main/java/info/nightscout/androidaps/plugins/general/actions/defs/CustomActionType.kt
+++ b/core/src/main/java/info/nightscout/androidaps/plugins/general/actions/defs/CustomActionType.kt
@@ -1,5 +1,5 @@
package info.nightscout.androidaps.plugins.general.actions.defs
interface CustomActionType {
- val key: String?
+ fun getKey(): String
}
\ No newline at end of file
diff --git a/core/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/formats/EncryptedPrefsFormat.kt b/core/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/formats/EncryptedPrefsFormat.kt
index 532b4eab00..575de38876 100644
--- a/core/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/formats/EncryptedPrefsFormat.kt
+++ b/core/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/formats/EncryptedPrefsFormat.kt
@@ -105,6 +105,7 @@ class EncryptedPrefsFormat @Inject constructor(
}
}
+ @kotlin.ExperimentalStdlibApi
override fun loadPreferences(file: File, masterPassword: String?): Prefs {
val entries: MutableMap = mutableMapOf()
diff --git a/core/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/NSUpload.java b/core/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/NSUpload.java
deleted file mode 100644
index c65ca85828..0000000000
--- a/core/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/NSUpload.java
+++ /dev/null
@@ -1,92 +0,0 @@
-package info.nightscout.androidaps.plugins.general.nsclient;
-
-import org.json.JSONObject;
-
-import javax.inject.Inject;
-import javax.inject.Singleton;
-
-import info.nightscout.androidaps.core.R;
-import info.nightscout.androidaps.db.DbRequest;
-import info.nightscout.androidaps.interfaces.UploadQueueInterface;
-import info.nightscout.androidaps.logging.AAPSLogger;
-import info.nightscout.androidaps.utils.sharedPreferences.SP;
-
-/**
- * Created by mike on 26.05.2017.
- */
-@Singleton
-public class NSUpload {
-
- private final AAPSLogger aapsLogger;
- private final SP sp;
- private final UploadQueueInterface uploadQueue;
-
- @Inject
- public NSUpload(
- AAPSLogger aapsLogger,
- SP sp,
- UploadQueueInterface uploadQueue
- ) {
- this.aapsLogger = aapsLogger;
- this.sp = sp;
- this.uploadQueue = uploadQueue;
- }
-/*
- public void uploadProfileSwitch(ProfileSwitch profileSwitch, long nsClientId, DateUtil dateUtil) {
- try {
- JSONObject data = getJson(profileSwitch, dateUtil);
- DbRequest dbr = new DbRequest("dbAdd", "treatments", data, nsClientId);
- aapsLogger.debug("Prepared: " + dbr.log());
- uploadQueue.add(dbr);
- } catch (JSONException e) {
- aapsLogger.error("Unhandled exception", e);
- }
- }
-
- public void updateProfileSwitch(ProfileSwitch profileSwitch, DateUtil dateUtil) {
- try {
- JSONObject data = getJson(profileSwitch, dateUtil);
- if (profileSwitch._id != null) {
- uploadQueue.add(new DbRequest("dbUpdate", "treatments", profileSwitch._id, data, profileSwitch.date));
- }
- } catch (JSONException e) {
- aapsLogger.error("Unhandled exception", e);
- }
- }
-
- private static JSONObject getJson(ProfileSwitch profileSwitch, DateUtil dateUtil) throws JSONException {
- JSONObject data = new JSONObject();
- data.put("eventType", TherapyEvent.Type.PROFILE_SWITCH.getText());
- data.put("duration", profileSwitch.durationInMinutes);
- data.put("profile", profileSwitch.getCustomizedName());
- data.put("profileJson", profileSwitch.profileJson);
- data.put("profilePlugin", profileSwitch.profilePlugin);
- if (profileSwitch.isCPP) {
- data.put("CircadianPercentageProfile", true);
- data.put("timeshift", profileSwitch.timeshift);
- data.put("percentage", profileSwitch.percentage);
- }
- data.put("created_at", dateUtil.toISOString(profileSwitch.date));
- data.put("enteredBy", "AndroidAPS");
-
- return data;
- }
-*/
- // TODO replace with setting isValid = false
- public void removeCareportalEntryFromNS(String _id) {
- uploadQueue.add(new DbRequest("dbRemove", "treatments", _id, System.currentTimeMillis()));
- }
-
- public void uploadProfileStore(JSONObject profileStore) {
- if (sp.getBoolean(R.string.key_ns_uploadlocalprofile, false)) {
- uploadQueue.add(new DbRequest("dbAdd", "profile", profileStore, System.currentTimeMillis()));
- }
- }
-
- public static boolean isIdValid(String _id) {
- if (_id == null)
- return false;
- return _id.length() == 24;
- }
-
-}
diff --git a/core/src/main/java/info/nightscout/androidaps/plugins/general/overview/graphExtensions/Scale.java b/core/src/main/java/info/nightscout/androidaps/plugins/general/overview/graphExtensions/Scale.java
deleted file mode 100644
index 53fa04af6b..0000000000
--- a/core/src/main/java/info/nightscout/androidaps/plugins/general/overview/graphExtensions/Scale.java
+++ /dev/null
@@ -1,30 +0,0 @@
-package info.nightscout.androidaps.plugins.general.overview.graphExtensions;
-
-/**
- * Created by mike on 18.10.2017.
- */
-
-public class Scale {
- private double multiplier;
- private final double shift;
-
- public Scale() {
- shift = 0;
- }
-
- public Scale(double shift) {
- this.shift = shift;
- }
-
- public void setMultiplier(double value) {
- this.multiplier = value;
- }
-
- public double transform(double original) {
- return original * multiplier + shift;
- }
-
- public double getShift() {
- return shift;
- }
-}
diff --git a/core/src/main/java/info/nightscout/androidaps/plugins/general/overview/graphExtensions/Scale.kt b/core/src/main/java/info/nightscout/androidaps/plugins/general/overview/graphExtensions/Scale.kt
new file mode 100644
index 0000000000..0c11b7e285
--- /dev/null
+++ b/core/src/main/java/info/nightscout/androidaps/plugins/general/overview/graphExtensions/Scale.kt
@@ -0,0 +1,8 @@
+package info.nightscout.androidaps.plugins.general.overview.graphExtensions
+
+class Scale(var shift: Double = 0.0, var multiplier: Double = 0.0) {
+
+ fun transform(original: Double): Double {
+ return original * multiplier + shift
+ }
+}
\ No newline at end of file
diff --git a/core/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/AutosensDataStore.kt b/core/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/AutosensDataStore.kt
index ee892ac0ed..5cbfe021a3 100644
--- a/core/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/AutosensDataStore.kt
+++ b/core/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/AutosensDataStore.kt
@@ -6,7 +6,9 @@ import info.nightscout.androidaps.database.AppRepository
import info.nightscout.androidaps.database.entities.GlucoseValue
import info.nightscout.androidaps.logging.AAPSLogger
import info.nightscout.androidaps.logging.LTag
+import info.nightscout.androidaps.plugins.bus.RxBusWrapper
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.data.AutosensData
+import info.nightscout.androidaps.plugins.iob.iobCobCalculator.events.EventBucketedDataCreated
import info.nightscout.androidaps.utils.DateUtil
import info.nightscout.androidaps.utils.T
import kotlin.math.abs
@@ -151,7 +153,7 @@ class AutosensDataStore {
return someTime + diff
}
- fun loadBgData(to: Long, repository: AppRepository, aapsLogger: AAPSLogger, dateUtil: DateUtil) {
+ fun loadBgData(to: Long, repository: AppRepository, aapsLogger: AAPSLogger, dateUtil: DateUtil, rxBus: RxBusWrapper) {
synchronized(dataLock) {
val start = to - T.hours((24 + 10 /* max dia */).toLong()).msecs()
// there can be some readings with time in close future (caused by wrong time setting on sensor)
@@ -162,6 +164,7 @@ class AutosensDataStore {
.filter { it.value >= 39 }
aapsLogger.debug(LTag.AUTOSENS, "BG data loaded. Size: " + bgReadings.size + " Start date: " + dateUtil.dateAndTimeString(start) + " End date: " + dateUtil.dateAndTimeString(to))
createBucketedData(aapsLogger, dateUtil)
+ rxBus.send(EventBucketedDataCreated())
}
}
diff --git a/core/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/AutosensResult.java b/core/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/AutosensResult.java
deleted file mode 100644
index e1debef726..0000000000
--- a/core/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/AutosensResult.java
+++ /dev/null
@@ -1,39 +0,0 @@
-package info.nightscout.androidaps.plugins.iob.iobCobCalculator;
-
-import org.json.JSONException;
-import org.json.JSONObject;
-import org.slf4j.LoggerFactory;
-
-import info.nightscout.androidaps.logging.LTag;
-
-/**
- * Created by mike on 06.01.2017.
- */
-public class AutosensResult {
-
- //default values to show when autosens algorithm is not called
- public double ratio = 1d;
- public double carbsAbsorbed = 0d;
- public String sensResult = "autosens not available";
- public String pastSensitivity = "";
- public String ratioLimit = "";
-
- public JSONObject json() {
- JSONObject ret = new JSONObject();
- try {
- ret.put("ratio", ratio);
- ret.put("ratioLimit", ratioLimit);
- ret.put("pastSensitivity", pastSensitivity);
- ret.put("sensResult", sensResult);
- ret.put("ratio", ratio);
- } catch (JSONException e) {
- LoggerFactory.getLogger(LTag.CORE.getTag()).error("Unhandled exception", e);
- }
- return ret;
- }
-
- @Override
- public String toString() {
- return json().toString();
- }
-}
diff --git a/core/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/AutosensResult.kt b/core/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/AutosensResult.kt
new file mode 100644
index 0000000000..f447651e29
--- /dev/null
+++ b/core/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/AutosensResult.kt
@@ -0,0 +1,22 @@
+package info.nightscout.androidaps.plugins.iob.iobCobCalculator
+
+import org.json.JSONObject
+
+class AutosensResult {
+
+ //default values to show when autosens algorithm is not called
+ var ratio = 1.0
+ var carbsAbsorbed = 0.0
+ var sensResult = "autosens not available"
+ var pastSensitivity = ""
+ var ratioLimit = ""
+
+ fun json(): JSONObject = JSONObject()
+ .put("ratio", ratio)
+ .put("ratioLimit", ratioLimit)
+ .put("pastSensitivity", pastSensitivity)
+ .put("sensResult", sensResult)
+ .put("ratio", ratio)
+
+ override fun toString(): String = json().toString()
+}
\ No newline at end of file
diff --git a/core/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/data/AutosensData.java b/core/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/data/AutosensData.java
index e3b223937b..bad39f9289 100644
--- a/core/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/data/AutosensData.java
+++ b/core/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/data/AutosensData.java
@@ -108,7 +108,7 @@ public class AutosensData implements DataPointWithLabelInterface {
@NonNull @Override
public String toString() {
return String.format(Locale.ENGLISH, "AutosensData: %s pastSensitivity=%s delta=%.02f avgDelta=%.02f bgi=%.02f deviation=%.02f avgDeviation=%.02f absorbed=%.02f carbsFromBolus=%.02f cob=%.02f autosensRatio=%.02f slopeFromMaxDeviation=%.02f slopeFromMinDeviation=%.02f activeCarbsList=%s",
- dateUtil.dateAndTimeString(time), pastSensitivity, delta, avgDelta, bgi, deviation, avgDeviation, absorbed, carbsFromBolus, cob, autosensResult.ratio, slopeFromMaxDeviation, slopeFromMinDeviation, activeCarbsList.toString());
+ dateUtil.dateAndTimeString(time), pastSensitivity, delta, avgDelta, bgi, deviation, avgDeviation, absorbed, carbsFromBolus, cob, autosensResult.getRatio(), slopeFromMaxDeviation, slopeFromMinDeviation, activeCarbsList.toString());
}
public List cloneCarbsList() {
diff --git a/core/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/events/EventBucketedDataCreated.kt b/core/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/events/EventBucketedDataCreated.kt
new file mode 100644
index 0000000000..c9411eb259
--- /dev/null
+++ b/core/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/events/EventBucketedDataCreated.kt
@@ -0,0 +1,5 @@
+package info.nightscout.androidaps.plugins.iob.iobCobCalculator.events
+
+import info.nightscout.androidaps.events.Event
+
+class EventBucketedDataCreated : Event()
\ No newline at end of file
diff --git a/core/src/main/java/info/nightscout/androidaps/plugins/pump/PumpSyncImplementation.kt b/core/src/main/java/info/nightscout/androidaps/plugins/pump/PumpSyncImplementation.kt
index ac9fa5ded0..4ea4d4d712 100644
--- a/core/src/main/java/info/nightscout/androidaps/plugins/pump/PumpSyncImplementation.kt
+++ b/core/src/main/java/info/nightscout/androidaps/plugins/pump/PumpSyncImplementation.kt
@@ -124,11 +124,11 @@ class PumpSyncImplementation @Inject constructor(
pumpSerial = pumpSerial
)
)
- repository.runTransactionForResult(InsertPumpBolusWithTempIdTransaction(bolus))
- .doOnError { aapsLogger.error(LTag.DATABASE, "Error while saving bolus", it) }
+ repository.runTransactionForResult(InsertBolusWithTempIdTransaction(bolus))
+ .doOnError { aapsLogger.error(LTag.DATABASE, "Error while saving Bolus", it) }
.blockingGet()
.also { result ->
- result.inserted.forEach { aapsLogger.debug(LTag.DATABASE, "Inserted bolus $it") }
+ result.inserted.forEach { aapsLogger.debug(LTag.DATABASE, "Inserted Bolus $it") }
return result.inserted.size > 0
}
}
@@ -146,11 +146,11 @@ class PumpSyncImplementation @Inject constructor(
pumpSerial = pumpSerial
)
)
- repository.runTransactionForResult(SyncPumpBolusWithTempIdTransaction(bolus, type?.toDBbBolusType()))
- .doOnError { aapsLogger.error(LTag.DATABASE, "Error while saving bolus", it) }
+ repository.runTransactionForResult(SyncBolusWithTempIdTransaction(bolus, type?.toDBbBolusType()))
+ .doOnError { aapsLogger.error(LTag.DATABASE, "Error while saving Bolus", it) }
.blockingGet()
.also { result ->
- result.updated.forEach { aapsLogger.debug(LTag.DATABASE, "Updated bolus $it") }
+ result.updated.forEach { aapsLogger.debug(LTag.DATABASE, "Updated Bolus $it") }
return result.updated.size > 0
}
}
@@ -168,11 +168,11 @@ class PumpSyncImplementation @Inject constructor(
)
)
repository.runTransactionForResult(SyncPumpBolusTransaction(bolus, type?.toDBbBolusType()))
- .doOnError { aapsLogger.error(LTag.DATABASE, "Error while saving bolus", it) }
+ .doOnError { aapsLogger.error(LTag.DATABASE, "Error while saving Bolus", it) }
.blockingGet()
.also { result ->
- result.inserted.forEach { aapsLogger.debug(LTag.DATABASE, "Inserted bolus $it") }
- result.updated.forEach { aapsLogger.debug(LTag.DATABASE, "Updated bolus $it") }
+ result.inserted.forEach { aapsLogger.debug(LTag.DATABASE, "Inserted Bolus $it") }
+ result.updated.forEach { aapsLogger.debug(LTag.DATABASE, "Updated Bolus $it") }
return result.inserted.size > 0
}
}
@@ -189,10 +189,10 @@ class PumpSyncImplementation @Inject constructor(
pumpSerial = pumpSerial)
)
repository.runTransactionForResult(InsertIfNewByTimestampCarbsTransaction(carbs))
- .doOnError { aapsLogger.error(LTag.DATABASE, "Error while saving carbs", it) }
+ .doOnError { aapsLogger.error(LTag.DATABASE, "Error while saving Carbs", it) }
.blockingGet()
.also { result ->
- result.inserted.forEach { aapsLogger.debug(LTag.DATABASE, "Inserted carbs $it") }
+ result.inserted.forEach { aapsLogger.debug(LTag.DATABASE, "Inserted Carbs $it") }
return result.inserted.size > 0
}
}
@@ -203,7 +203,7 @@ class PumpSyncImplementation @Inject constructor(
timestamp = timestamp,
type = type.toDBbEventType(),
duration = 0,
- note = null,
+ note = note,
enteredBy = "AndroidAPS",
glucose = null,
glucoseType = null,
@@ -215,11 +215,11 @@ class PumpSyncImplementation @Inject constructor(
)
repository.runTransactionForResult(InsertIfNewByTimestampTherapyEventTransaction(therapyEvent))
.doOnError {
- aapsLogger.error(LTag.DATABASE, "Error while saving therapy event", it)
+ aapsLogger.error(LTag.DATABASE, "Error while saving TherapyEvent", it)
}
.blockingGet()
.also { result ->
- result.inserted.forEach { aapsLogger.debug(LTag.DATABASE, "Inserted therapy event $it") }
+ result.inserted.forEach { aapsLogger.debug(LTag.DATABASE, "Inserted TherapyEvent $it") }
return result.inserted.size > 0
}
}
@@ -249,11 +249,11 @@ class PumpSyncImplementation @Inject constructor(
)
)
repository.runTransactionForResult(SyncPumpTemporaryBasalTransaction(temporaryBasal, type?.toDbType()))
- .doOnError { aapsLogger.error(LTag.DATABASE, "Error while temporary basal", it) }
+ .doOnError { aapsLogger.error(LTag.DATABASE, "Error while TemporaryBasal", it) }
.blockingGet()
.also { result ->
- result.inserted.forEach { aapsLogger.debug(LTag.DATABASE, "Inserted temporary basal $it") }
- result.updated.forEach { aapsLogger.debug(LTag.DATABASE, "Updated temporary basal $it") }
+ result.inserted.forEach { aapsLogger.debug(LTag.DATABASE, "Inserted TemporaryBasal $it") }
+ result.updated.forEach { aapsLogger.debug(LTag.DATABASE, "Updated TemporaryBasal $it") }
return result.inserted.size > 0
}
}
@@ -261,23 +261,82 @@ class PumpSyncImplementation @Inject constructor(
override fun syncStopTemporaryBasalWithPumpId(timestamp: Long, endPumpId: Long, pumpType: PumpType, pumpSerial: String): Boolean {
if (!confirmActivePump(timestamp, pumpType, pumpSerial)) return false
repository.runTransactionForResult(SyncPumpCancelTemporaryBasalIfAnyTransaction(timestamp, endPumpId, pumpType.toDbPumpType(), pumpSerial))
- .doOnError { aapsLogger.error(LTag.DATABASE, "Error while saving temporary basal", it) }
+ .doOnError { aapsLogger.error(LTag.DATABASE, "Error while saving TemporaryBasal", it) }
.blockingGet()
.also { result ->
result.updated.forEach {
- aapsLogger.debug(LTag.DATABASE, "Updated temporary basal $it")
+ aapsLogger.debug(LTag.DATABASE, "Updated TemporaryBasal $it")
}
return result.updated.size > 0
}
}
+ override fun addTemporaryBasalWithTempId(timestamp: Long, rate: Double, duration: Long, isAbsolute: Boolean, tempId: Long, type: PumpSync.TemporaryBasalType, pumpType: PumpType, pumpSerial: String): Boolean {
+ if (!confirmActivePump(timestamp, pumpType, pumpSerial)) return false
+ val temporaryBasal = TemporaryBasal(
+ timestamp = timestamp,
+ rate = rate,
+ duration = duration,
+ type = type.toDbType(),
+ isAbsolute = isAbsolute,
+ interfaceIDs_backing = InterfaceIDs(
+ temporaryId = tempId,
+ pumpType = pumpType.toDbPumpType(),
+ pumpSerial = pumpSerial
+ )
+ )
+ repository.runTransactionForResult(InsertTemporaryBasalWithTempIdTransaction(temporaryBasal))
+ .doOnError { aapsLogger.error(LTag.DATABASE, "Error while saving TemporaryBasal", it) }
+ .blockingGet()
+ .also { result ->
+ result.inserted.forEach { aapsLogger.debug(LTag.DATABASE, "Inserted TemporaryBasal $it") }
+ return result.inserted.size > 0
+ }
+ }
+
+ override fun syncTemporaryBasalWithTempId(timestamp: Long, rate: Double, duration: Long, isAbsolute: Boolean, temporaryId: Long, type: PumpSync.TemporaryBasalType?, pumpId: Long?, pumpType: PumpType, pumpSerial: String): Boolean {
+ if (!confirmActivePump(timestamp, pumpType, pumpSerial)) return false
+ val bolus = TemporaryBasal(
+ timestamp = timestamp,
+ rate = rate,
+ duration = duration,
+ type = TemporaryBasal.Type.NORMAL, // not used for update
+ isAbsolute = isAbsolute,
+ interfaceIDs_backing = InterfaceIDs(
+ temporaryId = temporaryId,
+ pumpId = pumpId,
+ pumpType = pumpType.toDbPumpType(),
+ pumpSerial = pumpSerial
+ )
+ )
+ repository.runTransactionForResult(SyncTemporaryBasalWithTempIdTransaction(bolus, type?.toDbType()))
+ .doOnError { aapsLogger.error(LTag.DATABASE, "Error while saving TemporaryBasal", it) }
+ .blockingGet()
+ .also { result ->
+ result.updated.forEach { aapsLogger.debug(LTag.DATABASE, "Updated TemporaryBasal $it") }
+ return result.updated.size > 0
+ }
+ }
+
override fun invalidateTemporaryBasal(id: Long): Boolean {
repository.runTransactionForResult(InvalidateTemporaryBasalTransaction(id))
- .doOnError { aapsLogger.error(LTag.DATABASE, "Error while invalidating temporary basal", it) }
+ .doOnError { aapsLogger.error(LTag.DATABASE, "Error while invalidating TemporaryBasal", it) }
.blockingGet()
.also { result ->
result.invalidated.forEach {
- aapsLogger.debug(LTag.DATABASE, "Invalidated temporary basal $it")
+ aapsLogger.debug(LTag.DATABASE, "Invalidated TemporaryBasal $it")
+ }
+ return result.invalidated.size > 0
+ }
+ }
+
+ override fun invalidateTemporaryBasalWithTempId(temporaryId: Long): Boolean {
+ repository.runTransactionForResult(InvalidateTemporaryBasalWithTempIdTransaction(temporaryId))
+ .doOnError { aapsLogger.error(LTag.DATABASE, "Error while invalidating TemporaryBasal", it) }
+ .blockingGet()
+ .also { result ->
+ result.invalidated.forEach {
+ aapsLogger.debug(LTag.DATABASE, "Invalidated TemporaryBasal $it")
}
return result.invalidated.size > 0
}
@@ -297,11 +356,11 @@ class PumpSyncImplementation @Inject constructor(
)
)
repository.runTransactionForResult(SyncPumpExtendedBolusTransaction(extendedBolus))
- .doOnError { aapsLogger.error(LTag.DATABASE, "Error while extended bolus", it) }
+ .doOnError { aapsLogger.error(LTag.DATABASE, "Error while ExtendedBolus", it) }
.blockingGet()
.also { result ->
- result.inserted.forEach { aapsLogger.debug(LTag.DATABASE, "Inserted extended bolus $it") }
- result.updated.forEach { aapsLogger.debug(LTag.DATABASE, "Updated extended bolus $it") }
+ result.inserted.forEach { aapsLogger.debug(LTag.DATABASE, "Inserted ExtendedBolus $it") }
+ result.updated.forEach { aapsLogger.debug(LTag.DATABASE, "Updated ExtendedBolus $it") }
return result.inserted.size > 0
}
}
@@ -309,11 +368,11 @@ class PumpSyncImplementation @Inject constructor(
override fun syncStopExtendedBolusWithPumpId(timestamp: Long, endPumpId: Long, pumpType: PumpType, pumpSerial: String): Boolean {
if (!confirmActivePump(timestamp, pumpType, pumpSerial)) return false
repository.runTransactionForResult(SyncPumpCancelExtendedBolusIfAnyTransaction(timestamp, endPumpId, pumpType.toDbPumpType(), pumpSerial))
- .doOnError { aapsLogger.error(LTag.DATABASE, "Error while saving extended bolus", it) }
+ .doOnError { aapsLogger.error(LTag.DATABASE, "Error while saving ExtendedBolus", it) }
.blockingGet()
.also { result ->
result.updated.forEach {
- aapsLogger.debug(LTag.DATABASE, "Updated extended bolus $it")
+ aapsLogger.debug(LTag.DATABASE, "Updated ExtendedBolus $it")
}
return result.updated.size > 0
}
diff --git a/core/src/main/java/info/nightscout/androidaps/plugins/pump/common/bolusInfo/DetailedBolusInfoStorage.kt b/core/src/main/java/info/nightscout/androidaps/plugins/pump/common/bolusInfo/DetailedBolusInfoStorage.kt
index 062d41191f..57a732cbc3 100644
--- a/core/src/main/java/info/nightscout/androidaps/plugins/pump/common/bolusInfo/DetailedBolusInfoStorage.kt
+++ b/core/src/main/java/info/nightscout/androidaps/plugins/pump/common/bolusInfo/DetailedBolusInfoStorage.kt
@@ -29,7 +29,7 @@ class DetailedBolusInfoStorage @Inject constructor(
val d = store[i]
//aapsLogger.debug(LTag.PUMP, "Existing bolus info: " + store[i])
if (bolusTime > d.timestamp - T.mins(1).msecs() && bolusTime < d.timestamp + T.mins(1).msecs() && abs(store[i].insulin - bolus) < 0.01) {
- aapsLogger.debug(LTag.PUMP, "Using & removing bolus info: ${store[i]}")
+ aapsLogger.debug(LTag.PUMP, "Using & removing bolus info for time $bolusTime: ${store[i]}")
store.removeAt(i)
return d
}
@@ -38,22 +38,22 @@ class DetailedBolusInfoStorage @Inject constructor(
for (i in store.indices) {
val d = store[i]
if (bolusTime > d.timestamp - T.mins(1).msecs() && bolusTime < d.timestamp + T.mins(1).msecs() && bolus <= store[i].insulin + 0.01) {
- aapsLogger.debug(LTag.PUMP, "Using TIME-ONLY & removing bolus info: ${store[i]}")
+ aapsLogger.debug(LTag.PUMP, "Using TIME-ONLY & removing bolus info for time $bolusTime: ${store[i]}")
store.removeAt(i)
return d
}
}
// If not found, use last record if amount is the same
- if (store.size > 0) {
- val d = store[store.size - 1]
- if (abs(d.insulin - bolus) < 0.01) {
- aapsLogger.debug(LTag.PUMP, "Using LAST & removing bolus info: $d")
- store.removeAt(store.size - 1)
- return d
- }
- }
+ // if (store.size > 0) {
+ // val d = store[store.size - 1]
+ // if (abs(d.insulin - bolus) < 0.01) {
+ // aapsLogger.debug(LTag.PUMP, "Using LAST & removing bolus info for time $bolusTime: $d")
+ // store.removeAt(store.size - 1)
+ // return d
+ // }
+ // }
//Not found
- //aapsLogger.debug(LTag.PUMP, "Bolus info not found")
+ aapsLogger.debug(LTag.PUMP, "Bolus info not found for time $bolusTime")
return null
}
}
\ No newline at end of file
diff --git a/core/src/main/java/info/nightscout/androidaps/plugins/pump/common/defs/PumpType.kt b/core/src/main/java/info/nightscout/androidaps/plugins/pump/common/defs/PumpType.kt
index d372c84c6b..387386f927 100644
--- a/core/src/main/java/info/nightscout/androidaps/plugins/pump/common/defs/PumpType.kt
+++ b/core/src/main/java/info/nightscout/androidaps/plugins/pump/common/defs/PumpType.kt
@@ -64,7 +64,7 @@ enum class PumpType {
baseBasalStep = 0.1,
baseBasalSpecialSteps = null,
pumpCapability = PumpCapability.VirtualPumpCapabilities),
- ACCU_CHEK_INSIGHT(description = "Accu-Chek Insight",
+ ACCU_CHEK_INSIGHT_VIRTUAL(description = "Accu-Chek Insight",
manufacturer = ManufacturerType.Roche,
model = "Insight",
bolusSize = 0.05,
@@ -77,7 +77,7 @@ enum class PumpType {
baseBasalStep = 0.01,
baseBasalSpecialSteps = null,
pumpCapability = PumpCapability.InsightCapabilities),
- ACCU_CHEK_INSIGHT_BLUETOOTH(description = "Accu-Chek Insight",
+ ACCU_CHEK_INSIGHT(description = "Accu-Chek Insight",
manufacturer = ManufacturerType.Roche,
model = "Insight",
bolusSize = 0.01,
@@ -89,7 +89,7 @@ enum class PumpType {
baseBasalMinValue = 0.02,
baseBasalMaxValue = null,
baseBasalStep = 0.01,
- baseBasalSpecialSteps = DoseStepSize.InsightBolus,
+ baseBasalSpecialSteps = DoseStepSize.InsightBasal,
pumpCapability = PumpCapability.InsightCapabilities),
ACCU_CHEK_SOLO(description = "Accu-Chek Solo",
manufacturer = ManufacturerType.Roche,
@@ -418,9 +418,9 @@ enum class PumpType {
CELLNOVO -> InterfaceIDs.PumpType.CELLNOVO
ACCU_CHEK_COMBO -> InterfaceIDs.PumpType.ACCU_CHEK_COMBO
ACCU_CHEK_SPIRIT -> InterfaceIDs.PumpType.ACCU_CHEK_SPIRIT
- ACCU_CHEK_INSIGHT -> InterfaceIDs.PumpType.ACCU_CHEK_INSIGHT
- ACCU_CHEK_INSIGHT_BLUETOOTH -> InterfaceIDs.PumpType.ACCU_CHEK_INSIGHT_BLUETOOTH
- ACCU_CHEK_SOLO -> InterfaceIDs.PumpType.ACCU_CHEK_SOLO
+ ACCU_CHEK_INSIGHT_VIRTUAL -> InterfaceIDs.PumpType.ACCU_CHEK_INSIGHT
+ ACCU_CHEK_INSIGHT -> InterfaceIDs.PumpType.ACCU_CHEK_INSIGHT_BLUETOOTH
+ ACCU_CHEK_SOLO -> InterfaceIDs.PumpType.ACCU_CHEK_SOLO
ANIMAS_VIBE -> InterfaceIDs.PumpType.ANIMAS_VIBE
ANIMAS_PING -> InterfaceIDs.PumpType.ANIMAS_PING
DANA_R -> InterfaceIDs.PumpType.DANA_R
diff --git a/core/src/main/java/info/nightscout/androidaps/utils/DateUtil.kt b/core/src/main/java/info/nightscout/androidaps/utils/DateUtil.kt
index d74fa72876..a65f6de701 100644
--- a/core/src/main/java/info/nightscout/androidaps/utils/DateUtil.kt
+++ b/core/src/main/java/info/nightscout/androidaps/utils/DateUtil.kt
@@ -137,12 +137,14 @@ open class DateUtil @Inject constructor(private val context: Context) {
return if (mills == 0L) "" else dateString(mills) + " " + timeStringWithSeconds(mills)
}
- fun minAgo(resourceHelper: ResourceHelper, time: Long): String {
+ fun minAgo(resourceHelper: ResourceHelper, time: Long?): String {
+ if (time == null) return ""
val mins = ((now() - time) / 1000 / 60).toInt()
return resourceHelper.gs(R.string.minago, mins)
}
- fun minAgoShort(time: Long): String {
+ fun minAgoShort(time: Long?): String {
+ if (time == null) return ""
val mins = ((time - now()) / 1000 / 60).toInt()
return (if (mins > 0) "+" else "") + mins
}
diff --git a/core/src/main/java/info/nightscout/androidaps/utils/Translator.kt b/core/src/main/java/info/nightscout/androidaps/utils/Translator.kt
index 9ee3dbee13..36b4705a13 100644
--- a/core/src/main/java/info/nightscout/androidaps/utils/Translator.kt
+++ b/core/src/main/java/info/nightscout/androidaps/utils/Translator.kt
@@ -1,6 +1,7 @@
package info.nightscout.androidaps.utils
import info.nightscout.androidaps.core.R
+import info.nightscout.androidaps.database.entities.OfflineEvent
import info.nightscout.androidaps.database.entities.TemporaryTarget
import info.nightscout.androidaps.database.entities.TherapyEvent
import info.nightscout.androidaps.database.entities.UserEntry.Action
@@ -15,94 +16,93 @@ class Translator @Inject internal constructor(
private val resourceHelper: ResourceHelper
) {
- @Deprecated("use type instead of string")
- fun translate(text: String): String = text
-
- fun translate(action: Action): String = when(action) {
- Action.BOLUS -> resourceHelper.gs(R.string.uel_bolus)
- Action.SMB -> resourceHelper.gs(R.string.smb_shortname)
- Action.BOLUS_ADVISOR -> resourceHelper.gs(R.string.uel_bolus_advisor)
- Action.EXTENDED_BOLUS -> resourceHelper.gs(R.string.uel_extended_bolus)
- Action.SUPERBOLUS_TBR -> resourceHelper.gs(R.string.uel_superbolus_tbr)
- Action.CARBS -> resourceHelper.gs(R.string.uel_carbs)
- Action.EXTENDED_CARBS -> resourceHelper.gs(R.string.uel_extended_carbs)
- Action.TEMP_BASAL -> resourceHelper.gs(R.string.uel_temp_basal)
- Action.TT -> resourceHelper.gs(R.string.uel_tt)
- Action.NEW_PROFILE -> resourceHelper.gs(R.string.uel_new_profile)
- Action.CLONE_PROFILE -> resourceHelper.gs(R.string.uel_clone_profile)
- Action.STORE_PROFILE -> resourceHelper.gs(R.string.uel_store_profile)
- Action.PROFILE_SWITCH -> resourceHelper.gs(R.string.uel_profile_switch)
- Action.PROFILE_SWITCH_CLONED -> resourceHelper.gs(R.string.uel_profile_switch_cloned)
- Action.CLOSED_LOOP_MODE -> resourceHelper.gs(R.string.uel_closed_loop_mode)
- Action.LGS_LOOP_MODE -> resourceHelper.gs(R.string.uel_lgs_loop_mode)
- Action.OPEN_LOOP_MODE -> resourceHelper.gs(R.string.uel_open_loop_mode)
- Action.LOOP_DISABLED -> resourceHelper.gs(R.string.uel_loop_disabled)
- Action.LOOP_ENABLED -> resourceHelper.gs(R.string.uel_loop_enabled)
- Action.RECONNECT -> resourceHelper.gs(R.string.uel_reconnect)
- Action.DISCONNECT -> resourceHelper.gs(R.string.uel_disconnect)
- Action.RESUME -> resourceHelper.gs(R.string.uel_resume)
- Action.SUSPEND -> resourceHelper.gs(R.string.uel_suspend)
- Action.HW_PUMP_ALLOWED -> resourceHelper.gs(R.string.uel_hw_pump_allowed)
- Action.CLEAR_PAIRING_KEYS -> resourceHelper.gs(R.string.uel_clear_pairing_keys)
- Action.ACCEPTS_TEMP_BASAL -> resourceHelper.gs(R.string.uel_accepts_temp_basal)
- Action.CANCEL_TEMP_BASAL -> resourceHelper.gs(R.string.uel_cancel_temp_basal)
- Action.CANCEL_BOLUS -> resourceHelper.gs(R.string.uel_cancel_bolus)
- Action.CANCEL_EXTENDED_BOLUS -> resourceHelper.gs(R.string.uel_cancel_extended_bolus)
- Action.CANCEL_TT -> resourceHelper.gs(R.string.uel_cancel_tt)
- Action.CAREPORTAL -> resourceHelper.gs(R.string.uel_careportal)
- Action.SITE_CHANGE -> resourceHelper.gs(R.string.uel_site_change)
- Action.RESERVOIR_CHANGE -> resourceHelper.gs(R.string.uel_reservoir_change)
- Action.CALIBRATION -> resourceHelper.gs(R.string.uel_calibration)
- Action.PRIME_BOLUS -> resourceHelper.gs(R.string.uel_prime_bolus)
- Action.TREATMENT -> resourceHelper.gs(R.string.uel_treatment)
- Action.CAREPORTAL_NS_REFRESH -> resourceHelper.gs(R.string.uel_careportal_ns_refresh)
- Action.PROFILE_SWITCH_NS_REFRESH -> resourceHelper.gs(R.string.uel_profile_switch_ns_refresh)
- Action.TREATMENTS_NS_REFRESH -> resourceHelper.gs(R.string.uel_treatments_ns_refresh)
- Action.TT_NS_REFRESH -> resourceHelper.gs(R.string.uel_tt_ns_refresh)
- Action.AUTOMATION_REMOVED -> resourceHelper.gs(R.string.uel_automation_removed)
- Action.BG_REMOVED -> resourceHelper.gs(R.string.uel_bg_removed)
- Action.CAREPORTAL_REMOVED -> resourceHelper.gs(R.string.uel_careportal_removed)
- Action.BOLUS_REMOVED -> resourceHelper.gs(R.string.uel_bolus_removed)
- Action.CARBS_REMOVED -> resourceHelper.gs(R.string.uel_carbs_removed)
- Action.TEMP_BASAL_REMOVED -> resourceHelper.gs(R.string.uel_temp_basal_removed)
- Action.EXTENDED_BOLUS_REMOVED -> resourceHelper.gs(R.string.uel_extended_bolus_removed)
- Action.FOOD -> resourceHelper.gs(R.string.uel_food)
- Action.FOOD_REMOVED -> resourceHelper.gs(R.string.uel_food_removed)
- Action.PROFILE_REMOVED -> resourceHelper.gs(R.string.uel_profile_removed)
- Action.PROFILE_SWITCH_REMOVED -> resourceHelper.gs(R.string.uel_profile_switch_removed)
- Action.RESTART_EVENTS_REMOVED -> resourceHelper.gs(R.string.uel_restart_events_removed)
- Action.TREATMENT_REMOVED -> resourceHelper.gs(R.string.uel_treatment_removed)
- Action.TT_REMOVED -> resourceHelper.gs(R.string.uel_tt_removed)
- Action.NS_PAUSED -> resourceHelper.gs(R.string.uel_ns_paused)
- Action.NS_RESUME -> resourceHelper.gs(R.string.uel_ns_resume)
- Action.NS_QUEUE_CLEARED -> resourceHelper.gs(R.string.uel_ns_queue_cleared)
- Action.NS_SETTINGS_COPIED -> resourceHelper.gs(R.string.uel_ns_settings_copied)
- Action.ERROR_DIALOG_OK -> resourceHelper.gs(R.string.uel_error_dialog_ok)
- Action.ERROR_DIALOG_MUTE -> resourceHelper.gs(R.string.uel_error_dialog_mute)
- Action.ERROR_DIALOG_MUTE_5MIN -> resourceHelper.gs(R.string.uel_error_dialog_mute_5min)
- Action.OBJECTIVE_STARTED -> resourceHelper.gs(R.string.uel_objective_started)
- Action.OBJECTIVE_UNSTARTED -> resourceHelper.gs(R.string.uel_objective_unstarted)
- Action.OBJECTIVES_SKIPPED -> resourceHelper.gs(R.string.uel_objectives_skipped)
- Action.STAT_RESET -> resourceHelper.gs(R.string.uel_stat_reset)
- Action.DELETE_LOGS -> resourceHelper.gs(R.string.uel_delete_logs)
- Action.DELETE_FUTURE_TREATMENTS -> resourceHelper.gs(R.string.uel_delete_future_treatments)
- Action.EXPORT_SETTINGS -> resourceHelper.gs(R.string.uel_export_settings)
- Action.IMPORT_SETTINGS -> resourceHelper.gs(R.string.uel_import_settings)
- Action.RESET_DATABASES -> resourceHelper.gs(R.string.uel_reset_databases)
- Action.EXPORT_DATABASES -> resourceHelper.gs(R.string.uel_export_databases)
- Action.IMPORT_DATABASES -> resourceHelper.gs(R.string.uel_import_databases)
- Action.OTP_EXPORT -> resourceHelper.gs(R.string.uel_otp_export)
- Action.OTP_RESET -> resourceHelper.gs(R.string.uel_otp_reset)
- Action.EXPORT_CSV -> resourceHelper.gs(R.string.uel_export_csv)
- Action.STOP_SMS -> resourceHelper.gs(R.string.uel_stop_sms)
- Action.START_AAPS -> resourceHelper.gs(R.string.uel_start_aaps)
- Action.EXIT_AAPS -> resourceHelper.gs(R.string.uel_exit_aaps)
- Action.PLUGIN_ENABLED -> resourceHelper.gs(R.string.uel_plugin_enabled)
- Action.PLUGIN_DISABLED -> resourceHelper.gs(R.string.uel_plugin_disabled)
- Action.UNKNOWN -> resourceHelper.gs(R.string.unknown)
+ fun translate(action: Action): String = when (action) {
+ Action.BOLUS -> resourceHelper.gs(R.string.uel_bolus)
+ Action.SMB -> resourceHelper.gs(R.string.smb_shortname)
+ Action.BOLUS_ADVISOR -> resourceHelper.gs(R.string.uel_bolus_advisor)
+ Action.EXTENDED_BOLUS -> resourceHelper.gs(R.string.uel_extended_bolus)
+ Action.SUPERBOLUS_TBR -> resourceHelper.gs(R.string.uel_superbolus_tbr)
+ Action.CARBS -> resourceHelper.gs(R.string.uel_carbs)
+ Action.EXTENDED_CARBS -> resourceHelper.gs(R.string.uel_extended_carbs)
+ Action.TEMP_BASAL -> resourceHelper.gs(R.string.uel_temp_basal)
+ Action.TT -> resourceHelper.gs(R.string.uel_tt)
+ Action.NEW_PROFILE -> resourceHelper.gs(R.string.uel_new_profile)
+ Action.CLONE_PROFILE -> resourceHelper.gs(R.string.uel_clone_profile)
+ Action.STORE_PROFILE -> resourceHelper.gs(R.string.uel_store_profile)
+ Action.PROFILE_SWITCH -> resourceHelper.gs(R.string.uel_profile_switch)
+ Action.PROFILE_SWITCH_CLONED -> resourceHelper.gs(R.string.uel_profile_switch_cloned)
+ Action.CLOSED_LOOP_MODE -> resourceHelper.gs(R.string.uel_closed_loop_mode)
+ Action.LGS_LOOP_MODE -> resourceHelper.gs(R.string.uel_lgs_loop_mode)
+ Action.OPEN_LOOP_MODE -> resourceHelper.gs(R.string.uel_open_loop_mode)
+ Action.LOOP_DISABLED -> resourceHelper.gs(R.string.uel_loop_disabled)
+ Action.LOOP_ENABLED -> resourceHelper.gs(R.string.uel_loop_enabled)
+ Action.RECONNECT -> resourceHelper.gs(R.string.uel_reconnect)
+ Action.DISCONNECT -> resourceHelper.gs(R.string.uel_disconnect)
+ Action.RESUME -> resourceHelper.gs(R.string.uel_resume)
+ Action.SUSPEND -> resourceHelper.gs(R.string.uel_suspend)
+ Action.HW_PUMP_ALLOWED -> resourceHelper.gs(R.string.uel_hw_pump_allowed)
+ Action.CLEAR_PAIRING_KEYS -> resourceHelper.gs(R.string.uel_clear_pairing_keys)
+ Action.ACCEPTS_TEMP_BASAL -> resourceHelper.gs(R.string.uel_accepts_temp_basal)
+ Action.CANCEL_TEMP_BASAL -> resourceHelper.gs(R.string.uel_cancel_temp_basal)
+ Action.CANCEL_BOLUS -> resourceHelper.gs(R.string.uel_cancel_bolus)
+ Action.CANCEL_EXTENDED_BOLUS -> resourceHelper.gs(R.string.uel_cancel_extended_bolus)
+ Action.CANCEL_TT -> resourceHelper.gs(R.string.uel_cancel_tt)
+ Action.CAREPORTAL -> resourceHelper.gs(R.string.uel_careportal)
+ Action.SITE_CHANGE -> resourceHelper.gs(R.string.uel_site_change)
+ Action.RESERVOIR_CHANGE -> resourceHelper.gs(R.string.uel_reservoir_change)
+ Action.CALIBRATION -> resourceHelper.gs(R.string.uel_calibration)
+ Action.PRIME_BOLUS -> resourceHelper.gs(R.string.uel_prime_bolus)
+ Action.TREATMENT -> resourceHelper.gs(R.string.uel_treatment)
+ Action.CAREPORTAL_NS_REFRESH -> resourceHelper.gs(R.string.uel_careportal_ns_refresh)
+ Action.PROFILE_SWITCH_NS_REFRESH -> resourceHelper.gs(R.string.uel_profile_switch_ns_refresh)
+ Action.TREATMENTS_NS_REFRESH -> resourceHelper.gs(R.string.uel_treatments_ns_refresh)
+ Action.TT_NS_REFRESH -> resourceHelper.gs(R.string.uel_tt_ns_refresh)
+ Action.AUTOMATION_REMOVED -> resourceHelper.gs(R.string.uel_automation_removed)
+ Action.BG_REMOVED -> resourceHelper.gs(R.string.uel_bg_removed)
+ Action.CAREPORTAL_REMOVED -> resourceHelper.gs(R.string.uel_careportal_removed)
+ Action.BOLUS_REMOVED -> resourceHelper.gs(R.string.uel_bolus_removed)
+ Action.CARBS_REMOVED -> resourceHelper.gs(R.string.uel_carbs_removed)
+ Action.TEMP_BASAL_REMOVED -> resourceHelper.gs(R.string.uel_temp_basal_removed)
+ Action.EXTENDED_BOLUS_REMOVED -> resourceHelper.gs(R.string.uel_extended_bolus_removed)
+ Action.FOOD -> resourceHelper.gs(R.string.uel_food)
+ Action.FOOD_REMOVED -> resourceHelper.gs(R.string.uel_food_removed)
+ Action.PROFILE_REMOVED -> resourceHelper.gs(R.string.uel_profile_removed)
+ Action.PROFILE_SWITCH_REMOVED -> resourceHelper.gs(R.string.uel_profile_switch_removed)
+ Action.RESTART_EVENTS_REMOVED -> resourceHelper.gs(R.string.uel_restart_events_removed)
+ Action.TREATMENT_REMOVED -> resourceHelper.gs(R.string.uel_treatment_removed)
+ Action.TT_REMOVED -> resourceHelper.gs(R.string.uel_tt_removed)
+ Action.NS_PAUSED -> resourceHelper.gs(R.string.uel_ns_paused)
+ Action.NS_RESUME -> resourceHelper.gs(R.string.uel_ns_resume)
+ Action.NS_QUEUE_CLEARED -> resourceHelper.gs(R.string.uel_ns_queue_cleared)
+ Action.NS_SETTINGS_COPIED -> resourceHelper.gs(R.string.uel_ns_settings_copied)
+ Action.ERROR_DIALOG_OK -> resourceHelper.gs(R.string.uel_error_dialog_ok)
+ Action.ERROR_DIALOG_MUTE -> resourceHelper.gs(R.string.uel_error_dialog_mute)
+ Action.ERROR_DIALOG_MUTE_5MIN -> resourceHelper.gs(R.string.uel_error_dialog_mute_5min)
+ Action.OBJECTIVE_STARTED -> resourceHelper.gs(R.string.uel_objective_started)
+ Action.OBJECTIVE_UNSTARTED -> resourceHelper.gs(R.string.uel_objective_unstarted)
+ Action.OBJECTIVES_SKIPPED -> resourceHelper.gs(R.string.uel_objectives_skipped)
+ Action.STAT_RESET -> resourceHelper.gs(R.string.uel_stat_reset)
+ Action.DELETE_LOGS -> resourceHelper.gs(R.string.uel_delete_logs)
+ Action.DELETE_FUTURE_TREATMENTS -> resourceHelper.gs(R.string.uel_delete_future_treatments)
+ Action.EXPORT_SETTINGS -> resourceHelper.gs(R.string.uel_export_settings)
+ Action.IMPORT_SETTINGS -> resourceHelper.gs(R.string.uel_import_settings)
+ Action.RESET_DATABASES -> resourceHelper.gs(R.string.uel_reset_databases)
+ Action.EXPORT_DATABASES -> resourceHelper.gs(R.string.uel_export_databases)
+ Action.IMPORT_DATABASES -> resourceHelper.gs(R.string.uel_import_databases)
+ Action.OTP_EXPORT -> resourceHelper.gs(R.string.uel_otp_export)
+ Action.OTP_RESET -> resourceHelper.gs(R.string.uel_otp_reset)
+ Action.EXPORT_CSV -> resourceHelper.gs(R.string.uel_export_csv)
+ Action.STOP_SMS -> resourceHelper.gs(R.string.uel_stop_sms)
+ Action.START_AAPS -> resourceHelper.gs(R.string.uel_start_aaps)
+ Action.EXIT_AAPS -> resourceHelper.gs(R.string.uel_exit_aaps)
+ Action.PLUGIN_ENABLED -> resourceHelper.gs(R.string.uel_plugin_enabled)
+ Action.PLUGIN_DISABLED -> resourceHelper.gs(R.string.uel_plugin_disabled)
+ Action.LOOP_CHANGE -> resourceHelper.gs(R.string.uel_loop_change)
+ Action.LOOP_REMOVED -> resourceHelper.gs(R.string.uel_loop_removed)
+ Action.UNKNOWN -> resourceHelper.gs(R.string.unknown)
}
- fun translate(units: ValueWithUnit?): String = when(units) {
+ fun translate(units: ValueWithUnit?): String = when (units) {
is ValueWithUnit.Gram -> resourceHelper.gs(R.string.shortgram)
is ValueWithUnit.Hour -> resourceHelper.gs(R.string.shorthour)
is ValueWithUnit.Insulin -> resourceHelper.gs(R.string.insulin_unit_shortname)
@@ -114,15 +114,15 @@ class Translator @Inject internal constructor(
else -> ""
}
- fun translate(meterType: TherapyEvent.MeterType): String = when(meterType) {
- TherapyEvent.MeterType.FINGER -> resourceHelper.gs(R.string.glucosetype_finger)
- TherapyEvent.MeterType.SENSOR -> resourceHelper.gs(R.string.glucosetype_sensor)
- TherapyEvent.MeterType.MANUAL -> resourceHelper.gs(R.string.manual)
+ fun translate(meterType: TherapyEvent.MeterType): String = when (meterType) {
+ TherapyEvent.MeterType.FINGER -> resourceHelper.gs(R.string.glucosetype_finger)
+ TherapyEvent.MeterType.SENSOR -> resourceHelper.gs(R.string.glucosetype_sensor)
+ TherapyEvent.MeterType.MANUAL -> resourceHelper.gs(R.string.manual)
- else -> resourceHelper.gs(R.string.unknown)
+ else -> resourceHelper.gs(R.string.unknown)
}
- fun translate(type: TherapyEvent.Type): String = when(type) {
+ fun translate(type: TherapyEvent.Type): String = when (type) {
TherapyEvent.Type.FINGER_STICK_BG_VALUE -> resourceHelper.gs(R.string.careportal_bgcheck)
TherapyEvent.Type.SNACK_BOLUS -> resourceHelper.gs(R.string.careportal_snackbolus)
TherapyEvent.Type.MEAL_BOLUS -> resourceHelper.gs(R.string.careportal_mealbolus)
@@ -170,21 +170,30 @@ class Translator @Inject internal constructor(
*/
TherapyEvent.Type.NONE -> resourceHelper.gs(R.string.unknown)
- else -> resourceHelper.gs(R.string.unknown)
- }
-
- fun translate(reason: TemporaryTarget.Reason): String = when(reason) {
- TemporaryTarget.Reason.CUSTOM -> resourceHelper.gs(R.string.custom)
- TemporaryTarget.Reason.HYPOGLYCEMIA -> resourceHelper.gs(R.string.hypo)
- TemporaryTarget.Reason.EATING_SOON -> resourceHelper.gs(R.string.eatingsoon)
- TemporaryTarget.Reason.ACTIVITY -> resourceHelper.gs(R.string.activity)
- TemporaryTarget.Reason.AUTOMATION -> resourceHelper.gs(R.string.automation)
- TemporaryTarget.Reason.WEAR -> resourceHelper.gs(R.string.wear)
-
else -> resourceHelper.gs(R.string.unknown)
}
- fun translate(source: Sources): String = when(source) {
+ fun translate(reason: TemporaryTarget.Reason): String = when (reason) {
+ TemporaryTarget.Reason.CUSTOM -> resourceHelper.gs(R.string.custom)
+ TemporaryTarget.Reason.HYPOGLYCEMIA -> resourceHelper.gs(R.string.hypo)
+ TemporaryTarget.Reason.EATING_SOON -> resourceHelper.gs(R.string.eatingsoon)
+ TemporaryTarget.Reason.ACTIVITY -> resourceHelper.gs(R.string.activity)
+ TemporaryTarget.Reason.AUTOMATION -> resourceHelper.gs(R.string.automation)
+ TemporaryTarget.Reason.WEAR -> resourceHelper.gs(R.string.wear)
+
+ else -> resourceHelper.gs(R.string.unknown)
+ }
+
+ fun translate(reason: OfflineEvent.Reason): String = when (reason) {
+ OfflineEvent.Reason.SUSPEND -> resourceHelper.gs(R.string.uel_suspend)
+ OfflineEvent.Reason.DISABLE_LOOP -> resourceHelper.gs(R.string.disableloop)
+ OfflineEvent.Reason.DISCONNECT_PUMP -> resourceHelper.gs(R.string.uel_disconnect)
+ OfflineEvent.Reason.OTHER -> resourceHelper.gs(R.string.uel_other)
+
+ else -> resourceHelper.gs(R.string.unknown)
+ }
+
+ fun translate(source: Sources): String = when (source) {
/*
Sources.TreatmentDialog -> TODO()
Sources.InsulinDialog -> TODO()
@@ -270,14 +279,14 @@ class Translator @Inject internal constructor(
Sources.Stats -> TODO()
Sources.Aaps -> TODO()
*/
- Sources.Automation -> resourceHelper.gs(R.string.automation)
- Sources.Loop -> resourceHelper.gs(R.string.loop)
- Sources.NSClient -> resourceHelper.gs(R.string.ns)
- Sources.Pump -> resourceHelper.gs(R.string.pump)
- Sources.SMS -> resourceHelper.gs(R.string.smb_shortname)
- Sources.Wear -> resourceHelper.gs(R.string.wear)
- Sources.Unknown -> resourceHelper.gs(R.string.unknown)
+ Sources.Automation -> resourceHelper.gs(R.string.automation)
+ Sources.Loop -> resourceHelper.gs(R.string.loop)
+ Sources.NSClient -> resourceHelper.gs(R.string.ns)
+ Sources.Pump -> resourceHelper.gs(R.string.pump)
+ Sources.SMS -> resourceHelper.gs(R.string.smb_shortname)
+ Sources.Wear -> resourceHelper.gs(R.string.wear)
+ Sources.Unknown -> resourceHelper.gs(R.string.unknown)
- else -> source.name
+ else -> source.name
}
}
\ No newline at end of file
diff --git a/core/src/main/java/info/nightscout/androidaps/utils/textValidator/validators/PinStrengthValidator.kt b/core/src/main/java/info/nightscout/androidaps/utils/textValidator/validators/PinStrengthValidator.kt
index 35907e33ff..300ea2f380 100644
--- a/core/src/main/java/info/nightscout/androidaps/utils/textValidator/validators/PinStrengthValidator.kt
+++ b/core/src/main/java/info/nightscout/androidaps/utils/textValidator/validators/PinStrengthValidator.kt
@@ -6,6 +6,7 @@ class PinStrengthValidator(val _customErrorMessage: String?) : Validator(_custom
val regex = "[0-9]{3,6}".toRegex()
+ @kotlin.ExperimentalStdlibApi
override fun isValid(editText: EditText): Boolean {
return try {
val value = editText.text.toString()
@@ -22,11 +23,11 @@ class PinStrengthValidator(val _customErrorMessage: String?) : Validator(_custom
same = false
}
- if (last.toInt() + 1 != c.toInt()) {
+ if (last.code + 1 != c.code) {
falling = false
}
- if (last.toInt() != c.toInt() + 1) {
+ if (last.code != c.code + 1) {
rising = false
}
}
diff --git a/core/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/ProfileGraph.kt b/core/src/main/java/info/nightscout/androidaps/utils/ui/ProfileGraph.kt
similarity index 96%
rename from core/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/ProfileGraph.kt
rename to core/src/main/java/info/nightscout/androidaps/utils/ui/ProfileGraph.kt
index 0623cbaf40..61e4f64a74 100644
--- a/core/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/ProfileGraph.kt
+++ b/core/src/main/java/info/nightscout/androidaps/utils/ui/ProfileGraph.kt
@@ -1,7 +1,6 @@
-package info.nightscout.androidaps.plugins.treatments.fragments
+package info.nightscout.androidaps.utils.ui
import android.content.Context
-import android.graphics.Color
import android.util.AttributeSet
import com.jjoe64.graphview.GraphView
import com.jjoe64.graphview.series.DataPoint
@@ -9,7 +8,7 @@ import com.jjoe64.graphview.series.LineGraphSeries
import info.nightscout.androidaps.core.R
import info.nightscout.androidaps.interfaces.Profile
import info.nightscout.androidaps.utils.Round
-import java.util.*
+import java.util.ArrayList
import kotlin.math.max
class ProfileGraph : GraphView {
diff --git a/core/src/main/java/info/nightscout/androidaps/utils/userEntry/UserEntryPresentationHelper.kt b/core/src/main/java/info/nightscout/androidaps/utils/userEntry/UserEntryPresentationHelper.kt
index 0211fcf550..6b46b1001d 100644
--- a/core/src/main/java/info/nightscout/androidaps/utils/userEntry/UserEntryPresentationHelper.kt
+++ b/core/src/main/java/info/nightscout/androidaps/utils/userEntry/UserEntryPresentationHelper.kt
@@ -123,6 +123,7 @@ class UserEntryPresentationHelper @Inject constructor(
is ValueWithUnit.SimpleString -> valueWithUnit.value
is ValueWithUnit.TherapyEventMeterType -> translator.translate(valueWithUnit.value)
is ValueWithUnit.TherapyEventTTReason -> translator.translate(valueWithUnit.value)
+ is ValueWithUnit.OfflineEventReason -> translator.translate(valueWithUnit.value)
is ValueWithUnit.TherapyEventType -> translator.translate(valueWithUnit.value)
is ValueWithUnit.Timestamp -> dateUtil.dateAndTimeAndSecondsString(valueWithUnit.value)
@@ -152,7 +153,7 @@ class UserEntryPresentationHelper @Inject constructor(
csvString(R.string.eventtype),
csvString(R.string.ue_source),
csvString(R.string.careportal_note),
- csvString(R.string.ue_formated_string),
+ csvString(R.string.ue_string),
csvString(R.string.event_time_label),
csvString(if (profileFunction.getUnits() == GlucoseUnit.MGDL) R.string.mgdl else R.string.mmol),
csvString(R.string.shortgram),
@@ -165,15 +166,15 @@ class UserEntryPresentationHelper @Inject constructor(
) + "\n"
private fun getCsvEntry(entry: UserEntry): String {
- val fullvalueWithUnitList = ArrayList(entry.values)
- var timestampRec = "" + entry.timestamp
- var dateTimestampRev = dateUtil.dateAndTimeAndSecondsString(entry.timestamp)
- var utcOffset = dateUtil.timeStringFromSeconds((entry.utcOffset/1000).toInt())
- var action = csvString(entry.action)
+ val fullValueWithUnitList = ArrayList(entry.values)
+ val timestampRec = entry.timestamp.toString()
+ val dateTimestampRev = dateUtil.dateAndTimeAndSecondsString(entry.timestamp)
+ val utcOffset = dateUtil.timeStringFromSeconds((entry.utcOffset / 1000).toInt())
+ val action = csvString(entry.action)
var therapyEvent = ""
- var source = translator.translate(entry.source)
- var note = csvString(entry.note)
- var stringResource = ""
+ val source = translator.translate(entry.source)
+ val note = csvString(entry.note)
+ var simpleString = ""
var timestamp = ""
var bg = ""
var gram = ""
@@ -182,9 +183,9 @@ class UserEntryPresentationHelper @Inject constructor(
var percent = ""
var hour = ""
var minute = ""
- var other = ""
+ var noUnit = ""
- for (valueWithUnit in fullvalueWithUnitList.filterNotNull()) {
+ for (valueWithUnit in fullValueWithUnitList.filterNotNull()) {
when (valueWithUnit) {
is ValueWithUnit.Gram -> gram = valueWithUnit.value.toString()
is ValueWithUnit.Hour -> hour = valueWithUnit.value.toString()
@@ -192,10 +193,11 @@ class UserEntryPresentationHelper @Inject constructor(
is ValueWithUnit.Percent -> percent = valueWithUnit.value.toString()
is ValueWithUnit.Insulin -> insulin = DecimalFormatter.to2Decimal(valueWithUnit.value)
is ValueWithUnit.UnitPerHour -> unitPerHour = DecimalFormatter.to2Decimal(valueWithUnit.value)
- is ValueWithUnit.SimpleInt -> other = other.addWithSeparator(valueWithUnit.value)
- is ValueWithUnit.SimpleString -> other = other.addWithSeparator(valueWithUnit.value)
+ is ValueWithUnit.SimpleInt -> noUnit = noUnit.addWithSeparator(valueWithUnit.value)
+ is ValueWithUnit.SimpleString -> simpleString = simpleString.addWithSeparator(valueWithUnit.value)
is ValueWithUnit.TherapyEventMeterType -> therapyEvent = therapyEvent.addWithSeparator(translator.translate(valueWithUnit.value))
is ValueWithUnit.TherapyEventTTReason -> therapyEvent = therapyEvent.addWithSeparator(translator.translate(valueWithUnit.value))
+ is ValueWithUnit.OfflineEventReason -> therapyEvent = therapyEvent.addWithSeparator(translator.translate(valueWithUnit.value))
is ValueWithUnit.TherapyEventType -> therapyEvent = therapyEvent.addWithSeparator(translator.translate(valueWithUnit.value))
is ValueWithUnit.Timestamp -> timestamp = dateUtil.dateAndTimeAndSecondsString(valueWithUnit.value)
@@ -210,14 +212,14 @@ class UserEntryPresentationHelper @Inject constructor(
}
therapyEvent = csvString(therapyEvent)
- stringResource = csvString(stringResource)
- other = csvString(other)
- return "$timestampRec;$dateTimestampRev;$utcOffset;$action;$therapyEvent;$source;$note;$stringResource;$timestamp;$bg;$gram;$insulin;$unitPerHour;$percent;$hour;$minute;$other"
+ simpleString = csvString(simpleString)
+ noUnit = csvString(noUnit)
+ return "$timestampRec;$dateTimestampRev;$utcOffset;$action;$therapyEvent;$source;$note;$simpleString;$timestamp;$bg;$gram;$insulin;$unitPerHour;$percent;$hour;$minute;$noUnit"
}
- private fun csvString(action: Action): String = "\"" + translator.translate(action).replace("\"", "\"\"").replace("\n"," / ") + "\""
- private fun csvString(id: Int): String = if (id != 0) "\"" + resourceHelper.gs(id).replace("\"", "\"\"").replace("\n"," / ") + "\"" else ""
- private fun csvString(s: String): String = if (s != "") "\"" + s.replace("\"", "\"\"").replace("\n"," / ") + "\"" else ""
+ private fun csvString(action: Action): String = "\"" + translator.translate(action).replace("\"", "\"\"").replace("\n", " / ") + "\""
+ private fun csvString(id: Int): String = if (id != 0) "\"" + resourceHelper.gs(id).replace("\"", "\"\"").replace("\n", " / ") + "\"" else ""
+ private fun csvString(s: String): String = if (s != "") "\"" + s.replace("\"", "\"\"").replace("\n", " / ") + "\"" else ""
private fun String.addWithSeparator(add: Any) =
this + (if (this.isBlank()) "" else " / ") + add.toString()
diff --git a/core/src/main/res/layout/dialog_profileviewer.xml b/core/src/main/res/layout/dialog_profileviewer.xml
index 822213e76c..7f02c1457e 100644
--- a/core/src/main/res/layout/dialog_profileviewer.xml
+++ b/core/src/main/res/layout/dialog_profileviewer.xml
@@ -371,7 +371,7 @@
- %1$.2f U/h
Ja
Nee
+ LOOP UIT AKSIE GESTEL DEUR BEPERKINGS
+ Geen geldige basale tempo gelees van pomp
+ Beperk maks IAB tot %1$.1f U agv %2$s
+ onveilige gebruik
+ Pomp onbereikbaar
+ Uitgebreide bolus
+ Pomp tyd opgedateer
+ Uitgang
+ Skakel loop af
+ Skakel loop aan
+ Hervat lus
+ Staak lus
+ Kennisgewing
+ Nog geen profiel gelaai vanaf NS
+ bestaan
+ bestaan nie
+ Glukose
+ Naam:
+ Tyd
+ WiFi SSID
+ Voeg nuwe by
@@ -12,21 +33,24 @@
+ Begin profiele%1$d%% vir %2$d min
+ Bolus slimjan
+ Eet binnekort
+ Hipo
+ Wear
+ Outomatisasie
+ Gepasmaak
-
- Operasie nog nie ondersteun deur pomp.
-
-
Handtekening verifieerder
diff --git a/core/src/main/res/values-af-rZA/validator.xml b/core/src/main/res/values-af-rZA/validator.xml
index 3ea04e700d..8fec1d86e6 100644
--- a/core/src/main/res/values-af-rZA/validator.xml
+++ b/core/src/main/res/values-af-rZA/validator.xml
@@ -1,2 +1,7 @@
-
+
+ Slegs numeriese syfers word toegelaat.
+ Slegs numeriese syfers binne die reeks %1$s - %2$s word toegelaat.
+ Hierdie veld moet nie leeg wees nie
+ Telefoonnommer ongeldig
+
diff --git a/core/src/main/res/values-bg-rBG/strings.xml b/core/src/main/res/values-bg-rBG/strings.xml
index 0ec78fdc75..ac97acedbc 100644
--- a/core/src/main/res/values-bg-rBG/strings.xml
+++ b/core/src/main/res/values-bg-rBG/strings.xml
@@ -151,6 +151,7 @@
гр/Е
Няма избран профил
+ Стартирай профил %1$d%% за %2$d мин
* Само конкретни стойности! Диапазони не се поддържат за базал/болус при виртуална помпа.
@@ -190,10 +191,18 @@
Смяна на батерия
Временна цел
Откажи временна цел
+ Болус калкулатор
Пръст
Сензор
Друго
неизвестно
+ Преди хранене
+ Хипоглекимия
+ Физ.активност
+ Часовник
+ Автоматизация
+ По избор
+ Кръг - Loop
Времето за връзка изтече
@@ -225,30 +234,6 @@
Засичане на времето
%1$dч:%2$dм
-
- Помпата не поддържа тази операция.
- Операцията не се поддържа от помпата (ВСЕ ОЩЕ).
- ОК
-
- Никога не сме се свързвали
- Събуждане
- Грешка в комуникацията
- Изтече времето за връзка
- Помпата е недостъпна
- Грешна конфигурация
- Активна
- Спинка си
-
- Базали
- Конфигурации
- Известия
- Статистика
- Неизвестни
- Всички
- Болуси
- Пълнене
- Аларми
- Кръвна захар
Изключи за 5 минути
Формат на файла
diff --git a/core/src/main/res/values-ca-rES/strings.xml b/core/src/main/res/values-ca-rES/strings.xml
index e58cd5aa55..6fcff51e89 100644
--- a/core/src/main/res/values-ca-rES/strings.xml
+++ b/core/src/main/res/values-ca-rES/strings.xml
@@ -9,20 +9,19 @@
+ Iniciar perfil %1$d%% durant %2$d min
+ Llaç
-
-
-
Creat:
Versió d\'AAPS
diff --git a/core/src/main/res/values-cs-rCZ/strings.xml b/core/src/main/res/values-cs-rCZ/strings.xml
index bddf429c49..1140bdd2f1 100644
--- a/core/src/main/res/values-cs-rCZ/strings.xml
+++ b/core/src/main/res/values-cs-rCZ/strings.xml
@@ -105,6 +105,7 @@
Poznámky
Odstranit
Přidat nový
+ Data přicházejí z jiné pumpy. Změňte ovladač pro obnovení stavu pumpy.
Max bazál omezen na %1$.2f U/h: %2$s
limit pumpy
@@ -154,6 +155,7 @@
g/U
Není vybrán žádný profil
+ Spustit profil %1$d%% na %2$d min
* Pouze diskrétní hodnoty a ne rozsahy jsou podporovány pro bazál/bolus ve virtuální pumpě.
@@ -207,6 +209,10 @@
Wear
Automatizace
Volitelný
+ Pumpa
+ Smyčka
+ NS
+ Záznam
Vypršel čas připojování
@@ -238,30 +244,6 @@
Detekce času
%1$dh %2$dm
-
- Operace není podporována pumpou a/nebo ovladačem.
- Operace prozatím pumpou nepodporována.
- OK
-
- Nikdy nekontaktováno
- Probouzení
- Chyba komunikace
- Vypršel časový limit komunikace
- Pumpa nedostupná
- Neplatná konfigurace
- Aktivní
- Spánek
-
- Bazály
- Konfigurace
- Oznámení
- Statistika
- Neznámé
- Vše
- Bolusy
- Doplňování
- Alarmy
- Glykémie
Ztlumit na 5 minut
Formát souboru
@@ -315,13 +297,12 @@
BOLUS
POMOCNÍK S BOLUSEM
- ZÁZNAM BOLUSU
PRODLOUŽENÝ BOLUS
SUPERBOLUS TBR
SACHARIDY
ROZLOŽENÉ SACHARIDY
DOČASNÝ BAZÁL
- DC
+ DOČASNÝ CÍL
NOVÝ PROFIL
KLONOVAT PROFIL
ULOŽIT PROFIL
@@ -340,26 +321,33 @@
VYMAZAT PÁROVACÍ KLÍČE
PŘIJMOUT DOČASNÝ BAZÁL
ZRUŠIT DOČASNÝ BAZÁL
+ ZRUŠIT BOLUS
ZRUŠIT PRODLOUŽENÝ BOLUS
- ZRUŠIT DC
+ ZRUŠIT DOČASNÝ CÍL
OŠETŘENÍ
+ VÝMĚNA SETU
+ VÝMĚNA ZÁSOBNÍKU
KALIBRACE
PLNICÍ BOLUS
OŠETŘENÍ
OBNOVENÍ CAREPORTÁLU Z NS
OBNOVENÍ PŘEPNUTÍ PROFILU Z NS
OBNOVENÍ OŠETŘENÍ Z NS
- OBNOVENÍ DC Z NS
+ OBNOVENÍ DOČASNÝCH CÍLŮ Z NS
AUTOMATIZACE ODEBRÁNA
GLYKÉMIE ODEBRÁNA
CAREPORTAL ODEBRÁN
+ BOLUS ODSTRANĚN
+ SACHARIDY ODSTRANĚNY
+ DOČASNÝ BAZÁL ODSTRANĚN
PRODLOUŽENÝ BOLUS ODEBRÁN
+ JÍDLO
JÍDLO ODEBRÁNO
PROFIL ODEBRÁN
PŘEPNUTÍ PROFILU ODEBRÁNO
UDÁLOSTI RESTARTU ODEBRÁNY
OŠETŘENÍ ODEBRÁNO
- DC ODEBRÁN
+ DOČASNÝ CÍL ODSTRANĚN
NS POZASTAVEN
NS OBNOVEN
FRONTA NS VYMAZÁNA
@@ -380,30 +368,20 @@
IMPORTOVAT DATABÁZE
EXPORT OTP
RESET OTP
- SMS BAZÁL
- SMS BOLUS
- SMS KALKULAČKA
- SMS SACHARIDY
- SMS PRODLOUŽENÝ BOLUS
- SMS SMYČKA VYPNUTA
- SMS SMYČKA ZAPNUTA
- SMS SMYČKA OBNOVENA
- SMS SMYČKA POZASTAVENA
- SMS PROFIL
- SMS PŘIPOJENÍ PUMPY
- SMS ODPOJENÍ PUMPY
- SMS SMS
- SMS DC
- DC ODSTRANĚN Z NS
- CAREPORTAL ODSTRANĚN Z NS
- CAREPORTAL Z NS
- DC Z NS
- DC ZRUŠEN Z NS
+ STOP SMS
EXPORTOVAT UŽIVATELSKÉ ZÁZNAMY
+ START AAPS
+ KONEC AAPS
+ PLUG-IN POVOLEN
+ PLUG-IN ZAKÁZÁN
NEZNÁMÉ
- Formátovaný řetězec
+ Text
+ Zdroj
+ Posun UTC
+ Akce
+ Datum
+ Žádné jednotky
Exportovat uživatelské záznamy do Excelu (csv)
- "Čas;Datum;Posun oproti UTC;Akce;Poznámka;Hodnota;Jednotka"
- %1$d den
- %1$d dnů
diff --git a/core/src/main/res/values-da-rDK/strings.xml b/core/src/main/res/values-da-rDK/strings.xml
index 7ef1869a86..253defae86 100644
--- a/core/src/main/res/values-da-rDK/strings.xml
+++ b/core/src/main/res/values-da-rDK/strings.xml
@@ -2,6 +2,16 @@
+ LOOP DEAKTIVERET AF BEGRÆNSNINGER
+ Bolus %1$.2fE leveret uden fejl
+ OK
+ Fjern registrering
+ Deaktivér loop
+ Aktiver loop
+ Ingen profil er indlæst fra NS endnu
+ Glukose
+ COB
+ Tidspunkt for hændelsen
@@ -15,14 +25,15 @@
+ Spiser snart
+ Hypo
+ Aktivitet
+ Ur
-
-
-
Oprettet den
AAPS Version
diff --git a/core/src/main/res/values-de-rDE/strings.xml b/core/src/main/res/values-de-rDE/strings.xml
index 309c9871d4..b64ad0646b 100644
--- a/core/src/main/res/values-de-rDE/strings.xml
+++ b/core/src/main/res/values-de-rDE/strings.xml
@@ -103,6 +103,7 @@
Notizen
Löschen
Weiteren hinzufügen
+ Daten kommen von einer anderen Pumpe. Wechsle den Pumpentreiber.
Begrenzung der max. Basalrate auf %1$.2f IE/h wegen %2$s
Limit der Pumpe
@@ -152,6 +153,7 @@
g/IE
Kein Profil ausgewählt
+ Profil %1$d%% für %2$d Min. starten
* Bei der virtuellen Pumpe können nur einzelne Werte und keine Bereiche zur Festlegung der Basal/Bolus-Granularität gewählt werden.
@@ -204,6 +206,10 @@
Wear
Automatisierung
Benutzerdefiniert
+ Pumpe
+ Loop
+ NS
+ Eintrag
Zeitüberschreitung bei Verbindung
@@ -235,30 +241,6 @@
Zeiterkennung
%1$dh %2$dm
-
- Aktion von Pumpe und/oder Treiber nicht unterstützt.
- Operation NOCH NICHT von Pumpe unterstützt.
- OK
-
- Nie verbunden
- Aufwecken
- Fehler bei der Kommunikation
- Zeitüberschreitung bei Kommunikation
- Pumpe nicht erreichbar
- Ungültige Einstellung
- Aktiv
- Schlafen
-
- Basal
- Konfigurationen
- Benachrichtigungen
- Statistiken
- Unbekannte
- Alle
- Boli
- Füllen
- Alarme
- Glukose
Stumm schalten für 5 Minuten
Dateiformat
@@ -310,6 +292,28 @@
Sa
So
+ TEMP. ZIEL
+ BOLUS ABBRECHEN
+ TEMP. ZIEL ABBRECHEN
+ KANÜLENWECHSEL
+ RESERVOIRWECHSEL
+ TEMP. ZIEL NS AKTUALISIEREN
+ BOLUS ENTFERNT
+ KOHLENHYDRATE ENTFERNT
+ TEMP BASAL ENTFERNT
+ NAHRUNG
+ TEMP ZIEL ENTFERNT
+ STOP SMS
+ STARTE AAPS
+ AAPS BEENDEN
+ PLUGIN AKTIVIERT
+ PLUGIN DEAKTIVIERT
+ Zeichenfolge
+ Quelle
+ UTC-Abstand
+ Aktion
+ Zeitstempel
+ Keine Einheit
- %1$d Tag
- %1$d Tage
diff --git a/core/src/main/res/values-el-rGR/strings.xml b/core/src/main/res/values-el-rGR/strings.xml
index e180c5c571..02531e039c 100644
--- a/core/src/main/res/values-el-rGR/strings.xml
+++ b/core/src/main/res/values-el-rGR/strings.xml
@@ -5,6 +5,26 @@
%1$.2f U/h
Ναι
Όχι
+ ΤΟ ΚΥΚΛΩΜΑ ΑΠΕΝΕΡΓΟΠΟΙΗΘΗΚΕ ΑΠΟ ΠΕΡΙΟΡΙΣΜΟΥΣ
+ Διαβάζεται από την αντλία μη έγκυρος βασικός ρυθμός
+ Περιορίζεται η μέγιστη IOB σε %1$.1f U λόγω %2$s
+ μη ασφαλής χρήση
+ Η αντλία δεν είναι διαθέσιμη
+ Εκτεταμένο bolus
+ Η ώρα στην αντλία άλλαξε
+ Απενεργοποιήστε κύκλωμα
+ Ενεργοποιήστε κύκλωμα
+ Επαναφορά κυκλώματος
+ Αναστολή κυκλώματος
+ Ειδοποίηση
+ Δεν φορτώθηκε προφίλ από το NS ακόμα
+ υπάρχει
+ δεν υπάρχει
+ Γλυκόζη
+ Όνομα:
+ Χρόνος
+ WiFi SSID
+ Προσθήκη νέου
@@ -12,21 +32,25 @@
+ Έναρξη προφίλ %1$d%% για %2$d λεπτά
+ Οδηγός Bolus
+ Γεύμα Σύντομα
+ Υπογλυκαιμία
+ Άσκηση
+ Wear
+ Αυτοματισμός
+ Προσαρμογή
-
- Η λειτουργία δεν υποστηρίζεται ΑΚΟΜΑ από την αντλία.
-
-
Έλεγχος υπογραφής
diff --git a/core/src/main/res/values-el-rGR/validator.xml b/core/src/main/res/values-el-rGR/validator.xml
index 3ea04e700d..2dad0d3f66 100644
--- a/core/src/main/res/values-el-rGR/validator.xml
+++ b/core/src/main/res/values-el-rGR/validator.xml
@@ -1,2 +1,7 @@
-
+
+ Μόνο αριθμητικά ψηφία επιτρέπονται.
+ Μόνο αριθμητικά ψηφία μέσα στο εύρος %1$s - %2$s επιτρέπονται.
+ Το πεδίο αυτό δεν πρέπει να είναι κενό
+ Μη έγκυρος αριθμός τηλεφώνου
+
diff --git a/core/src/main/res/values-es-rES/strings.xml b/core/src/main/res/values-es-rES/strings.xml
index 4f454e94c0..6c95ec7a74 100644
--- a/core/src/main/res/values-es-rES/strings.xml
+++ b/core/src/main/res/values-es-rES/strings.xml
@@ -68,6 +68,24 @@
Emparejando
Si
No
+ Bolo %1$.2fU enviado correctamente
+ Tasa Basal no valida en la bomba
+ Limitando max IOB a %1$.1f U debido a %2$s
+ uso no seguro
+ Bomba no alcanzable
+ Desactivar lazo
+ Activar lazo
+ Reactivar el lazo
+ Suspender lazo
+ Notificación
+ Pendiente carga perfil NS
+ no existe
+ IOB
+ Nombre:
+ Tiempo
+ WiFi SSID
+ Hora del evento
+ Añadir nuevo
Limitando max basal rate a %1$.2f U/h debido a %2$s
límite de la bomba
@@ -116,6 +134,7 @@
g/U
Ningun perfil seleccionado
+ Iniciar perfil %1$d%% durante %2$d min
* Sólo se soportan valores discretos, no rangos, como entrada de datos para basal/bolo en la bomba virtual.
@@ -190,30 +209,6 @@
Detección de tiempo
%1$dhoras %2$dmin
-
- Operación no soportada por bomba y/o controlador.
- Operación no soportada todavía por la bomba.
- Ok
-
- Nunca conectados
- En fase de inicio
- Error con la comunicación
- Tiempo de espera en la comunicación
- Bomba no alcanzable
- Configuración no válida
- Activo
- Suspendida
-
- Basales
- Ajustes
- Notificaciones
- Estadísticas
- Desconocido/a
- Todos
- Bolos
- Cebado
- Alarmas
- Glucosa
Silenciar por 5 minutos
Formato del archivo
diff --git a/core/src/main/res/values-es-rES/validator.xml b/core/src/main/res/values-es-rES/validator.xml
index 3ea04e700d..dd7ef290d9 100644
--- a/core/src/main/res/values-es-rES/validator.xml
+++ b/core/src/main/res/values-es-rES/validator.xml
@@ -1,2 +1,21 @@
-
+
+ Sólo se permiten caracteres numéricos.
+ Sólo se permiten dígitos en el rango %1$s - %2$s.
+ Este campo no puede contener caracteres especiales
+ Sólo se permiten letras estándar
+ Este campo no puede estar vacío
+ Correo electrónico no válido
+ Número de tarjeta de crédito no es válido
+ Número de teléfono no válido
+ Nombre de dominio no válido
+ Dirección IP no válida
+ Web Url no es válida
+ Nombre o apellido no válido.
+ No es válido el nombre completo.
+ Formato no válido
+ Debe ser un número de 4 dígitos
+ Debe ser un número de 6 dígitos
+ No supera la longitud mínima
+ El Pin debe tener de 3 a 6 dígitos, no el mismo ni en serie
+
diff --git a/core/src/main/res/values-fr-rFR/strings.xml b/core/src/main/res/values-fr-rFR/strings.xml
index cac9e65b15..4a784f34ba 100644
--- a/core/src/main/res/values-fr-rFR/strings.xml
+++ b/core/src/main/res/values-fr-rFR/strings.xml
@@ -105,6 +105,7 @@
Notes
Supprimer
Ajouter
+ Les données proviennent de différentes pompes. Changer le pilote de la pompe pour réinitialiser l\'état de la pompe.
Limiter le débit de basal max à %1$.2f U/h à cause de %2$s
Limite de la pompe
@@ -154,6 +155,7 @@
g/U
Aucun profil séléctionné
+ Démarrer le profil %1$d%% pour %2$d min
* Uniquement les valeurs unitaires sont acceptées. Les plages pour les basal/bolus ne sont pas supportées par les pompes virtuelles.
@@ -178,12 +180,12 @@
Remarque
Question
Activité Physique
- Changement Zone D\'insertion
+ Changement de site
Insertion Capteur MGC
Démarrage Capteur MGC
Arrêt capteur MGC
Chien d\'alerte
- Changement du Réservoir
+ Changement du réservoir
Changement de profil
Bolus Goûter
Bolus Repas
@@ -193,8 +195,8 @@
Fin Basal Temp
Ressucrage
OpenAPS hors ligne
- Changement Pile Pompe
- Cible temp.
+ Changement pile pompe
+ Cible Temp
Annuler Cible Temporaire
Assistant Bolus
Doigt
@@ -207,6 +209,10 @@
Montre
Automatisation
Manuel
+ Pompe
+ Boucle
+ NS
+ Enregistrement
Connexion expirée
@@ -238,30 +244,6 @@
Détection de temps
%1$dh%2$dm
-
- Opération non prise en charge par la pompe et/ou le pilote.
- Opération non ENCORE supportée par la pompe.
- OK
-
- Jamais contacté
- Réveil en cours
- Erreur de communication
- Expiration du délai d\'attente en communication
- Pompe hors de portée
- Configuration non valable
- Activé
- En veille
-
- Basals
- Configurations
- Notifications
- Statistiques
- Inconnus
- Tous
- Bolus
- Amorcer
- Alarmes
- Glucose
Muet pendant 5 minutes
Format de fichier
@@ -314,14 +296,13 @@
D
BOLUS
- ASSISTANT DE BOLUS
- BOLUS ENREGISTRÉ
+ ASSISTANT BOLUS
BOLUS ÉTENDU
DBT SUPERBOLUS
GLUCIDES
GLUCIDES ÉTENDUS
BASAL TEMP
- CT
+ CIBLE TEMP
NOUVEAU PROFIL
PROFIL DUPLIQUÉ
PROFIL SAUVEGARDÉ
@@ -340,26 +321,33 @@
CLÉS D\'APPAIRAGE EFFACÉES
TEMP BASAL ACCEPTÉE
TEMP BASAL ANNULÉE
+ ANNULER BOLUS
BOLUS ÉTENDU ANNULÉ
- CT ANNULÉE
+ ANNULER CIBLE TEMP
CAREPORTAL
+ CHANGEMENT DE SITE
+ CHANGEMENT DU RÉSERVOIR
ÉTALONNAGE
BOLUS D\'AMORÇAGE
TRAITEMENT
CAREPORTAL ACTU NS
CHANGEMENT DE PROFIL ACTU NS
TREATMENTS ACTU NS
- CT ACTU NS
+ RÉGÉNÉRATION NS CIBLES TEMP
AUTOMATISATION SUPPRIMÉE
GLY SUPPRIMÉE
CAREPORTAL SUPPRIMÉ
+ BOLUS SUPPRIMÉ
+ GLUCIDES SUPPRIMÉS
+ BASAL TEMP SUPPRIMÉ
BOLUS ÉTENDU SUPPRIMÉ
+ ALIMENTS
ALIMENT SUPPRIMÉ
PROFIL SUPPRIMÉ
CHANGEMENT DE PROFIL SUPPRIMÉ
REDÉMARRAGES SUPPRIMÉS
TRAITEMENT SUPPRIMÉ
- CT SUPPRIMÉE
+ CIBLE TEMP SUPPRIMÉE
PAUSE NS
REPRISE NS
QUEUE NS SUPPRIMÉE
@@ -380,30 +368,20 @@
BASE DE DONNÉES IMPORTÉE
OTP EXPORTÉ
OTP RÉINITIALISÉ
- BASAL (SMS)
- BOLUS (SMS)
- CAL (SMS)
- GLUCIDES (SMS)
- BOLUS ÉTENDU (SMS)
- BOUCLE DÉSACTIVÉE (SMS)
- BOUCLE ACTIVÉE (SMS)
- REPRISE BOUCLE (SMS)
- BOUCLE SUSPENDUE (SMS)
- PROFILE (SMS)
- POMPE CONNECTÉE (SMS)
- POMPE DÉCONNECTÉE (SMS)
- SMS (SMS)
- CT (SMS)
- CT SUPPRIMÉ (NS)
- CAREPORTAL SUPPRIMÉ (NS)
- CAREPORTAL (NS)
- CT (NS)
- CT SUPPRIMÉ (NS)
+ ARRÊTER SMS
ENTRÉES UTILISATEUR EXPORTÉES
+ DÉMARRER AAPS
+ QUITTER AAPS
+ PLUGIN ACTIVÉ
+ PLUGIN DÉSACTIVÉ
INCONNU
- Chaîne de caractères formatée
+ Chaîne
+ Source
+ Décalage UTC
+ Action
+ Horodatage
+ Aucune unité
Exporter les entrées utilisateur vers Excel (csv)
- "Horodatage;Date;Décalage TU;Action;Note;Valeur;Unité"
- %1$d jour
- %1$d jours
diff --git a/core/src/main/res/values-ga-rIE/strings.xml b/core/src/main/res/values-ga-rIE/strings.xml
index 3ff1d499cd..371108af05 100644
--- a/core/src/main/res/values-ga-rIE/strings.xml
+++ b/core/src/main/res/values-ga-rIE/strings.xml
@@ -46,6 +46,16 @@
Bluetooth
Tá
Níl
+ LÚB DÍCHUMASAITHE LE SRIANTA
+ Díchumasaigh lúb
+ Cumasaigh lúb
+ Lúb Atosú
+ Fionraí lúb
+ Glúcóis
+ Ainm:
+ Am
+ WiFi SSID
+ Cuir nua
Deimhniú
@@ -96,6 +106,7 @@
Athrú Cartús Inslin
Méar
Braiteoir
+ Gníomhaíocht
Tuairim
@@ -115,16 +126,6 @@
TBB * 2
%1$du %2$dn
-
- Ceart go leor
-
- Gníomhach
-
- Bunaidhi
- Ar fad
- Bólasi
- Aláraim
- Glúcóis
diff --git a/core/src/main/res/values-hr-rHR/strings.xml b/core/src/main/res/values-hr-rHR/strings.xml
index a1a4975ce9..e81d449be1 100644
--- a/core/src/main/res/values-hr-rHR/strings.xml
+++ b/core/src/main/res/values-hr-rHR/strings.xml
@@ -20,9 +20,6 @@
-
-
-
diff --git a/core/src/main/res/values-it-rIT/strings.xml b/core/src/main/res/values-it-rIT/strings.xml
index f3d0a941cd..62b4a7441d 100644
--- a/core/src/main/res/values-it-rIT/strings.xml
+++ b/core/src/main/res/values-it-rIT/strings.xml
@@ -154,6 +154,7 @@
g/U
Nessun profilo selezionato
+ Avvia profilo %1$d%% per %2$d min
* Sono supportati solo valori discreti, non intervalli di valori, come incrementi per basale/bolo nel micro virtuale.
@@ -207,6 +208,9 @@
Smartwatch
Automazione
Personalizzato
+ Micro
+ Loop
+ NS
Time out connessione
@@ -238,30 +242,6 @@
Rilevamento tempo
%1$dh %2$dm
-
- Operazione non supportata dal micro e/o dal driver.
- Operazione NON ANCORA supportata dal micro.
- OK
-
- Mai connesso
- Risveglio
- Errore nella comunicazione
- Timeout della comunicazione
- Micro irraggiungibile
- Configurazione non valida
- Attivo
- In sospensione
-
- Basali
- Configurazioni
- Notifiche
- Statistiche
- Sconosciuti
- Tutto
- Boli
- Caricamento
- Allarmi
- Glicemia
Muto per 5 minuti
Formato file
@@ -315,13 +295,11 @@
BOLO
CONSIGLIO BOLO
- RECORD BOLO
BOLO ESTESO
TBR SUPERBOLO
CHO
CHO ESTESI
BASALE TEMPORANEA
- TT
NUOVO PROFILO
CLONA PROFILO
MEMORIZZA PROFILO
@@ -341,25 +319,27 @@
ACCETTA BASALE TEMPORANEA
CANCELLA BASALE TEMPORANEA
CANCELLA BOLO ESTESO
- CANCELLA TT
PORTALE
+ CAMBIO POSIZIONE CANNULA
+ CAMBIO SERBATOIO
CALIBRAZIONE
BOLO DI CARICAMENTO
TRATTAMENTO
PORTALE NS AGGIORNAMENTO
CAMBIO PROFILO NS AGGIORNAMENTO
TRATTAMENTI NS AGGIORNAMENTO
- TT NS AGGIORNAMENTO
AUTOMAZIONE RIMOSSA
BG RIMOSSO
PORTALE RIMOSSO
+ BOLO RIMOSSO
+ CHO RIMOSSI
BOLO ESTESO RIMOSSO
+ CIBO
CIBO RIMOSSO
PROFILO RIMOSSO
CAMBIO PROFILO RIMOSSO
EVENTI DI RIAVVIO RIMOSSI
TRATTAMENTO RIMOSSO
- TT RIMOSSO
NS IN PAUSA
NS RIPRESA
CODA NS CANCELLATA
@@ -380,30 +360,12 @@
IMPORTA DATABASE
ESPORTAZIONE OTP
RESET OTP
- SMS BASALE
- SMS BOLO
- SMS CAL
- SMS CHO
- SMS BOLO ESTESO
- SMS LOOP DISABILITATO
- SMS LOOP ABILITATO
- SMS RIPRESA LOOP
- SMS SOSPENSIONE LOOP
- SMS PROFILO
- SMS CONNESSIONE MICRO
- SMS DISCONNESSIONE MICRO
- SMS SMS
- SMS TT
- TT ELIMINATO DA NS
- PORTALE ELIMINATO DA NS
- PORTALE DA NS
- TT DA NS
- TT CANCELLATO DA NS
ESPORTA VOCI UTENTE
SCONOSCIUTO
- Stringa formattata
+ Stringa
+ Fonte
+ Azione
Esporta voci utente in Excel (csv)
- "Timestamp;Date;UTC Offset;Action;Note;Value;Unit"
- %1$d giorno
- %1$d giorni
diff --git a/core/src/main/res/values-iw-rIL/strings.xml b/core/src/main/res/values-iw-rIL/strings.xml
index 87c4b4af68..ef704b5f4d 100644
--- a/core/src/main/res/values-iw-rIL/strings.xml
+++ b/core/src/main/res/values-iw-rIL/strings.xml
@@ -105,6 +105,7 @@
הערות
הסרה
הוסף חדש
+ הנתונים מגיעים ממשאבה אחרת. בחרו מחדש את סוג המשאבה כדי לאפס את מצב המשאבה.
מגביל את הקצב הבזאלי המרבי ל-%1$.2f יח\' לשעה בגלל %2$s
מגבלת משאבה
@@ -154,6 +155,7 @@
גר\'\\יח\'
לא נבחר פרופיל
+ הפעלת פרופיל %1$d%% במשך %2$d דק\'
* רק ערכים בדידים, טווחים אינם נתמכים עבור ערכי בזאלי ובולוס במשאבה וירטואלית.
@@ -207,6 +209,10 @@
Wear
אוטומציה
מותאם אישית
+ משאבה
+ לולאה
+ נייטסקאוט
+ הקלטה
החיבור חרג ממגבלת הזמן
@@ -238,30 +244,6 @@
זיהוי שעה
%1$d ש\' %2$d דק\'
-
- הפעולה לא נתמכת ע\"י המשאבה ו\\או מנהל התקן.
- הפעולה עוד לא נתמכת על ידי המשאבה.
- אישור
-
- מעולם לא נוצר קשר
- מתעורר
- שגיאת תקשורת
- חריגה ממגבלת הזמן בתקשורת
- המשאבה לא זמינה
- קונפיגורציה לא חוקית
- פעיל
- ישן
-
- בזאלים
- קונפיגורציות
- התראות
- סטטיסטיקה
- לא ידועים
- כל
- בולוסים
- תיחול
- התראות
- גלוקוז
השתקה ל-5 דקות
פורמט הקובץ
@@ -315,13 +297,12 @@
בולוס
יועץ בולוס
- רשומת בולוס
בולוס ממושך
בזאלי זמני של סופר בולוס
פחמימות
פחמימות מורכבות
בזאלי זמני
- מטרה זמנית
+ ערך מטרה זמני
פרופיל חדש
שכפול פרופיל
אחסון פרופיל
@@ -340,26 +321,33 @@
מחיקת מפתחות זיווג
מקבל מינוני בזאלי זמניים
ביטול בזאלי זמני
+ ביטול בולוס
ביטול בולוס ממושך
- ביטול מטרה זמנית
+ ביטול ערך מטרה זמני
פורטל הטיפולים
+ שינוי אתר עירוי
+ החלפת מכל
כיול
בולוס תיחול
טיפול
רענון פורטל הטיפולים בנייטסקאוט
רענון החלפת פרופיל בנייטסקאוט
רענון הטיפולים בנייטסקאוט
- רענון ערך מטרה זמני בנייטסקאוט
+ רענון מטרה זמנית מנייטסקאוט
האוטומציה הוסרה
ערך סוכר נמחק
פורטל הטיפולים הוסר
+ בולוס נמחק
+ פחמימות סולקו
+ מינון בזאלי זמני סולק
בולוס ממושך הוסר
+ מזון
מזון הוסר
הפרופיל הוסר
החלפת הפרופיל הוסרה
אירועי אתחול הוסרו
הטיפול הוסר
- ערך מטרה זמני הוסר
+ ערך מטרה זמני סולק
נייטסקאוט הושהה
נייטסקאוט חודש
תור נייטסקאוט נוקה
@@ -380,30 +368,20 @@
ייבוא מסדי נתונים
ייצוא סיסמה חד פעמית (OTP)
איפוס סיסמה חד פעמית (OTP)
- בזאלי (SMS)
- בולוס (SMS)
- כיול (SMS)
- פחמימות (SMS)
- בולוס ממושך (SMS)
- השבתת לולאה (SMS)
- הפעלת לולאה (SMS)
- חידוש לולאה (SMS)
- השהיית לולאה (SMS)
- פרופיל (SMS)
- חיבור משאבה (SMS)
- ניתוק משאבה (SMS)
- SMS (SMS)
- ערך מטרה זמני (SMS)
- ערך מטרה זמני נמחק מנייטסקאוט
- פורטל הטיפולים נמחק מנייטסקאוט
- פורטל הטיפולים מנייטסקאוט
- ערך מטרה זמני מנייטסקאוט
- ערך מטרה זמני בוטל בנייטסקאוט
+ עצור SMS
ייצוא רישומי המשתמש
+ הפעלת AAPS
+ יציאה
+ תוסף מופעל
+ תוסף מושבת
לא ידוע
- מחרוזת מעוצבת
+ מחרוזת
+ מקור
+ היסט זמן אוניברסלי מתואם (UTC)
+ פעולה
+ חתימת זמן
+ ללא יחידה
יצוא ערכי משתמש לאקסל (csv)
- "Timestamp;Date;UTC Offset;Action;Note;Value;Unit"
- %1$d יום
- %1$d ימים
diff --git a/core/src/main/res/values-ko-rKR/strings.xml b/core/src/main/res/values-ko-rKR/strings.xml
index 931e30637c..a1c6377f68 100644
--- a/core/src/main/res/values-ko-rKR/strings.xml
+++ b/core/src/main/res/values-ko-rKR/strings.xml
@@ -5,6 +5,26 @@
%1$.2f U/h
네
아니오
+ 제한으로 인해 LOOP가 사용불가합니다.
+ 펌프에서 유효한 Basal양을 읽을 수 없습니다.
+ %2$s로 인해 최대 IOB가 %1$.1f U로 제한됩니다.
+ 위험한 사용
+ 펌프에 연결할 수 없습니다.
+ 확장 Bolus
+ 펌프 시간 업데이트
+ Loop 중지하기
+ Loop 실행하기
+ Loop 재실행
+ Loop 일시중지
+ 공지
+ 아직 NS에서 프로파일을 로드하지 못했습니다.
+ 존재합니다.
+ 존재하지 않습니다.
+ 혈당
+ 이름:
+ 시간
+ 와이파이 SSID
+ 새로 추가
@@ -12,21 +32,24 @@
+ 프로파일 %1$d%%을 %2$d 분 동안 시작
+ Bolus 마법사
+ 식사직전
+ 저혈당
+ 워치
+ 자동화
+ 사용자 정의
-
- 펌프에서 지원되지 않는 작동.
-
-
가져올 파일을 선택하세요.
환경설정은 AAPS (%1$s) 와는 다르게 생성되기 때문에 불러오는 도중 일부 설정이 누락되거나 설정이 되지 않을 수 있습니다. - 가져오기를 수행한 후 설정을 확인하고 업데이트 해주시기 바랍니다.
diff --git a/core/src/main/res/values-ko-rKR/validator.xml b/core/src/main/res/values-ko-rKR/validator.xml
index 3ea04e700d..64e4675402 100644
--- a/core/src/main/res/values-ko-rKR/validator.xml
+++ b/core/src/main/res/values-ko-rKR/validator.xml
@@ -1,2 +1,7 @@
-
+
+ 숫자만 입력가능합니다.
+ 이 범위(%1$s - %2$s)안에 해당하는 숫자만 입력가능합니다.
+ 필수 입력 항목입니다.
+ 폰번호가 유효하지 않습니다
+
diff --git a/core/src/main/res/values-lt-rLT/strings.xml b/core/src/main/res/values-lt-rLT/strings.xml
index db446fc455..8707183adc 100644
--- a/core/src/main/res/values-lt-rLT/strings.xml
+++ b/core/src/main/res/values-lt-rLT/strings.xml
@@ -69,6 +69,26 @@
Sujungiama
Taip
Ne
+ CIKLAS NEAKTYVUS DĖL APRIBOJIMŲ
+ %1$.2f vv bolusas sėkmingai suleistas
+ Jokio tinkamo bazės kiekio nenuskaityta iš pompos
+ Ribojamas maks AIO iki %1$.1f vv dėl %2$s
+ Nesaugus naudojimas
+ Pompa nepasiekiama
+ Pompos laikas pakeistas
+ Išjungti Ciklą
+ Įjungti Ciklą
+ Atnaujinti ciklą
+ Sustabdyti ciklą
+ Pranešimas
+ Dar negautas joks profilis iš NS
+ egzistuoja
+ neegzistuoja
+ Gliukozė
+ Vardas:
+ Laikas
+ WiFi pavadinimas
+ Pridėti naują
Ribojamas maksimalus bazės dydis%1$.2f vv/val dėl %2$s
pompos limitas
@@ -117,6 +137,7 @@
g/vv
Nepasirinktas profilis
+ Pradėti profilį %1$d%% %2$d min
* Virtualioje pompoje palaikomos tik atskiros vertės, o ne diapazonas detalumui užtikrinti.
@@ -156,10 +177,16 @@
Baterijos keitimas
Laikinas tikslas
Laikino tikslo atšaukimas
+ Boluso patarėjas
Iš piršto
Iš sensoriaus
Rankiniu būdu
nežinoma
+ Netrukus valgysiu
+ Hipo
+ Išmanieji laikrodžiai
+ Automatiškai
+ Pasirinktinis
Prijungimo laikas baigėsi
@@ -191,30 +218,6 @@
Laiko nustatymas
%1$dh %2$dm
-
- Pompa ir/ar jos valdiklis nepalaiko operacijos.
- Pompa dar nepalaiko operacijos.
- Gerai
-
- Niekada nebuvo sujungta
- Pažadinimas
- Ryšio klaida
- Ryšiui skirtas laikas baigėsi
- Pompa nepasiekiama
- Neteisinga konfigūracija
- Aktyvi
- Užmigusi
-
- Bazė
- Nustatymai
- Pranešimai
- Statistika
- Nežinoma
- Visi
- Bolusai
- Užpildyti sistemą
- Aliarmai
- Gliukozė
Nutildyti 5 minutėms
Sukurta
diff --git a/core/src/main/res/values-lt-rLT/validator.xml b/core/src/main/res/values-lt-rLT/validator.xml
index 3ea04e700d..74729daf5b 100644
--- a/core/src/main/res/values-lt-rLT/validator.xml
+++ b/core/src/main/res/values-lt-rLT/validator.xml
@@ -1,2 +1,7 @@
-
+
+ Galimi tik skaičiai.
+ Galimi tik skaičiai intervale %1$s - %2$s.
+ Laukas negali būti tuščias
+ Telefono numeris negalioja
+
diff --git a/core/src/main/res/values-nl-rNL/strings.xml b/core/src/main/res/values-nl-rNL/strings.xml
index ff6c928433..1f33e3cebf 100644
--- a/core/src/main/res/values-nl-rNL/strings.xml
+++ b/core/src/main/res/values-nl-rNL/strings.xml
@@ -190,30 +190,6 @@
Tijd detectie
%1$du %2$dm
-
- Bewerking niet ondersteund door pomp en/of driver.
- Operatie NU nog niet ondersteund door pomp.
- OK
-
- Nooit verbonden
- Ontwaken
- Communicatiefout
- Time-out op de communicatie
- Pomp niet beschikbaar
- Ongeldige configuratie
- Actief
- Slapen
-
- Basalen
- Instellingen
- Meldingen
- Statistieken
- Onbekend
- Alle
- Bolussen
- Vullen
- Alarmen
- Glucose
5 minuten dempen
Bestandsformaat
diff --git a/core/src/main/res/values-no-rNO/strings.xml b/core/src/main/res/values-no-rNO/strings.xml
index 344b082bee..8087301f35 100644
--- a/core/src/main/res/values-no-rNO/strings.xml
+++ b/core/src/main/res/values-no-rNO/strings.xml
@@ -154,6 +154,7 @@
g/E
Ingen profil valgt
+ Start profil %1$d%% i %2$d min
* Bare konkrete verdier støttes som granularitet for basal/bolus i virtuell pumpe, ingen verdiområder.
@@ -238,30 +239,6 @@
Tidsdetektering
%1$dt %2$dm
-
- Operasjonen støttes ikke av pumpen og/eller driveren.
- Operasjonen støttes ikke av pumpen ennå.
- OK
-
- Aldri kontaktet
- Våkner opp
- Kommunikasjonsfeil
- Tidsavbrudd kommunikasjon
- Pumpe utilgjengelig
- Ugyldig oppsett
- Aktiv
- Sover
-
- Basaldoser
- Innstillinger
- Varsler
- Statistikk
- Ukjente
- Alle
- Boluser
- Prime
- Alarmer
- Glukose
Demp i 5 minutter
Filformat
@@ -315,13 +292,11 @@
BOLUS
BOLUS ASSISTENT
- BOLUS REGISTRERING
FORLENGET BOLUS
SUPERBOLUS TBR
KARBO
FORLENGET KARBO
TEMP BASAL
- TT
NY PROFIL
KOPIER PROFIL
LAGRE PROFIL
@@ -341,7 +316,6 @@
AKSEPTER TEMP BASAL
AVBRYT TEMP BASAL
AVBRYT FORLENGET BOLUS
- AVBRYT TT
CAREPORTAL
KALIBRERING
PRIME BOLUS
@@ -349,7 +323,6 @@
CAREPORTAL NS OPPDATER
PROFILBYTTE NS OPPDATER
BEHANDLINGER NS OPPDATER
- TT NS OPPDATER
AUTOMASJON FJERNET
BS FJERNET
CAREPORTAL FJERNET
@@ -359,7 +332,6 @@
PROFILBYTTE FJERNET
RESTART HENDELSER FJERNET
BEHANDLING FJERNET
- TT FJERNET
NS PAUSET
GJENOPPTA NS
NS KØ SLETTET
@@ -380,30 +352,9 @@
IMPORTER DATABASER
OTP EKSPORT
OTP RESET
- SMS BASAL
- SMS BOLUS
- SMS CAL
- SMS KARBO
- SMS FORLENGET BOLUS
- SMS DEAKTIVER LOOP
- SMS AKTIVER LOOP
- SMS GJENOPPTA LOOP
- SMS PAUSE LOOP
- SMS PROFIL
- SMS PUMPE TILKOBLE
- SMS PUMPE FRAKOBLE
- SMS SMS
- SMS TT
- TT SLETTET FRA NS
- CAREPORTAL SLETTET FRA NS
- CAREPORTAL FRA NS
- TT FRA NS
- TT KANSELLERT FRA NS
EKSPORTER BRUKEROPPFØRINGER
UKJENT
- Formatert tekst
Eksporter brukeroppføringer til Excel (csv)
- "Klokkeslett;Dato;UTC forskyvning;Aksjon;Merk;Verdi;Enhet"
- %1$d dag
- %1$d dager
diff --git a/core/src/main/res/values-pl-rPL/strings.xml b/core/src/main/res/values-pl-rPL/strings.xml
index 551fe4e471..7ee0250ffc 100644
--- a/core/src/main/res/values-pl-rPL/strings.xml
+++ b/core/src/main/res/values-pl-rPL/strings.xml
@@ -68,6 +68,27 @@
Parowanie
Tak
Nie
+ PĘTLA WYLĄCZONA Z UWAGI NA OGRANICZENIA
+ Bolus %1$.2f U podany prawidłowo
+ Brak prawidłowej dawki bazowej odczytanej z pompy
+ Ograniczam max IOB do %1$.1f U z uwagi na %2$s
+ niebezpieczne użycie
+ Pompa nieosiągalna
+ Czas pompy uaktualniony
+ Usuń wpis
+ Wyłącz pętle
+ Włącz pętle
+ Wznów pętlę
+ Wstrzymaj pętle
+ Powiadomienie
+ Nie załadowano profilu z NS
+ istnieje
+ nie istnieje
+ Glukoza
+ Nazwa:
+ Czas
+ WiFi SSID
+ Dodaj nowy
Ograniczam maks. dawkę bazową do %1$.2f U/h z uwagi na %2$s
ograniczenie pompy
@@ -116,6 +137,7 @@
g/U
Nie wybrano profilu
+ Uruchom profil %1$d%% na %2$d min
*Tylko wartości dyskretne, nie zakresy są wspierane jako dawki bazowe/bolusy w pompie wirtualnej.
@@ -155,10 +177,17 @@
Zmiana baterii pompy
Cel tymczasowy (TT)
Odrzuć Cel tymczasowy
+ Kalkulator bolusa
Palec
Sensor
Ręczne
nieznany
+ Wkrótce posiłek
+ Hipo
+ Ćwiczenia
+ Oprogramowanie Wear (Smartwatch)
+ Automatyzacja
+ Niestandardowe
Przekroczono limit czasu połączenia
@@ -190,30 +219,6 @@
Wykrywanie czasu
%1$dh %2$dm
-
- Operacja nie jest wspierana przez pompę i/lub sterownik pompy.
- Operacja nie jest JESZCZE wspierana przez pompę.
- OK
-
- Nigdy nie połączona
- Wybudzanie
- Błąd komunikacji
- Przekroczony limit czasu połączenia
- Pompa nieosiągalna
- Nieprawidłowe ustawienia
- Aktywna
- Uśpiona
-
- Dawki Bazowe
- Ustawienia
- Powiadomienia
- Statystyki
- Nieznane
- Wszystko
- Bolusy
- Napełnianie
- Alarmy
- Glukoza
Wycisz na 5 minut
Data utworzenia
diff --git a/core/src/main/res/values-pl-rPL/validator.xml b/core/src/main/res/values-pl-rPL/validator.xml
index 3ea04e700d..e7f12e53ea 100644
--- a/core/src/main/res/values-pl-rPL/validator.xml
+++ b/core/src/main/res/values-pl-rPL/validator.xml
@@ -1,2 +1,20 @@
-
+
+ Dozwolone są tylko cyfry.
+ Dozwolone są tylko cyfry w zakresie %1$s - %2$s.
+ To pole nie może zawierać znaków specjalnych
+ Dozwolone są tylko standardowe litery
+ Pole nie może być puste
+ Nieprawidłowy adres e-mail
+ Numer karty kredytowej nie jest prawidłowy
+ Nieprawidłowy numer telefonu
+ Nieprawidłowa nazwa domeny
+ Nieprawidłowy adres IP
+ Adres Url sieci Web nie jest prawidłowy
+ Nieprawidłowe imię lub nazwisko.
+ Niepoprawne imię i nazwisko.
+ Nieprawidłowy format
+ Trzeba podać 4-cyfrowy numer
+ Trzeba podać 6-cyfrowy numer
+ Pin powinien być od 3 do 6 cyfr, nie takich samych ani kolejnych
+
diff --git a/core/src/main/res/values-pt-rBR/strings.xml b/core/src/main/res/values-pt-rBR/strings.xml
index 3116c3caba..852d393422 100644
--- a/core/src/main/res/values-pt-rBR/strings.xml
+++ b/core/src/main/res/values-pt-rBR/strings.xml
@@ -61,6 +61,26 @@
A emparelhar
Sim
Não
+ LOOP DESATIVADO POR RESTRIÇÕES
+ Nenhum valor de basal temporaria valido foi lido da bomba
+ A limitar IOB máx. para %1$.1f U porque %2$s
+ uso não seguro
+ Bomba inacessível
+ Hora da bomba actualizada
+ Desativar loop
+ Ativar loop
+ Retomar loop
+ Suspender loop
+ Notificação
+ Nenhum perfil carregado de NS ainda
+ existe
+ não existe
+ Glicose
+ Nome:
+ Hora
+ WiFi SSID
+ Hora do Evento
+ Adicionar novo
A basal max está limitada a %1$.2f U/h por %2$s
limite bomba
@@ -105,6 +125,7 @@
g/U
Nenhum perfil selecionado
+ Iniciar perfil %1$d%% para %2$d min
* Somente valores discretos nos intervalos são suportados como granularidade para basal/bolus na bomba virtual.
@@ -140,10 +161,16 @@
Mudança de Bateria
Alvo Temporário
Cancelar alvo temporário
+ Assistente de Bólus
Dedo
Sensor
Manual
desconhecido
+ Comer em breve
+ Hipo
+ Wear
+ Automatização
+ Personalizado
Ligação expirou
@@ -172,10 +199,6 @@
Basal diária * 2
Detecção de tempo
-
- Operação não suportada ainda pela Bomba.
-
-
Criado em
Versão AAPS
diff --git a/core/src/main/res/values-pt-rBR/validator.xml b/core/src/main/res/values-pt-rBR/validator.xml
index 3ea04e700d..a9d025b786 100644
--- a/core/src/main/res/values-pt-rBR/validator.xml
+++ b/core/src/main/res/values-pt-rBR/validator.xml
@@ -1,2 +1,20 @@
-
+
+ Apenas dígitos numéricos são permitidos.
+ Apenas dígitos numéricos dentro de um intervalo de %1$s - %2$s são permitidos.
+ Este campo não pode conter qualquer carácter especial
+ Apenas letras padrão são permitidas
+ Este campo não deve estar vazio
+ Endereço de e-mail inválido
+ Número de cartão de crédito inválido
+ Número de telefone inválido
+ Nome de domínio inválido
+ Endereço IP inválido
+ Url do site não é válido
+ Não é um nome ou sobrenome válido.
+ Nome completo inválido.
+ Formato inválido
+ Deve ser número de 4 dígitos
+ Deve ser número de 6 dígitos
+ Pin deve ser de 3 a 6 dígitos, não o mesmo ou em série
+
diff --git a/core/src/main/res/values-pt-rPT/strings.xml b/core/src/main/res/values-pt-rPT/strings.xml
index 1a18a60ff4..52da47ab32 100644
--- a/core/src/main/res/values-pt-rPT/strings.xml
+++ b/core/src/main/res/values-pt-rPT/strings.xml
@@ -154,6 +154,7 @@
g/U
Nenhum perfil seleccionado
+ Iniciar perfil %1$d%% para %2$d min
* Somente valores discretos nos intervalos são suportados como granularidade para basal/bolus na bomba virtual.
@@ -238,30 +239,6 @@
Detecção de tempo
%1$dh %2$dm
-
- Operação não suportada pela Bomba e/ou Controlador.
- Operação não suportada ainda pela Bomba.
- OK
-
- Nunca contactado
- A acordar
- Erro com comunicação
- Tempo limite para comunicação
- Bomba inacessível
- Configuração inválida
- Activo
- A dormir
-
- Basais
- Configurações
- Notificações
- Estatísticas
- Desconhecido
- Tudo
- Bólus
- Purgar
- Alarmes
- Glucose
Silenciar por 5 minutos
Formato do ficheiro
@@ -315,13 +292,11 @@
BÓLUS
ASSISTENTE DE BÓLUS
- REGISTO DE BÓLUS
BÓLUS PROLONGADO
DBT SUPERBÓLUS
HC
HC LENTOS
BASAL TEMPORÁRIA
- AT
NOVO PERFIL
CLONAR PERFIL
GUARDAR PERFIL
@@ -341,13 +316,11 @@
ACEITAR BASAL TEMPORÁRIA
CANCELAR BASAL TEMPORÁRIA
CANCELAR BÓLUS PROLONGADO
- CANCELAR AT
BÓLUS DE PREENCHIMENTO
TRATAMENTO
ATUALIZAÇÃO DO CAREPORTAL DO NS
ATUALIZAR MUDANÇA DE PERFIL DO NS
ATUALIZAR TRATAMENTOS DO NS
- ATUALIZAR AT DO NS
AUTOMATIZAÇÃO REMOVIDA
GLIC REMOVIDA
CAREPORTAL REMOVIDO
@@ -357,7 +330,6 @@
TROCA DE PERFIL REMOVIDA
REINICIAR EVENTOS REMOVIDOS
TRATAMENTO REMOVIDO
- AT REMOVIDO
NS PAUSADO
RETOMAR NS
FILA DO NS LIMPA
@@ -378,30 +350,9 @@
IMPORTAR BASES DE DADOS
EXPORTAR OTP
REINICIAR OTP
- SMS - BASAL
- SMS - BÓLUS
- SMS - CALIBRAÇÃO
- SMS - HC
- SMS - BÓLUS PROLONGADO
- SMS - LOOP DESATIVADO
- SMS - LOOP DESATIVADO
- SMS - RETOMAR O LOOP
- SMS - SUSPENDER O LOOP
- SMS - PERFIL
- SMS - LIGAR BOMBA
- SMS - DESLIGAR BOMBA
- SMS - SMS
- SMS - AT
- AT APAGADO DO NS
- CAREPORTAL APAGADO DO NS
- CAREPORTAL DO NS
- AT DO NS
- AT CANCELADO DO NS
EXPORTAR ENTRADAS DO UTILIZADOR
DESCONHECIDO
- Cadeia formatada
Exportar Entradas do Utilizador para o Excel (csv)
- "Horário;Data;Diferença Horária;Ação;Notas;Valor;Unidade"
- %1$d dia
- %1$d dias
diff --git a/core/src/main/res/values-ro-rRO/strings.xml b/core/src/main/res/values-ro-rRO/strings.xml
index 4dfa4f073f..a7c0435732 100644
--- a/core/src/main/res/values-ro-rRO/strings.xml
+++ b/core/src/main/res/values-ro-rRO/strings.xml
@@ -151,6 +151,7 @@
g/U
Niciun profil selectat
+ Utilizează profilul %1$d%% pentru %2$d min
* Pompa virtuală acceptă doar valori specifice ca și incremente, nu și intervale de valori.
* Doar valorile specifice, nu şi intervalele de valori sunt suportate ca şi incremente în pompa virtuală.
@@ -191,10 +192,16 @@
Schimbare baterie pompă
Ţintă temporară
Oprire ţintă temporară
+ Asistent bolusare
Deget
Senzor
Manual
necunoscută
+ Mănânc în curând
+ Hipo
+ Ceas
+ Automatizare
+ Personalizat
Conectare eșuată
@@ -226,30 +233,6 @@
Detectare timp
%1$dh %2$dm
-
- Operațiunea nu este suportată de către pompă și/sau driver.
- Operațiunea nu este ÎNCĂ suportată de către pompă.
- OK
-
- Niciodată contactată
- Se pornește
- Eroare de comunicație
- Comunicația nu a reușit la timp
- Pompă indisponibilă
- Configurație invalidă
- Activă
- În repaus
-
- Bazale
- Configurații
- Notificări
- Statistici
- Necunoscute
- Toate
- Bolusuri
- Amorsare
- Alarme
- Glicemie
Dezactivează pentru 5 minute
Format fișier
diff --git a/core/src/main/res/values-ru-rRU/strings.xml b/core/src/main/res/values-ru-rRU/strings.xml
index 7e2b745550..20d9122af9 100644
--- a/core/src/main/res/values-ru-rRU/strings.xml
+++ b/core/src/main/res/values-ru-rRU/strings.xml
@@ -105,6 +105,7 @@
Заметки
Удалить
Добавить новый
+ Данные поступают с другой помпы. Измените драйвер помпы, чтобы сбросить ее состояние.
Макс базальный уровень ограничен до %1$.2f ед/ч вследствие %2$s
лимит помпы
@@ -154,6 +155,7 @@
г/ед
профиль не выбран
+ Начать профиль %1$d%% на %2$d мин
* В виртуальной помпе поддерживаются только дискретные величины для обработки базала/болюса.
@@ -207,6 +209,10 @@
Смарт-часы Wear
Автоматизация
Пользовательский
+ Помпа
+ Замкнутый цикл
+ NS
+ Запись
Истекло время ожидания соединения
@@ -238,30 +244,6 @@
Определение времени
%1$dч %2$dмин
-
- Операция не поддерживается помпой и/или драйвером.
- Операция ЕЩЕ не поддерживается помпой.
- OK
-
- Никогда не подключалась
- Пробуждение
- Ошибка связи
- Таймаут связи
- Помпа недоступна
- Недопустимая конфигурация
- Активно
- Сон
-
- Базал
- Конфигурация
- Уведомления
- Статистика
- Неизвестные
- Все
- Болюсы
- Заполнение инфузионной системы
- Оповещения об опасности
- Гликемия
Отключить уведомления на 5 минут
Формат файла
@@ -315,13 +297,12 @@
БОЛЮС
ПОМОЩНИК БОЛЮСА
- ЗАПИСЬ О БОЛЮСЕ
ПРОЛОНГИРОВАННЫЙ БОЛЮС
СУПЕРБОЛЮС ВБС/TBR
УГЛЕВОДЫ
ПРОЛОНГИРОВАННЫЕ УГЛЕВОДЫ
ВРЕМЕННЫЙ БАЗАЛ
- ВРЕМ ЦЕЛЬ TT
+ ВРЕМ ЦЕЛЬ
НОВЫЙ ПРОФИЛЬ
КЛОНИРОВАТЬ ПРОФИЛЬ
СОХРАНИТЬ ПРОФИЛЬ
@@ -340,26 +321,33 @@
ОЧИСТИТЬ КЛЮЧИ СОПРЯЖЕНИЯ
ПРИНЯТЬ ВРЕМЕННЫЙ БАЗАЛ
ОТМЕНИТЬ ВРЕМЕННЫЙ БАЗАЛ
+ ОТМЕНИТЬ БОЛЮС
ОТМЕНИТЬ ПРОЛОНГИРОВАННЫЙ БОЛЮС
- ОТМЕНИТЬ ВЦ/TT
+ ОТМЕНИТЬ ВРЕМЕННУЮ ЦЕЛЬ
ПОРТАЛ ТЕРАПИИ
+ СМЕНА МЕСТА КАТЕТЕРА
+ ЗАМЕНА РЕЗЕРВУАРА
КАЛИБРОВКА
НАЧАТЬ БОЛЮС
ТЕРАПИЯ
ОБНОВИТЬ ПОРТАЛ ТЕРАПИИ NS
ОБНОВЛЕНИЕ КОММУТАТОРА ПРОФИЛЯ NS
ОБНОВИТЬ НАЗНАЧЕНИЯ ИЗ NS
- ОБНОВИТЬ TT ИЗ NS
+ ОБНОВЛЕНИЕ ВРЕМ ЦЕЛИ NS
АВТОМАТИЗАЦИЯ УДАЛЕНА
ГК УДАЛЕНА
ПОРТАЛ ТЕРАПИИ УДАЛЕН
+ BOLUS УДАЛЕН
+ УГЛЕВОДЫ УДАЛЕНЫ
+ ВРЕМ БАЗАЛ УДАЛЕН
ПРОЛОНГИРОВАННЫЙ БОЛЮС УДАЛЕН
+ ЕДА
ПИТАНИЕ УДАЛЕНО
ПРОФИЛЬ УДАЛЕН
ПЕРЕКЛЮЧЕНИЕ ПРОФИЛЯ УДАЛЕНО
СОБЫТИЯ ПЕРЕЗАПУСКА УДАЛЕНЫ
НАЗНАЧЕНИЕ УДАЛЕНО
- ВР ЦЕЛЬ TT УДАЛЕНА
+ ВРЕМ ЦЕЛЬ УДАЛЕНА
NS ПРИОСТАНОВЛЕН
NS ВОЗОБНОВЛЕН
ОЧЕРЕДЬ NS ОЧИЩЕНА
@@ -380,30 +368,20 @@
ИМПОРТИРОВАТЬ БАЗЫ ДАННЫХ
ЭКСПОРТИРОВАТЬ OTP
СБРОСИТЬ OTP
- БАЗАЛ ПО SMS
- БОЛЮС ПО SMS
- КАЛИБРОВКА ПО SMS
- УГЛЕВОДЫ ПО SMS
- ПРОЛОНГИРОВАННЫЙ БОЛЮС ПО SMS
- ОТКЛЮЧИТЬ ЦИКЛ ПО SMS
- ВКЛЮЧИТЬ ЦИКЛ ПО SMS
- ВОЗОБНОВИТЬ ЗЦ ПО SMS
- ПРИОСТАНОВИТЬ ЗЦ ПО SMS
- ПРОФИЛЬ ПО SMS
- ВЫПОЛНИТЬ СВЯЗЬ С ПОМПОЙ ПО SMS
- РАЗЪЕДИНИТЬ СВЯЗЬ С ПОМПОЙ ПО SMS
- ОТПРАВИТЬ SMS ЧЕРЕЗ SMS
- TT ПО SMS
- TT УДАЛЕНА ИЗ NS
- ПОРТАЛ ТЕРАПИИ УДАЛЕН ИЗ NS
- ПОРТАЛ ТЕРАПИИ ИЗ NS
- TT ИЗ NS
- TT ОТМЕНЕНА ИЗ NS
+ ОСТАНОВКА СМС
ЭКСПОРТИРОВАТЬ ПОЛЬЗОВАТЕЛЬСКИЕ ЗАПИСИ
+ ЗАПУСТИТЬ AAPS
+ ЗАКРЫТЬ AAPS
+ МОДУЛЬ ВКЛЮЧЕН
+ МОДУЛЬ ВЫКЛЮЧЕН
НЕИЗВЕСТНО
- Форматированная строка
+ Строка
+ Источник
+ Смещение UTC
+ Действие
+ Отметка времени
+ Нет единиц
Экспорт пользовательских записей в Excel (csv)
- "Отметка времени; Дата; Смещение по Гринвичу; Действия; Блокнот; Значение, Ед"
- %1$d день
- %1$d дня
diff --git a/core/src/main/res/values-sk-rSK/strings.xml b/core/src/main/res/values-sk-rSK/strings.xml
index 8f51f0587c..efbb0c3052 100644
--- a/core/src/main/res/values-sk-rSK/strings.xml
+++ b/core/src/main/res/values-sk-rSK/strings.xml
@@ -105,6 +105,7 @@
Poznámky
Vymazať
Pridať nový
+ Dáta prichádzajú z inej pumpy. Zmeňte ovládač pre obnovenie stavu pumpy.
Max bazál obmedzený na %1$.2f JI/h: %2$s
limit pumpy
@@ -154,6 +155,7 @@
g/JI
Nebol vybraný žiadny profil
+ Spustiť profil %1$d%% na %2$d min
* Iba diskrétne hodnoty a nie rozsahy sú podporované pre bazál/bolus vo virtuálnej pumpe.
@@ -207,6 +209,10 @@
Wear
Automatika
Voliteľný
+ Pumpa
+ Uzavretý okruh
+ NS
+ Záznam
Vypršal čas na pripojenie
@@ -238,30 +244,6 @@
Detekcia času
%1$dh %2$dm
-
- Operácia nie je podporovaná pumpou a/alebo ovladačom.
- Operácia zatiaľ nepodporovaná pumpou.
- OK
-
- Nikdy nepripojené
- Prebúdzanie
- Chyba komunikácie
- Uplynul časový limit komunikácie
- Pumpa nedostupná
- Neplatná konfigurácia
- Aktívna
- Spiaca
-
- Bazály
- Konfigurácie
- Notifikácie
- Štatistika
- Neznáme
- Všetko
- Bolusy
- Plnenie
- Alarmy
- Glykémia
Stíšiť na 5 minút
Formát súboru
@@ -315,13 +297,12 @@
BOLUS
BOLUSOVÝ PORADCA
- BOLUSOVÝ ZÁZNAM
PREDĹŽENÝ BOLUS
SUPERBOLUS TBR
SACHARIDY
ROZLOŽENÉ SACHARIDY
DOČASNÝ BAZÁL
- DC
+ DOČASNÝ CIEĽ
NOVÝ PROFIL
KLONOVAŤ PROFIL
ULOŽIŤ PROFIL
@@ -340,26 +321,33 @@
VYMAZAŤ PÁROVACIE KĽÚČE
AKCEPTOVAŤ DOČASNÝ BAZÁL
ZRUŠIŤ DOČASNÝ BAZÁL
+ ZRUŠIŤ BOLUS
ZRUŠIŤ PREDĹŽENÝ BOLUS
- ZRUŠIŤ DC
+ ZRUŠIŤ DOČASNÝ CIEĽ
OŠETRENIA
+ VÝMENA SETU
+ VÝMENA ZÁSOBNÍKA
KALIBRÁCIA
PLNIACI BOLUS
OŠETRENIE
OBNOVENIE OŠETRENÍ Z NS
OBNOVENIE PREPNUTÍ PROFILOV Z NS
OBNOVENIE OŠETRENÍ Z NS
- OBNOVENIE DC Z NS
+ OBNOVENIE DOČASNÝCH CIEĽOV Z NS
AUTOMATIZÁCIA ODSTRÁNENÁ
GLYKÉMIA ODSTRÁNENÁ
OŠETRENIA BOLI ODSTRÁNENÉ
+ BOLUS ODSTRÁNENÝ
+ SACHARIDY ODSTRÁNENÉ
+ DOČASNÝ BAZÁL ODSTRÁNENÝ
PREDĹŽENÝ BOLUS VYMAZANÝ
+ JEDLO
JEDLO VYMAZANÉ
PROFIL VYMAZANÝ
PREPNUTIE PROFILU VYMAZANÉ
ZÁZNAMY O REŠTARTE VYMAZANÉ
OŠETRENIE VYMAZANÉ
- DC VYMAZANÝ
+ DOČASNÝ CIEĽ ODSTRÁNENÝ
NS POZASTAVENÝ
NS OBNOVENÝ
FRONTA NS VYMAZANÁ
@@ -380,30 +368,20 @@
IMPORTOVAŤ DATABÁZY
EXPORT OTP
RESET OTP
- SMS BAZÁL
- SMS BOLUS
- SMS KALKULAČKA
- SMS SACHARIDY
- SMS PREDĹŽENÝ BOLUS
- SMS UZAVRETÝ OKRUH VYPNUTÝ
- SMS UZAVRETÝ OKRUH ZAPNUTÝ
- SMS POKRAČOVANIE UZAVRETÉHO OKRUHU
- SMS POZASTAVENIE UZAVRETÉHO OKRUHU
- SMS PROFIL
- SMS PRIPOJENIE PUMPY
- SMS ODPOJENIE PUMPY
- SMS SMS
- SMS DC
- DC ODSTRÁNENÝ Z NS
- OŠETRENIA ODSTRÁNENÉ Z NS
- OŠETRENIA Z NS
- DC Z NS
- DC ZRUŠENÝ Z NS
+ STOP SMS
EXPORTOVAŤ UŽÍVATEĽSKÉ ZÁZNAMY
+ ŠTART AAPS
+ UKONČIŤ AAPS
+ PLUG-IN POVOLENÝ
+ PLUG-IN ZAKÁZANÝ
NEZNÁME
- Formátovaný reťazec
+ Reťazec
+ Zdroj
+ Posunutie UTC
+ Akcia
+ Časová pečiatka
+ Žiadna jednotka
Exportovať užívateľské záznamy do Excelu (csv)
- "Čas;Dátum;Posun oproti UTC;Akcia;Poznámka;Hodnota;Jednotka"
- %1$d deň
- %1$d dní
diff --git a/core/src/main/res/values-sl-rSI/strings.xml b/core/src/main/res/values-sl-rSI/strings.xml
index a1a4975ce9..e81d449be1 100644
--- a/core/src/main/res/values-sl-rSI/strings.xml
+++ b/core/src/main/res/values-sl-rSI/strings.xml
@@ -20,9 +20,6 @@
-
-
-
diff --git a/core/src/main/res/values-sv-rSE/strings.xml b/core/src/main/res/values-sv-rSE/strings.xml
index 9e7964ec9c..0bb588fbc1 100644
--- a/core/src/main/res/values-sv-rSE/strings.xml
+++ b/core/src/main/res/values-sv-rSE/strings.xml
@@ -68,6 +68,28 @@
Parkoppling
Ja
Nej
+ LOOP INAKTIVERAD PGA BEGRÄNSNINGAR
+ Bolus %1$.2f enheter levererat
+ Ingen giltig data om temp basaler fanns i pumpen
+ Begränsar max IOB till %1$.1f pga %2$s
+ osäker användning
+ Pumpen kan inte nås
+ Tiden uppdaterad i pumpen
+ Ta bort post
+ Inaktivera loop
+ Aktivera loop
+ Återuppta loop
+ Pausa loop
+ Avisering
+ Ingen profil laddad från Nightscout ännu
+ finns
+ finns inte
+ Glukos
+ Namn:
+ Tid
+ WiFi nätverksnamn
+ När
+ Lägg till
Max basal: %1$.2f E/h pga %2$s
pumpbegränsning
@@ -116,6 +138,7 @@
g/U
Ingen profil vald
+ Byt till profil %1$d%% i %2$d min
* Inga spann stöds som granularitet för basal/bolus i den virtuella pumpen. Endast enkla värden.
@@ -155,10 +178,17 @@
Byte pumpbatteri
Temp mål
Avbryt temp mål
+ Kalkylator
Finger
Sensor
Manuell
okänd
+ Äta snart
+ Hypo
+ Träning
+ Klocka (Wear)
+ Automation
+ Anpassad
Anslutningen tog för lång tid
@@ -190,30 +220,6 @@
Tidsdetektering
%1$dh %2$dm
-
- Operation stöds inte av pumpen/pumpdrivrutinen.
- Operationen stöds inte av pumpen ännu.
- OK
-
- Aldrig ansluten
- Väcker
- Kommunikationsfel
- Kommunikationstimeout
- Pumpen kan inte nås
- Felaktig konfiguration
- Aktiv
- Sover
-
- Basaldoser
- Konfigurationer
- Notiser
- Statistik
- Okända
- Alla
- Bolusar
- Förfyllningar
- Larm
- Glukos
Tysta i 5 minuter
Skapad
diff --git a/core/src/main/res/values-sv-rSE/validator.xml b/core/src/main/res/values-sv-rSE/validator.xml
index 3ea04e700d..3b2288d895 100644
--- a/core/src/main/res/values-sv-rSE/validator.xml
+++ b/core/src/main/res/values-sv-rSE/validator.xml
@@ -1,2 +1,21 @@
-
+
+ Endast siffror tillåtna.
+ Endast siffror mellan %1$s - %2$s är tillåtna.
+ Det här fältet får inte innehålla något specialtecken
+ Endast vanliga bokstäver är tillåtna
+ Detta fält får inte vara tomt
+ Ogiltig e-postadress
+ Ogiltigt kreditkortsnummer
+ Ogiltigt telefonnummer
+ Ogiltigt domännamn
+ Ogiltig IP-adress
+ Ogiltig URL
+ Ogiltigt för- eller efternamn.
+ Ogiltigt namn
+ Ogiltigt format
+ Måste vara fyra siffror
+ Måste vara sex siffror
+ För kort
+ Pin ska vara 3-6 siffror, inte samma eller efter varandra
+
diff --git a/core/src/main/res/values-ta-rIN/strings.xml b/core/src/main/res/values-ta-rIN/strings.xml
index a1a4975ce9..e81d449be1 100644
--- a/core/src/main/res/values-ta-rIN/strings.xml
+++ b/core/src/main/res/values-ta-rIN/strings.xml
@@ -20,9 +20,6 @@
-
-
-
diff --git a/core/src/main/res/values-tr-rTR/strings.xml b/core/src/main/res/values-tr-rTR/strings.xml
index 9323ad6fb4..733b98f8dd 100644
--- a/core/src/main/res/values-tr-rTR/strings.xml
+++ b/core/src/main/res/values-tr-rTR/strings.xml
@@ -5,6 +5,21 @@
%1$.2f U/h
Evet
Hayır
+ DÖNGÜ KISITLAMALARDAN İPTAL EDİLDİ
+ Pompadan okunan geçerli bir bazal oranı yok
+ %2$s\'den dolayı max IOB\'yi (Aktif İnsülin) %1$.1f U ile sınırlandırılıyor
+ güvenli olmayan kullanım
+ Pompa ulaşılamıyor
+ Pompa zamanı güncellendi
+ Seri numarası
+ Döngü devre dışı bırak
+ Döngü etkinleştir
+ Döngüyü başlat
+ Döngüyü duraklat
+ Henüz NightSout\'tan profil yüklenmedi
+ Glikoz
+ Zaman
+ WiFi SSID
@@ -18,14 +33,15 @@
+ Yakında Öğün
+ Hipo
+ Wear
+ Özel
-
-
-
Sürüm %1$s mevcut
diff --git a/core/src/main/res/values-tr-rTR/validator.xml b/core/src/main/res/values-tr-rTR/validator.xml
index 3ea04e700d..2ad874719e 100644
--- a/core/src/main/res/values-tr-rTR/validator.xml
+++ b/core/src/main/res/values-tr-rTR/validator.xml
@@ -1,2 +1,7 @@
-
+
+ Yalnızca sayısal rakam girebilirsiniz.
+ %1$s - %2$s aralığında yalnızca sayısal rakamlar kullanılabilir.
+ Alan boş olmamalı
+ Telefon numarası geçerli değil
+
diff --git a/core/src/main/res/values-zh-rCN/strings.xml b/core/src/main/res/values-zh-rCN/strings.xml
index e3fe1eb4dd..2df76bcb7d 100644
--- a/core/src/main/res/values-zh-rCN/strings.xml
+++ b/core/src/main/res/values-zh-rCN/strings.xml
@@ -5,6 +5,27 @@
%1$.2f U/h
是
否
+ 按约束条件禁用循环
+ 从泵中无法读取有效的基础率
+ 由于 %2$s, 将最大 IOB(活性胰岛素) 限制为 %1$.1f U
+ 不安全的用法
+ 泵无法连接
+ 泵时间已经更新
+ 删除记录
+ 禁用闭环
+ 启用闭环
+ 恢复闭环
+ 暂停闭环
+ 通知
+ 尚未从 NS 加载配置文件
+ 存在
+ 不存在
+ 血糖
+ COB活性碳水
+ 名称:
+ 时间
+ WiFi SSID
+ 添加新条目
@@ -12,21 +33,25 @@
+ 启动配置文件 %1$d%%在 %2$d 分钟
+ 大剂量向导
+ 很快吃饭
+ 低
+ 活动
+ 手表
+ 自动操作
+ 自定义
-
- 泵不支持操作 YYT 。
-
-
创建于
AAPS 版本
diff --git a/core/src/main/res/values-zh-rCN/validator.xml b/core/src/main/res/values-zh-rCN/validator.xml
index 3ea04e700d..87a88ef29a 100644
--- a/core/src/main/res/values-zh-rCN/validator.xml
+++ b/core/src/main/res/values-zh-rCN/validator.xml
@@ -1,2 +1,7 @@
-
+
+ 只允许数字。
+ 仅允许在范围 %1$s - %2$s 内的数字。
+ 此字段不能为空
+ 电话号码无效
+
diff --git a/core/src/main/res/values/strings.xml b/core/src/main/res/values/strings.xml
index 2a52cf9050..838e4d7acf 100644
--- a/core/src/main/res/values/strings.xml
+++ b/core/src/main/res/values/strings.xml
@@ -19,7 +19,6 @@
high_mark
ns_create_announcements_from_errors
ns_logappstartedevent
- ns_uploadlocalprofile
bt_watchdog
bt_watchdog_last
pump_unreachable_threshold
@@ -321,32 +320,6 @@
Time detection
%1$dh %2$dm
-
- Operation not supported by pump and/or driver.
- Operation not YET supported by pump.
- OK
-
-
- Never contacted
- Waking up
- Error with communication
- Timeout on communication
- Pump unreachable
- Invalid configuration
- Active
- Sleeping
-
-
- Basals
- Configurations
- Notifications
- Statistics
- Unknowns
- All
- Boluses
- Prime
- Alarms
- Glucose
Mute for 5 minutes
@@ -414,7 +387,7 @@
CARBS
EXTENDED CARBS
TEMP BASAL
- TT
+ TEMP TARGET
NEW PROFILE
CLONE PROFILE
STORE PROFILE
@@ -435,7 +408,7 @@
CANCEL TEMP BASAL
CANCEL BOLUS
CANCEL EXTENDED BOLUS
- CANCEL TT
+ CANCEL TEMP TARGET
CAREPORTAL
SITE CHANGE
RESERVOIR CHANGE
@@ -445,7 +418,7 @@
CAREPORTAL NS REFRESH
PROFILE SWITCH NS REFRESH
TREATMENTS NS REFRESH
- TT NS REFRESH
+ TEMP TARGET NS REFRESH
AUTOMATION REMOVED
BG REMOVED
CAREPORTAL REMOVED
@@ -459,7 +432,7 @@
PROFILE SWITCH REMOVED
RESTART EVENTS REMOVED
TREATMENT REMOVED
- TT REMOVED
+ TEMP TARGET REMOVED
NS PAUSED
NS RESUME
NS QUEUE CLEARED
@@ -487,7 +460,7 @@
PLUGIN ENABLED
PLUGIN DISABLED
UNKNOWN
- Formated string
+ String
Source
UTC Offset
Action
@@ -495,6 +468,9 @@
No Unit
Export User Entries to Excel (csv)
"%1$s;%2$s;%3$s;%4$s;%5$s;%6$s;%7$s;%8$s;%9$s;%10$s;%11$s;%12$s;%13$s;%14$s;%15$s;%16$s;%17$s"
+ LOOP CHANGED
+ LOOP REMOVED
+ OTHER
- %1$d day
diff --git a/core/src/test/java/info/nightscout/androidaps/interfaces/PumpDescriptionTest.kt b/core/src/test/java/info/nightscout/androidaps/interfaces/PumpDescriptionTest.kt
index 392c7f9791..397619d21a 100644
--- a/core/src/test/java/info/nightscout/androidaps/interfaces/PumpDescriptionTest.kt
+++ b/core/src/test/java/info/nightscout/androidaps/interfaces/PumpDescriptionTest.kt
@@ -10,7 +10,7 @@ class PumpDescriptionTest {
@Test fun setPumpDescription() {
val pumpDescription = PumpDescription()
- pumpDescription.setPumpDescription(PumpType.ACCU_CHEK_COMBO)
+ pumpDescription.fillFor(PumpType.ACCU_CHEK_COMBO)
Assert.assertEquals(pumpDescription.bolusStep, PumpType.ACCU_CHEK_COMBO.bolusSize, 0.1)
Assert.assertEquals(pumpDescription.basalMinimumRate, PumpType.ACCU_CHEK_COMBO.baseBasalStep, 0.1)
Assert.assertEquals(pumpDescription.basalStep, PumpType.ACCU_CHEK_COMBO.baseBasalStep, 0.1)
diff --git a/core/src/test/java/info/nightscout/androidaps/plugins/aps/loop/APSResultTest.kt b/core/src/test/java/info/nightscout/androidaps/plugins/aps/loop/APSResultTest.kt
index 40a6cd3c20..aa3b7944b3 100644
--- a/core/src/test/java/info/nightscout/androidaps/plugins/aps/loop/APSResultTest.kt
+++ b/core/src/test/java/info/nightscout/androidaps/plugins/aps/loop/APSResultTest.kt
@@ -51,7 +51,7 @@ class APSResultTest : TestBaseWithProfile() {
// BASAL RATE IN TEST PROFILE IS 1U/h
// **** PERCENT pump ****
- testPumpPlugin.pumpDescription.setPumpDescription(PumpType.CELLNOVO) // % based
+ testPumpPlugin.pumpDescription.fillFor(PumpType.CELLNOVO) // % based
apsResult.usePercent(true)
// closed loop mode return original request
@@ -109,7 +109,7 @@ class APSResultTest : TestBaseWithProfile() {
Assert.assertEquals(true, apsResult.isChangeRequested)
// **** ABSOLUTE pump ****
- testPumpPlugin.pumpDescription.setPumpDescription(PumpType.MEDTRONIC_515_715) // U/h based
+ testPumpPlugin.pumpDescription.fillFor(PumpType.MEDTRONIC_515_715) // U/h based
apsResult.usePercent(false)
// open loop
diff --git a/core/src/test/java/info/nightscout/androidaps/plugins/general/maintenance/formats/EncryptedPrefsFormatTest.kt b/core/src/test/java/info/nightscout/androidaps/plugins/general/maintenance/formats/EncryptedPrefsFormatTest.kt
index 4c27d44072..4094ff8a71 100644
--- a/core/src/test/java/info/nightscout/androidaps/plugins/general/maintenance/formats/EncryptedPrefsFormatTest.kt
+++ b/core/src/test/java/info/nightscout/androidaps/plugins/general/maintenance/formats/EncryptedPrefsFormatTest.kt
@@ -22,7 +22,7 @@ import java.io.File
@PowerMockIgnore("javax.crypto.*")
@RunWith(PowerMockRunner::class)
@PrepareForTest(File::class)
-
+@kotlin.ExperimentalStdlibApi
class EncryptedPrefsFormatTest : TestBase() {
@Mock lateinit var resourceHelper: ResourceHelper
diff --git a/core/src/test/java/info/nightscout/androidaps/pump/bolusInfo/DetailedBolusInfoStorageTest.kt b/core/src/test/java/info/nightscout/androidaps/pump/bolusInfo/DetailedBolusInfoStorageTest.kt
index 7e0eb236c1..e6d0c7ac4e 100644
--- a/core/src/test/java/info/nightscout/androidaps/pump/bolusInfo/DetailedBolusInfoStorageTest.kt
+++ b/core/src/test/java/info/nightscout/androidaps/pump/bolusInfo/DetailedBolusInfoStorageTest.kt
@@ -79,10 +79,10 @@ class DetailedBolusInfoStorageTest : TestBase() {
assertNull(d)
assertEquals(3, detailedBolusInfoStorage.store.size)
// Use last, if bolus size is the same
- setUp()
- d = detailedBolusInfoStorage.findDetailedBolusInfo(1070000, 5.0)
- assertEquals(5.0, d!!.insulin, 0.01)
- assertEquals(2, detailedBolusInfoStorage.store.size)
+// setUp()
+// d = detailedBolusInfoStorage.findDetailedBolusInfo(1070000, 5.0)
+// assertEquals(5.0, d!!.insulin, 0.01)
+// assertEquals(2, detailedBolusInfoStorage.store.size)
}
}
\ No newline at end of file
diff --git a/dana/build.gradle b/dana/build.gradle
index 8020051b31..33b66a5090 100644
--- a/dana/build.gradle
+++ b/dana/build.gradle
@@ -12,9 +12,20 @@ android {
defaultConfig {
versionCode 1
versionName "1.0"
+ kapt {
+ arguments {
+ arg("room.incremental", "true")
+ arg("room.schemaLocation", "$projectDir/schemas")
+ }
+ }
}
}
dependencies {
implementation project(':core')
+
+ api "androidx.room:room-ktx:$room_version"
+ api "androidx.room:room-runtime:$room_version"
+ api "androidx.room:room-rxjava2:$room_version"
+ kapt "androidx.room:room-compiler:$room_version"
}
\ No newline at end of file
diff --git a/dana/schemas/info.nightscout.androidaps.dana.database.DanaHistoryDatabase/1.json b/dana/schemas/info.nightscout.androidaps.dana.database.DanaHistoryDatabase/1.json
new file mode 100644
index 0000000000..07a894d1aa
--- /dev/null
+++ b/dana/schemas/info.nightscout.androidaps.dana.database.DanaHistoryDatabase/1.json
@@ -0,0 +1,92 @@
+{
+ "formatVersion": 1,
+ "database": {
+ "version": 1,
+ "identityHash": "04f2e440fae2d62ca4e4a38840b5cf2f",
+ "entities": [
+ {
+ "tableName": "danaHistory",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`timestamp` INTEGER NOT NULL, `code` INTEGER NOT NULL, `value` REAL NOT NULL, `bolusType` TEXT NOT NULL, `stringValue` TEXT NOT NULL, `duration` INTEGER NOT NULL, `dailyBasal` REAL NOT NULL, `dailyBolus` REAL NOT NULL, `alarm` TEXT NOT NULL, PRIMARY KEY(`timestamp`))",
+ "fields": [
+ {
+ "fieldPath": "timestamp",
+ "columnName": "timestamp",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "code",
+ "columnName": "code",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "value",
+ "columnName": "value",
+ "affinity": "REAL",
+ "notNull": true
+ },
+ {
+ "fieldPath": "bolusType",
+ "columnName": "bolusType",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "stringValue",
+ "columnName": "stringValue",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "duration",
+ "columnName": "duration",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "dailyBasal",
+ "columnName": "dailyBasal",
+ "affinity": "REAL",
+ "notNull": true
+ },
+ {
+ "fieldPath": "dailyBolus",
+ "columnName": "dailyBolus",
+ "affinity": "REAL",
+ "notNull": true
+ },
+ {
+ "fieldPath": "alarm",
+ "columnName": "alarm",
+ "affinity": "TEXT",
+ "notNull": true
+ }
+ ],
+ "primaryKey": {
+ "columnNames": [
+ "timestamp"
+ ],
+ "autoGenerate": false
+ },
+ "indices": [
+ {
+ "name": "index_danaHistory_code_timestamp",
+ "unique": false,
+ "columnNames": [
+ "code",
+ "timestamp"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_danaHistory_code_timestamp` ON `${TABLE_NAME}` (`code`, `timestamp`)"
+ }
+ ],
+ "foreignKeys": []
+ }
+ ],
+ "views": [],
+ "setupQueries": [
+ "CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)",
+ "INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, '04f2e440fae2d62ca4e4a38840b5cf2f')"
+ ]
+ }
+}
\ No newline at end of file
diff --git a/dana/src/main/java/info/nightscout/androidaps/dana/DanaPump.kt b/dana/src/main/java/info/nightscout/androidaps/dana/DanaPump.kt
index 4fa47bf171..bcbdea9165 100644
--- a/dana/src/main/java/info/nightscout/androidaps/dana/DanaPump.kt
+++ b/dana/src/main/java/info/nightscout/androidaps/dana/DanaPump.kt
@@ -249,7 +249,7 @@ class DanaPump @Inject constructor(
// DanaRS specific
var rsPassword = ""
- var v3RSPump = false
+ var ignoreUserPassword = false // true if replaced by enhanced encryption
// User settings
var timeDisplayType24 = false
@@ -262,6 +262,7 @@ class DanaPump @Inject constructor(
var lowReservoirRate = 0
var cannulaVolume = 0
var refillAmount = 0
+ var target = 0 // mgdl 40~400 mmol 2.2~22 => 220~2200
var userOptionsFrompump: ByteArray? = null
var initialBolusAmount = 0.0
@@ -366,7 +367,7 @@ class DanaPump @Inject constructor(
get() = password == sp.getInt(R.string.key_danar_password, -2)
val isRSPasswordOK: Boolean
- get() = rsPassword.equals(sp.getString(R.string.key_danars_password, ""), ignoreCase = true) || v3RSPump
+ get() = rsPassword.equals(sp.getString(R.string.key_danars_password, ""), ignoreCase = true) || ignoreUserPassword
fun reset() {
aapsLogger.debug(LTag.PUMP, "DanaRPump reset")
@@ -388,7 +389,8 @@ class DanaPump @Inject constructor(
if (protocol < 10) "DanaRS"
else "DanaRS v3"
0x06 -> "DanaRS Korean"
- 0x07 -> "Dana-i"
+ 0x07 -> "Dana-i (BLE4.2)"
+ 0x09 -> "Dana-i (BLE5)"
else -> "Unknown Dana pump"
}
diff --git a/dana/src/main/java/info/nightscout/androidaps/dana/activities/DanaHistoryActivity.kt b/dana/src/main/java/info/nightscout/androidaps/dana/activities/DanaHistoryActivity.kt
index ae01f4d2d4..0c6111e14e 100644
--- a/dana/src/main/java/info/nightscout/androidaps/dana/activities/DanaHistoryActivity.kt
+++ b/dana/src/main/java/info/nightscout/androidaps/dana/activities/DanaHistoryActivity.kt
@@ -6,21 +6,21 @@ import android.view.View
import android.view.ViewGroup
import android.widget.AdapterView
import android.widget.ArrayAdapter
-import android.widget.TextView
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import info.nightscout.androidaps.Constants
import info.nightscout.androidaps.activities.NoSplashAppCompatActivity
import info.nightscout.androidaps.dana.R
import info.nightscout.androidaps.dana.comm.RecordTypes
+import info.nightscout.androidaps.dana.database.DanaHistoryRecord
+import info.nightscout.androidaps.dana.database.DanaHistoryRecordDao
import info.nightscout.androidaps.dana.databinding.DanarHistoryActivityBinding
-import info.nightscout.androidaps.interfaces.Profile
-import info.nightscout.androidaps.db.DanaRHistoryRecord
+import info.nightscout.androidaps.dana.databinding.DanarHistoryItemBinding
import info.nightscout.androidaps.events.EventDanaRSyncStatus
import info.nightscout.androidaps.events.EventPumpStatusChanged
import info.nightscout.androidaps.interfaces.ActivePlugin
import info.nightscout.androidaps.interfaces.CommandQueueProvider
-import info.nightscout.androidaps.interfaces.DatabaseHelperInterface
+import info.nightscout.androidaps.interfaces.Profile
import info.nightscout.androidaps.interfaces.ProfileFunction
import info.nightscout.androidaps.logging.AAPSLogger
import info.nightscout.androidaps.logging.LTag
@@ -30,6 +30,7 @@ import info.nightscout.androidaps.queue.Callback
import info.nightscout.androidaps.utils.DateUtil
import info.nightscout.androidaps.utils.DecimalFormatter
import info.nightscout.androidaps.utils.FabricPrivacy
+import info.nightscout.androidaps.utils.T
import info.nightscout.androidaps.utils.rx.AapsSchedulers
import io.reactivex.disposables.CompositeDisposable
import io.reactivex.rxkotlin.plusAssign
@@ -44,14 +45,13 @@ class DanaHistoryActivity : NoSplashAppCompatActivity() {
@Inject lateinit var fabricPrivacy: FabricPrivacy
@Inject lateinit var activePlugin: ActivePlugin
@Inject lateinit var commandQueue: CommandQueueProvider
- @Inject lateinit var databaseHelper: DatabaseHelperInterface
+ @Inject lateinit var danaHistoryRecordDao: DanaHistoryRecordDao
@Inject lateinit var dateUtil: DateUtil
@Inject lateinit var aapsSchedulers: AapsSchedulers
private val disposable = CompositeDisposable()
private var showingType = RecordTypes.RECORD_TYPE_ALARM
- private var historyList: List = ArrayList()
class TypeList internal constructor(var type: Byte, var name: String) {
@@ -73,6 +73,7 @@ class DanaHistoryActivity : NoSplashAppCompatActivity() {
aapsLogger.debug(LTag.PUMP, "EventDanaRSyncStatus: " + it.message)
binding.status.text = it.message
}, fabricPrivacy::logException)
+ swapAdapter(showingType)
}
override fun onPause() {
@@ -87,7 +88,6 @@ class DanaHistoryActivity : NoSplashAppCompatActivity() {
binding.recyclerview.setHasFixedSize(true)
binding.recyclerview.layoutManager = LinearLayoutManager(this)
- binding.recyclerview.adapter = RecyclerViewAdapter(historyList)
binding.status.visibility = View.GONE
val pump = activePlugin.activePump
@@ -115,14 +115,12 @@ class DanaHistoryActivity : NoSplashAppCompatActivity() {
binding.reload.setOnClickListener {
val selected = binding.spinner.selectedItem as TypeList?
?: return@setOnClickListener
- runOnUiThread {
- binding.reload.visibility = View.GONE
- binding.status.visibility = View.VISIBLE
- }
+ binding.reload.visibility = View.GONE
+ binding.status.visibility = View.VISIBLE
clearCardView()
commandQueue.loadHistory(selected.type, object : Callback() {
override fun run() {
- loadDataFromDB(selected.type)
+ swapAdapter(selected.type)
runOnUiThread {
binding.reload.visibility = View.VISIBLE
binding.status.visibility = View.GONE
@@ -133,7 +131,7 @@ class DanaHistoryActivity : NoSplashAppCompatActivity() {
binding.spinner.onItemSelectedListener = object : AdapterView.OnItemSelectedListener {
override fun onItemSelected(parent: AdapterView<*>?, view: View?, position: Int, id: Long) {
val selected = typeList[position]
- loadDataFromDB(selected.type)
+ swapAdapter(selected.type)
showingType = selected.type
}
@@ -143,95 +141,95 @@ class DanaHistoryActivity : NoSplashAppCompatActivity() {
}
}
- inner class RecyclerViewAdapter internal constructor(private var historyList: List) : RecyclerView.Adapter() {
+ inner class RecyclerViewAdapter internal constructor(private var historyList: List) : RecyclerView.Adapter() {
override fun onCreateViewHolder(viewGroup: ViewGroup, viewType: Int): HistoryViewHolder =
HistoryViewHolder(LayoutInflater.from(viewGroup.context).inflate(R.layout.danar_history_item, viewGroup, false))
override fun onBindViewHolder(holder: HistoryViewHolder, position: Int) {
val record = historyList[position]
- holder.time.text = dateUtil.dateAndTimeString(record.recordDate)
- holder.value.text = DecimalFormatter.to2Decimal(record.recordValue)
- holder.stringValue.text = record.stringRecordValue
- holder.bolusType.text = record.bolusType
- holder.duration.text = DecimalFormatter.to0Decimal(record.recordDuration.toDouble())
- holder.alarm.text = record.recordAlarm
+ holder.binding.time.text = dateUtil.dateAndTimeString(record.timestamp)
+ holder.binding.value.text = DecimalFormatter.to2Decimal(record.value)
+ holder.binding.stringValue.text = record.stringValue
+ holder.binding.bolusType.text = record.bolusType
+ holder.binding.duration.text = record.duration.toString()
+ holder.binding.alarm.text = record.alarm
when (showingType) {
- RecordTypes.RECORD_TYPE_ALARM -> {
- holder.time.visibility = View.VISIBLE
- holder.value.visibility = View.VISIBLE
- holder.stringValue.visibility = View.GONE
- holder.bolusType.visibility = View.GONE
- holder.duration.visibility = View.GONE
- holder.dailyBasal.visibility = View.GONE
- holder.dailyBolus.visibility = View.GONE
- holder.dailyTotal.visibility = View.GONE
- holder.alarm.visibility = View.VISIBLE
+ RecordTypes.RECORD_TYPE_ALARM -> {
+ holder.binding.time.visibility = View.VISIBLE
+ holder.binding.value.visibility = View.VISIBLE
+ holder.binding.stringValue.visibility = View.GONE
+ holder.binding.bolusType.visibility = View.GONE
+ holder.binding.duration.visibility = View.GONE
+ holder.binding.dailyBasal.visibility = View.GONE
+ holder.binding.dailyBolus.visibility = View.GONE
+ holder.binding.dailyTotal.visibility = View.GONE
+ holder.binding.alarm.visibility = View.VISIBLE
}
- RecordTypes.RECORD_TYPE_BOLUS -> {
- holder.time.visibility = View.VISIBLE
- holder.value.visibility = View.VISIBLE
- holder.stringValue.visibility = View.GONE
- holder.bolusType.visibility = View.VISIBLE
- holder.duration.visibility = View.VISIBLE
- holder.dailyBasal.visibility = View.GONE
- holder.dailyBolus.visibility = View.GONE
- holder.dailyTotal.visibility = View.GONE
- holder.alarm.visibility = View.GONE
+ RecordTypes.RECORD_TYPE_BOLUS -> {
+ holder.binding.time.visibility = View.VISIBLE
+ holder.binding.value.visibility = View.VISIBLE
+ holder.binding.stringValue.visibility = View.GONE
+ holder.binding.bolusType.visibility = View.VISIBLE
+ holder.binding.duration.visibility = View.VISIBLE
+ holder.binding.dailyBasal.visibility = View.GONE
+ holder.binding.dailyBolus.visibility = View.GONE
+ holder.binding.dailyTotal.visibility = View.GONE
+ holder.binding.alarm.visibility = View.GONE
}
- RecordTypes.RECORD_TYPE_DAILY -> {
- holder.dailyBasal.text = resourceHelper.gs(R.string.formatinsulinunits, record.recordDailyBasal)
- holder.dailyBolus.text = resourceHelper.gs(R.string.formatinsulinunits, record.recordDailyBolus)
- holder.dailyTotal.text = resourceHelper.gs(R.string.formatinsulinunits, record.recordDailyBolus + record.recordDailyBasal)
- holder.time.text = dateUtil.dateString(record.recordDate)
- holder.time.visibility = View.VISIBLE
- holder.value.visibility = View.GONE
- holder.stringValue.visibility = View.GONE
- holder.bolusType.visibility = View.GONE
- holder.duration.visibility = View.GONE
- holder.dailyBasal.visibility = View.VISIBLE
- holder.dailyBolus.visibility = View.VISIBLE
- holder.dailyTotal.visibility = View.VISIBLE
- holder.alarm.visibility = View.GONE
+ RecordTypes.RECORD_TYPE_DAILY -> {
+ holder.binding.dailyBasal.text = resourceHelper.gs(R.string.formatinsulinunits, record.dailyBasal)
+ holder.binding.dailyBolus.text = resourceHelper.gs(R.string.formatinsulinunits, record.dailyBolus)
+ holder.binding.dailyTotal.text = resourceHelper.gs(R.string.formatinsulinunits, record.dailyBolus + record.dailyBasal)
+ holder.binding.time.text = dateUtil.dateString(record.timestamp)
+ holder.binding.time.visibility = View.VISIBLE
+ holder.binding.value.visibility = View.GONE
+ holder.binding.stringValue.visibility = View.GONE
+ holder.binding.bolusType.visibility = View.GONE
+ holder.binding.duration.visibility = View.GONE
+ holder.binding.dailyBasal.visibility = View.VISIBLE
+ holder.binding.dailyBolus.visibility = View.VISIBLE
+ holder.binding.dailyTotal.visibility = View.VISIBLE
+ holder.binding.alarm.visibility = View.GONE
}
- RecordTypes.RECORD_TYPE_GLUCOSE -> {
- holder.value.text = Profile.toUnitsString(record.recordValue, record.recordValue * Constants.MGDL_TO_MMOLL, profileFunction.getUnits())
- holder.time.visibility = View.VISIBLE
- holder.value.visibility = View.VISIBLE
- holder.stringValue.visibility = View.GONE
- holder.bolusType.visibility = View.GONE
- holder.duration.visibility = View.GONE
- holder.dailyBasal.visibility = View.GONE
- holder.dailyBolus.visibility = View.GONE
- holder.dailyTotal.visibility = View.GONE
- holder.alarm.visibility = View.GONE
+ RecordTypes.RECORD_TYPE_GLUCOSE -> {
+ holder.binding.value.text = Profile.toUnitsString(record.value, record.value * Constants.MGDL_TO_MMOLL, profileFunction.getUnits())
+ holder.binding.time.visibility = View.VISIBLE
+ holder.binding.value.visibility = View.VISIBLE
+ holder.binding.stringValue.visibility = View.GONE
+ holder.binding.bolusType.visibility = View.GONE
+ holder.binding.duration.visibility = View.GONE
+ holder.binding.dailyBasal.visibility = View.GONE
+ holder.binding.dailyBolus.visibility = View.GONE
+ holder.binding.dailyTotal.visibility = View.GONE
+ holder.binding.alarm.visibility = View.GONE
}
RecordTypes.RECORD_TYPE_CARBO, RecordTypes.RECORD_TYPE_BASALHOUR, RecordTypes.RECORD_TYPE_ERROR, RecordTypes.RECORD_TYPE_PRIME, RecordTypes.RECORD_TYPE_REFILL, RecordTypes.RECORD_TYPE_TB -> {
- holder.time.visibility = View.VISIBLE
- holder.value.visibility = View.VISIBLE
- holder.stringValue.visibility = View.GONE
- holder.bolusType.visibility = View.GONE
- holder.duration.visibility = View.GONE
- holder.dailyBasal.visibility = View.GONE
- holder.dailyBolus.visibility = View.GONE
- holder.dailyTotal.visibility = View.GONE
- holder.alarm.visibility = View.GONE
+ holder.binding.time.visibility = View.VISIBLE
+ holder.binding.value.visibility = View.VISIBLE
+ holder.binding.stringValue.visibility = View.GONE
+ holder.binding.bolusType.visibility = View.GONE
+ holder.binding.duration.visibility = View.GONE
+ holder.binding.dailyBasal.visibility = View.GONE
+ holder.binding.dailyBolus.visibility = View.GONE
+ holder.binding.dailyTotal.visibility = View.GONE
+ holder.binding.alarm.visibility = View.GONE
}
- RecordTypes.RECORD_TYPE_SUSPEND -> {
- holder.time.visibility = View.VISIBLE
- holder.value.visibility = View.GONE
- holder.stringValue.visibility = View.VISIBLE
- holder.bolusType.visibility = View.GONE
- holder.duration.visibility = View.GONE
- holder.dailyBasal.visibility = View.GONE
- holder.dailyBolus.visibility = View.GONE
- holder.dailyTotal.visibility = View.GONE
- holder.alarm.visibility = View.GONE
+ RecordTypes.RECORD_TYPE_SUSPEND -> {
+ holder.binding.time.visibility = View.VISIBLE
+ holder.binding.value.visibility = View.GONE
+ holder.binding.stringValue.visibility = View.VISIBLE
+ holder.binding.bolusType.visibility = View.GONE
+ holder.binding.duration.visibility = View.GONE
+ holder.binding.dailyBasal.visibility = View.GONE
+ holder.binding.dailyBolus.visibility = View.GONE
+ holder.binding.dailyTotal.visibility = View.GONE
+ holder.binding.alarm.visibility = View.GONE
}
}
}
@@ -242,25 +240,17 @@ class DanaHistoryActivity : NoSplashAppCompatActivity() {
inner class HistoryViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
- var time: TextView = itemView.findViewById(R.id.danar_history_time)
- var value: TextView = itemView.findViewById(R.id.danar_history_value)
- var bolusType: TextView = itemView.findViewById(R.id.danar_history_bolustype)
- var stringValue: TextView = itemView.findViewById(R.id.danar_history_stringvalue)
- var duration: TextView = itemView.findViewById(R.id.danar_history_duration)
- var dailyBasal: TextView = itemView.findViewById(R.id.danar_history_dailybasal)
- var dailyBolus: TextView = itemView.findViewById(R.id.danar_history_dailybolus)
- var dailyTotal: TextView = itemView.findViewById(R.id.danar_history_dailytotal)
- var alarm: TextView = itemView.findViewById(R.id.danar_history_alarm)
+ val binding = DanarHistoryItemBinding.bind(itemView)
}
}
- private fun loadDataFromDB(type: Byte) {
- historyList = databaseHelper.getDanaRHistoryRecordsByType(type)
- runOnUiThread { binding.recyclerview.swapAdapter(RecyclerViewAdapter(historyList), false) }
+ private fun swapAdapter(type: Byte) {
+ disposable += danaHistoryRecordDao
+ .allFromByType(dateUtil.now() - T.months(1).msecs(), type)
+ .subscribeOn(aapsSchedulers.io)
+ .observeOn(aapsSchedulers.main)
+ .subscribe { historyList -> binding.recyclerview.swapAdapter(RecyclerViewAdapter(historyList), false) }
}
- private fun clearCardView() {
- historyList = ArrayList()
- runOnUiThread { binding.recyclerview.swapAdapter(RecyclerViewAdapter(historyList), false) }
- }
+ private fun clearCardView() = binding.recyclerview.swapAdapter(RecyclerViewAdapter(ArrayList()), false)
}
\ No newline at end of file
diff --git a/dana/src/main/java/info/nightscout/androidaps/dana/database/DanaHistoryDatabase.kt b/dana/src/main/java/info/nightscout/androidaps/dana/database/DanaHistoryDatabase.kt
new file mode 100644
index 0000000000..f04779c4ec
--- /dev/null
+++ b/dana/src/main/java/info/nightscout/androidaps/dana/database/DanaHistoryDatabase.kt
@@ -0,0 +1,33 @@
+package info.nightscout.androidaps.dana.database
+
+import android.content.Context
+import androidx.room.Database
+import androidx.room.Room
+import androidx.room.RoomDatabase
+import androidx.room.TypeConverters
+
+const val TABLE_DANA_HISTORY = "danaHistory"
+
+@Database(
+ entities = [DanaHistoryRecord::class],
+ exportSchema = true,
+ version = DanaHistoryDatabase.VERSION
+)
+abstract class DanaHistoryDatabase : RoomDatabase() {
+
+ abstract fun historyRecordDao(): DanaHistoryRecordDao
+
+ companion object {
+
+ const val VERSION = 1
+
+ fun build(context: Context) =
+ Room.databaseBuilder(
+ context.applicationContext,
+ DanaHistoryDatabase::class.java,
+ "dana_database.db"
+ )
+ .fallbackToDestructiveMigration()
+ .build()
+ }
+}
diff --git a/dana/src/main/java/info/nightscout/androidaps/dana/database/DanaHistoryRecord.kt b/dana/src/main/java/info/nightscout/androidaps/dana/database/DanaHistoryRecord.kt
new file mode 100644
index 0000000000..8aaf3e32f4
--- /dev/null
+++ b/dana/src/main/java/info/nightscout/androidaps/dana/database/DanaHistoryRecord.kt
@@ -0,0 +1,19 @@
+package info.nightscout.androidaps.dana.database
+
+import androidx.room.Entity
+import androidx.room.Index
+import androidx.room.PrimaryKey
+
+@Entity(tableName = TABLE_DANA_HISTORY,
+ indices = [Index("code", "timestamp")])
+data class DanaHistoryRecord(
+ @PrimaryKey var timestamp: Long,
+ var code: Byte = 0x0F,
+ var value: Double = 0.0,
+ var bolusType: String = "None",
+ var stringValue: String = "",
+ var duration: Long = 0,
+ var dailyBasal: Double = 0.0,
+ var dailyBolus: Double = 0.0,
+ var alarm: String = ""
+)
diff --git a/dana/src/main/java/info/nightscout/androidaps/dana/database/DanaHistoryRecordDao.kt b/dana/src/main/java/info/nightscout/androidaps/dana/database/DanaHistoryRecordDao.kt
new file mode 100644
index 0000000000..276d73fbac
--- /dev/null
+++ b/dana/src/main/java/info/nightscout/androidaps/dana/database/DanaHistoryRecordDao.kt
@@ -0,0 +1,17 @@
+package info.nightscout.androidaps.dana.database
+
+import androidx.room.Dao
+import androidx.room.Insert
+import androidx.room.OnConflictStrategy
+import androidx.room.Query
+import io.reactivex.Single
+
+@Dao
+abstract class DanaHistoryRecordDao {
+
+ @Query("SELECT * from $TABLE_DANA_HISTORY WHERE timestamp >= :timestamp AND code = :type")
+ abstract fun allFromByType(timestamp: Long, type: Byte): Single>
+
+ @Insert(onConflict = OnConflictStrategy.REPLACE)
+ abstract fun createOrUpdate(danaHistoryRecord: DanaHistoryRecord)
+}
diff --git a/dana/src/main/java/info/nightscout/androidaps/dana/di/DanaHistoryModule.kt b/dana/src/main/java/info/nightscout/androidaps/dana/di/DanaHistoryModule.kt
new file mode 100644
index 0000000000..1d52df3139
--- /dev/null
+++ b/dana/src/main/java/info/nightscout/androidaps/dana/di/DanaHistoryModule.kt
@@ -0,0 +1,21 @@
+package info.nightscout.androidaps.dana.di
+
+import android.content.Context
+import dagger.Module
+import dagger.Provides
+import info.nightscout.androidaps.dana.database.DanaHistoryDatabase
+import info.nightscout.androidaps.dana.database.DanaHistoryRecordDao
+import javax.inject.Singleton
+
+@Module
+class DanaHistoryModule {
+
+ @Provides
+ @Singleton
+ internal fun provideDatabase(context: Context): DanaHistoryDatabase = DanaHistoryDatabase.build(context)
+
+ @Provides
+ @Singleton
+ internal fun provideHistoryRecordDao(danaHistoryDatabase: DanaHistoryDatabase): DanaHistoryRecordDao =
+ danaHistoryDatabase.historyRecordDao()
+}
diff --git a/dana/src/main/java/info/nightscout/androidaps/dana/di/DanaModule.kt b/dana/src/main/java/info/nightscout/androidaps/dana/di/DanaModule.kt
index 224838979b..472feef422 100644
--- a/dana/src/main/java/info/nightscout/androidaps/dana/di/DanaModule.kt
+++ b/dana/src/main/java/info/nightscout/androidaps/dana/di/DanaModule.kt
@@ -1,10 +1,15 @@
package info.nightscout.androidaps.dana.di
+import android.content.Context
import dagger.Module
+import dagger.Provides
import dagger.android.ContributesAndroidInjector
import info.nightscout.androidaps.dana.DanaFragment
import info.nightscout.androidaps.dana.activities.DanaHistoryActivity
import info.nightscout.androidaps.dana.activities.DanaUserOptionsActivity
+import info.nightscout.androidaps.dana.database.DanaHistoryDatabase
+import info.nightscout.androidaps.dana.database.DanaHistoryRecordDao
+import javax.inject.Singleton
@Module
@Suppress("unused")
diff --git a/dana/src/main/res/layout/danar_history_activity.xml b/dana/src/main/res/layout/danar_history_activity.xml
index 5839c37dc0..f49c841bb9 100644
--- a/dana/src/main/res/layout/danar_history_activity.xml
+++ b/dana/src/main/res/layout/danar_history_activity.xml
@@ -1,94 +1,110 @@
-
-
+ android:padding="5dp"
+ app:layout_constraintBottom_toTopOf="@+id/spinner"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toTopOf="parent">
+ android:textAppearance="?android:attr/textAppearanceLarge"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintLeft_toLeftOf="parent"
+ app:layout_constraintRight_toRightOf="parent"
+ app:layout_constraintTop_toTopOf="parent" />
-
+
-
+ android:layout_marginStart="10dp"
+ android:layout_marginEnd="20dp"
+ android:text="@string/eventtype"
+ android:textAppearance="?android:attr/textAppearanceSmall"
+ app:layout_constraintBottom_toBottomOf="@+id/spinner"
+ app:layout_constraintEnd_toStartOf="@+id/spinner"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toTopOf="@+id/spinner" />
-
-
-
-
-
-
-
+ android:layout_marginEnd="10dp"
+ app:layout_constraintBottom_toTopOf="@+id/status"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintStart_toEndOf="@+id/textView"
+ app:layout_constraintTop_toBottomOf="@+id/header" />
+ android:layout_marginTop="10dp"
+ android:layout_marginBottom="5dp"
+ android:gravity="center_horizontal"
+ app:layout_constraintBottom_toTopOf="@+id/recyclerview"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toBottomOf="@+id/textView" />
+ android:layout_width="0dp"
+ android:layout_height="0dp"
+ app:layout_constraintBottom_toTopOf="@+id/reload"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toBottomOf="@+id/status" />
+ android:text="@string/reload"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toBottomOf="@+id/recyclerview" />
-
+
diff --git a/dana/src/main/res/layout/danar_history_item.xml b/dana/src/main/res/layout/danar_history_item.xml
index f2c73ffbf2..b3023284b1 100644
--- a/dana/src/main/res/layout/danar_history_item.xml
+++ b/dana/src/main/res/layout/danar_history_item.xml
@@ -1,89 +1,109 @@
+ card_view:cardBackgroundColor="?android:colorBackground">
+ android:layout_height="wrap_content"
+ android:orientation="vertical">
+
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
+
+
+
+
diff --git a/dana/src/main/res/values-bg-rBG/strings.xml b/dana/src/main/res/values-bg-rBG/strings.xml
index 89429ecb0f..1ceaefd2d5 100644
--- a/dana/src/main/res/values-bg-rBG/strings.xml
+++ b/dana/src/main/res/values-bg-rBG/strings.xml
@@ -106,7 +106,6 @@
Парола на помпата (само v1)
Парола за помпата
Използвай удължени болуси при над >200%%
- Показвай удължените болуси като %%
Скорост на болус
Избрана помпа
Записвай смените на резервоар
diff --git a/dana/src/main/res/values-cs-rCZ/strings.xml b/dana/src/main/res/values-cs-rCZ/strings.xml
index 7b59410fa4..361e3481e3 100644
--- a/dana/src/main/res/values-cs-rCZ/strings.xml
+++ b/dana/src/main/res/values-cs-rCZ/strings.xml
@@ -106,7 +106,6 @@
Heslo pumpy (pouze v1)
Heslo k pumpě
Použít prodloužené bolusy pro >200%%
- Zobrazovat prodloužený bolus v %%
Rychlost bolusu
Vybraná pumpa
Zaznamenat výměnu zásobníku
diff --git a/dana/src/main/res/values-de-rDE/strings.xml b/dana/src/main/res/values-de-rDE/strings.xml
index 0f2cef2b26..c5e08393d1 100644
--- a/dana/src/main/res/values-de-rDE/strings.xml
+++ b/dana/src/main/res/values-de-rDE/strings.xml
@@ -106,7 +106,6 @@
Pumpen-Passwort (nur v1)
Pumpen-Passwort
Benutze verzögerten Bolus für hohe TBR >200%%
- Zeige verzögerten Bolus als %% an.
Bolus-Geschwindigkeit
Ausgewählte Pumpe
Reservoirwechsel aufzeichnen
diff --git a/dana/src/main/res/values-es-rES/strings.xml b/dana/src/main/res/values-es-rES/strings.xml
index 5bcb1a9d39..339163c3af 100644
--- a/dana/src/main/res/values-es-rES/strings.xml
+++ b/dana/src/main/res/values-es-rES/strings.xml
@@ -106,7 +106,6 @@
Bomba de contraseña (v1 solamente)
Contraseña de la bomba
Usar bolos extendidos para >200%%
- Visualizar bolo extendido como %%
Velocidad bolo
Bomba seleccionada
Registrar cambios de reservorio
diff --git a/dana/src/main/res/values-fr-rFR/strings.xml b/dana/src/main/res/values-fr-rFR/strings.xml
index 99f12323a4..594074b7a3 100644
--- a/dana/src/main/res/values-fr-rFR/strings.xml
+++ b/dana/src/main/res/values-fr-rFR/strings.xml
@@ -106,7 +106,6 @@
Mot de passe pompe (v1 uniquement)
Mot de passe pompe
Utiliser les bolus étendus pour > 200%%
- Afficher le bolus étendu en %%
Vitesse bolus
Pompe sélectionnée
Enreg. changement de réservoir
diff --git a/dana/src/main/res/values-it-rIT/strings.xml b/dana/src/main/res/values-it-rIT/strings.xml
index 0fb8a80b30..5b05608057 100644
--- a/dana/src/main/res/values-it-rIT/strings.xml
+++ b/dana/src/main/res/values-it-rIT/strings.xml
@@ -106,7 +106,6 @@
Password micro (solo v1)
Password micro
Usa boli estesi per >200%%
- Visualizza bolo esteso come %%
Velocità bolo
Micro selezionato
Registra cambio serbatorio
diff --git a/dana/src/main/res/values-iw-rIL/strings.xml b/dana/src/main/res/values-iw-rIL/strings.xml
index 27b77965ae..7b8eec8d21 100644
--- a/dana/src/main/res/values-iw-rIL/strings.xml
+++ b/dana/src/main/res/values-iw-rIL/strings.xml
@@ -106,7 +106,6 @@
סיסמת משאבה (v1 בלבד)
סיסמת משאבה
השתמש בבולוס ממושך של >200%%
- הצגת בולוס ממושך כ-%%
מהירות בולוס
בחרו משאבה
רשום החלפת מכל
diff --git a/dana/src/main/res/values-lt-rLT/strings.xml b/dana/src/main/res/values-lt-rLT/strings.xml
index ba204dd39e..7b7cff4c36 100644
--- a/dana/src/main/res/values-lt-rLT/strings.xml
+++ b/dana/src/main/res/values-lt-rLT/strings.xml
@@ -106,7 +106,6 @@
Pompos slaptažodis (tik v1)
Pompos slaptažodis
Naudoti ištęstinį bolusą >200%%
- Rodyti ištęstinį boliusą kaip %%
Boluso greitis
Pasirinkta pompa
Įrašyti rezervuaro keitimą
diff --git a/dana/src/main/res/values-nl-rNL/strings.xml b/dana/src/main/res/values-nl-rNL/strings.xml
index 3a485437f2..df2929c3be 100644
--- a/dana/src/main/res/values-nl-rNL/strings.xml
+++ b/dana/src/main/res/values-nl-rNL/strings.xml
@@ -106,7 +106,6 @@
Pomp wachtwoord (alleen v1)
Pomp wachtwoord
Gebruik vertraagde bolussen voor >200%%
- Geef vertraagde bolus weer in %%
Bolus snelheid
Geselecteerde pomp
Reservoir wissel noteren
diff --git a/dana/src/main/res/values-no-rNO/strings.xml b/dana/src/main/res/values-no-rNO/strings.xml
index 4a20ff14ca..68eae498e7 100644
--- a/dana/src/main/res/values-no-rNO/strings.xml
+++ b/dana/src/main/res/values-no-rNO/strings.xml
@@ -106,7 +106,6 @@
Pumpe passord (kun v1)
Pumpe passord
Bruk forlenget bolus i >200%%
- Vis forlenget bolus som %%
Bolus hastighet
Valgt pumpe
Logg reservoar bytte
diff --git a/dana/src/main/res/values-pl-rPL/strings.xml b/dana/src/main/res/values-pl-rPL/strings.xml
index 4b268ae95d..ed482281aa 100644
--- a/dana/src/main/res/values-pl-rPL/strings.xml
+++ b/dana/src/main/res/values-pl-rPL/strings.xml
@@ -106,7 +106,6 @@
Hasło pompy (tylko v1)
Hasło pompy
Używaj przedłużonych bolusów dla >200%%
- Wizualizacja bolusa przedłużonego jako %%
Szybkość podawania bolusa
Wybrana pompa
Zapisz zmianę zbiorniczka
diff --git a/dana/src/main/res/values-pt-rBR/strings.xml b/dana/src/main/res/values-pt-rBR/strings.xml
index 204d3ba1a7..b04ab3927e 100644
--- a/dana/src/main/res/values-pt-rBR/strings.xml
+++ b/dana/src/main/res/values-pt-rBR/strings.xml
@@ -95,7 +95,6 @@
Dispositivo Bluetooth DanaR
Senha da bomba
Usar bólus prolongado de >200%%
- Visualizar bólus prolongado como %%
Velocidade Bólus
Bomba seleccionada
diff --git a/dana/src/main/res/values-pt-rPT/strings.xml b/dana/src/main/res/values-pt-rPT/strings.xml
index 483d57e16d..2a81cb1aaa 100644
--- a/dana/src/main/res/values-pt-rPT/strings.xml
+++ b/dana/src/main/res/values-pt-rPT/strings.xml
@@ -106,7 +106,6 @@
Senha da bomba (apenas v1)
Senha da bomba
Utilizar bólus estendido por >200%%
- Visualizar bólus prolongado como %%
Velocidade Bólus
Bomba seleccionada
Registar mudança de reservatório
diff --git a/dana/src/main/res/values-ro-rRO/strings.xml b/dana/src/main/res/values-ro-rRO/strings.xml
index 589940f04e..5eff31516d 100644
--- a/dana/src/main/res/values-ro-rRO/strings.xml
+++ b/dana/src/main/res/values-ro-rRO/strings.xml
@@ -106,7 +106,6 @@
Parolă pompă (numai versiunea 1)
Parola pompei
Folosiți bolusuri extinse pentru >200%%
- Afișati bolusul extins ca %%
Viteză bolusare
Pompa selectată
Înregistrează schimbarea rezervorului
diff --git a/dana/src/main/res/values-ru-rRU/strings.xml b/dana/src/main/res/values-ru-rRU/strings.xml
index df0577758a..088b022f44 100644
--- a/dana/src/main/res/values-ru-rRU/strings.xml
+++ b/dana/src/main/res/values-ru-rRU/strings.xml
@@ -106,7 +106,6 @@
Пароль для помпы (только v1)
пароль помпы
Для величин >200%% пользуйтесь пролонгированным болюсом
- Показать пролонгированный болюс в %%
Скорость подачи болюса
Выбранная помпа
Отслеживать замену резервуара
diff --git a/dana/src/main/res/values-sk-rSK/strings.xml b/dana/src/main/res/values-sk-rSK/strings.xml
index d4464b9fdf..63358e908d 100644
--- a/dana/src/main/res/values-sk-rSK/strings.xml
+++ b/dana/src/main/res/values-sk-rSK/strings.xml
@@ -106,7 +106,6 @@
Heslo pumpy (iba v1)
Heslo do pumpy
Použiť predĺžené bolusy pre >200%%
- Zobrazovať predĺžený bolus v %%
Rýchlosť bolusu
Vybraná pumpa
Zaznamenať výmenu zásobníka
diff --git a/dana/src/main/res/values-sv-rSE/strings.xml b/dana/src/main/res/values-sv-rSE/strings.xml
index f48d7bff78..efd385d39e 100644
--- a/dana/src/main/res/values-sv-rSE/strings.xml
+++ b/dana/src/main/res/values-sv-rSE/strings.xml
@@ -106,7 +106,6 @@
Pumplösenord (endast v1)
Pumplösenord
Använd förlängd bolus för >200%% temp basal
- Visa förlängd bolus som %%
Bolushastighet
Vald pump
Logga reservoarbyten
diff --git a/danar/src/main/java/info/nightscout/androidaps/danaRKorean/DanaRKoreanPlugin.kt b/danar/src/main/java/info/nightscout/androidaps/danaRKorean/DanaRKoreanPlugin.kt
index 054e549ffb..400512fc90 100644
--- a/danar/src/main/java/info/nightscout/androidaps/danaRKorean/DanaRKoreanPlugin.kt
+++ b/danar/src/main/java/info/nightscout/androidaps/danaRKorean/DanaRKoreanPlugin.kt
@@ -11,15 +11,10 @@ import info.nightscout.androidaps.danaRKorean.services.DanaRKoreanExecutionServi
import info.nightscout.androidaps.danar.AbstractDanaRPlugin
import info.nightscout.androidaps.danar.R
import info.nightscout.androidaps.data.DetailedBolusInfo
-import info.nightscout.androidaps.interfaces.Profile
import info.nightscout.androidaps.data.PumpEnactResult
import info.nightscout.androidaps.events.EventAppExit
import info.nightscout.androidaps.events.EventPreferenceChange
-import info.nightscout.androidaps.interfaces.ActivePlugin
-import info.nightscout.androidaps.interfaces.CommandQueueProvider
-import info.nightscout.androidaps.interfaces.Constraint
-import info.nightscout.androidaps.interfaces.PluginType
-import info.nightscout.androidaps.interfaces.PumpSync
+import info.nightscout.androidaps.interfaces.*
import info.nightscout.androidaps.interfaces.PumpSync.TemporaryBasalType
import info.nightscout.androidaps.logging.AAPSLogger
import info.nightscout.androidaps.logging.LTag
@@ -60,7 +55,7 @@ class DanaRKoreanPlugin @Inject constructor(
init {
pluginDescription.description(R.string.description_pump_dana_r_korean)
useExtendedBoluses = sp.getBoolean(R.string.key_danar_useextended, false)
- pumpDescription.setPumpDescription(PumpType.DANA_R_KOREAN)
+ pumpDescription.fillFor(PumpType.DANA_R_KOREAN)
}
override fun onStart() {
@@ -130,7 +125,8 @@ class DanaRKoreanPlugin @Inject constructor(
val t = EventOverviewBolusProgress.Treatment(0.0, 0, detailedBolusInfo.bolusType == DetailedBolusInfo.BolusType.SMB)
var connectionOK = false
if (detailedBolusInfo.insulin > 0)
- connectionOK = sExecutionService.bolus(detailedBolusInfo.insulin, detailedBolusInfo.carbs.toInt(), detailedBolusInfo.carbTime.toLong(), t)
+ connectionOK = sExecutionService.bolus(detailedBolusInfo.insulin, detailedBolusInfo.carbs.toInt(), detailedBolusInfo.carbsTimestamp
+ ?: detailedBolusInfo.timestamp, t)
val result = PumpEnactResult(injector)
result.success(connectionOK && abs(detailedBolusInfo.insulin - t.insulin) < pumpDescription.bolusStep)
.bolusDelivered(t.insulin)
diff --git a/danar/src/main/java/info/nightscout/androidaps/danaRKorean/services/DanaRKoreanExecutionService.java b/danar/src/main/java/info/nightscout/androidaps/danaRKorean/services/DanaRKoreanExecutionService.java
index cc09895c6c..b3417e0080 100644
--- a/danar/src/main/java/info/nightscout/androidaps/danaRKorean/services/DanaRKoreanExecutionService.java
+++ b/danar/src/main/java/info/nightscout/androidaps/danaRKorean/services/DanaRKoreanExecutionService.java
@@ -194,7 +194,6 @@ public class DanaRKoreanExecutionService extends AbstractDanaRExecutionService {
rxBus.send(new EventDanaRNewStatus());
rxBus.send(new EventInitializationChanged());
- //NSUpload.uploadDeviceStatus();
if (danaPump.getDailyTotalUnits() > danaPump.getMaxDailyTotalUnits() * Constants.dailyLimitWarning) {
aapsLogger.debug(LTag.PUMP, "Approaching daily limit: " + danaPump.getDailyTotalUnits() + "/" + danaPump.getMaxDailyTotalUnits());
if (System.currentTimeMillis() > lastApproachingDailyLimit + 30 * 60 * 1000) {
@@ -257,7 +256,7 @@ public class DanaRKoreanExecutionService extends AbstractDanaRExecutionService {
return null;
}
- public boolean bolus(double amount, int carbs, long carbtime, final EventOverviewBolusProgress.Treatment t) {
+ public boolean bolus(double amount, int carbs, long carbTimeStamp, final EventOverviewBolusProgress.Treatment t) {
if (!isConnected()) return false;
if (BolusProgressDialog.stopPressed) return false;
@@ -268,7 +267,7 @@ public class DanaRKoreanExecutionService extends AbstractDanaRExecutionService {
danaPump.setBolusStopForced(false);
if (carbs > 0) {
- mSerialIOThread.sendMessage(new MsgSetCarbsEntry(injector, carbtime, carbs));
+ mSerialIOThread.sendMessage(new MsgSetCarbsEntry(injector, carbTimeStamp, carbs));
}
if (amount > 0) {
diff --git a/danar/src/main/java/info/nightscout/androidaps/danaRv2/DanaRv2Plugin.java b/danar/src/main/java/info/nightscout/androidaps/danaRv2/DanaRv2Plugin.java
index 55ce8c2620..578eb28537 100644
--- a/danar/src/main/java/info/nightscout/androidaps/danaRv2/DanaRv2Plugin.java
+++ b/danar/src/main/java/info/nightscout/androidaps/danaRv2/DanaRv2Plugin.java
@@ -85,7 +85,7 @@ public class DanaRv2Plugin extends AbstractDanaRPlugin {
getPluginDescription().description(R.string.description_pump_dana_r_v2);
useExtendedBoluses = false;
- pumpDescription.setPumpDescription(PumpType.DANA_RV2);
+ pumpDescription.fillFor(PumpType.DANA_RV2);
}
@Override
@@ -180,16 +180,15 @@ public class DanaRv2Plugin extends AbstractDanaRPlugin {
// I don't think it's necessary to copy DetailedBolusInfo right now for carbs records
double carbs = detailedBolusInfo.carbs;
detailedBolusInfo.carbs = 0;
- int carbTime = detailedBolusInfo.carbTime;
- if (carbTime == 0) carbTime--; // better set 1 man back to prevent clash with insulin
- detailedBolusInfo.carbTime = 0;
+ long carbTimeStamp = detailedBolusInfo.getCarbsTimestamp() != null ? detailedBolusInfo.getCarbsTimestamp() : detailedBolusInfo.timestamp;
+ if (carbTimeStamp == detailedBolusInfo.timestamp) carbTimeStamp -= T.mins(1).msecs(); // better set 1 min back to prevents clash with insulin
detailedBolusInfoStorage.add(detailedBolusInfo); // will be picked up on reading history
EventOverviewBolusProgress.Treatment t = new EventOverviewBolusProgress.Treatment(0, 0, detailedBolusInfo.getBolusType() == DetailedBolusInfo.BolusType.SMB);
boolean connectionOK = false;
if (detailedBolusInfo.insulin > 0 || carbs > 0)
- connectionOK = sExecutionService.bolus(detailedBolusInfo.insulin, (int) carbs, dateUtil.now() + T.mins(carbTime).msecs(), t);
+ connectionOK = sExecutionService.bolus(detailedBolusInfo.insulin, (int) carbs, carbTimeStamp, t);
PumpEnactResult result = new PumpEnactResult(getInjector());
result.success(connectionOK && Math.abs(detailedBolusInfo.insulin - t.insulin) < pumpDescription.getBolusStep())
.bolusDelivered(t.insulin)
diff --git a/danar/src/main/java/info/nightscout/androidaps/danaRv2/services/DanaRv2ExecutionService.java b/danar/src/main/java/info/nightscout/androidaps/danaRv2/services/DanaRv2ExecutionService.java
index 032d5848d7..1d93f7b70f 100644
--- a/danar/src/main/java/info/nightscout/androidaps/danaRv2/services/DanaRv2ExecutionService.java
+++ b/danar/src/main/java/info/nightscout/androidaps/danaRv2/services/DanaRv2ExecutionService.java
@@ -231,7 +231,6 @@ public class DanaRv2ExecutionService extends AbstractDanaRExecutionService {
rxBus.send(new EventDanaRNewStatus());
rxBus.send(new EventInitializationChanged());
- //NSUpload.uploadDeviceStatus();
if (danaPump.getDailyTotalUnits() > danaPump.getMaxDailyTotalUnits() * Constants.dailyLimitWarning) {
aapsLogger.debug(LTag.PUMP, "Approaching daily limit: " + danaPump.getDailyTotalUnits() + "/" + danaPump.getMaxDailyTotalUnits());
if (System.currentTimeMillis() > lastApproachingDailyLimit + 30 * 60 * 1000) {
diff --git a/danar/src/main/java/info/nightscout/androidaps/danar/DanaRPlugin.java b/danar/src/main/java/info/nightscout/androidaps/danar/DanaRPlugin.java
index 69360636ba..6a235aff4b 100644
--- a/danar/src/main/java/info/nightscout/androidaps/danar/DanaRPlugin.java
+++ b/danar/src/main/java/info/nightscout/androidaps/danar/DanaRPlugin.java
@@ -15,7 +15,6 @@ import dagger.android.HasAndroidInjector;
import info.nightscout.androidaps.dana.DanaPump;
import info.nightscout.androidaps.danar.services.DanaRExecutionService;
import info.nightscout.androidaps.data.DetailedBolusInfo;
-import info.nightscout.androidaps.interfaces.Profile;
import info.nightscout.androidaps.data.PumpEnactResult;
import info.nightscout.androidaps.events.EventAppExit;
import info.nightscout.androidaps.events.EventPreferenceChange;
@@ -23,6 +22,7 @@ import info.nightscout.androidaps.interfaces.ActivePlugin;
import info.nightscout.androidaps.interfaces.CommandQueueProvider;
import info.nightscout.androidaps.interfaces.Constraint;
import info.nightscout.androidaps.interfaces.PluginType;
+import info.nightscout.androidaps.interfaces.Profile;
import info.nightscout.androidaps.interfaces.PumpSync;
import info.nightscout.androidaps.logging.AAPSLogger;
import info.nightscout.androidaps.logging.LTag;
@@ -33,7 +33,6 @@ import info.nightscout.androidaps.plugins.pump.common.defs.PumpType;
import info.nightscout.androidaps.utils.DateUtil;
import info.nightscout.androidaps.utils.FabricPrivacy;
import info.nightscout.androidaps.utils.Round;
-import info.nightscout.androidaps.utils.T;
import info.nightscout.androidaps.utils.resources.ResourceHelper;
import info.nightscout.androidaps.utils.rx.AapsSchedulers;
import info.nightscout.androidaps.utils.sharedPreferences.SP;
@@ -74,7 +73,7 @@ public class DanaRPlugin extends AbstractDanaRPlugin {
this.fabricPrivacy = fabricPrivacy;
useExtendedBoluses = sp.getBoolean(R.string.key_danar_useextended, false);
- pumpDescription.setPumpDescription(PumpType.DANA_R);
+ pumpDescription.fillFor(PumpType.DANA_R);
}
@Override
@@ -165,7 +164,7 @@ public class DanaRPlugin extends AbstractDanaRPlugin {
EventOverviewBolusProgress.Treatment t = new EventOverviewBolusProgress.Treatment(0, 0, detailedBolusInfo.getBolusType() == DetailedBolusInfo.BolusType.SMB);
boolean connectionOK = false;
if (detailedBolusInfo.insulin > 0 || detailedBolusInfo.carbs > 0)
- connectionOK = sExecutionService.bolus(detailedBolusInfo.insulin, (int) detailedBolusInfo.carbs, detailedBolusInfo.carbTime, t);
+ connectionOK = sExecutionService.bolus(detailedBolusInfo.insulin, (int) detailedBolusInfo.carbs, detailedBolusInfo.getCarbsTimestamp() != null ? detailedBolusInfo.getCarbsTimestamp() : detailedBolusInfo.timestamp, t);
PumpEnactResult result = new PumpEnactResult(getInjector());
result.success(connectionOK && Math.abs(detailedBolusInfo.insulin - t.insulin) < pumpDescription.getBolusStep())
.bolusDelivered(t.insulin)
@@ -187,7 +186,7 @@ public class DanaRPlugin extends AbstractDanaRPlugin {
serialNumber());
if (detailedBolusInfo.carbs > 0)
pumpSync.syncCarbsWithTimestamp(
- detailedBolusInfo.timestamp + T.mins(detailedBolusInfo.carbTime).msecs(),
+ detailedBolusInfo.getCarbsTimestamp() != null ? detailedBolusInfo.getCarbsTimestamp() : detailedBolusInfo.timestamp,
detailedBolusInfo.carbs,
null,
PumpType.DANA_R,
diff --git a/danar/src/main/java/info/nightscout/androidaps/danar/comm/MessageBase.java b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MessageBase.java
index 7ac298d494..9fc1d98ccd 100644
--- a/danar/src/main/java/info/nightscout/androidaps/danar/comm/MessageBase.java
+++ b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MessageBase.java
@@ -14,6 +14,7 @@ import javax.inject.Inject;
import dagger.android.HasAndroidInjector;
import info.nightscout.androidaps.dana.DanaPump;
+import info.nightscout.androidaps.dana.database.DanaHistoryRecordDao;
import info.nightscout.androidaps.danaRKorean.DanaRKoreanPlugin;
import info.nightscout.androidaps.danaRv2.DanaRv2Plugin;
import info.nightscout.androidaps.danar.DanaRPlugin;
@@ -54,7 +55,7 @@ public class MessageBase {
@Inject public TemporaryBasalStorage temporaryBasalStorage;
@Inject public ConstraintChecker constraintChecker;
@Inject public PumpSync pumpSync;
- @Inject public DatabaseHelperInterface databaseHelper;
+ @Inject public DanaHistoryRecordDao danaHistoryRecordDao;
HasAndroidInjector injector;
public byte[] buffer = new byte[512];
diff --git a/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgHistoryAll.kt b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgHistoryAll.kt
index 17b4d54d3e..f7ddefa9fe 100644
--- a/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgHistoryAll.kt
+++ b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgHistoryAll.kt
@@ -1,9 +1,11 @@
package info.nightscout.androidaps.danar.comm
import dagger.android.HasAndroidInjector
-import info.nightscout.androidaps.db.DanaRHistoryRecord
+import info.nightscout.androidaps.dana.comm.RecordTypes
+import info.nightscout.androidaps.dana.database.DanaHistoryRecord
import info.nightscout.androidaps.events.EventDanaRSyncStatus
import info.nightscout.androidaps.logging.LTag
+import info.nightscout.androidaps.utils.T
open class MsgHistoryAll(
injector: HasAndroidInjector
@@ -24,101 +26,102 @@ open class MsgHistoryAll(
val paramByte7 = intFromBuff(bytes, 6, 1).toByte()
val paramByte8 = intFromBuff(bytes, 7, 1).toByte()
val value = intFromBuff(bytes, 8, 2).toDouble()
- val danaRHistoryRecord = DanaRHistoryRecord()
- danaRHistoryRecord.recordCode = recordCode
- danaRHistoryRecord.setBytes(bytes)
+ val danaHistoryRecord = DanaHistoryRecord(
+ timestamp = date,
+ code = recordCode
+ )
var messageType = ""
when (recordCode) {
info.nightscout.androidaps.dana.comm.RecordTypes.RECORD_TYPE_BOLUS -> {
val datetime = dateTimeFromBuff(bytes, 1) // 5 bytes
- danaRHistoryRecord.recordDate = datetime
+ danaHistoryRecord.timestamp = datetime
when (0xF0 and paramByte8.toInt()) {
0xA0 -> {
- danaRHistoryRecord.bolusType = "DS"
+ danaHistoryRecord.bolusType = "DS"
messageType += "DS bolus"
}
0xC0 -> {
- danaRHistoryRecord.bolusType = "E"
+ danaHistoryRecord.bolusType = "E"
messageType += "E bolus"
}
0x80 -> {
- danaRHistoryRecord.bolusType = "S"
+ danaHistoryRecord.bolusType = "S"
messageType += "S bolus"
}
0x90 -> {
- danaRHistoryRecord.bolusType = "DE"
+ danaHistoryRecord.bolusType = "DE"
messageType += "DE bolus"
}
- else -> danaRHistoryRecord.bolusType = "None"
+ else -> danaHistoryRecord.bolusType = "None"
}
- danaRHistoryRecord.recordDuration = (paramByte8.toInt() and 0x0F) * 60 + paramByte7.toInt()
- danaRHistoryRecord.recordValue = value * 0.01
+ danaHistoryRecord.duration = T.mins((paramByte8.toInt() and 0x0F) * 60 + paramByte7.toLong()).msecs()
+ danaHistoryRecord.value = value * 0.01
}
info.nightscout.androidaps.dana.comm.RecordTypes.RECORD_TYPE_DAILY -> {
messageType += "dailyinsulin"
- danaRHistoryRecord.recordDate = date
- danaRHistoryRecord.recordDailyBasal = dailyBasal
- danaRHistoryRecord.recordDailyBolus = dailyBolus
+ danaHistoryRecord.timestamp = date
+ danaHistoryRecord.dailyBasal = dailyBasal
+ danaHistoryRecord.dailyBolus = dailyBolus
}
info.nightscout.androidaps.dana.comm.RecordTypes.RECORD_TYPE_PRIME -> {
messageType += "prime"
val datetimewihtsec = dateTimeSecFromBuff(bytes, 1) // 6 bytes
- danaRHistoryRecord.recordDate = datetimewihtsec
- danaRHistoryRecord.recordValue = value * 0.01
+ danaHistoryRecord.timestamp = datetimewihtsec
+ danaHistoryRecord.value = value * 0.01
}
info.nightscout.androidaps.dana.comm.RecordTypes.RECORD_TYPE_ERROR -> {
messageType += "error"
val datetimewihtsec = dateTimeSecFromBuff(bytes, 1) // 6 bytes
- danaRHistoryRecord.recordDate = datetimewihtsec
- danaRHistoryRecord.recordValue = value * 0.01
+ danaHistoryRecord.timestamp = datetimewihtsec
+ danaHistoryRecord.value = value * 0.01
}
info.nightscout.androidaps.dana.comm.RecordTypes.RECORD_TYPE_REFILL -> {
messageType += "refill"
val datetimewihtsec = dateTimeSecFromBuff(bytes, 1) // 6 bytes
- danaRHistoryRecord.recordDate = datetimewihtsec
- danaRHistoryRecord.recordValue = value * 0.01
+ danaHistoryRecord.timestamp = datetimewihtsec
+ danaHistoryRecord.value = value * 0.01
}
info.nightscout.androidaps.dana.comm.RecordTypes.RECORD_TYPE_BASALHOUR -> {
messageType += "basal hour"
val datetimewihtsec = dateTimeSecFromBuff(bytes, 1) // 6 bytes
- danaRHistoryRecord.recordDate = datetimewihtsec
- danaRHistoryRecord.recordValue = value * 0.01
+ danaHistoryRecord.timestamp = datetimewihtsec
+ danaHistoryRecord.value = value * 0.01
}
info.nightscout.androidaps.dana.comm.RecordTypes.RECORD_TYPE_TB -> {
messageType += "tb"
val datetimewihtsec = dateTimeSecFromBuff(bytes, 1) // 6 bytes
- danaRHistoryRecord.recordDate = datetimewihtsec
- danaRHistoryRecord.recordValue = value * 0.01
+ danaHistoryRecord.timestamp = datetimewihtsec
+ danaHistoryRecord.value = value * 0.01
}
info.nightscout.androidaps.dana.comm.RecordTypes.RECORD_TYPE_GLUCOSE -> {
messageType += "glucose"
val datetimewihtsec = dateTimeSecFromBuff(bytes, 1) // 6 bytes
- danaRHistoryRecord.recordDate = datetimewihtsec
- danaRHistoryRecord.recordValue = value
+ danaHistoryRecord.timestamp = datetimewihtsec
+ danaHistoryRecord.value = value
}
info.nightscout.androidaps.dana.comm.RecordTypes.RECORD_TYPE_CARBO -> {
messageType += "carbo"
val datetimewihtsec = dateTimeSecFromBuff(bytes, 1) // 6 bytes
- danaRHistoryRecord.recordDate = datetimewihtsec
- danaRHistoryRecord.recordValue = value
+ danaHistoryRecord.timestamp = datetimewihtsec
+ danaHistoryRecord.value = value
}
info.nightscout.androidaps.dana.comm.RecordTypes.RECORD_TYPE_ALARM -> {
messageType += "alarm"
val datetimewihtsec = dateTimeSecFromBuff(bytes, 1) // 6 bytes
- danaRHistoryRecord.recordDate = datetimewihtsec
+ danaHistoryRecord.timestamp = datetimewihtsec
var strAlarm = "None"
when (paramByte8.toInt()) {
67 -> strAlarm = "Check"
@@ -126,22 +129,22 @@ open class MsgHistoryAll(
66 -> strAlarm = "Low Battery"
83 -> strAlarm = "Shutdown"
}
- danaRHistoryRecord.recordAlarm = strAlarm
- danaRHistoryRecord.recordValue = value * 0.01
+ danaHistoryRecord.alarm = strAlarm
+ danaHistoryRecord.value = value * 0.01
}
- info.nightscout.androidaps.dana.comm.RecordTypes.RECORD_TYPE_SUSPEND -> {
+ RecordTypes.RECORD_TYPE_SUSPEND -> {
messageType += "suspend"
val datetimewihtsec = dateTimeSecFromBuff(bytes, 1) // 6 bytes
- danaRHistoryRecord.recordDate = datetimewihtsec
+ danaHistoryRecord.timestamp = datetimewihtsec
var strRecordValue = "Off"
if (paramByte8.toInt() == 79) strRecordValue = "On"
- danaRHistoryRecord.stringRecordValue = strRecordValue
+ danaHistoryRecord.stringValue = strRecordValue
}
17.toByte() -> failed = true
}
- databaseHelper.createOrUpdate(danaRHistoryRecord)
- rxBus.send(EventDanaRSyncStatus(dateUtil.dateAndTimeString(danaRHistoryRecord.recordDate) + " " + messageType))
+ danaHistoryRecordDao.createOrUpdate(danaHistoryRecord)
+ rxBus.send(EventDanaRSyncStatus(dateUtil.dateAndTimeString(danaHistoryRecord.timestamp) + " " + messageType))
}
}
\ No newline at end of file
diff --git a/danar/src/main/java/info/nightscout/androidaps/danar/services/AbstractDanaRExecutionService.java b/danar/src/main/java/info/nightscout/androidaps/danar/services/AbstractDanaRExecutionService.java
index acaee4cc53..4778cc0d01 100644
--- a/danar/src/main/java/info/nightscout/androidaps/danar/services/AbstractDanaRExecutionService.java
+++ b/danar/src/main/java/info/nightscout/androidaps/danar/services/AbstractDanaRExecutionService.java
@@ -99,7 +99,7 @@ public abstract class AbstractDanaRExecutionService extends DaggerService {
public abstract PumpEnactResult loadEvents();
- public abstract boolean bolus(double amount, int carbs, long carbtime, final EventOverviewBolusProgress.Treatment t);
+ public abstract boolean bolus(double amount, int carbs, long carbTimeStamp, final EventOverviewBolusProgress.Treatment t);
public abstract boolean highTempBasal(int percent, int durationInMinutes); // Rv2 only
diff --git a/danar/src/main/java/info/nightscout/androidaps/danar/services/DanaRExecutionService.java b/danar/src/main/java/info/nightscout/androidaps/danar/services/DanaRExecutionService.java
index 36f7269295..3bff7e49e9 100644
--- a/danar/src/main/java/info/nightscout/androidaps/danar/services/DanaRExecutionService.java
+++ b/danar/src/main/java/info/nightscout/androidaps/danar/services/DanaRExecutionService.java
@@ -200,7 +200,6 @@ public class DanaRExecutionService extends AbstractDanaRExecutionService {
rxBus.send(new EventDanaRNewStatus());
rxBus.send(new EventInitializationChanged());
- //NSUpload.uploadDeviceStatus();
if (danaPump.getDailyTotalUnits() > danaPump.getMaxDailyTotalUnits() * Constants.dailyLimitWarning) {
aapsLogger.debug(LTag.PUMP, "Approaching daily limit: " + danaPump.getDailyTotalUnits() + "/" + danaPump.getMaxDailyTotalUnits());
if (System.currentTimeMillis() > lastApproachingDailyLimit + 30 * 60 * 1000) {
@@ -263,7 +262,7 @@ public class DanaRExecutionService extends AbstractDanaRExecutionService {
return null;
}
- public boolean bolus(double amount, int carbs, long carbtime, final EventOverviewBolusProgress.Treatment t) {
+ public boolean bolus(double amount, int carbs, long carbTimeStamp, final EventOverviewBolusProgress.Treatment t) {
if (!isConnected()) return false;
if (BolusProgressDialog.stopPressed) return false;
@@ -279,7 +278,7 @@ public class DanaRExecutionService extends AbstractDanaRExecutionService {
danaPump.setBolusStopForced(false);
if (carbs > 0) {
- mSerialIOThread.sendMessage(new MsgSetCarbsEntry(injector, carbtime, carbs));
+ mSerialIOThread.sendMessage(new MsgSetCarbsEntry(injector, carbTimeStamp, carbs));
}
if (amount > 0) {
diff --git a/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/DanaRTestBase.kt b/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/DanaRTestBase.kt
index 6eb138470a..5b24a3b8b7 100644
--- a/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/DanaRTestBase.kt
+++ b/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/DanaRTestBase.kt
@@ -5,11 +5,16 @@ import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.TestBase
import info.nightscout.androidaps.TestPumpPlugin
import info.nightscout.androidaps.dana.DanaPump
+import info.nightscout.androidaps.dana.database.DanaHistoryRecordDao
import info.nightscout.androidaps.danaRKorean.DanaRKoreanPlugin
import info.nightscout.androidaps.danaRv2.DanaRv2Plugin
import info.nightscout.androidaps.danar.DanaRPlugin
import info.nightscout.androidaps.danar.comm.MessageBase
-import info.nightscout.androidaps.interfaces.*
+import info.nightscout.androidaps.interfaces.ActivePlugin
+import info.nightscout.androidaps.interfaces.CommandQueueProvider
+import info.nightscout.androidaps.interfaces.ConfigBuilder
+import info.nightscout.androidaps.interfaces.ProfileFunction
+import info.nightscout.androidaps.interfaces.PumpSync
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker
import info.nightscout.androidaps.plugins.pump.common.bolusInfo.DetailedBolusInfoStorage
@@ -31,7 +36,6 @@ open class DanaRTestBase : TestBase() {
@Mock lateinit var profileFunction: ProfileFunction
@Mock lateinit var activePlugin: ActivePlugin
@Mock lateinit var dateUtil: DateUtil
- @Mock lateinit var databaseHelper: DatabaseHelperInterface
@Mock lateinit var danaRPlugin: DanaRPlugin
@Mock lateinit var danaRKoreanPlugin: DanaRKoreanPlugin
@Mock lateinit var danaRv2Plugin: DanaRv2Plugin
@@ -41,6 +45,7 @@ open class DanaRTestBase : TestBase() {
@Mock lateinit var detailedBolusInfoStorage: DetailedBolusInfoStorage
@Mock lateinit var constraintChecker: ConstraintChecker
@Mock lateinit var pumpSync: PumpSync
+ @Mock lateinit var danaHistoryRecordDao: DanaHistoryRecordDao
private lateinit var testPumpPlugin: TestPumpPlugin
@@ -69,9 +74,9 @@ open class DanaRTestBase : TestBase() {
it.configBuilder = configBuilder
it.detailedBolusInfoStorage = detailedBolusInfoStorage
it.constraintChecker = constraintChecker
- it.databaseHelper = databaseHelper
it.commandQueue = commandQueue
it.pumpSync = pumpSync
+ it.danaHistoryRecordDao = danaHistoryRecordDao
}
}
}
diff --git a/danars/src/main/java/info/nightscout/androidaps/danars/DanaRSPlugin.kt b/danars/src/main/java/info/nightscout/androidaps/danars/DanaRSPlugin.kt
index 46d762db38..fdd97c7a4a 100644
--- a/danars/src/main/java/info/nightscout/androidaps/danars/DanaRSPlugin.kt
+++ b/danars/src/main/java/info/nightscout/androidaps/danars/DanaRSPlugin.kt
@@ -141,6 +141,7 @@ class DanaRSPlugin @Inject constructor(
commandQueue.readStatus("DeviceChanged", null)
}
+ @kotlin.ExperimentalStdlibApi
override fun connect(reason: String) {
aapsLogger.debug(LTag.PUMP, "RS connect from: $reason")
if (danaRSService != null && mDeviceAddress != "" && mDeviceName != "") {
@@ -282,13 +283,12 @@ class DanaRSPlugin @Inject constructor(
// I don't think it's necessary to copy DetailedBolusInfo right now for carbs records
val carbs = detailedBolusInfo.carbs
detailedBolusInfo.carbs = 0.0
- var carbTime = detailedBolusInfo.carbTime
- if (carbTime == 0) carbTime-- // better set 1 min back to prevents clash with insulin
- detailedBolusInfo.carbTime = 0
+ var carbTimeStamp = detailedBolusInfo.carbsTimestamp ?: detailedBolusInfo.timestamp
+ if (carbTimeStamp == detailedBolusInfo.timestamp) carbTimeStamp -= T.mins(1).msecs() // better set 1 min back to prevents clash with insulin
detailedBolusInfoStorage.add(detailedBolusInfo) // will be picked up on reading history
val t = EventOverviewBolusProgress.Treatment(0.0, 0, detailedBolusInfo.bolusType == DetailedBolusInfo.BolusType.SMB)
var connectionOK = false
- if (detailedBolusInfo.insulin > 0 || carbs > 0) connectionOK = danaRSService?.bolus(detailedBolusInfo.insulin, carbs.toInt(), dateUtil.now() + T.mins(carbTime.toLong()).msecs(), t)
+ if (detailedBolusInfo.insulin > 0 || carbs > 0) connectionOK = danaRSService?.bolus(detailedBolusInfo.insulin, carbs.toInt(), carbTimeStamp, t)
?: false
val result = PumpEnactResult(injector)
result.success = connectionOK && abs(detailedBolusInfo.insulin - t.insulin) < pumpDescription.bolusStep
diff --git a/danars/src/main/java/info/nightscout/androidaps/danars/activities/EnterPinActivity.kt b/danars/src/main/java/info/nightscout/androidaps/danars/activities/EnterPinActivity.kt
index 7161850604..33268cb1e2 100644
--- a/danars/src/main/java/info/nightscout/androidaps/danars/activities/EnterPinActivity.kt
+++ b/danars/src/main/java/info/nightscout/androidaps/danars/activities/EnterPinActivity.kt
@@ -33,6 +33,7 @@ class EnterPinActivity : NoSplashAppCompatActivity() {
private lateinit var binding: DanarsEnterPinActivityBinding
+ @kotlin.ExperimentalStdlibApi
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
binding = DanarsEnterPinActivityBinding.inflate(layoutInflater)
diff --git a/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_APS_History_Events.kt b/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_APS_History_Events.kt
index 5e6b49a66a..12d20835fa 100644
--- a/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_APS_History_Events.kt
+++ b/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_APS_History_Events.kt
@@ -86,7 +86,7 @@ open class DanaRS_Packet_APS_History_Events(
// but on pump is running
// at least on Model: 05 Protocol: 10 Code: 10
if (index > 0 && recordCode(message) == DanaPump.TEMPSTOP) {
- val previous = sorted[index-1]
+ val previous = sorted[index - 1]
if (recordCode(previous) == DanaPump.TEMPSTART && dateTime(message) == dateTime(previous)) {
aapsLogger.debug(LTag.PUMPCOMM, "SKIPPING EVENT TEMPSTOP (" + recordCode(message) + ") " + dateUtil.dateAndTimeString(dateTime(message)) + " (" + dateTime(message) + ")")
continue
@@ -102,13 +102,16 @@ open class DanaRS_Packet_APS_History_Events(
if (!danaPump.usingUTC) dateTimeSecFromBuff(data, 1) // 6 bytes
else intFromBuffMsbLsb(data, 3, 4) * 1000L
- fun recordCode(data: ByteArray): Int =
- intFromBuff(data, 0, 1).toInt()
+ private fun recordCode(data: ByteArray): Int =
+ if (!danaPump.usingUTC)
+ intFromBuff(data, 0, 1)
+ else
+ intFromBuff(data, 2, 1)
fun processMessage(data: ByteArray) {
- var recordCode = intFromBuff(data, 0, 1).toByte()
+ val recordCode = recordCode(data)
// Last record
- if (recordCode == 0xFF.toByte()) {
+ if (recordCode == 0xFF) {
return
}
val datetime: Long
@@ -121,12 +124,11 @@ open class DanaRS_Packet_APS_History_Events(
pumpId = datetime
} else {
datetime = intFromBuffMsbLsb(data, 3, 4) * 1000L
- recordCode = intFromBuff(data, 2, 1).toByte()
id = intFromBuffMsbLsb(data, 0, 2) // range only 1-2000
pumpId = datetime shl 16 + id
}
val status: String
- when (recordCode.toInt()) {
+ when (recordCode) {
DanaPump.TEMPSTART -> {
val temporaryBasalInfo = temporaryBasalStorage.findTemporaryBasal(datetime, param1.toDouble())
val newRecord = pumpSync.syncTemporaryBasalWithPumpId(
diff --git a/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_History_.kt b/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_History_.kt
index 0ab6b0ef49..63f0882acf 100644
--- a/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_History_.kt
+++ b/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_History_.kt
@@ -3,13 +3,14 @@ package info.nightscout.androidaps.danars.comm
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.dana.DanaPump
import info.nightscout.androidaps.dana.comm.RecordTypes
-import info.nightscout.androidaps.db.DanaRHistoryRecord
+import info.nightscout.androidaps.dana.database.DanaHistoryRecord
+import info.nightscout.androidaps.dana.database.DanaHistoryRecordDao
import info.nightscout.androidaps.events.EventDanaRSyncStatus
-import info.nightscout.androidaps.interfaces.DatabaseHelperInterface
import info.nightscout.androidaps.interfaces.PumpSync
import info.nightscout.androidaps.logging.LTag
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
import info.nightscout.androidaps.plugins.pump.common.defs.PumpType
+import info.nightscout.androidaps.utils.T
import org.joda.time.DateTime
import java.util.*
import javax.inject.Inject
@@ -20,7 +21,7 @@ abstract class DanaRS_Packet_History_(
) : DanaRS_Packet(injector) {
@Inject lateinit var rxBus: RxBusWrapper
- @Inject lateinit var databaseHelper: DatabaseHelperInterface
+ @Inject lateinit var danaHistoryRecordDao: DanaHistoryRecordDao
@Inject lateinit var pumpSync: PumpSync
@Inject lateinit var danaPump: DanaPump
@@ -33,7 +34,7 @@ abstract class DanaRS_Packet_History_(
var done = false
var totalCount = 0
- val danaRHistoryRecord = DanaRHistoryRecord()
+ val danaRHistoryRecord = DanaHistoryRecord(0)
init {
val cal = GregorianCalendar()
@@ -59,6 +60,7 @@ abstract class DanaRS_Packet_History_(
return request
}
+ @kotlin.ExperimentalStdlibApi
override fun handleMessage(data: ByteArray) {
val error: Int
totalCount = 0
@@ -91,15 +93,14 @@ abstract class DanaRS_Packet_History_(
val historyCode = byteArrayToInt(getBytes(data, DATA_START + 7, 1))
val paramByte8 = historyCode.toByte()
val value: Int = (data[DATA_START + 8].toInt() and 0xFF shl 8) + (data[DATA_START + 9].toInt() and 0xFF)
- danaRHistoryRecord.setBytes(data)
- // danaRHistoryRecord.recordCode is different from DanaR codes
+ // danaRHistoryRecord.code is different from DanaR codes
// set in switch for every type
var messageType = ""
when (recordCode) {
0x02 -> {
- danaRHistoryRecord.recordCode = RecordTypes.RECORD_TYPE_BOLUS
+ danaRHistoryRecord.code = RecordTypes.RECORD_TYPE_BOLUS
val datetime = DateTime(2000 + historyYear, historyMonth, historyDay, historyHour, historyMinute)
- danaRHistoryRecord.recordDate = datetime.millis
+ danaRHistoryRecord.timestamp = datetime.millis
when (0xF0 and paramByte8.toInt()) {
0xA0 -> {
danaRHistoryRecord.bolusType = "DS"
@@ -123,121 +124,121 @@ abstract class DanaRS_Packet_History_(
else -> danaRHistoryRecord.bolusType = "None"
}
- danaRHistoryRecord.recordDuration = (paramByte8.toInt() and 0x0F) * 60 + paramByte7.toInt()
- danaRHistoryRecord.recordValue = value * 0.01
+ danaRHistoryRecord.duration = T.mins((paramByte8.toInt() and 0x0F) * 60 + paramByte7.toLong()).msecs()
+ danaRHistoryRecord.value = value * 0.01
aapsLogger.debug(LTag.PUMPCOMM, "History packet: " + recordCode + " Date: " + dateUtil.dateAndTimeString(datetime.millis) + " Code: " + historyCode + " Value: " + value)
}
0x03 -> {
- danaRHistoryRecord.recordCode = RecordTypes.RECORD_TYPE_DAILY
+ danaRHistoryRecord.code = RecordTypes.RECORD_TYPE_DAILY
messageType += "dailyinsulin"
val date = DateTime(2000 + historyYear, historyMonth, historyDay, 0, 0)
- danaRHistoryRecord.recordDate = date.millis
- danaRHistoryRecord.recordDailyBasal = dailyBasal
- danaRHistoryRecord.recordDailyBolus = dailyBolus
+ danaRHistoryRecord.timestamp = date.millis
+ danaRHistoryRecord.dailyBasal = dailyBasal
+ danaRHistoryRecord.dailyBolus = dailyBolus
aapsLogger.debug(LTag.PUMPCOMM, "History packet: " + recordCode + " Date: " + dateUtil.dateAndTimeString(date.millis) + " Code: " + historyCode + " Value: " + value)
}
0x04 -> {
- danaRHistoryRecord.recordCode = RecordTypes.RECORD_TYPE_PRIME
+ danaRHistoryRecord.code = RecordTypes.RECORD_TYPE_PRIME
messageType += "prime"
val datetimewihtsec = DateTime(2000 + historyYear, historyMonth, historyDay, historyHour, historyMinute, historySecond)
- danaRHistoryRecord.recordDate = datetimewihtsec.millis
- danaRHistoryRecord.recordValue = value * 0.01
+ danaRHistoryRecord.timestamp = datetimewihtsec.millis
+ danaRHistoryRecord.value = value * 0.01
aapsLogger.debug(LTag.PUMPCOMM, "History packet: " + recordCode + " Date: " + dateUtil.dateAndTimeString(datetimewihtsec.millis) + " Code: " + historyCode + " Value: " + value)
}
0x05 -> {
- danaRHistoryRecord.recordCode = RecordTypes.RECORD_TYPE_REFILL
+ danaRHistoryRecord.code = RecordTypes.RECORD_TYPE_REFILL
messageType += "refill"
val datetimewihtsec = DateTime(2000 + historyYear, historyMonth, historyDay, historyHour, historyMinute, historySecond)
- danaRHistoryRecord.recordDate = datetimewihtsec.millis
- danaRHistoryRecord.recordValue = value * 0.01
+ danaRHistoryRecord.timestamp = datetimewihtsec.millis
+ danaRHistoryRecord.value = value * 0.01
aapsLogger.debug(LTag.PUMPCOMM, "History packet: " + recordCode + " Date: " + dateUtil.dateAndTimeString(datetimewihtsec.millis) + " Code: " + historyCode + " Value: " + value)
}
0x0b -> {
- danaRHistoryRecord.recordCode = RecordTypes.RECORD_TYPE_BASALHOUR
+ danaRHistoryRecord.code = RecordTypes.RECORD_TYPE_BASALHOUR
messageType += "basal hour"
val datetimewihtsec = DateTime(2000 + historyYear, historyMonth, historyDay, historyHour, historyMinute, historySecond)
- danaRHistoryRecord.recordDate = datetimewihtsec.millis
- danaRHistoryRecord.recordValue = value * 0.01
+ danaRHistoryRecord.timestamp = datetimewihtsec.millis
+ danaRHistoryRecord.value = value * 0.01
aapsLogger.debug(LTag.PUMPCOMM, "History packet: " + recordCode + " Date: " + dateUtil.dateAndTimeString(datetimewihtsec.millis) + " Code: " + historyCode + " Value: " + value)
}
0x99 -> {
- danaRHistoryRecord.recordCode = RecordTypes.RECORD_TYPE_TEMP_BASAL
+ danaRHistoryRecord.code = RecordTypes.RECORD_TYPE_TEMP_BASAL
messageType += "tb"
val datetimewihtsec = DateTime(2000 + historyYear, historyMonth, historyDay, historyHour, historyMinute, historySecond)
- danaRHistoryRecord.recordDate = datetimewihtsec.millis
- danaRHistoryRecord.recordValue = value * 0.01
+ danaRHistoryRecord.timestamp = datetimewihtsec.millis
+ danaRHistoryRecord.value = value * 0.01
aapsLogger.debug(LTag.PUMPCOMM, "History packet: " + recordCode + " Date: " + dateUtil.dateAndTimeString(datetimewihtsec.millis) + " Code: " + historyCode + " Value: " + value)
}
0x06 -> {
- danaRHistoryRecord.recordCode = RecordTypes.RECORD_TYPE_GLUCOSE
+ danaRHistoryRecord.code = RecordTypes.RECORD_TYPE_GLUCOSE
messageType += "glucose"
val datetimewihtsec = DateTime(2000 + historyYear, historyMonth, historyDay, historyHour, historyMinute, historySecond)
- danaRHistoryRecord.recordDate = datetimewihtsec.millis
- danaRHistoryRecord.recordValue = value.toDouble()
+ danaRHistoryRecord.timestamp = datetimewihtsec.millis
+ danaRHistoryRecord.value = value.toDouble()
aapsLogger.debug(LTag.PUMPCOMM, "History packet: " + recordCode + " Date: " + dateUtil.dateAndTimeString(datetimewihtsec.millis) + " Code: " + historyCode + " Value: " + value)
}
0x07 -> {
- danaRHistoryRecord.recordCode = RecordTypes.RECORD_TYPE_CARBO
+ danaRHistoryRecord.code = RecordTypes.RECORD_TYPE_CARBO
messageType += "carbo"
val datetimewihtsec = DateTime(2000 + historyYear, historyMonth, historyDay, historyHour, historyMinute, historySecond)
- danaRHistoryRecord.recordDate = datetimewihtsec.millis
- danaRHistoryRecord.recordValue = value.toDouble()
+ danaRHistoryRecord.timestamp = datetimewihtsec.millis
+ danaRHistoryRecord.value = value.toDouble()
aapsLogger.debug(LTag.PUMPCOMM, "History packet: " + recordCode + " Date: " + dateUtil.dateAndTimeString(datetimewihtsec.millis) + " Code: " + historyCode + " Value: " + value)
}
0x0a -> {
- danaRHistoryRecord.recordCode = RecordTypes.RECORD_TYPE_ALARM
+ danaRHistoryRecord.code = RecordTypes.RECORD_TYPE_ALARM
messageType += "alarm"
val datetimewihtsec = DateTime(2000 + historyYear, historyMonth, historyDay, historyHour, historyMinute, historySecond)
- danaRHistoryRecord.recordDate = datetimewihtsec.millis
+ danaRHistoryRecord.timestamp = datetimewihtsec.millis
var strAlarm = "None"
when (paramByte8) {
- 'P'.toByte() -> strAlarm = "Basal Compare"
- 'R'.toByte() -> strAlarm = "Empty Reservoir"
- 'C'.toByte() -> strAlarm = "Check"
- 'O'.toByte() -> strAlarm = "Occlusion"
- 'M'.toByte() -> strAlarm = "Basal max"
- 'D'.toByte() -> strAlarm = "Daily max"
- 'B'.toByte() -> strAlarm = "Low Battery"
- 'S'.toByte() -> strAlarm = "Shutdown"
+ 'P'.code.toByte() -> strAlarm = "Basal Compare"
+ 'R'.code.toByte() -> strAlarm = "Empty Reservoir"
+ 'C'.code.toByte() -> strAlarm = "Check"
+ 'O'.code.toByte() -> strAlarm = "Occlusion"
+ 'M'.code.toByte() -> strAlarm = "Basal max"
+ 'D'.code.toByte() -> strAlarm = "Daily max"
+ 'B'.code.toByte() -> strAlarm = "Low Battery"
+ 'S'.code.toByte() -> strAlarm = "Shutdown"
}
- danaRHistoryRecord.recordAlarm = strAlarm
- danaRHistoryRecord.recordValue = value * 0.01
+ danaRHistoryRecord.alarm = strAlarm
+ danaRHistoryRecord.value = value * 0.01
aapsLogger.debug(LTag.PUMPCOMM, "History packet: " + recordCode + " Date: " + dateUtil.dateAndTimeString(datetimewihtsec.millis) + " Code: " + historyCode + " Value: " + value)
}
0x09 -> {
- danaRHistoryRecord.recordCode = RecordTypes.RECORD_TYPE_SUSPEND
+ danaRHistoryRecord.code = RecordTypes.RECORD_TYPE_SUSPEND
messageType += "suspend"
val datetimewihtsec = DateTime(2000 + historyYear, historyMonth, historyDay, historyHour, historyMinute, historySecond)
- danaRHistoryRecord.recordDate = datetimewihtsec.millis
+ danaRHistoryRecord.timestamp = datetimewihtsec.millis
var strRecordValue = "Off"
if (paramByte8.toInt() == 79) strRecordValue = "On"
- danaRHistoryRecord.stringRecordValue = strRecordValue
+ danaRHistoryRecord.stringValue = strRecordValue
aapsLogger.debug(LTag.PUMPCOMM, "History packet: " + recordCode + " Date: " + dateUtil.dateAndTimeString(datetimewihtsec.millis) + " Code: " + historyCode + " Value: " + value)
}
}
- databaseHelper.createOrUpdate(danaRHistoryRecord)
+ danaHistoryRecordDao.createOrUpdate(danaRHistoryRecord)
//If it is a TDD, store it for stats also.
- if (danaRHistoryRecord.recordCode == RecordTypes.RECORD_TYPE_DAILY) {
+ if (danaRHistoryRecord.code == RecordTypes.RECORD_TYPE_DAILY) {
pumpSync.createOrUpdateTotalDailyDose(
- timestamp = danaRHistoryRecord.recordDate,
- bolusAmount = danaRHistoryRecord.recordDailyBolus,
- basalAmount = danaRHistoryRecord.recordDailyBasal,
+ timestamp = danaRHistoryRecord.timestamp,
+ bolusAmount = danaRHistoryRecord.dailyBolus,
+ basalAmount = danaRHistoryRecord.dailyBasal,
totalAmount = 0.0,
pumpId = null,
pumpType = PumpType.DANA_RS,
danaPump.serialNumber
)
}
- rxBus.send(EventDanaRSyncStatus(dateUtil.dateAndTimeString(danaRHistoryRecord.recordDate) + " " + messageType))
+ rxBus.send(EventDanaRSyncStatus(dateUtil.dateAndTimeString(danaRHistoryRecord.timestamp) + " " + messageType))
}
}
diff --git a/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Option_Get_User_Option.kt b/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Option_Get_User_Option.kt
index d96da176ec..7c2a9fa16d 100644
--- a/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Option_Get_User_Option.kt
+++ b/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Option_Get_User_Option.kt
@@ -18,54 +18,24 @@ class DanaRS_Packet_Option_Get_User_Option(
}
override fun handleMessage(data: ByteArray) {
- var dataIndex = DATA_START
- var dataSize = 1
- danaPump.timeDisplayType24 = byteArrayToInt(getBytes(data, dataIndex, dataSize)) == 0
- dataIndex += dataSize
- dataSize = 1
- danaPump.buttonScrollOnOff = byteArrayToInt(getBytes(data, dataIndex, dataSize)) == 1
- dataIndex += dataSize
- dataSize = 1
- danaPump.beepAndAlarm = byteArrayToInt(getBytes(data, dataIndex, dataSize))
- dataIndex += dataSize
- dataSize = 1
- danaPump.lcdOnTimeSec = byteArrayToInt(getBytes(data, dataIndex, dataSize))
- dataIndex += dataSize
- dataSize = 1
- danaPump.backlightOnTimeSec = byteArrayToInt(getBytes(data, dataIndex, dataSize))
- dataIndex += dataSize
- dataSize = 1
- danaPump.selectedLanguage = byteArrayToInt(getBytes(data, dataIndex, dataSize))
- dataIndex += dataSize
- dataSize = 1
- danaPump.units = byteArrayToInt(getBytes(data, dataIndex, dataSize))
- dataIndex += dataSize
- dataSize = 1
- danaPump.shutdownHour = byteArrayToInt(getBytes(data, dataIndex, dataSize))
- dataIndex += dataSize
- dataSize = 1
- danaPump.lowReservoirRate = byteArrayToInt(getBytes(data, dataIndex, dataSize))
- dataIndex += dataSize
- dataSize = 2
- danaPump.cannulaVolume = byteArrayToInt(getBytes(data, dataIndex, dataSize))
- dataIndex += dataSize
- dataSize = 2
- danaPump.refillAmount = byteArrayToInt(getBytes(data, dataIndex, dataSize))
- dataIndex += dataSize
- dataSize = 1
- val selectableLanguage1 = byteArrayToInt(getBytes(data, dataIndex, dataSize))
- dataIndex += dataSize
- dataSize = 1
- val selectableLanguage2 = byteArrayToInt(getBytes(data, dataIndex, dataSize))
- dataIndex += dataSize
- dataSize = 1
- val selectableLanguage3 = byteArrayToInt(getBytes(data, dataIndex, dataSize))
- dataIndex += dataSize
- dataSize = 1
- val selectableLanguage4 = byteArrayToInt(getBytes(data, dataIndex, dataSize))
- dataIndex += dataSize
- dataSize = 1
- val selectableLanguage5 = byteArrayToInt(getBytes(data, dataIndex, dataSize))
+ danaPump.timeDisplayType24 = intFromBuff(data, 0, 1) == 0
+ danaPump.buttonScrollOnOff = intFromBuff(data, 1, 1) == 1
+ danaPump.beepAndAlarm = intFromBuff(data, 2, 1)
+ danaPump.lcdOnTimeSec = intFromBuff(data, 3, 1)
+ danaPump.backlightOnTimeSec = intFromBuff(data, 4, 1)
+ danaPump.selectedLanguage = intFromBuff(data, 5, 1)
+ danaPump.units = intFromBuff(data, 6, 1)
+ danaPump.shutdownHour = intFromBuff(data, 7, 1)
+ danaPump.lowReservoirRate = intFromBuff(data, 8, 1)
+ danaPump.cannulaVolume = intFromBuff(data, 9, 2)
+ danaPump.refillAmount = intFromBuff(data, 11, 2)
+ val selectableLanguage1 = intFromBuff(data, 13, 1)
+ val selectableLanguage2 = intFromBuff(data, 14, 1)
+ val selectableLanguage3 = intFromBuff(data, 15, 1)
+ val selectableLanguage4 = intFromBuff(data, 16, 1)
+ val selectableLanguage5 = intFromBuff(data, 17, 1)
+ if (data.size >= 22) // hw 7+
+ danaPump.target = intFromBuff(data, 18, 2)
// Pump's screen on time can't be less than 5
failed = danaPump.lcdOnTimeSec < 5
aapsLogger.debug(LTag.PUMPCOMM, "timeDisplayType24: " + danaPump.timeDisplayType24)
@@ -77,12 +47,14 @@ class DanaRS_Packet_Option_Get_User_Option(
aapsLogger.debug(LTag.PUMPCOMM, "Pump units: " + if (danaPump.units == DanaPump.UNITS_MGDL) "MGDL" else "MMOL")
aapsLogger.debug(LTag.PUMPCOMM, "shutdownHour: " + danaPump.shutdownHour)
aapsLogger.debug(LTag.PUMPCOMM, "lowReservoirRate: " + danaPump.lowReservoirRate)
+ aapsLogger.debug(LTag.PUMPCOMM, "cannulaVolume: " + danaPump.cannulaVolume)
aapsLogger.debug(LTag.PUMPCOMM, "refillAmount: " + danaPump.refillAmount)
aapsLogger.debug(LTag.PUMPCOMM, "selectableLanguage1: $selectableLanguage1")
aapsLogger.debug(LTag.PUMPCOMM, "selectableLanguage2: $selectableLanguage2")
aapsLogger.debug(LTag.PUMPCOMM, "selectableLanguage3: $selectableLanguage3")
aapsLogger.debug(LTag.PUMPCOMM, "selectableLanguage4: $selectableLanguage4")
aapsLogger.debug(LTag.PUMPCOMM, "selectableLanguage5: $selectableLanguage5")
+ aapsLogger.debug(LTag.PUMPCOMM, "target: ${if (danaPump.units == DanaPump.UNITS_MGDL) danaPump.target else danaPump.target / 100}")
}
override fun getFriendlyName(): String {
diff --git a/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Option_Set_User_Option.kt b/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Option_Set_User_Option.kt
index 78db5a28c2..ae2e0c03ef 100644
--- a/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Option_Set_User_Option.kt
+++ b/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Option_Set_User_Option.kt
@@ -26,8 +26,12 @@ class DanaRS_Packet_Option_Set_User_Option(
+ "\nlcdOnTimeSec:" + danaPump.lcdOnTimeSec
+ "\nbacklight:" + danaPump.backlightOnTimeSec
+ "\ndanaRPumpUnits:" + danaPump.units
- + "\nlowReservoir:" + danaPump.lowReservoirRate)
- val request = ByteArray(13)
+ + "\nlowReservoir:" + danaPump.lowReservoirRate
+ + "\ncannulaVolume:" + danaPump.cannulaVolume
+ + "\nrefillAmount:" + danaPump.refillAmount
+ + "\ntarget:" + danaPump.target)
+ val size = if (danaPump.hwModel >= 7) 15 else 13
+ val request = ByteArray(size)
request[0] = if (danaPump.timeDisplayType24) 0.toByte() else 1.toByte()
request[1] = if (danaPump.buttonScrollOnOff) 1.toByte() else 0.toByte()
request[2] = (danaPump.beepAndAlarm and 0xff).toByte()
@@ -41,6 +45,10 @@ class DanaRS_Packet_Option_Set_User_Option(
request[10] = (danaPump.cannulaVolume ushr 8 and 0xff).toByte()
request[11] = (danaPump.refillAmount and 0xff).toByte()
request[12] = (danaPump.refillAmount ushr 8 and 0xff).toByte()
+ if (danaPump.hwModel >= 7) {
+ request[13] = (danaPump.target and 0xff).toByte()
+ request[14] = (danaPump.target ushr 8 and 0xff).toByte()
+ }
return request
}
diff --git a/danars/src/main/java/info/nightscout/androidaps/danars/encryption/BleEncryption.java b/danars/src/main/java/info/nightscout/androidaps/danars/encryption/BleEncryption.java
index 83e8e3ed3f..a3fb39a647 100644
--- a/danars/src/main/java/info/nightscout/androidaps/danars/encryption/BleEncryption.java
+++ b/danars/src/main/java/info/nightscout/androidaps/danars/encryption/BleEncryption.java
@@ -126,7 +126,9 @@ public class BleEncryption {
private static native void setPairingKeysJni(byte[] pairingKey, byte[] randomPairingKey, byte randomSyncKey);
- private static native void setEnhancedEncryptionJni(boolean isSecurityVersion);
+ private static native void setBle5KeyJni(byte[] ble5Key);
+
+ private static native void setEnhancedEncryptionJni(int securityVersion);
private static native byte[] encryptSecondLevelPacketJni(Object context, byte[] bytes);
@@ -144,8 +146,12 @@ public class BleEncryption {
setPairingKeysJni(pairingKey, randomPairingKey, randomSyncKey);
}
- public void setEnhancedEncryption(boolean isSecureVersion) {
- setEnhancedEncryptionJni(isSecureVersion);
+ public void setBle5Key(byte[] ble5Key) {
+ setBle5KeyJni(ble5Key);
+ }
+
+ public void setEnhancedEncryption(EncryptionType securityVersion) {
+ setEnhancedEncryptionJni(securityVersion.ordinal());
}
public byte[] encryptSecondLevelPacket(byte[] bytes) {
diff --git a/danars/src/main/java/info/nightscout/androidaps/danars/encryption/EncryptionType.kt b/danars/src/main/java/info/nightscout/androidaps/danars/encryption/EncryptionType.kt
new file mode 100644
index 0000000000..a0e5a77882
--- /dev/null
+++ b/danars/src/main/java/info/nightscout/androidaps/danars/encryption/EncryptionType.kt
@@ -0,0 +1,7 @@
+package info.nightscout.androidaps.danars.encryption
+
+enum class EncryptionType(val type: Int) {
+ ENCRYPTION_DEFAULT(0),
+ ENCRYPTION_RSv3(1),
+ ENCRYPTION_BLE5(2)
+}
\ No newline at end of file
diff --git a/danars/src/main/java/info/nightscout/androidaps/danars/services/BLEComm.kt b/danars/src/main/java/info/nightscout/androidaps/danars/services/BLEComm.kt
index abd5cf6eb2..61c506d835 100644
--- a/danars/src/main/java/info/nightscout/androidaps/danars/services/BLEComm.kt
+++ b/danars/src/main/java/info/nightscout/androidaps/danars/services/BLEComm.kt
@@ -15,6 +15,7 @@ import info.nightscout.androidaps.danars.comm.DanaRSMessageHashTable
import info.nightscout.androidaps.danars.comm.DanaRS_Packet
import info.nightscout.androidaps.danars.comm.DanaRS_Packet_Etc_Keep_Connection
import info.nightscout.androidaps.danars.encryption.BleEncryption
+import info.nightscout.androidaps.danars.encryption.EncryptionType
import info.nightscout.androidaps.danars.events.EventDanaRSPairingSuccess
import info.nightscout.androidaps.events.EventPumpStatusChanged
import info.nightscout.androidaps.interfaces.PumpSync
@@ -57,6 +58,7 @@ class BLEComm @Inject internal constructor(
private const val WRITE_DELAY_MILLIS: Long = 50
private const val UART_READ_UUID = "0000fff1-0000-1000-8000-00805f9b34fb"
private const val UART_WRITE_UUID = "0000fff2-0000-1000-8000-00805f9b34fb"
+ private const val UART_BLE5_UUID = "00002902-0000-1000-8000-00805f9b34fb"
private const val PACKET_START_BYTE = 0xA5.toByte()
private const val PACKET_END_BYTE = 0x5A.toByte()
@@ -70,7 +72,7 @@ class BLEComm @Inject internal constructor(
private var connectDeviceName: String? = null
private var bluetoothGatt: BluetoothGatt? = null
- private var v3Encryption: Boolean = false
+ private var encryption: EncryptionType = EncryptionType.ENCRYPTION_DEFAULT
set(newValue) {
bleEncryption.setEnhancedEncryption(newValue)
field = newValue
@@ -86,6 +88,7 @@ class BLEComm @Inject internal constructor(
private var uartWrite: BluetoothGattCharacteristic? = null
@Synchronized
+ @kotlin.ExperimentalStdlibApi
fun connect(from: String, address: String?): Boolean {
aapsLogger.debug(LTag.PUMPBTCOMM, "Initializing BLEComm.")
if (bluetoothManager == null) {
@@ -117,7 +120,7 @@ class BLEComm @Inject internal constructor(
return false
}
isConnected = false
- v3Encryption = false
+ encryption = EncryptionType.ENCRYPTION_DEFAULT
encryptedDataRead = false
encryptedCommandSent = false
isConnecting = true
@@ -137,7 +140,7 @@ class BLEComm @Inject internal constructor(
fun disconnect(from: String) {
aapsLogger.debug(LTag.PUMPBTCOMM, "disconnect from: $from")
- if (!encryptedDataRead && encryptedCommandSent && v3Encryption) {
+ if (!encryptedDataRead && encryptedCommandSent && encryption == EncryptionType.ENCRYPTION_RSv3) {
// there was no response from pump after started encryption
// assume pairing keys are invalid
val lastClearRequest = sp.getLong(R.string.key_rs_last_clear_key_request, 0)
@@ -176,6 +179,7 @@ class BLEComm @Inject internal constructor(
bluetoothGatt = null
}
+ @kotlin.ExperimentalStdlibApi
private val mGattCallback: BluetoothGattCallback = object : BluetoothGattCallback() {
override fun onConnectionStateChange(gatt: BluetoothGatt, status: Int, newState: Int) {
onConnectionStateChangeSynchronized(gatt, newState) // call it synchronized
@@ -186,8 +190,6 @@ class BLEComm @Inject internal constructor(
if (status == BluetoothGatt.GATT_SUCCESS) {
findCharacteristic()
}
- sendConnect()
- // 1st message sent to pump after connect
}
override fun onCharacteristicRead(gatt: BluetoothGatt, characteristic: BluetoothGattCharacteristic, status: Int) {
@@ -205,7 +207,7 @@ class BLEComm @Inject internal constructor(
override fun onCharacteristicWrite(gatt: BluetoothGatt, characteristic: BluetoothGattCharacteristic, status: Int) {
// for v3 after initial handshake it's encrypted - useless
// aapsLogger.debug(LTag.PUMPBTCOMM, "onCharacteristicWrite: " + DanaRS_Packet.toHexString(characteristic.value))
- Thread(Runnable {
+ Thread {
synchronized(mSendQueue) {
// after message sent, check if there is the rest of the message waiting and send it
if (mSendQueue.size > 0) {
@@ -214,7 +216,14 @@ class BLEComm @Inject internal constructor(
writeCharacteristicNoResponse(uartWriteBTGattChar, bytes)
}
}
- }).start()
+ }.start()
+ }
+
+ override fun onDescriptorWrite(gatt: BluetoothGatt?, descriptor: BluetoothGattDescriptor?, status: Int) {
+ super.onDescriptorWrite(gatt, descriptor, status)
+ //aapsLogger.debug(LTag.PUMPBTCOMM, "onDescriptorWrite " + status)
+ sendConnect()
+ // 1st message sent to pump after connect
}
}
@@ -230,6 +239,11 @@ class BLEComm @Inject internal constructor(
return
}
bluetoothGatt?.setCharacteristicNotification(characteristic, enabled)
+ // Dana-i BLE5 specific
+ characteristic?.getDescriptor(UUID.fromString(UART_BLE5_UUID))?.let {
+ it.value = BluetoothGattDescriptor.ENABLE_NOTIFICATION_VALUE
+ bluetoothGatt?.writeDescriptor(it)
+ }
}
@Synchronized
@@ -300,7 +314,7 @@ class BLEComm @Inject internal constructor(
close()
isConnected = false
isConnecting = false
- v3Encryption = false
+ encryption = EncryptionType.ENCRYPTION_DEFAULT
encryptedDataRead = false
encryptedCommandSent = false
rxBus.send(EventPumpStatusChanged(EventPumpStatusChanged.Status.DISCONNECTED))
@@ -309,13 +323,16 @@ class BLEComm @Inject internal constructor(
}
private val readBuffer = ByteArray(1024)
- private var bufferLength = 0
+ @Volatile private var bufferLength = 0
private fun addToReadBuffer(buffer: ByteArray) {
//log.debug("addToReadBuffer " + DanaRS_Packet.toHexString(buffer));
if (buffer.isEmpty()) {
return
}
+ if (bufferLength == 1024) {
+ aapsLogger.debug(LTag.PUMPBTCOMM, "1024 XXXXXXXXXXXXXX")
+ }
synchronized(readBuffer) {
// Append incoming data to input buffer
System.arraycopy(buffer, 0, readBuffer, bufferLength, buffer.size)
@@ -323,27 +340,29 @@ class BLEComm @Inject internal constructor(
}
}
+ @kotlin.ExperimentalStdlibApi
private fun readDataParsing(receivedData: ByteArray) {
- //aapsLogger.debug(LTag.PUMPBTCOMM, "readDataParsing")
+ //aapsLogger.debug(LTag.PUMPBTCOMM, "<<<<< readDataParsing " + DanaRS_Packet.toHexString(receivedData))
var startSignatureFound = false
var packetIsValid = false
var isProcessing: Boolean
isProcessing = true
- var inputBuffer: ByteArray? = null
+ var inputBuffer: ByteArray?
// decrypt 2nd level after successful connection
- val incomingBuffer = if (v3Encryption && isConnected)
- bleEncryption.decryptSecondLevelPacket(receivedData).also {
- encryptedDataRead = true
- sp.putLong(R.string.key_rs_last_clear_key_request, 0L)
- }
- else receivedData
+ val incomingBuffer =
+ if (isConnected && (encryption == EncryptionType.ENCRYPTION_RSv3 || encryption == EncryptionType.ENCRYPTION_BLE5))
+ bleEncryption.decryptSecondLevelPacket(receivedData).also {
+ encryptedDataRead = true
+ sp.putLong(R.string.key_rs_last_clear_key_request, 0L)
+ }
+ else receivedData
addToReadBuffer(incomingBuffer)
+ //aapsLogger.debug(LTag.PUMPBTCOMM, "incomingBuffer " + DanaRS_Packet.toHexString(incomingBuffer))
while (isProcessing) {
var length = 0
synchronized(readBuffer) {
-
// Find packet start [A5 A5]
if (bufferLength >= 6) {
for (idxStartByte in 0 until bufferLength - 2) {
@@ -353,6 +372,7 @@ class BLEComm @Inject internal constructor(
aapsLogger.debug(LTag.PUMPBTCOMM, "Shifting the input buffer by $idxStartByte bytes")
System.arraycopy(readBuffer, idxStartByte, readBuffer, 0, bufferLength - idxStartByte)
bufferLength -= idxStartByte
+ if (bufferLength < 0) bufferLength = 0
}
startSignatureFound = true
break
@@ -369,24 +389,32 @@ class BLEComm @Inject internal constructor(
// Verify packed end [5A 5A]
if (readBuffer[length + 5] == PACKET_END_BYTE && readBuffer[length + 6] == PACKET_END_BYTE) {
packetIsValid = true
+ } else if (readBuffer[length + 5] == readBuffer[length + 6]) {
+ // BLE5
+ packetIsValid = true
+ readBuffer[length + 5] = PACKET_END_BYTE
+ readBuffer[length + 6] = PACKET_END_BYTE
+ } else {
+ aapsLogger.error(LTag.PUMPBTCOMM, "Error in input data. Resetting buffer.")
+ bufferLength = 0
}
}
- if (packetIsValid) {
- inputBuffer = ByteArray(length + 7)
- // copy packet to input buffer
- System.arraycopy(readBuffer, 0, inputBuffer, 0, length + 7)
- // Cut off the message from readBuffer
- try {
- System.arraycopy(readBuffer, length + 7, readBuffer, 0, bufferLength - (length + 7))
- } catch (e: Exception) {
- aapsLogger.error("length: " + length + "bufferLength: " + bufferLength)
- throw e
- }
- bufferLength -= length + 7
- // now we have encrypted packet in inputBuffer
- }
}
if (packetIsValid) {
+ inputBuffer = ByteArray(length + 7)
+ // copy packet to input buffer
+ System.arraycopy(readBuffer, 0, inputBuffer, 0, length + 7)
+ // Cut off the message from readBuffer
+ try {
+ System.arraycopy(readBuffer, length + 7, readBuffer, 0, bufferLength - (length + 7))
+ } catch (e: Exception) {
+ aapsLogger.error("length: " + length + "bufferLength: " + bufferLength)
+ throw e
+ }
+ bufferLength -= length + 7
+ // now we have encrypted packet in inputBuffer
+
+ //aapsLogger.debug(LTag.PUMPBTCOMM, "<<<<< PROCESSING: " + DanaRS_Packet.toHexString(inputBuffer))
// decrypt the packet
bleEncryption.getDecryptedPacket(inputBuffer)?.let { decryptedBuffer ->
if (decryptedBuffer[0] == BleEncryption.DANAR_PACKET__TYPE_ENCRYPTION_RESPONSE.toByte()) {
@@ -449,13 +477,14 @@ class BLEComm @Inject internal constructor(
writeCharacteristicNoResponse(uartWriteBTGattChar, bytes)
}
+ @kotlin.ExperimentalStdlibApi
// 1st packet response
private fun processConnectResponse(decryptedBuffer: ByteArray) {
// response OK v1
- if (decryptedBuffer.size == 4 && decryptedBuffer[2] == 'O'.toByte() && decryptedBuffer[3] == 'K'.toByte()) {
+ if (decryptedBuffer.size == 4 && decryptedBuffer[2] == 'O'.code.toByte() && decryptedBuffer[3] == 'K'.code.toByte()) {
aapsLogger.debug(LTag.PUMPBTCOMM, "<<<<< " + "ENCRYPTION__PUMP_CHECK (OK)" + " " + DanaRS_Packet.toHexString(decryptedBuffer))
- v3Encryption = false
- danaPump.v3RSPump = false
+ encryption = EncryptionType.ENCRYPTION_DEFAULT
+ danaPump.ignoreUserPassword = false
// Grab pairing key from preferences if exists
val pairingKey = sp.getString(resourceHelper.gs(R.string.key_danars_pairingkey) + danaRSPlugin.mDeviceName, "")
aapsLogger.debug(LTag.PUMPBTCOMM, "Using stored pairing key: $pairingKey")
@@ -466,10 +495,10 @@ class BLEComm @Inject internal constructor(
sendPairingRequest()
}
// response OK v3
- } else if (decryptedBuffer.size == 9 && decryptedBuffer[2] == 'O'.toByte() && decryptedBuffer[3] == 'K'.toByte()) {
+ } else if (decryptedBuffer.size == 9 && decryptedBuffer[2] == 'O'.code.toByte() && decryptedBuffer[3] == 'K'.code.toByte()) {
// v3 2nd layer encryption
- v3Encryption = true
- danaPump.v3RSPump = true
+ encryption = EncryptionType.ENCRYPTION_RSv3
+ danaPump.ignoreUserPassword = true
danaPump.hwModel = decryptedBuffer[5].toInt()
danaPump.protocol = decryptedBuffer[7].toInt()
// grab randomSyncKey
@@ -484,8 +513,23 @@ class BLEComm @Inject internal constructor(
// Dana RS Easy
sendEasyMenuCheck()
}
+ // response OK BLE5
+ } else if (decryptedBuffer.size == 14 && decryptedBuffer[2] == 'O'.toByte() && decryptedBuffer[3] == 'K'.toByte()) {
+ // v3 2nd layer encryption
+ encryption = EncryptionType.ENCRYPTION_BLE5
+ danaPump.ignoreUserPassword = true
+ danaPump.hwModel = decryptedBuffer[5].toInt()
+ danaPump.protocol = decryptedBuffer[7].toInt()
+ val pairingKey = DanaRS_Packet.asciiStringFromBuff(decryptedBuffer, 8, 6) // used while bonding
+
+ if (danaPump.hwModel == 0x09) {
+ bleEncryption.setBle5Key(pairingKey.encodeToByteArray())
+ aapsLogger.debug(LTag.PUMPBTCOMM, "<<<<< " + "ENCRYPTION__PUMP_CHECK BLE5 (OK)" + " " + DanaRS_Packet.toHexString(decryptedBuffer))
+ // Dana-i BLE5 Pump
+ sendBLE5PairingInformation()
+ }
// response PUMP : error status
- } else if (decryptedBuffer.size == 6 && decryptedBuffer[2] == 'P'.toByte() && decryptedBuffer[3] == 'U'.toByte() && decryptedBuffer[4] == 'M'.toByte() && decryptedBuffer[5] == 'P'.toByte()) {
+ } else if (decryptedBuffer.size == 6 && decryptedBuffer[2] == 'P'.code.toByte() && decryptedBuffer[3] == 'U'.code.toByte() && decryptedBuffer[4] == 'M'.code.toByte() && decryptedBuffer[5] == 'P'.code.toByte()) {
aapsLogger.debug(LTag.PUMPBTCOMM, "<<<<< " + "ENCRYPTION__PUMP_CHECK (PUMP)" + " " + DanaRS_Packet.toHexString(decryptedBuffer))
mSendQueue.clear()
rxBus.send(EventPumpStatusChanged(EventPumpStatusChanged.Status.DISCONNECTED, resourceHelper.gs(R.string.pumperror)))
@@ -493,7 +537,7 @@ class BLEComm @Inject internal constructor(
val n = Notification(Notification.PUMP_ERROR, resourceHelper.gs(R.string.pumperror), Notification.URGENT)
rxBus.send(EventNewNotification(n))
// response BUSY: error status
- } else if (decryptedBuffer.size == 6 && decryptedBuffer[2] == 'B'.toByte() && decryptedBuffer[3] == 'U'.toByte() && decryptedBuffer[4] == 'S'.toByte() && decryptedBuffer[5] == 'Y'.toByte()) {
+ } else if (decryptedBuffer.size == 6 && decryptedBuffer[2] == 'B'.code.toByte() && decryptedBuffer[3] == 'U'.code.toByte() && decryptedBuffer[4] == 'S'.code.toByte() && decryptedBuffer[5] == 'Y'.code.toByte()) {
aapsLogger.debug(LTag.PUMPBTCOMM, "<<<<< " + "ENCRYPTION__PUMP_CHECK (BUSY)" + " " + DanaRS_Packet.toHexString(decryptedBuffer))
mSendQueue.clear()
rxBus.send(EventPumpStatusChanged(EventPumpStatusChanged.Status.DISCONNECTED, resourceHelper.gs(R.string.pumpbusy)))
@@ -502,8 +546,8 @@ class BLEComm @Inject internal constructor(
aapsLogger.debug(LTag.PUMPBTCOMM, "<<<<< " + "ENCRYPTION__PUMP_CHECK (ERROR)" + " " + DanaRS_Packet.toHexString(decryptedBuffer))
mSendQueue.clear()
rxBus.send(EventPumpStatusChanged(EventPumpStatusChanged.Status.DISCONNECTED, resourceHelper.gs(R.string.connectionerror)))
- sp.remove(resourceHelper.gs(R.string.key_danars_pairingkey) + danaRSPlugin.mDeviceName)
- val n = Notification(Notification.WRONG_SERIAL_NUMBER, resourceHelper.gs(R.string.wrongpassword), Notification.URGENT)
+ danaRSPlugin.clearPairing()
+ val n = Notification(Notification.WRONG_SERIAL_NUMBER, resourceHelper.gs(R.string.password_cleared), Notification.URGENT)
rxBus.send(EventNewNotification(n))
}
}
@@ -545,6 +589,14 @@ class BLEComm @Inject internal constructor(
}
}
+ // 2nd packet BLE5
+ private fun sendBLE5PairingInformation() {
+ val params = ByteArray(4) { 0.toByte() }
+ val bytes: ByteArray = bleEncryption.getEncryptedPacket(BleEncryption.DANAR_PACKET__OPCODE_ENCRYPTION__TIME_INFORMATION, params, null)
+ aapsLogger.debug(LTag.PUMPBTCOMM, ">>>>> " + "ENCRYPTION__TIME_INFORMATION BLE5" + " " + DanaRS_Packet.toHexString(bytes))
+ writeCharacteristicNoResponse(uartWriteBTGattChar, bytes)
+ }
+
private fun sendV3PairingInformation(requestNewPairing: Int) {
val params = byteArrayOf(requestNewPairing.toByte())
val bytes: ByteArray = bleEncryption.getEncryptedPacket(BleEncryption.DANAR_PACKET__OPCODE_ENCRYPTION__TIME_INFORMATION, params, null)
@@ -554,8 +606,12 @@ class BLEComm @Inject internal constructor(
// 2nd packet response
private fun processEncryptionResponse(decryptedBuffer: ByteArray) {
- aapsLogger.debug(LTag.PUMPBTCOMM, "<<<<< " + "ENCRYPTION__TIME_INFORMATION " + /*message.getMessageName() + " " + */DanaRS_Packet.toHexString(decryptedBuffer))
- if (v3Encryption) {
+ aapsLogger.debug(LTag.PUMPBTCOMM, "<<<<< " + "ENCRYPTION__TIME_INFORMATION " + DanaRS_Packet.toHexString(decryptedBuffer))
+ if (encryption == EncryptionType.ENCRYPTION_BLE5) {
+ isConnected = true
+ isConnecting = false
+ aapsLogger.debug(LTag.PUMPBTCOMM, "Connect !!")
+ } else if (encryption == EncryptionType.ENCRYPTION_RSv3) {
// decryptedBuffer[2] : 0x00 OK 0x01 Error, No pairing
if (decryptedBuffer[2] == 0x00.toByte()) {
val randomPairingKey = sp.getString(resourceHelper.gs(R.string.key_danars_v3_randompairingkey) + danaRSPlugin.mDeviceName, "")
@@ -657,7 +713,7 @@ class BLEComm @Inject internal constructor(
isUnitUD = decryptedBuffer[3] == 0x01.toByte()
// request time information
- if (v3Encryption) sendV3PairingInformation()
+ if (encryption == EncryptionType.ENCRYPTION_RSv3) sendV3PairingInformation()
else sendTimeInfo()
}
@@ -669,7 +725,8 @@ class BLEComm @Inject internal constructor(
val params = message.requestParams
aapsLogger.debug(LTag.PUMPBTCOMM, ">>>>> " + message.friendlyName + " " + DanaRS_Packet.toHexString(command) + " " + DanaRS_Packet.toHexString(params))
var bytes = bleEncryption.getEncryptedPacket(message.opCode, params, null)
- if (v3Encryption)
+ // aapsLogger.debug(LTag.PUMPBTCOMM, ">>>>> " + DanaRS_Packet.toHexString(bytes))
+ if (encryption != EncryptionType.ENCRYPTION_DEFAULT)
bytes = bleEncryption.encryptSecondLevelPacket(bytes)
// If there is another message not completely sent, add to queue only
if (mSendQueue.size > 0) {
diff --git a/danars/src/main/java/info/nightscout/androidaps/danars/services/DanaRSService.kt b/danars/src/main/java/info/nightscout/androidaps/danars/services/DanaRSService.kt
index a24c99a4e0..43b3b8fa9d 100644
--- a/danars/src/main/java/info/nightscout/androidaps/danars/services/DanaRSService.kt
+++ b/danars/src/main/java/info/nightscout/androidaps/danars/services/DanaRSService.kt
@@ -97,6 +97,7 @@ class DanaRSService : DaggerService() {
val isConnecting: Boolean
get() = bleComm.isConnecting
+ @kotlin.ExperimentalStdlibApi
fun connect(from: String, address: String): Boolean {
return bleComm.connect(from, address)
}
@@ -198,7 +199,6 @@ class DanaRSService : DaggerService() {
danaPump.fromTemporaryBasal(tbr)
rxBus.send(EventDanaRNewStatus())
rxBus.send(EventInitializationChanged())
- //NSUpload.uploadDeviceStatus();
if (danaPump.dailyTotalUnits > danaPump.maxDailyTotalUnits * Constants.dailyLimitWarning) {
aapsLogger.debug(LTag.PUMPCOMM, "Approaching daily limit: " + danaPump.dailyTotalUnits + "/" + danaPump.maxDailyTotalUnits)
if (System.currentTimeMillis() > lastApproachingDailyLimit + 30 * 60 * 1000) {
diff --git a/danars/src/main/jniLibs/arm64-v8a/libBleEncryption.so b/danars/src/main/jniLibs/arm64-v8a/libBleEncryption.so
index c5fddf8925..7c0c49b7e8 100644
Binary files a/danars/src/main/jniLibs/arm64-v8a/libBleEncryption.so and b/danars/src/main/jniLibs/arm64-v8a/libBleEncryption.so differ
diff --git a/danars/src/main/jniLibs/armeabi-v7a/libBleEncryption.so b/danars/src/main/jniLibs/armeabi-v7a/libBleEncryption.so
index 47acae4c14..4778aca663 100644
Binary files a/danars/src/main/jniLibs/armeabi-v7a/libBleEncryption.so and b/danars/src/main/jniLibs/armeabi-v7a/libBleEncryption.so differ
diff --git a/danars/src/main/jniLibs/x86/libBleEncryption.so b/danars/src/main/jniLibs/x86/libBleEncryption.so
index 0c860f07d9..e5ef3a17a4 100644
Binary files a/danars/src/main/jniLibs/x86/libBleEncryption.so and b/danars/src/main/jniLibs/x86/libBleEncryption.so differ
diff --git a/danars/src/main/jniLibs/x86_64/libBleEncryption.so b/danars/src/main/jniLibs/x86_64/libBleEncryption.so
index 48d5708f60..e4c02d8842 100644
Binary files a/danars/src/main/jniLibs/x86_64/libBleEncryption.so and b/danars/src/main/jniLibs/x86_64/libBleEncryption.so differ
diff --git a/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRSPacketHistoryAlarmTest.kt b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRSPacketHistoryAlarmTest.kt
index 05627b2b5b..5993ed2535 100644
--- a/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRSPacketHistoryAlarmTest.kt
+++ b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRSPacketHistoryAlarmTest.kt
@@ -3,9 +3,8 @@ package info.nightscout.androidaps.danars.comm
import dagger.android.AndroidInjector
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.dana.comm.RecordTypes
+import info.nightscout.androidaps.dana.database.DanaHistoryRecordDao
import info.nightscout.androidaps.danars.DanaRSTestBase
-import info.nightscout.androidaps.interfaces.DatabaseHelperInterface
-import info.nightscout.androidaps.plugins.general.nsclient.NSUpload
import org.junit.Assert
import org.junit.Test
import org.junit.runner.RunWith
@@ -16,8 +15,7 @@ import java.util.*
@RunWith(PowerMockRunner::class)
class DanaRSPacketHistoryAlarmTest : DanaRSTestBase() {
- @Mock lateinit var databaseHelper: DatabaseHelperInterface
- @Mock lateinit var nsUpload: NSUpload
+ @Mock lateinit var danaHistoryRecordDao: DanaHistoryRecordDao
private val packetInjector = HasAndroidInjector {
AndroidInjector {
@@ -27,12 +25,13 @@ class DanaRSPacketHistoryAlarmTest : DanaRSTestBase() {
}
if (it is DanaRS_Packet_History_Alarm) {
it.rxBus = rxBus
- it.databaseHelper = databaseHelper
+ it.danaHistoryRecordDao = danaHistoryRecordDao
}
}
}
@Test
+ @kotlin.ExperimentalStdlibApi
fun runTest() {
val packet = DanaRS_Packet_History_Alarm(packetInjector, 0)
@@ -49,14 +48,14 @@ class DanaRSPacketHistoryAlarmTest : DanaRSTestBase() {
putByteToArray(array, 9, 100) // value
packet.handleMessage(array)
- Assert.assertEquals(RecordTypes.RECORD_TYPE_ALARM, packet.danaRHistoryRecord.recordCode)
+ Assert.assertEquals(RecordTypes.RECORD_TYPE_ALARM, packet.danaRHistoryRecord.code)
val date = GregorianCalendar().also {
it.clear()
it.set(2019, 1, 4, 20, 11, 35)
}
- Assert.assertEquals(date.timeInMillis, packet.danaRHistoryRecord.recordDate)
- Assert.assertEquals("Occlusion", packet.danaRHistoryRecord.recordAlarm)
- Assert.assertEquals(3.56, packet.danaRHistoryRecord.recordValue, 0.01)
+ Assert.assertEquals(date.timeInMillis, packet.danaRHistoryRecord.timestamp)
+ Assert.assertEquals("Occlusion", packet.danaRHistoryRecord.alarm)
+ Assert.assertEquals(3.56, packet.danaRHistoryRecord.value, 0.01)
Assert.assertEquals("REVIEW__ALARM", packet.friendlyName)
}
}
\ No newline at end of file
diff --git a/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketNotifyAlarmTest.kt b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketNotifyAlarmTest.kt
index e002e8373b..9df91c6c38 100644
--- a/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketNotifyAlarmTest.kt
+++ b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketNotifyAlarmTest.kt
@@ -32,7 +32,6 @@ class DanaRsPacketNotifyAlarmTest : DanaRSTestBase() {
// test params
Assert.assertEquals(null, packet.requestParams)
// test message decoding
- // handle message testing fails on non-error byte because of NSUpload not properly mocked
packet.handleMessage(createArray(17, 0x01.toByte()))
Assert.assertEquals(false, packet.failed)
// no error
diff --git a/database/build.gradle b/database/build.gradle
index d41e263136..f408159e29 100644
--- a/database/build.gradle
+++ b/database/build.gradle
@@ -26,12 +26,12 @@ dependencies {
implementation "io.reactivex.rxjava2:rxandroid:$rxandroid_version"
implementation("io.reactivex.rxjava2:rxkotlin:$rxkotlin_version")
- implementation "com.google.code.gson:gson:2.8.6"
+ implementation "com.google.code.gson:gson:2.8.7"
api "androidx.room:room-runtime:$room_version"
kapt "androidx.room:room-compiler:$room_version"
/* Database schema export */
- kapt "android.arch.persistence.room:compiler:$room_version"
+ kapt "androidx.room:room-compiler:$room_version"
implementation "androidx.room:room-ktx:$room_version"
implementation "androidx.room:room-rxjava2:$room_version"
diff --git a/database/schemas/info.nightscout.androidaps.database.AppDatabase/20.json b/database/schemas/info.nightscout.androidaps.database.AppDatabase/20.json
new file mode 100644
index 0000000000..9ee949cf15
--- /dev/null
+++ b/database/schemas/info.nightscout.androidaps.database.AppDatabase/20.json
@@ -0,0 +1,3424 @@
+{
+ "formatVersion": 1,
+ "database": {
+ "version": 20,
+ "identityHash": "9d3f2becffaecc2ee9508749be498ae4",
+ "entities": [
+ {
+ "tableName": "apsResults",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `version` INTEGER NOT NULL, `dateCreated` INTEGER NOT NULL, `isValid` INTEGER NOT NULL, `referenceId` INTEGER, `timestamp` INTEGER NOT NULL, `utcOffset` INTEGER NOT NULL, `algorithm` TEXT NOT NULL, `glucoseStatusJson` TEXT NOT NULL, `currentTempJson` TEXT NOT NULL, `iobDataJson` TEXT NOT NULL, `profileJson` TEXT NOT NULL, `autosensDataJson` TEXT, `mealDataJson` TEXT NOT NULL, `isMicroBolusAllowed` INTEGER, `resultJson` TEXT NOT NULL, `nightscoutSystemId` TEXT, `nightscoutId` TEXT, `pumpType` TEXT, `pumpSerial` TEXT, `temporaryId` INTEGER, `pumpId` INTEGER, `startId` INTEGER, `endId` INTEGER, FOREIGN KEY(`referenceId`) REFERENCES `apsResults`(`id`) ON UPDATE NO ACTION ON DELETE NO ACTION )",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "version",
+ "columnName": "version",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "dateCreated",
+ "columnName": "dateCreated",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "isValid",
+ "columnName": "isValid",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "referenceId",
+ "columnName": "referenceId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "timestamp",
+ "columnName": "timestamp",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "utcOffset",
+ "columnName": "utcOffset",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "algorithm",
+ "columnName": "algorithm",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "glucoseStatusJson",
+ "columnName": "glucoseStatusJson",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "currentTempJson",
+ "columnName": "currentTempJson",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "iobDataJson",
+ "columnName": "iobDataJson",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "profileJson",
+ "columnName": "profileJson",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "autosensDataJson",
+ "columnName": "autosensDataJson",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "mealDataJson",
+ "columnName": "mealDataJson",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "isMicroBolusAllowed",
+ "columnName": "isMicroBolusAllowed",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "resultJson",
+ "columnName": "resultJson",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.nightscoutSystemId",
+ "columnName": "nightscoutSystemId",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.nightscoutId",
+ "columnName": "nightscoutId",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpType",
+ "columnName": "pumpType",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpSerial",
+ "columnName": "pumpSerial",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.temporaryId",
+ "columnName": "temporaryId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpId",
+ "columnName": "pumpId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.startId",
+ "columnName": "startId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.endId",
+ "columnName": "endId",
+ "affinity": "INTEGER",
+ "notNull": false
+ }
+ ],
+ "primaryKey": {
+ "columnNames": [
+ "id"
+ ],
+ "autoGenerate": true
+ },
+ "indices": [
+ {
+ "name": "index_apsResults_referenceId",
+ "unique": false,
+ "columnNames": [
+ "referenceId"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_apsResults_referenceId` ON `${TABLE_NAME}` (`referenceId`)"
+ },
+ {
+ "name": "index_apsResults_timestamp",
+ "unique": false,
+ "columnNames": [
+ "timestamp"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_apsResults_timestamp` ON `${TABLE_NAME}` (`timestamp`)"
+ }
+ ],
+ "foreignKeys": [
+ {
+ "table": "apsResults",
+ "onDelete": "NO ACTION",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "referenceId"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ }
+ ]
+ },
+ {
+ "tableName": "boluses",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `version` INTEGER NOT NULL, `dateCreated` INTEGER NOT NULL, `isValid` INTEGER NOT NULL, `referenceId` INTEGER, `timestamp` INTEGER NOT NULL, `utcOffset` INTEGER NOT NULL, `amount` REAL NOT NULL, `type` TEXT NOT NULL, `isBasalInsulin` INTEGER NOT NULL, `nightscoutSystemId` TEXT, `nightscoutId` TEXT, `pumpType` TEXT, `pumpSerial` TEXT, `temporaryId` INTEGER, `pumpId` INTEGER, `startId` INTEGER, `endId` INTEGER, `insulinLabel` TEXT, `insulinEndTime` INTEGER, `peak` INTEGER, FOREIGN KEY(`referenceId`) REFERENCES `boluses`(`id`) ON UPDATE NO ACTION ON DELETE NO ACTION )",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "version",
+ "columnName": "version",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "dateCreated",
+ "columnName": "dateCreated",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "isValid",
+ "columnName": "isValid",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "referenceId",
+ "columnName": "referenceId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "timestamp",
+ "columnName": "timestamp",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "utcOffset",
+ "columnName": "utcOffset",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "amount",
+ "columnName": "amount",
+ "affinity": "REAL",
+ "notNull": true
+ },
+ {
+ "fieldPath": "type",
+ "columnName": "type",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "isBasalInsulin",
+ "columnName": "isBasalInsulin",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.nightscoutSystemId",
+ "columnName": "nightscoutSystemId",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.nightscoutId",
+ "columnName": "nightscoutId",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpType",
+ "columnName": "pumpType",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpSerial",
+ "columnName": "pumpSerial",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.temporaryId",
+ "columnName": "temporaryId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpId",
+ "columnName": "pumpId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.startId",
+ "columnName": "startId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.endId",
+ "columnName": "endId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "insulinConfiguration.insulinLabel",
+ "columnName": "insulinLabel",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "insulinConfiguration.insulinEndTime",
+ "columnName": "insulinEndTime",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "insulinConfiguration.peak",
+ "columnName": "peak",
+ "affinity": "INTEGER",
+ "notNull": false
+ }
+ ],
+ "primaryKey": {
+ "columnNames": [
+ "id"
+ ],
+ "autoGenerate": true
+ },
+ "indices": [
+ {
+ "name": "index_boluses_id",
+ "unique": false,
+ "columnNames": [
+ "id"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_boluses_id` ON `${TABLE_NAME}` (`id`)"
+ },
+ {
+ "name": "index_boluses_isValid",
+ "unique": false,
+ "columnNames": [
+ "isValid"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_boluses_isValid` ON `${TABLE_NAME}` (`isValid`)"
+ },
+ {
+ "name": "index_boluses_temporaryId",
+ "unique": false,
+ "columnNames": [
+ "temporaryId"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_boluses_temporaryId` ON `${TABLE_NAME}` (`temporaryId`)"
+ },
+ {
+ "name": "index_boluses_pumpId",
+ "unique": false,
+ "columnNames": [
+ "pumpId"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_boluses_pumpId` ON `${TABLE_NAME}` (`pumpId`)"
+ },
+ {
+ "name": "index_boluses_pumpSerial",
+ "unique": false,
+ "columnNames": [
+ "pumpSerial"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_boluses_pumpSerial` ON `${TABLE_NAME}` (`pumpSerial`)"
+ },
+ {
+ "name": "index_boluses_pumpType",
+ "unique": false,
+ "columnNames": [
+ "pumpType"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_boluses_pumpType` ON `${TABLE_NAME}` (`pumpType`)"
+ },
+ {
+ "name": "index_boluses_referenceId",
+ "unique": false,
+ "columnNames": [
+ "referenceId"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_boluses_referenceId` ON `${TABLE_NAME}` (`referenceId`)"
+ },
+ {
+ "name": "index_boluses_timestamp",
+ "unique": false,
+ "columnNames": [
+ "timestamp"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_boluses_timestamp` ON `${TABLE_NAME}` (`timestamp`)"
+ }
+ ],
+ "foreignKeys": [
+ {
+ "table": "boluses",
+ "onDelete": "NO ACTION",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "referenceId"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ }
+ ]
+ },
+ {
+ "tableName": "bolusCalculatorResults",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `version` INTEGER NOT NULL, `dateCreated` INTEGER NOT NULL, `isValid` INTEGER NOT NULL, `referenceId` INTEGER, `timestamp` INTEGER NOT NULL, `utcOffset` INTEGER NOT NULL, `targetBGLow` REAL NOT NULL, `targetBGHigh` REAL NOT NULL, `isf` REAL NOT NULL, `ic` REAL NOT NULL, `bolusIOB` REAL NOT NULL, `wasBolusIOBUsed` INTEGER NOT NULL, `basalIOB` REAL NOT NULL, `wasBasalIOBUsed` INTEGER NOT NULL, `glucoseValue` REAL NOT NULL, `wasGlucoseUsed` INTEGER NOT NULL, `glucoseDifference` REAL NOT NULL, `glucoseInsulin` REAL NOT NULL, `glucoseTrend` REAL NOT NULL, `wasTrendUsed` INTEGER NOT NULL, `trendInsulin` REAL NOT NULL, `cob` REAL NOT NULL, `wasCOBUsed` INTEGER NOT NULL, `cobInsulin` REAL NOT NULL, `carbs` REAL NOT NULL, `wereCarbsUsed` INTEGER NOT NULL, `carbsInsulin` REAL NOT NULL, `otherCorrection` REAL NOT NULL, `wasSuperbolusUsed` INTEGER NOT NULL, `superbolusInsulin` REAL NOT NULL, `wasTempTargetUsed` INTEGER NOT NULL, `totalInsulin` REAL NOT NULL, `percentageCorrection` INTEGER NOT NULL, `profileName` TEXT NOT NULL, `note` TEXT NOT NULL, `nightscoutSystemId` TEXT, `nightscoutId` TEXT, `pumpType` TEXT, `pumpSerial` TEXT, `temporaryId` INTEGER, `pumpId` INTEGER, `startId` INTEGER, `endId` INTEGER, FOREIGN KEY(`referenceId`) REFERENCES `bolusCalculatorResults`(`id`) ON UPDATE NO ACTION ON DELETE NO ACTION )",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "version",
+ "columnName": "version",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "dateCreated",
+ "columnName": "dateCreated",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "isValid",
+ "columnName": "isValid",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "referenceId",
+ "columnName": "referenceId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "timestamp",
+ "columnName": "timestamp",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "utcOffset",
+ "columnName": "utcOffset",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "targetBGLow",
+ "columnName": "targetBGLow",
+ "affinity": "REAL",
+ "notNull": true
+ },
+ {
+ "fieldPath": "targetBGHigh",
+ "columnName": "targetBGHigh",
+ "affinity": "REAL",
+ "notNull": true
+ },
+ {
+ "fieldPath": "isf",
+ "columnName": "isf",
+ "affinity": "REAL",
+ "notNull": true
+ },
+ {
+ "fieldPath": "ic",
+ "columnName": "ic",
+ "affinity": "REAL",
+ "notNull": true
+ },
+ {
+ "fieldPath": "bolusIOB",
+ "columnName": "bolusIOB",
+ "affinity": "REAL",
+ "notNull": true
+ },
+ {
+ "fieldPath": "wasBolusIOBUsed",
+ "columnName": "wasBolusIOBUsed",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "basalIOB",
+ "columnName": "basalIOB",
+ "affinity": "REAL",
+ "notNull": true
+ },
+ {
+ "fieldPath": "wasBasalIOBUsed",
+ "columnName": "wasBasalIOBUsed",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "glucoseValue",
+ "columnName": "glucoseValue",
+ "affinity": "REAL",
+ "notNull": true
+ },
+ {
+ "fieldPath": "wasGlucoseUsed",
+ "columnName": "wasGlucoseUsed",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "glucoseDifference",
+ "columnName": "glucoseDifference",
+ "affinity": "REAL",
+ "notNull": true
+ },
+ {
+ "fieldPath": "glucoseInsulin",
+ "columnName": "glucoseInsulin",
+ "affinity": "REAL",
+ "notNull": true
+ },
+ {
+ "fieldPath": "glucoseTrend",
+ "columnName": "glucoseTrend",
+ "affinity": "REAL",
+ "notNull": true
+ },
+ {
+ "fieldPath": "wasTrendUsed",
+ "columnName": "wasTrendUsed",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "trendInsulin",
+ "columnName": "trendInsulin",
+ "affinity": "REAL",
+ "notNull": true
+ },
+ {
+ "fieldPath": "cob",
+ "columnName": "cob",
+ "affinity": "REAL",
+ "notNull": true
+ },
+ {
+ "fieldPath": "wasCOBUsed",
+ "columnName": "wasCOBUsed",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "cobInsulin",
+ "columnName": "cobInsulin",
+ "affinity": "REAL",
+ "notNull": true
+ },
+ {
+ "fieldPath": "carbs",
+ "columnName": "carbs",
+ "affinity": "REAL",
+ "notNull": true
+ },
+ {
+ "fieldPath": "wereCarbsUsed",
+ "columnName": "wereCarbsUsed",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "carbsInsulin",
+ "columnName": "carbsInsulin",
+ "affinity": "REAL",
+ "notNull": true
+ },
+ {
+ "fieldPath": "otherCorrection",
+ "columnName": "otherCorrection",
+ "affinity": "REAL",
+ "notNull": true
+ },
+ {
+ "fieldPath": "wasSuperbolusUsed",
+ "columnName": "wasSuperbolusUsed",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "superbolusInsulin",
+ "columnName": "superbolusInsulin",
+ "affinity": "REAL",
+ "notNull": true
+ },
+ {
+ "fieldPath": "wasTempTargetUsed",
+ "columnName": "wasTempTargetUsed",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "totalInsulin",
+ "columnName": "totalInsulin",
+ "affinity": "REAL",
+ "notNull": true
+ },
+ {
+ "fieldPath": "percentageCorrection",
+ "columnName": "percentageCorrection",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "profileName",
+ "columnName": "profileName",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "note",
+ "columnName": "note",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.nightscoutSystemId",
+ "columnName": "nightscoutSystemId",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.nightscoutId",
+ "columnName": "nightscoutId",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpType",
+ "columnName": "pumpType",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpSerial",
+ "columnName": "pumpSerial",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.temporaryId",
+ "columnName": "temporaryId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpId",
+ "columnName": "pumpId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.startId",
+ "columnName": "startId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.endId",
+ "columnName": "endId",
+ "affinity": "INTEGER",
+ "notNull": false
+ }
+ ],
+ "primaryKey": {
+ "columnNames": [
+ "id"
+ ],
+ "autoGenerate": true
+ },
+ "indices": [
+ {
+ "name": "index_bolusCalculatorResults_referenceId",
+ "unique": false,
+ "columnNames": [
+ "referenceId"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_bolusCalculatorResults_referenceId` ON `${TABLE_NAME}` (`referenceId`)"
+ },
+ {
+ "name": "index_bolusCalculatorResults_timestamp",
+ "unique": false,
+ "columnNames": [
+ "timestamp"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_bolusCalculatorResults_timestamp` ON `${TABLE_NAME}` (`timestamp`)"
+ },
+ {
+ "name": "index_bolusCalculatorResults_id",
+ "unique": false,
+ "columnNames": [
+ "id"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_bolusCalculatorResults_id` ON `${TABLE_NAME}` (`id`)"
+ },
+ {
+ "name": "index_bolusCalculatorResults_isValid",
+ "unique": false,
+ "columnNames": [
+ "isValid"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_bolusCalculatorResults_isValid` ON `${TABLE_NAME}` (`isValid`)"
+ }
+ ],
+ "foreignKeys": [
+ {
+ "table": "bolusCalculatorResults",
+ "onDelete": "NO ACTION",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "referenceId"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ }
+ ]
+ },
+ {
+ "tableName": "carbs",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `version` INTEGER NOT NULL, `dateCreated` INTEGER NOT NULL, `isValid` INTEGER NOT NULL, `referenceId` INTEGER, `timestamp` INTEGER NOT NULL, `utcOffset` INTEGER NOT NULL, `duration` INTEGER NOT NULL, `amount` REAL NOT NULL, `nightscoutSystemId` TEXT, `nightscoutId` TEXT, `pumpType` TEXT, `pumpSerial` TEXT, `temporaryId` INTEGER, `pumpId` INTEGER, `startId` INTEGER, `endId` INTEGER, FOREIGN KEY(`referenceId`) REFERENCES `carbs`(`id`) ON UPDATE NO ACTION ON DELETE NO ACTION )",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "version",
+ "columnName": "version",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "dateCreated",
+ "columnName": "dateCreated",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "isValid",
+ "columnName": "isValid",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "referenceId",
+ "columnName": "referenceId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "timestamp",
+ "columnName": "timestamp",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "utcOffset",
+ "columnName": "utcOffset",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "duration",
+ "columnName": "duration",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "amount",
+ "columnName": "amount",
+ "affinity": "REAL",
+ "notNull": true
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.nightscoutSystemId",
+ "columnName": "nightscoutSystemId",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.nightscoutId",
+ "columnName": "nightscoutId",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpType",
+ "columnName": "pumpType",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpSerial",
+ "columnName": "pumpSerial",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.temporaryId",
+ "columnName": "temporaryId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpId",
+ "columnName": "pumpId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.startId",
+ "columnName": "startId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.endId",
+ "columnName": "endId",
+ "affinity": "INTEGER",
+ "notNull": false
+ }
+ ],
+ "primaryKey": {
+ "columnNames": [
+ "id"
+ ],
+ "autoGenerate": true
+ },
+ "indices": [
+ {
+ "name": "index_carbs_id",
+ "unique": false,
+ "columnNames": [
+ "id"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_carbs_id` ON `${TABLE_NAME}` (`id`)"
+ },
+ {
+ "name": "index_carbs_isValid",
+ "unique": false,
+ "columnNames": [
+ "isValid"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_carbs_isValid` ON `${TABLE_NAME}` (`isValid`)"
+ },
+ {
+ "name": "index_carbs_nightscoutId",
+ "unique": false,
+ "columnNames": [
+ "nightscoutId"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_carbs_nightscoutId` ON `${TABLE_NAME}` (`nightscoutId`)"
+ },
+ {
+ "name": "index_carbs_referenceId",
+ "unique": false,
+ "columnNames": [
+ "referenceId"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_carbs_referenceId` ON `${TABLE_NAME}` (`referenceId`)"
+ },
+ {
+ "name": "index_carbs_timestamp",
+ "unique": false,
+ "columnNames": [
+ "timestamp"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_carbs_timestamp` ON `${TABLE_NAME}` (`timestamp`)"
+ }
+ ],
+ "foreignKeys": [
+ {
+ "table": "carbs",
+ "onDelete": "NO ACTION",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "referenceId"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ }
+ ]
+ },
+ {
+ "tableName": "effectiveProfileSwitches",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `version` INTEGER NOT NULL, `dateCreated` INTEGER NOT NULL, `isValid` INTEGER NOT NULL, `referenceId` INTEGER, `timestamp` INTEGER NOT NULL, `utcOffset` INTEGER NOT NULL, `basalBlocks` TEXT NOT NULL, `isfBlocks` TEXT NOT NULL, `icBlocks` TEXT NOT NULL, `targetBlocks` TEXT NOT NULL, `glucoseUnit` TEXT NOT NULL, `originalProfileName` TEXT NOT NULL, `originalCustomizedName` TEXT NOT NULL, `originalTimeshift` INTEGER NOT NULL, `originalPercentage` INTEGER NOT NULL, `originalDuration` INTEGER NOT NULL, `originalEnd` INTEGER NOT NULL, `nightscoutSystemId` TEXT, `nightscoutId` TEXT, `pumpType` TEXT, `pumpSerial` TEXT, `temporaryId` INTEGER, `pumpId` INTEGER, `startId` INTEGER, `endId` INTEGER, `insulinLabel` TEXT NOT NULL, `insulinEndTime` INTEGER NOT NULL, `peak` INTEGER NOT NULL, FOREIGN KEY(`referenceId`) REFERENCES `effectiveProfileSwitches`(`id`) ON UPDATE NO ACTION ON DELETE NO ACTION )",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "version",
+ "columnName": "version",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "dateCreated",
+ "columnName": "dateCreated",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "isValid",
+ "columnName": "isValid",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "referenceId",
+ "columnName": "referenceId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "timestamp",
+ "columnName": "timestamp",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "utcOffset",
+ "columnName": "utcOffset",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "basalBlocks",
+ "columnName": "basalBlocks",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "isfBlocks",
+ "columnName": "isfBlocks",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "icBlocks",
+ "columnName": "icBlocks",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "targetBlocks",
+ "columnName": "targetBlocks",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "glucoseUnit",
+ "columnName": "glucoseUnit",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "originalProfileName",
+ "columnName": "originalProfileName",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "originalCustomizedName",
+ "columnName": "originalCustomizedName",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "originalTimeshift",
+ "columnName": "originalTimeshift",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "originalPercentage",
+ "columnName": "originalPercentage",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "originalDuration",
+ "columnName": "originalDuration",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "originalEnd",
+ "columnName": "originalEnd",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.nightscoutSystemId",
+ "columnName": "nightscoutSystemId",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.nightscoutId",
+ "columnName": "nightscoutId",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpType",
+ "columnName": "pumpType",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpSerial",
+ "columnName": "pumpSerial",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.temporaryId",
+ "columnName": "temporaryId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpId",
+ "columnName": "pumpId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.startId",
+ "columnName": "startId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.endId",
+ "columnName": "endId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "insulinConfiguration.insulinLabel",
+ "columnName": "insulinLabel",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "insulinConfiguration.insulinEndTime",
+ "columnName": "insulinEndTime",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "insulinConfiguration.peak",
+ "columnName": "peak",
+ "affinity": "INTEGER",
+ "notNull": true
+ }
+ ],
+ "primaryKey": {
+ "columnNames": [
+ "id"
+ ],
+ "autoGenerate": true
+ },
+ "indices": [
+ {
+ "name": "index_effectiveProfileSwitches_id",
+ "unique": false,
+ "columnNames": [
+ "id"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_effectiveProfileSwitches_id` ON `${TABLE_NAME}` (`id`)"
+ },
+ {
+ "name": "index_effectiveProfileSwitches_referenceId",
+ "unique": false,
+ "columnNames": [
+ "referenceId"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_effectiveProfileSwitches_referenceId` ON `${TABLE_NAME}` (`referenceId`)"
+ },
+ {
+ "name": "index_effectiveProfileSwitches_timestamp",
+ "unique": false,
+ "columnNames": [
+ "timestamp"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_effectiveProfileSwitches_timestamp` ON `${TABLE_NAME}` (`timestamp`)"
+ },
+ {
+ "name": "index_effectiveProfileSwitches_isValid",
+ "unique": false,
+ "columnNames": [
+ "isValid"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_effectiveProfileSwitches_isValid` ON `${TABLE_NAME}` (`isValid`)"
+ }
+ ],
+ "foreignKeys": [
+ {
+ "table": "effectiveProfileSwitches",
+ "onDelete": "NO ACTION",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "referenceId"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ }
+ ]
+ },
+ {
+ "tableName": "extendedBoluses",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `version` INTEGER NOT NULL, `dateCreated` INTEGER NOT NULL, `isValid` INTEGER NOT NULL, `referenceId` INTEGER, `timestamp` INTEGER NOT NULL, `utcOffset` INTEGER NOT NULL, `duration` INTEGER NOT NULL, `amount` REAL NOT NULL, `isEmulatingTempBasal` INTEGER NOT NULL, `nightscoutSystemId` TEXT, `nightscoutId` TEXT, `pumpType` TEXT, `pumpSerial` TEXT, `temporaryId` INTEGER, `pumpId` INTEGER, `startId` INTEGER, `endId` INTEGER, FOREIGN KEY(`referenceId`) REFERENCES `extendedBoluses`(`id`) ON UPDATE NO ACTION ON DELETE NO ACTION )",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "version",
+ "columnName": "version",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "dateCreated",
+ "columnName": "dateCreated",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "isValid",
+ "columnName": "isValid",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "referenceId",
+ "columnName": "referenceId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "timestamp",
+ "columnName": "timestamp",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "utcOffset",
+ "columnName": "utcOffset",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "duration",
+ "columnName": "duration",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "amount",
+ "columnName": "amount",
+ "affinity": "REAL",
+ "notNull": true
+ },
+ {
+ "fieldPath": "isEmulatingTempBasal",
+ "columnName": "isEmulatingTempBasal",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.nightscoutSystemId",
+ "columnName": "nightscoutSystemId",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.nightscoutId",
+ "columnName": "nightscoutId",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpType",
+ "columnName": "pumpType",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpSerial",
+ "columnName": "pumpSerial",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.temporaryId",
+ "columnName": "temporaryId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpId",
+ "columnName": "pumpId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.startId",
+ "columnName": "startId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.endId",
+ "columnName": "endId",
+ "affinity": "INTEGER",
+ "notNull": false
+ }
+ ],
+ "primaryKey": {
+ "columnNames": [
+ "id"
+ ],
+ "autoGenerate": true
+ },
+ "indices": [
+ {
+ "name": "index_extendedBoluses_id",
+ "unique": false,
+ "columnNames": [
+ "id"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_extendedBoluses_id` ON `${TABLE_NAME}` (`id`)"
+ },
+ {
+ "name": "index_extendedBoluses_isValid",
+ "unique": false,
+ "columnNames": [
+ "isValid"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_extendedBoluses_isValid` ON `${TABLE_NAME}` (`isValid`)"
+ },
+ {
+ "name": "index_extendedBoluses_endId",
+ "unique": false,
+ "columnNames": [
+ "endId"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_extendedBoluses_endId` ON `${TABLE_NAME}` (`endId`)"
+ },
+ {
+ "name": "index_extendedBoluses_pumpSerial",
+ "unique": false,
+ "columnNames": [
+ "pumpSerial"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_extendedBoluses_pumpSerial` ON `${TABLE_NAME}` (`pumpSerial`)"
+ },
+ {
+ "name": "index_extendedBoluses_pumpId",
+ "unique": false,
+ "columnNames": [
+ "pumpId"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_extendedBoluses_pumpId` ON `${TABLE_NAME}` (`pumpId`)"
+ },
+ {
+ "name": "index_extendedBoluses_pumpType",
+ "unique": false,
+ "columnNames": [
+ "pumpType"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_extendedBoluses_pumpType` ON `${TABLE_NAME}` (`pumpType`)"
+ },
+ {
+ "name": "index_extendedBoluses_referenceId",
+ "unique": false,
+ "columnNames": [
+ "referenceId"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_extendedBoluses_referenceId` ON `${TABLE_NAME}` (`referenceId`)"
+ },
+ {
+ "name": "index_extendedBoluses_timestamp",
+ "unique": false,
+ "columnNames": [
+ "timestamp"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_extendedBoluses_timestamp` ON `${TABLE_NAME}` (`timestamp`)"
+ }
+ ],
+ "foreignKeys": [
+ {
+ "table": "extendedBoluses",
+ "onDelete": "NO ACTION",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "referenceId"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ }
+ ]
+ },
+ {
+ "tableName": "glucoseValues",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `version` INTEGER NOT NULL, `dateCreated` INTEGER NOT NULL, `isValid` INTEGER NOT NULL, `referenceId` INTEGER, `timestamp` INTEGER NOT NULL, `utcOffset` INTEGER NOT NULL, `raw` REAL, `value` REAL NOT NULL, `trendArrow` TEXT NOT NULL, `noise` REAL, `sourceSensor` TEXT NOT NULL, `nightscoutSystemId` TEXT, `nightscoutId` TEXT, `pumpType` TEXT, `pumpSerial` TEXT, `temporaryId` INTEGER, `pumpId` INTEGER, `startId` INTEGER, `endId` INTEGER, FOREIGN KEY(`referenceId`) REFERENCES `glucoseValues`(`id`) ON UPDATE NO ACTION ON DELETE NO ACTION )",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "version",
+ "columnName": "version",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "dateCreated",
+ "columnName": "dateCreated",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "isValid",
+ "columnName": "isValid",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "referenceId",
+ "columnName": "referenceId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "timestamp",
+ "columnName": "timestamp",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "utcOffset",
+ "columnName": "utcOffset",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "raw",
+ "columnName": "raw",
+ "affinity": "REAL",
+ "notNull": false
+ },
+ {
+ "fieldPath": "value",
+ "columnName": "value",
+ "affinity": "REAL",
+ "notNull": true
+ },
+ {
+ "fieldPath": "trendArrow",
+ "columnName": "trendArrow",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "noise",
+ "columnName": "noise",
+ "affinity": "REAL",
+ "notNull": false
+ },
+ {
+ "fieldPath": "sourceSensor",
+ "columnName": "sourceSensor",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.nightscoutSystemId",
+ "columnName": "nightscoutSystemId",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.nightscoutId",
+ "columnName": "nightscoutId",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpType",
+ "columnName": "pumpType",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpSerial",
+ "columnName": "pumpSerial",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.temporaryId",
+ "columnName": "temporaryId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpId",
+ "columnName": "pumpId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.startId",
+ "columnName": "startId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.endId",
+ "columnName": "endId",
+ "affinity": "INTEGER",
+ "notNull": false
+ }
+ ],
+ "primaryKey": {
+ "columnNames": [
+ "id"
+ ],
+ "autoGenerate": true
+ },
+ "indices": [
+ {
+ "name": "index_glucoseValues_id",
+ "unique": false,
+ "columnNames": [
+ "id"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_glucoseValues_id` ON `${TABLE_NAME}` (`id`)"
+ },
+ {
+ "name": "index_glucoseValues_nightscoutId",
+ "unique": false,
+ "columnNames": [
+ "nightscoutId"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_glucoseValues_nightscoutId` ON `${TABLE_NAME}` (`nightscoutId`)"
+ },
+ {
+ "name": "index_glucoseValues_sourceSensor",
+ "unique": false,
+ "columnNames": [
+ "sourceSensor"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_glucoseValues_sourceSensor` ON `${TABLE_NAME}` (`sourceSensor`)"
+ },
+ {
+ "name": "index_glucoseValues_referenceId",
+ "unique": false,
+ "columnNames": [
+ "referenceId"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_glucoseValues_referenceId` ON `${TABLE_NAME}` (`referenceId`)"
+ },
+ {
+ "name": "index_glucoseValues_timestamp",
+ "unique": false,
+ "columnNames": [
+ "timestamp"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_glucoseValues_timestamp` ON `${TABLE_NAME}` (`timestamp`)"
+ }
+ ],
+ "foreignKeys": [
+ {
+ "table": "glucoseValues",
+ "onDelete": "NO ACTION",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "referenceId"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ }
+ ]
+ },
+ {
+ "tableName": "profileSwitches",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `version` INTEGER NOT NULL, `dateCreated` INTEGER NOT NULL, `isValid` INTEGER NOT NULL, `referenceId` INTEGER, `timestamp` INTEGER NOT NULL, `utcOffset` INTEGER NOT NULL, `basalBlocks` TEXT NOT NULL, `isfBlocks` TEXT NOT NULL, `icBlocks` TEXT NOT NULL, `targetBlocks` TEXT NOT NULL, `glucoseUnit` TEXT NOT NULL, `profileName` TEXT NOT NULL, `timeshift` INTEGER NOT NULL, `percentage` INTEGER NOT NULL, `duration` INTEGER NOT NULL, `nightscoutSystemId` TEXT, `nightscoutId` TEXT, `pumpType` TEXT, `pumpSerial` TEXT, `temporaryId` INTEGER, `pumpId` INTEGER, `startId` INTEGER, `endId` INTEGER, `insulinLabel` TEXT NOT NULL, `insulinEndTime` INTEGER NOT NULL, `peak` INTEGER NOT NULL, FOREIGN KEY(`referenceId`) REFERENCES `profileSwitches`(`id`) ON UPDATE NO ACTION ON DELETE NO ACTION )",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "version",
+ "columnName": "version",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "dateCreated",
+ "columnName": "dateCreated",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "isValid",
+ "columnName": "isValid",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "referenceId",
+ "columnName": "referenceId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "timestamp",
+ "columnName": "timestamp",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "utcOffset",
+ "columnName": "utcOffset",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "basalBlocks",
+ "columnName": "basalBlocks",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "isfBlocks",
+ "columnName": "isfBlocks",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "icBlocks",
+ "columnName": "icBlocks",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "targetBlocks",
+ "columnName": "targetBlocks",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "glucoseUnit",
+ "columnName": "glucoseUnit",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "profileName",
+ "columnName": "profileName",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "timeshift",
+ "columnName": "timeshift",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "percentage",
+ "columnName": "percentage",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "duration",
+ "columnName": "duration",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.nightscoutSystemId",
+ "columnName": "nightscoutSystemId",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.nightscoutId",
+ "columnName": "nightscoutId",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpType",
+ "columnName": "pumpType",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpSerial",
+ "columnName": "pumpSerial",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.temporaryId",
+ "columnName": "temporaryId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpId",
+ "columnName": "pumpId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.startId",
+ "columnName": "startId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.endId",
+ "columnName": "endId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "insulinConfiguration.insulinLabel",
+ "columnName": "insulinLabel",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "insulinConfiguration.insulinEndTime",
+ "columnName": "insulinEndTime",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "insulinConfiguration.peak",
+ "columnName": "peak",
+ "affinity": "INTEGER",
+ "notNull": true
+ }
+ ],
+ "primaryKey": {
+ "columnNames": [
+ "id"
+ ],
+ "autoGenerate": true
+ },
+ "indices": [
+ {
+ "name": "index_profileSwitches_referenceId",
+ "unique": false,
+ "columnNames": [
+ "referenceId"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_profileSwitches_referenceId` ON `${TABLE_NAME}` (`referenceId`)"
+ },
+ {
+ "name": "index_profileSwitches_timestamp",
+ "unique": false,
+ "columnNames": [
+ "timestamp"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_profileSwitches_timestamp` ON `${TABLE_NAME}` (`timestamp`)"
+ },
+ {
+ "name": "index_profileSwitches_isValid",
+ "unique": false,
+ "columnNames": [
+ "isValid"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_profileSwitches_isValid` ON `${TABLE_NAME}` (`isValid`)"
+ },
+ {
+ "name": "index_profileSwitches_id",
+ "unique": false,
+ "columnNames": [
+ "id"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_profileSwitches_id` ON `${TABLE_NAME}` (`id`)"
+ },
+ {
+ "name": "index_profileSwitches_nightscoutId",
+ "unique": false,
+ "columnNames": [
+ "nightscoutId"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_profileSwitches_nightscoutId` ON `${TABLE_NAME}` (`nightscoutId`)"
+ }
+ ],
+ "foreignKeys": [
+ {
+ "table": "profileSwitches",
+ "onDelete": "NO ACTION",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "referenceId"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ }
+ ]
+ },
+ {
+ "tableName": "temporaryBasals",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `version` INTEGER NOT NULL, `dateCreated` INTEGER NOT NULL, `isValid` INTEGER NOT NULL, `referenceId` INTEGER, `timestamp` INTEGER NOT NULL, `utcOffset` INTEGER NOT NULL, `type` TEXT NOT NULL, `isAbsolute` INTEGER NOT NULL, `rate` REAL NOT NULL, `duration` INTEGER NOT NULL, `nightscoutSystemId` TEXT, `nightscoutId` TEXT, `pumpType` TEXT, `pumpSerial` TEXT, `temporaryId` INTEGER, `pumpId` INTEGER, `startId` INTEGER, `endId` INTEGER, FOREIGN KEY(`referenceId`) REFERENCES `temporaryBasals`(`id`) ON UPDATE NO ACTION ON DELETE NO ACTION )",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "version",
+ "columnName": "version",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "dateCreated",
+ "columnName": "dateCreated",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "isValid",
+ "columnName": "isValid",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "referenceId",
+ "columnName": "referenceId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "timestamp",
+ "columnName": "timestamp",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "utcOffset",
+ "columnName": "utcOffset",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "type",
+ "columnName": "type",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "isAbsolute",
+ "columnName": "isAbsolute",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "rate",
+ "columnName": "rate",
+ "affinity": "REAL",
+ "notNull": true
+ },
+ {
+ "fieldPath": "duration",
+ "columnName": "duration",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.nightscoutSystemId",
+ "columnName": "nightscoutSystemId",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.nightscoutId",
+ "columnName": "nightscoutId",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpType",
+ "columnName": "pumpType",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpSerial",
+ "columnName": "pumpSerial",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.temporaryId",
+ "columnName": "temporaryId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpId",
+ "columnName": "pumpId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.startId",
+ "columnName": "startId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.endId",
+ "columnName": "endId",
+ "affinity": "INTEGER",
+ "notNull": false
+ }
+ ],
+ "primaryKey": {
+ "columnNames": [
+ "id"
+ ],
+ "autoGenerate": true
+ },
+ "indices": [
+ {
+ "name": "index_temporaryBasals_id",
+ "unique": false,
+ "columnNames": [
+ "id"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_temporaryBasals_id` ON `${TABLE_NAME}` (`id`)"
+ },
+ {
+ "name": "index_temporaryBasals_isValid",
+ "unique": false,
+ "columnNames": [
+ "isValid"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_temporaryBasals_isValid` ON `${TABLE_NAME}` (`isValid`)"
+ },
+ {
+ "name": "index_temporaryBasals_nightscoutId",
+ "unique": false,
+ "columnNames": [
+ "nightscoutId"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_temporaryBasals_nightscoutId` ON `${TABLE_NAME}` (`nightscoutId`)"
+ },
+ {
+ "name": "index_temporaryBasals_pumpType",
+ "unique": false,
+ "columnNames": [
+ "pumpType"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_temporaryBasals_pumpType` ON `${TABLE_NAME}` (`pumpType`)"
+ },
+ {
+ "name": "index_temporaryBasals_endId",
+ "unique": false,
+ "columnNames": [
+ "endId"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_temporaryBasals_endId` ON `${TABLE_NAME}` (`endId`)"
+ },
+ {
+ "name": "index_temporaryBasals_pumpSerial",
+ "unique": false,
+ "columnNames": [
+ "pumpSerial"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_temporaryBasals_pumpSerial` ON `${TABLE_NAME}` (`pumpSerial`)"
+ },
+ {
+ "name": "index_temporaryBasals_temporaryId",
+ "unique": false,
+ "columnNames": [
+ "temporaryId"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_temporaryBasals_temporaryId` ON `${TABLE_NAME}` (`temporaryId`)"
+ },
+ {
+ "name": "index_temporaryBasals_referenceId",
+ "unique": false,
+ "columnNames": [
+ "referenceId"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_temporaryBasals_referenceId` ON `${TABLE_NAME}` (`referenceId`)"
+ },
+ {
+ "name": "index_temporaryBasals_timestamp",
+ "unique": false,
+ "columnNames": [
+ "timestamp"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_temporaryBasals_timestamp` ON `${TABLE_NAME}` (`timestamp`)"
+ }
+ ],
+ "foreignKeys": [
+ {
+ "table": "temporaryBasals",
+ "onDelete": "NO ACTION",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "referenceId"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ }
+ ]
+ },
+ {
+ "tableName": "temporaryTargets",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `version` INTEGER NOT NULL, `dateCreated` INTEGER NOT NULL, `isValid` INTEGER NOT NULL, `referenceId` INTEGER, `timestamp` INTEGER NOT NULL, `utcOffset` INTEGER NOT NULL, `reason` TEXT NOT NULL, `highTarget` REAL NOT NULL, `lowTarget` REAL NOT NULL, `duration` INTEGER NOT NULL, `nightscoutSystemId` TEXT, `nightscoutId` TEXT, `pumpType` TEXT, `pumpSerial` TEXT, `temporaryId` INTEGER, `pumpId` INTEGER, `startId` INTEGER, `endId` INTEGER, FOREIGN KEY(`referenceId`) REFERENCES `temporaryTargets`(`id`) ON UPDATE NO ACTION ON DELETE NO ACTION )",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "version",
+ "columnName": "version",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "dateCreated",
+ "columnName": "dateCreated",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "isValid",
+ "columnName": "isValid",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "referenceId",
+ "columnName": "referenceId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "timestamp",
+ "columnName": "timestamp",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "utcOffset",
+ "columnName": "utcOffset",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "reason",
+ "columnName": "reason",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "highTarget",
+ "columnName": "highTarget",
+ "affinity": "REAL",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lowTarget",
+ "columnName": "lowTarget",
+ "affinity": "REAL",
+ "notNull": true
+ },
+ {
+ "fieldPath": "duration",
+ "columnName": "duration",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.nightscoutSystemId",
+ "columnName": "nightscoutSystemId",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.nightscoutId",
+ "columnName": "nightscoutId",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpType",
+ "columnName": "pumpType",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpSerial",
+ "columnName": "pumpSerial",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.temporaryId",
+ "columnName": "temporaryId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpId",
+ "columnName": "pumpId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.startId",
+ "columnName": "startId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.endId",
+ "columnName": "endId",
+ "affinity": "INTEGER",
+ "notNull": false
+ }
+ ],
+ "primaryKey": {
+ "columnNames": [
+ "id"
+ ],
+ "autoGenerate": true
+ },
+ "indices": [
+ {
+ "name": "index_temporaryTargets_id",
+ "unique": false,
+ "columnNames": [
+ "id"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_temporaryTargets_id` ON `${TABLE_NAME}` (`id`)"
+ },
+ {
+ "name": "index_temporaryTargets_isValid",
+ "unique": false,
+ "columnNames": [
+ "isValid"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_temporaryTargets_isValid` ON `${TABLE_NAME}` (`isValid`)"
+ },
+ {
+ "name": "index_temporaryTargets_nightscoutId",
+ "unique": false,
+ "columnNames": [
+ "nightscoutId"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_temporaryTargets_nightscoutId` ON `${TABLE_NAME}` (`nightscoutId`)"
+ },
+ {
+ "name": "index_temporaryTargets_referenceId",
+ "unique": false,
+ "columnNames": [
+ "referenceId"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_temporaryTargets_referenceId` ON `${TABLE_NAME}` (`referenceId`)"
+ },
+ {
+ "name": "index_temporaryTargets_timestamp",
+ "unique": false,
+ "columnNames": [
+ "timestamp"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_temporaryTargets_timestamp` ON `${TABLE_NAME}` (`timestamp`)"
+ }
+ ],
+ "foreignKeys": [
+ {
+ "table": "temporaryTargets",
+ "onDelete": "NO ACTION",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "referenceId"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ }
+ ]
+ },
+ {
+ "tableName": "therapyEvents",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `version` INTEGER NOT NULL, `dateCreated` INTEGER NOT NULL, `isValid` INTEGER NOT NULL, `referenceId` INTEGER, `timestamp` INTEGER NOT NULL, `utcOffset` INTEGER NOT NULL, `duration` INTEGER NOT NULL, `type` TEXT NOT NULL, `note` TEXT, `enteredBy` TEXT, `glucose` REAL, `glucoseType` TEXT, `glucoseUnit` TEXT NOT NULL, `nightscoutSystemId` TEXT, `nightscoutId` TEXT, `pumpType` TEXT, `pumpSerial` TEXT, `temporaryId` INTEGER, `pumpId` INTEGER, `startId` INTEGER, `endId` INTEGER, FOREIGN KEY(`referenceId`) REFERENCES `therapyEvents`(`id`) ON UPDATE NO ACTION ON DELETE NO ACTION )",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "version",
+ "columnName": "version",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "dateCreated",
+ "columnName": "dateCreated",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "isValid",
+ "columnName": "isValid",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "referenceId",
+ "columnName": "referenceId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "timestamp",
+ "columnName": "timestamp",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "utcOffset",
+ "columnName": "utcOffset",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "duration",
+ "columnName": "duration",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "type",
+ "columnName": "type",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "note",
+ "columnName": "note",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "enteredBy",
+ "columnName": "enteredBy",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "glucose",
+ "columnName": "glucose",
+ "affinity": "REAL",
+ "notNull": false
+ },
+ {
+ "fieldPath": "glucoseType",
+ "columnName": "glucoseType",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "glucoseUnit",
+ "columnName": "glucoseUnit",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.nightscoutSystemId",
+ "columnName": "nightscoutSystemId",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.nightscoutId",
+ "columnName": "nightscoutId",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpType",
+ "columnName": "pumpType",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpSerial",
+ "columnName": "pumpSerial",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.temporaryId",
+ "columnName": "temporaryId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpId",
+ "columnName": "pumpId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.startId",
+ "columnName": "startId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.endId",
+ "columnName": "endId",
+ "affinity": "INTEGER",
+ "notNull": false
+ }
+ ],
+ "primaryKey": {
+ "columnNames": [
+ "id"
+ ],
+ "autoGenerate": true
+ },
+ "indices": [
+ {
+ "name": "index_therapyEvents_id",
+ "unique": false,
+ "columnNames": [
+ "id"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_therapyEvents_id` ON `${TABLE_NAME}` (`id`)"
+ },
+ {
+ "name": "index_therapyEvents_type",
+ "unique": false,
+ "columnNames": [
+ "type"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_therapyEvents_type` ON `${TABLE_NAME}` (`type`)"
+ },
+ {
+ "name": "index_therapyEvents_nightscoutId",
+ "unique": false,
+ "columnNames": [
+ "nightscoutId"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_therapyEvents_nightscoutId` ON `${TABLE_NAME}` (`nightscoutId`)"
+ },
+ {
+ "name": "index_therapyEvents_isValid",
+ "unique": false,
+ "columnNames": [
+ "isValid"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_therapyEvents_isValid` ON `${TABLE_NAME}` (`isValid`)"
+ },
+ {
+ "name": "index_therapyEvents_referenceId",
+ "unique": false,
+ "columnNames": [
+ "referenceId"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_therapyEvents_referenceId` ON `${TABLE_NAME}` (`referenceId`)"
+ },
+ {
+ "name": "index_therapyEvents_timestamp",
+ "unique": false,
+ "columnNames": [
+ "timestamp"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_therapyEvents_timestamp` ON `${TABLE_NAME}` (`timestamp`)"
+ }
+ ],
+ "foreignKeys": [
+ {
+ "table": "therapyEvents",
+ "onDelete": "NO ACTION",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "referenceId"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ }
+ ]
+ },
+ {
+ "tableName": "totalDailyDoses",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `version` INTEGER NOT NULL, `dateCreated` INTEGER NOT NULL, `isValid` INTEGER NOT NULL, `referenceId` INTEGER, `timestamp` INTEGER NOT NULL, `utcOffset` INTEGER NOT NULL, `basalAmount` REAL NOT NULL, `bolusAmount` REAL NOT NULL, `totalAmount` REAL NOT NULL, `carbs` REAL NOT NULL, `nightscoutSystemId` TEXT, `nightscoutId` TEXT, `pumpType` TEXT, `pumpSerial` TEXT, `temporaryId` INTEGER, `pumpId` INTEGER, `startId` INTEGER, `endId` INTEGER, FOREIGN KEY(`referenceId`) REFERENCES `totalDailyDoses`(`id`) ON UPDATE NO ACTION ON DELETE NO ACTION )",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "version",
+ "columnName": "version",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "dateCreated",
+ "columnName": "dateCreated",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "isValid",
+ "columnName": "isValid",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "referenceId",
+ "columnName": "referenceId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "timestamp",
+ "columnName": "timestamp",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "utcOffset",
+ "columnName": "utcOffset",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "basalAmount",
+ "columnName": "basalAmount",
+ "affinity": "REAL",
+ "notNull": true
+ },
+ {
+ "fieldPath": "bolusAmount",
+ "columnName": "bolusAmount",
+ "affinity": "REAL",
+ "notNull": true
+ },
+ {
+ "fieldPath": "totalAmount",
+ "columnName": "totalAmount",
+ "affinity": "REAL",
+ "notNull": true
+ },
+ {
+ "fieldPath": "carbs",
+ "columnName": "carbs",
+ "affinity": "REAL",
+ "notNull": true
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.nightscoutSystemId",
+ "columnName": "nightscoutSystemId",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.nightscoutId",
+ "columnName": "nightscoutId",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpType",
+ "columnName": "pumpType",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpSerial",
+ "columnName": "pumpSerial",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.temporaryId",
+ "columnName": "temporaryId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpId",
+ "columnName": "pumpId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.startId",
+ "columnName": "startId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.endId",
+ "columnName": "endId",
+ "affinity": "INTEGER",
+ "notNull": false
+ }
+ ],
+ "primaryKey": {
+ "columnNames": [
+ "id"
+ ],
+ "autoGenerate": true
+ },
+ "indices": [
+ {
+ "name": "index_totalDailyDoses_id",
+ "unique": false,
+ "columnNames": [
+ "id"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_totalDailyDoses_id` ON `${TABLE_NAME}` (`id`)"
+ },
+ {
+ "name": "index_totalDailyDoses_pumpId",
+ "unique": false,
+ "columnNames": [
+ "pumpId"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_totalDailyDoses_pumpId` ON `${TABLE_NAME}` (`pumpId`)"
+ },
+ {
+ "name": "index_totalDailyDoses_pumpType",
+ "unique": false,
+ "columnNames": [
+ "pumpType"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_totalDailyDoses_pumpType` ON `${TABLE_NAME}` (`pumpType`)"
+ },
+ {
+ "name": "index_totalDailyDoses_pumpSerial",
+ "unique": false,
+ "columnNames": [
+ "pumpSerial"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_totalDailyDoses_pumpSerial` ON `${TABLE_NAME}` (`pumpSerial`)"
+ },
+ {
+ "name": "index_totalDailyDoses_isValid",
+ "unique": false,
+ "columnNames": [
+ "isValid"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_totalDailyDoses_isValid` ON `${TABLE_NAME}` (`isValid`)"
+ },
+ {
+ "name": "index_totalDailyDoses_referenceId",
+ "unique": false,
+ "columnNames": [
+ "referenceId"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_totalDailyDoses_referenceId` ON `${TABLE_NAME}` (`referenceId`)"
+ },
+ {
+ "name": "index_totalDailyDoses_timestamp",
+ "unique": false,
+ "columnNames": [
+ "timestamp"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_totalDailyDoses_timestamp` ON `${TABLE_NAME}` (`timestamp`)"
+ }
+ ],
+ "foreignKeys": [
+ {
+ "table": "totalDailyDoses",
+ "onDelete": "NO ACTION",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "referenceId"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ }
+ ]
+ },
+ {
+ "tableName": "apsResultLinks",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `version` INTEGER NOT NULL, `dateCreated` INTEGER NOT NULL, `isValid` INTEGER NOT NULL, `referenceId` INTEGER, `apsResultId` INTEGER NOT NULL, `smbId` INTEGER, `tbrId` INTEGER, `nightscoutSystemId` TEXT, `nightscoutId` TEXT, `pumpType` TEXT, `pumpSerial` TEXT, `temporaryId` INTEGER, `pumpId` INTEGER, `startId` INTEGER, `endId` INTEGER, FOREIGN KEY(`apsResultId`) REFERENCES `apsResults`(`id`) ON UPDATE NO ACTION ON DELETE NO ACTION , FOREIGN KEY(`smbId`) REFERENCES `boluses`(`id`) ON UPDATE NO ACTION ON DELETE NO ACTION , FOREIGN KEY(`tbrId`) REFERENCES `temporaryBasals`(`id`) ON UPDATE NO ACTION ON DELETE NO ACTION , FOREIGN KEY(`referenceId`) REFERENCES `apsResultLinks`(`id`) ON UPDATE NO ACTION ON DELETE NO ACTION )",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "version",
+ "columnName": "version",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "dateCreated",
+ "columnName": "dateCreated",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "isValid",
+ "columnName": "isValid",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "referenceId",
+ "columnName": "referenceId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "apsResultId",
+ "columnName": "apsResultId",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "smbId",
+ "columnName": "smbId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "tbrId",
+ "columnName": "tbrId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.nightscoutSystemId",
+ "columnName": "nightscoutSystemId",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.nightscoutId",
+ "columnName": "nightscoutId",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpType",
+ "columnName": "pumpType",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpSerial",
+ "columnName": "pumpSerial",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.temporaryId",
+ "columnName": "temporaryId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpId",
+ "columnName": "pumpId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.startId",
+ "columnName": "startId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.endId",
+ "columnName": "endId",
+ "affinity": "INTEGER",
+ "notNull": false
+ }
+ ],
+ "primaryKey": {
+ "columnNames": [
+ "id"
+ ],
+ "autoGenerate": true
+ },
+ "indices": [
+ {
+ "name": "index_apsResultLinks_referenceId",
+ "unique": false,
+ "columnNames": [
+ "referenceId"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_apsResultLinks_referenceId` ON `${TABLE_NAME}` (`referenceId`)"
+ },
+ {
+ "name": "index_apsResultLinks_apsResultId",
+ "unique": false,
+ "columnNames": [
+ "apsResultId"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_apsResultLinks_apsResultId` ON `${TABLE_NAME}` (`apsResultId`)"
+ },
+ {
+ "name": "index_apsResultLinks_smbId",
+ "unique": false,
+ "columnNames": [
+ "smbId"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_apsResultLinks_smbId` ON `${TABLE_NAME}` (`smbId`)"
+ },
+ {
+ "name": "index_apsResultLinks_tbrId",
+ "unique": false,
+ "columnNames": [
+ "tbrId"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_apsResultLinks_tbrId` ON `${TABLE_NAME}` (`tbrId`)"
+ }
+ ],
+ "foreignKeys": [
+ {
+ "table": "apsResults",
+ "onDelete": "NO ACTION",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "apsResultId"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ },
+ {
+ "table": "boluses",
+ "onDelete": "NO ACTION",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "smbId"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ },
+ {
+ "table": "temporaryBasals",
+ "onDelete": "NO ACTION",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "tbrId"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ },
+ {
+ "table": "apsResultLinks",
+ "onDelete": "NO ACTION",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "referenceId"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ }
+ ]
+ },
+ {
+ "tableName": "multiwaveBolusLinks",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `version` INTEGER NOT NULL, `dateCreated` INTEGER NOT NULL, `isValid` INTEGER NOT NULL, `referenceId` INTEGER, `bolusId` INTEGER NOT NULL, `extendedBolusId` INTEGER NOT NULL, `nightscoutSystemId` TEXT, `nightscoutId` TEXT, `pumpType` TEXT, `pumpSerial` TEXT, `temporaryId` INTEGER, `pumpId` INTEGER, `startId` INTEGER, `endId` INTEGER, FOREIGN KEY(`bolusId`) REFERENCES `boluses`(`id`) ON UPDATE NO ACTION ON DELETE NO ACTION , FOREIGN KEY(`extendedBolusId`) REFERENCES `extendedBoluses`(`id`) ON UPDATE NO ACTION ON DELETE NO ACTION , FOREIGN KEY(`referenceId`) REFERENCES `multiwaveBolusLinks`(`id`) ON UPDATE NO ACTION ON DELETE NO ACTION )",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "version",
+ "columnName": "version",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "dateCreated",
+ "columnName": "dateCreated",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "isValid",
+ "columnName": "isValid",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "referenceId",
+ "columnName": "referenceId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "bolusId",
+ "columnName": "bolusId",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "extendedBolusId",
+ "columnName": "extendedBolusId",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.nightscoutSystemId",
+ "columnName": "nightscoutSystemId",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.nightscoutId",
+ "columnName": "nightscoutId",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpType",
+ "columnName": "pumpType",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpSerial",
+ "columnName": "pumpSerial",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.temporaryId",
+ "columnName": "temporaryId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpId",
+ "columnName": "pumpId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.startId",
+ "columnName": "startId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.endId",
+ "columnName": "endId",
+ "affinity": "INTEGER",
+ "notNull": false
+ }
+ ],
+ "primaryKey": {
+ "columnNames": [
+ "id"
+ ],
+ "autoGenerate": true
+ },
+ "indices": [
+ {
+ "name": "index_multiwaveBolusLinks_referenceId",
+ "unique": false,
+ "columnNames": [
+ "referenceId"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_multiwaveBolusLinks_referenceId` ON `${TABLE_NAME}` (`referenceId`)"
+ },
+ {
+ "name": "index_multiwaveBolusLinks_bolusId",
+ "unique": false,
+ "columnNames": [
+ "bolusId"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_multiwaveBolusLinks_bolusId` ON `${TABLE_NAME}` (`bolusId`)"
+ },
+ {
+ "name": "index_multiwaveBolusLinks_extendedBolusId",
+ "unique": false,
+ "columnNames": [
+ "extendedBolusId"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_multiwaveBolusLinks_extendedBolusId` ON `${TABLE_NAME}` (`extendedBolusId`)"
+ }
+ ],
+ "foreignKeys": [
+ {
+ "table": "boluses",
+ "onDelete": "NO ACTION",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "bolusId"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ },
+ {
+ "table": "extendedBoluses",
+ "onDelete": "NO ACTION",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "extendedBolusId"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ },
+ {
+ "table": "multiwaveBolusLinks",
+ "onDelete": "NO ACTION",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "referenceId"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ }
+ ]
+ },
+ {
+ "tableName": "preferenceChanges",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `timestamp` INTEGER NOT NULL, `utcOffset` INTEGER NOT NULL, `key` TEXT NOT NULL, `value` TEXT)",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "timestamp",
+ "columnName": "timestamp",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "utcOffset",
+ "columnName": "utcOffset",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "key",
+ "columnName": "key",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "value",
+ "columnName": "value",
+ "affinity": "TEXT",
+ "notNull": false
+ }
+ ],
+ "primaryKey": {
+ "columnNames": [
+ "id"
+ ],
+ "autoGenerate": true
+ },
+ "indices": [],
+ "foreignKeys": []
+ },
+ {
+ "tableName": "versionChanges",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `timestamp` INTEGER NOT NULL, `utcOffset` INTEGER NOT NULL, `versionCode` INTEGER NOT NULL, `versionName` TEXT NOT NULL, `gitRemote` TEXT, `commitHash` TEXT)",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "timestamp",
+ "columnName": "timestamp",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "utcOffset",
+ "columnName": "utcOffset",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "versionCode",
+ "columnName": "versionCode",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "versionName",
+ "columnName": "versionName",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "gitRemote",
+ "columnName": "gitRemote",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "commitHash",
+ "columnName": "commitHash",
+ "affinity": "TEXT",
+ "notNull": false
+ }
+ ],
+ "primaryKey": {
+ "columnNames": [
+ "id"
+ ],
+ "autoGenerate": true
+ },
+ "indices": [],
+ "foreignKeys": []
+ },
+ {
+ "tableName": "userEntry",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `timestamp` INTEGER NOT NULL, `utcOffset` INTEGER NOT NULL, `action` TEXT NOT NULL, `source` TEXT NOT NULL, `note` TEXT NOT NULL, `values` TEXT NOT NULL)",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "timestamp",
+ "columnName": "timestamp",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "utcOffset",
+ "columnName": "utcOffset",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "action",
+ "columnName": "action",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "source",
+ "columnName": "source",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "note",
+ "columnName": "note",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "values",
+ "columnName": "values",
+ "affinity": "TEXT",
+ "notNull": true
+ }
+ ],
+ "primaryKey": {
+ "columnNames": [
+ "id"
+ ],
+ "autoGenerate": true
+ },
+ "indices": [
+ {
+ "name": "index_userEntry_source",
+ "unique": false,
+ "columnNames": [
+ "source"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_userEntry_source` ON `${TABLE_NAME}` (`source`)"
+ },
+ {
+ "name": "index_userEntry_timestamp",
+ "unique": false,
+ "columnNames": [
+ "timestamp"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_userEntry_timestamp` ON `${TABLE_NAME}` (`timestamp`)"
+ }
+ ],
+ "foreignKeys": []
+ },
+ {
+ "tableName": "foods",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `version` INTEGER NOT NULL, `dateCreated` INTEGER NOT NULL, `isValid` INTEGER NOT NULL, `referenceId` INTEGER, `name` TEXT NOT NULL, `category` TEXT, `subCategory` TEXT, `portion` REAL NOT NULL, `carbs` INTEGER NOT NULL, `fat` INTEGER, `protein` INTEGER, `energy` INTEGER, `unit` TEXT NOT NULL, `gi` INTEGER, `nightscoutSystemId` TEXT, `nightscoutId` TEXT, `pumpType` TEXT, `pumpSerial` TEXT, `temporaryId` INTEGER, `pumpId` INTEGER, `startId` INTEGER, `endId` INTEGER, FOREIGN KEY(`referenceId`) REFERENCES `foods`(`id`) ON UPDATE NO ACTION ON DELETE NO ACTION )",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "version",
+ "columnName": "version",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "dateCreated",
+ "columnName": "dateCreated",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "isValid",
+ "columnName": "isValid",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "referenceId",
+ "columnName": "referenceId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "name",
+ "columnName": "name",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "category",
+ "columnName": "category",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "subCategory",
+ "columnName": "subCategory",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "portion",
+ "columnName": "portion",
+ "affinity": "REAL",
+ "notNull": true
+ },
+ {
+ "fieldPath": "carbs",
+ "columnName": "carbs",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "fat",
+ "columnName": "fat",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "protein",
+ "columnName": "protein",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "energy",
+ "columnName": "energy",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "unit",
+ "columnName": "unit",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "gi",
+ "columnName": "gi",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.nightscoutSystemId",
+ "columnName": "nightscoutSystemId",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.nightscoutId",
+ "columnName": "nightscoutId",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpType",
+ "columnName": "pumpType",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpSerial",
+ "columnName": "pumpSerial",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.temporaryId",
+ "columnName": "temporaryId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpId",
+ "columnName": "pumpId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.startId",
+ "columnName": "startId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.endId",
+ "columnName": "endId",
+ "affinity": "INTEGER",
+ "notNull": false
+ }
+ ],
+ "primaryKey": {
+ "columnNames": [
+ "id"
+ ],
+ "autoGenerate": true
+ },
+ "indices": [
+ {
+ "name": "index_foods_id",
+ "unique": false,
+ "columnNames": [
+ "id"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_foods_id` ON `${TABLE_NAME}` (`id`)"
+ },
+ {
+ "name": "index_foods_nightscoutId",
+ "unique": false,
+ "columnNames": [
+ "nightscoutId"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_foods_nightscoutId` ON `${TABLE_NAME}` (`nightscoutId`)"
+ },
+ {
+ "name": "index_foods_referenceId",
+ "unique": false,
+ "columnNames": [
+ "referenceId"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_foods_referenceId` ON `${TABLE_NAME}` (`referenceId`)"
+ },
+ {
+ "name": "index_foods_isValid",
+ "unique": false,
+ "columnNames": [
+ "isValid"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_foods_isValid` ON `${TABLE_NAME}` (`isValid`)"
+ }
+ ],
+ "foreignKeys": [
+ {
+ "table": "foods",
+ "onDelete": "NO ACTION",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "referenceId"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ }
+ ]
+ },
+ {
+ "tableName": "deviceStatus",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `timestamp` INTEGER NOT NULL, `utcOffset` INTEGER NOT NULL, `device` TEXT, `pump` TEXT, `enacted` TEXT, `suggested` TEXT, `iob` TEXT, `uploaderBattery` INTEGER NOT NULL, `configuration` TEXT, `nightscoutSystemId` TEXT, `nightscoutId` TEXT, `pumpType` TEXT, `pumpSerial` TEXT, `temporaryId` INTEGER, `pumpId` INTEGER, `startId` INTEGER, `endId` INTEGER)",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "timestamp",
+ "columnName": "timestamp",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "utcOffset",
+ "columnName": "utcOffset",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "device",
+ "columnName": "device",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "pump",
+ "columnName": "pump",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "enacted",
+ "columnName": "enacted",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "suggested",
+ "columnName": "suggested",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "iob",
+ "columnName": "iob",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "uploaderBattery",
+ "columnName": "uploaderBattery",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "configuration",
+ "columnName": "configuration",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.nightscoutSystemId",
+ "columnName": "nightscoutSystemId",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.nightscoutId",
+ "columnName": "nightscoutId",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpType",
+ "columnName": "pumpType",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpSerial",
+ "columnName": "pumpSerial",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.temporaryId",
+ "columnName": "temporaryId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpId",
+ "columnName": "pumpId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.startId",
+ "columnName": "startId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.endId",
+ "columnName": "endId",
+ "affinity": "INTEGER",
+ "notNull": false
+ }
+ ],
+ "primaryKey": {
+ "columnNames": [
+ "id"
+ ],
+ "autoGenerate": true
+ },
+ "indices": [
+ {
+ "name": "index_deviceStatus_id",
+ "unique": false,
+ "columnNames": [
+ "id"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_deviceStatus_id` ON `${TABLE_NAME}` (`id`)"
+ },
+ {
+ "name": "index_deviceStatus_nightscoutId",
+ "unique": false,
+ "columnNames": [
+ "nightscoutId"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_deviceStatus_nightscoutId` ON `${TABLE_NAME}` (`nightscoutId`)"
+ },
+ {
+ "name": "index_deviceStatus_timestamp",
+ "unique": false,
+ "columnNames": [
+ "timestamp"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_deviceStatus_timestamp` ON `${TABLE_NAME}` (`timestamp`)"
+ }
+ ],
+ "foreignKeys": []
+ }
+ ],
+ "views": [],
+ "setupQueries": [
+ "CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)",
+ "INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, '9d3f2becffaecc2ee9508749be498ae4')"
+ ]
+ }
+}
\ No newline at end of file
diff --git a/database/schemas/info.nightscout.androidaps.database.AppDatabase/21.json b/database/schemas/info.nightscout.androidaps.database.AppDatabase/21.json
new file mode 100644
index 0000000000..383ec7b2ae
--- /dev/null
+++ b/database/schemas/info.nightscout.androidaps.database.AppDatabase/21.json
@@ -0,0 +1,3593 @@
+{
+ "formatVersion": 1,
+ "database": {
+ "version": 21,
+ "identityHash": "e3558dc3bb3136c37dba4f90c97e8bdd",
+ "entities": [
+ {
+ "tableName": "apsResults",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `version` INTEGER NOT NULL, `dateCreated` INTEGER NOT NULL, `isValid` INTEGER NOT NULL, `referenceId` INTEGER, `timestamp` INTEGER NOT NULL, `utcOffset` INTEGER NOT NULL, `algorithm` TEXT NOT NULL, `glucoseStatusJson` TEXT NOT NULL, `currentTempJson` TEXT NOT NULL, `iobDataJson` TEXT NOT NULL, `profileJson` TEXT NOT NULL, `autosensDataJson` TEXT, `mealDataJson` TEXT NOT NULL, `isMicroBolusAllowed` INTEGER, `resultJson` TEXT NOT NULL, `nightscoutSystemId` TEXT, `nightscoutId` TEXT, `pumpType` TEXT, `pumpSerial` TEXT, `temporaryId` INTEGER, `pumpId` INTEGER, `startId` INTEGER, `endId` INTEGER, FOREIGN KEY(`referenceId`) REFERENCES `apsResults`(`id`) ON UPDATE NO ACTION ON DELETE NO ACTION )",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "version",
+ "columnName": "version",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "dateCreated",
+ "columnName": "dateCreated",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "isValid",
+ "columnName": "isValid",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "referenceId",
+ "columnName": "referenceId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "timestamp",
+ "columnName": "timestamp",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "utcOffset",
+ "columnName": "utcOffset",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "algorithm",
+ "columnName": "algorithm",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "glucoseStatusJson",
+ "columnName": "glucoseStatusJson",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "currentTempJson",
+ "columnName": "currentTempJson",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "iobDataJson",
+ "columnName": "iobDataJson",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "profileJson",
+ "columnName": "profileJson",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "autosensDataJson",
+ "columnName": "autosensDataJson",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "mealDataJson",
+ "columnName": "mealDataJson",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "isMicroBolusAllowed",
+ "columnName": "isMicroBolusAllowed",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "resultJson",
+ "columnName": "resultJson",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.nightscoutSystemId",
+ "columnName": "nightscoutSystemId",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.nightscoutId",
+ "columnName": "nightscoutId",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpType",
+ "columnName": "pumpType",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpSerial",
+ "columnName": "pumpSerial",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.temporaryId",
+ "columnName": "temporaryId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpId",
+ "columnName": "pumpId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.startId",
+ "columnName": "startId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.endId",
+ "columnName": "endId",
+ "affinity": "INTEGER",
+ "notNull": false
+ }
+ ],
+ "primaryKey": {
+ "columnNames": [
+ "id"
+ ],
+ "autoGenerate": true
+ },
+ "indices": [
+ {
+ "name": "index_apsResults_referenceId",
+ "unique": false,
+ "columnNames": [
+ "referenceId"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_apsResults_referenceId` ON `${TABLE_NAME}` (`referenceId`)"
+ },
+ {
+ "name": "index_apsResults_timestamp",
+ "unique": false,
+ "columnNames": [
+ "timestamp"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_apsResults_timestamp` ON `${TABLE_NAME}` (`timestamp`)"
+ }
+ ],
+ "foreignKeys": [
+ {
+ "table": "apsResults",
+ "onDelete": "NO ACTION",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "referenceId"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ }
+ ]
+ },
+ {
+ "tableName": "boluses",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `version` INTEGER NOT NULL, `dateCreated` INTEGER NOT NULL, `isValid` INTEGER NOT NULL, `referenceId` INTEGER, `timestamp` INTEGER NOT NULL, `utcOffset` INTEGER NOT NULL, `amount` REAL NOT NULL, `type` TEXT NOT NULL, `isBasalInsulin` INTEGER NOT NULL, `nightscoutSystemId` TEXT, `nightscoutId` TEXT, `pumpType` TEXT, `pumpSerial` TEXT, `temporaryId` INTEGER, `pumpId` INTEGER, `startId` INTEGER, `endId` INTEGER, `insulinLabel` TEXT, `insulinEndTime` INTEGER, `peak` INTEGER, FOREIGN KEY(`referenceId`) REFERENCES `boluses`(`id`) ON UPDATE NO ACTION ON DELETE NO ACTION )",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "version",
+ "columnName": "version",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "dateCreated",
+ "columnName": "dateCreated",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "isValid",
+ "columnName": "isValid",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "referenceId",
+ "columnName": "referenceId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "timestamp",
+ "columnName": "timestamp",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "utcOffset",
+ "columnName": "utcOffset",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "amount",
+ "columnName": "amount",
+ "affinity": "REAL",
+ "notNull": true
+ },
+ {
+ "fieldPath": "type",
+ "columnName": "type",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "isBasalInsulin",
+ "columnName": "isBasalInsulin",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.nightscoutSystemId",
+ "columnName": "nightscoutSystemId",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.nightscoutId",
+ "columnName": "nightscoutId",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpType",
+ "columnName": "pumpType",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpSerial",
+ "columnName": "pumpSerial",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.temporaryId",
+ "columnName": "temporaryId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpId",
+ "columnName": "pumpId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.startId",
+ "columnName": "startId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.endId",
+ "columnName": "endId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "insulinConfiguration.insulinLabel",
+ "columnName": "insulinLabel",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "insulinConfiguration.insulinEndTime",
+ "columnName": "insulinEndTime",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "insulinConfiguration.peak",
+ "columnName": "peak",
+ "affinity": "INTEGER",
+ "notNull": false
+ }
+ ],
+ "primaryKey": {
+ "columnNames": [
+ "id"
+ ],
+ "autoGenerate": true
+ },
+ "indices": [
+ {
+ "name": "index_boluses_id",
+ "unique": false,
+ "columnNames": [
+ "id"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_boluses_id` ON `${TABLE_NAME}` (`id`)"
+ },
+ {
+ "name": "index_boluses_isValid",
+ "unique": false,
+ "columnNames": [
+ "isValid"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_boluses_isValid` ON `${TABLE_NAME}` (`isValid`)"
+ },
+ {
+ "name": "index_boluses_temporaryId",
+ "unique": false,
+ "columnNames": [
+ "temporaryId"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_boluses_temporaryId` ON `${TABLE_NAME}` (`temporaryId`)"
+ },
+ {
+ "name": "index_boluses_pumpId",
+ "unique": false,
+ "columnNames": [
+ "pumpId"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_boluses_pumpId` ON `${TABLE_NAME}` (`pumpId`)"
+ },
+ {
+ "name": "index_boluses_pumpSerial",
+ "unique": false,
+ "columnNames": [
+ "pumpSerial"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_boluses_pumpSerial` ON `${TABLE_NAME}` (`pumpSerial`)"
+ },
+ {
+ "name": "index_boluses_pumpType",
+ "unique": false,
+ "columnNames": [
+ "pumpType"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_boluses_pumpType` ON `${TABLE_NAME}` (`pumpType`)"
+ },
+ {
+ "name": "index_boluses_referenceId",
+ "unique": false,
+ "columnNames": [
+ "referenceId"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_boluses_referenceId` ON `${TABLE_NAME}` (`referenceId`)"
+ },
+ {
+ "name": "index_boluses_timestamp",
+ "unique": false,
+ "columnNames": [
+ "timestamp"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_boluses_timestamp` ON `${TABLE_NAME}` (`timestamp`)"
+ }
+ ],
+ "foreignKeys": [
+ {
+ "table": "boluses",
+ "onDelete": "NO ACTION",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "referenceId"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ }
+ ]
+ },
+ {
+ "tableName": "bolusCalculatorResults",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `version` INTEGER NOT NULL, `dateCreated` INTEGER NOT NULL, `isValid` INTEGER NOT NULL, `referenceId` INTEGER, `timestamp` INTEGER NOT NULL, `utcOffset` INTEGER NOT NULL, `targetBGLow` REAL NOT NULL, `targetBGHigh` REAL NOT NULL, `isf` REAL NOT NULL, `ic` REAL NOT NULL, `bolusIOB` REAL NOT NULL, `wasBolusIOBUsed` INTEGER NOT NULL, `basalIOB` REAL NOT NULL, `wasBasalIOBUsed` INTEGER NOT NULL, `glucoseValue` REAL NOT NULL, `wasGlucoseUsed` INTEGER NOT NULL, `glucoseDifference` REAL NOT NULL, `glucoseInsulin` REAL NOT NULL, `glucoseTrend` REAL NOT NULL, `wasTrendUsed` INTEGER NOT NULL, `trendInsulin` REAL NOT NULL, `cob` REAL NOT NULL, `wasCOBUsed` INTEGER NOT NULL, `cobInsulin` REAL NOT NULL, `carbs` REAL NOT NULL, `wereCarbsUsed` INTEGER NOT NULL, `carbsInsulin` REAL NOT NULL, `otherCorrection` REAL NOT NULL, `wasSuperbolusUsed` INTEGER NOT NULL, `superbolusInsulin` REAL NOT NULL, `wasTempTargetUsed` INTEGER NOT NULL, `totalInsulin` REAL NOT NULL, `percentageCorrection` INTEGER NOT NULL, `profileName` TEXT NOT NULL, `note` TEXT NOT NULL, `nightscoutSystemId` TEXT, `nightscoutId` TEXT, `pumpType` TEXT, `pumpSerial` TEXT, `temporaryId` INTEGER, `pumpId` INTEGER, `startId` INTEGER, `endId` INTEGER, FOREIGN KEY(`referenceId`) REFERENCES `bolusCalculatorResults`(`id`) ON UPDATE NO ACTION ON DELETE NO ACTION )",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "version",
+ "columnName": "version",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "dateCreated",
+ "columnName": "dateCreated",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "isValid",
+ "columnName": "isValid",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "referenceId",
+ "columnName": "referenceId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "timestamp",
+ "columnName": "timestamp",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "utcOffset",
+ "columnName": "utcOffset",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "targetBGLow",
+ "columnName": "targetBGLow",
+ "affinity": "REAL",
+ "notNull": true
+ },
+ {
+ "fieldPath": "targetBGHigh",
+ "columnName": "targetBGHigh",
+ "affinity": "REAL",
+ "notNull": true
+ },
+ {
+ "fieldPath": "isf",
+ "columnName": "isf",
+ "affinity": "REAL",
+ "notNull": true
+ },
+ {
+ "fieldPath": "ic",
+ "columnName": "ic",
+ "affinity": "REAL",
+ "notNull": true
+ },
+ {
+ "fieldPath": "bolusIOB",
+ "columnName": "bolusIOB",
+ "affinity": "REAL",
+ "notNull": true
+ },
+ {
+ "fieldPath": "wasBolusIOBUsed",
+ "columnName": "wasBolusIOBUsed",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "basalIOB",
+ "columnName": "basalIOB",
+ "affinity": "REAL",
+ "notNull": true
+ },
+ {
+ "fieldPath": "wasBasalIOBUsed",
+ "columnName": "wasBasalIOBUsed",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "glucoseValue",
+ "columnName": "glucoseValue",
+ "affinity": "REAL",
+ "notNull": true
+ },
+ {
+ "fieldPath": "wasGlucoseUsed",
+ "columnName": "wasGlucoseUsed",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "glucoseDifference",
+ "columnName": "glucoseDifference",
+ "affinity": "REAL",
+ "notNull": true
+ },
+ {
+ "fieldPath": "glucoseInsulin",
+ "columnName": "glucoseInsulin",
+ "affinity": "REAL",
+ "notNull": true
+ },
+ {
+ "fieldPath": "glucoseTrend",
+ "columnName": "glucoseTrend",
+ "affinity": "REAL",
+ "notNull": true
+ },
+ {
+ "fieldPath": "wasTrendUsed",
+ "columnName": "wasTrendUsed",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "trendInsulin",
+ "columnName": "trendInsulin",
+ "affinity": "REAL",
+ "notNull": true
+ },
+ {
+ "fieldPath": "cob",
+ "columnName": "cob",
+ "affinity": "REAL",
+ "notNull": true
+ },
+ {
+ "fieldPath": "wasCOBUsed",
+ "columnName": "wasCOBUsed",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "cobInsulin",
+ "columnName": "cobInsulin",
+ "affinity": "REAL",
+ "notNull": true
+ },
+ {
+ "fieldPath": "carbs",
+ "columnName": "carbs",
+ "affinity": "REAL",
+ "notNull": true
+ },
+ {
+ "fieldPath": "wereCarbsUsed",
+ "columnName": "wereCarbsUsed",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "carbsInsulin",
+ "columnName": "carbsInsulin",
+ "affinity": "REAL",
+ "notNull": true
+ },
+ {
+ "fieldPath": "otherCorrection",
+ "columnName": "otherCorrection",
+ "affinity": "REAL",
+ "notNull": true
+ },
+ {
+ "fieldPath": "wasSuperbolusUsed",
+ "columnName": "wasSuperbolusUsed",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "superbolusInsulin",
+ "columnName": "superbolusInsulin",
+ "affinity": "REAL",
+ "notNull": true
+ },
+ {
+ "fieldPath": "wasTempTargetUsed",
+ "columnName": "wasTempTargetUsed",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "totalInsulin",
+ "columnName": "totalInsulin",
+ "affinity": "REAL",
+ "notNull": true
+ },
+ {
+ "fieldPath": "percentageCorrection",
+ "columnName": "percentageCorrection",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "profileName",
+ "columnName": "profileName",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "note",
+ "columnName": "note",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.nightscoutSystemId",
+ "columnName": "nightscoutSystemId",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.nightscoutId",
+ "columnName": "nightscoutId",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpType",
+ "columnName": "pumpType",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpSerial",
+ "columnName": "pumpSerial",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.temporaryId",
+ "columnName": "temporaryId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpId",
+ "columnName": "pumpId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.startId",
+ "columnName": "startId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.endId",
+ "columnName": "endId",
+ "affinity": "INTEGER",
+ "notNull": false
+ }
+ ],
+ "primaryKey": {
+ "columnNames": [
+ "id"
+ ],
+ "autoGenerate": true
+ },
+ "indices": [
+ {
+ "name": "index_bolusCalculatorResults_referenceId",
+ "unique": false,
+ "columnNames": [
+ "referenceId"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_bolusCalculatorResults_referenceId` ON `${TABLE_NAME}` (`referenceId`)"
+ },
+ {
+ "name": "index_bolusCalculatorResults_timestamp",
+ "unique": false,
+ "columnNames": [
+ "timestamp"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_bolusCalculatorResults_timestamp` ON `${TABLE_NAME}` (`timestamp`)"
+ },
+ {
+ "name": "index_bolusCalculatorResults_id",
+ "unique": false,
+ "columnNames": [
+ "id"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_bolusCalculatorResults_id` ON `${TABLE_NAME}` (`id`)"
+ },
+ {
+ "name": "index_bolusCalculatorResults_isValid",
+ "unique": false,
+ "columnNames": [
+ "isValid"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_bolusCalculatorResults_isValid` ON `${TABLE_NAME}` (`isValid`)"
+ }
+ ],
+ "foreignKeys": [
+ {
+ "table": "bolusCalculatorResults",
+ "onDelete": "NO ACTION",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "referenceId"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ }
+ ]
+ },
+ {
+ "tableName": "carbs",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `version` INTEGER NOT NULL, `dateCreated` INTEGER NOT NULL, `isValid` INTEGER NOT NULL, `referenceId` INTEGER, `timestamp` INTEGER NOT NULL, `utcOffset` INTEGER NOT NULL, `duration` INTEGER NOT NULL, `amount` REAL NOT NULL, `nightscoutSystemId` TEXT, `nightscoutId` TEXT, `pumpType` TEXT, `pumpSerial` TEXT, `temporaryId` INTEGER, `pumpId` INTEGER, `startId` INTEGER, `endId` INTEGER, FOREIGN KEY(`referenceId`) REFERENCES `carbs`(`id`) ON UPDATE NO ACTION ON DELETE NO ACTION )",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "version",
+ "columnName": "version",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "dateCreated",
+ "columnName": "dateCreated",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "isValid",
+ "columnName": "isValid",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "referenceId",
+ "columnName": "referenceId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "timestamp",
+ "columnName": "timestamp",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "utcOffset",
+ "columnName": "utcOffset",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "duration",
+ "columnName": "duration",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "amount",
+ "columnName": "amount",
+ "affinity": "REAL",
+ "notNull": true
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.nightscoutSystemId",
+ "columnName": "nightscoutSystemId",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.nightscoutId",
+ "columnName": "nightscoutId",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpType",
+ "columnName": "pumpType",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpSerial",
+ "columnName": "pumpSerial",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.temporaryId",
+ "columnName": "temporaryId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpId",
+ "columnName": "pumpId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.startId",
+ "columnName": "startId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.endId",
+ "columnName": "endId",
+ "affinity": "INTEGER",
+ "notNull": false
+ }
+ ],
+ "primaryKey": {
+ "columnNames": [
+ "id"
+ ],
+ "autoGenerate": true
+ },
+ "indices": [
+ {
+ "name": "index_carbs_id",
+ "unique": false,
+ "columnNames": [
+ "id"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_carbs_id` ON `${TABLE_NAME}` (`id`)"
+ },
+ {
+ "name": "index_carbs_isValid",
+ "unique": false,
+ "columnNames": [
+ "isValid"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_carbs_isValid` ON `${TABLE_NAME}` (`isValid`)"
+ },
+ {
+ "name": "index_carbs_nightscoutId",
+ "unique": false,
+ "columnNames": [
+ "nightscoutId"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_carbs_nightscoutId` ON `${TABLE_NAME}` (`nightscoutId`)"
+ },
+ {
+ "name": "index_carbs_referenceId",
+ "unique": false,
+ "columnNames": [
+ "referenceId"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_carbs_referenceId` ON `${TABLE_NAME}` (`referenceId`)"
+ },
+ {
+ "name": "index_carbs_timestamp",
+ "unique": false,
+ "columnNames": [
+ "timestamp"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_carbs_timestamp` ON `${TABLE_NAME}` (`timestamp`)"
+ }
+ ],
+ "foreignKeys": [
+ {
+ "table": "carbs",
+ "onDelete": "NO ACTION",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "referenceId"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ }
+ ]
+ },
+ {
+ "tableName": "effectiveProfileSwitches",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `version` INTEGER NOT NULL, `dateCreated` INTEGER NOT NULL, `isValid` INTEGER NOT NULL, `referenceId` INTEGER, `timestamp` INTEGER NOT NULL, `utcOffset` INTEGER NOT NULL, `basalBlocks` TEXT NOT NULL, `isfBlocks` TEXT NOT NULL, `icBlocks` TEXT NOT NULL, `targetBlocks` TEXT NOT NULL, `glucoseUnit` TEXT NOT NULL, `originalProfileName` TEXT NOT NULL, `originalCustomizedName` TEXT NOT NULL, `originalTimeshift` INTEGER NOT NULL, `originalPercentage` INTEGER NOT NULL, `originalDuration` INTEGER NOT NULL, `originalEnd` INTEGER NOT NULL, `nightscoutSystemId` TEXT, `nightscoutId` TEXT, `pumpType` TEXT, `pumpSerial` TEXT, `temporaryId` INTEGER, `pumpId` INTEGER, `startId` INTEGER, `endId` INTEGER, `insulinLabel` TEXT NOT NULL, `insulinEndTime` INTEGER NOT NULL, `peak` INTEGER NOT NULL, FOREIGN KEY(`referenceId`) REFERENCES `effectiveProfileSwitches`(`id`) ON UPDATE NO ACTION ON DELETE NO ACTION )",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "version",
+ "columnName": "version",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "dateCreated",
+ "columnName": "dateCreated",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "isValid",
+ "columnName": "isValid",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "referenceId",
+ "columnName": "referenceId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "timestamp",
+ "columnName": "timestamp",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "utcOffset",
+ "columnName": "utcOffset",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "basalBlocks",
+ "columnName": "basalBlocks",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "isfBlocks",
+ "columnName": "isfBlocks",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "icBlocks",
+ "columnName": "icBlocks",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "targetBlocks",
+ "columnName": "targetBlocks",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "glucoseUnit",
+ "columnName": "glucoseUnit",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "originalProfileName",
+ "columnName": "originalProfileName",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "originalCustomizedName",
+ "columnName": "originalCustomizedName",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "originalTimeshift",
+ "columnName": "originalTimeshift",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "originalPercentage",
+ "columnName": "originalPercentage",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "originalDuration",
+ "columnName": "originalDuration",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "originalEnd",
+ "columnName": "originalEnd",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.nightscoutSystemId",
+ "columnName": "nightscoutSystemId",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.nightscoutId",
+ "columnName": "nightscoutId",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpType",
+ "columnName": "pumpType",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpSerial",
+ "columnName": "pumpSerial",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.temporaryId",
+ "columnName": "temporaryId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpId",
+ "columnName": "pumpId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.startId",
+ "columnName": "startId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.endId",
+ "columnName": "endId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "insulinConfiguration.insulinLabel",
+ "columnName": "insulinLabel",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "insulinConfiguration.insulinEndTime",
+ "columnName": "insulinEndTime",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "insulinConfiguration.peak",
+ "columnName": "peak",
+ "affinity": "INTEGER",
+ "notNull": true
+ }
+ ],
+ "primaryKey": {
+ "columnNames": [
+ "id"
+ ],
+ "autoGenerate": true
+ },
+ "indices": [
+ {
+ "name": "index_effectiveProfileSwitches_id",
+ "unique": false,
+ "columnNames": [
+ "id"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_effectiveProfileSwitches_id` ON `${TABLE_NAME}` (`id`)"
+ },
+ {
+ "name": "index_effectiveProfileSwitches_referenceId",
+ "unique": false,
+ "columnNames": [
+ "referenceId"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_effectiveProfileSwitches_referenceId` ON `${TABLE_NAME}` (`referenceId`)"
+ },
+ {
+ "name": "index_effectiveProfileSwitches_timestamp",
+ "unique": false,
+ "columnNames": [
+ "timestamp"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_effectiveProfileSwitches_timestamp` ON `${TABLE_NAME}` (`timestamp`)"
+ },
+ {
+ "name": "index_effectiveProfileSwitches_isValid",
+ "unique": false,
+ "columnNames": [
+ "isValid"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_effectiveProfileSwitches_isValid` ON `${TABLE_NAME}` (`isValid`)"
+ }
+ ],
+ "foreignKeys": [
+ {
+ "table": "effectiveProfileSwitches",
+ "onDelete": "NO ACTION",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "referenceId"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ }
+ ]
+ },
+ {
+ "tableName": "extendedBoluses",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `version` INTEGER NOT NULL, `dateCreated` INTEGER NOT NULL, `isValid` INTEGER NOT NULL, `referenceId` INTEGER, `timestamp` INTEGER NOT NULL, `utcOffset` INTEGER NOT NULL, `duration` INTEGER NOT NULL, `amount` REAL NOT NULL, `isEmulatingTempBasal` INTEGER NOT NULL, `nightscoutSystemId` TEXT, `nightscoutId` TEXT, `pumpType` TEXT, `pumpSerial` TEXT, `temporaryId` INTEGER, `pumpId` INTEGER, `startId` INTEGER, `endId` INTEGER, FOREIGN KEY(`referenceId`) REFERENCES `extendedBoluses`(`id`) ON UPDATE NO ACTION ON DELETE NO ACTION )",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "version",
+ "columnName": "version",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "dateCreated",
+ "columnName": "dateCreated",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "isValid",
+ "columnName": "isValid",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "referenceId",
+ "columnName": "referenceId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "timestamp",
+ "columnName": "timestamp",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "utcOffset",
+ "columnName": "utcOffset",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "duration",
+ "columnName": "duration",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "amount",
+ "columnName": "amount",
+ "affinity": "REAL",
+ "notNull": true
+ },
+ {
+ "fieldPath": "isEmulatingTempBasal",
+ "columnName": "isEmulatingTempBasal",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.nightscoutSystemId",
+ "columnName": "nightscoutSystemId",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.nightscoutId",
+ "columnName": "nightscoutId",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpType",
+ "columnName": "pumpType",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpSerial",
+ "columnName": "pumpSerial",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.temporaryId",
+ "columnName": "temporaryId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpId",
+ "columnName": "pumpId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.startId",
+ "columnName": "startId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.endId",
+ "columnName": "endId",
+ "affinity": "INTEGER",
+ "notNull": false
+ }
+ ],
+ "primaryKey": {
+ "columnNames": [
+ "id"
+ ],
+ "autoGenerate": true
+ },
+ "indices": [
+ {
+ "name": "index_extendedBoluses_id",
+ "unique": false,
+ "columnNames": [
+ "id"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_extendedBoluses_id` ON `${TABLE_NAME}` (`id`)"
+ },
+ {
+ "name": "index_extendedBoluses_isValid",
+ "unique": false,
+ "columnNames": [
+ "isValid"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_extendedBoluses_isValid` ON `${TABLE_NAME}` (`isValid`)"
+ },
+ {
+ "name": "index_extendedBoluses_endId",
+ "unique": false,
+ "columnNames": [
+ "endId"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_extendedBoluses_endId` ON `${TABLE_NAME}` (`endId`)"
+ },
+ {
+ "name": "index_extendedBoluses_pumpSerial",
+ "unique": false,
+ "columnNames": [
+ "pumpSerial"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_extendedBoluses_pumpSerial` ON `${TABLE_NAME}` (`pumpSerial`)"
+ },
+ {
+ "name": "index_extendedBoluses_pumpId",
+ "unique": false,
+ "columnNames": [
+ "pumpId"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_extendedBoluses_pumpId` ON `${TABLE_NAME}` (`pumpId`)"
+ },
+ {
+ "name": "index_extendedBoluses_pumpType",
+ "unique": false,
+ "columnNames": [
+ "pumpType"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_extendedBoluses_pumpType` ON `${TABLE_NAME}` (`pumpType`)"
+ },
+ {
+ "name": "index_extendedBoluses_referenceId",
+ "unique": false,
+ "columnNames": [
+ "referenceId"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_extendedBoluses_referenceId` ON `${TABLE_NAME}` (`referenceId`)"
+ },
+ {
+ "name": "index_extendedBoluses_timestamp",
+ "unique": false,
+ "columnNames": [
+ "timestamp"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_extendedBoluses_timestamp` ON `${TABLE_NAME}` (`timestamp`)"
+ }
+ ],
+ "foreignKeys": [
+ {
+ "table": "extendedBoluses",
+ "onDelete": "NO ACTION",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "referenceId"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ }
+ ]
+ },
+ {
+ "tableName": "glucoseValues",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `version` INTEGER NOT NULL, `dateCreated` INTEGER NOT NULL, `isValid` INTEGER NOT NULL, `referenceId` INTEGER, `timestamp` INTEGER NOT NULL, `utcOffset` INTEGER NOT NULL, `raw` REAL, `value` REAL NOT NULL, `trendArrow` TEXT NOT NULL, `noise` REAL, `sourceSensor` TEXT NOT NULL, `nightscoutSystemId` TEXT, `nightscoutId` TEXT, `pumpType` TEXT, `pumpSerial` TEXT, `temporaryId` INTEGER, `pumpId` INTEGER, `startId` INTEGER, `endId` INTEGER, FOREIGN KEY(`referenceId`) REFERENCES `glucoseValues`(`id`) ON UPDATE NO ACTION ON DELETE NO ACTION )",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "version",
+ "columnName": "version",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "dateCreated",
+ "columnName": "dateCreated",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "isValid",
+ "columnName": "isValid",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "referenceId",
+ "columnName": "referenceId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "timestamp",
+ "columnName": "timestamp",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "utcOffset",
+ "columnName": "utcOffset",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "raw",
+ "columnName": "raw",
+ "affinity": "REAL",
+ "notNull": false
+ },
+ {
+ "fieldPath": "value",
+ "columnName": "value",
+ "affinity": "REAL",
+ "notNull": true
+ },
+ {
+ "fieldPath": "trendArrow",
+ "columnName": "trendArrow",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "noise",
+ "columnName": "noise",
+ "affinity": "REAL",
+ "notNull": false
+ },
+ {
+ "fieldPath": "sourceSensor",
+ "columnName": "sourceSensor",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.nightscoutSystemId",
+ "columnName": "nightscoutSystemId",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.nightscoutId",
+ "columnName": "nightscoutId",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpType",
+ "columnName": "pumpType",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpSerial",
+ "columnName": "pumpSerial",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.temporaryId",
+ "columnName": "temporaryId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpId",
+ "columnName": "pumpId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.startId",
+ "columnName": "startId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.endId",
+ "columnName": "endId",
+ "affinity": "INTEGER",
+ "notNull": false
+ }
+ ],
+ "primaryKey": {
+ "columnNames": [
+ "id"
+ ],
+ "autoGenerate": true
+ },
+ "indices": [
+ {
+ "name": "index_glucoseValues_id",
+ "unique": false,
+ "columnNames": [
+ "id"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_glucoseValues_id` ON `${TABLE_NAME}` (`id`)"
+ },
+ {
+ "name": "index_glucoseValues_nightscoutId",
+ "unique": false,
+ "columnNames": [
+ "nightscoutId"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_glucoseValues_nightscoutId` ON `${TABLE_NAME}` (`nightscoutId`)"
+ },
+ {
+ "name": "index_glucoseValues_sourceSensor",
+ "unique": false,
+ "columnNames": [
+ "sourceSensor"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_glucoseValues_sourceSensor` ON `${TABLE_NAME}` (`sourceSensor`)"
+ },
+ {
+ "name": "index_glucoseValues_referenceId",
+ "unique": false,
+ "columnNames": [
+ "referenceId"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_glucoseValues_referenceId` ON `${TABLE_NAME}` (`referenceId`)"
+ },
+ {
+ "name": "index_glucoseValues_timestamp",
+ "unique": false,
+ "columnNames": [
+ "timestamp"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_glucoseValues_timestamp` ON `${TABLE_NAME}` (`timestamp`)"
+ }
+ ],
+ "foreignKeys": [
+ {
+ "table": "glucoseValues",
+ "onDelete": "NO ACTION",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "referenceId"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ }
+ ]
+ },
+ {
+ "tableName": "profileSwitches",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `version` INTEGER NOT NULL, `dateCreated` INTEGER NOT NULL, `isValid` INTEGER NOT NULL, `referenceId` INTEGER, `timestamp` INTEGER NOT NULL, `utcOffset` INTEGER NOT NULL, `basalBlocks` TEXT NOT NULL, `isfBlocks` TEXT NOT NULL, `icBlocks` TEXT NOT NULL, `targetBlocks` TEXT NOT NULL, `glucoseUnit` TEXT NOT NULL, `profileName` TEXT NOT NULL, `timeshift` INTEGER NOT NULL, `percentage` INTEGER NOT NULL, `duration` INTEGER NOT NULL, `nightscoutSystemId` TEXT, `nightscoutId` TEXT, `pumpType` TEXT, `pumpSerial` TEXT, `temporaryId` INTEGER, `pumpId` INTEGER, `startId` INTEGER, `endId` INTEGER, `insulinLabel` TEXT NOT NULL, `insulinEndTime` INTEGER NOT NULL, `peak` INTEGER NOT NULL, FOREIGN KEY(`referenceId`) REFERENCES `profileSwitches`(`id`) ON UPDATE NO ACTION ON DELETE NO ACTION )",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "version",
+ "columnName": "version",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "dateCreated",
+ "columnName": "dateCreated",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "isValid",
+ "columnName": "isValid",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "referenceId",
+ "columnName": "referenceId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "timestamp",
+ "columnName": "timestamp",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "utcOffset",
+ "columnName": "utcOffset",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "basalBlocks",
+ "columnName": "basalBlocks",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "isfBlocks",
+ "columnName": "isfBlocks",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "icBlocks",
+ "columnName": "icBlocks",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "targetBlocks",
+ "columnName": "targetBlocks",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "glucoseUnit",
+ "columnName": "glucoseUnit",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "profileName",
+ "columnName": "profileName",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "timeshift",
+ "columnName": "timeshift",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "percentage",
+ "columnName": "percentage",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "duration",
+ "columnName": "duration",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.nightscoutSystemId",
+ "columnName": "nightscoutSystemId",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.nightscoutId",
+ "columnName": "nightscoutId",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpType",
+ "columnName": "pumpType",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpSerial",
+ "columnName": "pumpSerial",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.temporaryId",
+ "columnName": "temporaryId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpId",
+ "columnName": "pumpId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.startId",
+ "columnName": "startId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.endId",
+ "columnName": "endId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "insulinConfiguration.insulinLabel",
+ "columnName": "insulinLabel",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "insulinConfiguration.insulinEndTime",
+ "columnName": "insulinEndTime",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "insulinConfiguration.peak",
+ "columnName": "peak",
+ "affinity": "INTEGER",
+ "notNull": true
+ }
+ ],
+ "primaryKey": {
+ "columnNames": [
+ "id"
+ ],
+ "autoGenerate": true
+ },
+ "indices": [
+ {
+ "name": "index_profileSwitches_referenceId",
+ "unique": false,
+ "columnNames": [
+ "referenceId"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_profileSwitches_referenceId` ON `${TABLE_NAME}` (`referenceId`)"
+ },
+ {
+ "name": "index_profileSwitches_timestamp",
+ "unique": false,
+ "columnNames": [
+ "timestamp"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_profileSwitches_timestamp` ON `${TABLE_NAME}` (`timestamp`)"
+ },
+ {
+ "name": "index_profileSwitches_isValid",
+ "unique": false,
+ "columnNames": [
+ "isValid"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_profileSwitches_isValid` ON `${TABLE_NAME}` (`isValid`)"
+ },
+ {
+ "name": "index_profileSwitches_id",
+ "unique": false,
+ "columnNames": [
+ "id"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_profileSwitches_id` ON `${TABLE_NAME}` (`id`)"
+ },
+ {
+ "name": "index_profileSwitches_nightscoutId",
+ "unique": false,
+ "columnNames": [
+ "nightscoutId"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_profileSwitches_nightscoutId` ON `${TABLE_NAME}` (`nightscoutId`)"
+ }
+ ],
+ "foreignKeys": [
+ {
+ "table": "profileSwitches",
+ "onDelete": "NO ACTION",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "referenceId"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ }
+ ]
+ },
+ {
+ "tableName": "temporaryBasals",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `version` INTEGER NOT NULL, `dateCreated` INTEGER NOT NULL, `isValid` INTEGER NOT NULL, `referenceId` INTEGER, `timestamp` INTEGER NOT NULL, `utcOffset` INTEGER NOT NULL, `type` TEXT NOT NULL, `isAbsolute` INTEGER NOT NULL, `rate` REAL NOT NULL, `duration` INTEGER NOT NULL, `nightscoutSystemId` TEXT, `nightscoutId` TEXT, `pumpType` TEXT, `pumpSerial` TEXT, `temporaryId` INTEGER, `pumpId` INTEGER, `startId` INTEGER, `endId` INTEGER, FOREIGN KEY(`referenceId`) REFERENCES `temporaryBasals`(`id`) ON UPDATE NO ACTION ON DELETE NO ACTION )",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "version",
+ "columnName": "version",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "dateCreated",
+ "columnName": "dateCreated",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "isValid",
+ "columnName": "isValid",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "referenceId",
+ "columnName": "referenceId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "timestamp",
+ "columnName": "timestamp",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "utcOffset",
+ "columnName": "utcOffset",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "type",
+ "columnName": "type",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "isAbsolute",
+ "columnName": "isAbsolute",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "rate",
+ "columnName": "rate",
+ "affinity": "REAL",
+ "notNull": true
+ },
+ {
+ "fieldPath": "duration",
+ "columnName": "duration",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.nightscoutSystemId",
+ "columnName": "nightscoutSystemId",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.nightscoutId",
+ "columnName": "nightscoutId",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpType",
+ "columnName": "pumpType",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpSerial",
+ "columnName": "pumpSerial",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.temporaryId",
+ "columnName": "temporaryId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpId",
+ "columnName": "pumpId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.startId",
+ "columnName": "startId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.endId",
+ "columnName": "endId",
+ "affinity": "INTEGER",
+ "notNull": false
+ }
+ ],
+ "primaryKey": {
+ "columnNames": [
+ "id"
+ ],
+ "autoGenerate": true
+ },
+ "indices": [
+ {
+ "name": "index_temporaryBasals_id",
+ "unique": false,
+ "columnNames": [
+ "id"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_temporaryBasals_id` ON `${TABLE_NAME}` (`id`)"
+ },
+ {
+ "name": "index_temporaryBasals_isValid",
+ "unique": false,
+ "columnNames": [
+ "isValid"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_temporaryBasals_isValid` ON `${TABLE_NAME}` (`isValid`)"
+ },
+ {
+ "name": "index_temporaryBasals_nightscoutId",
+ "unique": false,
+ "columnNames": [
+ "nightscoutId"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_temporaryBasals_nightscoutId` ON `${TABLE_NAME}` (`nightscoutId`)"
+ },
+ {
+ "name": "index_temporaryBasals_pumpType",
+ "unique": false,
+ "columnNames": [
+ "pumpType"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_temporaryBasals_pumpType` ON `${TABLE_NAME}` (`pumpType`)"
+ },
+ {
+ "name": "index_temporaryBasals_endId",
+ "unique": false,
+ "columnNames": [
+ "endId"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_temporaryBasals_endId` ON `${TABLE_NAME}` (`endId`)"
+ },
+ {
+ "name": "index_temporaryBasals_pumpSerial",
+ "unique": false,
+ "columnNames": [
+ "pumpSerial"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_temporaryBasals_pumpSerial` ON `${TABLE_NAME}` (`pumpSerial`)"
+ },
+ {
+ "name": "index_temporaryBasals_temporaryId",
+ "unique": false,
+ "columnNames": [
+ "temporaryId"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_temporaryBasals_temporaryId` ON `${TABLE_NAME}` (`temporaryId`)"
+ },
+ {
+ "name": "index_temporaryBasals_referenceId",
+ "unique": false,
+ "columnNames": [
+ "referenceId"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_temporaryBasals_referenceId` ON `${TABLE_NAME}` (`referenceId`)"
+ },
+ {
+ "name": "index_temporaryBasals_timestamp",
+ "unique": false,
+ "columnNames": [
+ "timestamp"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_temporaryBasals_timestamp` ON `${TABLE_NAME}` (`timestamp`)"
+ }
+ ],
+ "foreignKeys": [
+ {
+ "table": "temporaryBasals",
+ "onDelete": "NO ACTION",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "referenceId"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ }
+ ]
+ },
+ {
+ "tableName": "temporaryTargets",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `version` INTEGER NOT NULL, `dateCreated` INTEGER NOT NULL, `isValid` INTEGER NOT NULL, `referenceId` INTEGER, `timestamp` INTEGER NOT NULL, `utcOffset` INTEGER NOT NULL, `reason` TEXT NOT NULL, `highTarget` REAL NOT NULL, `lowTarget` REAL NOT NULL, `duration` INTEGER NOT NULL, `nightscoutSystemId` TEXT, `nightscoutId` TEXT, `pumpType` TEXT, `pumpSerial` TEXT, `temporaryId` INTEGER, `pumpId` INTEGER, `startId` INTEGER, `endId` INTEGER, FOREIGN KEY(`referenceId`) REFERENCES `temporaryTargets`(`id`) ON UPDATE NO ACTION ON DELETE NO ACTION )",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "version",
+ "columnName": "version",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "dateCreated",
+ "columnName": "dateCreated",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "isValid",
+ "columnName": "isValid",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "referenceId",
+ "columnName": "referenceId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "timestamp",
+ "columnName": "timestamp",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "utcOffset",
+ "columnName": "utcOffset",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "reason",
+ "columnName": "reason",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "highTarget",
+ "columnName": "highTarget",
+ "affinity": "REAL",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lowTarget",
+ "columnName": "lowTarget",
+ "affinity": "REAL",
+ "notNull": true
+ },
+ {
+ "fieldPath": "duration",
+ "columnName": "duration",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.nightscoutSystemId",
+ "columnName": "nightscoutSystemId",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.nightscoutId",
+ "columnName": "nightscoutId",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpType",
+ "columnName": "pumpType",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpSerial",
+ "columnName": "pumpSerial",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.temporaryId",
+ "columnName": "temporaryId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpId",
+ "columnName": "pumpId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.startId",
+ "columnName": "startId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.endId",
+ "columnName": "endId",
+ "affinity": "INTEGER",
+ "notNull": false
+ }
+ ],
+ "primaryKey": {
+ "columnNames": [
+ "id"
+ ],
+ "autoGenerate": true
+ },
+ "indices": [
+ {
+ "name": "index_temporaryTargets_id",
+ "unique": false,
+ "columnNames": [
+ "id"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_temporaryTargets_id` ON `${TABLE_NAME}` (`id`)"
+ },
+ {
+ "name": "index_temporaryTargets_isValid",
+ "unique": false,
+ "columnNames": [
+ "isValid"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_temporaryTargets_isValid` ON `${TABLE_NAME}` (`isValid`)"
+ },
+ {
+ "name": "index_temporaryTargets_nightscoutId",
+ "unique": false,
+ "columnNames": [
+ "nightscoutId"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_temporaryTargets_nightscoutId` ON `${TABLE_NAME}` (`nightscoutId`)"
+ },
+ {
+ "name": "index_temporaryTargets_referenceId",
+ "unique": false,
+ "columnNames": [
+ "referenceId"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_temporaryTargets_referenceId` ON `${TABLE_NAME}` (`referenceId`)"
+ },
+ {
+ "name": "index_temporaryTargets_timestamp",
+ "unique": false,
+ "columnNames": [
+ "timestamp"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_temporaryTargets_timestamp` ON `${TABLE_NAME}` (`timestamp`)"
+ }
+ ],
+ "foreignKeys": [
+ {
+ "table": "temporaryTargets",
+ "onDelete": "NO ACTION",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "referenceId"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ }
+ ]
+ },
+ {
+ "tableName": "therapyEvents",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `version` INTEGER NOT NULL, `dateCreated` INTEGER NOT NULL, `isValid` INTEGER NOT NULL, `referenceId` INTEGER, `timestamp` INTEGER NOT NULL, `utcOffset` INTEGER NOT NULL, `duration` INTEGER NOT NULL, `type` TEXT NOT NULL, `note` TEXT, `enteredBy` TEXT, `glucose` REAL, `glucoseType` TEXT, `glucoseUnit` TEXT NOT NULL, `nightscoutSystemId` TEXT, `nightscoutId` TEXT, `pumpType` TEXT, `pumpSerial` TEXT, `temporaryId` INTEGER, `pumpId` INTEGER, `startId` INTEGER, `endId` INTEGER, FOREIGN KEY(`referenceId`) REFERENCES `therapyEvents`(`id`) ON UPDATE NO ACTION ON DELETE NO ACTION )",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "version",
+ "columnName": "version",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "dateCreated",
+ "columnName": "dateCreated",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "isValid",
+ "columnName": "isValid",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "referenceId",
+ "columnName": "referenceId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "timestamp",
+ "columnName": "timestamp",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "utcOffset",
+ "columnName": "utcOffset",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "duration",
+ "columnName": "duration",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "type",
+ "columnName": "type",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "note",
+ "columnName": "note",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "enteredBy",
+ "columnName": "enteredBy",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "glucose",
+ "columnName": "glucose",
+ "affinity": "REAL",
+ "notNull": false
+ },
+ {
+ "fieldPath": "glucoseType",
+ "columnName": "glucoseType",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "glucoseUnit",
+ "columnName": "glucoseUnit",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.nightscoutSystemId",
+ "columnName": "nightscoutSystemId",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.nightscoutId",
+ "columnName": "nightscoutId",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpType",
+ "columnName": "pumpType",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpSerial",
+ "columnName": "pumpSerial",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.temporaryId",
+ "columnName": "temporaryId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpId",
+ "columnName": "pumpId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.startId",
+ "columnName": "startId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.endId",
+ "columnName": "endId",
+ "affinity": "INTEGER",
+ "notNull": false
+ }
+ ],
+ "primaryKey": {
+ "columnNames": [
+ "id"
+ ],
+ "autoGenerate": true
+ },
+ "indices": [
+ {
+ "name": "index_therapyEvents_id",
+ "unique": false,
+ "columnNames": [
+ "id"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_therapyEvents_id` ON `${TABLE_NAME}` (`id`)"
+ },
+ {
+ "name": "index_therapyEvents_type",
+ "unique": false,
+ "columnNames": [
+ "type"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_therapyEvents_type` ON `${TABLE_NAME}` (`type`)"
+ },
+ {
+ "name": "index_therapyEvents_nightscoutId",
+ "unique": false,
+ "columnNames": [
+ "nightscoutId"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_therapyEvents_nightscoutId` ON `${TABLE_NAME}` (`nightscoutId`)"
+ },
+ {
+ "name": "index_therapyEvents_isValid",
+ "unique": false,
+ "columnNames": [
+ "isValid"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_therapyEvents_isValid` ON `${TABLE_NAME}` (`isValid`)"
+ },
+ {
+ "name": "index_therapyEvents_referenceId",
+ "unique": false,
+ "columnNames": [
+ "referenceId"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_therapyEvents_referenceId` ON `${TABLE_NAME}` (`referenceId`)"
+ },
+ {
+ "name": "index_therapyEvents_timestamp",
+ "unique": false,
+ "columnNames": [
+ "timestamp"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_therapyEvents_timestamp` ON `${TABLE_NAME}` (`timestamp`)"
+ }
+ ],
+ "foreignKeys": [
+ {
+ "table": "therapyEvents",
+ "onDelete": "NO ACTION",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "referenceId"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ }
+ ]
+ },
+ {
+ "tableName": "totalDailyDoses",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `version` INTEGER NOT NULL, `dateCreated` INTEGER NOT NULL, `isValid` INTEGER NOT NULL, `referenceId` INTEGER, `timestamp` INTEGER NOT NULL, `utcOffset` INTEGER NOT NULL, `basalAmount` REAL NOT NULL, `bolusAmount` REAL NOT NULL, `totalAmount` REAL NOT NULL, `carbs` REAL NOT NULL, `nightscoutSystemId` TEXT, `nightscoutId` TEXT, `pumpType` TEXT, `pumpSerial` TEXT, `temporaryId` INTEGER, `pumpId` INTEGER, `startId` INTEGER, `endId` INTEGER, FOREIGN KEY(`referenceId`) REFERENCES `totalDailyDoses`(`id`) ON UPDATE NO ACTION ON DELETE NO ACTION )",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "version",
+ "columnName": "version",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "dateCreated",
+ "columnName": "dateCreated",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "isValid",
+ "columnName": "isValid",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "referenceId",
+ "columnName": "referenceId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "timestamp",
+ "columnName": "timestamp",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "utcOffset",
+ "columnName": "utcOffset",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "basalAmount",
+ "columnName": "basalAmount",
+ "affinity": "REAL",
+ "notNull": true
+ },
+ {
+ "fieldPath": "bolusAmount",
+ "columnName": "bolusAmount",
+ "affinity": "REAL",
+ "notNull": true
+ },
+ {
+ "fieldPath": "totalAmount",
+ "columnName": "totalAmount",
+ "affinity": "REAL",
+ "notNull": true
+ },
+ {
+ "fieldPath": "carbs",
+ "columnName": "carbs",
+ "affinity": "REAL",
+ "notNull": true
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.nightscoutSystemId",
+ "columnName": "nightscoutSystemId",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.nightscoutId",
+ "columnName": "nightscoutId",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpType",
+ "columnName": "pumpType",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpSerial",
+ "columnName": "pumpSerial",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.temporaryId",
+ "columnName": "temporaryId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpId",
+ "columnName": "pumpId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.startId",
+ "columnName": "startId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.endId",
+ "columnName": "endId",
+ "affinity": "INTEGER",
+ "notNull": false
+ }
+ ],
+ "primaryKey": {
+ "columnNames": [
+ "id"
+ ],
+ "autoGenerate": true
+ },
+ "indices": [
+ {
+ "name": "index_totalDailyDoses_id",
+ "unique": false,
+ "columnNames": [
+ "id"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_totalDailyDoses_id` ON `${TABLE_NAME}` (`id`)"
+ },
+ {
+ "name": "index_totalDailyDoses_pumpId",
+ "unique": false,
+ "columnNames": [
+ "pumpId"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_totalDailyDoses_pumpId` ON `${TABLE_NAME}` (`pumpId`)"
+ },
+ {
+ "name": "index_totalDailyDoses_pumpType",
+ "unique": false,
+ "columnNames": [
+ "pumpType"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_totalDailyDoses_pumpType` ON `${TABLE_NAME}` (`pumpType`)"
+ },
+ {
+ "name": "index_totalDailyDoses_pumpSerial",
+ "unique": false,
+ "columnNames": [
+ "pumpSerial"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_totalDailyDoses_pumpSerial` ON `${TABLE_NAME}` (`pumpSerial`)"
+ },
+ {
+ "name": "index_totalDailyDoses_isValid",
+ "unique": false,
+ "columnNames": [
+ "isValid"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_totalDailyDoses_isValid` ON `${TABLE_NAME}` (`isValid`)"
+ },
+ {
+ "name": "index_totalDailyDoses_referenceId",
+ "unique": false,
+ "columnNames": [
+ "referenceId"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_totalDailyDoses_referenceId` ON `${TABLE_NAME}` (`referenceId`)"
+ },
+ {
+ "name": "index_totalDailyDoses_timestamp",
+ "unique": false,
+ "columnNames": [
+ "timestamp"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_totalDailyDoses_timestamp` ON `${TABLE_NAME}` (`timestamp`)"
+ }
+ ],
+ "foreignKeys": [
+ {
+ "table": "totalDailyDoses",
+ "onDelete": "NO ACTION",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "referenceId"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ }
+ ]
+ },
+ {
+ "tableName": "apsResultLinks",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `version` INTEGER NOT NULL, `dateCreated` INTEGER NOT NULL, `isValid` INTEGER NOT NULL, `referenceId` INTEGER, `apsResultId` INTEGER NOT NULL, `smbId` INTEGER, `tbrId` INTEGER, `nightscoutSystemId` TEXT, `nightscoutId` TEXT, `pumpType` TEXT, `pumpSerial` TEXT, `temporaryId` INTEGER, `pumpId` INTEGER, `startId` INTEGER, `endId` INTEGER, FOREIGN KEY(`apsResultId`) REFERENCES `apsResults`(`id`) ON UPDATE NO ACTION ON DELETE NO ACTION , FOREIGN KEY(`smbId`) REFERENCES `boluses`(`id`) ON UPDATE NO ACTION ON DELETE NO ACTION , FOREIGN KEY(`tbrId`) REFERENCES `temporaryBasals`(`id`) ON UPDATE NO ACTION ON DELETE NO ACTION , FOREIGN KEY(`referenceId`) REFERENCES `apsResultLinks`(`id`) ON UPDATE NO ACTION ON DELETE NO ACTION )",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "version",
+ "columnName": "version",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "dateCreated",
+ "columnName": "dateCreated",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "isValid",
+ "columnName": "isValid",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "referenceId",
+ "columnName": "referenceId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "apsResultId",
+ "columnName": "apsResultId",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "smbId",
+ "columnName": "smbId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "tbrId",
+ "columnName": "tbrId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.nightscoutSystemId",
+ "columnName": "nightscoutSystemId",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.nightscoutId",
+ "columnName": "nightscoutId",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpType",
+ "columnName": "pumpType",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpSerial",
+ "columnName": "pumpSerial",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.temporaryId",
+ "columnName": "temporaryId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpId",
+ "columnName": "pumpId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.startId",
+ "columnName": "startId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.endId",
+ "columnName": "endId",
+ "affinity": "INTEGER",
+ "notNull": false
+ }
+ ],
+ "primaryKey": {
+ "columnNames": [
+ "id"
+ ],
+ "autoGenerate": true
+ },
+ "indices": [
+ {
+ "name": "index_apsResultLinks_referenceId",
+ "unique": false,
+ "columnNames": [
+ "referenceId"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_apsResultLinks_referenceId` ON `${TABLE_NAME}` (`referenceId`)"
+ },
+ {
+ "name": "index_apsResultLinks_apsResultId",
+ "unique": false,
+ "columnNames": [
+ "apsResultId"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_apsResultLinks_apsResultId` ON `${TABLE_NAME}` (`apsResultId`)"
+ },
+ {
+ "name": "index_apsResultLinks_smbId",
+ "unique": false,
+ "columnNames": [
+ "smbId"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_apsResultLinks_smbId` ON `${TABLE_NAME}` (`smbId`)"
+ },
+ {
+ "name": "index_apsResultLinks_tbrId",
+ "unique": false,
+ "columnNames": [
+ "tbrId"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_apsResultLinks_tbrId` ON `${TABLE_NAME}` (`tbrId`)"
+ }
+ ],
+ "foreignKeys": [
+ {
+ "table": "apsResults",
+ "onDelete": "NO ACTION",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "apsResultId"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ },
+ {
+ "table": "boluses",
+ "onDelete": "NO ACTION",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "smbId"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ },
+ {
+ "table": "temporaryBasals",
+ "onDelete": "NO ACTION",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "tbrId"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ },
+ {
+ "table": "apsResultLinks",
+ "onDelete": "NO ACTION",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "referenceId"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ }
+ ]
+ },
+ {
+ "tableName": "multiwaveBolusLinks",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `version` INTEGER NOT NULL, `dateCreated` INTEGER NOT NULL, `isValid` INTEGER NOT NULL, `referenceId` INTEGER, `bolusId` INTEGER NOT NULL, `extendedBolusId` INTEGER NOT NULL, `nightscoutSystemId` TEXT, `nightscoutId` TEXT, `pumpType` TEXT, `pumpSerial` TEXT, `temporaryId` INTEGER, `pumpId` INTEGER, `startId` INTEGER, `endId` INTEGER, FOREIGN KEY(`bolusId`) REFERENCES `boluses`(`id`) ON UPDATE NO ACTION ON DELETE NO ACTION , FOREIGN KEY(`extendedBolusId`) REFERENCES `extendedBoluses`(`id`) ON UPDATE NO ACTION ON DELETE NO ACTION , FOREIGN KEY(`referenceId`) REFERENCES `multiwaveBolusLinks`(`id`) ON UPDATE NO ACTION ON DELETE NO ACTION )",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "version",
+ "columnName": "version",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "dateCreated",
+ "columnName": "dateCreated",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "isValid",
+ "columnName": "isValid",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "referenceId",
+ "columnName": "referenceId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "bolusId",
+ "columnName": "bolusId",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "extendedBolusId",
+ "columnName": "extendedBolusId",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.nightscoutSystemId",
+ "columnName": "nightscoutSystemId",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.nightscoutId",
+ "columnName": "nightscoutId",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpType",
+ "columnName": "pumpType",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpSerial",
+ "columnName": "pumpSerial",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.temporaryId",
+ "columnName": "temporaryId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpId",
+ "columnName": "pumpId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.startId",
+ "columnName": "startId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.endId",
+ "columnName": "endId",
+ "affinity": "INTEGER",
+ "notNull": false
+ }
+ ],
+ "primaryKey": {
+ "columnNames": [
+ "id"
+ ],
+ "autoGenerate": true
+ },
+ "indices": [
+ {
+ "name": "index_multiwaveBolusLinks_referenceId",
+ "unique": false,
+ "columnNames": [
+ "referenceId"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_multiwaveBolusLinks_referenceId` ON `${TABLE_NAME}` (`referenceId`)"
+ },
+ {
+ "name": "index_multiwaveBolusLinks_bolusId",
+ "unique": false,
+ "columnNames": [
+ "bolusId"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_multiwaveBolusLinks_bolusId` ON `${TABLE_NAME}` (`bolusId`)"
+ },
+ {
+ "name": "index_multiwaveBolusLinks_extendedBolusId",
+ "unique": false,
+ "columnNames": [
+ "extendedBolusId"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_multiwaveBolusLinks_extendedBolusId` ON `${TABLE_NAME}` (`extendedBolusId`)"
+ }
+ ],
+ "foreignKeys": [
+ {
+ "table": "boluses",
+ "onDelete": "NO ACTION",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "bolusId"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ },
+ {
+ "table": "extendedBoluses",
+ "onDelete": "NO ACTION",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "extendedBolusId"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ },
+ {
+ "table": "multiwaveBolusLinks",
+ "onDelete": "NO ACTION",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "referenceId"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ }
+ ]
+ },
+ {
+ "tableName": "preferenceChanges",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `timestamp` INTEGER NOT NULL, `utcOffset` INTEGER NOT NULL, `key` TEXT NOT NULL, `value` TEXT)",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "timestamp",
+ "columnName": "timestamp",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "utcOffset",
+ "columnName": "utcOffset",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "key",
+ "columnName": "key",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "value",
+ "columnName": "value",
+ "affinity": "TEXT",
+ "notNull": false
+ }
+ ],
+ "primaryKey": {
+ "columnNames": [
+ "id"
+ ],
+ "autoGenerate": true
+ },
+ "indices": [],
+ "foreignKeys": []
+ },
+ {
+ "tableName": "versionChanges",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `timestamp` INTEGER NOT NULL, `utcOffset` INTEGER NOT NULL, `versionCode` INTEGER NOT NULL, `versionName` TEXT NOT NULL, `gitRemote` TEXT, `commitHash` TEXT)",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "timestamp",
+ "columnName": "timestamp",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "utcOffset",
+ "columnName": "utcOffset",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "versionCode",
+ "columnName": "versionCode",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "versionName",
+ "columnName": "versionName",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "gitRemote",
+ "columnName": "gitRemote",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "commitHash",
+ "columnName": "commitHash",
+ "affinity": "TEXT",
+ "notNull": false
+ }
+ ],
+ "primaryKey": {
+ "columnNames": [
+ "id"
+ ],
+ "autoGenerate": true
+ },
+ "indices": [],
+ "foreignKeys": []
+ },
+ {
+ "tableName": "userEntry",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `timestamp` INTEGER NOT NULL, `utcOffset` INTEGER NOT NULL, `action` TEXT NOT NULL, `source` TEXT NOT NULL, `note` TEXT NOT NULL, `values` TEXT NOT NULL)",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "timestamp",
+ "columnName": "timestamp",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "utcOffset",
+ "columnName": "utcOffset",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "action",
+ "columnName": "action",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "source",
+ "columnName": "source",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "note",
+ "columnName": "note",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "values",
+ "columnName": "values",
+ "affinity": "TEXT",
+ "notNull": true
+ }
+ ],
+ "primaryKey": {
+ "columnNames": [
+ "id"
+ ],
+ "autoGenerate": true
+ },
+ "indices": [
+ {
+ "name": "index_userEntry_source",
+ "unique": false,
+ "columnNames": [
+ "source"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_userEntry_source` ON `${TABLE_NAME}` (`source`)"
+ },
+ {
+ "name": "index_userEntry_timestamp",
+ "unique": false,
+ "columnNames": [
+ "timestamp"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_userEntry_timestamp` ON `${TABLE_NAME}` (`timestamp`)"
+ }
+ ],
+ "foreignKeys": []
+ },
+ {
+ "tableName": "foods",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `version` INTEGER NOT NULL, `dateCreated` INTEGER NOT NULL, `isValid` INTEGER NOT NULL, `referenceId` INTEGER, `name` TEXT NOT NULL, `category` TEXT, `subCategory` TEXT, `portion` REAL NOT NULL, `carbs` INTEGER NOT NULL, `fat` INTEGER, `protein` INTEGER, `energy` INTEGER, `unit` TEXT NOT NULL, `gi` INTEGER, `nightscoutSystemId` TEXT, `nightscoutId` TEXT, `pumpType` TEXT, `pumpSerial` TEXT, `temporaryId` INTEGER, `pumpId` INTEGER, `startId` INTEGER, `endId` INTEGER, FOREIGN KEY(`referenceId`) REFERENCES `foods`(`id`) ON UPDATE NO ACTION ON DELETE NO ACTION )",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "version",
+ "columnName": "version",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "dateCreated",
+ "columnName": "dateCreated",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "isValid",
+ "columnName": "isValid",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "referenceId",
+ "columnName": "referenceId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "name",
+ "columnName": "name",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "category",
+ "columnName": "category",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "subCategory",
+ "columnName": "subCategory",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "portion",
+ "columnName": "portion",
+ "affinity": "REAL",
+ "notNull": true
+ },
+ {
+ "fieldPath": "carbs",
+ "columnName": "carbs",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "fat",
+ "columnName": "fat",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "protein",
+ "columnName": "protein",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "energy",
+ "columnName": "energy",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "unit",
+ "columnName": "unit",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "gi",
+ "columnName": "gi",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.nightscoutSystemId",
+ "columnName": "nightscoutSystemId",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.nightscoutId",
+ "columnName": "nightscoutId",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpType",
+ "columnName": "pumpType",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpSerial",
+ "columnName": "pumpSerial",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.temporaryId",
+ "columnName": "temporaryId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpId",
+ "columnName": "pumpId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.startId",
+ "columnName": "startId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.endId",
+ "columnName": "endId",
+ "affinity": "INTEGER",
+ "notNull": false
+ }
+ ],
+ "primaryKey": {
+ "columnNames": [
+ "id"
+ ],
+ "autoGenerate": true
+ },
+ "indices": [
+ {
+ "name": "index_foods_id",
+ "unique": false,
+ "columnNames": [
+ "id"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_foods_id` ON `${TABLE_NAME}` (`id`)"
+ },
+ {
+ "name": "index_foods_nightscoutId",
+ "unique": false,
+ "columnNames": [
+ "nightscoutId"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_foods_nightscoutId` ON `${TABLE_NAME}` (`nightscoutId`)"
+ },
+ {
+ "name": "index_foods_referenceId",
+ "unique": false,
+ "columnNames": [
+ "referenceId"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_foods_referenceId` ON `${TABLE_NAME}` (`referenceId`)"
+ },
+ {
+ "name": "index_foods_isValid",
+ "unique": false,
+ "columnNames": [
+ "isValid"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_foods_isValid` ON `${TABLE_NAME}` (`isValid`)"
+ }
+ ],
+ "foreignKeys": [
+ {
+ "table": "foods",
+ "onDelete": "NO ACTION",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "referenceId"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ }
+ ]
+ },
+ {
+ "tableName": "deviceStatus",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `timestamp` INTEGER NOT NULL, `utcOffset` INTEGER NOT NULL, `device` TEXT, `pump` TEXT, `enacted` TEXT, `suggested` TEXT, `iob` TEXT, `uploaderBattery` INTEGER NOT NULL, `configuration` TEXT, `nightscoutSystemId` TEXT, `nightscoutId` TEXT, `pumpType` TEXT, `pumpSerial` TEXT, `temporaryId` INTEGER, `pumpId` INTEGER, `startId` INTEGER, `endId` INTEGER)",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "timestamp",
+ "columnName": "timestamp",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "utcOffset",
+ "columnName": "utcOffset",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "device",
+ "columnName": "device",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "pump",
+ "columnName": "pump",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "enacted",
+ "columnName": "enacted",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "suggested",
+ "columnName": "suggested",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "iob",
+ "columnName": "iob",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "uploaderBattery",
+ "columnName": "uploaderBattery",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "configuration",
+ "columnName": "configuration",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.nightscoutSystemId",
+ "columnName": "nightscoutSystemId",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.nightscoutId",
+ "columnName": "nightscoutId",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpType",
+ "columnName": "pumpType",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpSerial",
+ "columnName": "pumpSerial",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.temporaryId",
+ "columnName": "temporaryId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpId",
+ "columnName": "pumpId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.startId",
+ "columnName": "startId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.endId",
+ "columnName": "endId",
+ "affinity": "INTEGER",
+ "notNull": false
+ }
+ ],
+ "primaryKey": {
+ "columnNames": [
+ "id"
+ ],
+ "autoGenerate": true
+ },
+ "indices": [
+ {
+ "name": "index_deviceStatus_id",
+ "unique": false,
+ "columnNames": [
+ "id"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_deviceStatus_id` ON `${TABLE_NAME}` (`id`)"
+ },
+ {
+ "name": "index_deviceStatus_nightscoutId",
+ "unique": false,
+ "columnNames": [
+ "nightscoutId"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_deviceStatus_nightscoutId` ON `${TABLE_NAME}` (`nightscoutId`)"
+ },
+ {
+ "name": "index_deviceStatus_timestamp",
+ "unique": false,
+ "columnNames": [
+ "timestamp"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_deviceStatus_timestamp` ON `${TABLE_NAME}` (`timestamp`)"
+ }
+ ],
+ "foreignKeys": []
+ },
+ {
+ "tableName": "offlineEvents",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `version` INTEGER NOT NULL, `dateCreated` INTEGER NOT NULL, `isValid` INTEGER NOT NULL, `referenceId` INTEGER, `timestamp` INTEGER NOT NULL, `utcOffset` INTEGER NOT NULL, `reason` TEXT NOT NULL, `duration` INTEGER NOT NULL, `nightscoutSystemId` TEXT, `nightscoutId` TEXT, `pumpType` TEXT, `pumpSerial` TEXT, `temporaryId` INTEGER, `pumpId` INTEGER, `startId` INTEGER, `endId` INTEGER, FOREIGN KEY(`referenceId`) REFERENCES `offlineEvents`(`id`) ON UPDATE NO ACTION ON DELETE NO ACTION )",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "version",
+ "columnName": "version",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "dateCreated",
+ "columnName": "dateCreated",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "isValid",
+ "columnName": "isValid",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "referenceId",
+ "columnName": "referenceId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "timestamp",
+ "columnName": "timestamp",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "utcOffset",
+ "columnName": "utcOffset",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "reason",
+ "columnName": "reason",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "duration",
+ "columnName": "duration",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.nightscoutSystemId",
+ "columnName": "nightscoutSystemId",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.nightscoutId",
+ "columnName": "nightscoutId",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpType",
+ "columnName": "pumpType",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpSerial",
+ "columnName": "pumpSerial",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.temporaryId",
+ "columnName": "temporaryId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpId",
+ "columnName": "pumpId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.startId",
+ "columnName": "startId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.endId",
+ "columnName": "endId",
+ "affinity": "INTEGER",
+ "notNull": false
+ }
+ ],
+ "primaryKey": {
+ "columnNames": [
+ "id"
+ ],
+ "autoGenerate": true
+ },
+ "indices": [
+ {
+ "name": "index_offlineEvents_id",
+ "unique": false,
+ "columnNames": [
+ "id"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_offlineEvents_id` ON `${TABLE_NAME}` (`id`)"
+ },
+ {
+ "name": "index_offlineEvents_isValid",
+ "unique": false,
+ "columnNames": [
+ "isValid"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_offlineEvents_isValid` ON `${TABLE_NAME}` (`isValid`)"
+ },
+ {
+ "name": "index_offlineEvents_nightscoutId",
+ "unique": false,
+ "columnNames": [
+ "nightscoutId"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_offlineEvents_nightscoutId` ON `${TABLE_NAME}` (`nightscoutId`)"
+ },
+ {
+ "name": "index_offlineEvents_referenceId",
+ "unique": false,
+ "columnNames": [
+ "referenceId"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_offlineEvents_referenceId` ON `${TABLE_NAME}` (`referenceId`)"
+ },
+ {
+ "name": "index_offlineEvents_timestamp",
+ "unique": false,
+ "columnNames": [
+ "timestamp"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_offlineEvents_timestamp` ON `${TABLE_NAME}` (`timestamp`)"
+ }
+ ],
+ "foreignKeys": [
+ {
+ "table": "offlineEvents",
+ "onDelete": "NO ACTION",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "referenceId"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ }
+ ]
+ }
+ ],
+ "views": [],
+ "setupQueries": [
+ "CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)",
+ "INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, 'e3558dc3bb3136c37dba4f90c97e8bdd')"
+ ]
+ }
+}
\ No newline at end of file
diff --git a/database/src/main/java/info/nightscout/androidaps/database/AppDatabase.kt b/database/src/main/java/info/nightscout/androidaps/database/AppDatabase.kt
index c779c0a886..948aa705d6 100644
--- a/database/src/main/java/info/nightscout/androidaps/database/AppDatabase.kt
+++ b/database/src/main/java/info/nightscout/androidaps/database/AppDatabase.kt
@@ -6,14 +6,14 @@ import androidx.room.TypeConverters
import info.nightscout.androidaps.database.daos.*
import info.nightscout.androidaps.database.entities.*
-const val DATABASE_VERSION = 18
+const val DATABASE_VERSION = 21
@Database(version = DATABASE_VERSION,
entities = [APSResult::class, Bolus::class, BolusCalculatorResult::class, Carbs::class,
EffectiveProfileSwitch::class, ExtendedBolus::class, GlucoseValue::class, ProfileSwitch::class,
TemporaryBasal::class, TemporaryTarget::class, TherapyEvent::class, TotalDailyDose::class, APSResultLink::class,
MultiwaveBolusLink::class, PreferenceChange::class, VersionChange::class, UserEntry::class,
- Food::class, DeviceStatus::class],
+ Food::class, DeviceStatus::class, OfflineEvent::class],
exportSchema = true)
@TypeConverters(Converters::class)
internal abstract class AppDatabase : RoomDatabase() {
@@ -56,4 +56,6 @@ internal abstract class AppDatabase : RoomDatabase() {
abstract val deviceStatusDao: DeviceStatusDao
+ abstract val offlineEventDao: OfflineEventDao
+
}
\ No newline at end of file
diff --git a/database/src/main/java/info/nightscout/androidaps/database/AppRepository.kt b/database/src/main/java/info/nightscout/androidaps/database/AppRepository.kt
index d2150de8bc..da7449f887 100644
--- a/database/src/main/java/info/nightscout/androidaps/database/AppRepository.kt
+++ b/database/src/main/java/info/nightscout/androidaps/database/AppRepository.kt
@@ -7,8 +7,6 @@ import io.reactivex.Completable
import io.reactivex.Maybe
import io.reactivex.Observable
import io.reactivex.Single
-import io.reactivex.internal.operators.maybe.MaybeJust
-import io.reactivex.rxkotlin.subscribeBy
import io.reactivex.schedulers.Schedulers
import io.reactivex.subjects.PublishSubject
import java.util.concurrent.Callable
@@ -78,6 +76,16 @@ open class AppRepository @Inject internal constructor(
database.glucoseValueDao.getModifiedFrom(lastId)
.subscribeOn(Schedulers.io())
+ fun getLastGlucoseValueIdWrapped(): Single> =
+ database.glucoseValueDao.getLastId()
+ .subscribeOn(Schedulers.io())
+ .toWrappedSingle()
+
+ fun getLastGlucoseValueWrapped(): Single> =
+ database.glucoseValueDao.getLast()
+ .subscribeOn(Schedulers.io())
+ .toWrappedSingle()
+
/*
* returns a Pair of the next entity to sync and the ID of the "update".
* The update id might either be the entry id itself if it is a new entry - or the id
@@ -151,6 +159,11 @@ open class AppRepository @Inject internal constructor(
fun deleteAllTempTargetEntries() =
database.temporaryTargetDao.deleteAllEntries()
+ fun getLastTempTargetIdWrapped(): Single> =
+ database.temporaryTargetDao.getLastId()
+ .subscribeOn(Schedulers.io())
+ .toWrappedSingle()
+
// USER ENTRY
fun getAllUserEntries(): Single> =
database.userEntryDao.getAll()
@@ -217,6 +230,11 @@ open class AppRepository @Inject internal constructor(
.map { if (!ascending) it.reversed() else it }
.subscribeOn(Schedulers.io())
+ fun getLastProfileSwitchIdWrapped(): Single> =
+ database.profileSwitchDao.getLastId()
+ .subscribeOn(Schedulers.io())
+ .toWrappedSingle()
+
// EFFECTIVE PROFILE SWITCH
/*
* returns a Pair of the next entity to sync and the ID of the "update".
@@ -267,6 +285,11 @@ open class AppRepository @Inject internal constructor(
fun deleteAllEffectiveProfileSwitches() =
database.effectiveProfileSwitchDao.deleteAllEntries()
+ fun getLastEffectiveProfileSwitchIdWrapped(): Single> =
+ database.effectiveProfileSwitchDao.getLastId()
+ .subscribeOn(Schedulers.io())
+ .toWrappedSingle()
+
// THERAPY EVENT
/*
* returns a Pair of the next entity to sync and the ID of the "update".
@@ -329,6 +352,11 @@ open class AppRepository @Inject internal constructor(
database.therapyEventDao.compatGetTherapyEventDataFromToTime(from, to)
.subscribeOn(Schedulers.io())
+ fun getLastTherapyEventIdWrapped(): Single> =
+ database.therapyEventDao.getLastId()
+ .subscribeOn(Schedulers.io())
+ .toWrappedSingle()
+
// FOOD
/*
* returns a Pair of the next entity to sync and the ID of the "update".
@@ -360,6 +388,11 @@ open class AppRepository @Inject internal constructor(
fun deleteAllFoods() =
database.foodDao.deleteAllEntries()
+ fun getLastFoodIdWrapped(): Single> =
+ database.foodDao.getLastId()
+ .subscribeOn(Schedulers.io())
+ .toWrappedSingle()
+
// BOLUS
/*
* returns a Pair of the next entity to sync and the ID of the "update".
@@ -421,6 +454,10 @@ open class AppRepository @Inject internal constructor(
fun deleteAllBoluses() =
database.bolusDao.deleteAllEntries()
+ fun getLastBolusIdWrapped(): Single> =
+ database.bolusDao.getLastId()
+ .subscribeOn(Schedulers.io())
+ .toWrappedSingle()
// CARBS
private fun expandCarbs(carbs: Carbs): List =
@@ -529,6 +566,11 @@ open class AppRepository @Inject internal constructor(
fun deleteAllCarbs() =
database.carbsDao.deleteAllEntries()
+ fun getLastCarbsIdWrapped(): Single> =
+ database.carbsDao.getLastId()
+ .subscribeOn(Schedulers.io())
+ .toWrappedSingle()
+
// BOLUS CALCULATOR RESULT
/*
* returns a Pair of the next entity to sync and the ID of the "update".
@@ -566,6 +608,11 @@ open class AppRepository @Inject internal constructor(
fun deleteAllBolusCalculatorResults() =
database.bolusCalculatorResultDao.deleteAllEntries()
+ fun getLastBolusCalculatorResultIdWrapped(): Single> =
+ database.bolusCalculatorResultDao.getLastId()
+ .subscribeOn(Schedulers.io())
+ .toWrappedSingle()
+
// DEVICE STATUS
fun insert(deviceStatus: DeviceStatus): Long =
database.deviceStatusDao.insert(deviceStatus)
@@ -586,6 +633,11 @@ open class AppRepository @Inject internal constructor(
database.deviceStatusDao.getModifiedFrom(lastId)
.subscribeOn(Schedulers.io())
+ fun getLastDeviceStatusIdWrapped(): Single> =
+ database.deviceStatusDao.getLastId()
+ .subscribeOn(Schedulers.io())
+ .toWrappedSingle()
+
// TEMPORARY BASAL
/*
* returns a Pair of the next entity to sync and the ID of the "update".
@@ -643,6 +695,11 @@ open class AppRepository @Inject internal constructor(
fun getOldestTemporaryBasalRecord(): TemporaryBasal? =
database.temporaryBasalDao.getOldestRecord()
+ fun getLastTemporaryBasalIdWrapped(): Single> =
+ database.temporaryBasalDao.getLastId()
+ .subscribeOn(Schedulers.io())
+ .toWrappedSingle()
+
// EXTENDED BOLUS
/*
* returns a Pair of the next entity to sync and the ID of the "update".
@@ -707,6 +764,68 @@ open class AppRepository @Inject internal constructor(
.map { if (!ascending) it.reversed() else it }
.subscribeOn(Schedulers.io())
+ fun getLastExtendedBolusIdWrapped(): Single> =
+ database.extendedBolusDao.getLastId()
+ .subscribeOn(Schedulers.io())
+ .toWrappedSingle()
+
+ // OFFLINE EVENT
+ /*
+ * returns a Pair of the next entity to sync and the ID of the "update".
+ * The update id might either be the entry id itself if it is a new entry - or the id
+ * of the update ("historic") entry. The sync counter should be incremented to that id if it was synced successfully.
+ *
+ * It is a Maybe as there might be no next element.
+ * */
+ fun getNextSyncElementOfflineEvent(id: Long): Maybe> =
+ database.offlineEventDao.getNextModifiedOrNewAfter(id)
+ .flatMap { nextIdElement ->
+ val nextIdElemReferenceId = nextIdElement.referenceId
+ if (nextIdElemReferenceId == null) {
+ Maybe.just(nextIdElement to nextIdElement.id)
+ } else {
+ database.offlineEventDao.getCurrentFromHistoric(nextIdElemReferenceId)
+ .map { it to nextIdElement.id }
+ }
+ }
+
+ fun compatGetOfflineEventData(): Single> =
+ database.offlineEventDao.getOfflineEventData()
+ .subscribeOn(Schedulers.io())
+
+ fun getOfflineEventDataFromTime(timestamp: Long, ascending: Boolean): Single> =
+ database.offlineEventDao.getOfflineEventDataFromTime(timestamp)
+ .map { if (!ascending) it.reversed() else it }
+ .subscribeOn(Schedulers.io())
+
+ fun getOfflineEventDataIncludingInvalidFromTime(timestamp: Long, ascending: Boolean): Single> =
+ database.offlineEventDao.getOfflineEventDataIncludingInvalidFromTime(timestamp)
+ .map { if (!ascending) it.reversed() else it }
+ .subscribeOn(Schedulers.io())
+
+ fun getOfflineEventDataFromTimeToTime(start: Long, end: Long, ascending: Boolean): Single> =
+ database.offlineEventDao.getOfflineEventDataFromTimeToTime(start, end)
+ .map { if (!ascending) it.reversed() else it }
+ .subscribeOn(Schedulers.io())
+
+ fun getModifiedOfflineEventsDataFromId(lastId: Long): Single> =
+ database.offlineEventDao.getModifiedFrom(lastId)
+ .subscribeOn(Schedulers.io())
+
+ fun getOfflineEventActiveAt(timestamp: Long): Single> =
+ database.offlineEventDao.getOfflineEventActiveAt(timestamp)
+ .subscribeOn(Schedulers.io())
+ .toWrappedSingle()
+
+ fun deleteAllOfflineEventEntries() =
+ database.offlineEventDao.deleteAllEntries()
+
+ fun getLastOfflineEventIdWrapped(): Single> =
+ database.offlineEventDao.getLastId()
+ .subscribeOn(Schedulers.io())
+ .toWrappedSingle()
+
+
}
@Suppress("USELESS_CAST")
diff --git a/database/src/main/java/info/nightscout/androidaps/database/Converters.kt b/database/src/main/java/info/nightscout/androidaps/database/Converters.kt
index d41e5a6f42..371976cc5c 100644
--- a/database/src/main/java/info/nightscout/androidaps/database/Converters.kt
+++ b/database/src/main/java/info/nightscout/androidaps/database/Converters.kt
@@ -27,11 +27,11 @@ class Converters {
fun toSource(source: String?) = source?.let { Sources.fromString(it) }
@TypeConverter
- fun fromListOfXXXValueWithUnit(values: List): String = values.map(::ValueWithUnitWrapper)
+ fun fromListOfValueWithUnit(values: List): String = values.map(::ValueWithUnitWrapper)
.let(SealedClassHelper.gson::toJson)
@TypeConverter
- fun toMutableListOfXXXValueWithUnit(string: String): List = SealedClassHelper.gson
+ fun toMutableListOfValueWithUnit(string: String): List = SealedClassHelper.gson
.fromJson>(string).map { it.wrapped }
private class ValueWithUnitWrapper(val wrapped: ValueWithUnit)
@@ -183,4 +183,9 @@ class Converters {
return list
}
-}
\ No newline at end of file
+ @TypeConverter
+ fun fromOfflineEventReason(reason: OfflineEvent.Reason?) = reason?.name
+
+ @TypeConverter
+ fun toOfflineEventReason(reason: String?) = reason?.let { OfflineEvent.Reason.valueOf(it) }
+}
diff --git a/database/src/main/java/info/nightscout/androidaps/database/DatabaseModule.kt b/database/src/main/java/info/nightscout/androidaps/database/DatabaseModule.kt
index 2c9f768e68..4f2b1be88d 100644
--- a/database/src/main/java/info/nightscout/androidaps/database/DatabaseModule.kt
+++ b/database/src/main/java/info/nightscout/androidaps/database/DatabaseModule.kt
@@ -2,6 +2,7 @@ package info.nightscout.androidaps.database
import android.content.Context
import androidx.room.Room
+import androidx.room.RoomDatabase.Callback
import androidx.room.migration.Migration
import androidx.sqlite.db.SupportSQLiteDatabase
import dagger.Module
@@ -25,49 +26,47 @@ open class DatabaseModule {
// .addMigrations(migration6to7)
// .addMigrations(migration7to8)
// .addMigrations(migration11to12)
+ .addMigrations(migration20to21)
+ .addCallback(object : Callback() {
+ override fun onOpen(db: SupportSQLiteDatabase) {
+ super.onOpen(db)
+ createCustomIndexes(db)
+ }
+ })
.fallbackToDestructiveMigration()
.build()
@Qualifier
annotation class DbFileName
- private val migration5to6 = object : Migration(5, 6) {
+ private fun createCustomIndexes(database: SupportSQLiteDatabase) {
+ database.execSQL("CREATE INDEX IF NOT EXISTS `index_temporaryBasals_end` ON `temporaryBasals` (`timestamp` + `duration`)")
+ database.execSQL("CREATE INDEX IF NOT EXISTS `index_extendedBoluses_end` ON `extendedBoluses` (`timestamp` + `duration`)")
+ database.execSQL("CREATE INDEX IF NOT EXISTS `index_temporaryTargets_end` ON `temporaryTargets` (`timestamp` + `duration`)")
+ database.execSQL("CREATE INDEX IF NOT EXISTS `index_carbs_end` ON `carbs` (`timestamp` + `duration`)")
+ database.execSQL("CREATE INDEX IF NOT EXISTS `index_offlineEvents_end` ON `offlineEvents` (`timestamp` + `duration`)")
+ }
+
+ private fun dropCustomIndexes(database: SupportSQLiteDatabase) {
+ database.execSQL("DROP INDEX IF EXISTS `index_temporaryBasals_end`")
+ database.execSQL("DROP INDEX IF EXISTS `index_extendedBoluses_end`")
+ database.execSQL("DROP INDEX IF EXISTS `index_temporaryTargets_end`")
+ database.execSQL("DROP INDEX IF EXISTS `index_carbs_end`")
+ database.execSQL("DROP INDEX IF EXISTS `index_offlineEvents_end`")
+ }
+
+ private val migration20to21 = object : Migration(20,21) {
override fun migrate(database: SupportSQLiteDatabase) {
- database.execSQL("DROP TABLE IF EXISTS userEntry")
- database.execSQL("CREATE TABLE userEntry (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `timestamp` INTEGER NOT NULL, `utcOffset` INTEGER NOT NULL, `action` TEXT NOT NULL, `s` TEXT NOT NULL, `values` TEXT NOT NULL)")
+ database.execSQL("DROP TABLE IF EXISTS offlineEvents")
+ database.execSQL("CREATE TABLE IF NOT EXISTS `offlineEvents` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `version` INTEGER NOT NULL, `dateCreated` INTEGER NOT NULL, `isValid` INTEGER NOT NULL, `referenceId` INTEGER, `timestamp` INTEGER NOT NULL, `utcOffset` INTEGER NOT NULL, `reason` TEXT NOT NULL, `duration` INTEGER NOT NULL, `nightscoutSystemId` TEXT, `nightscoutId` TEXT, `pumpType` TEXT, `pumpSerial` TEXT, `temporaryId` INTEGER, `pumpId` INTEGER, `startId` INTEGER, `endId` INTEGER, FOREIGN KEY(`referenceId`) REFERENCES `offlineEvents`(`id`) ON UPDATE NO ACTION ON DELETE NO ACTION )")
+ database.execSQL("CREATE INDEX IF NOT EXISTS `index_offlineEvents_id` ON offlineEvents (`id`)")
+ database.execSQL("CREATE INDEX IF NOT EXISTS `index_offlineEvents_isValid` ON offlineEvents (`isValid`)")
+ database.execSQL("CREATE INDEX IF NOT EXISTS `index_offlineEvents_nightscoutId` ON offlineEvents (`nightscoutId`)")
+ database.execSQL("CREATE INDEX IF NOT EXISTS `index_offlineEvents_referenceId` ON offlineEvents (`referenceId`)")
+ database.execSQL("CREATE INDEX IF NOT EXISTS `index_offlineEvents_timestamp` ON offlineEvents (`timestamp`)")
+ // Custom indexes must be dropped on migration to pass room schema checking after upgrade
+ dropCustomIndexes(database)
}
}
- private val migration6to7 = object : Migration(6, 7) {
- override fun migrate(database: SupportSQLiteDatabase) {
- database.execSQL("DROP TABLE IF EXISTS foods")
- database.execSQL("CREATE TABLE IF NOT EXISTS foods (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `version` INTEGER NOT NULL, `dateCreated` INTEGER NOT NULL, `isValid` INTEGER NOT NULL, `referenceId` INTEGER, `name` TEXT NOT NULL, `category` TEXT, `subCategory` TEXT, `portion` REAL NOT NULL, `carbs` INTEGER NOT NULL, `fat` INTEGER, `protein` INTEGER, `energy` INTEGER, `unit` TEXT NOT NULL, `gi` INTEGER, `nightscoutSystemId` TEXT, `nightscoutId` TEXT, `pumpType` TEXT, `pumpSerial` TEXT, `pumpId` INTEGER, `startId` INTEGER, `endId` INTEGER, FOREIGN KEY(`referenceId`) REFERENCES `foods`(`id`) ON UPDATE NO ACTION ON DELETE NO ACTION )")
- database.execSQL("CREATE INDEX IF NOT EXISTS `index_foods_referenceId` ON `foods` (`referenceId`)")
- }
- }
-
- private val migration7to8 = object : Migration(7, 8) {
- override fun migrate(database: SupportSQLiteDatabase) {
- database.execSQL("DROP TABLE IF EXISTS bolusCalculatorResults")
- database.execSQL("CREATE TABLE IF NOT EXISTS bolusCalculatorResults (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `version` INTEGER NOT NULL, `dateCreated` INTEGER NOT NULL, `isValid` INTEGER NOT NULL, `referenceId` INTEGER, `timestamp` INTEGER NOT NULL, `utcOffset` INTEGER NOT NULL, `targetBGLow` REAL NOT NULL, `targetBGHigh` REAL NOT NULL, `isf` REAL NOT NULL, `ic` REAL NOT NULL, `bolusIOB` REAL NOT NULL, `wasBolusIOBUsed` INTEGER NOT NULL, `basalIOB` REAL NOT NULL, `wasBasalIOBUsed` INTEGER NOT NULL, `glucoseValue` REAL NOT NULL, `wasGlucoseUsed` INTEGER NOT NULL, `glucoseDifference` REAL NOT NULL, `glucoseInsulin` REAL NOT NULL, `glucoseTrend` REAL NOT NULL, `wasTrendUsed` INTEGER NOT NULL, `trendInsulin` REAL NOT NULL, `cob` REAL NOT NULL, `wasCOBUsed` INTEGER NOT NULL, `cobInsulin` REAL NOT NULL, `carbs` REAL NOT NULL, `wereCarbsUsed` INTEGER NOT NULL, `carbsInsulin` REAL NOT NULL, `otherCorrection` REAL NOT NULL, `wasSuperbolusUsed` INTEGER NOT NULL, `superbolusInsulin` REAL NOT NULL, `wasTempTargetUsed` INTEGER NOT NULL, `totalInsulin` REAL NOT NULL, `percentageCorrection` INTEGER NOT NULL, `profileName` TEXT NOT NULL, `nightscoutSystemId` TEXT, `nightscoutId` TEXT, `pumpType` TEXT, `pumpSerial` TEXT, `pumpId` INTEGER, `startId` INTEGER, `endId` INTEGER, FOREIGN KEY(`referenceId`) REFERENCES `bolusCalculatorResults`(`id`) ON UPDATE NO ACTION ON DELETE NO ACTION )")
- database.execSQL("CREATE INDEX IF NOT EXISTS `index_bolusCalculatorResults_referenceId` ON bolusCalculatorResults (`referenceId`)")
- database.execSQL("CREATE INDEX IF NOT EXISTS `index_bolusCalculatorResults_timestamp` ON bolusCalculatorResults (`timestamp`)")
-
- database.execSQL("DROP TABLE IF EXISTS mealLinks")
- database.execSQL("CREATE TABLE IF NOT EXISTS mealLinks (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `version` INTEGER NOT NULL, `dateCreated` INTEGER NOT NULL, `isValid` INTEGER NOT NULL, `referenceId` INTEGER, `timestamp` INTEGER NOT NULL, `utcOffset` INTEGER NOT NULL, `bolusId` INTEGER, `carbsId` INTEGER, `bolusCalcResultId` INTEGER, `superbolusTempBasalId` INTEGER, `noteId` INTEGER, `nightscoutSystemId` TEXT, `nightscoutId` TEXT, `pumpType` TEXT, `pumpSerial` TEXT, `pumpId` INTEGER, `startId` INTEGER, `endId` INTEGER, FOREIGN KEY(`bolusId`) REFERENCES `boluses`(`id`) ON UPDATE NO ACTION ON DELETE NO ACTION , FOREIGN KEY(`carbsId`) REFERENCES `carbs`(`id`) ON UPDATE NO ACTION ON DELETE NO ACTION , FOREIGN KEY(`bolusCalcResultId`) REFERENCES `bolusCalculatorResults`(`id`) ON UPDATE NO ACTION ON DELETE NO ACTION , FOREIGN KEY(`superbolusTempBasalId`) REFERENCES `temporaryBasals`(`id`) ON UPDATE NO ACTION ON DELETE NO ACTION , FOREIGN KEY(`noteId`) REFERENCES `therapyEvents`(`id`) ON UPDATE NO ACTION ON DELETE NO ACTION , FOREIGN KEY(`referenceId`) REFERENCES `mealLinks`(`id`) ON UPDATE NO ACTION ON DELETE NO ACTION )")
- database.execSQL("CREATE INDEX IF NOT EXISTS `index_mealLinks_referenceId` ON mealLinks (`referenceId`)")
- database.execSQL("CREATE INDEX IF NOT EXISTS `index_mealLinks_bolusId` ON `mealLinks (`bolusId`)")
- database.execSQL("CREATE INDEX IF NOT EXISTS `index_mealLinks_carbsId` ON mealLinks (`carbsId`)")
- database.execSQL("CREATE INDEX IF NOT EXISTS `index_mealLinks_bolusCalcResultId` ON mealLinks (`bolusCalcResultId`)")
- database.execSQL("CREATE INDEX IF NOT EXISTS `index_mealLinks_superbolusTempBasalId` ON mealLinks (`superbolusTempBasalId`)")
- database.execSQL("CREATE INDEX IF NOT EXISTS `index_mealLinks_noteId` ON mealLinks (`noteId`)")
- }
- }
-
- private val migration11to12 = object : Migration(11,12) {
- override fun migrate(database: SupportSQLiteDatabase) {
- database.execSQL("DROP TABLE IF EXISTS userEntry")
- database.execSQL("CREATE TABLE IF NOT EXISTS userEntry (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `timestamp` INTEGER NOT NULL, `utcOffset` INTEGER NOT NULL, `action` TEXT NOT NULL, `source` TEXT NOT NULL, `note` TEXT NOT NULL, `values` TEXT NOT NULL)")
- }
- }
}
\ No newline at end of file
diff --git a/database/src/main/java/info/nightscout/androidaps/database/DelegatedAppDatabase.kt b/database/src/main/java/info/nightscout/androidaps/database/DelegatedAppDatabase.kt
index 22ffbb4154..f436dc99e7 100644
--- a/database/src/main/java/info/nightscout/androidaps/database/DelegatedAppDatabase.kt
+++ b/database/src/main/java/info/nightscout/androidaps/database/DelegatedAppDatabase.kt
@@ -2,6 +2,7 @@ package info.nightscout.androidaps.database
import info.nightscout.androidaps.database.daos.*
import info.nightscout.androidaps.database.daos.delegated.*
+import info.nightscout.androidaps.database.entities.OfflineEvent
import info.nightscout.androidaps.database.interfaces.DBEntry
internal class DelegatedAppDatabase(val changes: MutableList, val database: AppDatabase) {
@@ -25,5 +26,6 @@ internal class DelegatedAppDatabase(val changes: MutableList, val datab
val preferenceChangeDao: PreferenceChangeDao = DelegatedPreferenceChangeDao(changes, database.preferenceChangeDao)
val foodDao: FoodDao = DelegatedFoodDao(changes, database.foodDao)
val deviceStatusDao: DeviceStatusDao = DelegatedDeviceStatusDao(changes, database.deviceStatusDao)
+ val offlineEventDao: OfflineEventDao = DelegatedOfflineEventDao(changes, database.offlineEventDao)
fun clearAllTables() = database.clearAllTables()
}
\ No newline at end of file
diff --git a/database/src/main/java/info/nightscout/androidaps/database/TableNames.kt b/database/src/main/java/info/nightscout/androidaps/database/TableNames.kt
index a22a280a2a..6cfc7e1de0 100644
--- a/database/src/main/java/info/nightscout/androidaps/database/TableNames.kt
+++ b/database/src/main/java/info/nightscout/androidaps/database/TableNames.kt
@@ -14,6 +14,7 @@ const val TABLE_MULTIWAVE_BOLUS_LINKS = "multiwaveBolusLinks"
const val TABLE_PROFILE_SWITCHES = "profileSwitches"
const val TABLE_TEMPORARY_BASALS = "temporaryBasals"
const val TABLE_TEMPORARY_TARGETS = "temporaryTargets"
+const val TABLE_OFFLINE_EVENTS = "offlineEvents"
const val TABLE_TOTAL_DAILY_DOSES = "totalDailyDoses"
const val TABLE_THERAPY_EVENTS = "therapyEvents"
const val TABLE_PREFERENCE_CHANGES = "preferenceChanges"
diff --git a/database/src/main/java/info/nightscout/androidaps/database/daos/BolusCalculatorResultDao.kt b/database/src/main/java/info/nightscout/androidaps/database/daos/BolusCalculatorResultDao.kt
index a1f5788368..600a01de0b 100644
--- a/database/src/main/java/info/nightscout/androidaps/database/daos/BolusCalculatorResultDao.kt
+++ b/database/src/main/java/info/nightscout/androidaps/database/daos/BolusCalculatorResultDao.kt
@@ -18,6 +18,9 @@ internal interface BolusCalculatorResultDao : TraceableDao
+
@Query("SELECT * FROM $TABLE_BOLUS_CALCULATOR_RESULTS WHERE isValid = 1 AND timestamp >= :timestamp AND referenceId IS NULL ORDER BY id DESC")
fun getBolusCalculatorResultsFromTime(timestamp: Long): Single>
diff --git a/database/src/main/java/info/nightscout/androidaps/database/daos/BolusDao.kt b/database/src/main/java/info/nightscout/androidaps/database/daos/BolusDao.kt
index 326e08e1dd..2483cb04cc 100644
--- a/database/src/main/java/info/nightscout/androidaps/database/daos/BolusDao.kt
+++ b/database/src/main/java/info/nightscout/androidaps/database/daos/BolusDao.kt
@@ -18,6 +18,9 @@ internal interface BolusDao : TraceableDao {
@Query("DELETE FROM $TABLE_BOLUSES")
override fun deleteAllEntries()
+ @Query("SELECT id FROM $TABLE_BOLUSES ORDER BY id DESC limit 1")
+ fun getLastId(): Maybe
+
@Query("SELECT * FROM $TABLE_BOLUSES WHERE timestamp = :timestamp AND referenceId IS NULL")
fun findByTimestamp(timestamp: Long): Bolus?
diff --git a/database/src/main/java/info/nightscout/androidaps/database/daos/CarbsDao.kt b/database/src/main/java/info/nightscout/androidaps/database/daos/CarbsDao.kt
index 025eb04a02..fabed9ae77 100644
--- a/database/src/main/java/info/nightscout/androidaps/database/daos/CarbsDao.kt
+++ b/database/src/main/java/info/nightscout/androidaps/database/daos/CarbsDao.kt
@@ -17,6 +17,9 @@ internal interface CarbsDao : TraceableDao {
@Query("DELETE FROM $TABLE_CARBS")
override fun deleteAllEntries()
+ @Query("SELECT id FROM $TABLE_CARBS ORDER BY id DESC limit 1")
+ fun getLastId(): Maybe
+
@Query("SELECT * FROM $TABLE_CARBS WHERE nightscoutId = :nsId AND referenceId IS NULL")
fun findByNSId(nsId: String): Carbs?
diff --git a/database/src/main/java/info/nightscout/androidaps/database/daos/DeviceStatusDao.kt b/database/src/main/java/info/nightscout/androidaps/database/daos/DeviceStatusDao.kt
index 239081d607..23fdc1a05c 100644
--- a/database/src/main/java/info/nightscout/androidaps/database/daos/DeviceStatusDao.kt
+++ b/database/src/main/java/info/nightscout/androidaps/database/daos/DeviceStatusDao.kt
@@ -25,6 +25,9 @@ internal interface DeviceStatusDao {
@Query("DELETE FROM $TABLE_DEVICE_STATUS")
fun deleteAllEntries()
+ @Query("SELECT id FROM $TABLE_DEVICE_STATUS ORDER BY id DESC limit 1")
+ fun getLastId(): Maybe
+
@Query("DELETE FROM $TABLE_DEVICE_STATUS WHERE id NOT IN (SELECT MAX(id) FROM $TABLE_DEVICE_STATUS)")
fun deleteAllEntriesExceptLast()
diff --git a/database/src/main/java/info/nightscout/androidaps/database/daos/EffectiveProfileSwitchDao.kt b/database/src/main/java/info/nightscout/androidaps/database/daos/EffectiveProfileSwitchDao.kt
index c6944d05ad..592c21bd0b 100644
--- a/database/src/main/java/info/nightscout/androidaps/database/daos/EffectiveProfileSwitchDao.kt
+++ b/database/src/main/java/info/nightscout/androidaps/database/daos/EffectiveProfileSwitchDao.kt
@@ -17,6 +17,9 @@ internal interface EffectiveProfileSwitchDao : TraceableDao
+
@Query("SELECT * FROM $TABLE_EFFECTIVE_PROFILE_SWITCHES WHERE isValid = 1 AND referenceId IS NULL ORDER BY id ASC LIMIT 1")
fun getOldestEffectiveProfileSwitchRecord(): EffectiveProfileSwitch?
diff --git a/database/src/main/java/info/nightscout/androidaps/database/daos/ExtendedBolusDao.kt b/database/src/main/java/info/nightscout/androidaps/database/daos/ExtendedBolusDao.kt
index 8f318577f8..657ee3b7ff 100644
--- a/database/src/main/java/info/nightscout/androidaps/database/daos/ExtendedBolusDao.kt
+++ b/database/src/main/java/info/nightscout/androidaps/database/daos/ExtendedBolusDao.kt
@@ -18,6 +18,9 @@ internal interface ExtendedBolusDao : TraceableDao {
@Query("DELETE FROM $TABLE_EXTENDED_BOLUSES")
override fun deleteAllEntries()
+ @Query("SELECT id FROM $TABLE_EXTENDED_BOLUSES ORDER BY id DESC limit 1")
+ fun getLastId(): Maybe
+
@Query("SELECT * FROM $TABLE_EXTENDED_BOLUSES WHERE timestamp = :timestamp AND referenceId IS NULL")
fun findByTimestamp(timestamp: Long): ExtendedBolus?
diff --git a/database/src/main/java/info/nightscout/androidaps/database/daos/FoodDao.kt b/database/src/main/java/info/nightscout/androidaps/database/daos/FoodDao.kt
index b7fe24d3a0..bac97a3cb6 100644
--- a/database/src/main/java/info/nightscout/androidaps/database/daos/FoodDao.kt
+++ b/database/src/main/java/info/nightscout/androidaps/database/daos/FoodDao.kt
@@ -17,6 +17,9 @@ internal interface FoodDao : TraceableDao {
@Query("DELETE FROM $TABLE_FOODS")
override fun deleteAllEntries()
+ @Query("SELECT id FROM $TABLE_FOODS ORDER BY id DESC limit 1")
+ fun getLastId(): Maybe
+
@Query("SELECT * FROM $TABLE_FOODS WHERE nightscoutId = :nsId AND referenceId IS NULL")
fun findByNSId(nsId: String): Food?
diff --git a/database/src/main/java/info/nightscout/androidaps/database/daos/GlucoseValueDao.kt b/database/src/main/java/info/nightscout/androidaps/database/daos/GlucoseValueDao.kt
index 0738101140..bda5c63b2f 100644
--- a/database/src/main/java/info/nightscout/androidaps/database/daos/GlucoseValueDao.kt
+++ b/database/src/main/java/info/nightscout/androidaps/database/daos/GlucoseValueDao.kt
@@ -16,6 +16,12 @@ internal interface GlucoseValueDao : TraceableDao {
@Query("DELETE FROM $TABLE_GLUCOSE_VALUES")
override fun deleteAllEntries()
+ @Query("SELECT * FROM $TABLE_GLUCOSE_VALUES WHERE isValid = 1 AND referenceId IS NULL ORDER BY id DESC limit 1")
+ fun getLast(): Maybe
+
+ @Query("SELECT id FROM $TABLE_GLUCOSE_VALUES ORDER BY id DESC limit 1")
+ fun getLastId(): Maybe
+
@Query("SELECT * FROM $TABLE_GLUCOSE_VALUES WHERE nightscoutId = :nsId AND referenceId IS NULL")
fun findByNSIdMaybe(nsId: String): Maybe
diff --git a/database/src/main/java/info/nightscout/androidaps/database/daos/OfflineEventDao.kt b/database/src/main/java/info/nightscout/androidaps/database/daos/OfflineEventDao.kt
new file mode 100644
index 0000000000..68d60cd058
--- /dev/null
+++ b/database/src/main/java/info/nightscout/androidaps/database/daos/OfflineEventDao.kt
@@ -0,0 +1,51 @@
+package info.nightscout.androidaps.database.daos
+
+import androidx.room.Dao
+import androidx.room.Query
+import info.nightscout.androidaps.database.TABLE_OFFLINE_EVENTS
+import info.nightscout.androidaps.database.entities.OfflineEvent
+import io.reactivex.Maybe
+import io.reactivex.Single
+
+@Suppress("FunctionName")
+@Dao
+internal interface OfflineEventDao : TraceableDao {
+
+ @Query("SELECT * FROM $TABLE_OFFLINE_EVENTS WHERE id = :id")
+ override fun findById(id: Long): OfflineEvent?
+
+ @Query("DELETE FROM $TABLE_OFFLINE_EVENTS")
+ override fun deleteAllEntries()
+
+ @Query("SELECT id FROM $TABLE_OFFLINE_EVENTS ORDER BY id DESC limit 1")
+ fun getLastId(): Maybe
+
+ @Query("SELECT * FROM $TABLE_OFFLINE_EVENTS WHERE nightscoutId = :nsId AND referenceId IS NULL")
+ fun findByNSId(nsId: String): OfflineEvent?
+
+ @Query("SELECT * FROM $TABLE_OFFLINE_EVENTS WHERE timestamp <= :timestamp AND (timestamp + duration) > :timestamp AND referenceId IS NULL AND isValid = 1 ORDER BY timestamp DESC LIMIT 1")
+ fun getOfflineEventActiveAt(timestamp: Long): Maybe
+
+ @Query("SELECT * FROM $TABLE_OFFLINE_EVENTS WHERE timestamp >= :timestamp AND isValid = 1 AND referenceId IS NULL ORDER BY timestamp ASC")
+ fun getOfflineEventDataFromTime(timestamp: Long): Single>
+
+ @Query("SELECT * FROM $TABLE_OFFLINE_EVENTS WHERE timestamp >= :timestamp AND referenceId IS NULL ORDER BY timestamp ASC")
+ fun getOfflineEventDataIncludingInvalidFromTime(timestamp: Long): Single>
+
+ @Query("SELECT * FROM $TABLE_OFFLINE_EVENTS WHERE timestamp BETWEEN :start AND :end AND isValid = 1 AND referenceId IS NULL ORDER BY timestamp ASC")
+ fun getOfflineEventDataFromTimeToTime(start: Long, end: Long): Single>
+
+ @Query("SELECT * FROM $TABLE_OFFLINE_EVENTS WHERE isValid = 1 AND referenceId IS NULL ORDER BY timestamp ASC")
+ fun getOfflineEventData(): Single>
+
+ // This query will be used with v3 to get all changed records
+ @Query("SELECT * FROM $TABLE_OFFLINE_EVENTS WHERE id > :id AND referenceId IS NULL OR id IN (SELECT DISTINCT referenceId FROM $TABLE_OFFLINE_EVENTS WHERE id > :id) ORDER BY id ASC")
+ fun getModifiedFrom(id: Long): Single>
+
+ // for WS we need 1 record only
+ @Query("SELECT * FROM $TABLE_OFFLINE_EVENTS WHERE id > :id ORDER BY id ASC limit 1")
+ fun getNextModifiedOrNewAfter(id: Long): Maybe
+
+ @Query("SELECT * FROM $TABLE_OFFLINE_EVENTS WHERE id = :referenceId")
+ fun getCurrentFromHistoric(referenceId: Long): Maybe
+}
\ No newline at end of file
diff --git a/database/src/main/java/info/nightscout/androidaps/database/daos/ProfileSwitchDao.kt b/database/src/main/java/info/nightscout/androidaps/database/daos/ProfileSwitchDao.kt
index c992e592be..598679864b 100644
--- a/database/src/main/java/info/nightscout/androidaps/database/daos/ProfileSwitchDao.kt
+++ b/database/src/main/java/info/nightscout/androidaps/database/daos/ProfileSwitchDao.kt
@@ -19,6 +19,9 @@ internal interface ProfileSwitchDao : ProfileSwitchDaoWorkaround {
@Query("DELETE FROM $TABLE_PROFILE_SWITCHES")
override fun deleteAllEntries()
+ @Query("SELECT id FROM $TABLE_PROFILE_SWITCHES ORDER BY id DESC limit 1")
+ fun getLastId(): Maybe
+
@Query("SELECT * FROM $TABLE_PROFILE_SWITCHES WHERE timestamp = :timestamp AND referenceId IS NULL")
fun findByTimestamp(timestamp: Long): ProfileSwitch?
diff --git a/database/src/main/java/info/nightscout/androidaps/database/daos/TemporaryBasalDao.kt b/database/src/main/java/info/nightscout/androidaps/database/daos/TemporaryBasalDao.kt
index 49f0c8342c..f2cdd2617e 100644
--- a/database/src/main/java/info/nightscout/androidaps/database/daos/TemporaryBasalDao.kt
+++ b/database/src/main/java/info/nightscout/androidaps/database/daos/TemporaryBasalDao.kt
@@ -18,6 +18,12 @@ internal interface TemporaryBasalDao : TraceableDao {
@Query("DELETE FROM $TABLE_TEMPORARY_BASALS")
override fun deleteAllEntries()
+ @Query("SELECT id FROM $TABLE_TEMPORARY_BASALS ORDER BY id DESC limit 1")
+ fun getLastId(): Maybe
+
+ @Query("SELECT * FROM $TABLE_TEMPORARY_BASALS WHERE temporaryId = :temporaryId")
+ fun findByTempId(temporaryId: Long): TemporaryBasal?
+
@Query("SELECT * FROM $TABLE_TEMPORARY_BASALS WHERE timestamp = :timestamp AND referenceId IS NULL")
fun findByTimestamp(timestamp: Long): TemporaryBasal?
@@ -30,6 +36,9 @@ internal interface TemporaryBasalDao : TraceableDao {
@Query("SELECT * FROM $TABLE_TEMPORARY_BASALS WHERE nightscoutId = :nsId AND referenceId IS NULL")
fun findByNSId(nsId: String): TemporaryBasal?
+ @Query("SELECT * FROM $TABLE_TEMPORARY_BASALS WHERE temporaryId = :temporaryId AND pumpType = :pumpType AND pumpSerial = :pumpSerial AND referenceId IS NULL")
+ fun findByPumpTempIds(temporaryId: Long, pumpType: InterfaceIDs.PumpType, pumpSerial: String): TemporaryBasal?
+
@Query("SELECT * FROM $TABLE_TEMPORARY_BASALS WHERE timestamp <= :timestamp AND (timestamp + duration) > :timestamp AND pumpType = :pumpType AND pumpSerial = :pumpSerial AND referenceId IS NULL AND isValid = 1 ORDER BY timestamp DESC LIMIT 1")
fun getTemporaryBasalActiveAt(timestamp: Long, pumpType: InterfaceIDs.PumpType, pumpSerial: String): Maybe
diff --git a/database/src/main/java/info/nightscout/androidaps/database/daos/TemporaryTargetDao.kt b/database/src/main/java/info/nightscout/androidaps/database/daos/TemporaryTargetDao.kt
index 7a5eaee720..065eb76595 100644
--- a/database/src/main/java/info/nightscout/androidaps/database/daos/TemporaryTargetDao.kt
+++ b/database/src/main/java/info/nightscout/androidaps/database/daos/TemporaryTargetDao.kt
@@ -17,6 +17,9 @@ internal interface TemporaryTargetDao : TraceableDao {
@Query("DELETE FROM $TABLE_TEMPORARY_TARGETS")
override fun deleteAllEntries()
+ @Query("SELECT id FROM $TABLE_TEMPORARY_TARGETS ORDER BY id DESC limit 1")
+ fun getLastId(): Maybe
+
@Query("SELECT * FROM $TABLE_TEMPORARY_TARGETS WHERE nightscoutId = :nsId AND referenceId IS NULL")
fun findByNSId(nsId: String): TemporaryTarget?
diff --git a/database/src/main/java/info/nightscout/androidaps/database/daos/TherapyEventDao.kt b/database/src/main/java/info/nightscout/androidaps/database/daos/TherapyEventDao.kt
index fcec0b020d..dea04b81b2 100644
--- a/database/src/main/java/info/nightscout/androidaps/database/daos/TherapyEventDao.kt
+++ b/database/src/main/java/info/nightscout/androidaps/database/daos/TherapyEventDao.kt
@@ -16,6 +16,9 @@ internal interface TherapyEventDao : TraceableDao {
@Query("DELETE FROM $TABLE_THERAPY_EVENTS")
override fun deleteAllEntries()
+ @Query("SELECT id FROM $TABLE_THERAPY_EVENTS ORDER BY id DESC limit 1")
+ fun getLastId(): Maybe
+
@Query("SELECT * FROM $TABLE_THERAPY_EVENTS WHERE type = :type AND timestamp = :timestamp AND referenceId IS NULL")
fun findByTimestamp(type: TherapyEvent.Type, timestamp: Long): TherapyEvent?
diff --git a/database/src/main/java/info/nightscout/androidaps/database/daos/delegated/DelegatedOfflineEventDao.kt b/database/src/main/java/info/nightscout/androidaps/database/daos/delegated/DelegatedOfflineEventDao.kt
new file mode 100644
index 0000000000..fc2bc94c30
--- /dev/null
+++ b/database/src/main/java/info/nightscout/androidaps/database/daos/delegated/DelegatedOfflineEventDao.kt
@@ -0,0 +1,18 @@
+package info.nightscout.androidaps.database.daos.delegated
+
+import info.nightscout.androidaps.database.daos.OfflineEventDao
+import info.nightscout.androidaps.database.entities.OfflineEvent
+import info.nightscout.androidaps.database.interfaces.DBEntry
+
+internal class DelegatedOfflineEventDao(changes: MutableList, private val dao: OfflineEventDao) : DelegatedDao(changes), OfflineEventDao by dao {
+
+ override fun insertNewEntry(entry: OfflineEvent): Long {
+ changes.add(entry)
+ return dao.insertNewEntry(entry)
+ }
+
+ override fun updateExistingEntry(entry: OfflineEvent): Long {
+ changes.add(entry)
+ return dao.updateExistingEntry(entry)
+ }
+}
\ No newline at end of file
diff --git a/database/src/main/java/info/nightscout/androidaps/database/entities/Bolus.kt b/database/src/main/java/info/nightscout/androidaps/database/entities/Bolus.kt
index afc6108867..d174f9b25d 100644
--- a/database/src/main/java/info/nightscout/androidaps/database/entities/Bolus.kt
+++ b/database/src/main/java/info/nightscout/androidaps/database/entities/Bolus.kt
@@ -18,7 +18,16 @@ import java.util.*
entity = Bolus::class,
parentColumns = ["id"],
childColumns = ["referenceId"])],
- indices = [Index("referenceId"), Index("timestamp")])
+ indices = [
+ Index("id"),
+ Index("isValid"),
+ Index("temporaryId"),
+ Index("pumpId"),
+ Index("pumpSerial"),
+ Index("pumpType"),
+ Index("referenceId"),
+ Index("timestamp")
+ ])
data class Bolus(
@PrimaryKey(autoGenerate = true)
override var id: Long = 0,
diff --git a/database/src/main/java/info/nightscout/androidaps/database/entities/BolusCalculatorResult.kt b/database/src/main/java/info/nightscout/androidaps/database/entities/BolusCalculatorResult.kt
index e88699f9ea..8e1f0b0532 100644
--- a/database/src/main/java/info/nightscout/androidaps/database/entities/BolusCalculatorResult.kt
+++ b/database/src/main/java/info/nightscout/androidaps/database/entities/BolusCalculatorResult.kt
@@ -12,7 +12,12 @@ import java.util.TimeZone
entity = BolusCalculatorResult::class,
parentColumns = ["id"],
childColumns = ["referenceId"])],
- indices = [Index("referenceId"), Index("timestamp")])
+ indices = [
+ Index("referenceId"),
+ Index("timestamp"),
+ Index("id"),
+ Index("isValid")
+ ])
data class BolusCalculatorResult(
@PrimaryKey(autoGenerate = true)
override var id: Long = 0,
diff --git a/database/src/main/java/info/nightscout/androidaps/database/entities/Carbs.kt b/database/src/main/java/info/nightscout/androidaps/database/entities/Carbs.kt
index cd5a41ab87..c068da1bfe 100644
--- a/database/src/main/java/info/nightscout/androidaps/database/entities/Carbs.kt
+++ b/database/src/main/java/info/nightscout/androidaps/database/entities/Carbs.kt
@@ -16,7 +16,13 @@ import java.util.*
entity = Carbs::class,
parentColumns = ["id"],
childColumns = ["referenceId"])],
- indices = [Index("referenceId"), Index("timestamp")])
+ indices = [
+ Index("id"),
+ Index("isValid"),
+ Index("nightscoutId"),
+ Index("referenceId"),
+ Index("timestamp")
+ ])
data class Carbs(
@PrimaryKey(autoGenerate = true)
override var id: Long = 0,
diff --git a/database/src/main/java/info/nightscout/androidaps/database/entities/DeviceStatus.kt b/database/src/main/java/info/nightscout/androidaps/database/entities/DeviceStatus.kt
index 87763245fc..516be6f9ce 100644
--- a/database/src/main/java/info/nightscout/androidaps/database/entities/DeviceStatus.kt
+++ b/database/src/main/java/info/nightscout/androidaps/database/entities/DeviceStatus.kt
@@ -11,7 +11,11 @@ import java.util.*
@Entity(tableName = TABLE_DEVICE_STATUS,
foreignKeys = [],
- indices = [Index("timestamp")])
+ indices = [
+ Index("id"),
+ Index("nightscoutId"),
+ Index("timestamp")
+ ])
data class DeviceStatus(
@PrimaryKey(autoGenerate = true)
var id: Long = 0,
diff --git a/database/src/main/java/info/nightscout/androidaps/database/entities/EffectiveProfileSwitch.kt b/database/src/main/java/info/nightscout/androidaps/database/entities/EffectiveProfileSwitch.kt
index a38e254c5b..7a2285831e 100644
--- a/database/src/main/java/info/nightscout/androidaps/database/entities/EffectiveProfileSwitch.kt
+++ b/database/src/main/java/info/nightscout/androidaps/database/entities/EffectiveProfileSwitch.kt
@@ -19,7 +19,12 @@ import java.util.*
entity = EffectiveProfileSwitch::class,
parentColumns = ["id"],
childColumns = ["referenceId"])],
- indices = [Index("referenceId"), Index("timestamp")])
+ indices = [
+ Index("id"),
+ Index("referenceId"),
+ Index("timestamp"),
+ Index("isValid")
+ ])
data class EffectiveProfileSwitch(
@PrimaryKey(autoGenerate = true)
override var id: Long = 0,
@@ -45,7 +50,7 @@ data class EffectiveProfileSwitch(
var originalEnd: Long,
@Embedded
var insulinConfiguration: InsulinConfiguration
-) : TraceableDBEntry, DBEntryWithTime{
+) : TraceableDBEntry, DBEntryWithTime {
enum class GlucoseUnit {
MGDL,
diff --git a/database/src/main/java/info/nightscout/androidaps/database/entities/ExtendedBolus.kt b/database/src/main/java/info/nightscout/androidaps/database/entities/ExtendedBolus.kt
index 08a218aea8..c59afdd34c 100644
--- a/database/src/main/java/info/nightscout/androidaps/database/entities/ExtendedBolus.kt
+++ b/database/src/main/java/info/nightscout/androidaps/database/entities/ExtendedBolus.kt
@@ -16,7 +16,16 @@ import java.util.*
entity = ExtendedBolus::class,
parentColumns = ["id"],
childColumns = ["referenceId"])],
- indices = [Index("referenceId"), Index("timestamp")])
+ indices = [
+ Index("id"),
+ Index("isValid"),
+ Index("endId"),
+ Index("pumpSerial"),
+ Index("pumpId"),
+ Index("pumpType"),
+ Index("referenceId"),
+ Index("timestamp")
+ ])
data class ExtendedBolus(
@PrimaryKey(autoGenerate = true)
override var id: Long = 0,
diff --git a/database/src/main/java/info/nightscout/androidaps/database/entities/Food.kt b/database/src/main/java/info/nightscout/androidaps/database/entities/Food.kt
index 9c4cfc9129..762edf38c7 100644
--- a/database/src/main/java/info/nightscout/androidaps/database/entities/Food.kt
+++ b/database/src/main/java/info/nightscout/androidaps/database/entities/Food.kt
@@ -14,7 +14,12 @@ import info.nightscout.androidaps.database.interfaces.TraceableDBEntry
entity = Food::class,
parentColumns = ["id"],
childColumns = ["referenceId"])],
- indices = [Index("referenceId")])
+ indices = [
+ Index("id"),
+ Index("nightscoutId"),
+ Index("referenceId"),
+ Index("isValid")
+ ])
data class Food(
@PrimaryKey(autoGenerate = true)
override var id: Long = 0,
diff --git a/database/src/main/java/info/nightscout/androidaps/database/entities/GlucoseValue.kt b/database/src/main/java/info/nightscout/androidaps/database/entities/GlucoseValue.kt
index 85fab0a92c..d7140a7900 100644
--- a/database/src/main/java/info/nightscout/androidaps/database/entities/GlucoseValue.kt
+++ b/database/src/main/java/info/nightscout/androidaps/database/entities/GlucoseValue.kt
@@ -13,7 +13,13 @@ import java.util.TimeZone
entity = GlucoseValue::class,
parentColumns = ["id"],
childColumns = ["referenceId"])],
- indices = [Index("referenceId"), Index("timestamp")])
+ indices = [
+ Index("id"),
+ Index("nightscoutId"),
+ Index("sourceSensor"),
+ Index("referenceId"),
+ Index("timestamp")
+ ])
data class GlucoseValue(
@PrimaryKey(autoGenerate = true)
override var id: Long = 0,
diff --git a/database/src/main/java/info/nightscout/androidaps/database/entities/OfflineEvent.kt b/database/src/main/java/info/nightscout/androidaps/database/entities/OfflineEvent.kt
new file mode 100644
index 0000000000..c2af9d5edb
--- /dev/null
+++ b/database/src/main/java/info/nightscout/androidaps/database/entities/OfflineEvent.kt
@@ -0,0 +1,64 @@
+package info.nightscout.androidaps.database.entities
+
+import androidx.room.Embedded
+import androidx.room.Entity
+import androidx.room.ForeignKey
+import androidx.room.Index
+import androidx.room.PrimaryKey
+import info.nightscout.androidaps.database.TABLE_OFFLINE_EVENTS
+import info.nightscout.androidaps.database.embedments.InterfaceIDs
+import info.nightscout.androidaps.database.interfaces.DBEntryWithTimeAndDuration
+import info.nightscout.androidaps.database.interfaces.TraceableDBEntry
+import java.util.*
+
+@Entity(tableName = TABLE_OFFLINE_EVENTS,
+ foreignKeys = [ForeignKey(
+ entity = OfflineEvent::class,
+ parentColumns = ["id"],
+ childColumns = ["referenceId"])],
+ indices = [
+ Index("id"),
+ Index("isValid"),
+ Index("nightscoutId"),
+ Index("referenceId"),
+ Index("timestamp")
+ ])
+data class OfflineEvent(
+ @PrimaryKey(autoGenerate = true)
+ override var id: Long = 0,
+ override var version: Int = 0,
+ override var dateCreated: Long = -1,
+ override var isValid: Boolean = true,
+ override var referenceId: Long? = null,
+ @Embedded
+ override var interfaceIDs_backing: InterfaceIDs? = InterfaceIDs(),
+ override var timestamp: Long,
+ override var utcOffset: Long = TimeZone.getDefault().getOffset(timestamp).toLong(),
+ var reason: Reason,
+ override var duration: Long // in millis
+) : TraceableDBEntry, DBEntryWithTimeAndDuration {
+
+ fun contentEqualsTo(other: OfflineEvent): Boolean =
+ timestamp == other.timestamp &&
+ utcOffset == other.utcOffset &&
+ reason == other.reason &&
+ duration == other.duration &&
+ isValid == other.isValid
+
+ fun isRecordDeleted(other: OfflineEvent): Boolean =
+ isValid && !other.isValid
+
+ enum class Reason {
+ DISCONNECT_PUMP,
+ SUSPEND,
+ DISABLE_LOOP,
+ SUPER_BOLUS,
+ OTHER
+ ;
+
+ companion object {
+
+ fun fromString(reason: String?) = values().firstOrNull { it.name == reason } ?: OTHER
+ }
+ }
+}
\ No newline at end of file
diff --git a/database/src/main/java/info/nightscout/androidaps/database/entities/ProfileSwitch.kt b/database/src/main/java/info/nightscout/androidaps/database/entities/ProfileSwitch.kt
index 791c32abe0..569a895301 100644
--- a/database/src/main/java/info/nightscout/androidaps/database/entities/ProfileSwitch.kt
+++ b/database/src/main/java/info/nightscout/androidaps/database/entities/ProfileSwitch.kt
@@ -19,7 +19,13 @@ import java.util.*
entity = ProfileSwitch::class,
parentColumns = ["id"],
childColumns = ["referenceId"])],
- indices = [Index("referenceId"), Index("timestamp")])
+ indices = [
+ Index("referenceId"),
+ Index("timestamp"),
+ Index("isValid"),
+ Index("id"),
+ Index("nightscoutId")
+ ])
data class ProfileSwitch(
@PrimaryKey(autoGenerate = true)
override var id: Long = 0,
@@ -47,6 +53,7 @@ data class ProfileSwitch(
enum class GlucoseUnit {
MGDL,
MMOL;
- companion object {}
+
+ companion object
}
}
\ No newline at end of file
diff --git a/database/src/main/java/info/nightscout/androidaps/database/entities/TemporaryBasal.kt b/database/src/main/java/info/nightscout/androidaps/database/entities/TemporaryBasal.kt
index 8f5e709790..14d1b876e6 100644
--- a/database/src/main/java/info/nightscout/androidaps/database/entities/TemporaryBasal.kt
+++ b/database/src/main/java/info/nightscout/androidaps/database/entities/TemporaryBasal.kt
@@ -16,7 +16,17 @@ import java.util.*
entity = TemporaryBasal::class,
parentColumns = ["id"],
childColumns = ["referenceId"])],
- indices = [Index("referenceId"), Index("timestamp")])
+ indices = [
+ Index("id"),
+ Index("isValid"),
+ Index("nightscoutId"),
+ Index("pumpType"),
+ Index("endId"),
+ Index("pumpSerial"),
+ Index("temporaryId"),
+ Index("referenceId"),
+ Index("timestamp")
+ ])
data class TemporaryBasal(
@PrimaryKey(autoGenerate = true)
override var id: Long = 0,
@@ -35,8 +45,7 @@ data class TemporaryBasal(
) : TraceableDBEntry, DBEntryWithTimeAndDuration {
init {
- if (duration <= 0)
- require(duration > 0)
+ require(duration > 0)
}
enum class Type {
diff --git a/database/src/main/java/info/nightscout/androidaps/database/entities/TemporaryTarget.kt b/database/src/main/java/info/nightscout/androidaps/database/entities/TemporaryTarget.kt
index f70fe145cc..7e6c2774fc 100644
--- a/database/src/main/java/info/nightscout/androidaps/database/entities/TemporaryTarget.kt
+++ b/database/src/main/java/info/nightscout/androidaps/database/entities/TemporaryTarget.kt
@@ -17,7 +17,13 @@ import java.util.*
entity = TemporaryTarget::class,
parentColumns = ["id"],
childColumns = ["referenceId"])],
- indices = [Index("referenceId"), Index("timestamp")])
+ indices = [
+ Index("id"),
+ Index("isValid"),
+ Index("nightscoutId"),
+ Index("referenceId"),
+ Index("timestamp")
+ ])
data class TemporaryTarget(
@PrimaryKey(autoGenerate = true)
override var id: Long = 0,
diff --git a/database/src/main/java/info/nightscout/androidaps/database/entities/TherapyEvent.kt b/database/src/main/java/info/nightscout/androidaps/database/entities/TherapyEvent.kt
index 15e7a1a7fd..8a701e1e21 100644
--- a/database/src/main/java/info/nightscout/androidaps/database/entities/TherapyEvent.kt
+++ b/database/src/main/java/info/nightscout/androidaps/database/entities/TherapyEvent.kt
@@ -17,7 +17,14 @@ import java.util.*
entity = TherapyEvent::class,
parentColumns = ["id"],
childColumns = ["referenceId"])],
- indices = [Index("referenceId"), Index("timestamp")])
+ indices = [
+ Index("id"),
+ Index("type"),
+ Index("nightscoutId"),
+ Index("isValid"),
+ Index("referenceId"),
+ Index("timestamp")
+ ])
data class TherapyEvent(
@PrimaryKey(autoGenerate = true)
override var id: Long = 0,
diff --git a/database/src/main/java/info/nightscout/androidaps/database/entities/TotalDailyDose.kt b/database/src/main/java/info/nightscout/androidaps/database/entities/TotalDailyDose.kt
index fb386312a5..a45330c844 100644
--- a/database/src/main/java/info/nightscout/androidaps/database/entities/TotalDailyDose.kt
+++ b/database/src/main/java/info/nightscout/androidaps/database/entities/TotalDailyDose.kt
@@ -16,7 +16,15 @@ import java.util.*
entity = TotalDailyDose::class,
parentColumns = ["id"],
childColumns = ["referenceId"])],
- indices = [Index("referenceId"), Index("timestamp")])
+ indices = [
+ Index("id"),
+ Index("pumpId"),
+ Index("pumpType"),
+ Index("pumpSerial"),
+ Index("isValid"),
+ Index("referenceId"),
+ Index("timestamp")
+ ])
data class TotalDailyDose(
@PrimaryKey(autoGenerate = true)
override var id: Long = 0,
diff --git a/database/src/main/java/info/nightscout/androidaps/database/entities/UserEntry.kt b/database/src/main/java/info/nightscout/androidaps/database/entities/UserEntry.kt
index 4e98e31686..00e9a3e25d 100644
--- a/database/src/main/java/info/nightscout/androidaps/database/entities/UserEntry.kt
+++ b/database/src/main/java/info/nightscout/androidaps/database/entities/UserEntry.kt
@@ -1,13 +1,18 @@
package info.nightscout.androidaps.database.entities
import androidx.room.Entity
+import androidx.room.Index
import androidx.room.PrimaryKey
import info.nightscout.androidaps.database.TABLE_USER_ENTRY
import info.nightscout.androidaps.database.interfaces.DBEntry
import info.nightscout.androidaps.database.interfaces.DBEntryWithTime
import java.util.*
-@Entity(tableName = TABLE_USER_ENTRY)
+@Entity(tableName = TABLE_USER_ENTRY,
+ indices = [
+ Index("source"),
+ Index("timestamp")
+ ])
data class UserEntry(
@PrimaryKey(autoGenerate = true)
override var id: Long = 0L,
@@ -38,6 +43,8 @@ data class UserEntry(
OPEN_LOOP_MODE (ColorGroup.Loop),
LOOP_DISABLED (ColorGroup.Loop),
LOOP_ENABLED (ColorGroup.Loop),
+ LOOP_CHANGE (ColorGroup.Loop),
+ LOOP_REMOVED (ColorGroup.Loop),
RECONNECT (ColorGroup.Pump),
DISCONNECT (ColorGroup.Pump),
RESUME (ColorGroup.Loop),
diff --git a/database/src/main/java/info/nightscout/androidaps/database/entities/ValueWithUnit.kt b/database/src/main/java/info/nightscout/androidaps/database/entities/ValueWithUnit.kt
index 7cd94956f0..55709888f7 100644
--- a/database/src/main/java/info/nightscout/androidaps/database/entities/ValueWithUnit.kt
+++ b/database/src/main/java/info/nightscout/androidaps/database/entities/ValueWithUnit.kt
@@ -1,7 +1,5 @@
package info.nightscout.androidaps.database.entities
-import androidx.annotation.StringRes
-
sealed class ValueWithUnit {
object UNKNOWN : ValueWithUnit() // formerly None used as fallback
@@ -34,6 +32,8 @@ sealed class ValueWithUnit {
data class TherapyEventTTReason(val value: TemporaryTarget.Reason) : ValueWithUnit()
+ data class OfflineEventReason(val value: OfflineEvent.Reason) : ValueWithUnit()
+
fun value(): Any? {
return when(this) {
is Gram -> this.value
@@ -47,6 +47,7 @@ sealed class ValueWithUnit {
is SimpleString -> this.value
is TherapyEventMeterType -> this.value
is TherapyEventTTReason -> this.value
+ is OfflineEventReason -> this.value
is TherapyEventType -> this.value
is Timestamp -> this.value
is UnitPerHour -> this.value
diff --git a/database/src/main/java/info/nightscout/androidaps/database/interfaces/DBEntryWithTimeAndDuration.kt b/database/src/main/java/info/nightscout/androidaps/database/interfaces/DBEntryWithTimeAndDuration.kt
index b4f3f0bbbf..01f41c7f3f 100644
--- a/database/src/main/java/info/nightscout/androidaps/database/interfaces/DBEntryWithTimeAndDuration.kt
+++ b/database/src/main/java/info/nightscout/androidaps/database/interfaces/DBEntryWithTimeAndDuration.kt
@@ -8,6 +8,7 @@ var DBEntryWithTimeAndDuration.end
get() = timestamp + duration
set(value) {
duration = value - timestamp
+ require(duration > 0)
}
@JvmOverloads
diff --git a/database/src/main/java/info/nightscout/androidaps/database/transactions/CancelCurrentOfflineEventIfAnyTransaction.kt b/database/src/main/java/info/nightscout/androidaps/database/transactions/CancelCurrentOfflineEventIfAnyTransaction.kt
new file mode 100644
index 0000000000..6d5e1c1794
--- /dev/null
+++ b/database/src/main/java/info/nightscout/androidaps/database/transactions/CancelCurrentOfflineEventIfAnyTransaction.kt
@@ -0,0 +1,25 @@
+package info.nightscout.androidaps.database.transactions
+
+import info.nightscout.androidaps.database.entities.OfflineEvent
+import info.nightscout.androidaps.database.interfaces.end
+
+class CancelCurrentOfflineEventIfAnyTransaction(
+ val timestamp: Long
+) : Transaction() {
+
+ override fun run(): TransactionResult {
+ val result = TransactionResult()
+ val current = database.offlineEventDao.getOfflineEventActiveAt(timestamp).blockingGet()
+ if (current != null) {
+ current.end = timestamp
+ database.offlineEventDao.updateExistingEntry(current)
+ result.updated.add(current)
+ }
+ return result
+ }
+
+ class TransactionResult {
+
+ val updated = mutableListOf()
+ }
+}
\ No newline at end of file
diff --git a/database/src/main/java/info/nightscout/androidaps/database/transactions/InsertAndCancelCurrentOfflineEventTransaction.kt b/database/src/main/java/info/nightscout/androidaps/database/transactions/InsertAndCancelCurrentOfflineEventTransaction.kt
new file mode 100644
index 0000000000..f4dd63fe81
--- /dev/null
+++ b/database/src/main/java/info/nightscout/androidaps/database/transactions/InsertAndCancelCurrentOfflineEventTransaction.kt
@@ -0,0 +1,30 @@
+package info.nightscout.androidaps.database.transactions
+
+import info.nightscout.androidaps.database.entities.OfflineEvent
+import info.nightscout.androidaps.database.interfaces.end
+
+class InsertAndCancelCurrentOfflineEventTransaction(
+ val offlineEvent: OfflineEvent
+) : Transaction() {
+
+ constructor(timestamp: Long, duration: Long, reason: OfflineEvent.Reason) :
+ this(OfflineEvent(timestamp = timestamp, reason = reason, duration = duration))
+
+ override fun run(): TransactionResult {
+ val result = TransactionResult()
+ val current = database.offlineEventDao.getOfflineEventActiveAt(offlineEvent.timestamp).blockingGet()
+ if (current != null) {
+ current.end = offlineEvent.timestamp
+ database.offlineEventDao.updateExistingEntry(current)
+ result.updated.add(current)
+ }
+ database.offlineEventDao.insertNewEntry(offlineEvent)
+ result.inserted.add(offlineEvent)
+ return result
+ }
+
+ class TransactionResult {
+ val inserted = mutableListOf()
+ val updated = mutableListOf()
+ }
+}
\ No newline at end of file
diff --git a/database/src/main/java/info/nightscout/androidaps/database/transactions/InsertTemporaryTargetAndCancelCurrentTransaction.kt b/database/src/main/java/info/nightscout/androidaps/database/transactions/InsertAndCancelCurrentTemporaryTargetTransaction.kt
similarity index 90%
rename from database/src/main/java/info/nightscout/androidaps/database/transactions/InsertTemporaryTargetAndCancelCurrentTransaction.kt
rename to database/src/main/java/info/nightscout/androidaps/database/transactions/InsertAndCancelCurrentTemporaryTargetTransaction.kt
index c100d0c358..87867309b6 100644
--- a/database/src/main/java/info/nightscout/androidaps/database/transactions/InsertTemporaryTargetAndCancelCurrentTransaction.kt
+++ b/database/src/main/java/info/nightscout/androidaps/database/transactions/InsertAndCancelCurrentTemporaryTargetTransaction.kt
@@ -3,9 +3,9 @@ package info.nightscout.androidaps.database.transactions
import info.nightscout.androidaps.database.entities.TemporaryTarget
import info.nightscout.androidaps.database.interfaces.end
-class InsertTemporaryTargetAndCancelCurrentTransaction(
+class InsertAndCancelCurrentTemporaryTargetTransaction(
val temporaryTarget: TemporaryTarget
-) : Transaction() {
+) : Transaction() {
constructor(timestamp: Long, duration: Long, reason: TemporaryTarget.Reason, lowTarget: Double, highTarget: Double) :
this(TemporaryTarget(timestamp = timestamp, reason = reason, lowTarget = lowTarget, highTarget = highTarget, duration = duration))
diff --git a/database/src/main/java/info/nightscout/androidaps/database/transactions/InsertPumpBolusWithTempIdTransaction.kt b/database/src/main/java/info/nightscout/androidaps/database/transactions/InsertBolusWithTempIdTransaction.kt
similarity index 87%
rename from database/src/main/java/info/nightscout/androidaps/database/transactions/InsertPumpBolusWithTempIdTransaction.kt
rename to database/src/main/java/info/nightscout/androidaps/database/transactions/InsertBolusWithTempIdTransaction.kt
index 97f8286eff..2b7ad086ac 100644
--- a/database/src/main/java/info/nightscout/androidaps/database/transactions/InsertPumpBolusWithTempIdTransaction.kt
+++ b/database/src/main/java/info/nightscout/androidaps/database/transactions/InsertBolusWithTempIdTransaction.kt
@@ -5,9 +5,9 @@ import info.nightscout.androidaps.database.entities.Bolus
/**
* Creates or updates the Bolus from pump synchronization
*/
-class InsertPumpBolusWithTempIdTransaction(
+class InsertBolusWithTempIdTransaction(
private val bolus: Bolus
-) : Transaction() {
+) : Transaction() {
override fun run(): TransactionResult {
bolus.interfaceIDs.temporaryId ?: bolus.interfaceIDs.pumpType ?: bolus.interfaceIDs.pumpSerial ?:
diff --git a/database/src/main/java/info/nightscout/androidaps/database/transactions/InsertTemporaryBasalWithTempIdTransaction.kt b/database/src/main/java/info/nightscout/androidaps/database/transactions/InsertTemporaryBasalWithTempIdTransaction.kt
new file mode 100644
index 0000000000..27f931bcd9
--- /dev/null
+++ b/database/src/main/java/info/nightscout/androidaps/database/transactions/InsertTemporaryBasalWithTempIdTransaction.kt
@@ -0,0 +1,28 @@
+package info.nightscout.androidaps.database.transactions
+
+import info.nightscout.androidaps.database.entities.TemporaryBasal
+
+/**
+ * Creates or updates the TemporaryBasal from pump synchronization
+ */
+class InsertTemporaryBasalWithTempIdTransaction(private val temporaryBasal: TemporaryBasal
+) : Transaction() {
+
+ override fun run(): TransactionResult {
+ temporaryBasal.interfaceIDs.temporaryId ?: temporaryBasal.interfaceIDs.pumpType
+ ?: temporaryBasal.interfaceIDs.pumpSerial
+ ?: throw IllegalStateException("Some pump ID is null")
+ val result = TransactionResult()
+ val current = database.temporaryBasalDao.findByPumpTempIds(temporaryBasal.interfaceIDs.temporaryId!!, temporaryBasal.interfaceIDs.pumpType!!, temporaryBasal.interfaceIDs.pumpSerial!!)
+ if (current == null) {
+ database.temporaryBasalDao.insert(temporaryBasal)
+ result.inserted.add(temporaryBasal)
+ }
+ return result
+ }
+
+ class TransactionResult {
+
+ val inserted = mutableListOf()
+ }
+}
\ No newline at end of file
diff --git a/database/src/main/java/info/nightscout/androidaps/database/transactions/InvalidateAAPSStartedTherapyEventTransaction.kt b/database/src/main/java/info/nightscout/androidaps/database/transactions/InvalidateAAPSStartedTherapyEventTransaction.kt
index 248b51d412..2a152c408c 100644
--- a/database/src/main/java/info/nightscout/androidaps/database/transactions/InvalidateAAPSStartedTherapyEventTransaction.kt
+++ b/database/src/main/java/info/nightscout/androidaps/database/transactions/InvalidateAAPSStartedTherapyEventTransaction.kt
@@ -8,7 +8,7 @@ class InvalidateAAPSStartedTherapyEventTransaction(private val note: String) : T
val result = TransactionResult()
val therapyEvents = database.therapyEventDao.getValidByType(TherapyEvent.Type.NOTE)
for (event in therapyEvents) {
- if (event.note?.contains(note) == true) {
+ if (event.note?.contains(note) == true && event.isValid) {
event.isValid = false
database.therapyEventDao.updateExistingEntry(event)
result.invalidated.add(event)
diff --git a/database/src/main/java/info/nightscout/androidaps/database/transactions/InvalidateOfflineEventTransaction.kt b/database/src/main/java/info/nightscout/androidaps/database/transactions/InvalidateOfflineEventTransaction.kt
new file mode 100644
index 0000000000..9db9b8e84a
--- /dev/null
+++ b/database/src/main/java/info/nightscout/androidaps/database/transactions/InvalidateOfflineEventTransaction.kt
@@ -0,0 +1,10 @@
+package info.nightscout.androidaps.database.transactions
+
+class InvalidateOfflineEventTransaction(val id: Long) : Transaction() {
+ override fun run() {
+ val offlineEvent = database.offlineEventDao.findById(id)
+ ?: throw IllegalArgumentException("There is no such OfflineEvent with the specified ID.")
+ offlineEvent.isValid = false
+ database.offlineEventDao.updateExistingEntry(offlineEvent)
+ }
+}
\ No newline at end of file
diff --git a/database/src/main/java/info/nightscout/androidaps/database/transactions/InvalidateTemporaryBasalWithTempIdTransaction.kt b/database/src/main/java/info/nightscout/androidaps/database/transactions/InvalidateTemporaryBasalWithTempIdTransaction.kt
new file mode 100644
index 0000000000..1e1afaf4d8
--- /dev/null
+++ b/database/src/main/java/info/nightscout/androidaps/database/transactions/InvalidateTemporaryBasalWithTempIdTransaction.kt
@@ -0,0 +1,21 @@
+package info.nightscout.androidaps.database.transactions
+
+import info.nightscout.androidaps.database.entities.TemporaryBasal
+
+class InvalidateTemporaryBasalWithTempIdTransaction(val tempId: Long) : Transaction() {
+
+ override fun run(): TransactionResult {
+ val result = TransactionResult()
+ val temporaryBasal = database.temporaryBasalDao.findByTempId(tempId)
+ ?: throw IllegalArgumentException("There is no such Temporary Basal with the specified temp ID.")
+ temporaryBasal.isValid = false
+ database.temporaryBasalDao.updateExistingEntry(temporaryBasal)
+ result.invalidated.add(temporaryBasal)
+ return result
+ }
+
+ class TransactionResult {
+
+ val invalidated = mutableListOf()
+ }
+}
\ No newline at end of file
diff --git a/database/src/main/java/info/nightscout/androidaps/database/transactions/SyncPumpBolusWithTempIdTransaction.kt b/database/src/main/java/info/nightscout/androidaps/database/transactions/SyncBolusWithTempIdTransaction.kt
similarity index 90%
rename from database/src/main/java/info/nightscout/androidaps/database/transactions/SyncPumpBolusWithTempIdTransaction.kt
rename to database/src/main/java/info/nightscout/androidaps/database/transactions/SyncBolusWithTempIdTransaction.kt
index 8fe8eb4fc3..99449f5ce7 100644
--- a/database/src/main/java/info/nightscout/androidaps/database/transactions/SyncPumpBolusWithTempIdTransaction.kt
+++ b/database/src/main/java/info/nightscout/androidaps/database/transactions/SyncBolusWithTempIdTransaction.kt
@@ -5,10 +5,10 @@ import info.nightscout.androidaps.database.entities.Bolus
/**
* Creates or updates the Bolus from pump synchronization
*/
-class SyncPumpBolusWithTempIdTransaction(
+class SyncBolusWithTempIdTransaction(
private val bolus: Bolus,
private val newType: Bolus.Type?
-) : Transaction() {
+) : Transaction() {
override fun run(): TransactionResult {
bolus.interfaceIDs.temporaryId ?: bolus.interfaceIDs.pumpType ?: bolus.interfaceIDs.pumpSerial ?:
diff --git a/database/src/main/java/info/nightscout/androidaps/database/transactions/SyncNsOfflineEventTransaction.kt b/database/src/main/java/info/nightscout/androidaps/database/transactions/SyncNsOfflineEventTransaction.kt
new file mode 100644
index 0000000000..d7a741436c
--- /dev/null
+++ b/database/src/main/java/info/nightscout/androidaps/database/transactions/SyncNsOfflineEventTransaction.kt
@@ -0,0 +1,73 @@
+package info.nightscout.androidaps.database.transactions
+
+import info.nightscout.androidaps.database.entities.OfflineEvent
+import info.nightscout.androidaps.database.interfaces.end
+import kotlin.math.abs
+
+/**
+ * Sync the OfflineEvent from NS
+ */
+class SyncNsOfflineEventTransaction(private val offlineEvent: OfflineEvent, private val invalidateByNsOnly: Boolean) : Transaction() {
+
+ override fun run(): TransactionResult {
+ val result = TransactionResult()
+
+ if (offlineEvent.duration != 0L) {
+ // not ending event
+ val current: OfflineEvent? =
+ offlineEvent.interfaceIDs.nightscoutId?.let {
+ database.offlineEventDao.findByNSId(it)
+ }
+
+ if (current != null) {
+ // nsId exists, allow only invalidation
+ if (current.isValid && !offlineEvent.isValid) {
+ current.isValid = false
+ database.offlineEventDao.updateExistingEntry(current)
+ result.invalidated.add(current)
+ }
+ return result
+ }
+
+ if (invalidateByNsOnly) return result
+
+ // not known nsId
+ val running = database.offlineEventDao.getOfflineEventActiveAt(offlineEvent.timestamp).blockingGet()
+ if (running != null && abs(running.timestamp - offlineEvent.timestamp) < 1000 && running.interfaceIDs.nightscoutId == null) { // allow missing milliseconds
+ // the same record, update nsId only
+ running.interfaceIDs.nightscoutId = offlineEvent.interfaceIDs.nightscoutId
+ database.offlineEventDao.updateExistingEntry(running)
+ result.updatedNsId.add(running)
+ } else if (running != null) {
+ // another running record. end current and insert new
+ running.end = offlineEvent.timestamp
+ database.offlineEventDao.updateExistingEntry(running)
+ database.offlineEventDao.insertNewEntry(offlineEvent)
+ result.ended.add(running)
+ result.inserted.add(offlineEvent)
+ } else {
+ database.offlineEventDao.insertNewEntry(offlineEvent)
+ result.inserted.add(offlineEvent)
+ }
+ return result
+
+ } else {
+ // ending event
+ val running = database.offlineEventDao.getOfflineEventActiveAt(offlineEvent.timestamp).blockingGet()
+ if (running != null) {
+ running.end = offlineEvent.timestamp
+ database.offlineEventDao.updateExistingEntry(running)
+ result.ended.add(running)
+ }
+ }
+ return result
+ }
+
+ class TransactionResult {
+
+ val updatedNsId = mutableListOf