Peer to Peer DBus Connection with Qt

Alberto Mardegan alberto.mardegan at canonical.com
Fri Mar 29 01:27:46 PDT 2013


Hi Tim,
  I tried your example (changing it to use the session bus, and also
re-enabled using the QCoreApplication):

On 03/28/2013 06:28 PM, Tim Sander wrote:
> I have a qt 4.8.4 base embedded system and i would like to send 
> peer to peer dbus messages over the system bus. 
> 
> I have build a bare bone example which does not work. Any hints why the peer 
> to peer connection is not established would be really nice.

I think that the connection is established. Here's the output I get from
the client:

=========================
$ ./dbuspeerclient
got address:
"unix:path=/tmp/testsocket,guid=72a5183d6e21e1d91374b19f51554e85"
last error: ""
QDBusMessage(type=Error, service="", error
name="org.freedesktop.DBus.Error.UnknownObject", error message="No such
object path '/'", signature="", contents=() )
call via peer failed! ""
=========================

Note that last error is empty, so the connection appears to be working.
The problem is that you are calling a method ("Introspect") on the "/"
object on the server, but the server never registered any objects on the
p2p connection.
You should modify your server code to react to the newConnection()
signal and call registerObject("/", ...) on the new connection.

The system/session buses and the p2p connection are completely separate:
the objects you register in the session bus are not automatically
registered in the p2p connection as well.

HTH,
  Alberto


More information about the dbus mailing list