BLE Sensor (e.g. thermometer/hygrometer) client.
More...
#include <BleSensors.h>
|
| | BleSensors (std::vector< std::string > known_sensors, bool(*stopScanCb)()=nullptr) |
| | Constructor.
|
|
| BleSensors (bool(*stopScanCb)()=nullptr) |
| | Constructor.
|
| void | setAddresses (std::vector< std::string > known_sensors) |
| | Set BLE MAC addresses of known sensors.
|
|
void | begin (void) |
| | Initialization.
|
|
void | clearScanResults (void) |
| | Delete results from BLEScan buffer to release memory.
|
| unsigned | getData (uint32_t duration, bool activeScan=true) |
| | Get data from sensors by running a BLE scan.
|
|
void | resetData (void) |
| | Set sensor data invalid.
|
BLE Sensor (e.g. thermometer/hygrometer) client.
◆ BleSensors()
| BleSensors::BleSensors |
( |
std::vector< std::string > | known_sensors, |
|
|
bool(* | stopScanCb )() = nullptr ) |
|
inline |
Constructor.
- Parameters
-
| known_sensors | Vector of BLE MAC addresses of known sensors, e.g. {"11:22:33:44:55:66", "AA:BB:CC:DD:EE:FF"} |
◆ getData()
| unsigned BleSensors::getData |
( |
uint32_t | scanTime, |
|
|
bool | activeScan = true ) |
Get data from sensors by running a BLE scan.
Get BLE sensor data.
- Parameters
-
| duration | Scan duration in seconds |
| activeScan | 0: passive scan / 1: active scan |
- Returns
- Number of known sensors found (max. size of known_sensors vector)
Note: Decoding using TheengsDecoder is performed here after scanning, instead of during the NimBLE callback, to avoid heavy processing in the callback context, which can lead to the watchdog being triggered.
◆ setAddresses()
| void BleSensors::setAddresses |
( |
std::vector< std::string > | known_sensors | ) |
|
|
inline |
Set BLE MAC addresses of known sensors.
- Parameters
-
| known_sensors | vector of BLE MAC addresses (see constructor) |
The documentation for this class was generated from the following files: