Android Question BLE - Scan Request and Scan Response?

doncx

Active Member
Licensed User
Longtime User
When I use SCAN or SCAN2, I receive the standard advertising packet in response. It's helpful, but the device offers more.

The BLE device I'm communicating with (a Blue Maestro Tempo Disc) has this standard advertising packet - which I'm receiving - and also a "scan response" packet with further information, which they say is available to a "scan request".

How do I issue a "scan request"? I have not figured this out.

Thanks for any information on this.
 

emexes

Expert
Licensed User
and also a "scan response" packet with further information, which they say is available to a "scan request".

How do I issue a "scan request"?

Maybe their usage of the word "scan" at that point means for their sensors to take a measurement, rather than from our perspective at the other end of the communication where we're thinking it's a Bluetooth scan to see who's out there.

Try connecting up with nRF Connect, see what characteristics (measurement and status values) are available.
 
Last edited:
Upvote 0

emexes

Expert
Licensed User
Thanks for any information on this.

It's been a few years since I looked at BLE GATT, and the consortium seems to have rearranged their website yet again.

I think the most useful documentation, for deciphering GATT descriptors that tell you the type, format and units of each characteristic, is now at:

https://www.bluetooth.com/specifications/assigned-numbers/

and I've attached the most useful document from there. No, I take that back: apparently it's too large to attach to this post. Download "GATT_Specification_Supplement_v7.pdf" and search for "blood" or "pulse" or "pressure" or whatever it is your device is measuring.
 
Upvote 0

emexes

Expert
Licensed User
How do I issue a "scan request"? I have not figured this out.

If the device has a "take reading now" button, you might not even have to request the device to do a reading; there's probably a characteristic (data value) that tells you the last valid reading, and perhaps its date and time.

So you could do it the hacker way - read all characteristics (you get a list of services when you connect, and then for each service you can get a list of characteristics) and see what changes when you do a new reading (with a different value to the old reading). But nRF Connect is already set up to do almost that, except that you'll have to poke through the characteristics one-by-one instead of having them all displayed in real(ish) time. Might be quicker to use that than to write your own.
 
Upvote 0

doncx

Active Member
Licensed User
Longtime User
Thanks for your replies. I am new to BLE and so am learning as I go. I believe there is a formal "scan request" and "scan response" capability in BLE where the requestor (B4A in this case) scans with a "request" and receives additional *advertising* information - without connecting - from devices with that capability.

However, for all my searching I haven't figured out exactly how. Here's a link that describes the BLE feature: https://www.argenox.com/library/bluetooth-low-energy/ble-advertising-primer/.

Search that page for the subheading "Scan Response" to find this:

We already mentioned that the advertisement packet has 31 data bytes available for you to use. This isn’t much, especially when you consider that a 128-bit UUID takes 16-bytes. If you want to include more information, your only choice is to respond to scan responses.

When a a smartphone scans for advertisements, it can also request more information from the advertising device without forming a connection. This is done through a Scan Request which is a special packet that is sent to the peripheral. The BLE peripheral receives the Scan Request and responds with a Scan response.

Both iOS, Android and other systems issue Scan Requests automatically without user intervention when scanning. Your device will therefore receive these requests if it has it enabled.

The Scan Response packet has the same packet format as the advertisement, with the exception of the type on the higher layer indicating it’s a scan response instead of an advertisement. So your scan response can provide the device name or other services you didn’t mention in the advertising packet.

When I scan with B4A I see the normal advertising in my logs but nothing additional. How do I access that?

All help is appreciated!
 
Upvote 0
Top