Page 1 of 1

Separating gap_callback and gatt_callback

Posted: Sat Nov 04, 2017 2:34 pm
by newsettler_AI
Hi,

I want to make ble scanner. I'm playing with gatt_client demo example:
https://github.com/espressif/esp-idf/bl ... ttc_demo.c

I have configured needed info output and now I want to "cut off" all GATT stuff (since I using only GAP feature - scan).

But when I removing this functions:

Code: Select all

//    //register the callback function to the gattc module
    ret = esp_ble_gattc_register_callback(esp_gattc_cb);
    if(ret){
        ESP_LOGE(GATTC_TAG, "%s gattc register failed, error code = %x\n", __func__, ret);
        return;
    }

    ret = esp_ble_gattc_app_register(PROFILE_A_APP_ID);
    if (ret){
        ESP_LOGE(GATTC_TAG, "%s gattc app register failed, error code = %x\n", __func__, ret);
    }
from main, esp32 doesnt scan anything.

Is is essential to register GAP and GATT callbacks together? Is it possible to register just GAP, without gatt profiles, callbacks and so on?

Regards

Re: Separating gap_callback and gatt_callback

Posted: Sat Nov 04, 2017 3:38 pm
by WiFive

Re: Separating gap_callback and gatt_callback

Posted: Sat Nov 04, 2017 3:47 pm
by newsettler_AI
thanks for examples, all of them uses GAP and GATT simultaneously.
Looks like I have to hold gatt stuff even if I actually dont use them :(

Re: Separating gap_callback and gatt_callback

Posted: Sat Nov 04, 2017 4:23 pm
by WiFive

Re: Separating gap_callback and gatt_callback

Posted: Sat Nov 04, 2017 8:59 pm
by newsettler_AI
my mistake :roll:

I have studied this project more carefully, and find out why my scanner didnt do anything.

Solution: add function esp_ble_gap_set_scan_params at initialisation sequence. By default, in gatt_client example this function called in gatt callback, thats why scanner didnt worked when I tried cut off gatt stuff.

Re: Separating gap_callback and gatt_callback

Posted: Tue Jan 23, 2018 7:19 am
by rankit0092
I'm uploading esp32 beacon tracking example FROM https://github.com/Oliv4945/ESP-Beacon-Tracker
..using ESP-IDF
IN make menuconfig I already did necessary configuration but while building I got two errors as below:


""In file included from C:/esp32/esp123/esp-idf/examples/mycode/ESP-Beacon-Tracker/main/main.c:46:0:
C:/esp32/esp123/esp-idf/components/bt/include/bt.h:2:2: warning: #warning "This header is deprecated, please use functions defined in esp_bt.h instead." [-Wcpp]
#warning "This header is deprecated, please use functions defined in esp_bt.h instead."
^
C:/esp32/esp123/esp-idf/examples/mycode/ESP-Beacon-Tracker/main/main.c:68:13: error: 'connect' redeclared as different kind of symbol
static bool connect = false;
^
In file included from C:/esp32/esp123/esp-idf/examples/mycode/ESP-Beacon-Tracker/main/main.c:41:0:
C:/esp32/esp123/esp-idf/components/lwip/include/lwip/lwip/sockets.h:577:19: note: previous definition of 'connect' was here
static inline int connect(int s,const struct sockaddr *name,socklen_t namelen)
^
make[1]: *** [/c/esp32/esp123/esp-idf/make/component_wrapper.mk:274: main.o] Error 1
make: *** [/c/esp32/esp123/esp-idf/make/project.mk:450: component-main-build] Error 2""