allow automated actions only whem pump is initialized
This commit is contained in:
parent
86a3df1996
commit
e8d169f078
6 changed files with 34 additions and 4 deletions
|
@ -16,6 +16,8 @@ import info.nightscout.client.data.NSProfile;
|
|||
*/
|
||||
public interface PumpInterface {
|
||||
|
||||
boolean isInitialized();
|
||||
|
||||
boolean isTempBasalInProgress();
|
||||
boolean isExtendedBoluslInProgress();
|
||||
|
||||
|
|
|
@ -294,10 +294,15 @@ public class ConfigBuilderPlugin implements PluginBase, PumpInterface, Constrain
|
|||
}
|
||||
|
||||
/*
|
||||
* Pump interface
|
||||
*
|
||||
* Config builder return itself as a pump and check constraints before it passes command to pump driver
|
||||
*/
|
||||
* Pump interface
|
||||
*
|
||||
* Config builder return itself as a pump and check constraints before it passes command to pump driver
|
||||
*/
|
||||
@Override
|
||||
public boolean isInitialized() {
|
||||
return activePump.isInitialized();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isTempBasalInProgress() {
|
||||
return activePump.isTempBasalInProgress();
|
||||
|
@ -527,6 +532,13 @@ public class ConfigBuilderPlugin implements PluginBase, PumpInterface, Constrain
|
|||
request.rate = applyBasalConstraints(request.rate);
|
||||
PumpEnactResult result;
|
||||
|
||||
if (!isInitialized()) {
|
||||
result = new PumpEnactResult();
|
||||
result.comment = MainApp.sResources.getString(R.string.pumpNotInitialized);
|
||||
result.enacted = false;
|
||||
result.success = false;
|
||||
}
|
||||
|
||||
if (Config.logCongigBuilderActions)
|
||||
log.debug("applyAPSRequest: " + request.toString());
|
||||
if ((request.rate == 0 && request.duration == 0) || Math.abs(request.rate - getBaseBasalRate()) < 0.05) {
|
||||
|
|
|
@ -150,6 +150,11 @@ public class DanaRPlugin implements PluginBase, PumpInterface, ConstraintsInterf
|
|||
this.fragmentPumpVisible = fragmentVisible;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInitialized() {
|
||||
return getDanaRPump().lastConnection.getTime() > 0;
|
||||
}
|
||||
|
||||
// Pump interface
|
||||
@Override
|
||||
public boolean isTempBasalInProgress() {
|
||||
|
|
|
@ -94,6 +94,11 @@ public class MM640gPlugin implements PluginBase, PumpInterface, BgSourceInterfac
|
|||
* Pump Interface
|
||||
*/
|
||||
|
||||
@Override
|
||||
public boolean isInitialized() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isTempBasalInProgress() {
|
||||
return false;
|
||||
|
|
|
@ -77,6 +77,11 @@ public class VirtualPumpPlugin implements PluginBase, PumpInterface {
|
|||
return PluginBase.PUMP;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInitialized() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isTempBasalInProgress() {
|
||||
return getTempBasal() != null;
|
||||
|
|
|
@ -339,4 +339,5 @@
|
|||
<string name="ns_upload_only">NS upload only (disabled sync)</string>
|
||||
<string name="ns_upload_only_summary">NS upload only. Not effective on SGV unless a local source like xDrip is selected. Not effective on Profiles while NS-Profiles is used.</string>
|
||||
<string name="ns_upload_only_enabled">Please deactivate "NS upload only" to use this feature.</string>
|
||||
<string name="pumpNotInitialized">Pump not initialized!</string>
|
||||
</resources>
|
||||
|
|
Loading…
Reference in a new issue