diff --git a/doc/docker-run-example.png b/doc/docker-run-example.png index ec47ac51..6b3447d2 100644 Binary files a/doc/docker-run-example.png and b/doc/docker-run-example.png differ diff --git a/src/linux/wpa-controller/Hostapd.cxx b/src/linux/wpa-controller/Hostapd.cxx index 3b0f8e52..b99d1542 100644 --- a/src/linux/wpa-controller/Hostapd.cxx +++ b/src/linux/wpa-controller/Hostapd.cxx @@ -45,7 +45,7 @@ Hostapd::Hostapd(std::string_view interfaceName) : throw HostapdException("Failed to create hostapd event handler control socket connection"); } - auto eventHandler{ std::make_unique(std::move(controlSocketConnection), WpaType::Hostapd) }; + auto eventHandler{ std::make_shared(std::move(controlSocketConnection), WpaType::Hostapd) }; if (!eventHandler) { throw HostapdException("Failed to create hostapd event handler"); } @@ -66,6 +66,12 @@ Hostapd::GetInterface() return m_interface; } +std::shared_ptr +Hostapd::GetEventHandler() const noexcept +{ + return m_eventHandler; +} + void Hostapd::Ping() { diff --git a/src/linux/wpa-controller/include/Wpa/Hostapd.hxx b/src/linux/wpa-controller/include/Wpa/Hostapd.hxx index 663720f4..ce1a20c5 100644 --- a/src/linux/wpa-controller/include/Wpa/Hostapd.hxx +++ b/src/linux/wpa-controller/include/Wpa/Hostapd.hxx @@ -93,6 +93,14 @@ struct Hostapd : std::string_view GetInterface() override; + /** + * @brief Obtain the event handler for the interface. + * + * @return std::shared_ptr + */ + std::shared_ptr + GetEventHandler() const noexcept override; + /** * @brief Get the status for the interface. * @@ -279,7 +287,7 @@ private: WpaController m_controller; std::unique_ptr m_eventHandlerControlSocketConnection{ nullptr }; std::shared_ptr m_eventListenerProxy; - std::unique_ptr m_eventHandler{ nullptr }; + std::shared_ptr m_eventHandler{ nullptr }; WpaEventListenerRegistrationToken m_eventHandlerRegistrationToken{}; }; } // namespace Wpa diff --git a/src/linux/wpa-controller/include/Wpa/IHostapd.hxx b/src/linux/wpa-controller/include/Wpa/IHostapd.hxx index a9fb0950..b76f6fc4 100644 --- a/src/linux/wpa-controller/include/Wpa/IHostapd.hxx +++ b/src/linux/wpa-controller/include/Wpa/IHostapd.hxx @@ -12,6 +12,7 @@ #include #include +#include namespace Wpa { @@ -90,6 +91,14 @@ struct IHostapd virtual std::string_view GetInterface() = 0; + /** + * @brief Obtain the event handler for the interface. + * + * @return std::shared_ptr + */ + virtual std::shared_ptr + GetEventHandler() const noexcept = 0; + /** * @brief Get the status for the interface. *