Mi Bands+Bip: when an operation finishes, unset the gatt callback on the BtLEQeue
Otherwise it will continue to receive events until another transaction is being executed.
This commit is contained in:
parent
c91e14f644
commit
c468e7f521
|
@ -85,6 +85,9 @@ public abstract class AbstractBTLEOperation<T extends AbstractBTLEDeviceSupport>
|
|||
* You MUST call this method when the operation has finished, either
|
||||
* successfully or unsuccessfully.
|
||||
*
|
||||
* Subclasses must ensure that the {@link BtLEQueue queue's}'s gatt callback (set on the transaction builder by {@link #performInitialized(String)})
|
||||
* is being unset, otherwise it will continue to receive events until another transaction is being executed by the queue.
|
||||
*
|
||||
* @throws IOException
|
||||
*/
|
||||
protected void operationFinished() throws IOException {
|
||||
|
|
|
@ -48,6 +48,7 @@ public abstract class AbstractMiBandOperation<T extends AbstractBTLEDeviceSuppor
|
|||
try {
|
||||
TransactionBuilder builder = performInitialized("reenabling disabled notifications");
|
||||
handleFinished(builder);
|
||||
builder.setGattCallback(null); // unset ourselves from being the queue's gatt callback
|
||||
builder.queue(getQueue());
|
||||
} catch (IOException ex) {
|
||||
GB.toast(getContext(), "Error enabling Mi Band notifications, you may need to connect and disconnect", Toast.LENGTH_LONG, GB.ERROR, ex);
|
||||
|
|
Loading…
Reference in New Issue