1
0
mirror of https://github.com/esphome/esphome.git synced 2025-02-23 05:18:15 +00:00
esphome/esphome/components/ota/ota_backend.cpp
Keith Burzinski f46c499c4e
Separate OTABackend from OTA component (#6459)
Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
2024-05-16 14:01:09 +12:00

21 lines
587 B
C++

#include "ota_backend.h"
namespace esphome {
namespace ota {
#ifdef USE_OTA_STATE_CALLBACK
OTAGlobalCallback *global_ota_callback{nullptr}; // NOLINT(cppcoreguidelines-avoid-non-const-global-variables)
OTAGlobalCallback *get_global_ota_callback() {
if (global_ota_callback == nullptr) {
global_ota_callback = new OTAGlobalCallback(); // NOLINT(cppcoreguidelines-owning-memory)
}
return global_ota_callback;
}
void register_ota_platform(OTAComponent *ota_caller) { get_global_ota_callback()->register_ota(ota_caller); }
#endif
} // namespace ota
} // namespace esphome