mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2025-01-12 02:45:49 +01:00
Lefun: Allow keeping request in queue (for multirecord responses)
This commit is contained in:
parent
4992e4c15b
commit
9fbfee945c
@ -283,7 +283,8 @@ public class LefunDeviceSupport extends AbstractBTLEDeviceSupport {
|
||||
if (req.expectsResponse() && req.getCommandId() == commandId) {
|
||||
try {
|
||||
req.handleResponse(data);
|
||||
inProgressRequests.remove(req);
|
||||
if (req.shouldRemoveAfterHandling())
|
||||
inProgressRequests.remove(req);
|
||||
return true;
|
||||
} catch (IllegalArgumentException e) {
|
||||
LOG.error("Failed to handle response", e);
|
||||
|
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user