问题描述
我正在编写一个小型测试应用程序以评估蓝牙模块.
I'm writing a small test application to assess a Bluetooth module.
该应用当前正在使用主动匹配模式和低延迟扫描模式进行扫描.我们已经控制了蓝牙模块的广告间隔,并正在尝试评估要触发android中的回调需要多少广告.
The app is currently scanning with the aggressive match mode and low latency scan mode. We have control of the advertising interval of the Bluetooth module, and are trying to assess how many adverts are required to trigger a callback in android.
有人知道与低延迟,平衡和低功耗扫描模式设置相关的android BLE扫描的间隔和窗口吗?
Does anyone know the interval and windows of the android BLE scans associated with the low latency, balanced, and low power scan mode settings?
我已经找到了这个()这样的问题,但是,如果我在我的android设备开始扫描后5000ms启动我的蓝牙设备广告,发现它在3000ms之内.(这表示5000ms的间隔,5000ms的窗口不正确吗?)
I've found this (How to set BLE scan interval and windows no just choose mode in android?) SO question, however if i start my Bluetooth device advertising 5000ms after my android device starts scanning it is found within 3000ms. (which indicates the the 5000ms interval, 5000ms window is incorrect?)
推荐答案
它们没有记录.
您可以在如果您在以下位置搜索,则https://android.googlesource.com/platform/packages/apps/Bluetooth/+/master/src/com/android/bluetooth/gatt/ScanManager.java 对应于常规扫描设置的扫描参数".您需要查看历史记录,以了解在不同的Android版本之间如何更改这些值.
You can see the source at https://android.googlesource.com/platform/packages/apps/Bluetooth/+/master/src/com/android/bluetooth/gatt/ScanManager.java if you search under "Scan params corresponding to regular scan setting". You will need to look at the history to see how the values have been changed between different Android versions.
本文发布时的当前值如下:
The current values at the time of this post are the following:
/**
* Scan params corresponding to regular scan setting
*/
private static final int SCAN_MODE_LOW_POWER_WINDOW_MS = 512;
private static final int SCAN_MODE_LOW_POWER_INTERVAL_MS = 5120;
private static final int SCAN_MODE_BALANCED_WINDOW_MS = 1024;
private static final int SCAN_MODE_BALANCED_INTERVAL_MS = 4096;
private static final int SCAN_MODE_LOW_LATENCY_WINDOW_MS = 4096;
private static final int SCAN_MODE_LOW_LATENCY_INTERVAL_MS = 4096;
您还可以获取hci监听日志,并查看它告诉控制器使用哪些扫描参数.请注意,根据规范,参数只是建议.控制器可能会根据其他并发无线电活动使用不同的值.
You can also fetch the hci snoop log and see which scan parameters it tells the controller to use. Note that there parameters are just a suggestion, according to the specification. The controller may use different values depending on other concurrent radio activities.
这篇关于Android BLE扫描模式设置间隔的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!