Results 1 to 5 of 5

Thread: qdbus connect return always FALSE

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1

    Default qdbus connect return always FALSE

    hi to all, this is my first post, i'm developing an program in qt4 and i want to attach it to the dbus daemon...

    i have using this method:

    Qt Code:
    1. halconnection = new QDBusInterface(HAL_SERVICE,HAL_PATH,HAL_INTERFACE,QDBusConnection::systemBus());
    2. //check if the connection is valid
    3. //sorround this with an try cath interface for emit the error and exit
    4. if(halconnection->isValid())
    5. {
    6. Logger::instance()->threadLogDebug(QString(__FUNCTION__),QString("%1").arg(__LINE__),"Dbus interface correctly created");
    7. } else
    8. Logger::instance()->threadLogDebug(QString(__FUNCTION__),QString("%1").arg(__LINE__),"Dbus interface problem");
    9.  
    10. QDBusReply<QStringList> allDevicesReply = halconnection->call("GetAllDevices");
    11. allDevicesReply.isValid() ? Logger::instance()->threadLogDebug(QString(__FUNCTION__),QString("%1").arg(__LINE__),"All devices were recieved") :
    12. Logger::instance()->threadLogDebug(QString(__FUNCTION__),QString("%1").arg(__LINE__),"Cannot receive all devices");
    To copy to clipboard, switch view to plain text mode 

    where :

    // Hal constants
    #define HAL_SERVICE "org.freedesktop.Hal"
    #define HAL_PATH "/org/freedesktop/Hal/Manager"
    #define HAL_INTERFACE "org.freedesktop.Hal.Manager"
    #define HAL_DEVICE_INTERFACE "org.freedesktop.Hal.Device"

    this all works graeat but i have problem at this point:
    Qt Code:
    1. ...
    2. qDebug() << "connection to hal DeviceAdded: "<<halconnection->connection().connect(HAL_SERVICE,HAL_PATH,HAL_INTERFACE,
    3. "DeviceAdded",this,SLOT(addNewDevice(const QString&)));
    4. qDebug() << "connection to hal DeviceRemoved: "<< halconnection->connection().connect(HAL_SERVICE,HAL_PATH,HAL_INTERFACE,
    5. "DeviceRemoved",this,SLOT(removedDevice(const QString&)));
    6. qDebug() << "connection to hal is connected: " << halconnection->connection().isConnected();
    7. qDebug() << "connection to hal is valid: " << halconnection->isValid();
    To copy to clipboard, switch view to plain text mode 

    this is the output:

    Qt Code:
    1. connection to hal DeviceAdded: false
    2. connection to hal DeviceRemoved: false
    3. connection to hal is connected: true
    4. connection to hal is valid: true
    To copy to clipboard, switch view to plain text mode 

    so i can't connect to the dbus and when a new device is attached my program is never advised by dbus...
    the class is called hub and have as super type QThread...
    can any help me??

    ps. all code compile well... but the problem is at runtime
    Last edited by ciberkids; 16th September 2009 at 16:55. Reason: subscription for email :)

Similar Threads

  1. connect returning false
    By thru in forum Newbie
    Replies: 3
    Last Post: 28th April 2009, 19:58
  2. error with QList with a class
    By john_god in forum Newbie
    Replies: 7
    Last Post: 12th January 2009, 21:48
  3. QTableView performances
    By miraks in forum Qt Programming
    Replies: 18
    Last Post: 1st December 2008, 10:25
  4. Problem with connect()
    By mrnor3 in forum Qt Programming
    Replies: 3
    Last Post: 23rd July 2008, 14:05
  5. connect returns false
    By krivenok in forum Qt Programming
    Replies: 6
    Last Post: 21st February 2006, 20:01

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.