• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
Keine Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

system/bt


Commit MetaInfo

Revision1297a28b2b47f625413e7f416c7629967c6944e1 (tree)
Zeit2017-05-28 16:22:55
Autorandroid-build-team Robot <android-build-team-robot@goog...>
Commiterandroid-build-team Robot

Log Message

release-request-fca2b5ac-03eb-4055-a549-b4fc2b292b64-for-git_oc-release-4049993 snap-temp-L04900000068539456

Change-Id: I7af38c959146a9406c712a170ffa6a9c380c3299

Ändern Zusammenfassung

Diff

--- a/bta/dm/bta_dm_act.cc
+++ b/bta/dm/bta_dm_act.cc
@@ -4639,9 +4639,15 @@ void btm_dm_start_gatt_discovery(BD_ADDR bd_addr) {
46394639 memset(bta_dm_search_cb.pending_close_bda, 0, BD_ADDR_LEN);
46404640 alarm_cancel(bta_dm_search_cb.gatt_close_timer);
46414641 btm_dm_start_disc_gatt_services(bta_dm_search_cb.conn_id);
4642- } else
4643- BTA_GATTC_Open(bta_dm_search_cb.client_if, bd_addr, true,
4644- BTA_GATT_TRANSPORT_LE);
4642+ } else {
4643+ if (BTM_IsAclConnectionUp(bd_addr, BT_TRANSPORT_LE)) {
4644+ BTA_GATTC_Open(bta_dm_search_cb.client_if, bd_addr, true,
4645+ BTA_GATT_TRANSPORT_LE, true);
4646+ } else {
4647+ BTA_GATTC_Open(bta_dm_search_cb.client_if, bd_addr, true,
4648+ BTA_GATT_TRANSPORT_LE, false);
4649+ }
4650+ }
46454651 }
46464652
46474653 /*******************************************************************************
--- a/bta/gatt/bta_gattc_act.cc
+++ b/bta/gatt/bta_gattc_act.cc
@@ -432,7 +432,7 @@ void bta_gattc_open(tBTA_GATTC_CLCB* p_clcb, tBTA_GATTC_DATA* p_data) {
432432
433433 /* open/hold a connection */
434434 if (!GATT_Connect(p_clcb->p_rcb->client_if, p_data->api_conn.remote_bda, true,
435- p_data->api_conn.transport, false,
435+ p_data->api_conn.transport, p_data->api_conn.opportunistic,
436436 p_data->api_conn.initiating_phys)) {
437437 APPL_TRACE_ERROR("Connection open failure");
438438
--- a/bta/gatt/bta_gattc_api.cc
+++ b/bta/gatt/bta_gattc_api.cc
@@ -127,16 +127,20 @@ void BTA_GATTC_AppDeregister(tBTA_GATTC_IF client_if) {
127127 * transport: Transport to be used for GATT connection
128128 * (BREDR/LE)
129129 * initiating_phys: LE PHY to use, optional
130+ * opportunistic: wether the connection shall be opportunistic,
131+ * and don't impact the disconnection timer
130132 *
131133 ******************************************************************************/
132134 void BTA_GATTC_Open(tBTA_GATTC_IF client_if, BD_ADDR remote_bda, bool is_direct,
133- tBTA_GATT_TRANSPORT transport) {
135+ tBTA_GATT_TRANSPORT transport, bool opportunistic) {
134136 uint8_t phy = controller_get_interface()->get_le_all_initiating_phys();
135- BTA_GATTC_Open(client_if, remote_bda, is_direct, transport, phy);
137+ BTA_GATTC_Open(client_if, remote_bda, is_direct, transport, phy,
138+ opportunistic);
136139 }
137140
138141 void BTA_GATTC_Open(tBTA_GATTC_IF client_if, BD_ADDR remote_bda, bool is_direct,
139- tBTA_GATT_TRANSPORT transport, uint8_t initiating_phys) {
142+ tBTA_GATT_TRANSPORT transport, uint8_t initiating_phys,
143+ bool opportunistic) {
140144 tBTA_GATTC_API_OPEN* p_buf =
141145 (tBTA_GATTC_API_OPEN*)osi_malloc(sizeof(tBTA_GATTC_API_OPEN));
142146
@@ -145,6 +149,7 @@ void BTA_GATTC_Open(tBTA_GATTC_IF client_if, BD_ADDR remote_bda, bool is_direct,
145149 p_buf->is_direct = is_direct;
146150 p_buf->transport = transport;
147151 p_buf->initiating_phys = initiating_phys;
152+ p_buf->opportunistic = opportunistic;
148153 memcpy(p_buf->remote_bda, remote_bda, BD_ADDR_LEN);
149154
150155 bta_sys_sendmsg(p_buf);
--- a/bta/gatt/bta_gattc_int.h
+++ b/bta/gatt/bta_gattc_int.h
@@ -102,6 +102,7 @@ typedef struct {
102102 bool is_direct;
103103 tBTA_TRANSPORT transport;
104104 uint8_t initiating_phys;
105+ bool opportunistic;
105106 } tBTA_GATTC_API_OPEN;
106107
107108 typedef tBTA_GATTC_API_OPEN tBTA_GATTC_API_CANCEL_OPEN;
--- a/bta/hh/bta_hh_le.cc
+++ b/bta/hh/bta_hh_le.cc
@@ -400,7 +400,8 @@ void bta_hh_le_open_conn(tBTA_HH_DEV_CB* p_cb, BD_ADDR remote_bda) {
400400 bta_hh_cb.le_cb_index[BTA_HH_GET_LE_CB_IDX(p_cb->hid_handle)] = p_cb->index;
401401 p_cb->in_use = true;
402402
403- BTA_GATTC_Open(bta_hh_cb.gatt_if, remote_bda, true, BTA_GATT_TRANSPORT_LE);
403+ BTA_GATTC_Open(bta_hh_cb.gatt_if, remote_bda, true, BTA_GATT_TRANSPORT_LE,
404+ false);
404405 }
405406
406407 /*******************************************************************************
@@ -2113,7 +2114,8 @@ static void bta_hh_le_add_dev_bg_conn(tBTA_HH_DEV_CB* p_cb, bool check_bond) {
21132114 if (/*p_cb->dscp_info.flag & BTA_HH_LE_NORMAL_CONN &&*/
21142115 !p_cb->in_bg_conn && to_add) {
21152116 /* add device into BG connection to accept remote initiated connection */
2116- BTA_GATTC_Open(bta_hh_cb.gatt_if, p_cb->addr, false, BTA_GATT_TRANSPORT_LE);
2117+ BTA_GATTC_Open(bta_hh_cb.gatt_if, p_cb->addr, false, BTA_GATT_TRANSPORT_LE,
2118+ false);
21172119 p_cb->in_bg_conn = true;
21182120
21192121 BTA_DmBleStartAutoConn();
--- a/bta/include/bta_gatt_api.h
+++ b/bta/include/bta_gatt_api.h
@@ -639,10 +639,11 @@ extern void BTA_GATTC_AppDeregister(tBTA_GATTC_IF client_if);
639639 *
640640 ******************************************************************************/
641641 extern void BTA_GATTC_Open(tBTA_GATTC_IF client_if, BD_ADDR remote_bda,
642- bool is_direct, tBTA_GATT_TRANSPORT transport);
642+ bool is_direct, tBTA_GATT_TRANSPORT transport,
643+ bool opportunistic);
643644 extern void BTA_GATTC_Open(tBTA_GATTC_IF client_if, BD_ADDR remote_bda,
644645 bool is_direct, tBTA_GATT_TRANSPORT transport,
645- uint8_t initiating_phys);
646+ uint8_t initiating_phys, bool opportunistic);
646647
647648 /*******************************************************************************
648649 *
--- a/btif/src/bluetooth.cc
+++ b/btif/src/bluetooth.cc
@@ -66,6 +66,9 @@
6666 #include "osi/include/wakelock.h"
6767 #include "stack_manager.h"
6868
69+/* Test interface includes */
70+#include "mca_api.h"
71+
6972 /*******************************************************************************
7073 * Static variables
7174 ******************************************************************************/
@@ -107,6 +110,9 @@ extern btrc_interface_t* btif_rc_ctrl_get_interface();
107110 /*SDP search client*/
108111 extern btsdp_interface_t* btif_sdp_get_interface();
109112
113+/* List all test interface here */
114+extern btmcap_test_interface_t* stack_mcap_get_interface();
115+
110116 /*******************************************************************************
111117 * Functions
112118 ******************************************************************************/
@@ -364,6 +370,9 @@ static const void* get_profile_interface(const char* profile_id) {
364370 if (is_profile(profile_id, BT_PROFILE_AV_RC_CTRL_ID))
365371 return btif_rc_ctrl_get_interface();
366372
373+ if (is_profile(profile_id, BT_TEST_INTERFACE_MCAP_ID))
374+ return stack_mcap_get_interface();
375+
367376 return NULL;
368377 }
369378
--- a/stack/gap/gap_ble.cc
+++ b/stack/gap/gap_ble.cc
@@ -87,15 +87,7 @@ tGAP_CLCB* gap_find_clcb_by_bd_addr(BD_ADDR bda) {
8787 return NULL;
8888 }
8989
90-/*******************************************************************************
91- *
92- * Function gap_ble_find_clcb_by_conn_id
93- *
94- * Description The function searches all LCB with macthing connection ID
95- *
96- * Returns total number of clcb found.
97- *
98- ******************************************************************************/
90+/* returns LCB with matching connection ID, or NULL if not found */
9991 tGAP_CLCB* gap_ble_find_clcb_by_conn_id(uint16_t conn_id) {
10092 uint8_t i_clcb;
10193 tGAP_CLCB* p_clcb = NULL;
@@ -107,7 +99,7 @@ tGAP_CLCB* gap_ble_find_clcb_by_conn_id(uint16_t conn_id) {
10799 }
108100 }
109101
110- return p_clcb;
102+ return NULL;
111103 }
112104
113105 /*******************************************************************************
@@ -132,10 +124,10 @@ tGAP_CLCB* gap_clcb_alloc(BD_ADDR bda) {
132124 p_clcb->in_use = true;
133125 memcpy(p_clcb->bda, bda, BD_ADDR_LEN);
134126 p_clcb->pending_req_q = fixed_queue_new(SIZE_MAX);
135- break;
127+ return p_clcb;
136128 }
137129 }
138- return p_clcb;
130+ return NULL;
139131 }
140132
141133 /*******************************************************************************
@@ -684,8 +676,7 @@ bool gap_ble_accept_cl_operation(BD_ADDR peer_bda, uint16_t uuid,
684676 BT_TRANSPORT_LE))
685677 p_clcb->connected = true;
686678
687- /* hold the link here */
688- if (!GATT_Connect(gap_cb.gatt_if, p_clcb->bda, true, BT_TRANSPORT_LE, false))
679+ if (!GATT_Connect(gap_cb.gatt_if, p_clcb->bda, true, BT_TRANSPORT_LE, true))
689680 return started;
690681
691682 /* enqueue the request */
--- a/stack/include/mca_api.h
+++ b/stack/include/mca_api.h
@@ -511,4 +511,43 @@ extern tMCA_RESULT MCA_WriteReq(tMCA_DL mdl, BT_HDR* p_pkt);
511511 ******************************************************************************/
512512 extern uint16_t MCA_GetL2CapChannel(tMCA_DL mdl);
513513
514+/**
515+ * The following definitions are for test interface only, they mirror function
516+ * definitions above. This struct allows an external application to load and
517+ * call these methods without linking against the core library.
518+ */
519+typedef struct {
520+ size_t size;
521+ void (*init)(void);
522+ tMCA_HANDLE (*register_application)(tMCA_REG* p_reg,
523+ tMCA_CTRL_CBACK* p_cback);
524+ void (*deregister_application)(tMCA_HANDLE handle);
525+ tMCA_RESULT (*create_mdep)(tMCA_HANDLE handle, tMCA_DEP* p_dep,
526+ tMCA_CS* p_cs);
527+ tMCA_RESULT (*delete_mdep)(tMCA_HANDLE handle, tMCA_DEP dep);
528+ tMCA_RESULT (*connect_mcl)(tMCA_HANDLE handle, BD_ADDR bd_addr,
529+ uint16_t ctrl_psm, uint16_t sec_mask);
530+ tMCA_RESULT (*disconnect_mcl)(tMCA_CL mcl);
531+ tMCA_RESULT (*create_mdl_request)(tMCA_CL mcl, tMCA_DEP dep,
532+ uint16_t data_psm, uint16_t mdl_id,
533+ uint8_t peer_dep_id, uint8_t cfg,
534+ const tMCA_CHNL_CFG* p_chnl_cfg);
535+ tMCA_RESULT (*create_mdl_response)(tMCA_CL mcl, tMCA_DEP dep, uint16_t mdl_id,
536+ uint8_t cfg, uint8_t rsp_code,
537+ const tMCA_CHNL_CFG* p_chnl_cfg);
538+ tMCA_RESULT (*close_mdl_request)(tMCA_DL mdl);
539+ tMCA_RESULT (*reconnect_mdl_request)(tMCA_CL mcl, tMCA_DEP dep,
540+ uint16_t data_psm, uint16_t mdl_id,
541+ const tMCA_CHNL_CFG* p_chnl_cfg);
542+ tMCA_RESULT (*reconnect_mdl_response)(tMCA_CL mcl, tMCA_DEP dep,
543+ uint16_t mdl_id, uint8_t rsp_code,
544+ const tMCA_CHNL_CFG* p_chnl_cfg);
545+ tMCA_RESULT (*data_channel_config)(tMCA_CL mcl,
546+ const tMCA_CHNL_CFG* p_chnl_cfg);
547+ tMCA_RESULT (*abort_mdl)(tMCA_CL mcl);
548+ tMCA_RESULT (*delete_mdl)(tMCA_CL mcl, uint16_t mdl_id);
549+ tMCA_RESULT (*write_mdl)(tMCA_DL mdl, BT_HDR* p_pkt);
550+ uint16_t (*get_l2cap_channel)(tMCA_DL mdl);
551+} btmcap_test_interface_t;
552+
514553 #endif /* MCA_API_H */
--- a/stack/mcap/mca_api.cc
+++ b/stack/mcap/mca_api.cc
@@ -827,3 +827,29 @@ uint16_t MCA_GetL2CapChannel(tMCA_DL mdl) {
827827 if (p_dcb) lcid = p_dcb->lcid;
828828 return lcid;
829829 }
830+
831+static const btmcap_test_interface_t mcap_test_interface = {
832+ sizeof(btmcap_test_interface_t),
833+ MCA_Init,
834+ MCA_Register,
835+ MCA_Deregister,
836+ MCA_CreateDep,
837+ MCA_DeleteDep,
838+ MCA_ConnectReq,
839+ MCA_DisconnectReq,
840+ MCA_CreateMdl,
841+ MCA_CreateMdlRsp,
842+ MCA_CloseReq,
843+ MCA_ReconnectMdl,
844+ MCA_ReconnectMdlRsp,
845+ MCA_DataChnlCfg,
846+ MCA_Abort,
847+ MCA_Delete,
848+ MCA_WriteReq,
849+ MCA_GetL2CapChannel,
850+};
851+
852+const btmcap_test_interface_t* stack_mcap_get_interface(void) {
853+ BTIF_TRACE_EVENT("%s", __func__);
854+ return &mcap_test_interface;
855+}