react-native-ble-manager
react-native-ble-manager copied to clipboard
Characteristics not found after connecting to Raspberry Pi
Before open an issue
Thank you for building and maintaining such a useful library. I have been using it without any issues until recently but have started facing issues with it recently.
characteristics
are returned empty after I connect to the pi and retrieve services from it. It was working fine earlier when I was using Raspberry Pi 3B+ with its inbuilt Bluetooth.
Now, I am using Raspberry Pi 3B with a USB Bluetooth. Is it possible that this library is not possible with USB Bluetooth on the pi. Just to reiterate, I am following the same steps as I was using on the other Pi model.
PS: I am aware that this issue might either be an upstream issue or can be a configuration issue on my end. I am opening an issue here to just eliminate the possibilities.
Version
Tell us which versions you are using:
- react-native-ble-manager v6.7.1
- react-native v0.60.6
- iOS/Android v.8.1
Expected behaviour
I have cloned the pizza peripheral service on the raspberry pi and am trying to use it. When I retrieve services after connecting to the pi, it returns characteristics
and services
to be empty. It shouldn't be returned empty as the service and characteristic are properly defined.
Actual behaviour
The characteristics
and services
arrays return empty when I try to retrieve services.
Steps to reproduce
Stack trace and console log
2020-10-02 16:56:30.577 16634-16663/com.spyralproject D/ReactNativeBleManager: Peripheral event (BleManagerConnectPeripheral):5C:F3:70:9C:8E:69
2020-10-02 16:56:30.577 16634-16663/com.spyralproject D/ReactNativeBleManager: Connected to: 5C:F3:70:9C:8E:69
2020-10-02 16:56:30.658 16634-16675/com.spyralproject I/ReactNativeJS: Connected to 5C:F3:70:9C:8E:69
2020-10-02 16:56:30.755 16634-16663/com.spyralproject D/BluetoothGatt: onSearchComplete() = Device=5C:F3:70:9C:8E:69 Status=0
2020-10-02 16:56:30.998 16634-16663/com.spyralproject D/BluetoothGatt: onConnectionUpdated() - Device=5C:F3:70:9C:8E:69 interval=6 latency=0 timeout=500 status=0
2020-10-02 16:56:31.135 16634-16663/com.spyralproject D/BluetoothGatt: onConnectionUpdated() - Device=5C:F3:70:9C:8E:69 interval=39 latency=0 timeout=500 status=0
2020-10-02 16:56:31.573 16634-16676/com.spyralproject D/ReactNativeBleManager: Retrieve services from: 5C:F3:70:9C:8E:69
2020-10-02 16:56:31.573 16634-16676/com.spyralproject D/BluetoothGatt: discoverServices() - device: 5C:F3:70:9C:8E:69
2020-10-02 16:56:31.579 16634-16663/com.spyralproject D/BluetoothGatt: onSearchComplete() = Device=5C:F3:70:9C:8E:69 Status=0
2020-10-02 16:56:31.604 16634-16675/com.spyralproject I/ReactNativeJS: { characteristics: [],
services: [],
advertising:
{ txPowerLevel: -2147483648,
serviceData: {},
serviceUUIDs: [ '13333333-3333-3333-3333-333333333337' ],
localName: 'spyral-raspberry',
isConnectable: true,
manufacturerData:
{ bytes:
[ 2,
1,
6,
17,
6,
55,
51,
51,
51,
51,
51,
51,
51,
51,
51,
51,
51,
51,
51,
51,
19,
17,
8,
115,
112,
121,
114,
97,
108,
45,
114,
97,
115,
112,
98,
101,
114,
114,
121,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0 ],
data: 'AgEGEQY3MzMzMzMzMzMzMzMzMzMTEQhzcHlyYWwtcmFzcGJlcnJ5AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=',
CDVType: 'ArrayBuffer' } },
rssi: -34,
id: '5C:F3:70:9C:8E:69',
name: 'spyral-raspberry' }
2020-10-02 16:56:31.822 16634-16676/com.spyralproject D/ReactNativeBleManager: startNotification
2020-10-02 16:56:31.824 16634-16676/com.spyralproject D/ReactNativeBleManager: registerNotify
2020-10-02 16:56:31.824 16634-16676/com.spyralproject D/ReactNativeBleManager: setNotify
2020-10-02 16:56:31.828 16634-16676/com.spyralproject E/ReactNativeBleManager: Error retriving characteristic 13333333-3333-3333-3333-333333330003
java.lang.NullPointerException: Attempt to invoke virtual method 'java.util.List android.bluetooth.BluetoothGattService.getCharacteristics()' on a null object reference
at it.innove.Peripheral.findNotifyCharacteristic(Peripheral.java:505)
at it.innove.Peripheral.setNotify(Peripheral.java:442)
at it.innove.Peripheral.registerNotify(Peripheral.java:490)
at it.innove.BleManager.startNotification(BleManager.java:277)
at java.lang.reflect.Method.invoke(Native Method)
at com.facebook.react.bridge.JavaMethodWrapper.invoke(JavaMethodWrapper.java:372)
at com.facebook.react.bridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:158)
at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method)
at android.os.Handler.handleCallback(Handler.java:794)
at android.os.Handler.dispatchMessage(Handler.java:99)
at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:29)
at android.os.Looper.loop(Looper.java:176)
at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(MessageQueueThreadImpl.java:232)
at java.lang.Thread.run(Thread.java:764)
2020-10-02 16:56:31.834 16634-16675/com.spyralproject I/ReactNativeJS: 'Notification error', 'Characteristic 13333333-3333-3333-3333-333333330003 not found'
Did you solve it ?