MockServer#
- class lsst.ts.electrometer.MockServer(brand, unstable=False, disconnect_reply_after_bytes=None)#
Bases:
OneClientReadLoopServerImplement a mock server for the electrometer.
- Parameters:
brand (
str) – Electrometer brand to simulate.unstable (
bool, optional) – If true, add random write latency to replies.disconnect_reply_after_bytes (
intorNone, optional) – If provided, close the client connection after writing this many bytes of the first reply. The remaining bytes are sent after the client reconnects.
- log#
The log for the server.
- Type:
logging.Logger
- device#
The mock device that handles commands that are parsed.
- Type:
- read_loop_task#
The task that tracks the read loop.
- Type:
asyncio.Future
Methods Summary
connect_callback(server)Start the command loop when client is connected.
Read client commands and dispatch them to the mock device.
Methods Documentation
- async connect_callback(server)#
Start the command loop when client is connected.
- Parameters:
server (
MockServer) – The server object.
- async read_and_dispatch()#
Read client commands and dispatch them to the mock device.
- Return type:
None