mirror of
https://github.com/lemmingDev/ESP32-BLE-Gamepad.git
synced 2026-03-03 06:44:11 +01:00
When Windows bonds with a device and subscribes to notifications/indications of the device characteristics it does not re-subscribe on subsequent connections. If a notification is sent when Windows reconnects it will overwrite the stored subscription value in the NimBLE stack configuration with an invalid value which results in notifications/indications not being sent. This change will ensure that no notification or indication is sent before authentication upon reconnection, avoiding the described issue described above.
27 lines
812 B
C++
27 lines
812 B
C++
#ifndef ESP32_BLE_CONNECTION_STATUS_H
|
|
#define ESP32_BLE_CONNECTION_STATUS_H
|
|
#include "sdkconfig.h"
|
|
#if defined(CONFIG_BT_ENABLED)
|
|
|
|
#include "nimconfig.h"
|
|
#if defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL)
|
|
|
|
#include <NimBLEServer.h>
|
|
#include "NimBLECharacteristic.h"
|
|
#include "NimBLEConnInfo.h"
|
|
|
|
class BleConnectionStatus : public NimBLEServerCallbacks
|
|
{
|
|
public:
|
|
BleConnectionStatus(void);
|
|
bool connected = false;
|
|
void onConnect(NimBLEServer *pServer, NimBLEConnInfo& connInfo) override;
|
|
void onDisconnect(NimBLEServer *pServer, NimBLEConnInfo& connInfo, int reason) override;
|
|
void onAuthenticationComplete(NimBLEConnInfo& connInfo) override;
|
|
NimBLECharacteristic *inputGamepad;
|
|
};
|
|
|
|
#endif // CONFIG_BT_NIMBLE_ROLE_PERIPHERAL
|
|
#endif // CONFIG_BT_ENABLED
|
|
#endif // ESP32_BLE_CONNECTION_STATUS_H
|