mirror of
https://github.com/meshtastic/firmware.git
synced 2026-01-03 16:41:56 +00:00
* Fix crash before clearing BLE bonds * Prevent clients re-pairing BLE during factory reset Clients seem able to re-pair BLE after clearing bonds during factory reset, even after advertising disabled. This seems to primarily occur on Android devices, which seem to more actively maintain the BLE connection. As a workaround, `NRF52Bluetooth::shutdown` swaps the BLE pairing callback to one which actively rejects new connections. --------- Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
25 lines
722 B
C++
25 lines
722 B
C++
#pragma once
|
|
|
|
#include "BluetoothCommon.h"
|
|
#include <Arduino.h>
|
|
|
|
class NRF52Bluetooth : BluetoothApi
|
|
{
|
|
public:
|
|
void setup();
|
|
void shutdown();
|
|
void startDisabled();
|
|
void resumeAdvertising();
|
|
void clearBonds();
|
|
bool isConnected();
|
|
int getRssi();
|
|
void sendLog(const uint8_t *logMessage, size_t length);
|
|
|
|
private:
|
|
static void onConnectionSecured(uint16_t conn_handle);
|
|
static bool onPairingPasskey(uint16_t conn_handle, uint8_t const passkey[6], bool match_request);
|
|
static void onPairingCompleted(uint16_t conn_handle, uint8_t auth_status);
|
|
|
|
static bool onUnwantedPairing(uint16_t conn_handle, uint8_t const passkey[6], bool match_request);
|
|
static void disconnect();
|
|
}; |