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 support for qos settings in sample #99

Merged
merged 3 commits into from
Feb 23, 2024
Merged
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
18 changes: 18 additions & 0 deletions include/zenohcxx/api.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,20 @@ typedef ::z_congestion_control_t CongestionControl;
/// - **Z_PRIORITY_BACKGROUND**: Priority for "background traffic" messages.
typedef ::z_priority_t Priority;

/// QoS settings of zenoh message.
///
struct QoS : public Copyable<::z_qos_t> {
using Copyable::Copyable;
/// @brief Returns message priority.
Priority get_priority() const { return ::z_qos_get_priority(*this); }
/// @brief Returns message congestion control.
CongestionControl get_congestion_control() const { return ::z_qos_get_congestion_control(*this); }
/// @brief Returns message express flag. If set to true, the message is not batched to reduce the latency.
bool get_express() const { return ::z_qos_get_express(*this); }
/// @brief Crates default QoS settings.
QoS() : Copyable(z_qos_default()) {};
};

/// Query target values.
///
/// see also: ``zenoh::query_target_default``
Expand Down Expand Up @@ -875,6 +889,10 @@ struct Sample : public Copyable<::z_sample_t> {
/// @return ``zenoh::SampleKind`` value
SampleKind get_kind() const { return kind; }

/// @brief QoS settings this sample was sent with
/// @return ``zenoh::QoS`` struct
QoS get_qos() const { return qos; }

/// @brief The timestamp of this data sample
/// @return ``Timestamp`` object
const z::Timestamp& get_timestamp() const { return static_cast<const z::Timestamp&>(timestamp); }
Expand Down
Loading