diff --git a/include/zenoh/api/ext/advanced_subscriber.hxx b/include/zenoh/api/ext/advanced_subscriber.hxx index 670fadc..7b2eb6d 100644 --- a/include/zenoh/api/ext/advanced_subscriber.hxx +++ b/include/zenoh/api/ext/advanced_subscriber.hxx @@ -19,6 +19,7 @@ #include "../interop.hxx" #include "../keyexpr.hxx" #include "../sample.hxx" +#include "../source_info.hxx" #include "miss.hxx" namespace zenoh::ext { @@ -183,6 +184,19 @@ class AdvancedSubscriberBase : public Owned<::ze_owned_advanced_subscriber_t> { return zenoh::Subscriber>( std::move(s), std::move(cb_handler_pair.second)); } + + /// @brief Get the key expression of the advanced subscriber. + const KeyExpr& get_keyexpr() const { + return zenoh::interop::as_owned_cpp_ref( + ::ze_advanced_subscriber_keyexpr(zenoh::interop::as_loaned_c_ptr(*this))); + } + + /// @brief Get the id of the advanced subscriber. + /// @return id of this advanced subscriber. + EntityGlobalId get_id() const { + return zenoh::interop::into_copyable_cpp_obj( + ::ze_advanced_subscriber_id(zenoh::interop::as_loaned_c_ptr(*this))); + } }; } // namespace detail diff --git a/include/zenoh/api/subscriber.hxx b/include/zenoh/api/subscriber.hxx index baf7eca..7b9342e 100644 --- a/include/zenoh/api/subscriber.hxx +++ b/include/zenoh/api/subscriber.hxx @@ -20,6 +20,9 @@ #include "base.hxx" #include "interop.hxx" #include "keyexpr.hxx" +#if defined(ZENOHCXX_ZENOHC) && defined(Z_FEATURE_UNSTABLE_API) +#include "source_info.hxx" +#endif namespace zenoh { @@ -31,10 +34,20 @@ class SubscriberBase : public Owned<::z_owned_subscriber_t> { SubscriberBase(::z_owned_subscriber_t* s) : Owned(s){}; public: - /// @brief Get the key expression of the subscriber + /// @brief Get the key expression of the subscriber. const KeyExpr& get_keyexpr() const { return interop::as_owned_cpp_ref(::z_subscriber_keyexpr(interop::as_loaned_c_ptr(*this))); } + +#if defined(ZENOHCXX_ZENOHC) && defined(Z_FEATURE_UNSTABLE_API) + /// @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future + /// release. + /// @brief Get the id of the subscriber. + /// @return id of this subscriber. + EntityGlobalId get_id() const { + return interop::into_copyable_cpp_obj(::z_subscriber_id(interop::as_loaned_c_ptr(*this))); + } +#endif }; } // namespace detail diff --git a/zenoh-c b/zenoh-c index 2f38959..17e7046 160000 --- a/zenoh-c +++ b/zenoh-c @@ -1 +1 @@ -Subproject commit 2f389597264c200d9ddf72bbabbfea878abd5179 +Subproject commit 17e70467834f080d8fe732de84378a5fd806f4d4