TcpipDevice

class lsst.ts.ess.common.device.TcpipDevice(name: str, host: str, port: int, sensor: BaseSensor, baud_rate: int, callback_func: Callable, log: Logger, simulation_mode: int)

Bases: BaseDevice

Remote device that publishes telemetry via TCP/IP.

Parameters:
namestr

The name of the device.

hoststr

The hostname of the device.

portint

The port of the device.

sensorBaseSensor

The sensor that produces the telemetry.

baud_rateint

The baud rate of the sensor.

callback_funcCallable

Callback function to receive the telemetry.

loglogging.Logger

The logger to create a child logger for.

simulation_modeint

Simulation mode; 0 for normal operation.

Attributes Summary

connected

Methods Summary

basic_close()

Close the Sensor Device.

basic_open()

Open the Sensor Device.

close()

Generic close function.

open()

Generic open function.

readline()

Read a line of telemetry from the device.

Attributes Documentation

connected

Methods Documentation

async basic_close() None

Close the Sensor Device.

async basic_open() None

Open the Sensor Device.

async close() None

Generic close function.

Stop the telemetry loop. Then check if the device is open and, if yes, call basic_close.

async open() None

Generic open function.

Check if the device is open and, if not, call basic_open. Then start the telemetry loop.

Raises:
RuntimeError

In case the device already is open.

async readline() str

Read a line of telemetry from the device.

Returns:
linestr

Line read from the device. Includes terminator string if there is one. May be returned empty if nothing was received or partial if the readline was started during device reception.