Hi. I've seen through the posts that the API does not support selecting hci adapter, but i can see that those posts are from a year ago, is there any change in this? If i have three hci devices which device will lightblue select? The other two will remain unused?
Thanks in advance.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
No, I think pybluez only allows you to bind to a local adapter for server sockets not client sockets.
One way of doing what you want is to use Python extensions. If you look at the lightblue source code for OBEXClient (which is used by sendfile()), you'll see it uses another internal OBEXClient class that takes a file descriptor for the client socket. You can create a Python extension that creates a Bluetooth socket that binds to the desired adapter (defined using the sockaddr struct) and then pass that socket's file descriptor to the internal OBEXClient class.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi. I've seen through the posts that the API does not support selecting hci adapter, but i can see that those posts are from a year ago, is there any change in this? If i have three hci devices which device will lightblue select? The other two will remain unused?
Thanks in advance.
No, multiple adapter support is not implemented yet and probably won't be anytime soon. If you have three hci devices it will probably use hci0.
If you are using server sockets, you can try using pybluez to bind to a particular adapter.
Could I bind with pybluez to a particular adapter and then use lightblue.obex.sendfile()? How could i do that?
Thanks in advance.
No, I think pybluez only allows you to bind to a local adapter for server sockets not client sockets.
One way of doing what you want is to use Python extensions. If you look at the lightblue source code for OBEXClient (which is used by sendfile()), you'll see it uses another internal OBEXClient class that takes a file descriptor for the client socket. You can create a Python extension that creates a Bluetooth socket that binds to the desired adapter (defined using the sockaddr struct) and then pass that socket's file descriptor to the internal OBEXClient class.