Page 1 of 1

ESP32 BLE (Beacon) Scan Request/Response

Posted: Tue May 04, 2021 7:20 am
by hyunwoo
Hello.
I have some questions about scan request/response.
My project is running with BLE/WiFi/SPI task. First, Check firmware version by WIFI (this is not important part of this Topic). Next, BLE advertising some data. If got 'Scan Response', check MAC address of Central device. If central device(its MAC address) is in the whitelist, send 'Scan Response' for necessary data. (This data will refreshed by other sensor after deep sleep and wake up.) else, failed to got 'Scan Response', send that data by SPI. At last, go to deep sleep.
For this work, I have to know "Scan Response is sent" or "received Scan Request".

And here is my questions.
1. How to know I sent 'Scan Response' or got 'Scan Request'? I will change power mode to deep sleep when finish all task. So it is okay check it once of one booting.
2. How to check scanners MAC address? I checked payload of SCAN_REQ, but can't find that part in ESP-IDF library. There is way to check it?
Image

Re: ESP32 BLE (Beacon) Scan Request/Response

Posted: Thu Jul 29, 2021 6:07 am
by komal nagda
How to send sesor data using ble beacon example. can you share code ?

Re: ESP32 BLE (Beacon) Scan Request/Response

Posted: Wed Sep 08, 2021 10:08 am
by hyunwoo
komal nagda wrote:
Thu Jul 29, 2021 6:07 am
How to send sesor data using ble beacon example. can you share code ?
I didn't make code yet, but I think it isn't that hard.

In my scenario, my ESP will repeat sleeping and waking up.
Every waking up sequence, ESP read the sensor data and create advertising data based on sensor data.
I'll transfer sensor data to some byte code(packet) like [00.000000,000.000000] => 0x00000000. The size of this packet always is 15. (Maximum size of ADV_IND + SCAN_RSP is 64, so that's enough)
The last step is just advertising it.