CommandTelemetryClient#
- class lsst.ts.hexrotcomm.CommandTelemetryClient(*, log, ConfigClass, TelemetryClass, host, port, connect_callback, config_callback, telemetry_callback, connect_timeout=10.0)#
Bases:
ClientTCP/IP Client for a Moog CSC.
This client cannot be reconnected; once closed, you must create a new one.
- Parameters:
log (
logging.Logger) – Logger.ConfigClass (
ctypes.Structure) – Class for configuration.TelemetryClass (
ctypes.Structure) – Class for telemetryhost (
str) – IP address of CSC server.port (
int) – Server port.connect_callback (coroutine) – Coroutine to call when a connection is made or dropped. The function receives one argument: this client.
config_callback (coroutine) – Coroutine to call when configuration is read. The function receives one argument: this client.
telemetry_callback (coroutine) – Coroutine to call when telemetry is read. The function receives one argument: this client.
connect_timeout (
float, optional) – Time limit for a connection to be made (seconds).
- header#
The most recently read header (which may be for config, telemetry, or unrecognized).
- Type:
Header
- config#
The most recently read configuration. A null-constructed instance before configuration is read.
- Type:
ConfigClass
- configured_task#
A Future that is set to None when configuration is first read and processed, or to the exception if
config_callbackraises.- Type:
- telemetry#
The most recently read telemetry. A null-constructed instance before telemetry is read.
- Type:
TelemetryClass
- config_callback#
The
config_callbackconstructor argument.- Type:
coroutine
- telemetry_callback#
The
telemetry_callbackconstructor argument.- Type:
coroutine
- Plus the standard attributes of `lsst.ts.tcpip.Client`.
- Raises:
TypeError – If any of the callbacks is not a coroutine.
Notes
To start a client:
client = Client(...) await client.start_task
To stop the client:
await client.stop()
Methods Summary
close()Close the socket connection and cancel all tasks.
Wait for next telemetry.
Read from the Moog controller.
run_command(command[, interrupt])Run a command and wait for acknowledgement.
start()Connect to the low-level controller.
Methods Documentation
- async close()#
Close the socket connection and cancel all tasks.
Always safe to call.
- Return type:
- async next_telemetry()#
Wait for next telemetry.
- Return type:
Structure
- async run_command(command, interrupt=False)#
Run a command and wait for acknowledgement.
- Parameters:
- Returns:
duration – The expected duration of the command (seconds).
- Return type:
- Raises:
ValueError – If
commandis not an instance ofstructs.Command.ConnectionError – If not connected.
asyncio.TimeoutError – If no acknowledgement is seen in time.
lsst.ts.salobj.ExpectedError – If the command fails.
Notes
Holds the command lock until the reply for this command is seen (or the time limit is exceeded).