diff --git a/src/NimBLEServer.cpp b/src/NimBLEServer.cpp index c50492d..a453556 100644 --- a/src/NimBLEServer.cpp +++ b/src/NimBLEServer.cpp @@ -624,7 +624,12 @@ int NimBLEServer::handleGapEvent(struct ble_gap_event *event, void *arg) { // BLE_GAP_EVENT_ADV_COMPLETE | BLE_GAP_EVENT_SCAN_REQ_RCVD case BLE_GAP_EVENT_CONN_UPDATE: { - NIMBLE_LOGD(LOG_TAG, "Connection parameters updated."); + rc = ble_gap_conn_find(event->connect.conn_handle, &peerInfo.m_desc); + if (rc != 0) { + return 0; + } + + pServer->m_pServerCallbacks->onConnParamsUpdate(peerInfo); return 0; } // BLE_GAP_EVENT_CONN_UPDATE @@ -1088,4 +1093,8 @@ void NimBLEServerCallbacks::onAuthenticationComplete(NimBLEConnInfo& connInfo, c NIMBLE_LOGD("NimBLEServerCallbacks", "onAuthenticationComplete: default"); } // onAuthenticationComplete +void NimBLEServerCallbacks::onConnParamsUpdate(NimBLEConnInfo& connInfo){ + NIMBLE_LOGD("NimBLEServerCallbacks", "onConnParamsUpdate: default"); +} // onConnParamsUpdate + #endif /* CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_PERIPHERAL */ diff --git a/src/NimBLEServer.h b/src/NimBLEServer.h index 251de22..a840ded 100644 --- a/src/NimBLEServer.h +++ b/src/NimBLEServer.h @@ -205,6 +205,14 @@ public: * @param [in] connInfo A reference to a NimBLEConnInfo instance with information */ virtual void onIdentity(NimBLEConnInfo& connInfo); + + /** + * @brief Called when connection parameters are updated following a request to + * update via NimBLEServer::updateConnParams + * @param [in] connInfo A reference to a NimBLEConnInfo instance containing the + * updated connection parameters. + */ + virtual void onConnParamsUpdate(NimBLEConnInfo& connInfo); }; // NimBLEServerCallbacks #endif /* CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_PERIPHERAL */