Skip to content

Commit

Permalink
Add missed z_sample_* methods (#518)
Browse files Browse the repository at this point in the history
  • Loading branch information
sashacmc authored Jul 9, 2024
1 parent a83be07 commit 4bdf32e
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
33 changes: 33 additions & 0 deletions include/zenoh-pico/api/primitives.h
Original file line number Diff line number Diff line change
Expand Up @@ -1429,6 +1429,39 @@ z_sample_kind_t z_sample_kind(const z_loaned_sample_t *sample);
*/
z_qos_t z_sample_qos(const z_loaned_sample_t *sample);

/**
* Got sample qos congestion control value.
*
* Parameters:
* sample: Pointer to a :c:type:`z_loaned_sample_t` to get the congestion control from.
*
* Return:
* The congestion control wrapped as a :c:type:`z_congestion_control_t`.
*/
z_congestion_control_t z_sample_congestion_control(const z_loaned_sample_t *sample);

/**
* Got whether sample qos express flag was set or not.
*
* Parameters:
* sample: Pointer to a :c:type:`z_loaned_sample_t` to get the express flag from.
*
* Return:
* The express flag value.
*/
bool z_sample_express(const z_loaned_sample_t *sample);

/**
*
* Parameters:
* sample: Pointer to a :c:type:`z_loaned_sample_t` to get the qos from.
*
* Return:
* The qos wrapped as a :c:type:`z_qos_t`.
* Got sample qos priority value.
*/
z_priority_t z_sample_priority(const z_loaned_sample_t *sample);

/**
* Gets the attachment of a sample by aliasing it.
*
Expand Down
5 changes: 5 additions & 0 deletions src/api/api.c
Original file line number Diff line number Diff line change
Expand Up @@ -922,6 +922,11 @@ z_timestamp_t z_sample_timestamp(const z_loaned_sample_t *sample) { return sampl
const z_loaned_encoding_t *z_sample_encoding(const z_loaned_sample_t *sample) { return &sample->encoding; }
z_qos_t z_sample_qos(const z_loaned_sample_t *sample) { return sample->qos; }
const z_loaned_bytes_t *z_sample_attachment(const z_loaned_sample_t *sample) { return &sample->attachment; }
z_congestion_control_t z_sample_congestion_control(const z_loaned_sample_t *sample) {
return _z_n_qos_get_congestion_control(sample->qos);
}
bool z_sample_express(const z_loaned_sample_t *sample) { return _z_n_qos_get_express(sample->qos); }
z_priority_t z_sample_priority(const z_loaned_sample_t *sample) { return _z_n_qos_get_priority(sample->qos); }

const z_loaned_bytes_t *z_reply_err_payload(const z_loaned_reply_err_t *reply_err) { return &reply_err->payload; }
const z_loaned_encoding_t *z_reply_err_encoding(const z_loaned_reply_err_t *reply_err) { return &reply_err->encoding; }
Expand Down

0 comments on commit 4bdf32e

Please sign in to comment.