Loading system/bta/dm/bta_dm_disc.cc +24 −29 Original line number Diff line number Diff line Loading @@ -371,6 +371,20 @@ static void bta_dm_store_audio_profiles_version(tSDP_DISCOVERY_DB* p_sdp_db) { } } void sdp_finished(RawAddress bda, tBTA_STATUS result, tBTA_SERVICE_MASK services, std::vector<bluetooth::Uuid> uuids = {}, std::vector<bluetooth::Uuid> gatt_uuids = {}) { bta_dm_disc_sm_execute(BTA_DM_DISCOVERY_RESULT_EVT, std::make_unique<tBTA_DM_MSG>(tBTA_DM_SVC_RES{ .bd_addr = bda, .services = services, .uuids = uuids, .gatt_uuids = gatt_uuids, .result = result, })); } static void bta_dm_sdp_result(tSDP_STATUS sdp_result, tBTA_DM_SDP_STATE* sdp_state); Loading Loading @@ -505,12 +519,6 @@ static void bta_dm_sdp_result(tSDP_STATUS sdp_result, sdp_state->services_found, sdp_state->service_index)); auto msg = std::make_unique<tBTA_DM_MSG>(tBTA_DM_SVC_RES{}); auto& disc_result = std::get<tBTA_DM_SVC_RES>(*msg); disc_result.result = BTA_SUCCESS; disc_result.uuids = std::move(uuid_list); disc_result.gatt_uuids = std::move(gatt_uuids); // Copy the raw_data to the discovery result structure if (p_sdp_db != NULL && p_sdp_db->raw_used != 0 && p_sdp_db->raw_data != NULL) { Loading @@ -524,19 +532,20 @@ static void bta_dm_sdp_result(tSDP_STATUS sdp_result, } else { log::verbose("raw data size is 0 or raw_data is null!!"); } disc_result.services = sdp_state->services_found; tBTA_STATUS result = BTA_SUCCESS; auto services = sdp_state->services_found; // Piggy back the SCN over result field if (scn_found) { disc_result.result = static_cast<tBTA_STATUS>((3 + sdp_state->peer_scn)); disc_result.services |= BTA_USER_SERVICE_MASK; result = static_cast<tBTA_STATUS>((3 + sdp_state->peer_scn)); services |= BTA_USER_SERVICE_MASK; log::verbose("Piggy back the SCN over result field SCN={}", sdp_state->peer_scn); } disc_result.bd_addr = bta_dm_discovery_cb.peer_bdaddr; bta_dm_disc_sm_execute(BTA_DM_DISCOVERY_RESULT_EVT, std::move(msg)); sdp_finished(bta_dm_discovery_cb.peer_bdaddr, result, services, uuid_list, gatt_uuids); } else { BTM_LogHistory( kBtmLogTag, bta_dm_discovery_cb.peer_bdaddr, "Discovery failed", Loading @@ -544,14 +553,8 @@ static void bta_dm_sdp_result(tSDP_STATUS sdp_result, log::error("SDP connection failed {}", sdp_status_text(sdp_result)); /* not able to connect go to next device */ auto msg = std::make_unique<tBTA_DM_MSG>(tBTA_DM_SVC_RES{}); auto& disc_result = std::get<tBTA_DM_SVC_RES>(*msg); disc_result.result = BTA_FAILURE; disc_result.services = sdp_state->services_found; disc_result.bd_addr = bta_dm_discovery_cb.peer_bdaddr; bta_dm_disc_sm_execute(BTA_DM_DISCOVERY_RESULT_EVT, std::move(msg)); sdp_finished(bta_dm_discovery_cb.peer_bdaddr, BTA_FAILURE, sdp_state->services_found); } } Loading Loading @@ -670,11 +673,7 @@ static void bta_dm_find_services(const RawAddress& bd_addr, /* no more services to be discovered */ if (sdp_state->service_index >= BTA_MAX_SERVICE_ID) { log::info("SDP - no more services to discover"); bta_dm_disc_sm_execute(BTA_DM_DISCOVERY_RESULT_EVT, std::make_unique<tBTA_DM_MSG>(tBTA_DM_SVC_RES{ .bd_addr = bta_dm_discovery_cb.peer_bdaddr, .services = sdp_state->services_found, .result = BTA_SUCCESS})); sdp_finished(bd_addr, BTA_SUCCESS, sdp_state->services_found); return; } Loading Loading @@ -712,11 +711,7 @@ static void bta_dm_find_services(const RawAddress& bd_addr, bd_addr); sdp_state->service_index = BTA_MAX_SERVICE_ID; bta_dm_disc_sm_execute(BTA_DM_DISCOVERY_RESULT_EVT, std::make_unique<tBTA_DM_MSG>(tBTA_DM_SVC_RES{ .bd_addr = bta_dm_discovery_cb.peer_bdaddr, .services = sdp_state->services_found, .result = BTA_SUCCESS})); sdp_finished(bd_addr, BTA_SUCCESS, sdp_state->services_found); return; } Loading system/bta/test/bta_sdp_test.cc +0 −9 Original line number Diff line number Diff line Loading @@ -19,7 +19,6 @@ #include "bta/dm/bta_dm_disc_int.h" #include "bta/test/bta_test_fixtures.h" #include "osi/include/allocator.h" void BTA_dm_on_hw_on(); void BTA_dm_on_hw_off(); Loading Loading @@ -51,14 +50,6 @@ class BtaSdpRegisteredTest : public BtaSdpTest { void SetUp() override { BtaSdpTest::SetUp(); } void TearDown() override { BtaSdpTest::TearDown(); } tBTA_SYS_REG bta_sys_reg = { .evt_hdlr = [](const BT_HDR_RIGID* p_msg) -> bool { osi_free((void*)p_msg); return false; }, .disable = []() {}, }; }; TEST_F(BtaSdpTest, nop) {} Loading Loading
system/bta/dm/bta_dm_disc.cc +24 −29 Original line number Diff line number Diff line Loading @@ -371,6 +371,20 @@ static void bta_dm_store_audio_profiles_version(tSDP_DISCOVERY_DB* p_sdp_db) { } } void sdp_finished(RawAddress bda, tBTA_STATUS result, tBTA_SERVICE_MASK services, std::vector<bluetooth::Uuid> uuids = {}, std::vector<bluetooth::Uuid> gatt_uuids = {}) { bta_dm_disc_sm_execute(BTA_DM_DISCOVERY_RESULT_EVT, std::make_unique<tBTA_DM_MSG>(tBTA_DM_SVC_RES{ .bd_addr = bda, .services = services, .uuids = uuids, .gatt_uuids = gatt_uuids, .result = result, })); } static void bta_dm_sdp_result(tSDP_STATUS sdp_result, tBTA_DM_SDP_STATE* sdp_state); Loading Loading @@ -505,12 +519,6 @@ static void bta_dm_sdp_result(tSDP_STATUS sdp_result, sdp_state->services_found, sdp_state->service_index)); auto msg = std::make_unique<tBTA_DM_MSG>(tBTA_DM_SVC_RES{}); auto& disc_result = std::get<tBTA_DM_SVC_RES>(*msg); disc_result.result = BTA_SUCCESS; disc_result.uuids = std::move(uuid_list); disc_result.gatt_uuids = std::move(gatt_uuids); // Copy the raw_data to the discovery result structure if (p_sdp_db != NULL && p_sdp_db->raw_used != 0 && p_sdp_db->raw_data != NULL) { Loading @@ -524,19 +532,20 @@ static void bta_dm_sdp_result(tSDP_STATUS sdp_result, } else { log::verbose("raw data size is 0 or raw_data is null!!"); } disc_result.services = sdp_state->services_found; tBTA_STATUS result = BTA_SUCCESS; auto services = sdp_state->services_found; // Piggy back the SCN over result field if (scn_found) { disc_result.result = static_cast<tBTA_STATUS>((3 + sdp_state->peer_scn)); disc_result.services |= BTA_USER_SERVICE_MASK; result = static_cast<tBTA_STATUS>((3 + sdp_state->peer_scn)); services |= BTA_USER_SERVICE_MASK; log::verbose("Piggy back the SCN over result field SCN={}", sdp_state->peer_scn); } disc_result.bd_addr = bta_dm_discovery_cb.peer_bdaddr; bta_dm_disc_sm_execute(BTA_DM_DISCOVERY_RESULT_EVT, std::move(msg)); sdp_finished(bta_dm_discovery_cb.peer_bdaddr, result, services, uuid_list, gatt_uuids); } else { BTM_LogHistory( kBtmLogTag, bta_dm_discovery_cb.peer_bdaddr, "Discovery failed", Loading @@ -544,14 +553,8 @@ static void bta_dm_sdp_result(tSDP_STATUS sdp_result, log::error("SDP connection failed {}", sdp_status_text(sdp_result)); /* not able to connect go to next device */ auto msg = std::make_unique<tBTA_DM_MSG>(tBTA_DM_SVC_RES{}); auto& disc_result = std::get<tBTA_DM_SVC_RES>(*msg); disc_result.result = BTA_FAILURE; disc_result.services = sdp_state->services_found; disc_result.bd_addr = bta_dm_discovery_cb.peer_bdaddr; bta_dm_disc_sm_execute(BTA_DM_DISCOVERY_RESULT_EVT, std::move(msg)); sdp_finished(bta_dm_discovery_cb.peer_bdaddr, BTA_FAILURE, sdp_state->services_found); } } Loading Loading @@ -670,11 +673,7 @@ static void bta_dm_find_services(const RawAddress& bd_addr, /* no more services to be discovered */ if (sdp_state->service_index >= BTA_MAX_SERVICE_ID) { log::info("SDP - no more services to discover"); bta_dm_disc_sm_execute(BTA_DM_DISCOVERY_RESULT_EVT, std::make_unique<tBTA_DM_MSG>(tBTA_DM_SVC_RES{ .bd_addr = bta_dm_discovery_cb.peer_bdaddr, .services = sdp_state->services_found, .result = BTA_SUCCESS})); sdp_finished(bd_addr, BTA_SUCCESS, sdp_state->services_found); return; } Loading Loading @@ -712,11 +711,7 @@ static void bta_dm_find_services(const RawAddress& bd_addr, bd_addr); sdp_state->service_index = BTA_MAX_SERVICE_ID; bta_dm_disc_sm_execute(BTA_DM_DISCOVERY_RESULT_EVT, std::make_unique<tBTA_DM_MSG>(tBTA_DM_SVC_RES{ .bd_addr = bta_dm_discovery_cb.peer_bdaddr, .services = sdp_state->services_found, .result = BTA_SUCCESS})); sdp_finished(bd_addr, BTA_SUCCESS, sdp_state->services_found); return; } Loading
system/bta/test/bta_sdp_test.cc +0 −9 Original line number Diff line number Diff line Loading @@ -19,7 +19,6 @@ #include "bta/dm/bta_dm_disc_int.h" #include "bta/test/bta_test_fixtures.h" #include "osi/include/allocator.h" void BTA_dm_on_hw_on(); void BTA_dm_on_hw_off(); Loading Loading @@ -51,14 +50,6 @@ class BtaSdpRegisteredTest : public BtaSdpTest { void SetUp() override { BtaSdpTest::SetUp(); } void TearDown() override { BtaSdpTest::TearDown(); } tBTA_SYS_REG bta_sys_reg = { .evt_hdlr = [](const BT_HDR_RIGID* p_msg) -> bool { osi_free((void*)p_msg); return false; }, .disable = []() {}, }; }; TEST_F(BtaSdpTest, nop) {} Loading