-
Notifications
You must be signed in to change notification settings - Fork 161
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
Async: Implementation of *_async versions for long-blocking calls #54
base: master
Are you sure you want to change the base?
Conversation
…an/connect/read/write), that use callbacks to report completion or return data. A ble_scan_async sample is included and a C++ library using these will be made available shortly.
…async connect function and break naming convention...
A continuous integration test was failing, some use of a pre-existing gattlib_connect_async() that isn't actually used on my system (probably for the older bluez?). Renamed my async w/callback version of connect to avoid the clash. |
… bluez is a whole 'nother story.
Ok, so I hadn't realized how drastically different the dbus and bluez versions were. I've restricted the async stuff to the dbus at this stage, but tests are still failing as the testing system can't find bluetooth.h ? Not sure what that's about, let me know if you need anything. |
…terfering with glib based apps.
…higher up while catching the dbus signal on connect.
I think I fixed the continuous integration (some distribution package were out of date). Note: I have not looked at your changes yet. |
Hi, Well, sorry about the string of commits, there... I was building something and kept needing tweaks. The good news is that, using my modded gattlib I built:
So you can see the modded gattlib working and in action in the short intro video on Coraline's home page... Let me know if you have any questions or need anything from me. |
0f6ab98
to
860f7f5
Compare
These mods provide async versions of scan/connect/read-write related functions. Though I moved some things around in the original sync versions, they are left as-is.
Caveats and limitations:
though the calls provided are asynchronous, they are limited to being called one at a time (e.g. if you read a characteristic, you need to wait until you get an answer, or a failure, callback before writing another).
I didn't want to impose any kind of threading model on the system, so you need to "tick" the system for the async functions to work. This can be done in a main loop, a thread, whatever you want, and the callbacks will be triggered in the given context.
Note: I know neither bluez nor glib, so the implementation is a bit hacky and may not be ideal... suggestions/improvements welcome.
Regards,
Pat Deegan