MockCommandHandler

class lsst.ts.ess.common.MockCommandHandler(callback: Callable, simulation_mode: int)

Bases: AbstractCommandHandler

Attributes Summary

valid_simulation_modes

Methods Summary

configure(configuration)

Apply the configuration and start sending telemetry.

create_device(device_configuration)

Create the device to connect to by using the specified configuration.

handle_command(command, **kwargs)

Handle incomming commands and parameters.

stop_sending_telemetry()

Stop reading the sensor data.

Attributes Documentation

valid_simulation_modes = (0, 1)

Methods Documentation

async configure(configuration: dict[str, Any]) None

Apply the configuration and start sending telemetry.

Parameters:
configurationdict

The contents of the dict depend on the type of sensor. See the ts_ess configuration schema for more details.

Raises:
CommandError

A CommandError with ResponseCode ALREADY_STARTED is raised if the command handler already was started.

create_device(device_configuration: dict[str, Any]) BaseDevice

Create the device to connect to by using the specified configuration.

Parameters:
device_configurationdict

A dict representing the device to connect to. The format of the dict is described in the devices part of lsst.ts.ess.common.CONFIG_SCHEMA.

Returns:
devicecommon.device.BaseDevice

The device to connect to.

Raises:
RuntimeError

In case an incorrect configuration has been loaded.

async handle_command(command: str, **kwargs: Any) None

Handle incomming commands and parameters.

Parameters:
commandstr

The command to handle.

kwargs:

The parameters to the command.

async stop_sending_telemetry() None

Stop reading the sensor data.

Raises:
CommandError

A CommandError with ResponseCode NOT_STARTED is raised if the command handler was not started yet.