Files
DoorCounter/firmware/src/ble_scanner.h
Peter Woolery ccbbf689cf feat: BLE passive scanner with RSSI bucketing and MAC hashing
Add passive BLE scan module using NimBLE for WiFi coexistence. Tracks
unique devices per hour with SHA256-hashed MACs, RSSI bucketing
(near/mid/far), max concurrent count, and thread-safe collect/reset.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-14 06:24:49 -07:00

26 lines
745 B
C++

// firmware/src/ble_scanner.h
#pragma once
#include <Arduino.h>
#include <vector>
struct BLEHourlyRecord {
uint32_t period_start;
uint32_t period_end;
int unique_devices;
int max_concurrent;
int near_count; // RSSI > -65 dBm
int mid_count; // RSSI -65 to -80 dBm
int far_count; // RSSI < -80 dBm
std::vector<String> device_hashes; // SHA256(MAC) first 16 hex chars
};
// Start continuous passive BLE scan (call once at boot).
void ble_scanner_start();
// Pause scan for ~3s during HTTP upload.
void ble_scanner_pause();
void ble_scanner_resume();
// Collect current hour's record and reset accumulators. Thread-safe.
BLEHourlyRecord ble_scanner_collect(uint32_t period_start, uint32_t period_end);