:database:entities cleanup
This commit is contained in:
parent
b982afbb49
commit
2200ce0afb
|
@ -60,6 +60,8 @@ import app.aaps.core.ui.dialogs.OKDialog
|
||||||
import app.aaps.core.ui.locale.LocaleHelper
|
import app.aaps.core.ui.locale.LocaleHelper
|
||||||
import app.aaps.core.ui.toast.ToastUtils
|
import app.aaps.core.ui.toast.ToastUtils
|
||||||
import app.aaps.core.utils.isRunningRealPumpTest
|
import app.aaps.core.utils.isRunningRealPumpTest
|
||||||
|
import app.aaps.database.entities.UserEntry.Action
|
||||||
|
import app.aaps.database.entities.UserEntry.Sources
|
||||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||||
import com.google.android.material.tabs.TabLayoutMediator
|
import com.google.android.material.tabs.TabLayoutMediator
|
||||||
import com.google.firebase.crashlytics.FirebaseCrashlytics
|
import com.google.firebase.crashlytics.FirebaseCrashlytics
|
||||||
|
@ -68,8 +70,6 @@ import com.joanzapata.iconify.fonts.FontAwesomeModule
|
||||||
import info.nightscout.androidaps.BuildConfig
|
import info.nightscout.androidaps.BuildConfig
|
||||||
import info.nightscout.androidaps.R
|
import info.nightscout.androidaps.R
|
||||||
import info.nightscout.androidaps.databinding.ActivityMainBinding
|
import info.nightscout.androidaps.databinding.ActivityMainBinding
|
||||||
import info.nightscout.database.entities.UserEntry.Action
|
|
||||||
import info.nightscout.database.entities.UserEntry.Sources
|
|
||||||
import info.nightscout.plugins.constraints.signatureVerifier.SignatureVerifierPlugin
|
import info.nightscout.plugins.constraints.signatureVerifier.SignatureVerifierPlugin
|
||||||
import info.nightscout.ui.activities.ProfileHelperActivity
|
import info.nightscout.ui.activities.ProfileHelperActivity
|
||||||
import info.nightscout.ui.activities.StatsActivity
|
import info.nightscout.ui.activities.StatsActivity
|
||||||
|
|
|
@ -13,7 +13,6 @@ import androidx.work.Data
|
||||||
import androidx.work.ExistingPeriodicWorkPolicy
|
import androidx.work.ExistingPeriodicWorkPolicy
|
||||||
import androidx.work.PeriodicWorkRequest
|
import androidx.work.PeriodicWorkRequest
|
||||||
import androidx.work.WorkManager
|
import androidx.work.WorkManager
|
||||||
import app.aaps.di.DaggerAppComponent
|
|
||||||
import app.aaps.core.interfaces.alerts.LocalAlertUtils
|
import app.aaps.core.interfaces.alerts.LocalAlertUtils
|
||||||
import app.aaps.core.interfaces.configuration.Config
|
import app.aaps.core.interfaces.configuration.Config
|
||||||
import app.aaps.core.interfaces.configuration.ConfigBuilder
|
import app.aaps.core.interfaces.configuration.ConfigBuilder
|
||||||
|
@ -28,6 +27,10 @@ import app.aaps.core.interfaces.sharedPreferences.SP
|
||||||
import app.aaps.core.interfaces.ui.UiInteraction
|
import app.aaps.core.interfaces.ui.UiInteraction
|
||||||
import app.aaps.core.interfaces.utils.DateUtil
|
import app.aaps.core.interfaces.utils.DateUtil
|
||||||
import app.aaps.core.interfaces.versionChecker.VersionCheckerUtils
|
import app.aaps.core.interfaces.versionChecker.VersionCheckerUtils
|
||||||
|
import app.aaps.core.ui.locale.LocaleHelper
|
||||||
|
import app.aaps.database.entities.TherapyEvent
|
||||||
|
import app.aaps.database.entities.UserEntry
|
||||||
|
import app.aaps.di.DaggerAppComponent
|
||||||
import app.aaps.receivers.BTReceiver
|
import app.aaps.receivers.BTReceiver
|
||||||
import app.aaps.receivers.ChargingStateReceiver
|
import app.aaps.receivers.ChargingStateReceiver
|
||||||
import app.aaps.receivers.KeepAliveWorker
|
import app.aaps.receivers.KeepAliveWorker
|
||||||
|
@ -36,9 +39,6 @@ import dagger.android.AndroidInjector
|
||||||
import dagger.android.DaggerApplication
|
import dagger.android.DaggerApplication
|
||||||
import info.nightscout.androidaps.BuildConfig
|
import info.nightscout.androidaps.BuildConfig
|
||||||
import info.nightscout.androidaps.R
|
import info.nightscout.androidaps.R
|
||||||
import app.aaps.core.ui.locale.LocaleHelper
|
|
||||||
import info.nightscout.database.entities.TherapyEvent
|
|
||||||
import info.nightscout.database.entities.UserEntry
|
|
||||||
import info.nightscout.database.impl.AppRepository
|
import info.nightscout.database.impl.AppRepository
|
||||||
import info.nightscout.database.impl.transactions.InsertIfNewByTimestampTherapyEventTransaction
|
import info.nightscout.database.impl.transactions.InsertIfNewByTimestampTherapyEventTransaction
|
||||||
import info.nightscout.database.impl.transactions.VersionChangeTransaction
|
import info.nightscout.database.impl.transactions.VersionChangeTransaction
|
||||||
|
|
|
@ -1,18 +1,18 @@
|
||||||
/**
|
/**
|
||||||
* GraphView
|
* GraphView
|
||||||
* Copyright (C) 2014 Jonas Gehring
|
* Copyright (C) 2014 Jonas Gehring
|
||||||
*
|
* <p>
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation; either version 2 of the License,
|
* the Free Software Foundation; either version 2 of the License,
|
||||||
* with the "Linking Exception", which can be found at the license.txt
|
* with the "Linking Exception", which can be found at the license.txt
|
||||||
* file in this program.
|
* file in this program.
|
||||||
*
|
* <p>
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
* <p>
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* with the "Linking Exception" along with this program; if not,
|
* with the "Linking Exception" along with this program; if not,
|
||||||
* write to the author Jonas Gehring <g.jjoe64@gmail.com>.
|
* write to the author Jonas Gehring <g.jjoe64@gmail.com>.
|
||||||
|
@ -39,122 +39,14 @@ import java.util.Map;
|
||||||
*/
|
*/
|
||||||
public class GridLabelRenderer {
|
public class GridLabelRenderer {
|
||||||
/**
|
/**
|
||||||
* wrapper for the styles regarding
|
* reference to graphview
|
||||||
* to the grid and the labels
|
|
||||||
*/
|
*/
|
||||||
public final class Styles {
|
private final GraphView mGraphView;
|
||||||
/**
|
|
||||||
* the general text size of the axis titles.
|
|
||||||
* can be overwritten with #verticalAxisTitleTextSize
|
|
||||||
* and #horizontalAxisTitleTextSize
|
|
||||||
*/
|
|
||||||
public float textSize;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* the alignment of the vertical labels
|
|
||||||
*/
|
|
||||||
public Paint.Align verticalLabelsAlign;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* the alignment of the labels on the right side
|
|
||||||
*/
|
|
||||||
public Paint.Align verticalLabelsSecondScaleAlign;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* the color of the vertical labels
|
|
||||||
*/
|
|
||||||
public int verticalLabelsColor;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* the color of the labels on the right side
|
|
||||||
*/
|
|
||||||
public int verticalLabelsSecondScaleColor;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* the color of the horizontal labels
|
|
||||||
*/
|
|
||||||
public int horizontalLabelsColor;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* the color of the grid lines
|
|
||||||
*/
|
|
||||||
public int gridColor;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* flag whether the zero-lines (vertical+
|
|
||||||
* horizontal) shall be highlighted
|
|
||||||
*/
|
|
||||||
public boolean highlightZeroLines;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* the padding around the graph and labels
|
|
||||||
*/
|
|
||||||
public int padding;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* font size of the vertical axis title
|
|
||||||
*/
|
|
||||||
public float verticalAxisTitleTextSize;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* font color of the vertical axis title
|
|
||||||
*/
|
|
||||||
public int verticalAxisTitleColor;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* font size of the horizontal axis title
|
|
||||||
*/
|
|
||||||
public float horizontalAxisTitleTextSize;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* font color of the horizontal axis title
|
|
||||||
*/
|
|
||||||
public int horizontalAxisTitleColor;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* flag whether the horizontal labels are
|
|
||||||
* visible
|
|
||||||
*/
|
|
||||||
boolean horizontalLabelsVisible;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* flag whether the vertical labels are
|
|
||||||
* visible
|
|
||||||
*/
|
|
||||||
boolean verticalLabelsVisible;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* defines which lines will be drawn in the background
|
|
||||||
*/
|
|
||||||
GridStyle gridStyle;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* the space between the labels text and the graph content
|
|
||||||
*/
|
|
||||||
int labelsSpace;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Definition which lines will be drawn in the background
|
|
||||||
*/
|
|
||||||
public enum GridStyle {
|
|
||||||
BOTH, VERTICAL, HORIZONTAL, NONE;
|
|
||||||
|
|
||||||
public boolean drawVertical() { return this == BOTH || this == VERTICAL && this != NONE; }
|
|
||||||
public boolean drawHorizontal() { return this == BOTH || this == HORIZONTAL && this != NONE; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* wraps the styles regarding the
|
* wraps the styles regarding the
|
||||||
* grid and labels
|
* grid and labels
|
||||||
*/
|
*/
|
||||||
protected Styles mStyles;
|
protected Styles mStyles;
|
||||||
|
|
||||||
/**
|
|
||||||
* reference to graphview
|
|
||||||
*/
|
|
||||||
private final GraphView mGraphView;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cache of the vertical steps
|
* cache of the vertical steps
|
||||||
* (horizontal lines and vertical labels)
|
* (horizontal lines and vertical labels)
|
||||||
|
@ -162,7 +54,6 @@ public class GridLabelRenderer {
|
||||||
* Value = y-value
|
* Value = y-value
|
||||||
*/
|
*/
|
||||||
private Map<Integer, Double> mStepsVertical;
|
private Map<Integer, Double> mStepsVertical;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cache of the vertical steps for the
|
* cache of the vertical steps for the
|
||||||
* second scale, which is on the right side
|
* second scale, which is on the right side
|
||||||
|
@ -171,7 +62,6 @@ public class GridLabelRenderer {
|
||||||
* Value = y-value
|
* Value = y-value
|
||||||
*/
|
*/
|
||||||
private Map<Integer, Double> mStepsVerticalSecondScale;
|
private Map<Integer, Double> mStepsVerticalSecondScale;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cache of the horizontal steps
|
* cache of the horizontal steps
|
||||||
* (vertical lines and horizontal labels)
|
* (vertical lines and horizontal labels)
|
||||||
|
@ -179,92 +69,75 @@ public class GridLabelRenderer {
|
||||||
* Value = x-value
|
* Value = x-value
|
||||||
*/
|
*/
|
||||||
private Map<Integer, Double> mStepsHorizontal;
|
private Map<Integer, Double> mStepsHorizontal;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* the paint to draw the grid lines
|
* the paint to draw the grid lines
|
||||||
*/
|
*/
|
||||||
private Paint mPaintLine;
|
private Paint mPaintLine;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* the paint to draw the labels
|
* the paint to draw the labels
|
||||||
*/
|
*/
|
||||||
private Paint mPaintLabel;
|
private Paint mPaintLabel;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* the paint to draw axis titles
|
* the paint to draw axis titles
|
||||||
*/
|
*/
|
||||||
private Paint mPaintAxisTitle;
|
private Paint mPaintAxisTitle;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* flag whether is bounds are automatically
|
* flag whether is bounds are automatically
|
||||||
* adjusted for nice human-readable numbers
|
* adjusted for nice human-readable numbers
|
||||||
*/
|
*/
|
||||||
private boolean mIsAdjusted;
|
private boolean mIsAdjusted;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* the width of the vertical labels
|
* the width of the vertical labels
|
||||||
*/
|
*/
|
||||||
private Integer mLabelVerticalWidth;
|
private Integer mLabelVerticalWidth;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* indicates if the width was set manually
|
* indicates if the width was set manually
|
||||||
*/
|
*/
|
||||||
private boolean mLabelVerticalWidthFixed;
|
private boolean mLabelVerticalWidthFixed;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* the height of the vertical labels
|
* the height of the vertical labels
|
||||||
*/
|
*/
|
||||||
private Integer mLabelVerticalHeight;
|
private Integer mLabelVerticalHeight;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* indicates if the height was set manually
|
* indicates if the height was set manually
|
||||||
*/
|
*/
|
||||||
private boolean mLabelHorizontalHeightFixed;
|
private boolean mLabelHorizontalHeightFixed;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* the width of the vertical labels
|
* the width of the vertical labels
|
||||||
* of the second scale
|
* of the second scale
|
||||||
*/
|
*/
|
||||||
private Integer mLabelVerticalSecondScaleWidth;
|
private Integer mLabelVerticalSecondScaleWidth;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* the height of the vertical labels
|
* the height of the vertical labels
|
||||||
* of the second scale
|
* of the second scale
|
||||||
*/
|
*/
|
||||||
private Integer mLabelVerticalSecondScaleHeight;
|
private Integer mLabelVerticalSecondScaleHeight;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* the width of the horizontal labels
|
* the width of the horizontal labels
|
||||||
*/
|
*/
|
||||||
private Integer mLabelHorizontalWidth;
|
private Integer mLabelHorizontalWidth;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* the height of the horizontal labels
|
* the height of the horizontal labels
|
||||||
*/
|
*/
|
||||||
private Integer mLabelHorizontalHeight;
|
private Integer mLabelHorizontalHeight;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* the label formatter, that converts
|
* the label formatter, that converts
|
||||||
* the raw numbers to strings
|
* the raw numbers to strings
|
||||||
*/
|
*/
|
||||||
private LabelFormatter mLabelFormatter;
|
private LabelFormatter mLabelFormatter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* the title of the horizontal axis
|
* the title of the horizontal axis
|
||||||
*/
|
*/
|
||||||
private String mHorizontalAxisTitle;
|
private String mHorizontalAxisTitle;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* the title of the vertical axis
|
* the title of the vertical axis
|
||||||
*/
|
*/
|
||||||
private String mVerticalAxisTitle;
|
private String mVerticalAxisTitle;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* count of the vertical labels, that
|
* count of the vertical labels, that
|
||||||
* will be shown at one time.
|
* will be shown at one time.
|
||||||
*/
|
*/
|
||||||
private int mNumVerticalLabels;
|
private int mNumVerticalLabels;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* count of the horizontal labels, that
|
* count of the horizontal labels, that
|
||||||
* will be shown at one time.
|
* will be shown at one time.
|
||||||
|
@ -369,6 +242,15 @@ public class GridLabelRenderer {
|
||||||
return mStyles.textSize;
|
return mStyles.textSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param textSize the general text size of the axis titles.
|
||||||
|
* can be overwritten with {@link #setVerticalAxisTitleTextSize(float)}
|
||||||
|
* and {@link #setHorizontalAxisTitleTextSize(float)}
|
||||||
|
*/
|
||||||
|
public void setTextSize(float textSize) {
|
||||||
|
mStyles.textSize = textSize;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the font color of the vertical labels
|
* @return the font color of the vertical labels
|
||||||
*/
|
*/
|
||||||
|
@ -376,6 +258,13 @@ public class GridLabelRenderer {
|
||||||
return mStyles.verticalLabelsColor;
|
return mStyles.verticalLabelsColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param verticalLabelsColor the color of the vertical labels
|
||||||
|
*/
|
||||||
|
public void setVerticalLabelsColor(int verticalLabelsColor) {
|
||||||
|
mStyles.verticalLabelsColor = verticalLabelsColor;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the alignment of the text of the
|
* @return the alignment of the text of the
|
||||||
* vertical labels
|
* vertical labels
|
||||||
|
@ -384,6 +273,13 @@ public class GridLabelRenderer {
|
||||||
return mStyles.verticalLabelsAlign;
|
return mStyles.verticalLabelsAlign;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param verticalLabelsAlign the alignment of the vertical labels
|
||||||
|
*/
|
||||||
|
public void setVerticalLabelsAlign(Paint.Align verticalLabelsAlign) {
|
||||||
|
mStyles.verticalLabelsAlign = verticalLabelsAlign;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the font color of the horizontal labels
|
* @return the font color of the horizontal labels
|
||||||
*/
|
*/
|
||||||
|
@ -391,6 +287,13 @@ public class GridLabelRenderer {
|
||||||
return mStyles.horizontalLabelsColor;
|
return mStyles.horizontalLabelsColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param horizontalLabelsColor the color of the horizontal labels
|
||||||
|
*/
|
||||||
|
public void setHorizontalLabelsColor(int horizontalLabelsColor) {
|
||||||
|
mStyles.horizontalLabelsColor = horizontalLabelsColor;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* clears the internal cache and forces
|
* clears the internal cache and forces
|
||||||
* to redraw the grid and labels.
|
* to redraw the grid and labels.
|
||||||
|
@ -677,7 +580,7 @@ public class GridLabelRenderer {
|
||||||
if (mStepsHorizontal != null) {
|
if (mStepsHorizontal != null) {
|
||||||
mStepsHorizontal.clear();
|
mStepsHorizontal.clear();
|
||||||
} else {
|
} else {
|
||||||
mStepsHorizontal = new LinkedHashMap<Integer, Double>((int) numHorizontalLabels);
|
mStepsHorizontal = new LinkedHashMap<Integer, Double>(numHorizontalLabels);
|
||||||
}
|
}
|
||||||
int width = mGraphView.getGraphContentWidth();
|
int width = mGraphView.getGraphContentWidth();
|
||||||
|
|
||||||
|
@ -1167,50 +1070,6 @@ public class GridLabelRenderer {
|
||||||
return mStyles.gridColor;
|
return mStyles.gridColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return whether the line at 0 are highlighted
|
|
||||||
*/
|
|
||||||
public boolean isHighlightZeroLines() {
|
|
||||||
return mStyles.highlightZeroLines;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the padding around the grid and labels
|
|
||||||
*/
|
|
||||||
public int getPadding() {
|
|
||||||
return mStyles.padding;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param textSize the general text size of the axis titles.
|
|
||||||
* can be overwritten with {@link #setVerticalAxisTitleTextSize(float)}
|
|
||||||
* and {@link #setHorizontalAxisTitleTextSize(float)}
|
|
||||||
*/
|
|
||||||
public void setTextSize(float textSize) {
|
|
||||||
mStyles.textSize = textSize;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param verticalLabelsAlign the alignment of the vertical labels
|
|
||||||
*/
|
|
||||||
public void setVerticalLabelsAlign(Paint.Align verticalLabelsAlign) {
|
|
||||||
mStyles.verticalLabelsAlign = verticalLabelsAlign;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param verticalLabelsColor the color of the vertical labels
|
|
||||||
*/
|
|
||||||
public void setVerticalLabelsColor(int verticalLabelsColor) {
|
|
||||||
mStyles.verticalLabelsColor = verticalLabelsColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param horizontalLabelsColor the color of the horizontal labels
|
|
||||||
*/
|
|
||||||
public void setHorizontalLabelsColor(int horizontalLabelsColor) {
|
|
||||||
mStyles.horizontalLabelsColor = horizontalLabelsColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param gridColor the color of the grid lines
|
* @param gridColor the color of the grid lines
|
||||||
*/
|
*/
|
||||||
|
@ -1218,6 +1077,13 @@ public class GridLabelRenderer {
|
||||||
mStyles.gridColor = gridColor;
|
mStyles.gridColor = gridColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return whether the line at 0 are highlighted
|
||||||
|
*/
|
||||||
|
public boolean isHighlightZeroLines() {
|
||||||
|
return mStyles.highlightZeroLines;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param highlightZeroLines flag whether the zero-lines (vertical+
|
* @param highlightZeroLines flag whether the zero-lines (vertical+
|
||||||
* horizontal) shall be highlighted
|
* horizontal) shall be highlighted
|
||||||
|
@ -1226,6 +1092,13 @@ public class GridLabelRenderer {
|
||||||
mStyles.highlightZeroLines = highlightZeroLines;
|
mStyles.highlightZeroLines = highlightZeroLines;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the padding around the grid and labels
|
||||||
|
*/
|
||||||
|
public int getPadding() {
|
||||||
|
return mStyles.padding;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param padding the padding around the graph and labels
|
* @param padding the padding around the graph and labels
|
||||||
*/
|
*/
|
||||||
|
@ -1465,4 +1338,115 @@ public class GridLabelRenderer {
|
||||||
public void setLabelsSpace(int labelsSpace) {
|
public void setLabelsSpace(int labelsSpace) {
|
||||||
mStyles.labelsSpace = labelsSpace;
|
mStyles.labelsSpace = labelsSpace;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Definition which lines will be drawn in the background
|
||||||
|
*/
|
||||||
|
public enum GridStyle {
|
||||||
|
BOTH, VERTICAL, HORIZONTAL, NONE;
|
||||||
|
|
||||||
|
public boolean drawVertical() {
|
||||||
|
return this == BOTH || this == VERTICAL && this != NONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean drawHorizontal() {
|
||||||
|
return this == BOTH || this == HORIZONTAL && this != NONE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* wrapper for the styles regarding
|
||||||
|
* to the grid and the labels
|
||||||
|
*/
|
||||||
|
public final class Styles {
|
||||||
|
/**
|
||||||
|
* the general text size of the axis titles.
|
||||||
|
* can be overwritten with #verticalAxisTitleTextSize
|
||||||
|
* and #horizontalAxisTitleTextSize
|
||||||
|
*/
|
||||||
|
public float textSize;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* the alignment of the vertical labels
|
||||||
|
*/
|
||||||
|
public Paint.Align verticalLabelsAlign;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* the alignment of the labels on the right side
|
||||||
|
*/
|
||||||
|
public Paint.Align verticalLabelsSecondScaleAlign;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* the color of the vertical labels
|
||||||
|
*/
|
||||||
|
public int verticalLabelsColor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* the color of the labels on the right side
|
||||||
|
*/
|
||||||
|
public int verticalLabelsSecondScaleColor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* the color of the horizontal labels
|
||||||
|
*/
|
||||||
|
public int horizontalLabelsColor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* the color of the grid lines
|
||||||
|
*/
|
||||||
|
public int gridColor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* flag whether the zero-lines (vertical+
|
||||||
|
* horizontal) shall be highlighted
|
||||||
|
*/
|
||||||
|
public boolean highlightZeroLines;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* the padding around the graph and labels
|
||||||
|
*/
|
||||||
|
public int padding;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* font size of the vertical axis title
|
||||||
|
*/
|
||||||
|
public float verticalAxisTitleTextSize;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* font color of the vertical axis title
|
||||||
|
*/
|
||||||
|
public int verticalAxisTitleColor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* font size of the horizontal axis title
|
||||||
|
*/
|
||||||
|
public float horizontalAxisTitleTextSize;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* font color of the horizontal axis title
|
||||||
|
*/
|
||||||
|
public int horizontalAxisTitleColor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* flag whether the horizontal labels are
|
||||||
|
* visible
|
||||||
|
*/
|
||||||
|
boolean horizontalLabelsVisible;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* flag whether the vertical labels are
|
||||||
|
* visible
|
||||||
|
*/
|
||||||
|
boolean verticalLabelsVisible;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* defines which lines will be drawn in the background
|
||||||
|
*/
|
||||||
|
GridStyle gridStyle;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* the space between the labels text and the graph content
|
||||||
|
*/
|
||||||
|
int labelsSpace;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,18 +1,18 @@
|
||||||
/**
|
/**
|
||||||
* GraphView
|
* GraphView
|
||||||
* Copyright (C) 2014 Jonas Gehring
|
* Copyright (C) 2014 Jonas Gehring
|
||||||
*
|
* <p>
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation; either version 2 of the License,
|
* the Free Software Foundation; either version 2 of the License,
|
||||||
* with the "Linking Exception", which can be found at the license.txt
|
* with the "Linking Exception", which can be found at the license.txt
|
||||||
* file in this program.
|
* file in this program.
|
||||||
*
|
* <p>
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
* <p>
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* with the "Linking Exception" along with this program; if not,
|
* with the "Linking Exception" along with this program; if not,
|
||||||
* write to the author Jonas Gehring <g.jjoe64@gmail.com>.
|
* write to the author Jonas Gehring <g.jjoe64@gmail.com>.
|
||||||
|
@ -45,33 +45,33 @@ public class BarGraphSeries<E extends DataPointInterface> extends BaseSeries<E>
|
||||||
* paint to do drawing on canvas
|
* paint to do drawing on canvas
|
||||||
*/
|
*/
|
||||||
private final Paint mPaint;
|
private final Paint mPaint;
|
||||||
|
/**
|
||||||
|
* stores the coordinates of the bars to
|
||||||
|
* trigger tap on series events.
|
||||||
|
*/
|
||||||
|
private final Map<RectF, E> mDataPoints = new HashMap<RectF, E>();
|
||||||
/**
|
/**
|
||||||
* spacing between the bars in percentage.
|
* spacing between the bars in percentage.
|
||||||
* 0 => no spacing
|
* 0 => no spacing
|
||||||
* 100 => the space bewetten the bars is as big as the bars itself
|
* 100 => the space bewetten the bars is as big as the bars itself
|
||||||
*/
|
*/
|
||||||
private int mSpacing;
|
private int mSpacing;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* callback to generate value-dependent colors
|
* callback to generate value-dependent colors
|
||||||
* of the bars
|
* of the bars
|
||||||
*/
|
*/
|
||||||
private ValueDependentColor<E> mValueDependentColor;
|
private ValueDependentColor<E> mValueDependentColor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* flag whether the values should drawn
|
* flag whether the values should drawn
|
||||||
* above the bars as text
|
* above the bars as text
|
||||||
*/
|
*/
|
||||||
private boolean mDrawValuesOnTop;
|
private boolean mDrawValuesOnTop;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* color of the text above the bars.
|
* color of the text above the bars.
|
||||||
*
|
*
|
||||||
* @see #mDrawValuesOnTop
|
* @see #mDrawValuesOnTop
|
||||||
*/
|
*/
|
||||||
private int mValuesOnTopColor;
|
private int mValuesOnTopColor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* font size of the text above the bars.
|
* font size of the text above the bars.
|
||||||
*
|
*
|
||||||
|
@ -79,12 +79,6 @@ public class BarGraphSeries<E extends DataPointInterface> extends BaseSeries<E>
|
||||||
*/
|
*/
|
||||||
private float mValuesOnTopSize;
|
private float mValuesOnTopSize;
|
||||||
|
|
||||||
/**
|
|
||||||
* stores the coordinates of the bars to
|
|
||||||
* trigger tap on series events.
|
|
||||||
*/
|
|
||||||
private final Map<RectF, E> mDataPoints = new HashMap<RectF, E>();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* creates bar series without any data
|
* creates bar series without any data
|
||||||
*/
|
*/
|
||||||
|
@ -155,10 +149,14 @@ public class BarGraphSeries<E extends DataPointInterface> extends BaseSeries<E>
|
||||||
Iterator<E> curValues = inspectedSeries.getValues(minX, maxX);
|
Iterator<E> curValues = inspectedSeries.getValues(minX, maxX);
|
||||||
if (curValues.hasNext()) {
|
if (curValues.hasNext()) {
|
||||||
xVals.add(curValues.next().getX());
|
xVals.add(curValues.next().getX());
|
||||||
if(isCurrentSeries) { numValues++; }
|
if (isCurrentSeries) {
|
||||||
|
numValues++;
|
||||||
|
}
|
||||||
while (curValues.hasNext()) {
|
while (curValues.hasNext()) {
|
||||||
xVals.add(curValues.next().getX());
|
xVals.add(curValues.next().getX());
|
||||||
if(isCurrentSeries) { numValues++; }
|
if (isCurrentSeries) {
|
||||||
|
numValues++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -191,7 +189,7 @@ public class BarGraphSeries<E extends DataPointInterface> extends BaseSeries<E>
|
||||||
Log.d("BarGraphSeries", "numBars=" + numBarSlots);
|
Log.d("BarGraphSeries", "numBars=" + numBarSlots);
|
||||||
|
|
||||||
// Total spacing (both sides) between sets of bars
|
// Total spacing (both sides) between sets of bars
|
||||||
float spacing = Math.min((float) barSlotWidth*mSpacing/100, barSlotWidth*0.98f);
|
float spacing = Math.min(barSlotWidth * mSpacing / 100, barSlotWidth * 0.98f);
|
||||||
// Width of an individual bar
|
// Width of an individual bar
|
||||||
float barWidth = (barSlotWidth - spacing) / numBarSeries;
|
float barWidth = (barSlotWidth - spacing) / numBarSeries;
|
||||||
// Offset from the center of a given bar to start drawing
|
// Offset from the center of a given bar to start drawing
|
||||||
|
|
|
@ -17,7 +17,7 @@ android {
|
||||||
|
|
||||||
namespace 'app.aaps.core.interfaces'
|
namespace 'app.aaps.core.interfaces'
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
minSdkVersion 25 // for wear
|
minSdkVersion 26 // for wear
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,8 +3,8 @@ package app.aaps.core.interfaces.aps
|
||||||
import android.text.Spanned
|
import android.text.Spanned
|
||||||
import app.aaps.core.interfaces.constraints.Constraint
|
import app.aaps.core.interfaces.constraints.Constraint
|
||||||
import app.aaps.core.interfaces.iob.IobTotal
|
import app.aaps.core.interfaces.iob.IobTotal
|
||||||
|
import app.aaps.database.entities.GlucoseValue
|
||||||
import dagger.android.HasAndroidInjector
|
import dagger.android.HasAndroidInjector
|
||||||
import info.nightscout.database.entities.GlucoseValue
|
|
||||||
import org.json.JSONObject
|
import org.json.JSONObject
|
||||||
|
|
||||||
interface APSResult {
|
interface APSResult {
|
||||||
|
|
|
@ -4,7 +4,7 @@ import androidx.collection.LongSparseArray
|
||||||
import app.aaps.core.interfaces.iob.InMemoryGlucoseValue
|
import app.aaps.core.interfaces.iob.InMemoryGlucoseValue
|
||||||
import app.aaps.core.interfaces.logging.AAPSLogger
|
import app.aaps.core.interfaces.logging.AAPSLogger
|
||||||
import app.aaps.core.interfaces.utils.DateUtil
|
import app.aaps.core.interfaces.utils.DateUtil
|
||||||
import info.nightscout.database.entities.GlucoseValue
|
import app.aaps.database.entities.GlucoseValue
|
||||||
|
|
||||||
interface AutosensDataStore {
|
interface AutosensDataStore {
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ package app.aaps.core.interfaces.aps
|
||||||
import app.aaps.core.interfaces.constraints.Constraint
|
import app.aaps.core.interfaces.constraints.Constraint
|
||||||
import app.aaps.core.interfaces.profile.Profile
|
import app.aaps.core.interfaces.profile.Profile
|
||||||
import app.aaps.core.interfaces.pump.PumpEnactResult
|
import app.aaps.core.interfaces.pump.PumpEnactResult
|
||||||
import info.nightscout.database.entities.OfflineEvent
|
import app.aaps.database.entities.OfflineEvent
|
||||||
|
|
||||||
interface Loop {
|
interface Loop {
|
||||||
|
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
package app.aaps.core.interfaces.db
|
package app.aaps.core.interfaces.db
|
||||||
|
|
||||||
import app.aaps.core.interfaces.queue.Callback
|
import app.aaps.core.interfaces.queue.Callback
|
||||||
|
import app.aaps.database.ValueWrapper
|
||||||
|
import app.aaps.database.entities.Bolus
|
||||||
|
import app.aaps.database.entities.BolusCalculatorResult
|
||||||
|
import app.aaps.database.entities.Carbs
|
||||||
|
import app.aaps.database.entities.EffectiveProfileSwitch
|
||||||
|
import app.aaps.database.entities.TemporaryTarget
|
||||||
|
import app.aaps.database.entities.UserEntry
|
||||||
import dagger.android.HasAndroidInjector
|
import dagger.android.HasAndroidInjector
|
||||||
import info.nightscout.database.ValueWrapper
|
|
||||||
import info.nightscout.database.entities.Bolus
|
|
||||||
import info.nightscout.database.entities.BolusCalculatorResult
|
|
||||||
import info.nightscout.database.entities.Carbs
|
|
||||||
import info.nightscout.database.entities.EffectiveProfileSwitch
|
|
||||||
import info.nightscout.database.entities.TemporaryTarget
|
|
||||||
import info.nightscout.database.entities.UserEntry
|
|
||||||
import io.reactivex.rxjava3.core.Single
|
import io.reactivex.rxjava3.core.Single
|
||||||
|
|
||||||
interface PersistenceLayer {
|
interface PersistenceLayer {
|
||||||
|
|
|
@ -2,8 +2,8 @@ package app.aaps.core.interfaces.insulin
|
||||||
|
|
||||||
import app.aaps.core.interfaces.configuration.ConfigExportImport
|
import app.aaps.core.interfaces.configuration.ConfigExportImport
|
||||||
import app.aaps.core.interfaces.iob.Iob
|
import app.aaps.core.interfaces.iob.Iob
|
||||||
import info.nightscout.database.entities.Bolus
|
import app.aaps.database.entities.Bolus
|
||||||
import info.nightscout.database.entities.embedments.InsulinConfiguration
|
import app.aaps.database.entities.embedments.InsulinConfiguration
|
||||||
|
|
||||||
interface Insulin : ConfigExportImport {
|
interface Insulin : ConfigExportImport {
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package app.aaps.core.interfaces.iob
|
package app.aaps.core.interfaces.iob
|
||||||
|
|
||||||
import info.nightscout.database.entities.GlucoseValue
|
import app.aaps.database.entities.GlucoseValue
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Simplified [GlucoseValue] for storing in memory and calculations
|
* Simplified [GlucoseValue] for storing in memory and calculations
|
||||||
|
|
|
@ -5,8 +5,8 @@ import app.aaps.core.interfaces.aps.AutosensDataStore
|
||||||
import app.aaps.core.interfaces.aps.AutosensResult
|
import app.aaps.core.interfaces.aps.AutosensResult
|
||||||
import app.aaps.core.interfaces.aps.BasalData
|
import app.aaps.core.interfaces.aps.BasalData
|
||||||
import app.aaps.core.interfaces.profile.Profile
|
import app.aaps.core.interfaces.profile.Profile
|
||||||
import info.nightscout.database.entities.ExtendedBolus
|
import app.aaps.database.entities.ExtendedBolus
|
||||||
import info.nightscout.database.entities.TemporaryBasal
|
import app.aaps.database.entities.TemporaryBasal
|
||||||
import org.json.JSONArray
|
import org.json.JSONArray
|
||||||
|
|
||||||
interface IobCobCalculator {
|
interface IobCobCalculator {
|
||||||
|
|
|
@ -2,10 +2,10 @@ package app.aaps.core.interfaces.logging
|
||||||
|
|
||||||
import app.aaps.core.interfaces.userEntry.UserEntryMapper
|
import app.aaps.core.interfaces.userEntry.UserEntryMapper
|
||||||
import app.aaps.core.interfaces.userEntry.ValueWithUnitMapper
|
import app.aaps.core.interfaces.userEntry.ValueWithUnitMapper
|
||||||
import info.nightscout.database.entities.UserEntry
|
import app.aaps.database.entities.UserEntry
|
||||||
import info.nightscout.database.entities.UserEntry.Action
|
import app.aaps.database.entities.UserEntry.Action
|
||||||
import info.nightscout.database.entities.UserEntry.Sources
|
import app.aaps.database.entities.UserEntry.Sources
|
||||||
import info.nightscout.database.entities.ValueWithUnit
|
import app.aaps.database.entities.ValueWithUnit
|
||||||
|
|
||||||
interface UserEntryLogger {
|
interface UserEntryLogger {
|
||||||
|
|
||||||
|
|
|
@ -1,19 +1,19 @@
|
||||||
package app.aaps.core.interfaces.nsclient
|
package app.aaps.core.interfaces.nsclient
|
||||||
|
|
||||||
import info.nightscout.database.entities.Bolus
|
import app.aaps.database.entities.Bolus
|
||||||
import info.nightscout.database.entities.BolusCalculatorResult
|
import app.aaps.database.entities.BolusCalculatorResult
|
||||||
import info.nightscout.database.entities.Carbs
|
import app.aaps.database.entities.Carbs
|
||||||
import info.nightscout.database.entities.DeviceStatus
|
import app.aaps.database.entities.DeviceStatus
|
||||||
import info.nightscout.database.entities.EffectiveProfileSwitch
|
import app.aaps.database.entities.EffectiveProfileSwitch
|
||||||
import info.nightscout.database.entities.ExtendedBolus
|
import app.aaps.database.entities.ExtendedBolus
|
||||||
import info.nightscout.database.entities.Food
|
import app.aaps.database.entities.Food
|
||||||
import info.nightscout.database.entities.GlucoseValue
|
import app.aaps.database.entities.GlucoseValue
|
||||||
import info.nightscout.database.entities.OfflineEvent
|
import app.aaps.database.entities.OfflineEvent
|
||||||
import info.nightscout.database.entities.ProfileSwitch
|
import app.aaps.database.entities.ProfileSwitch
|
||||||
import info.nightscout.database.entities.TemporaryBasal
|
import app.aaps.database.entities.TemporaryBasal
|
||||||
import info.nightscout.database.entities.TemporaryTarget
|
import app.aaps.database.entities.TemporaryTarget
|
||||||
import info.nightscout.database.entities.TherapyEvent
|
import app.aaps.database.entities.TherapyEvent
|
||||||
import info.nightscout.database.transactions.TransactionGlucoseValue
|
import app.aaps.database.transactions.TransactionGlucoseValue
|
||||||
|
|
||||||
interface StoreDataForDb {
|
interface StoreDataForDb {
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package app.aaps.core.interfaces.profile
|
package app.aaps.core.interfaces.profile
|
||||||
|
|
||||||
import app.aaps.core.interfaces.db.GlucoseUnit
|
import app.aaps.core.interfaces.db.GlucoseUnit
|
||||||
import info.nightscout.database.entities.ProfileSwitch
|
import app.aaps.database.entities.ProfileSwitch
|
||||||
|
|
||||||
interface ProfileFunction {
|
interface ProfileFunction {
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
package app.aaps.core.interfaces.profile
|
package app.aaps.core.interfaces.profile
|
||||||
|
|
||||||
import app.aaps.core.interfaces.db.GlucoseUnit
|
import app.aaps.core.interfaces.db.GlucoseUnit
|
||||||
import info.nightscout.database.entities.data.Block
|
import app.aaps.database.entities.data.Block
|
||||||
import info.nightscout.database.entities.data.TargetBlock
|
import app.aaps.database.entities.data.TargetBlock
|
||||||
import org.json.JSONObject
|
import org.json.JSONObject
|
||||||
import java.util.TimeZone
|
import java.util.TimeZone
|
||||||
|
|
||||||
|
|
|
@ -2,11 +2,11 @@ package app.aaps.core.interfaces.pump
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import app.aaps.core.interfaces.pump.defs.PumpType
|
import app.aaps.core.interfaces.pump.defs.PumpType
|
||||||
import info.nightscout.database.entities.Bolus
|
import app.aaps.database.entities.Bolus
|
||||||
import info.nightscout.database.entities.BolusCalculatorResult
|
import app.aaps.database.entities.BolusCalculatorResult
|
||||||
import info.nightscout.database.entities.Carbs
|
import app.aaps.database.entities.Carbs
|
||||||
import info.nightscout.database.entities.TherapyEvent
|
import app.aaps.database.entities.TherapyEvent
|
||||||
import info.nightscout.database.entities.embedments.InterfaceIDs
|
import app.aaps.database.entities.embedments.InterfaceIDs
|
||||||
|
|
||||||
class DetailedBolusInfo {
|
class DetailedBolusInfo {
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ import app.aaps.core.interfaces.pump.defs.PumpType
|
||||||
import app.aaps.core.interfaces.utils.DateUtil
|
import app.aaps.core.interfaces.utils.DateUtil
|
||||||
import app.aaps.core.interfaces.utils.DecimalFormatter
|
import app.aaps.core.interfaces.utils.DecimalFormatter
|
||||||
import app.aaps.core.interfaces.utils.T
|
import app.aaps.core.interfaces.utils.T
|
||||||
import info.nightscout.database.entities.TemporaryBasal
|
import app.aaps.database.entities.TemporaryBasal
|
||||||
import kotlin.math.max
|
import kotlin.math.max
|
||||||
import kotlin.math.min
|
import kotlin.math.min
|
||||||
import kotlin.math.roundToInt
|
import kotlin.math.roundToInt
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package app.aaps.core.interfaces.pump
|
package app.aaps.core.interfaces.pump
|
||||||
|
|
||||||
import android.widget.TextView
|
import android.widget.TextView
|
||||||
import info.nightscout.database.entities.TherapyEvent
|
import app.aaps.database.entities.TherapyEvent
|
||||||
|
|
||||||
interface WarnColors {
|
interface WarnColors {
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package app.aaps.core.interfaces.source
|
package app.aaps.core.interfaces.source
|
||||||
|
|
||||||
import info.nightscout.database.entities.GlucoseValue
|
import app.aaps.database.entities.GlucoseValue
|
||||||
|
|
||||||
interface NSClientSource {
|
interface NSClientSource {
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ package app.aaps.core.interfaces.stats
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.util.LongSparseArray
|
import android.util.LongSparseArray
|
||||||
import android.widget.TableLayout
|
import android.widget.TableLayout
|
||||||
import info.nightscout.database.entities.TotalDailyDose
|
import app.aaps.database.entities.TotalDailyDose
|
||||||
|
|
||||||
interface TddCalculator {
|
interface TddCalculator {
|
||||||
|
|
||||||
|
|
|
@ -1,18 +1,18 @@
|
||||||
package app.aaps.core.interfaces.sync
|
package app.aaps.core.interfaces.sync
|
||||||
|
|
||||||
import info.nightscout.database.entities.Bolus
|
import app.aaps.database.entities.Bolus
|
||||||
import info.nightscout.database.entities.BolusCalculatorResult
|
import app.aaps.database.entities.BolusCalculatorResult
|
||||||
import info.nightscout.database.entities.Carbs
|
import app.aaps.database.entities.Carbs
|
||||||
import info.nightscout.database.entities.DeviceStatus
|
import app.aaps.database.entities.DeviceStatus
|
||||||
import info.nightscout.database.entities.EffectiveProfileSwitch
|
import app.aaps.database.entities.EffectiveProfileSwitch
|
||||||
import info.nightscout.database.entities.ExtendedBolus
|
import app.aaps.database.entities.ExtendedBolus
|
||||||
import info.nightscout.database.entities.Food
|
import app.aaps.database.entities.Food
|
||||||
import info.nightscout.database.entities.GlucoseValue
|
import app.aaps.database.entities.GlucoseValue
|
||||||
import info.nightscout.database.entities.OfflineEvent
|
import app.aaps.database.entities.OfflineEvent
|
||||||
import info.nightscout.database.entities.ProfileSwitch
|
import app.aaps.database.entities.ProfileSwitch
|
||||||
import info.nightscout.database.entities.TemporaryBasal
|
import app.aaps.database.entities.TemporaryBasal
|
||||||
import info.nightscout.database.entities.TemporaryTarget
|
import app.aaps.database.entities.TemporaryTarget
|
||||||
import info.nightscout.database.entities.TherapyEvent
|
import app.aaps.database.entities.TherapyEvent
|
||||||
import org.json.JSONObject
|
import org.json.JSONObject
|
||||||
|
|
||||||
interface DataSyncSelector {
|
interface DataSyncSelector {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package app.aaps.core.interfaces.userEntry
|
package app.aaps.core.interfaces.userEntry
|
||||||
|
|
||||||
import info.nightscout.database.entities.UserEntry
|
import app.aaps.database.entities.UserEntry
|
||||||
|
|
||||||
class UserEntryMapper {
|
class UserEntryMapper {
|
||||||
enum class Action(val db: UserEntry.Action) {
|
enum class Action(val db: UserEntry.Action) {
|
||||||
|
|
|
@ -3,11 +3,11 @@ package app.aaps.core.interfaces.userEntry
|
||||||
import android.text.Spanned
|
import android.text.Spanned
|
||||||
import androidx.annotation.ColorRes
|
import androidx.annotation.ColorRes
|
||||||
import androidx.annotation.DrawableRes
|
import androidx.annotation.DrawableRes
|
||||||
import info.nightscout.database.entities.UserEntry
|
import app.aaps.database.entities.UserEntry
|
||||||
import info.nightscout.database.entities.UserEntry.Action
|
import app.aaps.database.entities.UserEntry.Action
|
||||||
import info.nightscout.database.entities.UserEntry.ColorGroup
|
import app.aaps.database.entities.UserEntry.ColorGroup
|
||||||
import info.nightscout.database.entities.UserEntry.Sources
|
import app.aaps.database.entities.UserEntry.Sources
|
||||||
import info.nightscout.database.entities.ValueWithUnit
|
import app.aaps.database.entities.ValueWithUnit
|
||||||
|
|
||||||
interface UserEntryPresentationHelper {
|
interface UserEntryPresentationHelper {
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
package app.aaps.core.interfaces.userEntry
|
package app.aaps.core.interfaces.userEntry
|
||||||
|
|
||||||
import app.aaps.core.interfaces.db.GlucoseUnit
|
import app.aaps.core.interfaces.db.GlucoseUnit
|
||||||
import info.nightscout.database.entities.TemporaryTarget
|
import app.aaps.database.entities.TemporaryTarget
|
||||||
import info.nightscout.database.entities.TherapyEvent
|
import app.aaps.database.entities.TherapyEvent
|
||||||
import info.nightscout.database.entities.ValueWithUnit
|
import app.aaps.database.entities.ValueWithUnit
|
||||||
|
|
||||||
sealed class ValueWithUnitMapper { //I use a sealed class because of StringResource that contains a listOf as second parameter
|
sealed class ValueWithUnitMapper { //I use a sealed class because of StringResource that contains a listOf as second parameter
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
package app.aaps.core.interfaces.utils
|
package app.aaps.core.interfaces.utils
|
||||||
|
|
||||||
import info.nightscout.database.entities.OfflineEvent
|
import app.aaps.database.entities.OfflineEvent
|
||||||
import info.nightscout.database.entities.TemporaryTarget
|
import app.aaps.database.entities.TemporaryTarget
|
||||||
import info.nightscout.database.entities.TherapyEvent
|
import app.aaps.database.entities.TherapyEvent
|
||||||
import info.nightscout.database.entities.UserEntry
|
import app.aaps.database.entities.UserEntry
|
||||||
import info.nightscout.database.entities.ValueWithUnit
|
import app.aaps.database.entities.ValueWithUnit
|
||||||
|
|
||||||
interface Translator {
|
interface Translator {
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@ package app.aaps.core.interfaces.utils
|
||||||
|
|
||||||
import app.aaps.core.interfaces.aps.AutosensDataStore
|
import app.aaps.core.interfaces.aps.AutosensDataStore
|
||||||
import app.aaps.core.interfaces.iob.InMemoryGlucoseValue
|
import app.aaps.core.interfaces.iob.InMemoryGlucoseValue
|
||||||
import info.nightscout.database.entities.GlucoseValue
|
import app.aaps.database.entities.GlucoseValue
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert BG direction value to trend arrow or calculate it if not provided
|
* Convert BG direction value to trend arrow or calculate it if not provided
|
||||||
|
|
|
@ -2,8 +2,8 @@ package app.aaps.core.main.extensions
|
||||||
|
|
||||||
import app.aaps.core.interfaces.utils.DateUtil
|
import app.aaps.core.interfaces.utils.DateUtil
|
||||||
import app.aaps.core.interfaces.utils.T
|
import app.aaps.core.interfaces.utils.T
|
||||||
import info.nightscout.database.entities.data.Block
|
import app.aaps.database.entities.data.Block
|
||||||
import info.nightscout.database.entities.data.TargetBlock
|
import app.aaps.database.entities.data.TargetBlock
|
||||||
import org.json.JSONArray
|
import org.json.JSONArray
|
||||||
import org.json.JSONObject
|
import org.json.JSONObject
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ package app.aaps.core.main.extensions
|
||||||
import app.aaps.core.interfaces.insulin.Insulin
|
import app.aaps.core.interfaces.insulin.Insulin
|
||||||
import app.aaps.core.interfaces.iob.Iob
|
import app.aaps.core.interfaces.iob.Iob
|
||||||
import app.aaps.core.interfaces.plugin.ActivePlugin
|
import app.aaps.core.interfaces.plugin.ActivePlugin
|
||||||
import info.nightscout.database.entities.Bolus
|
import app.aaps.database.entities.Bolus
|
||||||
|
|
||||||
fun Bolus.iobCalc(activePlugin: ActivePlugin, time: Long, dia: Double): Iob {
|
fun Bolus.iobCalc(activePlugin: ActivePlugin, time: Long, dia: Double): Iob {
|
||||||
if (!isValid || type == Bolus.Type.PRIMING) return Iob()
|
if (!isValid || type == Bolus.Type.PRIMING) return Iob()
|
||||||
|
|
|
@ -7,10 +7,10 @@ import app.aaps.core.interfaces.profile.Profile
|
||||||
import app.aaps.core.interfaces.utils.DateUtil
|
import app.aaps.core.interfaces.utils.DateUtil
|
||||||
import app.aaps.core.interfaces.utils.DecimalFormatter
|
import app.aaps.core.interfaces.utils.DecimalFormatter
|
||||||
import app.aaps.core.interfaces.utils.T
|
import app.aaps.core.interfaces.utils.T
|
||||||
import info.nightscout.database.entities.Bolus
|
import app.aaps.database.entities.Bolus
|
||||||
import info.nightscout.database.entities.ExtendedBolus
|
import app.aaps.database.entities.ExtendedBolus
|
||||||
import info.nightscout.database.entities.TemporaryBasal
|
import app.aaps.database.entities.TemporaryBasal
|
||||||
import info.nightscout.database.entities.interfaces.end
|
import app.aaps.database.entities.interfaces.end
|
||||||
import kotlin.math.ceil
|
import kotlin.math.ceil
|
||||||
import kotlin.math.max
|
import kotlin.math.max
|
||||||
import kotlin.math.min
|
import kotlin.math.min
|
||||||
|
@ -41,7 +41,7 @@ fun ExtendedBolus.toTemporaryBasal(profile: Profile): TemporaryBasal =
|
||||||
isAbsolute = true,
|
isAbsolute = true,
|
||||||
isValid = isValid,
|
isValid = isValid,
|
||||||
interfaceIDs_backing = interfaceIDs_backing,
|
interfaceIDs_backing = interfaceIDs_backing,
|
||||||
type = info.nightscout.database.entities.TemporaryBasal.Type.FAKE_EXTENDED
|
type = TemporaryBasal.Type.FAKE_EXTENDED
|
||||||
)
|
)
|
||||||
|
|
||||||
fun ExtendedBolus.iobCalc(time: Long, profile: Profile, insulinInterface: Insulin): IobTotal {
|
fun ExtendedBolus.iobCalc(time: Long, profile: Profile, insulinInterface: Insulin): IobTotal {
|
||||||
|
@ -61,7 +61,7 @@ fun ExtendedBolus.iobCalc(time: Long, profile: Profile, insulinInterface: Insuli
|
||||||
val tempBolusPart = Bolus(
|
val tempBolusPart = Bolus(
|
||||||
timestamp = calcDate,
|
timestamp = calcDate,
|
||||||
amount = tempBolusSize,
|
amount = tempBolusSize,
|
||||||
type = info.nightscout.database.entities.Bolus.Type.NORMAL
|
type = Bolus.Type.NORMAL
|
||||||
)
|
)
|
||||||
val aIOB = insulinInterface.iobCalcForTreatment(tempBolusPart, time, dia)
|
val aIOB = insulinInterface.iobCalcForTreatment(tempBolusPart, time, dia)
|
||||||
result.iob += aIOB.iobContrib
|
result.iob += aIOB.iobContrib
|
||||||
|
@ -110,7 +110,7 @@ fun ExtendedBolus.iobCalc(
|
||||||
val tempBolusPart = Bolus(
|
val tempBolusPart = Bolus(
|
||||||
timestamp = calcDate,
|
timestamp = calcDate,
|
||||||
amount = tempBolusSize,
|
amount = tempBolusSize,
|
||||||
type = info.nightscout.database.entities.Bolus.Type.NORMAL
|
type = Bolus.Type.NORMAL
|
||||||
)
|
)
|
||||||
val aIOB = insulinInterface.iobCalcForTreatment(tempBolusPart, time, dia)
|
val aIOB = insulinInterface.iobCalcForTreatment(tempBolusPart, time, dia)
|
||||||
result.iob += aIOB.iobContrib
|
result.iob += aIOB.iobContrib
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
package app.aaps.core.main.extensions
|
package app.aaps.core.main.extensions
|
||||||
|
|
||||||
import app.aaps.core.main.R
|
|
||||||
import app.aaps.core.interfaces.configuration.Constants
|
import app.aaps.core.interfaces.configuration.Constants
|
||||||
import app.aaps.core.interfaces.db.GlucoseUnit
|
import app.aaps.core.interfaces.db.GlucoseUnit
|
||||||
import app.aaps.core.interfaces.iob.InMemoryGlucoseValue
|
import app.aaps.core.interfaces.iob.InMemoryGlucoseValue
|
||||||
import app.aaps.core.interfaces.utils.DateUtil
|
import app.aaps.core.interfaces.utils.DateUtil
|
||||||
import info.nightscout.database.entities.GlucoseValue
|
import app.aaps.core.main.R
|
||||||
|
import app.aaps.database.entities.GlucoseValue
|
||||||
import org.json.JSONObject
|
import org.json.JSONObject
|
||||||
|
|
||||||
fun GlucoseValue.toJson(isAdd: Boolean, dateUtil: DateUtil): JSONObject =
|
fun GlucoseValue.toJson(isAdd: Boolean, dateUtil: DateUtil): JSONObject =
|
||||||
|
|
|
@ -8,7 +8,7 @@ import app.aaps.core.interfaces.utils.DecimalFormatter
|
||||||
import app.aaps.core.interfaces.utils.T
|
import app.aaps.core.interfaces.utils.T
|
||||||
import app.aaps.core.main.profile.ProfileSealed
|
import app.aaps.core.main.profile.ProfileSealed
|
||||||
import app.aaps.core.utils.JsonHelper
|
import app.aaps.core.utils.JsonHelper
|
||||||
import info.nightscout.database.entities.ProfileSwitch
|
import app.aaps.database.entities.ProfileSwitch
|
||||||
import org.json.JSONObject
|
import org.json.JSONObject
|
||||||
import java.util.TimeZone
|
import java.util.TimeZone
|
||||||
|
|
||||||
|
|
|
@ -7,9 +7,9 @@ import app.aaps.core.interfaces.profile.Profile
|
||||||
import app.aaps.core.interfaces.utils.DateUtil
|
import app.aaps.core.interfaces.utils.DateUtil
|
||||||
import app.aaps.core.interfaces.utils.DecimalFormatter
|
import app.aaps.core.interfaces.utils.DecimalFormatter
|
||||||
import app.aaps.core.interfaces.utils.T
|
import app.aaps.core.interfaces.utils.T
|
||||||
import info.nightscout.database.entities.Bolus
|
import app.aaps.database.entities.Bolus
|
||||||
import info.nightscout.database.entities.TemporaryBasal
|
import app.aaps.database.entities.TemporaryBasal
|
||||||
import info.nightscout.database.entities.interfaces.end
|
import app.aaps.database.entities.interfaces.end
|
||||||
import kotlin.math.ceil
|
import kotlin.math.ceil
|
||||||
import kotlin.math.max
|
import kotlin.math.max
|
||||||
import kotlin.math.min
|
import kotlin.math.min
|
||||||
|
|
|
@ -5,7 +5,7 @@ import app.aaps.core.interfaces.db.GlucoseUnit
|
||||||
import app.aaps.core.interfaces.profile.ProfileUtil
|
import app.aaps.core.interfaces.profile.ProfileUtil
|
||||||
import app.aaps.core.interfaces.resources.ResourceHelper
|
import app.aaps.core.interfaces.resources.ResourceHelper
|
||||||
import app.aaps.core.interfaces.utils.DecimalFormatter
|
import app.aaps.core.interfaces.utils.DecimalFormatter
|
||||||
import info.nightscout.database.entities.TemporaryTarget
|
import app.aaps.database.entities.TemporaryTarget
|
||||||
import java.util.concurrent.TimeUnit
|
import java.util.concurrent.TimeUnit
|
||||||
|
|
||||||
fun TemporaryTarget.lowValueToUnitsToString(units: GlucoseUnit, decimalFormatter: DecimalFormatter): String =
|
fun TemporaryTarget.lowValueToUnitsToString(units: GlucoseUnit, decimalFormatter: DecimalFormatter): String =
|
||||||
|
|
|
@ -2,7 +2,7 @@ package app.aaps.core.main.extensions
|
||||||
|
|
||||||
import app.aaps.core.interfaces.db.GlucoseUnit
|
import app.aaps.core.interfaces.db.GlucoseUnit
|
||||||
import app.aaps.core.interfaces.utils.DateUtil
|
import app.aaps.core.interfaces.utils.DateUtil
|
||||||
import info.nightscout.database.entities.TherapyEvent
|
import app.aaps.database.entities.TherapyEvent
|
||||||
|
|
||||||
fun TherapyEvent.isOlderThan(hours: Double, dateUtil: DateUtil): Boolean {
|
fun TherapyEvent.isOlderThan(hours: Double, dateUtil: DateUtil): Boolean {
|
||||||
return getHoursFromStart(dateUtil) > hours
|
return getHoursFromStart(dateUtil) > hours
|
||||||
|
|
|
@ -5,10 +5,10 @@ import android.graphics.Color
|
||||||
import android.util.AttributeSet
|
import android.util.AttributeSet
|
||||||
import app.aaps.core.interfaces.insulin.Insulin
|
import app.aaps.core.interfaces.insulin.Insulin
|
||||||
import app.aaps.core.interfaces.utils.T
|
import app.aaps.core.interfaces.utils.T
|
||||||
|
import app.aaps.database.entities.Bolus
|
||||||
import com.jjoe64.graphview.GraphView
|
import com.jjoe64.graphview.GraphView
|
||||||
import com.jjoe64.graphview.series.DataPoint
|
import com.jjoe64.graphview.series.DataPoint
|
||||||
import com.jjoe64.graphview.series.LineGraphSeries
|
import com.jjoe64.graphview.series.LineGraphSeries
|
||||||
import info.nightscout.database.entities.Bolus
|
|
||||||
import kotlin.math.floor
|
import kotlin.math.floor
|
||||||
|
|
||||||
class ActivityGraph : GraphView {
|
class ActivityGraph : GraphView {
|
||||||
|
|
|
@ -4,23 +4,23 @@ import android.content.Context
|
||||||
import androidx.annotation.AttrRes
|
import androidx.annotation.AttrRes
|
||||||
import androidx.annotation.ColorInt
|
import androidx.annotation.ColorInt
|
||||||
import androidx.annotation.DrawableRes
|
import androidx.annotation.DrawableRes
|
||||||
import app.aaps.core.main.graph.data.DataPointWithLabelInterface
|
|
||||||
import app.aaps.core.main.graph.data.DeviationDataPoint
|
|
||||||
import app.aaps.core.main.graph.data.FixedLineGraphSeries
|
|
||||||
import app.aaps.core.main.graph.data.PointsWithLabelGraphSeries
|
|
||||||
import app.aaps.core.main.graph.data.Scale
|
|
||||||
import app.aaps.core.main.graph.data.ScaledDataPoint
|
|
||||||
import app.aaps.core.interfaces.aps.AutosensData
|
import app.aaps.core.interfaces.aps.AutosensData
|
||||||
import app.aaps.core.interfaces.aps.AutosensDataStore
|
import app.aaps.core.interfaces.aps.AutosensDataStore
|
||||||
import app.aaps.core.interfaces.iob.CobInfo
|
import app.aaps.core.interfaces.iob.CobInfo
|
||||||
import app.aaps.core.interfaces.iob.InMemoryGlucoseValue
|
import app.aaps.core.interfaces.iob.InMemoryGlucoseValue
|
||||||
import app.aaps.core.interfaces.iob.IobCobCalculator
|
import app.aaps.core.interfaces.iob.IobCobCalculator
|
||||||
import app.aaps.core.interfaces.iob.IobTotal
|
import app.aaps.core.interfaces.iob.IobTotal
|
||||||
|
import app.aaps.core.main.graph.data.DataPointWithLabelInterface
|
||||||
|
import app.aaps.core.main.graph.data.DeviationDataPoint
|
||||||
|
import app.aaps.core.main.graph.data.FixedLineGraphSeries
|
||||||
|
import app.aaps.core.main.graph.data.PointsWithLabelGraphSeries
|
||||||
|
import app.aaps.core.main.graph.data.Scale
|
||||||
|
import app.aaps.core.main.graph.data.ScaledDataPoint
|
||||||
|
import app.aaps.database.entities.GlucoseValue
|
||||||
|
import app.aaps.database.entities.TemporaryTarget
|
||||||
import com.jjoe64.graphview.series.BarGraphSeries
|
import com.jjoe64.graphview.series.BarGraphSeries
|
||||||
import com.jjoe64.graphview.series.DataPoint
|
import com.jjoe64.graphview.series.DataPoint
|
||||||
import com.jjoe64.graphview.series.LineGraphSeries
|
import com.jjoe64.graphview.series.LineGraphSeries
|
||||||
import info.nightscout.database.entities.GlucoseValue
|
|
||||||
import info.nightscout.database.entities.TemporaryTarget
|
|
||||||
|
|
||||||
interface OverviewData {
|
interface OverviewData {
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ import app.aaps.core.interfaces.plugin.ActivePlugin
|
||||||
import app.aaps.core.interfaces.profile.DefaultValueHelper
|
import app.aaps.core.interfaces.profile.DefaultValueHelper
|
||||||
import app.aaps.core.interfaces.resources.ResourceHelper
|
import app.aaps.core.interfaces.resources.ResourceHelper
|
||||||
import app.aaps.core.interfaces.utils.DecimalFormatter
|
import app.aaps.core.interfaces.utils.DecimalFormatter
|
||||||
import info.nightscout.database.entities.Bolus
|
import app.aaps.database.entities.Bolus
|
||||||
|
|
||||||
class BolusDataPoint(
|
class BolusDataPoint(
|
||||||
val data: Bolus,
|
val data: Bolus,
|
||||||
|
|
|
@ -2,9 +2,9 @@ package app.aaps.core.main.graph.data
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.graphics.Paint
|
import android.graphics.Paint
|
||||||
import app.aaps.core.main.R
|
|
||||||
import app.aaps.core.interfaces.resources.ResourceHelper
|
import app.aaps.core.interfaces.resources.ResourceHelper
|
||||||
import info.nightscout.database.entities.Carbs
|
import app.aaps.core.main.R
|
||||||
|
import app.aaps.database.entities.Carbs
|
||||||
|
|
||||||
class CarbsDataPoint(
|
class CarbsDataPoint(
|
||||||
val data: Carbs,
|
val data: Carbs,
|
||||||
|
|
|
@ -4,7 +4,7 @@ import android.content.Context
|
||||||
import android.graphics.Paint
|
import android.graphics.Paint
|
||||||
import app.aaps.core.interfaces.resources.ResourceHelper
|
import app.aaps.core.interfaces.resources.ResourceHelper
|
||||||
import app.aaps.core.interfaces.utils.T
|
import app.aaps.core.interfaces.utils.T
|
||||||
import info.nightscout.database.entities.EffectiveProfileSwitch
|
import app.aaps.database.entities.EffectiveProfileSwitch
|
||||||
|
|
||||||
class EffectiveProfileSwitchDataPoint(
|
class EffectiveProfileSwitchDataPoint(
|
||||||
val data: EffectiveProfileSwitch,
|
val data: EffectiveProfileSwitch,
|
||||||
|
|
|
@ -4,7 +4,7 @@ import android.content.Context
|
||||||
import android.graphics.Paint
|
import android.graphics.Paint
|
||||||
import app.aaps.core.interfaces.resources.ResourceHelper
|
import app.aaps.core.interfaces.resources.ResourceHelper
|
||||||
import app.aaps.core.interfaces.utils.DecimalFormatter
|
import app.aaps.core.interfaces.utils.DecimalFormatter
|
||||||
import info.nightscout.database.entities.ExtendedBolus
|
import app.aaps.database.entities.ExtendedBolus
|
||||||
|
|
||||||
class ExtendedBolusDataPoint(
|
class ExtendedBolusDataPoint(
|
||||||
val data: ExtendedBolus,
|
val data: ExtendedBolus,
|
||||||
|
|
|
@ -6,7 +6,7 @@ import app.aaps.core.interfaces.configuration.Constants
|
||||||
import app.aaps.core.interfaces.db.GlucoseUnit
|
import app.aaps.core.interfaces.db.GlucoseUnit
|
||||||
import app.aaps.core.interfaces.profile.ProfileUtil
|
import app.aaps.core.interfaces.profile.ProfileUtil
|
||||||
import app.aaps.core.interfaces.resources.ResourceHelper
|
import app.aaps.core.interfaces.resources.ResourceHelper
|
||||||
import info.nightscout.database.entities.GlucoseValue
|
import app.aaps.database.entities.GlucoseValue
|
||||||
|
|
||||||
class GlucoseValueDataPoint(
|
class GlucoseValueDataPoint(
|
||||||
val data: GlucoseValue,
|
val data: GlucoseValue,
|
||||||
|
|
|
@ -3,7 +3,7 @@ package app.aaps.core.main.graph.data
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.graphics.Paint
|
import android.graphics.Paint
|
||||||
import app.aaps.core.interfaces.resources.ResourceHelper
|
import app.aaps.core.interfaces.resources.ResourceHelper
|
||||||
import info.nightscout.database.entities.HeartRate
|
import app.aaps.database.entities.HeartRate
|
||||||
|
|
||||||
class HeartRateDataPoint(
|
class HeartRateDataPoint(
|
||||||
private val data: HeartRate,
|
private val data: HeartRate,
|
||||||
|
|
|
@ -6,7 +6,7 @@ import app.aaps.core.interfaces.configuration.Constants
|
||||||
import app.aaps.core.interfaces.profile.ProfileUtil
|
import app.aaps.core.interfaces.profile.ProfileUtil
|
||||||
import app.aaps.core.interfaces.resources.ResourceHelper
|
import app.aaps.core.interfaces.resources.ResourceHelper
|
||||||
import app.aaps.core.interfaces.utils.Translator
|
import app.aaps.core.interfaces.utils.Translator
|
||||||
import info.nightscout.database.entities.TherapyEvent
|
import app.aaps.database.entities.TherapyEvent
|
||||||
|
|
||||||
class TherapyEventDataPoint(
|
class TherapyEventDataPoint(
|
||||||
val data: TherapyEvent,
|
val data: TherapyEvent,
|
||||||
|
|
|
@ -20,12 +20,12 @@ import app.aaps.core.main.extensions.shiftBlock
|
||||||
import app.aaps.core.main.extensions.shiftTargetBlock
|
import app.aaps.core.main.extensions.shiftTargetBlock
|
||||||
import app.aaps.core.main.extensions.targetBlockValueBySeconds
|
import app.aaps.core.main.extensions.targetBlockValueBySeconds
|
||||||
import app.aaps.core.utils.MidnightUtils
|
import app.aaps.core.utils.MidnightUtils
|
||||||
import info.nightscout.database.entities.EffectiveProfileSwitch
|
import app.aaps.database.entities.EffectiveProfileSwitch
|
||||||
import info.nightscout.database.entities.ProfileSwitch
|
import app.aaps.database.entities.ProfileSwitch
|
||||||
import info.nightscout.database.entities.data.Block
|
import app.aaps.database.entities.data.Block
|
||||||
import info.nightscout.database.entities.data.TargetBlock
|
import app.aaps.database.entities.data.TargetBlock
|
||||||
import info.nightscout.database.entities.embedments.InsulinConfiguration
|
import app.aaps.database.entities.embedments.InsulinConfiguration
|
||||||
import info.nightscout.database.entities.embedments.InterfaceIDs
|
import app.aaps.database.entities.embedments.InterfaceIDs
|
||||||
import org.json.JSONArray
|
import org.json.JSONArray
|
||||||
import org.json.JSONObject
|
import org.json.JSONObject
|
||||||
import java.text.DecimalFormat
|
import java.text.DecimalFormat
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
package app.aaps.core.main.pump
|
package app.aaps.core.main.pump
|
||||||
|
|
||||||
import app.aaps.core.interfaces.pump.defs.PumpType
|
import app.aaps.core.interfaces.pump.defs.PumpType
|
||||||
import info.nightscout.database.entities.UserEntry
|
import app.aaps.database.entities.UserEntry
|
||||||
import info.nightscout.database.entities.embedments.InterfaceIDs
|
import app.aaps.database.entities.embedments.InterfaceIDs
|
||||||
|
|
||||||
fun PumpType.Companion.fromDbSource(s: UserEntry.Sources): PumpType.Source =
|
fun PumpType.Companion.fromDbSource(s: UserEntry.Sources): PumpType.Source =
|
||||||
when (s) {
|
when (s) {
|
||||||
|
|
|
@ -38,14 +38,14 @@ import app.aaps.core.main.iob.round
|
||||||
import app.aaps.core.main.utils.extensions.formatColor
|
import app.aaps.core.main.utils.extensions.formatColor
|
||||||
import app.aaps.core.ui.dialogs.OKDialog
|
import app.aaps.core.ui.dialogs.OKDialog
|
||||||
import app.aaps.core.utils.HtmlHelper
|
import app.aaps.core.utils.HtmlHelper
|
||||||
|
import app.aaps.database.entities.BolusCalculatorResult
|
||||||
|
import app.aaps.database.entities.OfflineEvent
|
||||||
|
import app.aaps.database.entities.TemporaryTarget
|
||||||
|
import app.aaps.database.entities.UserEntry.Action
|
||||||
|
import app.aaps.database.entities.UserEntry.Sources
|
||||||
|
import app.aaps.database.entities.ValueWithUnit
|
||||||
import com.google.common.base.Joiner
|
import com.google.common.base.Joiner
|
||||||
import dagger.android.HasAndroidInjector
|
import dagger.android.HasAndroidInjector
|
||||||
import info.nightscout.database.entities.BolusCalculatorResult
|
|
||||||
import info.nightscout.database.entities.OfflineEvent
|
|
||||||
import info.nightscout.database.entities.TemporaryTarget
|
|
||||||
import info.nightscout.database.entities.UserEntry.Action
|
|
||||||
import info.nightscout.database.entities.UserEntry.Sources
|
|
||||||
import info.nightscout.database.entities.ValueWithUnit
|
|
||||||
import java.util.LinkedList
|
import java.util.LinkedList
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
import kotlin.math.abs
|
import kotlin.math.abs
|
||||||
|
|
|
@ -16,8 +16,8 @@ import app.aaps.core.main.iob.round
|
||||||
import app.aaps.core.utils.JsonHelper.safeGetInt
|
import app.aaps.core.utils.JsonHelper.safeGetInt
|
||||||
import app.aaps.core.utils.JsonHelper.safeGetString
|
import app.aaps.core.utils.JsonHelper.safeGetString
|
||||||
import app.aaps.core.utils.MidnightUtils
|
import app.aaps.core.utils.MidnightUtils
|
||||||
|
import app.aaps.database.ValueWrapper
|
||||||
import dagger.android.HasAndroidInjector
|
import dagger.android.HasAndroidInjector
|
||||||
import info.nightscout.database.ValueWrapper
|
|
||||||
import org.json.JSONException
|
import org.json.JSONException
|
||||||
import org.json.JSONObject
|
import org.json.JSONObject
|
||||||
import java.util.UUID
|
import java.util.UUID
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
package app.aaps.core.main.extensions
|
package app.aaps.core.main.extensions
|
||||||
|
|
||||||
import app.aaps.core.interfaces.utils.T
|
import app.aaps.core.interfaces.utils.T
|
||||||
|
import app.aaps.database.entities.data.Block
|
||||||
|
import app.aaps.database.entities.data.TargetBlock
|
||||||
|
import app.aaps.database.entities.data.checkSanity
|
||||||
import com.google.common.truth.Truth.assertThat
|
import com.google.common.truth.Truth.assertThat
|
||||||
import info.nightscout.database.entities.data.Block
|
|
||||||
import info.nightscout.database.entities.data.TargetBlock
|
|
||||||
import info.nightscout.database.entities.data.checkSanity
|
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
|
|
||||||
class BlockExtensionKtTest {
|
class BlockExtensionKtTest {
|
||||||
|
|
|
@ -2,13 +2,13 @@ package app.aaps.core.interfaces.iob
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.graphics.Color
|
import android.graphics.Color
|
||||||
import app.aaps.core.main.graph.data.InMemoryGlucoseValueDataPoint
|
|
||||||
import app.aaps.core.interfaces.db.GlucoseUnit
|
import app.aaps.core.interfaces.db.GlucoseUnit
|
||||||
import app.aaps.core.interfaces.profile.DefaultValueHelper
|
import app.aaps.core.interfaces.profile.DefaultValueHelper
|
||||||
import app.aaps.core.interfaces.profile.ProfileFunction
|
import app.aaps.core.interfaces.profile.ProfileFunction
|
||||||
import app.aaps.core.interfaces.resources.ResourceHelper
|
import app.aaps.core.interfaces.resources.ResourceHelper
|
||||||
|
import app.aaps.core.main.graph.data.InMemoryGlucoseValueDataPoint
|
||||||
|
import app.aaps.database.entities.GlucoseValue
|
||||||
import com.google.common.truth.Truth.assertThat
|
import com.google.common.truth.Truth.assertThat
|
||||||
import info.nightscout.database.entities.GlucoseValue
|
|
||||||
import org.junit.jupiter.api.BeforeEach
|
import org.junit.jupiter.api.BeforeEach
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
import org.junit.jupiter.api.extension.ExtendWith
|
import org.junit.jupiter.api.extension.ExtendWith
|
||||||
|
|
|
@ -1,12 +1,11 @@
|
||||||
package app.aaps.core.interfaces.pump
|
package app.aaps.core.interfaces.pump
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
|
import app.aaps.database.entities.BolusCalculatorResult
|
||||||
|
import app.aaps.database.entities.TherapyEvent
|
||||||
import app.aaps.shared.tests.TestBase
|
import app.aaps.shared.tests.TestBase
|
||||||
import com.google.common.truth.Truth.assertThat
|
import com.google.common.truth.Truth.assertThat
|
||||||
import com.google.gson.Gson
|
import com.google.gson.Gson
|
||||||
import info.nightscout.database.entities.Bolus
|
|
||||||
import info.nightscout.database.entities.BolusCalculatorResult
|
|
||||||
import info.nightscout.database.entities.TherapyEvent
|
|
||||||
import org.apache.commons.lang3.builder.EqualsBuilder
|
import org.apache.commons.lang3.builder.EqualsBuilder
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
import org.mockito.Mock
|
import org.mockito.Mock
|
||||||
|
|
|
@ -82,7 +82,7 @@ object DateTimeUtil {
|
||||||
|
|
||||||
@JvmStatic fun toATechDate(timeInMillis: Long): Long {
|
@JvmStatic fun toATechDate(timeInMillis: Long): Long {
|
||||||
val gc = GregorianCalendar()
|
val gc = GregorianCalendar()
|
||||||
gc.setTimeInMillis(timeInMillis)
|
gc.timeInMillis = timeInMillis
|
||||||
return toATechDate(gc)
|
return toATechDate(gc)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -139,7 +139,7 @@ object DateTimeUtil {
|
||||||
|
|
||||||
@JvmStatic fun toStringFromTimeInMillis(timeInMillis: Long): String {
|
@JvmStatic fun toStringFromTimeInMillis(timeInMillis: Long): String {
|
||||||
val gc = GregorianCalendar()
|
val gc = GregorianCalendar()
|
||||||
gc.setTimeInMillis(timeInMillis)
|
gc.timeInMillis = timeInMillis
|
||||||
return toString(gc)
|
return toString(gc)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -155,7 +155,7 @@ object DateTimeUtil {
|
||||||
|
|
||||||
fun toMillisFromATD(aTechDateTime: Long): Long {
|
fun toMillisFromATD(aTechDateTime: Long): Long {
|
||||||
val gc = toGregorianCalendar(aTechDateTime)
|
val gc = toGregorianCalendar(aTechDateTime)
|
||||||
return gc.getTimeInMillis()
|
return gc.timeInMillis
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getATechDateDifferenceAsMinutes(date1: Long, date2: Long): Int {
|
fun getATechDateDifferenceAsMinutes(date1: Long, date2: Long): Int {
|
||||||
|
@ -171,13 +171,13 @@ object DateTimeUtil {
|
||||||
fun getMillisFromATDWithAddedMinutes(atd: Long, minutesDiff: Int): Long {
|
fun getMillisFromATDWithAddedMinutes(atd: Long, minutesDiff: Int): Long {
|
||||||
val oldestEntryTime = toGregorianCalendar(atd)
|
val oldestEntryTime = toGregorianCalendar(atd)
|
||||||
oldestEntryTime.add(Calendar.MINUTE, minutesDiff)
|
oldestEntryTime.add(Calendar.MINUTE, minutesDiff)
|
||||||
return oldestEntryTime.getTimeInMillis()
|
return oldestEntryTime.timeInMillis
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getATDWithAddedSeconds(atd: Long, addedSeconds: Int): Long {
|
fun getATDWithAddedSeconds(atd: Long, addedSeconds: Int): Long {
|
||||||
val oldestEntryTime = toGregorianCalendar(atd)
|
val oldestEntryTime = toGregorianCalendar(atd)
|
||||||
oldestEntryTime.add(Calendar.SECOND, addedSeconds)
|
oldestEntryTime.add(Calendar.SECOND, addedSeconds)
|
||||||
return toATechDate(oldestEntryTime.getTimeInMillis())
|
return toATechDate(oldestEntryTime.timeInMillis)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -11,9 +11,9 @@ apply from: "${project.rootDir}/core/main/test_dependencies.gradle"
|
||||||
|
|
||||||
android {
|
android {
|
||||||
|
|
||||||
namespace 'info.nightscout.database.entities'
|
namespace 'app.aaps.database.entities'
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
minSdkVersion 25 // for wear
|
minSdkVersion 26 // for wear
|
||||||
}
|
}
|
||||||
|
|
||||||
buildFeatures {
|
buildFeatures {
|
||||||
|
|
|
@ -1,45 +0,0 @@
|
||||||
package info.nightscout.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.database.entities.embedments.InterfaceIDs
|
|
||||||
import info.nightscout.database.entities.interfaces.TraceableDBEntry
|
|
||||||
|
|
||||||
@Entity(tableName = TABLE_APS_RESULT_LINKS,
|
|
||||||
foreignKeys = [ForeignKey(
|
|
||||||
entity = APSResult::class,
|
|
||||||
parentColumns = arrayOf("id"),
|
|
||||||
childColumns = arrayOf("apsResultId")), ForeignKey(
|
|
||||||
|
|
||||||
entity = Bolus::class,
|
|
||||||
parentColumns = arrayOf("id"),
|
|
||||||
childColumns = arrayOf("smbId")), ForeignKey(
|
|
||||||
|
|
||||||
entity = TemporaryBasal::class,
|
|
||||||
parentColumns = arrayOf("id"),
|
|
||||||
childColumns = arrayOf("tbrId")), ForeignKey(
|
|
||||||
|
|
||||||
entity = APSResultLink::class,
|
|
||||||
parentColumns = arrayOf("id"),
|
|
||||||
childColumns = arrayOf("referenceId"))],
|
|
||||||
indices = [Index("referenceId"), Index("apsResultId"),
|
|
||||||
Index("smbId"), Index("tbrId")])
|
|
||||||
data class APSResultLink(
|
|
||||||
@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? = null,
|
|
||||||
var apsResultId: Long,
|
|
||||||
var smbId: Long? = null,
|
|
||||||
var tbrId: Long? = null
|
|
||||||
) : TraceableDBEntry {
|
|
||||||
override val foreignKeysValid: Boolean
|
|
||||||
get() = super.foreignKeysValid && apsResultId != 0L && smbId != 0L && tbrId != 0L
|
|
||||||
}
|
|
|
@ -1,40 +0,0 @@
|
||||||
package info.nightscout.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.database.entities.embedments.InterfaceIDs
|
|
||||||
import info.nightscout.database.entities.interfaces.TraceableDBEntry
|
|
||||||
|
|
||||||
@Entity(tableName = TABLE_MULTIWAVE_BOLUS_LINKS,
|
|
||||||
foreignKeys = [ForeignKey(
|
|
||||||
entity = Bolus::class,
|
|
||||||
parentColumns = arrayOf("id"),
|
|
||||||
childColumns = arrayOf("bolusId")), ForeignKey(
|
|
||||||
|
|
||||||
entity = ExtendedBolus::class,
|
|
||||||
parentColumns = arrayOf("id"),
|
|
||||||
childColumns = arrayOf("extendedBolusId")), ForeignKey(
|
|
||||||
|
|
||||||
entity = MultiwaveBolusLink::class,
|
|
||||||
parentColumns = ["id"],
|
|
||||||
childColumns = ["referenceId"])],
|
|
||||||
indices = [Index("referenceId"), Index("bolusId"),
|
|
||||||
Index("extendedBolusId")])
|
|
||||||
data class MultiwaveBolusLink(
|
|
||||||
@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? = null,
|
|
||||||
var bolusId: Long,
|
|
||||||
var extendedBolusId: Long
|
|
||||||
) : TraceableDBEntry {
|
|
||||||
override val foreignKeysValid: Boolean
|
|
||||||
get() = super.foreignKeysValid && bolusId != 0L && bolusId != 0L && extendedBolusId != 0L
|
|
||||||
}
|
|
|
@ -1,205 +0,0 @@
|
||||||
package info.nightscout.database.entities
|
|
||||||
|
|
||||||
import androidx.room.Entity
|
|
||||||
import androidx.room.Index
|
|
||||||
import androidx.room.PrimaryKey
|
|
||||||
import info.nightscout.database.entities.interfaces.DBEntry
|
|
||||||
import info.nightscout.database.entities.interfaces.DBEntryWithTime
|
|
||||||
import java.util.TimeZone
|
|
||||||
|
|
||||||
@Entity(tableName = TABLE_USER_ENTRY,
|
|
||||||
indices = [
|
|
||||||
Index("source"),
|
|
||||||
Index("timestamp")
|
|
||||||
])
|
|
||||||
data class UserEntry(
|
|
||||||
@PrimaryKey(autoGenerate = true)
|
|
||||||
override var id: Long = 0L,
|
|
||||||
override var timestamp: Long,
|
|
||||||
override var utcOffset: Long = TimeZone.getDefault().getOffset(timestamp).toLong(),
|
|
||||||
var action: Action,
|
|
||||||
var source: Sources,
|
|
||||||
var note: String,
|
|
||||||
var values: List<@JvmSuppressWildcards ValueWithUnit?>
|
|
||||||
) : DBEntry, DBEntryWithTime {
|
|
||||||
enum class Action (val colorGroup: ColorGroup) {
|
|
||||||
BOLUS (ColorGroup.InsulinTreatment),
|
|
||||||
BOLUS_CALCULATOR_RESULT (ColorGroup.InsulinTreatment),
|
|
||||||
BOLUS_CALCULATOR_RESULT_REMOVED (ColorGroup.Aaps),
|
|
||||||
SMB (ColorGroup.InsulinTreatment),
|
|
||||||
BOLUS_ADVISOR (ColorGroup.InsulinTreatment),
|
|
||||||
EXTENDED_BOLUS (ColorGroup.InsulinTreatment),
|
|
||||||
SUPERBOLUS_TBR (ColorGroup.InsulinTreatment),
|
|
||||||
CARBS (ColorGroup.CarbTreatment),
|
|
||||||
EXTENDED_CARBS (ColorGroup.CarbTreatment),
|
|
||||||
TEMP_BASAL (ColorGroup.BasalTreatment),
|
|
||||||
TT (ColorGroup.TT),
|
|
||||||
NEW_PROFILE (ColorGroup.Profile),
|
|
||||||
CLONE_PROFILE (ColorGroup.Profile),
|
|
||||||
STORE_PROFILE (ColorGroup.Profile),
|
|
||||||
PROFILE_SWITCH (ColorGroup.Profile),
|
|
||||||
PROFILE_SWITCH_CLONED (ColorGroup.Profile),
|
|
||||||
CLOSED_LOOP_MODE (ColorGroup.Loop),
|
|
||||||
LGS_LOOP_MODE (ColorGroup.Loop),
|
|
||||||
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),
|
|
||||||
SUSPEND (ColorGroup.Loop),
|
|
||||||
HW_PUMP_ALLOWED (ColorGroup.Pump),
|
|
||||||
CLEAR_PAIRING_KEYS (ColorGroup.Pump),
|
|
||||||
ACCEPTS_TEMP_BASAL (ColorGroup.BasalTreatment),
|
|
||||||
CANCEL_TEMP_BASAL (ColorGroup.BasalTreatment),
|
|
||||||
CANCEL_BOLUS (ColorGroup.InsulinTreatment),
|
|
||||||
CANCEL_EXTENDED_BOLUS (ColorGroup.InsulinTreatment),
|
|
||||||
CANCEL_TT (ColorGroup.TT),
|
|
||||||
CAREPORTAL (ColorGroup.Careportal),
|
|
||||||
SITE_CHANGE (ColorGroup.Pump),
|
|
||||||
RESERVOIR_CHANGE (ColorGroup.Pump),
|
|
||||||
CALIBRATION (ColorGroup.Careportal),
|
|
||||||
PRIME_BOLUS (ColorGroup.Pump),
|
|
||||||
TREATMENT (ColorGroup.InsulinTreatment),
|
|
||||||
CAREPORTAL_NS_REFRESH (ColorGroup.Careportal),
|
|
||||||
PROFILE_SWITCH_NS_REFRESH (ColorGroup.Profile),
|
|
||||||
TREATMENTS_NS_REFRESH (ColorGroup.InsulinTreatment),
|
|
||||||
TT_NS_REFRESH (ColorGroup.TT),
|
|
||||||
AUTOMATION_REMOVED (ColorGroup.Aaps),
|
|
||||||
BG_REMOVED (ColorGroup.Aaps),
|
|
||||||
CAREPORTAL_REMOVED (ColorGroup.Careportal),
|
|
||||||
EXTENDED_BOLUS_REMOVED (ColorGroup.InsulinTreatment),
|
|
||||||
FOOD_REMOVED (ColorGroup.CarbTreatment),
|
|
||||||
PROFILE_REMOVED (ColorGroup.Profile),
|
|
||||||
PROFILE_SWITCH_REMOVED (ColorGroup.Profile),
|
|
||||||
RESTART_EVENTS_REMOVED (ColorGroup.Aaps),
|
|
||||||
TREATMENT_REMOVED (ColorGroup.InsulinTreatment),
|
|
||||||
BOLUS_REMOVED (ColorGroup.InsulinTreatment),
|
|
||||||
CARBS_REMOVED (ColorGroup.CarbTreatment),
|
|
||||||
TEMP_BASAL_REMOVED (ColorGroup.BasalTreatment),
|
|
||||||
TT_REMOVED (ColorGroup.TT),
|
|
||||||
NS_PAUSED (ColorGroup.Aaps),
|
|
||||||
NS_RESUME (ColorGroup.Aaps),
|
|
||||||
NS_QUEUE_CLEARED (ColorGroup.Aaps),
|
|
||||||
NS_SETTINGS_COPIED (ColorGroup.Aaps),
|
|
||||||
ERROR_DIALOG_OK (ColorGroup.Aaps),
|
|
||||||
ERROR_DIALOG_MUTE (ColorGroup.Aaps),
|
|
||||||
ERROR_DIALOG_MUTE_5MIN (ColorGroup.Aaps),
|
|
||||||
OBJECTIVE_STARTED (ColorGroup.Aaps),
|
|
||||||
OBJECTIVE_UNSTARTED (ColorGroup.Aaps),
|
|
||||||
OBJECTIVES_SKIPPED (ColorGroup.Aaps),
|
|
||||||
STAT_RESET (ColorGroup.Aaps),
|
|
||||||
DELETE_LOGS (ColorGroup.Aaps),
|
|
||||||
DELETE_FUTURE_TREATMENTS (ColorGroup.Aaps),
|
|
||||||
EXPORT_SETTINGS (ColorGroup.Aaps),
|
|
||||||
IMPORT_SETTINGS (ColorGroup.Aaps),
|
|
||||||
RESET_DATABASES (ColorGroup.Aaps),
|
|
||||||
CLEANUP_DATABASES (ColorGroup.Aaps),
|
|
||||||
EXPORT_DATABASES (ColorGroup.Aaps),
|
|
||||||
IMPORT_DATABASES (ColorGroup.Aaps),
|
|
||||||
OTP_EXPORT (ColorGroup.Aaps),
|
|
||||||
OTP_RESET (ColorGroup.Aaps),
|
|
||||||
STOP_SMS (ColorGroup.Aaps),
|
|
||||||
FOOD (ColorGroup.CarbTreatment),
|
|
||||||
EXPORT_CSV (ColorGroup.Aaps),
|
|
||||||
START_AAPS (ColorGroup.Aaps),
|
|
||||||
EXIT_AAPS (ColorGroup.Aaps),
|
|
||||||
PLUGIN_ENABLED (ColorGroup.Aaps),
|
|
||||||
PLUGIN_DISABLED (ColorGroup.Aaps),
|
|
||||||
UNKNOWN (ColorGroup.Aaps)
|
|
||||||
;
|
|
||||||
|
|
||||||
companion object {
|
|
||||||
fun fromString(source: String?) = values().firstOrNull { it.name == source } ?: UNKNOWN
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
enum class Sources {
|
|
||||||
TreatmentDialog,
|
|
||||||
InsulinDialog,
|
|
||||||
CarbDialog,
|
|
||||||
WizardDialog,
|
|
||||||
QuickWizard,
|
|
||||||
ExtendedBolusDialog,
|
|
||||||
TTDialog,
|
|
||||||
ProfileSwitchDialog,
|
|
||||||
LoopDialog,
|
|
||||||
TempBasalDialog,
|
|
||||||
CalibrationDialog,
|
|
||||||
FillDialog,
|
|
||||||
BgCheck,
|
|
||||||
SensorInsert,
|
|
||||||
BatteryChange,
|
|
||||||
Note,
|
|
||||||
Exercise,
|
|
||||||
Question,
|
|
||||||
Announcement,
|
|
||||||
Actions, //From Actions plugin
|
|
||||||
Automation, //From Automation plugin
|
|
||||||
Autotune, //From Autotune plugin
|
|
||||||
BG, //From BG plugin => Add One Source per BG Source for Calibration or Sensor Change
|
|
||||||
Aidex,
|
|
||||||
Dexcom,
|
|
||||||
Eversense,
|
|
||||||
Glimp,
|
|
||||||
MM640g,
|
|
||||||
NSClientSource,
|
|
||||||
PocTech,
|
|
||||||
Tomato,
|
|
||||||
Glunovo,
|
|
||||||
Intelligo,
|
|
||||||
Xdrip,
|
|
||||||
LocalProfile, //From LocalProfile plugin
|
|
||||||
Loop, //From Loop plugin
|
|
||||||
Maintenance, //From Maintenance plugin
|
|
||||||
NSClient, //From NSClient plugin
|
|
||||||
NSProfile, //From NSProfile plugin
|
|
||||||
Objectives, //From Objectives plugin
|
|
||||||
Pump, //To update with one Source per pump
|
|
||||||
Dana, //Only one UserEntry in Common module Dana
|
|
||||||
DanaR,
|
|
||||||
DanaRC,
|
|
||||||
DanaRv2,
|
|
||||||
DanaRS,
|
|
||||||
DanaI,
|
|
||||||
DiaconnG8,
|
|
||||||
Insight,
|
|
||||||
Combo,
|
|
||||||
Medtronic,
|
|
||||||
Omnipod, //No entry currently
|
|
||||||
OmnipodEros,
|
|
||||||
OmnipodDash, //No entry currently
|
|
||||||
EOPatch2,
|
|
||||||
Medtrum,
|
|
||||||
MDI,
|
|
||||||
VirtualPump,
|
|
||||||
SMS, //From SMS plugin
|
|
||||||
Treatments, //From Treatments plugin
|
|
||||||
Wear, //From Wear plugin
|
|
||||||
Food, //From Food plugin
|
|
||||||
ConfigBuilder, //From ConfigBuilder Plugin
|
|
||||||
Overview, //From OverViewPlugin
|
|
||||||
Stats, //From Stat Activity
|
|
||||||
Aaps, // MainApp
|
|
||||||
Unknown //if necessary
|
|
||||||
;
|
|
||||||
|
|
||||||
companion object {
|
|
||||||
fun fromString(source: String?) = values().firstOrNull { it.name == source } ?: Unknown
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
enum class ColorGroup {
|
|
||||||
InsulinTreatment,
|
|
||||||
BasalTreatment,
|
|
||||||
CarbTreatment,
|
|
||||||
TT,
|
|
||||||
Profile,
|
|
||||||
Loop,
|
|
||||||
Careportal,
|
|
||||||
Pump,
|
|
||||||
Aaps
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,41 +0,0 @@
|
||||||
package info.nightscout.database.entities.data
|
|
||||||
|
|
||||||
import info.nightscout.database.entities.APSResult
|
|
||||||
import info.nightscout.database.entities.APSResultLink
|
|
||||||
import info.nightscout.database.entities.Bolus
|
|
||||||
import info.nightscout.database.entities.BolusCalculatorResult
|
|
||||||
import info.nightscout.database.entities.Carbs
|
|
||||||
import info.nightscout.database.entities.EffectiveProfileSwitch
|
|
||||||
import info.nightscout.database.entities.ExtendedBolus
|
|
||||||
import info.nightscout.database.entities.GlucoseValue
|
|
||||||
import info.nightscout.database.entities.HeartRate
|
|
||||||
import info.nightscout.database.entities.MultiwaveBolusLink
|
|
||||||
import info.nightscout.database.entities.OfflineEvent
|
|
||||||
import info.nightscout.database.entities.PreferenceChange
|
|
||||||
import info.nightscout.database.entities.ProfileSwitch
|
|
||||||
import info.nightscout.database.entities.TemporaryBasal
|
|
||||||
import info.nightscout.database.entities.TemporaryTarget
|
|
||||||
import info.nightscout.database.entities.TherapyEvent
|
|
||||||
import info.nightscout.database.entities.TotalDailyDose
|
|
||||||
import info.nightscout.database.entities.VersionChange
|
|
||||||
|
|
||||||
data class NewEntries(
|
|
||||||
val apsResults: List<APSResult>,
|
|
||||||
val apsResultLinks: List<APSResultLink>,
|
|
||||||
val bolusCalculatorResults: List<BolusCalculatorResult>,
|
|
||||||
val boluses: List<Bolus>,
|
|
||||||
val carbs: List<Carbs>,
|
|
||||||
val effectiveProfileSwitches: List<EffectiveProfileSwitch>,
|
|
||||||
val extendedBoluses: List<ExtendedBolus>,
|
|
||||||
val glucoseValues: List<GlucoseValue>,
|
|
||||||
val multiwaveBolusLinks: List<MultiwaveBolusLink>,
|
|
||||||
val offlineEvents: List<OfflineEvent>,
|
|
||||||
val preferencesChanges: List<PreferenceChange>,
|
|
||||||
val profileSwitches: List<ProfileSwitch>,
|
|
||||||
val temporaryBasals: List<TemporaryBasal>,
|
|
||||||
val temporaryTarget: List<TemporaryTarget>,
|
|
||||||
val therapyEvents: List<TherapyEvent>,
|
|
||||||
val totalDailyDoses: List<TotalDailyDose>,
|
|
||||||
val versionChanges: List<VersionChange>,
|
|
||||||
val heartRates: List<HeartRate>,
|
|
||||||
)
|
|
|
@ -1,7 +0,0 @@
|
||||||
package info.nightscout.database.entities.embedments
|
|
||||||
|
|
||||||
data class InsulinConfiguration(
|
|
||||||
var insulinLabel: String,
|
|
||||||
var insulinEndTime: Long, // DIA before [milliseconds]
|
|
||||||
var peak: Long // [milliseconds]
|
|
||||||
)
|
|
|
@ -1,5 +0,0 @@
|
||||||
package info.nightscout.database.entities.interfaces
|
|
||||||
|
|
||||||
interface DBEntry {
|
|
||||||
var id: Long
|
|
||||||
}
|
|
|
@ -1,4 +1,4 @@
|
||||||
package info.nightscout.database
|
package app.aaps.database
|
||||||
|
|
||||||
sealed class ValueWrapper<T> {
|
sealed class ValueWrapper<T> {
|
||||||
data class Existing<T>(val value: T) : ValueWrapper<T>()
|
data class Existing<T>(val value: T) : ValueWrapper<T>()
|
|
@ -1,21 +1,24 @@
|
||||||
package info.nightscout.database.entities
|
package app.aaps.database.entities
|
||||||
|
|
||||||
import androidx.room.Embedded
|
import androidx.room.Embedded
|
||||||
import androidx.room.Entity
|
import androidx.room.Entity
|
||||||
import androidx.room.ForeignKey
|
import androidx.room.ForeignKey
|
||||||
import androidx.room.Index
|
import androidx.room.Index
|
||||||
import androidx.room.PrimaryKey
|
import androidx.room.PrimaryKey
|
||||||
import info.nightscout.database.entities.embedments.InterfaceIDs
|
import app.aaps.database.entities.embedments.InterfaceIDs
|
||||||
import info.nightscout.database.entities.interfaces.DBEntryWithTime
|
import app.aaps.database.entities.interfaces.DBEntryWithTime
|
||||||
import info.nightscout.database.entities.interfaces.TraceableDBEntry
|
import app.aaps.database.entities.interfaces.TraceableDBEntry
|
||||||
import java.util.TimeZone
|
import java.util.TimeZone
|
||||||
|
|
||||||
@Entity(tableName = TABLE_APS_RESULTS,
|
@Entity(
|
||||||
|
tableName = TABLE_APS_RESULTS,
|
||||||
foreignKeys = [ForeignKey(
|
foreignKeys = [ForeignKey(
|
||||||
entity = APSResult::class,
|
entity = APSResult::class,
|
||||||
parentColumns = ["id"],
|
parentColumns = ["id"],
|
||||||
childColumns = ["referenceId"])],
|
childColumns = ["referenceId"]
|
||||||
indices = [Index("referenceId"), Index("timestamp")])
|
)],
|
||||||
|
indices = [Index("referenceId"), Index("timestamp")]
|
||||||
|
)
|
||||||
data class APSResult(
|
data class APSResult(
|
||||||
@PrimaryKey(autoGenerate = true)
|
@PrimaryKey(autoGenerate = true)
|
||||||
override var id: Long = 0,
|
override var id: Long = 0,
|
||||||
|
@ -37,6 +40,7 @@ data class APSResult(
|
||||||
var isMicroBolusAllowed: Boolean?,
|
var isMicroBolusAllowed: Boolean?,
|
||||||
var resultJson: String
|
var resultJson: String
|
||||||
) : TraceableDBEntry, DBEntryWithTime {
|
) : TraceableDBEntry, DBEntryWithTime {
|
||||||
|
|
||||||
enum class Algorithm {
|
enum class Algorithm {
|
||||||
MA,
|
MA,
|
||||||
AMA,
|
AMA,
|
|
@ -0,0 +1,52 @@
|
||||||
|
package app.aaps.database.entities
|
||||||
|
|
||||||
|
import androidx.room.Embedded
|
||||||
|
import androidx.room.Entity
|
||||||
|
import androidx.room.ForeignKey
|
||||||
|
import androidx.room.Index
|
||||||
|
import androidx.room.PrimaryKey
|
||||||
|
import app.aaps.database.entities.embedments.InterfaceIDs
|
||||||
|
import app.aaps.database.entities.interfaces.TraceableDBEntry
|
||||||
|
|
||||||
|
@Entity(
|
||||||
|
tableName = TABLE_APS_RESULT_LINKS,
|
||||||
|
foreignKeys = [ForeignKey(
|
||||||
|
entity = APSResult::class,
|
||||||
|
parentColumns = arrayOf("id"),
|
||||||
|
childColumns = arrayOf("apsResultId")
|
||||||
|
), ForeignKey(
|
||||||
|
|
||||||
|
entity = Bolus::class,
|
||||||
|
parentColumns = arrayOf("id"),
|
||||||
|
childColumns = arrayOf("smbId")
|
||||||
|
), ForeignKey(
|
||||||
|
|
||||||
|
entity = TemporaryBasal::class,
|
||||||
|
parentColumns = arrayOf("id"),
|
||||||
|
childColumns = arrayOf("tbrId")
|
||||||
|
), ForeignKey(
|
||||||
|
|
||||||
|
entity = APSResultLink::class,
|
||||||
|
parentColumns = arrayOf("id"),
|
||||||
|
childColumns = arrayOf("referenceId")
|
||||||
|
)],
|
||||||
|
indices = [Index("referenceId"), Index("apsResultId"),
|
||||||
|
Index("smbId"), Index("tbrId")]
|
||||||
|
)
|
||||||
|
data class APSResultLink(
|
||||||
|
@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? = null,
|
||||||
|
var apsResultId: Long,
|
||||||
|
var smbId: Long? = null,
|
||||||
|
var tbrId: Long? = null
|
||||||
|
) : TraceableDBEntry {
|
||||||
|
|
||||||
|
override val foreignKeysValid: Boolean
|
||||||
|
get() = super.foreignKeysValid && apsResultId != 0L && smbId != 0L && tbrId != 0L
|
||||||
|
}
|
|
@ -1,14 +1,14 @@
|
||||||
package info.nightscout.database.entities
|
package app.aaps.database.entities
|
||||||
|
|
||||||
import androidx.room.Embedded
|
import androidx.room.Embedded
|
||||||
import androidx.room.Entity
|
import androidx.room.Entity
|
||||||
import androidx.room.ForeignKey
|
import androidx.room.ForeignKey
|
||||||
import androidx.room.Index
|
import androidx.room.Index
|
||||||
import androidx.room.PrimaryKey
|
import androidx.room.PrimaryKey
|
||||||
import info.nightscout.database.entities.embedments.InsulinConfiguration
|
import app.aaps.database.entities.embedments.InsulinConfiguration
|
||||||
import info.nightscout.database.entities.embedments.InterfaceIDs
|
import app.aaps.database.entities.embedments.InterfaceIDs
|
||||||
import info.nightscout.database.entities.interfaces.DBEntryWithTime
|
import app.aaps.database.entities.interfaces.DBEntryWithTime
|
||||||
import info.nightscout.database.entities.interfaces.TraceableDBEntry
|
import app.aaps.database.entities.interfaces.TraceableDBEntry
|
||||||
import java.util.TimeZone
|
import java.util.TimeZone
|
||||||
|
|
||||||
@Entity(
|
@Entity(
|
|
@ -1,13 +1,13 @@
|
||||||
package info.nightscout.database.entities
|
package app.aaps.database.entities
|
||||||
|
|
||||||
import androidx.room.Embedded
|
import androidx.room.Embedded
|
||||||
import androidx.room.Entity
|
import androidx.room.Entity
|
||||||
import androidx.room.ForeignKey
|
import androidx.room.ForeignKey
|
||||||
import androidx.room.Index
|
import androidx.room.Index
|
||||||
import androidx.room.PrimaryKey
|
import androidx.room.PrimaryKey
|
||||||
import info.nightscout.database.entities.embedments.InterfaceIDs
|
import app.aaps.database.entities.embedments.InterfaceIDs
|
||||||
import info.nightscout.database.entities.interfaces.DBEntryWithTime
|
import app.aaps.database.entities.interfaces.DBEntryWithTime
|
||||||
import info.nightscout.database.entities.interfaces.TraceableDBEntry
|
import app.aaps.database.entities.interfaces.TraceableDBEntry
|
||||||
import java.util.TimeZone
|
import java.util.TimeZone
|
||||||
|
|
||||||
@Entity(
|
@Entity(
|
|
@ -1,13 +1,13 @@
|
||||||
package info.nightscout.database.entities
|
package app.aaps.database.entities
|
||||||
|
|
||||||
import androidx.room.Embedded
|
import androidx.room.Embedded
|
||||||
import androidx.room.Entity
|
import androidx.room.Entity
|
||||||
import androidx.room.ForeignKey
|
import androidx.room.ForeignKey
|
||||||
import androidx.room.Index
|
import androidx.room.Index
|
||||||
import androidx.room.PrimaryKey
|
import androidx.room.PrimaryKey
|
||||||
import info.nightscout.database.entities.embedments.InterfaceIDs
|
import app.aaps.database.entities.embedments.InterfaceIDs
|
||||||
import info.nightscout.database.entities.interfaces.DBEntryWithTimeAndDuration
|
import app.aaps.database.entities.interfaces.DBEntryWithTimeAndDuration
|
||||||
import info.nightscout.database.entities.interfaces.TraceableDBEntry
|
import app.aaps.database.entities.interfaces.TraceableDBEntry
|
||||||
import java.util.TimeZone
|
import java.util.TimeZone
|
||||||
|
|
||||||
@Entity(
|
@Entity(
|
|
@ -1,21 +1,23 @@
|
||||||
package info.nightscout.database.entities
|
package app.aaps.database.entities
|
||||||
|
|
||||||
import androidx.room.Embedded
|
import androidx.room.Embedded
|
||||||
import androidx.room.Entity
|
import androidx.room.Entity
|
||||||
import androidx.room.Index
|
import androidx.room.Index
|
||||||
import androidx.room.PrimaryKey
|
import androidx.room.PrimaryKey
|
||||||
import info.nightscout.database.entities.embedments.InterfaceIDs
|
import app.aaps.database.entities.embedments.InterfaceIDs
|
||||||
import info.nightscout.database.entities.interfaces.DBEntry
|
import app.aaps.database.entities.interfaces.DBEntry
|
||||||
import info.nightscout.database.entities.interfaces.DBEntryWithTime
|
import app.aaps.database.entities.interfaces.DBEntryWithTime
|
||||||
import java.util.TimeZone
|
import java.util.TimeZone
|
||||||
|
|
||||||
@Entity(tableName = TABLE_DEVICE_STATUS,
|
@Entity(
|
||||||
|
tableName = TABLE_DEVICE_STATUS,
|
||||||
foreignKeys = [],
|
foreignKeys = [],
|
||||||
indices = [
|
indices = [
|
||||||
Index("id"),
|
Index("id"),
|
||||||
Index("nightscoutId"),
|
Index("nightscoutId"),
|
||||||
Index("timestamp")
|
Index("timestamp")
|
||||||
])
|
]
|
||||||
|
)
|
||||||
data class DeviceStatus(
|
data class DeviceStatus(
|
||||||
@PrimaryKey(autoGenerate = true)
|
@PrimaryKey(autoGenerate = true)
|
||||||
override var id: Long = 0,
|
override var id: Long = 0,
|
|
@ -1,16 +1,16 @@
|
||||||
package info.nightscout.database.entities
|
package app.aaps.database.entities
|
||||||
|
|
||||||
import androidx.room.Embedded
|
import androidx.room.Embedded
|
||||||
import androidx.room.Entity
|
import androidx.room.Entity
|
||||||
import androidx.room.ForeignKey
|
import androidx.room.ForeignKey
|
||||||
import androidx.room.Index
|
import androidx.room.Index
|
||||||
import androidx.room.PrimaryKey
|
import androidx.room.PrimaryKey
|
||||||
import info.nightscout.database.entities.data.Block
|
import app.aaps.database.entities.data.Block
|
||||||
import info.nightscout.database.entities.data.TargetBlock
|
import app.aaps.database.entities.data.TargetBlock
|
||||||
import info.nightscout.database.entities.embedments.InsulinConfiguration
|
import app.aaps.database.entities.embedments.InsulinConfiguration
|
||||||
import info.nightscout.database.entities.embedments.InterfaceIDs
|
import app.aaps.database.entities.embedments.InterfaceIDs
|
||||||
import info.nightscout.database.entities.interfaces.DBEntryWithTime
|
import app.aaps.database.entities.interfaces.DBEntryWithTime
|
||||||
import info.nightscout.database.entities.interfaces.TraceableDBEntry
|
import app.aaps.database.entities.interfaces.TraceableDBEntry
|
||||||
import java.util.TimeZone
|
import java.util.TimeZone
|
||||||
|
|
||||||
@Entity(
|
@Entity(
|
|
@ -1,13 +1,13 @@
|
||||||
package info.nightscout.database.entities
|
package app.aaps.database.entities
|
||||||
|
|
||||||
import androidx.room.Embedded
|
import androidx.room.Embedded
|
||||||
import androidx.room.Entity
|
import androidx.room.Entity
|
||||||
import androidx.room.ForeignKey
|
import androidx.room.ForeignKey
|
||||||
import androidx.room.Index
|
import androidx.room.Index
|
||||||
import androidx.room.PrimaryKey
|
import androidx.room.PrimaryKey
|
||||||
import info.nightscout.database.entities.embedments.InterfaceIDs
|
import app.aaps.database.entities.embedments.InterfaceIDs
|
||||||
import info.nightscout.database.entities.interfaces.DBEntryWithTimeAndDuration
|
import app.aaps.database.entities.interfaces.DBEntryWithTimeAndDuration
|
||||||
import info.nightscout.database.entities.interfaces.TraceableDBEntry
|
import app.aaps.database.entities.interfaces.TraceableDBEntry
|
||||||
import java.util.TimeZone
|
import java.util.TimeZone
|
||||||
|
|
||||||
@Entity(
|
@Entity(
|
|
@ -1,12 +1,12 @@
|
||||||
package info.nightscout.database.entities
|
package app.aaps.database.entities
|
||||||
|
|
||||||
import androidx.room.Embedded
|
import androidx.room.Embedded
|
||||||
import androidx.room.Entity
|
import androidx.room.Entity
|
||||||
import androidx.room.ForeignKey
|
import androidx.room.ForeignKey
|
||||||
import androidx.room.Index
|
import androidx.room.Index
|
||||||
import androidx.room.PrimaryKey
|
import androidx.room.PrimaryKey
|
||||||
import info.nightscout.database.entities.embedments.InterfaceIDs
|
import app.aaps.database.entities.embedments.InterfaceIDs
|
||||||
import info.nightscout.database.entities.interfaces.TraceableDBEntry
|
import app.aaps.database.entities.interfaces.TraceableDBEntry
|
||||||
|
|
||||||
@Entity(
|
@Entity(
|
||||||
tableName = TABLE_FOODS,
|
tableName = TABLE_FOODS,
|
|
@ -1,10 +1,14 @@
|
||||||
package info.nightscout.database.entities
|
package app.aaps.database.entities
|
||||||
|
|
||||||
import androidx.room.*
|
import androidx.room.Embedded
|
||||||
import info.nightscout.database.entities.embedments.InterfaceIDs
|
import androidx.room.Entity
|
||||||
import info.nightscout.database.entities.interfaces.DBEntryWithTime
|
import androidx.room.ForeignKey
|
||||||
import info.nightscout.database.entities.interfaces.TraceableDBEntry
|
import androidx.room.Index
|
||||||
import java.util.*
|
import androidx.room.PrimaryKey
|
||||||
|
import app.aaps.database.entities.embedments.InterfaceIDs
|
||||||
|
import app.aaps.database.entities.interfaces.DBEntryWithTime
|
||||||
|
import app.aaps.database.entities.interfaces.TraceableDBEntry
|
||||||
|
import java.util.TimeZone
|
||||||
|
|
||||||
@Entity(
|
@Entity(
|
||||||
tableName = TABLE_GLUCOSE_VALUES,
|
tableName = TABLE_GLUCOSE_VALUES,
|
|
@ -1,13 +1,13 @@
|
||||||
package info.nightscout.database.entities
|
package app.aaps.database.entities
|
||||||
|
|
||||||
import androidx.room.Embedded
|
import androidx.room.Embedded
|
||||||
import androidx.room.Entity
|
import androidx.room.Entity
|
||||||
import androidx.room.Index
|
import androidx.room.Index
|
||||||
import androidx.room.PrimaryKey
|
import androidx.room.PrimaryKey
|
||||||
import info.nightscout.database.entities.embedments.InterfaceIDs
|
import app.aaps.database.entities.embedments.InterfaceIDs
|
||||||
import info.nightscout.database.entities.interfaces.DBEntryWithTimeAndDuration
|
import app.aaps.database.entities.interfaces.DBEntryWithTimeAndDuration
|
||||||
import info.nightscout.database.entities.interfaces.TraceableDBEntry
|
import app.aaps.database.entities.interfaces.TraceableDBEntry
|
||||||
import java.util.*
|
import java.util.TimeZone
|
||||||
|
|
||||||
/** Heart rate values measured by a user smart watch or the like. */
|
/** Heart rate values measured by a user smart watch or the like. */
|
||||||
@Entity(
|
@Entity(
|
|
@ -0,0 +1,46 @@
|
||||||
|
package app.aaps.database.entities
|
||||||
|
|
||||||
|
import androidx.room.Embedded
|
||||||
|
import androidx.room.Entity
|
||||||
|
import androidx.room.ForeignKey
|
||||||
|
import androidx.room.Index
|
||||||
|
import androidx.room.PrimaryKey
|
||||||
|
import app.aaps.database.entities.embedments.InterfaceIDs
|
||||||
|
import app.aaps.database.entities.interfaces.TraceableDBEntry
|
||||||
|
|
||||||
|
@Entity(
|
||||||
|
tableName = TABLE_MULTIWAVE_BOLUS_LINKS,
|
||||||
|
foreignKeys = [ForeignKey(
|
||||||
|
entity = Bolus::class,
|
||||||
|
parentColumns = arrayOf("id"),
|
||||||
|
childColumns = arrayOf("bolusId")
|
||||||
|
), ForeignKey(
|
||||||
|
|
||||||
|
entity = ExtendedBolus::class,
|
||||||
|
parentColumns = arrayOf("id"),
|
||||||
|
childColumns = arrayOf("extendedBolusId")
|
||||||
|
), ForeignKey(
|
||||||
|
|
||||||
|
entity = MultiwaveBolusLink::class,
|
||||||
|
parentColumns = ["id"],
|
||||||
|
childColumns = ["referenceId"]
|
||||||
|
)],
|
||||||
|
indices = [Index("referenceId"), Index("bolusId"),
|
||||||
|
Index("extendedBolusId")]
|
||||||
|
)
|
||||||
|
data class MultiwaveBolusLink(
|
||||||
|
@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? = null,
|
||||||
|
var bolusId: Long,
|
||||||
|
var extendedBolusId: Long
|
||||||
|
) : TraceableDBEntry {
|
||||||
|
|
||||||
|
override val foreignKeysValid: Boolean
|
||||||
|
get() = super.foreignKeysValid && bolusId != 0L && bolusId != 0L && extendedBolusId != 0L
|
||||||
|
}
|
|
@ -1,13 +1,13 @@
|
||||||
package info.nightscout.database.entities
|
package app.aaps.database.entities
|
||||||
|
|
||||||
import androidx.room.Embedded
|
import androidx.room.Embedded
|
||||||
import androidx.room.Entity
|
import androidx.room.Entity
|
||||||
import androidx.room.ForeignKey
|
import androidx.room.ForeignKey
|
||||||
import androidx.room.Index
|
import androidx.room.Index
|
||||||
import androidx.room.PrimaryKey
|
import androidx.room.PrimaryKey
|
||||||
import info.nightscout.database.entities.embedments.InterfaceIDs
|
import app.aaps.database.entities.embedments.InterfaceIDs
|
||||||
import info.nightscout.database.entities.interfaces.DBEntryWithTimeAndDuration
|
import app.aaps.database.entities.interfaces.DBEntryWithTimeAndDuration
|
||||||
import info.nightscout.database.entities.interfaces.TraceableDBEntry
|
import app.aaps.database.entities.interfaces.TraceableDBEntry
|
||||||
import java.util.TimeZone
|
import java.util.TimeZone
|
||||||
|
|
||||||
@Entity(
|
@Entity(
|
|
@ -1,9 +1,9 @@
|
||||||
package info.nightscout.database.entities
|
package app.aaps.database.entities
|
||||||
|
|
||||||
import androidx.room.Entity
|
import androidx.room.Entity
|
||||||
import androidx.room.PrimaryKey
|
import androidx.room.PrimaryKey
|
||||||
import info.nightscout.database.entities.interfaces.DBEntry
|
import app.aaps.database.entities.interfaces.DBEntry
|
||||||
import info.nightscout.database.entities.interfaces.DBEntryWithTime
|
import app.aaps.database.entities.interfaces.DBEntryWithTime
|
||||||
import java.util.TimeZone
|
import java.util.TimeZone
|
||||||
|
|
||||||
@Entity(tableName = TABLE_PREFERENCE_CHANGES)
|
@Entity(tableName = TABLE_PREFERENCE_CHANGES)
|
|
@ -1,16 +1,16 @@
|
||||||
package info.nightscout.database.entities
|
package app.aaps.database.entities
|
||||||
|
|
||||||
import androidx.room.Embedded
|
import androidx.room.Embedded
|
||||||
import androidx.room.Entity
|
import androidx.room.Entity
|
||||||
import androidx.room.ForeignKey
|
import androidx.room.ForeignKey
|
||||||
import androidx.room.Index
|
import androidx.room.Index
|
||||||
import androidx.room.PrimaryKey
|
import androidx.room.PrimaryKey
|
||||||
import info.nightscout.database.entities.data.Block
|
import app.aaps.database.entities.data.Block
|
||||||
import info.nightscout.database.entities.data.TargetBlock
|
import app.aaps.database.entities.data.TargetBlock
|
||||||
import info.nightscout.database.entities.embedments.InsulinConfiguration
|
import app.aaps.database.entities.embedments.InsulinConfiguration
|
||||||
import info.nightscout.database.entities.embedments.InterfaceIDs
|
import app.aaps.database.entities.embedments.InterfaceIDs
|
||||||
import info.nightscout.database.entities.interfaces.DBEntryWithTimeAndDuration
|
import app.aaps.database.entities.interfaces.DBEntryWithTimeAndDuration
|
||||||
import info.nightscout.database.entities.interfaces.TraceableDBEntry
|
import app.aaps.database.entities.interfaces.TraceableDBEntry
|
||||||
import java.util.TimeZone
|
import java.util.TimeZone
|
||||||
|
|
||||||
@Entity(
|
@Entity(
|
|
@ -1,4 +1,4 @@
|
||||||
package info.nightscout.database.entities
|
package app.aaps.database.entities
|
||||||
|
|
||||||
const val TABLE_APS_RESULTS = "apsResults"
|
const val TABLE_APS_RESULTS = "apsResults"
|
||||||
const val TABLE_APS_RESULT_LINKS = "apsResultLinks"
|
const val TABLE_APS_RESULT_LINKS = "apsResultLinks"
|
|
@ -1,13 +1,13 @@
|
||||||
package info.nightscout.database.entities
|
package app.aaps.database.entities
|
||||||
|
|
||||||
import androidx.room.Embedded
|
import androidx.room.Embedded
|
||||||
import androidx.room.Entity
|
import androidx.room.Entity
|
||||||
import androidx.room.ForeignKey
|
import androidx.room.ForeignKey
|
||||||
import androidx.room.Index
|
import androidx.room.Index
|
||||||
import androidx.room.PrimaryKey
|
import androidx.room.PrimaryKey
|
||||||
import info.nightscout.database.entities.embedments.InterfaceIDs
|
import app.aaps.database.entities.embedments.InterfaceIDs
|
||||||
import info.nightscout.database.entities.interfaces.DBEntryWithTimeAndDuration
|
import app.aaps.database.entities.interfaces.DBEntryWithTimeAndDuration
|
||||||
import info.nightscout.database.entities.interfaces.TraceableDBEntry
|
import app.aaps.database.entities.interfaces.TraceableDBEntry
|
||||||
import java.util.TimeZone
|
import java.util.TimeZone
|
||||||
|
|
||||||
@Entity(
|
@Entity(
|
|
@ -1,13 +1,13 @@
|
||||||
package info.nightscout.database.entities
|
package app.aaps.database.entities
|
||||||
|
|
||||||
import androidx.room.Embedded
|
import androidx.room.Embedded
|
||||||
import androidx.room.Entity
|
import androidx.room.Entity
|
||||||
import androidx.room.ForeignKey
|
import androidx.room.ForeignKey
|
||||||
import androidx.room.Index
|
import androidx.room.Index
|
||||||
import androidx.room.PrimaryKey
|
import androidx.room.PrimaryKey
|
||||||
import info.nightscout.database.entities.embedments.InterfaceIDs
|
import app.aaps.database.entities.embedments.InterfaceIDs
|
||||||
import info.nightscout.database.entities.interfaces.DBEntryWithTimeAndDuration
|
import app.aaps.database.entities.interfaces.DBEntryWithTimeAndDuration
|
||||||
import info.nightscout.database.entities.interfaces.TraceableDBEntry
|
import app.aaps.database.entities.interfaces.TraceableDBEntry
|
||||||
import java.util.TimeZone
|
import java.util.TimeZone
|
||||||
|
|
||||||
@Entity(
|
@Entity(
|
|
@ -1,13 +1,13 @@
|
||||||
package info.nightscout.database.entities
|
package app.aaps.database.entities
|
||||||
|
|
||||||
import androidx.room.Embedded
|
import androidx.room.Embedded
|
||||||
import androidx.room.Entity
|
import androidx.room.Entity
|
||||||
import androidx.room.ForeignKey
|
import androidx.room.ForeignKey
|
||||||
import androidx.room.Index
|
import androidx.room.Index
|
||||||
import androidx.room.PrimaryKey
|
import androidx.room.PrimaryKey
|
||||||
import info.nightscout.database.entities.embedments.InterfaceIDs
|
import app.aaps.database.entities.embedments.InterfaceIDs
|
||||||
import info.nightscout.database.entities.interfaces.DBEntryWithTimeAndDuration
|
import app.aaps.database.entities.interfaces.DBEntryWithTimeAndDuration
|
||||||
import info.nightscout.database.entities.interfaces.TraceableDBEntry
|
import app.aaps.database.entities.interfaces.TraceableDBEntry
|
||||||
import java.util.TimeZone
|
import java.util.TimeZone
|
||||||
|
|
||||||
@Entity(
|
@Entity(
|
|
@ -1,20 +1,22 @@
|
||||||
package info.nightscout.database.entities
|
package app.aaps.database.entities
|
||||||
|
|
||||||
import androidx.room.Embedded
|
import androidx.room.Embedded
|
||||||
import androidx.room.Entity
|
import androidx.room.Entity
|
||||||
import androidx.room.ForeignKey
|
import androidx.room.ForeignKey
|
||||||
import androidx.room.Index
|
import androidx.room.Index
|
||||||
import androidx.room.PrimaryKey
|
import androidx.room.PrimaryKey
|
||||||
import info.nightscout.database.entities.embedments.InterfaceIDs
|
import app.aaps.database.entities.embedments.InterfaceIDs
|
||||||
import info.nightscout.database.entities.interfaces.DBEntryWithTime
|
import app.aaps.database.entities.interfaces.DBEntryWithTime
|
||||||
import info.nightscout.database.entities.interfaces.TraceableDBEntry
|
import app.aaps.database.entities.interfaces.TraceableDBEntry
|
||||||
import java.util.TimeZone
|
import java.util.TimeZone
|
||||||
|
|
||||||
@Entity(tableName = TABLE_TOTAL_DAILY_DOSES,
|
@Entity(
|
||||||
|
tableName = TABLE_TOTAL_DAILY_DOSES,
|
||||||
foreignKeys = [ForeignKey(
|
foreignKeys = [ForeignKey(
|
||||||
entity = TotalDailyDose::class,
|
entity = TotalDailyDose::class,
|
||||||
parentColumns = ["id"],
|
parentColumns = ["id"],
|
||||||
childColumns = ["referenceId"])],
|
childColumns = ["referenceId"]
|
||||||
|
)],
|
||||||
indices = [
|
indices = [
|
||||||
Index("id"),
|
Index("id"),
|
||||||
Index("pumpId"),
|
Index("pumpId"),
|
||||||
|
@ -23,7 +25,8 @@ import java.util.TimeZone
|
||||||
Index("isValid"),
|
Index("isValid"),
|
||||||
Index("referenceId"),
|
Index("referenceId"),
|
||||||
Index("timestamp")
|
Index("timestamp")
|
||||||
])
|
]
|
||||||
|
)
|
||||||
data class TotalDailyDose(
|
data class TotalDailyDose(
|
||||||
@PrimaryKey(autoGenerate = true)
|
@PrimaryKey(autoGenerate = true)
|
||||||
override var id: Long = 0,
|
override var id: Long = 0,
|
||||||
|
@ -40,5 +43,6 @@ data class TotalDailyDose(
|
||||||
var totalAmount: Double = 0.0, // if zero it's calculated as basalAmount + bolusAmount
|
var totalAmount: Double = 0.0, // if zero it's calculated as basalAmount + bolusAmount
|
||||||
var carbs: Double = 0.0
|
var carbs: Double = 0.0
|
||||||
) : TraceableDBEntry, DBEntryWithTime {
|
) : TraceableDBEntry, DBEntryWithTime {
|
||||||
|
|
||||||
companion object
|
companion object
|
||||||
}
|
}
|
|
@ -0,0 +1,210 @@
|
||||||
|
package app.aaps.database.entities
|
||||||
|
|
||||||
|
import androidx.room.Entity
|
||||||
|
import androidx.room.Index
|
||||||
|
import androidx.room.PrimaryKey
|
||||||
|
import app.aaps.database.entities.interfaces.DBEntry
|
||||||
|
import app.aaps.database.entities.interfaces.DBEntryWithTime
|
||||||
|
import java.util.TimeZone
|
||||||
|
|
||||||
|
@Entity(
|
||||||
|
tableName = TABLE_USER_ENTRY,
|
||||||
|
indices = [
|
||||||
|
Index("source"),
|
||||||
|
Index("timestamp")
|
||||||
|
]
|
||||||
|
)
|
||||||
|
data class UserEntry(
|
||||||
|
@PrimaryKey(autoGenerate = true)
|
||||||
|
override var id: Long = 0L,
|
||||||
|
override var timestamp: Long,
|
||||||
|
override var utcOffset: Long = TimeZone.getDefault().getOffset(timestamp).toLong(),
|
||||||
|
var action: Action,
|
||||||
|
var source: Sources,
|
||||||
|
var note: String,
|
||||||
|
var values: List<@JvmSuppressWildcards ValueWithUnit?>
|
||||||
|
) : DBEntry, DBEntryWithTime {
|
||||||
|
|
||||||
|
enum class Action(val colorGroup: ColorGroup) {
|
||||||
|
BOLUS(ColorGroup.InsulinTreatment),
|
||||||
|
BOLUS_CALCULATOR_RESULT(ColorGroup.InsulinTreatment),
|
||||||
|
BOLUS_CALCULATOR_RESULT_REMOVED(ColorGroup.Aaps),
|
||||||
|
SMB(ColorGroup.InsulinTreatment),
|
||||||
|
BOLUS_ADVISOR(ColorGroup.InsulinTreatment),
|
||||||
|
EXTENDED_BOLUS(ColorGroup.InsulinTreatment),
|
||||||
|
SUPERBOLUS_TBR(ColorGroup.InsulinTreatment),
|
||||||
|
CARBS(ColorGroup.CarbTreatment),
|
||||||
|
EXTENDED_CARBS(ColorGroup.CarbTreatment),
|
||||||
|
TEMP_BASAL(ColorGroup.BasalTreatment),
|
||||||
|
TT(ColorGroup.TT),
|
||||||
|
NEW_PROFILE(ColorGroup.Profile),
|
||||||
|
CLONE_PROFILE(ColorGroup.Profile),
|
||||||
|
STORE_PROFILE(ColorGroup.Profile),
|
||||||
|
PROFILE_SWITCH(ColorGroup.Profile),
|
||||||
|
PROFILE_SWITCH_CLONED(ColorGroup.Profile),
|
||||||
|
CLOSED_LOOP_MODE(ColorGroup.Loop),
|
||||||
|
LGS_LOOP_MODE(ColorGroup.Loop),
|
||||||
|
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),
|
||||||
|
SUSPEND(ColorGroup.Loop),
|
||||||
|
HW_PUMP_ALLOWED(ColorGroup.Pump),
|
||||||
|
CLEAR_PAIRING_KEYS(ColorGroup.Pump),
|
||||||
|
ACCEPTS_TEMP_BASAL(ColorGroup.BasalTreatment),
|
||||||
|
CANCEL_TEMP_BASAL(ColorGroup.BasalTreatment),
|
||||||
|
CANCEL_BOLUS(ColorGroup.InsulinTreatment),
|
||||||
|
CANCEL_EXTENDED_BOLUS(ColorGroup.InsulinTreatment),
|
||||||
|
CANCEL_TT(ColorGroup.TT),
|
||||||
|
CAREPORTAL(ColorGroup.Careportal),
|
||||||
|
SITE_CHANGE(ColorGroup.Pump),
|
||||||
|
RESERVOIR_CHANGE(ColorGroup.Pump),
|
||||||
|
CALIBRATION(ColorGroup.Careportal),
|
||||||
|
PRIME_BOLUS(ColorGroup.Pump),
|
||||||
|
TREATMENT(ColorGroup.InsulinTreatment),
|
||||||
|
CAREPORTAL_NS_REFRESH(ColorGroup.Careportal),
|
||||||
|
PROFILE_SWITCH_NS_REFRESH(ColorGroup.Profile),
|
||||||
|
TREATMENTS_NS_REFRESH(ColorGroup.InsulinTreatment),
|
||||||
|
TT_NS_REFRESH(ColorGroup.TT),
|
||||||
|
AUTOMATION_REMOVED(ColorGroup.Aaps),
|
||||||
|
BG_REMOVED(ColorGroup.Aaps),
|
||||||
|
CAREPORTAL_REMOVED(ColorGroup.Careportal),
|
||||||
|
EXTENDED_BOLUS_REMOVED(ColorGroup.InsulinTreatment),
|
||||||
|
FOOD_REMOVED(ColorGroup.CarbTreatment),
|
||||||
|
PROFILE_REMOVED(ColorGroup.Profile),
|
||||||
|
PROFILE_SWITCH_REMOVED(ColorGroup.Profile),
|
||||||
|
RESTART_EVENTS_REMOVED(ColorGroup.Aaps),
|
||||||
|
TREATMENT_REMOVED(ColorGroup.InsulinTreatment),
|
||||||
|
BOLUS_REMOVED(ColorGroup.InsulinTreatment),
|
||||||
|
CARBS_REMOVED(ColorGroup.CarbTreatment),
|
||||||
|
TEMP_BASAL_REMOVED(ColorGroup.BasalTreatment),
|
||||||
|
TT_REMOVED(ColorGroup.TT),
|
||||||
|
NS_PAUSED(ColorGroup.Aaps),
|
||||||
|
NS_RESUME(ColorGroup.Aaps),
|
||||||
|
NS_QUEUE_CLEARED(ColorGroup.Aaps),
|
||||||
|
NS_SETTINGS_COPIED(ColorGroup.Aaps),
|
||||||
|
ERROR_DIALOG_OK(ColorGroup.Aaps),
|
||||||
|
ERROR_DIALOG_MUTE(ColorGroup.Aaps),
|
||||||
|
ERROR_DIALOG_MUTE_5MIN(ColorGroup.Aaps),
|
||||||
|
OBJECTIVE_STARTED(ColorGroup.Aaps),
|
||||||
|
OBJECTIVE_UNSTARTED(ColorGroup.Aaps),
|
||||||
|
OBJECTIVES_SKIPPED(ColorGroup.Aaps),
|
||||||
|
STAT_RESET(ColorGroup.Aaps),
|
||||||
|
DELETE_LOGS(ColorGroup.Aaps),
|
||||||
|
DELETE_FUTURE_TREATMENTS(ColorGroup.Aaps),
|
||||||
|
EXPORT_SETTINGS(ColorGroup.Aaps),
|
||||||
|
IMPORT_SETTINGS(ColorGroup.Aaps),
|
||||||
|
RESET_DATABASES(ColorGroup.Aaps),
|
||||||
|
CLEANUP_DATABASES(ColorGroup.Aaps),
|
||||||
|
EXPORT_DATABASES(ColorGroup.Aaps),
|
||||||
|
IMPORT_DATABASES(ColorGroup.Aaps),
|
||||||
|
OTP_EXPORT(ColorGroup.Aaps),
|
||||||
|
OTP_RESET(ColorGroup.Aaps),
|
||||||
|
STOP_SMS(ColorGroup.Aaps),
|
||||||
|
FOOD(ColorGroup.CarbTreatment),
|
||||||
|
EXPORT_CSV(ColorGroup.Aaps),
|
||||||
|
START_AAPS(ColorGroup.Aaps),
|
||||||
|
EXIT_AAPS(ColorGroup.Aaps),
|
||||||
|
PLUGIN_ENABLED(ColorGroup.Aaps),
|
||||||
|
PLUGIN_DISABLED(ColorGroup.Aaps),
|
||||||
|
UNKNOWN(ColorGroup.Aaps)
|
||||||
|
;
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
|
||||||
|
fun fromString(source: String?) = values().firstOrNull { it.name == source } ?: UNKNOWN
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
enum class Sources {
|
||||||
|
TreatmentDialog,
|
||||||
|
InsulinDialog,
|
||||||
|
CarbDialog,
|
||||||
|
WizardDialog,
|
||||||
|
QuickWizard,
|
||||||
|
ExtendedBolusDialog,
|
||||||
|
TTDialog,
|
||||||
|
ProfileSwitchDialog,
|
||||||
|
LoopDialog,
|
||||||
|
TempBasalDialog,
|
||||||
|
CalibrationDialog,
|
||||||
|
FillDialog,
|
||||||
|
BgCheck,
|
||||||
|
SensorInsert,
|
||||||
|
BatteryChange,
|
||||||
|
Note,
|
||||||
|
Exercise,
|
||||||
|
Question,
|
||||||
|
Announcement,
|
||||||
|
Actions, //From Actions plugin
|
||||||
|
Automation, //From Automation plugin
|
||||||
|
Autotune, //From Autotune plugin
|
||||||
|
BG, //From BG plugin => Add One Source per BG Source for Calibration or Sensor Change
|
||||||
|
Aidex,
|
||||||
|
Dexcom,
|
||||||
|
Eversense,
|
||||||
|
Glimp,
|
||||||
|
MM640g,
|
||||||
|
NSClientSource,
|
||||||
|
PocTech,
|
||||||
|
Tomato,
|
||||||
|
Glunovo,
|
||||||
|
Intelligo,
|
||||||
|
Xdrip,
|
||||||
|
LocalProfile, //From LocalProfile plugin
|
||||||
|
Loop, //From Loop plugin
|
||||||
|
Maintenance, //From Maintenance plugin
|
||||||
|
NSClient, //From NSClient plugin
|
||||||
|
NSProfile, //From NSProfile plugin
|
||||||
|
Objectives, //From Objectives plugin
|
||||||
|
Pump, //To update with one Source per pump
|
||||||
|
Dana, //Only one UserEntry in Common module Dana
|
||||||
|
DanaR,
|
||||||
|
DanaRC,
|
||||||
|
DanaRv2,
|
||||||
|
DanaRS,
|
||||||
|
DanaI,
|
||||||
|
DiaconnG8,
|
||||||
|
Insight,
|
||||||
|
Combo,
|
||||||
|
Medtronic,
|
||||||
|
Omnipod, //No entry currently
|
||||||
|
OmnipodEros,
|
||||||
|
OmnipodDash, //No entry currently
|
||||||
|
EOPatch2,
|
||||||
|
Medtrum,
|
||||||
|
MDI,
|
||||||
|
VirtualPump,
|
||||||
|
SMS, //From SMS plugin
|
||||||
|
Treatments, //From Treatments plugin
|
||||||
|
Wear, //From Wear plugin
|
||||||
|
Food, //From Food plugin
|
||||||
|
ConfigBuilder, //From ConfigBuilder Plugin
|
||||||
|
Overview, //From OverViewPlugin
|
||||||
|
Stats, //From Stat Activity
|
||||||
|
Aaps, // MainApp
|
||||||
|
Unknown //if necessary
|
||||||
|
;
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
|
||||||
|
fun fromString(source: String?) = values().firstOrNull { it.name == source } ?: Unknown
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
enum class ColorGroup {
|
||||||
|
InsulinTreatment,
|
||||||
|
BasalTreatment,
|
||||||
|
CarbTreatment,
|
||||||
|
TT,
|
||||||
|
Profile,
|
||||||
|
Loop,
|
||||||
|
Careportal,
|
||||||
|
Pump,
|
||||||
|
Aaps
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
package info.nightscout.database.entities
|
package app.aaps.database.entities
|
||||||
|
|
||||||
sealed class ValueWithUnit {
|
sealed class ValueWithUnit {
|
||||||
|
|
||||||
|
@ -54,6 +54,7 @@ sealed class ValueWithUnit {
|
||||||
UNKNOWN -> null
|
UNKNOWN -> null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
|
||||||
const val MGDL = "mg/dl" // This is Nightscout's representation
|
const val MGDL = "mg/dl" // This is Nightscout's representation
|
|
@ -1,9 +1,9 @@
|
||||||
package info.nightscout.database.entities
|
package app.aaps.database.entities
|
||||||
|
|
||||||
import androidx.room.Entity
|
import androidx.room.Entity
|
||||||
import androidx.room.PrimaryKey
|
import androidx.room.PrimaryKey
|
||||||
import info.nightscout.database.entities.interfaces.DBEntry
|
import app.aaps.database.entities.interfaces.DBEntry
|
||||||
import info.nightscout.database.entities.interfaces.DBEntryWithTime
|
import app.aaps.database.entities.interfaces.DBEntryWithTime
|
||||||
import java.util.TimeZone
|
import java.util.TimeZone
|
||||||
|
|
||||||
@Entity(tableName = TABLE_VERSION_CHANGES)
|
@Entity(tableName = TABLE_VERSION_CHANGES)
|
|
@ -1,4 +1,4 @@
|
||||||
package info.nightscout.database.entities.data
|
package app.aaps.database.entities.data
|
||||||
|
|
||||||
import java.util.concurrent.TimeUnit
|
import java.util.concurrent.TimeUnit
|
||||||
|
|
|
@ -0,0 +1,38 @@
|
||||||
|
package app.aaps.database.entities.data
|
||||||
|
|
||||||
|
import app.aaps.database.entities.BolusCalculatorResult
|
||||||
|
import app.aaps.database.entities.Carbs
|
||||||
|
import app.aaps.database.entities.EffectiveProfileSwitch
|
||||||
|
import app.aaps.database.entities.ExtendedBolus
|
||||||
|
import app.aaps.database.entities.GlucoseValue
|
||||||
|
import app.aaps.database.entities.HeartRate
|
||||||
|
import app.aaps.database.entities.MultiwaveBolusLink
|
||||||
|
import app.aaps.database.entities.OfflineEvent
|
||||||
|
import app.aaps.database.entities.PreferenceChange
|
||||||
|
import app.aaps.database.entities.ProfileSwitch
|
||||||
|
import app.aaps.database.entities.TemporaryBasal
|
||||||
|
import app.aaps.database.entities.TemporaryTarget
|
||||||
|
import app.aaps.database.entities.TherapyEvent
|
||||||
|
import app.aaps.database.entities.TotalDailyDose
|
||||||
|
import app.aaps.database.entities.VersionChange
|
||||||
|
|
||||||
|
data class NewEntries(
|
||||||
|
val apsResults: List<app.aaps.database.entities.APSResult>,
|
||||||
|
val apsResultLinks: List<app.aaps.database.entities.APSResultLink>,
|
||||||
|
val bolusCalculatorResults: List<BolusCalculatorResult>,
|
||||||
|
val boluses: List<app.aaps.database.entities.Bolus>,
|
||||||
|
val carbs: List<Carbs>,
|
||||||
|
val effectiveProfileSwitches: List<EffectiveProfileSwitch>,
|
||||||
|
val extendedBoluses: List<ExtendedBolus>,
|
||||||
|
val glucoseValues: List<GlucoseValue>,
|
||||||
|
val multiwaveBolusLinks: List<MultiwaveBolusLink>,
|
||||||
|
val offlineEvents: List<OfflineEvent>,
|
||||||
|
val preferencesChanges: List<PreferenceChange>,
|
||||||
|
val profileSwitches: List<ProfileSwitch>,
|
||||||
|
val temporaryBasals: List<TemporaryBasal>,
|
||||||
|
val temporaryTarget: List<TemporaryTarget>,
|
||||||
|
val therapyEvents: List<TherapyEvent>,
|
||||||
|
val totalDailyDoses: List<TotalDailyDose>,
|
||||||
|
val versionChanges: List<VersionChange>,
|
||||||
|
val heartRates: List<HeartRate>,
|
||||||
|
)
|
|
@ -1,4 +1,4 @@
|
||||||
package info.nightscout.database.entities.data
|
package app.aaps.database.entities.data
|
||||||
|
|
||||||
import java.util.concurrent.TimeUnit
|
import java.util.concurrent.TimeUnit
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
package app.aaps.database.entities.embedments
|
||||||
|
|
||||||
|
data class InsulinConfiguration(
|
||||||
|
var insulinLabel: String,
|
||||||
|
var insulinEndTime: Long, // DIA before [milliseconds]
|
||||||
|
var peak: Long // [milliseconds]
|
||||||
|
)
|
|
@ -1,4 +1,4 @@
|
||||||
package info.nightscout.database.entities.embedments
|
package app.aaps.database.entities.embedments
|
||||||
|
|
||||||
import androidx.room.Ignore
|
import androidx.room.Ignore
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
package app.aaps.database.entities.interfaces
|
||||||
|
|
||||||
|
interface DBEntry {
|
||||||
|
|
||||||
|
var id: Long
|
||||||
|
}
|
|
@ -1,6 +1,7 @@
|
||||||
package info.nightscout.database.entities.interfaces
|
package app.aaps.database.entities.interfaces
|
||||||
|
|
||||||
interface DBEntryWithDuration {
|
interface DBEntryWithDuration {
|
||||||
|
|
||||||
var duration: Long
|
var duration: Long
|
||||||
|
|
||||||
val durationUnknown get() = duration == Long.MAX_VALUE
|
val durationUnknown get() = duration == Long.MAX_VALUE
|
|
@ -1,6 +1,7 @@
|
||||||
package info.nightscout.database.entities.interfaces
|
package app.aaps.database.entities.interfaces
|
||||||
|
|
||||||
interface DBEntryWithTime {
|
interface DBEntryWithTime {
|
||||||
|
|
||||||
var timestamp: Long
|
var timestamp: Long
|
||||||
var utcOffset: Long
|
var utcOffset: Long
|
||||||
}
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
package info.nightscout.database.entities.interfaces
|
package app.aaps.database.entities.interfaces
|
||||||
|
|
||||||
import kotlin.math.min
|
import kotlin.math.min
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
package info.nightscout.database.entities.interfaces
|
package app.aaps.database.entities.interfaces
|
||||||
|
|
||||||
import info.nightscout.database.entities.embedments.InterfaceIDs
|
import app.aaps.database.entities.embedments.InterfaceIDs
|
||||||
|
|
||||||
interface TraceableDBEntry : DBEntry {
|
interface TraceableDBEntry : DBEntry {
|
||||||
|
|
||||||
var version: Int
|
var version: Int
|
||||||
var dateCreated: Long
|
var dateCreated: Long
|
||||||
var isValid: Boolean
|
var isValid: Boolean
|
|
@ -1,6 +1,6 @@
|
||||||
package info.nightscout.database.transactions
|
package app.aaps.database.transactions
|
||||||
|
|
||||||
import info.nightscout.database.entities.GlucoseValue
|
import app.aaps.database.entities.GlucoseValue
|
||||||
import java.util.TimeZone
|
import java.util.TimeZone
|
||||||
|
|
||||||
data class TransactionGlucoseValue(
|
data class TransactionGlucoseValue(
|
|
@ -1,10 +1,11 @@
|
||||||
package info.nightscout.database.entities
|
package app.aaps.database.entities
|
||||||
|
|
||||||
import org.junit.Assert.assertFalse
|
import org.junit.Assert.assertFalse
|
||||||
import org.junit.Assert.assertTrue
|
import org.junit.Assert.assertTrue
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
|
|
||||||
class HeartRateTest {
|
class HeartRateTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun contentEqualsTo_equals() {
|
fun contentEqualsTo_equals() {
|
||||||
val hr1 = createHeartRate()
|
val hr1 = createHeartRate()
|
|
@ -7,8 +7,8 @@ import androidx.sqlite.db.SupportSQLiteDatabase
|
||||||
import androidx.test.core.app.ApplicationProvider
|
import androidx.test.core.app.ApplicationProvider
|
||||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||||
import androidx.test.platform.app.InstrumentationRegistry
|
import androidx.test.platform.app.InstrumentationRegistry
|
||||||
import info.nightscout.database.entities.HeartRate
|
import app.aaps.database.entities.HeartRate
|
||||||
import info.nightscout.database.entities.TABLE_HEART_RATE
|
import app.aaps.database.entities.TABLE_HEART_RATE
|
||||||
import org.junit.Assert.assertEquals
|
import org.junit.Assert.assertEquals
|
||||||
import org.junit.Assert.assertFalse
|
import org.junit.Assert.assertFalse
|
||||||
import org.junit.Assert.assertTrue
|
import org.junit.Assert.assertTrue
|
||||||
|
@ -112,6 +112,7 @@ internal class HeartRateDaoTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
|
||||||
private const val TEST_DB_NAME = "testDatabase"
|
private const val TEST_DB_NAME = "testDatabase"
|
||||||
|
|
||||||
fun createHeartRate(timestamp: Long? = null, beatsPerMinute: Double = 80.0) =
|
fun createHeartRate(timestamp: Long? = null, beatsPerMinute: Double = 80.0) =
|
||||||
|
|
|
@ -3,6 +3,25 @@ package info.nightscout.database.impl
|
||||||
import androidx.room.Database
|
import androidx.room.Database
|
||||||
import androidx.room.RoomDatabase
|
import androidx.room.RoomDatabase
|
||||||
import androidx.room.TypeConverters
|
import androidx.room.TypeConverters
|
||||||
|
import app.aaps.database.entities.Bolus
|
||||||
|
import app.aaps.database.entities.BolusCalculatorResult
|
||||||
|
import app.aaps.database.entities.Carbs
|
||||||
|
import app.aaps.database.entities.DeviceStatus
|
||||||
|
import app.aaps.database.entities.EffectiveProfileSwitch
|
||||||
|
import app.aaps.database.entities.ExtendedBolus
|
||||||
|
import app.aaps.database.entities.Food
|
||||||
|
import app.aaps.database.entities.GlucoseValue
|
||||||
|
import app.aaps.database.entities.HeartRate
|
||||||
|
import app.aaps.database.entities.MultiwaveBolusLink
|
||||||
|
import app.aaps.database.entities.OfflineEvent
|
||||||
|
import app.aaps.database.entities.PreferenceChange
|
||||||
|
import app.aaps.database.entities.ProfileSwitch
|
||||||
|
import app.aaps.database.entities.TemporaryBasal
|
||||||
|
import app.aaps.database.entities.TemporaryTarget
|
||||||
|
import app.aaps.database.entities.TherapyEvent
|
||||||
|
import app.aaps.database.entities.TotalDailyDose
|
||||||
|
import app.aaps.database.entities.UserEntry
|
||||||
|
import app.aaps.database.entities.VersionChange
|
||||||
import info.nightscout.database.impl.daos.APSResultDao
|
import info.nightscout.database.impl.daos.APSResultDao
|
||||||
import info.nightscout.database.impl.daos.APSResultLinkDao
|
import info.nightscout.database.impl.daos.APSResultLinkDao
|
||||||
import info.nightscout.database.impl.daos.BolusCalculatorResultDao
|
import info.nightscout.database.impl.daos.BolusCalculatorResultDao
|
||||||
|
@ -13,6 +32,7 @@ import info.nightscout.database.impl.daos.EffectiveProfileSwitchDao
|
||||||
import info.nightscout.database.impl.daos.ExtendedBolusDao
|
import info.nightscout.database.impl.daos.ExtendedBolusDao
|
||||||
import info.nightscout.database.impl.daos.FoodDao
|
import info.nightscout.database.impl.daos.FoodDao
|
||||||
import info.nightscout.database.impl.daos.GlucoseValueDao
|
import info.nightscout.database.impl.daos.GlucoseValueDao
|
||||||
|
import info.nightscout.database.impl.daos.HeartRateDao
|
||||||
import info.nightscout.database.impl.daos.MultiwaveBolusLinkDao
|
import info.nightscout.database.impl.daos.MultiwaveBolusLinkDao
|
||||||
import info.nightscout.database.impl.daos.OfflineEventDao
|
import info.nightscout.database.impl.daos.OfflineEventDao
|
||||||
import info.nightscout.database.impl.daos.PreferenceChangeDao
|
import info.nightscout.database.impl.daos.PreferenceChangeDao
|
||||||
|
@ -23,39 +43,19 @@ import info.nightscout.database.impl.daos.TherapyEventDao
|
||||||
import info.nightscout.database.impl.daos.TotalDailyDoseDao
|
import info.nightscout.database.impl.daos.TotalDailyDoseDao
|
||||||
import info.nightscout.database.impl.daos.UserEntryDao
|
import info.nightscout.database.impl.daos.UserEntryDao
|
||||||
import info.nightscout.database.impl.daos.VersionChangeDao
|
import info.nightscout.database.impl.daos.VersionChangeDao
|
||||||
import info.nightscout.database.entities.APSResult
|
|
||||||
import info.nightscout.database.entities.APSResultLink
|
|
||||||
import info.nightscout.database.entities.Bolus
|
|
||||||
import info.nightscout.database.entities.BolusCalculatorResult
|
|
||||||
import info.nightscout.database.entities.Carbs
|
|
||||||
import info.nightscout.database.entities.DeviceStatus
|
|
||||||
import info.nightscout.database.entities.EffectiveProfileSwitch
|
|
||||||
import info.nightscout.database.entities.ExtendedBolus
|
|
||||||
import info.nightscout.database.entities.Food
|
|
||||||
import info.nightscout.database.entities.GlucoseValue
|
|
||||||
import info.nightscout.database.entities.HeartRate
|
|
||||||
import info.nightscout.database.entities.MultiwaveBolusLink
|
|
||||||
import info.nightscout.database.entities.OfflineEvent
|
|
||||||
import info.nightscout.database.entities.PreferenceChange
|
|
||||||
import info.nightscout.database.entities.ProfileSwitch
|
|
||||||
import info.nightscout.database.entities.TemporaryBasal
|
|
||||||
import info.nightscout.database.entities.TemporaryTarget
|
|
||||||
import info.nightscout.database.entities.TherapyEvent
|
|
||||||
import info.nightscout.database.entities.TotalDailyDose
|
|
||||||
import info.nightscout.database.entities.UserEntry
|
|
||||||
import info.nightscout.database.entities.VersionChange
|
|
||||||
import info.nightscout.database.impl.daos.HeartRateDao
|
|
||||||
import java.io.Closeable
|
import java.io.Closeable
|
||||||
|
|
||||||
const val DATABASE_VERSION = 24
|
const val DATABASE_VERSION = 24
|
||||||
|
|
||||||
@Database(version = DATABASE_VERSION,
|
@Database(
|
||||||
entities = [APSResult::class, Bolus::class, BolusCalculatorResult::class, Carbs::class,
|
version = DATABASE_VERSION,
|
||||||
|
entities = [app.aaps.database.entities.APSResult::class, Bolus::class, BolusCalculatorResult::class, Carbs::class,
|
||||||
EffectiveProfileSwitch::class, ExtendedBolus::class, GlucoseValue::class, ProfileSwitch::class,
|
EffectiveProfileSwitch::class, ExtendedBolus::class, GlucoseValue::class, ProfileSwitch::class,
|
||||||
TemporaryBasal::class, TemporaryTarget::class, TherapyEvent::class, TotalDailyDose::class, APSResultLink::class,
|
TemporaryBasal::class, TemporaryTarget::class, TherapyEvent::class, TotalDailyDose::class, app.aaps.database.entities.APSResultLink::class,
|
||||||
MultiwaveBolusLink::class, PreferenceChange::class, VersionChange::class, UserEntry::class,
|
MultiwaveBolusLink::class, PreferenceChange::class, VersionChange::class, UserEntry::class,
|
||||||
Food::class, DeviceStatus::class, OfflineEvent::class, HeartRate::class],
|
Food::class, DeviceStatus::class, OfflineEvent::class, HeartRate::class],
|
||||||
exportSchema = true)
|
exportSchema = true
|
||||||
|
)
|
||||||
@TypeConverters(Converters::class)
|
@TypeConverters(Converters::class)
|
||||||
internal abstract class AppDatabase : Closeable, RoomDatabase() {
|
internal abstract class AppDatabase : Closeable, RoomDatabase() {
|
||||||
|
|
||||||
|
|
|
@ -1,26 +1,26 @@
|
||||||
package info.nightscout.database.impl
|
package info.nightscout.database.impl
|
||||||
|
|
||||||
import info.nightscout.database.ValueWrapper
|
import app.aaps.database.ValueWrapper
|
||||||
|
import app.aaps.database.entities.Bolus
|
||||||
|
import app.aaps.database.entities.BolusCalculatorResult
|
||||||
|
import app.aaps.database.entities.Carbs
|
||||||
|
import app.aaps.database.entities.DeviceStatus
|
||||||
|
import app.aaps.database.entities.EffectiveProfileSwitch
|
||||||
|
import app.aaps.database.entities.ExtendedBolus
|
||||||
|
import app.aaps.database.entities.Food
|
||||||
|
import app.aaps.database.entities.GlucoseValue
|
||||||
|
import app.aaps.database.entities.HeartRate
|
||||||
|
import app.aaps.database.entities.OfflineEvent
|
||||||
|
import app.aaps.database.entities.ProfileSwitch
|
||||||
|
import app.aaps.database.entities.TemporaryBasal
|
||||||
|
import app.aaps.database.entities.TemporaryTarget
|
||||||
|
import app.aaps.database.entities.TherapyEvent
|
||||||
|
import app.aaps.database.entities.TotalDailyDose
|
||||||
|
import app.aaps.database.entities.UserEntry
|
||||||
|
import app.aaps.database.entities.data.NewEntries
|
||||||
|
import app.aaps.database.entities.embedments.InterfaceIDs
|
||||||
|
import app.aaps.database.entities.interfaces.DBEntry
|
||||||
import info.nightscout.database.annotations.DbOpenForTesting
|
import info.nightscout.database.annotations.DbOpenForTesting
|
||||||
import info.nightscout.database.entities.Bolus
|
|
||||||
import info.nightscout.database.entities.BolusCalculatorResult
|
|
||||||
import info.nightscout.database.entities.Carbs
|
|
||||||
import info.nightscout.database.entities.DeviceStatus
|
|
||||||
import info.nightscout.database.entities.EffectiveProfileSwitch
|
|
||||||
import info.nightscout.database.entities.ExtendedBolus
|
|
||||||
import info.nightscout.database.entities.Food
|
|
||||||
import info.nightscout.database.entities.GlucoseValue
|
|
||||||
import info.nightscout.database.entities.HeartRate
|
|
||||||
import info.nightscout.database.entities.OfflineEvent
|
|
||||||
import info.nightscout.database.entities.ProfileSwitch
|
|
||||||
import info.nightscout.database.entities.TemporaryBasal
|
|
||||||
import info.nightscout.database.entities.TemporaryTarget
|
|
||||||
import info.nightscout.database.entities.TherapyEvent
|
|
||||||
import info.nightscout.database.entities.TotalDailyDose
|
|
||||||
import info.nightscout.database.entities.UserEntry
|
|
||||||
import info.nightscout.database.entities.data.NewEntries
|
|
||||||
import info.nightscout.database.entities.embedments.InterfaceIDs
|
|
||||||
import info.nightscout.database.entities.interfaces.DBEntry
|
|
||||||
import info.nightscout.database.impl.transactions.Transaction
|
import info.nightscout.database.impl.transactions.Transaction
|
||||||
import io.reactivex.rxjava3.core.Completable
|
import io.reactivex.rxjava3.core.Completable
|
||||||
import io.reactivex.rxjava3.core.Maybe
|
import io.reactivex.rxjava3.core.Maybe
|
||||||
|
|
|
@ -1,21 +1,21 @@
|
||||||
package info.nightscout.database.impl
|
package info.nightscout.database.impl
|
||||||
|
|
||||||
import androidx.room.TypeConverter
|
import androidx.room.TypeConverter
|
||||||
import info.nightscout.database.entities.APSResult
|
import app.aaps.database.entities.APSResult
|
||||||
import info.nightscout.database.entities.Bolus
|
import app.aaps.database.entities.Bolus
|
||||||
import info.nightscout.database.entities.EffectiveProfileSwitch
|
import app.aaps.database.entities.EffectiveProfileSwitch
|
||||||
import info.nightscout.database.entities.GlucoseValue
|
import app.aaps.database.entities.GlucoseValue
|
||||||
import info.nightscout.database.entities.OfflineEvent
|
import app.aaps.database.entities.OfflineEvent
|
||||||
import info.nightscout.database.entities.ProfileSwitch
|
import app.aaps.database.entities.ProfileSwitch
|
||||||
import info.nightscout.database.entities.TemporaryBasal
|
import app.aaps.database.entities.TemporaryBasal
|
||||||
import info.nightscout.database.entities.TemporaryTarget
|
import app.aaps.database.entities.TemporaryTarget
|
||||||
import info.nightscout.database.entities.TherapyEvent
|
import app.aaps.database.entities.TherapyEvent
|
||||||
import info.nightscout.database.entities.UserEntry.Action
|
import app.aaps.database.entities.UserEntry.Action
|
||||||
import info.nightscout.database.entities.UserEntry.Sources
|
import app.aaps.database.entities.UserEntry.Sources
|
||||||
import info.nightscout.database.entities.ValueWithUnit
|
import app.aaps.database.entities.ValueWithUnit
|
||||||
import info.nightscout.database.entities.data.Block
|
import app.aaps.database.entities.data.Block
|
||||||
import info.nightscout.database.entities.data.TargetBlock
|
import app.aaps.database.entities.data.TargetBlock
|
||||||
import info.nightscout.database.entities.embedments.InterfaceIDs
|
import app.aaps.database.entities.embedments.InterfaceIDs
|
||||||
import info.nightscout.database.impl.serialisation.SealedClassHelper
|
import info.nightscout.database.impl.serialisation.SealedClassHelper
|
||||||
import info.nightscout.database.impl.serialisation.fromJson
|
import info.nightscout.database.impl.serialisation.fromJson
|
||||||
import org.json.JSONArray
|
import org.json.JSONArray
|
||||||
|
@ -186,9 +186,11 @@ class Converters {
|
||||||
for (i in 0 until jsonArray.length()) {
|
for (i in 0 until jsonArray.length()) {
|
||||||
val jsonObject = jsonArray.getJSONObject(i)
|
val jsonObject = jsonArray.getJSONObject(i)
|
||||||
list.add(
|
list.add(
|
||||||
TargetBlock(jsonObject.getLong("duration"),
|
TargetBlock(
|
||||||
|
jsonObject.getLong("duration"),
|
||||||
jsonObject.getDouble("lowTarget"),
|
jsonObject.getDouble("lowTarget"),
|
||||||
jsonObject.getDouble("highTarget"))
|
jsonObject.getDouble("highTarget")
|
||||||
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
return list
|
return list
|
||||||
|
|
|
@ -6,9 +6,9 @@ import androidx.room.Room
|
||||||
import androidx.room.RoomDatabase.Callback
|
import androidx.room.RoomDatabase.Callback
|
||||||
import androidx.room.migration.Migration
|
import androidx.room.migration.Migration
|
||||||
import androidx.sqlite.db.SupportSQLiteDatabase
|
import androidx.sqlite.db.SupportSQLiteDatabase
|
||||||
|
import app.aaps.database.entities.TABLE_HEART_RATE
|
||||||
import dagger.Module
|
import dagger.Module
|
||||||
import dagger.Provides
|
import dagger.Provides
|
||||||
import info.nightscout.database.entities.TABLE_HEART_RATE
|
|
||||||
import javax.inject.Qualifier
|
import javax.inject.Qualifier
|
||||||
import javax.inject.Singleton
|
import javax.inject.Singleton
|
||||||
|
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue