mirror of
https://github.com/espressif/esp-idf.git
synced 2026-10-02 03:00:34 +03:00
fix(nimble): Keep only BLE_GAP_EVENT_CONNECT gap event
This commit is contained in:
@@ -239,29 +239,29 @@ gatts_gap_event(struct ble_gap_event *event, void *arg)
|
||||
int rc;
|
||||
|
||||
switch (event->type) {
|
||||
case BLE_GAP_EVENT_LINK_ESTAB:
|
||||
case BLE_GAP_EVENT_CONNECT:
|
||||
/* A new connection was established or a connection attempt failed */
|
||||
ESP_LOGI(tag, "connection %s; status = %d ",
|
||||
event->link_estab.status == 0 ? "established" : "failed",
|
||||
event->link_estab.status);
|
||||
event->connect.status == 0 ? "established" : "failed",
|
||||
event->connect.status);
|
||||
rc = ble_att_set_preferred_mtu(PREFERRED_MTU_VALUE);
|
||||
if (rc != 0) {
|
||||
ESP_LOGE(tag, "Failed to set preferred MTU; rc = %d", rc);
|
||||
}
|
||||
|
||||
if (event->link_estab.status != 0) {
|
||||
if (event->connect.status != 0) {
|
||||
/* Connection failed; resume advertising */
|
||||
gatts_advertise();
|
||||
}
|
||||
|
||||
rc = ble_hs_hci_util_set_data_len(event->link_estab.conn_handle,
|
||||
rc = ble_hs_hci_util_set_data_len(event->connect.conn_handle,
|
||||
LL_PACKET_LENGTH,
|
||||
LL_PACKET_TIME);
|
||||
if (rc != 0) {
|
||||
ESP_LOGE(tag, "Set packet length failed");
|
||||
}
|
||||
|
||||
conn_handle = event->link_estab.conn_handle;
|
||||
conn_handle = event->connect.conn_handle;
|
||||
break;
|
||||
|
||||
case BLE_GAP_EVENT_DISCONNECT:
|
||||
|
||||
Reference in New Issue
Block a user