Ersa Wearable Platform
Embedded smartwatch firmware and application framework
Loading...
Searching...
No Matches
esp32_network_client.h
Go to the documentation of this file.
1#pragma once
2
3#if defined(ARDUINO)
5#include <HTTPClient.h>
6#include <WiFiClientSecure.h>
7#include <array>
8
9namespace ersa::hal {
10
12class Esp32HttpClient final : public IHttpClient {
13public:
14 Result<void> begin(std::string_view url, bool skipTlsVerification) override;
15 void setTimeout(uint32_t timeoutMs) override;
16 void setFollowRedirects(bool enabled) override;
17 void setBasicAuth(std::string_view user, std::string_view password) override;
18 void addHeader(std::string_view name, std::string_view value) override;
19 void collectHeader(std::string_view name) override;
20 int get() override;
21 int statusCode() const override;
22 bool hasHeader(std::string_view name) const override;
23 std::string header(std::string_view name) const override;
24 std::string body() override;
25 bool connected() const override;
26 int available() const override;
27 std::string readLine() override;
28 int lastTransportError(char* message, size_t capacity) const override;
29 void end() override;
30private:
31 WiFiClientSecure client_;
32 HTTPClient http_;
33 std::array<std::array<char, 40>, 8> headerNames_{};
34 std::array<const char*, 8> headerPointers_{};
35 size_t headerCount_{0};
36 int statusCode_{0};
37};
38
40class Esp32NtpTimeSource final : public INtpTimeSource {
41public:
42 bool synchronizeUtc(uint32_t timeoutMs, uint32_t& epochSeconds) override;
43};
44
45} // namespace ersa::hal
46#endif
void begin()
Definition app_agenda.cpp:27
const Config & get()
Definition watch_config.cpp:98
Definition battery.h:7
uint32_t end
Definition ota_service.cpp:93