GATT client sample

irobux
Posts: 9
Joined: Tue Jan 03, 2017 9:36 am

GATT client sample

Postby irobux » Wed Jan 25, 2017 10:28 am

Hi All,

I need to detect a ble device and connect to it as a Central, client then I used the gatt client sample.

I read the code, there is indeed a gap scanning then gatt procedures to get the services and characteristics and notification etc... but during scanning nothing occurs with a ble device like a bluetooth lifetrons audio or a beewi small car.

I waited to see a ESP_GAP_BLE_SCAN_RESULT_EVT event triggered but I always see a ESP_GAP_SEARCH_INQ_CMPL_EVT event without a detection if the advertising of the BLE device.

I modified the code to put in advance the string name of the device I want to detect since the code make a gatt process and an open call to connect after checking the name of the device hard implemented in the program.

Can anyone manage to detect a commercial BLE device with the gatt client sample.

Thanks,
Iro

f.h-f.s.
Posts: 215
Joined: Thu Dec 08, 2016 2:53 pm

Re: GATT client sample

Postby f.h-f.s. » Wed Jan 25, 2017 10:35 am

I used the gatt client example to scan everything in my neighborhood. It works fine. Even resolved the name of my cubot smart watch. I recommend you take out your modifications and try again or just run the clean example once to see if you are receiving advertisements.

WiFive
Posts: 3529
Joined: Tue Dec 01, 2015 7:35 am

Re: GATT client sample

Postby WiFive » Wed Jan 25, 2017 12:03 pm

irobux wrote:but during scanning nothing occurs with a ble device like a bluetooth lifetrons audio or a beewi small car.
I think neither of those is a BLE device both are Bluetooth classic devices.

irobux
Posts: 9
Joined: Tue Jan 03, 2017 9:36 am

Re: GATT client sample

Postby irobux » Wed Jan 25, 2017 10:03 pm

Hi,
Thanks for your responses !

@fhsh => I modified the code because the devices were not detected then as @WiFive said maybe there are not BLE.
Then where can I modify the code to take into account not only BLE device :D ?

Thanks
Iro

irobux
Posts: 9
Joined: Tue Jan 03, 2017 9:36 am

Re: GATT client sample

Postby irobux » Fri Jan 27, 2017 9:59 pm

Hi,
I tried with a BLE beewi LED and ths is OK.
Many thanks

Then I want to control the LED and I am not sure to understand the relation between the central and the peripheric. How to send data from Central ? I mean by How is: How to use the following events, is it in the "gattc_profile_a_event_handler" function ?
ESP_GATTC_WRITE_DESCR_EVT = 9
ESP_GATTC_PREP_WRITE_EVT = 11
ESP_GATTC_REG_FOR_NOTIFY_EVT = 38
ESP_GATTC_UNREG_FOR_NOTIFY_EVT = 39

For first sample, I connect in a digital input a button.
Should I call "esp_ble_gattc_write_char_descr" and where, should a implement a thread ?

Iro

Who is online

Users browsing this forum: No registered users and 6 guests