Loading system/bta/ag/bta_ag_act.cc +4 −1 Original line number Diff line number Diff line Loading @@ -462,7 +462,10 @@ void bta_ag_rfc_close(tBTA_AG_SCB* p_scb, const tBTA_AG_DATA& /* data */) { } /* else close port and deallocate scb */ else { RFCOMM_RemoveServer(p_scb->conn_handle); if (RFCOMM_RemoveServer(p_scb->conn_handle) != PORT_SUCCESS) { log::warn("Unable to remove RFCOMM server peer:{} handle:{}", p_scb->peer_addr, p_scb->conn_handle); }; bta_ag_scb_dealloc(p_scb); } } Loading system/bta/ag/bta_ag_cmd.cc +6 −1 Original line number Diff line number Diff line Loading @@ -258,7 +258,12 @@ static void bta_ag_send_result(tBTA_AG_SCB* p_scb, size_t code, /* send to RFCOMM */ uint16_t len = 0; PORT_WriteData(p_scb->conn_handle, buf, (uint16_t)(p - buf), &len); if (PORT_WriteData(p_scb->conn_handle, buf, (uint16_t)(p - buf), &len) != PORT_SUCCESS) { log::warn( "Unable to write RFCOMM data peer:{} handle:{} len_exp:{} len_act:{}", p_scb->peer_addr, p_scb->conn_handle, (uint16_t)(p - buf), len); } } /******************************************************************************* Loading system/bta/ag/bta_ag_rfc.cc +16 −4 Original line number Diff line number Diff line Loading @@ -227,8 +227,15 @@ void bta_ag_setup_port(tBTA_AG_SCB* p_scb, uint16_t handle) { sizeof(bta_ag_port_cback_tbl[0])), "callback index out of bound, handle={}, bd_addr={}", handle, ADDRESS_TO_LOGGABLE_STR(p_scb->peer_addr)); PORT_SetEventMask(handle, BTA_AG_PORT_EV_MASK); PORT_SetEventCallback(handle, bta_ag_port_cback_tbl[port_callback_index]); if (PORT_SetEventMask(handle, BTA_AG_PORT_EV_MASK) != PORT_SUCCESS) { log::warn("Unable to set RFCOMM event mask peer:{} handle:{}", p_scb->peer_addr, handle); } if (PORT_SetEventCallback( handle, bta_ag_port_cback_tbl[port_callback_index]) != PORT_SUCCESS) { log::warn("Unable to set RFCOMM event callback peer:{} handle:{}", p_scb->peer_addr, handle); } } /******************************************************************************* Loading Loading @@ -291,7 +298,9 @@ void bta_ag_close_servers(tBTA_AG_SCB* p_scb, tBTA_SERVICE_MASK services) { for (int i = 0; i < BTA_AG_NUM_IDX && services != 0; i++, services >>= 1) { /* if service is set in mask */ if (services & 1) { RFCOMM_RemoveServer(p_scb->serv_handle[i]); if (RFCOMM_RemoveServer(p_scb->serv_handle[i]) != PORT_SUCCESS) { log::warn("Unable to remove RFCOMM server service:0x{:x}", services); } p_scb->serv_handle[i] = 0; } } Loading Loading @@ -361,7 +370,10 @@ void bta_ag_rfc_do_open(tBTA_AG_SCB* p_scb, const tBTA_AG_DATA& data) { void bta_ag_rfc_do_close(tBTA_AG_SCB* p_scb, const tBTA_AG_DATA& /* data */) { log::info("p_scb->conn_handle: 0x{:04x}", p_scb->conn_handle); if (p_scb->conn_handle) { RFCOMM_RemoveConnection(p_scb->conn_handle); if (RFCOMM_RemoveConnection(p_scb->conn_handle) != PORT_SUCCESS) { log::warn("Unable to remove RFCOMM connection handle:0x{:04x}", p_scb->conn_handle); } } else { /* Close API was called while AG is in Opening state. */ /* Need to trigger the state machine to send callback to the app */ Loading system/bta/hf_client/bta_hf_client_at.cc +5 −1 Original line number Diff line number Diff line Loading @@ -196,7 +196,11 @@ static void bta_hf_client_send_at(tBTA_HF_CLIENT_CB* client_cb, } log::verbose("writing port data to {}", client_cb->conn_handle); PORT_WriteData(client_cb->conn_handle, buf, buf_len, &len); if (PORT_WriteData(client_cb->conn_handle, buf, buf_len, &len) != PORT_SUCCESS) { log::warn("Unable to write RFCOMM data peer:{} handle:{} len:{}", client_cb->peer_addr, client_cb->conn_handle, buf_len); }; bta_hf_client_start_at_resp_timer(client_cb); Loading system/bta/hf_client/bta_hf_client_rfc.cc +23 −6 Original line number Diff line number Diff line Loading @@ -118,7 +118,11 @@ static void bta_hf_client_mgmt_cback(uint32_t code, uint16_t port_handle) { if (client_cb == NULL) { log::error("error allocating a new handle"); p_buf->hdr.event = BTA_HF_CLIENT_RFC_CLOSE_EVT; RFCOMM_RemoveConnection(port_handle); if (RFCOMM_RemoveConnection(port_handle) != PORT_SUCCESS) { log::warn("Unable to remote RFCOMM server connection handle:{}", port_handle); } } else { // Set the connection fields for this new CB client_cb->conn_handle = port_handle; Loading @@ -139,7 +143,10 @@ static void bta_hf_client_mgmt_cback(uint32_t code, uint16_t port_handle) { log::error("closing port handle {} dev {}", port_handle, client_cb->peer_addr); RFCOMM_RemoveServer(port_handle); if (RFCOMM_RemoveServer(port_handle) != PORT_SUCCESS) { log::warn("Unable to remote RFCOMM server connection handle:{}", port_handle); } p_buf->hdr.event = BTA_HF_CLIENT_RFC_CLOSE_EVT; } else if (client_cb == NULL) { // client_cb is already cleaned due to hfp client disabled. Loading @@ -162,8 +169,12 @@ static void bta_hf_client_mgmt_cback(uint32_t code, uint16_t port_handle) { * ******************************************************************************/ void bta_hf_client_setup_port(uint16_t handle) { PORT_SetEventMask(handle, PORT_EV_RXCHAR); PORT_SetEventCallback(handle, bta_hf_client_port_cback); if (PORT_SetEventMask(handle, PORT_EV_RXCHAR) != PORT_SUCCESS) { log::warn("Unable to set RFCOMM event mask handle:{}", handle); } if (PORT_SetEventCallback(handle, bta_hf_client_port_cback) != PORT_SUCCESS) { log::warn("Unable to set RFCOMM event callback handle:{}", handle); } } /******************************************************************************* Loading Loading @@ -218,7 +229,10 @@ void bta_hf_client_close_server() { return; } RFCOMM_RemoveServer(bta_hf_client_cb_arr.serv_handle); if (RFCOMM_RemoveServer(bta_hf_client_cb_arr.serv_handle) != PORT_SUCCESS) { log::warn("Unable to remove RFCOMM servier handle:{}", bta_hf_client_cb_arr.serv_handle); } bta_hf_client_cb_arr.serv_handle = 0; } Loading Loading @@ -274,7 +288,10 @@ void bta_hf_client_rfc_do_close(tBTA_HF_CLIENT_DATA* p_data) { } if (client_cb->conn_handle) { RFCOMM_RemoveConnection(client_cb->conn_handle); if (RFCOMM_RemoveConnection(client_cb->conn_handle) != PORT_SUCCESS) { log::warn("Unable to remove RFCOMM connection peer:{} handle:{}", client_cb->peer_addr, client_cb->conn_handle); } } else { /* Close API was called while HF Client is in Opening state. */ /* Need to trigger the state machine to send callback to the app */ Loading Loading
system/bta/ag/bta_ag_act.cc +4 −1 Original line number Diff line number Diff line Loading @@ -462,7 +462,10 @@ void bta_ag_rfc_close(tBTA_AG_SCB* p_scb, const tBTA_AG_DATA& /* data */) { } /* else close port and deallocate scb */ else { RFCOMM_RemoveServer(p_scb->conn_handle); if (RFCOMM_RemoveServer(p_scb->conn_handle) != PORT_SUCCESS) { log::warn("Unable to remove RFCOMM server peer:{} handle:{}", p_scb->peer_addr, p_scb->conn_handle); }; bta_ag_scb_dealloc(p_scb); } } Loading
system/bta/ag/bta_ag_cmd.cc +6 −1 Original line number Diff line number Diff line Loading @@ -258,7 +258,12 @@ static void bta_ag_send_result(tBTA_AG_SCB* p_scb, size_t code, /* send to RFCOMM */ uint16_t len = 0; PORT_WriteData(p_scb->conn_handle, buf, (uint16_t)(p - buf), &len); if (PORT_WriteData(p_scb->conn_handle, buf, (uint16_t)(p - buf), &len) != PORT_SUCCESS) { log::warn( "Unable to write RFCOMM data peer:{} handle:{} len_exp:{} len_act:{}", p_scb->peer_addr, p_scb->conn_handle, (uint16_t)(p - buf), len); } } /******************************************************************************* Loading
system/bta/ag/bta_ag_rfc.cc +16 −4 Original line number Diff line number Diff line Loading @@ -227,8 +227,15 @@ void bta_ag_setup_port(tBTA_AG_SCB* p_scb, uint16_t handle) { sizeof(bta_ag_port_cback_tbl[0])), "callback index out of bound, handle={}, bd_addr={}", handle, ADDRESS_TO_LOGGABLE_STR(p_scb->peer_addr)); PORT_SetEventMask(handle, BTA_AG_PORT_EV_MASK); PORT_SetEventCallback(handle, bta_ag_port_cback_tbl[port_callback_index]); if (PORT_SetEventMask(handle, BTA_AG_PORT_EV_MASK) != PORT_SUCCESS) { log::warn("Unable to set RFCOMM event mask peer:{} handle:{}", p_scb->peer_addr, handle); } if (PORT_SetEventCallback( handle, bta_ag_port_cback_tbl[port_callback_index]) != PORT_SUCCESS) { log::warn("Unable to set RFCOMM event callback peer:{} handle:{}", p_scb->peer_addr, handle); } } /******************************************************************************* Loading Loading @@ -291,7 +298,9 @@ void bta_ag_close_servers(tBTA_AG_SCB* p_scb, tBTA_SERVICE_MASK services) { for (int i = 0; i < BTA_AG_NUM_IDX && services != 0; i++, services >>= 1) { /* if service is set in mask */ if (services & 1) { RFCOMM_RemoveServer(p_scb->serv_handle[i]); if (RFCOMM_RemoveServer(p_scb->serv_handle[i]) != PORT_SUCCESS) { log::warn("Unable to remove RFCOMM server service:0x{:x}", services); } p_scb->serv_handle[i] = 0; } } Loading Loading @@ -361,7 +370,10 @@ void bta_ag_rfc_do_open(tBTA_AG_SCB* p_scb, const tBTA_AG_DATA& data) { void bta_ag_rfc_do_close(tBTA_AG_SCB* p_scb, const tBTA_AG_DATA& /* data */) { log::info("p_scb->conn_handle: 0x{:04x}", p_scb->conn_handle); if (p_scb->conn_handle) { RFCOMM_RemoveConnection(p_scb->conn_handle); if (RFCOMM_RemoveConnection(p_scb->conn_handle) != PORT_SUCCESS) { log::warn("Unable to remove RFCOMM connection handle:0x{:04x}", p_scb->conn_handle); } } else { /* Close API was called while AG is in Opening state. */ /* Need to trigger the state machine to send callback to the app */ Loading
system/bta/hf_client/bta_hf_client_at.cc +5 −1 Original line number Diff line number Diff line Loading @@ -196,7 +196,11 @@ static void bta_hf_client_send_at(tBTA_HF_CLIENT_CB* client_cb, } log::verbose("writing port data to {}", client_cb->conn_handle); PORT_WriteData(client_cb->conn_handle, buf, buf_len, &len); if (PORT_WriteData(client_cb->conn_handle, buf, buf_len, &len) != PORT_SUCCESS) { log::warn("Unable to write RFCOMM data peer:{} handle:{} len:{}", client_cb->peer_addr, client_cb->conn_handle, buf_len); }; bta_hf_client_start_at_resp_timer(client_cb); Loading
system/bta/hf_client/bta_hf_client_rfc.cc +23 −6 Original line number Diff line number Diff line Loading @@ -118,7 +118,11 @@ static void bta_hf_client_mgmt_cback(uint32_t code, uint16_t port_handle) { if (client_cb == NULL) { log::error("error allocating a new handle"); p_buf->hdr.event = BTA_HF_CLIENT_RFC_CLOSE_EVT; RFCOMM_RemoveConnection(port_handle); if (RFCOMM_RemoveConnection(port_handle) != PORT_SUCCESS) { log::warn("Unable to remote RFCOMM server connection handle:{}", port_handle); } } else { // Set the connection fields for this new CB client_cb->conn_handle = port_handle; Loading @@ -139,7 +143,10 @@ static void bta_hf_client_mgmt_cback(uint32_t code, uint16_t port_handle) { log::error("closing port handle {} dev {}", port_handle, client_cb->peer_addr); RFCOMM_RemoveServer(port_handle); if (RFCOMM_RemoveServer(port_handle) != PORT_SUCCESS) { log::warn("Unable to remote RFCOMM server connection handle:{}", port_handle); } p_buf->hdr.event = BTA_HF_CLIENT_RFC_CLOSE_EVT; } else if (client_cb == NULL) { // client_cb is already cleaned due to hfp client disabled. Loading @@ -162,8 +169,12 @@ static void bta_hf_client_mgmt_cback(uint32_t code, uint16_t port_handle) { * ******************************************************************************/ void bta_hf_client_setup_port(uint16_t handle) { PORT_SetEventMask(handle, PORT_EV_RXCHAR); PORT_SetEventCallback(handle, bta_hf_client_port_cback); if (PORT_SetEventMask(handle, PORT_EV_RXCHAR) != PORT_SUCCESS) { log::warn("Unable to set RFCOMM event mask handle:{}", handle); } if (PORT_SetEventCallback(handle, bta_hf_client_port_cback) != PORT_SUCCESS) { log::warn("Unable to set RFCOMM event callback handle:{}", handle); } } /******************************************************************************* Loading Loading @@ -218,7 +229,10 @@ void bta_hf_client_close_server() { return; } RFCOMM_RemoveServer(bta_hf_client_cb_arr.serv_handle); if (RFCOMM_RemoveServer(bta_hf_client_cb_arr.serv_handle) != PORT_SUCCESS) { log::warn("Unable to remove RFCOMM servier handle:{}", bta_hf_client_cb_arr.serv_handle); } bta_hf_client_cb_arr.serv_handle = 0; } Loading Loading @@ -274,7 +288,10 @@ void bta_hf_client_rfc_do_close(tBTA_HF_CLIENT_DATA* p_data) { } if (client_cb->conn_handle) { RFCOMM_RemoveConnection(client_cb->conn_handle); if (RFCOMM_RemoveConnection(client_cb->conn_handle) != PORT_SUCCESS) { log::warn("Unable to remove RFCOMM connection peer:{} handle:{}", client_cb->peer_addr, client_cb->conn_handle); } } else { /* Close API was called while HF Client is in Opening state. */ /* Need to trigger the state machine to send callback to the app */ Loading