-
Notifications
You must be signed in to change notification settings - Fork 452
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
bleno advertising not working after noble peripheral disconnect #64
Comments
@remydavid the Linux kernel is probably in a bad state when you try to re-start advertising. One suggestion, try moving the Also, |
I am not sure I understand your suggestion to move startIBeaconAdvertising in a callback to disconnect, since it is already the case :
I will try to hack Isn't it possible to scan and broadcast at the same time ? this would solve the problem of start/stopping the advertising. Currently if I don't stop the broadcast I got |
Ok after one day of digging, the problem comes from both bleno and noble using their own l2cap thread opening the same socket for communicating with l2cap. In particular, the problem arise when noble l2cap-ble.js spawn its thread on connect (noble l2cap-ble.js at line 188) while bleno was already loaded (bleno spawn its own l2cap-ble thread at require time, bleno bindings.js line 13). If I comment out all l2cap code from bleno (in bleno bindings.js), I am able to both advertise and connect to a peripheral at the same time. So at the end, it seems bleno and noble are not really designed to work together. The right think to do would be to merge the 2 modules so they can use the same l2cap thread, but that means a lot of work. In the meantime, maybe it's worth mentioning this issue in the documentation. |
@remydavid I was thinking the
would ensure the listener is only attached once and removed. It is possible to scan and advertise at the same time (see https://github.com/sandeepmistry/node-bleacon/blob/master/test.js for iBeacon example). However you cannot advertise and connect at the same time, with the 4.0 spec, but looks like 4.1 will fix this. |
@remydavid any updates on this? |
For the moment I commented out all l2cap code from bleno (in bleno bindings.js) to be able to advertise and connect at the same time, it works for what we need to do so I did not dig further. I was not under the impression disconnect was firing multiple time but I did not test your suggestion. |
Ok, I'll close the issue then. |
@remydavid are you able to share what you did to get noble and bleno running on the same Linux box? I've found myself in a scenario where I need to advertise on the same box as the central (since the phone will also be a central and a peripheral). Did you need to create a new node process for the bleno client vs. the noble client (so the requires weren't shared) or were you able to manage to be in a scenario where you could require both modules in the same script? Thanks a lot in advance :D edit: I went back and re-read your comments and it looks like you do have 2 BLE adapters in your scenario where I would only have 1, so maybe it's a bust and I can't broadcast from the central and will just need to write to connected peripherals. |
Trying to use bleno for BLE broadcasting just after disconnecting from a peripheral won't work.
We want to scan and connect to a peripheral while broadcasting BLE packets using the same adapter.
Since it doesn't seems possible, we do :
Step 5 don't thow an error but doesn't actually resume broadcast.
I have a small test program here :
https://gist.github.com/remydavid/d3d2cec640d290e2ca44
Tested on 2 linux box with 2 different BLE adapters (bleno 0.1.5, node v0.10.30, BlueZ 5.21)
The text was updated successfully, but these errors were encountered: