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>
25 <arg choice="plain">--xml</arg>
28 <command>gdbus</command>
29 <arg choice="plain">monitor</arg>
31 <arg choice="plain">--system</arg>
32 <arg choice="plain">--session</arg>
33 <arg choice="plain">--address <replaceable>address</replaceable></arg>
35 <arg choice="plain">--dest <replaceable>bus_name</replaceable></arg>
37 <arg choice="plain">--object-path <replaceable>/path/to/object</replaceable></arg>
41 <command>gdbus</command>
42 <arg choice="plain">call</arg>
44 <arg choice="plain">--system</arg>
45 <arg choice="plain">--session</arg>
46 <arg choice="plain">--address <replaceable>address</replaceable></arg>
48 <arg choice="plain">--dest <replaceable>bus_name</replaceable></arg>
49 <arg choice="plain">--object-path <replaceable>/path/to/object</replaceable></arg>
50 <arg choice="plain">--method <replaceable>org.project.InterfaceName.MethodName</replaceable></arg>
51 <arg choice="plain">ARG1</arg>
52 <arg choice="plain" rep="repeat">ARG2</arg>
55 <command>gdbus</command>
56 <arg choice="plain">help</arg>
61 <title>Description</title>
63 <command>gdbus</command> offers a simple commandline utility for
64 introspecting and calling methods on remote objects.
67 <title>Commands</title>
70 <term><option>introspect</option></term>
72 Prints out interfaces and property values for a remote object.
73 For this to work, the owner of the object needs to implement the
74 <literal>org.freedesktop.DBus.Introspectable</literal> interface.
78 <term><option>monitor</option></term>
80 Monitors one or all objects owned by the owner of
81 <replaceable>bus_name</replaceable>.
85 <term><option>call</option></term>
87 Invokes a method on a remote object. Each argument to pass to the
88 method must be specified as a serialized
89 <link linkend="GVariant"><type>GVariant</type></link> except that strings do
90 not need explicit quotes. The return values are printed out as
91 serialized <link linkend="GVariant"><type>GVariant</type></link>
96 <term><option>help</option></term>
106 <title>Bash Completion</title>
108 <command>gdbus</command> ships with a bash completion script to
109 complete commands, destinations, bus names, object paths and
110 interface/method names.
115 <title>Examples</title>
116 This shows how to introspect an object - note that the value of each
117 property is displayed:
119 $ gdbus introspect --system \
120 --dest org.freedesktop.NetworkManager \
121 --object-path /org/freedesktop/NetworkManager/Devices/0
122 node /org/freedesktop/NetworkManager/Devices/0 {
123 interface org.freedesktop.DBus.Introspectable {
125 Introspect(out s data);
127 interface org.freedesktop.DBus.Properties {
135 GetAll(in s interface,
138 interface org.freedesktop.NetworkManager.Device.Wired {
140 PropertiesChanged(a{sv} arg_0);
142 readonly b Carrier = false;
143 readonly u Speed = 0;
144 readonly s HwAddress = '00:1D:72:88:BE:97';
146 interface org.freedesktop.NetworkManager.Device {
150 StateChanged(u arg_0,
154 readonly u DeviceType = 1;
155 readonly b Managed = true;
156 readwrite o Ip6Config = '/';
157 readwrite o Dhcp4Config = '/';
158 readwrite o Ip4Config = '/';
159 readonly u State = 2;
160 readwrite u Ip4Address = 0;
161 readonly u Capabilities = 3;
162 readonly s Driver = 'e1000e';
163 readwrite s Interface = 'eth0';
164 readonly s Udi = '/sys/devices/pci0000:00/0000:00:19.0/net/eth0';
169 In a similar fashion, the <option>introspect</option> command can be
170 used to learn details about the <literal>Notify</literal> method:
174 interface org.freedesktop.Notifications {
176 GetServerInformation(out s return_name,
178 out s return_version,
179 out s return_spec_version);
180 GetCapabilities(out as return_caps);
181 CloseNotification(in u id);
182 Notify(in s app_name,
195 With this information, it's easy to use the <option>call</option>
196 command to display a notification
199 $ gdbus call --session \
200 --dest org.freedesktop.Notifications \
201 --object-path /org/freedesktop/Notifications \
202 --method org.freedesktop.Notifications.Notify \
207 "Here's the body of the notification" \
214 Monitoring all objects on a service:
217 $ gdbus monitor --system --dest org.freedesktop.ConsoleKit
218 Monitoring signals from all objects owned by org.freedesktop.ConsoleKit
219 The name org.freedesktop.ConsoleKit is owned by :1.15
220 /org/freedesktop/ConsoleKit/Session2: org.freedesktop.ConsoleKit.Session.ActiveChanged (false,)
221 /org/freedesktop/ConsoleKit/Seat1: org.freedesktop.ConsoleKit.Seat.ActiveSessionChanged ('',)
222 /org/freedesktop/ConsoleKit/Session2: org.freedesktop.ConsoleKit.Session.ActiveChanged (true,)
223 /org/freedesktop/ConsoleKit/Seat1: org.freedesktop.ConsoleKit.Seat.ActiveSessionChanged ('/org/freedesktop/ConsoleKit/Session2',)
226 Monitoring a single object on a service:
229 $ gdbus monitor --system --dest org.freedesktop.NetworkManager --object-path /org/freedesktop/NetworkManager/AccessPoint/4141
230 Monitoring signals on object /org/freedesktop/NetworkManager/AccessPoint/4141 owned by org.freedesktop.NetworkManager
231 The name org.freedesktop.NetworkManager is owned by :1.5
232 /org/freedesktop/NetworkManager/AccessPoint/4141: org.freedesktop.NetworkManager.AccessPoint.PropertiesChanged ({'Strength': <byte 0x5c>},)
233 /org/freedesktop/NetworkManager/AccessPoint/4141: org.freedesktop.NetworkManager.AccessPoint.PropertiesChanged ({'Strength': <byte 0x64>},)
234 /org/freedesktop/NetworkManager/AccessPoint/4141: org.freedesktop.NetworkManager.AccessPoint.PropertiesChanged ({'Strength': <byte 0x5e>},)
235 /org/freedesktop/NetworkManager/AccessPoint/4141: org.freedesktop.NetworkManager.AccessPoint.PropertiesChanged ({'Strength': <byte 0x64>},)
241 <title>AUTHOR</title>
243 Written by David Zeuthen <email>zeuthen@gmail.com</email> with
244 a lot of help from many others.
251 Please send bug reports to either the distribution bug tracker
252 or the upstream bug tracker at
253 <ulink url="https://bugzilla.gnome.org/enter_bug.cgi?product=glib"/>.
258 <title>SEE ALSO</title>
261 <refentrytitle>dbus-send</refentrytitle><manvolnum>1</manvolnum>