Class Documentation

SensorFacade

class SensorFacade

The sensor facade holds a set of sensors and/or sensorSets.

Add all the sensors you’ll keep track on and call the begin() function. Thereafter call periodically the update() function. As last provide a callback and call ItrSensor() to read them out.

Inherits from ISensor

Public Functions

SensorFacade()

creates a sensor facade instance

SensorFacade(ITimeProvider *timeProvider)

creates a sensor facade instance with a time provider

Parameters
  • timeProvider:

SensorFacade(void (*sensorItr)(String, Data))

creates a sensor facade instance with a iteration callback

Parameters
  • sensorItr:

SensorFacade(ITimeProvider *timeProvider, void (*sensorItr)(String, Data))

creates a sensor facade with a time provider and a iteration callback

Parameters
  • timeProvider:
  • sensorItr:

void addSensor(Sensor *sensor)

add a sensor

Parameters
  • sensor:

void addSensorSet(SensorSet *sensorSet)

add a sensor set

Parameters
  • sensorSet:

Sensor *getSensor(int index)

get a sensor by index

Return
sensor
Parameters
  • index:

void setSensorItr(void (*sensorItr)(String, Data))

set a callback for the sensor iteration

Parameters
  • sensorItr:

void ItrSensor()

iterate over all the sensors using the predefined callback

int size()

get number of sensors

Return

void update()

call update function of all sensors

void begin()

call begin function of all sensors

SensorSet

class SensorSet

A sensor set helps you to add sensor metrics to one container.

e.g. a sensor that can reads the temperature as well the pressure.

Inherits from ISensor

Public Functions

SensorSet()

creates a sensor set

SensorSet(ITimeProvider *timeProvider)

creates a sensor set with a time provider

Parameters
  • timeProvider:

void begin()

call begin function of all sensors

void update()

call update function of all sensors

SensorLinkedList<Sensor *> getSensors()

Return
all the sensors of the container

Sensor

class Sensor

Each metric of each sensor should have an sensor implementation.

Implement the the update method or override the getData method.

Inherits from ISensor

Public Functions

Sensor(String name, ITimeProvider *timeProvider)

Parameters
  • name: of the sensor instance
  • timeProvider:

Sensor(String name)

Parameters
  • name: of the sensor instance

Data getData()

Return
last captured data

String getName()

Return
name of the sensor instance - used for e.g. MQTT topic

ISensor

class ISensor

an abstract sensor class

Subclassed by Sensor, SensorFacade, SensorSet

Public Functions

virtual void update()

use for sensors that needs periodic attention

virtual void begin()

use for sensors that needs initialization

ITimeProvider

class ITimeProvider

an abstract time provider class

Public Functions

virtual unsigned long getTime()

Return
abstract version returns always NAN

Data

struct Data

Public Functions

Data()

default struct constructor

Data(float value, unsigned long time)

Parameters
  • value:
  • time:

Public Members

float value = NAN

data enum value

unsigned long time = NAN

data enum time