mirror of
https://github.com/esphome/esphome.git
synced 2026-06-24 11:25:35 +00:00
Mark user-configurable classes as final (part 16/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 16 of 21, split alphabetically by component (sm10bit_base .. ssd1331_spi).
This commit is contained in:
@@ -27,7 +27,7 @@ class Sm10BitBase : public Component {
|
||||
void dump_config() override;
|
||||
void loop() override;
|
||||
|
||||
class Channel : public output::FloatOutput {
|
||||
class Channel final : public output::FloatOutput {
|
||||
public:
|
||||
void set_parent(Sm10BitBase *parent) { parent_ = parent; }
|
||||
void set_channel(uint8_t channel) { channel_ = channel; }
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
namespace esphome::sm16716 {
|
||||
|
||||
class SM16716 : public Component {
|
||||
class SM16716 final : public Component {
|
||||
public:
|
||||
class Channel;
|
||||
|
||||
@@ -25,7 +25,7 @@ class SM16716 : public Component {
|
||||
/// Send new values if they were updated.
|
||||
void loop() override;
|
||||
|
||||
class Channel : public output::FloatOutput {
|
||||
class Channel final : public output::FloatOutput {
|
||||
public:
|
||||
void set_parent(SM16716 *parent) { parent_ = parent; }
|
||||
void set_channel(uint8_t channel) { channel_ = channel; }
|
||||
|
||||
@@ -21,7 +21,7 @@ enum SM2135Current : uint8_t {
|
||||
SM2135_CURRENT_60MA = 0x0A,
|
||||
};
|
||||
|
||||
class SM2135 : public Component {
|
||||
class SM2135 final : public Component {
|
||||
public:
|
||||
class Channel;
|
||||
|
||||
@@ -49,7 +49,7 @@ class SM2135 : public Component {
|
||||
/// Send new values if they were updated.
|
||||
void loop() override;
|
||||
|
||||
class Channel : public output::FloatOutput {
|
||||
class Channel final : public output::FloatOutput {
|
||||
public:
|
||||
void set_parent(SM2135 *parent) { parent_ = parent; }
|
||||
void set_channel(uint8_t channel) { channel_ = channel; }
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
namespace esphome::sm2235 {
|
||||
|
||||
class SM2235 : public sm10bit_base::Sm10BitBase {
|
||||
class SM2235 final : public sm10bit_base::Sm10BitBase {
|
||||
public:
|
||||
SM2235() = default;
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
namespace esphome::sm2335 {
|
||||
|
||||
class SM2335 : public sm10bit_base::Sm10BitBase {
|
||||
class SM2335 final : public sm10bit_base::Sm10BitBase {
|
||||
public:
|
||||
SM2335() = default;
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
namespace esphome::sm300d2 {
|
||||
|
||||
class SM300D2Sensor : public PollingComponent, public uart::UARTDevice {
|
||||
class SM300D2Sensor final : public PollingComponent, public uart::UARTDevice {
|
||||
public:
|
||||
void set_co2_sensor(sensor::Sensor *co2_sensor) { co2_sensor_ = co2_sensor; }
|
||||
void set_formaldehyde_sensor(sensor::Sensor *formaldehyde_sensor) { formaldehyde_sensor_ = formaldehyde_sensor; }
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
namespace esphome::sml {
|
||||
|
||||
class SmlSensor : public SmlListener, public sensor::Sensor, public Component {
|
||||
class SmlSensor final : public SmlListener, public sensor::Sensor, public Component {
|
||||
public:
|
||||
SmlSensor(std::string server_id, std::string obis_code);
|
||||
void publish_val(const ObisInfo &obis_info) override;
|
||||
|
||||
@@ -17,7 +17,7 @@ class SmlListener {
|
||||
virtual void publish_val(const ObisInfo &obis_info){};
|
||||
};
|
||||
|
||||
class Sml : public Component, public uart::UARTDevice {
|
||||
class Sml final : public Component, public uart::UARTDevice {
|
||||
public:
|
||||
void register_sml_listener(SmlListener *listener);
|
||||
void loop() override;
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
namespace esphome::sml {
|
||||
|
||||
class SmlTextSensor : public SmlListener, public text_sensor::TextSensor, public Component {
|
||||
class SmlTextSensor final : public SmlListener, public text_sensor::TextSensor, public Component {
|
||||
public:
|
||||
SmlTextSensor(std::string server_id, std::string obis_code, SmlType format);
|
||||
void publish_val(const ObisInfo &obis_info) override;
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
namespace esphome::smt100 {
|
||||
|
||||
class SMT100Component : public PollingComponent, public uart::UARTDevice {
|
||||
class SMT100Component final : public PollingComponent, public uart::UARTDevice {
|
||||
static const uint16_t MAX_LINE_LENGTH = 31;
|
||||
|
||||
public:
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
namespace esphome::sn74hc165 {
|
||||
|
||||
class SN74HC165Component : public Component {
|
||||
class SN74HC165Component final : public Component {
|
||||
public:
|
||||
SN74HC165Component() = default;
|
||||
|
||||
@@ -40,7 +40,7 @@ class SN74HC165Component : public Component {
|
||||
};
|
||||
|
||||
/// Helper class to expose a SC74HC165 pin as an internal input GPIO pin.
|
||||
class SN74HC165GPIOPin : public GPIOPin, public Parented<SN74HC165Component> {
|
||||
class SN74HC165GPIOPin final : public GPIOPin, public Parented<SN74HC165Component> {
|
||||
public:
|
||||
void setup() override {}
|
||||
void pin_mode(gpio::Flags flags) override {}
|
||||
|
||||
@@ -47,7 +47,7 @@ class SN74HC595Component : public Component {
|
||||
};
|
||||
|
||||
/// Helper class to expose a SC74HC595 pin as an internal output GPIO pin.
|
||||
class SN74HC595GPIOPin : public GPIOPin, public Parented<SN74HC595Component> {
|
||||
class SN74HC595GPIOPin final : public GPIOPin, public Parented<SN74HC595Component> {
|
||||
public:
|
||||
void setup() override {}
|
||||
void pin_mode(gpio::Flags flags) override {}
|
||||
@@ -66,7 +66,7 @@ class SN74HC595GPIOPin : public GPIOPin, public Parented<SN74HC595Component> {
|
||||
bool inverted_;
|
||||
};
|
||||
|
||||
class SN74HC595GPIOComponent : public SN74HC595Component {
|
||||
class SN74HC595GPIOComponent final : public SN74HC595Component {
|
||||
public:
|
||||
void setup() override;
|
||||
void set_data_pin(GPIOPin *pin) { data_pin_ = pin; }
|
||||
@@ -80,9 +80,9 @@ class SN74HC595GPIOComponent : public SN74HC595Component {
|
||||
};
|
||||
|
||||
#ifdef USE_SPI
|
||||
class SN74HC595SPIComponent : public SN74HC595Component,
|
||||
public spi::SPIDevice<spi::BIT_ORDER_MSB_FIRST, spi::CLOCK_POLARITY_LOW,
|
||||
spi::CLOCK_PHASE_LEADING, spi::DATA_RATE_4MHZ> {
|
||||
class SN74HC595SPIComponent final : public SN74HC595Component,
|
||||
public spi::SPIDevice<spi::BIT_ORDER_MSB_FIRST, spi::CLOCK_POLARITY_LOW,
|
||||
spi::CLOCK_PHASE_LEADING, spi::DATA_RATE_4MHZ> {
|
||||
public:
|
||||
void setup() override;
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace esphome::sntp {
|
||||
/// The C library (newlib) available on ESPs only supports TZ strings that specify an offset and DST info;
|
||||
/// you cannot specify zone names or paths to zoneinfo files.
|
||||
/// \see https://www.gnu.org/software/libc/manual/html_node/TZ-Variable.html
|
||||
class SNTPComponent : public time::RealTimeClock {
|
||||
class SNTPComponent final : public time::RealTimeClock {
|
||||
public:
|
||||
SNTPComponent(const std::array<const char *, SNTP_SERVER_COUNT> &servers) : servers_(servers) {}
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
|
||||
namespace esphome::sonoff_d1 {
|
||||
|
||||
class SonoffD1Output : public light::LightOutput, public uart::UARTDevice, public Component {
|
||||
class SonoffD1Output final : public light::LightOutput, public uart::UARTDevice, public Component {
|
||||
public:
|
||||
// LightOutput methods
|
||||
light::LightTraits get_traits() override;
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
namespace esphome::sound_level {
|
||||
|
||||
class SoundLevelComponent : public Component {
|
||||
class SoundLevelComponent final : public Component {
|
||||
public:
|
||||
void dump_config() override;
|
||||
void setup() override;
|
||||
@@ -59,12 +59,12 @@ class SoundLevelComponent : public Component {
|
||||
uint32_t measurement_duration_ms_;
|
||||
};
|
||||
|
||||
template<typename... Ts> class StartAction : public Action<Ts...>, public Parented<SoundLevelComponent> {
|
||||
template<typename... Ts> class StartAction final : public Action<Ts...>, public Parented<SoundLevelComponent> {
|
||||
public:
|
||||
void play(const Ts &...x) override { this->parent_->start(); }
|
||||
};
|
||||
|
||||
template<typename... Ts> class StopAction : public Action<Ts...>, public Parented<SoundLevelComponent> {
|
||||
template<typename... Ts> class StopAction final : public Action<Ts...>, public Parented<SoundLevelComponent> {
|
||||
public:
|
||||
void play(const Ts &...x) override { this->parent_->stop(); }
|
||||
};
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
namespace esphome::spa06_i2c {
|
||||
|
||||
class SPA06I2CComponent : public spa06_base::SPA06Component, public i2c::I2CDevice {
|
||||
class SPA06I2CComponent final : public spa06_base::SPA06Component, public i2c::I2CDevice {
|
||||
public:
|
||||
bool spa_read_byte(uint8_t a_register, uint8_t *data) override { return read_byte(a_register, data); }
|
||||
bool spa_write_byte(uint8_t a_register, uint8_t data) override { return write_byte(a_register, data); }
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
|
||||
namespace esphome::spa06_spi {
|
||||
|
||||
class SPA06SPIComponent : public spa06_base::SPA06Component,
|
||||
public spi::SPIDevice<spi::BIT_ORDER_MSB_FIRST, spi::CLOCK_POLARITY_HIGH,
|
||||
spi::CLOCK_PHASE_TRAILING, spi::DATA_RATE_200KHZ> {
|
||||
class SPA06SPIComponent final : public spa06_base::SPA06Component,
|
||||
public spi::SPIDevice<spi::BIT_ORDER_MSB_FIRST, spi::CLOCK_POLARITY_HIGH,
|
||||
spi::CLOCK_PHASE_TRAILING, spi::DATA_RATE_200KHZ> {
|
||||
void setup() override;
|
||||
bool spa_read_byte(uint8_t a_register, uint8_t *data) override;
|
||||
bool spa_write_byte(uint8_t a_register, uint8_t data) override;
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
namespace esphome::speaker {
|
||||
|
||||
template<typename... Ts> class PlayAction : public Action<Ts...>, public Parented<Speaker> {
|
||||
template<typename... Ts> class PlayAction final : public Action<Ts...>, public Parented<Speaker> {
|
||||
public:
|
||||
void set_data_template(std::vector<uint8_t> (*func)(Ts...)) {
|
||||
this->data_.func = func;
|
||||
@@ -38,12 +38,12 @@ template<typename... Ts> class PlayAction : public Action<Ts...>, public Parente
|
||||
} data_;
|
||||
};
|
||||
|
||||
template<typename... Ts> class VolumeSetAction : public Action<Ts...>, public Parented<Speaker> {
|
||||
template<typename... Ts> class VolumeSetAction final : public Action<Ts...>, public Parented<Speaker> {
|
||||
TEMPLATABLE_VALUE(float, volume)
|
||||
void play(const Ts &...x) override { this->parent_->set_volume(this->volume_.value(x...)); }
|
||||
};
|
||||
|
||||
template<typename... Ts> class MuteOnAction : public Action<Ts...> {
|
||||
template<typename... Ts> class MuteOnAction final : public Action<Ts...> {
|
||||
public:
|
||||
explicit MuteOnAction(Speaker *speaker) : speaker_(speaker) {}
|
||||
|
||||
@@ -53,7 +53,7 @@ template<typename... Ts> class MuteOnAction : public Action<Ts...> {
|
||||
Speaker *speaker_;
|
||||
};
|
||||
|
||||
template<typename... Ts> class MuteOffAction : public Action<Ts...> {
|
||||
template<typename... Ts> class MuteOffAction final : public Action<Ts...> {
|
||||
public:
|
||||
explicit MuteOffAction(Speaker *speaker) : speaker_(speaker) {}
|
||||
|
||||
@@ -63,22 +63,22 @@ template<typename... Ts> class MuteOffAction : public Action<Ts...> {
|
||||
Speaker *speaker_;
|
||||
};
|
||||
|
||||
template<typename... Ts> class StopAction : public Action<Ts...>, public Parented<Speaker> {
|
||||
template<typename... Ts> class StopAction final : public Action<Ts...>, public Parented<Speaker> {
|
||||
public:
|
||||
void play(const Ts &...x) override { this->parent_->stop(); }
|
||||
};
|
||||
|
||||
template<typename... Ts> class FinishAction : public Action<Ts...>, public Parented<Speaker> {
|
||||
template<typename... Ts> class FinishAction final : public Action<Ts...>, public Parented<Speaker> {
|
||||
public:
|
||||
void play(const Ts &...x) override { this->parent_->finish(); }
|
||||
};
|
||||
|
||||
template<typename... Ts> class IsPlayingCondition : public Condition<Ts...>, public Parented<Speaker> {
|
||||
template<typename... Ts> class IsPlayingCondition final : public Condition<Ts...>, public Parented<Speaker> {
|
||||
public:
|
||||
bool check(const Ts &...x) override { return this->parent_->is_running(); }
|
||||
};
|
||||
|
||||
template<typename... Ts> class IsStoppedCondition : public Condition<Ts...>, public Parented<Speaker> {
|
||||
template<typename... Ts> class IsStoppedCondition final : public Condition<Ts...>, public Parented<Speaker> {
|
||||
public:
|
||||
bool check(const Ts &...x) override { return this->parent_->is_stopped(); }
|
||||
};
|
||||
|
||||
@@ -56,7 +56,7 @@ struct InfoErrorEvent {
|
||||
optional<DecodingError> decoding_err;
|
||||
};
|
||||
|
||||
class AudioPipeline {
|
||||
class AudioPipeline final {
|
||||
public:
|
||||
/// @param speaker ESPHome speaker component for pipeline's audio output
|
||||
/// @param buffer_size Size of the buffer in bytes between the reader and decoder
|
||||
|
||||
@@ -9,7 +9,8 @@
|
||||
|
||||
namespace esphome::speaker {
|
||||
|
||||
template<typename... Ts> class PlayOnDeviceMediaAction : public Action<Ts...>, public Parented<SpeakerMediaPlayer> {
|
||||
template<typename... Ts>
|
||||
class PlayOnDeviceMediaAction final : public Action<Ts...>, public Parented<SpeakerMediaPlayer> {
|
||||
TEMPLATABLE_VALUE(audio::AudioFile *, audio_file)
|
||||
TEMPLATABLE_VALUE(bool, announcement)
|
||||
TEMPLATABLE_VALUE(bool, enqueue)
|
||||
|
||||
@@ -42,11 +42,11 @@ struct VolumeRestoreState {
|
||||
bool is_muted;
|
||||
};
|
||||
|
||||
class SpeakerMediaPlayer : public Component,
|
||||
public media_player::MediaPlayer
|
||||
class SpeakerMediaPlayer final : public Component,
|
||||
public media_player::MediaPlayer
|
||||
#ifdef USE_OTA_STATE_LISTENER
|
||||
,
|
||||
public ota::OTAGlobalStateListener
|
||||
public ota::OTAGlobalStateListener
|
||||
#endif
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
namespace esphome::speaker_source {
|
||||
|
||||
template<typename... Ts> class SetPlaylistDelayAction : public Action<Ts...> {
|
||||
template<typename... Ts> class SetPlaylistDelayAction final : public Action<Ts...> {
|
||||
public:
|
||||
explicit SetPlaylistDelayAction(SpeakerSourceMediaPlayer *parent) : parent_(parent) {}
|
||||
|
||||
|
||||
@@ -146,7 +146,7 @@ struct VolumeRestoreState {
|
||||
bool is_muted;
|
||||
};
|
||||
|
||||
class SpeakerSourceMediaPlayer : public Component, public media_player::MediaPlayer {
|
||||
class SpeakerSourceMediaPlayer final : public Component, public media_player::MediaPlayer {
|
||||
friend struct SourceBinding;
|
||||
|
||||
public:
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
namespace esphome::speed {
|
||||
|
||||
class SpeedFan : public Component, public fan::Fan {
|
||||
class SpeedFan final : public Component, public fan::Fan {
|
||||
public:
|
||||
SpeedFan(int speed_count) : speed_count_(speed_count) {}
|
||||
void setup() override;
|
||||
|
||||
@@ -334,7 +334,7 @@ class SPIBus {
|
||||
|
||||
class SPIClient;
|
||||
|
||||
class SPIComponent : public Component {
|
||||
class SPIComponent final : public Component {
|
||||
public:
|
||||
SPIDelegate *register_device(SPIClient *device, SPIMode mode, SPIBitOrder bit_order, uint32_t data_rate,
|
||||
GPIOPin *cs_pin, bool release_device, bool write_only);
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
|
||||
namespace esphome::spi_device {
|
||||
|
||||
class SPIDeviceComponent : public Component,
|
||||
public spi::SPIDevice<spi::BIT_ORDER_MSB_FIRST, spi::CLOCK_POLARITY_HIGH,
|
||||
spi::CLOCK_PHASE_TRAILING, spi::DATA_RATE_1MHZ> {
|
||||
class SPIDeviceComponent final : public Component,
|
||||
public spi::SPIDevice<spi::BIT_ORDER_MSB_FIRST, spi::CLOCK_POLARITY_HIGH,
|
||||
spi::CLOCK_PHASE_TRAILING, spi::DATA_RATE_1MHZ> {
|
||||
public:
|
||||
void setup() override;
|
||||
void dump_config() override;
|
||||
|
||||
@@ -8,9 +8,9 @@
|
||||
namespace esphome::spi_led_strip {
|
||||
|
||||
static const char *const TAG = "spi_led_strip";
|
||||
class SpiLedStrip : public light::AddressableLight,
|
||||
public spi::SPIDevice<spi::BIT_ORDER_MSB_FIRST, spi::CLOCK_POLARITY_HIGH, spi::CLOCK_PHASE_TRAILING,
|
||||
spi::DATA_RATE_1MHZ> {
|
||||
class SpiLedStrip final : public light::AddressableLight,
|
||||
public spi::SPIDevice<spi::BIT_ORDER_MSB_FIRST, spi::CLOCK_POLARITY_HIGH,
|
||||
spi::CLOCK_PHASE_TRAILING, spi::DATA_RATE_1MHZ> {
|
||||
public:
|
||||
SpiLedStrip(uint16_t num_leds);
|
||||
void setup() override;
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
namespace esphome::sprinkler {
|
||||
|
||||
template<typename... Ts> class SetDividerAction : public Action<Ts...> {
|
||||
template<typename... Ts> class SetDividerAction final : public Action<Ts...> {
|
||||
public:
|
||||
explicit SetDividerAction(Sprinkler *a_sprinkler) : sprinkler_(a_sprinkler) {}
|
||||
|
||||
@@ -18,7 +18,7 @@ template<typename... Ts> class SetDividerAction : public Action<Ts...> {
|
||||
Sprinkler *sprinkler_;
|
||||
};
|
||||
|
||||
template<typename... Ts> class SetMultiplierAction : public Action<Ts...> {
|
||||
template<typename... Ts> class SetMultiplierAction final : public Action<Ts...> {
|
||||
public:
|
||||
explicit SetMultiplierAction(Sprinkler *a_sprinkler) : sprinkler_(a_sprinkler) {}
|
||||
|
||||
@@ -30,7 +30,7 @@ template<typename... Ts> class SetMultiplierAction : public Action<Ts...> {
|
||||
Sprinkler *sprinkler_;
|
||||
};
|
||||
|
||||
template<typename... Ts> class QueueValveAction : public Action<Ts...> {
|
||||
template<typename... Ts> class QueueValveAction final : public Action<Ts...> {
|
||||
public:
|
||||
explicit QueueValveAction(Sprinkler *a_sprinkler) : sprinkler_(a_sprinkler) {}
|
||||
|
||||
@@ -46,7 +46,7 @@ template<typename... Ts> class QueueValveAction : public Action<Ts...> {
|
||||
Sprinkler *sprinkler_;
|
||||
};
|
||||
|
||||
template<typename... Ts> class ClearQueuedValvesAction : public Action<Ts...> {
|
||||
template<typename... Ts> class ClearQueuedValvesAction final : public Action<Ts...> {
|
||||
public:
|
||||
explicit ClearQueuedValvesAction(Sprinkler *a_sprinkler) : sprinkler_(a_sprinkler) {}
|
||||
|
||||
@@ -56,7 +56,7 @@ template<typename... Ts> class ClearQueuedValvesAction : public Action<Ts...> {
|
||||
Sprinkler *sprinkler_;
|
||||
};
|
||||
|
||||
template<typename... Ts> class SetRepeatAction : public Action<Ts...> {
|
||||
template<typename... Ts> class SetRepeatAction final : public Action<Ts...> {
|
||||
public:
|
||||
explicit SetRepeatAction(Sprinkler *a_sprinkler) : sprinkler_(a_sprinkler) {}
|
||||
|
||||
@@ -68,7 +68,7 @@ template<typename... Ts> class SetRepeatAction : public Action<Ts...> {
|
||||
Sprinkler *sprinkler_;
|
||||
};
|
||||
|
||||
template<typename... Ts> class SetRunDurationAction : public Action<Ts...> {
|
||||
template<typename... Ts> class SetRunDurationAction final : public Action<Ts...> {
|
||||
public:
|
||||
explicit SetRunDurationAction(Sprinkler *a_sprinkler) : sprinkler_(a_sprinkler) {}
|
||||
|
||||
@@ -84,7 +84,7 @@ template<typename... Ts> class SetRunDurationAction : public Action<Ts...> {
|
||||
Sprinkler *sprinkler_;
|
||||
};
|
||||
|
||||
template<typename... Ts> class StartFromQueueAction : public Action<Ts...> {
|
||||
template<typename... Ts> class StartFromQueueAction final : public Action<Ts...> {
|
||||
public:
|
||||
explicit StartFromQueueAction(Sprinkler *a_sprinkler) : sprinkler_(a_sprinkler) {}
|
||||
|
||||
@@ -94,7 +94,7 @@ template<typename... Ts> class StartFromQueueAction : public Action<Ts...> {
|
||||
Sprinkler *sprinkler_;
|
||||
};
|
||||
|
||||
template<typename... Ts> class StartFullCycleAction : public Action<Ts...> {
|
||||
template<typename... Ts> class StartFullCycleAction final : public Action<Ts...> {
|
||||
public:
|
||||
explicit StartFullCycleAction(Sprinkler *a_sprinkler) : sprinkler_(a_sprinkler) {}
|
||||
|
||||
@@ -104,7 +104,7 @@ template<typename... Ts> class StartFullCycleAction : public Action<Ts...> {
|
||||
Sprinkler *sprinkler_;
|
||||
};
|
||||
|
||||
template<typename... Ts> class StartSingleValveAction : public Action<Ts...> {
|
||||
template<typename... Ts> class StartSingleValveAction final : public Action<Ts...> {
|
||||
public:
|
||||
explicit StartSingleValveAction(Sprinkler *a_sprinkler) : sprinkler_(a_sprinkler) {}
|
||||
|
||||
@@ -122,7 +122,7 @@ template<typename... Ts> class StartSingleValveAction : public Action<Ts...> {
|
||||
TemplatableValue<size_t, Ts...> valve_to_start_{};
|
||||
};
|
||||
|
||||
template<typename... Ts> class ShutdownAction : public Action<Ts...> {
|
||||
template<typename... Ts> class ShutdownAction final : public Action<Ts...> {
|
||||
public:
|
||||
explicit ShutdownAction(Sprinkler *a_sprinkler) : sprinkler_(a_sprinkler) {}
|
||||
|
||||
@@ -132,7 +132,7 @@ template<typename... Ts> class ShutdownAction : public Action<Ts...> {
|
||||
Sprinkler *sprinkler_;
|
||||
};
|
||||
|
||||
template<typename... Ts> class NextValveAction : public Action<Ts...> {
|
||||
template<typename... Ts> class NextValveAction final : public Action<Ts...> {
|
||||
public:
|
||||
explicit NextValveAction(Sprinkler *a_sprinkler) : sprinkler_(a_sprinkler) {}
|
||||
|
||||
@@ -142,7 +142,7 @@ template<typename... Ts> class NextValveAction : public Action<Ts...> {
|
||||
Sprinkler *sprinkler_;
|
||||
};
|
||||
|
||||
template<typename... Ts> class PreviousValveAction : public Action<Ts...> {
|
||||
template<typename... Ts> class PreviousValveAction final : public Action<Ts...> {
|
||||
public:
|
||||
explicit PreviousValveAction(Sprinkler *a_sprinkler) : sprinkler_(a_sprinkler) {}
|
||||
|
||||
@@ -152,7 +152,7 @@ template<typename... Ts> class PreviousValveAction : public Action<Ts...> {
|
||||
Sprinkler *sprinkler_;
|
||||
};
|
||||
|
||||
template<typename... Ts> class PauseAction : public Action<Ts...> {
|
||||
template<typename... Ts> class PauseAction final : public Action<Ts...> {
|
||||
public:
|
||||
explicit PauseAction(Sprinkler *a_sprinkler) : sprinkler_(a_sprinkler) {}
|
||||
|
||||
@@ -162,7 +162,7 @@ template<typename... Ts> class PauseAction : public Action<Ts...> {
|
||||
Sprinkler *sprinkler_;
|
||||
};
|
||||
|
||||
template<typename... Ts> class ResumeAction : public Action<Ts...> {
|
||||
template<typename... Ts> class ResumeAction final : public Action<Ts...> {
|
||||
public:
|
||||
explicit ResumeAction(Sprinkler *a_sprinkler) : sprinkler_(a_sprinkler) {}
|
||||
|
||||
@@ -172,7 +172,7 @@ template<typename... Ts> class ResumeAction : public Action<Ts...> {
|
||||
Sprinkler *sprinkler_;
|
||||
};
|
||||
|
||||
template<typename... Ts> class ResumeOrStartAction : public Action<Ts...> {
|
||||
template<typename... Ts> class ResumeOrStartAction final : public Action<Ts...> {
|
||||
public:
|
||||
explicit ResumeOrStartAction(Sprinkler *a_sprinkler) : sprinkler_(a_sprinkler) {}
|
||||
|
||||
|
||||
@@ -70,7 +70,7 @@ struct SprinklerValve {
|
||||
std::unique_ptr<Automation<>> valve_turn_on_automation;
|
||||
};
|
||||
|
||||
class SprinklerControllerNumber : public number::Number, public Component {
|
||||
class SprinklerControllerNumber final : public number::Number, public Component {
|
||||
public:
|
||||
void setup() override;
|
||||
void dump_config() override;
|
||||
@@ -89,7 +89,7 @@ class SprinklerControllerNumber : public number::Number, public Component {
|
||||
ESPPreferenceObject pref_;
|
||||
};
|
||||
|
||||
class SprinklerControllerSwitch : public switch_::Switch, public Component {
|
||||
class SprinklerControllerSwitch final : public switch_::Switch, public Component {
|
||||
public:
|
||||
SprinklerControllerSwitch();
|
||||
|
||||
@@ -173,7 +173,7 @@ class SprinklerValveRunRequest {
|
||||
SprinklerValveRunRequestOrigin origin_{USER};
|
||||
};
|
||||
|
||||
class Sprinkler : public Component {
|
||||
class Sprinkler final : public Component {
|
||||
public:
|
||||
Sprinkler();
|
||||
Sprinkler(const char *name);
|
||||
|
||||
@@ -6,17 +6,17 @@
|
||||
|
||||
namespace esphome::sps30 {
|
||||
|
||||
template<typename... Ts> class StartFanAction : public Action<Ts...>, public Parented<SPS30Component> {
|
||||
template<typename... Ts> class StartFanAction final : public Action<Ts...>, public Parented<SPS30Component> {
|
||||
public:
|
||||
void play(const Ts &...x) override { this->parent_->start_fan_cleaning(); }
|
||||
};
|
||||
|
||||
template<typename... Ts> class StartMeasurementAction : public Action<Ts...>, public Parented<SPS30Component> {
|
||||
template<typename... Ts> class StartMeasurementAction final : public Action<Ts...>, public Parented<SPS30Component> {
|
||||
public:
|
||||
void play(const Ts &...x) override { this->parent_->start_measurement(); }
|
||||
};
|
||||
|
||||
template<typename... Ts> class StopMeasurementAction : public Action<Ts...>, public Parented<SPS30Component> {
|
||||
template<typename... Ts> class StopMeasurementAction final : public Action<Ts...>, public Parented<SPS30Component> {
|
||||
public:
|
||||
void play(const Ts &...x) override { this->parent_->stop_measurement(); }
|
||||
};
|
||||
|
||||
@@ -8,7 +8,7 @@ namespace esphome::sps30 {
|
||||
|
||||
/// This class implements support for the Sensirion SPS30 i2c/UART Particulate Matter
|
||||
/// PM1.0, PM2.5, PM4, PM10 Air Quality sensors.
|
||||
class SPS30Component : public PollingComponent, public sensirion_common::SensirionI2CDevice {
|
||||
class SPS30Component final : public PollingComponent, public sensirion_common::SensirionI2CDevice {
|
||||
public:
|
||||
void set_pm_1_0_sensor(sensor::Sensor *pm_1_0) { pm_1_0_sensor_ = pm_1_0; }
|
||||
void set_pm_2_5_sensor(sensor::Sensor *pm_2_5) { pm_2_5_sensor_ = pm_2_5; }
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
namespace esphome::ssd1306_i2c {
|
||||
|
||||
class I2CSSD1306 : public ssd1306_base::SSD1306, public i2c::I2CDevice {
|
||||
class I2CSSD1306 final : public ssd1306_base::SSD1306, public i2c::I2CDevice {
|
||||
public:
|
||||
void setup() override;
|
||||
void dump_config() override;
|
||||
|
||||
@@ -6,9 +6,9 @@
|
||||
|
||||
namespace esphome::ssd1306_spi {
|
||||
|
||||
class SPISSD1306 : public ssd1306_base::SSD1306,
|
||||
public spi::SPIDevice<spi::BIT_ORDER_MSB_FIRST, spi::CLOCK_POLARITY_HIGH, spi::CLOCK_PHASE_TRAILING,
|
||||
spi::DATA_RATE_8MHZ> {
|
||||
class SPISSD1306 final : public ssd1306_base::SSD1306,
|
||||
public spi::SPIDevice<spi::BIT_ORDER_MSB_FIRST, spi::CLOCK_POLARITY_HIGH,
|
||||
spi::CLOCK_PHASE_TRAILING, spi::DATA_RATE_8MHZ> {
|
||||
public:
|
||||
void set_dc_pin(GPIOPin *dc_pin) { dc_pin_ = dc_pin; }
|
||||
|
||||
|
||||
@@ -6,9 +6,9 @@
|
||||
|
||||
namespace esphome::ssd1322_spi {
|
||||
|
||||
class SPISSD1322 : public ssd1322_base::SSD1322,
|
||||
public spi::SPIDevice<spi::BIT_ORDER_MSB_FIRST, spi::CLOCK_POLARITY_HIGH, spi::CLOCK_PHASE_TRAILING,
|
||||
spi::DATA_RATE_8MHZ> {
|
||||
class SPISSD1322 final : public ssd1322_base::SSD1322,
|
||||
public spi::SPIDevice<spi::BIT_ORDER_MSB_FIRST, spi::CLOCK_POLARITY_HIGH,
|
||||
spi::CLOCK_PHASE_TRAILING, spi::DATA_RATE_8MHZ> {
|
||||
public:
|
||||
void set_dc_pin(GPIOPin *dc_pin) { dc_pin_ = dc_pin; }
|
||||
|
||||
|
||||
@@ -6,9 +6,9 @@
|
||||
|
||||
namespace esphome::ssd1325_spi {
|
||||
|
||||
class SPISSD1325 : public ssd1325_base::SSD1325,
|
||||
public spi::SPIDevice<spi::BIT_ORDER_MSB_FIRST, spi::CLOCK_POLARITY_HIGH, spi::CLOCK_PHASE_TRAILING,
|
||||
spi::DATA_RATE_8MHZ> {
|
||||
class SPISSD1325 final : public ssd1325_base::SSD1325,
|
||||
public spi::SPIDevice<spi::BIT_ORDER_MSB_FIRST, spi::CLOCK_POLARITY_HIGH,
|
||||
spi::CLOCK_PHASE_TRAILING, spi::DATA_RATE_8MHZ> {
|
||||
public:
|
||||
void set_dc_pin(GPIOPin *dc_pin) { dc_pin_ = dc_pin; }
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
namespace esphome::ssd1327_i2c {
|
||||
|
||||
class I2CSSD1327 : public ssd1327_base::SSD1327, public i2c::I2CDevice {
|
||||
class I2CSSD1327 final : public ssd1327_base::SSD1327, public i2c::I2CDevice {
|
||||
public:
|
||||
void setup() override;
|
||||
void dump_config() override;
|
||||
|
||||
@@ -6,9 +6,9 @@
|
||||
|
||||
namespace esphome::ssd1327_spi {
|
||||
|
||||
class SPISSD1327 : public ssd1327_base::SSD1327,
|
||||
public spi::SPIDevice<spi::BIT_ORDER_MSB_FIRST, spi::CLOCK_POLARITY_HIGH, spi::CLOCK_PHASE_TRAILING,
|
||||
spi::DATA_RATE_8MHZ> {
|
||||
class SPISSD1327 final : public ssd1327_base::SSD1327,
|
||||
public spi::SPIDevice<spi::BIT_ORDER_MSB_FIRST, spi::CLOCK_POLARITY_HIGH,
|
||||
spi::CLOCK_PHASE_TRAILING, spi::DATA_RATE_8MHZ> {
|
||||
public:
|
||||
void set_dc_pin(GPIOPin *dc_pin) { dc_pin_ = dc_pin; }
|
||||
|
||||
|
||||
@@ -6,9 +6,9 @@
|
||||
|
||||
namespace esphome::ssd1331_spi {
|
||||
|
||||
class SPISSD1331 : public ssd1331_base::SSD1331,
|
||||
public spi::SPIDevice<spi::BIT_ORDER_MSB_FIRST, spi::CLOCK_POLARITY_HIGH, spi::CLOCK_PHASE_TRAILING,
|
||||
spi::DATA_RATE_8MHZ> {
|
||||
class SPISSD1331 final : public ssd1331_base::SSD1331,
|
||||
public spi::SPIDevice<spi::BIT_ORDER_MSB_FIRST, spi::CLOCK_POLARITY_HIGH,
|
||||
spi::CLOCK_PHASE_TRAILING, spi::DATA_RATE_8MHZ> {
|
||||
public:
|
||||
void set_dc_pin(GPIOPin *dc_pin) { dc_pin_ = dc_pin; }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user