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>
This commit is contained in:
25
firmware/src/ble_scanner.h
Normal file
25
firmware/src/ble_scanner.h
Normal file
@@ -0,0 +1,25 @@
|
||||
// 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);
|
||||
Reference in New Issue
Block a user