Loading system/stack/gap/gap_conn.cc +20 −21 Original line number Diff line number Diff line Loading @@ -235,7 +235,7 @@ uint16_t GAP_ConnOpen(const char* p_serv_name, uint8_t service_id, /* Register the PSM with L2CAP */ if (transport == BT_TRANSPORT_BR_EDR) { p_ccb->psm = L2CA_REGISTER(psm, &conn.reg_info, false /* enable_snoop */); p_ccb->psm = L2CA_Register(psm, &conn.reg_info, false /* enable_snoop */); if (p_ccb->psm == 0) { LOG(ERROR) << StringPrintf("%s: Failure registering PSM 0x%04x", __func__, psm); Loading @@ -245,8 +245,7 @@ uint16_t GAP_ConnOpen(const char* p_serv_name, uint8_t service_id, } if (transport == BT_TRANSPORT_LE) { p_ccb->psm = L2CA_REGISTER_COC( psm, &conn.reg_info, AMP_AUTOSWITCH_ALLOWED | AMP_USE_AMP_IF_POSSIBLE); p_ccb->psm = L2CA_RegisterLECoc(psm, (tL2CAP_APPL_INFO*)&conn.reg_info); if (p_ccb->psm == 0) { LOG(ERROR) << StringPrintf("%s: Failure registering PSM 0x%04x", __func__, psm); Loading Loading @@ -302,7 +301,7 @@ uint16_t GAP_ConnOpen(const char* p_serv_name, uint8_t service_id, /* Check if L2CAP started the connection process */ if (p_rem_bda && (transport == BT_TRANSPORT_BR_EDR)) { cid = L2CA_CONNECT_REQ(p_ccb->psm, *p_rem_bda, &p_ccb->ertm_info); cid = L2CA_ErtmConnectReq(p_ccb->psm, *p_rem_bda, &p_ccb->ertm_info); if (cid != 0) { p_ccb->connection_id = cid; return (p_ccb->gap_handle); Loading @@ -310,7 +309,7 @@ uint16_t GAP_ConnOpen(const char* p_serv_name, uint8_t service_id, } if (p_rem_bda && (transport == BT_TRANSPORT_LE)) { cid = L2CA_CONNECT_COC_REQ(p_ccb->psm, *p_rem_bda, &p_ccb->local_coc_cfg); cid = L2CA_ConnectLECocReq(p_ccb->psm, *p_rem_bda, &p_ccb->local_coc_cfg); if (cid != 0) { p_ccb->connection_id = cid; return (p_ccb->gap_handle); Loading Loading @@ -342,7 +341,7 @@ uint16_t GAP_ConnClose(uint16_t gap_handle) { if (p_ccb) { /* Check if we have a connection ID */ if (p_ccb->con_state != GAP_CCB_STATE_LISTENING) L2CA_DISCONNECT_REQ(p_ccb->connection_id); L2CA_DisconnectReq(p_ccb->connection_id); gap_release_ccb(p_ccb); Loading Loading @@ -488,7 +487,7 @@ static bool gap_try_write_queued_data(tGAP_CCB* p_ccb) { /* Send the buffer through L2CAP */ BT_HDR* p_buf; while ((p_buf = (BT_HDR*)fixed_queue_try_dequeue(p_ccb->tx_queue)) != NULL) { uint8_t status = L2CA_DATA_WRITE(p_ccb->connection_id, p_buf); uint8_t status = L2CA_DataWrite(p_ccb->connection_id, p_buf); if (status == L2CAP_DW_CONGESTED) { p_ccb->is_congested = true; Loading Loading @@ -565,7 +564,7 @@ uint16_t GAP_ConnReconfig(uint16_t gap_handle, tL2CAP_CFG_INFO* p_cfg) { p_ccb->cfg = *p_cfg; if (p_ccb->con_state == GAP_CCB_STATE_CONNECTED) L2CA_CONFIG_REQ(p_ccb->connection_id, p_cfg); L2CA_ConfigReq(p_ccb->connection_id, p_cfg); return (BT_PASS); } Loading Loading @@ -733,7 +732,7 @@ static void gap_connect_ind(const RawAddress& bd_addr, uint16_t l2cap_cid, LOG(WARNING) << "*******"; /* Disconnect because it is an unexpected connection */ L2CA_DISCONNECT_REQ(l2cap_cid); L2CA_DisconnectReq(l2cap_cid); return; } Loading @@ -747,15 +746,15 @@ static void gap_connect_ind(const RawAddress& bd_addr, uint16_t l2cap_cid, /* Send response to the L2CAP layer. */ if (p_ccb->transport == BT_TRANSPORT_BR_EDR) L2CA_CONNECT_RSP(bd_addr, l2cap_id, l2cap_cid, L2CAP_CONN_OK, L2CAP_CONN_OK, &p_ccb->ertm_info); L2CA_ErtmConnectRsp(bd_addr, l2cap_id, l2cap_cid, L2CAP_CONN_OK, L2CAP_CONN_OK, &p_ccb->ertm_info); if (p_ccb->transport == BT_TRANSPORT_LE) { L2CA_CONNECT_COC_RSP(bd_addr, l2cap_id, l2cap_cid, L2CAP_CONN_OK, L2CA_ConnectLECocRsp(bd_addr, l2cap_id, l2cap_cid, L2CAP_CONN_OK, L2CAP_CONN_OK, &p_ccb->local_coc_cfg); /* get the remote coc configuration */ L2CA_GET_PEER_COC_CONFIG(l2cap_cid, &p_ccb->peer_coc_cfg); L2CA_GetPeerLECocConfig(l2cap_cid, &p_ccb->peer_coc_cfg); p_ccb->rem_mtu_size = p_ccb->peer_coc_cfg.mtu; /* configuration is not required for LE COC */ Loading @@ -769,7 +768,7 @@ static void gap_connect_ind(const RawAddress& bd_addr, uint16_t l2cap_cid, /* Send a Configuration Request. */ if (p_ccb->transport == BT_TRANSPORT_BR_EDR) L2CA_CONFIG_REQ(l2cap_cid, &p_ccb->cfg); L2CA_ConfigReq(l2cap_cid, &p_ccb->cfg); } /******************************************************************************* Loading Loading @@ -816,7 +815,7 @@ static void gap_sec_check_complete(const RawAddress*, tBT_TRANSPORT, gap_checks_con_flags(p_ccb); } else { /* security failed - disconnect the channel */ L2CA_DISCONNECT_REQ(p_ccb->connection_id); L2CA_DisconnectReq(p_ccb->connection_id); } } Loading Loading @@ -853,12 +852,12 @@ static void gap_connect_cfm(uint16_t l2cap_cid, uint16_t result) { p_ccb->con_state = GAP_CCB_STATE_CFG_SETUP; /* Send a Configuration Request. */ L2CA_CONFIG_REQ(l2cap_cid, &p_ccb->cfg); L2CA_ConfigReq(l2cap_cid, &p_ccb->cfg); } if (p_ccb->transport == BT_TRANSPORT_LE) { /* get the remote coc configuration */ L2CA_GET_PEER_COC_CONFIG(l2cap_cid, &p_ccb->peer_coc_cfg); L2CA_GetPeerLECocConfig(l2cap_cid, &p_ccb->peer_coc_cfg); p_ccb->rem_mtu_size = p_ccb->peer_coc_cfg.mtu; /* configuration is not required for LE COC */ Loading Loading @@ -913,7 +912,7 @@ static void gap_config_ind(uint16_t l2cap_cid, tL2CAP_CFG_INFO* p_cfg) { p_cfg->result = L2CAP_CFG_OK; p_cfg->fcs_present = false; L2CA_CONFIG_RSP(l2cap_cid, p_cfg); L2CA_ConfigRsp(l2cap_cid, p_cfg); p_ccb->con_flags |= GAP_CCB_FLAGS_HIS_CFG_DONE; Loading Loading @@ -971,7 +970,7 @@ static void gap_disconnect_ind(uint16_t l2cap_cid, bool ack_needed) { p_ccb = gap_find_ccb_by_cid(l2cap_cid); if (p_ccb == NULL) return; if (ack_needed) L2CA_DISCONNECT_RSP(l2cap_cid); if (ack_needed) L2CA_DisconnectRsp(l2cap_cid); p_ccb->p_callback(p_ccb->gap_handle, GAP_EVT_CONN_CLOSED, nullptr); gap_release_ccb(p_ccb); Loading Loading @@ -1154,8 +1153,8 @@ static void gap_release_ccb(tGAP_CCB* p_ccb) { /* Free the security record for this PSM */ BTM_SecClrService(p_ccb->service_id); if (p_ccb->transport == BT_TRANSPORT_BR_EDR) L2CA_DEREGISTER(p_ccb->psm); if (p_ccb->transport == BT_TRANSPORT_LE) L2CA_DEREGISTER_COC(p_ccb->psm); if (p_ccb->transport == BT_TRANSPORT_BR_EDR) L2CA_Deregister(p_ccb->psm); if (p_ccb->transport == BT_TRANSPORT_LE) L2CA_DeregisterLECoc(p_ccb->psm); } extern void gap_attr_db_init(void); Loading system/stack/include/l2c_api.h +0 −16 Original line number Diff line number Diff line Loading @@ -328,22 +328,6 @@ typedef struct { } tL2CAP_ERTM_INFO; #define L2CA_REGISTER(a, b, c) L2CA_Register(a, (tL2CAP_APPL_INFO*)(b), c) #define L2CA_DEREGISTER(a) L2CA_Deregister(a) #define L2CA_CONNECT_REQ(a, b, c) L2CA_ErtmConnectReq(a, b, c) #define L2CA_CONNECT_RSP(a, b, c, d, e, f) L2CA_ErtmConnectRsp(a, b, c, d, e, f) #define L2CA_CONFIG_REQ(a, b) L2CA_ConfigReq(a, b) #define L2CA_CONFIG_RSP(a, b) L2CA_ConfigRsp(a, b) #define L2CA_DISCONNECT_REQ(a) L2CA_DisconnectReq(a) #define L2CA_DISCONNECT_RSP(a) L2CA_DisconnectRsp(a) #define L2CA_DATA_WRITE(a, b) L2CA_DataWrite(a, b) #define L2CA_REGISTER_COC(a, b, c) L2CA_RegisterLECoc(a, (tL2CAP_APPL_INFO*)(b)) #define L2CA_DEREGISTER_COC(a) L2CA_DeregisterLECoc(a) #define L2CA_CONNECT_COC_REQ(a, b, c) L2CA_ConnectLECocReq(a, b, c) #define L2CA_CONNECT_COC_RSP(a, b, c, d, e, f) \ L2CA_ConnectLECocRsp(a, b, c, d, e, f) #define L2CA_GET_PEER_COC_CONFIG(a, b) L2CA_GetPeerLECocConfig(a, b) /***************************************************************************** * External Function Declarations ****************************************************************************/ Loading Loading
system/stack/gap/gap_conn.cc +20 −21 Original line number Diff line number Diff line Loading @@ -235,7 +235,7 @@ uint16_t GAP_ConnOpen(const char* p_serv_name, uint8_t service_id, /* Register the PSM with L2CAP */ if (transport == BT_TRANSPORT_BR_EDR) { p_ccb->psm = L2CA_REGISTER(psm, &conn.reg_info, false /* enable_snoop */); p_ccb->psm = L2CA_Register(psm, &conn.reg_info, false /* enable_snoop */); if (p_ccb->psm == 0) { LOG(ERROR) << StringPrintf("%s: Failure registering PSM 0x%04x", __func__, psm); Loading @@ -245,8 +245,7 @@ uint16_t GAP_ConnOpen(const char* p_serv_name, uint8_t service_id, } if (transport == BT_TRANSPORT_LE) { p_ccb->psm = L2CA_REGISTER_COC( psm, &conn.reg_info, AMP_AUTOSWITCH_ALLOWED | AMP_USE_AMP_IF_POSSIBLE); p_ccb->psm = L2CA_RegisterLECoc(psm, (tL2CAP_APPL_INFO*)&conn.reg_info); if (p_ccb->psm == 0) { LOG(ERROR) << StringPrintf("%s: Failure registering PSM 0x%04x", __func__, psm); Loading Loading @@ -302,7 +301,7 @@ uint16_t GAP_ConnOpen(const char* p_serv_name, uint8_t service_id, /* Check if L2CAP started the connection process */ if (p_rem_bda && (transport == BT_TRANSPORT_BR_EDR)) { cid = L2CA_CONNECT_REQ(p_ccb->psm, *p_rem_bda, &p_ccb->ertm_info); cid = L2CA_ErtmConnectReq(p_ccb->psm, *p_rem_bda, &p_ccb->ertm_info); if (cid != 0) { p_ccb->connection_id = cid; return (p_ccb->gap_handle); Loading @@ -310,7 +309,7 @@ uint16_t GAP_ConnOpen(const char* p_serv_name, uint8_t service_id, } if (p_rem_bda && (transport == BT_TRANSPORT_LE)) { cid = L2CA_CONNECT_COC_REQ(p_ccb->psm, *p_rem_bda, &p_ccb->local_coc_cfg); cid = L2CA_ConnectLECocReq(p_ccb->psm, *p_rem_bda, &p_ccb->local_coc_cfg); if (cid != 0) { p_ccb->connection_id = cid; return (p_ccb->gap_handle); Loading Loading @@ -342,7 +341,7 @@ uint16_t GAP_ConnClose(uint16_t gap_handle) { if (p_ccb) { /* Check if we have a connection ID */ if (p_ccb->con_state != GAP_CCB_STATE_LISTENING) L2CA_DISCONNECT_REQ(p_ccb->connection_id); L2CA_DisconnectReq(p_ccb->connection_id); gap_release_ccb(p_ccb); Loading Loading @@ -488,7 +487,7 @@ static bool gap_try_write_queued_data(tGAP_CCB* p_ccb) { /* Send the buffer through L2CAP */ BT_HDR* p_buf; while ((p_buf = (BT_HDR*)fixed_queue_try_dequeue(p_ccb->tx_queue)) != NULL) { uint8_t status = L2CA_DATA_WRITE(p_ccb->connection_id, p_buf); uint8_t status = L2CA_DataWrite(p_ccb->connection_id, p_buf); if (status == L2CAP_DW_CONGESTED) { p_ccb->is_congested = true; Loading Loading @@ -565,7 +564,7 @@ uint16_t GAP_ConnReconfig(uint16_t gap_handle, tL2CAP_CFG_INFO* p_cfg) { p_ccb->cfg = *p_cfg; if (p_ccb->con_state == GAP_CCB_STATE_CONNECTED) L2CA_CONFIG_REQ(p_ccb->connection_id, p_cfg); L2CA_ConfigReq(p_ccb->connection_id, p_cfg); return (BT_PASS); } Loading Loading @@ -733,7 +732,7 @@ static void gap_connect_ind(const RawAddress& bd_addr, uint16_t l2cap_cid, LOG(WARNING) << "*******"; /* Disconnect because it is an unexpected connection */ L2CA_DISCONNECT_REQ(l2cap_cid); L2CA_DisconnectReq(l2cap_cid); return; } Loading @@ -747,15 +746,15 @@ static void gap_connect_ind(const RawAddress& bd_addr, uint16_t l2cap_cid, /* Send response to the L2CAP layer. */ if (p_ccb->transport == BT_TRANSPORT_BR_EDR) L2CA_CONNECT_RSP(bd_addr, l2cap_id, l2cap_cid, L2CAP_CONN_OK, L2CAP_CONN_OK, &p_ccb->ertm_info); L2CA_ErtmConnectRsp(bd_addr, l2cap_id, l2cap_cid, L2CAP_CONN_OK, L2CAP_CONN_OK, &p_ccb->ertm_info); if (p_ccb->transport == BT_TRANSPORT_LE) { L2CA_CONNECT_COC_RSP(bd_addr, l2cap_id, l2cap_cid, L2CAP_CONN_OK, L2CA_ConnectLECocRsp(bd_addr, l2cap_id, l2cap_cid, L2CAP_CONN_OK, L2CAP_CONN_OK, &p_ccb->local_coc_cfg); /* get the remote coc configuration */ L2CA_GET_PEER_COC_CONFIG(l2cap_cid, &p_ccb->peer_coc_cfg); L2CA_GetPeerLECocConfig(l2cap_cid, &p_ccb->peer_coc_cfg); p_ccb->rem_mtu_size = p_ccb->peer_coc_cfg.mtu; /* configuration is not required for LE COC */ Loading @@ -769,7 +768,7 @@ static void gap_connect_ind(const RawAddress& bd_addr, uint16_t l2cap_cid, /* Send a Configuration Request. */ if (p_ccb->transport == BT_TRANSPORT_BR_EDR) L2CA_CONFIG_REQ(l2cap_cid, &p_ccb->cfg); L2CA_ConfigReq(l2cap_cid, &p_ccb->cfg); } /******************************************************************************* Loading Loading @@ -816,7 +815,7 @@ static void gap_sec_check_complete(const RawAddress*, tBT_TRANSPORT, gap_checks_con_flags(p_ccb); } else { /* security failed - disconnect the channel */ L2CA_DISCONNECT_REQ(p_ccb->connection_id); L2CA_DisconnectReq(p_ccb->connection_id); } } Loading Loading @@ -853,12 +852,12 @@ static void gap_connect_cfm(uint16_t l2cap_cid, uint16_t result) { p_ccb->con_state = GAP_CCB_STATE_CFG_SETUP; /* Send a Configuration Request. */ L2CA_CONFIG_REQ(l2cap_cid, &p_ccb->cfg); L2CA_ConfigReq(l2cap_cid, &p_ccb->cfg); } if (p_ccb->transport == BT_TRANSPORT_LE) { /* get the remote coc configuration */ L2CA_GET_PEER_COC_CONFIG(l2cap_cid, &p_ccb->peer_coc_cfg); L2CA_GetPeerLECocConfig(l2cap_cid, &p_ccb->peer_coc_cfg); p_ccb->rem_mtu_size = p_ccb->peer_coc_cfg.mtu; /* configuration is not required for LE COC */ Loading Loading @@ -913,7 +912,7 @@ static void gap_config_ind(uint16_t l2cap_cid, tL2CAP_CFG_INFO* p_cfg) { p_cfg->result = L2CAP_CFG_OK; p_cfg->fcs_present = false; L2CA_CONFIG_RSP(l2cap_cid, p_cfg); L2CA_ConfigRsp(l2cap_cid, p_cfg); p_ccb->con_flags |= GAP_CCB_FLAGS_HIS_CFG_DONE; Loading Loading @@ -971,7 +970,7 @@ static void gap_disconnect_ind(uint16_t l2cap_cid, bool ack_needed) { p_ccb = gap_find_ccb_by_cid(l2cap_cid); if (p_ccb == NULL) return; if (ack_needed) L2CA_DISCONNECT_RSP(l2cap_cid); if (ack_needed) L2CA_DisconnectRsp(l2cap_cid); p_ccb->p_callback(p_ccb->gap_handle, GAP_EVT_CONN_CLOSED, nullptr); gap_release_ccb(p_ccb); Loading Loading @@ -1154,8 +1153,8 @@ static void gap_release_ccb(tGAP_CCB* p_ccb) { /* Free the security record for this PSM */ BTM_SecClrService(p_ccb->service_id); if (p_ccb->transport == BT_TRANSPORT_BR_EDR) L2CA_DEREGISTER(p_ccb->psm); if (p_ccb->transport == BT_TRANSPORT_LE) L2CA_DEREGISTER_COC(p_ccb->psm); if (p_ccb->transport == BT_TRANSPORT_BR_EDR) L2CA_Deregister(p_ccb->psm); if (p_ccb->transport == BT_TRANSPORT_LE) L2CA_DeregisterLECoc(p_ccb->psm); } extern void gap_attr_db_init(void); Loading
system/stack/include/l2c_api.h +0 −16 Original line number Diff line number Diff line Loading @@ -328,22 +328,6 @@ typedef struct { } tL2CAP_ERTM_INFO; #define L2CA_REGISTER(a, b, c) L2CA_Register(a, (tL2CAP_APPL_INFO*)(b), c) #define L2CA_DEREGISTER(a) L2CA_Deregister(a) #define L2CA_CONNECT_REQ(a, b, c) L2CA_ErtmConnectReq(a, b, c) #define L2CA_CONNECT_RSP(a, b, c, d, e, f) L2CA_ErtmConnectRsp(a, b, c, d, e, f) #define L2CA_CONFIG_REQ(a, b) L2CA_ConfigReq(a, b) #define L2CA_CONFIG_RSP(a, b) L2CA_ConfigRsp(a, b) #define L2CA_DISCONNECT_REQ(a) L2CA_DisconnectReq(a) #define L2CA_DISCONNECT_RSP(a) L2CA_DisconnectRsp(a) #define L2CA_DATA_WRITE(a, b) L2CA_DataWrite(a, b) #define L2CA_REGISTER_COC(a, b, c) L2CA_RegisterLECoc(a, (tL2CAP_APPL_INFO*)(b)) #define L2CA_DEREGISTER_COC(a) L2CA_DeregisterLECoc(a) #define L2CA_CONNECT_COC_REQ(a, b, c) L2CA_ConnectLECocReq(a, b, c) #define L2CA_CONNECT_COC_RSP(a, b, c, d, e, f) \ L2CA_ConnectLECocRsp(a, b, c, d, e, f) #define L2CA_GET_PEER_COC_CONFIG(a, b) L2CA_GetPeerLECocConfig(a, b) /***************************************************************************** * External Function Declarations ****************************************************************************/ Loading