Skip to content

SDK¤

SDK (Interface) ¤

SDK(
    equipment: Equipment,
    *,
    libtype: LibType | None = None,
    path: PathLike | None = None,
    **kwargs: Any
)

Base class for equipment that use the manufacturer's Software Development Kit (SDK).

You can use the configuration file to add the directory that the SDK is located at to the PATH environment variable.

Parameters:

Name Type Description Default
equipment Equipment

An Equipment instance.

required
libtype LibType | None

The library type. See LoadLibrary for more details.

None
path PathLike | None

The path to the SDK. Specifying this value will take precedence over the address value.

None
kwargs Any

All additional keyword arguments are passed to LoadLibrary.

{}
Source code in src/msl/equipment/interfaces/sdk.py
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
def __init__(
    self,
    equipment: Equipment,
    *,
    libtype: LibType | None = None,
    path: PathLike | None = None,
    **kwargs: Any,  # noqa: ANN401
) -> None:
    """Base class for equipment that use the manufacturer's Software Development Kit (SDK).

    You can use the [configuration file][config-xml-example] to add the directory that the SDK
    is located at to the `PATH` environment variable.

    Args:
        equipment: An [Equipment][] instance.
        libtype: The library type. See [LoadLibrary][msl.loadlib.load_library.LoadLibrary] for more details.
        path: The path to the SDK. Specifying this value will take precedence over the
            [address][msl.equipment.schema.Connection.address] value.
        kwargs: All additional keyword arguments are passed to [LoadLibrary][msl.loadlib.load_library.LoadLibrary].
    """
    super().__init__(equipment)

    if path is None:
        assert equipment.connection is not None  # noqa: S101
        info = parse_sdk_address(equipment.connection.address)
        if info is None:
            msg = f"Invalid SDK interface address {equipment.connection.address!r}"
            raise ValueError(msg)
        path = info.path

    self._load_library: LoadLibrary = LoadLibrary(path, libtype=libtype, **kwargs)
    self._sdk: Any = self._load_library.lib

application property ¤

application: Application | None

Application | None — Reference to the ActiveX application window.

If the loaded library is not an ActiveX library, returns None.

equipment property ¤

equipment: Equipment

The Equipment associated with the interface.

path property ¤

path: str

str — The path to the library file.

sdk property ¤

sdk: Any

lib — The reference to the SDK object.

disconnect ¤

disconnect() -> None

Cleanup references to the SDK library.

Source code in src/msl/equipment/interfaces/sdk.py
60
61
62
63
64
65
def disconnect(self) -> None:  # pyright: ignore[reportImplicitOverride]
    """Cleanup references to the SDK library."""
    if hasattr(self, "_sdk") and self._sdk is not None:
        self._load_library.cleanup()
        self._sdk = None
        super().disconnect()