mirror of
https://github.com/espressif/esp-idf.git
synced 2025-09-01 14:34:31 +00:00
fix(nimble): Corrected link_estab event handling parameters
This commit is contained in:
@@ -273,25 +273,25 @@ ble_spp_client_gap_event(struct ble_gap_event *event, void *arg)
|
||||
|
||||
case BLE_GAP_EVENT_LINK_ESTAB:
|
||||
/* A new connection was established or a connection attempt failed. */
|
||||
if (event->connect.status == 0) {
|
||||
if (event->link_estab.status == 0) {
|
||||
/* Connection successfully established. */
|
||||
MODLOG_DFLT(INFO, "Connection established ");
|
||||
rc = ble_gap_conn_find(event->connect.conn_handle, &desc);
|
||||
rc = ble_gap_conn_find(event->link_estab.conn_handle, &desc);
|
||||
assert(rc == 0);
|
||||
memcpy(&connected_addr[event->connect.conn_handle].val, desc.peer_id_addr.val,
|
||||
memcpy(&connected_addr[event->link_estab.conn_handle].val, desc.peer_id_addr.val,
|
||||
PEER_ADDR_VAL_SIZE);
|
||||
print_conn_desc(&desc);
|
||||
MODLOG_DFLT(INFO, "\n");
|
||||
|
||||
/* Remember peer. */
|
||||
rc = peer_add(event->connect.conn_handle);
|
||||
rc = peer_add(event->link_estab.conn_handle);
|
||||
if (rc != 0) {
|
||||
MODLOG_DFLT(ERROR, "Failed to add peer; rc=%d\n", rc);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Perform service discovery. */
|
||||
rc = peer_disc_all(event->connect.conn_handle,
|
||||
rc = peer_disc_all(event->link_estab.conn_handle,
|
||||
ble_spp_client_on_disc_complete, NULL);
|
||||
if (rc != 0) {
|
||||
MODLOG_DFLT(ERROR, "Failed to discover services; rc=%d\n", rc);
|
||||
@@ -300,7 +300,7 @@ ble_spp_client_gap_event(struct ble_gap_event *event, void *arg)
|
||||
} else {
|
||||
/* Connection attempt failed; resume scanning. */
|
||||
MODLOG_DFLT(ERROR, "Error: Connection failed; status=%d\n",
|
||||
event->connect.status);
|
||||
event->link_estab.status);
|
||||
ble_spp_client_scan();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user