Separating gap_callback and gatt_callback

newsettler_AI
Posts: 121
Joined: Wed Apr 05, 2017 12:49 pm

Separating gap_callback and gatt_callback

Postby newsettler_AI » Sat Nov 04, 2017 2:34 pm

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


newsettler_AI
Posts: 121
Joined: Wed Apr 05, 2017 12:49 pm

Re: Separating gap_callback and gatt_callback

Postby newsettler_AI » Sat Nov 04, 2017 3:47 pm

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 :(

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

Re: Separating gap_callback and gatt_callback

Postby WiFive » Sat Nov 04, 2017 4:23 pm


newsettler_AI
Posts: 121
Joined: Wed Apr 05, 2017 12:49 pm

Re: Separating gap_callback and gatt_callback

Postby newsettler_AI » Sat Nov 04, 2017 8:59 pm

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.

rankit0092
Posts: 16
Joined: Tue Jan 23, 2018 5:31 am

Re: Separating gap_callback and gatt_callback

Postby rankit0092 » Tue Jan 23, 2018 7:19 am

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""

Who is online

Users browsing this forum: Baidu [Spider] and 125 guests