FastLED 3.9.15
Loading...
Searching...
No Matches
stream_client.h
Go to the documentation of this file.
1#pragma once
2
3#ifdef FASTLED_HAS_NETWORKING
4
6#include "fl/stl/asio/http/native_client.h" // IWYU pragma: keep
7#include "fl/stl/string.h"
8#include "fl/stl/unique_ptr.h"
9#include "fl/stl/noexcept.h"
10
11namespace fl {
12namespace net {
13namespace http {
14
20public:
25 HttpStreamClient(const fl::string& host, u16 port = 8080, u32 heartbeatIntervalMs = 30000);
26
28 ~HttpStreamClient() FL_NOEXCEPT override;
29
30 // Connection Management (override from HttpStreamTransport)
31
35 bool connect() override;
36
38 void disconnect() override;
39
42 bool isConnected() const override;
43
44protected:
45 // Abstract methods implementation (from HttpStreamTransport)
46
50 int sendData(fl::span<const u8> data) override;
51
55 int recvData(fl::span<u8> buffer) override;
56
58 void triggerReconnect() override;
59
60private:
64 bool sendHttpRequestHeader();
65
69 bool readHttpResponseHeader();
70
72 fl::unique_ptr<NativeHttpClient> mNativeClient;
73
75 bool mHttpHeaderSent;
76 bool mHttpHeaderReceived;
77
79 fl::string mHost;
80 u16 mPort;
81};
82
83} // namespace http
84} // namespace net
85} // namespace fl
86
87#endif // FASTLED_HAS_NETWORKING
Base class for HTTP streaming transport Implements RequestSource and ResponseSink for Remote class Ma...
unsigned char u8
Definition stdint.h:131
::fl::net::http::HttpStreamClient HttpStreamClient
Definition rpc.h:17
Base definition for an LED controller.
Definition crgb.hpp:179
#define FL_NOEXCEPT