remotivelabs.topology.namespaces.some_ip
SomeIP provides a client-side interface for sending SOME/IP requests and handling responses within a specific namespace using a broker client.
The client maintains a session ID counter and ensures that the namespace is of type 'someip' before issuing requests. To validate and activate the namespace, this class must be used as an async context manager.
Initialize the SomeIP namespace client
Arguments:
- name: The namespace name to operate in.
- broker_client: The client used to communicate with the broker.
- client_id: The SOME/IP client ID used for requests.
- decode_named_values: True will decode named values to str.
Note:
Use together with a
BehavioralModel
or start the instance using a context manager:async with SomeIPNamespace(...) as namespace: ...
Opens the SOME/IP namespace and validates that the namespace is of the correct type. 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 'someip'.
Send a SOME/IP request and return an asyncio Task that resolves to the response or error.
Arguments:
- req: A SomeIPRequest instance specifying service, method, type, and parameters.
Returns:
asyncio.Task that resolves to SomeIPResponse, SomeIPError, or None if no return is expected.
Raises:
- ValueError: If a response is expected but the response frame is missing.
Subscribes to a stream of SOME/IP events.
Arguments:
- *events: One or more tuples, each containing event name and service name of events to subscribe to.
- on_change: If True, only yield updates when signal values change.
Returns:
An asynchronous iterator with SomeIPEvent.
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 requests/events.
Arguments:
- - filters: A sequence of SomeIPRequestFilter or SomeIPEventFilter objects to select relevant requests or events
- - callback: An async callback function that receives and processes a request or event.
Inherited Members
Represents a SOME/IP request
Attributes:
- name: The name of the request.
- service_instance_name: The name of the service associated with the request.
- raw: The raw data to be sent with the request. If non-empty, it takes priority over
parameters
. - parameters: A dictionary of key-value pairs representing decoded request data.
Note:
str
is only supported for named values (e.g., Enums).
Note:
When sending a request, if
raw
is non-empty, it overrides the contents ofparameters
.
Represents a SOME/IP response
Attributes:
- raw: The raw data received in the response. If non-empty, it takes priority over
parameters
. - parameters: A dictionary of key-value pairs representing decoded response data.
Note:
str
is only supported for named values (e.g., Enums).
Note:
When processing a response, if
raw
is non-empty, it overrides the contents ofparameters
.
Represents a SOME/IP error response
Attributes:
- return_code: The return code of the response.
Represents a SOME/IP event.
Attributes:
- name: The name of the event.
- service_instance_name: The name of the service associated with the event.
- raw: Raw bytes of the event payload. If non-empty, it takes precedence over
parameters
when emitting an event. - parameters: A dictionary of key-value pairs representing decoded event data.
Note:
str
is only supported for named values (e.g., Enums).
Note:
When handling the event, if
raw
is non-empty, it overrides the contents ofparameters
.