|
nros C API
Lightweight ROS 2 client for embedded real-time systems
|
#include <stdarg.h>#include <stdbool.h>#include <stdint.h>#include <stddef.h>#include "nros/visibility.h"#include "nros/nros_config_generated.h"

Go to the source code of this file.
Typedefs | |
| typedef void(* | nros_accepted_callback_t) (struct nros_action_server_t *server, const struct nros_goal_handle_t *goal, void *context) |
| typedef enum nros_cancel_response_t(* | nros_cancel_callback_t) (struct nros_action_server_t *server, const struct nros_goal_handle_t *goal, void *context) |
| typedef uint8_t | nros_deadline_policy_t |
| typedef bool(* | nros_endpoint_info_visit_fn) (void *ctx, const struct nros_endpoint_info_t *info) |
| typedef void(* | nros_event_liveliness_changed_cb_t) (struct nros_subscription_t *sub, struct nros_liveliness_changed_status_t status, void *user_context) |
| typedef void(* | nros_event_publisher_count_cb_t) (struct nros_publisher_t *pub_, struct nros_count_status_t status, void *user_context) |
| typedef void(* | nros_event_subscriber_count_cb_t) (struct nros_subscription_t *sub, struct nros_count_status_t status, void *user_context) |
| typedef bool(* | nros_executor_trigger_t) (const bool *ready, size_t count, void *context) |
| typedef void(* | nros_feedback_callback_t) (const struct nros_goal_uuid_t *goal_uuid, const uint8_t *feedback, size_t feedback_len, void *context) |
| typedef enum nros_goal_response_t(* | nros_goal_callback_t) (struct nros_action_server_t *server, const struct nros_goal_handle_t *goal, const uint8_t *goal_request, size_t goal_len, void *context) |
| typedef void(* | nros_goal_response_callback_t) (const struct nros_goal_uuid_t *goal_uuid, bool accepted, void *context) |
| typedef void(* | nros_guard_condition_callback_t) (void *context) |
| typedef uint8_t(* | nros_lifecycle_callback_t) (void *context) |
| typedef bool(* | nros_names_and_types_visit_fn) (void *ctx, const char *name, const char *const *types, size_t types_count) |
| typedef bool(* | nros_node_visit_fn) (void *ctx, const char *node_name, const char *node_namespace, const char *enclave) |
| typedef bool(* | nros_parameter_callback_t) (const char *name, const struct nros_parameter_t *param, void *context) |
| typedef void(* | nros_response_callback_t) (const uint8_t *response, size_t response_len, void *context) |
| typedef void(* | nros_result_callback_t) (const struct nros_goal_uuid_t *goal_uuid, enum nros_goal_status_t status, const uint8_t *result, size_t result_len, void *context) |
| typedef int | nros_ret_t |
| typedef uint8_t | nros_sched_class_t |
| typedef uint8_t | nros_sched_context_id_t |
| typedef uint8_t | nros_sched_priority_t |
| typedef bool(* | nros_service_callback_t) (const uint8_t *request_data, size_t request_len, uint8_t *response_data, size_t response_capacity, size_t *response_len, void *context) |
| typedef uint32_t | nros_shutdown_callback_handle_t |
| typedef void(* | nros_shutdown_callback_t) (void *context) |
| typedef void(* | nros_subscription_callback_t) (const uint8_t *data, size_t len, void *context) |
| typedef void(* | nros_subscription_info_callback_t) (const uint8_t *data, size_t len, const uint8_t *attachment, size_t attachment_len, void *context) |
| typedef void(* | nros_timer_callback_t) (struct nros_timer_t *timer, void *context) |
Variables | |
| const struct nros_qos_t | NROS_QOS_DEFAULT |
| const struct nros_qos_t | NROS_QOS_SENSOR_DATA |
| const struct nros_qos_t | NROS_QOS_SERVICES |
| const uint32_t | NROS_TRANSPORT_OPS_ABI_VERSION_V1 |
| #define MAX_RMW_NAME_LEN 32 |
Maximum length of an RMW backend name (e.g., "zenoh", "cyclonedds", "xrce").
Matches BACKEND_NAME_MAX in nros-rmw-cffi/src/lib.rs. Lifted to a public constant here so nros_node_options_t can declare a fixed-size buffer that round-trips through the registry without truncation.
| #define NROS_DOMAIN_ID_EXPLICIT_ZERO 255 |
Issue #227 — pass this as domain_id to nros_support_init[_named] to request an EXPLICIT domain 0. Plain 0 is the UNSET sentinel (defers to ROS_DOMAIN_ID env on hosted, then the baked/default rungs — the #206 model-A ladder). Valid domains cap at 232, so 255 is unambiguous. Hosted env still overrides it, like every explicit argument under model A.
| #define NROS_DOMAIN_ID_INHERIT UINT32_MAX |
Sentinel value for domain_id_override. When set, the support context's domain_id is used instead of the per-Node override.
| #define NROS_GENERATED_H |
| #define NROS_LIFECYCLE_RET_ERROR 2 |
Transition result: Error
| #define NROS_LIFECYCLE_RET_FAILURE 1 |
Transition result: Failure
| #define NROS_LIFECYCLE_RET_OK 0 |
Transition result: Success
| #define NROS_LIFECYCLE_STATE_ACTIVE 3 |
Lifecycle state: Active
| #define NROS_LIFECYCLE_STATE_ERROR_PROCESSING 5 |
Lifecycle state: ErrorProcessing
| #define NROS_LIFECYCLE_STATE_FINALIZED 4 |
Lifecycle state: Finalized
| #define NROS_LIFECYCLE_STATE_INACTIVE 2 |
Lifecycle state: Inactive
| #define NROS_LIFECYCLE_STATE_UNCONFIGURED 1 |
Lifecycle state: Unconfigured
| #define NROS_LIFECYCLE_TRANSITION_ACTIVATE 2 |
Lifecycle transition: Activate
| #define NROS_LIFECYCLE_TRANSITION_CLEANUP 4 |
Lifecycle transition: Cleanup
| #define NROS_LIFECYCLE_TRANSITION_CONFIGURE 1 |
Lifecycle transition: Configure
| #define NROS_LIFECYCLE_TRANSITION_DEACTIVATE 3 |
Lifecycle transition: Deactivate
| #define NROS_LIFECYCLE_TRANSITION_ERROR_RECOVERY 8 |
Lifecycle transition: Error Recovery
| #define NROS_LIFECYCLE_TRANSITION_SHUTDOWN_ACTIVE 7 |
Lifecycle transition: Shutdown (from Active)
| #define NROS_LIFECYCLE_TRANSITION_SHUTDOWN_INACTIVE 6 |
Lifecycle transition: Shutdown (from Inactive)
| #define NROS_LIFECYCLE_TRANSITION_SHUTDOWN_UNCONFIGURED 5 |
Lifecycle transition: Shutdown (from Unconfigured)
| #define NROS_MAX_ACTION_NAME_LEN 256 |
Maximum length of an action name
| #define NROS_MAX_CONCURRENT_GOALS 4 |
Maximum number of concurrent goals per action server.
This is a fixed constant (not configurable via env var) because it affects nros_action_server_t struct layout. Changing it requires rebuilding the runtime and the consuming application together.
| #define NROS_MAX_LOCATOR_LEN 128 |
Maximum length of a zenoh locator string (e.g., "tcp/127.0.0.1:7447")
| #define NROS_MAX_NAME_LEN 64 |
Maximum length of a node name
| #define NROS_MAX_NAMESPACE_LEN 128 |
Maximum length of a node namespace
| #define NROS_MAX_PARAM_NAME_LEN 64 |
Maximum length of a parameter name
| #define NROS_MAX_PARAM_STRING_LEN 128 |
Maximum length of a string parameter value
| #define NROS_MAX_SERVICE_NAME_LEN 256 |
Maximum length of a service name
| #define NROS_MAX_TOPIC_LEN 256 |
Maximum length of a topic name
| #define NROS_MAX_TYPE_HASH_LEN 128 |
Maximum length of a type hash (RIHS format)
| #define NROS_MAX_TYPE_NAME_LEN 256 |
Maximum length of a type name (e.g., "std_msgs::msg::dds_::Int32_")
| #define NROS_RET_ALREADY_EXISTS -5 |
Resource already exists
| #define NROS_RET_BAD_SEQUENCE -8 |
Bad sequence (e.g., wrong order of operations)
| #define NROS_RET_ERROR -1 |
Generic error
| #define NROS_RET_FULL -6 |
Resource limit reached (e.g., max handles)
| #define NROS_RET_INVALID_ARGUMENT -3 |
Invalid argument passed
| #define NROS_RET_NOT_ALLOWED -12 |
Operation not allowed (e.g., goal not in correct state)
| #define NROS_RET_NOT_FOUND -4 |
Resource not found
| #define NROS_RET_NOT_INIT -7 |
Not initialized
| #define NROS_RET_OK 0 |
Success
| #define NROS_RET_PUBLISH_FAILED -10 |
Publish failed
| #define NROS_RET_REENTRANT -15 |
Reentrant call detected — a blocking helper (nros_client_call, nros_action_send_goal, nros_action_get_result) was called from inside a dispatch callback. These functions internally call nros_executor_spin_some, which is not reentrant.
| #define NROS_RET_REJECTED -13 |
Request was rejected (e.g., goal rejected by server)
| #define NROS_RET_SERVICE_FAILED -9 |
Service call failed
| #define NROS_RET_STALE_NODE -17 |
phase-379 W4 — the entity's node reference no longer names a live binding.
Returned when an entity is used or finalised after nros_node_fini retired the slot it was created on. Before W4 the entity held a raw *const nros_node_t that nothing dereferenced, so this case SUCCEEDED silently; the identity makes it detectable. Distinct from NROS_RET_NOT_INIT (never initialised) and NROS_RET_BAD_SEQUENCE (initialised, wrong order) because the remedy differs: the node outlived by this entity has to be finalised LAST.
| #define NROS_RET_SUBSCRIPTION_FAILED -11 |
Subscription failed
| #define NROS_RET_TIMEOUT -2 |
Timeout occurred
| #define NROS_RET_TRY_AGAIN -14 |
Operation not yet ready (e.g., async response still pending). Caller should spin the executor and try again.
| #define NROS_RET_UNSUPPORTED -16 |
The active backend does not implement this operation. Phase 108 status-event setters return this until backend wiring lands per phase (109+).
| #define NROS_SERIALIZATION_FORMAT_ID 1 |
Image-local discriminant of the linked backend's serialization format (nros_serdes::format::SerializationFormatId). RFC-0088 D2 — image-local: never persist it, never compare it across images.
| #define NROS_SHUTDOWN_CALLBACK_HANDLE_INVALID 4294967295 |
The value no successful registration ever produces.
| typedef void(* nros_accepted_callback_t) (struct nros_action_server_t *server, const struct nros_goal_handle_t *goal, void *context) |
Goal accepted callback type.
Invoked after the arena has sent the accept reply to the client. Use this to kick off goal execution.
| typedef enum nros_cancel_response_t(* nros_cancel_callback_t) (struct nros_action_server_t *server, const struct nros_goal_handle_t *goal, void *context) |
Cancel request callback type.
Invoked when a client requests cancellation of an accepted goal. Return NROS_CANCEL_ACCEPT or NROS_CANCEL_REJECT.
| typedef uint8_t nros_deadline_policy_t |
| typedef bool(* nros_endpoint_info_visit_fn) (void *ctx, const struct nros_endpoint_info_t *info) |
phase-381 W4 — visit one endpoint. Return false to stop.
| typedef void(* nros_event_liveliness_changed_cb_t) (struct nros_subscription_t *sub, struct nros_liveliness_changed_status_t status, void *user_context) |
Callback for NROS_EVENT_LIVELINESS_CHANGED.
| typedef void(* nros_event_publisher_count_cb_t) (struct nros_publisher_t *pub_, struct nros_count_status_t status, void *user_context) |
Callback for NROS_EVENT_LIVELINESS_LOST, NROS_EVENT_OFFERED_DEADLINE_MISSED (publisher side).
| typedef void(* nros_event_subscriber_count_cb_t) (struct nros_subscription_t *sub, struct nros_count_status_t status, void *user_context) |
Callback for NROS_EVENT_REQUESTED_DEADLINE_MISSED, NROS_EVENT_MESSAGE_LOST (subscriber side).
| typedef bool(* nros_executor_trigger_t) (const bool *ready, size_t count, void *context) |
Trigger function type for executor.
A trigger function receives a boolean array indicating which handles have data ready, along with the count of handles. It returns true if the executor should process callbacks.
ready - Pointer to boolean array (one per handle)count - Number of elements in the arraycontext - User-provided context pointertrue if executor should process callbacksfalse if executor should skip processing | typedef void(* nros_feedback_callback_t) (const struct nros_goal_uuid_t *goal_uuid, const uint8_t *feedback, size_t feedback_len, void *context) |
Feedback callback type (for client).
| typedef enum nros_goal_response_t(* nros_goal_callback_t) (struct nros_action_server_t *server, const struct nros_goal_handle_t *goal, const uint8_t *goal_request, size_t goal_len, void *context) |
Goal request callback type.
Invoked when a client sends a new goal. Return NROS_GOAL_REJECT, NROS_GOAL_ACCEPT_AND_EXECUTE, or NROS_GOAL_ACCEPT_AND_DEFER.
| typedef void(* nros_goal_response_callback_t) (const struct nros_goal_uuid_t *goal_uuid, bool accepted, void *context) |
Goal response callback type (for async client). Called when the action server accepts or rejects a goal.
| typedef void(* nros_guard_condition_callback_t) (void *context) |
Guard condition callback type.
| typedef uint8_t(* nros_lifecycle_callback_t) (void *context) |
C callback type for a lifecycle transition: uint8_t callback(void *context).
The return value is a REP-2002 TransitionResult ([NROS_LIFECYCLE_RET_OK] = 0, [NROS_LIFECYCLE_RET_FAILURE] = 1, [NROS_LIFECYCLE_RET_ERROR] = 2). context is the pointer most recently handed to a nros_lifecycle_register_on_* / nros_executor_lifecycle_register_on_* call — all six slots on one state machine share a single context.
NULL clears the slot.
Issue 0792: this alias is declared HERE rather than reusing nros_node::lifecycle::LifecycleCallbackFnCtx because cbindgen runs with parse_deps = false. A cross-crate Option<LifecycleCallbackFnCtx> in an extern "C" signature is unresolvable to it, so it emitted an OPAQUE struct Option_LifecycleCallbackFnCtx and passed it BY VALUE — a C translation unit could not form the argument, and all twelve *_register_on_* entry points were uncallable from C. A local Option<fn> alias renders as a plain nullable function pointer (the same shape nros_guard_condition_callback_t and nros_timer_callback_t already use, and the same one the C++ shim's nros_cpp_lifecycle_callback_t uses). The ABI is unchanged: a nullable extern "C" fn is one pointer either way.
| typedef bool(* nros_names_and_types_visit_fn) (void *ctx, const char *name, const char *const *types, size_t types_count) |
phase-381 W4 — visit one name and the types on it.
types_count may legitimately be 0 on a partially discovered graph: reporting the name without a type beats dropping it. Strings are BORROWED. Return false to stop.
| typedef bool(* nros_node_visit_fn) (void *ctx, const char *node_name, const char *node_namespace, const char *enclave) |
phase-381 W4 — visit one node on the graph.
node_namespace is a ROS namespace ("/", "/demo"). enclave is NULL where the backend does not track one, which is what lets one call answer both rmw_get_node_names and rmw_get_node_names_with_enclaves.
Every string is BORROWED for the duration of the call — copy anything you keep. Return false to stop the enumeration early.
| typedef bool(* nros_parameter_callback_t) (const char *name, const struct nros_parameter_t *param, void *context) |
Parameter change callback type.
| typedef void(* nros_response_callback_t) (const uint8_t *response, size_t response_len, void *context) |
Service-client response callback type (Phase 82).
Invoked by the executor's spin_some dispatch when a previously-sent request has its response delivered. The CDR bytes are owned by the arena entry's reply buffer for the duration of the call — copy if you need to keep them.
| typedef void(* nros_result_callback_t) (const struct nros_goal_uuid_t *goal_uuid, enum nros_goal_status_t status, const uint8_t *result, size_t result_len, void *context) |
Result callback type (for client).
| typedef int nros_ret_t |
Return type for nros C API functions.
Compatible with rcl_ret_t for familiarity.
| typedef uint8_t nros_sched_class_t |
| typedef uint8_t nros_sched_context_id_t |
Identifier of a registered scheduling context. 0 is the auto-created default Fifo SC. Mirrors nros_node::executor::sched_context::SchedContextId.
| typedef uint8_t nros_sched_priority_t |
| typedef bool(* nros_service_callback_t) (const uint8_t *request_data, size_t request_len, uint8_t *response_data, size_t response_capacity, size_t *response_len, void *context) |
Service server callback function type.
request_data - Pointer to CDR-serialized request datarequest_len - Length of request data in bytesresponse_data - Pointer to buffer for CDR-serialized responseresponse_capacity - Capacity of response bufferresponse_len - Output: actual length of response data writtencontext - User-provided context pointertrue if the request was handled successfullyfalse if there was an error handling the request | typedef uint32_t nros_shutdown_callback_handle_t |
Handle to a registered shutdown hook.
Returned by nros_executor_add_{pre,on}_shutdown_callback and consumed by the matching remove. Opaque: the only operations are "pass it back" and "compare against `NROS_SHUTDOWN_CALLBACK_HANDLE_INVALID`".
| typedef void(* nros_shutdown_callback_t) (void *context) |
| typedef void(* nros_subscription_info_callback_t) (const uint8_t *data, size_t len, const uint8_t *attachment, size_t attachment_len, void *context) |
Subscription callback that also receives the sample's wire attachment (Phase 189.M3.4 — the C analog of the Rust node.subscription(t).generic(..).message_info() builder path). Used by [nros_executor_add_subscription_raw_with_info].
data / len — received CDR bytes.attachment / attachment_len — the sample's wire attachment (attachment_len == 0 ⇒ none). Cross-RMW bridges read the bridge_origin tag from it. Valid only during the call.context — user-provided context pointer. | typedef void(* nros_timer_callback_t) (struct nros_timer_t *timer, void *context) |
Action client state.
Action server state.
Phase 122.3.c.6.d — overall cancel-RPC return code. Distinct from the per-goal nros_cancel_response_t (ACCEPT/REJECT) used by the L2 callback path. These four discriminants mirror nros_core::CancelReturnCode and the action_msgs/srv/CancelGoal wire-CDR return_code field. (Issue 0796 — the Rust type was called CancelResponse until it was split; this pair of C names is what the Rust names now follow.)
| Enumerator | |
|---|---|
| NROS_CANCEL_RC_OK | |
| NROS_CANCEL_RC_REJECTED | |
| NROS_CANCEL_RC_UNKNOWN_GOAL | |
| NROS_CANCEL_RC_GOAL_TERMINATED | |
| enum nros_client_state_t |
Client state
| enum nros_clock_state_t |
| enum nros_clock_type_t |
Clock type enumeration.
Executor data communication semantics
Defines when data is taken from DDS during spin operations.
| enum nros_goal_response_t |
| enum nros_goal_status_t |
Goal status enumeration.
Compatible with action_msgs/msg/GoalStatus values.
| enum nros_node_state_t |
Parameter type enumeration.
| enum nros_qos_history_t |
QoS liveliness policy. Phase 109 — matches DDS LIVELINESS.
| enum nros_sched_class_t |
| enum nros_service_state_t |
Service server state
Subscription state
| enum nros_support_state_t |
| enum nros_timer_state_t |
| nros_ret_t nros_action_abort | ( | struct nros_action_server_t * | server, |
| const struct nros_goal_handle_t * | goal, | ||
| const uint8_t * | result, | ||
| size_t | result_len | ||
| ) |
Mark a goal as aborted with an optional result.
Delegates to ActionServerRawHandle::complete_goal_raw.
| nros_ret_t nros_action_cancel_goal | ( | struct nros_action_client_t * | client, |
| const struct nros_goal_uuid_t * | goal_uuid | ||
| ) |
Request cancellation of a goal.
| nros_ret_t nros_action_canceled | ( | struct nros_action_server_t * | server, |
| const struct nros_goal_handle_t * | goal, | ||
| const uint8_t * | result, | ||
| size_t | result_len | ||
| ) |
Mark a goal as canceled with an optional result.
Delegates to ActionServerRawHandle::complete_goal_raw.
| bool nros_action_client_action_server_is_ready | ( | const struct nros_action_client_t * | client, |
| struct nros_executor_t * | executor | ||
| ) |
Non-blocking snapshot of action-server visibility. Mirrors rclcpp_action::Client::action_server_is_ready. Takes executor for the same reason as [nros_action_client_wait_for_action_server].
| nros_ret_t nros_action_client_fini | ( | struct nros_action_client_t * | client | ) |
Finalize an action client.
| struct nros_action_client_options_t nros_action_client_get_default_options | ( | void | ) |
Get a zero-initialised [nros_action_client_options_t] (sched_context = 0).
| struct nros_action_client_t nros_action_client_get_zero_initialized | ( | void | ) |
Get a zero-initialized action client.
| nros_ret_t nros_action_client_init | ( | struct nros_action_client_t * | client, |
| const struct nros_node_t * | node, | ||
| const char * | action_name, | ||
| const struct nros_action_type_t * | type_info | ||
| ) |
Initialize an action client.
| nros_ret_t nros_action_client_init_polling | ( | struct nros_action_client_t * | client, |
| const struct nros_node_t * | node, | ||
| const struct nros_action_type_t * | type_info, | ||
| const char * | action_name | ||
| ) |
Phase 122.3.c.6.b — initialize an L1 polling-mode action client.
Creates the 4 transport channels (3 service clients + feedback subscriber) immediately and stores the ActionClientCore inline in _opaque. The caller drives the goal lifecycle via:
nros_action_client_send_goal_raw — start a new goal; returns the generated 16-byte UUID.nros_action_client_try_recv_goal_response_raw — poll for the send_goal RPC reply (accepted / rejected).nros_action_client_send_get_result_request_raw + _try_recv_result_raw — fetch the terminal result.nros_action_client_send_cancel_request_raw + _try_recv_cancel_response_raw — cancel a goal.nros_action_client_try_recv_feedback_raw — drain feedback.All pointers must be valid; action_name must be a valid null-terminated string.
| nros_ret_t nros_action_client_init_with_options | ( | struct nros_action_client_t * | client, |
| const struct nros_node_t * | node, | ||
| const char * | action_name, | ||
| const struct nros_action_type_t * | type_info, | ||
| const struct nros_action_client_options_t * | options | ||
| ) |
Phase 189.M3.3.b — initialize an action client with named options. Like [nros_action_client_init] except a non-zero options->sched_context is stashed so [nros_executor_add_action_client] binds the resulting executor handle to that scheduling context once known.
All non-NULL pointers must be valid + the node initialized; options may be NULL.
| nros_ret_t nros_action_client_poll | ( | struct nros_action_client_t * | client | ) |
Poll the action client for pending async replies (non-blocking).
Note: In the unified design (77.6+), nros_executor_spin_some already dispatches action_client_raw_try_process which invokes callbacks. This function is provided for manual polling outside the executor loop.
client must be a valid pointer.
| nros_ret_t nros_action_client_send_cancel_request_raw | ( | struct nros_action_client_t * | client, |
| const uint8_t(*) | goal_id[16] | ||
| ) |
Phase 122.3.c.6.b — L1 polling: send a cancel request.
| nros_ret_t nros_action_client_send_get_result_request_raw | ( | struct nros_action_client_t * | client, |
| const uint8_t(*) | goal_id[16] | ||
| ) |
Phase 122.3.c.6.b — L1 polling: send a get_result request for the given goal. Reply lands via _try_recv_result_raw.
| nros_ret_t nros_action_client_send_goal_raw | ( | struct nros_action_client_t * | client, |
| const uint8_t * | goal_cdr, | ||
| size_t | goal_len, | ||
| uint8_t(*) | goal_id_out[16] | ||
| ) |
Phase 122.3.c.6.b — L1 polling: send a goal. Writes the generated 16-byte UUID into goal_id_out. Poll for the accept/reject reply via nros_action_client_try_recv_goal_response_raw.
| nros_ret_t nros_action_client_set_cancel_response_wake_callback | ( | struct nros_action_client_t * | client, |
| struct nros_wake_state_t * | state, | ||
| void(*)(void *) | cb, | ||
| void * | ctx | ||
| ) |
Phase 122.3.c.6.e — wake on the cancel-reply channel.
| nros_ret_t nros_action_client_set_feedback_callback | ( | struct nros_action_client_t * | client, |
| nros_feedback_callback_t | callback, | ||
| void * | context | ||
| ) |
Set feedback callback.
| nros_ret_t nros_action_client_set_feedback_wake_callback | ( | struct nros_action_client_t * | client, |
| struct nros_wake_state_t * | state, | ||
| void(*)(void *) | cb, | ||
| void * | ctx | ||
| ) |
Phase 122.3.c.6.e — wake on the feedback channel.
| nros_ret_t nros_action_client_set_goal_response_callback | ( | struct nros_action_client_t * | client, |
| nros_goal_response_callback_t | callback, | ||
| void * | context | ||
| ) |
| nros_ret_t nros_action_client_set_goal_response_wake_callback | ( | struct nros_action_client_t * | client, |
| struct nros_wake_state_t * | state, | ||
| void(*)(void *) | cb, | ||
| void * | ctx | ||
| ) |
Phase 122.3.c.6.e — register a C wake callback on the send_goal-reply channel of an L1 polling-mode action client.
| nros_ret_t nros_action_client_set_result_callback | ( | struct nros_action_client_t * | client, |
| nros_result_callback_t | callback, | ||
| void * | context | ||
| ) |
Set result callback.
| nros_ret_t nros_action_client_set_result_wake_callback | ( | struct nros_action_client_t * | client, |
| struct nros_wake_state_t * | state, | ||
| void(*)(void *) | cb, | ||
| void * | ctx | ||
| ) |
Phase 122.3.c.6.e — wake on the get_result-reply channel.
| int32_t nros_action_client_try_recv_cancel_response_raw | ( | struct nros_action_client_t * | client, |
| uint8_t * | buf, | ||
| size_t | buf_len | ||
| ) |
Phase 122.3.c.6.c — L1 polling: try to receive the cancel-RPC reply. Returns 0 when no reply yet, >0 bytes copied into buf, negative on error.
| int32_t nros_action_client_try_recv_feedback_raw | ( | struct nros_action_client_t * | client, |
| uint8_t * | buf, | ||
| size_t | buf_len, | ||
| uint8_t(*) | goal_id_out[16] | ||
| ) |
Phase 122.3.c.6.b — L1 polling: try to receive feedback for any goal. Returns 0 when no feedback yet, >0 bytes copied (with goal_id_out filled), negative on error.
| int32_t nros_action_client_try_recv_goal_response_raw | ( | struct nros_action_client_t * | client, |
| uint8_t * | buf, | ||
| size_t | buf_len | ||
| ) |
Phase 122.3.c.6.b — L1 polling: try to receive a send_goal reply (the accept/reject response). Returns 0 when no reply yet, >0 bytes when one was copied into buf, negative on error.
| int32_t nros_action_client_try_recv_result_raw | ( | struct nros_action_client_t * | client, |
| uint8_t * | buf, | ||
| size_t | buf_len | ||
| ) |
Phase 122.3.c.6.b — L1 polling: try to receive a get_result reply. Returns 0 when no reply yet, >0 bytes copied, negative on error.
| nros_ret_t nros_action_client_wait_for_action_server | ( | struct nros_action_client_t * | client, |
| struct nros_executor_t * | executor, | ||
| uint32_t | timeout_ms | ||
| ) |
Block until the action server's send-goal queryable is discoverable on the network, or timeout_ms elapses.
Mirrors rclcpp_action::Client::wait_for_action_server and the the underlying ActionClient::wait_for_action_server. Internally probes the action's send_goal service-server liveliness keyexpr (the goal queryable is the load-bearing entity for the first nros_action_send_goal call) via the same primitive as the service-client equivalent. See packages/api/nros-c/src/service.rsnros_client_wait_for_service for the re-probe rationale.
NROS_RET_OK — server visible.NROS_RET_TIMEOUT — timeout_ms elapsed without seeing a token.NROS_RET_NOT_INIT — client not registered with an executor.NROS_RET_ERROR — transport-level failure. | nros_ret_t nros_action_execute | ( | struct nros_action_server_t * | server, |
| const struct nros_goal_handle_t * | goal | ||
| ) |
Execute a goal (transition to Executing).
Idempotent: delegates to ActionServerRawHandle::set_goal_status which is a no-op if the goal isn't in the active-goals vector. Returns NROS_RET_OK on success, NROS_RET_NOT_INIT if the server isn't registered.
| nros_ret_t nros_action_get_goal_status | ( | const struct nros_action_server_t * | server, |
| const struct nros_goal_handle_t * | goal, | ||
| enum nros_goal_status_t * | status | ||
| ) |
Look up a goal's current status in the arena by UUID.
Returns NROS_RET_OK and writes the arena-sourced status on success. Returns NROS_RET_NOT_FOUND if the arena has already retired the goal (completed + result delivered, or cancelled + acknowledged).
This is the authoritative successor to the removed goal->status field: lifecycle transitions are driven by ActionServerArenaEntry::active_goals and read back through this function.
| nros_ret_t nros_action_get_result | ( | struct nros_action_client_t * | client, |
| struct nros_executor_t * | executor, | ||
| const struct nros_goal_uuid_t * | goal_uuid, | ||
| enum nros_goal_status_t * | status, | ||
| uint8_t * | result, | ||
| size_t | result_capacity, | ||
| size_t * | result_len | ||
| ) |
Request result of a goal (blocking convenience).
Calls nros_action_get_result_async then spins the executor until the result arrives or timeout. Never calls zpico_get directly.
| nros_ret_t nros_action_get_result_async | ( | struct nros_action_client_t * | client, |
| const struct nros_goal_uuid_t * | goal_uuid | ||
| ) |
| nros_ret_t nros_action_publish_feedback | ( | struct nros_action_server_t * | server, |
| const struct nros_goal_handle_t * | goal, | ||
| const uint8_t * | feedback, | ||
| size_t | feedback_len | ||
| ) |
Publish feedback for an active goal.
Delegates to ActionServerRawHandle::publish_feedback_raw; the arena enforces goal liveness and is the sole source of truth for lifecycle state.
| nros_ret_t nros_action_send_goal | ( | struct nros_action_client_t * | client, |
| struct nros_executor_t * | executor, | ||
| const uint8_t * | goal, | ||
| size_t | goal_len, | ||
| struct nros_goal_uuid_t * | goal_uuid | ||
| ) |
Send a goal request. Send a goal (blocking convenience).
Calls nros_action_send_goal_async then spins the executor until the goal is accepted/rejected or timeout. Never calls zpico_get directly — all I/O is driven by the executor's spin_once.
Like the runtime's Promise::wait, this is syntactic sugar over async + spin.
Three outcomes, three codes — they were two before issue 0868 (see the C++ twin nros_cpp_action_client_send_goal):
NROS_RET_OK — the server ACCEPTED; goal_uuid is filled.NROS_RET_REJECTED — the server RECEIVED the goal and declined it.NROS_RET_TIMEOUT — no goal response within the blocking budget. The server may never have received the goal at all.NROS_RET_ERROR — the goal could not be SENT.NROS_RET_REENTRANT — called from inside a dispatch callback. | nros_ret_t nros_action_send_goal_async | ( | struct nros_action_client_t * | client, |
| const uint8_t * | goal, | ||
| size_t | goal_len, | ||
| struct nros_goal_uuid_t * | goal_uuid | ||
| ) |
Send a goal asynchronously (non-blocking).
Sends the goal request and returns immediately. The goal response (accepted/rejected) arrives via the goal_response_callback registered with nros_action_client_set_goal_response_callback, invoked during nros_executor_spin_some.
The goal_uuid output is filled with the generated goal UUID on success.
All pointers must be valid. goal must point to goal_len bytes of CDR-serialized goal data (with CDR header).
| nros_ret_t nros_action_server_accept_goal_raw | ( | struct nros_action_server_t * | server, |
| const uint8_t(*) | goal_id[16], | ||
| int64_t | sequence_number | ||
| ) |
Phase 122.3.c.6.b — L1 polling: accept a goal received via try_recv_goal_request_raw.
| nros_ret_t nros_action_server_complete_goal_raw | ( | struct nros_action_server_t * | server, |
| const uint8_t(*) | goal_id[16], | ||
| enum nros_goal_status_t | status, | ||
| const uint8_t * | result_cdr, | ||
| size_t | result_len | ||
| ) |
Phase 122.3.c.6.b — L1 polling: mark a goal terminal.
status must be one of SUCCEEDED / ABORTED / CANCELED. result_cdr is the CDR-encoded <Action>_Result_ payload (the core handles the status wrapper before storing in the slab).
| nros_ret_t nros_action_server_fini | ( | struct nros_action_server_t * | server | ) |
Finalize an action server.
| nros_ret_t nros_action_server_get_active_goal_count | ( | struct nros_action_server_t * | server, |
| size_t * | out | ||
| ) |
Get the number of currently active goals.
Phase-379 W6 decision 3: ONE function in rcl's shape, serving both tiers. Upstream ships no count function; its nearest neighbour is rcl_action_server_get_goal_handles(server, ***handles, size_t
*num_goals) -> rcl_ret_t, which reports the count through an out-param and keeps the return code for "did the query work". This replaces the pair nros_action_server_get_active_goal_count(server) -> size_t (answered 0 on every error) and nros_action_server_active_goal_count_raw(server) -> int32_t (negative = error code), each of which collapsed the two channels into one value.
The tier is selected by server->state, and the two tiers read DIFFERENT STORAGE — this was never one field behind two names:
NROS_ACTION_SERVER_STATE_INITIALIZED (L2, callback tier) reads the executor arena through ActionServerRawHandle::active_goal_count.NROS_ACTION_SERVER_STATE_POLLING (L1, polling tier) reads the ActionServerCore living inline in _opaque, with no executor and no arena indirection, behind #[cfg(feature = "rmw-cffi")].Returns:
NROS_RET_OK — *out holds the count, which may legitimately be 0.NROS_RET_INVALID_ARGUMENT — server or out is NULL.NROS_RET_NOT_INIT — the server is UNINITIALIZED or SHUTDOWN; or it is INITIALIZED but was never registered with an executor (or has been finalised); or it is POLLING in a build without rmw-cffi, where the inline core was never constructed.*out is left untouched on every error path, so a caller that ignores the return code reads back its own initialiser rather than a fabricated 0 — which is precisely the ambiguity the old size_t spelling could not escape.
| struct nros_action_server_options_t nros_action_server_get_default_options | ( | void | ) |
Get a zero-initialised [nros_action_server_options_t] (sched_context = 0).
| struct nros_action_server_t nros_action_server_get_zero_initialized | ( | void | ) |
Get a zero-initialized action server.
improper_ctypes_definitions is silenced because the inline opaque handle stores a function-pointer field whose parameter signature references a runtime-internal type. The pointer itself is C-ABI safe; the C API never lets callers invoke through it directly.
| nros_ret_t nros_action_server_init | ( | struct nros_action_server_t * | server, |
| const struct nros_node_t * | node, | ||
| const char * | action_name, | ||
| const struct nros_action_type_t * | type_info, | ||
| nros_goal_callback_t | goal_callback, | ||
| nros_cancel_callback_t | cancel_callback, | ||
| nros_accepted_callback_t | accepted_callback, | ||
| void * | context | ||
| ) |
Initialize an action server.
Stores metadata (name, type, callbacks). RMW entity creation is deferred to nros_executor_add_action_server().
| nros_ret_t nros_action_server_init_polling | ( | struct nros_action_server_t * | server, |
| const struct nros_node_t * | node, | ||
| const struct nros_action_type_t * | type_info, | ||
| const char * | action_name | ||
| ) |
Phase 122.3.c.6.b — initialize an L1 polling-mode action server.
Creates the 5 transport channels immediately and stores the ActionServerCore inline in _opaque. The caller drives the goal lifecycle via:
nros_action_server_try_recv_goal_request_raw — poll for new goal requests (returns goal_id + sequence + payload).nros_action_server_accept_goal_raw / _reject_goal_raw — reply to the send_goal RPC.nros_action_server_publish_feedback_raw — push feedback.nros_action_server_complete_goal_raw — terminate (SUCCEEDED / ABORTED / CANCELED).nros_action_server_try_handle_cancel_raw / _try_handle_get_result_raw — service cancel / get_result RPCs.All pointers must be valid; action_name must be a valid null-terminated string.
| nros_ret_t nros_action_server_init_with_options | ( | struct nros_action_server_t * | server, |
| const struct nros_node_t * | node, | ||
| const char * | action_name, | ||
| const struct nros_action_type_t * | type_info, | ||
| nros_goal_callback_t | goal_callback, | ||
| nros_cancel_callback_t | cancel_callback, | ||
| nros_accepted_callback_t | accepted_callback, | ||
| void * | context, | ||
| const struct nros_qos_t * | qos, | ||
| const struct nros_action_server_options_t * | options | ||
| ) |
Phase 189.M3.3.b — initialize an action server with custom QoS + named options. Like [nros_action_server_init_with_qos] except a non-zero options->sched_context is stashed so [nros_executor_add_action_server] binds the resulting executor handle to that scheduling context once known.
All non-NULL pointers must be valid + the node initialized; qos / options may be NULL.
| nros_ret_t nros_action_server_init_with_qos | ( | struct nros_action_server_t * | server, |
| const struct nros_node_t * | node, | ||
| const char * | action_name, | ||
| const struct nros_action_type_t * | type_info, | ||
| nros_goal_callback_t | goal_callback, | ||
| nros_cancel_callback_t | cancel_callback, | ||
| nros_accepted_callback_t | accepted_callback, | ||
| void * | context, | ||
| const struct nros_qos_t * | qos | ||
| ) |
Phase 193.4b — initialize an action server with an explicit QoS profile (rclc's _with_options). The profile applies to the three underlying service servers (send_goal / cancel_goal / get_result); the feedback + status publishers keep their own profiles. qos NULL ⇒ the services default. Same as [nros_action_server_init] otherwise.
All non-NULL pointers must be valid + the node initialized.
| nros_ret_t nros_action_server_publish_feedback_raw | ( | struct nros_action_server_t * | server, |
| const uint8_t(*) | goal_id[16], | ||
| const uint8_t * | feedback_cdr, | ||
| size_t | feedback_len | ||
| ) |
Phase 122.3.c.6.b — L1 polling: publish a feedback message.
feedback_cdr is the CDR-encoded <Action>_Feedback_ payload (without the goal_id prefix — the core wraps it).
| nros_ret_t nros_action_server_reject_goal_raw | ( | struct nros_action_server_t * | server, |
| int64_t | sequence_number | ||
| ) |
Phase 122.3.c.6.b — L1 polling: reject a goal received via try_recv_goal_request_raw.
| nros_ret_t nros_action_server_send_cancel_reply_raw | ( | struct nros_action_server_t * | server, |
| int64_t | sequence_number, | ||
| enum nros_cancel_return_code_t | return_code, | ||
| const uint8_t(*) | accepted[16], | ||
| size_t | accepted_count | ||
| ) |
Phase 122.3.c.6.d — L1 polling: reply to a cancel-goal request previously peeked via _try_recv_cancel_request_raw. accepted points to accepted_count goal-ID byte arrays that will transition to CANCELING. Pass an empty list (accepted=NULL, accepted_count=0) with return_code=NROS_CANCEL_RC_REJECTED to refuse the request entirely.
| nros_ret_t nros_action_server_set_cancel_wake_callback | ( | struct nros_action_server_t * | server, |
| struct nros_wake_state_t * | state, | ||
| void(*)(void *) | cb, | ||
| void * | ctx | ||
| ) |
Phase 122.3.c.6.e — register a C wake callback on the cancel_goal channel of an L1 polling-mode action server. The primary use case from the .c.6.e design discussion — RTOS / event-driven cancel handling.
| nros_ret_t nros_action_server_set_get_result_wake_callback | ( | struct nros_action_server_t * | server, |
| struct nros_wake_state_t * | state, | ||
| void(*)(void *) | cb, | ||
| void * | ctx | ||
| ) |
Phase 122.3.c.6.e — register a C wake callback on the get_result channel of an L1 polling-mode action server.
| nros_ret_t nros_action_server_set_goal_wake_callback | ( | struct nros_action_server_t * | server, |
| struct nros_wake_state_t * | state, | ||
| void(*)(void *) | cb, | ||
| void * | ctx | ||
| ) |
Phase 122.3.c.6.e — register a C wake callback on the send_goal channel of an L1 polling-mode action server. state is a caller-owned nros_wake_state_t that must outlive the server and not move.
| int32_t nros_action_server_try_handle_get_result_raw | ( | struct nros_action_server_t * | server, |
| const uint8_t * | default_result_cdr, | ||
| size_t | default_result_len | ||
| ) |
Phase 122.3.c.6.b — L1 polling: serve a pending get_result query.
default_result_cdr is the default serialized result (without status byte / CDR header) returned to the client when no complete_goal_raw has been called for the queried goal yet.
Returns 0 when no query is pending; 1 when one was served; negative nros_ret_t on error.
| int32_t nros_action_server_try_recv_cancel_request_raw | ( | struct nros_action_server_t * | server, |
| uint8_t(*) | goal_id_out[16], | ||
| int64_t * | sequence_number_out, | ||
| enum nros_goal_status_t * | current_status_out | ||
| ) |
Phase 122.3.c.6.d — L1 polling: peek a pending cancel-goal request. Writes the named goal_id, the matching service sequence number, and the goal's current status (matches the nros_goal_status_t discriminants — pass it back unchanged).
Returns 1 when a request was peeked, 0 when none pending, negative nros_ret_t on error.
After a successful peek, call nros_action_server_send_cancel_reply_raw with the recorded sequence_number and the list of goals to accept-cancel.
| int32_t nros_action_server_try_recv_goal_request_raw | ( | struct nros_action_server_t * | server, |
| uint8_t * | buf, | ||
| size_t | buf_len, | ||
| uint8_t(*) | goal_id_out[16], | ||
| int64_t * | sequence_number_out | ||
| ) |
Phase 122.3.c.6.b — L1 polling: try to receive a goal request.
On success writes the goal payload bytes (already stripped of CDR framing) into buf, returns the number of bytes copied (>= 0), and fills goal_id_out (16 bytes) + sequence_number_out. Use the sequence number with nros_action_server_accept_goal_raw / _reject_goal_raw.
Returns 0 when no request is pending; negative nros_ret_t on error.
| nros_ret_t nros_action_succeed | ( | struct nros_action_server_t * | server, |
| const struct nros_goal_handle_t * | goal, | ||
| const uint8_t * | result, | ||
| size_t | result_len | ||
| ) |
Mark a goal as succeeded with a result.
Delegates to ActionServerRawHandle::complete_goal_raw; the arena owns the active-goals vector and retires the goal there.
| nros_ret_t nros_action_try_recv_feedback | ( | struct nros_action_client_t * | client | ) |
Try to receive feedback for an active goal (non-blocking).
If feedback is available, invokes the feedback callback (if set). Returns NROS_RET_OK if feedback was received and dispatched, NROS_RET_TIMEOUT if no feedback is available.
| int64_t nros_cdr_begin_dheader | ( | uint8_t ** | ptr, |
| const uint8_t * | end, | ||
| const uint8_t * | origin | ||
| ) |
Begin a DHEADER-delimited struct. Under XCDR2 (iron/jazzy+) reserves a 4-byte DHEADER at the cursor (aligned) and advances it, returning the mark (its byte offset). Under XCDR1 (humble) this is a NO-OP returning -1. The generated C _serialize_inline calls this at the top of every struct and passes the mark to [nros_cdr_end_dheader]. Returns -2 on any bounds/pointer failure.
ptr/end/origin follow the same (cursor, end, origin) contract as the write helpers.
| int64_t nros_cdr_begin_dheader_read | ( | const uint8_t ** | ptr, |
| const uint8_t * | end, | ||
| const uint8_t * | origin | ||
| ) |
Begin reading a DHEADER-delimited struct. Under XCDR2 reads the 4-byte DHEADER at the cursor (advancing it) and returns the struct's END offset; under XCDR1 returns -1 (no-op). Returns -2 on failure. The generated C _deserialize passes the result to [nros_cdr_end_dheader_read].
Same (cursor, end, origin) contract as the read helpers.
| int32_t nros_cdr_end_dheader | ( | int64_t | mark, |
| uint8_t ** | ptr, | ||
| const uint8_t * | end, | ||
| const uint8_t * | origin | ||
| ) |
| int32_t nros_cdr_end_dheader_read | ( | int64_t | scope, |
| const uint8_t ** | ptr, | ||
| const uint8_t * | end, | ||
| const uint8_t * | origin | ||
| ) |
Finish reading a DHEADER-delimited struct: skip any unknown trailing members by advancing the cursor to the struct END (scope from [nros_cdr_begin_dheader_read]). scope < 0 (XCDR1) is a no-op. Returns 0 on success, -1 if the reader over-read past the declared end.
Same buffer contract as the read helpers.
| int32_t nros_cdr_read_bool | ( | const uint8_t ** | ptr, |
| const uint8_t * | end, | ||
| const uint8_t * | origin, | ||
| bool * | value | ||
| ) |
Read a CDR-encoded bool (1 byte) into *value and advance the cursor.
Returns 0 on success, -1 if the cursor would overrun end, the payload is malformed, or any pointer is null.
| int32_t nros_cdr_read_f32 | ( | const uint8_t ** | ptr, |
| const uint8_t * | end, | ||
| const uint8_t * | origin, | ||
| float * | value | ||
| ) |
Read a CDR-encoded IEEE-754 float into *value.
| int32_t nros_cdr_read_f64 | ( | const uint8_t ** | ptr, |
| const uint8_t * | end, | ||
| const uint8_t * | origin, | ||
| double * | value | ||
| ) |
Read a CDR-encoded IEEE-754 double into *value.
| int32_t nros_cdr_read_i16 | ( | const uint8_t ** | ptr, |
| const uint8_t * | end, | ||
| const uint8_t * | origin, | ||
| int16_t * | value | ||
| ) |
Read a CDR-encoded int16_t into *value.
| int32_t nros_cdr_read_i32 | ( | const uint8_t ** | ptr, |
| const uint8_t * | end, | ||
| const uint8_t * | origin, | ||
| int32_t * | value | ||
| ) |
Read a CDR-encoded int32_t into *value.
| int32_t nros_cdr_read_i64 | ( | const uint8_t ** | ptr, |
| const uint8_t * | end, | ||
| const uint8_t * | origin, | ||
| int64_t * | value | ||
| ) |
Read a CDR-encoded int64_t into *value.
| int32_t nros_cdr_read_i8 | ( | const uint8_t ** | ptr, |
| const uint8_t * | end, | ||
| const uint8_t * | origin, | ||
| int8_t * | value | ||
| ) |
Read a CDR-encoded int8_t into *value and advance the cursor.
| int32_t nros_cdr_read_string | ( | const uint8_t ** | ptr, |
| const uint8_t * | end, | ||
| const uint8_t * | origin, | ||
| char * | value, | ||
| size_t | max_len | ||
| ) |
Read a CDR string into a fixed-size C buffer. Fails if the encoded length exceeds max_len. Always null-terminates the output on success.
| int32_t nros_cdr_read_u16 | ( | const uint8_t ** | ptr, |
| const uint8_t * | end, | ||
| const uint8_t * | origin, | ||
| uint16_t * | value | ||
| ) |
Read a CDR-encoded uint16_t (2-byte aligned) into *value.
| int32_t nros_cdr_read_u32 | ( | const uint8_t ** | ptr, |
| const uint8_t * | end, | ||
| const uint8_t * | origin, | ||
| uint32_t * | value | ||
| ) |
Read a CDR-encoded uint32_t (4-byte aligned) into *value.
| int32_t nros_cdr_read_u64 | ( | const uint8_t ** | ptr, |
| const uint8_t * | end, | ||
| const uint8_t * | origin, | ||
| uint64_t * | value | ||
| ) |
Read a CDR-encoded uint64_t (8-byte aligned) into *value.
| int32_t nros_cdr_read_u8 | ( | const uint8_t ** | ptr, |
| const uint8_t * | end, | ||
| const uint8_t * | origin, | ||
| uint8_t * | value | ||
| ) |
Read a CDR-encoded uint8_t into *value and advance the cursor. See [nros_cdr_read_bool] for the buffer contract.
| int32_t nros_cdr_write_bool | ( | uint8_t ** | ptr, |
| const uint8_t * | end, | ||
| const uint8_t * | origin, | ||
| bool | value | ||
| ) |
Write a CDR-encoded bool (1 byte) and advance the cursor.
Returns 0 on success, -1 if the cursor would overrun end or any pointer is null.
| int32_t nros_cdr_write_encaps_header | ( | uint8_t ** | ptr, |
| const uint8_t * | end | ||
| ) |
Write the 4-byte CDR encapsulation header for the active ROS edition and advance the cursor: XCDR1 00 01 00 00 (humble) or XCDR2 DELIMITED_CDR2 00 09 00 00 (iron/jazzy+). Replaces the hardcoded header the generated C _serialize used to emit. Returns 0 on success, -1 on overrun/null.
ptr is a *mut *mut u8 cursor; end bounds the buffer.
| int32_t nros_cdr_write_f32 | ( | uint8_t ** | ptr, |
| const uint8_t * | end, | ||
| const uint8_t * | origin, | ||
| float | value | ||
| ) |
Write a CDR-encoded IEEE-754 float (4-byte aligned) and advance the cursor.
| int32_t nros_cdr_write_f64 | ( | uint8_t ** | ptr, |
| const uint8_t * | end, | ||
| const uint8_t * | origin, | ||
| double | value | ||
| ) |
Write a CDR-encoded IEEE-754 double (8-byte aligned) and advance the cursor.
| int32_t nros_cdr_write_i16 | ( | uint8_t ** | ptr, |
| const uint8_t * | end, | ||
| const uint8_t * | origin, | ||
| int16_t | value | ||
| ) |
Write a CDR-encoded int16_t and advance the cursor.
| int32_t nros_cdr_write_i32 | ( | uint8_t ** | ptr, |
| const uint8_t * | end, | ||
| const uint8_t * | origin, | ||
| int32_t | value | ||
| ) |
Write a CDR-encoded int32_t and advance the cursor.
| int32_t nros_cdr_write_i64 | ( | uint8_t ** | ptr, |
| const uint8_t * | end, | ||
| const uint8_t * | origin, | ||
| int64_t | value | ||
| ) |
Write a CDR-encoded int64_t and advance the cursor.
| int32_t nros_cdr_write_i8 | ( | uint8_t ** | ptr, |
| const uint8_t * | end, | ||
| const uint8_t * | origin, | ||
| int8_t | value | ||
| ) |
Write a CDR-encoded int8_t and advance the cursor.
| int32_t nros_cdr_write_string | ( | uint8_t ** | ptr, |
| const uint8_t * | end, | ||
| const uint8_t * | origin, | ||
| const char * | value | ||
| ) |
Write a null-terminated string (CDR: u32 length inc. null + bytes + null).
| int32_t nros_cdr_write_string_n | ( | uint8_t ** | ptr, |
| const uint8_t * | end, | ||
| const uint8_t * | origin, | ||
| const char * | data, | ||
| size_t | data_len | ||
| ) |
Write a ptr+len string (CDR: u32 length inc. null + bytes + null).
| int32_t nros_cdr_write_u16 | ( | uint8_t ** | ptr, |
| const uint8_t * | end, | ||
| const uint8_t * | origin, | ||
| uint16_t | value | ||
| ) |
Write a CDR-encoded uint16_t (2 bytes, little-endian, 2-byte aligned) and advance the cursor.
| int32_t nros_cdr_write_u32 | ( | uint8_t ** | ptr, |
| const uint8_t * | end, | ||
| const uint8_t * | origin, | ||
| uint32_t | value | ||
| ) |
Write a CDR-encoded uint32_t (4 bytes, little-endian, 4-byte aligned) and advance the cursor.
| int32_t nros_cdr_write_u64 | ( | uint8_t ** | ptr, |
| const uint8_t * | end, | ||
| const uint8_t * | origin, | ||
| uint64_t | value | ||
| ) |
Write a CDR-encoded uint64_t (8 bytes, little-endian, 8-byte aligned) and advance the cursor.
| int32_t nros_cdr_write_u8 | ( | uint8_t ** | ptr, |
| const uint8_t * | end, | ||
| const uint8_t * | origin, | ||
| uint8_t | value | ||
| ) |
Write a CDR-encoded uint8_t and advance the cursor. See [nros_cdr_write_bool] for the buffer contract.
| nros_ret_t nros_clear_custom_transport | ( | void | ) |
Phase 115.C — clear any previously-registered custom transport. Equivalent to nros_set_custom_transport(NULL). Convenience for teardown paths.
| nros_ret_t nros_client_call | ( | struct nros_client_t * | client, |
| const uint8_t * | request_data, | ||
| size_t | request_len, | ||
| uint8_t * | response_data, | ||
| size_t | response_capacity, | ||
| size_t * | response_len | ||
| ) |
Call a service (blocking convenience over the async pair).
Phase 82: signature unchanged, but no longer blocks at the transport layer. Internally calls nros_client_send_request_async and spins the registered executor via nros_executor_spin_some until the response arrives or the client's timeout_ms elapses. The client must have been registered with nros_executor_add_client.
client - Pointer to a registered clientrequest_data - CDR-serialized request datarequest_len - Length of request dataresponse_data - Buffer to receive CDR-serialized responseresponse_capacity - Capacity of response bufferresponse_len - Output: actual length of response dataNROS_RET_OK on successNROS_RET_INVALID_ARGUMENT if any pointer is NULLNROS_RET_NOT_INIT if the client isn't registered with an executorNROS_RET_TIMEOUT if no response within timeout_msNROS_RET_ERROR on call failure | nros_ret_t nros_client_fini | ( | struct nros_client_t * | client | ) |
Finalize a service client.
Phase 82: the underlying transport handle lives in the executor's arena and is dropped automatically when the executor is finalised. This function only resets the C-side metadata + internal blob.
client - Pointer to an initialized clientNROS_RET_OK on successNROS_RET_INVALID_ARGUMENT if client is NULLNROS_RET_NOT_INIT if not initialized | struct nros_client_options_t nros_client_get_default_options | ( | void | ) |
Get a zero-initialised [nros_client_options_t] (sched_context = 0).
| const char * nros_client_get_service_name | ( | const struct nros_client_t * | client | ) |
| struct nros_client_t nros_client_get_zero_initialized | ( | void | ) |
Get a zero-initialized client.
| nros_ret_t nros_client_init | ( | struct nros_client_t * | client, |
| const struct nros_node_t * | node, | ||
| const struct nros_service_type_t * | type_info, | ||
| const char * | service_name | ||
| ) |
Initialize a service client (Phase 82: metadata-only).
Stores the service name/type metadata and a ServiceClientInternal blob; the actual transport handle (RmwServiceClient) is created later by nros_executor_add_client. This deferred lifecycle matches nros_service_init (server side) and the action client.
client - Pointer to a zero-initialized clientnode - Pointer to an initialized nodetype_info - Pointer to service type informationservice_name - Service name (null-terminated string)NROS_RET_OK on successNROS_RET_INVALID_ARGUMENT if any required pointer is NULLNROS_RET_NOT_INIT if node is not initialized | nros_ret_t nros_client_init_polling | ( | struct nros_client_t * | client, |
| const struct nros_node_t * | node, | ||
| const struct nros_service_type_t * | type_info, | ||
| const char * | service_name | ||
| ) |
Phase 122.3.c.5 — initialize an L1 polling-mode service client.
Creates the underlying RMW client immediately and stores it inline in the client's _opaque field. The caller drives the request/reply cycle via nros_client_send_request_raw + nros_client_take_response_raw.
client - Pointer to a zero-initialized clientnode - Pointer to an initialized nodetype_info - Pointer to service type informationservice_name - Service name (null-terminated)NROS_RET_OK on successNROS_RET_INVALID_ARGUMENT if any pointer is NULL or name emptyNROS_RET_NOT_INIT if node / support not initializedNROS_RET_ERROR if client creation failedAll pointers must be valid; service_name must be a valid null-terminated string.
| nros_ret_t nros_client_init_with_options | ( | struct nros_client_t * | client, |
| const struct nros_node_t * | node, | ||
| const struct nros_service_type_t * | type_info, | ||
| const char * | service_name, | ||
| const struct nros_qos_t * | qos, | ||
| const struct nros_client_options_t * | options | ||
| ) |
Phase 189.M3.3.a — initialize a service client with custom QoS + named options. Like [nros_client_init_with_qos] except a non-zero options->sched_context is stashed so [nros_executor_register_client] binds the resulting executor handle to that scheduling context once known.
All non-NULL pointers must be valid + the node initialized; qos / options may be NULL.
| nros_ret_t nros_client_init_with_qos | ( | struct nros_client_t * | client, |
| const struct nros_node_t * | node, | ||
| const struct nros_service_type_t * | type_info, | ||
| const char * | service_name, | ||
| const struct nros_qos_t * | qos | ||
| ) |
| bool nros_client_is_valid | ( | const struct nros_client_t * | client | ) |
| nros_ret_t nros_client_send_request_async | ( | struct nros_client_t * | client, |
| const uint8_t * | request_data, | ||
| size_t | request_len | ||
| ) |
Send a service request asynchronously (Phase 82).
Non-blocking. The reply is delivered via the registered response_callback during nros_executor_spin_some. The user must have previously registered the client with nros_executor_add_client.
NROS_RET_OK on successNROS_RET_NOT_INIT if the client is not registered with an executorNROS_RET_BAD_SEQUENCE if a previous request is still pendingNROS_RET_ERROR on transport failure | nros_ret_t nros_client_send_request_raw | ( | struct nros_client_t * | client, |
| const uint8_t * | data, | ||
| size_t | len | ||
| ) |
| nros_ret_t nros_client_server_available | ( | struct nros_client_t * | client, |
| int32_t * | out | ||
| ) |
Phase 124.C.3 — synchronous, graph-aware "is the matching server up?" probe. Unlike [nros_client_wait_for_service] this never spins the executor: it asks the active RMW backend whether at least one matching server has been observed on the RMW graph and returns immediately.
out receives 1 if a server is visible, 0 if none is yet, -1 if the backend cannot answer (e.g. XRCE without participant enumeration). Callers that want the same answer rounded to a hard yes/no should treat -1 as "unknown — assume yes" or use [nros_client_wait_for_service] instead.
NROS_RET_OK — *out was written (0, 1, or -1).NROS_RET_INVALID_ARGUMENT — client or out is null.NROS_RET_NOT_INIT — client not registered with an executor.NROS_RET_ERROR — transport-level failure. | bool nros_client_service_is_ready | ( | const struct nros_client_t * | client | ) |
Non-blocking snapshot of whether a matching service server is currently visible. Mirrors rclcpp::ClientBase::service_is_ready and rcl's rcl_service_server_is_available. Returns false when the client isn't registered with an executor or the backend lacks liveliness discovery (in which case use nros_client_wait_for_service instead, which handles those cases conservatively).
| nros_ret_t nros_client_set_response_callback | ( | struct nros_client_t * | client, |
| nros_response_callback_t | callback, | ||
| void * | context | ||
| ) |
Set the response callback fired by nros_executor_spin_some when an async request has its reply delivered.
| nros_ret_t nros_client_set_timeout | ( | struct nros_client_t * | client, |
| uint32_t | timeout_ms | ||
| ) |
Set the default timeout used by nros_client_call.
| nros_ret_t nros_client_set_wake_callback | ( | struct nros_client_t * | client, |
| struct nros_wake_state_t * | state, | ||
| void(*)(void *) | cb, | ||
| void * | ctx | ||
| ) |
Phase 122.3.c.6.e — register a C wake callback on an L1 polling-mode service client. Wakes when a reply lands. See nros_service_set_wake_callback for the lifetime contract.
| nros_ret_t nros_client_take_response | ( | struct nros_client_t * | client, |
| uint8_t * | response_data, | ||
| size_t | response_capacity, | ||
| size_t * | response_len | ||
| ) |
| int32_t nros_client_take_response_raw | ( | struct nros_client_t * | client, |
| uint8_t * | buf, | ||
| size_t | buf_len | ||
| ) |
Phase 122.3.c.5 — non-blocking poll for a reply on an L1 polling-mode client. Writes reply bytes into the caller's buf.
>= 0 — number of bytes written to buf (0 = no reply yet)NROS_RET_INVALID_ARGUMENT if pointers / state wrongNROS_RET_ERROR on transport failureclient must be in POLLING state. buf writable for buf_len bytes.
| nros_ret_t nros_client_wait_for_service | ( | struct nros_client_t * | client, |
| uint32_t | timeout_ms | ||
| ) |
Block until a matching service server is discoverable, or timeout_ms elapses. Mirrors rclcpp::ClientBase::wait_for_service and the the underlying Client::wait_for_service.
The client must already have been registered with the executor via nros_executor_add_client. Internally fires liveliness queries against the matching service-server's wildcard liveliness keyexpr and spins the executor cooperatively while the probe is in flight. 1-second per-probe timeout, looped until either a token reply lands or the outer wall-clock budget expires — see the runtime API for the rationale (a single liveliness_get samples the router's current token list and terminates, so a server that comes up after we start waiting needs to be re-probed).
NROS_RET_OK — server is visible (proceed with nros_client_call).NROS_RET_TIMEOUT — timeout_ms elapsed without seeing a token.NROS_RET_NOT_INIT — client not registered with an executor.NROS_RET_ERROR — transport-level failure. | nros_ret_t nros_clock_fini | ( | struct nros_clock_t * | clock | ) |
Finalize a clock.
| nros_ret_t nros_clock_get_now | ( | const struct nros_clock_t * | clock, |
| struct nros_time_t * | time_out | ||
| ) |
Get the current time from a clock.
| nros_ret_t nros_clock_get_now_ns | ( | const struct nros_clock_t * | clock, |
| int64_t * | nanoseconds | ||
| ) |
Get the current time from a clock as nanoseconds.
| enum nros_clock_type_t nros_clock_get_type | ( | const struct nros_clock_t * | clock | ) |
Get the clock type.
| struct nros_clock_t nros_clock_get_zero_initialized | ( | void | ) |
Get a zero-initialized clock.
| nros_ret_t nros_clock_init | ( | struct nros_clock_t * | clock, |
| enum nros_clock_type_t | clock_type | ||
| ) |
Initialize a clock.
| bool nros_clock_is_valid | ( | const struct nros_clock_t * | clock | ) |
Check if a clock is valid.
| bool nros_clock_time_started | ( | const struct nros_clock_t * | clock | ) |
Whether the clock has produced a time yet.
Mirrors rcl_clock_time_started, including its implementation: read the clock and report whether the value is non-zero. For a ROS-time clock that is the "enabled, but no `/clock` sample has arrived" state — the one nros_enable_ros_time_override leaves behind — and for a system or steady clock it is true as soon as the clock is valid.
| nros_ret_t nros_disable_ros_time_override | ( | const struct nros_clock_t * | clock | ) |
Disable the ROS time override; the clock reads the system clock again.
Mirrors rcl_disable_ros_time_override, and nros_core::Clock:: clear_ros_time_override underneath. The stored time does not survive: with one piece of state there is nowhere for an inert value to live, so re-enabling starts from 0 again.
| struct nros_duration_t nros_duration_from_nanoseconds | ( | int64_t | nanoseconds | ) |
Convert nanoseconds to a nros_duration_t structure.
The duration half of nros_time_from_nanoseconds, and the same encoding — builtin_interfaces/msg/Duration has the identical {sec, nanosec} shape and the identical [0, 1e9) rule on nanosec. Issue 0799: a negative span is ordinary ("how far ahead of the deadline are we" is negative half the time), and until this existed the C++ Duration::to_msg open-coded the split rather than delegate to a _time_ entry point that got negatives wrong.
| nros_ret_t nros_enable_ros_time_override | ( | const struct nros_clock_t * | clock | ) |
Enable the ROS time override on a NROS_CLOCK_ROS_TIME clock.
Mirrors rcl_enable_ros_time_override. If no override is active yet the clock starts at time 0 — the state rcl reports as "not started" (nros_clock_time_started), i.e. enabled but waiting for the first /clock sample. An already-active override keeps its value.
| nros_ret_t nros_executor_add_action_client | ( | struct nros_executor_t * | executor, |
| struct nros_action_client_t * | client | ||
| ) |
Register an action client with the executor for async (non-blocking) operation.
After registration, nros_executor_spin_some polls the action client's pending requests (goal response, feedback, result) and invokes the registered callbacks.
The action client must already be initialized via nros_action_client_init. Callbacks should be set via nros_action_client_set_goal_response_callback, nros_action_client_set_feedback_callback, and nros_action_client_set_result_callback before or after this call.
executor and client must be valid pointers to initialized structs. | nros_ret_t nros_executor_add_action_server | ( | struct nros_executor_t * | executor, |
| struct nros_action_server_t * | server | ||
| ) |
| nros_ret_t nros_executor_add_client | ( | struct nros_executor_t * | executor, |
| struct nros_client_t * | client | ||
| ) |
Add a service client to the executor (Phase 82).
Creates the underlying RmwServiceClient inside the executor's arena and stashes the executor pointer + arena entry index into the client's _internal blob so subsequent calls to nros_client_call, nros_client_send_request_async, and friends can drive the executor without taking it as an explicit argument.
Must be called exactly once after nros_client_init and before any send/call. Calling it twice on the same client returns NROS_RET_BAD_SEQUENCE.
| nros_ret_t nros_executor_add_guard_condition | ( | struct nros_executor_t * | executor, |
| struct nros_guard_condition_t * | guard | ||
| ) |
| nros_ret_t nros_executor_add_on_shutdown_callback | ( | struct nros_executor_t * | executor, |
| nros_shutdown_callback_t | callback, | ||
| void * | context, | ||
| nros_shutdown_callback_handle_t * | out_handle | ||
| ) |
Register a callback to run AFTER the executor's session is closed.
Issue 0790 — rclcpp's add_on_shutdown_callback / rclcpp::on_shutdown. The entities are gone by the time it runs, so anything that needs the wire belongs in [nros_executor_add_pre_shutdown_callback] instead.
Same contract as [nros_executor_add_pre_shutdown_callback].
| nros_ret_t nros_executor_add_pre_shutdown_callback | ( | struct nros_executor_t * | executor, |
| nros_shutdown_callback_t | callback, | ||
| void * | context, | ||
| nros_shutdown_callback_handle_t * | out_handle | ||
| ) |
Register a callback to run BEFORE the executor's session is closed.
Issue 0790. This is the phase with no workaround: the callback runs while every entity still works, so a node can publish a final state, answer a last request, park an actuator or release a bus. After teardown it cannot.
On success writes the handle through out_handle and returns NROS_RET_OK. Returns NROS_RET_FULL when the phase's fixed table is exhausted (build-time NROS_EXECUTOR_MAX_SHUTDOWN_CBS, default 2).
The hooks run when the executor is finalized — nros_executor_fini(), or whatever tears the executor down. They are a CLEAN-STOP facility: a watchdog reset, a hard fault or an abort does not come through here.
executor must be a valid pointer to an initialized executor.out_handle must be a valid pointer.callback must be safe to invoke once with context, and context must stay valid until the hook runs or is removed. | nros_ret_t nros_executor_add_service | ( | struct nros_executor_t * | executor, |
| struct nros_service_t * | service | ||
| ) |
| nros_ret_t nros_executor_add_subscription | ( | struct nros_executor_t * | executor, |
| struct nros_subscription_t * | subscription, | ||
| enum nros_executor_handle_invocation_t | invocation | ||
| ) |
| nros_ret_t nros_executor_add_subscription_in_group | ( | struct nros_executor_t * | executor, |
| struct nros_subscription_t * | subscription, | ||
| enum nros_executor_handle_invocation_t | invocation, | ||
| const char * | callback_group | ||
| ) |
Phase 273 (RFC-0047) — register a subscription in a named callback group.
Identical to nros_executor_add_subscription but additionally passes the group name to the executor so the seeded group_sched_table can bind the callback to the group's SchedContext. callback_group may be NULL or an empty string — both behave identically to nros_executor_add_subscription.
All non-NULL pointers must be valid and point to initialized objects.
| nros_ret_t nros_executor_add_subscription_raw_with_info | ( | struct nros_executor_t * | executor, |
| const struct nros_node_t * | node, | ||
| const char * | topic_name, | ||
| const char * | type_name, | ||
| const char * | type_hash, | ||
| const struct nros_qos_t * | qos, | ||
| nros_subscription_info_callback_t | callback, | ||
| void * | context | ||
| ) |
Phase 189.M3.4 — register a raw subscription whose callback also receives the sample's wire attachment (the C analog of the Rust node.subscription(t).generic(..).message_info() builder; rclc's generic-with-info subscription). Direct-arg form (no nros_subscription_t struct): the callback signature differs from the plain [nros_subscription_callback_t], so this is its own entry point rather than a flag on nros_executor_add_subscription.
node may be NULL (legacy single-Node path) or a Node created via nros_executor_node_init (routes to that Node's session). qos may be NULL (defaults). Cross-RMW bridges read the bridge_origin tag from the attachment for echo suppression.
All non-NULL pointers must be valid; the C strings must be NUL-terminated UTF-8 valid for the duration of the call.
| nros_ret_t nros_executor_add_time_triggered_dispatcher | ( | struct nros_executor_t * | executor, |
| uint32_t | major_frame_us | ||
| ) |
| nros_ret_t nros_executor_add_timer | ( | struct nros_executor_t * | executor, |
| struct nros_timer_t * | timer | ||
| ) |
| nros_ret_t nros_executor_add_timer_in_group | ( | struct nros_executor_t * | executor, |
| struct nros_timer_t * | timer, | ||
| const char * | callback_group | ||
| ) |
Phase 273 (RFC-0047) — register a timer in a named callback group.
Identical to nros_executor_add_timer but additionally passes the group name so the seeded group_sched_table can bind the callback to the group's SchedContext. callback_group may be NULL or empty — both behave identically to nros_executor_add_timer.
All non-NULL pointers must be valid and point to initialized objects.
| nros_ret_t nros_executor_bind_handle_to_sched_context | ( | struct nros_executor_t * | executor, |
| size_t | handle, | ||
| nros_sched_context_id_t | sc_id | ||
| ) |
Bind a registered callback to a scheduling context. The next spin_once cycle dispatches that callback through the SC's queue (FIFO bitmap or EDF heap, in the SC's priority bucket). Phase 110.B.
handle is the index returned by the corresponding nros_executor_add_* call. sc_id must be a value previously returned from [nros_executor_create_sched_context] (or 0 for the auto-created default Fifo SC).
Returns NROS_RET_INVALID_ARGUMENT for an out-of-range handle, an empty entry slot, or an unknown sc_id.
executor must be a valid pointer to an initialized executor.
| nros_ret_t nros_executor_count_publishers | ( | struct nros_executor_t * | executor, |
| const char * | topic_name, | ||
| size_t * | out_count | ||
| ) |
phase-381 W4 — how many publishers are visible on topic_name.
topic_name is a ROS name ("/chatter"). The count reflects what has been DISCOVERED, so it can be low right after startup and is never a proof of absence.
executor must point to an initialised executor.topic_name must be a valid NUL-terminated string.out_count must be writable. | nros_ret_t nros_executor_count_subscribers | ( | struct nros_executor_t * | executor, |
| const char * | topic_name, | ||
| size_t * | out_count | ||
| ) |
| nros_ret_t nros_executor_create_sched_context | ( | struct nros_executor_t * | executor, |
| const struct nros_sched_context_t * | cfg, | ||
| nros_sched_context_id_t * | out_sc_id | ||
| ) |
Register a new scheduling context with the executor. Phase 110.B.
On success writes the new SchedContextId through out_sc_id and returns NROS_RET_OK. Returns NROS_RET_FULL when no slot is available (build-time NROS_EXECUTOR_MAX_SC exhausted).
All pointers must be valid and the executor initialized.
| nros_ret_t nros_executor_declare_param_string | ( | struct nros_executor_t * | executor, |
| const char * | name, | ||
| const char * | value | ||
| ) |
Declare a string parameter on the executor's server.
| nros_sched_context_id_t nros_executor_default_sched_context_id | ( | void | ) |
Identifier of the auto-created default Fifo-class SC. Every callback registered without an explicit binding maps to it. Phase 110.B.
| nros_ret_t nros_executor_fini | ( | struct nros_executor_t * | executor | ) |
| nros_ret_t nros_executor_get_client_names_and_types_by_node | ( | struct nros_executor_t * | executor, |
| const char * | node_name, | ||
| const char * | node_namespace, | ||
| nros_names_and_types_visit_fn | visit, | ||
| void * | ctx | ||
| ) |
| int nros_executor_get_handle_count | ( | const struct nros_executor_t * | executor | ) |
Get the number of handles in the executor.
| nros_ret_t nros_executor_get_node_names | ( | struct nros_executor_t * | executor, |
| nros_node_visit_fn | visit, | ||
| void * | ctx | ||
| ) |
phase-381 W4 — every node on the graph, with its namespace.
A VISITOR rather than an out-array: upstream's rcutils_string_array_t allocates two levels deep, there is no allocator here, and a caller-provided buffer needs a bound the caller cannot know. Peak extra memory is one entry, and a caller with its own limit stops by returning false.
Reports what has been DISCOVERED; never blocks. The first call after startup legitimately sees a partial graph — the backend keeps a standing query fed by the spin loop. Poll rather than calling once and concluding: an empty enumeration means "nobody seen yet", never "nobody exists".
NROS_RET_OK — enumeration ran (possibly visiting nothing).NROS_RET_UNSUPPORTED — this backend has no graph. DISTINCT from an empty graph, deliberately.NROS_RET_NOT_INIT — executor not initialised.NROS_RET_INVALID_ARGUMENT — executor or visit is NULL.executor must point to an initialised executor.visit must be callable for the duration of the call. | nros_ret_t nros_executor_get_param_string | ( | struct nros_executor_t * | executor, |
| const char * | name, | ||
| char * | out_value, | ||
| size_t | max_len | ||
| ) |
Get a string parameter from the executor's server into a fixed buffer.
| nros_ret_t nros_executor_get_publisher_names_and_types_by_node | ( | struct nros_executor_t * | executor, |
| const char * | node_name, | ||
| const char * | node_namespace, | ||
| nros_names_and_types_visit_fn | visit, | ||
| void * | ctx | ||
| ) |
| nros_ret_t nros_executor_get_publishers_info_by_topic | ( | struct nros_executor_t * | executor, |
| const char * | topic_name, | ||
| nros_endpoint_info_visit_fn | visit, | ||
| void * | ctx | ||
| ) |
| int nros_executor_get_remaining_handles | ( | const struct nros_executor_t * | executor | ) |
Get remaining total handle capacity.
| nros_ret_t nros_executor_get_service_names_and_types | ( | struct nros_executor_t * | executor, |
| nros_names_and_types_visit_fn | visit, | ||
| void * | ctx | ||
| ) |
| nros_ret_t nros_executor_get_service_names_and_types_by_node | ( | struct nros_executor_t * | executor, |
| const char * | node_name, | ||
| const char * | node_namespace, | ||
| nros_names_and_types_visit_fn | visit, | ||
| void * | ctx | ||
| ) |
| nros_ret_t nros_executor_get_subscriber_names_and_types_by_node | ( | struct nros_executor_t * | executor, |
| const char * | node_name, | ||
| const char * | node_namespace, | ||
| nros_names_and_types_visit_fn | visit, | ||
| void * | ctx | ||
| ) |
phase-381 W4 — what one named node SUBSCRIBES to, with the types.
**subscriber, not subscription** — rcl spells it rcl_get_subscriber_names_and_types_by_node, and the C surface takes its vocabulary from rcl so a user porting C ROS 2 code types what they already know. The C++ and Rust surfaces say subscription because rclcpp and rclrs do. Three layers, three upstreams, one word each — not drift. Issue 0788 owns the wider verb sweep.
executor must point to an initialised executor.node_name / node_namespace must be valid NUL-terminated strings.visit must be callable for the duration of the call. | nros_ret_t nros_executor_get_subscriptions_info_by_topic | ( | struct nros_executor_t * | executor, |
| const char * | topic_name, | ||
| nros_endpoint_info_visit_fn | visit, | ||
| void * | ctx | ||
| ) |
| nros_ret_t nros_executor_get_topic_names_and_types | ( | struct nros_executor_t * | executor, |
| nros_names_and_types_visit_fn | visit, | ||
| void * | ctx | ||
| ) |
phase-381 W4 — every topic on the graph, with the types on it.
Called once per distinct TOPIC: a topic carrying two types is one call with two entries, not two calls. types_count may legitimately be 0 on a partially discovered graph — reporting the name without a type beats dropping it.
Same discovery caveat as nros_executor_get_node_names: an empty enumeration means "nobody seen yet", not "nobody exists".
NROS_RET_OK — enumeration ran (possibly visiting nothing).NROS_RET_UNSUPPORTED — this backend has no graph.NROS_RET_NOT_INIT — executor not initialised.NROS_RET_INVALID_ARGUMENT — executor or visit is NULL.executor must point to an initialised executor.visit must be callable for the duration of the call. | struct nros_executor_t nros_executor_get_zero_initialized | ( | void | ) |
Get a zero-initialized executor.
| bool nros_executor_has_param | ( | struct nros_executor_t * | executor, |
| const char * | name | ||
| ) |
Check if a parameter exists on the executor's server.
| nros_ret_t nros_executor_init | ( | struct nros_executor_t * | executor, |
| const struct nros_support_t * | support, | ||
| size_t | max_handles | ||
| ) |
Initialize an executor.
executor - Pointer to a zero-initialized executorsupport - Pointer to an initialized support contextmax_handles - Maximum number of handles (capped at NROS_EXECUTOR_MAX_HANDLES)NROS_RET_OK on successNROS_RET_INVALID_ARGUMENT if any pointer is NULL or max_handles is 0NROS_RET_NOT_INIT if support is not initialized| bool nros_executor_is_valid | ( | const struct nros_executor_t * | executor | ) |
Check if executor is valid (initialized).
| nros_ret_t nros_executor_lifecycle_change_state | ( | struct nros_executor_t * | executor, |
| uint8_t | transition_id | ||
| ) |
| uint8_t nros_executor_lifecycle_get_current_state | ( | struct nros_executor_t * | executor | ) |
Get the current lifecycle state of the executor's state machine.
Returns NROS_LIFECYCLE_STATE_UNCONFIGURED if services are not registered yet.
Takes *mut rather than *const because get_executor returns &mut CExecutor — reading the state is logically read-only but the executor accessor shares storage with the services loop that needs &mut during spin.
| nros_ret_t nros_executor_lifecycle_register_on_activate | ( | struct nros_executor_t * | executor, |
| nros_lifecycle_callback_t | cb, | ||
| void * | context | ||
| ) |
Register the on-activate callback on the executor's state machine.
| nros_ret_t nros_executor_lifecycle_register_on_cleanup | ( | struct nros_executor_t * | executor, |
| nros_lifecycle_callback_t | cb, | ||
| void * | context | ||
| ) |
Register the on-cleanup callback on the executor's state machine.
| nros_ret_t nros_executor_lifecycle_register_on_configure | ( | struct nros_executor_t * | executor, |
| nros_lifecycle_callback_t | cb, | ||
| void * | context | ||
| ) |
Register the on-configure callback on the executor's state machine.
| nros_ret_t nros_executor_lifecycle_register_on_deactivate | ( | struct nros_executor_t * | executor, |
| nros_lifecycle_callback_t | cb, | ||
| void * | context | ||
| ) |
Register the on-deactivate callback on the executor's state machine.
| nros_ret_t nros_executor_lifecycle_register_on_error | ( | struct nros_executor_t * | executor, |
| nros_lifecycle_callback_t | cb, | ||
| void * | context | ||
| ) |
Register the on-error callback on the executor's state machine.
| nros_ret_t nros_executor_lifecycle_register_on_shutdown | ( | struct nros_executor_t * | executor, |
| nros_lifecycle_callback_t | cb, | ||
| void * | context | ||
| ) |
Register the on-shutdown callback on the executor's state machine.
| nros_ret_t nros_executor_node_init | ( | struct nros_executor_t * | executor, |
| struct nros_node_t * | node, | ||
| const char * | name, | ||
| const struct nros_node_options_t * | options | ||
| ) |
Phase 104.C.8.b — initialize a Node via the executor's [node_builder](nros_node::Executor::node_builder) chain.
Thin wrapper over Rust's executor.node_builder(name).rmw(...).locator(...).domain_id(...). namespace(...).sched(...).build(). Materialises a Node inside the executor's node table and stores the returned NodeId in node.node_id so subsequent [nros_executor_add_subscription] / _service / _client / _action_* calls route through register_*_on(NodeId, ...) instead of the legacy single-Node path.
Replaces the pre-104.C ordering of support_init → node_init → executor_init with the rclcpp-aligned support_init → executor_init → executor_node_init. The old nros_node_init / nros_node_init_ex entry points are preserved for source compatibility — they still drive the single-Node legacy path and leave node.node_id = 0.
executor — Pointer to an initialised executor.node — Pointer to a zero-initialised node. Populated on success.name — Node name (null-terminated). Must not be NULL.options — Pointer to populated nros_node_options_t. NULL = default options (no rmw override, inherits executor's locatorNROS_RET_OK on success.NROS_RET_INVALID_ARGUMENT on NULL pointers / bad strings.NROS_RET_BAD_SEQUENCE if node is already initialised.NROS_RET_NOT_INIT if executor isn't initialised.NROS_RET_ERROR if the executor's node table is full (NROS_EXECUTOR_MAX_NODES) or the backend session open failed.All pointer arguments must satisfy their per-parameter rules. options length fields must not overrun their buffers.
| nros_ret_t nros_executor_ping | ( | struct nros_executor_t * | executor, |
| int32_t | timeout_ms | ||
| ) |
Phase 124.F.3 — session-level connectivity probe.
Sends a wire-level round-trip ("is the peer / agent / router
reachable?") and waits up to timeout_ms. Mirrors micro-ROS's rmw_uros_ping_agent. Useful for reconnect-on-link-loss patterns: bare-metal code calls ping(100) periodically and tears down / re-opens the session on timeout.
NROS_RET_OK — peer responded within budget.NROS_RET_TIMEOUT — no reply before timeout_ms.NROS_RET_UNSUPPORTED — active backend can't probe.NROS_RET_NOT_INIT — executor not initialised.NROS_RET_INVALID_ARGUMENT — executor is NULL.executor must be a valid pointer to an initialized executor. | nros_ret_t nros_executor_register_lifecycle_services | ( | struct nros_executor_t * | executor | ) |
Register the five REP-2002 lifecycle services on the executor's node.
After this call, ros2 lifecycle set|get|list|nodes can drive the executor-owned state machine. Register transition callbacks via nros_executor_lifecycle_register_on_* and inspect the state via nros_executor_lifecycle_get_current_state.
| nros_ret_t nros_executor_register_parameter_services | ( | struct nros_executor_t * | executor | ) |
Register the 6 ROS 2 parameter services on the executor's node.
After this call, parameters declared via nros_executor_declare_param_* are visible to ros2 param list, ros2 param get, ros2 param set, etc.
| nros_ret_t nros_executor_remove_on_shutdown_callback | ( | struct nros_executor_t * | executor, |
| nros_shutdown_callback_handle_t | handle | ||
| ) |
| nros_ret_t nros_executor_remove_pre_shutdown_callback | ( | struct nros_executor_t * | executor, |
| nros_shutdown_callback_handle_t | handle | ||
| ) |
Remove a previously registered pre-shutdown callback.
Returns NROS_RET_OK when handle named a live hook, NROS_RET_NOT_FOUND when it did not — including a handle that was already removed, and a handle issued by nros_executor_add_on_shutdown_callback (the phase is part of the handle, so it cannot cross over and remove the wrong hook).
executor must be a valid pointer to an initialized executor.
| nros_ret_t nros_executor_set_param_string | ( | struct nros_executor_t * | executor, |
| const char * | name, | ||
| const char * | value | ||
| ) |
Set a string parameter on the executor's server.
| nros_ret_t nros_executor_set_semantics | ( | struct nros_executor_t * | executor, |
| enum nros_executor_semantics_t | semantics | ||
| ) |
| nros_ret_t nros_executor_set_timeout | ( | struct nros_executor_t * | executor, |
| uint64_t | timeout_ns | ||
| ) |
| nros_ret_t nros_executor_set_trigger | ( | struct nros_executor_t * | executor, |
| nros_executor_trigger_t | trigger, | ||
| void * | context | ||
| ) |
| nros_ret_t nros_executor_spin | ( | struct nros_executor_t * | executor | ) |
| nros_ret_t nros_executor_spin_one_period | ( | struct nros_executor_t * | executor, |
| uint64_t | period_ns | ||
| ) |
| nros_ret_t nros_executor_spin_period | ( | struct nros_executor_t * | executor, |
| uint64_t | period_ns | ||
| ) |
| nros_ret_t nros_executor_spin_some | ( | struct nros_executor_t * | executor, |
| uint64_t | timeout_ns | ||
| ) |
| nros_ret_t nros_executor_stop | ( | struct nros_executor_t * | executor | ) |
| bool nros_executor_trigger_all | ( | const bool * | ready, |
| size_t | count, | ||
| void * | context | ||
| ) |
| bool nros_executor_trigger_always | ( | const bool * | ready, |
| size_t | count, | ||
| void * | context | ||
| ) |
| bool nros_executor_trigger_any | ( | const bool * | ready, |
| size_t | count, | ||
| void * | context | ||
| ) |
| bool nros_executor_trigger_one | ( | const bool * | ready, |
| size_t | count, | ||
| void * | context | ||
| ) |
Built-in trigger: fire when the handle at the index stored in context has data.
context must point to a caller-owned size_t holding the handle index. Passing (void*)(size_t)idx directly is NOT supported — that pattern is UB on strict-alignment targets and CHERI, and the function will dereference the pointer.
Recommended usage:
ready must point to a valid array of at least count booleans.context must point to a valid size_t alive for the trigger's lifetime. | nros_ret_t nros_get_ros_time_override | ( | const struct nros_clock_t * | clock, |
| int64_t * | nanoseconds | ||
| ) |
Read the ROS time override back, in nanoseconds since the epoch.
The C face of nros_core::Clock::get_ros_time_override, whose Option this splits into a status and an out-parameter: NROS_RET_OK and a value when an override is in effect, NROS_RET_NOT_FOUND and an untouched out-parameter when none is. rcl has no equivalent — a caller there reads the clock — but dropping it would leave the C mirror of the Rust surface one entry point short, and "is a simulator driving me, and at what time" is one question.
| const char * nros_goal_status_to_string | ( | enum nros_goal_status_t | status | ) |
Get status name as string.
| bool nros_goal_uuid_equal | ( | const struct nros_goal_uuid_t * | a, |
| const struct nros_goal_uuid_t * | b | ||
| ) |
Compare two goal UUIDs.
| nros_ret_t nros_goal_uuid_generate | ( | struct nros_goal_uuid_t * | uuid | ) |
Generate a new random goal UUID.
| nros_ret_t nros_guard_condition_clear | ( | struct nros_guard_condition_t * | guard | ) |
Clear the triggered flag.
| nros_ret_t nros_guard_condition_fini | ( | struct nros_guard_condition_t * | guard | ) |
Finalize a guard condition.
| struct nros_guard_condition_t nros_guard_condition_get_zero_initialized | ( | void | ) |
Get a zero-initialized guard condition.
| nros_ret_t nros_guard_condition_init | ( | struct nros_guard_condition_t * | guard, |
| const struct nros_support_t * | support | ||
| ) |
Initialize a guard condition.
| bool nros_guard_condition_is_triggered | ( | const struct nros_guard_condition_t * | guard | ) |
Check if the guard condition is triggered.
| bool nros_guard_condition_is_valid | ( | const struct nros_guard_condition_t * | guard | ) |
Check if guard condition is valid (initialized).
| nros_ret_t nros_guard_condition_set_callback | ( | struct nros_guard_condition_t * | guard, |
| nros_guard_condition_callback_t | callback, | ||
| void * | context | ||
| ) |
Set the guard condition callback.
| nros_ret_t nros_guard_condition_trigger | ( | struct nros_guard_condition_t * | guard | ) |
Trigger a guard condition.
This function is designed to be thread-safe. When registered with an executor, it triggers via the executor's guard handle (atomic flag in the arena). Otherwise falls back to the local triggered flag.
| nros_ret_t nros_has_custom_transport | ( | void | ) |
Phase 115.C — query whether a custom transport is currently registered. Returns 1 if a transport is registered, 0 otherwise. Useful for board crates that want to fall back to a static transport when no runtime override has been provided.
| size_t nros_heap_peak_bytes | ( | void | ) |
Peak outstanding bytes through the Rust global allocator since boot.
| size_t nros_heap_platform_used_bytes | ( | void | ) |
Bytes currently outstanding from the platform's unified heap — the true figure spanning both the Rust global allocator and the C side (zenoh-pico etc.), where the port owns one shared kernel heap. 0 if the port does not instrument heap usage.
| size_t nros_heap_total_bytes | ( | void | ) |
Total managed heap size in bytes (used + free) reported by the platform, or 0 if unknown.
| size_t nros_heap_used_bytes | ( | void | ) |
Bytes currently outstanding through the Rust global allocator.
| nros_ret_t nros_is_enabled_ros_time_override | ( | const struct nros_clock_t * | clock, |
| bool * | is_enabled | ||
| ) |
Whether the ROS time override is in effect.
Mirrors rcl_is_enabled_ros_time_override. Writes is_enabled only on NROS_RET_OK.
| nros_ret_t nros_lifecycle_change_state | ( | struct nros_lifecycle_state_machine_t * | sm, |
| uint8_t | transition_id | ||
| ) |
Trigger a lifecycle state transition.
| nros_ret_t nros_lifecycle_fini | ( | struct nros_lifecycle_state_machine_t * | sm | ) |
Finalize a lifecycle state machine.
| uint8_t nros_lifecycle_get_current_state | ( | const struct nros_lifecycle_state_machine_t * | sm | ) |
Get the current lifecycle state.
| struct nros_lifecycle_state_machine_t nros_lifecycle_get_zero_initialized | ( | void | ) |
Get a zero-initialized lifecycle state machine.
| nros_ret_t nros_lifecycle_init | ( | struct nros_lifecycle_state_machine_t * | sm | ) |
Initialize a standalone lifecycle state machine.
The machine starts in Unconfigured with no callbacks registered. It is self-contained: it drives the REP-2002 transition table and the six transition callbacks, and it is NOT bound to a node and registers no ROS 2 services. A node that should answer ros2 lifecycle set|get|list uses the executor-scoped family instead — nros_executor_register_lifecycle_services plus nros_executor_lifecycle_*.
Issue 0792: this took a const nros_node_t *node until it was noticed that the pointer was only NULL-checked and never stored. The parameter is gone rather than stored, because storing it would not have helped: the executor-scoped family does not reach its node through an nros_node_t at all. Executor::register_lifecycle_services builds the five servers on the executor's own session, keeps them in the executor's LifecycleRuntimeState, and relies on the executor's spin loop to poll them — none of which a caller-held nros_lifecycle_state_machine_t has access to or can be given by a node pointer. The removed nros_make_node_a_lifecycle_node alias went with it for the same reason: it could not do what its name said.
| nros_ret_t nros_lifecycle_register_on_activate | ( | struct nros_lifecycle_state_machine_t * | sm, |
| nros_lifecycle_callback_t | cb, | ||
| void * | context | ||
| ) |
Register a callback for the activate transition.
| nros_ret_t nros_lifecycle_register_on_cleanup | ( | struct nros_lifecycle_state_machine_t * | sm, |
| nros_lifecycle_callback_t | cb, | ||
| void * | context | ||
| ) |
Register a callback for the cleanup transition.
| nros_ret_t nros_lifecycle_register_on_configure | ( | struct nros_lifecycle_state_machine_t * | sm, |
| nros_lifecycle_callback_t | cb, | ||
| void * | context | ||
| ) |
Register a callback for the configure transition.
| nros_ret_t nros_lifecycle_register_on_deactivate | ( | struct nros_lifecycle_state_machine_t * | sm, |
| nros_lifecycle_callback_t | cb, | ||
| void * | context | ||
| ) |
Register a callback for the deactivate transition.
| nros_ret_t nros_lifecycle_register_on_error | ( | struct nros_lifecycle_state_machine_t * | sm, |
| nros_lifecycle_callback_t | cb, | ||
| void * | context | ||
| ) |
Register a callback for the error transition (error recovery).
| nros_ret_t nros_lifecycle_register_on_shutdown | ( | struct nros_lifecycle_state_machine_t * | sm, |
| nros_lifecycle_callback_t | cb, | ||
| void * | context | ||
| ) |
Register a callback for the shutdown transition.
| nros_ret_t nros_node_fini | ( | struct nros_node_t * | node | ) |
Finalize a node.
node - Pointer to an initialized nodeNROS_RET_OK on successNROS_RET_INVALID_ARGUMENT if node is NULLNROS_RET_NOT_INIT if not initializednode must be a valid pointer to an initialized nros_node_t | struct nros_node_options_t nros_node_get_default_options | ( | void | ) |
Get a zero-initialised nros_node_options_t.
All fields default to "inherit" — rmw_name_len = 0, locator_len = 0, domain_id_override = NROS_DOMAIN_ID_INHERIT, sched_context_id = 0. Callers populate only the fields they want to override.
| const void * nros_node_get_logger | ( | const struct nros_node_t * | node | ) |
Phase 88.12 — return the nros::Logger keyed on this node's name.
The returned handle is opaque from the C side; pass it to nros_log_info(...) / nros_log_warn(...) / etc. (declared in <nros/log.h>). The lifetime is 'static — loggers live for the process; callers must NOT free the returned pointer.
node - Pointer to an initialized node.nros_logger_t * (= &'static nros_log::Logger), or NULL if node is NULL / uninitialised.node must be a valid pointer. | const char * nros_node_get_name | ( | const struct nros_node_t * | node | ) |
| const char * nros_node_get_namespace | ( | const struct nros_node_t * | node | ) |
| const char * nros_node_get_serialization_format | ( | const struct nros_node_t * | node | ) |
RFC-0088 D4 / phase-421 W2 — the serialization format the backend behind THIS node speaks, as its cross-image identity string ("cdr", "uorb").
Resolved through the node's own session, not from an image-wide constant. That distinction is the whole point: a single-backend image could answer from the generated NROS_SERIALIZATION_FORMAT macro, but a bridge image links two backends and has no single answer — its two nodes sit on two sessions and this function reports each one's format separately. The macro is the fast path for the common case; this is the correct one always.
node - Pointer to an initialized nodenode is NULL / uninitialised, if its session cannot be resolved, or if the backend does not declare a format. NULL is not a synonym for "cdr" — a backend that has not said what it speaks has not said CDR, and guessing on its behalf is exactly the fallback the vtable's sibling identity slot spent two phases wrongly promising.node must be a valid pointer | struct nros_node_t nros_node_get_zero_initialized | ( | void | ) |
| nros_ret_t nros_node_init | ( | struct nros_node_t * | node, |
| const struct nros_support_t * | support, | ||
| const char * | name, | ||
| const char * | namespace_ | ||
| ) |
Initialize a node with default options.
Equivalent to building a [nros_node_options_t] via [nros_node_get_default_options], copying namespace_ into its namespace field, and calling [nros_node_init_ex]. The shim is kept for source-compatibility with rclc-style callers that pre-date Phase 104.C.8.
node - Pointer to a zero-initialized nodesupport - Pointer to an initialized support contextname - Node name (null-terminated string)namespace_ - Node namespace (null-terminated string, use "/" for root)NROS_RET_OK on successNROS_RET_INVALID_ARGUMENT if any pointer is NULL or strings are invalidNROS_RET_NOT_INIT if support is not initializedNROS_RET_ERROR on initialization failurename and namespace_ must be valid null-terminated strings | nros_ret_t nros_node_init_ex | ( | struct nros_node_t * | node, |
| const struct nros_support_t * | support, | ||
| const char * | name, | ||
| const struct nros_node_options_t * | options | ||
| ) |
Phase 104.C.8 — initialize a Node with extended options.
Thin C wrapper over the Rust Executor::node_builder(name).rmw(...) .locator(...).domain_id(...).namespace(...).sched(...).build() chain. Options fields with *_len == 0 (or domain_id_override == NROS_DOMAIN_ID_INHERIT) inherit from the support context, matching the legacy single-Node behaviour nros_node_init provides.
The rmw_name selector drives Phase 104 multi-RMW Node binding: a bridge node can be initialised with options.rmw_name = "cyclonedds" while the support context's primary backend is "zenoh", and subsequent publishers/subscribers created via this Node route through the named backend's session. (Internal multi-Session dispatch piggy-backs on the executor's extra_sessions cache; see Phase 104.C.3.)
Currently the inline node_id slot stays 0; per-Node multi-RMW dispatch in C lands once the C executor surfaces Executor::node_builder (Phase 104.C.8 follow-up). Options fields round-trip into the node struct today so users can write code against the final API surface without waiting for that follow-up.
node - Pointer to a zero-initialized nodesupport - Pointer to an initialized support contextname - Node name (null-terminated string)options - Pointer to an [nros_node_options_t] (must be non-NULL)NROS_RET_OK on successNROS_RET_INVALID_ARGUMENT on NULL / invalid strings / overrun buffersNROS_RET_BAD_SEQUENCE if the node is already initializedNROS_RET_NOT_INIT if support is not initializedname must be a valid NUL-terminated UTF-8 stringoptions fields must satisfy their declared length invariants | nros_ret_t nros_node_set_qos_overrides | ( | struct nros_node_t * | node, |
| const struct nros_qos_override_t * | overrides, | ||
| size_t | len | ||
| ) |
Install the per-topic QoS override table the deploy plan lowered from qos_overrides.<topic>.<role>.<policy> launch params (issue #52). Every entity created on node afterwards folds the matching (topic, role) entries into its QoS before the backend-compat check — the C/C++ mirror of Rust's NodeHandle::set_qos_overrides. Call once, after nros_node_init* and before creating publishers/subscriptions (a generated entry does this before configure(node)).
overrides must outlive the node (a static array in the generated entry). Pass len == 0 (or a null overrides) to clear.
node must point to an initialised nros_node_t.overrides must be null or point to len valid nros_qos_override_t (each topic a valid NUL-terminated UTF-8 C string), living at least as long as the node. | nros_ret_t nros_parameter_declare_string | ( | struct nros_parameter_server_t * | server, |
| const char * | name, | ||
| const char * | default_value | ||
| ) |
Declare a string parameter.
| nros_ret_t nros_parameter_get_string | ( | const struct nros_parameter_server_t * | server, |
| const char * | name, | ||
| char * | value, | ||
| size_t | max_len | ||
| ) |
Get a string parameter value.
| enum nros_parameter_type_t nros_parameter_get_type | ( | const struct nros_parameter_server_t * | server, |
| const char * | name | ||
| ) |
Get the type of a parameter.
| bool nros_parameter_has | ( | const struct nros_parameter_server_t * | server, |
| const char * | name | ||
| ) |
Check if a parameter exists.
| nros_ret_t nros_parameter_server_fini | ( | struct nros_parameter_server_t * | server | ) |
Finalize a parameter server.
| size_t nros_parameter_server_get_count | ( | const struct nros_parameter_server_t * | server | ) |
Get the number of declared parameters.
| struct nros_parameter_server_t nros_parameter_server_get_zero_initialized | ( | void | ) |
Get a zero-initialized parameter server.
| nros_ret_t nros_parameter_server_init | ( | struct nros_parameter_server_t * | server, |
| struct nros_parameter_t * | storage, | ||
| size_t | capacity | ||
| ) |
Initialize a parameter server with user-provided storage.
| nros_ret_t nros_parameter_server_set_callback | ( | struct nros_parameter_server_t * | server, |
| nros_parameter_callback_t | callback, | ||
| void * | context | ||
| ) |
Set a parameter change callback.
| nros_ret_t nros_parameter_set_string | ( | struct nros_parameter_server_t * | server, |
| const char * | name, | ||
| const char * | value | ||
| ) |
Set a string parameter value.
|
extern |
Monotonic nanoseconds since a platform-defined epoch (RFC-0073).
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
Sleep at least us microseconds.
|
extern |
Nanoseconds since the Unix epoch (issue 0532).
ONE symbol, replacing the time_since_epoch_{secs,nanos} pair. Those are RETIRED — nothing defines them any more, so a reference here is not a deprecation warning but an undefined symbol at link time.
| nros_ret_t nros_publish_raw | ( | const struct nros_publisher_t * | publisher, |
| const uint8_t * | data, | ||
| size_t | len | ||
| ) |
Publish raw CDR-serialized data.
publisher - Pointer to an initialized publisherdata - Pointer to CDR-serialized message datalen - Length of data in bytesNROS_RET_OK on successNROS_RET_INVALID_ARGUMENT if any pointer is NULL or len is 0NROS_RET_NOT_INIT if publisher is not initializedNROS_RET_PUBLISH_FAILED on publish failurepublisher must be a valid pointer to an initialized publisherdata must be a valid pointer to len bytes | nros_ret_t nros_publisher_assert_liveliness | ( | const struct nros_publisher_t * | publisher | ) |
Phase 108.B.7 — manually assert this publisher's liveliness.
Required for entities created with QoS liveliness_kind = NROS_QOS_LIVELINESS_MANUAL_BY_TOPIC or MANUAL_BY_NODE. No-op for AUTOMATIC / NONE. Backends that don't implement manual assertion (XRCE-DDS, zenoh-pico, uORB today) treat this as a no-op and return NROS_RET_OK.
publisher - Pointer to an initialized publisherNROS_RET_OK on successNROS_RET_INVALID_ARGUMENT if publisher is NULLNROS_RET_NOT_INIT if not initializedNROS_RET_PUBLISH_FAILED on backend failurepublisher must be a valid pointer to an initialized publisher | nros_ret_t nros_publisher_commit | ( | const struct nros_publisher_t * | publisher, |
| void * | token, | ||
| size_t | actual_len | ||
| ) |
Phase 124.A.6 — commit a previously-loaned slot. Sends the slot's actual_len bytes via the active backend.
Availability: lending-only, and no shipped build enables it — see nros_publisher_loan. Issue 0814.
token MUST come from a prior nros_publisher_loan on the SAME publisher; consuming it (commit OR discard) is mandatory.
publisher must be the same publisher the token was loaned from.token must not be NULL and must not be reused after this call. | nros_ret_t nros_publisher_discard | ( | const struct nros_publisher_t * | publisher, |
| void * | token | ||
| ) |
Phase 124.A.6 — abandon a previously-loaned slot without sending.
Availability: lending-only, and no shipped build enables it — see nros_publisher_loan. Issue 0814.
token MUST come from a prior nros_publisher_loan on the SAME publisher; consuming it (commit OR discard) is mandatory.
publisher must be the same publisher the token was loaned from.token must not be NULL and must not be reused after this call. | nros_ret_t nros_publisher_fini | ( | struct nros_publisher_t * | publisher | ) |
| struct nros_publisher_options_t nros_publisher_get_default_options | ( | void | ) |
Get a zero-initialised [nros_publisher_options_t].
All fields default to "inherit"/"none". Callers populate only the fields they want to override before passing the struct to [nros_publisher_init_with_options].
| const char * nros_publisher_get_topic_name | ( | const struct nros_publisher_t * | publisher | ) |
| struct nros_publisher_t nros_publisher_get_zero_initialized | ( | void | ) |
Get a zero-initialized publisher.
| nros_ret_t nros_publisher_init | ( | struct nros_publisher_t * | publisher, |
| const struct nros_node_t * | node, | ||
| const struct nros_message_type_t * | type_info, | ||
| const char * | topic_name | ||
| ) |
Initialize a publisher with default QoS (RELIABLE, KEEP_LAST(10)).
This is the recommended initialization function for most use cases. Uses QOS_PROFILE_DEFAULT which provides reliable delivery.
publisher - Pointer to a zero-initialized publishernode - Pointer to an initialized nodetype_info - Pointer to message type informationtopic_name - Topic name (null-terminated string)NROS_RET_OK on successNROS_RET_INVALID_ARGUMENT if any pointer is NULLNROS_RET_NOT_INIT if node is not initializedNROS_RET_ERROR on initialization failuretopic_name must be a valid null-terminated string | nros_ret_t nros_publisher_init_with_options | ( | struct nros_publisher_t * | publisher, |
| const struct nros_node_t * | node, | ||
| const struct nros_message_type_t * | type_info, | ||
| const char * | topic_name, | ||
| const struct nros_qos_t * | qos, | ||
| const struct nros_publisher_options_t * | options | ||
| ) |
Phase 189.M3 — initialize a publisher with custom QoS + named options.
rclc-style entry point: QoS is passed separately (qos, NULL = default) and the non-QoS axes ride in options (NULL = defaults). Equivalent to [nros_publisher_init_with_qos] today — [nros_publisher_options_t] is currently a reserved, thin struct (publishers have no scheduling-context binding) — but kept as a distinct, additive entry point for rclc symmetry and forward ABI headroom.
publisher - Pointer to a zero-initialized publishernode - Pointer to an initialized nodetype_info - Pointer to message type informationtopic_name - Topic name (null-terminated string)qos - Pointer to QoS settings (NULL for default)options - Pointer to publisher options (NULL for defaults)NROS_RET_OK on successNROS_RET_INVALID_ARGUMENT if any required pointer is NULLNROS_RET_NOT_INIT if node is not initializedNROS_RET_ERROR on initialization failuretopic_name must be a valid null-terminated stringqos / options may be NULL or point to valid structs | nros_ret_t nros_publisher_init_with_qos | ( | struct nros_publisher_t * | publisher, |
| const struct nros_node_t * | node, | ||
| const struct nros_message_type_t * | type_info, | ||
| const char * | topic_name, | ||
| const struct nros_qos_t * | qos | ||
| ) |
Initialize a publisher with custom QoS.
publisher - Pointer to a zero-initialized publishernode - Pointer to an initialized nodetype_info - Pointer to message type informationtopic_name - Topic name (null-terminated string)qos - Pointer to QoS settings (NULL for default)NROS_RET_OK on successNROS_RET_INVALID_ARGUMENT if any required pointer is NULLNROS_RET_NOT_INIT if node is not initializedNROS_RET_ERROR on initialization failuretopic_name must be a valid null-terminated string | bool nros_publisher_is_valid | ( | const struct nros_publisher_t * | publisher | ) |
| nros_ret_t nros_publisher_loan | ( | const struct nros_publisher_t * | publisher, |
| size_t | requested_len, | ||
| uint8_t ** | out_buf, | ||
| size_t * | out_cap, | ||
| void ** | out_token | ||
| ) |
Phase 124.A.6 — loan a writable slot from the publisher's outbound buffer (zero-copy publish path).
This symbol exists only in a nano-ros built with the lending cargo feature, and no shipped configuration enables it: the string lending appears zero times under cmake/ and zephyr/, nros-rmw-zenoh-staticlib — the crate every C/C++ and RTOS image links — declares no forwarder for it, and the only crate in the tree that turns it on is the nros-tests test harness.
Its presence in this header is therefore not evidence that it can be linked. cbindgen emits every declaration unconditionally here, by deliberate repo-wide policy (packages/api/nros-c/cbindgen.toml [defines], empty on purpose), so a #[cfg]-gated Rust symbol still appears. Calling this against a default build compiles and then fails at LINK with an undefined symbol.
The supported zero-copy surface is nros_publisher_publish_streamed and its receive twin process_raw_in_place: no feature, no token, no arena, no size ceiling, and the XRCE and zenoh backends fill them natively while all three NULL the loan trio. See issue 0814.
On success, *out_buf points at *out_cap writable bytes the caller fills in place. Pass *out_token back to [nros_publisher_commit] (to send) or [nros_publisher_discard] (to abandon). The slot's bytes are valid until commit / discard runs OR the publisher is finalised — whichever comes first. The caller is responsible for matching every loan with exactly one commit OR discard.
Falls back to a heap-allocated staging buffer when the active backend's vtable doesn't expose a native loan slot — the wire payload still takes a single memcpy at commit time. requested_len is the minimum capacity; *out_cap may exceed it. That fallback needs a heap: in a build without alloc there is nothing to hand out, and the answer is NROS_RET_NOT_ALLOWED (see below).
NROS_RET_OK — slot reserved.NROS_RET_TRY_AGAIN (-14) — no slot available right now. TRANSIENT: retry later, or use a non-loan publish path.NROS_RET_NOT_ALLOWED (-12) — this publisher cannot loan at all. PERMANENT (issue 0814): the backend's vtable exposes no loan slot and this build has no heap for the staging fallback, and neither fact can change while the publisher lives. Do NOT retry — take a non-loan path. nros_publisher_publish_streamed is the better one: it needs no token, no arena and no heap, and the XRCE and zenoh backends fill it natively.NROS_RET_INVALID_ARGUMENT on NULL pointers or zero requested_len.NROS_RET_NOT_INIT if publisher isn't initialised.| nros_ret_t nros_publisher_publish_streamed | ( | const struct nros_publisher_t * | publisher, |
| void(*)(size_t *out_total_len, void *user_ctx) | size_cb, | ||
| void(*)(uint8_t *out_buf, size_t cap, size_t *out_written, void *user_ctx) | chunk_cb, | ||
| void * | user_ctx | ||
| ) |
Phase 124.E.1 — streamed publish.
Two callbacks: size_cb reports the total payload length once, chunk_cb fills the slot in chunks. Backends that support streaming land each chunk directly in their outbound buffer; backends that don't fall through to a stack-allocated staging buffer (capped at ~4 KiB) + a single publish_raw.
publisher — initialized publishersize_cb — invoked once; writes the total byte count to *out_total_lenchunk_cb — invoked repeatedly; writes up to cap bytes starting at out_buf, reports the count via *out_written. *out_written == 0 signals EOFuser_ctx — opaque pointer passed through to both callbacksNROS_RET_OK on successNROS_RET_INVALID_ARGUMENT if any required pointer is NULLNROS_RET_NOT_INIT if not initialisedNROS_RET_PUBLISH_FAILED on backend failureNROS_RET_BUFFER_TOO_SMALL if the fallback's staging buffer is exceededpublisher must be a valid pointer to an initialised publisher.user_ctx is valid only for the duration of the call. | nros_ret_t nros_publisher_set_liveliness_lost_callback | ( | struct nros_publisher_t * | _pub_, |
| nros_event_publisher_count_cb_t | _cb, | ||
| void * | _user_context | ||
| ) |
Register a callback for NROS_EVENT_LIVELINESS_LOST.
pub_ must point to a valid, initialised nros_publisher_t. cb must be a valid function pointer or None.
| nros_ret_t nros_publisher_set_offered_deadline_missed_callback | ( | struct nros_publisher_t * | _pub_, |
| uint32_t | _deadline_ms, | ||
| nros_event_publisher_count_cb_t | _cb, | ||
| void * | _user_context | ||
| ) |
| nros_ret_t nros_service_fini | ( | struct nros_service_t * | service | ) |
| struct nros_service_options_t nros_service_get_default_options | ( | void | ) |
Get a zero-initialised [nros_service_options_t] (sched_context = 0).
| const char * nros_service_get_service_name | ( | const struct nros_service_t * | service | ) |
| struct nros_service_t nros_service_get_zero_initialized | ( | void | ) |
Get a zero-initialized service server.
| nros_ret_t nros_service_init | ( | struct nros_service_t * | service, |
| const struct nros_node_t * | node, | ||
| const struct nros_service_type_t * | type_info, | ||
| const char * | service_name, | ||
| nros_service_callback_t | callback, | ||
| void * | context | ||
| ) |
Initialize a service server.
service - Pointer to a zero-initialized servicenode - Pointer to an initialized nodetype_info - Pointer to service type informationservice_name - Service name (null-terminated string)callback - Callback function to invoke when requests arrivecontext - User context pointer passed to callback (can be NULL)NROS_RET_OK on successNROS_RET_INVALID_ARGUMENT if any required pointer is NULLNROS_RET_NOT_INIT if node is not initializedNROS_RET_ERROR on initialization failure | nros_ret_t nros_service_init_polling | ( | struct nros_service_t * | service, |
| const struct nros_node_t * | node, | ||
| const struct nros_service_type_t * | type_info, | ||
| const char * | service_name | ||
| ) |
Phase 122.3.c.4 — initialize an L1 polling-mode service server.
Creates the underlying RMW server immediately and stores it inline in the service's _opaque field. The caller drains received requests via nros_service_take_request_raw and sends replies via nros_service_send_response_raw.
service - Pointer to a zero-initialized servicenode - Pointer to an initialized nodetype_info - Pointer to service type informationservice_name - Service name (null-terminated)NROS_RET_OK on successNROS_RET_INVALID_ARGUMENT if any pointer is NULL or name emptyNROS_RET_NOT_INIT if node / support not initializedNROS_RET_ERROR if server creation failedAll pointers must be valid; service_name must be a valid null-terminated string.
| nros_ret_t nros_service_init_with_options | ( | struct nros_service_t * | service, |
| const struct nros_node_t * | node, | ||
| const struct nros_service_type_t * | type_info, | ||
| const char * | service_name, | ||
| nros_service_callback_t | callback, | ||
| void * | context, | ||
| const struct nros_qos_t * | qos, | ||
| const struct nros_service_options_t * | options | ||
| ) |
Phase 189.M3.3.a — initialize a service server with custom QoS + named options. Behaves like [nros_service_init_with_qos] except a non-zero options->sched_context is stashed on the service so that [nros_executor_add_service] binds the resulting executor handle to that scheduling context once the handle is known (server creation is deferred to registration, so the handle does not exist at init time).
All non-NULL pointers must be valid + the node initialized; qos / options may be NULL.
| nros_ret_t nros_service_init_with_qos | ( | struct nros_service_t * | service, |
| const struct nros_node_t * | node, | ||
| const struct nros_service_type_t * | type_info, | ||
| const char * | service_name, | ||
| nros_service_callback_t | callback, | ||
| void * | context, | ||
| const struct nros_qos_t * | qos | ||
| ) |
| bool nros_service_is_valid | ( | const struct nros_service_t * | service | ) |
| nros_ret_t nros_service_send_response_raw | ( | struct nros_service_t * | service, |
| int64_t | sequence_number, | ||
| const uint8_t * | data, | ||
| size_t | len | ||
| ) |
| nros_ret_t nros_service_set_wake_callback | ( | struct nros_service_t * | service, |
| struct nros_wake_state_t * | state, | ||
| void(*)(void *) | cb, | ||
| void * | ctx | ||
| ) |
Phase 122.3.c.6.e — register a C wake callback on an L1 polling-mode service server. state must point to a nros_wake_state_t allocated by the caller; it must outlive the service (typically declared inline next to the nros_service_t) and must not move after this call. Pass cb = NULL to disable. The backend wakes the callback when a new request arrives.
All pointers valid; state storage stable for the entity's lifetime.
| nros_ret_t nros_service_take_request | ( | struct nros_service_t * | service, |
| uint8_t * | _request_data, | ||
| size_t | _request_capacity, | ||
| size_t * | _request_len, | ||
| int64_t * | _sequence_number | ||
| ) |
Take a service request (non-blocking).
Currently not supported — service servers are callback-only through the executor. Use nros_executor_add_service() with a callback instead.
NROS_RET_NOT_INIT always (manual poll not supported) | int32_t nros_service_take_request_raw | ( | struct nros_service_t * | service, |
| uint8_t * | buf, | ||
| size_t | buf_len, | ||
| int64_t * | sequence_number | ||
| ) |
Phase 122.3.c.4 — non-blocking poll for a pending request on an L1 polling-mode service. Writes the request bytes into the caller's buf and the matching sequence_number (required for reply).
>= 0 — number of bytes written to buf (0 = no request)NROS_RET_INVALID_ARGUMENT if pointers / state wrongNROS_RET_ERROR on transport failureservice must be in POLLING state. buf writable for buf_len bytes. sequence_number writable for i64.
| nros_ret_t nros_set_custom_transport | ( | const struct nros_transport_ops_t * | ops | ) |
Phase 115.C — register a custom transport vtable.
Must be called BEFORE nros_support_init. Subsequent calls before init overwrite the slot. After init, behaviour is implementation-defined — the active RMW backend may have already consumed the previously-registered vtable.
Pass NULL to clear a previously-registered vtable.
NROS_RET_OK on success.NROS_RET_INVALID_ARGUMENT if ops is non-NULL but any of the four function pointers is NULL.The four function pointers in ops must follow the threading contract documented in <nros/transport.h>.
| nros_ret_t nros_set_ros_time_override | ( | const struct nros_clock_t * | clock, |
| int64_t | nanoseconds | ||
| ) |
Set the time a NROS_CLOCK_ROS_TIME clock reads, in nanoseconds since the epoch — the entry point a /clock subscriber or a bag player calls.
Mirrors rcl_set_ros_time_override, with the one model difference stated at the top of this section: setting a value also ENABLES the override, and a NEGATIVE nanoseconds is NROS_RET_INVALID_ARGUMENT because a negative value is the "no override" sentinel.
| void nros_set_trace_sink | ( | void(*)(uint32_t, uint32_t) | sink | ) |
Install the callback trace sink, or clear it with NULL.
sink is called as sink(marker_id, arg) — the signature of a two-uint32 platform trace event, chosen so a platform shim is installable verbatim:
marker_id | event | arg |
|---|---|---|
| 16 | register | handle << 8 \| kind |
| 17 | name | next 4 name bytes, byte i in bits 8*i |
| 18 | start | handle |
| 19 | end | handle |
Call it once at startup, BEFORE anything is registered on the executor: a sink installed later misses the registration events, and the decoder then has handles with no names.
No-op unless the crate was built with trace-callbacks.
sink must be a valid function pointer with the C ABI above, or NULL. It is called from the executor's dispatch path — including from an OS-priority worker task, i.e. a different thread — so it must be re-entrant and must not unwind. It must remain valid until it is replaced or cleared.
| int32_t nros_subscription_borrow | ( | struct nros_subscription_t * | subscription, |
| const uint8_t ** | out_buf, | ||
| size_t * | out_len, | ||
| void ** | out_token | ||
| ) |
Phase 124.A.6 — borrow a read-only view of the next available message in place (zero-copy receive path).
Availability: requires the lending AND alloc cargo features, and no shipped build enables lending — see nros_publisher_loan for what that means for this header. Issue 0814.
Bypasses the subscription's staging buffer. On success, *out_buf points at *out_len bytes the caller can read directly. Caller MUST pass *out_token back to [nros_subscription_release] before requesting another borrow on the same subscription — only one outstanding view per subscription at a time.
Falls back to a take_serialized copy into the staging buffer when the active backend's vtable doesn't expose a native borrow slot.
Requires alloc as well as lending. Unlike the publish half — which issue 0812 made allocation-free by passing the BACKEND's own token through — the receive half still boxes a RecvView per borrow to manufacture a stable FFI token, so it cannot exist in a heap-free image. That was 0812's own "what this does NOT yet buy" item, and leaving the cfg at lending alone did not make it work: it made nros-c FAIL TO COMPILE under --features lending without alloc (four alloc::boxed::Box uses with no extern crate alloc in scope). A capability that cannot build is worse than one that is absent, so the cfg now states the real requirement (issue 0814).
> 0 — message length written into *out_len; view is ready.0 — no message ready right now.nros_ret_t).subscription must be a valid polling subscription.out_buf / out_len / out_token must be valid pointers. | nros_ret_t nros_subscription_fini | ( | struct nros_subscription_t * | subscription | ) |
| struct nros_subscription_options_t nros_subscription_get_default_options | ( | void | ) |
Get a zero-initialised [nros_subscription_options_t].
All fields default to "inherit"/"off": sched_context = 0 (executor default), message_info = 0 (reserved, off). Callers populate only the fields they want before passing the struct to [nros_subscription_init_with_options].
| const char * nros_subscription_get_topic_name | ( | const struct nros_subscription_t * | subscription | ) |
| struct nros_subscription_t nros_subscription_get_zero_initialized | ( | void | ) |
Get a zero-initialized subscription.
| nros_ret_t nros_subscription_init | ( | struct nros_subscription_t * | subscription, |
| const struct nros_node_t * | node, | ||
| const struct nros_message_type_t * | type_info, | ||
| const char * | topic_name, | ||
| nros_subscription_callback_t | callback, | ||
| void * | context | ||
| ) |
Initialize a subscription with default QoS (RELIABLE, KEEP_LAST(10)).
This is the recommended initialization function for most use cases. Uses QOS_PROFILE_DEFAULT which provides reliable delivery.
subscription - Pointer to a zero-initialized subscriptionnode - Pointer to an initialized nodetype_info - Pointer to message type informationtopic_name - Topic name (null-terminated string)callback - Callback function to invoke when messages arrivecontext - User context pointer passed to callback (can be NULL)NROS_RET_OK on successNROS_RET_INVALID_ARGUMENT if any required pointer is NULLNROS_RET_NOT_INIT if node is not initializedNROS_RET_ERROR on initialization failuretopic_name must be a valid null-terminated stringcallback must be a valid function pointer | nros_ret_t nros_subscription_init_polling | ( | struct nros_subscription_t * | subscription, |
| const struct nros_node_t * | node, | ||
| const struct nros_message_type_t * | type_info, | ||
| const char * | topic_name | ||
| ) |
Phase 122.3.b — initialize an L1 polling-mode subscription.
Creates the underlying RMW subscriber immediately and stores it inline in the subscription's _opaque field. The caller drains received messages via nros_subscription_take_serialized.
Uses default QoS (RELIABLE, KEEP_LAST(10)). For custom QoS, use nros_subscription_init_polling_with_qos.
subscription - Pointer to a zero-initialized subscriptionnode - Pointer to an initialized nodetype_info - Pointer to message type informationtopic_name - Topic name (null-terminated)NROS_RET_OK on successNROS_RET_INVALID_ARGUMENT if any pointer is NULL or topic emptyNROS_RET_NOT_INIT if node / support not initializedNROS_RET_ERROR if subscriber creation failedtopic_name must be a valid null-terminated string | nros_ret_t nros_subscription_init_polling_with_qos | ( | struct nros_subscription_t * | subscription, |
| const struct nros_node_t * | node, | ||
| const struct nros_message_type_t * | type_info, | ||
| const char * | topic_name, | ||
| const struct nros_qos_t * | qos | ||
| ) |
| nros_ret_t nros_subscription_init_with_options | ( | struct nros_subscription_t * | subscription, |
| const struct nros_node_t * | node, | ||
| const struct nros_message_type_t * | type_info, | ||
| const char * | topic_name, | ||
| nros_subscription_callback_t | callback, | ||
| void * | context, | ||
| const struct nros_qos_t * | qos, | ||
| const struct nros_subscription_options_t * | options | ||
| ) |
Phase 189.M3 — initialize a subscription with custom QoS + named options.
rclc-style entry point: QoS is passed separately (qos, NULL = default) and the non-QoS axes ride in options (NULL = defaults). Behaves exactly like [nros_subscription_init_with_qos] except that a non-zero options->sched_context is stashed on the subscription so that [nros_executor_add_subscription] binds the resulting executor handle to that scheduling context once the handle is known (entity creation is deferred to registration, so the handle does not exist at init time). options->message_info is RESERVED and ignored (Phase 189.M3.4).
subscription - Pointer to a zero-initialized subscriptionnode - Pointer to an initialized nodetype_info - Pointer to message type informationtopic_name - Topic name (null-terminated string)callback - Callback function to invoke when messages arrivecontext - User context pointer passed to callback (can be NULL)qos - Pointer to QoS settings (NULL for default)options - Pointer to subscription options (NULL for defaults)NROS_RET_OK on successNROS_RET_INVALID_ARGUMENT if any required pointer is NULLNROS_RET_NOT_INIT if node is not initializedNROS_RET_ERROR on initialization failuretopic_name must be a valid null-terminated stringqos / options may be NULL or point to valid structs | nros_ret_t nros_subscription_init_with_qos | ( | struct nros_subscription_t * | subscription, |
| const struct nros_node_t * | node, | ||
| const struct nros_message_type_t * | type_info, | ||
| const char * | topic_name, | ||
| nros_subscription_callback_t | callback, | ||
| void * | context, | ||
| const struct nros_qos_t * | qos | ||
| ) |
| bool nros_subscription_is_valid | ( | const struct nros_subscription_t * | subscription | ) |
| nros_ret_t nros_subscription_release | ( | struct nros_subscription_t * | subscription, |
| void * | token | ||
| ) |
Phase 124.A.6 — release a previously borrowed view.
Availability: requires lending AND alloc, and no shipped build enables lending — see nros_publisher_loan. Issue 0814.
token MUST come from a prior nros_subscription_borrow on the SAME subscription; consuming it is mandatory before the subscription's next borrow / destroy.
Requires alloc as well as lending — it unboxes the RecvView its paired nros_subscription_borrow boxed. See that function.
subscription must be the subscription the token was borrowed from.token must not be NULL and must not be reused after this call. | nros_ret_t nros_subscription_set_liveliness_changed_callback | ( | struct nros_subscription_t * | _sub, |
| nros_event_liveliness_changed_cb_t | _cb, | ||
| void * | _user_context | ||
| ) |
Register a callback for NROS_EVENT_LIVELINESS_CHANGED.
Returns NROS_RMW_RET_UNSUPPORTED until the active backend wires up liveliness-event detection (Phase 109+). Applications can call it today; the event fires once the backend gains support.
sub must point to a valid, initialised nros_subscription_t. cb must be a valid function pointer or None. user_context is opaque to nros and must outlive the subscription.
| nros_ret_t nros_subscription_set_message_lost_callback | ( | struct nros_subscription_t * | _sub, |
| nros_event_subscriber_count_cb_t | _cb, | ||
| void * | _user_context | ||
| ) |
| nros_ret_t nros_subscription_set_requested_deadline_missed_callback | ( | struct nros_subscription_t * | _sub, |
| uint32_t | _deadline_ms, | ||
| nros_event_subscriber_count_cb_t | _cb, | ||
| void * | _user_context | ||
| ) |
| nros_ret_t nros_subscription_set_wake_callback | ( | struct nros_subscription_t * | subscription, |
| struct nros_wake_state_t * | state, | ||
| void(*)(void *) | cb, | ||
| void * | ctx | ||
| ) |
Phase 122.3.c.6.e — register a C wake callback on an L1 polling-mode subscription. state is a caller-owned nros_wake_state_t (declared next to the subscription) that must outlive the subscription and not move. Pass cb = NULL to disable. The backend wakes the callback when a new message arrives.
All pointers valid; state storage stable for the subscription's lifetime.
| int32_t nros_subscription_take_sequence | ( | struct nros_subscription_t * | subscription, |
| uint8_t * | buf, | ||
| size_t | per_msg_cap, | ||
| size_t | max_msgs, | ||
| size_t * | out_lens | ||
| ) |
Phase 124.D.1 — burst-take. Drain up to max_msgs queued samples into the contiguous buf block in a single call, with the i-th sample at buf + i * per_msg_cap and length out_lens[i].
buf is a caller-owned contiguous region of at least max_msgs * per_msg_cap bytes. out_lens is a writable array of at least max_msgs size_t slots.
Returns the number of messages delivered (>= 0) on success, or a negative nros_ret_t error code. Partial drains are reported as the count, never as an error.
subscription must be in POLLING state.buf must point to writable memory of at least max_msgs * per_msg_cap bytes.out_lens must point to a writable array of at least max_msgs size_t slots. | int32_t nros_subscription_take_serialized | ( | struct nros_subscription_t * | subscription, |
| uint8_t * | buf, | ||
| size_t | buf_len | ||
| ) |
Phase 122.3.b — non-blocking poll on an L1 polling-mode subscription. Returns the number of bytes received on success (may be 0 if no data available), or a negative nros_ret_t on error.
subscription - Pointer to a POLLING-state subscriptionbuf - Caller-supplied buffer to receive the message bytesbuf_len - Capacity of buf>= 0 — number of bytes copied into bufNROS_RET_INVALID_ARGUMENT if any pointer is NULL or state is wrongNROS_RET_ERROR on transport failuresubscription must be in POLLING statebuf must point to writable memory of at least buf_len bytes | int32_t nros_subscription_take_validated | ( | struct nros_subscription_t * | subscription, |
| uint8_t * | buf, | ||
| size_t | buf_len, | ||
| struct nros_integrity_status_t * | out_status | ||
| ) |
Phase 252 / issue 0073 — non-blocking poll that ALSO returns the E2E integrity status (CRC + sequence gap/dup) of the received sample. The safety-e2e analog of [nros_subscription_take_serialized]: it requests validation on the backend (the zenoh shim recomputes + compares the CRC attachment and tracks the sequence) and writes the verdict to *out_status.
Requires the build to enable safety-e2e on both ends (the zenoh backend's own feature, lowered from a declared [safety] axis); otherwise crc_valid reports -1 (no CRC on the wire).
>= 0 — number of bytes copied into buf (0 = no data available)NROS_RET_INVALID_ARGUMENT if subscription/buf is NULLNROS_RET_BAD_SEQUENCE if the subscription is not in POLLING stateNROS_RET_ERROR on transport failuresubscription must be a valid POLLING subscriptionbuf must point to writable memory of at least buf_len bytesout_status, if non-NULL, must point to a writable nros_integrity_status_t | nros_ret_t nros_support_fini | ( | struct nros_support_t * | support | ) |
Finalize the support context.
This function closes the middleware session and releases all resources.
support - Pointer to an initialized support contextNROS_RET_OK on successNROS_RET_INVALID_ARGUMENT if support is NULLNROS_RET_NOT_INIT if not initializedsupport must be a valid pointer to an initialized nros_support_t | struct nros_support_t nros_support_get_zero_initialized | ( | void | ) |
| nros_ret_t nros_support_init | ( | struct nros_support_t * | support, |
| const char * | locator, | ||
| uint8_t | domain_id | ||
| ) |
Initialize the support context.
This function initializes the middleware session and prepares the context for creating nodes, publishers, and subscribers.
support - Pointer to a zero-initialized support contextlocator - Middleware locator string (e.g., "tcp/127.0.0.1:7447"), or NULL for defaultdomain_id - ROS domain ID (0-232)NROS_RET_OK on successNROS_RET_INVALID_ARGUMENT if support is NULLNROS_RET_ERROR on initialization failuresupport must be a valid pointer to a zero-initialized nros_support_tlocator must be a valid null-terminated string or NULL | nros_ret_t nros_support_init_named | ( | struct nros_support_t * | support, |
| const char * | locator, | ||
| uint8_t | domain_id, | ||
| const char * | session_name | ||
| ) |
Initialize the support context with a session name.
Like nros_support_init, but allows specifying a session name for XRCE-DDS. Different XRCE clients on the same agent MUST use different session names; otherwise the agent treats them as the same client and won't relay data between them.
support - Pointer to a zero-initialized support contextlocator - Middleware locator string, or NULL for defaultdomain_id - ROS domain ID (0-232)session_name - Session name for XRCE key derivation, or NULL for defaultsupport must be a valid pointer to a zero-initialized nros_support_tlocator and session_name must be valid null-terminated strings or NULL | nros_ret_t nros_support_init_rmw | ( | struct nros_support_t * | support, |
| const char * | locator, | ||
| uint8_t | domain_id, | ||
| const char * | session_name, | ||
| const char * | rmw | ||
| ) |
Issue 1050 defect (3) — [nros_support_init_named] with an explicit RMW selector.
rmw is the BAKED rung of precedence model A (RFC-0045): a hosted $NROS_RMW still wins, NULL or "" means "no selector", and a selector that names no registered backend is an error rather than a fallback.
The C surface needed this most. Its open path (nros::internals::open_session) never consulted resolve_backend at all — it took registry slot 0 whenever $NROS_RMW was unset, so a second backend registering from an .init_array ctor before main silently won. That is fixed at the source (nros_rmw_cffi::get_vtable resolves once, for every language), and this is how a C image says which one it meant.
As [nros_support_init_named], plus: rmw must be a valid NUL-terminated string or NULL.
| bool nros_support_is_valid | ( | const struct nros_support_t * | support | ) |
| struct nros_time_t nros_time_add | ( | struct nros_time_t | time, |
| struct nros_duration_t | duration | ||
| ) |
Add a duration to a time.
| int nros_time_compare | ( | struct nros_time_t | a, |
| struct nros_time_t | b | ||
| ) |
Compare two times.
| struct nros_time_t nros_time_from_nanoseconds | ( | int64_t | nanoseconds | ) |
Convert nanoseconds to a nros_time_t structure.
| struct nros_time_t nros_time_sub | ( | struct nros_time_t | time, |
| struct nros_duration_t | duration | ||
| ) |
Subtract a duration from a time.
| int64_t nros_time_to_nanoseconds | ( | const struct nros_time_t * | time | ) |
Convert a nros_time_t structure to nanoseconds.
| nros_ret_t nros_timer_cancel | ( | struct nros_timer_t * | timer | ) |
Cancel a timer.
A canceled timer will not fire, but can be reset to start again. If registered with an executor, forwards to the executor's cancel_timer.
timer - Pointer to an initialized timerNROS_RET_OK on successNROS_RET_INVALID_ARGUMENT if timer is NULLNROS_RET_NOT_INIT if not initialized | nros_ret_t nros_timer_fini | ( | struct nros_timer_t * | timer | ) |
| uint64_t nros_timer_get_period | ( | const struct nros_timer_t * | timer | ) |
| uint64_t nros_timer_get_time_until_next_call | ( | const struct nros_timer_t * | timer, |
| uint64_t | current_time_ns | ||
| ) |
| struct nros_timer_t nros_timer_get_zero_initialized | ( | void | ) |
Get a zero-initialized timer.
| nros_ret_t nros_timer_init | ( | struct nros_timer_t * | timer, |
| const struct nros_support_t * | support, | ||
| uint64_t | period_ns, | ||
| nros_timer_callback_t | callback, | ||
| void * | context | ||
| ) |
Initialize a timer.
timer - Pointer to a zero-initialized timersupport - Pointer to an initialized support contextperiod_ns - Timer period in nanosecondscallback - Callback function to invoke when timer firescontext - User context pointer passed to callback (can be NULL)NROS_RET_OK on successNROS_RET_INVALID_ARGUMENT if any required pointer is NULL or period is 0NROS_RET_NOT_INIT if support is not initializedcallback must be a valid function pointer | bool nros_timer_is_valid | ( | const struct nros_timer_t * | timer | ) |
| nros_ret_t nros_timer_reset | ( | struct nros_timer_t * | timer | ) |
Reset a timer.
This resets the timer's last call time and starts it running again if it was canceled. If registered with an executor, forwards to the executor's reset_timer.
timer - Pointer to an initialized timerNROS_RET_OK on successNROS_RET_INVALID_ARGUMENT if timer is NULLNROS_RET_NOT_INIT if not initialized | struct nros_wake_state_t nros_wake_state_get_zero_initialized | ( | void | ) |
Phase 122.3.c.6.e — zero-initialise a wake-state slot.
|
extern |
Default QoS profile (matches rmw_qos_profile_default).
|
extern |
Sensor data QoS profile (best effort, small depth).
|
extern |
Services QoS profile (reliable).
|
extern |
Phase 115.A.2 — current ABI version of [nros_transport_ops_t].
C / C++ callers MUST fill in ops.abi_version = NROS_TRANSPORT_OPS_ABI_VERSION_V1 before passing the struct to [nros_set_custom_transport]. Mismatched values are rejected with NROS_RET_ERROR (mapped from TransportError::IncompatibleAbi); cffi consumers see NROS_RMW_RET_INCOMPATIBLE_ABI.