From ae9761bd11432ecff2e1e08234204d28832452b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mose=20M=C3=BCller?= Date: Tue, 16 Jan 2024 16:46:35 +0100 Subject: [PATCH] adds docstring to DeviceConnection --- src/pydase/components/connection.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/pydase/components/connection.py b/src/pydase/components/connection.py index df36c26..fbaa3f8 100644 --- a/src/pydase/components/connection.py +++ b/src/pydase/components/connection.py @@ -5,6 +5,25 @@ import pydase class DeviceConnection(pydase.DataService, ABC): + """ + Abstract base class for device connection management in the pydase framework. + + This class forms the foundation for subclasses that manage connections to specific + devices. Implementers are required to define the `connect()` method and the + `connected` property. The `connect()` method should handle the logic to establish a + connection with the device, while the `connected` property should return the current + connection status. + + An instance of this class automatically starts a task that periodically checks the + device's availability and attempts reconnection if necessary. + + In the frontend, this class is represented without directly exposing the `connect` + method and `connected` attribute. Instead, it displays user-defined attributes, + methods, and properties. When the device connection is not established, the frontend + component is overlaid, allowing manual triggering of the `connect()` method. The + overlay disappears once the connection is re-established. + """ + def __init__(self) -> None: super().__init__() self._autostart_tasks = {"_handle_connection": ()} # type: ignore