Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Problem reading a QDBusArgument
Forum Update on Monday, May 27th 2025

Problem reading a QDBusArgument

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 1.8k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • I Offline
    I Offline
    Iktwo
    wrote on 20 Feb 2012, 19:42 last edited by
    #1

    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("com.nokia.CallUi.Context",
    "/com/nokia/CallUi/ActiveCall","org.maemo.contextkit.Property",
    "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.beginArray();
    arg >> argFirstValue;
    arg.endArray();
    
    arg = qvariant_cast<QDBusArgument>(argFirstValue);
    arg.beginMap();
    arg.beginMapEntry();
    arg >> map;
    arg.endMapEntry();
    qDebug() << map.keys();
    
    arg.endMap();
    

    }
    @

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

    1 Reply Last reply
    0

    1/1

    20 Feb 2012, 19:42

    • Login

    • Login or register to search.
    1 out of 1
    • First post
      1/1
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved