• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
Aucun tag

Frequently used words (click to add to your profile)

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

system/bt


Commit MetaInfo

Révisiond8cdc6c2b802fbc0c5a5b4f1599a9e6d911e74b9 (tree)
l'heure2019-06-12 16:29:52
Auteurweichinweng <weichinweng@goog...>
Commiterweichinweng

Message de Log

Load gatt_database if it is empty in bta_gattc_process_indicate

If Service Changed indication is received but gatt_database is empty,
will try to load database from storage.

Bug: 131814072
Bug: 134994428
Test: 1.CTS Bluetooth LE Secure Test. 2.Unit test.
3. Pair BLE device via APP. 4. Pair device via Bluetooth Setting

Change-Id: Id3f3f0f33d5e0469a6f2ac6612fa9f5ea0b24142
Merged-In: Id3f3f0f33d5e0469a6f2ac6612fa9f5ea0b24142

Change Summary

Modification

--- a/bta/gatt/bta_gattc_act.cc
+++ b/bta/gatt/bta_gattc_act.cc
@@ -478,7 +478,7 @@ void bta_gattc_conn(tBTA_GATTC_CLCB* p_clcb, tBTA_GATTC_DATA* p_data) {
478478 p_clcb->p_srcb->state != BTA_GATTC_SERV_IDLE) {
479479 if (p_clcb->p_srcb->state == BTA_GATTC_SERV_IDLE) {
480480 p_clcb->p_srcb->state = BTA_GATTC_SERV_LOAD;
481- if (bta_gattc_cache_load(p_clcb)) {
481+ if (bta_gattc_cache_load(p_clcb->p_srcb)) {
482482 p_clcb->p_srcb->state = BTA_GATTC_SERV_IDLE;
483483 bta_gattc_reset_discover_st(p_clcb->p_srcb, GATT_SUCCESS);
484484 } else {
@@ -1127,6 +1127,10 @@ bool bta_gattc_process_srvc_chg_ind(uint16_t conn_id, tBTA_GATTC_RCB* p_clrcb,
11271127 Uuid gattp_uuid = Uuid::From16Bit(UUID_SERVCLASS_GATT_SERVER);
11281128 Uuid srvc_chg_uuid = Uuid::From16Bit(GATT_UUID_GATT_SRV_CHGD);
11291129
1130+ if (p_srcb->gatt_database.IsEmpty() && p_srcb->state == BTA_GATTC_SERV_IDLE) {
1131+ bta_gattc_cache_load(p_srcb);
1132+ }
1133+
11301134 const gatt::Characteristic* p_char =
11311135 bta_gattc_get_characteristic_srcb(p_srcb, p_notify->handle);
11321136 if (!p_char) return false;
--- a/bta/gatt/bta_gattc_cache.cc
+++ b/bta/gatt/bta_gattc_cache.cc
@@ -703,15 +703,14 @@ void bta_gattc_get_gatt_db(uint16_t conn_id, uint16_t start_handle,
703703 *
704704 * Description Load GATT cache from storage for server.
705705 *
706- * Parameter p_clcb: pointer to server clcb, that will
706+ * Parameter p_srcb: pointer to server cache, that will
707707 * be filled from storage
708708 * Returns true on success, false otherwise
709709 *
710710 ******************************************************************************/
711-bool bta_gattc_cache_load(tBTA_GATTC_CLCB* p_clcb) {
711+bool bta_gattc_cache_load(tBTA_GATTC_SERV* p_srcb) {
712712 char fname[255] = {0};
713- bta_gattc_generate_cache_file_name(fname, sizeof(fname),
714- p_clcb->p_srcb->server_bda);
713+ bta_gattc_generate_cache_file_name(fname, sizeof(fname), p_srcb->server_bda);
715714
716715 FILE* fd = fopen(fname, "rb");
717716 if (!fd) {
@@ -748,7 +747,7 @@ bool bta_gattc_cache_load(tBTA_GATTC_CLCB* p_clcb) {
748747 goto done;
749748 }
750749
751- p_clcb->p_srcb->gatt_database = gatt::Database::Deserialize(attr, &success);
750+ p_srcb->gatt_database = gatt::Database::Deserialize(attr, &success);
752751 }
753752
754753 done:
--- a/bta/gatt/bta_gattc_int.h
+++ b/bta/gatt/bta_gattc_int.h
@@ -451,7 +451,7 @@ extern tBTA_GATTC_CONN* bta_gattc_conn_find(const RawAddress& remote_bda);
451451 extern tBTA_GATTC_CONN* bta_gattc_conn_find_alloc(const RawAddress& remote_bda);
452452 extern bool bta_gattc_conn_dealloc(const RawAddress& remote_bda);
453453
454-extern bool bta_gattc_cache_load(tBTA_GATTC_CLCB* p_clcb);
454+extern bool bta_gattc_cache_load(tBTA_GATTC_SERV* p_srcb);
455455 extern void bta_gattc_cache_reset(const RawAddress& server_bda);
456456
457457 #endif /* BTA_GATTC_INT_H */