AtSimulator#
- class lsst.ts.attcpip.AtSimulator(host, cmd_evt_port, telemetry_port, simulator_state=State.STANDBY, send_fail_reason=True)#
Bases:
objectCommon code for simulating an AT system.
- simulator_state#
The summary state to start with.
- Type:
sal_enums.State
- send_fail_reason#
Send a fail reason for failed commands or not. Defaults to True. Unit tests may set this to False.
- Type:
- Parameters:
Methods Summary
base_cmd_evt_connect_callback(server)Callback to call when a command/event client connects or disconnects.
cmd_evt_connect_callback(server)Callback to call when a command/event client connects or disconnects.
Asynchronous function to call when data is read and dispatched.
disable(*, sequence_id)Switch to sal_enums.State.DISABLED.
enable(*, sequence_id)Switch to sal_enums.State.ENABLED.
fault()Switch to sal_enums.State.FAULT.
Load the JSON schemas needed to validate the incoming and outgoing JSON messages.
Send detailed state events.
standby(*, sequence_id)Switch to sal_enums.State.STANDBY.
start(*, sequence_id)Start and switch to sal_enums.State.DISABLED.
telemetry_connect_callback(server)Callback function for when a telemetry client connects or disconnects.
Asynchronous function to call when data are read and dispatched.
verify_data(data)Verify the format and values of the data.
write_ack_response(sequence_id)Write an
ACKresponse.write_fail_response(sequence_id, reason, ...)Write a
FAILresponse.write_noack_response(sequence_id)Write a
NOACKresponse.write_success_response(sequence_id)Write a
SUCCESSresponse.Methods Documentation
- async base_cmd_evt_connect_callback(server)#
Callback to call when a command/event client connects or disconnects.
This method will call cmd_evt_connect_callback which needs to be implemented by subclasses.
- Parameters:
server (
tcpip.OneClientServer) – The server to which the client connected.- Return type:
- async cmd_evt_connect_callback(server)#
Callback to call when a command/event client connects or disconnects.
- Parameters:
server (
tcpip.OneClientServer) – The server to which the client connected.- Return type:
- async cmd_evt_dispatch_callback(data)#
Asynchronous function to call when data is read and dispatched.
The received data is validated and then dispatched to the corresponding function as listed in
self.dispatch_dict. If the data is invalid then anoackresponse is sent back to the client and the data is not dispatched.- Parameters:
data (
dict`[`str,typing.Any]) – The data sent to the server.- Return type:
- async disable(*, sequence_id)#
Switch to sal_enums.State.DISABLED.
- async enable(*, sequence_id)#
Switch to sal_enums.State.ENABLED.
- load_schemas()#
Load the JSON schemas needed to validate the incoming and outgoing JSON messages.
- Return type:
- async send_detailed_state_events()#
Send detailed state events.
This method is called when going to FAULT state. Subclasses may implement this such that the device specific behavior is mimicked.
- Return type:
- async standby(*, sequence_id)#
Switch to sal_enums.State.STANDBY.
- async start(*, sequence_id)#
Start and switch to sal_enums.State.DISABLED.
- async telemetry_connect_callback(server)#
Callback function for when a telemetry client connects or disconnects.
- Parameters:
server (
tcpip.OneClientServer) – The server to which the client connected.- Return type:
- async telemetry_dispatch_callback(data)#
Asynchronous function to call when data are read and dispatched.
The received data is ignored since the telemetry server is only supposed to send data and not to receive any.
- Parameters:
data (
dict`[`str,typing.Any]) – The data sent to the server.- Return type:
- async verify_data(data)#
Verify the format and values of the data.
The format of the data is described at lsst-ts/ts_labview_tcp_json as well as in the JSON schemas in the schemas directory.
- async write_ack_response(sequence_id)#
Write an
ACKresponse.
- async write_fail_response(sequence_id, reason, error_details)#
Write a
FAILresponse.
- async write_noack_response(sequence_id)#
Write a
NOACKresponse.