remove static ConfigBuilderPlugin.activePump
This commit is contained in:
parent
0504619b39
commit
bc19973ce0
66 changed files with 136 additions and 138 deletions
|
@ -196,7 +196,7 @@ public class MainApp extends Application {
|
||||||
|
|
||||||
NSUpload.uploadAppStart();
|
NSUpload.uploadAppStart();
|
||||||
|
|
||||||
final PumpInterface pump = ConfigBuilderPlugin.getActivePump();
|
final PumpInterface pump = ConfigBuilderPlugin.getPlugin().getActivePump();
|
||||||
if (pump != null) {
|
if (pump != null) {
|
||||||
new Thread(() -> {
|
new Thread(() -> {
|
||||||
SystemClock.sleep(5000);
|
SystemClock.sleep(5000);
|
||||||
|
|
|
@ -229,7 +229,7 @@ public class HistoryBrowseActivity extends AppCompatActivity {
|
||||||
if (noProfile == null || buttonDate == null || buttonZoom == null || bgGraph == null || iobGraph == null || seekBar == null)
|
if (noProfile == null || buttonDate == null || buttonZoom == null || bgGraph == null || iobGraph == null || seekBar == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
final PumpInterface pump = ConfigBuilderPlugin.getActivePump();
|
final PumpInterface pump = ConfigBuilderPlugin.getPlugin().getActivePump();
|
||||||
final Profile profile = ProfileFunctions.getInstance().getProfile();
|
final Profile profile = ProfileFunctions.getInstance().getProfile();
|
||||||
|
|
||||||
if (profile == null) {
|
if (profile == null) {
|
||||||
|
|
|
@ -130,7 +130,7 @@ public class TDDStatsActivity extends Activity {
|
||||||
}
|
}
|
||||||
totalBaseBasal.setText(TBB);
|
totalBaseBasal.setText(TBB);
|
||||||
|
|
||||||
if (!ConfigBuilderPlugin.getActivePump().getPumpDescription().needsManualTDDLoad)
|
if (!ConfigBuilderPlugin.getPlugin().getActivePump().getPumpDescription().needsManualTDDLoad)
|
||||||
reloadButton.setVisibility(View.GONE);
|
reloadButton.setVisibility(View.GONE);
|
||||||
|
|
||||||
// stats table
|
// stats table
|
||||||
|
@ -440,7 +440,7 @@ public class TDDStatsActivity extends Activity {
|
||||||
TableLayout.LayoutParams.WRAP_CONTENT));
|
TableLayout.LayoutParams.WRAP_CONTENT));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isOldData(historyList) && ConfigBuilderPlugin.getActivePump().getPumpDescription().needsManualTDDLoad) {
|
if (isOldData(historyList) && ConfigBuilderPlugin.getPlugin().getActivePump().getPumpDescription().needsManualTDDLoad) {
|
||||||
statsMessage.setVisibility(View.VISIBLE);
|
statsMessage.setVisibility(View.VISIBLE);
|
||||||
statsMessage.setText(MainApp.gs(R.string.danar_stats_olddata_Message));
|
statsMessage.setText(MainApp.gs(R.string.danar_stats_olddata_Message));
|
||||||
|
|
||||||
|
@ -545,7 +545,7 @@ public class TDDStatsActivity extends Activity {
|
||||||
|
|
||||||
|
|
||||||
public static boolean isOldData(List<TDD> historyList) {
|
public static boolean isOldData(List<TDD> historyList) {
|
||||||
Object activePump = MainApp.getConfigBuilder().getActivePump();
|
Object activePump = ConfigBuilderPlugin.getPlugin().getActivePump();
|
||||||
PumpInterface dana = MainApp.getSpecificPlugin(DanaRPlugin.class);
|
PumpInterface dana = MainApp.getSpecificPlugin(DanaRPlugin.class);
|
||||||
PumpInterface danaRS = MainApp.getSpecificPlugin(DanaRSPlugin.class);
|
PumpInterface danaRS = MainApp.getSpecificPlugin(DanaRSPlugin.class);
|
||||||
PumpInterface danaV2 = MainApp.getSpecificPlugin(DanaRv2Plugin.class);
|
PumpInterface danaV2 = MainApp.getSpecificPlugin(DanaRv2Plugin.class);
|
||||||
|
|
|
@ -12,12 +12,12 @@ import java.text.DecimalFormat;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.TimeZone;
|
import java.util.TimeZone;
|
||||||
|
|
||||||
import info.nightscout.androidaps.Config;
|
|
||||||
import info.nightscout.androidaps.Constants;
|
import info.nightscout.androidaps.Constants;
|
||||||
import info.nightscout.androidaps.MainApp;
|
import info.nightscout.androidaps.MainApp;
|
||||||
import info.nightscout.androidaps.R;
|
import info.nightscout.androidaps.R;
|
||||||
import info.nightscout.androidaps.interfaces.PumpDescription;
|
import info.nightscout.androidaps.interfaces.PumpDescription;
|
||||||
import info.nightscout.androidaps.interfaces.PumpInterface;
|
import info.nightscout.androidaps.interfaces.PumpInterface;
|
||||||
|
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
|
||||||
import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification;
|
import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification;
|
||||||
import info.nightscout.androidaps.plugins.Overview.notifications.Notification;
|
import info.nightscout.androidaps.plugins.Overview.notifications.Notification;
|
||||||
import info.nightscout.utils.DateUtil;
|
import info.nightscout.utils.DateUtil;
|
||||||
|
@ -221,7 +221,7 @@ public class Profile {
|
||||||
|
|
||||||
if (isValid) {
|
if (isValid) {
|
||||||
// Check for hours alignment
|
// Check for hours alignment
|
||||||
PumpInterface pump = MainApp.getConfigBuilder().getActivePump();
|
PumpInterface pump = ConfigBuilderPlugin.getPlugin().getActivePump();
|
||||||
if (pump != null && !pump.getPumpDescription().is30minBasalRatesCapable) {
|
if (pump != null && !pump.getPumpDescription().is30minBasalRatesCapable) {
|
||||||
for (int index = 0; index < basal_v.size(); index++) {
|
for (int index = 0; index < basal_v.size(); index++) {
|
||||||
long secondsFromMidnight = basal_v.keyAt(index);
|
long secondsFromMidnight = basal_v.keyAt(index);
|
||||||
|
|
|
@ -142,7 +142,7 @@ public class ActionsFragment extends SubscriberFragment implements View.OnClickL
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final PumpInterface pump = ConfigBuilderPlugin.getActivePump();
|
final PumpInterface pump = ConfigBuilderPlugin.getPlugin().getActivePump();
|
||||||
final boolean basalprofileEnabled = MainApp.isEngineeringModeOrRelease()
|
final boolean basalprofileEnabled = MainApp.isEngineeringModeOrRelease()
|
||||||
&& pump.getPumpDescription().isSetBasalProfileCapable;
|
&& pump.getPumpDescription().isSetBasalProfileCapable;
|
||||||
|
|
||||||
|
@ -192,7 +192,7 @@ public class ActionsFragment extends SubscriberFragment implements View.OnClickL
|
||||||
else
|
else
|
||||||
tempTarget.setVisibility(View.VISIBLE);
|
tempTarget.setVisibility(View.VISIBLE);
|
||||||
|
|
||||||
if (!ConfigBuilderPlugin.getActivePump().getPumpDescription().supportsTDDs) tddStats.setVisibility(View.GONE);
|
if (!ConfigBuilderPlugin.getPlugin().getActivePump().getPumpDescription().supportsTDDs) tddStats.setVisibility(View.GONE);
|
||||||
else tddStats.setVisibility(View.VISIBLE);
|
else tddStats.setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -103,7 +103,7 @@ public class FillDialog extends DialogFragment implements OnClickListener {
|
||||||
insulinCartridgeChangeCheckbox = view.findViewById(R.id.fill_cartridge_change);
|
insulinCartridgeChangeCheckbox = view.findViewById(R.id.fill_cartridge_change);
|
||||||
|
|
||||||
Double maxInsulin = MainApp.getConstraintChecker().getMaxBolusAllowed().value();
|
Double maxInsulin = MainApp.getConstraintChecker().getMaxBolusAllowed().value();
|
||||||
double bolusstep = ConfigBuilderPlugin.getActivePump().getPumpDescription().bolusStep;
|
double bolusstep = ConfigBuilderPlugin.getPlugin().getActivePump().getPumpDescription().bolusStep;
|
||||||
editInsulin = view.findViewById(R.id.fill_insulinamount);
|
editInsulin = view.findViewById(R.id.fill_insulinamount);
|
||||||
editInsulin.setParams(0d, 0d, maxInsulin, bolusstep, DecimalFormatter.pumpSupportedBolusFormat(), false, textWatcher);
|
editInsulin.setParams(0d, 0d, maxInsulin, bolusstep, DecimalFormatter.pumpSupportedBolusFormat(), false, textWatcher);
|
||||||
|
|
||||||
|
|
|
@ -48,8 +48,8 @@ public class NewExtendedBolusDialog extends DialogFragment implements View.OnCli
|
||||||
editInsulin = (NumberPicker) view.findViewById(R.id.overview_newextendedbolus_insulin);
|
editInsulin = (NumberPicker) view.findViewById(R.id.overview_newextendedbolus_insulin);
|
||||||
editInsulin.setParams(0d, 0d, maxInsulin, 0.1d, new DecimalFormat("0.00"), false);
|
editInsulin.setParams(0d, 0d, maxInsulin, 0.1d, new DecimalFormat("0.00"), false);
|
||||||
|
|
||||||
double extendedDurationStep = ConfigBuilderPlugin.getActivePump().getPumpDescription().extendedBolusDurationStep;
|
double extendedDurationStep = ConfigBuilderPlugin.getPlugin().getActivePump().getPumpDescription().extendedBolusDurationStep;
|
||||||
double extendedMaxDuration = ConfigBuilderPlugin.getActivePump().getPumpDescription().extendedBolusMaxDuration;
|
double extendedMaxDuration = ConfigBuilderPlugin.getPlugin().getActivePump().getPumpDescription().extendedBolusMaxDuration;
|
||||||
editDuration = (NumberPicker) view.findViewById(R.id.overview_newextendedbolus_duration);
|
editDuration = (NumberPicker) view.findViewById(R.id.overview_newextendedbolus_duration);
|
||||||
editDuration.setParams(extendedDurationStep, extendedDurationStep, extendedMaxDuration, extendedDurationStep, new DecimalFormat("0"), false);
|
editDuration.setParams(extendedDurationStep, extendedDurationStep, extendedMaxDuration, extendedDurationStep, new DecimalFormat("0"), false);
|
||||||
|
|
||||||
|
|
|
@ -64,7 +64,7 @@ public class NewTempBasalDialog extends DialogFragment implements View.OnClickLi
|
||||||
absoluteRadio = (RadioButton) view.findViewById(R.id.overview_newtempbasal_absolute_radio);
|
absoluteRadio = (RadioButton) view.findViewById(R.id.overview_newtempbasal_absolute_radio);
|
||||||
typeSelectorLayout = (LinearLayout) view.findViewById(R.id.overview_newtempbasal_typeselector_layout);
|
typeSelectorLayout = (LinearLayout) view.findViewById(R.id.overview_newtempbasal_typeselector_layout);
|
||||||
|
|
||||||
PumpDescription pumpDescription = ConfigBuilderPlugin.getActivePump().getPumpDescription();
|
PumpDescription pumpDescription = ConfigBuilderPlugin.getPlugin().getActivePump().getPumpDescription();
|
||||||
|
|
||||||
basalPercent = (NumberPicker) view.findViewById(R.id.overview_newtempbasal_basalpercentinput);
|
basalPercent = (NumberPicker) view.findViewById(R.id.overview_newtempbasal_basalpercentinput);
|
||||||
double maxTempPercent = pumpDescription.maxTempPercent;
|
double maxTempPercent = pumpDescription.maxTempPercent;
|
||||||
|
|
|
@ -19,7 +19,6 @@ import info.nightscout.androidaps.interfaces.PluginType;
|
||||||
import info.nightscout.androidaps.interfaces.ProfileInterface;
|
import info.nightscout.androidaps.interfaces.ProfileInterface;
|
||||||
import info.nightscout.androidaps.interfaces.PumpInterface;
|
import info.nightscout.androidaps.interfaces.PumpInterface;
|
||||||
import info.nightscout.androidaps.interfaces.SensitivityInterface;
|
import info.nightscout.androidaps.interfaces.SensitivityInterface;
|
||||||
import info.nightscout.androidaps.interfaces.TreatmentsInterface;
|
|
||||||
import info.nightscout.androidaps.logging.L;
|
import info.nightscout.androidaps.logging.L;
|
||||||
import info.nightscout.androidaps.plugins.Insulin.InsulinOrefRapidActingPlugin;
|
import info.nightscout.androidaps.plugins.Insulin.InsulinOrefRapidActingPlugin;
|
||||||
import info.nightscout.androidaps.plugins.PumpVirtual.VirtualPumpPlugin;
|
import info.nightscout.androidaps.plugins.PumpVirtual.VirtualPumpPlugin;
|
||||||
|
@ -42,9 +41,8 @@ public class ConfigBuilderPlugin extends PluginBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
private BgSourceInterface activeBgSource;
|
private BgSourceInterface activeBgSource;
|
||||||
private static PumpInterface activePump;
|
private PumpInterface activePump;
|
||||||
private static ProfileInterface activeProfile;
|
private static ProfileInterface activeProfile;
|
||||||
private static TreatmentsInterface activeTreatments;
|
|
||||||
private static APSInterface activeAPS;
|
private static APSInterface activeAPS;
|
||||||
private static InsulinInterface activeInsulin;
|
private static InsulinInterface activeInsulin;
|
||||||
private static SensitivityInterface activeSensitivity;
|
private static SensitivityInterface activeSensitivity;
|
||||||
|
@ -250,7 +248,7 @@ public class ConfigBuilderPlugin extends PluginBase {
|
||||||
return activeAPS;
|
return activeAPS;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static PumpInterface getActivePump() {
|
public PumpInterface getActivePump() {
|
||||||
return activePump;
|
return activePump;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -322,7 +320,6 @@ public class ConfigBuilderPlugin extends PluginBase {
|
||||||
this.setFragmentVisiblities(((PluginBase) activePump).getName(), pluginsInCategory, PluginType.PUMP);
|
this.setFragmentVisiblities(((PluginBase) activePump).getName(), pluginsInCategory, PluginType.PUMP);
|
||||||
|
|
||||||
// PluginType.TREATMENT
|
// PluginType.TREATMENT
|
||||||
activeTreatments = this.determineActivePlugin(PluginType.TREATMENT);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -65,7 +65,7 @@ public class ObjectivesPlugin extends PluginBase implements ConstraintsInterface
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean specialEnableCondition() {
|
public boolean specialEnableCondition() {
|
||||||
PumpInterface pump = ConfigBuilderPlugin.getActivePump();
|
PumpInterface pump = ConfigBuilderPlugin.getPlugin().getActivePump();
|
||||||
return pump == null || pump.getPumpDescription().isTempBasalCapable;
|
return pump == null || pump.getPumpDescription().isTempBasalCapable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -52,7 +52,7 @@ public class SafetyPlugin extends PluginBase implements ConstraintsInterface {
|
||||||
**/
|
**/
|
||||||
@Override
|
@Override
|
||||||
public Constraint<Boolean> isLoopInvocationAllowed(Constraint<Boolean> value) {
|
public Constraint<Boolean> isLoopInvocationAllowed(Constraint<Boolean> value) {
|
||||||
if (!ConfigBuilderPlugin.getActivePump().getPumpDescription().isTempBasalCapable)
|
if (!ConfigBuilderPlugin.getPlugin().getActivePump().getPumpDescription().isTempBasalCapable)
|
||||||
value.set(false, MainApp.gs(R.string.pumpisnottempbasalcapable), this);
|
value.set(false, MainApp.gs(R.string.pumpisnottempbasalcapable), this);
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
@ -124,7 +124,7 @@ public class SafetyPlugin extends PluginBase implements ConstraintsInterface {
|
||||||
|
|
||||||
absoluteRate.setIfSmaller(HardLimits.maxBasal(), String.format(MainApp.gs(R.string.limitingbasalratio), HardLimits.maxBasal(), MainApp.gs(R.string.hardlimit)), this);
|
absoluteRate.setIfSmaller(HardLimits.maxBasal(), String.format(MainApp.gs(R.string.limitingbasalratio), HardLimits.maxBasal(), MainApp.gs(R.string.hardlimit)), this);
|
||||||
|
|
||||||
PumpInterface pump = MainApp.getConfigBuilder().getActivePump();
|
PumpInterface pump = ConfigBuilderPlugin.getPlugin().getActivePump();
|
||||||
// check for pump max
|
// check for pump max
|
||||||
if (pump != null && pump.getPumpDescription().tempBasalStyle == PumpDescription.ABSOLUTE) {
|
if (pump != null && pump.getPumpDescription().tempBasalStyle == PumpDescription.ABSOLUTE) {
|
||||||
double pumpLimit = pump.getPumpDescription().pumpType.getTbrSettings().getMaxDose();
|
double pumpLimit = pump.getPumpDescription().pumpType.getTbrSettings().getMaxDose();
|
||||||
|
@ -150,7 +150,7 @@ public class SafetyPlugin extends PluginBase implements ConstraintsInterface {
|
||||||
applyBasalConstraints(absoluteConstraint, profile);
|
applyBasalConstraints(absoluteConstraint, profile);
|
||||||
percentRate.copyReasons(absoluteConstraint);
|
percentRate.copyReasons(absoluteConstraint);
|
||||||
|
|
||||||
PumpInterface pump = MainApp.getConfigBuilder().getActivePump();
|
PumpInterface pump = ConfigBuilderPlugin.getPlugin().getActivePump();
|
||||||
|
|
||||||
Integer percentRateAfterConst = Double.valueOf(absoluteConstraint.value() / currentBasal * 100).intValue();
|
Integer percentRateAfterConst = Double.valueOf(absoluteConstraint.value() / currentBasal * 100).intValue();
|
||||||
if (pump != null) {
|
if (pump != null) {
|
||||||
|
@ -179,7 +179,7 @@ public class SafetyPlugin extends PluginBase implements ConstraintsInterface {
|
||||||
|
|
||||||
insulin.setIfSmaller(HardLimits.maxBolus(), String.format(MainApp.gs(R.string.limitingbolus), HardLimits.maxBolus(), MainApp.gs(R.string.hardlimit)), this);
|
insulin.setIfSmaller(HardLimits.maxBolus(), String.format(MainApp.gs(R.string.limitingbolus), HardLimits.maxBolus(), MainApp.gs(R.string.hardlimit)), this);
|
||||||
|
|
||||||
PumpInterface pump = MainApp.getConfigBuilder().getActivePump();
|
PumpInterface pump = ConfigBuilderPlugin.getPlugin().getActivePump();
|
||||||
if (pump != null) {
|
if (pump != null) {
|
||||||
double rounded = Round.roundTo(insulin.value(), pump.getPumpDescription().pumpType.determineCorrectBolusSize(insulin.value()));
|
double rounded = Round.roundTo(insulin.value(), pump.getPumpDescription().pumpType.determineCorrectBolusSize(insulin.value()));
|
||||||
insulin.setIfDifferent(rounded, MainApp.gs(R.string.pumplimit), this);
|
insulin.setIfDifferent(rounded, MainApp.gs(R.string.pumplimit), this);
|
||||||
|
@ -196,7 +196,7 @@ public class SafetyPlugin extends PluginBase implements ConstraintsInterface {
|
||||||
|
|
||||||
insulin.setIfSmaller(HardLimits.maxBolus(), String.format(MainApp.gs(R.string.limitingextendedbolus), HardLimits.maxBolus(), MainApp.gs(R.string.hardlimit)), this);
|
insulin.setIfSmaller(HardLimits.maxBolus(), String.format(MainApp.gs(R.string.limitingextendedbolus), HardLimits.maxBolus(), MainApp.gs(R.string.hardlimit)), this);
|
||||||
|
|
||||||
PumpInterface pump = MainApp.getConfigBuilder().getActivePump();
|
PumpInterface pump = ConfigBuilderPlugin.getPlugin().getActivePump();
|
||||||
if (pump != null) {
|
if (pump != null) {
|
||||||
double rounded = Round.roundTo(insulin.value(), pump.getPumpDescription().pumpType.determineCorrectExtendedBolusSize(insulin.value()));
|
double rounded = Round.roundTo(insulin.value(), pump.getPumpDescription().pumpType.determineCorrectExtendedBolusSize(insulin.value()));
|
||||||
insulin.setIfDifferent(rounded, MainApp.gs(R.string.pumplimit), this);
|
insulin.setIfDifferent(rounded, MainApp.gs(R.string.pumplimit), this);
|
||||||
|
|
|
@ -86,7 +86,7 @@ public class APSResult {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
final PumpInterface pump = ConfigBuilderPlugin.getActivePump();
|
final PumpInterface pump = ConfigBuilderPlugin.getPlugin().getActivePump();
|
||||||
if (isChangeRequested()) {
|
if (isChangeRequested()) {
|
||||||
String ret;
|
String ret;
|
||||||
// rate
|
// rate
|
||||||
|
@ -115,7 +115,7 @@ public class APSResult {
|
||||||
}
|
}
|
||||||
|
|
||||||
public Spanned toSpanned() {
|
public Spanned toSpanned() {
|
||||||
final PumpInterface pump = ConfigBuilderPlugin.getActivePump();
|
final PumpInterface pump = ConfigBuilderPlugin.getPlugin().getActivePump();
|
||||||
if (isChangeRequested()) {
|
if (isChangeRequested()) {
|
||||||
String ret;
|
String ret;
|
||||||
// rate
|
// rate
|
||||||
|
@ -304,7 +304,7 @@ public class APSResult {
|
||||||
|
|
||||||
long now = System.currentTimeMillis();
|
long now = System.currentTimeMillis();
|
||||||
TemporaryBasal activeTemp = TreatmentsPlugin.getPlugin().getTempBasalFromHistory(now);
|
TemporaryBasal activeTemp = TreatmentsPlugin.getPlugin().getTempBasalFromHistory(now);
|
||||||
PumpInterface pump = MainApp.getConfigBuilder().getActivePump();
|
PumpInterface pump = ConfigBuilderPlugin.getPlugin().getActivePump();
|
||||||
Profile profile = ProfileFunctions.getInstance().getProfile();
|
Profile profile = ProfileFunctions.getInstance().getProfile();
|
||||||
|
|
||||||
if (usePercent) {
|
if (usePercent) {
|
||||||
|
|
|
@ -140,7 +140,7 @@ public class LoopPlugin extends PluginBase {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean specialEnableCondition() {
|
public boolean specialEnableCondition() {
|
||||||
PumpInterface pump = ConfigBuilderPlugin.getActivePump();
|
PumpInterface pump = ConfigBuilderPlugin.getPlugin().getActivePump();
|
||||||
return pump == null || pump.getPumpDescription().isTempBasalCapable;
|
return pump == null || pump.getPumpDescription().isTempBasalCapable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -275,7 +275,7 @@ public class LoopPlugin extends PluginBase {
|
||||||
MainApp.bus().post(new EventLoopSetLastRunGui(message));
|
MainApp.bus().post(new EventLoopSetLastRunGui(message));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final PumpInterface pump = ConfigBuilderPlugin.getActivePump();
|
final PumpInterface pump = ConfigBuilderPlugin.getPlugin().getActivePump();
|
||||||
APSResult result = null;
|
APSResult result = null;
|
||||||
|
|
||||||
if (!isEnabled(PluginType.LOOP))
|
if (!isEnabled(PluginType.LOOP))
|
||||||
|
@ -489,7 +489,7 @@ public class LoopPlugin extends PluginBase {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
PumpInterface pump = MainApp.getConfigBuilder().getActivePump();
|
PumpInterface pump = ConfigBuilderPlugin.getPlugin().getActivePump();
|
||||||
TreatmentsInterface activeTreatments = TreatmentsPlugin.getPlugin();
|
TreatmentsInterface activeTreatments = TreatmentsPlugin.getPlugin();
|
||||||
|
|
||||||
if (!pump.isInitialized()) {
|
if (!pump.isInitialized()) {
|
||||||
|
@ -583,7 +583,7 @@ public class LoopPlugin extends PluginBase {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
PumpInterface pump = MainApp.getConfigBuilder().getActivePump();
|
PumpInterface pump = ConfigBuilderPlugin.getPlugin().getActivePump();
|
||||||
TreatmentsInterface activeTreatments = TreatmentsPlugin.getPlugin();
|
TreatmentsInterface activeTreatments = TreatmentsPlugin.getPlugin();
|
||||||
|
|
||||||
long lastBolusTime = activeTreatments.getLastBolusTime();
|
long lastBolusTime = activeTreatments.getLastBolusTime();
|
||||||
|
@ -633,7 +633,7 @@ public class LoopPlugin extends PluginBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void disconnectPump(int durationInMinutes, Profile profile) {
|
public void disconnectPump(int durationInMinutes, Profile profile) {
|
||||||
PumpInterface pump = MainApp.getConfigBuilder().getActivePump();
|
PumpInterface pump = ConfigBuilderPlugin.getPlugin().getActivePump();
|
||||||
TreatmentsInterface activeTreatments = TreatmentsPlugin.getPlugin();
|
TreatmentsInterface activeTreatments = TreatmentsPlugin.getPlugin();
|
||||||
|
|
||||||
LoopPlugin.getPlugin().disconnectTo(System.currentTimeMillis() + durationInMinutes * 60 * 1000L);
|
LoopPlugin.getPlugin().disconnectTo(System.currentTimeMillis() + durationInMinutes * 60 * 1000L);
|
||||||
|
|
|
@ -249,7 +249,7 @@ public class NSUpload {
|
||||||
log.debug("OpenAPS data too old to upload");
|
log.debug("OpenAPS data too old to upload");
|
||||||
}
|
}
|
||||||
deviceStatus.device = "openaps://" + Build.MANUFACTURER + " " + Build.MODEL;
|
deviceStatus.device = "openaps://" + Build.MANUFACTURER + " " + Build.MODEL;
|
||||||
JSONObject pumpstatus = ConfigBuilderPlugin.getActivePump().getJSONStatus(profile, profileName);
|
JSONObject pumpstatus = ConfigBuilderPlugin.getPlugin().getActivePump().getJSONStatus(profile, profileName);
|
||||||
if (pumpstatus != null) {
|
if (pumpstatus != null) {
|
||||||
deviceStatus.pump = pumpstatus;
|
deviceStatus.pump = pumpstatus;
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,13 +67,13 @@ public class OpenAPSAMAPlugin extends PluginBase implements APSInterface {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean specialEnableCondition() {
|
public boolean specialEnableCondition() {
|
||||||
PumpInterface pump = ConfigBuilderPlugin.getActivePump();
|
PumpInterface pump = ConfigBuilderPlugin.getPlugin().getActivePump();
|
||||||
return pump == null || pump.getPumpDescription().isTempBasalCapable;
|
return pump == null || pump.getPumpDescription().isTempBasalCapable;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean specialShowInListCondition() {
|
public boolean specialShowInListCondition() {
|
||||||
PumpInterface pump = ConfigBuilderPlugin.getActivePump();
|
PumpInterface pump = ConfigBuilderPlugin.getPlugin().getActivePump();
|
||||||
return pump == null || pump.getPumpDescription().isTempBasalCapable;
|
return pump == null || pump.getPumpDescription().isTempBasalCapable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -97,7 +97,7 @@ public class OpenAPSAMAPlugin extends PluginBase implements APSInterface {
|
||||||
|
|
||||||
GlucoseStatus glucoseStatus = GlucoseStatus.getGlucoseStatusData();
|
GlucoseStatus glucoseStatus = GlucoseStatus.getGlucoseStatusData();
|
||||||
Profile profile = ProfileFunctions.getInstance().getProfile();
|
Profile profile = ProfileFunctions.getInstance().getProfile();
|
||||||
PumpInterface pump = ConfigBuilderPlugin.getActivePump();
|
PumpInterface pump = ConfigBuilderPlugin.getPlugin().getActivePump();
|
||||||
|
|
||||||
if (profile == null) {
|
if (profile == null) {
|
||||||
MainApp.bus().post(new EventOpenAPSUpdateResultGui(MainApp.gs(R.string.noprofileselected)));
|
MainApp.bus().post(new EventOpenAPSUpdateResultGui(MainApp.gs(R.string.noprofileselected)));
|
||||||
|
@ -188,7 +188,7 @@ public class OpenAPSAMAPlugin extends PluginBase implements APSInterface {
|
||||||
start = System.currentTimeMillis();
|
start = System.currentTimeMillis();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
determineBasalAdapterAMAJS.setData(profile, maxIob, maxBasal, minBg, maxBg, targetBg, ConfigBuilderPlugin.getActivePump().getBaseBasalRate(), iobArray, glucoseStatus, mealData,
|
determineBasalAdapterAMAJS.setData(profile, maxIob, maxBasal, minBg, maxBg, targetBg, ConfigBuilderPlugin.getPlugin().getActivePump().getBaseBasalRate(), iobArray, glucoseStatus, mealData,
|
||||||
lastAutosensResult.ratio, //autosensDataRatio
|
lastAutosensResult.ratio, //autosensDataRatio
|
||||||
isTempTarget
|
isTempTarget
|
||||||
);
|
);
|
||||||
|
|
|
@ -66,13 +66,13 @@ public class OpenAPSMAPlugin extends PluginBase implements APSInterface {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean specialEnableCondition() {
|
public boolean specialEnableCondition() {
|
||||||
PumpInterface pump = ConfigBuilderPlugin.getActivePump();
|
PumpInterface pump = ConfigBuilderPlugin.getPlugin().getActivePump();
|
||||||
return pump == null || pump.getPumpDescription().isTempBasalCapable;
|
return pump == null || pump.getPumpDescription().isTempBasalCapable;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean specialShowInListCondition() {
|
public boolean specialShowInListCondition() {
|
||||||
PumpInterface pump = ConfigBuilderPlugin.getActivePump();
|
PumpInterface pump = ConfigBuilderPlugin.getPlugin().getActivePump();
|
||||||
return pump == null || pump.getPumpDescription().isTempBasalCapable;
|
return pump == null || pump.getPumpDescription().isTempBasalCapable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -96,7 +96,7 @@ public class OpenAPSMAPlugin extends PluginBase implements APSInterface {
|
||||||
|
|
||||||
GlucoseStatus glucoseStatus = GlucoseStatus.getGlucoseStatusData();
|
GlucoseStatus glucoseStatus = GlucoseStatus.getGlucoseStatusData();
|
||||||
Profile profile = ProfileFunctions.getInstance().getProfile();
|
Profile profile = ProfileFunctions.getInstance().getProfile();
|
||||||
PumpInterface pump = ConfigBuilderPlugin.getActivePump();
|
PumpInterface pump = ConfigBuilderPlugin.getPlugin().getActivePump();
|
||||||
|
|
||||||
if (profile == null) {
|
if (profile == null) {
|
||||||
MainApp.bus().post(new EventOpenAPSUpdateResultGui(MainApp.gs(R.string.noprofileselected)));
|
MainApp.bus().post(new EventOpenAPSUpdateResultGui(MainApp.gs(R.string.noprofileselected)));
|
||||||
|
@ -168,7 +168,7 @@ public class OpenAPSMAPlugin extends PluginBase implements APSInterface {
|
||||||
|
|
||||||
start = System.currentTimeMillis();
|
start = System.currentTimeMillis();
|
||||||
try {
|
try {
|
||||||
determineBasalAdapterMAJS.setData(profile, maxIob, maxBasal, minBg, maxBg, targetBg, ConfigBuilderPlugin.getActivePump().getBaseBasalRate(), iobTotal, glucoseStatus, mealData);
|
determineBasalAdapterMAJS.setData(profile, maxIob, maxBasal, minBg, maxBg, targetBg, ConfigBuilderPlugin.getPlugin().getActivePump().getBaseBasalRate(), iobTotal, glucoseStatus, mealData);
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
log.error("Unhandled exception", e);
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,13 +72,13 @@ public class OpenAPSSMBPlugin extends PluginBase implements APSInterface {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean specialEnableCondition() {
|
public boolean specialEnableCondition() {
|
||||||
PumpInterface pump = ConfigBuilderPlugin.getActivePump();
|
PumpInterface pump = ConfigBuilderPlugin.getPlugin().getActivePump();
|
||||||
return pump == null || pump.getPumpDescription().isTempBasalCapable;
|
return pump == null || pump.getPumpDescription().isTempBasalCapable;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean specialShowInListCondition() {
|
public boolean specialShowInListCondition() {
|
||||||
PumpInterface pump = ConfigBuilderPlugin.getActivePump();
|
PumpInterface pump = ConfigBuilderPlugin.getPlugin().getActivePump();
|
||||||
return pump == null || pump.getPumpDescription().isTempBasalCapable;
|
return pump == null || pump.getPumpDescription().isTempBasalCapable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,7 +102,7 @@ public class OpenAPSSMBPlugin extends PluginBase implements APSInterface {
|
||||||
|
|
||||||
GlucoseStatus glucoseStatus = GlucoseStatus.getGlucoseStatusData();
|
GlucoseStatus glucoseStatus = GlucoseStatus.getGlucoseStatusData();
|
||||||
Profile profile = ProfileFunctions.getInstance().getProfile();
|
Profile profile = ProfileFunctions.getInstance().getProfile();
|
||||||
PumpInterface pump = ConfigBuilderPlugin.getActivePump();
|
PumpInterface pump = ConfigBuilderPlugin.getPlugin().getActivePump();
|
||||||
|
|
||||||
if (profile == null) {
|
if (profile == null) {
|
||||||
MainApp.bus().post(new EventOpenAPSUpdateResultGui(MainApp.gs(R.string.noprofileselected)));
|
MainApp.bus().post(new EventOpenAPSUpdateResultGui(MainApp.gs(R.string.noprofileselected)));
|
||||||
|
@ -205,7 +205,7 @@ public class OpenAPSSMBPlugin extends PluginBase implements APSInterface {
|
||||||
|
|
||||||
start = System.currentTimeMillis();
|
start = System.currentTimeMillis();
|
||||||
try {
|
try {
|
||||||
determineBasalAdapterSMBJS.setData(profile, maxIob, maxBasal, minBg, maxBg, targetBg, ConfigBuilderPlugin.getActivePump().getBaseBasalRate(), iobArray, glucoseStatus, mealData,
|
determineBasalAdapterSMBJS.setData(profile, maxIob, maxBasal, minBg, maxBg, targetBg, ConfigBuilderPlugin.getPlugin().getActivePump().getBaseBasalRate(), iobArray, glucoseStatus, mealData,
|
||||||
lastAutosensResult.ratio, //autosensDataRatio
|
lastAutosensResult.ratio, //autosensDataRatio
|
||||||
isTempTarget,
|
isTempTarget,
|
||||||
smbAllowed.value(),
|
smbAllowed.value(),
|
||||||
|
|
|
@ -133,7 +133,7 @@ public class NewInsulinDialog extends DialogFragment implements OnClickListener
|
||||||
maxInsulin = MainApp.getConstraintChecker().getMaxBolusAllowed().value();
|
maxInsulin = MainApp.getConstraintChecker().getMaxBolusAllowed().value();
|
||||||
|
|
||||||
editInsulin = view.findViewById(R.id.newinsulin_amount);
|
editInsulin = view.findViewById(R.id.newinsulin_amount);
|
||||||
editInsulin.setParams(0d, 0d, maxInsulin, ConfigBuilderPlugin.getActivePump().getPumpDescription().bolusStep, DecimalFormatter.pumpSupportedBolusFormat(), false, textWatcher);
|
editInsulin.setParams(0d, 0d, maxInsulin, ConfigBuilderPlugin.getPlugin().getActivePump().getPumpDescription().bolusStep, DecimalFormatter.pumpSupportedBolusFormat(), false, textWatcher);
|
||||||
|
|
||||||
Button plus1Button = view.findViewById(R.id.newinsulin_plus05);
|
Button plus1Button = view.findViewById(R.id.newinsulin_plus05);
|
||||||
plus1Button.setOnClickListener(this);
|
plus1Button.setOnClickListener(this);
|
||||||
|
@ -212,7 +212,7 @@ public class NewInsulinDialog extends DialogFragment implements OnClickListener
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Profile currentProfile = ProfileFunctions.getInstance().getProfile();
|
Profile currentProfile = ProfileFunctions.getInstance().getProfile();
|
||||||
final PumpInterface pump = MainApp.getConfigBuilder().getActivePump();
|
final PumpInterface pump = ConfigBuilderPlugin.getPlugin().getActivePump();
|
||||||
if (currentProfile == null || pump == null)
|
if (currentProfile == null || pump == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
|
@ -105,7 +105,7 @@ public class NewTreatmentDialog extends DialogFragment implements OnClickListene
|
||||||
editInsulin = (NumberPicker) view.findViewById(R.id.treatments_newtreatment_insulinamount);
|
editInsulin = (NumberPicker) view.findViewById(R.id.treatments_newtreatment_insulinamount);
|
||||||
|
|
||||||
editCarbs.setParams(0d, 0d, (double) maxCarbs, 1d, new DecimalFormat("0"), false, textWatcher);
|
editCarbs.setParams(0d, 0d, (double) maxCarbs, 1d, new DecimalFormat("0"), false, textWatcher);
|
||||||
editInsulin.setParams(0d, 0d, maxInsulin, ConfigBuilderPlugin.getActivePump().getPumpDescription().bolusStep, DecimalFormatter.pumpSupportedBolusFormat(), false, textWatcher);
|
editInsulin.setParams(0d, 0d, maxInsulin, ConfigBuilderPlugin.getPlugin().getActivePump().getPumpDescription().bolusStep, DecimalFormatter.pumpSupportedBolusFormat(), false, textWatcher);
|
||||||
|
|
||||||
recordOnlyCheckbox = (CheckBox) view.findViewById(R.id.newtreatment_record_only);
|
recordOnlyCheckbox = (CheckBox) view.findViewById(R.id.newtreatment_record_only);
|
||||||
|
|
||||||
|
@ -126,7 +126,7 @@ public class NewTreatmentDialog extends DialogFragment implements OnClickListene
|
||||||
okClicked = true;
|
okClicked = true;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
final PumpInterface pump = MainApp.getConfigBuilder().getActivePump();
|
final PumpInterface pump = ConfigBuilderPlugin.getPlugin().getActivePump();
|
||||||
|
|
||||||
if (pump == null)
|
if (pump == null)
|
||||||
return;
|
return;
|
||||||
|
@ -177,7 +177,7 @@ public class NewTreatmentDialog extends DialogFragment implements OnClickListene
|
||||||
detailedBolusInfo.carbs = finalCarbsAfterConstraints;
|
detailedBolusInfo.carbs = finalCarbsAfterConstraints;
|
||||||
detailedBolusInfo.context = context;
|
detailedBolusInfo.context = context;
|
||||||
detailedBolusInfo.source = Source.USER;
|
detailedBolusInfo.source = Source.USER;
|
||||||
if (!(recordOnlyCheckbox.isChecked() && (detailedBolusInfo.insulin > 0 || ConfigBuilderPlugin.getActivePump().getPumpDescription().storesCarbInfo))) {
|
if (!(recordOnlyCheckbox.isChecked() && (detailedBolusInfo.insulin > 0 || ConfigBuilderPlugin.getPlugin().getActivePump().getPumpDescription().storesCarbInfo))) {
|
||||||
ConfigBuilderPlugin.getCommandQueue().bolus(detailedBolusInfo, new Callback() {
|
ConfigBuilderPlugin.getCommandQueue().bolus(detailedBolusInfo, new Callback() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
|
|
@ -270,7 +270,7 @@ public class WizardDialog extends DialogFragment implements OnClickListener, Com
|
||||||
|
|
||||||
editBg.setParams(0d, 0d, 500d, 0.1d, new DecimalFormat("0.0"), false, textWatcher);
|
editBg.setParams(0d, 0d, 500d, 0.1d, new DecimalFormat("0.0"), false, textWatcher);
|
||||||
editCarbs.setParams(0d, 0d, (double) maxCarbs, 1d, new DecimalFormat("0"), false, textWatcher);
|
editCarbs.setParams(0d, 0d, (double) maxCarbs, 1d, new DecimalFormat("0"), false, textWatcher);
|
||||||
double bolusstep = ConfigBuilderPlugin.getActivePump().getPumpDescription().bolusStep;
|
double bolusstep = ConfigBuilderPlugin.getPlugin().getActivePump().getPumpDescription().bolusStep;
|
||||||
editCorr.setParams(0d, -maxCorrection, maxCorrection, bolusstep, DecimalFormatter.pumpSupportedBolusFormat(), false, textWatcher);
|
editCorr.setParams(0d, -maxCorrection, maxCorrection, bolusstep, DecimalFormatter.pumpSupportedBolusFormat(), false, textWatcher);
|
||||||
editCarbTime.setParams(0d, -60d, 60d, 5d, new DecimalFormat("0"), false);
|
editCarbTime.setParams(0d, -60d, 60d, 5d, new DecimalFormat("0"), false);
|
||||||
initDialog();
|
initDialog();
|
||||||
|
@ -327,7 +327,7 @@ public class WizardDialog extends DialogFragment implements OnClickListener, Com
|
||||||
}
|
}
|
||||||
okClicked = true;
|
okClicked = true;
|
||||||
final Profile profile = ProfileFunctions.getInstance().getProfile();
|
final Profile profile = ProfileFunctions.getInstance().getProfile();
|
||||||
final PumpInterface pump = MainApp.getConfigBuilder().getActivePump();
|
final PumpInterface pump = ConfigBuilderPlugin.getPlugin().getActivePump();
|
||||||
|
|
||||||
if (pump != null && profile != null && (calculatedTotalInsulin > 0d || calculatedCarbs > 0d)) {
|
if (pump != null && profile != null && (calculatedTotalInsulin > 0d || calculatedCarbs > 0d)) {
|
||||||
String confirmMessage = MainApp.gs(R.string.entertreatmentquestion);
|
String confirmMessage = MainApp.gs(R.string.entertreatmentquestion);
|
||||||
|
@ -394,7 +394,7 @@ public class WizardDialog extends DialogFragment implements OnClickListener, Com
|
||||||
detailedBolusInfo.boluscalc = boluscalcJSON;
|
detailedBolusInfo.boluscalc = boluscalcJSON;
|
||||||
detailedBolusInfo.source = Source.USER;
|
detailedBolusInfo.source = Source.USER;
|
||||||
detailedBolusInfo.notes = finalNotes;
|
detailedBolusInfo.notes = finalNotes;
|
||||||
if (detailedBolusInfo.insulin > 0 || ConfigBuilderPlugin.getActivePump().getPumpDescription().storesCarbInfo) {
|
if (detailedBolusInfo.insulin > 0 || ConfigBuilderPlugin.getPlugin().getActivePump().getPumpDescription().storesCarbInfo) {
|
||||||
ConfigBuilderPlugin.getCommandQueue().bolus(detailedBolusInfo, new Callback() {
|
ConfigBuilderPlugin.getCommandQueue().bolus(detailedBolusInfo, new Callback() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
|
|
@ -446,7 +446,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
||||||
super.onCreateContextMenu(menu, v, menuInfo);
|
super.onCreateContextMenu(menu, v, menuInfo);
|
||||||
if (v == apsModeView) {
|
if (v == apsModeView) {
|
||||||
final LoopPlugin loopPlugin = LoopPlugin.getPlugin();
|
final LoopPlugin loopPlugin = LoopPlugin.getPlugin();
|
||||||
final PumpDescription pumpDescription = ConfigBuilderPlugin.getActivePump().getPumpDescription();
|
final PumpDescription pumpDescription = ConfigBuilderPlugin.getPlugin().getActivePump().getPumpDescription();
|
||||||
if (!ProfileFunctions.getInstance().isProfileValid("ContexMenuCreation"))
|
if (!ProfileFunctions.getInstance().isProfileValid("ContexMenuCreation"))
|
||||||
return;
|
return;
|
||||||
menu.setHeaderTitle(MainApp.gs(R.string.loop));
|
menu.setHeaderTitle(MainApp.gs(R.string.loop));
|
||||||
|
@ -681,7 +681,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
||||||
new NewCarbsDialog().show(manager, "CarbsDialog");
|
new NewCarbsDialog().show(manager, "CarbsDialog");
|
||||||
break;
|
break;
|
||||||
case R.id.overview_pumpstatus:
|
case R.id.overview_pumpstatus:
|
||||||
if (ConfigBuilderPlugin.getActivePump().isSuspended() || !ConfigBuilderPlugin.getActivePump().isInitialized())
|
if (ConfigBuilderPlugin.getPlugin().getActivePump().isSuspended() || !ConfigBuilderPlugin.getPlugin().getActivePump().isInitialized())
|
||||||
ConfigBuilderPlugin.getCommandQueue().readStatus("RefreshClicked", null);
|
ConfigBuilderPlugin.getCommandQueue().readStatus("RefreshClicked", null);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -836,7 +836,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
||||||
detailedBolusInfo.context = context;
|
detailedBolusInfo.context = context;
|
||||||
detailedBolusInfo.boluscalc = boluscalcJSON;
|
detailedBolusInfo.boluscalc = boluscalcJSON;
|
||||||
detailedBolusInfo.source = Source.USER;
|
detailedBolusInfo.source = Source.USER;
|
||||||
if (finalInsulinAfterConstraints > 0 || ConfigBuilderPlugin.getActivePump().getPumpDescription().storesCarbInfo) {
|
if (finalInsulinAfterConstraints > 0 || ConfigBuilderPlugin.getPlugin().getActivePump().getPumpDescription().storesCarbInfo) {
|
||||||
ConfigBuilderPlugin.getCommandQueue().bolus(detailedBolusInfo, new Callback() {
|
ConfigBuilderPlugin.getCommandQueue().bolus(detailedBolusInfo, new Callback() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
@ -1043,7 +1043,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
||||||
BgReading actualBG = DatabaseHelper.actualBg();
|
BgReading actualBG = DatabaseHelper.actualBg();
|
||||||
BgReading lastBG = DatabaseHelper.lastBg();
|
BgReading lastBG = DatabaseHelper.lastBg();
|
||||||
|
|
||||||
final PumpInterface pump = ConfigBuilderPlugin.getActivePump();
|
final PumpInterface pump = ConfigBuilderPlugin.getPlugin().getActivePump();
|
||||||
|
|
||||||
final Profile profile = ProfileFunctions.getInstance().getProfile();
|
final Profile profile = ProfileFunctions.getInstance().getProfile();
|
||||||
|
|
||||||
|
@ -1248,7 +1248,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
||||||
// **** Various treatment buttons ****
|
// **** Various treatment buttons ****
|
||||||
if (carbsButton != null) {
|
if (carbsButton != null) {
|
||||||
if (SP.getBoolean(R.string.key_show_carbs_button, true)
|
if (SP.getBoolean(R.string.key_show_carbs_button, true)
|
||||||
&& (!ConfigBuilderPlugin.getActivePump().getPumpDescription().storesCarbInfo ||
|
&& (!ConfigBuilderPlugin.getPlugin().getActivePump().getPumpDescription().storesCarbInfo ||
|
||||||
(pump.isInitialized() && !pump.isSuspended()))) {
|
(pump.isInitialized() && !pump.isSuspended()))) {
|
||||||
carbsButton.setVisibility(View.VISIBLE);
|
carbsButton.setVisibility(View.VISIBLE);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -303,7 +303,7 @@ public class GraphData {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Extended bolus
|
// Extended bolus
|
||||||
if (!ConfigBuilderPlugin.getActivePump().isFakingTempsByExtendedBoluses()) {
|
if (!ConfigBuilderPlugin.getPlugin().getActivePump().isFakingTempsByExtendedBoluses()) {
|
||||||
List<ExtendedBolus> extendedBoluses = TreatmentsPlugin.getPlugin().getExtendedBolusesFromHistory().getList();
|
List<ExtendedBolus> extendedBoluses = TreatmentsPlugin.getPlugin().getExtendedBolusesFromHistory().getList();
|
||||||
|
|
||||||
for (int tx = 0; tx < extendedBoluses.size(); tx++) {
|
for (int tx = 0; tx < extendedBoluses.size(); tx++) {
|
||||||
|
|
|
@ -145,7 +145,7 @@ public class PersistentNotificationPlugin extends PluginBase {
|
||||||
|
|
||||||
String line2 = MainApp.gs(R.string.treatments_iob_label_string) + " " + DecimalFormatter.to2Decimal(bolusIob.iob + basalIob.basaliob) + "U " + MainApp.gs(R.string.cob)+": " + IobCobCalculatorPlugin.getPlugin().getCobInfo(false, "PersistentNotificationPlugin").generateCOBString();;
|
String line2 = MainApp.gs(R.string.treatments_iob_label_string) + " " + DecimalFormatter.to2Decimal(bolusIob.iob + basalIob.basaliob) + "U " + MainApp.gs(R.string.cob)+": " + IobCobCalculatorPlugin.getPlugin().getCobInfo(false, "PersistentNotificationPlugin").generateCOBString();;
|
||||||
|
|
||||||
String line3 = DecimalFormatter.to2Decimal(ConfigBuilderPlugin.getActivePump().getBaseBasalRate()) + " U/h";
|
String line3 = DecimalFormatter.to2Decimal(ConfigBuilderPlugin.getPlugin().getActivePump().getBaseBasalRate()) + " U/h";
|
||||||
|
|
||||||
|
|
||||||
line3 += " - " + ProfileFunctions.getInstance().getProfileName();
|
line3 += " - " + ProfileFunctions.getInstance().getProfileName();
|
||||||
|
|
|
@ -79,7 +79,7 @@ public class LocalProfileFragment extends SubscriberFragment {
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||||
Bundle savedInstanceState) {
|
Bundle savedInstanceState) {
|
||||||
PumpDescription pumpDescription = ConfigBuilderPlugin.getActivePump().getPumpDescription();
|
PumpDescription pumpDescription = ConfigBuilderPlugin.getPlugin().getActivePump().getPumpDescription();
|
||||||
View layout = inflater.inflate(R.layout.localprofile_fragment, container, false);
|
View layout = inflater.inflate(R.layout.localprofile_fragment, container, false);
|
||||||
diaView = (NumberPicker) layout.findViewById(R.id.localprofile_dia);
|
diaView = (NumberPicker) layout.findViewById(R.id.localprofile_dia);
|
||||||
diaView.setParams(LocalProfilePlugin.getPlugin().dia, 2d, 48d, 0.1d, new DecimalFormat("0.0"), false, textWatch);
|
diaView.setParams(LocalProfilePlugin.getPlugin().dia, 2d, 48d, 0.1d, new DecimalFormat("0.0"), false, textWatch);
|
||||||
|
@ -96,7 +96,7 @@ public class LocalProfileFragment extends SubscriberFragment {
|
||||||
|
|
||||||
invalidProfile = (TextView) layout.findViewById(R.id.invalidprofile);
|
invalidProfile = (TextView) layout.findViewById(R.id.invalidprofile);
|
||||||
|
|
||||||
if (!ConfigBuilderPlugin.getActivePump().getPumpDescription().isTempBasalCapable) {
|
if (!ConfigBuilderPlugin.getPlugin().getActivePump().getPumpDescription().isTempBasalCapable) {
|
||||||
layout.findViewById(R.id.localprofile_basal).setVisibility(View.GONE);
|
layout.findViewById(R.id.localprofile_basal).setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -55,7 +55,7 @@ public class SimpleProfileFragment extends SubscriberFragment {
|
||||||
profileswitchButton = (Button) layout.findViewById(R.id.simpleprofile_profileswitch);
|
profileswitchButton = (Button) layout.findViewById(R.id.simpleprofile_profileswitch);
|
||||||
invalidProfile = (TextView) layout.findViewById(R.id.invalidprofile);
|
invalidProfile = (TextView) layout.findViewById(R.id.invalidprofile);
|
||||||
|
|
||||||
if (!ConfigBuilderPlugin.getActivePump().getPumpDescription().isTempBasalCapable) {
|
if (!ConfigBuilderPlugin.getPlugin().getActivePump().getPumpDescription().isTempBasalCapable) {
|
||||||
layout.findViewById(R.id.simpleprofile_basalrate).setVisibility(View.GONE);
|
layout.findViewById(R.id.simpleprofile_basalrate).setVisibility(View.GONE);
|
||||||
layout.findViewById(R.id.simpleprofile_basalrate_label).setVisibility(View.GONE);
|
layout.findViewById(R.id.simpleprofile_basalrate_label).setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
|
@ -136,7 +136,7 @@ public class SimpleProfileFragment extends SubscriberFragment {
|
||||||
if (activity != null)
|
if (activity != null)
|
||||||
activity.runOnUiThread(() -> {
|
activity.runOnUiThread(() -> {
|
||||||
boolean isValid = SimpleProfilePlugin.getPlugin().getProfile() != null && SimpleProfilePlugin.getPlugin().getProfile().getDefaultProfile().isValid(MainApp.gs(R.string.simpleprofile));
|
boolean isValid = SimpleProfilePlugin.getPlugin().getProfile() != null && SimpleProfilePlugin.getPlugin().getProfile().getDefaultProfile().isValid(MainApp.gs(R.string.simpleprofile));
|
||||||
if (!ConfigBuilderPlugin.getActivePump().isInitialized() || ConfigBuilderPlugin.getActivePump().isSuspended() || !isValid) {
|
if (!ConfigBuilderPlugin.getPlugin().getActivePump().isInitialized() || ConfigBuilderPlugin.getPlugin().getActivePump().isSuspended() || !isValid) {
|
||||||
profileswitchButton.setVisibility(View.GONE);
|
profileswitchButton.setVisibility(View.GONE);
|
||||||
} else {
|
} else {
|
||||||
profileswitchButton.setVisibility(View.VISIBLE);
|
profileswitchButton.setVisibility(View.VISIBLE);
|
||||||
|
|
|
@ -228,9 +228,9 @@ public class DanaRFragment extends SubscriberFragment {
|
||||||
|
|
||||||
dailyUnitsView.setText(DecimalFormatter.to0Decimal(pump.dailyTotalUnits) + " / " + pump.maxDailyTotalUnits + " U");
|
dailyUnitsView.setText(DecimalFormatter.to0Decimal(pump.dailyTotalUnits) + " / " + pump.maxDailyTotalUnits + " U");
|
||||||
SetWarnColor.setColor(dailyUnitsView, pump.dailyTotalUnits, pump.maxDailyTotalUnits * 0.75d, pump.maxDailyTotalUnits * 0.9d);
|
SetWarnColor.setColor(dailyUnitsView, pump.dailyTotalUnits, pump.maxDailyTotalUnits * 0.75d, pump.maxDailyTotalUnits * 0.9d);
|
||||||
basaBasalRateView.setText("( " + (pump.activeProfile + 1) + " ) " + DecimalFormatter.to2Decimal(ConfigBuilderPlugin.getActivePump().getBaseBasalRate()) + " U/h");
|
basaBasalRateView.setText("( " + (pump.activeProfile + 1) + " ) " + DecimalFormatter.to2Decimal(ConfigBuilderPlugin.getPlugin().getActivePump().getBaseBasalRate()) + " U/h");
|
||||||
// DanaRPlugin, DanaRKoreanPlugin
|
// DanaRPlugin, DanaRKoreanPlugin
|
||||||
if (ConfigBuilderPlugin.getActivePump().isFakingTempsByExtendedBoluses()) {
|
if (ConfigBuilderPlugin.getPlugin().getActivePump().isFakingTempsByExtendedBoluses()) {
|
||||||
if (TreatmentsPlugin.getPlugin().isInHistoryRealTempBasalInProgress()) {
|
if (TreatmentsPlugin.getPlugin().isInHistoryRealTempBasalInProgress()) {
|
||||||
tempBasalView.setText(TreatmentsPlugin.getPlugin().getRealTempBasalFromHistory(System.currentTimeMillis()).toStringFull());
|
tempBasalView.setText(TreatmentsPlugin.getPlugin().getRealTempBasalFromHistory(System.currentTimeMillis()).toStringFull());
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -71,13 +71,13 @@ public class ProfileViewDialog extends DialogFragment {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setContent() {
|
private void setContent() {
|
||||||
ProfileStore store = ((ProfileInterface)MainApp.getConfigBuilder().getActivePump()).getProfile();
|
ProfileStore store = ((ProfileInterface)ConfigBuilderPlugin.getPlugin().getActivePump()).getProfile();
|
||||||
if (store != null) {
|
if (store != null) {
|
||||||
noProfile.setVisibility(View.GONE);
|
noProfile.setVisibility(View.GONE);
|
||||||
Profile profile = store.getDefaultProfile();
|
Profile profile = store.getDefaultProfile();
|
||||||
units.setText(profile.getUnits());
|
units.setText(profile.getUnits());
|
||||||
dia.setText(DecimalFormatter.to2Decimal(profile.getDia()) + " h");
|
dia.setText(DecimalFormatter.to2Decimal(profile.getDia()) + " h");
|
||||||
activeProfile.setText(((ProfileInterface) MainApp.getConfigBuilder().getActivePump()).getProfileName());
|
activeProfile.setText(((ProfileInterface) ConfigBuilderPlugin.getPlugin().getActivePump()).getProfileName());
|
||||||
ic.setText(profile.getIcList());
|
ic.setText(profile.getIcList());
|
||||||
isf.setText(profile.getIsfList());
|
isf.setText(profile.getIsfList());
|
||||||
basal.setText(profile.getBasalList());
|
basal.setText(profile.getBasalList());
|
||||||
|
|
|
@ -160,7 +160,7 @@ public class DanaRExecutionService extends AbstractDanaRExecutionService {
|
||||||
mDanaRPump.lastConnection = now;
|
mDanaRPump.lastConnection = now;
|
||||||
|
|
||||||
Profile profile = ProfileFunctions.getInstance().getProfile();
|
Profile profile = ProfileFunctions.getInstance().getProfile();
|
||||||
PumpInterface pump = MainApp.getConfigBuilder().getActivePump();
|
PumpInterface pump = ConfigBuilderPlugin.getPlugin().getActivePump();
|
||||||
if (profile != null && Math.abs(mDanaRPump.currentBasal - profile.getBasal()) >= pump.getPumpDescription().basalStep) {
|
if (profile != null && Math.abs(mDanaRPump.currentBasal - profile.getBasal()) >= pump.getPumpDescription().basalStep) {
|
||||||
MainApp.bus().post(new EventPumpStatusChanged(MainApp.gs(R.string.gettingpumpsettings)));
|
MainApp.bus().post(new EventPumpStatusChanged(MainApp.gs(R.string.gettingpumpsettings)));
|
||||||
mSerialIOThread.sendMessage(new MsgSettingBasal());
|
mSerialIOThread.sendMessage(new MsgSettingBasal());
|
||||||
|
|
|
@ -164,7 +164,7 @@ public class DanaRKoreanExecutionService extends AbstractDanaRExecutionService {
|
||||||
mDanaRPump.lastConnection = now;
|
mDanaRPump.lastConnection = now;
|
||||||
|
|
||||||
Profile profile = ProfileFunctions.getInstance().getProfile();
|
Profile profile = ProfileFunctions.getInstance().getProfile();
|
||||||
PumpInterface pump = MainApp.getConfigBuilder().getActivePump();
|
PumpInterface pump = ConfigBuilderPlugin.getPlugin().getActivePump();
|
||||||
if (profile != null && Math.abs(mDanaRPump.currentBasal - profile.getBasal()) >= pump.getPumpDescription().basalStep) {
|
if (profile != null && Math.abs(mDanaRPump.currentBasal - profile.getBasal()) >= pump.getPumpDescription().basalStep) {
|
||||||
MainApp.bus().post(new EventPumpStatusChanged(MainApp.gs(R.string.gettingpumpsettings)));
|
MainApp.bus().post(new EventPumpStatusChanged(MainApp.gs(R.string.gettingpumpsettings)));
|
||||||
mSerialIOThread.sendMessage(new MsgSettingBasal());
|
mSerialIOThread.sendMessage(new MsgSettingBasal());
|
||||||
|
|
|
@ -144,7 +144,7 @@ public class DanaRSService extends Service {
|
||||||
danaRPump.lastConnection = System.currentTimeMillis();
|
danaRPump.lastConnection = System.currentTimeMillis();
|
||||||
|
|
||||||
Profile profile = ProfileFunctions.getInstance().getProfile();
|
Profile profile = ProfileFunctions.getInstance().getProfile();
|
||||||
PumpInterface pump = MainApp.getConfigBuilder().getActivePump();
|
PumpInterface pump = ConfigBuilderPlugin.getPlugin().getActivePump();
|
||||||
if (profile != null && Math.abs(danaRPump.currentBasal - profile.getBasal()) >= pump.getPumpDescription().basalStep) {
|
if (profile != null && Math.abs(danaRPump.currentBasal - profile.getBasal()) >= pump.getPumpDescription().basalStep) {
|
||||||
MainApp.bus().post(new EventPumpStatusChanged(MainApp.gs(R.string.gettingpumpsettings)));
|
MainApp.bus().post(new EventPumpStatusChanged(MainApp.gs(R.string.gettingpumpsettings)));
|
||||||
bleComm.sendMessage(new DanaRS_Packet_Basal_Get_Basal_Rate()); // basal profile, basalStep, maxBasal
|
bleComm.sendMessage(new DanaRS_Packet_Basal_Get_Basal_Rate()); // basal profile, basalStep, maxBasal
|
||||||
|
|
|
@ -182,7 +182,7 @@ public class DanaRv2ExecutionService extends AbstractDanaRExecutionService {
|
||||||
mDanaRPump.lastConnection = System.currentTimeMillis();
|
mDanaRPump.lastConnection = System.currentTimeMillis();
|
||||||
|
|
||||||
Profile profile = ProfileFunctions.getInstance().getProfile();
|
Profile profile = ProfileFunctions.getInstance().getProfile();
|
||||||
PumpInterface pump = MainApp.getConfigBuilder().getActivePump();
|
PumpInterface pump = ConfigBuilderPlugin.getPlugin().getActivePump();
|
||||||
if (profile != null && Math.abs(mDanaRPump.currentBasal - profile.getBasal()) >= pump.getPumpDescription().basalStep) {
|
if (profile != null && Math.abs(mDanaRPump.currentBasal - profile.getBasal()) >= pump.getPumpDescription().basalStep) {
|
||||||
MainApp.bus().post(new EventPumpStatusChanged(MainApp.gs(R.string.gettingpumpsettings)));
|
MainApp.bus().post(new EventPumpStatusChanged(MainApp.gs(R.string.gettingpumpsettings)));
|
||||||
mSerialIOThread.sendMessage(new MsgSettingBasal());
|
mSerialIOThread.sendMessage(new MsgSettingBasal());
|
||||||
|
|
|
@ -348,7 +348,7 @@ public class SmsCommunicatorPlugin extends PluginBase {
|
||||||
ConfigBuilderPlugin.getCommandQueue().readStatus("SMS", new Callback() {
|
ConfigBuilderPlugin.getCommandQueue().readStatus("SMS", new Callback() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
PumpInterface pump = MainApp.getConfigBuilder().getActivePump();
|
PumpInterface pump = ConfigBuilderPlugin.getPlugin().getActivePump();
|
||||||
if (result.success) {
|
if (result.success) {
|
||||||
if (pump != null) {
|
if (pump != null) {
|
||||||
String reply = pump.shortStatus(true);
|
String reply = pump.shortStatus(true);
|
||||||
|
@ -405,7 +405,7 @@ public class SmsCommunicatorPlugin extends PluginBase {
|
||||||
if (System.currentTimeMillis() - lastRemoteBolusTime.getTime() < Constants.remoteBolusMinDistance) {
|
if (System.currentTimeMillis() - lastRemoteBolusTime.getTime() < Constants.remoteBolusMinDistance) {
|
||||||
reply = MainApp.gs(R.string.smscommunicator_remotebolusnotallowed);
|
reply = MainApp.gs(R.string.smscommunicator_remotebolusnotallowed);
|
||||||
sendSMS(new Sms(receivedSms.phoneNumber, reply, System.currentTimeMillis()));
|
sendSMS(new Sms(receivedSms.phoneNumber, reply, System.currentTimeMillis()));
|
||||||
} else if (ConfigBuilderPlugin.getActivePump().isSuspended()) {
|
} else if (ConfigBuilderPlugin.getPlugin().getActivePump().isSuspended()) {
|
||||||
reply = MainApp.gs(R.string.pumpsuspended);
|
reply = MainApp.gs(R.string.pumpsuspended);
|
||||||
sendSMS(new Sms(receivedSms.phoneNumber, reply, System.currentTimeMillis()));
|
sendSMS(new Sms(receivedSms.phoneNumber, reply, System.currentTimeMillis()));
|
||||||
} else if (splited.length > 1) {
|
} else if (splited.length > 1) {
|
||||||
|
@ -452,7 +452,7 @@ public class SmsCommunicatorPlugin extends PluginBase {
|
||||||
ConfigBuilderPlugin.getCommandQueue().bolus(detailedBolusInfo, new Callback() {
|
ConfigBuilderPlugin.getCommandQueue().bolus(detailedBolusInfo, new Callback() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
PumpInterface pump = MainApp.getConfigBuilder().getActivePump();
|
PumpInterface pump = ConfigBuilderPlugin.getPlugin().getActivePump();
|
||||||
if (result.success) {
|
if (result.success) {
|
||||||
SystemClock.sleep(T.secs(15).msecs()); // wait some time to get history
|
SystemClock.sleep(T.secs(15).msecs()); // wait some time to get history
|
||||||
String reply = String.format(MainApp.gs(R.string.smscommunicator_bolusdelivered), result.bolusDelivered);
|
String reply = String.format(MainApp.gs(R.string.smscommunicator_bolusdelivered), result.bolusDelivered);
|
||||||
|
@ -479,11 +479,11 @@ public class SmsCommunicatorPlugin extends PluginBase {
|
||||||
public void run() {
|
public void run() {
|
||||||
if (result.success) {
|
if (result.success) {
|
||||||
String reply = String.format(MainApp.gs(R.string.smscommunicator_tempbasalset), result.absolute, result.duration);
|
String reply = String.format(MainApp.gs(R.string.smscommunicator_tempbasalset), result.absolute, result.duration);
|
||||||
reply += "\n" + ConfigBuilderPlugin.getActivePump().shortStatus(true);
|
reply += "\n" + ConfigBuilderPlugin.getPlugin().getActivePump().shortStatus(true);
|
||||||
sendSMSToAllNumbers(new Sms(receivedSms.phoneNumber, reply, System.currentTimeMillis()));
|
sendSMSToAllNumbers(new Sms(receivedSms.phoneNumber, reply, System.currentTimeMillis()));
|
||||||
} else {
|
} else {
|
||||||
String reply = MainApp.gs(R.string.smscommunicator_tempbasalfailed);
|
String reply = MainApp.gs(R.string.smscommunicator_tempbasalfailed);
|
||||||
reply += "\n" + ConfigBuilderPlugin.getActivePump().shortStatus(true);
|
reply += "\n" + ConfigBuilderPlugin.getPlugin().getActivePump().shortStatus(true);
|
||||||
sendSMS(new Sms(receivedSms.phoneNumber, reply, System.currentTimeMillis()));
|
sendSMS(new Sms(receivedSms.phoneNumber, reply, System.currentTimeMillis()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -496,11 +496,11 @@ public class SmsCommunicatorPlugin extends PluginBase {
|
||||||
public void run() {
|
public void run() {
|
||||||
if (result.success) {
|
if (result.success) {
|
||||||
String reply = MainApp.gs(R.string.smscommunicator_tempbasalcanceled);
|
String reply = MainApp.gs(R.string.smscommunicator_tempbasalcanceled);
|
||||||
reply += "\n" + ConfigBuilderPlugin.getActivePump().shortStatus(true);
|
reply += "\n" + ConfigBuilderPlugin.getPlugin().getActivePump().shortStatus(true);
|
||||||
sendSMSToAllNumbers(new Sms(receivedSms.phoneNumber, reply, System.currentTimeMillis()));
|
sendSMSToAllNumbers(new Sms(receivedSms.phoneNumber, reply, System.currentTimeMillis()));
|
||||||
} else {
|
} else {
|
||||||
String reply = MainApp.gs(R.string.smscommunicator_tempbasalcancelfailed);
|
String reply = MainApp.gs(R.string.smscommunicator_tempbasalcancelfailed);
|
||||||
reply += "\n" + ConfigBuilderPlugin.getActivePump().shortStatus(true);
|
reply += "\n" + ConfigBuilderPlugin.getPlugin().getActivePump().shortStatus(true);
|
||||||
sendSMS(new Sms(receivedSms.phoneNumber, reply, System.currentTimeMillis()));
|
sendSMS(new Sms(receivedSms.phoneNumber, reply, System.currentTimeMillis()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -531,7 +531,7 @@ public class SmsCommunicatorPlugin extends PluginBase {
|
||||||
sendSMSToAllNumbers(new Sms(receivedSms.phoneNumber, reply, System.currentTimeMillis()));
|
sendSMSToAllNumbers(new Sms(receivedSms.phoneNumber, reply, System.currentTimeMillis()));
|
||||||
} else {
|
} else {
|
||||||
String reply = MainApp.gs(R.string.smscommunicator_tempbasalcancelfailed);
|
String reply = MainApp.gs(R.string.smscommunicator_tempbasalcancelfailed);
|
||||||
reply += "\n" + ConfigBuilderPlugin.getActivePump().shortStatus(true);
|
reply += "\n" + ConfigBuilderPlugin.getPlugin().getActivePump().shortStatus(true);
|
||||||
sendSMS(new Sms(receivedSms.phoneNumber, reply, System.currentTimeMillis()));
|
sendSMS(new Sms(receivedSms.phoneNumber, reply, System.currentTimeMillis()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,7 +35,7 @@ public class CarbsGenerator {
|
||||||
carbInfo.context = MainApp.instance();
|
carbInfo.context = MainApp.instance();
|
||||||
carbInfo.source = Source.USER;
|
carbInfo.source = Source.USER;
|
||||||
carbInfo.notes = notes;
|
carbInfo.notes = notes;
|
||||||
if (ConfigBuilderPlugin.getActivePump().getPumpDescription().storesCarbInfo && carbInfo.date <= now()) {
|
if (ConfigBuilderPlugin.getPlugin().getActivePump().getPumpDescription().storesCarbInfo && carbInfo.date <= now()) {
|
||||||
ConfigBuilderPlugin.getCommandQueue().bolus(carbInfo, new Callback() {
|
ConfigBuilderPlugin.getCommandQueue().bolus(carbInfo, new Callback() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
|
|
@ -121,7 +121,7 @@ public class TreatmentsFragment extends SubscriberFragment implements View.OnCli
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void updateGUI() {
|
protected void updateGUI() {
|
||||||
if (ConfigBuilderPlugin.getActivePump().getPumpDescription().isExtendedBolusCapable
|
if (ConfigBuilderPlugin.getPlugin().getActivePump().getPumpDescription().isExtendedBolusCapable
|
||||||
|| TreatmentsPlugin.getPlugin().getExtendedBolusesFromHistory().size() > 0) {
|
|| TreatmentsPlugin.getPlugin().getExtendedBolusesFromHistory().size() > 0) {
|
||||||
extendedBolusesTab.setVisibility(View.VISIBLE);
|
extendedBolusesTab.setVisibility(View.VISIBLE);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -209,7 +209,7 @@ public class TreatmentsPlugin extends PluginBase implements TreatmentsInterface
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ConfigBuilderPlugin.getActivePump().isFakingTempsByExtendedBoluses())
|
if (!ConfigBuilderPlugin.getPlugin().getActivePump().isFakingTempsByExtendedBoluses())
|
||||||
synchronized (extendedBoluses) {
|
synchronized (extendedBoluses) {
|
||||||
for (Integer pos = 0; pos < extendedBoluses.size(); pos++) {
|
for (Integer pos = 0; pos < extendedBoluses.size(); pos++) {
|
||||||
ExtendedBolus e = extendedBoluses.get(pos);
|
ExtendedBolus e = extendedBoluses.get(pos);
|
||||||
|
@ -391,7 +391,7 @@ public class TreatmentsPlugin extends PluginBase implements TreatmentsInterface
|
||||||
total.plus(calc);
|
total.plus(calc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (ConfigBuilderPlugin.getActivePump().isFakingTempsByExtendedBoluses()) {
|
if (ConfigBuilderPlugin.getPlugin().getActivePump().isFakingTempsByExtendedBoluses()) {
|
||||||
IobTotal totalExt = new IobTotal(time);
|
IobTotal totalExt = new IobTotal(time);
|
||||||
synchronized (extendedBoluses) {
|
synchronized (extendedBoluses) {
|
||||||
for (Integer pos = 0; pos < extendedBoluses.size(); pos++) {
|
for (Integer pos = 0; pos < extendedBoluses.size(); pos++) {
|
||||||
|
@ -433,7 +433,7 @@ public class TreatmentsPlugin extends PluginBase implements TreatmentsInterface
|
||||||
if (tb != null)
|
if (tb != null)
|
||||||
return tb;
|
return tb;
|
||||||
ExtendedBolus eb = getExtendedBolusFromHistory(time);
|
ExtendedBolus eb = getExtendedBolusFromHistory(time);
|
||||||
if (eb != null && ConfigBuilderPlugin.getActivePump().isFakingTempsByExtendedBoluses())
|
if (eb != null && ConfigBuilderPlugin.getPlugin().getActivePump().isFakingTempsByExtendedBoluses())
|
||||||
return new TemporaryBasal(eb);
|
return new TemporaryBasal(eb);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -451,11 +451,11 @@ public class TreatmentsPlugin extends PluginBase implements TreatmentsInterface
|
||||||
boolean newRecordCreated = MainApp.getDbHelper().createOrUpdate(extendedBolus);
|
boolean newRecordCreated = MainApp.getDbHelper().createOrUpdate(extendedBolus);
|
||||||
if (newRecordCreated) {
|
if (newRecordCreated) {
|
||||||
if (extendedBolus.durationInMinutes == 0) {
|
if (extendedBolus.durationInMinutes == 0) {
|
||||||
if (MainApp.getConfigBuilder().getActivePump().isFakingTempsByExtendedBoluses())
|
if (ConfigBuilderPlugin.getPlugin().getActivePump().isFakingTempsByExtendedBoluses())
|
||||||
NSUpload.uploadTempBasalEnd(extendedBolus.date, true, extendedBolus.pumpId);
|
NSUpload.uploadTempBasalEnd(extendedBolus.date, true, extendedBolus.pumpId);
|
||||||
else
|
else
|
||||||
NSUpload.uploadExtendedBolusEnd(extendedBolus.date, extendedBolus.pumpId);
|
NSUpload.uploadExtendedBolusEnd(extendedBolus.date, extendedBolus.pumpId);
|
||||||
} else if (MainApp.getConfigBuilder().getActivePump().isFakingTempsByExtendedBoluses())
|
} else if (ConfigBuilderPlugin.getPlugin().getActivePump().isFakingTempsByExtendedBoluses())
|
||||||
NSUpload.uploadTempBasalStartAbsolute(new TemporaryBasal(extendedBolus), extendedBolus.insulin);
|
NSUpload.uploadTempBasalStartAbsolute(new TemporaryBasal(extendedBolus), extendedBolus.insulin);
|
||||||
else
|
else
|
||||||
NSUpload.uploadExtendedBolus(extendedBolus);
|
NSUpload.uploadExtendedBolus(extendedBolus);
|
||||||
|
|
|
@ -295,7 +295,7 @@ public class ActionStringHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if ("tddstats".equals(act[0])) {
|
} else if ("tddstats".equals(act[0])) {
|
||||||
Object activePump = MainApp.getConfigBuilder().getActivePump();
|
Object activePump = ConfigBuilderPlugin.getPlugin().getActivePump();
|
||||||
if (activePump != null) {
|
if (activePump != null) {
|
||||||
// check if DB up to date
|
// check if DB up to date
|
||||||
List<TDD> dummies = new LinkedList<TDD>();
|
List<TDD> dummies = new LinkedList<TDD>();
|
||||||
|
@ -307,7 +307,7 @@ public class ActionStringHandler {
|
||||||
rMessage = "OLD DATA - ";
|
rMessage = "OLD DATA - ";
|
||||||
|
|
||||||
//if pump is not busy: try to fetch data
|
//if pump is not busy: try to fetch data
|
||||||
final PumpInterface pump = MainApp.getConfigBuilder().getActivePump();
|
final PumpInterface pump = ConfigBuilderPlugin.getPlugin().getActivePump();
|
||||||
if (pump.isBusy()) {
|
if (pump.isBusy()) {
|
||||||
rMessage += MainApp.gs(R.string.pumpbusy);
|
rMessage += MainApp.gs(R.string.pumpbusy);
|
||||||
} else {
|
} else {
|
||||||
|
@ -398,7 +398,7 @@ public class ActionStringHandler {
|
||||||
|
|
||||||
double refTDD = profile.baseBasalSum() * 2;
|
double refTDD = profile.baseBasalSum() * 2;
|
||||||
|
|
||||||
PumpInterface pump = MainApp.getConfigBuilder().getActivePump();
|
PumpInterface pump = ConfigBuilderPlugin.getPlugin().getActivePump();
|
||||||
if (df.format(new Date(historyList.get(0).date)).equals(df.format(new Date()))) {
|
if (df.format(new Date(historyList.get(0).date)).equals(df.format(new Date()))) {
|
||||||
double tdd = historyList.get(0).getTotal();
|
double tdd = historyList.get(0).getTotal();
|
||||||
historyList.remove(0);
|
historyList.remove(0);
|
||||||
|
@ -447,7 +447,7 @@ public class ActionStringHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isOldData(List<TDD> historyList) {
|
public static boolean isOldData(List<TDD> historyList) {
|
||||||
Object activePump = MainApp.getConfigBuilder().getActivePump();
|
Object activePump = ConfigBuilderPlugin.getPlugin().getActivePump();
|
||||||
PumpInterface dana = MainApp.getSpecificPlugin(DanaRPlugin.class);
|
PumpInterface dana = MainApp.getSpecificPlugin(DanaRPlugin.class);
|
||||||
PumpInterface danaRS = MainApp.getSpecificPlugin(DanaRSPlugin.class);
|
PumpInterface danaRS = MainApp.getSpecificPlugin(DanaRSPlugin.class);
|
||||||
PumpInterface danaV2 = MainApp.getSpecificPlugin(DanaRv2Plugin.class);
|
PumpInterface danaV2 = MainApp.getSpecificPlugin(DanaRv2Plugin.class);
|
||||||
|
@ -498,7 +498,7 @@ public class ActionStringHandler {
|
||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
private static String getPumpStatus() {
|
private static String getPumpStatus() {
|
||||||
return ConfigBuilderPlugin.getActivePump().shortStatus(false);
|
return ConfigBuilderPlugin.getPlugin().getActivePump().shortStatus(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
|
@ -582,7 +582,7 @@ public class ActionStringHandler {
|
||||||
ret += MainApp.gs(R.string.canceltemp) + "\n";
|
ret += MainApp.gs(R.string.canceltemp) + "\n";
|
||||||
} else {
|
} else {
|
||||||
ret += MainApp.gs(R.string.rate) + ": " + DecimalFormatter.to2Decimal(result.rate) + " U/h " +
|
ret += MainApp.gs(R.string.rate) + ": " + DecimalFormatter.to2Decimal(result.rate) + " U/h " +
|
||||||
"(" + DecimalFormatter.to2Decimal(result.rate / ConfigBuilderPlugin.getActivePump().getBaseBasalRate() * 100) + "%)\n" +
|
"(" + DecimalFormatter.to2Decimal(result.rate / ConfigBuilderPlugin.getPlugin().getActivePump().getBaseBasalRate() * 100) + "%)\n" +
|
||||||
MainApp.gs(R.string.duration) + ": " + DecimalFormatter.to0Decimal(result.duration) + " min\n";
|
MainApp.gs(R.string.duration) + ": " + DecimalFormatter.to0Decimal(result.duration) + " min\n";
|
||||||
}
|
}
|
||||||
ret += "\n" + MainApp.gs(R.string.reason) + ": " + result.reason;
|
ret += "\n" + MainApp.gs(R.string.reason) + ": " + result.reason;
|
||||||
|
@ -732,7 +732,7 @@ public class ActionStringHandler {
|
||||||
detailedBolusInfo.insulin = amount;
|
detailedBolusInfo.insulin = amount;
|
||||||
detailedBolusInfo.carbs = carbs;
|
detailedBolusInfo.carbs = carbs;
|
||||||
detailedBolusInfo.source = Source.USER;
|
detailedBolusInfo.source = Source.USER;
|
||||||
if (detailedBolusInfo.insulin > 0 || ConfigBuilderPlugin.getActivePump().getPumpDescription().storesCarbInfo) {
|
if (detailedBolusInfo.insulin > 0 || ConfigBuilderPlugin.getPlugin().getActivePump().getPumpDescription().storesCarbInfo) {
|
||||||
ConfigBuilderPlugin.getCommandQueue().bolus(detailedBolusInfo, new Callback() {
|
ConfigBuilderPlugin.getCommandQueue().bolus(detailedBolusInfo, new Callback() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
|
|
@ -209,7 +209,7 @@ public class WatchUpdaterService extends WearableListenerService implements
|
||||||
}
|
}
|
||||||
|
|
||||||
private void cancelBolus() {
|
private void cancelBolus() {
|
||||||
ConfigBuilderPlugin.getActivePump().stopBolusDelivering();
|
ConfigBuilderPlugin.getPlugin().getActivePump().stopBolusDelivering();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void sendData() {
|
private void sendData() {
|
||||||
|
|
|
@ -245,7 +245,7 @@ public class CommandQueue {
|
||||||
}
|
}
|
||||||
removeAll(Command.CommandType.BOLUS);
|
removeAll(Command.CommandType.BOLUS);
|
||||||
removeAll(Command.CommandType.SMB_BOLUS);
|
removeAll(Command.CommandType.SMB_BOLUS);
|
||||||
ConfigBuilderPlugin.getActivePump().stopBolusDelivering();
|
ConfigBuilderPlugin.getPlugin().getActivePump().stopBolusDelivering();
|
||||||
}
|
}
|
||||||
|
|
||||||
// returns true if command is queued
|
// returns true if command is queued
|
||||||
|
@ -369,7 +369,7 @@ public class CommandQueue {
|
||||||
|
|
||||||
// Compare with pump limits
|
// Compare with pump limits
|
||||||
Profile.BasalValue[] basalValues = profile.getBasalValues();
|
Profile.BasalValue[] basalValues = profile.getBasalValues();
|
||||||
PumpInterface pump = ConfigBuilderPlugin.getActivePump();
|
PumpInterface pump = ConfigBuilderPlugin.getPlugin().getActivePump();
|
||||||
|
|
||||||
for (Profile.BasalValue basalValue : basalValues) {
|
for (Profile.BasalValue basalValue : basalValues) {
|
||||||
if (basalValue.value < pump.getPumpDescription().basalMinimumRate) {
|
if (basalValue.value < pump.getPumpDescription().basalMinimumRate) {
|
||||||
|
@ -508,7 +508,7 @@ public class CommandQueue {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isThisProfileSet(Profile profile) {
|
public boolean isThisProfileSet(Profile profile) {
|
||||||
PumpInterface activePump = ConfigBuilderPlugin.getActivePump();
|
PumpInterface activePump = ConfigBuilderPlugin.getPlugin().getActivePump();
|
||||||
Profile current = ProfileFunctions.getInstance().getProfile();
|
Profile current = ProfileFunctions.getInstance().getProfile();
|
||||||
if (activePump != null && current != null) {
|
if (activePump != null && current != null) {
|
||||||
boolean result = activePump.isThisProfileSet(profile);
|
boolean result = activePump.isThisProfileSet(profile);
|
||||||
|
|
|
@ -54,7 +54,7 @@ public class QueueThread extends Thread {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
while (true) {
|
while (true) {
|
||||||
PumpInterface pump = ConfigBuilderPlugin.getActivePump();
|
PumpInterface pump = ConfigBuilderPlugin.getPlugin().getActivePump();
|
||||||
if (pump == null) {
|
if (pump == null) {
|
||||||
if (L.isEnabled(L.PUMPQUEUE))
|
if (L.isEnabled(L.PUMPQUEUE))
|
||||||
log.debug("pump == null");
|
log.debug("pump == null");
|
||||||
|
|
|
@ -30,7 +30,7 @@ public class CommandBolus extends Command {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute() {
|
public void execute() {
|
||||||
PumpEnactResult r = ConfigBuilderPlugin.getActivePump().deliverTreatment(detailedBolusInfo);
|
PumpEnactResult r = ConfigBuilderPlugin.getPlugin().getActivePump().deliverTreatment(detailedBolusInfo);
|
||||||
|
|
||||||
BolusProgressDialog.bolusEnded = true;
|
BolusProgressDialog.bolusEnded = true;
|
||||||
MainApp.bus().post(new EventDismissBolusprogressIfRunning(r));
|
MainApp.bus().post(new EventDismissBolusprogressIfRunning(r));
|
||||||
|
|
|
@ -22,7 +22,7 @@ public class CommandCancelExtendedBolus extends Command {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute() {
|
public void execute() {
|
||||||
PumpEnactResult r = ConfigBuilderPlugin.getActivePump().cancelExtendedBolus();
|
PumpEnactResult r = ConfigBuilderPlugin.getPlugin().getActivePump().cancelExtendedBolus();
|
||||||
if (L.isEnabled(L.PUMPQUEUE))
|
if (L.isEnabled(L.PUMPQUEUE))
|
||||||
log.debug("Result success: " + r.success + " enacted: " + r.enacted);
|
log.debug("Result success: " + r.success + " enacted: " + r.enacted);
|
||||||
if (callback != null)
|
if (callback != null)
|
||||||
|
|
|
@ -25,7 +25,7 @@ public class CommandCancelTempBasal extends Command {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute() {
|
public void execute() {
|
||||||
PumpEnactResult r = ConfigBuilderPlugin.getActivePump().cancelTempBasal(enforceNew);
|
PumpEnactResult r = ConfigBuilderPlugin.getPlugin().getActivePump().cancelTempBasal(enforceNew);
|
||||||
if (L.isEnabled(L.PUMPQUEUE))
|
if (L.isEnabled(L.PUMPQUEUE))
|
||||||
log.debug("Result success: " + r.success + " enacted: " + r.enacted);
|
log.debug("Result success: " + r.success + " enacted: " + r.enacted);
|
||||||
if (callback != null)
|
if (callback != null)
|
||||||
|
|
|
@ -27,7 +27,7 @@ public class CommandExtendedBolus extends Command {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute() {
|
public void execute() {
|
||||||
PumpEnactResult r = ConfigBuilderPlugin.getActivePump().setExtendedBolus(insulin, durationInMinutes);
|
PumpEnactResult r = ConfigBuilderPlugin.getPlugin().getActivePump().setExtendedBolus(insulin, durationInMinutes);
|
||||||
if (L.isEnabled(L.PUMPQUEUE))
|
if (L.isEnabled(L.PUMPQUEUE))
|
||||||
log.debug("Result rate: " + insulin + " durationInMinutes: " + durationInMinutes + " success: " + r.success + " enacted: " + r.enacted);
|
log.debug("Result rate: " + insulin + " durationInMinutes: " + durationInMinutes + " success: " + r.success + " enacted: " + r.enacted);
|
||||||
if (callback != null)
|
if (callback != null)
|
||||||
|
|
|
@ -24,7 +24,7 @@ public class CommandLoadEvents extends Command {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute() {
|
public void execute() {
|
||||||
PumpInterface pump = ConfigBuilderPlugin.getActivePump();
|
PumpInterface pump = ConfigBuilderPlugin.getPlugin().getActivePump();
|
||||||
if (pump instanceof DanaRInterface) {
|
if (pump instanceof DanaRInterface) {
|
||||||
DanaRInterface danaPump = (DanaRInterface) pump;
|
DanaRInterface danaPump = (DanaRInterface) pump;
|
||||||
PumpEnactResult r = danaPump.loadEvents();
|
PumpEnactResult r = danaPump.loadEvents();
|
||||||
|
|
|
@ -27,7 +27,7 @@ public class CommandLoadHistory extends Command {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute() {
|
public void execute() {
|
||||||
PumpInterface pump = ConfigBuilderPlugin.getActivePump();
|
PumpInterface pump = ConfigBuilderPlugin.getPlugin().getActivePump();
|
||||||
if (pump instanceof DanaRInterface) {
|
if (pump instanceof DanaRInterface) {
|
||||||
DanaRInterface danaPump = (DanaRInterface) pump;
|
DanaRInterface danaPump = (DanaRInterface) pump;
|
||||||
PumpEnactResult r = danaPump.loadHistory(type);
|
PumpEnactResult r = danaPump.loadHistory(type);
|
||||||
|
|
|
@ -24,7 +24,7 @@ public class CommandLoadTDDs extends Command {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute() {
|
public void execute() {
|
||||||
PumpInterface pump = ConfigBuilderPlugin.getActivePump();
|
PumpInterface pump = ConfigBuilderPlugin.getPlugin().getActivePump();
|
||||||
PumpEnactResult r = pump.loadTDDs();
|
PumpEnactResult r = pump.loadTDDs();
|
||||||
if (L.isEnabled(L.PUMPQUEUE))
|
if (L.isEnabled(L.PUMPQUEUE))
|
||||||
log.debug("Result success: " + r.success + " enacted: " + r.enacted);
|
log.debug("Result success: " + r.success + " enacted: " + r.enacted);
|
||||||
|
|
|
@ -28,11 +28,11 @@ public class CommandReadStatus extends Command {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute() {
|
public void execute() {
|
||||||
ConfigBuilderPlugin.getActivePump().getPumpStatus();
|
ConfigBuilderPlugin.getPlugin().getActivePump().getPumpStatus();
|
||||||
LocalAlertUtils.notifyPumpStatusRead();
|
LocalAlertUtils.notifyPumpStatusRead();
|
||||||
if (L.isEnabled(L.PUMPQUEUE))
|
if (L.isEnabled(L.PUMPQUEUE))
|
||||||
log.debug("CommandReadStatus executed. Reason: " + reason);
|
log.debug("CommandReadStatus executed. Reason: " + reason);
|
||||||
final PumpInterface pump = ConfigBuilderPlugin.getActivePump();
|
final PumpInterface pump = ConfigBuilderPlugin.getPlugin().getActivePump();
|
||||||
PumpEnactResult result = new PumpEnactResult().success(false);
|
PumpEnactResult result = new PumpEnactResult().success(false);
|
||||||
if (pump != null) {
|
if (pump != null) {
|
||||||
long lastConnection = pump.lastDataTime();
|
long lastConnection = pump.lastDataTime();
|
||||||
|
|
|
@ -37,7 +37,7 @@ public class CommandSMBBolus extends Command {
|
||||||
log.debug("SMB requsted but still in 3 min interval");
|
log.debug("SMB requsted but still in 3 min interval");
|
||||||
r = new PumpEnactResult().enacted(false).success(false).comment("SMB requsted but still in 3 min interval");
|
r = new PumpEnactResult().enacted(false).success(false).comment("SMB requsted but still in 3 min interval");
|
||||||
} else if (detailedBolusInfo.deliverAt != 0 && detailedBolusInfo.deliverAt + T.mins(1).msecs() > System.currentTimeMillis()) {
|
} else if (detailedBolusInfo.deliverAt != 0 && detailedBolusInfo.deliverAt + T.mins(1).msecs() > System.currentTimeMillis()) {
|
||||||
r = ConfigBuilderPlugin.getActivePump().deliverTreatment(detailedBolusInfo);
|
r = ConfigBuilderPlugin.getPlugin().getActivePump().deliverTreatment(detailedBolusInfo);
|
||||||
} else {
|
} else {
|
||||||
r = new PumpEnactResult().enacted(false).success(false).comment("SMB request too old");
|
r = new PumpEnactResult().enacted(false).success(false).comment("SMB request too old");
|
||||||
if (L.isEnabled(L.PUMPQUEUE))
|
if (L.isEnabled(L.PUMPQUEUE))
|
||||||
|
|
|
@ -41,7 +41,7 @@ public class CommandSetProfile extends Command {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
PumpEnactResult r = ConfigBuilderPlugin.getActivePump().setNewBasalProfile(profile);
|
PumpEnactResult r = ConfigBuilderPlugin.getPlugin().getActivePump().setNewBasalProfile(profile);
|
||||||
if (L.isEnabled(L.PUMPQUEUE))
|
if (L.isEnabled(L.PUMPQUEUE))
|
||||||
log.debug("Result success: " + r.success + " enacted: " + r.enacted + " profile: " + profile.toString());
|
log.debug("Result success: " + r.success + " enacted: " + r.enacted + " profile: " + profile.toString());
|
||||||
if (callback != null)
|
if (callback != null)
|
||||||
|
|
|
@ -24,7 +24,7 @@ public class CommandSetUserSettings extends Command {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute() {
|
public void execute() {
|
||||||
PumpInterface pump = ConfigBuilderPlugin.getActivePump();
|
PumpInterface pump = ConfigBuilderPlugin.getPlugin().getActivePump();
|
||||||
if (pump instanceof DanaRInterface) {
|
if (pump instanceof DanaRInterface) {
|
||||||
DanaRInterface danaPump = (DanaRInterface) pump;
|
DanaRInterface danaPump = (DanaRInterface) pump;
|
||||||
PumpEnactResult r = danaPump.setUserOptions();
|
PumpEnactResult r = danaPump.setUserOptions();
|
||||||
|
|
|
@ -32,7 +32,7 @@ public class CommandTempBasalAbsolute extends Command {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute() {
|
public void execute() {
|
||||||
PumpEnactResult r = ConfigBuilderPlugin.getActivePump().setTempBasalAbsolute(absoluteRate, durationInMinutes, profile, enforceNew);
|
PumpEnactResult r = ConfigBuilderPlugin.getPlugin().getActivePump().setTempBasalAbsolute(absoluteRate, durationInMinutes, profile, enforceNew);
|
||||||
if (L.isEnabled(L.PUMPQUEUE))
|
if (L.isEnabled(L.PUMPQUEUE))
|
||||||
log.debug("Result rate: " + absoluteRate + " durationInMinutes: " + durationInMinutes + " success: " + r.success + " enacted: " + r.enacted);
|
log.debug("Result rate: " + absoluteRate + " durationInMinutes: " + durationInMinutes + " success: " + r.success + " enacted: " + r.enacted);
|
||||||
if (callback != null)
|
if (callback != null)
|
||||||
|
|
|
@ -32,7 +32,7 @@ public class CommandTempBasalPercent extends Command {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute() {
|
public void execute() {
|
||||||
PumpEnactResult r = ConfigBuilderPlugin.getActivePump().setTempBasalPercent(percent, durationInMinutes, profile, enforceNew);
|
PumpEnactResult r = ConfigBuilderPlugin.getPlugin().getActivePump().setTempBasalPercent(percent, durationInMinutes, profile, enforceNew);
|
||||||
if (L.isEnabled(L.PUMPQUEUE))
|
if (L.isEnabled(L.PUMPQUEUE))
|
||||||
log.debug("Result percent: " + percent + " durationInMinutes: " + durationInMinutes + " success: " + r.success + " enacted: " + r.enacted);
|
log.debug("Result percent: " + percent + " durationInMinutes: " + durationInMinutes + " success: " + r.success + " enacted: " + r.enacted);
|
||||||
if (callback != null)
|
if (callback != null)
|
||||||
|
|
|
@ -60,7 +60,7 @@ public class KeepAliveReceiver extends BroadcastReceiver {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkPump() {
|
private void checkPump() {
|
||||||
final PumpInterface pump = ConfigBuilderPlugin.getActivePump();
|
final PumpInterface pump = ConfigBuilderPlugin.getPlugin().getActivePump();
|
||||||
final Profile profile = ProfileFunctions.getInstance().getProfile();
|
final Profile profile = ProfileFunctions.getInstance().getProfile();
|
||||||
if (pump != null && profile != null) {
|
if (pump != null && profile != null) {
|
||||||
long lastConnection = pump.lastDataTime();
|
long lastConnection = pump.lastDataTime();
|
||||||
|
|
|
@ -317,18 +317,18 @@ public class SWDefinition {
|
||||||
.add(new SWButton()
|
.add(new SWButton()
|
||||||
.text(R.string.pumpsetup)
|
.text(R.string.pumpsetup)
|
||||||
.action(() -> {
|
.action(() -> {
|
||||||
final PluginBase plugin = (PluginBase) MainApp.getConfigBuilder().getActivePump();
|
final PluginBase plugin = (PluginBase) ConfigBuilderPlugin.getPlugin().getActivePump();
|
||||||
PasswordProtection.QueryPassword(activity, R.string.settings_password, "settings_password", () -> {
|
PasswordProtection.QueryPassword(activity, R.string.settings_password, "settings_password", () -> {
|
||||||
Intent i = new Intent(activity, PreferencesActivity.class);
|
Intent i = new Intent(activity, PreferencesActivity.class);
|
||||||
i.putExtra("id", plugin.getPreferencesId());
|
i.putExtra("id", plugin.getPreferencesId());
|
||||||
activity.startActivity(i);
|
activity.startActivity(i);
|
||||||
}, null);
|
}, null);
|
||||||
})
|
})
|
||||||
.visibility(() -> ((PluginBase) MainApp.getConfigBuilder().getActivePump()).getPreferencesId() > 0))
|
.visibility(() -> ((PluginBase) ConfigBuilderPlugin.getPlugin().getActivePump()).getPreferencesId() > 0))
|
||||||
.add(new SWButton()
|
.add(new SWButton()
|
||||||
.text(R.string.readstatus)
|
.text(R.string.readstatus)
|
||||||
.action(() -> ConfigBuilderPlugin.getCommandQueue().readStatus("Clicked connect to pump", null))
|
.action(() -> ConfigBuilderPlugin.getCommandQueue().readStatus("Clicked connect to pump", null))
|
||||||
.visibility(() -> MainApp.getConfigBuilder().getActivePump() != null))
|
.visibility(() -> ConfigBuilderPlugin.getPlugin().getActivePump() != null))
|
||||||
.add(new SWEventListener(this)
|
.add(new SWEventListener(this)
|
||||||
.listener(new Object() {
|
.listener(new Object() {
|
||||||
@Subscribe
|
@Subscribe
|
||||||
|
@ -337,7 +337,7 @@ public class SWDefinition {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
.validator(() -> MainApp.getConfigBuilder().getActivePump() != null && MainApp.getConfigBuilder().getActivePump().isInitialized())
|
.validator(() -> ConfigBuilderPlugin.getPlugin().getActivePump() != null && ConfigBuilderPlugin.getPlugin().getActivePump().isInitialized())
|
||||||
)
|
)
|
||||||
.add(new SWScreen(R.string.configbuilder_aps)
|
.add(new SWScreen(R.string.configbuilder_aps)
|
||||||
.skippable(false)
|
.skippable(false)
|
||||||
|
|
|
@ -136,7 +136,7 @@ public class BolusWizard {
|
||||||
calculatedTotalInsulin = 0d;
|
calculatedTotalInsulin = 0d;
|
||||||
}
|
}
|
||||||
|
|
||||||
double bolusStep = ConfigBuilderPlugin.getActivePump().getPumpDescription().bolusStep;
|
double bolusStep = ConfigBuilderPlugin.getPlugin().getActivePump().getPumpDescription().bolusStep;
|
||||||
calculatedTotalInsulin = Round.roundTo(calculatedTotalInsulin, bolusStep);
|
calculatedTotalInsulin = Round.roundTo(calculatedTotalInsulin, bolusStep);
|
||||||
|
|
||||||
log.debug(log());
|
log.debug(log());
|
||||||
|
|
|
@ -46,13 +46,13 @@ public class DecimalFormatter {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String toPumpSupportedBolus(double value) {
|
public static String toPumpSupportedBolus(double value) {
|
||||||
return ConfigBuilderPlugin.getActivePump().getPumpDescription().bolusStep <= 0.051
|
return ConfigBuilderPlugin.getPlugin().getActivePump().getPumpDescription().bolusStep <= 0.051
|
||||||
? to2Decimal(value)
|
? to2Decimal(value)
|
||||||
: to1Decimal(value);
|
: to1Decimal(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static DecimalFormat pumpSupportedBolusFormat() {
|
public static DecimalFormat pumpSupportedBolusFormat() {
|
||||||
return ConfigBuilderPlugin.getActivePump().getPumpDescription().bolusStep <= 0.051
|
return ConfigBuilderPlugin.getPlugin().getActivePump().getPumpDescription().bolusStep <= 0.051
|
||||||
? new DecimalFormat("0.00")
|
? new DecimalFormat("0.00")
|
||||||
: new DecimalFormat("0.0");
|
: new DecimalFormat("0.0");
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,7 +78,7 @@ public class LocalAlertUtils {
|
||||||
public static void notifyPumpStatusRead() {
|
public static void notifyPumpStatusRead() {
|
||||||
//TODO: persist the actual time the pump is read and simplify the whole logic when to alarm
|
//TODO: persist the actual time the pump is read and simplify the whole logic when to alarm
|
||||||
|
|
||||||
final PumpInterface pump = ConfigBuilderPlugin.getActivePump();
|
final PumpInterface pump = ConfigBuilderPlugin.getPlugin().getActivePump();
|
||||||
final Profile profile = ProfileFunctions.getInstance().getProfile();
|
final Profile profile = ProfileFunctions.getInstance().getProfile();
|
||||||
if (pump != null && profile != null) {
|
if (pump != null && profile != null) {
|
||||||
long lastConnection = pump.lastDataTime();
|
long lastConnection = pump.lastDataTime();
|
||||||
|
|
|
@ -114,6 +114,7 @@ public class AAPSMocker {
|
||||||
PowerMockito.mockStatic(ConfigBuilderPlugin.class);
|
PowerMockito.mockStatic(ConfigBuilderPlugin.class);
|
||||||
ConfigBuilderPlugin configBuilderPlugin = mock(ConfigBuilderPlugin.class);
|
ConfigBuilderPlugin configBuilderPlugin = mock(ConfigBuilderPlugin.class);
|
||||||
when(MainApp.getConfigBuilder()).thenReturn(configBuilderPlugin);
|
when(MainApp.getConfigBuilder()).thenReturn(configBuilderPlugin);
|
||||||
|
when(ConfigBuilderPlugin.getPlugin()).thenReturn(configBuilderPlugin);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ConstraintChecker mockConstraintsChecker() {
|
public static ConstraintChecker mockConstraintsChecker() {
|
||||||
|
|
|
@ -15,6 +15,7 @@ import java.util.List;
|
||||||
import info.AAPSMocker;
|
import info.AAPSMocker;
|
||||||
import info.nightscout.androidaps.MainApp;
|
import info.nightscout.androidaps.MainApp;
|
||||||
import info.nightscout.androidaps.db.ProfileSwitch;
|
import info.nightscout.androidaps.db.ProfileSwitch;
|
||||||
|
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
|
||||||
import info.nightscout.utils.DateUtil;
|
import info.nightscout.utils.DateUtil;
|
||||||
import info.nightscout.utils.T;
|
import info.nightscout.utils.T;
|
||||||
|
|
||||||
|
@ -23,7 +24,7 @@ import info.nightscout.utils.T;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@RunWith(PowerMockRunner.class)
|
@RunWith(PowerMockRunner.class)
|
||||||
@PrepareForTest({MainApp.class, Bus.class})
|
@PrepareForTest({MainApp.class, Bus.class, ConfigBuilderPlugin.class})
|
||||||
public class ProfileIntervalsTest {
|
public class ProfileIntervalsTest {
|
||||||
private final long startDate = DateUtil.now();
|
private final long startDate = DateUtil.now();
|
||||||
ProfileIntervals<ProfileSwitch> list = new ProfileIntervals<>();
|
ProfileIntervals<ProfileSwitch> list = new ProfileIntervals<>();
|
||||||
|
@ -89,5 +90,6 @@ public class ProfileIntervalsTest {
|
||||||
AAPSMocker.mockMainApp();
|
AAPSMocker.mockMainApp();
|
||||||
AAPSMocker.mockStrings();
|
AAPSMocker.mockStrings();
|
||||||
AAPSMocker.mockBus();
|
AAPSMocker.mockBus();
|
||||||
|
AAPSMocker.mockConfigBuilder();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -137,7 +137,7 @@ public class ProfileTest {
|
||||||
"03:00 110.0 mmol/U", p.getIsfList());
|
"03:00 110.0 mmol/U", p.getIsfList());
|
||||||
|
|
||||||
// Test hour alignment
|
// Test hour alignment
|
||||||
MainApp.getConfigBuilder().getActivePump().getPumpDescription().is30minBasalRatesCapable = false;
|
ConfigBuilderPlugin.getPlugin().getActivePump().getPumpDescription().is30minBasalRatesCapable = false;
|
||||||
((AAPSMocker.MockedBus) MainApp.bus()).notificationSent = false;
|
((AAPSMocker.MockedBus) MainApp.bus()).notificationSent = false;
|
||||||
p = new Profile(new JSONObject(notAllignedBasalValidProfile), 100, 0);
|
p = new Profile(new JSONObject(notAllignedBasalValidProfile), 100, 0);
|
||||||
p.isValid("Test");
|
p.isValid("Test");
|
||||||
|
@ -151,7 +151,7 @@ public class ProfileTest {
|
||||||
AAPSMocker.mockStrings();
|
AAPSMocker.mockStrings();
|
||||||
AAPSMocker.prepareMockedBus();
|
AAPSMocker.prepareMockedBus();
|
||||||
|
|
||||||
when(MainApp.getConfigBuilder().getActivePump()).thenReturn(pump);
|
when(ConfigBuilderPlugin.getPlugin().getActivePump()).thenReturn(pump);
|
||||||
|
|
||||||
PowerMockito.mockStatic(FabricPrivacy.class);
|
PowerMockito.mockStatic(FabricPrivacy.class);
|
||||||
// PowerMockito.doNothing().when(FabricPrivacy.log(""));
|
// PowerMockito.doNothing().when(FabricPrivacy.log(""));
|
||||||
|
|
|
@ -280,7 +280,7 @@ public class ConstraintsCheckerTest {
|
||||||
when(SP.getString(R.string.key_danars_address, "")).thenReturn("");
|
when(SP.getString(R.string.key_danars_address, "")).thenReturn("");
|
||||||
|
|
||||||
//SafetyPlugin
|
//SafetyPlugin
|
||||||
when(MainApp.getConfigBuilder().getActivePump()).thenReturn(pump);
|
when(ConfigBuilderPlugin.getPlugin().getActivePump()).thenReturn(pump);
|
||||||
|
|
||||||
constraintChecker = new ConstraintChecker(mainApp);
|
constraintChecker = new ConstraintChecker(mainApp);
|
||||||
|
|
||||||
|
|
|
@ -231,7 +231,7 @@ public class SafetyPluginTest {
|
||||||
AAPSMocker.mockBus();
|
AAPSMocker.mockBus();
|
||||||
|
|
||||||
|
|
||||||
when(MainApp.getConfigBuilder().getActivePump()).thenReturn(pump);
|
when(ConfigBuilderPlugin.getPlugin().getActivePump()).thenReturn(pump);
|
||||||
|
|
||||||
safetyPlugin = SafetyPlugin.getPlugin();
|
safetyPlugin = SafetyPlugin.getPlugin();
|
||||||
}
|
}
|
||||||
|
|
|
@ -187,7 +187,7 @@ public class APSResultTest {
|
||||||
ConstraintChecker constraintChecker = AAPSMocker.mockConstraintsChecker();
|
ConstraintChecker constraintChecker = AAPSMocker.mockConstraintsChecker();
|
||||||
|
|
||||||
virtualPumpPlugin = VirtualPumpPlugin.getPlugin();
|
virtualPumpPlugin = VirtualPumpPlugin.getPlugin();
|
||||||
when(ConfigBuilderPlugin.getActivePump()).thenReturn(virtualPumpPlugin);
|
when(ConfigBuilderPlugin.getPlugin().getActivePump()).thenReturn(virtualPumpPlugin);
|
||||||
|
|
||||||
when(constraintChecker.isClosedLoopAllowed()).thenReturn(closedLoopEnabled);
|
when(constraintChecker.isClosedLoopAllowed()).thenReturn(closedLoopEnabled);
|
||||||
|
|
||||||
|
|
|
@ -97,7 +97,7 @@ public class LoopPluginTest {
|
||||||
loopPlugin = LoopPlugin.getPlugin();
|
loopPlugin = LoopPlugin.getPlugin();
|
||||||
virtualPumpPlugin = VirtualPumpPlugin.getPlugin();
|
virtualPumpPlugin = VirtualPumpPlugin.getPlugin();
|
||||||
|
|
||||||
when(ConfigBuilderPlugin.getActivePump()).thenReturn(virtualPumpPlugin);
|
when(ConfigBuilderPlugin.getPlugin().getActivePump()).thenReturn(virtualPumpPlugin);
|
||||||
}
|
}
|
||||||
|
|
||||||
class MockedBus extends Bus {
|
class MockedBus extends Bus {
|
||||||
|
|
|
@ -17,6 +17,7 @@ import org.powermock.modules.junit4.PowerMockRunner;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
|
import info.AAPSMocker;
|
||||||
import info.nightscout.androidaps.Constants;
|
import info.nightscout.androidaps.Constants;
|
||||||
import info.nightscout.androidaps.MainApp;
|
import info.nightscout.androidaps.MainApp;
|
||||||
import info.nightscout.androidaps.data.ConstraintChecker;
|
import info.nightscout.androidaps.data.ConstraintChecker;
|
||||||
|
@ -115,19 +116,15 @@ public class CommandQueueTest extends CommandQueue {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void prepareMock(Double insulin, Integer carbs) throws Exception {
|
private void prepareMock(Double insulin, Integer carbs) throws Exception {
|
||||||
ConfigBuilderPlugin configBuilderPlugin = mock(ConfigBuilderPlugin.class);
|
|
||||||
ConstraintChecker constraintChecker = mock(ConstraintChecker.class);
|
ConstraintChecker constraintChecker = mock(ConstraintChecker.class);
|
||||||
|
|
||||||
PowerMockito.mockStatic(ConfigBuilderPlugin.class);
|
AAPSMocker.mockMainApp();
|
||||||
|
AAPSMocker.mockConfigBuilder();
|
||||||
PumpInterface pump = MDIPlugin.getPlugin();
|
PumpInterface pump = MDIPlugin.getPlugin();
|
||||||
when(ConfigBuilderPlugin.getActivePump()).thenReturn(pump);
|
when(ConfigBuilderPlugin.getPlugin().getActivePump()).thenReturn(pump);
|
||||||
|
|
||||||
PowerMockito.mockStatic(MainApp.class);
|
|
||||||
MainApp mainApp = mock(MainApp.class);
|
|
||||||
when(MainApp.getConfigBuilder()).thenReturn(configBuilderPlugin);
|
|
||||||
when(MainApp.getConstraintChecker()).thenReturn(constraintChecker);
|
when(MainApp.getConstraintChecker()).thenReturn(constraintChecker);
|
||||||
when(MainApp.isEngineeringModeOrRelease()).thenReturn(true);
|
when(MainApp.isEngineeringModeOrRelease()).thenReturn(true);
|
||||||
when(MainApp.instance()).thenReturn(mainApp);
|
|
||||||
Constraint<Double> bolusConstraint = new Constraint<>(0d);
|
Constraint<Double> bolusConstraint = new Constraint<>(0d);
|
||||||
when(MainApp.getConstraintChecker().applyBolusConstraints(any())).thenReturn(bolusConstraint);
|
when(MainApp.getConstraintChecker().applyBolusConstraints(any())).thenReturn(bolusConstraint);
|
||||||
when(MainApp.getConstraintChecker().applyExtendedBolusConstraints(any())).thenReturn(bolusConstraint);
|
when(MainApp.getConstraintChecker().applyExtendedBolusConstraints(any())).thenReturn(bolusConstraint);
|
||||||
|
|
|
@ -7,6 +7,7 @@ import org.powermock.api.mockito.PowerMockito;
|
||||||
import org.powermock.core.classloader.annotations.PrepareForTest;
|
import org.powermock.core.classloader.annotations.PrepareForTest;
|
||||||
import org.powermock.modules.junit4.PowerMockRunner;
|
import org.powermock.modules.junit4.PowerMockRunner;
|
||||||
|
|
||||||
|
import info.AAPSMocker;
|
||||||
import info.nightscout.androidaps.MainApp;
|
import info.nightscout.androidaps.MainApp;
|
||||||
import info.nightscout.androidaps.data.GlucoseStatus;
|
import info.nightscout.androidaps.data.GlucoseStatus;
|
||||||
import info.nightscout.androidaps.data.IobTotal;
|
import info.nightscout.androidaps.data.IobTotal;
|
||||||
|
@ -76,10 +77,10 @@ public class BolusWizardTest {
|
||||||
PowerMockito.mockStatic(MainApp.class);
|
PowerMockito.mockStatic(MainApp.class);
|
||||||
when(TreatmentsPlugin.getPlugin()).thenReturn(treatment);
|
when(TreatmentsPlugin.getPlugin()).thenReturn(treatment);
|
||||||
|
|
||||||
PowerMockito.mockStatic(ConfigBuilderPlugin.class);
|
AAPSMocker.mockConfigBuilder();
|
||||||
PumpInterface pump = MDIPlugin.getPlugin();
|
PumpInterface pump = MDIPlugin.getPlugin();
|
||||||
pump.getPumpDescription().bolusStep = PUMP_BOLUS_STEP;
|
pump.getPumpDescription().bolusStep = PUMP_BOLUS_STEP;
|
||||||
when(ConfigBuilderPlugin.getActivePump()).thenReturn(pump);
|
when(ConfigBuilderPlugin.getPlugin().getActivePump()).thenReturn(pump);
|
||||||
|
|
||||||
return profile;
|
return profile;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue