|
Generalized-Core-Counter 3.20
Particle-based generalized core counter firmware
|
Generic sensor data structure. More...
#include <ISensor.h>
Public Member Functions | |
| SensorData () | |
| Construct a new SensorData with default values. | |
| bool | toJSON (char *buffer, size_t bufferSize) const |
| Convert sensor data to JSON string for publishing. | |
Public Attributes | |
| uint16_t | aux1 |
| Auxiliary numeric field 1. | |
| uint16_t | aux2 |
| Auxiliary numeric field 2. | |
| bool | flag1 |
| Generic boolean flag (e.g., motionDetected, occupied, inRange). | |
| bool | flag2 |
| Spare boolean flag for future use. | |
| bool | hasNewData |
| Flag indicating if this record contains new data. | |
| uint16_t | primary |
| Main numeric value (count, distance, faceNumber, ...). | |
| uint16_t | secondary |
| Secondary numeric value (score, quality, ...). | |
| char | sensorType [16] |
| Type of sensor ("PIR", "Ultrasonic", etc.). | |
| time_t | timestamp |
| When the data was captured (Unix time). | |
Generic sensor data structure.
This structure is intentionally generic so different sensor types (PIR, ultrasonic, gesture, etc.) can share the same layout. The meaning of each numeric/boolean field is defined by the sensorType string.
Examples:
Uses only POD types and fixed-size char[] to avoid heap use.
|
inline |
Construct a new SensorData with default values.
Definition at line 54 of file ISensor.h.
References aux1, aux2, flag1, flag2, hasNewData, primary, secondary, sensorType, and timestamp.
|
inline |
Convert sensor data to JSON string for publishing.
| buffer | Character buffer to write JSON into |
| bufferSize | Size of the buffer |
Definition at line 156 of file ISensor.h.
References aux1, aux2, flag1, flag2, primary, secondary, sensorType, and timestamp.
| uint16_t SensorData::aux1 |
Auxiliary numeric field 1.
Definition at line 40 of file ISensor.h.
Referenced by SensorData(), and toJSON().
| uint16_t SensorData::aux2 |
Auxiliary numeric field 2.
Definition at line 43 of file ISensor.h.
Referenced by SensorData(), and toJSON().
| bool SensorData::flag1 |
Generic boolean flag (e.g., motionDetected, occupied, inRange).
Definition at line 46 of file ISensor.h.
Referenced by SensorData(), and toJSON().
| bool SensorData::flag2 |
Spare boolean flag for future use.
Definition at line 49 of file ISensor.h.
Referenced by SensorData(), and toJSON().
| bool SensorData::hasNewData |
Flag indicating if this record contains new data.
Definition at line 31 of file ISensor.h.
Referenced by SensorData().
| uint16_t SensorData::primary |
Main numeric value (count, distance, faceNumber, ...).
Definition at line 34 of file ISensor.h.
Referenced by SensorData(), and toJSON().
| uint16_t SensorData::secondary |
Secondary numeric value (score, quality, ...).
Definition at line 37 of file ISensor.h.
Referenced by SensorData(), and toJSON().
| char SensorData::sensorType[16] |
Type of sensor ("PIR", "Ultrasonic", etc.).
Definition at line 28 of file ISensor.h.
Referenced by SensorData(), and toJSON().
| time_t SensorData::timestamp |
When the data was captured (Unix time).
Definition at line 25 of file ISensor.h.
Referenced by SensorData(), and toJSON().