|
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 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 bool(* | nros_param_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 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) |
| typedef struct Option_LifecycleCallbackFnCtx | Option_LifecycleCallbackFnCtx |
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_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_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_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+).
| 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 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 bool(* nros_param_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 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) |
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_register_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) |
| typedef struct Option_LifecycleCallbackFnCtx Option_LifecycleCallbackFnCtx |
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::CancelResponse and the action_msgs/srv/CancelGoal wire-CDR return_code field.
| 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_register_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/core/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.
| 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.
| int32_t nros_action_server_active_goal_count_raw | ( | struct nros_action_server_t * | server | ) |
Phase 122.3.c.6.b — L1 polling: get the number of active goals.
| 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.
| size_t nros_action_server_get_active_goal_count | ( | const struct nros_action_server_t * | server | ) |
Get the number of currently active goals.
Reads from the arena via ActionServerRawHandle::active_goal_count. Returns 0 if the server isn't registered or has been finalised.
| 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_register_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_register_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.
| 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_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_try_recv_reply_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.
| int32_t nros_client_try_recv_reply_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_try_recv_response | ( | struct nros_client_t * | client, |
| uint8_t * | response_data, | ||
| size_t | response_capacity, | ||
| size_t * | response_len | ||
| ) |
| 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.
| 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_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_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 | ) |
| 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_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.
| int nros_executor_get_remaining_handles | ( | const struct nros_executor_t * | executor | ) |
Get remaining total handle capacity.
| 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_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, |
| struct Option_LifecycleCallbackFnCtx | 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, |
| struct Option_LifecycleCallbackFnCtx | 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, |
| struct Option_LifecycleCallbackFnCtx | 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, |
| struct Option_LifecycleCallbackFnCtx | 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, |
| struct Option_LifecycleCallbackFnCtx | 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, |
| struct Option_LifecycleCallbackFnCtx | 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_register_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_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_register_action_server | ( | struct nros_executor_t * | executor, |
| struct nros_action_server_t * | server | ||
| ) |
| nros_ret_t nros_executor_register_guard_condition | ( | struct nros_executor_t * | executor, |
| struct nros_guard_condition_t * | guard | ||
| ) |
| 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_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_register_service | ( | struct nros_executor_t * | executor, |
| struct nros_service_t * | service | ||
| ) |
| nros_ret_t nros_executor_register_subscription | ( | struct nros_executor_t * | executor, |
| struct nros_subscription_t * | subscription, | ||
| enum nros_executor_invocation_t | invocation | ||
| ) |
| nros_ret_t nros_executor_register_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_register_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_register_time_triggered_dispatcher | ( | struct nros_executor_t * | executor, |
| uint32_t | major_frame_us | ||
| ) |
| nros_ret_t nros_executor_register_timer | ( | struct nros_executor_t * | executor, |
| struct nros_timer_t * | timer | ||
| ) |
| 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. | 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_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_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, |
| const struct nros_node_t * | node | ||
| ) |
Initialize a lifecycle state machine for a node.
| nros_ret_t nros_lifecycle_register_on_activate | ( | struct nros_lifecycle_state_machine_t * | sm, |
| struct Option_LifecycleCallbackFnCtx | 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, |
| struct Option_LifecycleCallbackFnCtx | 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, |
| struct Option_LifecycleCallbackFnCtx | 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, |
| struct Option_LifecycleCallbackFnCtx | 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, |
| struct Option_LifecycleCallbackFnCtx | 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, |
| struct Option_LifecycleCallbackFnCtx | cb, | ||
| void * | context | ||
| ) |
Register a callback for the shutdown transition.
| nros_ret_t nros_make_node_a_lifecycle_node | ( | struct nros_lifecycle_state_machine_t * | sm, |
| const struct nros_node_t * | node | ||
| ) |
Convenience: alias for nros_lifecycle_init matching rclc's rclc_make_node_a_lifecycle_node.
| 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 | ) |
| 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_param_declare_string | ( | struct nros_param_server_t * | server, |
| const char * | name, | ||
| const char * | default_value | ||
| ) |
Declare a string parameter.
| nros_ret_t nros_param_get_string | ( | const struct nros_param_server_t * | server, |
| const char * | name, | ||
| char * | value, | ||
| size_t | max_len | ||
| ) |
Get a string parameter value.
| enum nros_parameter_type_t nros_param_get_type | ( | const struct nros_param_server_t * | server, |
| const char * | name | ||
| ) |
Get the type of a parameter.
| bool nros_param_has | ( | const struct nros_param_server_t * | server, |
| const char * | name | ||
| ) |
Check if a parameter exists.
| nros_ret_t nros_param_server_fini | ( | struct nros_param_server_t * | server | ) |
Finalize a parameter server.
| size_t nros_param_server_get_count | ( | const struct nros_param_server_t * | server | ) |
Get the number of declared parameters.
| struct nros_param_server_t nros_param_server_get_zero_initialized | ( | void | ) |
Get a zero-initialized parameter server.
| nros_ret_t nros_param_server_init | ( | struct nros_param_server_t * | server, |
| struct nros_parameter_t * | storage, | ||
| size_t | capacity | ||
| ) |
Initialize a parameter server with user-provided storage.
| nros_ret_t nros_param_server_set_callback | ( | struct nros_param_server_t * | server, |
| nros_param_callback_t | callback, | ||
| void * | context | ||
| ) |
Set a parameter change callback.
| nros_ret_t nros_param_set_string | ( | struct nros_param_server_t * | server, |
| const char * | name, | ||
| const char * | value | ||
| ) |
Set a string parameter value.
|
extern |
|
extern |
Monotonic microseconds since a platform-defined epoch.
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
Sleep at least us microseconds.
| 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.
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.
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).
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.
NROS_RET_OK — slot reserved.NROS_RET_TRY_AGAIN (-15) — backend has no slot available; retry later or use a non-loan publish path.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_try_recv_request_raw and sends replies via nros_service_send_reply_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_register_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_reply_raw | ( | struct nros_service_t * | service, |
| int64_t | sequence_number, | ||
| const uint8_t * | data, | ||
| size_t | len | ||
| ) |
| nros_ret_t nros_service_send_response | ( | struct nros_service_t * | service, |
| int64_t | _sequence_number, | ||
| const uint8_t * | _response_data, | ||
| size_t | _response_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_register_service() with a callback instead.
NROS_RET_NOT_INIT always (manual poll not supported) | int32_t nros_service_try_recv_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>.
| 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).
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 try_recv_raw copy into the staging buffer when the active backend's vtable doesn't expose a native borrow slot.
> 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_try_recv_raw.
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_register_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.
token MUST come from a prior nros_subscription_borrow on the SAME subscription; consuming it is mandatory before the subscription's next borrow / destroy.
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_try_recv_raw | ( | 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_try_recv_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_try_recv_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_try_recv_raw]: 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 | 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.