I need to change the Secure Simple Pairing mode programmatically, but I can't figure out how to set SSP mode on or off in Bluez using a DBus command.
Using btmgmt
utility, I just do:
btmgmt ssp off
btmgmt ssp on
Ok, but what I need is rather DBus method calls that I can include in my application.
But the Bluez documentation doesn't seem to mention any DBus method to change the SSP mode.
Does anyone know how to do that? (a gdbus call
or dbus-send
example would be just great).
Or is this just impossible?
There is no way you can do this using DBus. Bluez has no DBus API for this. You need to either use Bluetooth Management socket interface to toggle SSP mode or you can do this using bluez deprecated HCI interface.
To know how to use Bluetooth Management sockets see bluez-5-X/doc/mgmt-api.txt file in bluez-5.X source directory. Command code to toggle SSP is 0x000B
. Actually, this is how btmgmt
tool enables/disables SSP. It uses Bluetooth Management socket. Search keyword ssp
in bluez-5.X/tools/btmgmt.c and see the sample C code.
You can also do this using deprecated hci API (not recommended). See hci_write_simple_pairing_mode
method in bluez-5-X/lib/hci.c.