plesty.lib.traffic.tcp_ip ========================= .. py:module:: plesty.lib.traffic.tcp_ip .. autoapi-nested-parse:: TCP/IP traffic manager for Plesty device communication. Classes ------- .. autoapisummary:: plesty.lib.traffic.tcp_ip.TCPIPTrafficManager Module Contents --------------- .. py:class:: TCPIPTrafficManager(host, port, timeout=5, write_termination='\r\n', read_termination='\r\n') Bases: :py:obj:`plesty.lib.traffic.TrafficManager` A TrafficManager implementation for managing TCP/IP communication. This class provides methods to open, close, and communicate with instruments over TCP/IP. Initialize with host, port, timeout, and termination characters. .. py:attribute:: host .. py:attribute:: port .. py:attribute:: write_termination :value: Multiline-String .. raw:: html
Show Value .. code-block:: python """ """ .. raw:: html
.. py:attribute:: read_termination :value: Multiline-String .. raw:: html
Show Value .. code-block:: python """ """ .. raw:: html
.. py:method:: _open(*args, **kwargs) Open the TCP/IP connection to the instrument. :param args: Positional arguments for the specific implementation (not used in this case). :param kwargs: Keyword arguments for the specific implementation (not used in this case). .. py:method:: _close() Close the connection to the resource. Subclasses must implement this to handle the specific close logic. .. py:method:: receive_one(timeout: float | None = None) -> str | bool We leave this function public for direct use in some cases where the caller needs more control over the receiving process (e.g. in some requests, two responses might be expected, one for instant feedback and one for the final report when the operation is complete). .. py:method:: orphan(command: str) -> bool Transmit *command* without receiving its answer. :param command: A command the peer will answer. :returns: ``True`` once transmitted, ``False`` when the socket is not open. .. py:method:: _send_command(command: str, timeout=None, expect_response=True) Send a command to the resource and return the response. :param command: The command to send. :param timeout: Timeout in seconds; defaults to the instance's timeout. :param \*args: Additional positional arguments for subclass implementations. :param \*\*kwargs: Additional keyword arguments for subclass implementations. :returns: The response from the resource, or False if the command failed. :rtype: Any