laptou / bluez-rs

Control Bluetooth on Linux.
MIT License
39 stars 9 forks source link

How to connect to bluetooth devices without pairing #23

Closed EthanYidong closed 3 years ago

EthanYidong commented 3 years ago

I know, I know, I'm an idiot, but for the life of me, I cannot figure out how to connect to bluetooth devices using this library. I'm not looking for pairing, and I'm not using BLE devices, I just need the equivalent of bluetoothctl connect <dev>.

laptou commented 3 years ago

It doesn't look like this functionality is exposed by the BlueZ management API, and therefore is not exposed by this library. This library currently only exposes the management API, which cannot be used to communicate with devices directly, only to administrate them.

If you want to communicate with devices directly or send/receive data from them, you will have to create an L2CAP socket yourself. It seems that this is also the case for connecting to a device that is not paired, as the management API has no such instruction.

EthanYidong commented 3 years ago

Ah, thanks for the info.