Device was Disconnected - monitorCharacteristicForService
See original GitHub issuePrerequisites
- I am running the latest version
- I checked the documentation and found no answer
- I checked to make sure that this issue has not already been filed
Expected Behavior
Monitoring a characteristic for notifications, should receive the notifications.
Current Behavior
Receive an error that is not very detailed, I tried adding logs to the java code, to see what happens and where. This is as far as I’ve come:
In BleModule.java, the function “safeMonitorCharacteristicForDevice”, the setupMode is set to “QUICK_SETUP”, and it setup a notification (
if ((properties & BluetoothGattCharacteristic.PROPERTY_NOTIFY) != 0) {
Log.e("BleModule", "[safeMonitorCharacteristicForDevice] setupNotification");
return connection.setupNotification(gattCharacteristic, setupMode);
}
And the error function gets invoked:
@Override
public void onError(Throwable e) {
Log.e("BleModule", "[safeMonitorCharacteristicForDevice] onError error toString: " + e.toString());
Log.e("BleModule", "[safeMonitorCharacteristicForDevice] onError error message: " + e.getMessage());
errorConverter.toError(e).reject(promise);
transactions.removeSubscription(transactionId);
}
The Log.e produce the following:
E/BleModule: [safeMonitorCharacteristicForDevice] setup mode: Quick Setup
E/BleModule: [safeMonitorCharacteristicForDevice] setupNotification
E/BleModule: [safeMonitorCharacteristicForDevice] onError error toString: com.polidea.rxandroidble.exceptions.BleDisconnectedException: Disconnected from .... with status 0 (GATT_SUCCESS)
E/BleModule: [safeMonitorCharacteristicForDevice] onError error message: Disconnected from .... with status 0 (GATT_SUCCESS)
Where “…” is a unique device ID.
Steps to Reproduce
Please provide detailed steps for reproducing the issue.
- writeCharacteristicWithoutResponseForService for the RECORD_ACCESS_CONTROL_POINT, with the byte values [1, 1], encoded in Base64 format.
- monitorCharacteristicForService for the Glucose Measurement (00002A18) and Glucose Measurement Context (00002A34) characteristic.
- Experience the error.
Context
- Library version: “react-native-ble-plx”: “^1.0.3”
- Platform: Android
Issue Analytics
- State:
- Created 4 years ago
- Comments:12
Top Results From Across the Web
dotintent/react-native-ble-plx - Device was Disconnected
Prerequisites I am running the latest version I checked the documentation and found no answer I checked to make sure that this issue...
Read more >RxBLELibraries/react-native-ble - Gitter
Hi, I'm facing same problem as @pride7 I'm not able to send data through my Bluetooth device. After connection I do : device....
Read more >react-native-ble-plx 2.0.2 | Documentation
Connecting and discovering services and characteristics. Once device is scanned it is in disconnected state. We need to connect to it and discover...
Read more >cant subscribe to a ble service with react native ble-plx
new here. I am trying to write an app which pulls data from an ESP32 ble device. I am using the ble-plx library....
Read more >react-native-ble-plx - npm
Monitors if device was disconnected due to any errors or connection ... monitorCharacteristicForService(serviceUUID, characteristicUUID ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@harguus I put
setInterval
inside theconnect()
function. Here is a simplified code. Your code will be different depending on how you connect to your device:@joaovitorqueiroz In my case, the device was disconnecting after 45 seconds. So I added
setInterval
to dowriteCharacteristicWithoutResponseForService
every 40 seconds(which just gets the status of the device). And it keeps the device connected.