Using bluez-libs for non-blocking I/O
Hi,
I've been digging the bluez mailing lists and the source code of the libraries for a while, but couldn't find a solution for my problem yet. I'm writing a bluetooth library in C++, it wraps the whole bluez-libs around C++ objects, I'll use it for my project of a GUI-based bluetooth management tool.
Things have not been though until now, I've layed out the whole class hierarchy and most class member functions don't do anything but calling their bluez-counterpart.
Now I wanted to implement an event-driven interface, using libsigc++ to provide a basic callback mechanism (basically, the library gets a event from the hci device and dispatches it to the originating object trough the appropriate callback functor) but this is giving me quite some headaches, I'm going to have a single, separate, thread which does all the poll()ing stuff, I want to reuse as most of the original bluez library as possible, but I don't know how to make the existing hci_send_req() return immediately without waiting for a reply (which, in case of a asynchronous request, will be handled in the event-dispatching-thread described above), I don't want to rewrite hci_send_req() nor any of the many functions which rely on it, which could be the best solution ?
Another question: the existing kernel modules and the library are able to handle multiple pending requests at once or am I just wasting my time trying to do something Bluez wasn't actually designed for ?
thanks in advance,
Paul
-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies from IBM. Find simple to follow Roadmaps, straightforward articles, informative Webcasts and more! Get everything you need to get up to speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel
Marcel Holtmann
maintainerHi Paul,
Quoted 12 lines
I've been digging the bluez mailing lists and the source code of the libraries for a while, but couldn't find a solution for my problem yet. I'm writing a bluetooth library in C++, it wraps the whole bluez-libs around C++ objects, I'll use it for my project of a GUI-based bluetooth management tool.
Things have not been though until now, I've layed out the whole class hierarchy and most class member functions don't do anything but calling their bluez-counterpart.
Now I wanted to implement an event-driven interface, using libsigc++ to provide a basic callback mechanism (basically, the library gets a event from the hci device and dispatches it to the originating object trough the appropriate callback functor) but this is giving me quite
Quoted 8 lines
some headaches, I'm going to have a single, separate, thread which does all the poll()ing stuff, I want to reuse as most of the original bluez library as possible, but I don't know how to make the existing
hci_send_req()return immediately without waiting for a reply (which, in case of a asynchronous request, will be handled in the event-dispatching-thread described above), I don't want to rewritehci_send_req()nor any of the many functions which rely on it, which could be the best solution ?
you need to use the raw HCI socket directly for this task. Examples on how to do this have been posted to mailing list some time ago.
Quoted 3 lines
Another question: the existing kernel modules and the library are able to handle multiple pending requests at once or am I just wasting my time trying to do something Bluez wasn't actually designed for ?
This depends on. For the same request, we handle it badly. For different requests this should work.
Regards
Marcel
-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies from IBM. Find simple to follow Roadmaps, straightforward articles, informative Webcasts and more! Get everything you need to get up to speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel