Closed zabojad closed 2 years ago
Hi @don ! Any thought on this one?
@zabojad I can't duplicate this
I'm using this project https://github.com/don/ITP-BluetoothLE/tree/master/phonegap/thermometer
cordova platform add ios
cordova plugin add cordova-plugin-ble-central
cordova plugin add cordova-plugin-dialogs
Run the app, connect to the thermometer peripheral. After a few notifications, pull the power on the peripheral. App gets the disconnect dialog then goes back to scan screen after clicking ok. Turn the peripheral back on. Connect in the app. I see notifications.
Do you see the same behavior if you use LightBlue Explorer?
Can you run a BLE sniffer to see if the peripheral if the 2902 descriptor is being set and the peripheral is sending a notification after the reconnect?
Hey @don !
I do not reproduce the issue with LightBlue Explorer (nor with cordova-plugin-ble-central on Android).
Can you run a BLE sniffer to see if the peripheral if the 2902 descriptor is being set and the peripheral is sending a notification after the reconnect?
What BLE sniffer do you use?
I'm trying to debug the problem and for a reason I do not understand, didUpdateValueForCharacteristic
is never raised when the problem occurs...
Can you run a BLE sniffer to see if the peripheral if the 2902 descriptor is being set and the peripheral is sending a notification after the reconnect?
If it works with Android, it should be OK on the peripheral side no?
For the time being, I've applied a workaround on the app side by detecting if no notification come from the peripheral. If that's the case, I disconnect from the app side, scan/discover and reconnect to the peripheral. Doing that, it works back as it should...
@zabojad For iOS I like using the Nordic nRF Sniffer with the nRF51/51 SDK to man-in-the-middle the connection. I think that only works if your peripheral is nRF5x based.
That's odd that didUpdateValueForCharacteristic
is never called. After you re-connect, are you calling ble.subscribe
again? Is it possible to make a very simple app that causes the problem?
@don
After you re-connect, are you calling ble.subscribe again?
You mean ble.startnotification
?
Yes, I call it right in the success callback of the ble.connect
method...
You mean ble.startnotification? yes
Is this the same problem at #476?
No unfortunately, I've tried this fix and it did not solve my issue... In my case, I do not call ble.stopNotification
...
@zabojad Can you try the latest commit ac55995dc9e9d19f231c13e6bbfb9ba24b076480 to see it makes a difference? If it's still broken, can you share some code with me that causes the issue?
Also what version of iOS and Xcode are you running?
@don please let this ticket open, I'm going to vacations and won't be able to work on this until August...
make sure you are using write() instead of writeWithoutResponse(), this solved my issue on ios
Hi , has anyone solved this issue. We are facing the same issue on iOS only, where if we reconnect bluetooth and call startNotification, the subscribe event is never called , i.e. we are not getting any response. It works fine for the first time connection. Any pointers would really help.
I've noticed that if the startNotification
fails during setup on iOS that the error is never passed back to the javascript layer.
I'm not sure why reconnecting would impact this or make it more likely to fail however, unless the peripheral is rejecting the request to activate notifications for some reason.
There's an obvious bug to fix at least, so I'll put up a PR for this.
I've raised a fix at https://github.com/don/cordova-plugin-ble-central/pull/893 that improves the situation for me locally. Would be great to hear if it makes any difference to the cases identified here.
A fix is available in pre-release in case anyone has time to test it: https://www.npmjs.com/package/cordova-plugin-ble-central/v/1.4.3-alpha.1
I tested 1.4.3-alpha.1 on iOS and my startNotification is not returning success scenarios.
The only thing different from this(https://github.com/don/ITP-BluetoothLE/blob/master/phonegap/thermometer/www/js/index.js) code to mine is it calls read after startNotification, which I do not.
Trying to see if calling stopNotification when disconnecting helps iOS as this bug is preventing us from using this plugin atm :(
Tested 1.4.4-alpha.1 and still having the issue
@tigohenryschultz are you able to move that to a new issue... that sounds unrelated to the described bug here.
Yeah, I wasn't sure if it was the same because we were not disconnecting first.
Hi !
I'm having this issue only on iOS with
cordova-plugin-ble-central
1.1.9.I'm connecting to a peripheral and listens to its notifications. Everything works fine.
Now, if I:
Can you please fix it?