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 missed z_sample_* methods #518

Merged
merged 1 commit into from
Jul 9, 2024
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
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
Loading