fastcs.attributes.attr_r#
Members
An AttributeIO callback that takes an AttrR and updates its value |
|
A callback to be called when the value of the attribute is updated |
|
A read-only |
|
A callback to be called periodically to update an attribute |
- fastcs.attributes.attr_r.AttrIOUpdateCallback#
An AttributeIO callback that takes an AttrR and updates its value
- fastcs.attributes.attr_r.AttrUpdateCallback#
A callback to be called periodically to update an attribute
- fastcs.attributes.attr_r.AttrOnUpdateCallback#
A callback to be called when the value of the attribute is updated
- class fastcs.attributes.attr_r.AttrR(datatype: DataType[DType_T], io_ref: AttributeIORefT | None = None, group: str | None = None, initial_value: DType_T | None = None, description: str | None = None)[source]#
A read-only
Attribute- async update(value: Any) 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.
Any update callbacks will be called with the new value and any update events with predicates satisfied by the new value will be set.
To request a change to the setpoint of the attribute, use the
putmethod, which will attempt to apply the change to the underlying source.- Parameters:
value – The new value of the attribute
- Raises:
ValueError – If the value fails to be validated to DType_T
- add_on_update_callback(callback: Callable[[DType_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[DType_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
- async wait_for_predicate(predicate: Callable[[DType_T], bool], *, timeout: float)[source]#
Wait for the predicate to be satisfied when called with the current value
- Parameters:
predicate – The predicate to test - a callable that takes the attribute value and returns True if the event should be set
timeout – The timeout in seconds
- async wait_for_value(target_value: DType_T, *, timeout: float)[source]#
Wait for self._value to equal the target value
- Parameters:
target_value – The target value to wait for
timeout – The timeout in seconds
- Raises:
TimeoutError – If the attribute does not reach the target value within the timeout