Connecting two raspberry pi through bluetooth with

2019-08-27 20:07发布

问题:

I'm trying to use this API: https://www.linumiz.com/bluetooth-connectdevice-without-scanning/ to make a connection between two Raspberry PI. I'm using this program like a server such as:

pi@raspberrypi:~/bluetoothC $ sudo ./bin/bluez_adapter_connect

Adapter is Powered "on"

and then, in the client side:

pi@raspberrypi:~/bluetoothC $ sudo ./bin/bluez_adapter_connect B8:27:EB:9F:91:A7

Adapter is Powered "on" Unable to get result: GDBus.Error:org.freedesktop.DBus.Error.UnknownMethod: Method "ConnectDevice" with signature "a{sv}" on interface "org.bluez.Adapter1" doesn't exist

But I don't understand this error. I'm doing this correctly? If not, what I have to do?

回答1:

As mentioned in the article, ConnectDevice is the new adapter API introduced in BlueZ 5.49. Refer release notes here for more details.

This API is still marked as experimental, so you need to run bluetoothd daemon in experimental mode, i.e by passing "-E" as extra argument when starting bluetoothd.

So you need,

  1. BlueZ 5.49 or later
  2. Run bluetoothd daemon with "-E" option