Problem reading a QDBusArgument

  • I'm trying to detect when a SIP call it's active on MeeGo Harmattan using DBus, I have the method and signal name, but I can't read the reply, here's what I'm trying to do.

    first I connect the signal
    result = QDBusConnection::sessionBus().connect("",
    "ValueChanged", this, SLOT(detectCall(const QDBusMessage&)));

    the problem is trying to read the reply, if I output with QDebug the QDBusMessage I see what I want..

    qDebug() << msg;

    I get
    QDBusMessage(type=Signal, service=":1.837", path="/com/nokia/CallUi/ActiveCall", interface="org.maemo.contextkit.Property", member="ValueChanged", signature="avt", contents=([Argument: av {[Variant: [Argument: a{sv} {"displayName" = [Variant(QString): "echo123"], "muted" = [Variant(bool): false], "startTime" = [Variant(qlonglong): 0], "state" = [Variant(int): 1], "status" = [Variant(bool): true]}]]}], 161751454621870) )

    what I want it's the value of "state"

    so here's what I'm trying to do and doesn't work
    void WMain::detectCall(const QDBusMessage &msg){
    //qDebug() << msg;
    QVariant argFirstValue;
    QVariant key;
    QVariant value;
    QVariantMap map;
    QMap<QString, QVariant> test;

    QDBusArgument arg = qvariant_cast<QDBusArgument>(msg.arguments().first());
    arg >> argFirstValue;
    arg = qvariant_cast<QDBusArgument>(argFirstValue);
    arg >> map;
    qDebug() << map.keys();


    I don't know what I'm missing or doing wrong, hope you can help me, thanks!

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.