/////////////////////////////////////////////////////////////////////////// C0ZIRParser used to parse the stream from a COZIR CO2 sensor. Note: one can comment fields / code not used to minimize footprint.
| 176 | // Note: one can comment fields / code not used to minimize footprint. |
| 177 | // |
| 178 | class C0ZIRParser |
| 179 | { |
| 180 | public: |
| 181 | C0ZIRParser(); |
| 182 | |
| 183 | // init resets all internal values |
| 184 | void init(); |
| 185 | // resetParser only resets current FIELD (last values are kept). |
| 186 | void resetParser() { _field = 0; }; |
| 187 | |
| 188 | |
| 189 | // returns field char if a field is completed, 0 otherwise. |
| 190 | uint8_t nextChar(char c); |
| 191 | |
| 192 | // FETCH LAST READ VALUES |
| 193 | float celsius(); |
| 194 | float fahrenheit() { return (celsius() * 1.8) + 32; }; |
| 195 | float kelvin() { return celsius() + 273.15; }; |
| 196 | float humidity() { return 0.1 * _humidity; }; |
| 197 | |
| 198 | uint16_t light() { return _light; }; |
| 199 | uint16_t ledFilt() { return _LED_FILT; }; |
| 200 | uint16_t ledRaw() { return _LED_RAW; }; |
| 201 | uint16_t ledMax() { return _LED_MAX; }; |
| 202 | uint16_t ledSignalFilt() { return _LED_signal_FILT; }; |
| 203 | uint16_t ledSignalRaw() { return _LED_signal_RAW; }; |
| 204 | |
| 205 | uint16_t zeroPoint() { return _zeroPoint; }; |
| 206 | uint16_t tempFilt() { return _temperature_FILT; }; |
| 207 | uint16_t tempRaw() { return _temperature_RAW; }; |
| 208 | uint16_t tempSensor() { return _temperature_Sensor; }; |
| 209 | |
| 210 | uint16_t CO2() { return _CO2_FILT; }; |
| 211 | uint16_t CO2Raw() { return _CO2_RAW; }; |
| 212 | |
| 213 | uint16_t samples() { return _samples; }; |
| 214 | uint16_t getPPMFactor() { return _PPM; } |
| 215 | |
| 216 | |
| 217 | private: |
| 218 | // FIELD ID character |
| 219 | uint16_t _light; // L |
| 220 | uint16_t _humidity; // H |
| 221 | uint16_t _LED_FILT; // D |
| 222 | uint16_t _LED_RAW; // d |
| 223 | uint16_t _LED_MAX; // l // el not one |
| 224 | uint16_t _zeroPoint; // h |
| 225 | uint16_t _temperature_RAW; // V |
| 226 | uint16_t _temperature_FILT; // T |
| 227 | uint16_t _LED_signal_FILT; // o // oo not zero |
| 228 | uint16_t _LED_signal_RAW; // O // oo not zero |
| 229 | uint16_t _temperature_Sensor; // v |
| 230 | uint16_t _CO2_FILT; // Z |
| 231 | uint16_t _CO2_RAW; // z |
| 232 | |
| 233 | // not output fields sec but useful. |
| 234 | uint16_t _samples; // a |
| 235 | uint16_t _PPM; // . // point |
nothing calls this directly
no outgoing calls
no test coverage detected