ESP-IDF BLE scanning an advertisement package

bgfortran
Posts: 2
Joined: Tue Mar 10, 2020 8:23 pm

ESP-IDF BLE scanning an advertisement package

Postby bgfortran » Fri Sep 11, 2020 11:44 am

i am working on the ESP32 chip and am trying to get the all avaliable information from advertising. For this purpose I use the nRF connect app by NORDIC with prepare advertiser
Y01Oo.jpg
Y01Oo.jpg (32.92 KiB) Viewed 1619 times
I scan for the device and successfully only read the complete name but i want to extract all the information from advertising.

Code: Select all

case ESP_GAP_BLE_SCAN_RESULT_EVT:           
            if(param->scan_rst.search_evt == ESP_GAP_SEARCH_INQ_RES_EVT) {


                if(!alreadyDiscovered(param->scan_rst.bda)) {
                    
                    printf("##############################\n");
                     esp_log_buffer_hex("!!!!", param->scan_rst.ble_adv, 62);
                    printf("##############################\n");
                    printf("ESP_GAP_BLE_SCAN_RESULT_EVT\n");
                    printf("Device found: ADDR=");
                    for(int i = 0; i < ESP_BD_ADDR_LEN; i++) {
                        printf("%02X", param->scan_rst.bda[i]);
                        if(i != ESP_BD_ADDR_LEN -1) printf(":");
                    }
                    
                    // try to read the complete name
                    uint8_t *adv_name = NULL;
                    uint8_t adv_name_len = 0;
                    adv_name = esp_ble_resolve_adv_data(param->scan_rst.ble_adv, ESP_BLE_AD_TYPE_NAME_CMPL, &adv_name_len);
                    if(adv_name) {
                        printf("\nFULL NAME=");
                        for(int i = 0; i < adv_name_len; i++) printf("%c", adv_name[i]);
                    }
                    
                    printf("\n\n");
                    addDevice(param->scan_rst.bda);
                }
                
            }

Do you know why

Code: Select all

esp_log_buffer_hex("!!!!", param->scan_rst.ble_adv, 62);
doesn't work

Who is online

Users browsing this forum: Bing [Bot] and 78 guests