Base Compoenent

The espp::BaseComponent provides a simple base class for all components in the ESP-CPP package. It provides a simple interface for the component to be initialized and to be updated.

It is not required to use the BaseComponent class, but it is recommended to use as it provides a standardized API for logging and log management.

API Reference

Header File

Classes

class BaseComponent

Base class for all components Provides a logger and some basic logging configuration

Subclassed by espp::BasePeripheral< uint8_t, Mt6701Interface::I2C==Mt6701Interface::I2C >, espp::BasePeripheral< std::uint16_t >, espp::BasePeripheral< uint8_t, Interface==Mt6701Interface::I2C >, espp::BasePeripheral< uint16_t >, espp::BasePeripheral< std::uint8_t >, espp::BldcMotor< espp::BldcDriver, Encoder >, espp::AbiEncoder< T >, espp::BasePeripheral< RegisterAddressType, UseAddress >, espp::BatteryService, espp::BldcDriver, espp::BldcHaptics< M >, espp::BldcMotor< D, S, CS >, espp::BleGattServer, espp::ContinuousAdc, espp::Controller, espp::DeviceInfoService, espp::Display< Pixel >, espp::EncoderInput, espp::EspBox, espp::EspTimerCam, espp::EventManager, espp::FileSystem, espp::FtpClientSession, espp::FtpServer, espp::GfpsService, espp::HidService, espp::HighResolutionTimer, espp::I2c, espp::Interrupt, espp::Joystick, espp::KeypadInput, espp::Led, espp::LedStrip, espp::MatouchRotaryDisplay, espp::MotorGoMini, espp::Nvs, espp::NvsHandle, espp::OneshotAdc, espp::Pid, espp::PointerInput, espp::Rmt, espp::RtspClient, espp::RtspServer, espp::RtspSession, espp::Socket, espp::SsRoundDisplay, espp::TDeck, espp::TDongleS3, espp::Task, espp::TaskMonitor, espp::Thermistor, espp::Timer, espp::TouchpadInput, espp::WifiAp, espp::WifiSta, espp::WroverKit

Public Functions

inline const std::string &get_name() const

Get the name of the component

Note

This is the tag of the logger

Returns

A const reference to the name of the component

inline void set_log_tag(const std::string_view &tag)

Set the tag for the logger

Parameters

tag – The tag to use for the logger

inline espp::Logger::Verbosity get_log_level() const

Get the log level for the logger

Returns

The verbosity level of the logger

inline void set_log_level(espp::Logger::Verbosity level)

Set the log level for the logger

Parameters

level – The verbosity level to use for the logger

inline void set_log_verbosity(espp::Logger::Verbosity level)

Set the log verbosity for the logger

See also

set_log_level

Note

This is a convenience method that calls set_log_level

Parameters

level – The verbosity level to use for the logger

inline espp::Logger::Verbosity get_log_verbosity() const

Get the log verbosity for the logger

See also

get_log_level

Note

This is a convenience method that calls get_log_level

Returns

The verbosity level of the logger

inline void set_log_rate_limit(std::chrono::duration<float> rate_limit)

Set the rate limit for the logger

Note

Only calls to the logger that have _rate_limit suffix will be rate limited

Parameters

rate_limit – The rate limit to use for the logger