Introspection¶
-
class
dbus_next.introspection.
Node
(name: Optional[str] = None, interfaces: Optional[List[dbus_next.introspection.Interface]] = None, is_root: bool = True)¶ A class that represents a node in an object path in introspection data.
A node contains information about interfaces exported on this path and child nodes. A node can be converted to and from introspection XML exposed through the
org.freedesktop.DBus.Introspectable
standard DBus interface.This class is an essential building block for a high-level DBus interface. This is the underlying data structure for the
ProxyObject
. AServiceInterface
definition is converted to this class to expose XML on the introspectable interface.- Variables
- Raises
InvalidIntrospectionError
- If the name is not a valid node name.
-
static
default
(name: Optional[str] = None) → dbus_next.introspection.Node¶ Create a
Node
with the default interfaces supported by this library.The default interfaces include:
org.freedesktop.DBus.Introspectable
org.freedesktop.DBus.Peer
org.freedesktop.DBus.Properties
org.freedesktop.DBus.ObjectManager
-
static
from_xml
(element: xml.etree.ElementTree.Element, is_root: bool = False)¶ Convert an
xml.etree.ElementTree.Element
to aNode
.The element must be valid DBus introspection XML for a
node
.- Parameters
element (
xml.etree.ElementTree.Element
) – The parsed XML element.is_root (bool) – Whether this is the root node
- Raises
InvalidIntrospectionError
- If the XML tree is not valid introspection data.
-
static
parse
(data: str) → dbus_next.introspection.Node¶ Parse XML data as a string into a
Node
.The string must be valid DBus introspection XML.
- Parameters
data (str) – The XMl string.
- Raises
InvalidIntrospectionError
- If the string is not valid introspection data.
-
class
dbus_next.introspection.
Interface
(name: str, methods: Optional[List[dbus_next.introspection.Method]] = None, signals: Optional[List[dbus_next.introspection.Signal]] = None, properties: Optional[List[dbus_next.introspection.Property]] = None)¶ A class that represents a DBus interface exported on on object path.
Contains information about the methods, signals, and properties exposed on this interface.
- Variables
- Raises
InvalidInterfaceNameError
- If the name is not a valid interface name.
-
static
from_xml
(element: xml.etree.ElementTree.Element) → dbus_next.introspection.Interface¶ Convert a
xml.etree.ElementTree.Element
into aInterface
.The element must be valid DBus introspection XML for an
interface
.- Parameters
element (
xml.etree.ElementTree.Element
) – The parsed XML element.- Raises
InvalidIntrospectionError
- If the XML tree is not valid introspection data.
-
class
dbus_next.introspection.
Property
(name: str, signature: str, access: dbus_next.constants.PropertyAccess = <PropertyAccess.READWRITE: 'readwrite'>)¶ A class that represents a DBus property exposed on an
Interface
.- Variables
name (str) – The name of this property.
signature (str) – The signature string for this property. Must be a single complete type.
access (
PropertyAccess
) – Whether this property is readable and writable.type (
SignatureType
) – The parsed type of this property.
- Raises
InvalidIntrospectionError
- If the property is not a single complete type.:class InvalidSignatureError <dbus_next.InvalidSignatureError> - If the given signature is not valid.
- class
InvalidMemberNameError <dbus_next.InvalidMemberNameError> - If the member name is not valid.
-
from_xml
()¶ Convert an
xml.etree.ElementTree.Element
to aProperty
.The element must be valid DBus introspection XML for a
property
.- Parameters
element (
xml.etree.ElementTree.Element
) – The parsed XML element.- Raises
InvalidIntrospectionError
- If the XML tree is not valid introspection data.
-
class
dbus_next.introspection.
Method
(name: str, in_args: List[dbus_next.introspection.Arg] = [], out_args: List[dbus_next.introspection.Arg] = [])¶ A class that represents a method exposed on an
Interface
.- Variables
name (str) – The name of this method.
in_args (list(Arg)) – A list of input arguments to this method.
out_args (list(Arg)) – A list of output arguments to this method.
in_signature (str) – The collected signature string of the input arguments.
out_signature (str) – The collected signature string of the output arguments.
- Raises
InvalidMemberNameError
- If the name of this method is not valid.
-
from_xml
() → dbus_next.introspection.Method¶ Convert an
xml.etree.ElementTree.Element
to aMethod
.The element must be valid DBus introspection XML for a
method
.- Parameters
element (
xml.etree.ElementTree.Element
) – The parsed XML element.is_root (bool) – Whether this is the root node
- Raises
InvalidIntrospectionError
- If the XML tree is not valid introspection data.
-
class
dbus_next.introspection.
Signal
(name: str, args: Optional[List[dbus_next.introspection.Arg]] = None)¶ A class that represents a signal exposed on an interface.
- Variables
name (str) – The name of this signal
args (list(Arg)) – A list of output arguments for this signal.
signature (str) – The collected signature of the output arguments.
- Raises
InvalidMemberNameError
- If the name of the signal is not a valid member name.
-
from_xml
()¶ Convert an
xml.etree.ElementTree.Element
to aSignal
.The element must be valid DBus introspection XML for a
signal
.- Parameters
element (
xml.etree.ElementTree.Element
) – The parsed XML element.is_root (bool) – Whether this is the root node
- Raises
InvalidIntrospectionError
- If the XML tree is not valid introspection data.
-
class
dbus_next.introspection.
Arg
(signature: Union[dbus_next.signature.SignatureType, str], direction: Optional[List[dbus_next.constants.ArgDirection]] = None, name: Optional[str] = None)¶ A class that represents an input or output argument to a signal or a method.
- Variables
name (str) – The name of this arg.
direction (
ArgDirection
) – Whether this is an input or an output argument.type (
SignatureType
) – The parsed signature type of this argument.signature (str) – The signature string of this argument.
- Raises
InvalidMemberNameError
- If the name of the arg is not valid.InvalidSignatureError
- If the signature is not valid.InvalidIntrospectionError
- If the signature is not a single complete type.
-
from_xml
(direction: dbus_next.constants.ArgDirection) → dbus_next.introspection.Arg¶ Convert a
xml.etree.ElementTree.Element
into aArg
.The element must be valid DBus introspection XML for an
arg
.- Parameters
element (
xml.etree.ElementTree.Element
) – The parsed XML element.direction (
ArgDirection
) – The direction of this arg. Must be specified because it can default to different values depending on if it’s in a method or signal.
- Raises
InvalidIntrospectionError
- If the XML tree is not valid introspection data.