ESPHome  2024.11.1
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 
21  protected:
22  esp_http_client_handle_t client_;
23 };
24 
26  public:
27  void dump_config() override;
28 
29  std::shared_ptr<HttpContainer> start(std::string url, std::string method, std::string body,
30  std::list<Header> headers) override;
31 
32  void set_buffer_size_rx(uint16_t buffer_size_rx) { this->buffer_size_rx_ = buffer_size_rx; }
33  void set_buffer_size_tx(uint16_t buffer_size_tx) { this->buffer_size_tx_ = buffer_size_tx; }
34 
35  protected:
36  // if zero ESP-IDF will use DEFAULT_HTTP_BUF_SIZE
37  uint16_t buffer_size_rx_{};
38  uint16_t buffer_size_tx_{};
39 };
40 
41 } // namespace http_request
42 } // namespace esphome
43 
44 #endif // USE_ESP_IDF
int read(uint8_t *buf, size_t max_len) override
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)