def dbus_introspection_add_deprecated(obj, data, interface, deprecated_methods, deprecated_signals): doc = minidom.parseString(data) if interface in deprecated_methods: for node in doc.getElementsByTagName("interface"): if node.hasAttribute("name") and \ node.getAttribute("name") == interface: for method_node in node.getElementsByTagName("method"): if method_node.hasAttribute("name") and \ method_node.getAttribute("name") in deprecated_methods[interface]: annotation = doc.createElement("annotation") annotation.setAttribute( "name", "org.freedesktop.DBus.Deprecated") annotation.setAttribute("value", "true") method_node.appendChild(annotation) if interface in deprecated_signals: for node in doc.getElementsByTagName("interface"): if node.hasAttribute("name") and \ node.getAttribute("name") == interface: for signal_node in node.getElementsByTagName("signal"): if signal_node.hasAttribute("name") and \ signal_node.getAttribute("name") in deprecated_signals[interface]: annotation = doc.createElement("annotation") annotation.setAttribute( "name", "org.freedesktop.DBus.Deprecated") annotation.setAttribute("value", "true") signal_node.appendChild(annotation) log.debug10(doc.toxml()) data = doc.toxml() doc.unlink() return data
def dbus_introspection_add_properties(obj, data, interface): doc = minidom.parseString(data) if hasattr(obj, "_fw_dbus_properties"): for node in doc.getElementsByTagName("interface"): if node.hasAttribute("name") and \ node.getAttribute("name") == interface: dip = { } if getattr(obj, "_fw_dbus_properties"): dip = getattr(obj, "_fw_dbus_properties") if interface in dip: for key,value in dip[interface].items(): prop = doc.createElement("property") prop.setAttribute("name", key) prop.setAttribute("type", value["type"]) prop.setAttribute("access", value["access"]) node.appendChild(prop) log.debug10(doc.toxml()) return doc.toxml()
def dbus_introspection_add_properties(obj, data, interface): doc = minidom.parseString(data) if hasattr(obj, "_fw_dbus_properties"): for node in doc.getElementsByTagName("interface"): if node.hasAttribute("name") and \ node.getAttribute("name") == interface: dip = {} if getattr(obj, "_fw_dbus_properties"): dip = getattr(obj, "_fw_dbus_properties") if interface in dip: for key, value in dip[interface].items(): prop = doc.createElement("property") prop.setAttribute("name", key) prop.setAttribute("type", value["type"]) prop.setAttribute("access", value["access"]) node.appendChild(prop) log.debug10(doc.toxml()) return doc.toxml()