connect命令发送后,出现disconenct

公告

大中华汽车电子生态圈社区并入开发者社区- 更多资讯点击此

Tip / 登入 to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
YaTr_3516311
Level 5
Level 5
25 sign-ins First solution authored 100 replies posted

Hi,

测试多链接的时候,发现有的板子比较不容易建立上连接,比如发送了connect的命令,然后就过来190601030001003e的消息,reason是3e。

请问是什么原因

0 点赞
2 回复数
Owen_Zhang123
Moderator
Moderator
Moderator
5 questions asked 500 solutions authored 250 sign-ins

Disconnecton reason 可以在wiced_bt_gatt.h中查到:

/**  GATT Disconnection reason */

enum wiced_bt_gatt_disconn_reason_e {

    GATT_CONN_UNKNOWN                      = 0,                                    /**< Unknown reason */

    GATT_CONN_L2C_FAILURE                  = 1,                                    /**< General L2cap failure  */

    GATT_CONN_TIMEOUT                      = HCI_ERR_CONNECTION_TOUT,              /**< Connection timeout  */

    GATT_CONN_TERMINATE_PEER_USER          = HCI_ERR_PEER_USER,                    /**< Connection terminated by peer user  */

    GATT_CONN_TERMINATE_LOCAL_HOST          = HCI_ERR_CONN_CAUSE_LOCAL_HOST,        /**< Connection terminated by local host  */

    GATT_CONN_FAIL_ESTABLISH                = HCI_ERR_CONN_FAILED_ESTABLISHMENT,    /**< Connection fail to establish  */

    GATT_CONN_LMP_TIMEOUT                  = HCI_ERR_LMP_RESPONSE_TIMEOUT,        /**< Connection fail due to LMP response tout */

    GATT_CONN_CANCEL                        = L2CAP_CONN_CANCEL                    /**< L2CAP connection cancelled  */

};

3e表示的是GATT_CONN_TERMINATE_LOCAL_HOST          = HCI_ERR_CONN_CAUSE_LOCAL_HOST,        /**< Connection terminated by local host  */

你可以试下如果单独连接这个设备或者将设备靠的近一点是否可以成功连接。

0 点赞

你的意思是GATT_CONN_TERMINATE_LOCAL_HOST的错误是因为信号强弱的原因导致的disconnect?

1. 单独连接 也是这样的现象(出现3e)

2. 在同样的距离(A: master, B:slaver),有时候就会出现3e,有时候就能成功connect.  然后换了一块A的板子,就可以成功连上B.

3. 蓝牙能成功建立链接的距离最大是支持多少

0 点赞