:py:mod:`pycasx.connectors.protocols` ===================================== .. py:module:: pycasx.connectors.protocols .. autoapi-nested-parse:: Protocols for connectors. Module Contents --------------- Classes ~~~~~~~ .. autoapisummary:: pycasx.connectors.protocols.PropsDict pycasx.connectors.protocols.PropsConnection .. py:class:: PropsDict Bases: :py:obj:`TypedDict` A dictionary of properties returned. This dictionary is returned by the ``list_props`` method of the ``PropsConnection`` protocol. .. attribute:: directories the directories in the property tree. :type: list[str] .. attribute:: properties the properties in the property tree. :type: dict[str, Any] .. py:attribute:: directories :type: list[str] .. py:attribute:: properties :type: dict[str, Any] .. py:class:: PropsConnection Bases: :py:obj:`Protocol` Protocol for a connection to the FlightGear Property Tree. .. py:method:: get_prop(prop_str) Get a property from FlightGear. For all general available properties, this works the same as :meth:`PropsConnection.get_prop`. But as we assume we do not have ADS-B data from the intruder aka the AI, we will use object detection to get the properties under ``/ai/models/aircraft/``. :param prop_str: location of the property, should always be relative to the root (``/``) :type prop_str: str :returns: the value of the property. If FG tells us what the type is we will pre-convert it (i.e. make an int from a string) :rtype: Any .. py:method:: set_prop(prop_str, value) Set a property in FlightGear. :param prop_str: location of the property, should always be relative to the root (``/``) :type prop_str: str :param value: value to set the property to. Must be convertible to ``str`` :type value: Any .. py:method:: list_props(path = '/', recurse_limit = 0) List properties in the FlightGear property tree. :param path: directory to list from, should always be relative to the root (``/``) :type path: str :param recurse_limit: how many times to recurse into subdirectories. 1 (default) is no recursion, 2 is 1 level deep, etc. Passing in ``None`` disables the recursion limit. Be warned that enabling any kind of recursion will take a long time! :type recurse_limit: int | None :returns: dictionary with keys: :rtype: PropsDict Example for ``list_props('/position', recurse_limit=0)``: .. code-block:: python { 'directories': [ '/position/model' ], 'properties': { '/position/altitude-agl-ft': 3.148566963, '/position/altitude-agl-m': 0.9596832103, '/position/altitude-ft': 3491.986254, '/position/ground-elev-ft': 3488.469757, '/position/ground-elev-m': 1063.285582, '/position/latitude-deg': 0.104476136, '/position/latitude-string': '0*06\\'16.1"N', '/position/longitude-deg': 100.023135, '/position/longitude-string': '100*01\\'23.3"E', '/position/sea-level-radius-ft': 20925646.09 } }