sgr_commhandler.api.data_point_api ================================== .. py:module:: sgr_commhandler.api.data_point_api .. autoapi-nested-parse:: Provides the data-point-level API. Attributes ---------- .. autoapisummary:: sgr_commhandler.api.data_point_api.TFpSpec sgr_commhandler.api.data_point_api.TDpSpec Classes ------- .. autoapisummary:: sgr_commhandler.api.data_point_api.DataPointValidator sgr_commhandler.api.data_point_api.DataPointProtocol sgr_commhandler.api.data_point_api.DataPoint Module Contents --------------- .. py:data:: TFpSpec Defines a generic functional profile data type. .. py:data:: TDpSpec Defines a generic data point data type. .. py:class:: DataPointValidator(data_type) Bases: :py:obj:`object` Implements a base class for data point validators. .. py:attribute:: _data_type :type: sgr_commhandler.api.data_types.DataTypes .. py:method:: validate(value) Validates the compatibility of a value. :param value: the value to validate :type value: Any :returns: true if value is compatible, false otherwise :rtype: bool .. py:method:: data_type() Gets the validator's data type. :returns: the data type enumeration :rtype: DataTypes .. py:method:: options() Gets the validator's options. :returns: the options :rtype: list[Any] .. py:class:: DataPointProtocol(fp_spec, dp_spec) Bases: :py:obj:`abc.ABC`, :py:obj:`Generic`\ [\ :py:obj:`TFpSpec`\ , :py:obj:`TDpSpec`\ ] Implements a base class for data point protocols. .. py:attribute:: _fp_spec :type: TFpSpec .. py:attribute:: _dp_spec :type: TDpSpec .. py:attribute:: _fp_name :type: str .. py:attribute:: _dp_name :type: str .. py:attribute:: _dynamic_parameters :type: list[sgr_commhandler.api.dynamic_parameter.DynamicParameter] .. py:method:: get_specification() Gets the data point specification. :returns: the interface-specific specification :rtype: TDpSpec .. py:method:: set_val(value) :abstractmethod: :async: Writes the data point value. :param value: the data point value to write :type value: Any .. py:method:: get_val(parameters = None, skip_cache = False) :abstractmethod: :async: Reads the data point value. :param parameters: optional dynamic parameters of the request :type parameters: Optional[dict[str, str]] :param skip_cache: does not use cache if true :type skip_cache: bool :returns: the data point value :rtype: Any .. py:method:: name() Gets the functional profile and data point names. :returns: the functional profile and data point names as tuple :rtype: tuple[str, str] .. py:method:: direction() Gets the data direction of the data point. :returns: the data point direction :rtype: DataDirectionProduct .. py:method:: unit() Gets the unit of measurement of the data point. :returns: the unit :rtype: Units .. py:method:: dynamic_parameters() Gets the dynamic parameters of the data point. :returns: the dynamic parameters :rtype: list[DynamicParameter] .. py:method:: can_subscribe() Defines if subscribe() is allowed. :returns: True if allowed, False otherwise :rtype: bool .. py:method:: subscribe(fn) Subscribes to changes of the data point value. :param fn: the callback method :type fn: Callable[[DataPointProtocol, Any], NoReturn] .. py:method:: unsubscribe() Unsubscribes from changes of the data point value. .. py:class:: DataPoint(protocol, validator) Bases: :py:obj:`Generic`\ [\ :py:obj:`TFpSpec`\ , :py:obj:`TDpSpec`\ ] Implements a data point of a generic data type. .. py:attribute:: _protocol .. py:attribute:: _validator .. py:method:: name() Gets the data point name. :returns: the functional profile and data point name :rtype: tuple[str, str] .. py:method:: get_value_async(parameters = None, skip_cache = False) :async: Gets the data point value asynchronously. :returns: the data point value :rtype: Any :raises Exception: when read value is not compatible with data type .. py:method:: set_value_async(value) :async: Sets the data point value asynchronously. :param value: the data point value :type value: Any .. py:method:: subscribe(fn) Subscribes to data point value changes. :param fn: the handler method :type fn: Callable[[DataPointProtocol, Any], NoReturn] .. py:method:: unsubscribe() Unsubscribes from data point value changes. .. py:method:: direction() Gets the data point direction. :returns: the data point direction :rtype: DataDirectionProduct .. py:method:: data_type() Gets the data point data type. :returns: the data point data type :rtype: DataTypes .. py:method:: unit() Gets the unit of measurement of the data point. :returns: the unit :rtype: Units .. py:method:: describe() Describes the data point. :returns: the data point information :rtype: tuple[tuple[str, str], DataDirectionProduct, DataTypes, Units] .. py:method:: options() Describes the data point options. :returns: the data point options :rtype: list[Any] .. py:method:: dynamic_parameters() Gets the dynamic parameters of the data point. :returns: the dynamic parameters :rtype: list[DynamicParameter] .. py:method:: get_specification() Gets the data point specification. :returns: the data point specification :rtype: TDpSpec