Switch

Module holding classes for optical switches.

class qosst_hal.switch.FakeSwitch(_location: Any, **kwargs)

Fake switch, to use as a dummy switch.

__init__(_location: Any, **kwargs)
Parameters:

_location (Any) – ignored parameter.

__str__() str

Return str(self).

close()

Close the fake hardware (do nothing).

open()

Open the fake hardware (do nothing).

read_state() int

Return the state of the fake hardware (always return 0).

Returns:

always return 0 for the fake hardware.

Return type:

int

set_state(state: int)

Set the state for the fake hardware (do nothing).

Parameters:

state (Any) – ignored parameter.

class qosst_hal.switch.GenericSwitch(_location: Any, **kwargs)

A generic switch.

A switch should implement the following methods: * open: open the switch * close: close the switch * set_state: set the switch to the given state. * read_state: read the current state. If it cannot be queried, it should be saved as an attribute.

__init__(_location: Any, **kwargs)

All parameters are ignored.

__str__() str

Return str(self).

abstract read_state() int

Read the current state of the switch.

If it cannot be queried, it should be saved as an attribute.

Returns:

current state of the switch.

Return type:

int

abstract set_state(state: int) None

Set the switch to the given state.

Parameters:

state (int) – state to which the switch should be set.