move applyAPSResult out of pump interface
This commit is contained in:
parent
56225f1851
commit
c16ad7e37d
|
@ -33,7 +33,6 @@ public interface PumpInterface {
|
|||
PumpEnactResult setExtendedBolus(Double insulin, Integer durationInMinutes);
|
||||
PumpEnactResult cancelTempBasal();
|
||||
PumpEnactResult cancelExtendedBolus();
|
||||
PumpEnactResult applyAPSRequest(APSResult request);
|
||||
|
||||
// Status to be passed to NS
|
||||
JSONObject getJSONStatus();
|
||||
|
|
|
@ -144,6 +144,7 @@ public class ConfigBuilderFragment extends Fragment implements PluginBase, PumpI
|
|||
}
|
||||
|
||||
void setViews() {
|
||||
// TODO: hide empty categories
|
||||
bgsourceDataAdapter = new PluginCustomAdapter(getContext(), R.layout.configbuilder_simpleitem, MainActivity.getSpecificPluginsList(PluginBase.BGSOURCE));
|
||||
bgsourceListView.setAdapter(bgsourceDataAdapter);
|
||||
setListViewHeightBasedOnChildren(bgsourceListView);
|
||||
|
@ -365,7 +366,7 @@ public class ConfigBuilderFragment extends Fragment implements PluginBase, PumpI
|
|||
* @param request
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
|
||||
public PumpEnactResult applyAPSRequest(APSResult request) {
|
||||
request.rate = applyBasalConstraints(request.rate);
|
||||
PumpEnactResult result = null;
|
||||
|
|
|
@ -39,6 +39,7 @@ import info.nightscout.androidaps.interfaces.APSInterface;
|
|||
import info.nightscout.androidaps.interfaces.ConstraintsInterface;
|
||||
import info.nightscout.androidaps.interfaces.PluginBase;
|
||||
import info.nightscout.androidaps.interfaces.PumpInterface;
|
||||
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderFragment;
|
||||
|
||||
public class LoopFragment extends Fragment implements View.OnClickListener, PluginBase {
|
||||
private static Logger log = LoggerFactory.getLogger(LoopFragment.class);
|
||||
|
@ -226,10 +227,10 @@ public class LoopFragment extends Fragment implements View.OnClickListener, Plug
|
|||
});
|
||||
return;
|
||||
}
|
||||
PumpInterface pumpInterface = MainApp.getConfigBuilder().getActivePump();
|
||||
ConfigBuilderFragment configBuilder = MainApp.getConfigBuilder();
|
||||
APSResult result = null;
|
||||
|
||||
if (constraintsInterface == null || pumpInterface == null || !isEnabled())
|
||||
if (constraintsInterface == null || configBuilder == null || !isEnabled())
|
||||
return;
|
||||
|
||||
APSInterface usedAPS = null;
|
||||
|
@ -274,7 +275,7 @@ public class LoopFragment extends Fragment implements View.OnClickListener, Plug
|
|||
|
||||
if (constraintsInterface.isClosedModeEnabled()) {
|
||||
if (result.changeRequested) {
|
||||
PumpEnactResult applyResult = pumpInterface.applyAPSRequest(resultAfterConstraints);
|
||||
PumpEnactResult applyResult = configBuilder.applyAPSRequest(resultAfterConstraints);
|
||||
if (applyResult.enacted) {
|
||||
lastRun.setByPump = applyResult;
|
||||
lastRun.lastEnact = lastRun.lastAPSRun;
|
||||
|
|
|
@ -240,7 +240,7 @@ public class OverviewFragment extends Fragment implements PluginBase {
|
|||
builder.setMessage(getContext().getString(R.string.setbasalquestion) + "\n" + finalLastRun.constraintsProcessed);
|
||||
builder.setPositiveButton(getContext().getString(R.string.ok), new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
PumpEnactResult applyResult = MainApp.getConfigBuilder().getActivePump().applyAPSRequest(finalLastRun.constraintsProcessed);
|
||||
PumpEnactResult applyResult = MainApp.getConfigBuilder().applyAPSRequest(finalLastRun.constraintsProcessed);
|
||||
if (applyResult.enacted) {
|
||||
finalLastRun.setByPump = applyResult;
|
||||
finalLastRun.lastEnact = new Date();
|
||||
|
|
|
@ -51,6 +51,8 @@ public class VirtualPumpFragment extends Fragment implements PluginBase, PumpInt
|
|||
boolean fragmentVisible = true;
|
||||
boolean visibleNow = false;
|
||||
|
||||
// TODO: upload pump status without Loop plugin too
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return MainApp.instance().getString(R.string.virtualpump);
|
||||
|
@ -342,12 +344,6 @@ public class VirtualPumpFragment extends Fragment implements PluginBase, PumpInt
|
|||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PumpEnactResult applyAPSRequest(APSResult request) {
|
||||
// This should be implemented only on ConfigBuilder
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject getJSONStatus() {
|
||||
JSONObject pump = new JSONObject();
|
||||
|
|
Loading…
Reference in a new issue