fix(nimble): Corrected link_estab event handling parameters

This commit is contained in:
Rahul Tank
2024-12-19 16:04:25 +05:30
parent 2c786a4b04
commit 749d70e159
28 changed files with 161 additions and 161 deletions
@@ -94,16 +94,16 @@ ble_cent_client_gap_event(struct ble_gap_event *event, void *arg)
return 0;
case BLE_GAP_EVENT_LINK_ESTAB:
if (event->connect.status == 0) {
ESP_LOGI(TAG, "Connection established. Handle:%d, Total:%d", event->connect.conn_handle,
if (event->link_estab.status == 0) {
ESP_LOGI(TAG, "Connection established. Handle:%d, Total:%d", event->link_estab.conn_handle,
++s_ble_multi_conn_num);
/* Remember peer. */
rc = peer_add(event->connect.conn_handle);
rc = peer_add(event->link_estab.conn_handle);
if (rc != 0) {
ESP_LOGE(TAG, "Failed to add peer; rc=%d\n", rc);
} else {
/* Perform service discovery */
rc = peer_disc_svc_by_uuid(event->connect.conn_handle, remote_svc_uuid,
rc = peer_disc_svc_by_uuid(event->link_estab.conn_handle, remote_svc_uuid,
ble_cent_on_disc_complete, NULL);
if(rc != 0) {
ESP_LOGE(TAG, "Failed to discover services; rc=%d\n", rc);
@@ -111,7 +111,7 @@ ble_cent_client_gap_event(struct ble_gap_event *event, void *arg)
}
} else {
/* Connection attempt failed; resume scanning. */
ESP_LOGE(TAG, "Central: Connection failed; status=0x%x\n", event->connect.status);
ESP_LOGE(TAG, "Central: Connection failed; status=0x%x\n", event->link_estab.status);
}
ble_cent_scan();
return 0;
@@ -176,10 +176,10 @@ ble_cent_server_gap_event(struct ble_gap_event *event, void *arg)
switch (event->type) {
case BLE_GAP_EVENT_LINK_ESTAB:
/* The connectable adv has been established. We will act as the peripheral. */
if (event->connect.status == 0) {
ESP_LOGI(TAG, "Peripheral connected to central. Handle:%d", event->connect.conn_handle);
if (event->link_estab.status == 0) {
ESP_LOGI(TAG, "Peripheral connected to central. Handle:%d", event->link_estab.conn_handle);
} else {
ESP_LOGE(TAG, "Peripheral: Connection failed; status=0x%x\n", event->connect.status);
ESP_LOGE(TAG, "Peripheral: Connection failed; status=0x%x\n", event->link_estab.status);
ble_cent_advertise();
}
return 0;
@@ -190,9 +190,9 @@ ble_prph_gap_event(struct ble_gap_event *event, void *arg)
{
switch (event->type) {
case BLE_GAP_EVENT_LINK_ESTAB:
if (event->connect.status == 0) {
if (event->link_estab.status == 0) {
/* A new connection was established. */
ESP_LOGI(TAG, "Connection established. Handle:%d. Total:%d", event->connect.conn_handle,
ESP_LOGI(TAG, "Connection established. Handle:%d. Total:%d", event->link_estab.conn_handle,
++s_ble_prph_conn_num);
#if CONFIG_EXAMPLE_RESTART_ADV_AFTER_CONNECTED
ble_prph_restart_adv();