mirror of
https://github.com/espressif/esp-idf.git
synced 2026-10-03 03:31:41 +03:00
fix(nimble): Added missing api in nimble which present in bluedroid
This commit is contained in:
@@ -787,6 +787,13 @@ blecent_gap_event(struct ble_gap_event *event, void *arg)
|
||||
}
|
||||
#else
|
||||
#if MYNEWT_VAL(BLE_GATTC)
|
||||
#if MYNEWT_VAL(BLE_GATT_CACHING_ASSOC_ENABLE)
|
||||
rc = ble_gattc_cache_assoc(desc.peer_id_addr);
|
||||
if (rc != 0) {
|
||||
MODLOG_DFLT(ERROR, "Cache Association Failed; rc=%d\n", rc);
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
/* Perform service discovery */
|
||||
rc = peer_disc_all(event->connect.conn_handle,
|
||||
blecent_on_disc_complete, NULL);
|
||||
@@ -794,8 +801,9 @@ blecent_gap_event(struct ble_gap_event *event, void *arg)
|
||||
MODLOG_DFLT(ERROR, "Failed to discover services; rc=%d\n", rc);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
#endif // BLE_GATT_CACHING_ASSOC_ENABLE
|
||||
#endif // BLE_GATTC
|
||||
#endif // EXAMPLE_ENCRYPTION
|
||||
} else {
|
||||
/* Connection attempt failed; resume scanning. */
|
||||
MODLOG_DFLT(ERROR, "Error: Connection failed; status=%d\n",
|
||||
@@ -840,6 +848,13 @@ blecent_gap_event(struct ble_gap_event *event, void *arg)
|
||||
print_conn_desc(&desc);
|
||||
#if !MYNEWT_VAL(BLE_EATT_CHAN_NUM)
|
||||
#if CONFIG_EXAMPLE_ENCRYPTION && MYNEWT_VAL(BLE_GATTC)
|
||||
#if MYNEWT_VAL(BLE_GATT_CACHING_ASSOC_ENABLE)
|
||||
rc = ble_gattc_cache_assoc(desc.peer_id_addr);
|
||||
if (rc != 0) {
|
||||
MODLOG_DFLT(ERROR, "Cache Association Failed; rc=%d\n", rc);
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
/*** Go for service discovery after encryption has been successfully enabled ***/
|
||||
rc = peer_disc_all(event->enc_change.conn_handle,
|
||||
blecent_on_disc_complete, NULL);
|
||||
@@ -847,10 +862,28 @@ blecent_gap_event(struct ble_gap_event *event, void *arg)
|
||||
MODLOG_DFLT(ERROR, "Failed to discover services; rc=%d\n", rc);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
#endif // BLE_GATT_CACHING_ASSOC_ENABLE
|
||||
#endif // EXAMPLE_ENCRYPTION
|
||||
#endif
|
||||
return 0;
|
||||
|
||||
case BLE_GAP_EVENT_CACHE_ASSOC:
|
||||
#if MYNEWT_VAL(BLE_GATT_CACHING_ASSOC_ENABLE)
|
||||
/* Cache association result for this connection */
|
||||
MODLOG_DFLT(INFO, "cache association; conn_handle=%d status=%d cache_state=%s\n",
|
||||
event->cache_assoc.conn_handle,
|
||||
event->cache_assoc.status,
|
||||
(event->cache_assoc.cache_state == 0) ? "INVALID" : "LOADED");
|
||||
/* Perform service discovery */
|
||||
rc = peer_disc_all(event->connect.conn_handle,
|
||||
blecent_on_disc_complete, NULL);
|
||||
if(rc != 0) {
|
||||
MODLOG_DFLT(ERROR, "Failed to discover services; rc=%d\n", rc);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
return 0;
|
||||
|
||||
case BLE_GAP_EVENT_NOTIFY_RX:
|
||||
/* Peer sent us a notification or indication. */
|
||||
MODLOG_DFLT(INFO, "received %s; conn_handle=%d attr_handle=%d "
|
||||
|
||||
Reference in New Issue
Block a user