ESP32 RAW advertising data

HanvanHulst
Posts: 2
Joined: Mon Apr 23, 2018 12:59 pm

ESP32 RAW advertising data

Postby HanvanHulst » Mon Apr 23, 2018 1:29 pm

Hi,

Is it possible to use an ESP32 to scan and gather raw advertising data?
At this moment i use a raspberry pi with HCIDUMP -Rx to get the following data;

> 0000: 04 3e 2b 02 01 00 00 84 34 49 0e f0 ec 1f 02 01 .>+.....4I......
0010: 06 0f 09 41 69 72 20 4d 65 6e 74 6f 72 20 50 72 ...Air Mentor Pr
0020: 6f 0b ff 12 21 00 8a 1a df 39 20 00 16 d8 o...!....9 ...

> 0000: 04 3e 0f 02 01 04 00 84 34 49 0e f0 ec 03 02 0a .>......4I......
0010: 00 c9 ..

> 0000: 04 3e 2b 02 01 00 00 84 34 49 0e f0 ec 1f 02 01 .>+.....4I......
0010: 06 0f 09 41 69 72 20 4d 65 6e 74 6f 72 20 50 72 ...Air Mentor Pr
0020: 6f 0b ff 12 21 00 8a 1a df 39 20 00 16 c4 o...!....9 ...

> 0000: 04 3e 0f 02 01 04 00 84 34 49 0e f0 ec 03 02 0a .>......4I......
0010: 00 c4 ..

I would like to store this raw BLE advertising data in a database.
The data is from a Air Mentor Pro and contains PM2.5,PM10,CO2,TVOC, TEMP and humidity data.

Is there an example program to scan for raw data?

Kindly regards Han

chegewara
Posts: 2378
Joined: Wed Jun 14, 2017 9:00 pm

Re: ESP32 RAW advertising data

Postby chegewara » Tue Apr 24, 2018 6:19 am

Here is example that you can use as base. If you set scan duration to 0 then you can scan infinitely:
https://github.com/espressif/esp-idf/bl ... emo.c#L311

From this code you can remove all you dont need (not related to scann).
Here is event called when esp32 find ble device:
https://github.com/espressif/esp-idf/bl ... #L327-L345

HanvanHulst
Posts: 2
Joined: Mon Apr 23, 2018 12:59 pm

Re: ESP32 RAW advertising data

Postby HanvanHulst » Tue Apr 24, 2018 9:22 pm

Thanks, Can the code also work with arduino ide with espressif/ble libery? at my first compile i got a lot of compile errors.

C:\Users\hvanh\Documents\Arduino\testBLE\testBLE.ino: In function 'void gattc_profile_event_handler(esp_gattc_cb_event_t, esp_gatt_if_t, esp_ble_gattc_cb_param_t*)':

testBLE:108: error: jump to case label [-fpermissive]
case ESP_GATTC_CONNECT_EVT:{
^
C:\Users\hvanh\Documents\Arduino\testBLE\testBLE.ino:103:19: note: crosses initialization of 'esp_err_t scan_ret'
esp_err_t scan_ret = esp_ble_gap_set_scan_params(&ble_scan_params);
^
testBLE:120: error: jump to case label [-fpermissive]
case ESP_GATTC_OPEN_EVT:

Who is online

Users browsing this forum: No registered users and 147 guests