- Create a class extending the Transformer base class in the transformers folder.
- Overload the transform function and don't forget to call the Transformer constructor.
- Include the header file in the
SensorFactory.h
file. - Write a
createThisTransformerFromStr
function in theSensorFactory.h
file. This function is expected to parse the key-value pairs from the config file and match them to the parameters with the same name. It should return astd::shared_ptr<Transformer>
result or a nullptr if the parsing failed. - Add an if statement for your Transformer to the
transformerFromConfigStr
function inSensorFactory.h
which calls your create function.
- Create a class extending the Sensor base class in the sensors folder.
- Overload the
readSensorRaw
function and don't forget to call the Sensor constructor. - Include the header file in the
SensorFactory.h
file. - Write a
createThisSensor
function in theSensorFactory.h
file which dynamically allocates your sensor and returns it as a pointer. - Write a
createThisSensorFromStr
function in theSensorFactory.h
file. This function is expected to parse the key-value pairs from the config file and match them to the parameters with the same name and calls the function you wrote in step 4 with those parameters. It should also call theparseTransformerChainFromConfigStr
function to read possible transformers added to your sensor. - Add an if statement to the
sensorFromConfigString
function in theSensorFactory.h
file which calls your function from step 5 with the config string.
The webinterface design was stolen and modified from the Jarolift_MQTT project by madmartin because I suck at webinterfaces.