setDanaConnection if not exists
This commit is contained in:
parent
b81cf8341b
commit
7fc939f179
1 changed files with 8 additions and 11 deletions
|
@ -172,10 +172,9 @@ public class DanaRFragment extends Fragment implements PluginBase, PumpInterface
|
||||||
mHandler.post(new Runnable() {
|
mHandler.post(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
if (getDanaConnection() != null)
|
if (getDanaConnection() == null)
|
||||||
getDanaConnection().connectIfNotConnected("Connect request from GUI");
|
setDanaConnection(new DanaConnection(MainApp.bus()));
|
||||||
else
|
getDanaConnection().connectIfNotConnected("Connect request from GUI");
|
||||||
log.error("Connect req from GUI: getDanaConnection() is null");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@ -265,7 +264,7 @@ public class DanaRFragment extends Fragment implements PluginBase, PumpInterface
|
||||||
public void setFragmentEnabled(int type, boolean fragmentEnabled) {
|
public void setFragmentEnabled(int type, boolean fragmentEnabled) {
|
||||||
if (type == PluginBase.PROFILE) this.fragmentProfileEnabled = fragmentEnabled;
|
if (type == PluginBase.PROFILE) this.fragmentProfileEnabled = fragmentEnabled;
|
||||||
else if (type == PluginBase.PUMP) this.fragmentPumpEnabled = fragmentEnabled;
|
else if (type == PluginBase.PUMP) this.fragmentPumpEnabled = fragmentEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setFragmentVisible(int type, boolean fragmentVisible) {
|
public void setFragmentVisible(int type, boolean fragmentVisible) {
|
||||||
|
@ -292,10 +291,10 @@ public class DanaRFragment extends Fragment implements PluginBase, PumpInterface
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setNewBasalProfile(NSProfile profile) {
|
public void setNewBasalProfile(NSProfile profile) {
|
||||||
if (getDanaConnection() != null) {
|
if (getDanaConnection() == null)
|
||||||
getDanaConnection().connectIfNotConnected("setNewBasalProfile");
|
setDanaConnection(new DanaConnection(MainApp.bus()));
|
||||||
getDanaConnection().updateBasalsInPump(profile);
|
getDanaConnection().connectIfNotConnected("setNewBasalProfile");
|
||||||
}
|
getDanaConnection().updateBasalsInPump(profile);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -670,13 +669,11 @@ public class DanaRFragment extends Fragment implements PluginBase, PumpInterface
|
||||||
if (!getDanaRPump().isExtendedInProgress) {
|
if (!getDanaRPump().isExtendedInProgress) {
|
||||||
result.success = true;
|
result.success = true;
|
||||||
result.comment = MainApp.instance().getString(R.string.virtualpump_resultok);
|
result.comment = MainApp.instance().getString(R.string.virtualpump_resultok);
|
||||||
result.isTempCancel = true;
|
|
||||||
if (Config.logPumpActions)
|
if (Config.logPumpActions)
|
||||||
log.debug("cancelExtendedBolus: OK");
|
log.debug("cancelExtendedBolus: OK");
|
||||||
return result;
|
return result;
|
||||||
} else {
|
} else {
|
||||||
result.success = false;
|
result.success = false;
|
||||||
result.isTempCancel = true;
|
|
||||||
result.comment = MainApp.instance().getString(R.string.danar_valuenotsetproperly);
|
result.comment = MainApp.instance().getString(R.string.danar_valuenotsetproperly);
|
||||||
log.error("cancelExtendedBolus: Failed to cancel extended bolus");
|
log.error("cancelExtendedBolus: Failed to cancel extended bolus");
|
||||||
return result;
|
return result;
|
||||||
|
|
Loading…
Reference in a new issue