Architecture and responsibilities

Project boundaries

smartlab_ctrl (separate project: orchestration, device-control API)
    └── SmartLabUIA (one instance)
          ├── IUIA (one instance)
          ├── UIA element caches / logger
          └── SmartLabConfig (dataclass: paths and identifiers)
server / communication layer (separate from device-control classes)

SmartLabUIA is a GUI adapter. It does not own the measurement workflow at the device-control/server level. Measurement, parameter setting, and post-measurement export currently remain in the same class; no separate measurement/export classes, duplicated UIA interfaces, or duplicated search implementations are introduced.

SmartLabConfig holds TARGET_TITLE, ROOT_ID, SCAN_ID, SCAN_NAME, BASIC_PATH, the three group paths, PATHS, EXPORT_DATA_GRAPH_PATH, DIALOG_NAME, STOP_ID, and PARAMETER_PATH_KEYS. It does not hold COM/UIA interfaces or cached elements. The controller owns _uia, _root, _scan_button, _dialog, _remaining_element, and _stop_button.

Lifecycle

SmartLabUIA.__init__() checks Windows, initializes logging, creates IUIA() and SmartLabConfig, and initializes caches. It does not locate GUI elements or issue instrument commands at construction. Calls lazily resolve the main window using title and AutomationId. Dialog-related references are invalidated as the GUI changes.

Error and result semantics

scan() and stop() request GUI actions; they do not wait for the instrument to finish. is_running() reports presence of the operation dialog, not an instrument protocol status or success/failure state. Parameter reads can return None; successful UIA writes do not prove hardware acceptance. Higher-level workflows must interpret these limitations explicitly.

Why not split measurement and export yet?

Both use the same UIA session, root window, logger, and search helpers; independent controllers would require additional ownership/coordination. A later split should be driven by real independent responsibilities, while preserving a single UIA owner and the SmartLabUIA public facade.