ServiceServerBase QML Type
Abstract base for all generated ROS 2 service server types. More...
Properties
Detailed Description
ServiceServerBase is not creatable directly. Use a generated service server type such as TriggerServiceServer from QtRos2.StdSrvs.
Property Documentation
active : bool
true while the service is created and advertised on topic.
handler : var
A JavaScript function invoked (on the GUI thread) for every incoming request: (request, reply) => response.
The handler may respond in one of two ways:
- synchronously — return the response value. For services with a multi-field response, return an object with the response fields, e.g.
({ success: true, message: "ok" }). For services with an empty response, return any value other thanundefinedto acknowledge the request. - deferred — return
undefined(i.e. noreturnstatement) and later callreply.send(response)when the work is done. Use this for requests that take time to complete.
Setting a handler is optional: generated server types also offer a declarative response property that answers each request with its current (bindable) value. A callable handler takes precedence over the response property. If neither is set (or the handler throws), a default-constructed response is sent so callers do not block indefinitely.
© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.