Closed hard-cat closed 2 years ago
When a connection event is reported, the parameter param->connect.link_role
in gattc and gatts event handler callback function can be used to determine which side the connection initiated.
If the link_role equal 0, it means ESP32 send CONNECT_IND, it's link layer role is master. If the link_role equal 1, it means ESP32 send ADV and received CONNECT_IND from remote device, it's link layer role is slave.
exactly what is needed!
I'm trying to run BLE in coex mode. Individually, the client or server works fine. In coex mode, when connecting to a server, from a mobile phone, the callback is called by both the server and the client. uuid char server and client do not match. I wrote based on the example gattc_gatts_coex ESP-IDF v4.2.2 chip esp32-pico-v3-02, user board
Initialization:
When connecting to the server, the client's callback is triggered, with a connection event.
I (15612) SERVER: ESP_GATTS_CONNECT_EVT, conn_id 0, remote 6b:18:c1:36:87:44: I (15613) SERVER: CONNECT_EVT, conn_id 0, remote 6b:18:c1:36:87:44: I (15617) BLE_CLIENT: ESP_GATTC_CONNECT_EVT conn_id 0, if 5 I (15623) BLE_CLIENT: REMOTE BDA: I (15627) BLE_CLIENT: 6b 18 c1 36 87 44 I (15760) SERVER: ESP_GATTS_MTU_EVT, MTU 500 I (15761) SERVER: ESP_GATTS_MTU_EVT, MTU 500 I (16029) SERVER: update connection params status = 0, min_int = 16, max_int = 32,conn_int = 24,latency = 0, timeout = 400 I (16585) SERVER: GATT_READ_EVT, conn_id 0, trans_id 2, handle 46 I (16675) SERVER: GATT_WRITE_EVT, conn_id 0, trans_id 3, handle 44 I (16675) SERVER: GATT_WRITE_EVT, value: hello bro!!!, len 12, value : I (16679) SERVER: 68 65 6c 6c 6f 20 62 72 6f 21 21 21 W (16885) BT_APPL: bta_gattc_conn_cback() - cif=5 connected=0 conn_id=5 reason=0x0013 I (16887) SERVER: ESP_GATTS_DISCONNECT_EVT, disconnect reason 0x13 I (16890) BLE_CLIENT: ESP_GATTC_DISCONNECT_EVT, reason = 19