Page 1 of 1

why ble manufacturer data is empty?

Posted: Thu Jun 06, 2019 9:33 am
by jkaae93
Hi!
You must connect multiple devices using ble. We confirmed that the size of the BLE manufacturer data was zero when we stopped and then resumed.
Our device should not be zero because it has important data in the manufacturer data.
Can you tell me why the data is zero when you restart the data after the stop?

Re: why ble manufacturer data is empty?

Posted: Thu Jun 06, 2019 3:05 pm
by chegewara
What example are you using or what is your code?

Re: why ble manufacturer data is empty?

Posted: Mon Jun 10, 2019 7:23 am
by jkaae93
Thanks for your answer!
I have customized the ibeacon_demo code.

When i print manu_len to ESP_LOGI(). it is 0.

This code.
_hal ~ is not ble action.

Code: Select all

if (!EMPTYCHK(gl_beacon_json_str)){
                if (esp_ble_is_ibeacon_packet(scan_result->scan_rst.ble_adv, scan_result->scan_rst.adv_data_len)){
                    ESP_LOGI(BEACON_TAG, "----------Beacon Found----------");
                    esp_ble_ibeacon_t *ibeacon_data = (esp_ble_ibeacon_t*)(scan_result->scan_rst.ble_adv);
                    char* _uuid_str = uint8_to_hexstring(ibeacon_data->ibeacon_vendor.proximity_uuid, 16);
                    char* _uuid = _hal_transform_beacon(_uuid_str);
                    mem_free(_uuid_str);
                    uint16_t _major = ENDIAN_CHANGE_U16(ibeacon_data->ibeacon_vendor.major);
                    uint16_t _minor = ENDIAN_CHANGE_U16(ibeacon_data->ibeacon_vendor.minor);
                    float _distance = _dbm_to_distance(scan_result->scan_rst.rssi, ibeacon_data->ibeacon_vendor.measured_power);
                    ESP_LOGI(BEACON_TAG, "scan Beacon %s major: %d minor: %d distance: %f", _uuid, _major, _minor, _distance);
                    int _index = _hal_find_beacon_index(_uuid, _major, _minor);
                    if(_index != HAL_ERROR_BEACON_INDEX) {
                        ESP_LOGI(BEACON_TAG, "esp_gap_cb: matched uuid");
                        _hal_discover_beacon(_major, _minor, _distance, _index);
                    }
                    mem_free(_uuid);
                }
            }
            // NOTE: Discovered peripherals
            // esp_log_buffer_hex(GAP_TAG, scan_result->scan_rst.bda, 6);
            adv_name = esp_ble_resolve_adv_data(scan_result->scan_rst.ble_adv,
                                                ESP_BLE_AD_TYPE_NAME_CMPL, &adv_name_len);
            // esp_log_buffer_char(GAP_TAG, adv_name, adv_name_len);
            manufacturer = esp_ble_resolve_adv_data(scan_result->scan_rst.ble_adv,
                                                    ESP_BLE_AD_MANUFACTURER_SPECIFIC_TYPE, &manu_len);

            ESP_LOGI(GAP_TAG,"%s - man size:%d", adv_name, manu_len);

Re: why ble manufacturer data is empty?

Posted: Mon Jun 10, 2019 1:55 pm
by chegewara
Is it possible that you are performing passive scan and manufacturer data are in scan response packet?

Could you add code to print full scan_rsp.ble_adv with ESP_LOG_BUFFER_HEX and scan_rsp.adv_data_len?

Re: why ble manufacturer data is empty?

Posted: Tue Jun 11, 2019 2:27 am
by jkaae93
No. it is not scan response.
I was able to verify adv_date in the way you suggested.
but. There was no manufacturer data in adv_data.
We need manufacturer data. The type is 0xFF.

We use an nRFconnect application.
All data is displayed in the app.

Re: why ble manufacturer data is empty?

Posted: Tue Jun 11, 2019 8:30 pm
by chegewara
Sorry, but images are on slack, and not displayed here.
There was no manufacturer data in adv_data.
If thats true then either that device is not advertising manufacturer data or it is advertising 2 different advertising packets, switching very quick (some beacons do it).

Re: why ble manufacturer data is empty?

Posted: Wed Jun 12, 2019 4:38 am
by jkaae93
chegewara wrote:
Tue Jun 11, 2019 8:30 pm
Sorry, but images are on slack, and not displayed here.
oh, sorry. I'll attach it to the log.

Print scan_rst.ble_adv

I (18439) GAP: mibp manufacturer size:20, adv_data_len:17
I (18439) GAP: 03 19 00 00 02 01 06 03 03 cd ab 05 09 6d 69 62
I (18449) GAP: 70

This was output via esp_ble_resolve_adv_data.

I (18449) GAP: 00 05 ff d1 9b ff 93 7a 00 02 6d 69 62 70 28 66
I (18459) GAP: 66 64 31 29

manufacturer = esp_ble_resolve_adv_data(scan_result->scan_rst.ble_adv, ESP_BLE_AD_MANUFACTURER_SPECIFIC_TYPE, &manu_len);

Ble scan stop -> restart


I (74269) GAP: mibp manufacturer size:0, adv_data_len:17
I (74269) GAP: 03 19 00 00 02 01 06 03 03 cd ab 05 09 6d 69 62
I (74269) GAP: 70


It is raw data for nRFConnect app

0x031900000201060303CDAB05096D69627015FF0005FFD19BFF937A00026D696270286666643129

What I am curious about is
There is no manufacturer data in scan_rst.adv_data (Because there is no output, I think there is no data in it.)
Why output only occurs through esp_ble_resolve_adv_data
Isn't it imported from scan_rst.adv_data through esp_ble_resolve_adv_data?

If you need any more information, please let me know.

Re: why ble manufacturer data is empty?

Posted: Wed Jun 12, 2019 6:50 pm
by chegewara
There is few things. First of all like i suspected manufacturer data is send in scan response packet. This is advertising packet which is length of 17 bytes:
I (18439) GAP: mibp manufacturer size:20, adv_data_len:17
I (18439) GAP: 03 19 00 00 02 01 06 03 03 cd ab 05 09 6d 69 62
I (18449) GAP: 70
Manufacturer data is length of 0x15 (21) bytes
15FF0005FFD19BFF937A00026D696270286666643129
Because 1 advertising or scan response packet cant exceed 31 bytes in size it is how it is. So make sure your you are using active scan.
Also, for the same reason i asked you this in the first time, to make sure you are receiving and passing advertising and scan response data to this function "esp_ble_resolve_adv_data":
Could you add code to print full scan_rsp.ble_adv with ESP_LOG_BUFFER_HEX and scan_rsp.adv_data_len?

Re: why ble manufacturer data is empty?

Posted: Tue Jul 23, 2019 11:18 am
by jkaae93
I solved this problem.
The data were coming in divided by two.

First data is advertising data,
Second data is scan resp.

Discovered only after scanning.

So. I was combined two data use it.

Thanks for your answer.