61 std::string_view client_id,
62 std::chrono::milliseconds timeout = std::chrono::seconds(30));
86 auto set_path(std::string_view path) -> void;
101 [[nodiscard]]
auto is_running() const ->
bool override;
108 [[nodiscard]] auto
start(std::string_view host, uint16_t port) ->
VoidResult override;
110 [[nodiscard]] auto
send(std::vector<uint8_t>&& data) ->
VoidResult override;
111 [[nodiscard]] auto
is_connected() const ->
bool override;
113 auto
set_observer(std::shared_ptr<interfaces::connection_observer> observer) ->
void override;
124 [[nodiscard]] auto
build_url() const -> std::
string;
149 std::shared_ptr<interfaces::connection_observer>
observer_;
Unified interface for all protocol client implementations.
std::function< void(const std::vector< uint8_t > &)> receive_callback_t
Callback type for received data.
std::function< void()> connected_callback_t
Callback type for connection established.
std::function< void(std::error_code)> error_callback_t
Callback type for errors.
std::function< void()> disconnected_callback_t
Callback type for disconnection.
Adapter that wraps http_client to implement i_protocol_client.
auto notify_error(std::error_code ec) -> void
Notifies observers/callbacks of errors.
std::atomic< bool > is_running_
auto set_receive_callback(receive_callback_t callback) -> void override
Sets the callback for received data.
auto wait_for_stop() -> void override
Blocks until the component has stopped.
auto notify_receive(const std::vector< uint8_t > &data) -> void
Notifies observers/callbacks of received data.
auto set_use_ssl(bool use_ssl) -> void
Sets whether to use HTTPS.
disconnected_callback_t disconnected_callback_
error_callback_t error_callback_
auto set_error_callback(error_callback_t callback) -> void override
Sets the callback for errors.
auto build_url() const -> std::string
Builds the full URL from stored components.
auto set_path(std::string_view path) -> void
Sets the HTTP path for requests.
std::shared_ptr< core::http_client > client_
http_client_adapter(const http_client_adapter &)=delete
http_client_adapter(std::string_view client_id, std::chrono::milliseconds timeout=std::chrono::seconds(30))
Constructs an adapter with timeout configuration.
auto is_connected() const -> bool override
Checks if the client is connected to the server.
auto set_disconnected_callback(disconnected_callback_t callback) -> void override
Sets the callback for disconnection.
auto stop() -> VoidResult override
Stops the client and closes the connection.
std::chrono::milliseconds timeout_
auto start(std::string_view host, uint16_t port) -> VoidResult override
Starts the client and connects to the specified server.
~http_client_adapter() override
Destructor ensures proper cleanup.
auto is_running() const -> bool override
Checks if the component is currently running.
std::shared_ptr< interfaces::connection_observer > observer_
auto set_connected_callback(connected_callback_t callback) -> void override
Sets the callback for connection established.
std::mutex callbacks_mutex_
http_client_adapter(http_client_adapter &&)=delete
http_client_adapter & operator=(http_client_adapter &&)=delete
receive_callback_t receive_callback_
connected_callback_t connected_callback_
auto set_observer(std::shared_ptr< interfaces::connection_observer > observer) -> void override
Sets the connection observer for unified event handling.
http_client_adapter & operator=(const http_client_adapter &)=delete
Protocol-specific client interface extending i_client.