RemoteCommand#

class lsst.ts.salobj.topics.RemoteCommand(salinfo, name)#

Bases: WriteTopic

Issue a specific command topic and wait for acknowldgement.

Parameters:
  • salinfo (SalInfo) – SAL component information.

  • name (str) – Command name, with no prefix, e.g. “start”.

Methods Summary

next_ackcmd(ackcmd[, timeout, wait_done])

Wait for the next acknowledgement for the command.

set(**kwargs)

Create a new self.data and set one or more fields.

set_start([timeout, wait_done])

Create a new self.data, set zero or more fields, and start the command.

set_write(*[, force_output])

An override of WriteTopic.set_write that is disabled.

start([data, timeout, wait_done])

Start a command.

write(**kwargs)

An override of WriteTopic.write that is disabled.

Methods Documentation

async next_ackcmd(ackcmd, timeout=3600, wait_done=True)#

Wait for the next acknowledgement for the command.

Parameters:
  • ackcmd (SalInfo.AckCmdType) – Command acknowledgement returned by the previous call to set_start, start or next_ackcmd.

  • timeout (float, optional) – Time limit, in seconds. If None then use DEFAULT_TIMEOUT. This time limit is for the entire command if wait_done is true, else it is for the next command acknowledgement. If wait_done is true and the command is acknowledged with CMD_INPROGRESS then the timeout is extended by the timeout value in the acknowledgement. Thus a slow command will not need a long timeout, so long as the command issues a CMD_INPROGRESS acknowledgement with a reasonable timeout value.

  • wait_done (bool, optional) – If true then wait for final command acknowledgement. If false then wait only for the next command acknowledgement If that acknowledgement is not final (the ack code is not in self.done_ack_codes), then you will almost certainly want to await next_ackcmd again.

Returns:

ackcmd – Command acknowledgement.

Return type:

SalInfo.AckCmdType

Raises:
set(**kwargs)#

Create a new self.data and set one or more fields.

Parameters:

**kwargs (dict [str, any]) –

Dict of field name: new value for that field:

  • Any key whose value is None is checked for existence, but the value of the field is not changed.

  • If the field being set is an array then the value must either be an array of the same length or a scalar (which replaces every element of the array).

Returns:

did_change – True if self.data was changed, or if this was the first call to set.

Return type:

bool

Raises:
  • AttributeError – If the topic does not have the specified field.

  • ValueError – If the field cannot be set to the specified value.

Notes

If one or more fields cannot be set, the data may be partially updated.

async set_start(timeout=3600, wait_done=True, **kwargs)#

Create a new self.data, set zero or more fields, and start the command.

Parameters:
  • timeout (float, optional) – Time limit, in seconds. If None then use DEFAULT_TIMEOUT. This time limit is for the entire command if wait_done is true, else it is for the first command acknowledgement. If wait_done is true and the command is acknowledged with CMD_INPROGRESS then the timeout is extended by the timeout value in the acknowledgement. Thus a slow command will not need a long timeout, so long as the command issues a CMD_INPROGRESS acknowledgement with a reasonable timeout value.

  • wait_done (bool, optional) – If True then wait for final command acknowledgement. If False then wait only for the first command acknowledgement If that acknowledgement is not final (the ack code is not in self.done_ack_codes), then you will almost certainly want to await next_ackcmd.

  • **kwargs (dict [str, any]) – The remaining keyword arguments are field name = new value for that field. See set for more information about values.

Returns:

ackcmd – Command acknowledgement.

Return type:

SalInfo.AckCmdType

Raises:
async set_write(*, force_output=None, **kwargs)#

An override of WriteTopic.set_write that is disabled.

Parameters:
  • force_output (bool | None, default: None)

  • kwargs (Any)

Return type:

SetWriteResult

async start(data=None, timeout=3600, wait_done=True)#

Start a command.

Parameters:
  • data (self.DataType, optional) – Command message. If None then send the current self.data.

  • timeout (float, optional) – Time limit, in seconds. If None then use DEFAULT_TIMEOUT. This time limit is for the entire command if wait_done is true, else it is for the first acknowledgement. If wait_done is true and the command is acknowledged with CMD_INPROGRESS then the timeout is extended by the timeout value in the acknowledgement. Thus a slow command will not need a long timeout, so long as the command issues a CMD_INPROGRESS acknowledgement with a reasonable timeout value.

  • wait_done (bool, optional) – If True then wait for final command acknowledgement. If False then wait only for the first command acknowledgement. If that acknowledgement is not final (the ack code is not in self.done_ack_codes), then you will almost certainly want to await next_ackcmd.

Returns:

ackcmd – Command acknowledgement.

Return type:

SalInfo.AckCmdType

Raises:
async write(**kwargs)#

An override of WriteTopic.write that is disabled.

Parameters:

kwargs (Any)

Return type:

BaseMsgType