Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Investigate auto-scanning on RxBleDevice.establishConnection() #318

Open
KarolMB opened this issue Nov 16, 2017 · 6 comments
Open

Investigate auto-scanning on RxBleDevice.establishConnection() #318

KarolMB opened this issue Nov 16, 2017 · 6 comments
Milestone

Comments

@KarolMB
Copy link

KarolMB commented Nov 16, 2017

(Android stack flaw description by @dariuszseweryn)

Android uses 48 bits to "uniquely" identify a device. If the device is obtained solely on providing the "unique" mac address or it was scanned before the BluetoothAdapter was turned on the last time the stack does not know if the address is public or not until the device is scanned again.

Library version

1.4.2

Steps to reproduce actual result


1. Connect with BLE device.

2. Turn off bluetooth on the phone

3. Turn on bluetooth

4. Try to connect again with the same BLE device

Minimum code snippet reproducing the issue

final String bleMac = bleDevice.getMacAddress();
        if (isConnected(bleDevice)) {
            triggerDisconnect(bleDevice);
        } else {
            final Subscription subscription = bleDevice.establishConnection(false)
                    .takeUntil(disconnectTriggerSubject)
                    .flatMap(new Func1<RxBleConnection, Observable<RxBleDeviceServices>>() {
                        @Override
                        public Observable<RxBleDeviceServices> call(RxBleConnection rxBleConnection) {
                            Log.d(TAG, "BLE connection to " + bleMac + " done!");

                            // Add this connection to a map for later use
                            connectionMap.put(bleMac, rxBleConnection);

                            return rxBleConnection.discoverServices();
                        }
                    })
                    .map(new Func1<RxBleDeviceServices, ConnectedDevice>() {
                        @Override
                        public ConnectedDevice call(RxBleDeviceServices rxBleDeviceServices) {
                            Log.d(TAG, "Got service BLE from " + bleMac);

                            BluetoothGattService ngService = null;
                            for (BluetoothGattService service : rxBleDeviceServices.getBluetoothGattServices()) {
                                Log.e(TAG, "ngServices UUID: " + service.getUuid());
                                Log.e(TAG, "ngServices Instance Id: " + service.getInstanceId());
                                if (NG_SERVICE_UUID.equals(service.getUuid())) {
                                    ngService = service;
                                    break;
                                }
                            }

                            // If there are no proper service, just throw an error
                            if (ngService == null) {
                                // try connect again in case of error
                                new Handler(Looper.getMainLooper()).postDelayed(new Runnable() {
                                    @Override
                                    public void run() {
                                        Log.e(TAG, "Try again connect to " + bleMac);
                                        MdsRx.Instance.connect(bleDevice);
                                    }
                                }, CONNCTION_DELAY_MILLIS);
                                return null;
                            }

                            BluetoothGattCharacteristic notifyCharacteristic = ngService.getCharacteristic(NG_NOTIFY_CHARACTERISTIC_UUID);
                            BluetoothGattCharacteristic writeCharacteristic = ngService.getCharacteristic(NG_WRITE_CHARACTERISTIC_UUID);

                            // Setup notifications for incoming data
                            RxBleConnection connection = connectionMap.get(bleMac);
                            Subscription notifySubscription = connection.setupNotification(notifyCharacteristic)
                                    .doOnNext(new Action1<Observable<byte[]>>() {
                                        @Override
                                        public void call(Observable<byte[]> observable) {
                                            Log.d(TAG, "Notifications set, calling bypassConnect()");

                                            // Bypass connect in WB to make it aware of this new device
                                            String wbAddress = addressMap.getOrCreateWbAddress(bleMac);
                                            bleWrapper.bypassConnect(wbAddress);
                                        }
                                    })
                                    .flatMap(new Func1<Observable<byte[]>, Observable<byte[]>>() {
                                        @Override
                                        public Observable<byte[]> call(Observable<byte[]> observable) {
                                            return observable;
                                        }
                                    })
                                    .subscribe(new Action1<byte[]>() {
                                        @Override
                                        public void call(byte[] bytes) {
                                            dataAvailable(bleMac, bytes);
                                        }
                                    }, new ThrowableLoggingAction(TAG, "Error while receiving data"));

                            ConnectedDevice device = new ConnectedDevice(bleDevice, notifySubscription, writeCharacteristic);
                            devicesMap.put(bleMac, device);

                            return device;
                        }
                    })
                    .subscribe(new Action1<ConnectedDevice>() {
                        @Override
                        public void call(ConnectedDevice connectedDevice) {
                            // ..
                        }
                    }, new Action1<Throwable>() {
                        @Override
                        public void call(Throwable throwable) {
                            Log.e(TAG, "new Action1<Throwable> throwable: ", throwable);
                            Log.e(TAG, "new Action1<Throwable> bleMac: " + bleMac);
                            Log.e(TAG, "new Action1<Throwable> subscriptionMap.size(): " + subscriptionMap.size());
                            // Unwind the connection (if it happened)
                            Subscription s = subscriptionMap.get(bleMac);
                            if (s != null) {
                                Log.e(TAG, "new Action1<Throwable> unsubscribe() =======");
                                s.unsubscribe();
                            }

                            // Remove this from subscriptions and connections
                            subscriptionMap.remove(bleMac);
                            connectionMap.remove(bleMac);
                            addressMap.removeBleMac(bleMac);
                            devicesMap.remove(bleMac);

                            String wbAddress = addressMap.getOrCreateWbAddress(bleMac);
                            bleWrapper.bypassDisconnect(wbAddress);


                            Log.e(TAG, "Could not connect to " + bleMac, throwable);

                            new Handler(Looper.getMainLooper()).postDelayed(new Runnable() {
                                @Override
                                public void run() {
                                    Log.e(TAG, "Try again connect to " + bleMac);
                                    MdsRx.Instance.connect(bleDevice);
                                }
                            }, CONNCTION_DELAY_MILLIS);

                        }
                    });

            // Add this subscription to map so that we can disconnect later by unsubscribing
            subscriptionMap.put(bleMac, subscription);
        }
    }

Logs from the application running with setting

 D/RxBle#ClientOperationQueue:   QUEUED LegacyScanOperation(177904432)
 D/RxBle#ClientOperationQueue:  STARTED LegacyScanOperation(177904432)
 D/BluetoothAdapter: startLeScan(): null
 D/BluetoothAdapter: STATE_ON
 D/BluetoothLeScanner: onClientRegistered() - status=0 clientIf=5
 D/RxBle#ClientOperationQueue: FINISHED LegacyScanOperation(177904432)
 D/BluetoothStatusReceiver: onReceive action: android.bluetooth.adapter.action.STATE_CHANGED
  : Connecting to :  D5:1D:A7:76:6F:AE
 D/BleManager: connecting to D5:1D:A7:76:6F:AE
 D/BleManager: isConnected: RxBleConnectionState{DISCONNECTED}
 D/BleManager: Connection try: 0
 D/RxBle#ClientOperationQueue:   QUEUED ConnectOperation(179751079)
 E/BleManager: connect: subscriptionMap.put bleMac: D5:1D:A7:76:6F:AE subscription: rx.observers.SafeSubscriber@f25a9f2
 D/RxBle#ClientOperationQueue:  STARTED ConnectOperation(179751079)
 D/BluetoothGatt: connect() - device: D5:1D:A7:76:6F:AE, auto: false
 D/BluetoothGatt: registerApp()
 D/BluetoothGatt: registerApp() - UUID=593bc8b7-4075-4fd4-a263-fa9acb9bf5dc
 D/BluetoothGatt: onClientRegistered() - status=0 clientIf=8
 D/BluetoothAdapter: stopLeScan()
 D/BluetoothAdapter: STATE_ON
 I/Komposti: [SDS REQUEST] type: POST uri: suunto://MDS/EventListener contract: {"Uri":"suunto://MDS/ConnectedDevices"}
 I/Komposti: Adding EventListener for path: suunto://MDS/ConnectedDevices
 I/Komposti: [SDS RESPONSE] type: POST status: OK header: {"Location": "MDS/EventListener/14", "Status": 200, "TaskId": 14, "Reason": "OK", "Uri": "suunto://MDS/EventListener", "Content-Length": 0}
 D/BluetoothStatusReceiver: onReceive action: android.bluetooth.adapter.action.STATE_CHANGED
 D/BluetoothStatusReceiver: onReceive BluetoothAdapter.STATE_ON
 D/BluetoothGatt: onClientConnectionState() - status=0 clientIf=8 device=D5:1D:A7:76:6F:AE
D/RxBle#BluetoothGatt: onConnectionStateChange newState=2 status=0
D/RxBle#ClientOperationQueue: FINISHED ConnectOperation(179751079)
D/BleManager: BLE connection to D5:1D:A7:76:6F:AE done!
D/RxBle#ConnectionOperationQueue:   QUEUED ServiceDiscoveryOperation(133468216)
D/RxBle#ConnectionOperationQueue:  STARTED ServiceDiscoveryOperation(133468216)
D/BluetoothGatt: discoverServices() - device: D5:1D:A7:76:6F:AE
D/BluetoothGatt: onSearchComplete() = Device=D5:1D:A7:76:6F:AE Status=0
D/RxBle#BluetoothGatt: onServicesDiscovered status=0
D/BleManager: Got service BLE from D5:1D:A7:76:6F:AE
E/BleManager: ngServices UUID: 00001800-0000-1000-8000-00805f9b34fb
E/BleManager: ngServices Instance Id: 0
E/BleManager: ngServices UUID: 00001801-0000-1000-8000-00805f9b34fb
E/BleManager: ngServices Instance Id: 0
E/BleManager: ngServices UUID: 0000180f-0000-1000-8000-00805f9b34fb
E/BleManager: ngServices Instance Id: 0
E/BleManager: ngServices UUID: 0000180a-0000-1000-8000-00805f9b34fb
E/BleManager: ngServices Instance Id: 0
E/BleManager: ngServices UUID: 61353090-8231-49cc-b57a-886370740041
E/BleManager: ngServices Instance Id: 0
D/BluetoothGatt: setCharacteristicNotification() - uuid: 34802252-7185-4d5d-b431-630e7050e8f0 enable: true
D/RxBle#ConnectionOperationQueue:   QUEUED DescriptorWriteOperation(259938394)
D/RxBle#ConnectionOperationQueue: FINISHED ServiceDiscoveryOperation(133468216)
D/RxBle#ConnectionOperationQueue:  STARTED DescriptorWriteOperation(259938394)
D/RxBle#BluetoothGatt: onDescriptorWrite descriptor=00002902-0000-1000-8000-00805f9b34fb status=0
D/BleManager: Notifications set, calling bypassConnect()
E/BleManager: getOrCreateWbAddress: handle: 268435457
E/BleManager: getOrCreateWbAddress: wbAddress2: 10000001
D/BleManager: getConnectedBleDevicesCb()
D/RxBle#ConnectionOperationQueue: FINISHED DescriptorWriteOperation(259938394)
D/BleManager: Found connected devices: [10000001, ECKIC4AD3F4B,  ECKIC4AD3F4B]
 I/Komposti: [SDS RESPONSE] type: PUT status: OK header: {"Status": 200, "TaskId": 15, "Reason": "OK", "Uri": "suunto://MDS/ConnectingDevices", "Content-Length": 0}
 D/BleManager: connectCb(10000001)
 D/BleManager: calling connectCompleted(10000001)
 D/BleManager: sendCb(10000001), 38 bytes
 D/RxBle#ConnectionOperationQueue:   QUEUED CharacteristicLongWriteOperation(223462743)
 D/RxBle#ConnectionOperationQueue:  STARTED CharacteristicLongWriteOperation(223462743)
 D/RxBle#BluetoothGatt: onCharacteristicWrite characteristic=17816557-5652-417f-909f-3aee61e5fa85 status=0
 D/RxBle#BluetoothGatt: onCharacteristicWrite characteristic=17816557-5652-417f-909f-3aee61e5fa85 status=0
 D/RxBle#BluetoothGatt: onCharacteristicWrite characteristic=17816557-5652-417f-909f-3aee61e5fa85 status=0
 D/BleManager: Send complete
 D/RxBle#ConnectionOperationQueue: FINISHED CharacteristicLongWriteOperation(223462743)
 D/RxBle#BluetoothGatt: onCharacteristicChanged characteristic=34802252-7185-4d5d-b431-630e7050e8f0
 D/BleManager: Received data: WB_COMMMSG_HELLO_ACK, type: 19, direct msg, msgLen: 32, reqId: 0, size: 38
 I/Komposti: whiteboard device detected.
 I/Komposti: Getting /System/Mode
 D/BleManager: sendCb(10000001), 22 bytes
 D/RxBle#ConnectionOperationQueue:   QUEUED CharacteristicLongWriteOperation(266466829)
 D/RxBle#ConnectionOperationQueue:  STARTED CharacteristicLongWriteOperation(266466829)
 D/RxBle#BluetoothGatt: onCharacteristicWrite characteristic=17816557-5652-417f-909f-3aee61e5fa85 status=0
 D/RxBle#BluetoothGatt: onCharacteristicWrite characteristic=17816557-5652-417f-909f-3aee61e5fa85 status=0
 D/BleManager: Send complete
 D/RxBle#ConnectionOperationQueue: FINISHED CharacteristicLongWriteOperation(266466829)
 D/RxBle#BluetoothGatt: onCharacteristicChanged characteristic=34802252-7185-4d5d-b431-630e7050e8f0
 D/BleManager: Received data: WB_DATAMSG_CLIENT_ON_GET_RESOURCE_RESULT, type: 2, direct msg, msgLen: 8, reqId: 2560, size: 14
 D/BleManager: sendCb(10000001), 20 bytes
 D/RxBle#ConnectionOperationQueue:   QUEUED CharacteristicLongWriteOperation(32554549)
 D/RxBle#ConnectionOperationQueue:  STARTED CharacteristicLongWriteOperation(32554549)
 D/RxBle#BluetoothGatt: onCharacteristicWrite characteristic=17816557-5652-417f-909f-3aee61e5fa85 status=0
 D/RxBle#BluetoothGatt: onCharacteristicWrite characteristic=17816557-5652-417f-909f-3aee61e5fa85 status=0
 D/BleManager: Send complete
 D/RxBle#ConnectionOperationQueue: FINISHED CharacteristicLongWriteOperation(32554549)
 D/RxBle#BluetoothGatt: onCharacteristicChanged characteristic=34802252-7185-4d5d-b431-630e7050e8f0
 D/BleManager: Received data: WB_DATAMSG_CLIENT_ON_GET_RESOURCE_RESULT, type: 2, direct msg, msgLen: 8, reqId: 2816, size: 14
 D/BleManager: sendCb(10000001), 13 bytes
 D/RxBle#ConnectionOperationQueue:   QUEUED CharacteristicLongWriteOperation(239717446)
 D/RxBle#ConnectionOperationQueue:  STARTED CharacteristicLongWriteOperation(239717446)
 D/RxBle#BluetoothGatt: onCharacteristicWrite characteristic=17816557-5652-417f-909f-3aee61e5fa85 status=0
 D/BleManager: Send complete
 D/RxBle#ConnectionOperationQueue: FINISHED CharacteristicLongWriteOperation(239717446)
 D/RxBle#BluetoothGatt: onCharacteristicChanged characteristic=34802252-7185-4d5d-b431-630e7050e8f0
 D/BleManager: Received data: WB_DATAMSG_CLIENT_ON_GET_RESULT, type: 5, direct msg, msgLen: 19, reqId: 3072, size: 25
 D/BleManager: sendCb(10000001), 13 bytes
 D/RxBle#ConnectionOperationQueue:   QUEUED CharacteristicLongWriteOperation(17314843)
 D/RxBle#ConnectionOperationQueue:  STARTED CharacteristicLongWriteOperation(17314843)
 D/RxBle#BluetoothGatt: onCharacteristicWrite characteristic=17816557-5652-417f-909f-3aee61e5fa85 status=0
 D/BleManager: Send complete
 D/RxBle#ConnectionOperationQueue: FINISHED CharacteristicLongWriteOperation(17314843)
 D/RxBle#BluetoothGatt: onCharacteristicChanged characteristic=34802252-7185-4d5d-b431-630e7050e8f0
 D/BleManager: Received data: WB_DATAMSG_CLIENT_ON_GET_RESULT, type: 5, direct msg, msgLen: 15, reqId: 3328, size: 21
 D/BleManager: sendCb(10000001), 12 bytes
 D/RxBle#ConnectionOperationQueue:   QUEUED CharacteristicLongWriteOperation(176468220)
 D/RxBle#ConnectionOperationQueue:  STARTED CharacteristicLongWriteOperation(176468220)
 D/RxBle#BluetoothGatt: onCharacteristicWrite characteristic=17816557-5652-417f-909f-3aee61e5fa85 status=0
 D/BleManager: Send complete
 D/RxBle#ConnectionOperationQueue: FINISHED CharacteristicLongWriteOperation(176468220)
 D/RxBle#BluetoothGatt: onCharacteristicChanged characteristic=34802252-7185-4d5d-b431-630e7050e8f0
 D/BleManager: Received data: WB_DATAMSG_CLIENT_ON_RELEASE_RESOURCE_RESULT, type: 3, direct msg, msgLen: 8, reqId: 3584, size: 14
 I/Komposti: /System/Mode: {"current": 5, "next": null}
 I/Komposti: Getting Device /Info.
 D/BleManager: sendCb(10000001), 15 bytes
 D/RxBle#ConnectionOperationQueue:   QUEUED CharacteristicLongWriteOperation(200847673)
 D/RxBle#ConnectionOperationQueue:  STARTED CharacteristicLongWriteOperation(200847673)
 D/RxBle#BluetoothGatt: onCharacteristicWrite characteristic=17816557-5652-417f-909f-3aee61e5fa85 status=0
 D/RxBle#BluetoothGatt: onCharacteristicWrite characteristic=17816557-5652-417f-909f-3aee61e5fa85 status=0
 D/BleManager: Send complete
 D/RxBle#ConnectionOperationQueue: FINISHED CharacteristicLongWriteOperation(200847673)
 D/RxBle#BluetoothGatt: onCharacteristicChanged characteristic=34802252-7185-4d5d-b431-630e7050e8f0
 D/BleManager: Received data: WB_DATAMSG_CLIENT_ON_GET_RESOURCE_RESULT, type: 2, direct msg, msgLen: 8, reqId: 3840, size: 14
 D/BleManager: sendCb(10000001), 13 bytes
 D/RxBle#ConnectionOperationQueue:   QUEUED CharacteristicLongWriteOperation(188070379)
 D/RxBle#ConnectionOperationQueue:  STARTED CharacteristicLongWriteOperation(188070379)
 D/RxBle#BluetoothGatt: onCharacteristicWrite characteristic=17816557-5652-417f-909f-3aee61e5fa85 status=0
 D/BleManager: Send complete
 D/RxBle#ConnectionOperationQueue: FINISHED CharacteristicLongWriteOperation(188070379)
 D/RxBle#BluetoothGatt: onCharacteristicChanged characteristic=34802252-7185-4d5d-b431-630e7050e8f0
 D/RxBle#BluetoothGatt: onCharacteristicChanged characteristic=34802252-7185-4d5d-b431-630e7050e8f0
 D/BleManager: Received data: WB_DATAMSG_CLIENT_ON_GET_RESULT, type: 5, direct msg, msgLen: -32, reqId: 4096, size: 230
 D/BleManager: sendCb(10000001), 12 bytes
 D/RxBle#ConnectionOperationQueue:   QUEUED CharacteristicLongWriteOperation(9356501)
 D/RxBle#ConnectionOperationQueue:  STARTED CharacteristicLongWriteOperation(9356501)
 D/RxBle#BluetoothGatt: onCharacteristicWrite characteristic=17816557-5652-417f-909f-3aee61e5fa85 status=0
 D/BleManager: Send complete
 D/RxBle#ConnectionOperationQueue: FINISHED CharacteristicLongWriteOperation(9356501)
 D/RxBle#BluetoothGatt: onCharacteristicChanged characteristic=34802252-7185-4d5d-b431-630e7050e8f0
 D/BleManager: Received data: WB_DATAMSG_CLIENT_ON_RELEASE_RESOURCE_RESULT, type: 3, direct msg, msgLen: 8, reqId: 4352, size: 14
 I/Komposti: Device /Info dump: {"Content": {"manufacturerName": "Suunto", "brandName": null, "productName": "SmartSensor2", "variant": "Unknown", "design": null, "hwCompatibilityId": "C", "serial": "ECKIC4AD3F4B", "pcbaSerial": "UNKNOWN", "sw": "0.12.1", "hw": "UNKNOWN", "additionalVersionInfo": null, "addressInfo": [{"name": "BLE", "address": "D5-1D-A7-76-6F-AE"}, {"name": "DFU-BLE", "address": "D5-1D-A7-76-6F-AF"}], "apiLevel": "1"}}
 I/Komposti: Additional device set up in Application mode.
 I/Komposti: Completed device set up in Application mode.
 I/Komposti: [SDS REQUEST] type: PUT uri: suunto://MDS/ConnectingDevices contract: {"State": "FinishConnect", "Serial": "ECKIC4AD3F4B"}
 I/Komposti: [SDS REQUEST] type: POST uri: suunto://MDS/ConnectedDevices contract: {"DeviceInfo": {"Mode": 5, "SwVersion": "0.12.1", "hw": "UNKNOWN", "brandName": null, "sw": "0.12.1", "pcbaSerial": "UNKNOWN", "hwCompatibilityId": "C", "design": null, "serial": "ECKIC4AD3F4B", "variant": "Unknown", "productName": "SmartSensor2", "additionalVersionInfo": null, "apiLevel": "1", "Name": "SmartSensor2", "manufacturerName": "Suunto", "Serial": "ECKIC4AD3F4B", "addressInfo": [{"name": "BLE", "address": "D5-1D-A7-76-6F-AE"}, {"name": "DFU-BLE", "address": "D5-1D-A7-76-6F-AF"}], "Description": " ECKIC4AD3F4B"}, "Serial": "ECKIC4AD3F4B", "Connection": {"UUID": "10000001", "Type": "BLE"}}
 I/Komposti: [SDS REQUEST] type: PUT uri: sds://MDS/Devices/Library/ECKIC4AD3F4B contract: {"LastKnownState": 5, "HwVersion": "C", "Serial": "ECKIC4AD3F4B", "Descriptors": {"SwVersion": "0.12.1"}, "Model": "Unknown", "Name": "SmartSensor2"}
 E/Komposti: [SDS RESPONSE] type: PUT status: NOT_FOUND header: {"Status": 404, "TaskId": 18, "Reason": "NOT_FOUND", "Uri": "suunto://MDS/Devices/Library/ECKIC4AD3F4B", "Content-Length": 0}
 I/Komposti: [SDS REQUEST] type: POST uri: sds:/// contract: {"ECKIC4AD3F4B": ""}
 I/Komposti: [SDS RESPONSE] type: POST status: OK header: {"Location": "ECKIC4AD3F4B", "Status": 200, "TaskId": 19, "Reason": "OK", "Uri": "suunto://", "Content-Length": 0}
 I/Komposti: [SDS RESPONSE] type: POST status: CREATED header: {"Location": "ECKIC4AD3F4B", "Status": 201, "TaskId": 17, "Reason": "CREATED", "Uri": "suunto://MDS/ConnectedDevices", "Content-Length": 0}
 I/Komposti: [SDS REQUEST] type: DEL uri: suunto://MDS/EventListener/14
 I/Komposti: [SDS RESPONSE] type: DEL status: OK header: {"Status": 200, "TaskId": 20, "Reason": "OK", "Uri": "suunto://MDS/EventListener/14", "Content-Length": 0}
 D/Mds: Mds get() uri: suunto://ECKIC4AD3F4B/Info contract: null
 I/Komposti: [SDS REQUEST] type: GET uri: suunto://ECKIC4AD3F4B/Info
 D/BleManager: sendCb(10000001), 15 bytes
 D/RxBle#ConnectionOperationQueue:   QUEUED CharacteristicLongWriteOperation(19158065)
 D/RxBle#ConnectionOperationQueue:  STARTED CharacteristicLongWriteOperation(19158065)
 D/RxBle#BluetoothGatt: onCharacteristicWrite characteristic=17816557-5652-417f-909f-3aee61e5fa85 status=0
 D/RxBle#BluetoothGatt: onCharacteristicWrite characteristic=17816557-5652-417f-909f-3aee61e5fa85 status=0
 D/BleManager: Send complete
 D/RxBle#ConnectionOperationQueue: FINISHED CharacteristicLongWriteOperation(19158065)
 D/RxBle#BluetoothGatt: onCharacteristicChanged characteristic=34802252-7185-4d5d-b431-630e7050e8f0
 D/BleManager: Received data: WB_DATAMSG_CLIENT_ON_GET_RESOURCE_RESULT, type: 2, direct msg, msgLen: 8, reqId: 4608, size: 14
 D/BleManager: sendCb(10000001), 13 bytes
 D/RxBle#ConnectionOperationQueue:   QUEUED CharacteristicLongWriteOperation(250460278)
 D/RxBle#ConnectionOperationQueue:  STARTED CharacteristicLongWriteOperation(250460278)
 D/RxBle#BluetoothGatt: onCharacteristicWrite characteristic=17816557-5652-417f-909f-3aee61e5fa85 status=0
 D/BleManager: Send complete
 D/RxBle#ConnectionOperationQueue: FINISHED CharacteristicLongWriteOperation(250460278)
 I/Timeline: Timeline: Activity_idle id: android.os.BinderProxy@d04f716 time:8551854
 D/RxBle#BluetoothGatt: onCharacteristicChanged characteristic=34802252-7185-4d5d-b431-630e7050e8f0
 D/RxBle#BluetoothGatt: onCharacteristicChanged characteristic=34802252-7185-4d5d-b431-630e7050e8f0
 D/BleManager: Received data: WB_DATAMSG_CLIENT_ON_GET_RESULT, type: 5, direct msg, msgLen: -32, reqId: 4864, size: 230
 D/BleManager: sendCb(10000001), 12 bytes
 D/RxBle#ConnectionOperationQueue:   QUEUED CharacteristicLongWriteOperation(51792488)
 D/RxBle#ConnectionOperationQueue:  STARTED CharacteristicLongWriteOperation(51792488)
 D/RxBle#BluetoothGatt: onCharacteristicWrite characteristic=17816557-5652-417f-909f-3aee61e5fa85 status=0
 D/BleManager: Send complete
 D/RxBle#ConnectionOperationQueue: FINISHED CharacteristicLongWriteOperation(51792488)
 D/RxBle#BluetoothGatt: onCharacteristicChanged characteristic=34802252-7185-4d5d-b431-630e7050e8f0
 D/BleManager: Received data: WB_DATAMSG_CLIENT_ON_RELEASE_RESOURCE_RESULT, type: 3, direct msg, msgLen: 8, reqId: 5120, size: 14
 I/Komposti: [SDS RESPONSE] type: GET status: OK header: {"Content-Type": "application/json", "Status": 200, "TaskId": 21, "Reason": "OK", "Uri": "suunto://ECKIC4AD3F4B/Info", "Content-Length": 408} body: {"Content": {"manufacturerName": "Suunto", "brandName": null, "productName": "SmartSensor2", "variant": "Unknown", "design": null, "hwCompatibilityId": "C", "serial": "ECKIC4AD3F4B", "pcbaSerial": "UNKNOWN", "sw": "0.12.1", "hw": "UNKNOWN", "additionalVersionInfo": null, "addressInfo": [{"name": "BLE", "address": "D5-1D-A7-76-6F-AE"}, {"name": "DFU-BLE", "address": "D5-1D-A7-76-6F-AF"}], "apiLevel": "1"}}
 D/SensorListActivity: Info onSuccess: {"Content": {"manufacturerName": "Suunto", "brandName": null, "productName": "SmartSensor2", "variant": "Unknown", "design": null, "hwCompatibilityId": "C", "serial": "ECKIC4AD3F4B", "pcbaSerial": "UNKNOWN", "sw": "0.12.1", "hw": "UNKNOWN", "additionalVersionInfo": null, "addressInfo": [{"name": "BLE", "address": "D5-1D-A7-76-6F-AE"}, {"name": "DFU-BLE", "address": "D5-1D-A7-76-6F-AF"}], "apiLevel": "1"}}
 I/Komposti: [SDS REQUEST] type: POST uri: suunto://MDS/EventListener contract: {"Uri":"suunto://MDS/ConnectedDevices"}
 I/Komposti: Adding EventListener for path: suunto://MDS/ConnectedDevices
 I/Komposti: [SDS RESPONSE] type: POST status: OK header: {"Location": "MDS/EventListener/22", "Status": 200, "TaskId": 22, "Reason": "OK", "Uri": "suunto://MDS/EventListener", "Content-Length": 0}
 E/SensorListActivity: Info: Content{manufacturerName='Suunto', brandName='null', productName='SmartSensor2', variant='Unknown', design='null', hwCompatiblity='null', serial='ECKIC4AD3F4B', pcbSerial='null', sw='0.12.1', hw='UNKNOWN', additionalVersionInfo='null', apiLevel='1', addressInfoNew=[MdsAddressModel{name='BLE', address='D5-1D-A7-76-6F-AE'}, MdsAddressModel{name='DFU-BLE', address='D5-1D-A7-76-6F-AF'}]}
 I/Komposti: [SDS REQUEST] type: DEL uri: suunto://MDS/EventListener/22
 I/Komposti: [SDS RESPONSE] type: DEL status: OK header: {"Status": 200, "TaskId": 23, "Reason": "OK", "Uri": "suunto://MDS/EventListener/22", "Content-Length": 0}
 D/Mds: Mds get() uri: suunto://ECKIC4AD3F4B/Meas/Acc/Info contract: null
 I/Komposti: [SDS REQUEST] type: GET uri: suunto://ECKIC4AD3F4B/Meas/Acc/Info
 D/BleManager: sendCb(10000001), 24 bytes
 D/RxBle#ConnectionOperationQueue:   QUEUED CharacteristicLongWriteOperation(266136484)
 D/RxBle#ConnectionOperationQueue:  STARTED CharacteristicLongWriteOperation(266136484)
 D/RxBle#BluetoothGatt: onCharacteristicWrite characteristic=17816557-5652-417f-909f-3aee61e5fa85 status=0
 D/RxBle#BluetoothGatt: onCharacteristicWrite characteristic=17816557-5652-417f-909f-3aee61e5fa85 status=0
 D/BleManager: Send complete
 D/RxBle#ConnectionOperationQueue: FINISHED CharacteristicLongWriteOperation(266136484)
 D/RxBle#BluetoothGatt: onCharacteristicChanged characteristic=34802252-7185-4d5d-b431-630e7050e8f0
 D/BleManager: Received data: WB_DATAMSG_CLIENT_ON_GET_RESOURCE_RESULT, type: 2, direct msg, msgLen: 8, reqId: 5376, size: 14
 D/BleManager: sendCb(10000001), 13 bytes
 D/RxBle#ConnectionOperationQueue:   QUEUED CharacteristicLongWriteOperation(189813694)
 D/RxBle#ConnectionOperationQueue:  STARTED CharacteristicLongWriteOperation(189813694)
 D/RxBle#BluetoothGatt: onCharacteristicWrite characteristic=17816557-5652-417f-909f-3aee61e5fa85 status=0
 D/BleManager: Send complete
 D/RxBle#ConnectionOperationQueue: FINISHED CharacteristicLongWriteOperation(189813694)
 I/Timeline: Timeline: Activity_idle id: android.os.BinderProxy@c742a37 time:8557768
 D/RxBle#BluetoothGatt: onCharacteristicChanged characteristic=34802252-7185-4d5d-b431-630e7050e8f0
 D/BleManager: Received data: WB_DATAMSG_CLIENT_ON_GET_RESULT, type: 5, direct msg, msgLen: 50, reqId: 5632, size: 56
 D/BleManager: sendCb(10000001), 12 bytes
 D/RxBle#ConnectionOperationQueue:   QUEUED CharacteristicLongWriteOperation(218011315)
 D/RxBle#ConnectionOperationQueue:  STARTED CharacteristicLongWriteOperation(218011315)
 D/RxBle#BluetoothGatt: onCharacteristicWrite characteristic=17816557-5652-417f-909f-3aee61e5fa85 status=0
 D/BleManager: Send complete
 D/RxBle#ConnectionOperationQueue: FINISHED CharacteristicLongWriteOperation(218011315)
 D/RxBle#BluetoothGatt: onCharacteristicChanged characteristic=34802252-7185-4d5d-b431-630e7050e8f0
 D/BleManager: Received data: WB_DATAMSG_CLIENT_ON_RELEASE_RESOURCE_RESULT, type: 3, direct msg, msgLen: 8, reqId: 5888, size: 14
 I/Komposti: [SDS RESPONSE] type: GET status: OK header: {"Content-Type": "application/json", "Status": 200, "TaskId": 24, "Reason": "OK", "Uri": "suunto://ECKIC4AD3F4B/Meas/Acc/Info", "Content-Length": 93} body: {"Content": {"SampleRates": [13, 26, 52, 104, 208, 416, 833, 1666], "Ranges": [2, 4, 8, 16]}}
 D/LinearAccelerationTestActivity: onSuccess(): {"Content": {"SampleRates": [13, 26, 52, 104, 208, 416, 833, 1666], "Ranges": [2, 4, 8, 16]}}
 E/BleManager: new Action1<Throwable> throwable: 
                                                                         BleDisconnectedException{bluetoothDeviceAddress='D5:1D:A7:76:6F:AE'}
                                                                             at com.polidea.rxandroidble.internal.connection.DisconnectionRouter$2.call(DisconnectionRouter.java:57)
                                                                             at com.polidea.rxandroidble.internal.connection.DisconnectionRouter$2.call(DisconnectionRouter.java:54)
                                                                             at rx.internal.operators.OnSubscribeMap$MapSubscriber.onNext(OnSubscribeMap.java:69)
                                                                             at rx.internal.operators.OnSubscribeFilter$FilterSubscriber.onNext(OnSubscribeFilter.java:76)
                                                                             at rx.observers.SerializedObserver.onNext(SerializedObserver.java:91)
                                                                             at rx.observers.SerializedSubscriber.onNext(SerializedSubscriber.java:94)
                                                                             at rx.internal.operators.OnSubscribeConcatMap$ConcatMapSubscriber.innerNext(OnSubscribeConcatMap.java:182)
                                                                             at rx.internal.operators.OnSubscribeConcatMap$ConcatMapInnerSubscriber.onNext(OnSubscribeConcatMap.java:335)
                                                                             at rx.internal.operators.OnSubscribeMap$MapSubscriber.onNext(OnSubscribeMap.java:77)
                                                                             at rx.internal.operators.OnSubscribeCreate$LatestEmitter.drain(OnSubscribeCreate.java:492)
                                                                             at rx.internal.operators.OnSubscribeCreate$LatestEmitter.onNext(OnSubscribeCreate.java:425)
                                                                             at com.polidea.rxandroidble.RxBleAdapterStateObservable$1$1.onReceive(RxBleAdapterStateObservable.java:57)
                                                                             at android.app.LoadedApk$ReceiverDispatcher$Args.run(LoadedApk.java:885)
                                                                             at android.os.Handler.handleCallback(Handler.java:739)
                                                                             at android.os.Handler.dispatchMessage(Handler.java:95)
                                                                             at android.os.Looper.loop(Looper.java:234)
                                                                             at android.app.ActivityThread.main(ActivityThread.java:5526)
                                                                             at java.lang.reflect.Method.invoke(Native Method)
                                                                             at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
                                                                             at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
 E/BleManager: new Action1<Throwable> bleMac: D5:1D:A7:76:6F:AE
 E/BleManager: new Action1<Throwable> subscriptionMap.size(): 1
 E/BleManager: new Action1<Throwable> unsubscribe() =======
 I/RxBle#DisconnectAction: Connection operations queue to be terminated (D5:1D:A7:76:6F:AE)
 D/RxBle#Executors$RunnableAdapter: Terminated.
 D/RxBle#ClientOperationQueue:   QUEUED DisconnectOperation(106842457)
 E/BleManager: getOrCreateWbAddress: handle: 268435457
 E/BleManager: getOrCreateWbAddress: wbAddress2: 10000001
 D/BleManager: getConnectedBleDevicesCb()
 D/BleManager: Found connected devices: []
 D/RxBle#ClientOperationQueue:  STARTED DisconnectOperation(106842457)
 D/BluetoothManager: getConnectionState()
 D/BluetoothManager: getConnectedDevices
 I/Komposti: [SDS REQUEST] type: PUT uri: sds://MDS/Devices/Library/ECKIC4AD3F4B contract: {"LastKnownState": 5, "HwVersion": "C", "Serial": "ECKIC4AD3F4B", "Descriptors": {"SwVersion": "0.12.1"}, "Model": "Unknown", "Name": "SmartSensor2"}
 E/Komposti: [SDS RESPONSE] type: PUT status: NOT_FOUND header: {"Status": 404, "TaskId": 25, "Reason": "NOT_FOUND", "Uri": "suunto://MDS/Devices/Library/ECKIC4AD3F4B", "Content-Length": 0}
 D/BluetoothGatt: cancelOpen() - device: D5:1D:A7:76:6F:AE
 I/Komposti: [SDS REQUEST] type: PUT uri: suunto://MDS/ConnectingDevices contract: {"State": "Disconnected", "Serial": "ECKIC4AD3F4B"}
 I/Komposti: [SDS REQUEST] type: DEL uri: suunto://ECKIC4AD3F4B/
 I/Komposti: [SDS RESPONSE] type: PUT status: OK header: {"Status": 200, "TaskId": 26, "Reason": "OK", "Uri": "suunto://MDS/ConnectingDevices", "Content-Length": 0}
 I/Komposti: [SDS REQUEST] type: PUT uri: sds://MDS/Devices/Library/ECKIC4AD3F4B contract: {"LastKnownState": 5, "HwVersion": "C", "Serial": "ECKIC4AD3F4B", "Descriptors": {"SwVersion": "0.12.1"}, "Model": "Unknown", "Name": "SmartSensor2"}
 E/Komposti: [SDS RESPONSE] type: PUT status: NOT_FOUND header: {"Status": 404, "TaskId": 28, "Reason": "NOT_FOUND", "Uri": "suunto://MDS/Devices/Library/ECKIC4AD3F4B", "Content-Length": 0}
 I/Komposti: [SDS REQUEST] type: POST uri: suunto://MDS/EventListener contract: {"Operation": "Unsubscribe", "Serial": "ECKIC4AD3F4B"}
 I/Komposti: [SDS RESPONSE] type: DEL status: OK header: {"Status": 200, "TaskId": 27, "Reason": "OK", "Uri": "suunto://ECKIC4AD3F4B", "Content-Length": 0}
 I/Komposti: [SDS RESPONSE] type: POST status: OK header: {"Status": 200, "TaskId": 29, "Reason": "OK", "Uri": "suunto://MDS/EventListener", "Content-Length": 0}
 E/LinearAccelerationTestActivity: onDisconnect: ECKIC4AD3F4B D5:1D:A7:76:6F:AE
 E/ConnectionLostDialog: showDialog: 
 D/BluetoothGatt: onClientConnectionState() - status=0 clientIf=8 device=D5:1D:A7:76:6F:AE
 D/RxBle#BluetoothGatt: onConnectionStateChange newState=0 status=0
 D/BluetoothGatt: close()
 D/BluetoothGatt: unregisterApp() - mClientIf=8
 D/RxBle#ClientOperationQueue: FINISHED DisconnectOperation(106842457)
 E/BleManager: Could not connect to D5:1D:A7:76:6F:AE
                                                                         BleDisconnectedException{bluetoothDeviceAddress='D5:1D:A7:76:6F:AE'}
                                                                             at com.polidea.rxandroidble.internal.connection.DisconnectionRouter$2.call(DisconnectionRouter.java:57)
                                                                             at com.polidea.rxandroidble.internal.connection.DisconnectionRouter$2.call(DisconnectionRouter.java:54)
                                                                             at rx.internal.operators.OnSubscribeMap$MapSubscriber.onNext(OnSubscribeMap.java:69)
                                                                             at rx.internal.operators.OnSubscribeFilter$FilterSubscriber.onNext(OnSubscribeFilter.java:76)
                                                                             at rx.observers.SerializedObserver.onNext(SerializedObserver.java:91)
                                                                             at rx.observers.SerializedSubscriber.onNext(SerializedSubscriber.java:94)
                                                                             at rx.internal.operators.OnSubscribeConcatMap$ConcatMapSubscriber.innerNext(OnSubscribeConcatMap.java:182)
                                                                             at rx.internal.operators.OnSubscribeConcatMap$ConcatMapInnerSubscriber.onNext(OnSubscribeConcatMap.java:335)
                                                                             at rx.internal.operators.OnSubscribeMap$MapSubscriber.onNext(OnSubscribeMap.java:77)
                                                                             at rx.internal.operators.OnSubscribeCreate$LatestEmitter.drain(OnSubscribeCreate.java:492)
                                                                             at rx.internal.operators.OnSubscribeCreate$LatestEmitter.onNext(OnSubscribeCreate.java:425)
                                                                             at com.polidea.rxandroidble.RxBleAdapterStateObservable$1$1.onReceive(RxBleAdapterStateObservable.java:57)
                                                                             at android.app.LoadedApk$ReceiverDispatcher$Args.run(LoadedApk.java:885)
                                                                             at android.os.Handler.handleCallback(Handler.java:739)
                                                                             at android.os.Handler.dispatchMessage(Handler.java:95)
                                                                             at android.os.Looper.loop(Looper.java:234)
                                                                             at android.app.ActivityThread.main(ActivityThread.java:5526)
                                                                             at java.lang.reflect.Method.invoke(Native Method)
                                                                             at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
                                                                             at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
 D/BluetoothGatt: setCharacteristicNotification() - uuid: 34802252-7185-4d5d-b431-630e7050e8f0 enable: false
 E/BleManager: Error while receiving data
                                                                         BleDisconnectedException{bluetoothDeviceAddress='D5:1D:A7:76:6F:AE'}
                                                                             at com.polidea.rxandroidble.internal.connection.DisconnectionRouter$2.call(DisconnectionRouter.java:57)
                                                                             at com.polidea.rxandroidble.internal.connection.DisconnectionRouter$2.call(DisconnectionRouter.java:54)
                                                                             at rx.internal.operators.OnSubscribeMap$MapSubscriber.onNext(OnSubscribeMap.java:69)
                                                                             at rx.internal.operators.OnSubscribeFilter$FilterSubscriber.onNext(OnSubscribeFilter.java:76)
                                                                             at rx.observers.SerializedObserver.onNext(SerializedObserver.java:91)
                                                                             at rx.observers.SerializedSubscriber.onNext(SerializedSubscriber.java:94)
                                                                             at rx.internal.operators.OnSubscribeConcatMap$ConcatMapSubscriber.innerNext(OnSubscribeConcatMap.java:182)
                                                                             at rx.internal.operators.OnSubscribeConcatMap$ConcatMapInnerSubscriber.onNext(OnSubscribeConcatMap.java:335)
                                                                             at rx.internal.operators.OnSubscribeMap$MapSubscriber.onNext(OnSubscribeMap.java:77)
                                                                             at rx.internal.operators.OnSubscribeCreate$LatestEmitter.drain(OnSubscribeCreate.java:492)
                                                                             at rx.internal.operators.OnSubscribeCreate$LatestEmitter.onNext(OnSubscribeCreate.java:425)
                                                                             at com.polidea.rxandroidble.RxBleAdapterStateObservable$1$1.onReceive(RxBleAdapterStateObservable.java:57)
                                                                             at android.app.LoadedApk$ReceiverDispatcher$Args.run(LoadedApk.java:885)
                                                                             at android.os.Handler.handleCallback(Handler.java:739)
                                                                             at android.os.Handler.dispatchMessage(Handler.java:95)
                                                                             at android.os.Looper.loop(Looper.java:234)
                                                                             at android.app.ActivityThread.main(ActivityThread.java:5526)
                                                                             at java.lang.reflect.Method.invoke(Native Method)
                                                                             at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
                                                                             at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
D/BluetoothStatusReceiver: onReceive action: android.bluetooth.adapter.action.STATE_CHANGED
E/LinearAccelerationTestActivity: call bluetoothStatusObservable: 13
D/BluetoothStatusReceiver: onReceive action: android.bluetooth.adapter.action.STATE_CHANGED
E/LinearAccelerationTestActivity: call bluetoothStatusObservable: 10
E/LinearAccelerationTestActivity: call: BluetoothAdapter.STATE_OFF
D/BleManager: disconnect() Address: D5:1D:A7:76:6F:AE
D/BleManager: disconnect() wbAddress: 10000001
D/BleManager: disconnect() bleMac: D5:1D:A7:76:6F:AE
D/BleManager: disconnect() subscriptionMap.size(): 0
E/BleManager:  subscription null
D/BleManager: disconnect() wbAddress: 10000001
D/BleManager: getConnectedBleDevicesCb()
D/BleManager: Found connected devices: []
D/BluetoothStatusReceiver: onReceive BluetoothAdapter.STATE_OFF
E/BleManager: Try again connect to D5:1D:A7:76:6F:AE
D/BleManager: connecting to D5:1D:A7:76:6F:AE
D/BleManager: isConnected: RxBleConnectionState{DISCONNECTED}
D/BleManager: Connection try: 0
D/RxBle#ClientOperationQueue:   QUEUED ConnectOperation(171845268)
D/RxBle#ClientOperationQueue:  STARTED ConnectOperation(171845268)
D/RxBle#ClientOperationQueue: FINISHED ConnectOperation(171845268)
E/BleManager: new Action1<Throwable> throwable: 
                                                                         BleDisconnectedException{bluetoothDeviceAddress='D5:1D:A7:76:6F:AE'}
                                                                             at com.polidea.rxandroidble.internal.connection.DisconnectionRouter$2.call(DisconnectionRouter.java:57)
                                                                             at com.polidea.rxandroidble.internal.connection.DisconnectionRouter$2.call(DisconnectionRouter.java:54)
                                                                             at rx.internal.operators.OnSubscribeMap$MapSubscriber.onNext(OnSubscribeMap.java:69)
                                                                             at rx.internal.operators.OnSubscribeFilter$FilterSubscriber.onNext(OnSubscribeFilter.java:76)
                                                                             at rx.observers.SerializedObserver.onNext(SerializedObserver.java:91)
                                                                             at rx.observers.SerializedSubscriber.onNext(SerializedSubscriber.java:94)
                                                                             at rx.internal.operators.OnSubscribeConcatMap$ConcatMapSubscriber.innerNext(OnSubscribeConcatMap.java:182)
                                                                             at rx.internal.operators.OnSubscribeConcatMap$ConcatMapInnerScalarProducer.request(OnSubscribeConcatMap.java:366)
                                                                             at rx.internal.producers.ProducerArbiter.setProducer(ProducerArbiter.java:126)
                                                                             at rx.internal.operators.OnSubscribeConcatMap$ConcatMapSubscriber.drain(OnSubscribeConcatMap.java:278)
                                                                             at rx.internal.operators.OnSubscribeConcatMap$ConcatMapSubscriber.onNext(OnSubscribeConcatMap.java:144)
                                                                             at rx.internal.operators.OnSubscribeFromArray$FromArrayProducer.slowPath(OnSubscribeFromArray.java:100)
                                                                             at rx.internal.operators.OnSubscribeFromArray$FromArrayProducer.request(OnSubscribeFromArray.java:63)
                                                                             at rx.Subscriber.setProducer(Subscriber.java:211)
                                                                             at rx.internal.operators.OnSubscribeFromArray.call(OnSubscribeFromArray.java:32)
                                                                             at rx.internal.operators.OnSubscribeFromArray.call(OnSubscribeFromArray.java:24)
                                                                             at rx.Observable.unsafeSubscribe(Observable.java:10256)
                                                                             at rx.internal.operators.OnSubscribeConcatMap.call(OnSubscribeConcatMap.java:94)
                                                                             at rx.internal.operators.OnSubscribeConcatMap.call(OnSubscribeConcatMap.java:42)
                                                                             at rx.Observable.unsafeSubscribe(Observable.java:10256)
                                                                             at rx.internal.operators.OnSubscribeFilter.call(OnSubscribeFilter.java:45)
                                                                             at rx.internal.operators.OnSubscribeFilter.call(OnSubscribeFilter.java:30)
                                                                             at rx.Observable.unsafeSubscribe(Observable.java:10256)
                                                                             at rx.internal.operators.OnSubscribeMap.call(OnSubscribeMap.java:48)
                                                                             at rx.internal.operators.OnSubscribeMap.call(OnSubscribeMap.java:33)
                                                                             at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48)
                                                                             at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)
                                                                             at rx.Observable.unsafeSubscribe(Observable.java:10256)
                                                                             at rx.internal.operators.OperatorMerge$MergeSubscriber.onNext(OperatorMerge.java:248)
                                                                             at rx.internal.operators.OperatorMerge$MergeSubscriber.onNext(OperatorMerge.java:148)
                                                                             at rx.internal.operators.OnSubscribeFromArray$FromArrayProducer.fastPath(OnSubscribeFromArray.java:76)
                                                                             at rx.internal.operators.OnSubscribeFromArray$FromArrayProducer.request(OnSubscribeFromArray.java:58)
                                                                             at rx.Subscriber.setProducer(Subscriber.java:211)
                                                                             at rx.internal.operators.OnSubscribeFromArray.call(OnSubscribeFromArray.java:32)
                                                                             at rx.internal.operators.OnSubscribeFromArray.call(OnSubscribeFromArray.java:24)
                                                                             at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48)
                                                                             at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)
                                                                             at rx.Observable.unsafeSubscribe(Observable.java:10256)
                                                                             at rx.internal.operators.OperatorReplay.connect(OperatorReplay.java:310)
                                                                             at rx.observables.ConnectableObservable.autoConnect(ConnectableObservable.java:125)
                                                                             at rx.observables.ConnectableObservable.autoConnect(ConnectableObservable.java:105)
                                                                             at com.polidea.rxandroidble.internal.connection.DisconnectionRouter.<init>(DisconnectionRouter.java:62)
                                                                             at com.polidea.rxandroidble.internal.connection.DisconnectionRouter_Factory.get(DisconnectionRouter_Factory.java:36)
                                                                             at com.polidea.rxandroidble.internal.connection.DisconnectionRouter_Factory.get(DisconnectionRouter_Factory.java:10)
                                                                             at dagger.internal.DoubleCheck.get(DoubleCheck.java:47)
                                                                             at com.polidea.rxandroidble.internal.connection.RxBleGattCallback_Factory.get(RxBleGattCallback_Factory.java:37)
                                                                         	at com.polidea.rxandroidble.internal.connection.RxBleGattCallback_Factory.get(RxBleGattCallback_Factory.j
 E/BleManager: new Action1<Throwable> bleMac: D5:1D:A7:76:6F:AE
 E/BleManager: new Action1<Throwable> subscriptionMap.size(): 0
 E/BleManager: getOrCreateWbAddress: handle: 268435457
 E/BleManager: getOrCreateWbAddress: wbAddress2: 10000001
 D/BleManager: getConnectedBleDevicesCb()
 D/BleManager: Found connected devices: []
 E/BluetoothDevice: BT not enabled. Cannot get Remote Device name
 E/LinearAccelerationTestActivity: onDisconnect: null D5:1D:A7:76:6F:AE
 E/ConnectionLostDialog: showDialog: 
 E/ConnectionLostDialog: showDialog: DIALOG NOT NULL
 E/BleManager: Could not connect to D5:1D:A7:76:6F:AE
                                                                         BleDisconnectedException{bluetoothDeviceAddress='D5:1D:A7:76:6F:AE'}
                                                                              at com.polidea.rxandroidble.internal.connection.DisconnectionRouter$2.call(DisconnectionRouter.java:57)
                                                                             at com.polidea.rxandroidble.internal.connection.DisconnectionRouter$2.call(DisconnectionRouter.java:54)
                                                                             at rx.internal.operators.OnSubscribeMap$MapSubscriber.onNext(OnSubscribeMap.java:69)
                                                                             at rx.internal.operators.OnSubscribeFilter$FilterSubscriber.onNext(OnSubscribeFilter.java:76)
                                                                             at rx.observers.SerializedObserver.onNext(SerializedObserver.java:91)
                                                                             at rx.observers.SerializedSubscriber.onNext(SerializedSubscriber.java:94)
                                                                             at rx.internal.operators.OnSubscribeConcatMap$ConcatMapSubscriber.innerNext(OnSubscribeConcatMap.java:182)
                                                                             at rx.internal.operators.OnSubscribeConcatMap$ConcatMapInnerScalarProducer.request(OnSubscribeConcatMap.java:366)
                                                                             at rx.internal.producers.ProducerArbiter.setProducer(ProducerArbiter.java:126)
                                                                             at rx.internal.operators.OnSubscribeConcatMap$ConcatMapSubscriber.drain(OnSubscribeConcatMap.java:278)
                                                                             at rx.internal.operators.OnSubscribeConcatMap$ConcatMapSubscriber.onNext(OnSubscribeConcatMap.java:144)
                                                                             at rx.internal.operators.OnSubscribeFromArray$FromArrayProducer.slowPath(OnSubscribeFromArray.java:100)
                                                                             at rx.internal.operators.OnSubscribeFromArray$FromArrayProducer.request(OnSubscribeFromArray.java:63)
                                                                             at rx.Subscriber.setProducer(Subscriber.java:211)
                                                                             at rx.internal.operators.OnSubscribeFromArray.call(OnSubscribeFromArray.java:32)
                                                                             at rx.internal.operators.OnSubscribeFromArray.call(OnSubscribeFromArray.java:24)
                                                                             at rx.Observable.unsafeSubscribe(Observable.java:10256)
                                                                             at rx.internal.operators.OnSubscribeConcatMap.call(OnSubscribeConcatMap.java:94)
                                                                             at rx.internal.operators.OnSubscribeConcatMap.call(OnSubscribeConcatMap.java:42)
                                                                             at rx.Observable.unsafeSubscribe(Observable.java:10256)
                                                                             at rx.internal.operators.OnSubscribeFilter.call(OnSubscribeFilter.java:45)
                                                                             at rx.internal.operators.OnSubscribeFilter.call(OnSubscribeFilter.java:30)
                                                                             at rx.Observable.unsafeSubscribe(Observable.java:10256)
                                                                             at rx.internal.operators.OnSubscribeMap.call(OnSubscribeMap.java:48)
                                                                             at rx.internal.operators.OnSubscribeMap.call(OnSubscribeMap.java:33)
                                                                             at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48)
                                                                             at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)
                                                                             at rx.Observable.unsafeSubscribe(Observable.java:10256)
                                                                             at rx.internal.operators.OperatorMerge$MergeSubscriber.onNext(OperatorMerge.java:248)
                                                                             at rx.internal.operators.OperatorMerge$MergeSubscriber.onNext(OperatorMerge.java:148)
                                                                             at rx.internal.operators.OnSubscribeFromArray$FromArrayProducer.fastPath(OnSubscribeFromArray.java:76)
                                                                             at rx.internal.operators.OnSubscribeFromArray$FromArrayProducer.request(OnSubscribeFromArray.java:58)
                                                                             at rx.Subscriber.setProducer(Subscriber.java:211)
                                                                             at rx.internal.operators.OnSubscribeFromArray.call(OnSubscribeFromArray.java:32)
                                                                             at rx.internal.operators.OnSubscribeFromArray.call(OnSubscribeFromArray.java:24)
                                                                             at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48)
                                                                             at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)
                                                                             at rx.Observable.unsafeSubscribe(Observable.java:10256)
                                                                             at rx.internal.operators.OperatorReplay.connect(OperatorReplay.java:310)
                                                                             at rx.observables.ConnectableObservable.autoConnect(ConnectableObservable.java:125)
                                                                             at rx.observables.ConnectableObservable.autoConnect(ConnectableObservable.java:105)
                                                                             at com.polidea.rxandroidble.internal.connection.DisconnectionRouter.<init>(DisconnectionRouter.java:62)
                                                                             at com.polidea.rxandroidble.internal.connection.DisconnectionRouter_Factory.get(DisconnectionRouter_Factory.java:36)
                                                                             at com.polidea.rxandroidble.internal.connection.DisconnectionRouter_Factory.get(DisconnectionRouter_Factory.java:10)
                                                                             at dagger.internal.DoubleCheck.get(DoubleCheck.java:47)
                                                                             at com.polidea.rxandroidble.internal.connection.RxBleGattCallback_Factory.get(RxBleGattCallback_Factory.java:37)
                                                                         	at com.polidea.rxandroidble.internal.connection.RxBleGattCallback_Factory.get(RxBleGattCallback_Facto
 I/RxBle#DisconnectAction: Connection operations queue to be terminated (D5:1D:A7:76:6F:AE)
 D/RxBle#Executors$RunnableAdapter: Terminated.
 D/RxBle#ClientOperationQueue:   QUEUED DisconnectOperation(209695788)
 E/BleManager: connect: subscriptionMap.put bleMac: D5:1D:A7:76:6F:AE subscription: rx.observers.SafeSubscriber@14d4ef5
 D/RxBle#ClientOperationQueue:  STARTED DisconnectOperation(209695788)
 W/RxBle#QueueOperation: Disconnect operation has been executed but GATT instance was null - considering disconnected.
 D/RxBle#ClientOperationQueue: FINISHED DisconnectOperation(209695788)
 E/BleManager: Try again connect to D5:1D:A7:76:6F:AE
 D/BleManager: connecting to D5:1D:A7:76:6F:AE
 D/BleManager: isConnected: RxBleConnectionState{DISCONNECTED}
 D/BleManager: Connection try: 0
 D/RxBle#ClientOperationQueue:   QUEUED ConnectOperation(92429508)
 D/RxBle#ClientOperationQueue:  STARTED ConnectOperation(92429508)
 D/RxBle#ClientOperationQueue: FINISHED ConnectOperation(92429508)

Actual result

D/BluetoothGatt: connect() - device: D5:1D:A7:76:6F:AE, auto: false
D/BluetoothGatt: registerApp()
D/BluetoothGatt: registerApp() - UUID=75697751-02fe-4dc1-8c65-2e7d90c4ead0
D/BluetoothGatt: onClientRegistered() - status=0 clientIf=5
D/BluetoothGatt: onClientConnectionState() - status=133 clientIf=5 device=D5:1D:A7:76:6F:AE
D/RxBle#BluetoothGatt: onConnectionStateChange newState=0 status=133
E/BleManager: new Action1<Throwable> throwable: 
 BleDisconnectedException{bluetoothDeviceAddress='D5:1D:A7:76:6F:AE'}
     at com.polidea.rxandroidble.internal.connection.RxBleGattCallback$2.onConnectionStateChange(RxBleGattCallback.java:76)
     at android.bluetooth.BluetoothGatt$1.onClientConnectionState(BluetoothGatt.java:181)
     at android.bluetooth.IBluetoothGattCallback$Stub.onTransact(IBluetoothGattCallback.java:70)
     at android.os.Binder.execTransact(Binder.java:453)

Expected result

RxAndroidBle will connect to the device after bluetooth off/on.

@dariuszseweryn
Copy link
Owner

Hello @Esperanz0

I see a status=133 in your Actual result. Why do you think it is a problem with the library?

@KarolMB
Copy link
Author

KarolMB commented Nov 22, 2017

@dariuszseweryn Hi.

When I will kill app and run it again its working so I thought it is something with library.

So if it is no library problem do You have idea how to check where is problem / what failing after bt off/on.

@dariuszseweryn
Copy link
Owner

Try scanning the device after adapter off/on

@dariuszseweryn dariuszseweryn added the question / library Issue containing question / discussion about library workings label Nov 22, 2017
@dariuszseweryn
Copy link
Owner

Actually this question should go to the stackoverflow as this is a general usage question or rather an Android BLE stack quirk. Not an issue with the library

@dariuszseweryn dariuszseweryn changed the title Can't connect again to the BLE device after bluetooth off / on Investigate automatic scanning as a part of RxBleDevice.establishConnection() after adapter on Nov 27, 2017
@dariuszseweryn dariuszseweryn added enhancement and removed question / library Issue containing question / discussion about library workings labels Nov 27, 2017
@dariuszseweryn dariuszseweryn changed the title Investigate automatic scanning as a part of RxBleDevice.establishConnection() after adapter on Investigate auto-scanning on RxBleDevice.establishConnection() Nov 27, 2017
@uKL uKL added this to the 2.0.0 milestone Mar 16, 2018
@thuytrinh
Copy link
Contributor

Hi @uKL, I saw you added this issue into the 2.0.0 milestone. Is there anything you guys can do from the library side?

@dariuszseweryn
Copy link
Owner

I was investigating the issue more deeply recently but unfortunately there is no good solution for the current state of the OS. I will probably create a blog post about the issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants