Add server and client onIdentity callback.

Adds a callback that is called when the identity address of the peer is resolved, this is useful for adding it to a whitelist.
This commit is contained in:
h2zero
2024-06-12 09:26:10 -06:00
committed by h2zero
parent 44daa3c687
commit aeb4334e98
4 changed files with 43 additions and 0 deletions

View File

@@ -528,6 +528,16 @@ int NimBLEServer::handleGapEvent(struct ble_gap_event *event, void *arg) {
return 0;
} // BLE_GAP_EVENT_ENC_CHANGE
case BLE_GAP_EVENT_IDENTITY_RESOLVED: {
rc = ble_gap_conn_find(event->identity_resolved.conn_handle, &peerInfo.m_desc);
if(rc != 0) {
return BLE_ATT_ERR_INVALID_HANDLE;
}
pServer->m_pServerCallbacks->onIdentity(peerInfo);
return 0;
} // BLE_GAP_EVENT_IDENTITY_RESOLVED
case BLE_GAP_EVENT_PASSKEY_ACTION: {
struct ble_sm_io pkey = {0,0};
@@ -864,6 +874,10 @@ void NimBLEServerCallbacks::onConfirmPIN(const NimBLEConnInfo& connInfo, uint32_
NimBLEDevice::injectConfirmPIN(connInfo, true);
} // onConfirmPIN
void NimBLEServerCallbacks::onIdentity(const NimBLEConnInfo& connInfo){
NIMBLE_LOGD("NimBLEServerCallbacks", "onIdentity: default");
} // onIdentity
void NimBLEServerCallbacks::onAuthenticationComplete(const NimBLEConnInfo& connInfo){
NIMBLE_LOGD("NimBLEServerCallbacks", "onAuthenticationComplete: default");
} // onAuthenticationComplete