FastLED 3.9.15
Loading...
Searching...
No Matches
fetch_request.h
Go to the documentation of this file.
1#pragma once
2
3#include "fl/task/promise.h"
4#include "fl/net/http/fetch.h" // Includes response class // IWYU pragma: keep
5#include "fl/stl/string.h"
6#include "fl/stl/url.h"
7#include "fl/stl/int.h"
8#include "fl/stl/noexcept.h"
9
10// Forward declaration for hostent (platform-specific type)
11struct hostent;
12
13namespace fl {
14namespace net {
15namespace http {
16
25public:
34
40
43
48 void update();
49
51 bool is_done() const { return mState == COMPLETED || mState == FAILED; }
52
54 State get_state() const { return mState; }
55
56private:
59
60 // Parsed URL
63 int mPort;
65
66 // Socket state
68 ::hostent* mDnsResult; // Use global namespace to avoid conflict
69
70 // Send/receive buffers
73 size_t mBytesSent;
74
75 // Timeouts
77
78 // State handlers
83
84 // Completion helpers
85 void complete_success(const Response& resp);
86 void complete_error(const char* message);
87
88 // Utilities
91};
92
93} // namespace http
94} // namespace net
95} // namespace fl
Fetch options builder (fluent interface)
Definition fetch.h:195
bool is_done() const
Check if request is complete (success or failure)
void update()
Pump the state machine (called by fl::task every update interval)
fl::task::Promise< Response > mPromise
void complete_error(const char *message)
State get_state() const
Get current state.
~FetchRequest() FL_NOEXCEPT
Destructor - closes socket if still open.
void complete_success(const Response &resp)
@ DNS_LOOKUP
Resolving hostname (brief blocking ~10-100ms)
@ RECEIVING
Receiving HTTP response (non-blocking)
@ SENDING
Sending HTTP request (non-blocking)
@ CONNECTING
Waiting for socket connection (non-blocking)
@ COMPLETED
Successfully completed.
Response parse_http_response(const fl::string &raw)
FetchRequest(const fl::string &url, const FetchOptions &opts, fl::task::Promise< Response > promise)
Construct a new fetch request.
HTTP response class (unified interface)
Definition fetch.h:78
Promise class that provides fluent .then() and .catch_() semantics This is a lightweight wrapper arou...
Definition promise.h:58
Definition url.h:15
Unified HTTP fetch API for FastLED (cross-platform)
Base definition for an LED controller.
Definition crgb.hpp:179
Promise-based fluent API for FastLED - standalone async primitives.
#define FL_NOEXCEPT
Lightweight URL parser for embedded environments.