I want to call method RegisterAgent
with gdbus
but I can't find the proper syntax to do so.
Introspecting on /org/bluez
with this command
$ gdbus introspect --system --dest org.bluez --object-path /org/bluez --recurse
shows that method RegisterAgent
on interface org.bluez.AgentManager1
has the following signature:
RegisterAgent(in o agent,
in s capability);
but I can't find any example showing how to pass an object to a method in the gdbus reference documentation, nor in the numerous examples I've found on the Internet.
So I don't know how to pass an agent as first argument, for example I'd like to select KeyboardOnly
as agent, but how can this be done?
With dbus-send
, this gives:
dbus-send --print-reply --system --dest=org.bluez /org/bluez \
--type=method_call org.bluez.AgentManager1.RegisterAgent \
objpath:/org/bluez/agent1 string:KeyboardOnly
But I can't find how to do this with a gdbus call. Any idea?
I spied on the actual commands sent through DBus using
dbus-monitor --system
With trial and error, I finally found the correct syntax.
The gdbus command I was trying to make can be spelled like so:
gdbus call --system --dest org.bluez --method \
org.bluez.AgentManager1.RegisterAgent --object-path /org/bluez \
/org/bluez/agent KeyboardOnly
So passing an object as parameter to gdbus is done by spelling its path, for instance /org/bluez/agent
in our case. It seems to me this is not documented.
By the way, the corresponding dbus-send
command is spelled almost the same
dbus-send --print-reply --system --dest=org.bluez /org/bluez \
--type=method_call org.bluez.AgentManager1.RegisterAgent \
objpath:/org/bluez/agent1 string:KeyboardOnly
but for the agent object path... /org/bluez/agent1 for dbus-send
, and just /org/bluez/agent for gdbus
. I don't think this aspect is documented either.