Results 1 to 5 of 5

Thread: sending a signal though the dbus.

  1. #1
    Join Date
    May 2010
    Posts
    100
    Thanks
    1
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default sending a signal though the dbus.

    I am sending a QDBusMessage signal through dbus to a dbus-glib application. but i am not recieving a signal ,i dont know what to do?

    I can send signals and methodcall to qt application ,but reverse is not happening.

    below is my code:

    /********start******************/

    QDBusMessage message=createsignal("/","local.Widget","pong"); //pong is signal and local.wirdget is an interface
    if(conncetion.send(message))
    {
    qDebg()<<"yes i can send the pong signal and see with dbus--monitor "<<endl;
    }


    Now,on dbus-glib side i am doing this:

    dbus_g_proxy_add_signal(proxy,"pong",G_tPE_INVALID );
    dbus_g_proxy_connect_signal(proxy,"pong",G_CALLBAC K(pong_callback),NUL,NULL);

    static void pong_callback(void)
    {
    g_print("yes,now entered into callback"); //this is not getting invoked
    }

    /************End****************/

    Can some one please guide me on this.What can be the wrong?

    Thankyou.

  2. #2
    Join Date
    May 2010
    Posts
    100
    Thanks
    1
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Re:sending or receiving structure with dbus.

    hello,

    how can we represnt a structure in qt? i want to send and receive a structure though dbus.your reply will be a useful for me.

    thank you.

  3. #3
    Join Date
    May 2010
    Posts
    100
    Thanks
    1
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: receiving strucutre though the dbus.

    i am sending a strucutre though dbsu-glib as follow.
    typedef struct{
    int a;
    int b;
    char [5];
    }payload;

    payload p={5,5,"ARRAY"};

    And i am able to send this structure data with function call,which i can see in dbus-monitor as follow.
    array[
    array[
    byte 5;
    byte 5;
    byte 65;
    ....
    byte 89;
    ]
    ]
    signature is :'aay'
    up to this every thing is OK.

    But on qt side(receiver) i dont have any idea as to how to receive this message.what can be the argument of my function in qt application?

    i tried with QByteArray,QStringList but no succusses.now,what to do?

  4. #4
    Join Date
    May 2010
    Posts
    100
    Thanks
    1
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: receiving strucutre though the dbus.

    hellow,

    if i want receive call from a remote application as shown in the upper post,i need to register a class member which can have the arguments as "array of array of bytes".

    is it possible to generate this?how can i do this.
    please reply me urgently.

    thanking u all.

  5. #5
    Join Date
    Aug 2010
    Posts
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Maemo/MeeGo

    Default Re: sending a signal though the dbus.

    I had the same problem and spent the whole day on it.

    The only thing you need is to register the service before sending the signal from Qt.

    It should look like this:

    Qt Code:
    1. if (! connection.registerService("local.Widget"))
    2. {
    3. qDebug() << "Failed to register the service. Is it already registered?";
    4. }
    5. QDBusMessage message=createsignal("/","local.Widget","pong"); //pong is signal and local.Widget is an interface
    6. if(conncetion.send(message))
    7. {
    8. qDebug()<<"yes i can send the pong signal and see with dbus --monitor "<<endl;
    9. }
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. Replies: 5
    Last Post: 21st April 2010, 21:36
  2. Sending signal to other process?
    By Boron in forum Qt Programming
    Replies: 3
    Last Post: 28th August 2009, 09:06
  3. Qt 4.5.0 win opensource and <dbus/dbus.h>
    By YaK in forum Installation and Deployment
    Replies: 2
    Last Post: 22nd March 2009, 11:06
  4. DBus and IPC
    By DrDonut in forum Qt Programming
    Replies: 3
    Last Post: 22nd March 2008, 23:42
  5. sending data over signal
    By gyre in forum Newbie
    Replies: 1
    Last Post: 16th December 2007, 23:10

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.