CN / EN
CN / EN

提问

设计支持

您的项目私密技术问题如需获得一对一支持,请点击下方联系我们。

蓝牙不设置超时,即一直不停的扫描,该怎么弄,是将超时时间设置为0吗 GR551x

qianxuping

2021-08-06 14:10

蓝牙不设置超时,即一直不停的扫描,该怎么弄,是将超时时间设置为0吗,但是我设置成0都进入不了回调函数。该怎么设置让扫描一直扫描,不设置超时。

1收藏

0赞成

{-}{-}

汇顶员工
2021-08-09 15:01

Hi,

您好!

“ 对于legacy scan而言将 timeout时间设置为0表示一直不停的扫描,对于ext scan而言需要将duration和period参数设置为0,具体用法可以参考示例工程:

GR551x_Vxxx_sdk\projects\ble\ble_basic_example\ble_app_gap_legacy_scan(ble_app_gap_extended_scan)以及GR551x_Vxxx_sdk \components\sdk\ble_gapm.h 中关于结构体gap_scan_param_t\gap_ext_scan_param_t的注释,如下:

/** * @brief Parameters for legacy scanning */

typedef struct{

gap_scan_type_t scan_type; /**< Active scanning or passive scanning. */

gap_scan_mode_t scan_mode; /**< Scan mode. */

gap_scan_dup_filt_policy_t scan_dup_filt; /**< Duplicate filter policy. */

bool use_whitelist; /**< Filter policy. */

uint16_t interval; /**< Scan interval between 0x0004 and 0x4000 in 0.625 ms (range: 2.5 ms to 10.24s). */

uint16_t window; /**< Scan window between 0x0004 and 0x4000 in 0.625 ms (range: 2.5 ms to 10.24s). */ uint16_t timeout; /**< Scan timeout should be a value between 0x0001 and 0xFFFF(unit: 10 ms). 0x0000 indicates that the timeout has no effect. */

} gap_scan_param_t;

也可以参考“GR55xx BLE Stack用户指南”的2.4.2.1/2.4.2.2章节的说明,地址如下:

https://product.goodix.com/zh/docview/GR55xx BLE Stack用户指南?objectId=103&objectType=document&version=234

没有明白您说的“设置成0都进入不了回调函数”是指进不了什么回调? 能否更详细的描述一下问题”


谢谢!

0条评论

0赞成

1收藏

您的评论

登录后可回答问题,请 注册

我们时刻倾听您的声音
联系销售

扫描关注公众号

打开微信,使用“扫一扫”即可关注