qtdbus: Export org.freedesktop.DBus.Peer interface when introspected
authorDaniele E. Domenichelli <daniele.domenichelli@gmail.com>
Thu, 21 Jun 2012 18:41:27 +0000 (20:41 +0200)
committerQt by Nokia <qt-info@nokia.com>
Fri, 22 Jun 2012 07:47:59 +0000 (09:47 +0200)
The ofD.Peer interface is automatically implemented when an object is
registered on DBus, but the ofD.Introspectable.Introspect method does
not show it.

You can test it by running

$ qdbus --literal <some service> <some object> \
>    org.freedesktop.DBus.Peer.Ping

$ qdbus --literal <some service> <some object> \
>    org.freedesktop.DBus.Peer.GetMachineId

Change-Id: I7062ba0cdae486d443011ee19cf3874aabf90205
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
src/dbus/qdbusinternalfilters.cpp

index e498531..44481ac 100644 (file)
@@ -92,6 +92,14 @@ static const char propertiesInterfaceXml[] =
     "    </method>\n"
     "  </interface>\n";
 
+static const char peerInterfaceXml[] =
+    "  <interface name=\"org.freedesktop.DBus.Peer\">\n"
+    "    <method name=\"Ping\"/>\n"
+    "    <method name=\"GetMachineId\">\n"
+    "      <arg name=\"machine_uuid\" type=\"s\" direction=\"out\"/>\n"
+    "    </method>\n"
+    "  </interface>\n";
+
 static QString generateSubObjectXml(QObject *object)
 {
     QString retval;
@@ -165,6 +173,7 @@ QString qDBusIntrospectObject(const QDBusConnectionPrivate::ObjectTreeNode &node
     }
 
     xml_data += QLatin1String( introspectableInterfaceXml );
+    xml_data += QLatin1String( peerInterfaceXml );
 
     if (node.flags & QDBusConnection::ExportChildObjects) {
         xml_data += generateSubObjectXml(node.obj);