• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# lws minimal dbus server
2
3## build
4
5Using libdbus requires additional non-default include paths setting, same as
6is necessary for lws build described in ./lib/roles/dbus/README.md
7
8CMake can guess one path and the library name usually, see the README above
9for details of how to override for custom libdbus and cross build.
10
11Fedora example:
12```
13$ cmake .. -DLWS_DBUS_INCLUDE2="/usr/lib64/dbus-1.0/include"
14$ make
15```
16
17Ubuntu example:
18```
19$ cmake .. -DLWS_DBUS_INCLUDE2="/usr/lib/x86_64-linux-gnu/dbus-1.0/include"
20$ make
21```
22
23## usage
24
25Commandline option|Meaning
26---|---
27-d <loglevel>|Debug verbosity in decimal, eg, -d15
28--session | Bind to session bus instead of creating private abstract unix socket
29
30By default the minimal server listens using its own abstract unix socket
31at `unix:abstract=org.libwebsockets.test`.
32
33You can also run it instead as a participant on the session bus, without its own
34unix socket, by giving `--session`.
35
36### Examples using the default private abstract unix socket
37
38```
39 $ ./lws-minimal-dbus-server
40[2018/10/03 07:08:02:6448] USER: LWS minimal dbus server
41[2018/10/03 07:08:02:6693] NOTICE: Creating Vhost 'default' port 0, 1 protocols, IPv6 off
42...
43```
44
45You can communicate with the dbus server over its private abstract socket using, eg
46
47```
48$ gdbus introspect --address unix:abstract=org.libwebsockets.test --dest org.libwebsockets.test --object-path /org/libwebsockets/test
49node /org/example/TestObject {
50  interface org.freedesktop.DBus.Introspectable {
51    methods:
52      Introspect(out s data);
53    signals:
54    properties:
55  };
56  interface org.freedesktop.DBus.Properties {
57    methods:
58      Get(in  s interface,
59...
60```
61
62```
63$ gdbus call --address unix:abstract=org.libwebsockets.test --dest org.libwebsockets.test --object-path /org/libwebsockets/test --method org.libwebsockets.test.Echo HELLO
64('HELLO',)
65```
66
67### Examples using the DBUS session bus
68
69```
70 $ ./lws-minimal-dbus-server --session
71[2018/10/03 07:08:02:6448] USER: LWS minimal dbus server
72[2018/10/03 07:08:02:6693] NOTICE: Creating Vhost 'default' port 0, 1 protocols, IPv6 off
73...
74```
75
76You can communicate with the dbus server over the session bus using, eg
77
78```
79$ gdbus introspect --session --dest org.libwebsockets.test --object-path /org/libwebsockets/test
80node /org/example/TestObject {
81  interface org.freedesktop.DBus.Introspectable {
82    methods:
83      Introspect(out s data);
84    signals:
85    properties:
86  };
87  interface org.freedesktop.DBus.Properties {
88    methods:
89      Get(in  s interface,
90...
91```
92
93```
94$ gdbus call --session --dest org.libwebsockets.test --object-path /org/libwebsockets/test --method org.libwebsockets.test.Echo HELLO
95('HELLO',)
96```
97