views:

37

answers:

0

Here is my problem:

I send this message on my DBus session bus :

signal sender=:1.3 -> dest=(null destination) path=/; interface=a.a.a; member=a

here is my code :

dbus_interface.h :

#ifndef DBUS_INTERFACE_H
#define DBUS_INTERFACE_H

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

class dbus_interface : public QDBusInterface
{
Q_OBJECT
    Q_CLASSINFO("D-Bus Interface", "a.a.a")

public:
    dbus_interface( const QString &, const QString &, const QString &, \
                        const QDBusConnection &, QObject * = 0 ) ;
   ~dbus_interface()                                         ;   
} ;

#endif // DBUS_INTERFACE_H

dbus_interface.cpp :

#include <QDebug>
#include "dbus_interface.h"

dbus_interface::dbus_interface( const QString &service, const QString &path, \
                                const QString &interface, \ 
                                const QDBusConnection &connection, \
                                QObject *parent ) \
                                : QDBusInterface( service, path, interface, \
                                                  connection, parent )
{
}

dbus_interface::~dbus_interface()
{
}

gpio_daemon.h :

#ifndef GPIODAEMON_H
#define GPIODAEMON_H



#include <QtCore/QObject>
#include <QtCore/QString>
#include <QtDBus/QtDBus>
#include "dbus_interface.h"


class GPIO_daemon : public QObject
{
Q_OBJECT
Q_CLASSINFO("D-Bus Interface", "a.a.a")

public:
    GPIO_daemon( QObject * = 0 ) ;

void run()     ;

public slots :

void on_button_value_updated();

private:
dbus_interface *interface ;
} ;

#endif // GPIODAEMON_H

gpio_daemon.cpp :

#include <QDebug>
#include gpio_daemon.h

GPIO_daemon::GPIO_daemon( QObject *parent ) : QObject( parent )
{
    this->interface = new dbus_interface( "a.a.a","/","a.a.a", \
                                          QDBusConnection::sessionBus(), this ) ;
}

void GPIO_daemon::run()
{

    if(this->interface->connection().connect(QString("a.a.a"), QString("/"), \
                                             QString("a.a.a"),QString("a"), \
                                           this,SLOT(on_button_value_updated())))
    qDebug() << "Connected";



    while( 1 )
    {
        qDebug() << "infinite loop" ;
        sleep(1);
    }  
}


void GPIO_daemon::on_button_value_updated()
{
    qDebug() << "I'm in on_button_value_updated";
}

The thing is, even if the connect works, the slot is never called...

Did I miss something here.

Thanks in advance for your help.