plestylib.device.base_device_sync
=================================

.. py:module:: plestylib.device.base_device_sync


Classes
-------

.. autoapisummary::

   plestylib.device.base_device_sync.BaseDeviceSyncModel


Module Contents
---------------

.. py:class:: BaseDeviceSyncModel(id: str, op_schema=None, param_schema=None, op_solver=None, cmd_solver=None, **kwargs)

   Bases: :py:obj:`abc.ABC`, :py:obj:`plestylib.device.params.ConfigSystem`, :py:obj:`plestylib.device.funcs.FunctionSystem`


   Helper class that provides a standard way to create an ABC using
   inheritance.

   :param solver: Callable used to send a message dictionary and
                  return a response dictionary.


   .. py:attribute:: id


   .. py:method:: init(main=None)
      :abstractmethod:


      Initialize the device. This should be called before any other operations.



   .. py:property:: is_operatable
      :type: bool


      Check if the device is currently operatable (connected and responsive).


   .. py:property:: state
      :type: dict


      Return a dictionary representing the current state of the device, including all configuration parameters and their values.


   .. py:method:: get_state() -> dict

      Return a dictionary of all configuration parameters and their current values.



   .. py:method:: synchronize_param_from_device(keys: list[str] = None, sync_constraints: bool = False) -> None

      synchronizing the model's configuration with the actual device.



   .. py:method:: summary() -> str

      Return a summary string of the device's API functions.
      This can be used for documentation or debugging purposes to quickly see what TCP/IP commands are
      available for the device.



   .. py:method:: query_param_range(key: str) -> tuple[float | int | None, float | int | None]

      Query the device for the valid range of a numeric parameter.



   .. py:method:: query_param_options(key: str) -> list[Any] | None

      Query the device for the valid options of a categorical parameter.



   .. py:method:: connect()
      :abstractmethod:


      Placeholder method for connecting to the device.



   .. py:method:: disconnect()
      :abstractmethod:


      Placeholder method for disconnecting from the device.



   .. py:method:: identity() -> str
      :abstractmethod:


      Query the device for its identity string.



   .. py:method:: check_errors() -> list[str]
      :abstractmethod:


      Query the device for any error messages.



   .. py:method:: check_operatability() -> bool
      :abstractmethod:


      Check if the device is currently operatable (connected and responsive).



   .. py:method:: __enter__()


   .. py:method:: __exit__(exc_type, exc_value, tb)


   .. py:method:: response_to_target_type(key, response) -> Any


   .. py:method:: write(key: str, value: str | float | int | bool)


   .. py:method:: query(key)


   .. py:method:: _write_(key: str, value: str | float | int | bool) -> bool
      :abstractmethod:


      Placeholder method for writing a command to the device.



   .. py:method:: _query_(key: str) -> str
      :abstractmethod:


      Placeholder method for querying the device.



   .. py:method:: reset()

      Reset the device to a known state.



   .. py:method:: clear()

      Clear the device state.



