core-avr-sensor

SensorManager

class SensorManager

Manages all sensors.

Public Functions

SensorManager(DatabaseManager *data)

Constructor.

Parameters
  • data: The database layer.

~SensorManager()

Destructor.

bool add(Sensor *sensor)

Adds a sensor.

Return
True if the sensor was successfully added.
Parameters
  • sensor: The sensor to add.

bool remove(Sensor *sensor)

Removes a sensor.

Return
True if the sensor was successfully removed.
Parameters
  • sensor: The sensor to remove.

void update(double dt)

Updates sensors. This will automatically determine which sensors to poll and write to the database layer.

Parameters
  • dt: The amount of ms that has passed since last update.

Sensor

class Sensor

Abstract base class for a Sensor.

Subclassed by Dht11Sensor, DummySensor

Public Functions

Sensor()

Constructor.

virtual ~Sensor()

Destructor.

SensorConfig config()

Retrieves the configuration for this sensor.

Return
Config for this object.

bool init(SensorConfig config)

Initializes the sensor.

Return
True if sensor initialization was successful.
Parameters
  • config: The configuration for this sensor.

virtual bool poll(const float *values) = 0

Polls the sensor for values.

Return
True if the sensor could generate values.
Parameters
  • values: Output values.

Sensor Implementations

class Dht11Sensor

Sensor implementation for the DHT11 temperature/humidity sensor.

Inherits from Sensor