Publish keypad code and rolling log
This commit is contained in:
@@ -16,6 +16,10 @@
|
||||
#include <NimBLEDevice.h>
|
||||
#include "BleInterfaces.h"
|
||||
|
||||
// Access to a globally available instance of BleScanner, created when first used
|
||||
// Note that BLESCANNER.initialize() has to be called somewhere
|
||||
#define BLESCANNER BleScanner::Scanner::instance()
|
||||
|
||||
namespace BleScanner {
|
||||
|
||||
class Scanner : public Publisher, BLEAdvertisedDeviceCallbacks {
|
||||
@@ -23,6 +27,11 @@ class Scanner : public Publisher, BLEAdvertisedDeviceCallbacks {
|
||||
Scanner(int reservedSubscribers = 10);
|
||||
~Scanner() = default;
|
||||
|
||||
static Scanner& instance() {
|
||||
static Scanner* scanner = new Scanner(); // only initialized once on first call
|
||||
return *scanner;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Initializes the BLE scanner
|
||||
*
|
||||
@@ -77,7 +86,7 @@ class Scanner : public Publisher, BLEAdvertisedDeviceCallbacks {
|
||||
void onResult(NimBLEAdvertisedDevice* advertisedDevice) override;
|
||||
|
||||
private:
|
||||
uint32_t scanDuration = 3;
|
||||
uint32_t scanDuration = 0; //default indefinite scanning time
|
||||
BLEScan* bleScan = nullptr;
|
||||
std::vector<Subscriber*> subscribers;
|
||||
uint16_t scanErrors = 0;
|
||||
|
||||
Reference in New Issue
Block a user