diff --git a/system/bta/dm/bta_dm_act.cc b/system/bta/dm/bta_dm_act.cc index a1e35a024bece8dc55d085303ad589bd3c6dbb9b..b9fbe2dceccf98883287f72bcef64748e2437ba8 100644 --- a/system/bta/dm/bta_dm_act.cc +++ b/system/bta/dm/bta_dm_act.cc @@ -1145,7 +1145,8 @@ void bta_dm_sdp_result(tBTA_DM_MSG* p_data) { BD_NAME_LEN + 1); result.disc_ble_res.services = &gatt_uuids; - bta_dm_search_cb.p_search_cback(BTA_DM_DISC_BLE_RES_EVT, &result); + bta_dm_search_cb.p_search_cback(BTA_DM_GATT_OVER_SDP_RES_EVT, + &result); } } else { /* SDP_DB_FULL means some records with the @@ -1373,7 +1374,7 @@ void bta_dm_search_cmpl() { LOG_INFO("GATT services discovered using LE Transport"); // send all result back to app - bta_dm_search_cb.p_search_cback(BTA_DM_DISC_BLE_RES_EVT, &result); + bta_dm_search_cb.p_search_cback(BTA_DM_GATT_OVER_LE_RES_EVT, &result); bta_dm_search_cb.p_search_cback(BTA_DM_DISC_CMPL_EVT, nullptr); diff --git a/system/bta/include/bta_api.h b/system/bta/include/bta_api.h index 2dd88043b711225cb432b2c5aba1887b2aa18508..0a70e978ffb1d07cea564e78d9848ab842266f3f 100644 --- a/system/bta/include/bta_api.h +++ b/system/bta/include/bta_api.h @@ -430,11 +430,12 @@ typedef void(tBTA_DM_SEC_CBACK)(tBTA_DM_SEC_EVT event, tBTA_DM_SEC* p_data); #define BTA_DM_INQ_RES_EVT 0 /* Inquiry result for a peer device. */ #define BTA_DM_INQ_CMPL_EVT 1 /* Inquiry complete. */ #define BTA_DM_DISC_RES_EVT 2 /* Discovery result for a peer device. */ -#define BTA_DM_DISC_BLE_RES_EVT \ - 3 /* Discovery result for BLE GATT based servoce on a peer device. */ +#define BTA_DM_GATT_OVER_LE_RES_EVT \ + 3 /* GATT services over LE transport discovered */ #define BTA_DM_DISC_CMPL_EVT 4 /* Discovery complete. */ #define BTA_DM_SEARCH_CANCEL_CMPL_EVT 6 /* Search cancelled */ #define BTA_DM_DID_RES_EVT 7 /* Vendor/Product ID search result */ +#define BTA_DM_GATT_OVER_SDP_RES_EVT 8 /* GATT services over SDP discovered */ typedef uint8_t tBTA_DM_SEARCH_EVT; diff --git a/system/btif/src/btif_dm.cc b/system/btif/src/btif_dm.cc index 93f9554c4d00fcfbd91130a66c0e574cdd39019e..57b8c4f9e835236d73e14d37066bbbf8b7e1b616 100644 --- a/system/btif/src/btif_dm.cc +++ b/system/btif/src/btif_dm.cc @@ -1553,14 +1553,20 @@ static void btif_dm_search_services_evt(tBTA_DM_SEARCH_EVT event, /* no-op */ break; - case BTA_DM_DISC_BLE_RES_EVT: { + case BTA_DM_GATT_OVER_SDP_RES_EVT: + case BTA_DM_GATT_OVER_LE_RES_EVT: { int num_properties = 0; bt_property_t prop[2]; std::vector<uint8_t> property_value; std::set<Uuid> uuids; RawAddress& bd_addr = p_data->disc_ble_res.bd_addr; - LOG_INFO("New BLE UUIDs for %s:", bd_addr.ToString().c_str()); + if (event == BTA_DM_GATT_OVER_LE_RES_EVT) { + LOG_INFO("New GATT over LE UUIDs for %s:", bd_addr.ToString().c_str()); + } else { + LOG_INFO("New GATT over SDP UUIDs for %s:", bd_addr.ToString().c_str()); + } + for (Uuid uuid : *p_data->disc_ble_res.services) { if (btif_is_interesting_le_service(uuid)) { if (btif_should_ignore_uuid(uuid)) { @@ -1573,7 +1579,7 @@ static void btif_dm_search_services_evt(tBTA_DM_SEARCH_EVT event, } if (uuids.empty()) { - LOG_INFO("No well known BLE services discovered"); + LOG_INFO("No well known GATT services discovered"); return; } diff --git a/system/btif/src/btif_util.cc b/system/btif/src/btif_util.cc index bcd0ef96fc93a15bb766de518b2f0c5ac34ab431..00776d99fa3c5ffbe2e534e3fa5a1af980669dd6 100644 --- a/system/btif/src/btif_util.cc +++ b/system/btif/src/btif_util.cc @@ -112,9 +112,10 @@ const char* dump_dm_search_event(uint16_t event) { CASE_RETURN_STR(BTA_DM_INQ_RES_EVT) CASE_RETURN_STR(BTA_DM_INQ_CMPL_EVT) CASE_RETURN_STR(BTA_DM_DISC_RES_EVT) - CASE_RETURN_STR(BTA_DM_DISC_BLE_RES_EVT) + CASE_RETURN_STR(BTA_DM_GATT_OVER_LE_RES_EVT) CASE_RETURN_STR(BTA_DM_DISC_CMPL_EVT) CASE_RETURN_STR(BTA_DM_SEARCH_CANCEL_CMPL_EVT) + CASE_RETURN_STR(BTA_DM_GATT_OVER_SDP_RES_EVT) default: return "UNKNOWN MSG ID"; diff --git a/system/btif/test/btif_core_test.cc b/system/btif/test/btif_core_test.cc index da56b00b0ddada6d6bc4d222a7301eb8c4dc1366..57eed2e8c39199dd68e64ab58e21eaf36f00f8d9 100644 --- a/system/btif/test/btif_core_test.cc +++ b/system/btif/test/btif_core_test.cc @@ -227,10 +227,13 @@ TEST_F(BtifCoreTest, dump_dm_search_event) { std::make_pair(BTA_DM_INQ_RES_EVT, "BTA_DM_INQ_RES_EVT"), std::make_pair(BTA_DM_INQ_CMPL_EVT, "BTA_DM_INQ_CMPL_EVT"), std::make_pair(BTA_DM_DISC_RES_EVT, "BTA_DM_DISC_RES_EVT"), - std::make_pair(BTA_DM_DISC_BLE_RES_EVT, "BTA_DM_DISC_BLE_RES_EVT"), + std::make_pair(BTA_DM_GATT_OVER_LE_RES_EVT, + "BTA_DM_GATT_OVER_LE_RES_EVT"), std::make_pair(BTA_DM_DISC_CMPL_EVT, "BTA_DM_DISC_CMPL_EVT"), std::make_pair(BTA_DM_SEARCH_CANCEL_CMPL_EVT, "BTA_DM_SEARCH_CANCEL_CMPL_EVT"), + std::make_pair(BTA_DM_GATT_OVER_SDP_RES_EVT, + "BTA_DM_GATT_OVER_SDP_RES_EVT"), }; for (const auto& event : events) { ASSERT_STREQ(event.second.c_str(), dump_dm_search_event(event.first));