Skip to content
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

Open
wants to merge 12 commits into
base: master
Choose a base branch
from

Conversation

psychogenic
Copy link

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:

  1. 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).

  2. 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

…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...
@psychogenic
Copy link
Author

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.

@psychogenic
Copy link
Author

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.

@oliviermartin
Copy link
Contributor

I think I fixed the continuous integration (some distribution package were out of date).

Note: I have not looked at your changes yet.

@psychogenic
Copy link
Author

psychogenic commented Jan 3, 2018

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.
Cheers,
Pat D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants