horiba-sdk 0.3.3__py3-none-any.whl → 0.5.2__py3-none-any.whl

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.
Files changed (27) hide show
  1. horiba_sdk/__init__.py +5 -3
  2. horiba_sdk/communication/websocket_communicator.py +2 -2
  3. horiba_sdk/core/__init__.py +0 -0
  4. horiba_sdk/core/acquisition_format.py +20 -0
  5. horiba_sdk/core/clean_count_mode.py +13 -0
  6. horiba_sdk/core/timer_resolution.py +14 -0
  7. horiba_sdk/core/x_axis_conversion_type.py +18 -0
  8. horiba_sdk/devices/ccd_discovery.py +10 -12
  9. horiba_sdk/devices/device_manager.py +24 -10
  10. horiba_sdk/devices/fake_responses/ccd.json +261 -12
  11. horiba_sdk/devices/fake_responses/monochromator.json +38 -10
  12. horiba_sdk/devices/monochromator_discovery.py +16 -9
  13. horiba_sdk/devices/single_devices/abstract_device.py +46 -1
  14. horiba_sdk/devices/single_devices/ccd.py +388 -143
  15. horiba_sdk/devices/single_devices/monochromator.py +87 -71
  16. horiba_sdk/sync/communication/abstract_communicator.py +2 -3
  17. horiba_sdk/sync/communication/websocket_communicator.py +38 -18
  18. horiba_sdk/sync/devices/device_discovery.py +13 -37
  19. horiba_sdk/sync/devices/device_manager.py +14 -10
  20. horiba_sdk/sync/devices/fake_icl_server.py +9 -6
  21. horiba_sdk/sync/devices/single_devices/abstract_device.py +11 -7
  22. horiba_sdk/sync/devices/single_devices/ccd.py +517 -62
  23. horiba_sdk/sync/devices/single_devices/monochromator.py +288 -25
  24. {horiba_sdk-0.3.3.dist-info → horiba_sdk-0.5.2.dist-info}/METADATA +166 -92
  25. {horiba_sdk-0.3.3.dist-info → horiba_sdk-0.5.2.dist-info}/RECORD +27 -22
  26. {horiba_sdk-0.3.3.dist-info → horiba_sdk-0.5.2.dist-info}/LICENSE +0 -0
  27. {horiba_sdk-0.3.3.dist-info → horiba_sdk-0.5.2.dist-info}/WHEEL +0 -0
@@ -23,6 +23,14 @@ class AbstractDevice(ABC):
23
23
  self._error_db: AbstractErrorDB = error_db
24
24
  self._communicator: AbstractCommunicator = communicator
25
25
 
26
+ def id(self) -> int:
27
+ """Return the ID of the device.
28
+
29
+ Returns:
30
+ int: ID of the device.
31
+ """
32
+ return self._id
33
+
26
34
  @abstractmethod
27
35
  def open(self) -> None:
28
36
  """
@@ -44,9 +52,7 @@ class AbstractDevice(ABC):
44
52
  """
45
53
  pass
46
54
 
47
- def _execute_command(
48
- self, command_name: str, parameters: dict[Any, Any], time_to_wait_for_response_in_s: float = 0.1
49
- ) -> Response:
55
+ def _execute_command(self, command_name: str, parameters: dict[Any, Any], timeout_in_s: float = 5) -> Response:
50
56
  """
51
57
  Creates a command from the command name, and it's parameters
52
58
  Executes a command and handles the response.
@@ -54,7 +60,7 @@ class AbstractDevice(ABC):
54
60
  Args:
55
61
  command_name (str): The name of the command to execute.
56
62
  parameters (dict): The parameters for the command.
57
- time_to_wait_for_response_in_s (float, optional): The time to wait for the response. Defaults to 0.1
63
+ timeout_in_s (float, optional): The timeout in seconds.
58
64
 
59
65
  Returns:
60
66
  Response: The response from the device.
@@ -62,9 +68,7 @@ class AbstractDevice(ABC):
62
68
  Raises:
63
69
  Exception: When an error occurred on the device side.
64
70
  """
65
- response: Response = self._communicator.request_with_response(
66
- Command(command_name, parameters), time_to_wait_for_response_in_s
67
- )
71
+ response: Response = self._communicator.request_with_response(Command(command_name, parameters), timeout_in_s)
68
72
  if response.errors:
69
73
  self._handle_errors(response.errors)
70
74
  return response