Skip to content

Component

Purpose

The EspComponent class serves as a general purpose super-class. It defines generic methods which should be implemented in sub-classes. All methods operate as virtual, therefore it is possible (more or less expected) to override these functions. EspComponent shall define a generalized interface in order to keep the code clean.

Usage

In order to be as generalized as possible the EspComponent class implements a template. This template is later used as the data type of the transfer parameter for the function setup().

virtual void setup(T setup_config){};

Due to the characteristic of templateparameters T can be any valid data type. Therefore the setup() method serves as an ideal interface in order to be implemented in all sorts of sub-class. E.g:

class NewSubClass : public EspComponent<uint8_t>{
  .
  .
  .
  public:
    void setup(uint8_t X) override; 
    .
    .
    .
}

Last update: 2022-02-14
Back to top