This is an example of an ObjectProxy generated by dbus-cxx-xml2cpp from a modified dbus introspection XML document.
- The command used to generate hal_manager_proxy.h from hal_manager_introspection.xml is:
dbus-cxx-xml2cpp --xml hal_manager_introspection.xml --proxy -f --prefix="hal_"
- Modifying the DBus introspected XML
- dbus-cxx-xml2cpp uses a modified XML document obtained via introspection. In this example several attributes were added to the node tag and the introspection interface tag.
- The node tag was changed from this: to this:
<node gen-namespace="DBus::Hal" cppname="Manager" dest="org.freedesktop.Hal" path="/org/freedesktop/Hal/Manager" >
- The introspection interface tag had the ignored attribute added to prevent the interface from being built changing it from this:
<interface name="org.freedesktop.DBus.Introspectable" ignored="1">
- Source xml
- Here is the modified xml document:
- Generated Proxy Object
- After running dbus-cxx-xml2cpp results in a .h file containing the definition of the proxy class. Here is the resulting hal_manager_proxy.h:
And finally, here is the example application that uses the proxy to watch for device added/removed signals.