Results 1 to 8 of 8

Thread: Connecting dbus signal iwth Qt Apps

  1. #1

    Default Connecting dbus signal iwth Qt Apps

    Hi All,

    I want to connect dbus signal with my Qt Apps.

    Tried with below mentioned piece of code
    Qt Code:
    1. example::example(const QString &service, const QString &path, const char *interface,const QDBusConnection &connection,QObject *parent):QDBusAbstractInterface(service, path, interface,connection,parent)
    2. {
    3.  
    4. bool val= this->connection().connect(service,path,QString("/myInterface),QString("PropertyChanged"),QString("QString,QDBusVariant"),this,SLOT(stateChanged(QString,QVariant)));
    5. qDebug() << " Value is " << val;
    6.  
    7.  
    8. }
    To copy to clipboard, switch view to plain text mode 

    Here my Dbus signal signature is

    Qt Code:
    1. PropertyChanged(string name, variant value)
    To copy to clipboard, switch view to plain text mode 

    Always my slot is not at all connected

    Could anybody provide here sample code.


    Thanks

    Yuvaraj

  2. #2

    Default Connecting dbus signal iwth Qt Apps

    ** merged! **

    Hi All

    Please refer this link http://www.qtcentre.org/threads/42374-Connecting-dbus-signal-iwth-Qt-Apps.

    Already i have posted my issue in newbie section.


    Thanks

    Yuvaraj
    Last edited by Lykurg; 13th June 2011 at 08:07.

  3. #3
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Connecting dbus signal iwth Qt Apps

    Deliberate cross-posting is unlikely to win you any favours.
    "We can't solve problems by using the same kind of thinking we used when we created them." -- Einstein
    If you are posting code then please use [code] [/code] tags around it - makes addressing the problem easier.

  4. #4

    Default Re: Connecting dbus signal iwth Qt Apps

    Hi All,

    Could anybody help me on this issue?

    Thanks

    Yuvaraj R

  5. #5
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Connecting dbus signal iwth Qt Apps

    You have a missing close quote in your code snippet.

    Does Qt issue a warning about your connection when you run the program? Is stateChanged() declared as a slot?

  6. #6

    Default Re: Connecting dbus signal iwth Qt Apps

    Hi,

    yes i declared stateChanged.

    I suspect, problem with


    bool val= this->connection().connect(service,path,QString("/myInterface),QString("PropertyChanged"),QString("Q String,QDBusVariant"),this,SLOT(stateChanged(QStri ng,QVariant)));



    Thanks


    Yuvaraj R

  7. #7
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Connecting dbus signal iwth Qt Apps

    You still have a missing double-quote in your code example. You didn't answer my question regarding warnings.

    I don't use Dbus but a cursory reading of the docs would indicate that your third argument (interface) is not correct. It looks like a path and not a dotted DBus interface name as, for example, you see in the D-Bus Remote Controlled Car Example.

    You also say that the Dbus signature is "string name, variant value" but that is not the same as the signature in your call: "Q String,QDBusVariant". I don't know if this is correct or not.
    Last edited by ChrisW67; 13th June 2011 at 10:28.

  8. #8

    Default Re: Connecting dbus signal iwth Qt Apps

    Hi,

    I solved this issue 4 days back itself . I forgot to update here

    Solution:

    Qt Code:
    1. QDBusConnection::systemBus().connect(SERVICE,path,INTERFACE,"PropertyChanged",this,SLOT(stateChanged(QString,QDBusVariant)));
    To copy to clipboard, switch view to plain text mode 

    Thanks

    Yuvaraj R

Similar Threads

  1. Replies: 1
    Last Post: 14th March 2011, 10:21
  2. Connecting Button with Quit-Signal
    By moatilliatta in forum Qt Programming
    Replies: 1
    Last Post: 11th October 2010, 16:19
  3. sending a signal though the dbus.
    By savaliya_ambani in forum Qt for Embedded and Mobile
    Replies: 4
    Last Post: 26th August 2010, 18:06
  4. dynamic signal connecting
    By donglebob in forum Qt Programming
    Replies: 4
    Last Post: 19th November 2008, 09:58
  5. Connecting signal to button
    By steg90 in forum Qt Programming
    Replies: 8
    Last Post: 13th December 2007, 10:37

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.