Results 1 to 2 of 2

Thread: Service Framework - out of proccess via DBus - invokeMethod with char problem

  1. #1
    Join Date
    Sep 2009
    Posts
    31
    Thanks
    2
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Service Framework - out of proccess via DBus - invokeMethod with char problem

    Hi,
    I'm creating some simple client - service application. Using Qt Mobility 1.1, Qt 4.7 (qtsdk-201005). In my service class i've something as this:
    Qt Code:
    1. ...
    2. public slots:
    3. int sampleMethod(int par1, char par2, QString par3);
    To copy to clipboard, switch view to plain text mode 
    Than in client, when got service proxy object successfully using QServiceManager:
    Qt Code:
    1. QServieManager manager;
    2. ...
    3. QObject *serviceProxy = manager.loadInterface(...); // successfull
    4. // now try invoke method
    5. int ret = 0;
    6. bool ok = QMetaObject::invokeMethod(serviceProxy, "sampleMethod", Q_RETURN_ARG(int,ret), Q_ARG(int,0), Q_ARG(char,'a'), Q_ARG(QString,"something"));
    To copy to clipboard, switch view to plain text mode 
    Everything seems ok, but the char parameter received in Service is incorrect (not 'a' and when try it again, the value seems to be random). Same for unsinged char, long, unsigned long, ... only int is ok. And maybe some Qt classes as QString, QDataTime are ok. But why not char?
    I've even tried to run dbus-monitor and here it seems, that values are passed correctly, so maybe they are parsed from DBus packet in some incorrect way.

    If I invoke the same method with the same parameter directly on the Service object, using invoke method, i works fine (sampleMethod on object is called with proper values)
    Qt Code:
    1. MyServiceObject *service = new MyServiceObject();
    2. invokeMethod(service, "sampleMethod", Q_RETURN_ARG(int,ret), Q_ARG(int,0), Q_ARG(char,'a'), Q_ARG(QString,"something"));
    To copy to clipboard, switch view to plain text mode 

    Thanks for ideas.

  2. #2
    Join Date
    Sep 2009
    Posts
    31
    Thanks
    2
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Service Framework - out of proccess via DBus - invokeMethod with char problem

    Maybe this is not the right place for asking about Qt Service. I will be happy even if somebody navigate me where I should post question. Or should I rather report a bug? I've tried to find some QtMobility related forum, but i didn't find it.

    Here is what dbus-monitor displayed:
    1. Client passes: int value == 0, char value == 2, QString value == "my text"
    Qt Code:
    1. int32 0
    2. variant struct {
    3. array [
    4. byte 99
    5. byte 104
    6. byte 97
    7. byte 114
    8. ]
    9. array [
    10. byte 0
    11. byte 0
    12. byte 0
    13. byte 131
    14. byte 0
    15. byte 2
    16. ]
    17. }
    18. string "my text"
    19. method return sender=:1.256 -> dest=:1.257 reply_serial=16
    20. int32 0
    To copy to clipboard, switch view to plain text mode 
    and now for char value == 0:
    Qt Code:
    1. int32 0
    2. variant struct {
    3. array [
    4. byte 99
    5. byte 104
    6. byte 97
    7. byte 114
    8. ]
    9. array [
    10. byte 0
    11. byte 0
    12. byte 0
    13. byte 131
    14. byte 0
    15. byte 0
    16. ]
    17. }
    18. string "my text"
    19. method return sender=:1.256 -> dest=:1.257 reply_serial=16
    20. int32 0
    To copy to clipboard, switch view to plain text mode 

    When I've a breakpoint in MyServiceObject::sampleMethod(int p1, char p2, const QString &p3), p1 and p3 (int and QString) are the same as passed by client, but p2 (char) is some random number. But according to dbus it seems that the value there is ok (last byte field changes). Maybe problem is in casting back from QVariant, I havn't found char support in QVariant class.

Similar Threads

  1. Problems with QMetaObject::invokeMethod
    By AlphaWolf in forum Qt Programming
    Replies: 3
    Last Post: 13th September 2012, 12:57
  2. DBus service name
    By charlesf in forum Qt Programming
    Replies: 6
    Last Post: 4th May 2009, 08:53
  3. DBus Registration problem
    By nrabara in forum Newbie
    Replies: 1
    Last Post: 30th April 2009, 11:34
  4. How to use QMetaObject::invokeMethod?
    By niko in forum Qt Programming
    Replies: 3
    Last Post: 26th January 2008, 17:02
  5. Problem with MDI framework
    By a_m_mukul in forum Qt Programming
    Replies: 7
    Last Post: 6th July 2007, 23:07

Tags for this Thread

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.