Files
ESP32-BLE-Gamepad/BleConnectionStatus.cpp
h2zero 2bec081589 Fix Windows notifications not being sent on reconnection.
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.
2025-01-11 16:47:47 -07:00

21 lines
490 B
C++

#include "BleConnectionStatus.h"
BleConnectionStatus::BleConnectionStatus(void)
{
}
void BleConnectionStatus::onConnect(NimBLEServer *pServer, NimBLEConnInfo& connInfo)
{
pServer->updateConnParams(connInfo.getConnHandle(), 6, 7, 0, 600);
}
void BleConnectionStatus::onDisconnect(NimBLEServer* pServer, NimBLEConnInfo& connInfo, int reason)
{
this->connected = false;
}
void BleConnectionStatus::onAuthenticationComplete(NimBLEConnInfo& connInfo)
{
this->connected = true;
}