remotivelabs.topology.namespaces.scripted
ScriptedNamespace provides access to frames that have been transformed by scripts in the broker.
Initialize the scripted namespace client.
Arguments:
- name: The namespace name to operate in.
- broker_client: The client used to communicate with the broker.
- decode_named_values: True will decode named values to str.
Note:
Use together with a
BehavioralModelor start the instance using a context manager:async with ScriptedNamespace(...) as broker_client: ...
Open the namespace. This is an idempotent operation - calling it multiple times has no additional effect.
Returns:
The namespace
Raises:
- ValueError: If the namespace is not of type 'scripted'.
Will close the namespace. This is an idempotent operation - calling it multiple times has no additional effect.
Subscribe to a list of signals.
Arguments:
- *signals: One or more signals to subscribe to.
- on_change: Whether to receive updates only on change.
Note: does not support decoding enums
Returns:
An asynchronous iterator of lists of Signal objects.
Subscribe to a Frames.
Arguments:
- *frames: One or more frames to subscribe to.
- on_change: Whether to receive updates only on change.
- initial_empty: If
True, the first broker message (an empty sync marker) is consumed internally before the iterator is returned, ensuring the broker is ready before the first real value arrives. Useful when you need to guarantee the subscription is live before publishing something. - decode_named_values: True will decode named values to str.
Returns:
An asynchronous iterator with Frames.
Creates a list of input handlers for the given namespace to be used with a BehavioralModel.
Each handler defines a filter and a corresponding async callback for processing matching frames.
Arguments:
- - filters: A sequence of filter objects to select relevant frames or signals.
- - callback: An async callback function that receives and processes a Frame.