Controller

class lsst.ts.MTMount.mock.Controller(reply_port, log)

Bases: object

Simulate the most basic responses from the Operation Manager.

Acknowledge all commands and mark as done. Also output a few other replies, to exercise the code.

Parameters:
reply_port : int

Port for writing replies (that the CSC reads). The command port is one greater than the reply port.

log : logging.Logger

Logger.

Methods Summary

add_all_devices() Add all mock devices.
add_device(device_class, **kwargs) Add a mock device.
close()
connect_callback(server)
delete_command_queue() Delete the command queue, if present.
disconnect()
do_both_axes_move(command)
do_both_axes_stop(command)
do_both_axes_track(command)
handle_command(command)
read_loop()
reply_to_command(command)
set_command_queue([maxsize]) Create the command queue.
start()
write_ack(command, timeout) Report a command as acknowledged.
write_done(command) Report a command as done.
write_noack(command, explanation) Report a command as failed.

Methods Documentation

add_all_devices()

Add all mock devices.

The devices are added to self.device_dict.

Parameters:
device_id : DeviceId

Device identifier.

add_device(device_class, **kwargs)

Add a mock device.

The device is added to self.device_dict.

Parameters:
device_class : mock.Device

Mock device class.

**kwargs : dict

Additional arguments for device_class.

close()
connect_callback(server)
delete_command_queue()

Delete the command queue, if present.

This sets self.command_queue=None.

disconnect()
do_both_axes_move(command)
do_both_axes_stop(command)
do_both_axes_track(command)
handle_command(command)
read_loop()
reply_to_command(command)
set_command_queue(maxsize=0)

Create the command queue.

This sets attribute self.command_queue to an asyncio.Queue and uses it to record commands as they are received.

Parameters:
maxsize : int (optional)

Maximum number of items on the queue. If <= 0 then no limit. If the queue gets full then the newest items are dropped.

start()
write_ack(command, timeout)

Report a command as acknowledged.

Parameters:
command : Command

Command to report as acknowledged.

timeout : float or None

Timeout for command (second)

write_done(command)

Report a command as done.

Parameters:
command : Command

Command to report as done.

write_noack(command, explanation)

Report a command as failed.

Parameters:
command : Command

Command to report as failed.

explanation : str

Reason for the failure.