# AckCmdWriter¶

class lsst.ts.salobj.topics.AckCmdWriter(salinfo)

Command Acknowledgement writer.

Attributes Summary

 DataType The type (class) for a message of this topic. data Internally cached message. has_data Has data ever been set? metadata Get topic metadata as a TopicMetadata, if available, else None. volatile Does this topic have volatile durability?

Methods Summary

 basic_close() A synchronous and possibly less thorough version of close. close() Shut down and release resources. put([data, priority]) Output this topic. set(**kwargs) Set one or more fields of message data cache self.data.

Attributes Documentation

DataType

The type (class) for a message of this topic.

When you read or write a message for this topic you are reading or writing an instance of DataType.

Notes

The preferred way to write a message for a topic is:

However, it is also possible to use DataType to create a message, then write, it as separate operations. For example, assuming we have a Remote for SAL component “Test”:

# The preferred way to issue a command:
await = remote.cmd_wait.set_put(duration=2, timeout=5)

# But an alternative is to first create the command,
# then send it, as two separate operations:
message = remote.cmd_wait.DataType(duration=2)
await remote.cmd_wait.start(message, timeout=5)

# Or, even more verbosely:
message = remote.cmd_wait.DataType()
message.duration = 2
await remote.cmd_wait.start(message, timeout=5)

data

Internally cached message.

Raises: TypeError If data is not an instance of DataType

Notes

Do not assume the data will be constant. You can make a copy using copy.copy(data).

has_data

Has data ever been set?

metadata

Get topic metadata as a TopicMetadata, if available, else None.

volatile

Does this topic have volatile durability?

Methods Documentation

basic_close()

A synchronous and possibly less thorough version of close.

Intended for exit handlers and constructor error handlers.

close()

Shut down and release resources.

Intended to be called by SalInfo.close(), since that tracks all topics.

put(data=None, priority=0)

Output this topic.

Parameters: data : self.DataType or None New message data to replace self.data, if any. priority : int, optional Priority; used to set the priority field of events. Ignored for commands and telemetry. TypeError If data is not None and not an instance of DataType.
set(**kwargs)

Set one or more fields of message data cache self.data.

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). did_change : bool True if self.data was changed, or if this was the first call to set. 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 message data may be partially updated.