Receive, decode and store Bresser Weather Sensor Data Uses CC1101 or SX1276 radio module for receiving FSK modulated signal at 868 MHz.
More...
#include <WeatherSensor.h>
|
int16_t | begin (uint8_t max_sensors_default=MAX_SENSORS_DEFAULT, bool init_filters=true, double frequency_offset=0.0) |
| Presence check and initialization of radio module.
|
|
void | radioReset (void) |
| Reset radio transceiver.
|
|
void | sleep (void) |
| Set transceiver into sleep mode.
|
|
bool | getData (uint32_t timeout, uint8_t flags=0, uint8_t type=0, void(*func)()=NULL) |
| Wait for reception of data or occurrence of timeout. With BRESSER_6_IN_1, data is distributed across two different messages. Reception of entire data is tried if 'complete' is set.
|
|
DecodeStatus | getMessage (void) |
| Tries to receive radio message (non-blocking) and to decode it. Timeout occurs after a multitude of expected time-on-air.
|
|
DecodeStatus | decodeMessage (const uint8_t *msg, uint8_t msgSize) |
| Decode message Tries the available decoders until a decoding was successful.
|
|
bool | genMessage (int i, uint32_t id=0xff, uint8_t s_type=1, uint8_t channel=0, uint8_t startup=0) |
| Generates data otherwise received and decoded from a radio message.
|
|
void | clearSlots (uint8_t type=0xFF) |
| Clear sensor data.
|
|
int | findId (uint32_t id) |
|
int | findType (uint8_t type, uint8_t channel=0xFF) |
|
void | setSensorsInc (uint8_t *bytes, uint8_t size) |
|
void | setSensorsExc (uint8_t *bytes, uint8_t size) |
|
void | setSensorsCfg (uint8_t max_sensors, uint8_t rx_flags, uint8_t en_decoders=0xFF) |
|
uint8_t | getSensorsInc (uint8_t *payload) |
|
uint8_t | getSensorsExc (uint8_t *payload) |
|
uint8_t | convSensorsJson (std::vector< uint32_t > &ids, String json, uint8_t *buf) |
|
void | setSensorsIncJson (String json) |
|
void | setSensorsExcJson (String json) |
|
String | getSensorsJson (std::vector< uint32_t > &ids) |
|
String | getSensorsIncJson (void) |
|
String | getSensorsExcJson (void) |
|
void | getSensorsCfg (uint8_t &max_sensors, uint8_t &rx_flags, uint8_t &en_decoders) |
|
|
std::vector< sensor_t > | sensor |
| sensor data array
|
|
float | rssi = 0.0 |
| received signal strength indicator in dBm
|
|
uint8_t | rxFlags |
| receive flags (see getData())
|
|
uint8_t | enDecoders = 0xFF |
| enabled Decoders
|
|
Receive, decode and store Bresser Weather Sensor Data Uses CC1101 or SX1276 radio module for receiving FSK modulated signal at 868 MHz.
◆ begin()
int16_t WeatherSensor::begin |
( |
uint8_t |
max_sensors_default = MAX_SENSORS_DEFAULT , |
|
|
bool |
init_filters = true , |
|
|
double |
frequency_offset = 0.0 |
|
) |
| |
Presence check and initialization of radio module.
- Returns
- RADIOLIB_ERR_NONE on success (otherwise does never return).
◆ clearSlots()
void WeatherSensor::clearSlots |
( |
uint8_t |
type = 0xFF | ) |
|
|
inline |
Clear sensor data.
If 'type' is not specified, all slots are cleared. If 'type' is specified, only slots containing data of the given sensor type are cleared.
- Parameters
-
◆ convSensorsJson()
uint8_t WeatherSensor::convSensorsJson |
( |
std::vector< uint32_t > & |
ids, |
|
|
String |
json, |
|
|
uint8_t * |
buf |
|
) |
| |
Convert sensor IDs from JSON string to byte array
- Parameters
-
ids | list of sensor IDs |
json | JSON string |
buf | buffer for storing sensor IDs |
- Returns
- size in bytes
◆ decodeMessage()
DecodeStatus WeatherSensor::decodeMessage |
( |
const uint8_t * |
msg, |
|
|
uint8_t |
msgSize |
|
) |
| |
Decode message Tries the available decoders until a decoding was successful.
- Returns
- DecodeStatus
◆ findId()
int WeatherSensor::findId |
( |
uint32_t |
id | ) |
|
Find slot of required data set by ID
- Parameters
-
- Returns
- slot (or -1 if not found)
◆ findType()
int WeatherSensor::findType |
( |
uint8_t |
type, |
|
|
uint8_t |
channel = 0xFF |
|
) |
| |
Find slot of required data set by type and (optionally) channel
- Parameters
-
type | sensor type |
channel | sensor channel (0xFF: don't care) |
- Returns
- slot (or -1 if not found)
◆ genMessage()
bool WeatherSensor::genMessage |
( |
int |
i, |
|
|
uint32_t |
id = 0xff , |
|
|
uint8_t |
s_type = 1 , |
|
|
uint8_t |
channel = 0 , |
|
|
uint8_t |
startup = 0 |
|
) |
| |
Generates data otherwise received and decoded from a radio message.
- Returns
- Always true (for compatibility with getMessage())
◆ getData()
bool WeatherSensor::getData |
( |
uint32_t |
timeout, |
|
|
uint8_t |
flags = 0 , |
|
|
uint8_t |
type = 0 , |
|
|
void(*)() |
func = NULL |
|
) |
| |
Wait for reception of data or occurrence of timeout. With BRESSER_6_IN_1, data is distributed across two different messages. Reception of entire data is tried if 'complete' is set.
- Parameters
-
timeout | timeout in ms. |
flags | DATA_COMPLETE / DATA_TYPE / DATA_ALL_SLOTS |
type | sensor type (combined with FLAGS==DATA_TYPE) |
func | Callback function for each loop iteration. (default: NULL) |
- Returns
- false: Timeout occurred. true: Reception (according to parameter 'complete') successful.
◆ getMessage()
DecodeStatus WeatherSensor::getMessage |
( |
void |
| ) |
|
Tries to receive radio message (non-blocking) and to decode it. Timeout occurs after a multitude of expected time-on-air.
- Returns
- DecodeStatus
◆ getSensorsCfg()
void WeatherSensor::getSensorsCfg |
( |
uint8_t & |
max_sensors, |
|
|
uint8_t & |
rx_flags, |
|
|
uint8_t & |
en_decoders |
|
) |
| |
Get maximum number of sensors from Preferences
- Parameters
-
max_sensors | maximum number of sensors |
rx_flags | receive flags (see getData()) |
en_decoders | enabled decoders |
◆ getSensorsExc()
uint8_t WeatherSensor::getSensorsExc |
( |
uint8_t * |
payload | ) |
|
Get sensors exclude list (Preferences/defaults)
- Parameters
-
payload | buffer for storing sensor IDs |
- Returns
- size size in bytes
◆ getSensorsExcJson()
String WeatherSensor::getSensorsExcJson |
( |
void |
| ) |
|
Get sensors exclude list as JSON string
- Returns
- JSON string
◆ getSensorsInc()
uint8_t WeatherSensor::getSensorsInc |
( |
uint8_t * |
payload | ) |
|
Get sensors include list (Preferences/defaults)
- Parameters
-
payload | buffer for storing sensor IDs |
- Returns
- size size in bytes
◆ getSensorsIncJson()
String WeatherSensor::getSensorsIncJson |
( |
void |
| ) |
|
Get sensors include list as JSON string
- Returns
- JSON string
◆ getSensorsJson()
String WeatherSensor::getSensorsJson |
( |
std::vector< uint32_t > & |
ids | ) |
|
Get sensors include/exclude list as JSON string
- Parameters
-
- Returns
- JSON string
◆ setSensorsCfg()
void WeatherSensor::setSensorsCfg |
( |
uint8_t |
max_sensors, |
|
|
uint8_t |
rx_flags, |
|
|
uint8_t |
en_decoders = 0xFF |
|
) |
| |
Set maximum number of sensors and store it in Preferences
- Parameters
-
max_sensors | maximum number of sensors |
rx_flags | receive flags (see getData()) |
en_decoders | enabled decoders |
◆ setSensorsExc()
void WeatherSensor::setSensorsExc |
( |
uint8_t * |
bytes, |
|
|
uint8_t |
size |
|
) |
| |
Set sensors include list in Preferences
- Parameters
-
bytes | sensor IDs |
size | buffer size in bytes |
◆ setSensorsExcJson()
void WeatherSensor::setSensorsExcJson |
( |
String |
json | ) |
|
Set sensors exclude list from JSON string
- Parameters
-
◆ setSensorsInc()
void WeatherSensor::setSensorsInc |
( |
uint8_t * |
bytes, |
|
|
uint8_t |
size |
|
) |
| |
Set sensors include list in Preferences
- Parameters
-
bytes | sensor IDs |
size | buffer size in bytes |
◆ setSensorsIncJson()
void WeatherSensor::setSensorsIncJson |
( |
String |
json | ) |
|
Set sensors include list from JSON string
- Parameters
-
The documentation for this class was generated from the following files:
- src/WeatherSensor.h
- src/WeatherSensor.cpp
- src/WeatherSensorConfig.cpp
- src/WeatherSensorDecoders.cpp