- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
要求是在 Android 设备上具有 hfp 客户端角色。所以我们向后移植了 Lollopop 版本中可用的 hfp 客户端角色实现。除了音频更改外,一切都很顺利。
现在我面临一个问题,我无法调用/接听其他电话(设备作为 HFP 客户端,任何智能手机作为 AG)。我遇到过通话未正确结束的情况。
我在这里列出了我所有的观察——
如果电话(充当 AG)是果冻 bean ,那么调用/接听电话不是问题。
如果电话(充当 AG)是 kitkat,那么拨号/接听电话不会顺利进行(例如拨号时,hfp 客户端设备不会收到 CALL_STATE_DIALING 而是收到 CALL_STATE_ALERTING。虽然通话通常会建立但会结束来自设备的调用不顺利)。奇怪的是,如果用户断开 AG 电话并再次连接。接收/拨号开始正常。
如果电话(充当 AG)是 Lollipop ,则调用/接听电话的行为与 #2 中解释的类似,但是这次断开/连接对行为没有任何影响。
如果您需要有关此问题的更多信息,请告诉我。
注意- 这是拨号案例,记录日志直到调用被接受。区别在于我在非工作场景中没有得到 android.bluetooth.headsetclient.profile.action.AG_CALL_CHANGED State: 2(CALL_STATE_DIALING)
编辑:刚刚注意到 JellyBean 可以工作是因为它是 bluez,问题出在具有 bluedroid 堆栈的 sdk 中。有人可以分享一些可以提供帮助的指示。问题仍然存在。我们不会收到拨号、接受和终止的确认。
不工作的案例日志
D/BluetoothHeadsetClient( 2403): dial()
D/HeadsetClientStateMachine( 2189): Connected process message: 10
D/bt-l2cap( 2189): TotalWin=5,Hndl=0x100,Quota=6,Unack=1,RRQuota=0,RRUnack=0
D/bt-l2cap( 2189): RR scan pri=2, lcid=0x004a, q_cout=0
D/HeadsetClientStateMachine( 2189): Connected: addQueuedAction: 10
D/bt-l2cap( 2189): RR scan pri=2, lcid=0x004a, q_cout=0
D/bt-l2cap( 2189): TotalWin=6,LinkUnack(0x100)=0,RRCheck=0,RRUnack=0
D/bt-l2cap( 2189): l2cu_allocate_ccb: cid 0x0000
D/bt-l2cap( 2189): l2cu_enqueue_ccb CID: 0x004f priority: 2
D/bt-l2cap( 2189): l2c_link_adjust_chnl_allocation
D/bt-l2cap( 2189): POOL ID:3, GKI_poolcount = 200, reserved_buff = 0, weighted_chnls = 4, quota_per_weighted_chnls = 51
D/bt-btm ( 2189): BTM_SetPowerMode: mode:0x0 interval 0 max:0, min:0
D/bt-btm ( 2189): btm_sec_l2cap_access_req is_originator:0, 0x54f825c8
D/bt-l2cap( 2189): l2c_link_sec_comp: 17, 0x54f825c8
D/bt-l2cap( 2189): ccb timer ticks: 2147483648
D/bt-l2cap( 2189): TotalWin=5,Hndl=0x100,Quota=6,Unack=1,RRQuota=0,RRUnack=0
D/bt-l2cap( 2189): RR scan pri=2, lcid=0x004a, q_cout=0
D/bt-l2cap( 2189): RR scan pri=2, lcid=0x004f, q_cout=0
D/bt-l2cap( 2189): TotalWin=4,Hndl=0x100,Quota=6,Unack=2,RRQuota=0,RRUnack=0
D/bt-l2cap( 2189): RR scan pri=2, lcid=0x004a, q_cout=0
D/bt-l2cap( 2189): RR scan pri=2, lcid=0x004f, q_cout=0
D/bt-l2cap( 2189): RR scan pri=2, lcid=0x004a, q_cout=0
D/bt-l2cap( 2189): RR scan pri=2, lcid=0x004f, q_cout=0
D/bt-l2cap( 2189): TotalWin=5,LinkUnack(0x100)=1,RRCheck=0,RRUnack=0
D/bt-l2cap( 2189): RR scan pri=2, lcid=0x004a, q_cout=0
D/bt-l2cap( 2189): RR scan pri=2, lcid=0x004f, q_cout=0
D/bt-l2cap( 2189): TotalWin=6,LinkUnack(0x100)=0,RRCheck=0,RRUnack=0
D/bt-btm ( 2189): btm_bda_to_acl found
D/bt-btm ( 2189): btm_get_max_packet_size
D/bt-l2cap( 2189): l2cu_adjust_out_mps use 0 Based on peer_cfg.fcr.mps: 0 packet_size: 1011
D/bt-l2cap( 2189): TotalWin=5,Hndl=0x100,Quota=6,Unack=1,RRQuota=0,RRUnack=0
D/bt-l2cap( 2189): RR scan pri=2, lcid=0x004a, q_cout=0
D/bt-l2cap( 2189): RR scan pri=2, lcid=0x004f, q_cout=0
D/bt-l2cap( 2189): l2c_link_adjust_chnl_allocation
D/bt-l2cap( 2189): POOL ID:3, GKI_poolcount = 200, reserved_buff = 0, weighted_chnls = 4, quota_per_weighted_chnls = 51
D/bt-l2cap( 2189): RR scan pri=2, lcid=0x004a, q_cout=0
D/bt-l2cap( 2189): RR scan pri=2, lcid=0x004f, q_cout=0
D/bt-l2cap( 2189): TotalWin=6,LinkUnack(0x100)=0,RRCheck=0,RRUnack=0
D/bt-l2cap( 2189): RR scan pri=2, lcid=0x004a, q_cout=0
D/bt-l2cap( 2189): RR scan pri=2, lcid=0x004f, q_cout=1
D/bt-l2cap( 2189): RR service pri=2, quota=4, lcid=0x004f
D/bt-l2cap( 2189): TotalWin=5,Hndl=0x100,Quota=6,Unack=1,RRQuota=0,RRUnack=0
D/bt-l2cap( 2189): RR scan pri=2, lcid=0x004a, q_cout=0
D/bt-l2cap( 2189): RR scan pri=2, lcid=0x004f, q_cout=0
D/bt-l2cap( 2189): RR scan pri=2, lcid=0x004a, q_cout=0
D/bt-l2cap( 2189): RR scan pri=2, lcid=0x004f, q_cout=0
D/bt-l2cap( 2189): TotalWin=6,LinkUnack(0x100)=0,RRCheck=0,RRUnack=0
D/bt-btif ( 2189): bta_hf_client_esco_connreq_cback 2
D/bt-btif ( 2189): bta_hf_client_sco_conn_rsp
D/bt-btif ( 2189): bta_hf_client_sco_conn_cback 0
D/bt-btif ( 2189): bta_hf_client_sco_conn_open
D/bt-btif ( 2189): bta_hf_client_sco_event state: 2 event: 4
D/bt-btif ( 2189): bta_dm_pm_cback: st(4), id(27), app(1)
D/bt-btm ( 2189): BTM_SetPowerMode: mode:0x0 interval 0 max:31209, min:21738
D/HeadsetClientStateMachine( 2189): incomingStackEvent {type:EVENT_TYPE_AUDIO_STATE_CHANGED, value1:2, value2:0, value3:0, value4:0, string: "null", device:CC:FA:00:72:B7:D0}
D/HeadsetClientStateMachine( 2189): Connected process message: 100
D/bt-l2cap( 2189): TotalWin=5,Hndl=0x100,Quota=6,Unack=1,RRQuota=0,RRUnack=0
D/bt-l2cap( 2189): RR scan pri=2, lcid=0x004a, q_cout=0
D/bt-l2cap( 2189): RR scan pri=2, lcid=0x004f, q_cout=0
D/bt-l2cap( 2189): l2cu_release_ccb: cid 0x004f in_use: 1
D/bt-l2cap( 2189): l2cu_dequeue_ccb CID: 0x004f
D/bt-l2cap( 2189): l2c_link_adjust_chnl_allocation
D/bt-l2cap( 2189): POOL ID:3, GKI_poolcount = 200, reserved_buff = 0, weighted_chnls = 2, quota_per_weighted_chnls = 101
D/bt-sdp ( 2189): releasing SDP rsp_list
D/HeadsetClientStateMachine( 2189): Connected: event type: 2
D/HeadsetClientStateMachine( 2189): Connected: Audio state changed: CC:FA:00:72:B7:D0: 2
E/bt-rfcomm( 2189): PORT_DataInd, p_port:0x54f82d5c, p_data_co_callback is null
D/bt-btif ( 2189): bta_hf_client_at_parse offset: 0 len: 6
D/bt-btif ( 2189): bta_hf_client_check_at_complete 1
D/bt-btif ( 2189): bta_hf_client_at_parse_start
D/bt-btif ( 2189): bta_hf_client_handle_ok
D/bt-btif ( 2189): bta_hf_client_send_queued_at
E/bt-rfcomm( 2189): PORT_DataInd, p_port:0x54f82d5c, p_data_co_callback is null
D/bt-btif ( 2189): bta_hf_client_at_parse offset: 0 len: 14
D/bt-btif ( 2189): bta_hf_client_check_at_complete 1
D/bt-btif ( 2189): bta_hf_client_at_parse_start
D/bt-btif ( 2189): bta_hf_client_handle_ciev index: 2 value: 2
D/HeadsetClientStateMachine( 2189): bthf_companion case
D/HeadsetClientStateMachine( 2189): incomingStackEvent {type:EVENT_TYPE_CMD_RESULT, value1:0, value2:0, value3:0, value4:0, string: "null", device:null}
V/Avrcp ( 2189): New genId = 4, clearing = 1
D/bt-l2cap( 2189): RR scan pri=2, lcid=0x004a, q_cout=0
D/bt-l2cap( 2189): TotalWin=6,LinkUnack(0x100)=0,RRCheck=0,RRUnack=0
D/HeadsetClientStateMachine( 2189): setAudioMode Setting audio mode from 0 to 2
D/HeadsetClientStateMachine( 2189): incomingStackEvent {type:EVENT_TYPE_CALLSETUP, value1:2, value2:0, value3:0, value4:0, string: "null", device:null}
D/bt-l2cap( 2189): l2cu_allocate_ccb: cid 0x0000
D/bt-l2cap( 2189): l2cu_enqueue_ccb CID: 0x0040 priority: 2
D/bt-l2cap( 2189): l2c_link_adjust_chnl_allocation
D/bt-l2cap( 2189): POOL ID:3, GKI_poolcount = 200, reserved_buff = 0, weighted_chnls = 4, quota_per_weighted_chnls = 51
D/bt-btm ( 2189): BTM_SetPowerMode: mode:0x0 interval 0 max:0, min:0
D/bt-btm ( 2189): btm_sec_l2cap_access_req is_originator:0, 0x54f81164
D/bt-btm ( 2189): btm_sec_l2cap_access_req() sm4:0x11, sec_flags:0xbe, security_required:0x1086 chk:1
D/bt-btm ( 2189): no next_serv sm4:0x11, chk:1
D/bt-btm ( 2189): (SM4 to SM4) btm_sec_l2cap_access_req rspd. authenticated: x2, enc: x4
D/bt-btm ( 2189): btm_sec_check_upgrade...
D/bt-btm ( 2189): btm_sec_is_upgrade_possible id:37, link_key_typet:5, rmt_io_caps:1, chk flags:x1000, flags:x1082
D/bt-btm ( 2189): btm_sec_is_upgrade_possible is_possible:0 sec_flags:0xbe
D/bt-l2cap( 2189): l2c_link_sec_comp: 0, 0x54f81164
D/bt-l2cap( 2189): ccb timer ticks: 2147483648
D/bt-btm ( 2189): btm_sec_mx_access_request is_originator:0
D/bt-btm ( 2189): btm_sec_find_mx_serv
D/bt-btm ( 2189): btm_sec_check_upgrade...
D/bt-btm ( 2189): btm_sec_is_upgrade_possible id:37, link_key_typet:5, rmt_io_caps:1, chk flags:x1000, flags:x1082
D/bt-btm ( 2189): btm_sec_is_upgrade_possible is_possible:0 sec_flags:0xbe
D/bt-l2cap( 2189): TotalWin=5,Hndl=0x100,Quota=6,Unack=1,RRQuota=0,RRUnack=0
D/bt-l2cap( 2189): RR scan pri=2, lcid=0x004a, q_cout=0
D/bt-l2cap( 2189): RR scan pri=2, lcid=0x0040, q_cout=0
D/bt-l2cap( 2189): TotalWin=4,Hndl=0x100,Quota=6,Unack=2,RRQuota=0,RRUnack=0
D/bt-l2cap( 2189): RR scan pri=2, lcid=0x004a, q_cout=0
D/bt-l2cap( 2189): RR scan pri=2, lcid=0x0040, q_cout=0
D/bt-l2cap( 2189): RR scan pri=2, lcid=0x004a, q_cout=0
D/bt-l2cap( 2189): RR scan pri=2, lcid=0x0040, q_cout=0
D/bt-l2cap( 2189): TotalWin=5,LinkUnack(0x100)=1,RRCheck=0,RRUnack=0
D/bt-l2cap( 2189): RR scan pri=2, lcid=0x004a, q_cout=0
D/bt-l2cap( 2189): RR scan pri=2, lcid=0x0040, q_cout=0
D/bt-l2cap( 2189): TotalWin=6,LinkUnack(0x100)=0,RRCheck=0,RRUnack=0
D/bt-btm ( 2189): btm_bda_to_acl found
D/bt-btm ( 2189): btm_get_max_packet_size
D/bt-l2cap( 2189): l2cu_adjust_out_mps use 0 Based on peer_cfg.fcr.mps: 0 packet_size: 1011
D/bt-l2cap( 2189): TotalWin=5,Hndl=0x100,Quota=6,Unack=1,RRQuota=0,RRUnack=0
D/bt-l2cap( 2189): RR scan pri=2, lcid=0x004a, q_cout=0
D/bt-l2cap( 2189): RR scan pri=2, lcid=0x0040, q_cout=0
D/bt-l2cap( 2189): l2c_link_adjust_chnl_allocation
D/bt-l2cap( 2189): POOL ID:3, GKI_poolcount = 200, reserved_buff = 0, weighted_chnls = 4, quota_per_weighted_chnls = 51
D/bt-l2cap( 2189): Update CCB list in logical link
D/bt-l2cap( 2189): l2cu_dequeue_ccb CID: 0x0040
D/bt-l2cap( 2189): l2cu_enqueue_ccb CID: 0x0040 priority: 0
D/bt-btif ( 2189): CONN_IND is ACP:1
D/bt-btif ( 2189): conn_cback bd_addr:cc-fa-00-72-b7-d0
D/bt-btif ( 2189): bta_av_sig_chg event: 16
D/bt-btif ( 2189): conn_lcb: 0x0
E/bt-btif ( 2189): bta_av_rc_create ACP handle exist for shdl:0
D/bt-btif ( 2189): start sig timer 1
D/bt-btif ( 2189): Incoming L2CAP acquired, set state as incoming
D/bt-btif ( 2189): bta_av_sig_timer
D/bt-btif ( 2189): conn_lcb: 0x1
D/bt-btif ( 2189): btif_av_state_idle_handler event:BTA_AV_PENDING_EVT flags 0
D/bt-btif ( 2189): btif_av_state_idle_handler event:BTIF_SM_EXIT_EVT flags 0
D/bt-btif ( 2189): btif_av_state_opening_handler event:BTIF_SM_ENTER_EVT flags 0
D/bt-l2cap( 2189): RR scan pri=2, lcid=0x004a, q_cout=0
D/bt-l2cap( 2189): RR scan pri=0, lcid=0x0040, q_cout=0
D/bt-l2cap( 2189): TotalWin=6,LinkUnack(0x100)=0,RRCheck=0,RRUnack=0
D/A2dpStateMachine( 2189): Disconnected process message: 101
I/A2dpStateMachine( 2189): Incoming A2DP accepted
D/A2dpStateMachine( 2189): Exit Disconnected: 101
D/A2dpStateMachine( 2189): Enter Pending: 101
D/bt-l2cap( 2189): RR scan pri=0, lcid=0x0040, q_cout=1
D/bt-l2cap( 2189): RR service pri=0, quota=14, lcid=0x0040
D/bt-l2cap( 2189): TotalWin=5,Hndl=0x100,Quota=6,Unack=1,RRQuota=0,RRUnack=0
D/bt-l2cap( 2189): RR scan pri=0, lcid=0x0040, q_cout=0
D/bt-l2cap( 2189): RR scan pri=2, lcid=0x004a, q_cout=0
D/A2dpStateMachine( 2189): Connection state CC:FA:00:72:B7:D0: 0->1
D/bt-l2cap( 2189): RR scan pri=0, lcid=0x0040, q_cout=0
D/bt-l2cap( 2189): RR scan pri=2, lcid=0x004a, q_cout=0
D/bt-l2cap( 2189): TotalWin=6,LinkUnack(0x100)=0,RRCheck=0,RRUnack=0
D/CachedBluetoothDevice( 1850): onProfileStateChanged: profile A2DP newProfileState 1
D/bt-btm ( 2189): BTM_SetPowerMode: mode:0x0 interval 0 max:1, min:0
D/bt-l2cap( 2189): TotalWin=5,Hndl=0x100,Quota=6,Unack=1,RRQuota=0,RRUnack=0
D/bt-l2cap( 2189): RR scan pri=0, lcid=0x0040, q_cout=0
D/bt-l2cap( 2189): RR scan pri=2, lcid=0x004a, q_cout=0
D/bt-l2cap( 2189): l2cu_release_ccb: cid 0x0040 in_use: 1
D/bt-l2cap( 2189): l2cu_dequeue_ccb CID: 0x0040
D/bt-l2cap( 2189): l2c_link_adjust_chnl_allocation
D/bt-l2cap( 2189): POOL ID:3, GKI_poolcount = 200, reserved_buff = 0, weighted_chnls = 2, quota_per_weighted_chnls = 101
D/bt-btif ( 2189): scb hndl x41, role x0
D/bt-btif ( 2189): conn_cback bd_addr:cc-fa-00-72-b7-d0
D/bt-btif ( 2189): bta_av_sig_chg event: 17
D/bt-btif ( 2189): conn_lcb: 0x0
D/bt-btif ( 2189): conn_lcb: 0x0
D/bt-l2cap( 2189): RR scan pri=2, lcid=0x004a, q_cout=0
D/bt-l2cap( 2189): TotalWin=6,LinkUnack(0x100)=0,RRCheck=0,RRUnack=0
D/HeadsetClientStateMachine( 2189): hfp_enable=true
D/HeadsetClientStateMachine( 2189): mAudioWbs is false
D/HeadsetClientStateMachine( 2189): Setting sampling rate as 8000
D/HeadsetClientStateMachine( 2189): Audio state CC:FA:00:72:B7:D0: 1->2
D/HeadsetClientStateMachine( 2189): Enter AudioOn: 100
D/HeadsetClientStateMachine( 2189): AudioOn process message: 100
D/HeadsetClientStateMachine( 2189): AudioOn: event type: 16
D/HeadsetClientStateMachine( 2189): Connected process message: 100
D/HeadsetClientStateMachine( 2189): Connected: event type: 16
D/HeadsetClientStateMachine( 2189): EVENT_TYPE_CMD_RESULT 0
D/HeadsetClientStateMachine( 2189): Connected: command result: 0 queuedAction: 7
D/HeadsetClientStateMachine( 2189): AudioOn process message: 100
D/HeadsetClientStateMachine( 2189): AudioOn: event type: 10
D/HeadsetClientStateMachine( 2189): Connected process message: 100
D/HeadsetClientStateMachine( 2189): Connected: event type: 10
D/HeadsetClientStateMachine( 2189): updateCallSetupIndicator 2 0
D/HeadsetClientStateMachine( 2189): updateCallSetupIndicator 52
D/HeadsetClientStateMachine( 2189): AudioOn process message: 50
D/HeadsetClientStateMachine( 2189): Connected process message: 50
D/HeadsetClientStateMachine( 2189): queryCallsStart
D/HeadsetClientStateMachine( 2189): queryCallsStart clearPendingAction
D/HeadsetClientStateMachine( 2189): function clearPendingAction
D/bt-btif ( 2189): bta_hf_client_send_at_clcc
D/bt-l2cap( 2189): RR scan pri=2, lcid=0x004a, q_cout=1
D/bt-l2cap( 2189): RR service pri=2, quota=4, lcid=0x004a
D/bt-l2cap( 2189): TotalWin=5,Hndl=0x100,Quota=6,Unack=1,RRQuota=0,RRUnack=0
D/bt-l2cap( 2189): RR scan pri=2, lcid=0x004a, q_cout=0
D/HeadsetClientStateMachine( 2189): queryCallsStart: queryCurrentCallsNative
D/HeadsetClientStateMachine( 2189): action3: 50
D/bt-l2cap( 2189): RR scan pri=2, lcid=0x004a, q_cout=0
D/bt-l2cap( 2189): TotalWin=6,LinkUnack(0x100)=0,RRCheck=0,RRUnack=0
E/bt-rfcomm( 2189): PORT_DataInd, p_port:0x54f82d5c, p_data_co_callback is null
D/bt-btif ( 2189): bta_hf_client_at_parse offset: 0 len: 37
D/bt-btif ( 2189): bta_hf_client_check_at_complete 1
D/bt-btif ( 2189): bta_hf_client_at_parse_start
D/bt-btif ( 2189): bta_hf_client_handle_clcc idx: 1 dir: 0 status: 2 mode: 0 mpty: 0
D/bt-btif ( 2189): bta_hf_client_handle_clcc number: 9686811761 type: 129
D/HeadsetClientStateMachine( 2189): incoming StackEvent {type:EVENT_TYPE_CURRENT_CALLS, value1:1, value2:0, value3:2, value4:0, string: "9686811761", device:null}
D/HeadsetClientStateMachine( 2189): AudioOn process message: 100
D/HeadsetClientStateMachine( 2189): AudioOn: event type: 14
D/HeadsetClientStateMachine( 2189): Connected process message: 100
D/HeadsetClientStateMachine( 2189): Connected: event type: 14
D/HeadsetClientStateMachine( 2189): queryCallsUpdate: 1
E/bt-rfcomm( 2189): PORT_DataInd, p_port:0x54f82d5c, p_data_co_callback is null
D/bt-btif ( 2189): bta_hf_client_at_parse offset: 0 len: 6
D/bt-btif ( 2189): bta_hf_client_check_at_complete 1
D/bt-btif ( 2189): bta_hf_client_at_parse_start
D/bt-btif ( 2189): bta_hf_client_handle_ok
D/bt-btif ( 2189): bta_hf_client_send_queued_at
D/HeadsetClientStateMachine( 2189): incomingStackEvent {type:EVENT_TYPE_CMD_RESULT, value1:0, value2:0, value3:0, value4:0, string: "null", device:null}
D/HeadsetClientStateMachine( 2189): AudioOn process message: 100
D/HeadsetClientStateMachine( 2189): AudioOn: event type: 16
D/HeadsetClientStateMachine( 2189): Connected process message: 100
D/HeadsetClientStateMachine( 2189): Connected: event type: 16
D/HeadsetClientStateMachine( 2189): EVENT_TYPE_CMD_RESULT 0
D/HeadsetClientStateMachine( 2189): Connected: command result: 0 queuedAction: 10
D/HeadsetClientStateMachine( 2189): Line 1924: 10
E/bt-rfcomm( 2189): PORT_DataInd, p_port:0x54f82d5c, p_data_co_callback is null
D/bt-btif ( 2189): bta_hf_client_at_parse offset: 0 len: 14
D/bt-btif ( 2189): bta_hf_client_check_at_complete 1
D/bt-btif ( 2189): bta_hf_client_at_parse_start
D/bt-btif ( 2189): bta_hf_client_handle_ciev index: 2 value: 3
I/bt-btif ( 2189): HAL bt_hf_client_callbacks->callsetup_cb
D/HeadsetClientStateMachine( 2189): incomingStackEvent {type:EVENT_TYPE_CALLSETUP, value1:3, value2:0, value3:0, value4:0, string: "null", device:null}
D/HeadsetClientStateMachine( 2189): AudioOn process message: 100
D/HeadsetClientStateMachine( 2189): AudioOn: event type: 10
D/HeadsetClientStateMachine( 2189): Connected process message: 100
D/HeadsetClientStateMachine( 2189): Connected: event type: 10
D/HeadsetClientStateMachine( 2189): updateCallSetupIndicator 3 10
D/HeadsetClientStateMachine( 2189): updateCallSetupIndicator 50
D/HeadsetClientStateMachine( 2189): AudioOn process message: 50
D/HeadsetClientStateMachine( 2189): Connected process message: 50
D/HeadsetClientStateMachine( 2189): queryCallsStart
D/HeadsetClientStateMachine( 2189): queryCallsStart clearPendingAction
D/HeadsetClientStateMachine( 2189): function clearPendingAction
D/HeadsetClientStateMachine( 2189): queryCallsStart: mCallsUpdate != null
D/bt-btif ( 2189): bta_av_acp_sig_timer_cback, coll_mask = 0x03
D/bt-btif ( 2189): bta_av_do_disc_a2d use_rc: 1 rs:0, oc:0
D/bt-btm ( 2189): BTM_GetRole
D/bt-btm ( 2189): btm_bda_to_acl found
E/bt-btif ( 2189): bta_av_link_role_ok hndl:x41 role:0, conn_audio:x0, bits:2, features:x824b
D/bt-btif ( 2189): ok_continue: 1 wait:x0, q_tag: 0
D/bt-btif ( 2189): bta_av_save_addr r:1, s:1
D/bt-btif ( 2189): bta_dm_pm_cback: st(2), id(18), app(0)
D/bt-l2cap( 2189): l2cu_allocate_ccb: cid 0x0000
D/bt-l2cap( 2189): l2cu_enqueue_ccb CID: 0x0041 priority: 2
D/bt-l2cap( 2189): l2c_link_adjust_chnl_allocation
D/bt-l2cap( 2189): POOL ID:3, GKI_poolcount = 200, reserved_buff = 0, weighted_chnls = 4, quota_per_weighted_chnls = 51
D/bt-btm ( 2189): BTM_SetPowerMode: mode:0x0 interval 0 max:0, min:0
D/bt-btm ( 2189): btm_sec_l2cap_access_req is_originator:1, 0x54f812c0
D/bt-l2cap( 2189): l2c_link_sec_comp: 17, 0x54f812c0
D/bt-l2cap( 2189): ccb timer ticks: 2147483648
D/bt-l2cap( 2189): TotalWin=5,Hndl=0x100,Quota=6,Unack=1,RRQuota=0,RRUnack=0
D/bt-l2cap( 2189): RR scan pri=2, lcid=0x004a, q_cout=0
D/bt-l2cap( 2189): RR scan pri=2, lcid=0x0041, q_cout=0
D/bt-l2cap( 2189): RR scan pri=2, lcid=0x004a, q_cout=0
D/bt-l2cap( 2189): RR scan pri=2, lcid=0x0041, q_cout=0
D/bt-l2cap( 2189): TotalWin=6,LinkUnack(0x100)=0,RRCheck=0,RRUnack=0
D/bt-l2cap( 2189): TotalWin=5,Hndl=0x100,Quota=6,Unack=1,RRQuota=0,RRUnack=0
D/bt-l2cap( 2189): RR scan pri=2, lcid=0x004a, q_cout=0
D/bt-l2cap( 2189): RR scan pri=2, lcid=0x0041, q_cout=0
D/bt-btm ( 2189): btm_bda_to_acl found
D/bt-btm ( 2189): btm_get_max_packet_size
D/bt-l2cap( 2189): l2cu_adjust_out_mps use 0 Based on peer_cfg.fcr.mps: 0 packet_size: 1011
D/bt-l2cap( 2189): TotalWin=4,Hndl=0x100,Quota=6,Unack=2,RRQuota=0,RRUnack=0
D/bt-l2cap( 2189): RR scan pri=2, lcid=0x004a, q_cout=0
D/bt-l2cap( 2189): RR scan pri=2, lcid=0x0041, q_cout=0
D/bt-l2cap( 2189): RR scan pri=2, lcid=0x004a, q_cout=0
D/bt-l2cap( 2189): RR scan pri=2, lcid=0x0041, q_cout=0
D/bt-l2cap( 2189): TotalWin=5,LinkUnack(0x100)=1,RRCheck=0,RRUnack=0
D/bt-l2cap( 2189): RR scan pri=2, lcid=0x004a, q_cout=0
D/bt-l2cap( 2189): RR scan pri=2, lcid=0x0041, q_cout=0
D/bt-l2cap( 2189): TotalWin=6,LinkUnack(0x100)=0,RRCheck=0,RRUnack=0
D/bt-l2cap( 2189): l2c_link_adjust_chnl_allocation
D/bt-l2cap( 2189): POOL ID:3, GKI_poolcount = 200, reserved_buff = 0, weighted_chnls = 4, quota_per_weighted_chnls = 51
D/bt-l2cap( 2189): RR scan pri=2, lcid=0x004a, q_cout=0
D/bt-l2cap( 2189): RR scan pri=2, lcid=0x0041, q_cout=1
D/bt-l2cap( 2189): RR service pri=2, quota=4, lcid=0x0041
D/bt-l2cap( 2189): TotalWin=5,Hndl=0x100,Quota=6,Unack=1,RRQuota=0,RRUnack=0
D/bt-l2cap( 2189): RR scan pri=2, lcid=0x004a, q_cout=0
D/bt-l2cap( 2189): RR scan pri=2, lcid=0x0041, q_cout=0
D/bt-l2cap( 2189): RR scan pri=2, lcid=0x004a, q_cout=0
D/bt-l2cap( 2189): RR scan pri=2, lcid=0x0041, q_cout=0
D/bt-l2cap( 2189): TotalWin=6,LinkUnack(0x100)=0,RRCheck=0,RRUnack=0
W/bt-sdp ( 2189): process_service_search_attr_rsp
D/bt-btm ( 2189): BTM_SetPowerMode: mode:0x0 interval 0 max:8, min:0
D/bt-l2cap( 2189): TotalWin=5,Hndl=0x100,Quota=6,Unack=1,RRQuota=0,RRUnack=0
D/bt-l2cap( 2189): RR scan pri=2, lcid=0x004a, q_cout=0
D/bt-l2cap( 2189): RR scan pri=2, lcid=0x0041, q_cout=0
D/bt-l2cap( 2189): RR scan pri=2, lcid=0x004a, q_cout=0
D/bt-l2cap( 2189): RR scan pri=2, lcid=0x0041, q_cout=0
D/bt-l2cap( 2189): TotalWin=6,LinkUnack(0x100)=0,RRCheck=0,RRUnack=0
D/bt-l2cap( 2189): l2cu_release_ccb: cid 0x0041 in_use: 1
D/bt-l2cap( 2189): l2cu_dequeue_ccb CID: 0x0041
D/bt-l2cap( 2189): l2c_link_adjust_chnl_allocation
D/bt-l2cap( 2189): POOL ID:3, GKI_poolcount = 200, reserved_buff = 0, weighted_chnls = 2, quota_per_weighted_chnls = 101
D/bt-sdp ( 2189): releasing SDP rsp_list
最佳答案
我通过将 Bluedroid 升级到更新版本来修复它。事实上,我认为我必须将 Nougat Bluedroid 中的特定提交反向移植回 Marshmallow。这是我修复的补丁,尽管它可能不适用于您的 Bluedroid 版本:
From 39eef6e4ab1f7313d21c93ee94c9d1655e60ddde Mon Sep 17 00:00:00 2001
From: Tyler <tyler@x>
Date: Tue, 06 Sep 2016 17:33:37 -0700
Subject: [PATCH] Headset client: Try to fix parsing errors with iPhone.
Manually patched certain changes from changes in 08337175a34a9694b0d175ca714de3fd8cb5d9ec: tag: android-cts-7.0_r1 tag: android-7.0.0_r1
---
diff --git a/bta/hf_client/bta_hf_client_at.c b/bta/hf_client/bta_hf_client_at.c
index 5674b91..65ff088 100644
--- a/bta/hf_client/bta_hf_client_at.c
+++ b/bta/hf_client/bta_hf_client_at.c
@@ -714,7 +714,7 @@
static char *bta_hf_client_parse_cind_list(char *buffer)
{
- int offset;
+ int offset = 0;
char name[129];
UINT32 min, max;
UINT32 index = 0;
@@ -723,6 +723,12 @@
while ((res = sscanf(buffer, "(\"%128[^\"]\",(%u%*[-,]%u))%n", name, &min, &max, &offset)) > 2)
{
bta_hf_client_handle_cind_list_item(name, min, max, index);
+ if (offset == 0)
+ {
+ APPL_TRACE_ERROR("%s: Format Error %s", __func__, buffer);
+ return NULL;
+ }
+
buffer += offset;
index++;
@@ -830,13 +836,19 @@
{
UINT32 index, value;
int res;
- int offset;
+ int offset = 0;
AT_CHECK_EVENT(buffer, "+CIEV:");
res = sscanf(buffer, "%u,%u%n", &index, &value, &offset);
if(res < 2)
{
+ return NULL;
+ }
+
+ if (offset == 0)
+ {
+ APPL_TRACE_ERROR("%s: Format Error %s", __func__, buffer);
return NULL;
}
@@ -910,7 +922,7 @@
char number[33];
UINT32 type = 0;
int res;
- int offset;
+ int offset = 0;
AT_CHECK_EVENT(buffer, "+CLIP:");
@@ -918,6 +930,12 @@
res = sscanf(buffer, "\"%32[^\"]\",%u%n", number, &type, &offset);
if(res < 2)
{
+ return NULL;
+ }
+
+ if (offset == 0)
+ {
+ APPL_TRACE_ERROR("%s: Format Error %s", __func__, buffer);
return NULL;
}
@@ -938,7 +956,7 @@
char number[33];
UINT32 type = 0;
int res ;
- int offset;
+ int offset = 0;
AT_CHECK_EVENT(buffer, "+CCWA:");
@@ -946,6 +964,12 @@
res = sscanf(buffer, "\"%32[^\"]\",%u%n", number, &type, &offset);
if(res < 2)
{
+ return NULL;
+ }
+
+ if (offset == 0)
+ {
+ APPL_TRACE_ERROR("%s: Format Error %s", __func__, buffer);
return NULL;
}
@@ -965,7 +989,7 @@
/* spec forces 16 chars max, plus \0 here */
char opstr[17];
int res;
- int offset;
+ int offset = 0;
AT_CHECK_EVENT(buffer, "+COPS:");
@@ -973,6 +997,12 @@
res = sscanf(buffer, "%hhi,0,\"%16[^\"]\"%n", &mode, opstr, &offset);
if(res < 2)
{
+ return NULL;
+ }
+ /* Abort in case offset not set because of format error */
+ if (offset == 0)
+ {
+ APPL_TRACE_ERROR("%s: Format Error %s", __func__, buffer);
return NULL;
}
@@ -983,6 +1013,12 @@
AT_CHECK_RN(buffer);
bta_hf_client_handle_cops(opstr, mode);
+ // check for OK Response in end
+ AT_CHECK_EVENT(buffer, "OK");
+ AT_CHECK_RN(buffer);
+
+ bta_hf_client_handle_ok();
+
return buffer;
}
@@ -992,13 +1028,20 @@
/* phone number is 32 chars plus one for \0*/
char numstr[33];
int res;
- int offset;
+ int offset = 0;
AT_CHECK_EVENT(buffer, "+BINP:");
res = sscanf(buffer, "\"%32[^\"]\"\r\n%n", numstr, &offset);
if(res < 1)
{
+ return NULL;
+ }
+
+ /* Abort in case offset not set because of format error */
+ if (offset == 0)
+ {
+ APPL_TRACE_ERROR("%s: Format Error %s", __func__, buffer);
return NULL;
}
@@ -1010,6 +1053,13 @@
AT_CHECK_RN(buffer);
bta_hf_client_handle_binp(numstr);
+
+ // check for OK response in end
+ AT_CHECK_EVENT(buffer, "OK");
+ AT_CHECK_RN(buffer);
+
+ bta_hf_client_handle_ok();
+
return buffer;
}
@@ -1019,7 +1069,7 @@
char numstr[33]; /* spec forces 32 chars, plus one for \0*/
UINT16 type;
int res;
- int offset;
+ int offset = 0;
AT_CHECK_EVENT(buffer, "+CLCC:");
@@ -1030,14 +1080,20 @@
return NULL;
}
+ /* Abort in case offset not set because of format error */
+ if (offset == 0)
+ {
+ APPL_TRACE_ERROR("%s: Format Error %s", __func__, buffer);
+ return NULL;
+ }
+
buffer += offset;
+ offset = 0;
/* check optional part */
if (*buffer == ',')
{
- int res2;
-
- res2 = sscanf(buffer, ",\"%32[^\"]\",%hu%n", numstr, &type, &offset);
+ int res2 = sscanf(buffer, ",\"%32[^\"]\",%hu%n", numstr, &type, &offset);
if (res2 < 0)
{
return NULL;
@@ -1056,15 +1112,22 @@
numstr[0] = '\0';
}
- if (res2 < 2)
+ if (res2 >= 2)
{
- return NULL;
- }
+ res += res2;
+ /* Abort in case offset not set because of format error */
+ if (offset == 0)
+ {
+ APPL_TRACE_ERROR("%s: Format Error %s", __func__, buffer);
+ return NULL;
+ }
- res += res2;
- buffer += offset;
+ buffer += offset;
+ }
}
+ /* Skip any remaing param,as they are not defined by BT HFP spec */
+ AT_SKIP_REST(buffer);
AT_CHECK_RN(buffer);
if(res > 6)
@@ -1078,6 +1141,11 @@
bta_hf_client_handle_clcc(idx, dir, status, mode, mpty, NULL, 0);
}
+ // check for OK response in end
+ AT_CHECK_EVENT(buffer, "OK");
+ AT_CHECK_RN(buffer);
+
+ bta_hf_client_handle_ok();
return buffer;
}
@@ -1087,7 +1155,7 @@
UINT16 type;
UINT16 service = 0; /* 0 in case this optional parameter is not being sent */
int res;
- int offset;
+ int offset = 0;
AT_CHECK_EVENT(buffer, "+CNUM:");
@@ -1115,6 +1183,13 @@
return NULL;
}
+ /* Abort in case offset not set because of format error */
+ if (offset == 0)
+ {
+ APPL_TRACE_ERROR("%s: Format Error %s", __func__, buffer);
+ return NULL;
+ }
+
buffer += offset;
AT_CHECK_RN(buffer);
@@ -1132,6 +1207,12 @@
}
bta_hf_client_handle_cnum(numstr, type, service);
+
+ // check for OK response in end
+ AT_CHECK_EVENT(buffer, "OK");
+ AT_CHECK_RN(buffer);
+
+ bta_hf_client_handle_ok();
return buffer;
}
@@ -1459,6 +1540,11 @@
APPL_TRACE_DEBUG("%s", __FUNCTION__);
at_len = snprintf(buf, sizeof(buf), "AT+BRSF=%u\r", bta_hf_client_cb.scb.features);
+ if (at_len < 0)
+ {
+ APPL_TRACE_ERROR("%s: AT command Framing error", __func__);
+ return;
+ }
bta_hf_client_send_at(BTA_HF_CLIENT_AT_BRSF , buf, at_len);
}
@@ -1489,6 +1575,11 @@
APPL_TRACE_DEBUG("%s", __FUNCTION__);
at_len = snprintf(buf, sizeof(buf), "AT+BCS=%u\r", codec);
+ if (at_len < 0)
+ {
+ APPL_TRACE_ERROR("%s: AT command Framing error", __func__);
+ return;
+ }
bta_hf_client_send_at(BTA_HF_CLIENT_AT_BCS, buf, at_len);
}
@@ -1539,6 +1630,12 @@
at_len = snprintf(buf, sizeof(buf), "AT+CHLD=%c%u\r", cmd, idx);
else
at_len = snprintf(buf, sizeof(buf), "AT+CHLD=%c\r", cmd);
+
+ if (at_len < 0)
+ {
+ APPL_TRACE_ERROR("%s: AT command Framing error", __func__);
+ return;
+ }
bta_hf_client_send_at(BTA_HF_CLIENT_AT_CHLD, buf, at_len);
}
@@ -1633,6 +1730,11 @@
APPL_TRACE_DEBUG("%s", __FUNCTION__);
at_len = snprintf(buf, sizeof(buf), "AT+VGS=%u\r", volume);
+ if (at_len < 0)
+ {
+ APPL_TRACE_ERROR("%s: AT command Framing error", __func__);
+ return;
+ }
bta_hf_client_send_at(BTA_HF_CLIENT_AT_VGS, buf, at_len);
}
@@ -1645,6 +1747,11 @@
APPL_TRACE_DEBUG("%s", __FUNCTION__);
at_len = snprintf(buf, sizeof(buf), "AT+VGM=%u\r", volume);
+ if (at_len < 0)
+ {
+ APPL_TRACE_ERROR("%s: AT command Framing error", __func__);
+ return;
+ }
bta_hf_client_send_at(BTA_HF_CLIENT_AT_VGM, buf, at_len);
}
@@ -1662,8 +1769,18 @@
at_len = snprintf(buf, sizeof(buf), "ATD>%u;\r", memory);
}
- at_len = MIN(at_len, sizeof(buf));
+ if (at_len < 0) {
+ APPL_TRACE_ERROR("%s: error preparing ATD command", __func__);
+ return;
+ }
+ at_len = MIN((size_t)at_len, sizeof(buf));
+
+ if (at_len < 0)
+ {
+ APPL_TRACE_ERROR("%s: AT command Framing error", __func__);
+ return;
+ }
bta_hf_client_send_at(BTA_HF_CLIENT_AT_ATD, buf, at_len);
}
@@ -1716,6 +1833,12 @@
at_len = snprintf(buf, sizeof(buf), "AT+BTRH=%u\r", val);
}
+ if (at_len < 0)
+ {
+ APPL_TRACE_ERROR("%s: AT command Framing error", __func__);
+ return;
+ }
+
bta_hf_client_send_at(BTA_HF_CLIENT_AT_BTRH, buf, at_len);
}
@@ -1727,6 +1850,12 @@
APPL_TRACE_DEBUG("%s", __FUNCTION__);
at_len = snprintf(buf, sizeof(buf), "AT+VTS=%c\r", code);
+
+ if (at_len < 0)
+ {
+ APPL_TRACE_ERROR("%s: AT command Framing error", __func__);
+ return;
+ }
bta_hf_client_send_at(BTA_HF_CLIENT_AT_VTS, buf, at_len);
}
@@ -1779,6 +1908,12 @@
at_len = snprintf(buf, sizeof(buf), "AT+BINP=%u\r", action);
+ if (at_len < 0)
+ {
+ APPL_TRACE_ERROR("%s: AT command Framing error", __func__);
+ return;
+ }
+
bta_hf_client_send_at(BTA_HF_CLIENT_AT_BINP, buf, at_len);
}
@@ -1806,6 +1941,12 @@
buf[at_len - 1] = '\r';
+ if (at_len < 0)
+ {
+ APPL_TRACE_ERROR("%s: AT command Framing error", __func__);
+ return;
+ }
+
bta_hf_client_send_at(BTA_HF_CLIENT_AT_BIA, buf, at_len);
}
关于android - kitkat 上的 hfp 客户端角色实现,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29211984/
我想在一些计算机之间建立点对点连接,这样用户就可以在没有外部服务器的情况下聊天和交换文件。我的第一个想法如下: 我在服务器上创建了一个中央 ServerSocket,所有应用程序都可以连接到该服务器。
我正在 Unity 中构建多人游戏。为此,我必须将一些值从客户端发送到两个或多个通过服务器连接的客户端。我想将其构建为服务器真实游戏。客户端将使用 Android,他们的数据将通过服务器同步(可能是一
练习 C 网络编程:我正在编写一个简单的 TCP 客户端-服务器应用程序,它应该将消息(在每个客户端的单独线程中)作为字符串从服务器发送到客户端并在客户端(稍后将成为控制台商店应用程序)。我首先发送消
我使用证书身份验证设置了 AWS Client VPN。我正在为客户端-客户端访问系统进行设置,基本上如 this AWS scenario/example 中所述.一切正常,如果我知道他们的 IP
我正在开发一个小型客户端1/客户端2、服务器(线程)TCP 游戏。在尝试处理延迟问题时,我意识到我的 transmitState() 中存在缺陷。它强制将不必要的信息传递到通讯流中,从而造成迟缓,将汽
来自文档:Configurable token lifetimes in Azure Active Directory (Public Preview) 它提到“ secret 客户端”,刷新 tok
Apollo 客户端开发工具无法连接到我的应用程序。我已在 ApolloClient 构造函数中将 connectToDevTools 传递为 true,但没有任何 react 。我也试过this p
我想在 Pod 内使用 Fabric8 kubernetes 客户端 (java)。如何获取部署集群的 kubernetes 客户端? 我可以使用该集群的 kubeconfig 文件获取任何集群的配置
我正在阅读 the security issue with Log4j我了解此产品受此漏洞影响。但是 Oracle 客户端 11.2 和 12 是否受此问题影响? 我找不到这些产品是否使用任何 Log
Eureka 服务器设置 pom.xml 1.8 Hoxton.SR1 org.springframework.cloud spring
我有一个点对点(客户端/服务器)设置(通过本地 LAN),它使用 Netty,一个 Java 网络框架。我使用原始 TCP/IP(例如,没有 HTTP)进行通信和传输。现在,根据要求,我们希望转向 T
上一篇已经实现了ModbusTcp服务器和8个主要的功能码,只是还没有实现错误处理功能。 但是在测试客户端时却发现了上一篇的一个错误,那就是写数据成功,服务器不需要响应。 接下来要做的就是实现Modb
有没有办法将二维十六进制代码数组转换为 png 图像? 数组看起来像这样(只是更大) [ [ '#FF0000', '#00FF00' ], [ '#0000FF'
我是套接字编程的新手。每次我运行客户端程序时,它都会说“无法连接到服务器”。谁能告诉我我在哪里犯了错误。任何帮助将不胜感激。 这是client.c #include #include #inclu
我们在UNIX环境下制作了简单的client.c和server.c程序。我们使用它来传输一个简单的文本文件,首先打开它,然后读取它并使用 open、read 和 send 系统调用发送;在客户端,我接
当我的程序来自 my previous question正在响应客户端,它应该发送加密消息。 当客户端连接时,它会发送一条类似“YourMessage”的消息。现在我想做的是,当客户端连接时,应该以某
我正在使用 C 和 putty 编写客户端/服务器程序。两个 c 文件位于同一系统上。 我目前在向客户端写回其正在使用的框架以及打印我的框架时遇到问题。它打印出 3 0 9 8,但随后开始打印 134
我正在使用 C 中的 select() 制作一个模拟快餐或其他任何东西的客户端服务器。 我有客户随机点 1-5 种“食物”。服务器每 30 秒决定一次。所有客户最喜欢的食物是什么?他为那些客户提供服务
对于单机游戏,基本的游戏循环是(来源:维基百科) while( user doesn't exit ) check for user input run AI move enemies
1、CentOS安装TortoiseSVN 复制代码 代码如下: yum install -y subversion 2、SVN客户端命令
我是一名优秀的程序员,十分优秀!