ESPHome 2026.8.0b4
Loading...
Searching...
No Matches
ota_backend_factory.h
Go to the documentation of this file.
1#pragma once
2
3#include "ota_backend.h"
4
5#include <memory>
6
7#ifdef USE_ESP8266
9#elif defined(USE_ESP32)
10#include "ota_backend_esp_idf.h"
11#elif defined(USE_RP2)
13#elif defined(USE_LIBRETINY)
15#elif defined(USE_HOST)
16#include "ota_backend_host.h"
17#else
18// Stub for static analysis when no platform is defined
19namespace esphome::ota {
21 OTAResponseTypes begin(size_t image_size, OTAType ota_type = OTA_TYPE_UPDATE_APP) {
23 }
24 void set_update_md5(const char *md5) {}
25 OTAResponseTypes write(uint8_t *data, size_t len) { return OTA_RESPONSE_ERROR_UNKNOWN; }
27 void abort() {}
28 bool supports_compression() { return false; }
29};
30std::unique_ptr<StubOTABackend> make_ota_backend();
31} // namespace esphome::ota
32#endif
33
34namespace esphome::ota {
35using OTABackendPtr = decltype(make_ota_backend());
37 "The platform's OTA backend is missing part of the backend surface (ota_backend.h)");
38} // namespace esphome::ota
decltype(make_ota_backend()) OTABackendPtr
@ OTA_RESPONSE_ERROR_UNKNOWN
Definition ota_backend.h:52
std::unique_ptr< ArduinoLibreTinyOTABackend > make_ota_backend()
const void size_t len
Definition hal.h:64
void set_update_md5(const char *md5)
OTAResponseTypes begin(size_t image_size, OTAType ota_type=OTA_TYPE_UPDATE_APP)
OTAResponseTypes write(uint8_t *data, size_t len)