蓝牙连接失败的日志

这篇博客详细记录了一次蓝牙设备配对过程中的关键事件,包括创建绑定、服务获取、搜索操作取消、状态变化及连接状态的改变。同时,它深入解析了蓝牙连接失败的代码含义,如BTA_GATT_OK到BTA_GATT_ERROR的错误码。对于IT技术人员研究蓝牙通信问题极具参考价值。
摘要由CSDN通过智能技术生成

配对日志:

05-09 20:36:50.481  5055  5055 I BluetoothDevice: createBond() for device 7C:DF:A1:E2:71:6E called by pid: 5055 tid: 5055
05-09 20:36:50.484  6646  6657 D A2dpService: getA2DPService(): returning com.android.bluetooth.a2dp.A2dpService@f9f3c27
05-09 20:36:50.484  6646  6657 I bt_btif : btif_dm_cancel_discovery
05-09 20:36:50.484  6646  6732 I bt_btif : BTA got event 0x201
05-09 20:36:50.484  6646  6732 I bt_btif : bta_dm_search_sm_execute state:0, event:0x201
05-09 20:36:50.484  6646  6732 D bt_btif : bte_search_devices_evt event=BTA_DM_SEARCH_CANCEL_CMPL_EVT param_len=0
05-09 20:36:50.484  6646  6732 D bt_btif : btif_transfer_context event 6, len 0
05-09 20:36:50.484  6646  6732 I bt_btm  : BTM_CancelRemoteDeviceName()
05-09 20:36:50.486  6646  6666 D bt_btif : btif task fetched event a001
05-09 20:36:50.486  6646  6666 D bt_btif : btif_context_switched
05-09 20:36:50.486  6646  6666 I bt_btif : btif_dm_search_devices_evt event=BTA_DM_SEARCH_CANCEL_CMPL_EVT
05-09 20:36:50.486  6646  6666 I bt_btif : BTA_DmBleScanFilterSetup: 1
05-09 20:36:50.486  6646  6666 I bt_btif : HAL bt_hal_cbacks->discovery_state_changed_cb
05-09 20:36:50.486  6646  6732 I bt_btif : BTA got event 0x123
05-09 20:36:50.486  6646  6732 I bt_btif : bta_dm_sm_execute event:0x23
05-09 20:36:50.486  6646  6732 D bt_btif : bta_dm_scan_filter_param_setup
05-09 20:36:50.486  6646  6732 D bt_btm  : BTM_BleGetVendorCapabilities
05-09 20:36:50.486  6646  6732 D bt_btm  : BTM_BleGetVendorCapabilities
05-09 20:36:50.486  6646  6732 I bt_btm  :  BTM_BleAdvFilterParamSetup
05-09 20:36:50.486  6646  6732 I bt_btm  : BTM: BTM_VendorSpecificCommand: Opcode: 0xFD57, ParamLen: 3.
05-09 20:36:50.486  6646  6732 D bt_btm  : btm_ble_advfilt_enq_op_q: act_ocf:17, action:1, ocf:1,cb_evt;3, cback:0
05-09 20:36:50.488  6646  6667 I BluetoothBondStateMachine: Bond address is:7C:DF:A1:E2:71:6E
05-09 20:36:50.488  6646  6667 I bt_btif : btif_dm_create_bond: bd_addr=7c:df:a1:e2:71:6e, transport=0
05-09 20:36:50.488  6646  6667 D bt_btif_config: btif_get_device_type: Device [7c:df:a1:e2:71:6e] type 2
05-09 20:36:50.488  6646  6667 D bt_btif : in, bd addr:7c:df:a1:e2:71:6e, prop type:4, len:4
05-09 20:36:50.488  6646  6667 I bt_btif_dm: get_cod remote_cod = 0x00001f00
05-09 20:36:50.489  6646  6667 D bt_btif : btif_transfer_context event 33026, len 6
05-09 20:36:50.489  6646  6667 I BluetoothBondStateMachine: Entering PendingCommandState State
05-09 20:36:50.490  6646  6666 D bt_btif : btif task fetched event a001
05-09 20:36:50.490  6646  6666 D bt_btif : btif_context_switched
05-09 20:36:50.490  6646  6666 I bt_btif : btif_dm_generic_evt: event=33026
05-09 20:36:50.490  5055  6627 D Index   : Indexing locale 'zh_CN' took 3 millis
05-09 20:36:50.490  6646  6666 D bt_btif : in, bd addr:7c:df:a1:e2:71:6e, prop type:4, len:4
05-09 20:36:50.490  6646  6666 I bt_btif_dm: get_cod remote_cod = 0x00001f00
05-09 20:36:50.490  6646  6666 D bt_btif_config: btif_get_device_type: Device [7c:df:a1:e2:71:6e] type 2
05-09 20:36:50.490  6646  6666 D bt_btif : in, bd addr:7c:df:a1:e2:71:6e, prop type:4, len:4
05-09 20:36:50.490  6646  6666 I bt_btif_dm: get_cod remote_cod = 0x00001f00
05-09 20:36:50.490  6646  6666 D bt_btif : bond_state_changed: state=1, prev_state=0, sdp_attempts = 0
05-09 20:36:50.490  6646  6666 I bt_btif : HAL bt_hal_cbacks->bond_state_changed_cb
05-09 20:36:50.491   569  1064 D msm8916_platform: platform_set_channel_map mixer_ctl_name:Playback Channel Map12
05-09 20:36:50.491  6646  6666 I BluetoothBondStateMachine: bondStateChangeCallback: Status: 0 Address: 7C:DF:A1:E2:71:6E newState: 1


01-01 10:28:09.523  3577  3753 I BluetoothBondStateMachine: bondStateChangeCallback: Status: 1 Address: 7C:DF:A1:E2:44:B6 newState: 0
01-01 10:28:09.524  3577  4041 D BluetoothAdapterProperties: Failed to remove device: 7C:DF:A1:E2:44:B6
01-01 10:28:09.526  3577  3577 D BluetoothDunService: parseIntent: action: android.bluetooth.device.action.BOND_STATE_CHANGED
01-01 10:28:09.528  3577  4041 I BluetoothBondStateMachine: Bond State Change Intent:7C:DF:A1:E2:44:B6 OldState: 11 NewState: 10  配对失败

连接日志

BtGatt.GattService: onConnected() - clientIf=5, connId=5, address=7C:DF:A1:E2:45:4A

BluetoothGatt: onClientConnectionState() - status=133 clientIf=5 device=7C:DF:A1:E2:45:4A

在文件system/bt/bta/include/bta_gatt_api.h 成功码和失败码的定义

/* Success code and error codes */
#define  BTA_GATT_OK                        GATT_SUCCESS
#define  BTA_GATT_INVALID_HANDLE            GATT_INVALID_HANDLE                /* 0x0001 */
#define  BTA_GATT_READ_NOT_PERMIT           GATT_READ_NOT_PERMIT               /* 0x0002 */
#define  BTA_GATT_WRITE_NOT_PERMIT          GATT_WRITE_NOT_PERMIT              /* 0x0003 */
#define  BTA_GATT_INVALID_PDU               GATT_INVALID_PDU                   /* 0x0004 */
#define  BTA_GATT_INSUF_AUTHENTICATION      GATT_INSUF_AUTHENTICATION          /* 0x0005 */
#define  BTA_GATT_REQ_NOT_SUPPORTED         GATT_REQ_NOT_SUPPORTED             /* 0x0006 */
#define  BTA_GATT_INVALID_OFFSET            GATT_INVALID_OFFSET                /* 0x0007 */
#define  BTA_GATT_INSUF_AUTHORIZATION       GATT_INSUF_AUTHORIZATION           /* 0x0008 */
#define  BTA_GATT_PREPARE_Q_FULL            GATT_PREPARE_Q_FULL                /* 0x0009 */
#define  BTA_GATT_NOT_FOUND                 GATT_NOT_FOUND                     /* 0x000a */
#define  BTA_GATT_NOT_LONG                  GATT_NOT_LONG                      /* 0x000b */
#define  BTA_GATT_INSUF_KEY_SIZE            GATT_INSUF_KEY_SIZE                /* 0x000c */
#define  BTA_GATT_INVALID_ATTR_LEN          GATT_INVALID_ATTR_LEN              /* 0x000d */
#define  BTA_GATT_ERR_UNLIKELY              GATT_ERR_UNLIKELY                  /* 0x000e */
#define  BTA_GATT_INSUF_ENCRYPTION          GATT_INSUF_ENCRYPTION              /* 0x000f */
#define  BTA_GATT_UNSUPPORT_GRP_TYPE        GATT_UNSUPPORT_GRP_TYPE            /* 0x0010 */
#define  BTA_GATT_INSUF_RESOURCE            GATT_INSUF_RESOURCE                /* 0x0011 */


#define  BTA_GATT_NO_RESOURCES              GATT_NO_RESOURCES                  /* 0x80 */
#define  BTA_GATT_INTERNAL_ERROR            GATT_INTERNAL_ERROR                /* 0x81 */
#define  BTA_GATT_WRONG_STATE               GATT_WRONG_STATE                   /* 0x82 */
#define  BTA_GATT_DB_FULL                   GATT_DB_FULL                       /* 0x83 */
#define  BTA_GATT_BUSY                      GATT_BUSY                          /* 0x84 */
#define  BTA_GATT_ERROR                     GATT_ERROR                         /* 0x85 */
framework 中涉及文件

frameworks/base/core/java/android/bluetooth/BluetoothGatt.java

connect->registerApp(callback, handler)->onClientConnectionState

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值