mirror of
https://github.com/esphome/esphome.git
synced 2026-06-24 09:39:42 +00:00
Mark user-configurable classes as final (part 19/21)
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).
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
|
||||
namespace esphome::uart {
|
||||
|
||||
template<typename... Ts> class UARTWriteAction : public Action<Ts...>, public Parented<UARTComponent> {
|
||||
template<typename... Ts> class UARTWriteAction final : public Action<Ts...>, public Parented<UARTComponent> {
|
||||
public:
|
||||
void set_data_template(std::vector<uint8_t> (*func)(Ts...)) {
|
||||
// Stateless lambdas (generated by ESPHome) implicitly convert to function pointers
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
namespace esphome::uart {
|
||||
|
||||
class UARTButton : public button::Button, public UARTDevice, public Component {
|
||||
class UARTButton final : public button::Button, public UARTDevice, public Component {
|
||||
public:
|
||||
void set_data(std::vector<uint8_t> &&data) { this->data_ = std::move(data); }
|
||||
void set_data(std::initializer_list<uint8_t> data) { this->data_ = std::vector<uint8_t>(data); }
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
namespace esphome::uart {
|
||||
|
||||
class UARTEvent : public event::Event, public UARTDevice, public Component {
|
||||
class UARTEvent final : public event::Event, public UARTDevice, public Component {
|
||||
public:
|
||||
void setup() override;
|
||||
void loop() override;
|
||||
|
||||
@@ -20,7 +20,7 @@ static const uint16_t MAX_PACKET_SIZE = 508;
|
||||
static const uint8_t FLAG_BYTE = 0x7E;
|
||||
static const uint8_t CONTROL_BYTE = 0x7D;
|
||||
|
||||
class UARTTransport : public packet_transport::PacketTransport, public UARTDevice {
|
||||
class UARTTransport final : public packet_transport::PacketTransport, public UARTDevice {
|
||||
public:
|
||||
void loop() override;
|
||||
float get_setup_priority() const override { return setup_priority::PROCESSOR; }
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
namespace esphome::uart {
|
||||
|
||||
class UARTSwitch : public switch_::Switch, public UARTDevice, public Component {
|
||||
class UARTSwitch final : public switch_::Switch, public UARTDevice, public Component {
|
||||
public:
|
||||
void loop() override;
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ class ESP8266SoftwareSerial {
|
||||
ISRInternalGPIOPin rx_pin_;
|
||||
};
|
||||
|
||||
class ESP8266UartComponent : public UARTComponent, public Component {
|
||||
class ESP8266UartComponent final : public UARTComponent, public Component {
|
||||
public:
|
||||
void setup() override;
|
||||
void dump_config() override;
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace esphome::uart {
|
||||
/// Thread safety: All public methods must only be called from the main loop.
|
||||
/// The ESP-IDF UART driver API does not guarantee thread safety, and ESPHome's
|
||||
/// peek byte state (has_peek_/peek_byte_) is not synchronized.
|
||||
class IDFUARTComponent : public UARTComponent, public Component {
|
||||
class IDFUARTComponent final : public UARTComponent, public Component {
|
||||
public:
|
||||
void setup() override;
|
||||
void dump_config() override;
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
namespace esphome::uart {
|
||||
|
||||
class HostUartComponent : public UARTComponent, public Component {
|
||||
class HostUartComponent final : public UARTComponent, public Component {
|
||||
public:
|
||||
virtual ~HostUartComponent();
|
||||
void setup() override;
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
namespace esphome::uart {
|
||||
|
||||
class LibreTinyUARTComponent : public UARTComponent, public Component {
|
||||
class LibreTinyUARTComponent final : public UARTComponent, public Component {
|
||||
public:
|
||||
void setup() override;
|
||||
void dump_config() override;
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
namespace esphome::uart {
|
||||
|
||||
class RP2040UartComponent : public UARTComponent, public Component {
|
||||
class RP2040UartComponent final : public UARTComponent, public Component {
|
||||
public:
|
||||
void setup() override;
|
||||
void dump_config() override;
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace esphome::uart {
|
||||
/// 'appropriate time' means exactly, is determined by a number of
|
||||
/// configurable constraints. E.g. when a given number of bytes is gathered
|
||||
/// and/or when no more data has been seen for a given time interval.
|
||||
class UARTDebugger : public Component, public Trigger<UARTDirection, std::vector<uint8_t>, StringRef> {
|
||||
class UARTDebugger final : public Component, public Trigger<UARTDirection, std::vector<uint8_t>, StringRef> {
|
||||
public:
|
||||
explicit UARTDebugger(UARTComponent *parent);
|
||||
void loop() override;
|
||||
@@ -73,7 +73,7 @@ class UARTDebugger : public Component, public Trigger<UARTDirection, std::vector
|
||||
/// debugger is used to reverse engineer a serial protocol, for which no
|
||||
/// specific UARTDevice implementation exists (yet), but for which the
|
||||
/// incoming bytes must be read to drive the debugger.
|
||||
class UARTDummyReceiver : public Component, public UARTDevice {
|
||||
class UARTDummyReceiver final : public Component, public UARTDevice {
|
||||
public:
|
||||
UARTDummyReceiver(UARTComponent *parent) : UARTDevice(parent) {}
|
||||
void loop() override;
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
namespace esphome::udp {
|
||||
|
||||
template<typename... Ts> class UDPWriteAction : public Action<Ts...>, public Parented<UDPComponent> {
|
||||
template<typename... Ts> class UDPWriteAction final : public Action<Ts...>, public Parented<UDPComponent> {
|
||||
public:
|
||||
void set_data_template(std::vector<uint8_t> (*func)(Ts...)) {
|
||||
this->data_.func = func;
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
namespace esphome::udp {
|
||||
|
||||
class UDPTransport : public packet_transport::PacketTransport, public Parented<UDPComponent> {
|
||||
class UDPTransport final : public packet_transport::PacketTransport, public Parented<UDPComponent> {
|
||||
public:
|
||||
void setup() override;
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
namespace esphome::udp {
|
||||
|
||||
static const size_t MAX_PACKET_SIZE = 508;
|
||||
class UDPComponent : public Component {
|
||||
class UDPComponent final : public Component {
|
||||
public:
|
||||
void set_addresses(std::initializer_list<const char *> addresses) { this->addresses_ = addresses; }
|
||||
/// Prevent accidental use of std::string which would dangle
|
||||
|
||||
@@ -24,7 +24,7 @@ static const uint8_t COMMAND_CALIBRATE_PROBE = 20;
|
||||
static const uint8_t COMMAND_MEASURE_TEMP = 40;
|
||||
static const uint8_t COMMAND_MEASURE_EC = 80;
|
||||
|
||||
class UFireECComponent : public PollingComponent, public i2c::I2CDevice {
|
||||
class UFireECComponent final : public PollingComponent, public i2c::I2CDevice {
|
||||
public:
|
||||
void setup() override;
|
||||
void update() override;
|
||||
@@ -58,7 +58,7 @@ class UFireECComponent : public PollingComponent, public i2c::I2CDevice {
|
||||
float temperature_coefficient_{0.0};
|
||||
};
|
||||
|
||||
template<typename... Ts> class UFireECCalibrateProbeAction : public Action<Ts...> {
|
||||
template<typename... Ts> class UFireECCalibrateProbeAction final : public Action<Ts...> {
|
||||
public:
|
||||
UFireECCalibrateProbeAction(UFireECComponent *parent) : parent_(parent) {}
|
||||
TEMPLATABLE_VALUE(float, solution)
|
||||
@@ -72,7 +72,7 @@ template<typename... Ts> class UFireECCalibrateProbeAction : public Action<Ts...
|
||||
UFireECComponent *parent_;
|
||||
};
|
||||
|
||||
template<typename... Ts> class UFireECResetAction : public Action<Ts...> {
|
||||
template<typename... Ts> class UFireECResetAction final : public Action<Ts...> {
|
||||
public:
|
||||
UFireECResetAction(UFireECComponent *parent) : parent_(parent) {}
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ static const uint8_t COMMAND_CALIBRATE_LOW = 10;
|
||||
static const uint8_t COMMAND_MEASURE_TEMP = 40;
|
||||
static const uint8_t COMMAND_MEASURE_MV = 80;
|
||||
|
||||
class UFireISEComponent : public PollingComponent, public i2c::I2CDevice {
|
||||
class UFireISEComponent final : public PollingComponent, public i2c::I2CDevice {
|
||||
public:
|
||||
void setup() override;
|
||||
void update() override;
|
||||
@@ -58,7 +58,7 @@ class UFireISEComponent : public PollingComponent, public i2c::I2CDevice {
|
||||
sensor::Sensor *ph_sensor_{nullptr};
|
||||
};
|
||||
|
||||
template<typename... Ts> class UFireISECalibrateProbeLowAction : public Action<Ts...> {
|
||||
template<typename... Ts> class UFireISECalibrateProbeLowAction final : public Action<Ts...> {
|
||||
public:
|
||||
UFireISECalibrateProbeLowAction(UFireISEComponent *parent) : parent_(parent) {}
|
||||
TEMPLATABLE_VALUE(float, solution)
|
||||
@@ -69,7 +69,7 @@ template<typename... Ts> class UFireISECalibrateProbeLowAction : public Action<T
|
||||
UFireISEComponent *parent_;
|
||||
};
|
||||
|
||||
template<typename... Ts> class UFireISECalibrateProbeHighAction : public Action<Ts...> {
|
||||
template<typename... Ts> class UFireISECalibrateProbeHighAction final : public Action<Ts...> {
|
||||
public:
|
||||
UFireISECalibrateProbeHighAction(UFireISEComponent *parent) : parent_(parent) {}
|
||||
TEMPLATABLE_VALUE(float, solution)
|
||||
@@ -80,7 +80,7 @@ template<typename... Ts> class UFireISECalibrateProbeHighAction : public Action<
|
||||
UFireISEComponent *parent_;
|
||||
};
|
||||
|
||||
template<typename... Ts> class UFireISEResetAction : public Action<Ts...> {
|
||||
template<typename... Ts> class UFireISEResetAction final : public Action<Ts...> {
|
||||
public:
|
||||
UFireISEResetAction(UFireISEComponent *parent) : parent_(parent) {}
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ enum ULN2003StepMode {
|
||||
ULN2003_STEP_MODE_WAVE_DRIVE,
|
||||
};
|
||||
|
||||
class ULN2003 : public stepper::Stepper, public Component {
|
||||
class ULN2003 final : public stepper::Stepper, public Component {
|
||||
public:
|
||||
void set_pin_a(GPIOPin *pin_a) { pin_a_ = pin_a; }
|
||||
void set_pin_b(GPIOPin *pin_b) { pin_b_ = pin_b; }
|
||||
|
||||
@@ -18,7 +18,7 @@ struct UltrasonicSensorStore {
|
||||
volatile bool echo_end{false};
|
||||
};
|
||||
|
||||
class UltrasonicSensorComponent : public sensor::Sensor, public PollingComponent {
|
||||
class UltrasonicSensorComponent final : public sensor::Sensor, public PollingComponent {
|
||||
public:
|
||||
void set_trigger_pin(InternalGPIOPin *trigger_pin) { this->trigger_pin_ = trigger_pin; }
|
||||
void set_echo_pin(InternalGPIOPin *echo_pin) { this->echo_pin_ = echo_pin; }
|
||||
|
||||
@@ -6,19 +6,19 @@
|
||||
|
||||
namespace esphome::update {
|
||||
|
||||
template<typename... Ts> class PerformAction : public Action<Ts...>, public Parented<UpdateEntity> {
|
||||
template<typename... Ts> class PerformAction final : public Action<Ts...>, public Parented<UpdateEntity> {
|
||||
TEMPLATABLE_VALUE(bool, force)
|
||||
|
||||
public:
|
||||
void play(const Ts &...x) override { this->parent_->perform(this->force_.value(x...)); }
|
||||
};
|
||||
|
||||
template<typename... Ts> class CheckAction : public Action<Ts...>, public Parented<UpdateEntity> {
|
||||
template<typename... Ts> class CheckAction final : public Action<Ts...>, public Parented<UpdateEntity> {
|
||||
public:
|
||||
void play(const Ts &...x) override { this->parent_->check(); }
|
||||
};
|
||||
|
||||
template<typename... Ts> class IsAvailableCondition : public Condition<Ts...>, public Parented<UpdateEntity> {
|
||||
template<typename... Ts> class IsAvailableCondition final : public Condition<Ts...>, public Parented<UpdateEntity> {
|
||||
public:
|
||||
bool check(const Ts &...x) override { return this->parent_->state == UPDATE_STATE_AVAILABLE; }
|
||||
};
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
namespace esphome::uponor_smatrix {
|
||||
|
||||
class UponorSmatrixClimate : public climate::Climate, public Component, public UponorSmatrixDevice {
|
||||
class UponorSmatrixClimate final : public climate::Climate, public Component, public UponorSmatrixDevice {
|
||||
public:
|
||||
void dump_config() override;
|
||||
void loop() override;
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
namespace esphome::uponor_smatrix {
|
||||
|
||||
class UponorSmatrixSensor : public sensor::Sensor, public Component, public UponorSmatrixDevice {
|
||||
class UponorSmatrixSensor final : public sensor::Sensor, public Component, public UponorSmatrixDevice {
|
||||
SUB_SENSOR(temperature)
|
||||
SUB_SENSOR(external_temperature)
|
||||
SUB_SENSOR(humidity)
|
||||
|
||||
@@ -62,7 +62,7 @@ struct UponorSmatrixData {
|
||||
|
||||
class UponorSmatrixDevice;
|
||||
|
||||
class UponorSmatrixComponent : public uart::UARTDevice, public Component {
|
||||
class UponorSmatrixComponent final : public uart::UARTDevice, public Component {
|
||||
public:
|
||||
UponorSmatrixComponent() = default;
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
namespace esphome::uptime {
|
||||
|
||||
class UptimeSecondsSensor : public sensor::Sensor, public PollingComponent {
|
||||
class UptimeSecondsSensor final : public sensor::Sensor, public PollingComponent {
|
||||
public:
|
||||
void update() override;
|
||||
void dump_config() override;
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
namespace esphome::uptime {
|
||||
|
||||
class UptimeTimestampSensor : public sensor::Sensor, public Component {
|
||||
class UptimeTimestampSensor final : public sensor::Sensor, public Component {
|
||||
public:
|
||||
void setup() override;
|
||||
void dump_config() override;
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
namespace esphome::uptime {
|
||||
|
||||
class UptimeTextSensor : public text_sensor::TextSensor, public PollingComponent {
|
||||
class UptimeTextSensor final : public text_sensor::TextSensor, public PollingComponent {
|
||||
public:
|
||||
UptimeTextSensor(const char *days_text, const char *hours_text, const char *minutes_text, const char *seconds_text,
|
||||
const char *separator, bool expand)
|
||||
|
||||
@@ -50,7 +50,7 @@ struct CDCEvent {
|
||||
class USBCDCACMComponent;
|
||||
|
||||
/// Represents a single CDC ACM interface instance
|
||||
class USBCDCACMInstance : public uart::UARTComponent, public Parented<USBCDCACMComponent> {
|
||||
class USBCDCACMInstance final : public uart::UARTComponent, public Parented<USBCDCACMComponent> {
|
||||
public:
|
||||
void setup();
|
||||
void loop();
|
||||
@@ -111,7 +111,7 @@ class USBCDCACMInstance : public uart::UARTComponent, public Parented<USBCDCACMC
|
||||
};
|
||||
|
||||
/// Main USB CDC ACM component that manages the USB device and all CDC interfaces
|
||||
class USBCDCACMComponent : public Component {
|
||||
class USBCDCACMComponent final : public Component {
|
||||
public:
|
||||
USBCDCACMComponent();
|
||||
|
||||
|
||||
@@ -183,7 +183,7 @@ class USBClient : public Component {
|
||||
uint16_t vid_{};
|
||||
uint16_t pid_{};
|
||||
};
|
||||
class USBHost : public Component {
|
||||
class USBHost final : public Component {
|
||||
public:
|
||||
float get_setup_priority() const override { return setup_priority::BUS; }
|
||||
void loop() override;
|
||||
|
||||
@@ -125,7 +125,7 @@ struct UsbOutputChunk {
|
||||
void release() {}
|
||||
};
|
||||
|
||||
class USBUartChannel : public uart::UARTComponent, public Parented<USBUartComponent> {
|
||||
class USBUartChannel final : public uart::UARTComponent, public Parented<USBUartComponent> {
|
||||
friend class USBUartComponent;
|
||||
friend class USBUartTypeCdcAcm;
|
||||
friend class USBUartTypeCP210X;
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
namespace esphome::valve {
|
||||
|
||||
template<typename... Ts> class OpenAction : public Action<Ts...> {
|
||||
template<typename... Ts> class OpenAction final : public Action<Ts...> {
|
||||
public:
|
||||
explicit OpenAction(Valve *valve) : valve_(valve) {}
|
||||
|
||||
@@ -16,7 +16,7 @@ template<typename... Ts> class OpenAction : public Action<Ts...> {
|
||||
Valve *valve_;
|
||||
};
|
||||
|
||||
template<typename... Ts> class CloseAction : public Action<Ts...> {
|
||||
template<typename... Ts> class CloseAction final : public Action<Ts...> {
|
||||
public:
|
||||
explicit CloseAction(Valve *valve) : valve_(valve) {}
|
||||
|
||||
@@ -26,7 +26,7 @@ template<typename... Ts> class CloseAction : public Action<Ts...> {
|
||||
Valve *valve_;
|
||||
};
|
||||
|
||||
template<typename... Ts> class StopAction : public Action<Ts...> {
|
||||
template<typename... Ts> class StopAction final : public Action<Ts...> {
|
||||
public:
|
||||
explicit StopAction(Valve *valve) : valve_(valve) {}
|
||||
|
||||
@@ -36,7 +36,7 @@ template<typename... Ts> class StopAction : public Action<Ts...> {
|
||||
Valve *valve_;
|
||||
};
|
||||
|
||||
template<typename... Ts> class ToggleAction : public Action<Ts...> {
|
||||
template<typename... Ts> class ToggleAction final : public Action<Ts...> {
|
||||
public:
|
||||
explicit ToggleAction(Valve *valve) : valve_(valve) {}
|
||||
|
||||
@@ -58,7 +58,7 @@ template<typename... Ts> class ToggleAction : public Action<Ts...> {
|
||||
// (e.g. `const T & &` if Ts already carries a reference, or `const const
|
||||
// T &` if Ts already carries a const). This keeps trigger args no-copy
|
||||
// regardless of whether the trigger supplies `T`, `T &`, or `const T &`.
|
||||
template<typename... Ts> class ControlAction : public Action<Ts...> {
|
||||
template<typename... Ts> class ControlAction final : public Action<Ts...> {
|
||||
public:
|
||||
using ApplyFn = void (*)(ValveCall &, const std::remove_cvref_t<Ts> &...);
|
||||
ControlAction(Valve *valve, ApplyFn apply) : valve_(valve), apply_(apply) {}
|
||||
@@ -74,7 +74,7 @@ template<typename... Ts> class ControlAction : public Action<Ts...> {
|
||||
ApplyFn apply_;
|
||||
};
|
||||
|
||||
template<typename... Ts> class ValveIsOpenCondition : public Condition<Ts...> {
|
||||
template<typename... Ts> class ValveIsOpenCondition final : public Condition<Ts...> {
|
||||
public:
|
||||
ValveIsOpenCondition(Valve *valve) : valve_(valve) {}
|
||||
bool check(const Ts &...x) override { return this->valve_->is_fully_open(); }
|
||||
@@ -83,7 +83,7 @@ template<typename... Ts> class ValveIsOpenCondition : public Condition<Ts...> {
|
||||
Valve *valve_;
|
||||
};
|
||||
|
||||
template<typename... Ts> class ValveIsClosedCondition : public Condition<Ts...> {
|
||||
template<typename... Ts> class ValveIsClosedCondition final : public Condition<Ts...> {
|
||||
public:
|
||||
ValveIsClosedCondition(Valve *valve) : valve_(valve) {}
|
||||
bool check(const Ts &...x) override { return this->valve_->is_fully_closed(); }
|
||||
@@ -92,7 +92,7 @@ template<typename... Ts> class ValveIsClosedCondition : public Condition<Ts...>
|
||||
Valve *valve_;
|
||||
};
|
||||
|
||||
class ValveOpenTrigger : public Trigger<> {
|
||||
class ValveOpenTrigger final : public Trigger<> {
|
||||
public:
|
||||
ValveOpenTrigger(Valve *a_valve) : valve_(a_valve) {
|
||||
a_valve->add_on_state_callback([this]() {
|
||||
@@ -106,7 +106,7 @@ class ValveOpenTrigger : public Trigger<> {
|
||||
Valve *valve_;
|
||||
};
|
||||
|
||||
class ValveClosedTrigger : public Trigger<> {
|
||||
class ValveClosedTrigger final : public Trigger<> {
|
||||
public:
|
||||
ValveClosedTrigger(Valve *a_valve) : valve_(a_valve) {
|
||||
a_valve->add_on_state_callback([this]() {
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
namespace esphome::vbus {
|
||||
|
||||
class DeltaSolBSPlusBSensor : public VBusListener, public Component {
|
||||
class DeltaSolBSPlusBSensor final : public VBusListener, public Component {
|
||||
public:
|
||||
void dump_config() override;
|
||||
void set_relay1_bsensor(binary_sensor::BinarySensor *bsensor) { this->relay1_bsensor_ = bsensor; }
|
||||
@@ -38,7 +38,7 @@ class DeltaSolBSPlusBSensor : public VBusListener, public Component {
|
||||
void handle_message(std::vector<uint8_t> &message) override;
|
||||
};
|
||||
|
||||
class DeltaSolBS2009BSensor : public VBusListener, public Component {
|
||||
class DeltaSolBS2009BSensor final : public VBusListener, public Component {
|
||||
public:
|
||||
void dump_config() override;
|
||||
void set_s1_error_bsensor(binary_sensor::BinarySensor *bsensor) { this->s1_error_bsensor_ = bsensor; }
|
||||
@@ -59,7 +59,7 @@ class DeltaSolBS2009BSensor : public VBusListener, public Component {
|
||||
void handle_message(std::vector<uint8_t> &message) override;
|
||||
};
|
||||
|
||||
class DeltaSolCBSensor : public VBusListener, public Component {
|
||||
class DeltaSolCBSensor final : public VBusListener, public Component {
|
||||
public:
|
||||
void dump_config() override;
|
||||
void set_s1_error_bsensor(binary_sensor::BinarySensor *bsensor) { this->s1_error_bsensor_ = bsensor; }
|
||||
@@ -76,7 +76,7 @@ class DeltaSolCBSensor : public VBusListener, public Component {
|
||||
void handle_message(std::vector<uint8_t> &message) override;
|
||||
};
|
||||
|
||||
class DeltaSolCS2BSensor : public VBusListener, public Component {
|
||||
class DeltaSolCS2BSensor final : public VBusListener, public Component {
|
||||
public:
|
||||
void dump_config() override;
|
||||
void set_s1_error_bsensor(binary_sensor::BinarySensor *bsensor) { this->s1_error_bsensor_ = bsensor; }
|
||||
@@ -93,7 +93,7 @@ class DeltaSolCS2BSensor : public VBusListener, public Component {
|
||||
void handle_message(std::vector<uint8_t> &message) override;
|
||||
};
|
||||
|
||||
class DeltaSolCS4BSensor : public VBusListener, public Component {
|
||||
class DeltaSolCS4BSensor final : public VBusListener, public Component {
|
||||
public:
|
||||
void dump_config() override;
|
||||
void set_s1_error_bsensor(binary_sensor::BinarySensor *bsensor) { this->s1_error_bsensor_ = bsensor; }
|
||||
@@ -110,7 +110,7 @@ class DeltaSolCS4BSensor : public VBusListener, public Component {
|
||||
void handle_message(std::vector<uint8_t> &message) override;
|
||||
};
|
||||
|
||||
class DeltaSolCSPlusBSensor : public VBusListener, public Component {
|
||||
class DeltaSolCSPlusBSensor final : public VBusListener, public Component {
|
||||
public:
|
||||
void dump_config() override;
|
||||
void set_s1_error_bsensor(binary_sensor::BinarySensor *bsensor) { this->s1_error_bsensor_ = bsensor; }
|
||||
@@ -127,7 +127,7 @@ class DeltaSolCSPlusBSensor : public VBusListener, public Component {
|
||||
void handle_message(std::vector<uint8_t> &message) override;
|
||||
};
|
||||
|
||||
class DeltaSolBS2BSensor : public VBusListener, public Component {
|
||||
class DeltaSolBS2BSensor final : public VBusListener, public Component {
|
||||
public:
|
||||
void dump_config() override;
|
||||
void set_s1_error_bsensor(binary_sensor::BinarySensor *bsensor) { this->s1_error_bsensor_ = bsensor; }
|
||||
@@ -146,7 +146,7 @@ class DeltaSolBS2BSensor : public VBusListener, public Component {
|
||||
|
||||
class VBusCustomSubBSensor;
|
||||
|
||||
class VBusCustomBSensor : public VBusListener, public Component {
|
||||
class VBusCustomBSensor final : public VBusListener, public Component {
|
||||
public:
|
||||
void dump_config() override;
|
||||
void set_bsensors(std::vector<VBusCustomSubBSensor *> bsensors) { this->bsensors_ = std::move(bsensors); };
|
||||
@@ -156,7 +156,7 @@ class VBusCustomBSensor : public VBusListener, public Component {
|
||||
void handle_message(std::vector<uint8_t> &message) override;
|
||||
};
|
||||
|
||||
class VBusCustomSubBSensor : public binary_sensor::BinarySensor, public Component {
|
||||
class VBusCustomSubBSensor final : public binary_sensor::BinarySensor, public Component {
|
||||
public:
|
||||
void set_message_parser(message_parser_t parser) { this->message_parser_ = std::move(parser); };
|
||||
void parse_message(std::vector<uint8_t> &message);
|
||||
|
||||
@@ -25,7 +25,7 @@ class VBusListener {
|
||||
virtual void handle_message(std::vector<uint8_t> &message) = 0;
|
||||
};
|
||||
|
||||
class VBus : public uart::UARTDevice, public Component {
|
||||
class VBus final : public uart::UARTDevice, public Component {
|
||||
public:
|
||||
void dump_config() override;
|
||||
void loop() override;
|
||||
|
||||
@@ -59,7 +59,7 @@ enum VEML3235ComponentGain {
|
||||
VEML3235_GAIN_4X = 0b11,
|
||||
};
|
||||
|
||||
class VEML3235Sensor : public sensor::Sensor, public PollingComponent, public i2c::I2CDevice {
|
||||
class VEML3235Sensor final : public sensor::Sensor, public PollingComponent, public i2c::I2CDevice {
|
||||
public:
|
||||
void setup() override;
|
||||
void dump_config() override;
|
||||
|
||||
@@ -95,7 +95,7 @@ union PSMRegister {
|
||||
} __attribute__((packed));
|
||||
};
|
||||
|
||||
class VEML7700Component : public PollingComponent, public i2c::I2CDevice {
|
||||
class VEML7700Component final : public PollingComponent, public i2c::I2CDevice {
|
||||
public:
|
||||
//
|
||||
// EspHome framework functions
|
||||
|
||||
@@ -22,7 +22,7 @@ struct SequenceStepTimeouts {
|
||||
|
||||
enum VcselPeriodType { VCSEL_PERIOD_PRE_RANGE, VCSEL_PERIOD_FINAL_RANGE };
|
||||
|
||||
class VL53L0XSensor : public sensor::Sensor, public PollingComponent, public i2c::I2CDevice {
|
||||
class VL53L0XSensor final : public sensor::Sensor, public PollingComponent, public i2c::I2CDevice {
|
||||
public:
|
||||
VL53L0XSensor();
|
||||
|
||||
|
||||
@@ -110,7 +110,7 @@ enum class MediaPlayerResponseState {
|
||||
};
|
||||
#endif
|
||||
|
||||
class VoiceAssistant : public Component {
|
||||
class VoiceAssistant final : public Component {
|
||||
public:
|
||||
VoiceAssistant();
|
||||
|
||||
@@ -353,7 +353,7 @@ class VoiceAssistant : public Component {
|
||||
#endif
|
||||
};
|
||||
|
||||
template<typename... Ts> class StartAction : public Action<Ts...>, public Parented<VoiceAssistant> {
|
||||
template<typename... Ts> class StartAction final : public Action<Ts...>, public Parented<VoiceAssistant> {
|
||||
TEMPLATABLE_VALUE(std::string, wake_word);
|
||||
|
||||
public:
|
||||
@@ -368,22 +368,22 @@ template<typename... Ts> class StartAction : public Action<Ts...>, public Parent
|
||||
bool silence_detection_;
|
||||
};
|
||||
|
||||
template<typename... Ts> class StartContinuousAction : public Action<Ts...>, public Parented<VoiceAssistant> {
|
||||
template<typename... Ts> class StartContinuousAction final : public Action<Ts...>, public Parented<VoiceAssistant> {
|
||||
public:
|
||||
void play(const Ts &...x) override { this->parent_->request_start(true, true); }
|
||||
};
|
||||
|
||||
template<typename... Ts> class StopAction : public Action<Ts...>, public Parented<VoiceAssistant> {
|
||||
template<typename... Ts> class StopAction final : public Action<Ts...>, public Parented<VoiceAssistant> {
|
||||
public:
|
||||
void play(const Ts &...x) override { this->parent_->request_stop(); }
|
||||
};
|
||||
|
||||
template<typename... Ts> class IsRunningCondition : public Condition<Ts...>, public Parented<VoiceAssistant> {
|
||||
template<typename... Ts> class IsRunningCondition final : public Condition<Ts...>, public Parented<VoiceAssistant> {
|
||||
public:
|
||||
bool check(const Ts &...x) override { return this->parent_->is_running() || this->parent_->is_continuous(); }
|
||||
};
|
||||
|
||||
template<typename... Ts> class ConnectedCondition : public Condition<Ts...>, public Parented<VoiceAssistant> {
|
||||
template<typename... Ts> class ConnectedCondition final : public Condition<Ts...>, public Parented<VoiceAssistant> {
|
||||
public:
|
||||
bool check(const Ts &...x) override { return this->parent_->get_api_connection() != nullptr; }
|
||||
};
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
namespace esphome::wake_on_lan {
|
||||
|
||||
class WakeOnLanButton : public button::Button, public Component {
|
||||
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);
|
||||
|
||||
|
||||
@@ -88,7 +88,7 @@ class AuthMiddlewareHandler : public MiddlewareHandler {
|
||||
|
||||
} // namespace internal
|
||||
|
||||
class WebServerBase {
|
||||
class WebServerBase final {
|
||||
public:
|
||||
void init() {
|
||||
if (this->initialized_) {
|
||||
|
||||
@@ -266,7 +266,7 @@ class WeikaiComponent : public Component {
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief Helper class to expose a WeiKai family IO pin as an internal GPIO pin.
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class WeikaiGPIOPin : public GPIOPin {
|
||||
class WeikaiGPIOPin final : public GPIOPin {
|
||||
public:
|
||||
void set_parent(WeikaiComponent *parent) { this->parent_ = parent; }
|
||||
void set_pin(uint8_t pin) { this->pin_ = pin; }
|
||||
@@ -293,7 +293,7 @@ class WeikaiGPIOPin : public GPIOPin {
|
||||
/// uart::UARTComponent virtual class. This class is common to the different members of the Weikai
|
||||
/// components family and therefore avoid code duplication.
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
class WeikaiChannel : public uart::UARTComponent {
|
||||
class WeikaiChannel final : public uart::UARTComponent {
|
||||
public:
|
||||
/// @brief We belongs to this WeikaiComponent
|
||||
/// @param parent pointer to the component we belongs to
|
||||
|
||||
@@ -38,7 +38,7 @@ class WeikaiRegisterI2C : public weikai::WeikaiRegister {
|
||||
/// @brief The WeikaiComponentI2C class stores the information to the WeiKai component
|
||||
/// connected through an I2C bus.
|
||||
////////////////////////////////////////////////////////////////////////////////////
|
||||
class WeikaiComponentI2C : public weikai::WeikaiComponent, public i2c::I2CDevice {
|
||||
class WeikaiComponentI2C final : public weikai::WeikaiComponent, public i2c::I2CDevice {
|
||||
public:
|
||||
weikai::WeikaiRegister ®(uint8_t reg, uint8_t channel) override {
|
||||
reg_i2c_.register_ = reg;
|
||||
|
||||
@@ -31,9 +31,9 @@ class WeikaiRegisterSPI : public weikai::WeikaiRegister {
|
||||
/// @brief The WeikaiComponentSPI class stores the information to the WeiKai component
|
||||
/// connected through an SPI bus.
|
||||
////////////////////////////////////////////////////////////////////////////////////
|
||||
class WeikaiComponentSPI : public weikai::WeikaiComponent,
|
||||
public spi::SPIDevice<spi::BIT_ORDER_MSB_FIRST, spi::CLOCK_POLARITY_LOW,
|
||||
spi::CLOCK_PHASE_LEADING, spi::DATA_RATE_1MHZ> {
|
||||
class WeikaiComponentSPI final : public weikai::WeikaiComponent,
|
||||
public spi::SPIDevice<spi::BIT_ORDER_MSB_FIRST, spi::CLOCK_POLARITY_LOW,
|
||||
spi::CLOCK_PHASE_LEADING, spi::DATA_RATE_1MHZ> {
|
||||
public:
|
||||
weikai::WeikaiRegister ®(uint8_t reg, uint8_t channel) override {
|
||||
reg_spi_.register_ = reg;
|
||||
|
||||
@@ -16,7 +16,7 @@ const float WHIRLPOOL_DG11J1_3A_TEMP_MIN = 18.0;
|
||||
const float WHIRLPOOL_DG11J1_91_TEMP_MAX = 30.0;
|
||||
const float WHIRLPOOL_DG11J1_91_TEMP_MIN = 16.0;
|
||||
|
||||
class WhirlpoolClimate : public climate_ir::ClimateIR {
|
||||
class WhirlpoolClimate final : public climate_ir::ClimateIR {
|
||||
public:
|
||||
WhirlpoolClimate();
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ const uint8_t TEMP_MAX_C = 32; // Celsius
|
||||
const uint8_t TEMP_MIN_F = 61; // Fahrenheit
|
||||
const uint8_t TEMP_MAX_F = 89; // Fahrenheit
|
||||
|
||||
class Whynter : public climate_ir::ClimateIR {
|
||||
class Whynter final : public climate_ir::ClimateIR {
|
||||
public:
|
||||
Whynter()
|
||||
: climate_ir::ClimateIR(TEMP_MIN_C, TEMP_MAX_C, 1.0, true, true,
|
||||
|
||||
@@ -21,13 +21,13 @@ struct WiegandStore {
|
||||
static void d1_gpio_intr(WiegandStore *arg);
|
||||
};
|
||||
|
||||
class WiegandTagTrigger : public Trigger<std::string> {};
|
||||
class WiegandTagTrigger final : public Trigger<std::string> {};
|
||||
|
||||
class WiegandRawTrigger : public Trigger<uint8_t, uint64_t> {};
|
||||
class WiegandRawTrigger final : public Trigger<uint8_t, uint64_t> {};
|
||||
|
||||
class WiegandKeyTrigger : public Trigger<uint8_t> {};
|
||||
class WiegandKeyTrigger final : public Trigger<uint8_t> {};
|
||||
|
||||
class Wiegand : public key_provider::KeyProvider, public Component {
|
||||
class Wiegand final : public key_provider::KeyProvider, public Component {
|
||||
public:
|
||||
float get_setup_priority() const override { return setup_priority::HARDWARE; }
|
||||
void setup() override;
|
||||
|
||||
@@ -6,32 +6,32 @@
|
||||
|
||||
namespace esphome::wifi {
|
||||
|
||||
template<typename... Ts> class WiFiConnectedCondition : public Condition<Ts...> {
|
||||
template<typename... Ts> class WiFiConnectedCondition final : public Condition<Ts...> {
|
||||
public:
|
||||
bool check(const Ts &...x) override { return global_wifi_component->is_connected(); }
|
||||
};
|
||||
|
||||
template<typename... Ts> class WiFiEnabledCondition : public Condition<Ts...> {
|
||||
template<typename... Ts> class WiFiEnabledCondition final : public Condition<Ts...> {
|
||||
public:
|
||||
bool check(const Ts &...x) override { return !global_wifi_component->is_disabled(); }
|
||||
};
|
||||
|
||||
template<typename... Ts> class WiFiAPActiveCondition : public Condition<Ts...> {
|
||||
template<typename... Ts> class WiFiAPActiveCondition final : public Condition<Ts...> {
|
||||
public:
|
||||
bool check(const Ts &...x) override { return global_wifi_component->is_ap_active(); }
|
||||
};
|
||||
|
||||
template<typename... Ts> class WiFiEnableAction : public Action<Ts...> {
|
||||
template<typename... Ts> class WiFiEnableAction final : public Action<Ts...> {
|
||||
public:
|
||||
void play(const Ts &...x) override { global_wifi_component->enable(); }
|
||||
};
|
||||
|
||||
template<typename... Ts> class WiFiDisableAction : public Action<Ts...> {
|
||||
template<typename... Ts> class WiFiDisableAction final : public Action<Ts...> {
|
||||
public:
|
||||
void play(const Ts &...x) override { global_wifi_component->disable(); }
|
||||
};
|
||||
|
||||
template<typename... Ts> class WiFiConfigureAction : public Action<Ts...>, public Component {
|
||||
template<typename... Ts> class WiFiConfigureAction final : public Action<Ts...>, public Component {
|
||||
public:
|
||||
TEMPLATABLE_VALUE(std::string, ssid)
|
||||
TEMPLATABLE_VALUE(std::string, password)
|
||||
|
||||
@@ -10,9 +10,9 @@
|
||||
namespace esphome::wifi_signal {
|
||||
|
||||
#ifdef USE_WIFI_CONNECT_STATE_LISTENERS
|
||||
class WiFiSignalSensor : public sensor::Sensor, public PollingComponent, public wifi::WiFiConnectStateListener {
|
||||
class WiFiSignalSensor final : public sensor::Sensor, public PollingComponent, public wifi::WiFiConnectStateListener {
|
||||
#else
|
||||
class WiFiSignalSensor : public sensor::Sensor, public PollingComponent {
|
||||
class WiFiSignalSensor final : public sensor::Sensor, public PollingComponent {
|
||||
#endif
|
||||
public:
|
||||
#ifdef USE_WIFI_CONNECT_STATE_LISTENERS
|
||||
|
||||
@@ -32,7 +32,7 @@ struct AllowedIP {
|
||||
};
|
||||
|
||||
/// Main Wireguard component class.
|
||||
class Wireguard : public PollingComponent {
|
||||
class Wireguard final : public PollingComponent {
|
||||
public:
|
||||
void setup() override;
|
||||
void loop() override;
|
||||
@@ -165,25 +165,26 @@ static constexpr size_t MASK_KEY_BUFFER_SIZE = 12;
|
||||
void mask_key_to(char *buffer, size_t len, const char *key);
|
||||
|
||||
/// Condition to check if remote peer is online.
|
||||
template<typename... Ts> class WireguardPeerOnlineCondition : public Condition<Ts...>, public Parented<Wireguard> {
|
||||
template<typename... Ts>
|
||||
class WireguardPeerOnlineCondition final : public Condition<Ts...>, public Parented<Wireguard> {
|
||||
public:
|
||||
bool check(const Ts &...x) override { return this->parent_->is_peer_up(); }
|
||||
};
|
||||
|
||||
/// Condition to check if Wireguard component is enabled.
|
||||
template<typename... Ts> class WireguardEnabledCondition : public Condition<Ts...>, public Parented<Wireguard> {
|
||||
template<typename... Ts> class WireguardEnabledCondition final : public Condition<Ts...>, public Parented<Wireguard> {
|
||||
public:
|
||||
bool check(const Ts &...x) override { return this->parent_->is_enabled(); }
|
||||
};
|
||||
|
||||
/// Action to enable Wireguard component.
|
||||
template<typename... Ts> class WireguardEnableAction : public Action<Ts...>, public Parented<Wireguard> {
|
||||
template<typename... Ts> class WireguardEnableAction final : public Action<Ts...>, public Parented<Wireguard> {
|
||||
public:
|
||||
void play(const Ts &...x) override { this->parent_->enable(); }
|
||||
};
|
||||
|
||||
/// Action to disable Wireguard component.
|
||||
template<typename... Ts> class WireguardDisableAction : public Action<Ts...>, public Parented<Wireguard> {
|
||||
template<typename... Ts> class WireguardDisableAction final : public Action<Ts...>, public Parented<Wireguard> {
|
||||
public:
|
||||
void play(const Ts &...x) override { this->parent_->disable(); }
|
||||
};
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
namespace esphome::wl_134 {
|
||||
|
||||
class Wl134Component : public text_sensor::TextSensor, public Component, public uart::UARTDevice {
|
||||
class Wl134Component final : public text_sensor::TextSensor, public Component, public uart::UARTDevice {
|
||||
public:
|
||||
enum Rfid134Error {
|
||||
RFID134_ERROR_NONE,
|
||||
|
||||
Reference in New Issue
Block a user