Android Question BLE Get Service UUID on DeviceFound

fbritop

Active Member
Licensed User
Longtime User
Hi
I have several BLE devices with a name like DeviceMine_XXXXXX
This devices have a standard Service UUID advertised, but there are cases when a device enters a "Configuration Mode", so it can be modified, in that case the Service UUID changes to another one.

From an App (B4I and B4A), the device scans for BLE Beacons that start with "DeviceMine_", and when it finds the unit, it stops the scan. The problem is that I need a second check on device detection, to check for the service UUID of the device to see if it is realy on config mode or should I move to the next device.

How can I decipher this info from AdvertisingData?

Thanks
 

fbritop

Active Member
Licensed User
Longtime User
Thanks
I found the key in the ESP32 device BLE configuration, so the device can start in either mode and then filter the scan by services advertised

B4X:
    BLEAdvertising* pAdvertising = pServer->getAdvertising();
    pAdvertising->addServiceUUID(SERVICE_UUID);
    pAdvertising->setScanResponse(true);
    pAdvertising->setMinPreferred(0x12);
    pAdvertising->setMaxPreferred(0x16);
    pAdvertising->start();
 
Upvote 0
Top