Getting different bytes [] of scanRecord data for one BLE device while scanning with different versions of Android device

private final BluetoothAdapter.LeScanCallback mLeScanCallback = new BluetoothAdapter.LeScanCallback() { @Override public void onLeScan(final BluetoothDevice device, final int rssi, final byte[] scanRecord) { } } 

I looked at one BLE device from the Acer table version 4.4.2 and version Nexus 7 5.1. I want to filter BLE devices using UUIDS, but I get different scanRecord data for one BLE device.

I have attached detailed photos. enter image description here enter image description here

+5
source share
1 answer

This is quite common in the BLE world. When a BLE device advertises multiple services . The scanner can freely filter what it needs or has to do with it. I saw a similar behavior in the HRM (Heart Rate Monitor) device, which also doubles as a Food Pod (profile - RSCP) - therefore, it simultaneously implements 2 services.

For such devices (hosting several services), it is good practice to have a type resolution policy for the results of the BLE check - for example, this may be a priority order: -

 1. GAP Appearance 2. GATT Service 

The fitness sensor I mentioned above ( TICKR RUN from Wahoo ) sets the GAP look for the 833 HRM belt type and advertises 2 UUID s-HRP and RSCP. Thus, thanks to the results of scanning (advertising), we concluded that this is an HRM device. Only after you connect to it to receive GATT services, you will receive a full set of GATT UUIDs, and it turns out that it supports RSCP (Running Speed ​​and Cadence Profile) and HRP (Heart Rate Profile)

Now, from the point of view of scanning, this is an expensive game to connect to each device in the detection phase, so it may well go with the main service that the device advertises

NTN!

+2
source

Source: https://habr.com/ru/post/1268122/


All Articles