ESP32 BLE (Beacon) Scan Request/Response

hyunwoo
Posts: 15
Joined: Tue May 04, 2021 6:54 am

ESP32 BLE (Beacon) Scan Request/Response

Postby hyunwoo » Tue May 04, 2021 7:20 am

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
Attachments
SCAN_REQ.png
SCAN_REQ.png (51.66 KiB) Viewed 3780 times

komal nagda
Posts: 4
Joined: Thu Jul 29, 2021 5:44 am

Re: ESP32 BLE (Beacon) Scan Request/Response

Postby komal nagda » Thu Jul 29, 2021 6:07 am

How to send sesor data using ble beacon example. can you share code ?

hyunwoo
Posts: 15
Joined: Tue May 04, 2021 6:54 am

Re: ESP32 BLE (Beacon) Scan Request/Response

Postby hyunwoo » Wed Sep 08, 2021 10:08 am

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.

Who is online

Users browsing this forum: Majestic-12 [Bot] and 104 guests