0
votes

I'm performing a UUID filtered scan on Android (mobile device A) and I have two test cases.

One uses an app called BLE Scanner on another Android device (mobile device b) to create a BLE server with two test Services (each with their own unique UUID). The other is via an Arduino BLE server with a custom UUID for it's service.

If I use mobile device B's BLE Scanner app and scan for the arduino I can find it, connect to it and see the Services along with each services UUID. It has Generic Attribute, Generic Access and a custom service (the one I set). So that's great.

If I use mobile device A and perform a BLE filtered scan using the three services (Generic Attribute UUID, Generic Access UUID and the custom service UUID) the Arduino doesn't show up in the scan at all.

If I use mobile device A and perform a BLE filtered scan using the UUID's from the test server created via the BLE Scanner app on mobile device B, mobile devices B's BLE server does show up in the scan.

So I'm confused. Mobile Device A's filtered scanning seems to work to find the server created via the BLE Scanner app with the assigned custom UUIDs created by the BLE Scanner App, but for the Arduino BLE server it fails to show up.

Is it perhaps because the BLE Scanner app doesn't do filtered scan to find/connect to the Arduino BLE Server that it is able to work? In which case is it not possible to do a filtered scan using the known Service UUID's on the Arduino? Or is there a hidden UUID I'm missing or does the UUID need to be contained in the advertisement data / manufacturing data?

1
You are right in the assumption that the service UUID needs to be included in the advertisement for a filtered scan to work. Have you tried a filtered scan from device B and get the same result? - Michael Kotzjan
I have not but if what you are saying is true does that mean there could be an entirely other UUID stuck in the advertisement data that I'm not aware of? I suppose with the BLE Scanner app when I view raw data it is showing me the advertisement data, is the service UUID in there? Or is it possible the advertisement data contains no service UUID at all in there and if so I can't scan using a filter in that case. Unless I figure out how to add it in there? I'm new to BLE so slowly wrapping my head around all this. - Nonlin
Usually all commercially available devices using BLE already contain at least one of their service UUIDs in the advertisement data. This is the normal way to differentiate between multiple devices and to find yours. You said you are using an Arduino which you probably programmed yourself. Still, the library used by you should handle advertisements or at least offer you an option to add a UUID. It's great that you found a solution to your problem yourself! :) - Michael Kotzjan

1 Answers

1
votes

Turns out the discrepancy was due to the fact that the device that failed to show up in a filter scan was because the advertisement data did not have the UUID set/provided in it so the scan just excluded it all together.

Once I added the UUID to the advertisement data it showed up in the scan.

In my case I had to follow the sample here for BLE library with Arduino. https://github.com/nkolban/ESP32_BLE_Arduino/blob/master/examples/BLE_server/BLE_server.ino