Navigation

    全志在线开发者论坛

    • Register
    • Login
    • Search
    • Categories
    • Tags
    • 在线文档
    • 社区主页

    【FAQ】全志R329如何解决蓝牙设备断开慢的问题?

    其它全志芯片讨论区
    r329 r328 r818 faq 技术支持
    1
    1
    1263
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • q1215200171
      budbool LV 9 last edited by

      问题背景

      蓝牙设备主动断开连接,主控端20s后才收到断开消息,时间过长。

      问题描述

      • 已连接的蓝牙耳机设备关机了,没及时收到断开的回调,无法播放音乐。
      • 已连接的蓝牙打印机关机了,没收到断开的消息,继续打印,数据发送失败。

      问题分析

      此问题涉及到一个概念:Link supervision timeout。
      每个物理链路都有一个timer用于链接监测,link supervision timeout就是timer的超时时间。
      蓝牙Controller使用link supervision timeout监测连接是否丢失了。一般以下的这种情况link supervision timeout会发挥作用:

      • 设备连接超出范围或者被干扰导致物理链接丢失。
      • 设备掉电引起的物理链接丢失。

      link supervision timeout 一般是双方设备协商的,一般默认为20s。
      如果觉得20s时间太长,可以主动去调整link supervision timeout。

      解决办法

      当蓝牙为master设备时,可以修改link supervision timeout。
      Tina平台,可以调用btmanager的API去调整:

      int bt_manager_set_link_supervision_timeout(const char *addr, int slots) ;
      其中addr是对端蓝牙设备的mac地址,slots为超时时间,单位为0.625ms,实际的超时时间为: slots * 0.625ms。
      

      需要注意,需要在设备已连接的状态去设置,否则无效,同时设备断开连接之后也会失效。
      所以如果要设置,则每次连接成功之后需要设置一次。

      1 Reply Last reply Reply Quote Share 0
      • Referenced by  q1215200171 q1215200171 
      • Referenced by  q1215200171 q1215200171 
      • Referenced by  q1215200171 q1215200171 
      • Referenced by  q1215200171 q1215200171 
      • Referenced by  q1215200171 q1215200171 
      • 1 / 1
      • First post
        Last post

      Copyright © 2024 深圳全志在线有限公司 粤ICP备2021084185号 粤公网安备44030502007680号

      行为准则 | 用户协议 | 隐私权政策