PDA

View Full Version : Using QDBusAbstractAdaptor to post signals on DBus



runeh
27th September 2010, 10:42
Hello
I am trying to use QDBusAbstractAdaptor to register slots as service on the DBUS, and to relay signals to the DBUS. The slot part is working fine, but when I emit a signal that is part of the class inherit from QDBusAbstractAdaptor the signal is posted to the DBus, but the destination is null. The signal is therefore not reaching the proper service. I am using dbus-monitor to view the traffic on DBus.

In the code below it is the signal "change" that I want to be sent to the proper destination:

#ifndef GUISENDERDBUSINTERFACE_H
#define GUISENDERDBUSINTERFACE_H

#include <QtCore/QObject>
#include <QtDBus/QDBusAbstractAdaptor>

#include "guisenderinterface.h"

class GuiSenderDBusInterface: public QDBusAbstractAdaptor
{
Q_OBJECT
Q_CLASSINFO("D-Bus Interface", "com.xxx.yyy.GuiDBusInterface")

public:
GuiSenderDBusInterface(QObject *obj) : QDBusAbstractAdaptor(obj)
{ }
void setGuiSenderInterface(GuiSenderInterface *gui_sender_int);

signals:
void change(int value);

private:
GuiSenderInterface *m_gui_sender_int;
};

#endif // GUISENDERDBUSINTERFACE_H

When I emit the change signal it is sent out on the DBus, but with incorrect destination. See the dbus-monitor log:

signal sender=:1.310 -> dest=(null destination) serial=11 path=/; interface=com.xxx.yyy.GuiDBusInterface; member=change
int32 4

Is it possible to set the DBus destination using the QDBusAbstractAdaptor?

Regards
Rune Hamnvik