Acknowledge getPumpStatus request in Omnipod plugin when explicitly requested with SMS

This commit is contained in:
Bart Sopers 2020-12-18 01:43:29 +01:00
parent ae175f3b99
commit 078eec82eb
10 changed files with 21 additions and 15 deletions

View file

@ -338,7 +338,7 @@ public class ComboPlugin extends PumpPluginBase implements PumpInterface, Constr
* Runs pump initialization if needed and reads the pump state from the main screen.
*/
@Override
public synchronized void getPumpStatus() {
public synchronized void getPumpStatus(String reason) {
getAapsLogger().debug(LTag.PUMP, "getPumpStatus called");
if (!pump.initialized) {
initializePump();

View file

@ -370,7 +370,7 @@ public class LocalInsightPlugin extends PumpPluginBase implements PumpInterface,
}
@Override
public void getPumpStatus() {
public void getPumpStatus(String reason) {
try {
tbrOverNotificationBlock = ParameterBlockUtil.readParameterBlock(connectionService, Service.CONFIGURATION, TBROverNotificationBlock.class);
readHistory();

View file

@ -132,7 +132,7 @@ public class MDIPlugin extends PumpPluginBase implements PumpInterface {
}
@Override
public void getPumpStatus() {
public void getPumpStatus(String reason) {
}
@NonNull @Override

View file

@ -178,7 +178,7 @@ class VirtualPumpPlugin @Inject constructor(
override fun disconnect(reason: String) {}
override fun stopConnecting() {}
override fun getPumpStatus() {
override fun getPumpStatus(reason: String?) {
lastDataTime = System.currentTimeMillis()
}

View file

@ -11,7 +11,7 @@ import javax.inject.Inject
class CommandReadStatus(
injector: HasAndroidInjector,
private val reason: String,
val reason: String,
callback: Callback?
) : Command(injector, CommandType.READSTATUS, callback) {
@ -19,7 +19,7 @@ class CommandReadStatus(
@Inject lateinit var localAlertUtils: LocalAlertUtils
override fun execute() {
activePlugin.activePump.getPumpStatus()
activePlugin.activePump.getPumpStatus(reason)
localAlertUtils.notifyPumpStatusRead()
aapsLogger.debug(LTag.PUMPQUEUE, "CommandReadStatus executed. Reason: $reason")
val pump = activePlugin.activePump

View file

@ -43,7 +43,7 @@ public interface PumpInterface {
void stopConnecting();
void getPumpStatus();
void getPumpStatus(String reason);
// Upload to pump new basal profile
@NotNull

View file

@ -361,7 +361,7 @@ public abstract class AbstractDanaRPlugin extends PumpPluginBase implements Pump
}
@Override
public void getPumpStatus() {
public void getPumpStatus(String reason) {
if (sExecutionService != null) {
sExecutionService.getPumpStatus();
pumpDescription.basalStep = danaPump.getBasalStep();

View file

@ -165,7 +165,7 @@ class DanaRSPlugin @Inject constructor(
danaRSService?.stopConnecting()
}
override fun getPumpStatus() {
override fun getPumpStatus(reason: String?) {
danaRSService?.readPumpStatus()
pumpDesc.basalStep = danaPump.basalStep
pumpDesc.bolusStep = danaPump.bolusStep

View file

@ -421,7 +421,7 @@ public class MedtronicPumpPlugin extends PumpPluginAbstract implements PumpInter
@Override
public void getPumpStatus() {
public void getPumpStatus(String reason) {
if (firstRun) {
initializePump(!isRefresh);

View file

@ -537,18 +537,24 @@ public class OmnipodPumpPlugin extends PumpPluginBase implements PumpInterface,
/**
* We don't do periodical status requests because that could drain the Pod's battery
* The only actual status requests we send to the Pod here are on startup (in {@link #initializeAfterRileyLinkConnection() initializeAfterRileyLinkConnection()})
* The only actual status requests we send to the Pod here are on startup (in {@link #initializeAfterRileyLinkConnection() initializeAfterRileyLinkConnection()}),
* When explicitly requested through SMS commands
* And when the basal and/or temp basal status is uncertain
* When the user explicitly requested it by clicking the Refresh button on the Omnipod tab (which is executed through {@link #executeCustomCommand(CustomCommand)})
*/
@Override
public void getPumpStatus() {
public void getPumpStatus(String reason) {
if (firstRun) {
initializeAfterRileyLinkConnection();
firstRun = false;
} else if (!podStateManager.isBasalCertain() || !podStateManager.isTempBasalCertain()) {
aapsLogger.info(LTag.PUMP, "Acknowledged AAPS getPumpStatus request because basal and/or temp basal is uncertain");
getPodStatus();
} else {
if ("SMS".equals(reason)) {
aapsLogger.info(LTag.PUMP, "Acknowledged AAPS getPumpStatus request it was requested through an SMS");
getPodStatus();
} else if (!podStateManager.isBasalCertain() || !podStateManager.isTempBasalCertain()) {
aapsLogger.info(LTag.PUMP, "Acknowledged AAPS getPumpStatus request because basal and/or temp basal is uncertain");
getPodStatus();
}
}
}