CommandTelemetryClient#

class lsst.ts.hexrotcomm.CommandTelemetryClient(*, log, ConfigClass, TelemetryClass, host, port, connect_callback, config_callback, telemetry_callback, connect_timeout=10.0)#

Bases: Client

TCP/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 telemetry

  • host (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_callback raises.

Type:

asyncio.Future

telemetry#

The most recently read telemetry. A null-constructed instance before telemetry is read.

Type:

TelemetryClass

config_callback#

The config_callback constructor argument.

Type:

coroutine

telemetry_callback#

The telemetry_callback constructor 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.

next_telemetry()

Wait for next telemetry.

read_loop()

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:

None

async next_telemetry()#

Wait for next telemetry.

Return type:

Structure

async read_loop()#

Read from the Moog controller.

Return type:

None

async run_command(command, interrupt=False)#

Run a command and wait for acknowledgement.

Parameters:
  • command (Command) – Command to write. Its counter field will be set.

  • interrupt (bool, optional) – Interrupt the current command, if any? Only use this for the stop command and similar.

Returns:

duration – The expected duration of the command (seconds).

Return type:

float

Raises:

Notes

Holds the command lock until the reply for this command is seen (or the time limit is exceeded).

async start()#

Connect to the low-level controller.

Return type:

None