-
Notifications
You must be signed in to change notification settings - Fork 23
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
Simple BLE #46
Simple BLE #46
Conversation
Just tried this branch on Windows and it was so much easier to get going with it than the published version. Can't wait for it to become upstream :) |
FWIW I fried the device board in an unrelated accident since writing this comment, so looks like I can wait after all 😅 |
Sorry, forgot to push. It's in my simpleble-port branch. |
Erk, was hoping for a drop-in fix with some wiring, but it looks like the entire cpp interface has changed :/ |
Yeah, sorry. Objects turned out to be necessary because the only way to get callbacks to work was with function references. If you don't want to change your code, I can make whatever changes you want to my branch so you can merge it. I changed it so that |
Thanks, I have grabbed your latest bindings and updated these on this branch: https://github.com/thegecko/webbluetooth/tree/simple-ble-update Although everything compiles, I'm getting this error when a device is found:
I seem to remember having this issue before when using the found callback so the adapter previously used the simpleble_adapter_scan_get_results_handle instead. Your new API no longer exposes this method, so I'll see if I can fix the issue... |
UPDATE: Just found the |
OK, so I have your latest updates in to this branch and working as well as before. I much prefer this interface, very clean 👍 Unfortunately I still see errors for the
I'm still using polling to get round the BTW, I had to fix a couple of issues in your code:
Any other ideas for fixing these callback issues? |
Simple ble update
I'll take a look. I'm on vacation, so I don't have access to a Windows laptop. I'll definitely keep working on this, though. Can you try building my branch and see if it has the same error? That will help narrow it down. If you still do, I'll send you some debug statements to add to peripheral.cpp to identify where the problem is. |
My Windows machine doesn't have bluetooth so all my dev/testing is done on macOS. I tried your branch. I can build it, but can't work out how to run anything due to the module system
As the |
The Deno port is not working at all ATM in my branch (I decided to wait until I got the Node stuff finished). The Which version of Node.js are you using? I am getting that V8 error when using your branch. Looking into it. This would all have been so much easier if ThreadSafeFunction just worked. |
I think I finally got it! The problem with ThreadSafeFunction was that it would block the program from exiting. I managed to solve that with HandleScope and Unref. There can sometimes be a delay (<1s) but all callbacks, including Should be much safer now that it's using TSFN. |
Nice work! I tried your update earlier and saw callbacks working. I'll update the lib and tests on this branch. |
Thanks to the awesome efforts from @Symbitic , this is ready to be merged. I'll leave it open for a few days for comment. |
I think this looks great! Good job! I'll close my PR and start a new fork to start adding things incrementally, like removing Node-specific things like EventEmitter so I can start on Deno compatibility later. For now, the important thing is: webbluetooth no longer requires sudo on Linux and installing custom drivers on Windows! 🥳 |
webbluetooth@3.0.2 has just been released containing the new SimpleBLE backend. I've tested this on MacOS (the only system I have access to), would love to hear how this works for others! |
Tested on Linux. Looks good to me. |
Switch backend to use SimpleBLE