how to use esp_ble_gatts_close ?

datluong
Posts: 10
Joined: Thu Jun 13, 2019 10:34 am

how to use esp_ble_gatts_close ?

Postby datluong » Thu Jul 25, 2019 6:44 am

Hi all,
Currently, I want to terminate the connection between esp32 and mobile application by pressing a button.
How can I do that?
I have checked and then found this function:
  1. esp_ble_gatts_close(gatts_if, conn_id);
But I don't know how to implemet this function into my code, where can I find those two parameters, gatts_if and conn_id.
I used example code in example gatt_security_server in esp-idf folder.
Thank you very much,

chegewara
Posts: 2376
Joined: Wed Jun 14, 2017 9:00 pm

Re: how to use esp_ble_gatts_close ?

Postby chegewara » Sat Jul 27, 2019 2:34 am

When succesfully connected you will receive `ESP_GATTS_CONNECT_EVT`:
https://docs.espressif.com/projects/esp ... evt_paramE

kongon
Posts: 4
Joined: Mon Aug 13, 2018 8:55 pm

Re: how to use esp_ble_gatts_close ?

Postby kongon » Sat Dec 19, 2020 11:01 am

Hi,

You can find those values at gatts_profile_event_handler.

case ESP_GATTS_CONNECT_EVT:
spp_conn_id = p_data->connect.conn_id;
spp_gatts_if = gatts_if;

Who is online

Users browsing this forum: No registered users and 87 guests