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

查看:312
本文介绍了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.

推荐答案

我在

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)设置两个参数scanWindowscanInterval,将其转换为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天全站免登陆