mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-08-26 09:11:37 +02:00
Lefun: Allow keeping request in queue (for multirecord responses)
This commit is contained in:
parent
4992e4c15b
commit
9fbfee945c
@ -283,6 +283,7 @@ public class LefunDeviceSupport extends AbstractBTLEDeviceSupport {
|
|||||||
if (req.expectsResponse() && req.getCommandId() == commandId) {
|
if (req.expectsResponse() && req.getCommandId() == commandId) {
|
||||||
try {
|
try {
|
||||||
req.handleResponse(data);
|
req.handleResponse(data);
|
||||||
|
if (req.shouldRemoveAfterHandling())
|
||||||
inProgressRequests.remove(req);
|
inProgressRequests.remove(req);
|
||||||
return true;
|
return true;
|
||||||
} catch (IllegalArgumentException e) {
|
} catch (IllegalArgumentException e) {
|
||||||
|
@ -35,6 +35,7 @@ import nodomain.freeyourgadget.gadgetbridge.util.GB;
|
|||||||
// Ripped from nodomain.freeyourgadget.gadgetbridge.service.devices.qhybrid.requests.Request
|
// Ripped from nodomain.freeyourgadget.gadgetbridge.service.devices.qhybrid.requests.Request
|
||||||
public abstract class Request extends AbstractBTLEOperation<LefunDeviceSupport> {
|
public abstract class Request extends AbstractBTLEOperation<LefunDeviceSupport> {
|
||||||
protected TransactionBuilder builder;
|
protected TransactionBuilder builder;
|
||||||
|
protected boolean removeAfterHandling = true;
|
||||||
private Logger logger = (Logger) LoggerFactory.getLogger(getName());
|
private Logger logger = (Logger) LoggerFactory.getLogger(getName());
|
||||||
|
|
||||||
protected Request(LefunDeviceSupport support, TransactionBuilder builder) {
|
protected Request(LefunDeviceSupport support, TransactionBuilder builder) {
|
||||||
@ -71,6 +72,10 @@ public abstract class Request extends AbstractBTLEOperation<LefunDeviceSupport>
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean shouldRemoveAfterHandling() {
|
||||||
|
return removeAfterHandling;
|
||||||
|
}
|
||||||
|
|
||||||
protected void reportFailure(String message) {
|
protected void reportFailure(String message) {
|
||||||
GB.toast(getContext(), message, Toast.LENGTH_SHORT, GB.ERROR);
|
GB.toast(getContext(), message, Toast.LENGTH_SHORT, GB.ERROR);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user