Skip to content

Commit

Permalink
merge
Browse files Browse the repository at this point in the history
  • Loading branch information
DenisBiryukov91 committed Jul 11, 2024
2 parents 8e2039f + 1dad7ce commit f2a7064
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
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 @@ -1228,6 +1228,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

0 comments on commit f2a7064

Please sign in to comment.