且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Android BLE扫描模式设置间隔

更新时间:2023-01-24 08:14:46

它们没有记录.

您可以在如果您在以下位置搜索,则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.