简体   繁体   English

如何仅扫描广告包BLE

[英]How to scan only Advertising Packet BLE

While scanning for advertising beacons with startLeScan method, this method also request peripheral device for scan response and stores it in scanRecord. 在使用startLeScan方法扫描广告信标时,此方法还请求外围设备进行扫描响应并将其存储在scanRecord中。 I only want to scan for advertising payload I don't want to send request scan response to peripheral device 我只想扫描广告有效载荷,我不想将请求扫描响应发送到外围设备

my code to scan: 我要扫描的代码:

mBluetoothAdapter.startLeScan(mLEScanCallback);
private BluetoothAdapter.LeScanCallback mLEScanCallback = new BluetoothAdapter.LeScanCallback() {
    @Override
    public void onLeScan(BluetoothDevice device, int rssi, byte[] scanRecord) {

    }
};

No, I do not believe there is any way to turn off scan response requests. 不,我不认为有任何方法可以关闭扫描响应请求。 Android 4.3-4.4 BLE APIs provide no scanning options at all (other than a service uuid filter). Android 4.3-4.4 BLE API完全不提供扫描选项(服务uuid​​过滤器除外)。 The new Android 5.0 APIs have added some scan options, but none that halt scan responses. 新的Android 5.0 API已添加了一些扫描选项,但没有一个会停止扫描响应。 See here: 看这里:

https://developer.android.com/reference/android/bluetooth/le/ScanSettings.Builder.html https://developer.android.com/reference/android/bluetooth/le/ScanSettings.Builder.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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