Restart BLE controller
This commit is contained in:
@@ -20,6 +20,16 @@ Scanner::Scanner(int reservedSubscribers) {
|
||||
subscribers.reserve(reservedSubscribers);
|
||||
}
|
||||
|
||||
Scanner::~Scanner() {
|
||||
Serial.println("Destroying scanner");
|
||||
bleScan->stop();
|
||||
Serial.println("bleScan stopped");
|
||||
bleScan->clearResults();
|
||||
Serial.println("bleScan results cleared");
|
||||
bleScan = nullptr;
|
||||
Serial.println("bleScan nulled");
|
||||
}
|
||||
|
||||
void Scanner::initialize(const std::string& deviceName, const bool wantDuplicates, const uint16_t interval, const uint16_t window) {
|
||||
if (!BLEDevice::isInitialized()) {
|
||||
if (wantDuplicates) {
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace BleScanner {
|
||||
class Scanner : public Publisher, BLEAdvertisedDeviceCallbacks {
|
||||
public:
|
||||
Scanner(int reservedSubscribers = 10);
|
||||
~Scanner() = default;
|
||||
~Scanner();
|
||||
|
||||
static Scanner& instance() {
|
||||
static Scanner* scanner = new Scanner(); // only initialized once on first call
|
||||
|
||||
Reference in New Issue
Block a user