adbus_Interface Struct Reference

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_Interfaceadbus_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_Memberadbus_iface_addmethod (adbus_Interface *i, const char *name, int size)
 Adds a new method.
adbus_Memberadbus_iface_addsignal (adbus_Interface *i, const char *name, int size)
 Adds a new signal.
adbus_Memberadbus_iface_addproperty (adbus_Interface *i, const char *name, int namesize, const char *sig, int sigsize)
 Adds a new property.
adbus_Memberadbus_iface_method (adbus_Interface *i, const char *name, int size)
 Gets a method.
adbus_Memberadbus_iface_signal (adbus_Interface *i, const char *name, int size)
 Gets a signal.
adbus_Memberadbus_iface_property (adbus_Interface *i, const char *name, int size)
 Gets a property.

Detailed Description

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.

Warning:
Once an interface is bound to a connection it cannot be further modified.
Note:
In multithreaded programs, it's generally assumed that all the callbacks in an interface will be called on the thread that the bind occured on. This is required for the GetAll function which calls all of the property getters locally.

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.


The documentation for this struct was generated from the following file:
 All Data Structures Files Functions Variables Friends Defines

Generated on Mon Mar 22 00:10:02 2010 for adbus by  doxygen 1.6.1