RumPi 1.0
A self-assembling C++ sensor & actuator library for the Raspberry Pi 5
SelectedSensorReadings.h
Go to the documentation of this file.
1#pragma once
2#include <string>
3#include "SensorLevels.h"
4
5namespace RumPi
6{
18 {
19 protected:
23 std::string myAirQuality;
24 float myTVOC;
26 float myCO2;
29 float myLightLux;
30 std::string myLightCategory;
31
32 //Levels have no "absent" sentinel; check the paired reading (light category non-empty, air-quality string
33 //non-empty) to know whether the sensor was actually present before acting on these.
36
37 public:
50
62 virtual ~SelectedSensorReadings() = default;
63
76 float GetTemperatureCelsius() const;
77
90 float GetHumidityPercent() const;
91
104 float GetPmTwoPointFive() const;
105
118 const std::string& GetAirQuality() const;
119
132 float GetTVOC() const;
133
146 float GetFormaldehyde() const;
147
160 float GetCO2() const;
161
174 bool GetIsMotionDetected() const;
175
188 float GetWindSpeed() const;
189
202 float GetLightLux() const;
203
216 const std::string& GetLightCategory() const;
217
231
245
258 void SetTemperatureCelsius(const float temperatureCelsius);
259
272 void SetHumidityPercent(const float humidityPercent);
273
286 void SetPmTwoPointFive(const float pmTwoPointFive);
287
300 void SetAirQuality(const std::string& airQuality);
301
314 void SetTVOC(const float tvoc);
315
328 void SetFormaldehyde(const float formaldehyde);
329
342 void SetCO2(const float co2);
343
356 void SetIsMotionDetected(const bool isMotionDetected);
357
370 void SetWindSpeed(const float windSpeed);
371
384 void SetLightLux(const float lightLux);
385
398 void SetLightCategory(const std::string& lightCategory);
399
412 void SetLightLevel(const E_LightLevel lightLevel);
413
426 void SetAirQualityLevel(const E_AirQualityLevel airQualityLevel);
427 };
428} // namespace RumPi
A point-in-time copy of the SELECTED sensor readings the Home dashboard surfaces - a deliberately cur...
Definition: SelectedSensorReadings.h:18
float GetWindSpeed() const
Gets the wind speed reading.
Definition: SelectedSensorReadings.cpp:182
void SetAirQuality(const std::string &airQuality)
Sets the air-quality description.
Definition: SelectedSensorReadings.cpp:318
float GetTVOC() const
Gets the total volatile organic compounds (TVOC) reading.
Definition: SelectedSensorReadings.cpp:114
E_LightLevel GetLightLevel() const
Gets the categorized light level.
Definition: SelectedSensorReadings.cpp:233
const std::string & GetAirQuality() const
Gets the air-quality description.
Definition: SelectedSensorReadings.cpp:97
float myCO2
CO2 reading (NaN if not present).
Definition: SelectedSensorReadings.h:26
float myLightLux
Light level, in lux (NaN if not present).
Definition: SelectedSensorReadings.h:29
float GetPmTwoPointFive() const
Gets the PM2.5 particulate reading.
Definition: SelectedSensorReadings.cpp:80
float myFormaldehyde
Formaldehyde reading (NaN if not present).
Definition: SelectedSensorReadings.h:25
const std::string & GetLightCategory() const
Gets the human-readable light category.
Definition: SelectedSensorReadings.cpp:216
void SetLightLux(const float lightLux)
Sets the light level, in lux.
Definition: SelectedSensorReadings.cpp:420
void SetHumidityPercent(const float humidityPercent)
Sets the relative humidity, as a percent.
Definition: SelectedSensorReadings.cpp:284
float myWindSpeed
Wind speed reading (NaN if not present).
Definition: SelectedSensorReadings.h:28
float GetLightLux() const
Gets the light level, in lux.
Definition: SelectedSensorReadings.cpp:199
void SetCO2(const float co2)
Sets the CO2 reading.
Definition: SelectedSensorReadings.cpp:369
E_AirQualityLevel GetAirQualityLevel() const
Gets the categorized air-quality level.
Definition: SelectedSensorReadings.cpp:250
void SetPmTwoPointFive(const float pmTwoPointFive)
Sets the PM2.5 particulate reading.
Definition: SelectedSensorReadings.cpp:301
std::string myLightCategory
Human-readable light category (empty if not present).
Definition: SelectedSensorReadings.h:30
float myTemperatureCelsius
Temperature, in Celsius (NaN if not present).
Definition: SelectedSensorReadings.h:20
void SetTemperatureCelsius(const float temperatureCelsius)
Sets the temperature, in Celsius.
Definition: SelectedSensorReadings.cpp:267
float GetCO2() const
Gets the CO2 reading.
Definition: SelectedSensorReadings.cpp:148
void SetWindSpeed(const float windSpeed)
Sets the wind speed reading.
Definition: SelectedSensorReadings.cpp:403
SelectedSensorReadings()
Builds a SelectedSensorReadings with every numeric field defaulted to NaN ("no reading / sensor not p...
Definition: SelectedSensorReadings.cpp:17
void SetLightLevel(const E_LightLevel lightLevel)
Sets the categorized light level.
Definition: SelectedSensorReadings.cpp:454
float GetFormaldehyde() const
Gets the formaldehyde reading.
Definition: SelectedSensorReadings.cpp:131
void SetLightCategory(const std::string &lightCategory)
Sets the human-readable light category.
Definition: SelectedSensorReadings.cpp:437
float GetHumidityPercent() const
Gets the relative humidity, as a percent.
Definition: SelectedSensorReadings.cpp:63
virtual ~SelectedSensorReadings()=default
Defaulted destructor.
void SetAirQualityLevel(const E_AirQualityLevel airQualityLevel)
Sets the categorized air-quality level.
Definition: SelectedSensorReadings.cpp:471
E_AirQualityLevel myAirQualityLevel
Categorized air-quality level.
Definition: SelectedSensorReadings.h:35
void SetTVOC(const float tvoc)
Sets the total volatile organic compounds (TVOC) reading.
Definition: SelectedSensorReadings.cpp:335
float GetTemperatureCelsius() const
Gets the temperature, in Celsius.
Definition: SelectedSensorReadings.cpp:46
void SetFormaldehyde(const float formaldehyde)
Sets the formaldehyde reading.
Definition: SelectedSensorReadings.cpp:352
bool GetIsMotionDetected() const
Gets whether motion was detected.
Definition: SelectedSensorReadings.cpp:165
void SetIsMotionDetected(const bool isMotionDetected)
Sets whether motion was detected.
Definition: SelectedSensorReadings.cpp:386
E_LightLevel myLightLevel
Categorized light level.
Definition: SelectedSensorReadings.h:34
float myHumidityPercent
Relative humidity, as a percent (NaN if not present).
Definition: SelectedSensorReadings.h:21
bool myIsMotionDetected
True if motion was detected.
Definition: SelectedSensorReadings.h:27
std::string myAirQuality
Air-quality description (empty if not present).
Definition: SelectedSensorReadings.h:23
float myTVOC
Total volatile organic compounds reading (NaN if not present).
Definition: SelectedSensorReadings.h:24
float myPmTwoPointFive
PM2.5 particulate reading (NaN if not present).
Definition: SelectedSensorReadings.h:22
RumPi is the library's top-level facade.
Definition: AlertManager.h:6
E_AirQualityLevel
How bad the air is, best to worst, taking whichever of PM2.5 / PM10 is worse.
Definition: SensorLevels.h:34
E_LightLevel
How much light the sensor is seeing, darkest to brightest.
Definition: SensorLevels.h:17