Wrapper around a dbus interface that can be bound to multiple paths on multiple connections. More...
Related Functions | |
(Note that these are not member functions.) | |
| adbus_Interface * | adbus_iface_new (const char *name, int size) |
| Creates a new interface. | |
| void | adbus_iface_ref (adbus_Interface *interface) |
| Refs an interface. | |
| void | adbus_iface_deref (adbus_Interface *i) |
| Derefs an interface. | |
| adbus_Member * | adbus_iface_addmethod (adbus_Interface *i, const char *name, int size) |
| Adds a new method. | |
| adbus_Member * | adbus_iface_addsignal (adbus_Interface *i, const char *name, int size) |
| Adds a new signal. | |
| adbus_Member * | adbus_iface_addproperty (adbus_Interface *i, const char *name, int namesize, const char *sig, int sigsize) |
| Adds a new property. | |
| adbus_Member * | adbus_iface_method (adbus_Interface *i, const char *name, int size) |
| Gets a method. | |
| adbus_Member * | adbus_iface_signal (adbus_Interface *i, const char *name, int size) |
| Gets a signal. | |
| adbus_Member * | adbus_iface_property (adbus_Interface *i, const char *name, int size) |
| Gets a property. | |
Wrapper around a dbus interface that can be bound to multiple paths on multiple connections.
Generally interfaces are created up front statically or with some kind of singleton so that they are reused. The interface then binds in all of the information in the introspection xml for that interface as well as the callbacks for properties and methods.
For example:
adbus_Interface* i; adbus_Member* m; i = adbus_iface_new("org.freedesktop.SampleInterface", -1); m = adbus_iface_addmethod(i, "Frobate", -1); adbus_mbr_setmethod(m, &Frobate, NULL); adbus_mbr_argsig(m, "i", -1); adbus_mbr_argname(m, "foo", -1); adbus_mbr_retsig(m, "sa{us}", -1) adbus_mbr_retname(m, "bar", -1); adbus_mbr_retname(m, "baz", -1); adbus_mbr_annotate(m, "org.freedesktop.DBus.Deprecated", -1, "true", -1); m = adbus_iface_addsignal(i, "Changed", -1); adbus_mbr_argsig(m, "b", -1); adbus_mbr_argname(m, "new_value", -1); m = adbus_iface_addproperty(i, "Bar", -1); adbus_mbr_argsig(m, "y", -1); adbus_mbr_setgetter(m, &GetBar, NULL); adbus_mbr_setsetter(m, &SetBar, NULL);
On introspection this will generate the following xml:
<interface name="org.freedesktop.SampleInterface"> <method name="Frobate"> <arg name="foo" type="i" direction="in"/> <arg name="bar" type="s" direction="out"/> <arg name="baz" type="a{us}" direction="out"/> <annotation name="org.freedesktop.DBus.Deprecated" value="true"/> </method> <signal name="Changed"> <arg name="new_value" type="b"/> </signal> <property name="Bar" type="y" access="readwrite"/> </interface>
For further examples and details on how to manipulate the members see adbus_Member.
1.6.1