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