setDanaConnection if not exists
This commit is contained in:
parent
b81cf8341b
commit
7fc939f179
|
@ -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)
|
||||||
|
setDanaConnection(new DanaConnection(MainApp.bus()));
|
||||||
getDanaConnection().connectIfNotConnected("Connect request from GUI");
|
getDanaConnection().connectIfNotConnected("Connect request from GUI");
|
||||||
else
|
|
||||||
log.error("Connect req from GUI: getDanaConnection() is null");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@ -292,11 +291,11 @@ 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)
|
||||||
|
setDanaConnection(new DanaConnection(MainApp.bus()));
|
||||||
getDanaConnection().connectIfNotConnected("setNewBasalProfile");
|
getDanaConnection().connectIfNotConnected("setNewBasalProfile");
|
||||||
getDanaConnection().updateBasalsInPump(profile);
|
getDanaConnection().updateBasalsInPump(profile);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double getBaseBasalRate() {
|
public double getBaseBasalRate() {
|
||||||
|
@ -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