system/bt
Revision | 1095bf35c437306d42987be344d67da29cb82dcd (tree) |
---|---|
Zeit | 2019-05-30 16:00:51 |
Autor | weichinweng <weichinweng@goog...> |
Commiter | android-build-merger |
Merge "Open connection if it doesn't exsist in bta_gattc_process_indicate" into qt-dev
am: 8c3e9415af
Change-Id: I7bc7abd759f0ef495a592998f205da7a720d732f
@@ -1240,6 +1240,20 @@ void bta_gattc_process_indicate(uint16_t conn_id, tGATTC_OPTYPE op, | ||
1240 | 1240 | } |
1241 | 1241 | |
1242 | 1242 | tBTA_GATTC_CLCB* p_clcb = bta_gattc_find_clcb_by_conn_id(conn_id); |
1243 | + /* connection not open yet */ | |
1244 | + if (p_clcb == NULL) { | |
1245 | + p_clcb = bta_gattc_clcb_alloc(gatt_if, remote_bda, transport); | |
1246 | + | |
1247 | + if (p_clcb == NULL) { | |
1248 | + LOG(ERROR) << __func__ << ": No resources"; | |
1249 | + return; | |
1250 | + } | |
1251 | + | |
1252 | + p_clcb->bta_conn_id = conn_id; | |
1253 | + p_clcb->transport = transport; | |
1254 | + | |
1255 | + bta_gattc_sm_execute(p_clcb, BTA_GATTC_INT_CONN_EVT, NULL); | |
1256 | + } | |
1243 | 1257 | |
1244 | 1258 | notify.handle = handle; |
1245 | 1259 |
@@ -1250,21 +1264,6 @@ void bta_gattc_process_indicate(uint16_t conn_id, tGATTC_OPTYPE op, | ||
1250 | 1264 | |
1251 | 1265 | /* if app registered for the notification */ |
1252 | 1266 | if (bta_gattc_check_notif_registry(p_clrcb, p_srcb, ¬ify)) { |
1253 | - /* connection not open yet */ | |
1254 | - if (p_clcb == NULL) { | |
1255 | - p_clcb = bta_gattc_clcb_alloc(gatt_if, remote_bda, transport); | |
1256 | - | |
1257 | - if (p_clcb == NULL) { | |
1258 | - LOG(ERROR) << "No resources"; | |
1259 | - return; | |
1260 | - } | |
1261 | - | |
1262 | - p_clcb->bta_conn_id = conn_id; | |
1263 | - p_clcb->transport = transport; | |
1264 | - | |
1265 | - bta_gattc_sm_execute(p_clcb, BTA_GATTC_INT_CONN_EVT, NULL); | |
1266 | - } | |
1267 | - | |
1268 | 1267 | if (p_clcb != NULL) |
1269 | 1268 | bta_gattc_proc_other_indication(p_clcb, op, p_data, ¬ify); |
1270 | 1269 | } |