Hello,
I'm having a problem cancelling a executing split WriteRequest.
The sending of the packets is not stopped.
I think this is because WriteRequest.hasMore() (in BleManagerHandler.onCharacteristicWrite) will always return the next packet.
If we add this following function to the WriteRequest class :
/**
* Cancel split WriteRequest during sending packets (called by BleManagerHandler.cancelCurrent function)
* This will block hasMore function called by BleManagerHandler.onCharacteristicWrite function
*/
void cancel() {
complete = true;
}
And call it it BleManagerHandler.cancelCurrent function (after notifyFail of TimeoutableRequest)
if (request instanceof final TimeoutableRequest r) {
r.notifyFail(device, FailCallback.REASON_CANCELLED);
} else if(request instanceof final WriteRequest r) {
r.cancel();
}
So when WriteRequest.hasMore() is called, the ‘complete’ variable will be set to true and so will not return the next packet (and will not send the next packet).
(I tried to test locally with a fork but Execution failed for task ':ble:signReleasePublication'. error fail publication)
Hello,
I'm having a problem cancelling a executing split WriteRequest.
The sending of the packets is not stopped.
I think this is because WriteRequest.hasMore() (in BleManagerHandler.onCharacteristicWrite) will always return the next packet.
If we add this following function to the WriteRequest class :
And call it it BleManagerHandler.cancelCurrent function (after notifyFail of TimeoutableRequest)
So when WriteRequest.hasMore() is called, the ‘complete’ variable will be set to true and so will not return the next packet (and will not send the next packet).
(I tried to test locally with a fork but
Execution failed for task ':ble:signReleasePublication'.error fail publication)