maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Development (https://talk.maemo.org/forumdisplay.php?f=13)
-   -   DBus a{sv} type in Qt (https://talk.maemo.org/showthread.php?t=61842)

kende 2010-09-07 07:18

DBus a{sv} type in Qt
 
Hullo,

I'm trying to use BlueZ BT stack in N900 PR 1.2 with Qt 4.6.2. I'm not able to connect to signals that contain a{sv} parameter which I think should be used as QVariantMap in Qt. Connect and signals work if I use Python but for some reason Qt does not accept that QVariantMap parameter.

<code>
QDBusConnection * m_dbus = new QDBusConnection(QDBusConnection::systemBus());
QDBusMessage message = QDBusMessage::createMethodCall("org.bluez", "/", "org.bluez.Manager", "DefaultAdapter");
QDBusMessage reply = m_dbus->call(message);
QString m_path = reply.arguments().first().value<QDBusObjectPath>() .path();
QDBusInterface * interface = new QDBusInterface("org.bluez", m_path, "org.bluez.Adapter", *m_dbus);
connect(interface, SIGNAL(DeviceFound(QString, QVariantMap)), this, SLOT(slotDeviceFound(QString, QVariantMap)));
</code>

danielwilms 2010-09-07 11:12

Re: DBus a{sv} type in Qt
 
Hi,

Quote:

Originally Posted by kende (Post 809285)
Hullo,

<code>
QDBusInterface * interface = new QDBusInterface("org.bluez", m_path, "org.bluez.Adapter", *m_dbus);
connect(interface, SIGNAL(DeviceFound(QString, QVariantMap)), this, SLOT(slotDeviceFound(QString, QVariantMap)));
</code>


QDBusInterface doesn't have a signal called "DeviceFound". Which code are you referring to in Python? Any example?

Daniel

kende 2010-09-07 14:01

Re: DBus a{sv} type in Qt
 
I got this to work with using <annotation name="com.trolltech.QtDBus.QtTypeName.Out0" value="QVariantMap"/> in DBus xml and then generating the proxy class with qdbusxml2cpp. Connect and signal work just fine when using this generated interface.

I missed this because all other parameters work just fine with just QDBusInterface.


All times are GMT. The time now is 19:20.

vBulletin® Version 3.8.8