Michele Calgaro wrote: Sorry I forgot the test program
// TQt includes #include <tqmap.h> #include <tqstring.h> #include <tqstringlist.h> #include <kdebug.h> // TQt D-Bus includes #include <tqdbusconnection.h> #include <tqdbusdata.h> #include <tqdbusvariant.h> #include <tqdbusdatalist.h> #include <tqdbusdatamap.h> #include <tqdbuserror.h> #include <tqdbusmessage.h> #include <tqdbusobjectpath.h> #include <tqdbusproxy.h> #include <tdecmdlineargs.h> #include <tdeaboutdata.h> #include <tdelocale.h> #include <tdeapplication.h> #include <iostream> #define DBUS_CONN_NAME "BTTest" int main() { kdDebug() << k_funcinfo << endl; TQT_DBusConnection dBusConn = TQT_DBusConnection::addConnection(TQT_DBusConnection::SystemBus, DBUS_CONN_NAME); // TQT_DBusProxy m_baseProxy = new TQT_DBusProxy(DBUS_SERVICE_DBUS, DBUS_PATH_DBUS, DBUS_INTERFACE_DBUS, dBusConn); if( !dBusConn.isConnected() ) return -1; TQT_DBusProxy *m_baseProxy = new TQT_DBusProxy("org.bluez", "/", "org.freedesktop.DBus.ObjectManager", dBusConn); TQValueList<TQT_DBusData> parameters; TQT_DBusError error; TQT_DBusMessage reply = m_baseProxy->sendWithReply("GetManagedObjects", parameters, &error); kdDebug() << "reply.count(): " << reply.count() << endl; if (error.isValid()) kdDebug() << "error: " << error.message() << endl; if (reply.type() != TQT_DBusMessage::ReplyMessage) return -1; kdDebug() << "reply.type() : " << reply.type() << endl; if (reply.count() != 1) return -1; bool ok = false; TQT_DBusDataMap<TQT_DBusObjectPath> objects = reply.front().toObjectPathKeyMap(&ok); if (!ok) kdDebug() << "toObjectPathKeyMap failed" << endl; else kdDebug() << "toObjectPathKeyMap worked" << endl; if (!ok) return -1; kdDebug() << "objects.count()" << objects.count() << endl; TQT_DBusDataMap<TQT_DBusObjectPath>::const_iterator it = objects.begin(); for (it; it != objects.end(); ++it) { kdDebug() << " it.data() typeName: " << it.data().typeName() << endl; kdDebug() << " it.data() keyType: " << it.data().keyType() << endl; bool ok = false; TQT_DBusDataMap<TQString> map1 = it.data().toStringKeyMap(&ok); if (!ok) continue; kdDebug() << " map1.size() " << map1.count() << endl; TQT_DBusDataMap<TQString>::const_iterator it1 = map1.begin(); for (it1; it1 != map1.end(); ++it1) { kdDebug() << " it1.key() : " << it1.key() << endl; kdDebug() << " it1.data() typeName: " << it1.data().typeName() << endl; kdDebug() << " it1.data() keyType: " << it1.data().keyType() << endl; TQT_DBusDataMap<TQString> map2 = it1.data().toStringKeyMap(); kdDebug() << " map2.size() " << map2.count() << endl; TQT_DBusDataMap<TQString>::const_iterator it2 = map2.begin(); for (it2; it2 != map2.end(); ++it2) { kdDebug() << "-------------------------------------------------------" << endl; kdDebug() << " it2.key() : " << it2.key() << endl; kdDebug() << " it2.data() typeName : " << it2.data().typeName() << endl; kdDebug() << " it2.data() keyType : " << it2.data().keyType() << endl; // kdDebug() << " it2.data() : " << it2.data().toString() << endl; kdDebug() << " it2.data() : " << it2.data().toVariant().value.toString() << endl; } } } dBusConn.closeConnection(DBUS_CONN_NAME); if (m_baseProxy) delete m_baseProxy; kdDebug() << "DONE" << endl; return 0; }
--------------------------------------------------------------------- To unsubscribe, e-mail: trinity-devel-unsubscribe@xxxxxxxxxxxxxxxxxxxxxxxxxx For additional commands, e-mail: trinity-devel-help@xxxxxxxxxxxxxxxxxxxxxxxxxx Read list messages on the web archive: http://trinity-devel.pearsoncomputing.net/ Please remember not to top-post: http://trinity.pearsoncomputing.net/mailing_lists/#top-posting