mirror of
https://github.com/h2zero/esp-nimble-cpp.git
synced 2025-07-31 10:57:14 +02:00
[Bugfix](workaround) OnConnect not being called.
Upstream changes have resulted in a possible status of BLE_ERR_UNSUPP_REM_FEATURE, this resulted in the onConnect callback not being called despite the connection actually being created. This works around that bug to ensure that the connections are correctly tracked.
This commit is contained in:
@@ -988,6 +988,10 @@ int NimBLEClient::handleGapEvent(struct ble_gap_event* event, void* arg) {
|
||||
}
|
||||
|
||||
rc = event->connect.status;
|
||||
if (rc == BLE_ERR_UNSUPP_REM_FEATURE) {
|
||||
rc = 0; // Workaround: Ignore unsupported remote feature error as it is not a real error.
|
||||
}
|
||||
|
||||
if (rc == 0) {
|
||||
pClient->m_connHandle = event->connect.conn_handle;
|
||||
|
||||
|
@@ -354,8 +354,15 @@ int NimBLEServer::handleGapEvent(ble_gap_event* event, void* arg) {
|
||||
|
||||
switch (event->type) {
|
||||
case BLE_GAP_EVENT_CONNECT: {
|
||||
if (event->connect.status != 0) {
|
||||
NIMBLE_LOGE(LOG_TAG, "Connection failed");
|
||||
rc = event->connect.status;
|
||||
if (rc == BLE_ERR_UNSUPP_REM_FEATURE) {
|
||||
rc = 0; // Workaround: Ignore unsupported remote feature error as it is not a real error.
|
||||
}
|
||||
|
||||
if (rc != 0) {
|
||||
NIMBLE_LOGE(LOG_TAG, "Connection failed rc = %d %s",
|
||||
rc,
|
||||
NimBLEUtils::returnCodeToString(rc));
|
||||
# if !CONFIG_BT_NIMBLE_EXT_ADV && CONFIG_BT_NIMBLE_ROLE_BROADCASTER
|
||||
NimBLEDevice::startAdvertising();
|
||||
# endif
|
||||
|
Reference in New Issue
Block a user