navigate.model.device_startup_functions.SerialConnectionFactory
- class navigate.model.device_startup_functions.SerialConnectionFactory
Bases:
object
Serial Connection Factory.
This class is used to build serial connections to devices.
- __init__()
Methods
__init__
()build_connection
(build_connection_function, args)Builds a serial connection to a device.
- classmethod build_connection(build_connection_function: ~typing.Callable[[...], ~typing.Any], args: ~typing.Tuple[~typing.Any, ...], exception: ~typing.Type[Exception] = <class 'Exception'>) → Any
Builds a serial connection to a device.
This method establishes a connection to a device using the provided connection-building function and arguments. If the connection does not exist, it will be created and stored.
- Parameters:
build_connection_function (Callable) – Function that builds the connection to the device.
args (Tuple) – Arguments to the build_connection_function
exception (Type[Exception]) – Exception to catch when building the connection
- Returns:
connection – Connection to the device
- Return type:
Any
:raises exception : Exception: If the connection building process fails, the specified exception is raised.