1 <refentry id="gdbus" lang="en">
4 <refentrytitle>gdbus</refentrytitle>
5 <manvolnum>1</manvolnum>
6 <refmiscinfo class="manual">User Commands</refmiscinfo>
10 <refname>gdbus</refname>
11 <refpurpose>Introspect and call remote objects</refpurpose>
16 <command>gdbus</command>
17 <arg choice="plain">introspect</arg>
19 <arg choice="plain">--system</arg>
20 <arg choice="plain">--session</arg>
21 <arg choice="plain">--address <replaceable>address</replaceable></arg>
23 <arg choice="plain">--dest <replaceable>bus_name</replaceable></arg>
24 <arg choice="plain">--object-path <replaceable>/path/to/object</replaceable></arg>
27 <command>gdbus</command>
28 <arg choice="plain">monitor</arg>
30 <arg choice="plain">--system</arg>
31 <arg choice="plain">--session</arg>
32 <arg choice="plain">--address <replaceable>address</replaceable></arg>
34 <arg choice="plain">--dest <replaceable>bus_name</replaceable></arg>
36 <arg choice="plain">--object-path <replaceable>/path/to/object</replaceable></arg>
40 <command>gdbus</command>
41 <arg choice="plain">call</arg>
43 <arg choice="plain">--system</arg>
44 <arg choice="plain">--session</arg>
45 <arg choice="plain">--address <replaceable>address</replaceable></arg>
47 <arg choice="plain">--dest <replaceable>bus_name</replaceable></arg>
48 <arg choice="plain">--object-path <replaceable>/path/to/object</replaceable></arg>
49 <arg choice="plain">--method <replaceable>org.project.InterfaceName.MethodName</replaceable></arg>
50 <arg choice="plain">ARG1</arg>
51 <arg choice="plain" rep="repeat">ARG2</arg>
54 <command>gdbus</command>
55 <arg choice="plain">help</arg>
60 <title>Description</title>
62 <command>gdbus</command> offers a simple commandline utility for
63 introspecting and calling methods on remote objects.
66 <title>Commands</title>
69 <term><option>introspect</option></term>
71 Prints out interfaces and property values for a remote object.
72 For this to work, the owner of the object needs to implement the
73 <literal>org.freedesktop.DBus.Introspectable</literal> interface.
77 <term><option>monitor</option></term>
79 Monitors one or all objects owned by the owner of
80 <replaceable>bus_name</replaceable>.
84 <term><option>call</option></term>
86 Invokes a method on a remote object. Each argument to pass to the
87 method must be specified as a serialized
88 <link linkend="GVariant"><type>GVariant</type></link> except that strings do
89 not need explicit quotes. The return values are printed out as
90 serialized <link linkend="GVariant"><type>GVariant</type></link>
95 <term><option>help</option></term>
105 <title>Bash Completion</title>
107 <command>gdbus</command> ships with a bash completion script to
108 complete commands, destinations, bus names, object paths and
109 interface/method names.
114 <title>Examples</title>
115 This shows how to introspect an object - note that the value of each
116 property is displayed:
118 $ gdbus introspect --system \
119 --dest org.freedesktop.NetworkManager \
120 --object-path /org/freedesktop/NetworkManager/Devices/0
121 node /org/freedesktop/NetworkManager/Devices/0 {
122 interface org.freedesktop.DBus.Introspectable {
124 Introspect(out s data);
126 interface org.freedesktop.DBus.Properties {
134 GetAll(in s interface,
137 interface org.freedesktop.NetworkManager.Device.Wired {
139 PropertiesChanged(a{sv} arg_0);
141 readonly b Carrier = false;
142 readonly u Speed = 0;
143 readonly s HwAddress = '00:1D:72:88:BE:97';
145 interface org.freedesktop.NetworkManager.Device {
149 StateChanged(u arg_0,
153 readonly u DeviceType = 1;
154 readonly b Managed = true;
155 readwrite o Ip6Config = '/';
156 readwrite o Dhcp4Config = '/';
157 readwrite o Ip4Config = '/';
158 readonly u State = 2;
159 readwrite u Ip4Address = 0;
160 readonly u Capabilities = 3;
161 readonly s Driver = 'e1000e';
162 readwrite s Interface = 'eth0';
163 readonly s Udi = '/sys/devices/pci0000:00/0000:00:19.0/net/eth0';
168 In a similar fashion, the <option>introspect</option> command can be
169 used to learn details about the <literal>Notify</literal> method:
173 interface org.freedesktop.Notifications {
175 GetServerInformation(out s return_name,
177 out s return_version,
178 out s return_spec_version);
179 GetCapabilities(out as return_caps);
180 CloseNotification(in u id);
181 Notify(in s app_name,
194 With this information, it's easy to use the <option>call</option>
195 command to display a notification
198 $ gdbus call --session \
199 --dest org.freedesktop.Notifications \
200 --object-path /org/freedesktop/Notifications \
201 --method org.freedesktop.Notifications.Notify \
206 "Here's the body of the notification" \
213 Monitoring all objects on a service:
216 $ gdbus monitor --system --dest org.freedesktop.ConsoleKit
217 Monitoring signals from all objects owned by org.freedesktop.ConsoleKit
218 The name org.freedesktop.ConsoleKit is owned by :1.15
219 /org/freedesktop/ConsoleKit/Session2: org.freedesktop.ConsoleKit.Session.ActiveChanged (false,)
220 /org/freedesktop/ConsoleKit/Seat1: org.freedesktop.ConsoleKit.Seat.ActiveSessionChanged ('',)
221 /org/freedesktop/ConsoleKit/Session2: org.freedesktop.ConsoleKit.Session.ActiveChanged (true,)
222 /org/freedesktop/ConsoleKit/Seat1: org.freedesktop.ConsoleKit.Seat.ActiveSessionChanged ('/org/freedesktop/ConsoleKit/Session2',)
225 Monitoring a single object on a service:
228 $ gdbus monitor --system --dest org.freedesktop.NetworkManager --object-path /org/freedesktop/NetworkManager/AccessPoint/4141
229 Monitoring signals on object /org/freedesktop/NetworkManager/AccessPoint/4141 owned by org.freedesktop.NetworkManager
230 The name org.freedesktop.NetworkManager is owned by :1.5
231 /org/freedesktop/NetworkManager/AccessPoint/4141: org.freedesktop.NetworkManager.AccessPoint.PropertiesChanged ({'Strength': <byte 0x5c>},)
232 /org/freedesktop/NetworkManager/AccessPoint/4141: org.freedesktop.NetworkManager.AccessPoint.PropertiesChanged ({'Strength': <byte 0x64>},)
233 /org/freedesktop/NetworkManager/AccessPoint/4141: org.freedesktop.NetworkManager.AccessPoint.PropertiesChanged ({'Strength': <byte 0x5e>},)
234 /org/freedesktop/NetworkManager/AccessPoint/4141: org.freedesktop.NetworkManager.AccessPoint.PropertiesChanged ({'Strength': <byte 0x64>},)
240 <title>AUTHOR</title>
242 Written by David Zeuthen <email>zeuthen@gmail.com</email> with
243 a lot of help from many others.
250 Please send bug reports to either the distribution bug tracker
251 or the upstream bug tracker at
252 <ulink url="https://bugzilla.gnome.org/enter_bug.cgi?product=glib"/>.
257 <title>SEE ALSO</title>
260 <refentrytitle>dbus-send</refentrytitle><manvolnum>1</manvolnum>