fastcs.attributes#

Members

AttrIOUpdateCallback

An AttributeIO callback that takes an AttrR and updates its value

AttrOnPutCallback

Callbacks to be called when the setpoint of an attribute is changed

AttrOnUpdateCallback

A callback to be called when the value of the attribute is updated

AttrR

A read-only Attribute.

AttrRW

A read-write Attribute.

AttrSyncSetpointCallback

Callbacks to be called when the setpoint of an attribute is changed

AttrUpdateCallback

A callback to be called periodically to update an attribute

AttrW

A write-only Attribute.

Attribute

Base FastCS attribute.

ONCE

Special value to indicate that an attribute should be updated once on start up.

fastcs.attributes.ONCE = inf#

Special value to indicate that an attribute should be updated once on start up.

class fastcs.attributes.Attribute(datatype: DataType[T], io_ref: AttributeIORefT | None = None, group: str | None = None, description: str | None = None)[source]#

Base FastCS attribute.

Instances of this class added to a Controller will be used by the FastCS class.

fastcs.attributes.AttrIOUpdateCallback#

An AttributeIO callback that takes an AttrR and updates its value

alias of Callable[[AttrR[T, Any]], Awaitable[None]]

fastcs.attributes.AttrUpdateCallback#

A callback to be called periodically to update an attribute

alias of Callable[[], Awaitable[None]]

fastcs.attributes.AttrOnUpdateCallback#

A callback to be called when the value of the attribute is updated

alias of Callable[[T], Awaitable[None]]

class fastcs.attributes.AttrR(datatype: DataType[T], io_ref: AttributeIORefT | None = None, group: str | None = None, initial_value: T | None = None, description: str | None = None)[source]#

A read-only Attribute.

get() T[source]#

Get the cached value of the attribute.

async update(value: T) None[source]#

Update the value of the attibute

This sets the cached value of the attribute presented in the API. It should generally only be called from an IO or a controller that is updating the value from some underlying source.

To request a change to the setpoint of the attribute, use the put method, which will attempt to apply the change to the underlying source.

add_on_update_callback(callback: Callable[[T], Awaitable[None]]) None[source]#

Add a callback to be called when the value of the attribute is updated

The callback will be called with the updated value.

set_update_callback(callback: AttrIOUpdateCallback[T])[source]#

Set the callback to update the value of the attribute from the source

The callback will be converted to an async task and called periodically.

bind_update_callback() Callable[[], Awaitable[None]][source]#

Bind self into the registered IO update callback

fastcs.attributes.AttrOnPutCallback#

Callbacks to be called when the setpoint of an attribute is changed

alias of Callable[[AttrW[T, Any], T], Awaitable[None]]

fastcs.attributes.AttrSyncSetpointCallback#

Callbacks to be called when the setpoint of an attribute is changed

alias of Callable[[T], Awaitable[None]]

class fastcs.attributes.AttrW(datatype: DataType[T], io_ref: AttributeIORefT | None = None, group: str | None = None, description: str | None = None)[source]#

A write-only Attribute.

async put(setpoint: T, sync_setpoint: bool = False) None[source]#

Set the setpoint of the attribute

This should be called by clients to the attribute such as transports to apply a change to the attribute. The _on_put_callback will be called with this new setpoint, which may or may not take effect depending on the validity of the new value. For example, if the attribute has an IO to some device, the value might be rejected.

To directly change the value of the attribute, for example from an update loop that has read a new value from some underlying source, call the update method.

set_on_put_callback(callback: Callable[[AttrW[T, Any], T], Awaitable[None]]) None[source]#

Set the callback to call when the setpoint is changed

The callback will be called with the attribute and the new setpoint.

add_sync_setpoint_callback(callback: Callable[[T], Awaitable[None]]) None[source]#

Add a callback to publish changes to the setpoint of the attribute

The callback will be called with the new setpoint.

class fastcs.attributes.AttrRW(datatype: DataType[T], io_ref: AttributeIORefT | None = None, group: str | None = None, initial_value: T | None = None, description: str | None = None)[source]#

A read-write Attribute.