Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ManagedObjectMap ObjectManager::getManagedObjects()
- {
- kDebug()<<"Get Managed Objects";
- ManagedObjectMap object_map;
- org::freedesktop::DBus::Introspectable *introspectable_iface = new org::freedesktop::DBus::Introspectable("", "/", m_conn, this);
- //create an xml document of the introspect
- QDomDocument doc("dbus connection");
- kDebug() << introspectable_iface->Introspect();
- if (!doc.setContent(introspectable_iface->Introspect())) {
- kDebug()<<"Error in setting the content of introspectable interface";
- }
- QDomElement docElem = doc.documentElement();
- QString rootTag = docElem.tagName();
- kDebug()<<"Root Name" << rootTag;
- //Parse the above xml document for all the object paths registered on the dbus
- QDomNodeList nodeList = docElem.elementsByTagName("node");
- for(int ii = 0;ii < nodeList.count(); ii++)
- {
- kDebug()<<"inside";
- QDomElement el = nodeList.at(ii).toElement();
- kDebug()<<el.tagName();
- QString object_name = el.attribute("name");
- kDebug() << "Object Name" << object_name;
- org::freedesktop::DBus::Introspectable *introspectable_iface1 = new org::freedesktop::DBus::Introspectable("", "/"+object_name, m_conn, this);
- QDomDocument doc1("single object");
- kDebug() << introspectable_iface1->Introspect();
- //Create the xml document for intefaces available at each object path
- if (!doc1.setContent(introspectable_iface1->Introspect())) {
- kDebug()<<"Error in setting the content of introspectable interface";
- }
- QDomElement docElem1 = doc1.documentElement();
- QString rootTag1 = docElem1.tagName();
- kDebug()<<"Interface Root Name" << rootTag1;
- QDomNodeList nodeList1 = docElem1.elementsByTagName("interface");
- ManagedInterfaceMap interface_map;
- kDebug()<<"Just testing";
- //Parse Each interface to get the properties
- for(int jj = 0;jj < nodeList1.count(); jj++)
- {
- QDomElement el1 = nodeList1.at(jj).toElement();
- kDebug()<<"Inside the Inteface Loop";
- QString interface_name = el1.attribute("name");
- org::freedesktop::DBus::Properties *prop_iface = new org::freedesktop::DBus::Properties("","/"+object_name, m_conn, this);
- kDebug()<<"Fetching Properties for interface"<<interface_name;
- QVariantMap properties = prop_iface->GetAll(interface_name);
- kDebug()<<"Fetching Properties Done!";
- if(properties.isEmpty()) {
- kDebug()<<"No Properties";
- } else {
- QMapIterator<QString, QVariant> i(properties);
- while (i.hasNext()) {
- i.next();
- kDebug() << i.key() << ": " << i.value() << endl;
- }
- }
- interface_map.insert(interface_name,properties);
- }
- object_map.insert(object_name,interface_map);
- }
- kDebug() << "Returning the value now";
- // qDebug()<<object_map;
- return object_map;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement