简体   繁体   中英

Android BLE scan filters returning many MAC matches for 1 dev in a few secs - What is intended behavior?

It's not clear from the documentation I've read what the intended behavior of BluetoothLE scans is. There's a particular device we're looking for, if I scan using name or MAC as a criterion I get dozens of results matching both -- is this an intended reflection of multiple device advertisements, or RSSI change or something?

ArrayList<ScanFilter> filter = new ArrayList<ScanFilter>();
filter.add(new ScanFilter.Builder().setDeviceAddress("24:XX:XX:XX:XX:XX").build());
ScanSettings settings = new ScanSettings.Builder().setScanMode(ScanSettings.SCAN_MODE_LOW_LATENCY).build();
bluetoothLeScanner.startScan(filter, settings, leScanCallback);    // Yields 34 in 5 sec

Yes, you will get one callback per advertisement or pair of advertisement/scan response data.

You can therefore for example track rssi changes, or changes in the advertisement data.

Use for example https://developer.android.com/reference/android/bluetooth/le/ScanSettings#MATCH_NUM_ONE_ADVERTISEMENT to modify that behaviour.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM