mirror of
https://github.com/esphome/esphome.git
synced 2026-05-30 07:16:11 +08:00
[ota] Use modernized namespace syntax (#15398)
This commit is contained in:
@@ -4,8 +4,7 @@
|
||||
|
||||
#include "esphome/core/automation.h"
|
||||
|
||||
namespace esphome {
|
||||
namespace ota {
|
||||
namespace esphome::ota {
|
||||
|
||||
class OTAStateChangeTrigger final : public Trigger<OTAState>, public OTAStateListener {
|
||||
public:
|
||||
@@ -67,6 +66,5 @@ class OTAErrorTrigger final : public Trigger<uint8_t>, public OTAStateListener {
|
||||
OTAComponent *parent_;
|
||||
};
|
||||
|
||||
} // namespace ota
|
||||
} // namespace esphome
|
||||
} // namespace esphome::ota
|
||||
#endif
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
#include "ota_backend.h"
|
||||
|
||||
namespace esphome {
|
||||
namespace ota {
|
||||
namespace esphome::ota {
|
||||
|
||||
#ifdef USE_OTA_STATE_LISTENER
|
||||
OTAGlobalCallback *global_ota_callback{nullptr}; // NOLINT(cppcoreguidelines-avoid-non-const-global-variables)
|
||||
@@ -34,5 +33,4 @@ void OTAComponent::notify_state_(OTAState state, float progress, uint8_t error)
|
||||
}
|
||||
#endif
|
||||
|
||||
} // namespace ota
|
||||
} // namespace esphome
|
||||
} // namespace esphome::ota
|
||||
|
||||
@@ -8,8 +8,7 @@
|
||||
#include <vector>
|
||||
#endif
|
||||
|
||||
namespace esphome {
|
||||
namespace ota {
|
||||
namespace esphome::ota {
|
||||
|
||||
enum OTAResponseTypes {
|
||||
OTA_RESPONSE_OK = 0x00,
|
||||
@@ -117,5 +116,4 @@ OTAGlobalCallback *get_global_ota_callback();
|
||||
// - notify_state_deferred_() when in separate task (e.g., web_server OTA)
|
||||
// This ensures proper listener execution in all contexts.
|
||||
#endif
|
||||
} // namespace ota
|
||||
} // namespace esphome
|
||||
} // namespace esphome::ota
|
||||
|
||||
@@ -7,8 +7,7 @@
|
||||
|
||||
#include <Update.h>
|
||||
|
||||
namespace esphome {
|
||||
namespace ota {
|
||||
namespace esphome::ota {
|
||||
|
||||
static const char *const TAG = "ota.arduino_libretiny";
|
||||
|
||||
@@ -66,7 +65,5 @@ OTAResponseTypes ArduinoLibreTinyOTABackend::end() {
|
||||
|
||||
void ArduinoLibreTinyOTABackend::abort() { Update.abort(); }
|
||||
|
||||
} // namespace ota
|
||||
} // namespace esphome
|
||||
|
||||
} // namespace esphome::ota
|
||||
#endif // USE_LIBRETINY
|
||||
|
||||
@@ -4,8 +4,7 @@
|
||||
|
||||
#include "esphome/core/defines.h"
|
||||
|
||||
namespace esphome {
|
||||
namespace ota {
|
||||
namespace esphome::ota {
|
||||
|
||||
class ArduinoLibreTinyOTABackend final {
|
||||
public:
|
||||
@@ -22,7 +21,5 @@ class ArduinoLibreTinyOTABackend final {
|
||||
|
||||
std::unique_ptr<ArduinoLibreTinyOTABackend> make_ota_backend();
|
||||
|
||||
} // namespace ota
|
||||
} // namespace esphome
|
||||
|
||||
} // namespace esphome::ota
|
||||
#endif // USE_LIBRETINY
|
||||
|
||||
@@ -9,8 +9,7 @@
|
||||
|
||||
#include <Updater.h>
|
||||
|
||||
namespace esphome {
|
||||
namespace ota {
|
||||
namespace esphome::ota {
|
||||
|
||||
static const char *const TAG = "ota.arduino_rp2040";
|
||||
|
||||
@@ -75,8 +74,6 @@ void ArduinoRP2040OTABackend::abort() {
|
||||
rp2040::preferences_prevent_write(false);
|
||||
}
|
||||
|
||||
} // namespace ota
|
||||
} // namespace esphome
|
||||
|
||||
} // namespace esphome::ota
|
||||
#endif // USE_RP2040
|
||||
#endif // USE_ARDUINO
|
||||
|
||||
@@ -6,8 +6,7 @@
|
||||
#include "esphome/core/defines.h"
|
||||
#include "esphome/core/macros.h"
|
||||
|
||||
namespace esphome {
|
||||
namespace ota {
|
||||
namespace esphome::ota {
|
||||
|
||||
class ArduinoRP2040OTABackend final {
|
||||
public:
|
||||
@@ -24,8 +23,6 @@ class ArduinoRP2040OTABackend final {
|
||||
|
||||
std::unique_ptr<ArduinoRP2040OTABackend> make_ota_backend();
|
||||
|
||||
} // namespace ota
|
||||
} // namespace esphome
|
||||
|
||||
} // namespace esphome::ota
|
||||
#endif // USE_RP2040
|
||||
#endif // USE_ARDUINO
|
||||
|
||||
@@ -8,8 +8,7 @@
|
||||
#include <esp_task_wdt.h>
|
||||
#include <spi_flash_mmap.h>
|
||||
|
||||
namespace esphome {
|
||||
namespace ota {
|
||||
namespace esphome::ota {
|
||||
|
||||
std::unique_ptr<IDFOTABackend> make_ota_backend() { return make_unique<IDFOTABackend>(); }
|
||||
|
||||
@@ -112,6 +111,5 @@ void IDFOTABackend::abort() {
|
||||
this->update_handle_ = 0;
|
||||
}
|
||||
|
||||
} // namespace ota
|
||||
} // namespace esphome
|
||||
} // namespace esphome::ota
|
||||
#endif // USE_ESP32
|
||||
|
||||
@@ -7,8 +7,7 @@
|
||||
|
||||
#include <esp_ota_ops.h>
|
||||
|
||||
namespace esphome {
|
||||
namespace ota {
|
||||
namespace esphome::ota {
|
||||
|
||||
class IDFOTABackend final {
|
||||
public:
|
||||
@@ -29,6 +28,5 @@ class IDFOTABackend final {
|
||||
|
||||
std::unique_ptr<IDFOTABackend> make_ota_backend();
|
||||
|
||||
} // namespace ota
|
||||
} // namespace esphome
|
||||
} // namespace esphome::ota
|
||||
#endif // USE_ESP32
|
||||
|
||||
Reference in New Issue
Block a user