# TopicCallback¶

class lsst.ts.watcher.TopicCallback(topic, rule, model)

Bases: object

Call one or more rules when a salobj topic receives a sample.

The rule is called with one argument: this topic callback.

Parameters: topic : salobj.ReadTopic Topic to monitor. rule : BaseRule Rule to call. model : Model Watcher model. Used by __call__ to check if the model is enabled.

Attributes Summary

 attr_name Get the topic name, with an evt_ or tel_ prefix. remote_index Get the SAL index of the remote. remote_name Get the name of the remote.

Methods Summary

 __call__(value) Call self as a function. add_rule(rule) Add a rule. get() Get the current value of the topic.

Attributes Documentation

attr_name

Get the topic name, with an evt_ or tel_ prefix.

This is the name of the wrapped topic attribute in RemoteWrapper.

remote_index

Get the SAL index of the remote.

remote_name

Get the name of the remote.

Methods Documentation

__call__(value)

Call self as a function.

add_rule(rule)

Parameters: rule : BaseRule Rule to add.
get()
This is provided so that code in Rule.__call__ can easily get the current value of the topic that triggered the call.