Results 1 to 3 of 3

Thread: Multi output parameters with DBUS-Method

  1. #1
    Join Date
    May 2010
    Posts
    5
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Multi output parameters with DBUS-Method

    Hi all

    I have a xml file as bellow:
    <!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
    "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
    <node>
    <interface name="org.example.chat">
    <method name="CalcTime">
    <arg name="TimeStamp" direction="out" type="i">
    <doc>
    <line> TimeStamp: The value of the monotonic system clock (millisecond precision) when this signal was sent out.</line>
    </doc>
    </arg>
    <arg name="IsDaylightSaving" direction="out" type="i">
    <doc>
    <line> 1 is DST is currently used, 0 otherwise.</line>
    </doc>
    </arg>
    </method>
    </interface>
    </node>

    as the xml file, that have two parameter for output, and I using qtdbusxml2cpp got the interface file as bellow:
    class OrgExampleChatInterface: public QDBusAbstractInterface
    {
    Q_OBJECT
    public:
    static inline const char *staticInterfaceName()
    { return "org.example.chat"; }

    public:
    OrgExampleChatInterface(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent = 0);
    ~OrgExampleChatInterface();

    public Q_SLOTS: // METHODS
    inline QDBusPendingReply<int, int> CalcTime()
    {
    QList<QVariant> argumentList;
    return asyncCallWithArgumentList(QLatin1String("CalcTime" ), argumentList);
    }
    inline QDBusReply<int> CalcTime(int &IsDaylightSaving)
    {
    QList<QVariant> argumentList;
    QDBusMessage reply = callWithArgumentList(QDBus::Block, QLatin1String("CalcTime"), argumentList);
    if (reply.type() == QDBusMessage::ReplyMessage && reply.arguments().count() == 2) {
    IsDaylightSaving = qdbus_cast<int>(reply.arguments().at(1));
    }
    return reply;
    }

    Q_SIGNALS: // SIGNALS
    };

    namespace org {
    namespace example {
    typedef ::OrgExampleChatInterface chat;
    }
    }

    I implement the method in server:
    int ChatMainWindow::CalcTime(int& val)
    {
    val = 8;
    return 1024;
    }

    and call it in client:
    int v3;
    QDBusReply<int> reply = ifc->CalcTime(v3);
    qDebug() << "###########: " << reply;
    qDebug() << "###########: " << v3;

    but the method does'nt run in server, the client output as bellow:
    ###########: 151468768
    ###########: 0

    That's have any problem? please point it, thank you.
    BR,

    Mecland

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Multi output parameters with DBUS-Method

    I would suggest you run qdbusxml2cpp and let it create an Adaptor. Then you know exactly what kind of signature you are expected to implement

    Cheers,
    _

  3. #3
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Multi output parameters with DBUS-Method

    What is the code in the DBus Adaptor that you created ?
    Have you properly set parent for the dbus adaptor ? May be you need to show the adaptor code for the function call.

Similar Threads

  1. Replies: 3
    Last Post: 27th August 2011, 21:44
  2. Replies: 5
    Last Post: 7th January 2010, 10:42
  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. Replies: 2
    Last Post: 27th March 2007, 12:09
  5. Multi-Page PDF Output
    By igor in forum Qt Programming
    Replies: 1
    Last Post: 9th January 2007, 04: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.