- gradle fix, that might fix ClassNotFound Exception with Wear

- fix for duplicated entries
- trying to fix overwriting of data from NS (not done yet)
This commit is contained in:
Andy Rozman 2019-04-09 23:14:06 +01:00
parent 2397c8e0d2
commit 26a50bbbc4
7 changed files with 149 additions and 114 deletions

View file

@ -9,6 +9,7 @@ buildscript {
classpath 'com.dicedmelon.gradle:jacoco-android:0.1.3' classpath 'com.dicedmelon.gradle:jacoco-android:0.1.3'
} }
} }
apply plugin: "com.android.application" apply plugin: "com.android.application"
apply plugin: 'com.google.gms.google-services' apply plugin: 'com.google.gms.google-services'
apply plugin: "io.fabric" apply plugin: "io.fabric"
@ -21,6 +22,8 @@ ext {
powermockVersion = "1.7.3" powermockVersion = "1.7.3"
dexmakerVersion = "1.2" dexmakerVersion = "1.2"
butterknifeVersion = "8.8.1" butterknifeVersion = "8.8.1"
playServicesWearVersion = "10.2.1" // 10.2.1
} }
@ -65,7 +68,7 @@ android {
multiDexEnabled true multiDexEnabled true
versionCode 1500 versionCode 1500
// dev_version: 2.2.3-dev // dev_version: 2.2.3-dev
version "medtronic-0.9.0-SNAPSHOT" version "medtronic-0.9.1-SNAPSHOT"
buildConfigField "String", "VERSION", '"' + version + '"' buildConfigField "String", "VERSION", '"' + version + '"'
buildConfigField "String", "BUILDVERSION", '"' + generateGitBuild() + '-' + generateDate() + '"' buildConfigField "String", "BUILDVERSION", '"' + generateGitBuild() + '-' + generateDate() + '"'
buildConfigField "String", "HEAD", '"' + generateGitBuild() + '"' buildConfigField "String", "HEAD", '"' + generateGitBuild() + '"'
@ -158,6 +161,10 @@ android {
allprojects { allprojects {
repositories { repositories {
jcenter() jcenter()
maven {
url "https://maven.google.com"
}
flatDir { flatDir {
dirs 'libs' dirs 'libs'
} }
@ -172,7 +179,10 @@ dependencies {
wearApp project(':wear') wearApp project(':wear')
implementation fileTree(include: ['*.jar'], dir: 'libs') 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.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") { implementation("com.crashlytics.sdk.android:crashlytics:2.9.9@aar") {
transitive = true; transitive = true;
} }
@ -200,7 +210,7 @@ dependencies {
implementation "com.jjoe64:graphview:4.0.1" implementation "com.jjoe64:graphview:4.0.1"
implementation "com.joanzapata.iconify:android-iconify-fontawesome:2.1.1" implementation "com.joanzapata.iconify:android-iconify-fontawesome:2.1.1"
implementation 'com.android.support.constraint:constraint-layout:1.1.3' 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(name: "android-edittext-validator-v1.3.4-mod", ext: "aar")
implementation 'com.madgag.spongycastle:core:1.58.0.0' implementation 'com.madgag.spongycastle:core:1.58.0.0'

View file

@ -1,5 +1,6 @@
package info.nightscout.androidaps.plugins.pump.common.defs; package info.nightscout.androidaps.plugins.pump.common.defs;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
@ -7,115 +8,123 @@ import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R; import info.nightscout.androidaps.R;
import info.nightscout.androidaps.plugins.pump.common.data.DoseSettings; import info.nightscout.androidaps.plugins.pump.common.data.DoseSettings;
/** /**
* Created by andy on 02/05/2018. * Created by andy on 02/05/2018.
* * <p>
* Most of this defintions is intended for VirtualPump only, but they can be used by other plugins. * Most of this defintions is intended for VirtualPump only, but they can be used by other plugins.
*/ */
public enum PumpType { public enum PumpType {
GenericAAPS("Generic AAPS", 0.1d, null, // GenericAAPS("Generic AAPS", 0.1d, null, //
new DoseSettings(0.05d, 30, 8 * 60, 0.05d), // new DoseSettings(0.05d, 30, 8 * 60, 0.05d), //
PumpTempBasalType.Percent, // PumpTempBasalType.Percent, //
new DoseSettings(10, 30, 24 * 60, 0d, 500d), PumpCapability.BasalRate_Duration15and30minAllowed, // new DoseSettings(10, 30, 24 * 60, 0d, 500d), PumpCapability.BasalRate_Duration15and30minAllowed, //
0.01d, 0.01d, null, PumpCapability.VirtualPumpCapabilities), // 0.01d, 0.01d, null, PumpCapability.VirtualPumpCapabilities), //
// Cellnovo // Cellnovo
Cellnovo1("Cellnovo", 0.05d, null, // Cellnovo1("Cellnovo", 0.05d, null, //
new DoseSettings(0.05d, 30, 24 * 60, 1d, null), PumpTempBasalType.Percent, new DoseSettings(5, 30, 24 * 60, 0d, new DoseSettings(0.05d, 30, 24 * 60, 1d, null),
200d), PumpCapability.BasalRate_Duration30minAllowed, // PumpTempBasalType.Percent,
0.05d, 0.05d, null, PumpCapability.VirtualPumpCapabilities), // new DoseSettings(5, 30, 24 * 60, 0d, 200d), PumpCapability.BasalRate_Duration30minAllowed, //
0.05d, 0.05d, null, PumpCapability.VirtualPumpCapabilities), //
// Accu-Chek // Accu-Chek
AccuChekCombo("Accu-Chek Combo", 0.1d, null, // AccuChekCombo("Accu-Chek Combo", 0.1d, null, //
new DoseSettings(0.1d, 15, 12 * 60, 0.1d), // new DoseSettings(0.1d, 15, 12 * 60, 0.1d), //
PumpTempBasalType.Percent, new DoseSettings(10, 15, 12 * 60, 0d, 500d), PumpCapability.BasalRate_Duration15and30minAllowed, // PumpTempBasalType.Percent,
0.01d, 0.01d, DoseStepSize.ComboBasal, PumpCapability.ComboCapabilities), // 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, // AccuChekSpirit("Accu-Chek Spirit", 0.1d, null, //
new DoseSettings(0.1d, 15, 12 * 60, 0.1d), // new DoseSettings(0.1d, 15, 12 * 60, 0.1d), //
PumpTempBasalType.Percent, new DoseSettings(10, 15, 12 * 60, 0d, 500d), PumpCapability.BasalRate_Duration15and30minAllowed, // PumpTempBasalType.Percent,
0.01d, 0.1d, null, PumpCapability.VirtualPumpCapabilities), // 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, // AccuChekInsight("Accu-Chek Insight", 0.05d, DoseStepSize.InsightBolus, //
new DoseSettings(0.05d, 15, 24 * 60, 0.05d), // new DoseSettings(0.05d, 15, 24 * 60, 0.05d), //
PumpTempBasalType.Percent, new DoseSettings(10, 15, 24 * 60, 0d, 250d), PumpCapability.BasalRate_Duration15and30minAllowed, // PumpTempBasalType.Percent,
0.02d, 0.01d, null, PumpCapability.InsightCapabilities), // 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, // AccuChekInsightBluetooth("Accu-Chek Insight", 0.01d, null, //
new DoseSettings(0.01d, 15, 24 * 60, 0.05d), // new DoseSettings(0.01d, 15, 24 * 60, 0.05d), //
PumpTempBasalType.Percent, new DoseSettings(10, 15, 24 * 60, 0d, 250d), PumpCapability.BasalRate_Duration15and30minAllowed, // PumpTempBasalType.Percent,
0.02d, 0.01d, DoseStepSize.InsightBolus, PumpCapability.InsightCapabilities), // new DoseSettings(10, 15, 24 * 60, 0d, 250d), PumpCapability.BasalRate_Duration15and30minAllowed, //
0.02d, 0.01d, DoseStepSize.InsightBolus, PumpCapability.InsightCapabilities), //
// Animas // Animas
AnimasVibe("Animas Vibe", 0.05d, null, // AnimasBolus? AnimasVibe("Animas Vibe", 0.05d, null, // AnimasBolus?
new DoseSettings(0.05d, 30, 12 * 60, 0.05d), // new DoseSettings(0.05d, 30, 12 * 60, 0.05d), //
PumpTempBasalType.Percent, // PumpTempBasalType.Percent, //
new DoseSettings(10, 30, 24 * 60, 0d, 300d), PumpCapability.BasalRate_Duration30minAllowed, // new DoseSettings(10, 30, 24 * 60, 0d, 300d), PumpCapability.BasalRate_Duration30minAllowed, //
0.025d, 5d, 0d, null, PumpCapability.VirtualPumpCapabilities), // 0.025d, 5d, 0d, null, PumpCapability.VirtualPumpCapabilities), //
AnimasPing("Animas Ping", AnimasVibe), AnimasPing("Animas Ping", AnimasVibe),
// Dana // Dana
DanaR("DanaR", 0.05d, null, // DanaR("DanaR", 0.05d, null, //
new DoseSettings(0.05d, 30, 8 * 60, 0.05d), // new DoseSettings(0.05d, 30, 8 * 60, 0.05d), //
PumpTempBasalType.Percent, // PumpTempBasalType.Percent, //
new DoseSettings(10d, 60, 24 * 60, 0d, 200d), PumpCapability.BasalRate_Duration15and30minNotAllowed, // new DoseSettings(10d, 60, 24 * 60, 0d, 200d), PumpCapability.BasalRate_Duration15and30minNotAllowed, //
0.04d, 0.01d, null, PumpCapability.DanaCapabilities), 0.04d, 0.01d, null, PumpCapability.DanaCapabilities),
DanaRKorean("DanaR Korean", 0.05d, null, // DanaRKorean("DanaR Korean", 0.05d, null, //
new DoseSettings(0.05d, 30, 8 * 60, 0.05d), // new DoseSettings(0.05d, 30, 8 * 60, 0.05d), //
PumpTempBasalType.Percent, // PumpTempBasalType.Percent, //
new DoseSettings(10d, 60, 24 * 60, 0d, 200d), PumpCapability.BasalRate_Duration15and30minNotAllowed, // new DoseSettings(10d, 60, 24 * 60, 0d, 200d), PumpCapability.BasalRate_Duration15and30minNotAllowed, //
0.1d, 0.01d, null, PumpCapability.DanaCapabilities), 0.1d, 0.01d, null, PumpCapability.DanaCapabilities),
DanaRS("DanaRS", 0.05d, null, // DanaRS("DanaRS", 0.05d, null, //
new DoseSettings(0.05d, 30, 8 * 60, 0.05d), // new DoseSettings(0.05d, 30, 8 * 60, 0.05d), //
PumpTempBasalType.Percent, // PumpTempBasalType.Percent, //
new DoseSettings(10d, 60, 24 * 60, 0d, 200d), PumpCapability.BasalRate_Duration15and30minAllowed, // new DoseSettings(10d, 60, 24 * 60, 0d, 200d), PumpCapability.BasalRate_Duration15and30minAllowed, //
0.04d, 0.01d, null, PumpCapability.DanaWithHistoryCapabilities), 0.04d, 0.01d, null, PumpCapability.DanaWithHistoryCapabilities),
DanaRv2("DanaRv2", DanaRS), DanaRv2("DanaRv2", DanaRS),
// Insulet // Insulet
Insulet_Omnipod("Insulet Omnipod", 0.05d, null, // Insulet_Omnipod("Insulet Omnipod", 0.05d, null, //
new DoseSettings(0.05d, 30, 8 * 60, 0.05d), // new DoseSettings(0.05d, 30, 8 * 60, 0.05d), //
PumpTempBasalType.Absolute, // PumpTempBasalType.Absolute, //
new DoseSettings(0.05d, 30, 12 * 60, 0d, 30.0d), PumpCapability.BasalRate_Duration30minAllowed, // cannot exceed max new DoseSettings(0.05d, 30, 12 * 60, 0d, 30.0d), PumpCapability.BasalRate_Duration30minAllowed, // cannot exceed max basal rate 30u/hr
// basal rate 30u/hr 0.05d, 0.05d, null, PumpCapability.VirtualPumpCapabilities),
0.05d, 0.05d, null, PumpCapability.VirtualPumpCapabilities),
// Medtronic // Medtronic
Medtronic_512_712("Medtronic 512/712", 0.05d, null, // Medtronic_512_712("Medtronic 512/712", 0.05d, null, //
new DoseSettings(0.05d, 30, 8 * 60, 0.05d), // new DoseSettings(0.05d, 30, 8 * 60, 0.05d), //
PumpTempBasalType.Absolute, // PumpTempBasalType.Absolute, //
new DoseSettings(0.05d, 30, 24 * 60, 0d, 35d), PumpCapability.BasalRate_Duration30minAllowed, // new DoseSettings(0.05d, 30, 24 * 60, 0d, 35d), PumpCapability.BasalRate_Duration30minAllowed, //
0.05d, 0.05d, null, PumpCapability.MedtronicCapabilities), // TODO 0.05d, 0.05d, null, PumpCapability.MedtronicCapabilities), // TODO
Medtronic_515_715("Medtronic 515/715", Medtronic_512_712), Medtronic_515_715("Medtronic 515/715", Medtronic_512_712),
Medtronic_522_722("Medtronic 522/722", Medtronic_512_712), Medtronic_522_722("Medtronic 522/722", Medtronic_512_712),
Medtronic_523_723_Revel("Medtronic 523/723 (Revel)", 0.05d, null, // Medtronic_523_723_Revel("Medtronic 523/723 (Revel)", 0.05d, null, //
new DoseSettings(0.05d, 30, 8 * 60, 0.05d), // new DoseSettings(0.05d, 30, 8 * 60, 0.05d), //
PumpTempBasalType.Absolute, // PumpTempBasalType.Absolute, //
new DoseSettings(0.05d, 30, 24 * 60, 0d, 35d), PumpCapability.BasalRate_Duration30minAllowed, // new DoseSettings(0.05d, 30, 24 * 60, 0d, 35d), PumpCapability.BasalRate_Duration30minAllowed, //
0.025d, 0.025d, DoseStepSize.MedtronicVeoBasal, PumpCapability.MedtronicCapabilities), // 0.025d, 0.025d, DoseStepSize.MedtronicVeoBasal, PumpCapability.MedtronicCapabilities), //
Medtronic_554_754_Veo("Medtronic 554/754 (Veo)", Medtronic_523_723_Revel), // TODO Medtronic_554_754_Veo("Medtronic 554/754 (Veo)", Medtronic_523_723_Revel), // TODO
Medtronic_640G("Medtronic 640G", 0.025d, null, // Medtronic_640G("Medtronic 640G", 0.025d, null, //
new DoseSettings(0.05d, 30, 8 * 60, 0.05d), // new DoseSettings(0.05d, 30, 8 * 60, 0.05d), //
PumpTempBasalType.Absolute, // PumpTempBasalType.Absolute, //
new DoseSettings(0.05d, 30, 24 * 60, 0d, 35d), PumpCapability.BasalRate_Duration30minAllowed, // new DoseSettings(0.05d, 30, 24 * 60, 0d, 35d), PumpCapability.BasalRate_Duration30minAllowed, //
0.025d, 0.025d, DoseStepSize.MedtronicVeoBasal, PumpCapability.VirtualPumpCapabilities), // 0.025d, 0.025d, DoseStepSize.MedtronicVeoBasal, PumpCapability.VirtualPumpCapabilities), //
// Tandem // Tandem
TandemTSlim("Tandem t:slim", 0.01d, null, // 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, // new DoseSettings(0.01d, 15, 8 * 60, 0.4d),
0.1d, 0.001d, null, PumpCapability.VirtualPumpCapabilities), 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), // TandemTFlex("Tandem t:flex", TandemTSlim), //
TandemTSlimG4("Tandem t:slim G4", TandemTSlim), // TandemTSlimG4("Tandem t:slim G4", TandemTSlim), //
@ -148,37 +157,30 @@ public enum PumpType {
PumpType(String description, PumpType parent) { PumpType(String description, PumpType parent) {
this.description = description; this.description = description;
this.parent = parent; this.parent = parent;
} }
PumpType(String description, PumpType parent, PumpCapability pumpCapability) { PumpType(String description, PumpType parent, PumpCapability pumpCapability) {
this.description = description; this.description = description;
this.parent = parent; this.parent = parent;
this.pumpCapability = pumpCapability; 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, this(description, bolusSize, specialBolusSize, extendedBolusSettings, pumpTempBasalType, tbrSettings, specialBasalDurations, baseBasalMinValue, null, baseBasalStep, baseBasalSpecialSteps, pumpCapability);
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);
} }
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.description = description;
this.bolusSize = bolusSize; this.bolusSize = bolusSize;
this.specialBolusSize = specialBolusSize; this.specialBolusSize = specialBolusSize;
@ -195,10 +197,10 @@ public enum PumpType {
public String getDescription() { public String getDescription() {
return description; return description;
} }
public PumpCapability getPumpCapability() { public PumpCapability getPumpCapability() {
if (isParentSet()) if (isParentSet())
@ -207,63 +209,74 @@ public enum PumpType {
return this.pumpCapability; return this.pumpCapability;
} }
public double getBolusSize() { public double getBolusSize() {
return isParentSet() ? parent.bolusSize : bolusSize; return isParentSet() ? parent.bolusSize : bolusSize;
} }
public DoseStepSize getSpecialBolusSize() { public DoseStepSize getSpecialBolusSize() {
return isParentSet() ? parent.specialBolusSize : specialBolusSize; return isParentSet() ? parent.specialBolusSize : specialBolusSize;
} }
public DoseSettings getExtendedBolusSettings() { public DoseSettings getExtendedBolusSettings() {
return isParentSet() ? parent.extendedBolusSettings : extendedBolusSettings; return isParentSet() ? parent.extendedBolusSettings : extendedBolusSettings;
} }
public PumpTempBasalType getPumpTempBasalType() { public PumpTempBasalType getPumpTempBasalType() {
return isParentSet() ? parent.pumpTempBasalType : pumpTempBasalType; return isParentSet() ? parent.pumpTempBasalType : pumpTempBasalType;
} }
public DoseSettings getTbrSettings() { public DoseSettings getTbrSettings() {
return isParentSet() ? parent.tbrSettings : tbrSettings; return isParentSet() ? parent.tbrSettings : tbrSettings;
} }
public double getBaseBasalMinValue() { public double getBaseBasalMinValue() {
return isParentSet() ? parent.baseBasalMinValue : baseBasalMinValue; return isParentSet() ? parent.baseBasalMinValue : baseBasalMinValue;
} }
public Double getBaseBasalMaxValue() { public Double getBaseBasalMaxValue() {
return isParentSet() ? parent.baseBasalMaxValue : baseBasalMaxValue; return isParentSet() ? parent.baseBasalMaxValue : baseBasalMaxValue;
} }
public double getBaseBasalStep() { public double getBaseBasalStep() {
return isParentSet() ? parent.baseBasalStep : baseBasalStep; return isParentSet() ? parent.baseBasalStep : baseBasalStep;
} }
public DoseStepSize getBaseBasalSpecialSteps() { public DoseStepSize getBaseBasalSpecialSteps() {
return isParentSet() ? parent.baseBasalSpecialSteps : baseBasalSpecialSteps; return isParentSet() ? parent.baseBasalSpecialSteps : baseBasalSpecialSteps;
} }
public PumpType getParent() { public PumpType getParent() {
return parent; return parent;
} }
private boolean isParentSet() { private boolean isParentSet() {
return this.parent != null; return this.parent != null;
} }
public static PumpType getByDescription(String desc) { public static PumpType getByDescription(String desc) {
if (mapByDescription.containsKey(desc)) { if (mapByDescription.containsKey(desc)) {
return mapByDescription.get(desc); return mapByDescription.get(desc);
} else { } else {
@ -281,18 +294,17 @@ public enum PumpType {
String extendedNote = hasExtendedBasals ? MainApp.gs(R.string.virtualpump_pump_def_extended_note) : ""; String extendedNote = hasExtendedBasals ? MainApp.gs(R.string.virtualpump_pump_def_extended_note) : "";
return String.format( return String.format(i18nTemplate, //
i18nTemplate, // getStep("" + getBolusSize(), getSpecialBolusSize()), //
getStep("" + getBolusSize(), getSpecialBolusSize()), // eb.getStep(), eb.getDurationStep(), eb.getMaxDuration() / 60, //
eb.getStep(), eb.getDurationStep(), getStep(getBaseBasalRange(), getBaseBasalSpecialSteps()), //
eb.getMaxDuration() / 60, // tbr.getMinDose() + unit + "-" + tbr.getMaxDose() + unit, tbr.getStep() + unit,
getStep(getBaseBasalRange(), getBaseBasalSpecialSteps()), // tbr.getDurationStep(), tbr.getMaxDuration() / 60, extendedNote);
tbr.getMinDose() + unit + "-" + tbr.getMaxDose() + unit, tbr.getStep() + unit, tbr.getDurationStep(),
tbr.getMaxDuration() / 60, extendedNote);
} }
private String getBaseBasalRange() { private String getBaseBasalRange() {
Double maxValue = getBaseBasalMaxValue(); Double maxValue = getBaseBasalMaxValue();
return maxValue == null ? "" + getBaseBasalMinValue() : getBaseBasalMinValue() + "-" + maxValue; return maxValue == null ? "" + getBaseBasalMinValue() : getBaseBasalMinValue() + "-" + maxValue;
@ -300,6 +312,7 @@ public enum PumpType {
private String getStep(String step, DoseStepSize stepSize) { private String getStep(String step, DoseStepSize stepSize) {
if (stepSize != null) if (stepSize != null)
return step + " [" + stepSize.getDescription() + "] *"; return step + " [" + stepSize.getDescription() + "] *";
else else
@ -308,6 +321,7 @@ public enum PumpType {
public boolean hasExtendedBasals() { public boolean hasExtendedBasals() {
return ((getBaseBasalSpecialSteps() != null) || (getSpecialBolusSize() != null)); return ((getBaseBasalSpecialSteps() != null) || (getSpecialBolusSize() != null));
} }
@ -318,13 +332,12 @@ public enum PumpType {
return parent.getSpecialBasalDurations(); return parent.getSpecialBasalDurations();
} else { } else {
return specialBasalDurations == null ? // return specialBasalDurations == null ? //
PumpCapability.BasalRate_Duration15and30minNotAllowed PumpCapability.BasalRate_Duration15and30minNotAllowed : specialBasalDurations;
: specialBasalDurations;
} }
} }
public double determineCorrectBolusSize(double bolusAmount) { public double determineCorrectBolusSize(double bolusAmount) {
if (bolusAmount == 0.0d) { if (bolusAmount == 0.0d) {
return bolusAmount; return bolusAmount;
} }
@ -336,7 +349,7 @@ public enum PumpType {
} else { } else {
DoseStepSize specialBolusSize = getSpecialBolusSize(); DoseStepSize specialBolusSize = getSpecialBolusSize();
bolusStepSize = specialBolusSize.getStepSizeForAmount((double)bolusAmount); bolusStepSize = specialBolusSize.getStepSizeForAmount((double) bolusAmount);
} }
return Math.round(bolusAmount / bolusStepSize) * bolusStepSize; return Math.round(bolusAmount / bolusStepSize) * bolusStepSize;
@ -344,6 +357,7 @@ public enum PumpType {
public double determineCorrectExtendedBolusSize(double bolusAmount) { public double determineCorrectExtendedBolusSize(double bolusAmount) {
if (bolusAmount == 0.0d) { if (bolusAmount == 0.0d) {
return bolusAmount; return bolusAmount;
} }
@ -367,6 +381,7 @@ public enum PumpType {
public double determineCorrectBasalSize(double basalAmount) { public double determineCorrectBasalSize(double basalAmount) {
if (basalAmount == 0.0d) { if (basalAmount == 0.0d) {
return basalAmount; return basalAmount;
} }
@ -378,7 +393,7 @@ public enum PumpType {
} else { } else {
DoseStepSize specialBolusSize = getBaseBasalSpecialSteps(); DoseStepSize specialBolusSize = getBaseBasalSpecialSteps();
basalStepSize = specialBolusSize.getStepSizeForAmount((double)basalAmount); basalStepSize = specialBolusSize.getStepSizeForAmount((double) basalAmount);
} }
if (basalAmount > getTbrSettings().getMaxDose()) if (basalAmount > getTbrSettings().getMaxDose())

View file

@ -44,6 +44,7 @@ public class FabricUtil {
} }
} }
// FIXME andy!!!
// FabricPrivacy.getInstance().logCustom(customEvent); // FabricPrivacy.getInstance().logCustom(customEvent);
} }

View file

@ -631,9 +631,9 @@ public class MedtronicPumpHistoryDecoder extends MedtronicHistoryDecoder<PumpHis
if (MedtronicDeviceType.isSameDevice(MedtronicUtil.getMedtronicPumpModel(), if (MedtronicDeviceType.isSameDevice(MedtronicUtil.getMedtronicPumpModel(),
MedtronicDeviceType.Medtronic_523andHigher)) { MedtronicDeviceType.Medtronic_523andHigher)) {
bolus.setRequestedAmount(bitUtils.toInt(data[0], data[1]) / 40.0f); bolus.setRequestedAmount(ByteUtil.toInt(data[0], data[1]) / 40.0f);
bolus.setDeliveredAmount(bitUtils.toInt(data[2], data[3]) / 40.0f); bolus.setDeliveredAmount(ByteUtil.toInt(data[2], data[3]) / 40.0f);
bolus.setInsulinOnBoard(bitUtils.toInt(data[4], data[5]) / 40.0f); bolus.setInsulinOnBoard(ByteUtil.toInt(data[4], data[5]) / 40.0f);
bolus.setDuration(data[6] * 30); bolus.setDuration(data[6] * 30);
} else { } else {
bolus.setRequestedAmount(ByteUtil.asUINT8(data[0]) / 10.0f); bolus.setRequestedAmount(ByteUtil.asUINT8(data[0]) / 10.0f);

View file

@ -124,6 +124,11 @@ public class PumpHistoryEntry extends MedtronicHistoryEntry {
// } // }
public boolean isAfter(long atechDateTime) { public boolean isAfter(long atechDateTime) {
if (this.atechDateTime == null) {
LOG.error("Date is null. Show object: " + toString());
return false; // FIXME shouldn't happen
}
return atechDateTime < this.atechDateTime; return atechDateTime < this.atechDateTime;
} }

View file

@ -283,7 +283,7 @@ public class MedtronicHistoryData {
if (!forHistory) { if (!forHistory) {
newAndAll2 = filterPumpSuspend(newAndAll2, 10); // just last 10 (of relevant), for history we already newAndAll2 = filterPumpSuspend(newAndAll2, 10); // just last 10 (of relevant), for history we already
// filtered // filtered
} }
return newAndAll2; return newAndAll2;
@ -450,10 +450,11 @@ public class MedtronicHistoryData {
} }
} }
if (selectedBolus != null) if (selectedBolus != null) {
boluses.remove(selectedBolus); boluses.remove(selectedBolus);
removeTreatmentsFromHistory.add(treatment); removeTreatmentsFromHistory.add(treatment);
}
} }
} }
@ -607,11 +608,7 @@ public class MedtronicHistoryData {
case Normal: { case Normal: {
// DetailedBolusInfo normalBolus = new DetailedBolusInfo(); // DetailedBolusInfo normalBolus = new DetailedBolusInfo();
DetailedBolusInfo detailedBolusInfo = DetailedBolusInfoStorage DetailedBolusInfo detailedBolusInfo = new DetailedBolusInfo();
.findDetailedBolusInfo(tryToGetByLocalTime(bolus.atechDateTime));
if (detailedBolusInfo == null) {
detailedBolusInfo = new DetailedBolusInfo();
}
detailedBolusInfo.date = tryToGetByLocalTime(bolus.atechDateTime); detailedBolusInfo.date = tryToGetByLocalTime(bolus.atechDateTime);
detailedBolusInfo.source = Source.PUMP; detailedBolusInfo.source = Source.PUMP;
@ -775,20 +772,22 @@ public class MedtronicHistoryData {
LocalDateTime ldt = DateTimeUtil.toLocalDateTime(atechDateTime); LocalDateTime ldt = DateTimeUtil.toLocalDateTime(atechDateTime);
LOG.debug("TOE. Time of Entry: " + atechDateTime); // LOG.debug("TOE. Time of Entry: " + atechDateTime);
LOG.debug("TOE. Clock Pump: " + pumpTime.pumpTime.toString("HH:mm:ss")); // LOG.debug("TOE. Clock Pump: " + pumpTime.pumpTime.toString("HH:mm:ss"));
LOG.debug("TOE. LocalTime: " + pumpTime.localDeviceTime.toString("HH:mm:ss")); // LOG.debug("TOE. LocalTime: " + pumpTime.localDeviceTime.toString("HH:mm:ss"));
LOG.debug("TOE. Difference(s): " + pumpTime.timeDifference); // LOG.debug("TOE. Difference(s): " + pumpTime.timeDifference);
ldt = ldt.plusSeconds(pumpTime.timeDifference); ldt = ldt.plusSeconds(pumpTime.timeDifference);
ldt = ldt.millisOfSecond().setCopy(000);
LOG.debug("TOE. New Time Of Entry: " + ldt.toString("HH:mm:ss")); // LOG.debug("TOE. New Time Of Entry: " + ldt.toString("HH:mm:ss"));
ldt.millisOfSecond().setCopy(000); LOG.debug("tryToGetByLocalTime: [TimeOfEntry={}, ClockPump={}, LocalTime={}, DifferenceSec={}, "
+ "NewTimeOfEntry={}, time={}", atechDateTime, pumpTime.pumpTime.toString("HH:mm:ss"),
pumpTime.localDeviceTime.toString("HH:mm:ss"), pumpTime.timeDifference, ldt.toString("HH:mm:ss"), ldt
.toDate().getTime());
return ldt.toDate().getTime(); return ldt.toDate().getTime();
// return 0;
} }
@ -803,19 +802,25 @@ public class MedtronicHistoryData {
} }
} }
LocalDateTime d = DateTimeUtil.toLocalDateTime(dt); // LOG.debug("Oldest entry: {}, pumpTimeDifference={}", dt, this.pumpTime.timeDifference);
d.minusMinutes(5);
LocalDateTime oldestEntryTime = DateTimeUtil.toLocalDateTime(dt);
oldestEntryTime = oldestEntryTime.minusMinutes(5);
if (this.pumpTime.timeDifference < 0) { if (this.pumpTime.timeDifference < 0) {
d.plusSeconds(this.pumpTime.timeDifference); oldestEntryTime = oldestEntryTime.plusSeconds(this.pumpTime.timeDifference);
} }
// } else { // } else {
// d.minusSeconds(this.pumpTime.timeDifference); // d.minusSeconds(this.pumpTime.timeDifference);
// } // }
Minutes minutes = Minutes.minutesBetween(d, new LocalDateTime()); LocalDateTime now = new LocalDateTime();
// returns oldest time in history, with calculated time difference between pump and phone, minus 2 minutes Minutes minutes = Minutes.minutesBetween(oldestEntryTime, now);
// returns oldest time in history, with calculated time difference between pump and phone, minus 5 minutes
LOG.debug("Oldest entry: {}, pumpTimeDifference={}, newDt={}, currentTime={}, differenceMin={}", dt,
this.pumpTime.timeDifference, oldestEntryTime, now, minutes.getMinutes());
return minutes.getMinutes(); return minutes.getMinutes();

View file

@ -168,7 +168,6 @@ public class Treatment implements DataPointWithLabelInterface {
mealBolus = t.mealBolus; mealBolus = t.mealBolus;
pumpId = t.pumpId; pumpId = t.pumpId;
isSMB = t.isSMB; isSMB = t.isSMB;
source = t.source;
} }