Loading system/bta/jv/bta_jv_act.cc +4 −2 Original line number Diff line number Diff line Loading @@ -849,7 +849,8 @@ void bta_jv_delete_record(uint32_t handle) { * Returns void * ******************************************************************************/ static void bta_jv_l2cap_client_cback(uint16_t gap_handle, uint16_t event) { static void bta_jv_l2cap_client_cback(uint16_t gap_handle, uint16_t event, tGAP_CB_DATA* data) { tBTA_JV_L2C_CB* p_cb = &bta_jv_cb.l2c_cb[gap_handle]; tBTA_JV evt_data; Loading Loading @@ -997,7 +998,8 @@ void bta_jv_l2cap_close(uint32_t handle, tBTA_JV_L2C_CB* p_cb) { * Returns void * ******************************************************************************/ static void bta_jv_l2cap_server_cback(uint16_t gap_handle, uint16_t event) { static void bta_jv_l2cap_server_cback(uint16_t gap_handle, uint16_t event, tGAP_CB_DATA* data) { tBTA_JV_L2C_CB* p_cb = &bta_jv_cb.l2c_cb[gap_handle]; tBTA_JV evt_data; tBTA_JV_L2CAP_CBACK* p_cback; Loading system/stack/gap/gap_conn.cc +32 −16 Original line number Diff line number Diff line Loading @@ -93,6 +93,9 @@ static void gap_disconnect_ind(uint16_t l2cap_cid, bool ack_needed); static void gap_data_ind(uint16_t l2cap_cid, BT_HDR* p_msg); static void gap_congestion_ind(uint16_t lcid, bool is_congested); static void gap_tx_complete_ind(uint16_t l2cap_cid, uint16_t sdu_sent); static void gap_credits_received_cb(uint16_t l2cap_cid, uint16_t credits_received, uint16_t credit_count); static tGAP_CCB* gap_find_ccb_by_cid(uint16_t cid); static tGAP_CCB* gap_find_ccb_by_handle(uint16_t handle); Loading Loading @@ -123,6 +126,7 @@ void gap_conn_init(void) { conn.reg_info.pL2CA_DataInd_Cb = gap_data_ind; conn.reg_info.pL2CA_CongestionStatus_Cb = gap_congestion_ind; conn.reg_info.pL2CA_TxComplete_Cb = gap_tx_complete_ind; conn.reg_info.pL2CA_CreditsReceived_Cb = gap_credits_received_cb; } /******************************************************************************* Loading Loading @@ -400,7 +404,8 @@ uint16_t GAP_ConnReadData(uint16_t gap_handle, uint8_t* p_data, mutex_global_unlock(); DVLOG(1) << StringPrintf("GAP_ConnReadData - rx_queue_size left=%d, *p_len=%d", DVLOG(1) << StringPrintf( "GAP_ConnReadData - rx_queue_size left=%d, *p_len=%d", p_ccb->rx_queue_size, *p_len); return (BT_PASS); Loading Loading @@ -432,8 +437,8 @@ int GAP_GetRxQueueCnt(uint16_t handle, uint32_t* p_rx_queue_count) { } else rc = GAP_INVALID_HANDLE; DVLOG(1) << StringPrintf("GAP_GetRxQueueCnt - rc = 0x%04x, rx_queue_count=%d", rc, *p_rx_queue_count); DVLOG(1) << StringPrintf("GAP_GetRxQueueCnt - rc = 0x%04x, rx_queue_count=%d", rc, *p_rx_queue_count); return (rc); } Loading Loading @@ -681,8 +686,18 @@ void gap_tx_complete_ind(uint16_t l2cap_cid, uint16_t sdu_sent) { if ((p_ccb->con_state == GAP_CCB_STATE_CONNECTED) && (sdu_sent == 0xFFFF)) { DVLOG(1) << StringPrintf("%s: GAP_EVT_TX_EMPTY", __func__); p_ccb->p_callback(p_ccb->gap_handle, GAP_EVT_TX_EMPTY); p_ccb->p_callback(p_ccb->gap_handle, GAP_EVT_TX_EMPTY, nullptr); } } void gap_credits_received_cb(uint16_t l2cap_cid, uint16_t credits_received, uint16_t credit_count) { tGAP_CCB* p_ccb = gap_find_ccb_by_cid(l2cap_cid); if (!p_ccb) return; tGAP_CB_DATA data{.coc_credits = {.credits_received = credits_received, .credit_count = credit_count}}; p_ccb->p_callback(p_ccb->gap_handle, GAP_EVT_LE_COC_CREDITS, &data); } /******************************************************************************* Loading Loading @@ -770,7 +785,7 @@ static void gap_checks_con_flags(tGAP_CCB* p_ccb) { if ((p_ccb->con_flags & GAP_CCB_FLAGS_CONN_DONE) == GAP_CCB_FLAGS_CONN_DONE) { p_ccb->con_state = GAP_CCB_STATE_CONNECTED; p_ccb->p_callback(p_ccb->gap_handle, GAP_EVT_CONN_OPENED); p_ccb->p_callback(p_ccb->gap_handle, GAP_EVT_CONN_OPENED, nullptr); } } Loading Loading @@ -852,7 +867,7 @@ static void gap_connect_cfm(uint16_t l2cap_cid, uint16_t result) { } else { /* Tell the user if he has a callback */ if (p_ccb->p_callback) (*p_ccb->p_callback)(p_ccb->gap_handle, GAP_EVT_CONN_CLOSED); (*p_ccb->p_callback)(p_ccb->gap_handle, GAP_EVT_CONN_CLOSED, nullptr); gap_release_ccb(p_ccb); } Loading Loading @@ -929,7 +944,7 @@ static void gap_config_cfm(uint16_t l2cap_cid, tL2CAP_CFG_INFO* p_cfg) { gap_checks_con_flags(p_ccb); } else { p_ccb->p_callback(p_ccb->gap_handle, GAP_EVT_CONN_CLOSED); p_ccb->p_callback(p_ccb->gap_handle, GAP_EVT_CONN_CLOSED, nullptr); gap_release_ccb(p_ccb); } } Loading @@ -955,7 +970,7 @@ static void gap_disconnect_ind(uint16_t l2cap_cid, bool ack_needed) { if (ack_needed) L2CA_DISCONNECT_RSP(l2cap_cid); p_ccb->p_callback(p_ccb->gap_handle, GAP_EVT_CONN_CLOSED); p_ccb->p_callback(p_ccb->gap_handle, GAP_EVT_CONN_CLOSED, nullptr); gap_release_ccb(p_ccb); } Loading Loading @@ -987,7 +1002,7 @@ static void gap_data_ind(uint16_t l2cap_cid, BT_HDR* p_msg) { p_ccb->rx_queue_size, p_msg->len); */ p_ccb->p_callback(p_ccb->gap_handle, GAP_EVT_CONN_DATA_AVAIL); p_ccb->p_callback(p_ccb->gap_handle, GAP_EVT_CONN_DATA_AVAIL, nullptr); } else { osi_free(p_msg); } Loading @@ -1010,9 +1025,10 @@ static void gap_congestion_ind(uint16_t lcid, bool is_congested) { p_ccb->is_congested = is_congested; p_ccb->p_callback(p_ccb->gap_handle, (is_congested) ? GAP_EVT_CONN_CONGESTED : GAP_EVT_CONN_UNCONGESTED); p_ccb->p_callback( p_ccb->gap_handle, (is_congested) ? GAP_EVT_CONN_CONGESTED : GAP_EVT_CONN_UNCONGESTED, nullptr); gap_try_write_queued_data(p_ccb); } Loading system/stack/include/gap_api.h +13 −1 Original line number Diff line number Diff line Loading @@ -77,6 +77,7 @@ #define GAP_EVT_CONN_CONGESTED 0x0103 #define GAP_EVT_CONN_UNCONGESTED 0x0104 #define GAP_EVT_TX_EMPTY 0x0105 #define GAP_EVT_LE_COC_CREDITS 0x0106 /* Values for 'chan_mode_mask' field */ /* GAP_ConnOpen() - optional channels to negotiate */ Loading Loading @@ -105,13 +106,24 @@ #define GAP_PREFER_CONN_SP_TOUT 2000 #endif struct tGAP_COC_CREDITS { uint16_t gap_handle; uint16_t credits_received; uint16_t credit_count; }; union tGAP_CB_DATA { tGAP_COC_CREDITS coc_credits; }; /***************************************************************************** * Type Definitions ****************************************************************************/ /* * Callback function for connection services */ typedef void(tGAP_CONN_CALLBACK)(uint16_t gap_handle, uint16_t event); typedef void(tGAP_CONN_CALLBACK)(uint16_t gap_handle, uint16_t event, tGAP_CB_DATA* data); /* * Define the callback function prototypes. Parameters are specific Loading Loading
system/bta/jv/bta_jv_act.cc +4 −2 Original line number Diff line number Diff line Loading @@ -849,7 +849,8 @@ void bta_jv_delete_record(uint32_t handle) { * Returns void * ******************************************************************************/ static void bta_jv_l2cap_client_cback(uint16_t gap_handle, uint16_t event) { static void bta_jv_l2cap_client_cback(uint16_t gap_handle, uint16_t event, tGAP_CB_DATA* data) { tBTA_JV_L2C_CB* p_cb = &bta_jv_cb.l2c_cb[gap_handle]; tBTA_JV evt_data; Loading Loading @@ -997,7 +998,8 @@ void bta_jv_l2cap_close(uint32_t handle, tBTA_JV_L2C_CB* p_cb) { * Returns void * ******************************************************************************/ static void bta_jv_l2cap_server_cback(uint16_t gap_handle, uint16_t event) { static void bta_jv_l2cap_server_cback(uint16_t gap_handle, uint16_t event, tGAP_CB_DATA* data) { tBTA_JV_L2C_CB* p_cb = &bta_jv_cb.l2c_cb[gap_handle]; tBTA_JV evt_data; tBTA_JV_L2CAP_CBACK* p_cback; Loading
system/stack/gap/gap_conn.cc +32 −16 Original line number Diff line number Diff line Loading @@ -93,6 +93,9 @@ static void gap_disconnect_ind(uint16_t l2cap_cid, bool ack_needed); static void gap_data_ind(uint16_t l2cap_cid, BT_HDR* p_msg); static void gap_congestion_ind(uint16_t lcid, bool is_congested); static void gap_tx_complete_ind(uint16_t l2cap_cid, uint16_t sdu_sent); static void gap_credits_received_cb(uint16_t l2cap_cid, uint16_t credits_received, uint16_t credit_count); static tGAP_CCB* gap_find_ccb_by_cid(uint16_t cid); static tGAP_CCB* gap_find_ccb_by_handle(uint16_t handle); Loading Loading @@ -123,6 +126,7 @@ void gap_conn_init(void) { conn.reg_info.pL2CA_DataInd_Cb = gap_data_ind; conn.reg_info.pL2CA_CongestionStatus_Cb = gap_congestion_ind; conn.reg_info.pL2CA_TxComplete_Cb = gap_tx_complete_ind; conn.reg_info.pL2CA_CreditsReceived_Cb = gap_credits_received_cb; } /******************************************************************************* Loading Loading @@ -400,7 +404,8 @@ uint16_t GAP_ConnReadData(uint16_t gap_handle, uint8_t* p_data, mutex_global_unlock(); DVLOG(1) << StringPrintf("GAP_ConnReadData - rx_queue_size left=%d, *p_len=%d", DVLOG(1) << StringPrintf( "GAP_ConnReadData - rx_queue_size left=%d, *p_len=%d", p_ccb->rx_queue_size, *p_len); return (BT_PASS); Loading Loading @@ -432,8 +437,8 @@ int GAP_GetRxQueueCnt(uint16_t handle, uint32_t* p_rx_queue_count) { } else rc = GAP_INVALID_HANDLE; DVLOG(1) << StringPrintf("GAP_GetRxQueueCnt - rc = 0x%04x, rx_queue_count=%d", rc, *p_rx_queue_count); DVLOG(1) << StringPrintf("GAP_GetRxQueueCnt - rc = 0x%04x, rx_queue_count=%d", rc, *p_rx_queue_count); return (rc); } Loading Loading @@ -681,8 +686,18 @@ void gap_tx_complete_ind(uint16_t l2cap_cid, uint16_t sdu_sent) { if ((p_ccb->con_state == GAP_CCB_STATE_CONNECTED) && (sdu_sent == 0xFFFF)) { DVLOG(1) << StringPrintf("%s: GAP_EVT_TX_EMPTY", __func__); p_ccb->p_callback(p_ccb->gap_handle, GAP_EVT_TX_EMPTY); p_ccb->p_callback(p_ccb->gap_handle, GAP_EVT_TX_EMPTY, nullptr); } } void gap_credits_received_cb(uint16_t l2cap_cid, uint16_t credits_received, uint16_t credit_count) { tGAP_CCB* p_ccb = gap_find_ccb_by_cid(l2cap_cid); if (!p_ccb) return; tGAP_CB_DATA data{.coc_credits = {.credits_received = credits_received, .credit_count = credit_count}}; p_ccb->p_callback(p_ccb->gap_handle, GAP_EVT_LE_COC_CREDITS, &data); } /******************************************************************************* Loading Loading @@ -770,7 +785,7 @@ static void gap_checks_con_flags(tGAP_CCB* p_ccb) { if ((p_ccb->con_flags & GAP_CCB_FLAGS_CONN_DONE) == GAP_CCB_FLAGS_CONN_DONE) { p_ccb->con_state = GAP_CCB_STATE_CONNECTED; p_ccb->p_callback(p_ccb->gap_handle, GAP_EVT_CONN_OPENED); p_ccb->p_callback(p_ccb->gap_handle, GAP_EVT_CONN_OPENED, nullptr); } } Loading Loading @@ -852,7 +867,7 @@ static void gap_connect_cfm(uint16_t l2cap_cid, uint16_t result) { } else { /* Tell the user if he has a callback */ if (p_ccb->p_callback) (*p_ccb->p_callback)(p_ccb->gap_handle, GAP_EVT_CONN_CLOSED); (*p_ccb->p_callback)(p_ccb->gap_handle, GAP_EVT_CONN_CLOSED, nullptr); gap_release_ccb(p_ccb); } Loading Loading @@ -929,7 +944,7 @@ static void gap_config_cfm(uint16_t l2cap_cid, tL2CAP_CFG_INFO* p_cfg) { gap_checks_con_flags(p_ccb); } else { p_ccb->p_callback(p_ccb->gap_handle, GAP_EVT_CONN_CLOSED); p_ccb->p_callback(p_ccb->gap_handle, GAP_EVT_CONN_CLOSED, nullptr); gap_release_ccb(p_ccb); } } Loading @@ -955,7 +970,7 @@ static void gap_disconnect_ind(uint16_t l2cap_cid, bool ack_needed) { if (ack_needed) L2CA_DISCONNECT_RSP(l2cap_cid); p_ccb->p_callback(p_ccb->gap_handle, GAP_EVT_CONN_CLOSED); p_ccb->p_callback(p_ccb->gap_handle, GAP_EVT_CONN_CLOSED, nullptr); gap_release_ccb(p_ccb); } Loading Loading @@ -987,7 +1002,7 @@ static void gap_data_ind(uint16_t l2cap_cid, BT_HDR* p_msg) { p_ccb->rx_queue_size, p_msg->len); */ p_ccb->p_callback(p_ccb->gap_handle, GAP_EVT_CONN_DATA_AVAIL); p_ccb->p_callback(p_ccb->gap_handle, GAP_EVT_CONN_DATA_AVAIL, nullptr); } else { osi_free(p_msg); } Loading @@ -1010,9 +1025,10 @@ static void gap_congestion_ind(uint16_t lcid, bool is_congested) { p_ccb->is_congested = is_congested; p_ccb->p_callback(p_ccb->gap_handle, (is_congested) ? GAP_EVT_CONN_CONGESTED : GAP_EVT_CONN_UNCONGESTED); p_ccb->p_callback( p_ccb->gap_handle, (is_congested) ? GAP_EVT_CONN_CONGESTED : GAP_EVT_CONN_UNCONGESTED, nullptr); gap_try_write_queued_data(p_ccb); } Loading
system/stack/include/gap_api.h +13 −1 Original line number Diff line number Diff line Loading @@ -77,6 +77,7 @@ #define GAP_EVT_CONN_CONGESTED 0x0103 #define GAP_EVT_CONN_UNCONGESTED 0x0104 #define GAP_EVT_TX_EMPTY 0x0105 #define GAP_EVT_LE_COC_CREDITS 0x0106 /* Values for 'chan_mode_mask' field */ /* GAP_ConnOpen() - optional channels to negotiate */ Loading Loading @@ -105,13 +106,24 @@ #define GAP_PREFER_CONN_SP_TOUT 2000 #endif struct tGAP_COC_CREDITS { uint16_t gap_handle; uint16_t credits_received; uint16_t credit_count; }; union tGAP_CB_DATA { tGAP_COC_CREDITS coc_credits; }; /***************************************************************************** * Type Definitions ****************************************************************************/ /* * Callback function for connection services */ typedef void(tGAP_CONN_CALLBACK)(uint16_t gap_handle, uint16_t event); typedef void(tGAP_CONN_CALLBACK)(uint16_t gap_handle, uint16_t event, tGAP_CB_DATA* data); /* * Define the callback function prototypes. Parameters are specific Loading