function to convert esp_ble_adv_data_t to raw data array ?

jumjum123
Posts: 113
Joined: Mon Oct 17, 2016 3:11 pm

function to convert esp_ble_adv_data_t to raw data array ?

Postby jumjum123 » Tue Nov 21, 2017 10:02 am

Is there any function available to convert data from a esp_ble_adv_data_t structure to a raw data array ?

Or something like a guideline ?

User avatar
kolban
Posts: 1086
Joined: Mon Nov 16, 2015 4:43 pm
Location: Texas, USA

Re: function to convert esp_ble_adv_data_t to raw data array ?

Postby kolban » Tue Nov 21, 2017 3:17 pm

Howdy my friend. To clarify what you are asking for ... when working with BLE advertising, a BLE server builds advertising packet payloads as documented in the BLE spec. We can then advertise/publish these packets and because the format is well defined, a BLE client can receive an advertised packet and decode it. The ESP-IDF provides a "helper" in the form of the "esp_ble_adv_data_t" structure which contains some of the more popular advertising fields. An ESP32 application can then fill in these fields and pass it to the ESP-IDF which in turn unpacks that structure and builds the BLE advertising packet associated with the spec.

I suspect (guess) that you don't want to convert an "esp_ble_adv_data_t" structure to an advertisement packet (raw data) but instead want to be able to build your own advertisements from fields that you choose which may or may not include those already found in the "esp_ble_adv_data_t" structure.
Free book on ESP32 available here: https://leanpub.com/kolban-ESP32

jumjum123
Posts: 113
Joined: Mon Oct 17, 2016 3:11 pm

Re: function to convert esp_ble_adv_data_t to raw data array ?

Postby jumjum123 » Wed Nov 22, 2017 8:48 am

Hello Neil,
sorry, but your guess is wrong.
For testing, better understanding, comparing with other chips etc, I would use esp_ble_adv_data_t to get raw data.
Somewhere inside bt-components is this (hidden ?) function, and I would like to use it from my code.
Even the information, that this does not exist would be helpful. At least I would know then.


jumjum123
Posts: 113
Joined: Mon Oct 17, 2016 3:11 pm

Re: function to convert esp_ble_adv_data_t to raw data array ?

Postby jumjum123 » Wed Nov 22, 2017 12:45 pm

@wifive, thanks a lot.
Looks very promising

User avatar
kolban
Posts: 1086
Joined: Mon Nov 16, 2015 4:43 pm
Location: Texas, USA

Re: function to convert esp_ble_adv_data_t to raw data array ?

Postby kolban » Wed Nov 22, 2017 4:50 pm

Howdy my friend, maybe some background on the puzzle you are looking to solve would help?

To my understanding, the esp_ble_adv_data_t is a data structure we populate in an ESP32 BLE Server when we want to advertise data to the BLE environment. If what you want to do is receive the raw data from other advertisers, that doesn't have anything to do with that data structure (I think). Instead, what you do is register a GAP event handler and start scanning. When advertisements start arriving, you get passed a raw chunk of data that contains the advertised payload.
Free book on ESP32 available here: https://leanpub.com/kolban-ESP32

jumjum123
Posts: 113
Joined: Mon Oct 17, 2016 3:11 pm

Re: function to convert esp_ble_adv_data_t to raw data array ?

Postby jumjum123 » Wed Nov 22, 2017 9:20 pm

Hello Neil,

I'm pretty sure, you know the project I'm working on ;)
My idea right now is to get Bluetooth running.
There is a command http://www.espruino.com/Reference#l_NRF ... tisingData
Internally, this is also called in http://www.espruino.com/Reference#l_NRF_setAdvertising

For now I found a way to bypass this, but on a long term I try to be as compatible as possible to puck.js port
Therefore I'm searching for a similiar call like this one adv_data_encode(&advdata, encoded_advdata, &len_advdata);

If you want some more information, please send me a line

Who is online

Users browsing this forum: Baidu [Spider], Bing [Bot], Gfast2 and 8 guests