mirror of
https://github.com/esphome/esphome.git
synced 2026-06-24 11:25:35 +00:00
Add the C++ `final` specifier to leaf, user-configurable component classes and automation action/trigger/condition primitives so that classes meant to be terminal cannot be subclassed by external components. Only classes never used as a base anywhere in the tree are marked. Part 19 of 21, split alphabetically by component (uart .. wl_134).
36 lines
1.0 KiB
C++
36 lines
1.0 KiB
C++
#pragma once
|
|
#include "esphome/core/defines.h"
|
|
#if defined(USE_NETWORK) && !defined(USE_ZEPHYR)
|
|
#include "esphome/components/button/button.h"
|
|
#include "esphome/core/component.h"
|
|
#if defined(USE_SOCKET_IMPL_BSD_SOCKETS) || defined(USE_SOCKET_IMPL_LWIP_SOCKETS)
|
|
#include "esphome/components/socket/socket.h"
|
|
#else
|
|
#include "WiFiUdp.h"
|
|
#endif
|
|
|
|
namespace esphome::wake_on_lan {
|
|
|
|
class WakeOnLanButton final : public button::Button, public Component {
|
|
public:
|
|
void set_macaddr(uint8_t a, uint8_t b, uint8_t c, uint8_t d, uint8_t e, uint8_t f);
|
|
|
|
void dump_config() override;
|
|
void setup() override;
|
|
float get_setup_priority() const override { return setup_priority::AFTER_WIFI; }
|
|
|
|
protected:
|
|
#if defined(USE_SOCKET_IMPL_BSD_SOCKETS) || defined(USE_SOCKET_IMPL_LWIP_SOCKETS)
|
|
std::unique_ptr<socket::Socket> broadcast_socket_{};
|
|
#else
|
|
WiFiUDP udp_client_{};
|
|
#endif
|
|
void press_action() override;
|
|
uint16_t port_{9};
|
|
uint8_t macaddr_[6];
|
|
};
|
|
|
|
} // namespace esphome::wake_on_lan
|
|
|
|
#endif // USE_NETWORK && !USE_ZEPHYR
|