dbus-1-tqt ObjectManager

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,
I am sorry if ask similar question again.

My question is how can I get access to all object paths as shown below, when
calling qdbus. 
How can I get the name of the object path?

thanks in advance



I have written a test.cpp (attached) file which produces following output

TQT_DBusMessage::ReplyMessage Type : 2
TQT_DBusData::Map                  : 16
Name1                              : Map
Size1                              : 1
        Name2                          : Map
        Size2                          : 4
                Name3                          : Map
                key                            : org.bluez.Device1
                Size3                          : 13
                Name3                          : Map
                key                            : org.bluez.MediaControl1
                Size3                          : 1
                Name3                          : Map
                key                            :
org.freedesktop.DBus.Introspectable
                Size3                          : 0
                Name3                          : Map
                key                            :
org.freedesktop.DBus.Properties
                Size3                          : 0


Now, when I run 
qdbus --literal --system org.bluez /
org.freedesktop.DBus.ObjectManager.GetManagedObjects

[Argument: a{oa{sa{sv}}} {
        [ObjectPath: /org/bluez] =  [ Argument: a{sa{sv}} 
                {"org.freedesktop.DBus.Introspectable" = [Argument: a{sv} {}], 
                 "org.bluez.AgentManager1" =  [Argument: a{sv} {}],
                 "org.bluez.ProfileManager1" = [Argument: a{sv} {}],
                 "org.bluez.HealthManager1" = [Argument: a{sv} {}]}],
        [ObjectPath: /org/bluez/hci0] = [Argument: a{sa{sv}} 
                {"org.freedesktop.DBus.Introspectable" = [Argument: a{sv} {}],
                 "org.bluez.Adapter1" = [Argument: a{sv} 
                        {"Address" = [Variant(QString): "00:10:60:D1:0F:5C"],
                         "Name" = [Variant(QString): "fujitsu"],
                         "Alias" = [Variant(QString): "fujitsu"],
                         "Class" = [Variant(uint): 0],
                         "Powered" = [Variant(bool): false],
                         "Discoverable" = [Variant(bool): false],
                         "DiscoverableTimeout" = [Variant(uint): 180],
                         "Pairable" = [Variant(bool): true],
                         "PairableTimeout" = [Variant(uint): 0],
                         "Discovering" = [Variant(bool): false],
                         "UUIDs" = [Variant(QStringList): 
                                {"00001112-0000-1000-8000-00805f9b34fb", 
                                "00001801-0000-1000-8000-00805f9b34fb",
                                "0000110e-0000-1000-8000-00805f9b34fb",
                                "00001106-0000-1000-8000-00805f9b34fb",
                                "00001800-0000-1000-8000-00805f9b34fb",
                                "00001105-0000-1000-8000-00805f9b34fb",
                                "00001200-0000-1000-8000-00805f9b34fb",
                                "0000110c-0000-1000-8000-00805f9b34fb",
                                "00001104-0000-1000-8000-00805f9b34fb",
                                "0000110b-0000-1000-8000-00805f9b34fb",
                                "0000110a-0000-1000-8000-00805f9b34fb",
                                "00005005-0000-1000-8000-0002ee000001",
                                "00001133-0000-1000-8000-00805f9b34fb",
                                "0000112f-0000-1000-8000-00805f9b34fb",
                                "00001132-0000-1000-8000-00805f9b34fb"}],
                         "Modalias" = [Variant(QString): "usb:v1D6Bp0246d052B"]}],
                 "org.freedesktop.DBus.Properties" = [Argument: a{sv} {}],
                 "org.bluez.GattManager1" = [Argument: a{sv} {}],
                 "org.bluez.Media1" = [Argument: a{sv} {}],
                 "org.bluez.NetworkServer1" = [Argument: a{sv} {}]
                }],
        [ObjectPath: /org/bluez/hci0/dev_XX_XX_XX_XX_XX_XX] = [Argument: a{sa{sv}}
                 {"org.freedesktop.DBus.Introspectable" = [Argument: a{sv} {}],
                    {"org.bluez.Device1" = 
                        [Argument: a{sv}
                            {"Address" = [Variant(QString): "XX:XX:XX:XX:XX:XX"],
                                  "Name" = [Variant(QString): "Mobile Phone"],
                                  "Alias" = [Variant(QString): "Mobile Phone"],
                                  "Class" = [Variant(uint): 5898764],
                                  "Icon" = [Variant(QString): "phone"],
                                  "Paired" = [Variant(bool): true],
                                  "Trusted" = [Variant(bool): true],
                                  "Blocked" = [Variant(bool): false],
                                  "LegacyPairing" = [Variant(bool): false],
                                  "Connected" = [Variant(bool): false],
                                  "UUIDs" = [Variant(QStringList):
{"00000002-0000-1000-8000-0002ee000002", "00001103-0000-1000-8000-00805f9b34fb", "00001105-0000-1000-8000-00805f9b34fb", "00001106-0000-1000-8000-00805f9b34fb", "0000110a-0000-1000-8000-00805f9b34fb", "0000110c-0000-1000-8000-00805f9b34fb", "0000110e-0000-1000-8000-00805f9b34fb", "00001112-0000-1000-8000-00805f9b34fb", "0000111f-0000-1000-8000-00805f9b34fb", "0000112f-0000-1000-8000-00805f9b34fb", "00001132-0000-1000-8000-00805f9b34fb", "00005005-0000-1000-8000-0002ee000001", "00005601-0000-1000-8000-0002ee000001"}],
                                  "Adapter" = [Variant:  [ObjectPath: /org/bluez/hci0]], 
                                  "ServicesResolved" = [Variant(bool): false]
                         }
                    ],
                    "org.freedesktop.DBus.Properties" = [Argument: a{sv} {}],
                    "org.bluez.MediaControl1" = [Argument: a{sv} {"Connected" =
[Variant(bool): false]}]
                }
            }]
}]
int main()
{

	TQT_DBusConnection connection = TQT_DBusConnection::systemBus();
	if (!connection.isConnected())
		tqFatal("Failed to connect to system Bus");
	// create a proxy object for method calls
	TQT_DBusProxy proxy("org.bluez","/","org.freedesktop.DBus.ObjectManager"  ,connection);
	
	TQValueList<TQT_DBusData> params;
	TQT_DBusMessage reply = proxy.sendWithReply("GetManagedObjects",params );
	
	if (reply.type() != TQT_DBusMessage::ReplyMessage)
		tqFatal("Call failed");
	
	if ( reply.type() != TQT_DBusMessage::ReplyMessage || reply.count() != 1 || reply[0].type() != TQT_DBusData::Map)
		tqFatal("Unexpected reply");
	
	bool ok = false;
	TQT_DBusDataMap<TQT_DBusObjectPath> names = reply[0].toObjectPathKeyMap(&ok);

	kdDebug() << "TQT_DBusMessage::ReplyMessage Type : " << reply.type() << endl;
	kdDebug() << "TQT_DBusData::Map                  : " << reply[0].type() << endl;
	kdDebug() << "Name1                              : " << reply[0].typeName() << endl;
	kdDebug() << "Size1                              : " << names.count() << endl;
	if (!ok) tqFatal("toTQStringList failed");

	for (TQT_DBusDataMap<TQT_DBusObjectPath>::const_iterator it = names.begin(); it != names.end(); ++it)
	{
		kdDebug() << "\tName2                          : " << (*it).typeName() << endl;
		ok = false;
		TQT_DBusDataMap<TQString> names1 = (*it).toStringKeyMap(&ok);
		kdDebug() << "\tSize2                          : " << names1.count() << endl;
		if (!ok) tqFatal("toTQStringList failed");
		
		for (TQT_DBusDataMap<TQString>::const_iterator it1 = names1.begin(); it1 != names1.end(); ++it1)
		{
			ok = false;
			kdDebug() << "\t\tName3                          : " << (*it1).typeName() << endl;
			TQT_DBusDataMap<TQString> names2 = (*it1).toStringKeyMap(&ok);
			if (!ok) tqFatal("toTQStringList failed");
			kdDebug() << "\t\tkey                            : " << TQString(it1.key()) << endl;
			kdDebug() << "\t\tSize3                          : " << names2.count() << 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

[Index of Archives]     [Trinity Users]     [Linux Sound]     [ALSA Users]     [ALSA Devel]     [Linux Audio Users]     [Linux Media]     [KDE]     [Kernel]     [Gimp]     [Yosemite News]     [Linux Media]     [Trinity Desktop Environment]

  Powered by Linux