Android AOSP - android源代码中定义扫描间隔和扫描窗口 [英] Android AOSP - Definition of scan interval and scan window in android source code

查看:63
本文介绍了Android AOSP - android源代码中定义扫描间隔和扫描窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经下载了 Lollipop 5.0 的 AOSP 源代码.在 api 级别 21 中,在蓝牙低功耗扫描设置下,扫描 ble 设备有三个选项 - SCAN_MODE_BALANCED、SCAN_MODE_LOW_LATENCY、SCAN_MODE_LOW_POWER.是否基于不同的扫描间隔和扫描窗口值?如果是这样,我在哪里可以找到源代码目录中为这些宏定义的值.

I have downloaded the AOSP Source code for Lollipop 5.0. In api level 21, under bluetooth low energy scan settings there are three options for scanning the ble devices- SCAN_MODE_BALANCED, SCAN_MODE_LOW_LATENCY, SCAN_MODE_LOW_POWER. Are the based on different scan interval and scan window values? If so, where can I find the values defined for these macros in the source code directory.

推荐答案

我在 http://androidxref.com/5.0.0_r2/xref/packages/apps/Bluetooth/src/com/android/bluetooth/gatt/ScanManager.java 同时搜索关键字SCAN_MODE_BALANCED":

I found below values in http://androidxref.com/5.0.0_r2/xref/packages/apps/Bluetooth/src/com/android/bluetooth/gatt/ScanManager.java while greping the keyword "SCAN_MODE_BALANCED" :

    /**
     * Scan params corresponding to regular scan setting
     */
    private static final int SCAN_MODE_LOW_POWER_WINDOW_MS = 500;
    private static final int SCAN_MODE_LOW_POWER_INTERVAL_MS = 5000;
    private static final int SCAN_MODE_BALANCED_WINDOW_MS = 2000;
    private static final int SCAN_MODE_BALANCED_INTERVAL_MS = 5000;
    private static final int SCAN_MODE_LOW_LATENCY_WINDOW_MS = 5000;
    private static final int SCAN_MODE_LOW_LATENCY_INTERVAL_MS = 5000;

    /**
     * Scan params corresponding to batch scan setting
     */
    private static final int SCAN_MODE_BATCH_LOW_POWER_WINDOW_MS = 1500;
    private static final int SCAN_MODE_BATCH_LOW_POWER_INTERVAL_MS = 150000;
    private static final int SCAN_MODE_BATCH_BALANCED_WINDOW_MS = 1500;
    private static final int SCAN_MODE_BATCH_BALANCED_INTERVAL_MS = 15000;
    private static final int SCAN_MODE_BATCH_LOW_LATENCY_WINDOW_MS = 1500;
    private static final int SCAN_MODE_BATCH_LOW_LATENCY_INTERVAL_MS = 5000;

还要检查 ScanManager.ScanNative.configureRegularScanParams().根据扫描设置(ScanSettings.SCAN_MODE_LOW_POWERScanSettings.SCAN_MODE_BALANCEDScanSettings.SCAN_MODE_LOW_LATENCY),转换成BLE单位,然后传递给gattSetScanParametersNative().

Also checkout out ScanManager.ScanNative.configureRegularScanParams(). Two params scanWindow and scanInterval are set according to the scan setting (ScanSettings.SCAN_MODE_LOW_POWER, ScanSettings.SCAN_MODE_BALANCED, ScanSettings.SCAN_MODE_LOW_LATENCY), converted into BLE units, and then passed to gattSetScanParametersNative().

希望这会有所帮助.

这篇关于Android AOSP - android源代码中定义扫描间隔和扫描窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆