mirror of
https://github.com/h2zero/esp-nimble-cpp.git
synced 2024-11-24 22:20:55 +01:00
implement connection parameters update callback (#210)
This commit is contained in:
parent
3820f57076
commit
8ca58f5a89
2 changed files with 18 additions and 1 deletions
|
@ -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
|
// BLE_GAP_EVENT_ADV_COMPLETE | BLE_GAP_EVENT_SCAN_REQ_RCVD
|
||||||
|
|
||||||
case BLE_GAP_EVENT_CONN_UPDATE: {
|
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;
|
return 0;
|
||||||
} // BLE_GAP_EVENT_CONN_UPDATE
|
} // BLE_GAP_EVENT_CONN_UPDATE
|
||||||
|
|
||||||
|
@ -1088,4 +1093,8 @@ void NimBLEServerCallbacks::onAuthenticationComplete(NimBLEConnInfo& connInfo, c
|
||||||
NIMBLE_LOGD("NimBLEServerCallbacks", "onAuthenticationComplete: default");
|
NIMBLE_LOGD("NimBLEServerCallbacks", "onAuthenticationComplete: default");
|
||||||
} // onAuthenticationComplete
|
} // onAuthenticationComplete
|
||||||
|
|
||||||
|
void NimBLEServerCallbacks::onConnParamsUpdate(NimBLEConnInfo& connInfo){
|
||||||
|
NIMBLE_LOGD("NimBLEServerCallbacks", "onConnParamsUpdate: default");
|
||||||
|
} // onConnParamsUpdate
|
||||||
|
|
||||||
#endif /* CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_PERIPHERAL */
|
#endif /* CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_PERIPHERAL */
|
||||||
|
|
|
@ -205,6 +205,14 @@ public:
|
||||||
* @param [in] connInfo A reference to a NimBLEConnInfo instance with information
|
* @param [in] connInfo A reference to a NimBLEConnInfo instance with information
|
||||||
*/
|
*/
|
||||||
virtual void onIdentity(NimBLEConnInfo& connInfo);
|
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
|
}; // NimBLEServerCallbacks
|
||||||
|
|
||||||
#endif /* CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_PERIPHERAL */
|
#endif /* CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_PERIPHERAL */
|
||||||
|
|
Loading…
Reference in a new issue