ESPHome  2024.12.4
http_request_idf.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "http_request.h"
4 
5 #ifdef USE_ESP_IDF
6 
7 #include <esp_event.h>
8 #include <esp_http_client.h>
9 #include <esp_netif.h>
10 #include <esp_tls.h>
11 
12 namespace esphome {
13 namespace http_request {
14 
16  public:
17  HttpContainerIDF(esp_http_client_handle_t client) : client_(client) {}
18  int read(uint8_t *buf, size_t max_len) override;
19  void end() override;
20 
22  void feed_wdt();
23 
24  protected:
25  esp_http_client_handle_t client_;
26 };
27 
29  public:
30  void dump_config() override;
31 
32  std::shared_ptr<HttpContainer> start(std::string url, std::string method, std::string body,
33  std::list<Header> headers) override;
34 
35  void set_buffer_size_rx(uint16_t buffer_size_rx) { this->buffer_size_rx_ = buffer_size_rx; }
36  void set_buffer_size_tx(uint16_t buffer_size_tx) { this->buffer_size_tx_ = buffer_size_tx; }
37 
38  protected:
39  // if zero ESP-IDF will use DEFAULT_HTTP_BUF_SIZE
40  uint16_t buffer_size_rx_{};
41  uint16_t buffer_size_tx_{};
42 };
43 
44 } // namespace http_request
45 } // namespace esphome
46 
47 #endif // USE_ESP_IDF
int read(uint8_t *buf, size_t max_len) override
void feed_wdt()
Feeds the watchdog timer if the executing task has one attached.
void set_buffer_size_tx(uint16_t buffer_size_tx)
void set_buffer_size_rx(uint16_t buffer_size_rx)
Implementation of SPI Controller mode.
Definition: a01nyub.cpp:7
HttpContainerIDF(esp_http_client_handle_t client)