remotivelabs.topology.namespaces.namespace_client

class NamespaceClient:

A NamespaceClient is used to interact with one or more namespaces on RemotiveBroker.

It manages lifecycle operations for namespaces (e.g., CanNamespace, SomeIPNamespace) and handles inputs.

NamespaceClient( broker_client: remotivelabs.broker.BrokerClient, namespaces: list[remotivelabs.topology.namespaces.namespace.Namespace] | None = None, input_handlers: list[tuple[str, remotivelabs.topology.namespaces.input_handlers.InputHandler]] | None = None, on_change: bool = True)

Initialize the NamespaceClient instance.

Arguments:
  • broker_client: The client used for communication with the broker.
  • namespaces: list of Namespace instances (CanNamespace, SomeIPNamespace, etc.).
  • input_handlers: Optional list of (namespace, handler list) pairs to receive callbacks on inputs. It is advised to create these using the namespace's create_input_handler method.
  • on_change: When True (default), a frame is only delivered when at least one of its signals has changed. The delivered frame always contains all signals, including unchanged ones. When False, every frame is delivered regardless of whether its signals have changed.
Note:

Start the instance using a context manager:

async with NamespaceClient(...) as client:
    ...
    await client.run_forever()

Or use the start/stop methods directly:

client = NamespaceClient(...)
await client.start()
# ...
await client.stop()

def is_running(self) -> bool:

Has the NamespaceClient been started?

async def start(self) -> None:

Start the NamespaceClient, open all namespaces, and initialize input handlers. This is an idempotent operation - calling it multiple times has no additional effect.

async def stop(self) -> None:

Stop the NamespaceClient, close all namespaces, and clean up resources. This is an idempotent operation - calling it multiple times has no additional effect.

async def run_forever(self) -> None:

Run the NamespaceClient indefinitely, processing inputs.

async def reset_restbuses(self) -> None:

Reset all restbus data for all namespaces.