Clearing the task queues on disconnection

This commit is contained in:
Aleksander Nowakowski
2017-03-15 12:32:35 +01:00
parent 38546cf4a0
commit a01d3d5b41
2 changed files with 4 additions and 0 deletions

View File

@@ -1182,6 +1182,8 @@ public abstract class BleManager<E extends BleManagerCallbacks> implements ILogg
Logger.w(mLogSession, "Error: (0x" + Integer.toHexString(status) + "): " + GattError.parseConnectionError(status)); Logger.w(mLogSession, "Error: (0x" + Integer.toHexString(status) + "): " + GattError.parseConnectionError(status));
mOperationInProgress = true; // no more calls are possible mOperationInProgress = true; // no more calls are possible
mInitQueue.clear();
mTaskQueue.clear();
if (mConnected) { if (mConnected) {
notifyDeviceDisconnected(gatt.getDevice()); notifyDeviceDisconnected(gatt.getDevice());
} }

View File

@@ -611,6 +611,8 @@ public class BleManager implements BleProfileApi {
} else { } else {
if (newState == BluetoothProfile.STATE_DISCONNECTED) { if (newState == BluetoothProfile.STATE_DISCONNECTED) {
mOperationInProgress = true; // no more calls are possible mOperationInProgress = true; // no more calls are possible
mInitQueue.clear();
mTaskQueue.clear();
if (mConnected) { if (mConnected) {
notifyDeviceDisconnected(gatt.getDevice()); notifyDeviceDisconnected(gatt.getDevice());
} }