class ROS2ServiceMethod(ROS2ContainerMixin, ParentMixin[
Constructor: ROS2ServiceMethod(binding, runtime, context, minimum_access_level)
The Method one ~opensmi.ros2.server.bindings.MethodBinding becomes.
Constructed by the declaring Component. A declaration may name a subclass of this class to add behaviour; the subclass is checked when the declaration is read.
| Method | __init__ |
Resolve everything about the declaration that can be wrong, before any node exists. |
| Async Method | build |
Return the request message to send, given what a client wrote into the Parameters. |
| Async Method | execute |
Call the service and write what answered. |
| Async Method | read |
Return what the ParameterSet holds now, by variable name. |
| Async Method | read |
Return the FinalResultData values one response message carries, by variable name. |
| Async Method | read |
Return what the FinalResultData holds now, by variable name. |
| Class Variable | callable |
Undocumented |
| Property | binding |
Return the declaration this Method was built from. |
| Property | service |
Return the request and response types of the service this Method is bound to. |
| Async Method | _call |
Send one request, turning the two transport failures into UA status codes. |
| Async Method | _init |
Let opensmi register the Call, create the variables, and prove the defaults can be sent. |
| Method | _require |
Refuse a call the service answered with no, if the declaration named the field. |
| Instance Variable | _binding |
Undocumented |
| Instance Variable | _parameters |
Undocumented |
| Instance Variable | _request |
Undocumented |
| Instance Variable | _request |
Undocumented |
| Instance Variable | _response |
Undocumented |
| Instance Variable | _response |
Undocumented |
| Instance Variable | _results |
Undocumented |
| Instance Variable | _runtime |
Undocumented |
| Instance Variable | _types |
Undocumented |
MethodBinding, runtime: RuntimeInterface, context: ProjectionContext, minimum_access_level: int = SKILL_ACCESS_LEVEL):
¶
Resolve everything about the declaration that can be wrong, before any node exists.
A missing interface package, a pattern that matches nothing, a request that cannot be built backwards or a bad success_field fails here instead of on the first Call.
| Parameters | |
binding:MethodBinding | What to build. |
runtime:RuntimeInterface | Where the request is sent. The Machine's, reached through the Component. |
context:ProjectionContext | The Projection context of the Component, with nothing selected yet. The Method narrows it once per surface (request, response). |
minimumint | The level a caller needs. |
| Raises | |
MessageTypeError | When the service type cannot be resolved. |
FieldSelectionError | When a selection pattern matches nothing. |
NotInvertibleError | When the request type reaches a Projection that cannot run backwards. |
SuccessFieldError | When success_field names a field the response does not have, or one that is not a bool. |
Return the request message to send, given what a client wrote into the Parameters.
Override on a custom class when building the request needs the instance. The declaration's
request_from is the pure-function form, and default_request_from is the
default. An override must also work with the declaration's defaults, because _init
calls it once with them. A Parameter a subclass adds after super()._init() does not
exist yet at that point, so an override reading it must tolerate its absence.
Call the service and write what answered.
opensmi's only hook, called after the access level, Lock and startup checks.
| Raises | |
UaStatusCodeError | The code TRANSPORT_STATUS gives a transport failure,
or REFUSED_BY_THE_SERVICE when the success_field came back False
(after the response has been written). |
Return the FinalResultData values one response message carries, by variable name.
Overridable like build_request; the declaration's response_to is the
pure-function form and default_response_to the default.
Let opensmi register the Call, create the variables, and prove the defaults can be sent.
Building a request from the initial Parameters must work, so a value ROS2 would abort on fails here, on the machine of whoever wrote the declaration.