1GDBUS(1)                         User Commands                        GDBUS(1)
2
3
4

NAME

6       gdbus - Introspect and call remote objects
7

SYNOPSIS

9       gdbus introspect [--system | --session | --address address]
10             --dest bus_name --object-path /path/to/object --xml
11
12       gdbus monitor [--system | --session | --address address]
13             --dest bus_name [--object-path /path/to/object]
14
15       gdbus call [--system | --session | --address address] --dest bus_name
16             --object-path /path/to/object
17             --method org.project.InterfaceName.MethodName ARG1 ARG2...
18
19       gdbus help
20

DESCRIPTION

22       gdbus offers a simple commandline utility for introspecting and calling
23       methods on remote objects.
24
25   Commands
26       introspect
27           Prints out interfaces and property values for a remote object. For
28           this to work, the owner of the object needs to implement the
29           org.freedesktop.DBus.Introspectable interface.
30
31       monitor
32           Monitors one or all objects owned by the owner of bus_name.
33
34       call
35           Invokes a method on a remote object. Each argument to pass to the
36           method must be specified as a serialized GVariant except that
37           strings do not need explicit quotes. The return values are printed
38           out as serialized GVariant values.
39
40       help
41           Prints help and exit.
42

BASH COMPLETION

44       gdbus ships with a bash completion script to complete commands,
45       destinations, bus names, object paths and interface/method names.
46

EXAMPLES

48         This shows how to introspect an object - note that the value of each
49         property is displayed:
50
51           $ gdbus introspect --system \
52                   --dest org.freedesktop.NetworkManager \
53                   --object-path /org/freedesktop/NetworkManager/Devices/0
54           node /org/freedesktop/NetworkManager/Devices/0 {
55             interface org.freedesktop.DBus.Introspectable {
56               methods:
57                 Introspect(out s data);
58             };
59             interface org.freedesktop.DBus.Properties {
60               methods:
61                 Get(in  s interface,
62                     in  s propname,
63                     out v value);
64                 Set(in  s interface,
65                     in  s propname,
66                     in  v value);
67                 GetAll(in  s interface,
68                        out a{sv} props);
69             };
70             interface org.freedesktop.NetworkManager.Device.Wired {
71               signals:
72                 PropertiesChanged(a{sv} arg_0);
73               properties:
74                 readonly b Carrier = false;
75                 readonly u Speed = 0;
76                 readonly s HwAddress = ´00:1D:72:88:BE:97´;
77             };
78             interface org.freedesktop.NetworkManager.Device {
79               methods:
80                 Disconnect();
81               signals:
82                 StateChanged(u arg_0,
83                              u arg_1,
84                              u arg_2);
85               properties:
86                 readonly u DeviceType = 1;
87                 readonly b Managed = true;
88                 readwrite o Ip6Config = ´/´;
89                 readwrite o Dhcp4Config = ´/´;
90                 readwrite o Ip4Config = ´/´;
91                 readonly u State = 2;
92                 readwrite u Ip4Address = 0;
93                 readonly u Capabilities = 3;
94                 readonly s Driver = ´e1000e´;
95                 readwrite s Interface = ´eth0´;
96                 readonly s Udi = ´/sys/devices/pci0000:00/0000:00:19.0/net/eth0´;
97             };
98           };
99
100       In a similar fashion, the introspect command can be used to learn
101       details about the Notify method:
102
103           [...]
104             interface org.freedesktop.Notifications {
105               methods:
106                 GetServerInformation(out s return_name,
107                                      out s return_vendor,
108                                      out s return_version,
109                                      out s return_spec_version);
110                 GetCapabilities(out as return_caps);
111                 CloseNotification(in  u id);
112                 Notify(in  s app_name,
113                        in  u id,
114                        in  s icon,
115                        in  s summary,
116                        in  s body,
117                        in  as actions,
118                        in  a{sv} hints,
119                        in  i timeout,
120                        out u return_id);
121             };
122           [...]
123
124       With this information, it´s easy to use the call command to display a
125       notification
126
127           $ gdbus call --session \
128                        --dest org.freedesktop.Notifications \
129                        --object-path /org/freedesktop/Notifications \
130                        --method org.freedesktop.Notifications.Notify \
131                        my_app_name \
132                        42 \
133                        gtk-dialog-info \
134                        "The Summary" \
135                        "Here´s the body of the notification" \
136                        [] \
137                        {} \
138                        5000
139           (uint32 12,)
140
141       Monitoring all objects on a service:
142
143           $ gdbus monitor --system --dest org.freedesktop.ConsoleKit
144           Monitoring signals from all objects owned by org.freedesktop.ConsoleKit
145           The name org.freedesktop.ConsoleKit is owned by :1.15
146           /org/freedesktop/ConsoleKit/Session2: org.freedesktop.ConsoleKit.Session.ActiveChanged (false,)
147           /org/freedesktop/ConsoleKit/Seat1: org.freedesktop.ConsoleKit.Seat.ActiveSessionChanged (´´,)
148           /org/freedesktop/ConsoleKit/Session2: org.freedesktop.ConsoleKit.Session.ActiveChanged (true,)
149           /org/freedesktop/ConsoleKit/Seat1: org.freedesktop.ConsoleKit.Seat.ActiveSessionChanged (´/org/freedesktop/ConsoleKit/Session2´,)
150
151       Monitoring a single object on a service:
152
153           $ gdbus monitor --system --dest org.freedesktop.NetworkManager --object-path /org/freedesktop/NetworkManager/AccessPoint/4141
154           Monitoring signals on object /org/freedesktop/NetworkManager/AccessPoint/4141 owned by org.freedesktop.NetworkManager
155           The name org.freedesktop.NetworkManager is owned by :1.5
156           /org/freedesktop/NetworkManager/AccessPoint/4141: org.freedesktop.NetworkManager.AccessPoint.PropertiesChanged ({´Strength´: <byte 0x5c>},)
157           /org/freedesktop/NetworkManager/AccessPoint/4141: org.freedesktop.NetworkManager.AccessPoint.PropertiesChanged ({´Strength´: <byte 0x64>},)
158           /org/freedesktop/NetworkManager/AccessPoint/4141: org.freedesktop.NetworkManager.AccessPoint.PropertiesChanged ({´Strength´: <byte 0x5e>},)
159           /org/freedesktop/NetworkManager/AccessPoint/4141: org.freedesktop.NetworkManager.AccessPoint.PropertiesChanged ({´Strength´: <byte 0x64>},)
160

AUTHOR

162       Written by David Zeuthen zeuthen@gmail.com with a lot of help from many
163       others.
164

BUGS

166       Please send bug reports to either the distribution bug tracker or the
167       upstream bug tracker at
168       https://bugzilla.gnome.org/enter_bug.cgi?product=glib.
169

SEE ALSO

171       dbus-send(1)
172
173
174
175User Commands                     09/27/2010                          GDBUS(1)
Impressum