Getting different byte[] scanRecord data for same BLE device while scanning with different versions of android device

…衆ロ難τιáo~ 提交于 2019-12-12 10:57:26

问题


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.


回答1:


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!



来源:https://stackoverflow.com/questions/44126450/getting-different-byte-scanrecord-data-for-same-ble-device-while-scanning-with

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!