cgse-common 0.17.3__tar.gz → 0.18.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {cgse_common-0.17.3 → cgse_common-0.18.0}/.gitignore +6 -1
- {cgse_common-0.17.3 → cgse_common-0.18.0}/PKG-INFO +1 -1
- {cgse_common-0.17.3 → cgse_common-0.18.0}/pyproject.toml +1 -1
- {cgse_common-0.17.3 → cgse_common-0.18.0}/src/egse/device.py +71 -1
- {cgse_common-0.17.3 → cgse_common-0.18.0}/src/egse/env.py +1 -1
- {cgse_common-0.17.3 → cgse_common-0.18.0}/src/egse/hk.py +2 -2
- {cgse_common-0.17.3 → cgse_common-0.18.0}/src/egse/log.py +10 -0
- cgse_common-0.18.0/src/egse/scpi.py +582 -0
- {cgse_common-0.17.3 → cgse_common-0.18.0}/src/egse/setup.py +7 -4
- cgse_common-0.18.0/src/egse/socketdevice.py +379 -0
- {cgse_common-0.17.3 → cgse_common-0.18.0}/src/egse/system.py +6 -1
- cgse_common-0.17.3/src/egse/scpi.py +0 -323
- {cgse_common-0.17.3 → cgse_common-0.18.0}/README.md +0 -0
- {cgse_common-0.17.3 → cgse_common-0.18.0}/justfile +0 -0
- {cgse_common-0.17.3 → cgse_common-0.18.0}/noxfile.py +0 -0
- {cgse_common-0.17.3 → cgse_common-0.18.0}/service_registry.db +0 -0
- {cgse_common-0.17.3 → cgse_common-0.18.0}/src/cgse_common/__init__.py +0 -0
- {cgse_common-0.17.3 → cgse_common-0.18.0}/src/cgse_common/cgse.py +0 -0
- {cgse_common-0.17.3 → cgse_common-0.18.0}/src/cgse_common/settings.yaml +0 -0
- {cgse_common-0.17.3 → cgse_common-0.18.0}/src/egse/bits.py +0 -0
- {cgse_common-0.17.3 → cgse_common-0.18.0}/src/egse/calibration.py +0 -0
- {cgse_common-0.17.3 → cgse_common-0.18.0}/src/egse/config.py +0 -0
- {cgse_common-0.17.3 → cgse_common-0.18.0}/src/egse/counter.py +0 -0
- {cgse_common-0.17.3 → cgse_common-0.18.0}/src/egse/decorators.py +0 -0
- {cgse_common-0.17.3 → cgse_common-0.18.0}/src/egse/dicts.py +0 -0
- {cgse_common-0.17.3 → cgse_common-0.18.0}/src/egse/exceptions.py +0 -0
- {cgse_common-0.17.3 → cgse_common-0.18.0}/src/egse/heartbeat.py +0 -0
- {cgse_common-0.17.3 → cgse_common-0.18.0}/src/egse/metrics.py +0 -0
- {cgse_common-0.17.3 → cgse_common-0.18.0}/src/egse/observer.py +0 -0
- {cgse_common-0.17.3 → cgse_common-0.18.0}/src/egse/obsid.py +0 -0
- {cgse_common-0.17.3 → cgse_common-0.18.0}/src/egse/persistence.py +0 -0
- {cgse_common-0.17.3 → cgse_common-0.18.0}/src/egse/plugin.py +0 -0
- {cgse_common-0.17.3 → cgse_common-0.18.0}/src/egse/plugins/metrics/influxdb.py +0 -0
- {cgse_common-0.17.3 → cgse_common-0.18.0}/src/egse/process.py +0 -0
- {cgse_common-0.17.3 → cgse_common-0.18.0}/src/egse/py.typed +0 -0
- {cgse_common-0.17.3 → cgse_common-0.18.0}/src/egse/randomwalk.py +0 -0
- {cgse_common-0.17.3 → cgse_common-0.18.0}/src/egse/reload.py +0 -0
- {cgse_common-0.17.3 → cgse_common-0.18.0}/src/egse/resource.py +0 -0
- {cgse_common-0.17.3 → cgse_common-0.18.0}/src/egse/response.py +0 -0
- {cgse_common-0.17.3 → cgse_common-0.18.0}/src/egse/settings.py +0 -0
- {cgse_common-0.17.3 → cgse_common-0.18.0}/src/egse/settings.yaml +0 -0
- {cgse_common-0.17.3 → cgse_common-0.18.0}/src/egse/signal.py +0 -0
- {cgse_common-0.17.3 → cgse_common-0.18.0}/src/egse/state.py +0 -0
- {cgse_common-0.17.3 → cgse_common-0.18.0}/src/egse/task.py +0 -0
- {cgse_common-0.17.3 → cgse_common-0.18.0}/src/egse/version.py +0 -0
- {cgse_common-0.17.3 → cgse_common-0.18.0}/src/egse/zmq_ser.py +0 -0
|
@@ -54,7 +54,7 @@ class DeviceControllerError(DeviceError):
|
|
|
54
54
|
super().__init__(device_name, message)
|
|
55
55
|
|
|
56
56
|
|
|
57
|
-
class DeviceConnectionError(DeviceError):
|
|
57
|
+
class DeviceConnectionError(DeviceError, ConnectionError):
|
|
58
58
|
"""A generic error for all connection type of problems.
|
|
59
59
|
|
|
60
60
|
Args:
|
|
@@ -339,6 +339,76 @@ class AsyncDeviceTransport:
|
|
|
339
339
|
return await self.trans(command)
|
|
340
340
|
|
|
341
341
|
|
|
342
|
+
class AsyncDeviceConnectionInterface(DeviceConnectionObservable):
|
|
343
|
+
"""Generic connection interface for all Device classes and Controllers.
|
|
344
|
+
|
|
345
|
+
This interface shall be implemented in the Controllers that directly connect to the
|
|
346
|
+
hardware, but also in the simulators to guarantee an identical interface as the controllers.
|
|
347
|
+
|
|
348
|
+
This interface will be implemented in the Proxy classes through the
|
|
349
|
+
YAML definitions. Therefore, the YAML files shall define at least
|
|
350
|
+
the following commands: `connect`, `disconnect`, `reconnect`, `is_connected`.
|
|
351
|
+
"""
|
|
352
|
+
|
|
353
|
+
def __init__(self):
|
|
354
|
+
super().__init__()
|
|
355
|
+
|
|
356
|
+
def __enter__(self):
|
|
357
|
+
self.connect()
|
|
358
|
+
return self
|
|
359
|
+
|
|
360
|
+
def __exit__(self, exc_type, exc_val, exc_tb):
|
|
361
|
+
self.disconnect()
|
|
362
|
+
|
|
363
|
+
async def connect(self) -> None:
|
|
364
|
+
"""Connect to the device controller.
|
|
365
|
+
|
|
366
|
+
Raises:
|
|
367
|
+
ConnectionError: when the connection can not be opened.
|
|
368
|
+
"""
|
|
369
|
+
|
|
370
|
+
raise NotImplementedError
|
|
371
|
+
|
|
372
|
+
async def disconnect(self) -> None:
|
|
373
|
+
"""Disconnect from the device controller.
|
|
374
|
+
|
|
375
|
+
Raises:
|
|
376
|
+
ConnectionError: when the connection can not be closed.
|
|
377
|
+
"""
|
|
378
|
+
raise NotImplementedError
|
|
379
|
+
|
|
380
|
+
async def reconnect(self):
|
|
381
|
+
"""Reconnect the device controller.
|
|
382
|
+
|
|
383
|
+
Raises:
|
|
384
|
+
ConnectionError: when the device can not be reconnected for some reason.
|
|
385
|
+
"""
|
|
386
|
+
raise NotImplementedError
|
|
387
|
+
|
|
388
|
+
async def is_connected(self) -> bool:
|
|
389
|
+
"""Check if the device is connected.
|
|
390
|
+
|
|
391
|
+
Returns:
|
|
392
|
+
True if the device is connected and responds to a command, False otherwise.
|
|
393
|
+
"""
|
|
394
|
+
raise NotImplementedError
|
|
395
|
+
|
|
396
|
+
|
|
397
|
+
class AsyncDeviceInterface(AsyncDeviceConnectionInterface):
|
|
398
|
+
"""A generic interface for all device classes."""
|
|
399
|
+
|
|
400
|
+
def is_simulator(self) -> bool:
|
|
401
|
+
"""Checks whether the device is a simulator rather than a real hardware controller.
|
|
402
|
+
|
|
403
|
+
This can be useful for testing purposes or when doing actual movement simulations.
|
|
404
|
+
|
|
405
|
+
Returns:
|
|
406
|
+
True if the Device is a Simulator; False if the Device is connected to real hardware.
|
|
407
|
+
"""
|
|
408
|
+
|
|
409
|
+
raise NotImplementedError
|
|
410
|
+
|
|
411
|
+
|
|
342
412
|
class DeviceFactoryInterface:
|
|
343
413
|
"""
|
|
344
414
|
Base class for creating a device factory class to access devices.
|
|
@@ -51,8 +51,8 @@ class TmDictionaryColumns(str, Enum):
|
|
|
51
51
|
""" # noqa
|
|
52
52
|
|
|
53
53
|
STORAGE_MNEMONIC = "Storage mnemonic"
|
|
54
|
-
CORRECT_HK_NAMES = "
|
|
55
|
-
ORIGINAL_EGSE_HK_NAMES = "Original name in
|
|
54
|
+
CORRECT_HK_NAMES = "CGSE mnemonic"
|
|
55
|
+
ORIGINAL_EGSE_HK_NAMES = "Original name in CGSE"
|
|
56
56
|
SYNOPTICS_ORIGIN = f"Origin of synoptics at {get_site_id()}"
|
|
57
57
|
TIMESTAMP_NAMES = "Name of corresponding timestamp"
|
|
58
58
|
DESCRIPTION = "Description"
|
|
@@ -131,6 +131,16 @@ for handler in root_logger.handlers:
|
|
|
131
131
|
handler.addFilter(NonEGSEFilter())
|
|
132
132
|
handler.addFilter(PackageFilter())
|
|
133
133
|
|
|
134
|
+
# Optional: integrate with Textual logging if available
|
|
135
|
+
#
|
|
136
|
+
# try:
|
|
137
|
+
# from textual.logging import TextualHandler
|
|
138
|
+
|
|
139
|
+
# root_logger.addHandler(TextualHandler())
|
|
140
|
+
# except ImportError:
|
|
141
|
+
# pass
|
|
142
|
+
|
|
143
|
+
|
|
134
144
|
logger = egse_logger
|
|
135
145
|
|
|
136
146
|
if __name__ == "__main__":
|