1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-07-23 07:11:52 +02:00

Lefun: Allow keeping request in queue (for multirecord responses)

This commit is contained in:
Yukai Li 2020-10-04 21:47:27 -06:00 committed by Gitea
parent 4992e4c15b
commit 9fbfee945c
2 changed files with 7 additions and 1 deletions

View File

@ -283,6 +283,7 @@ public class LefunDeviceSupport extends AbstractBTLEDeviceSupport {
if (req.expectsResponse() && req.getCommandId() == commandId) {
try {
req.handleResponse(data);
if (req.shouldRemoveAfterHandling())
inProgressRequests.remove(req);
return true;
} catch (IllegalArgumentException e) {

View File

@ -35,6 +35,7 @@ import nodomain.freeyourgadget.gadgetbridge.util.GB;
// Ripped from nodomain.freeyourgadget.gadgetbridge.service.devices.qhybrid.requests.Request
public abstract class Request extends AbstractBTLEOperation<LefunDeviceSupport> {
protected TransactionBuilder builder;
protected boolean removeAfterHandling = true;
private Logger logger = (Logger) LoggerFactory.getLogger(getName());
protected Request(LefunDeviceSupport support, TransactionBuilder builder) {
@ -71,6 +72,10 @@ public abstract class Request extends AbstractBTLEOperation<LefunDeviceSupport>
return true;
}
public boolean shouldRemoveAfterHandling() {
return removeAfterHandling;
}
protected void reportFailure(String message) {
GB.toast(getContext(), message, Toast.LENGTH_SHORT, GB.ERROR);
}