Mark user-configurable classes as final (part 5/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 5 of 21, split alphabetically by
component (dfrobot_sen0395 .. esp32_ble_beacon).
This commit is contained in:
Jesse Hills
2026-06-15 13:19:17 +12:00
parent a25ac28ae5
commit c2d6730f3d
38 changed files with 74 additions and 74 deletions

View File

@@ -8,13 +8,13 @@
namespace esphome::dfrobot_sen0395 {
template<typename... Ts>
class DfrobotSen0395ResetAction : public Action<Ts...>, public Parented<DfrobotSen0395Component> {
class DfrobotSen0395ResetAction final : public Action<Ts...>, public Parented<DfrobotSen0395Component> {
public:
void play(const Ts &...x) { this->parent_->enqueue(make_unique<ResetSystemCommand>()); }
};
template<typename... Ts>
class DfrobotSen0395SettingsAction : public Action<Ts...>, public Parented<DfrobotSen0395Component> {
class DfrobotSen0395SettingsAction final : public Action<Ts...>, public Parented<DfrobotSen0395Component> {
public:
TEMPLATABLE_VALUE(int8_t, factory_reset)
TEMPLATABLE_VALUE(int8_t, start_after_power_on)

View File

@@ -36,7 +36,7 @@ class CircularCommandQueue {
std::unique_ptr<Command> commands_[COMMAND_QUEUE_SIZE];
};
class DfrobotSen0395Component : public uart::UARTDevice, public Component {
class DfrobotSen0395Component final : public uart::UARTDevice, public Component {
#ifdef USE_SWITCH
SUB_SWITCH(sensor_active)
SUB_SWITCH(turn_on_led)

View File

@@ -9,22 +9,22 @@ namespace esphome::dfrobot_sen0395 {
class DfrobotSen0395Switch : public switch_::Switch, public Component, public Parented<DfrobotSen0395Component> {};
class Sen0395PowerSwitch : public DfrobotSen0395Switch {
class Sen0395PowerSwitch final : public DfrobotSen0395Switch {
public:
void write_state(bool state) override;
};
class Sen0395LedSwitch : public DfrobotSen0395Switch {
class Sen0395LedSwitch final : public DfrobotSen0395Switch {
public:
void write_state(bool state) override;
};
class Sen0395UartPresenceSwitch : public DfrobotSen0395Switch {
class Sen0395UartPresenceSwitch final : public DfrobotSen0395Switch {
public:
void write_state(bool state) override;
};
class Sen0395StartAfterBootSwitch : public DfrobotSen0395Switch {
class Sen0395StartAfterBootSwitch final : public DfrobotSen0395Switch {
public:
void write_state(bool state) override;
};

View File

@@ -18,7 +18,7 @@ enum DHTModel : uint8_t {
};
/// Component for reading temperature/humidity measurements from DHT11/DHT22 sensors.
class DHT : public PollingComponent {
class DHT final : public PollingComponent {
public:
/** Manually select the DHT model.
*

View File

@@ -6,7 +6,7 @@
namespace esphome::dht12 {
class DHT12Component : public PollingComponent, public i2c::I2CDevice {
class DHT12Component final : public PollingComponent, public i2c::I2CDevice {
public:
void setup() override;
void dump_config() override;

View File

@@ -796,7 +796,7 @@ class Display : public PollingComponent {
bool show_test_card_{false};
};
class DisplayPage {
class DisplayPage final {
public:
DisplayPage(display_writer_t writer);
void show();
@@ -814,7 +814,7 @@ class DisplayPage {
DisplayPage *next_{nullptr};
};
template<typename... Ts> class DisplayPageShowAction : public Action<Ts...> {
template<typename... Ts> class DisplayPageShowAction final : public Action<Ts...> {
public:
TEMPLATABLE_VALUE(DisplayPage *, page)
@@ -826,7 +826,7 @@ template<typename... Ts> class DisplayPageShowAction : public Action<Ts...> {
}
};
template<typename... Ts> class DisplayPageShowNextAction : public Action<Ts...> {
template<typename... Ts> class DisplayPageShowNextAction final : public Action<Ts...> {
public:
DisplayPageShowNextAction(Display *buffer) : buffer_(buffer) {}
@@ -835,7 +835,7 @@ template<typename... Ts> class DisplayPageShowNextAction : public Action<Ts...>
Display *buffer_;
};
template<typename... Ts> class DisplayPageShowPrevAction : public Action<Ts...> {
template<typename... Ts> class DisplayPageShowPrevAction final : public Action<Ts...> {
public:
DisplayPageShowPrevAction(Display *buffer) : buffer_(buffer) {}
@@ -844,7 +844,7 @@ template<typename... Ts> class DisplayPageShowPrevAction : public Action<Ts...>
Display *buffer_;
};
template<typename... Ts> class DisplayIsDisplayingPageCondition : public Condition<Ts...> {
template<typename... Ts> class DisplayIsDisplayingPageCondition final : public Condition<Ts...> {
public:
DisplayIsDisplayingPageCondition(Display *parent) : parent_(parent) {}
@@ -856,7 +856,7 @@ template<typename... Ts> class DisplayIsDisplayingPageCondition : public Conditi
DisplayPage *page_;
};
class DisplayOnPageChangeTrigger : public Trigger<DisplayPage *, DisplayPage *> {
class DisplayOnPageChangeTrigger final : public Trigger<DisplayPage *, DisplayPage *> {
public:
explicit DisplayOnPageChangeTrigger(Display *parent) { parent->add_on_page_change_trigger(this); }
void process(DisplayPage *from, DisplayPage *to);

View File

@@ -5,7 +5,7 @@
namespace esphome::display_menu_base {
template<typename... Ts> class UpAction : public Action<Ts...> {
template<typename... Ts> class UpAction final : public Action<Ts...> {
public:
explicit UpAction(DisplayMenuComponent *menu) : menu_(menu) {}
@@ -15,7 +15,7 @@ template<typename... Ts> class UpAction : public Action<Ts...> {
DisplayMenuComponent *menu_;
};
template<typename... Ts> class DownAction : public Action<Ts...> {
template<typename... Ts> class DownAction final : public Action<Ts...> {
public:
explicit DownAction(DisplayMenuComponent *menu) : menu_(menu) {}
@@ -25,7 +25,7 @@ template<typename... Ts> class DownAction : public Action<Ts...> {
DisplayMenuComponent *menu_;
};
template<typename... Ts> class LeftAction : public Action<Ts...> {
template<typename... Ts> class LeftAction final : public Action<Ts...> {
public:
explicit LeftAction(DisplayMenuComponent *menu) : menu_(menu) {}
@@ -35,7 +35,7 @@ template<typename... Ts> class LeftAction : public Action<Ts...> {
DisplayMenuComponent *menu_;
};
template<typename... Ts> class RightAction : public Action<Ts...> {
template<typename... Ts> class RightAction final : public Action<Ts...> {
public:
explicit RightAction(DisplayMenuComponent *menu) : menu_(menu) {}
@@ -45,7 +45,7 @@ template<typename... Ts> class RightAction : public Action<Ts...> {
DisplayMenuComponent *menu_;
};
template<typename... Ts> class EnterAction : public Action<Ts...> {
template<typename... Ts> class EnterAction final : public Action<Ts...> {
public:
explicit EnterAction(DisplayMenuComponent *menu) : menu_(menu) {}
@@ -55,7 +55,7 @@ template<typename... Ts> class EnterAction : public Action<Ts...> {
DisplayMenuComponent *menu_;
};
template<typename... Ts> class ShowAction : public Action<Ts...> {
template<typename... Ts> class ShowAction final : public Action<Ts...> {
public:
explicit ShowAction(DisplayMenuComponent *menu) : menu_(menu) {}
@@ -65,7 +65,7 @@ template<typename... Ts> class ShowAction : public Action<Ts...> {
DisplayMenuComponent *menu_;
};
template<typename... Ts> class HideAction : public Action<Ts...> {
template<typename... Ts> class HideAction final : public Action<Ts...> {
public:
explicit HideAction(DisplayMenuComponent *menu) : menu_(menu) {}
@@ -75,7 +75,7 @@ template<typename... Ts> class HideAction : public Action<Ts...> {
DisplayMenuComponent *menu_;
};
template<typename... Ts> class ShowMainAction : public Action<Ts...> {
template<typename... Ts> class ShowMainAction final : public Action<Ts...> {
public:
explicit ShowMainAction(DisplayMenuComponent *menu) : menu_(menu) {}
@@ -84,7 +84,7 @@ template<typename... Ts> class ShowMainAction : public Action<Ts...> {
protected:
DisplayMenuComponent *menu_;
};
template<typename... Ts> class IsActiveCondition : public Condition<Ts...> {
template<typename... Ts> class IsActiveCondition final : public Condition<Ts...> {
public:
explicit IsActiveCondition(DisplayMenuComponent *menu) : menu_(menu) {}
bool check(const Ts &...x) override { return this->menu_->is_active(); }
@@ -93,7 +93,7 @@ template<typename... Ts> class IsActiveCondition : public Condition<Ts...> {
DisplayMenuComponent *menu_;
};
class DisplayMenuOnEnterTrigger : public Trigger<const MenuItem *> {
class DisplayMenuOnEnterTrigger final : public Trigger<const MenuItem *> {
public:
explicit DisplayMenuOnEnterTrigger(MenuItem *parent) : parent_(parent) {
parent->add_on_enter_callback([this]() { this->trigger(this->parent_); });
@@ -103,7 +103,7 @@ class DisplayMenuOnEnterTrigger : public Trigger<const MenuItem *> {
MenuItem *parent_;
};
class DisplayMenuOnLeaveTrigger : public Trigger<const MenuItem *> {
class DisplayMenuOnLeaveTrigger final : public Trigger<const MenuItem *> {
public:
explicit DisplayMenuOnLeaveTrigger(MenuItem *parent) : parent_(parent) {
parent->add_on_leave_callback([this]() { this->trigger(this->parent_); });
@@ -113,7 +113,7 @@ class DisplayMenuOnLeaveTrigger : public Trigger<const MenuItem *> {
MenuItem *parent_;
};
class DisplayMenuOnValueTrigger : public Trigger<const MenuItem *> {
class DisplayMenuOnValueTrigger final : public Trigger<const MenuItem *> {
public:
explicit DisplayMenuOnValueTrigger(MenuItem *parent) : parent_(parent) {
parent->add_on_value_callback([this]() { this->trigger(this->parent_); });
@@ -123,7 +123,7 @@ class DisplayMenuOnValueTrigger : public Trigger<const MenuItem *> {
MenuItem *parent_;
};
class DisplayMenuOnNextTrigger : public Trigger<const MenuItem *> {
class DisplayMenuOnNextTrigger final : public Trigger<const MenuItem *> {
public:
explicit DisplayMenuOnNextTrigger(MenuItemCustom *parent) : parent_(parent) {
parent->add_on_next_callback([this]() { this->trigger(this->parent_); });
@@ -133,7 +133,7 @@ class DisplayMenuOnNextTrigger : public Trigger<const MenuItem *> {
MenuItemCustom *parent_;
};
class DisplayMenuOnPrevTrigger : public Trigger<const MenuItem *> {
class DisplayMenuOnPrevTrigger final : public Trigger<const MenuItem *> {
public:
explicit DisplayMenuOnPrevTrigger(MenuItemCustom *parent) : parent_(parent) {
parent->add_on_prev_callback([this]() { this->trigger(this->parent_); });

View File

@@ -70,7 +70,7 @@ class MenuItem {
CallbackManager<void()> on_value_callbacks_{};
};
class MenuItemMenu : public MenuItem {
class MenuItemMenu final : public MenuItem {
public:
explicit MenuItemMenu() : MenuItem(MENU_ITEM_MENU) {}
void add_item(MenuItem *item) {
@@ -97,7 +97,7 @@ class MenuItemEditable : public MenuItem {
};
#ifdef USE_SELECT
class MenuItemSelect : public MenuItemEditable {
class MenuItemSelect final : public MenuItemEditable {
public:
explicit MenuItemSelect() : MenuItemEditable(MENU_ITEM_SELECT) {}
void set_select_variable(select::Select *var) { this->select_var_ = var; }
@@ -114,7 +114,7 @@ class MenuItemSelect : public MenuItemEditable {
#endif
#ifdef USE_NUMBER
class MenuItemNumber : public MenuItemEditable {
class MenuItemNumber final : public MenuItemEditable {
public:
explicit MenuItemNumber() : MenuItemEditable(MENU_ITEM_NUMBER) {}
void set_number_variable(number::Number *var) { this->number_var_ = var; }
@@ -135,7 +135,7 @@ class MenuItemNumber : public MenuItemEditable {
#endif
#ifdef USE_SWITCH
class MenuItemSwitch : public MenuItemEditable {
class MenuItemSwitch final : public MenuItemEditable {
public:
explicit MenuItemSwitch() : MenuItemEditable(MENU_ITEM_SWITCH) {}
void set_switch_variable(switch_::Switch *var) { this->switch_var_ = var; }
@@ -158,7 +158,7 @@ class MenuItemSwitch : public MenuItemEditable {
};
#endif
class MenuItemCommand : public MenuItem {
class MenuItemCommand final : public MenuItem {
public:
explicit MenuItemCommand() : MenuItem(MENU_ITEM_COMMAND) {}
@@ -166,7 +166,7 @@ class MenuItemCommand : public MenuItem {
bool select_prev() override;
};
class MenuItemCustom : public MenuItemEditable {
class MenuItemCustom final : public MenuItemEditable {
public:
explicit MenuItemCustom() : MenuItemEditable(MENU_ITEM_CUSTOM) {}
template<typename F> void add_on_next_callback(F &&cb) { this->on_next_callbacks_.add(std::forward<F>(cb)); }

View File

@@ -98,7 +98,7 @@ struct CustomPattern {
std::optional<std::array<uint8_t, 6>> default_obis;
};
class DlmsMeterComponent : public Component, public uart::UARTDevice {
class DlmsMeterComponent final : public Component, public uart::UARTDevice {
public:
DlmsMeterComponent(uint32_t receive_timeout_ms, bool skip_crc_check,
std::optional<std::array<uint8_t, 16>> decryption_key,

View File

@@ -35,7 +35,7 @@ static const uint8_t DPS310_INIT_TIMEOUT = 20; // How long to wait for DPS
static const uint8_t DPS310_NUM_COEF_REGS = 18; // Number of coefficients we need to read from the device
static const int32_t DPS310_SCALE_FACTOR = 1572864; // Measurement compensation scale factor
class DPS310Component : public PollingComponent, public i2c::I2CDevice {
class DPS310Component final : public PollingComponent, public i2c::I2CDevice {
public:
void setup() override;
void dump_config() override;

View File

@@ -6,7 +6,7 @@
namespace esphome::ds1307 {
class DS1307Component : public time::RealTimeClock, public i2c::I2CDevice {
class DS1307Component final : public time::RealTimeClock, public i2c::I2CDevice {
public:
void setup() override;
void update() override;
@@ -55,12 +55,12 @@ class DS1307Component : public time::RealTimeClock, public i2c::I2CDevice {
} ds1307_;
};
template<typename... Ts> class WriteAction : public Action<Ts...>, public Parented<DS1307Component> {
template<typename... Ts> class WriteAction final : public Action<Ts...>, public Parented<DS1307Component> {
public:
void play(const Ts &...x) override { this->parent_->write_time(); }
};
template<typename... Ts> class ReadAction : public Action<Ts...>, public Parented<DS1307Component> {
template<typename... Ts> class ReadAction final : public Action<Ts...>, public Parented<DS1307Component> {
public:
void play(const Ts &...x) override { this->parent_->read_time(); }
};

View File

@@ -8,7 +8,7 @@
namespace esphome::ds2484 {
class DS2484OneWireBus : public one_wire::OneWireBus, public i2c::I2CDevice, public Component {
class DS2484OneWireBus final : public one_wire::OneWireBus, public i2c::I2CDevice, public Component {
public:
void setup() override;
void dump_config() override;

View File

@@ -65,7 +65,7 @@ using MyData = dsmr_parser::ParsedData<DSMR_TEXT_SENSOR_LIST(DSMR_IDENTITY, DSMR
using MyData = dsmr_parser::ParsedData<DSMR_SENSOR_LIST(DSMR_IDENTITY, DSMR_COMMA)>;
#endif
class Dsmr : public Component, public uart::UARTDevice {
class Dsmr final : public Component, public uart::UARTDevice {
public:
Dsmr(uart::UARTComponent *uart, bool crc_check, size_t max_telegram_length, uint32_t request_interval,
uint32_t receive_timeout, GPIOPin *request_pin, const char *decryption_key)

View File

@@ -16,7 +16,7 @@ struct DutyCycleSensorStore {
static void gpio_intr(DutyCycleSensorStore *arg);
};
class DutyCycleSensor : public sensor::Sensor, public PollingComponent {
class DutyCycleSensor final : public sensor::Sensor, public PollingComponent {
public:
void set_pin(InternalGPIOPin *pin) { pin_ = pin; }

View File

@@ -12,7 +12,7 @@
namespace esphome::duty_time_sensor {
class DutyTimeSensor : public sensor::Sensor, public PollingComponent {
class DutyTimeSensor final : public sensor::Sensor, public PollingComponent {
public:
void setup() override;
void update() override;
@@ -61,7 +61,7 @@ template<typename... Ts> class ResetAction : public BaseAction<Ts...> {
void play(const Ts &...x) override { this->parent_->reset(); }
};
template<typename... Ts> class RunningCondition : public Condition<Ts...>, public Parented<DutyTimeSensor> {
template<typename... Ts> class RunningCondition final : public Condition<Ts...>, public Parented<DutyTimeSensor> {
public:
explicit RunningCondition(DutyTimeSensor *parent, bool state) : Parented(parent), state_(state) {}

View File

@@ -30,7 +30,7 @@ struct UniverseConsumer {
uint16_t consumers;
};
class E131Component : public esphome::Component {
class E131Component final : public esphome::Component {
public:
E131Component();
~E131Component();

View File

@@ -7,7 +7,7 @@
namespace esphome::ee895 {
/// This class implements support for the ee895 of temperature i2c sensors.
class EE895Component : public PollingComponent, public i2c::I2CDevice {
class EE895Component final : public PollingComponent, public i2c::I2CDevice {
public:
void set_co2_sensor(sensor::Sensor *co2) { co2_sensor_ = co2; }
void set_temperature_sensor(sensor::Sensor *temperature_sensor) { temperature_sensor_ = temperature_sensor; }

View File

@@ -10,7 +10,7 @@ namespace esphome::ektf2232 {
using namespace touchscreen;
class EKTF2232Touchscreen : public Touchscreen, public i2c::I2CDevice {
class EKTF2232Touchscreen final : public Touchscreen, public i2c::I2CDevice {
public:
void setup() override;
void dump_config() override;

View File

@@ -25,7 +25,7 @@ enum Emc2101DACConversionRate {
/// This class includes support for the EMC2101 i2c fan controller.
/// The device has an output (PWM or DAC) and several sensors and this
/// class is for the EMC2101 configuration.
class Emc2101Component : public Component, public i2c::I2CDevice {
class Emc2101Component final : public Component, public i2c::I2CDevice {
public:
/** Sets the mode of the output.
*

View File

@@ -6,7 +6,7 @@
namespace esphome::emc2101 {
/// This class allows to control the EMC2101 output.
class EMC2101Output : public output::FloatOutput {
class EMC2101Output final : public output::FloatOutput {
public:
EMC2101Output(Emc2101Component *parent) : parent_(parent) {}

View File

@@ -7,7 +7,7 @@
namespace esphome::emc2101 {
/// This class exposes the EMC2101 sensors.
class EMC2101Sensor : public PollingComponent {
class EMC2101Sensor final : public PollingComponent {
public:
EMC2101Sensor(Emc2101Component *parent) : parent_(parent) {}
/** Used by ESPHome framework. */

View File

@@ -60,7 +60,7 @@ struct EmmetiState {
uint8_t checksum = 0;
};
class EmmetiClimate : public climate_ir::ClimateIR {
class EmmetiClimate final : public climate_ir::ClimateIR {
public:
EmmetiClimate()
: climate_ir::ClimateIR(EMMETI_TEMP_MIN, EMMETI_TEMP_MAX, 1.0f, true, true,

View File

@@ -26,7 +26,7 @@ static constexpr size_t MAX_LINE_LENGTH = 1024;
* The EmonTx processes incoming data frames via UART,
* extracts tags and values, and publishes them to registered sensors.
*/
class EmonTx : public Component, public uart::UARTDevice {
class EmonTx final : public Component, public uart::UARTDevice {
public:
EmonTx() = default;
@@ -59,7 +59,7 @@ class EmonTx : public Component, public uart::UARTDevice {
};
// Action to send command to emonTx
template<typename... Ts> class EmonTxSendCommandAction : public Action<Ts...>, public Parented<EmonTx> {
template<typename... Ts> class EmonTxSendCommandAction final : public Action<Ts...>, public Parented<EmonTx> {
public:
TEMPLATABLE_VALUE(std::string, command)

View File

@@ -5,7 +5,7 @@
namespace esphome::emontx {
class EmonTxSensor : public sensor::Sensor, public Component {
class EmonTxSensor final : public sensor::Sensor, public Component {
public:
void dump_config() override;
};

View File

@@ -7,7 +7,7 @@
namespace esphome::endstop {
class EndstopCover : public cover::Cover, public Component {
class EndstopCover final : public cover::Cover, public Component {
public:
void setup() override;
void loop() override;

View File

@@ -5,7 +5,7 @@
namespace esphome::ens160_i2c {
class ENS160I2CComponent : public esphome::ens160_base::ENS160Component, public i2c::I2CDevice {
class ENS160I2CComponent final : public esphome::ens160_base::ENS160Component, public i2c::I2CDevice {
void dump_config() override;
bool read_byte(uint8_t a_register, uint8_t *data) override;

View File

@@ -5,9 +5,9 @@
namespace esphome::ens160_spi {
class ENS160SPIComponent : public esphome::ens160_base::ENS160Component,
public spi::SPIDevice<spi::BIT_ORDER_MSB_FIRST, spi::CLOCK_POLARITY_LOW,
spi::CLOCK_PHASE_LEADING, spi::DATA_RATE_200KHZ> {
class ENS160SPIComponent final : public esphome::ens160_base::ENS160Component,
public spi::SPIDevice<spi::BIT_ORDER_MSB_FIRST, spi::CLOCK_POLARITY_LOW,
spi::CLOCK_PHASE_LEADING, spi::DATA_RATE_200KHZ> {
void setup() override;
void dump_config() override;

View File

@@ -7,7 +7,7 @@
namespace esphome::ens210 {
/// This class implements support for the ENS210 relative humidity and temperature i2c sensor.
class ENS210Component : public PollingComponent, public i2c::I2CDevice {
class ENS210Component final : public PollingComponent, public i2c::I2CDevice {
public:
void dump_config() override;
void setup() override;

View File

@@ -16,7 +16,7 @@ enum ES7210BitsPerSample : uint8_t {
ES7210_BITS_PER_SAMPLE_32 = 32,
};
class ES7210 : public audio_adc::AudioAdc, public Component, public i2c::I2CDevice {
class ES7210 final : public audio_adc::AudioAdc, public Component, public i2c::I2CDevice {
/* Class for configuring an ES7210 ADC for microphone input.
* Based on code from:
* - https://github.com/espressif/esp-bsp/ (accessed 20241219)

View File

@@ -6,7 +6,7 @@
namespace esphome::es7243e {
class ES7243E : public audio_adc::AudioAdc, public Component, public i2c::I2CDevice {
class ES7243E final : public audio_adc::AudioAdc, public Component, public i2c::I2CDevice {
/* Class for configuring an ES7243E ADC for microphone input.
* Based on code from:
* - https://github.com/espressif/esp-adf/ (accessed 20250116)

View File

@@ -6,7 +6,7 @@
namespace esphome::es8156 {
class ES8156 : public audio_dac::AudioDac, public Component, public i2c::I2CDevice {
class ES8156 final : public audio_dac::AudioDac, public Component, public i2c::I2CDevice {
public:
/////////////////////////
// Component overrides //

View File

@@ -42,7 +42,7 @@ struct ES8311Coefficient {
uint8_t dac_osr; // dac osr
};
class ES8311 : public audio_dac::AudioDac, public Component, public i2c::I2CDevice {
class ES8311 final : public audio_dac::AudioDac, public Component, public i2c::I2CDevice {
public:
/////////////////////////
// Component overrides //

View File

@@ -25,7 +25,7 @@ enum AdcInputMicLine : uint8_t {
ADC_INPUT_MIC_DIFFERENCE,
};
class ES8388 : public audio_dac::AudioDac, public Component, public i2c::I2CDevice {
class ES8388 final : public audio_dac::AudioDac, public Component, public i2c::I2CDevice {
#ifdef USE_SELECT
SUB_SELECT(dac_output)
SUB_SELECT(adc_input_mic)

View File

@@ -5,7 +5,7 @@
namespace esphome::es8388 {
class ADCInputMicSelect : public select::Select, public Parented<ES8388> {
class ADCInputMicSelect final : public select::Select, public Parented<ES8388> {
protected:
void control(size_t index) override;
};

View File

@@ -5,7 +5,7 @@
namespace esphome::es8388 {
class DacOutputSelect : public select::Select, public Parented<ES8388> {
class DacOutputSelect final : public select::Select, public Parented<ES8388> {
protected:
void control(size_t index) override;
};

View File

@@ -10,7 +10,7 @@ namespace esphome::esp32 {
static_assert(GPIO_NUM_MAX <= 256, "gpio_num_t has too many values for uint8_t");
static_assert(GPIO_DRIVE_CAP_MAX <= 4, "gpio_drive_cap_t has too many values for 2-bit field");
class ESP32InternalGPIOPin : public InternalGPIOPin {
class ESP32InternalGPIOPin final : public InternalGPIOPin {
public:
void set_pin(gpio_num_t pin) { this->pin_ = static_cast<uint8_t>(pin); }
void set_inverted(bool inverted) { this->pin_flags_.inverted = inverted; }

View File

@@ -87,7 +87,7 @@ enum BLEComponentState : uint8_t {
BLE_COMPONENT_STATE_ACTIVE,
};
class ESP32BLE : public Component {
class ESP32BLE final : public Component {
public:
void set_io_capability(IoCapability io_capability) { this->io_cap_ = (esp_ble_io_cap_t) io_capability; }
@@ -236,12 +236,12 @@ class ESP32BLE : public Component {
// NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables)
extern ESP32BLE *global_ble;
template<typename... Ts> class BLEEnabledCondition : public Condition<Ts...> {
template<typename... Ts> class BLEEnabledCondition final : public Condition<Ts...> {
public:
bool check(const Ts &...x) override { return global_ble != nullptr && global_ble->is_active(); }
};
template<typename... Ts> class BLEEnableAction : public Action<Ts...> {
template<typename... Ts> class BLEEnableAction final : public Action<Ts...> {
public:
void play(const Ts &...x) override {
if (global_ble != nullptr)
@@ -249,7 +249,7 @@ template<typename... Ts> class BLEEnableAction : public Action<Ts...> {
}
};
template<typename... Ts> class BLEDisableAction : public Action<Ts...> {
template<typename... Ts> class BLEDisableAction final : public Action<Ts...> {
public:
void play(const Ts &...x) override {
if (global_ble != nullptr)

View File

@@ -34,7 +34,7 @@ using esp_ble_ibeacon_t = struct {
using namespace esp32_ble;
class ESP32BLEBeacon : public Component {
class ESP32BLEBeacon final : public Component {
public:
explicit ESP32BLEBeacon(const std::array<uint8_t, 16> &uuid) : uuid_(uuid) {}