Getting different byte[] scanRecord data for same

2019-06-22 08:16发布

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

I scanned a single BLE device from Acer table of version 4.4.2 and Nexus 7 5.1 version. I want to filter the BLE devices using UUIDS, but I am getting different scanRecord data for same BLE device.

I attached the detailed pics.enter image description hereenter image description here

1条回答
Explosion°爆炸
2楼-- · 2019-06-22 08:43

This is pretty common in BLE world. When a BLE device advertises multiple services - The scanner is free to filter what it needs or is relevant to it. I have seen similar behavior in a HRM (Heart Rate Monitor) device which doubles up as a Food Pod (profile - RSCP) as well - Hence implementing 2 services at the same time.

For such devices (hosting multiple services) it is a good practice to have a type resolution policy for BLE scan results - for example this may be an order of precedence:-

1. GAP Appearance  
2. GATT Service  

The fitness sensor I mentioned above (TICKR RUN from Wahoo) sets GAP appearance to 833 belt type HRM and advertises 2 UUID s- HRP and RSCP. So going by sheer scan (advertisement) results we concluded it to be a HRM device only. Only after you connect to it for retrieving GATT services you get the full set of GATT UUIDs and it turned out to support RSCP (Running Speed and Cadence Profile) and HRP (Heart Rate Profile)

Now from the perspective of scanning - it's a costly game to connect to each and every device in the discovery phase hence it might be OK to go with the primary service the device is advertising

HTH!

查看更多
登录 后发表回答