Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add z_reply_replier_id #526

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions include/zenoh-pico/api/primitives.h
Original file line number Diff line number Diff line change
Expand Up @@ -1687,6 +1687,17 @@ const z_loaned_sample_t *z_reply_ok(const z_loaned_reply_t *reply);
* The error reply content wrapped as a :c:type:`z_loaned_reply_err_t`.
*/
const z_loaned_reply_err_t *z_reply_err(const z_loaned_reply_t *reply);

/**
* Gets the id of the zenoh instance that answered this Reply.
*
* Parameters:
* reply: Pointer to a :c:type:`z_loaned_reply_t` to get content from.
*
* Return:
* `true` if id is present
*/
_Bool z_reply_replier_id(const z_loaned_reply_t *reply, z_id_t *out_id);
#endif

#if Z_FEATURE_QUERYABLE == 1
Expand Down
8 changes: 8 additions & 0 deletions src/api/api.c
Original file line number Diff line number Diff line change
Expand Up @@ -1229,6 +1229,14 @@ _Bool z_reply_is_ok(const z_loaned_reply_t *reply) { return reply->_tag != _Z_RE
const z_loaned_sample_t *z_reply_ok(const z_loaned_reply_t *reply) { return &reply->data.sample; }

const z_loaned_reply_err_t *z_reply_err(const z_loaned_reply_t *reply) { return &reply->data.error; }

_Bool z_reply_replier_id(const z_loaned_reply_t *reply, z_id_t *out_id) {
if (_z_id_check(reply->data.replier_id)) {
*out_id = reply->data.replier_id;
return true;
}
return false;
}
#endif

#if Z_FEATURE_QUERYABLE == 1
Expand Down
2 changes: 1 addition & 1 deletion zenohpico.pc
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ prefix=/usr/local
Name: zenohpico
Description:
URL:
Version: 1.0.20240709dev
Version: 1.0.20240710dev
Cflags: -I${prefix}/include
Libs: -L${prefix}/lib -lzenohpico
Loading