Async: Implementation of *_async versions for long-blocking calls
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
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.
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.
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:
- GattLib++ https://github.com/psychogenic/gattlibpp
- on top of that, I built the BLE plugin for Coraline
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. Cheers, Pat D