diff --git a/app/build.gradle b/app/build.gradle index 26c79286a4..4c840f920c 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -9,6 +9,7 @@ buildscript { classpath 'com.dicedmelon.gradle:jacoco-android:0.1.3' } } + apply plugin: "com.android.application" apply plugin: 'com.google.gms.google-services' apply plugin: "io.fabric" @@ -21,6 +22,8 @@ ext { powermockVersion = "1.7.3" dexmakerVersion = "1.2" butterknifeVersion = "8.8.1" + playServicesWearVersion = "10.2.1" // 10.2.1 + } @@ -65,7 +68,7 @@ android { multiDexEnabled true versionCode 1500 // dev_version: 2.2.3-dev - version "medtronic-0.9.0-SNAPSHOT" + version "medtronic-0.9.1-SNAPSHOT" buildConfigField "String", "VERSION", '"' + version + '"' buildConfigField "String", "BUILDVERSION", '"' + generateGitBuild() + '-' + generateDate() + '"' buildConfigField "String", "HEAD", '"' + generateGitBuild() + '"' @@ -158,6 +161,10 @@ android { allprojects { repositories { jcenter() + maven { + url "https://maven.google.com" + } + flatDir { dirs 'libs' } @@ -172,7 +179,10 @@ dependencies { wearApp project(':wear') implementation fileTree(include: ['*.jar'], dir: 'libs') + implementation "com.google.android.gms:play-services-wearable:16.0.1" implementation 'com.google.firebase:firebase-core:16.0.8' + //implementation 'com.google.android.gms:play-services-auth:16.0.1' + //implementation 'com.google.firebase:firebase-auth:16.0.1' implementation("com.crashlytics.sdk.android:crashlytics:2.9.9@aar") { transitive = true; } @@ -200,7 +210,7 @@ dependencies { implementation "com.jjoe64:graphview:4.0.1" implementation "com.joanzapata.iconify:android-iconify-fontawesome:2.1.1" implementation 'com.android.support.constraint:constraint-layout:1.1.3' - implementation 'com.google.android.gms:play-services-wearable:10.2.1' + implementation(name: "android-edittext-validator-v1.3.4-mod", ext: "aar") implementation 'com.madgag.spongycastle:core:1.58.0.0' diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/defs/PumpType.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/defs/PumpType.java index c14cf5eee2..705f389fd2 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/defs/PumpType.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/defs/PumpType.java @@ -1,5 +1,6 @@ package info.nightscout.androidaps.plugins.pump.common.defs; + import java.util.HashMap; import java.util.Map; @@ -7,115 +8,123 @@ import info.nightscout.androidaps.MainApp; import info.nightscout.androidaps.R; import info.nightscout.androidaps.plugins.pump.common.data.DoseSettings; + /** * Created by andy on 02/05/2018. - * + *
* Most of this defintions is intended for VirtualPump only, but they can be used by other plugins.
*/
public enum PumpType {
GenericAAPS("Generic AAPS", 0.1d, null, //
- new DoseSettings(0.05d, 30, 8 * 60, 0.05d), //
- PumpTempBasalType.Percent, //
- new DoseSettings(10, 30, 24 * 60, 0d, 500d), PumpCapability.BasalRate_Duration15and30minAllowed, //
- 0.01d, 0.01d, null, PumpCapability.VirtualPumpCapabilities), //
+ new DoseSettings(0.05d, 30, 8 * 60, 0.05d), //
+ PumpTempBasalType.Percent, //
+ new DoseSettings(10, 30, 24 * 60, 0d, 500d), PumpCapability.BasalRate_Duration15and30minAllowed, //
+ 0.01d, 0.01d, null, PumpCapability.VirtualPumpCapabilities), //
// Cellnovo
Cellnovo1("Cellnovo", 0.05d, null, //
- new DoseSettings(0.05d, 30, 24 * 60, 1d, null), PumpTempBasalType.Percent, new DoseSettings(5, 30, 24 * 60, 0d,
- 200d), PumpCapability.BasalRate_Duration30minAllowed, //
- 0.05d, 0.05d, null, PumpCapability.VirtualPumpCapabilities), //
+ new DoseSettings(0.05d, 30, 24 * 60, 1d, null),
+ PumpTempBasalType.Percent,
+ new DoseSettings(5, 30, 24 * 60, 0d, 200d), PumpCapability.BasalRate_Duration30minAllowed, //
+ 0.05d, 0.05d, null, PumpCapability.VirtualPumpCapabilities), //
// Accu-Chek
AccuChekCombo("Accu-Chek Combo", 0.1d, null, //
- new DoseSettings(0.1d, 15, 12 * 60, 0.1d), //
- PumpTempBasalType.Percent, new DoseSettings(10, 15, 12 * 60, 0d, 500d), PumpCapability.BasalRate_Duration15and30minAllowed, //
- 0.01d, 0.01d, DoseStepSize.ComboBasal, PumpCapability.ComboCapabilities), //
+ new DoseSettings(0.1d, 15, 12 * 60, 0.1d), //
+ PumpTempBasalType.Percent,
+ new DoseSettings(10, 15, 12 * 60, 0d, 500d), PumpCapability.BasalRate_Duration15and30minAllowed, //
+ 0.01d, 0.01d, DoseStepSize.ComboBasal, PumpCapability.ComboCapabilities), //
AccuChekSpirit("Accu-Chek Spirit", 0.1d, null, //
- new DoseSettings(0.1d, 15, 12 * 60, 0.1d), //
- PumpTempBasalType.Percent, new DoseSettings(10, 15, 12 * 60, 0d, 500d), PumpCapability.BasalRate_Duration15and30minAllowed, //
- 0.01d, 0.1d, null, PumpCapability.VirtualPumpCapabilities), //
+ new DoseSettings(0.1d, 15, 12 * 60, 0.1d), //
+ PumpTempBasalType.Percent,
+ new DoseSettings(10, 15, 12 * 60, 0d, 500d), PumpCapability.BasalRate_Duration15and30minAllowed, //
+ 0.01d, 0.1d, null, PumpCapability.VirtualPumpCapabilities), //
AccuChekInsight("Accu-Chek Insight", 0.05d, DoseStepSize.InsightBolus, //
- new DoseSettings(0.05d, 15, 24 * 60, 0.05d), //
- PumpTempBasalType.Percent, new DoseSettings(10, 15, 24 * 60, 0d, 250d), PumpCapability.BasalRate_Duration15and30minAllowed, //
- 0.02d, 0.01d, null, PumpCapability.InsightCapabilities), //
+ new DoseSettings(0.05d, 15, 24 * 60, 0.05d), //
+ PumpTempBasalType.Percent,
+ new DoseSettings(10, 15, 24 * 60, 0d, 250d), PumpCapability.BasalRate_Duration15and30minAllowed, //
+ 0.02d, 0.01d, null, PumpCapability.InsightCapabilities), //
AccuChekInsightBluetooth("Accu-Chek Insight", 0.01d, null, //
- new DoseSettings(0.01d, 15, 24 * 60, 0.05d), //
- PumpTempBasalType.Percent, new DoseSettings(10, 15, 24 * 60, 0d, 250d), PumpCapability.BasalRate_Duration15and30minAllowed, //
- 0.02d, 0.01d, DoseStepSize.InsightBolus, PumpCapability.InsightCapabilities), //
+ new DoseSettings(0.01d, 15, 24 * 60, 0.05d), //
+ PumpTempBasalType.Percent,
+ new DoseSettings(10, 15, 24 * 60, 0d, 250d), PumpCapability.BasalRate_Duration15and30minAllowed, //
+ 0.02d, 0.01d, DoseStepSize.InsightBolus, PumpCapability.InsightCapabilities), //
// Animas
AnimasVibe("Animas Vibe", 0.05d, null, // AnimasBolus?
- new DoseSettings(0.05d, 30, 12 * 60, 0.05d), //
- PumpTempBasalType.Percent, //
- new DoseSettings(10, 30, 24 * 60, 0d, 300d), PumpCapability.BasalRate_Duration30minAllowed, //
- 0.025d, 5d, 0d, null, PumpCapability.VirtualPumpCapabilities), //
+ new DoseSettings(0.05d, 30, 12 * 60, 0.05d), //
+ PumpTempBasalType.Percent, //
+ new DoseSettings(10, 30, 24 * 60, 0d, 300d), PumpCapability.BasalRate_Duration30minAllowed, //
+ 0.025d, 5d, 0d, null, PumpCapability.VirtualPumpCapabilities), //
AnimasPing("Animas Ping", AnimasVibe),
// Dana
DanaR("DanaR", 0.05d, null, //
- new DoseSettings(0.05d, 30, 8 * 60, 0.05d), //
- PumpTempBasalType.Percent, //
- new DoseSettings(10d, 60, 24 * 60, 0d, 200d), PumpCapability.BasalRate_Duration15and30minNotAllowed, //
- 0.04d, 0.01d, null, PumpCapability.DanaCapabilities),
+ new DoseSettings(0.05d, 30, 8 * 60, 0.05d), //
+ PumpTempBasalType.Percent, //
+ new DoseSettings(10d, 60, 24 * 60, 0d, 200d), PumpCapability.BasalRate_Duration15and30minNotAllowed, //
+ 0.04d, 0.01d, null, PumpCapability.DanaCapabilities),
DanaRKorean("DanaR Korean", 0.05d, null, //
- new DoseSettings(0.05d, 30, 8 * 60, 0.05d), //
- PumpTempBasalType.Percent, //
- new DoseSettings(10d, 60, 24 * 60, 0d, 200d), PumpCapability.BasalRate_Duration15and30minNotAllowed, //
- 0.1d, 0.01d, null, PumpCapability.DanaCapabilities),
+ new DoseSettings(0.05d, 30, 8 * 60, 0.05d), //
+ PumpTempBasalType.Percent, //
+ new DoseSettings(10d, 60, 24 * 60, 0d, 200d), PumpCapability.BasalRate_Duration15and30minNotAllowed, //
+ 0.1d, 0.01d, null, PumpCapability.DanaCapabilities),
DanaRS("DanaRS", 0.05d, null, //
- new DoseSettings(0.05d, 30, 8 * 60, 0.05d), //
- PumpTempBasalType.Percent, //
- new DoseSettings(10d, 60, 24 * 60, 0d, 200d), PumpCapability.BasalRate_Duration15and30minAllowed, //
- 0.04d, 0.01d, null, PumpCapability.DanaWithHistoryCapabilities),
+ new DoseSettings(0.05d, 30, 8 * 60, 0.05d), //
+ PumpTempBasalType.Percent, //
+ new DoseSettings(10d, 60, 24 * 60, 0d, 200d), PumpCapability.BasalRate_Duration15and30minAllowed, //
+ 0.04d, 0.01d, null, PumpCapability.DanaWithHistoryCapabilities),
DanaRv2("DanaRv2", DanaRS),
+
// Insulet
Insulet_Omnipod("Insulet Omnipod", 0.05d, null, //
- new DoseSettings(0.05d, 30, 8 * 60, 0.05d), //
- PumpTempBasalType.Absolute, //
- new DoseSettings(0.05d, 30, 12 * 60, 0d, 30.0d), PumpCapability.BasalRate_Duration30minAllowed, // cannot exceed max
- // basal rate 30u/hr
- 0.05d, 0.05d, null, PumpCapability.VirtualPumpCapabilities),
+ new DoseSettings(0.05d, 30, 8 * 60, 0.05d), //
+ PumpTempBasalType.Absolute, //
+ new DoseSettings(0.05d, 30, 12 * 60, 0d, 30.0d), PumpCapability.BasalRate_Duration30minAllowed, // cannot exceed max basal rate 30u/hr
+ 0.05d, 0.05d, null, PumpCapability.VirtualPumpCapabilities),
// Medtronic
Medtronic_512_712("Medtronic 512/712", 0.05d, null, //
- new DoseSettings(0.05d, 30, 8 * 60, 0.05d), //
- PumpTempBasalType.Absolute, //
- new DoseSettings(0.05d, 30, 24 * 60, 0d, 35d), PumpCapability.BasalRate_Duration30minAllowed, //
- 0.05d, 0.05d, null, PumpCapability.MedtronicCapabilities), // TODO
+ new DoseSettings(0.05d, 30, 8 * 60, 0.05d), //
+ PumpTempBasalType.Absolute, //
+ new DoseSettings(0.05d, 30, 24 * 60, 0d, 35d), PumpCapability.BasalRate_Duration30minAllowed, //
+ 0.05d, 0.05d, null, PumpCapability.MedtronicCapabilities), // TODO
Medtronic_515_715("Medtronic 515/715", Medtronic_512_712),
Medtronic_522_722("Medtronic 522/722", Medtronic_512_712),
Medtronic_523_723_Revel("Medtronic 523/723 (Revel)", 0.05d, null, //
- new DoseSettings(0.05d, 30, 8 * 60, 0.05d), //
- PumpTempBasalType.Absolute, //
- new DoseSettings(0.05d, 30, 24 * 60, 0d, 35d), PumpCapability.BasalRate_Duration30minAllowed, //
- 0.025d, 0.025d, DoseStepSize.MedtronicVeoBasal, PumpCapability.MedtronicCapabilities), //
+ new DoseSettings(0.05d, 30, 8 * 60, 0.05d), //
+ PumpTempBasalType.Absolute, //
+ new DoseSettings(0.05d, 30, 24 * 60, 0d, 35d), PumpCapability.BasalRate_Duration30minAllowed, //
+ 0.025d, 0.025d, DoseStepSize.MedtronicVeoBasal, PumpCapability.MedtronicCapabilities), //
Medtronic_554_754_Veo("Medtronic 554/754 (Veo)", Medtronic_523_723_Revel), // TODO
Medtronic_640G("Medtronic 640G", 0.025d, null, //
- new DoseSettings(0.05d, 30, 8 * 60, 0.05d), //
- PumpTempBasalType.Absolute, //
- new DoseSettings(0.05d, 30, 24 * 60, 0d, 35d), PumpCapability.BasalRate_Duration30minAllowed, //
- 0.025d, 0.025d, DoseStepSize.MedtronicVeoBasal, PumpCapability.VirtualPumpCapabilities), //
+ new DoseSettings(0.05d, 30, 8 * 60, 0.05d), //
+ PumpTempBasalType.Absolute, //
+ new DoseSettings(0.05d, 30, 24 * 60, 0d, 35d), PumpCapability.BasalRate_Duration30minAllowed, //
+ 0.025d, 0.025d, DoseStepSize.MedtronicVeoBasal, PumpCapability.VirtualPumpCapabilities), //
// Tandem
TandemTSlim("Tandem t:slim", 0.01d, null, //
- new DoseSettings(0.01d, 15, 8 * 60, 0.4d), PumpTempBasalType.Percent, new DoseSettings(1, 15, 8 * 60, 0d, 250d), PumpCapability.BasalRate_Duration15and30minAllowed, //
- 0.1d, 0.001d, null, PumpCapability.VirtualPumpCapabilities),
+ new DoseSettings(0.01d, 15, 8 * 60, 0.4d),
+ PumpTempBasalType.Percent,
+ new DoseSettings(1, 15, 8 * 60, 0d, 250d), PumpCapability.BasalRate_Duration15and30minAllowed, //
+ 0.1d, 0.001d, null, PumpCapability.VirtualPumpCapabilities),
TandemTFlex("Tandem t:flex", TandemTSlim), //
TandemTSlimG4("Tandem t:slim G4", TandemTSlim), //
@@ -148,37 +157,30 @@ public enum PumpType {
PumpType(String description, PumpType parent) {
+
this.description = description;
this.parent = parent;
}
-
PumpType(String description, PumpType parent, PumpCapability pumpCapability) {
this.description = description;
this.parent = parent;
this.pumpCapability = pumpCapability;
}
+ PumpType(String description, double bolusSize, DoseStepSize specialBolusSize, //
+ DoseSettings extendedBolusSettings, //
+ PumpTempBasalType pumpTempBasalType, DoseSettings tbrSettings, PumpCapability specialBasalDurations, //
+ double baseBasalMinValue, double baseBasalStep, DoseStepSize baseBasalSpecialSteps, PumpCapability pumpCapability) {
- PumpType(String description, double bolusSize,
- DoseStepSize specialBolusSize, //
- DoseSettings extendedBolusSettings, //
- PumpTempBasalType pumpTempBasalType, DoseSettings tbrSettings,
- PumpCapability specialBasalDurations, //
- double baseBasalMinValue, double baseBasalStep, DoseStepSize baseBasalSpecialSteps,
- PumpCapability pumpCapability) {
- this(description, bolusSize, specialBolusSize, extendedBolusSettings, pumpTempBasalType, tbrSettings,
- specialBasalDurations, baseBasalMinValue, null, baseBasalStep, baseBasalSpecialSteps, pumpCapability);
+ this(description, bolusSize, specialBolusSize, extendedBolusSettings, pumpTempBasalType, tbrSettings, specialBasalDurations, baseBasalMinValue, null, baseBasalStep, baseBasalSpecialSteps, pumpCapability);
}
+ PumpType(String description, double bolusSize, DoseStepSize specialBolusSize, //
+ DoseSettings extendedBolusSettings, //
+ PumpTempBasalType pumpTempBasalType, DoseSettings tbrSettings, PumpCapability specialBasalDurations, //
+ double baseBasalMinValue, Double baseBasalMaxValue, double baseBasalStep, DoseStepSize baseBasalSpecialSteps, PumpCapability pumpCapability) {
- PumpType(String description, double bolusSize,
- DoseStepSize specialBolusSize, //
- DoseSettings extendedBolusSettings, //
- PumpTempBasalType pumpTempBasalType, DoseSettings tbrSettings,
- PumpCapability specialBasalDurations, //
- double baseBasalMinValue, Double baseBasalMaxValue, double baseBasalStep,
- DoseStepSize baseBasalSpecialSteps, PumpCapability pumpCapability) {
this.description = description;
this.bolusSize = bolusSize;
this.specialBolusSize = specialBolusSize;
@@ -195,10 +197,10 @@ public enum PumpType {
public String getDescription() {
+
return description;
}
-
public PumpCapability getPumpCapability() {
if (isParentSet())
@@ -207,63 +209,74 @@ public enum PumpType {
return this.pumpCapability;
}
-
public double getBolusSize() {
+
return isParentSet() ? parent.bolusSize : bolusSize;
}
public DoseStepSize getSpecialBolusSize() {
+
return isParentSet() ? parent.specialBolusSize : specialBolusSize;
}
public DoseSettings getExtendedBolusSettings() {
+
return isParentSet() ? parent.extendedBolusSettings : extendedBolusSettings;
}
public PumpTempBasalType getPumpTempBasalType() {
+
return isParentSet() ? parent.pumpTempBasalType : pumpTempBasalType;
}
public DoseSettings getTbrSettings() {
+
return isParentSet() ? parent.tbrSettings : tbrSettings;
}
public double getBaseBasalMinValue() {
+
return isParentSet() ? parent.baseBasalMinValue : baseBasalMinValue;
}
public Double getBaseBasalMaxValue() {
+
return isParentSet() ? parent.baseBasalMaxValue : baseBasalMaxValue;
}
public double getBaseBasalStep() {
+
return isParentSet() ? parent.baseBasalStep : baseBasalStep;
}
public DoseStepSize getBaseBasalSpecialSteps() {
+
return isParentSet() ? parent.baseBasalSpecialSteps : baseBasalSpecialSteps;
}
public PumpType getParent() {
+
return parent;
}
private boolean isParentSet() {
+
return this.parent != null;
}
public static PumpType getByDescription(String desc) {
+
if (mapByDescription.containsKey(desc)) {
return mapByDescription.get(desc);
} else {
@@ -281,18 +294,17 @@ public enum PumpType {
String extendedNote = hasExtendedBasals ? MainApp.gs(R.string.virtualpump_pump_def_extended_note) : "";
- return String.format(
- i18nTemplate, //
- getStep("" + getBolusSize(), getSpecialBolusSize()), //
- eb.getStep(), eb.getDurationStep(),
- eb.getMaxDuration() / 60, //
- getStep(getBaseBasalRange(), getBaseBasalSpecialSteps()), //
- tbr.getMinDose() + unit + "-" + tbr.getMaxDose() + unit, tbr.getStep() + unit, tbr.getDurationStep(),
- tbr.getMaxDuration() / 60, extendedNote);
+ return String.format(i18nTemplate, //
+ getStep("" + getBolusSize(), getSpecialBolusSize()), //
+ eb.getStep(), eb.getDurationStep(), eb.getMaxDuration() / 60, //
+ getStep(getBaseBasalRange(), getBaseBasalSpecialSteps()), //
+ tbr.getMinDose() + unit + "-" + tbr.getMaxDose() + unit, tbr.getStep() + unit,
+ tbr.getDurationStep(), tbr.getMaxDuration() / 60, extendedNote);
}
private String getBaseBasalRange() {
+
Double maxValue = getBaseBasalMaxValue();
return maxValue == null ? "" + getBaseBasalMinValue() : getBaseBasalMinValue() + "-" + maxValue;
@@ -300,6 +312,7 @@ public enum PumpType {
private String getStep(String step, DoseStepSize stepSize) {
+
if (stepSize != null)
return step + " [" + stepSize.getDescription() + "] *";
else
@@ -308,6 +321,7 @@ public enum PumpType {
public boolean hasExtendedBasals() {
+
return ((getBaseBasalSpecialSteps() != null) || (getSpecialBolusSize() != null));
}
@@ -318,13 +332,12 @@ public enum PumpType {
return parent.getSpecialBasalDurations();
} else {
return specialBasalDurations == null ? //
- PumpCapability.BasalRate_Duration15and30minNotAllowed
- : specialBasalDurations;
+ PumpCapability.BasalRate_Duration15and30minNotAllowed : specialBasalDurations;
}
}
-
public double determineCorrectBolusSize(double bolusAmount) {
+
if (bolusAmount == 0.0d) {
return bolusAmount;
}
@@ -336,7 +349,7 @@ public enum PumpType {
} else {
DoseStepSize specialBolusSize = getSpecialBolusSize();
- bolusStepSize = specialBolusSize.getStepSizeForAmount((double)bolusAmount);
+ bolusStepSize = specialBolusSize.getStepSizeForAmount((double) bolusAmount);
}
return Math.round(bolusAmount / bolusStepSize) * bolusStepSize;
@@ -344,6 +357,7 @@ public enum PumpType {
public double determineCorrectExtendedBolusSize(double bolusAmount) {
+
if (bolusAmount == 0.0d) {
return bolusAmount;
}
@@ -367,6 +381,7 @@ public enum PumpType {
public double determineCorrectBasalSize(double basalAmount) {
+
if (basalAmount == 0.0d) {
return basalAmount;
}
@@ -378,7 +393,7 @@ public enum PumpType {
} else {
DoseStepSize specialBolusSize = getBaseBasalSpecialSteps();
- basalStepSize = specialBolusSize.getStepSizeForAmount((double)basalAmount);
+ basalStepSize = specialBolusSize.getStepSizeForAmount((double) basalAmount);
}
if (basalAmount > getTbrSettings().getMaxDose())
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/utils/FabricUtil.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/utils/FabricUtil.java
index 51504095ef..eb07d79582 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/utils/FabricUtil.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/utils/FabricUtil.java
@@ -44,6 +44,7 @@ public class FabricUtil {
}
}
+ // FIXME andy!!!
// FabricPrivacy.getInstance().logCustom(customEvent);
}
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/history/pump/MedtronicPumpHistoryDecoder.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/history/pump/MedtronicPumpHistoryDecoder.java
index c73e735db7..9deb8c95a6 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/history/pump/MedtronicPumpHistoryDecoder.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/history/pump/MedtronicPumpHistoryDecoder.java
@@ -631,9 +631,9 @@ public class MedtronicPumpHistoryDecoder extends MedtronicHistoryDecoder