# API guide ## Controller `SmartLabUIA(logger=None, log_level=None)` creates one `IUIA` interface and one `SmartLabConfig`. An external logger is accepted; otherwise standard logging is used (default INFO). Windows is required. ## Measurement | API | Meaning | | --- | --- | | `scan() -> None` | Invoke Scan once; no completion wait. | | `stop() -> None` | Invoke Stop in the operation dialog; no completion wait. | | `is_running() -> bool` | Whether the `装置制御中` dialog is found; raises on UIA access failure. | | `get_running() -> bool` | Alias for `is_running()`. | | `get_remaining_time() -> Optional[str]` | Displayed remaining time `HH:MM:SS` or `None`. | | `get_estimated_end_time() -> Optional[datetime]` | Current time plus remaining time, or `None`. | | `running`, `remaining_time`, `estimated_end_time` | Read-only properties. | ## Parameters | Property suffix | GUI item | Getter | Setter | | --- | --- | --- | --- | | `absolute_scan` | Absolute selection | `get_absolute_scan()` | `set_absolute_scan(value)` | | `relative_scan` | Relative selection | `get_relative_scan()` | `set_relative_scan(value)` | | `scan_mode` | Scan mode | `get_scan_mode()` | `set_scan_mode(value)` | | `start` | Start | `get_start()` | `set_start(value)` | | `stop_position` | Stop position | `get_stop_position()` | `set_stop_position(value)` | | `step` | Step | `get_step()` | `set_step(value)` | | `speed` | Speed | `get_speed()` | `set_speed(value)` | | `move_to` | Move destination | `get_move_to()` | `set_move_to(value)` | | `move_step` | Move step | `get_move_step()` | `set_move_step(value)` | | `slit` | Slit | `get_slit()` | `set_slit(value)` | | `slit_list` | Slit list | `get_slit_list()` | `set_slit_list(value)` | | `slit_width` | Slit width | `get_slit_width()` | `set_slit_width(value)` | Absolute/relative getters return selection booleans and setters select on `True` (not deselect on `False`). Other getters return strings or `None`. Setters use UIA ValuePattern/SelectionItemPattern; their success is not a readback guarantee. All 12 fields also have property accessors. ## Export `export_data(filename=None, save=False, graph="2theta", overwrite=False) -> bool` opens the export and Save dialogs for the selected graph (2θ or 2θ/θ). `filename=None` keeps the dialog's default. `save=False` leaves the Save dialog open and returns `False`. With `save=True`, the method returns `True` once the GUI save operation completes, or `False` when overwrite is declined. The gRPC server checks the resulting file before sending it. ## Exceptions and boundaries The code raises exceptions for missing required GUI elements or failed critical UIA actions. `is_running()` does not return `None`. A missing operation dialog cannot distinguish normal completion, cancellation, or an error. The API does not implement hardware-level status reporting. [Export details](export.md)