From cdc401ff4941ed8b509d7251b4c8db6d6655f12a Mon Sep 17 00:00:00 2001 From: Ben Date: Fri, 8 Nov 2024 18:08:20 +0000 Subject: [PATCH] pw_bluetooth_sapphire: Remove Adapter::LowEnergy::StopAdvertising MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adapter::LowEnergy::StopAdvertising has been unused for some time since AdvertisementInstance was introduced. Change-Id: Id1072f51c6e159fba4688ac42c2c7f4bb07b48e4 Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/247312 Lint: Lint 🤖 Commit-Queue: Auto-Submit Reviewed-by: Lulu Wang Docs-Not-Needed: Ben Lawson Pigweed-Auto-Submit: Ben Lawson --- pw_bluetooth_sapphire/host/gap/adapter.cc | 5 ----- pw_bluetooth_sapphire/host/gap/adapter_test.cc | 8 ++++---- .../pw_bluetooth_sapphire/internal/host/gap/adapter.h | 4 ---- .../internal/host/gap/fake_adapter.h | 2 -- 4 files changed, 4 insertions(+), 15 deletions(-) diff --git a/pw_bluetooth_sapphire/host/gap/adapter.cc b/pw_bluetooth_sapphire/host/gap/adapter.cc index e17a96f83..32bfb80b2 100644 --- a/pw_bluetooth_sapphire/host/gap/adapter.cc +++ b/pw_bluetooth_sapphire/host/gap/adapter.cc @@ -180,11 +180,6 @@ class AdapterImpl final : public Adapter { adapter_->metrics_.le.start_advertising_events.Add(); } - void StopAdvertising(AdvertisementId advertisement_id) override { - adapter_->le_advertising_manager_->StopAdvertising(advertisement_id); - adapter_->metrics_.le.stop_advertising_events.Add(); - } - void StartDiscovery(bool active, SessionCallback callback) override { adapter_->le_discovery_manager_->StartDiscovery(active, std::move(callback)); diff --git a/pw_bluetooth_sapphire/host/gap/adapter_test.cc b/pw_bluetooth_sapphire/host/gap/adapter_test.cc index 05f47abbc..23bc2b933 100644 --- a/pw_bluetooth_sapphire/host/gap/adapter_test.cc +++ b/pw_bluetooth_sapphire/host/gap/adapter_test.cc @@ -662,7 +662,7 @@ TEST_F(AdapterTest, LocalAddressForLegacyAdvertising) { test_device()->set_settings(settings); InitializeAdapter([](bool) {}); - AdvertisementInstance instance; + std::optional instance; auto adv_cb = [&](auto i, hci::Result<> status) { instance = std::move(i); EXPECT_EQ(fit::ok(), status); @@ -691,7 +691,7 @@ TEST_F(AdapterTest, LocalAddressForLegacyAdvertising) { EXPECT_FALSE(test_device()->legacy_advertising_state().random_address); // Stop advertising. - adapter()->le()->StopAdvertising(instance.id()); + instance.reset(); RunUntilIdle(); EXPECT_FALSE(test_device()->legacy_advertising_state().enabled); EXPECT_FALSE(test_device()->legacy_advertising_state().random_address); @@ -722,7 +722,7 @@ TEST_F(AdapterTest, LocalAddressForLegacyAdvertising) { *test_device()->legacy_advertising_state().random_address); // Restarting advertising should refresh the controller address. - adapter()->le()->StopAdvertising(instance.id()); + instance.reset(); adapter()->le()->StartAdvertising(AdvertisingData(), AdvertisingData(), AdvertisingInterval::FAST1, @@ -743,7 +743,7 @@ TEST_F(AdapterTest, LocalAddressForLegacyAdvertising) { // Disable privacy. The next time advertising gets started it should use a // public address. adapter()->le()->EnablePrivacy(false); - adapter()->le()->StopAdvertising(instance.id()); + instance.reset(); adapter()->le()->StartAdvertising(AdvertisingData(), AdvertisingData(), AdvertisingInterval::FAST1, diff --git a/pw_bluetooth_sapphire/public/pw_bluetooth_sapphire/internal/host/gap/adapter.h b/pw_bluetooth_sapphire/public/pw_bluetooth_sapphire/internal/host/gap/adapter.h index 3549d8d9d..63b81edb7 100644 --- a/pw_bluetooth_sapphire/public/pw_bluetooth_sapphire/internal/host/gap/adapter.h +++ b/pw_bluetooth_sapphire/public/pw_bluetooth_sapphire/internal/host/gap/adapter.h @@ -242,10 +242,6 @@ class Adapter { std::optional address_type, AdvertisingStatusCallback status_callback) = 0; - // Stop advertising the advertisement with the id |advertisement_id| - // Returns true if an advertisement was stopped, and false otherwise. - virtual void StopAdvertising(AdvertisementId advertisement_id) = 0; - // Starts a new discovery session and reports the result via |callback|. If // a session has been successfully started the caller will receive a new // LowEnergyDiscoverySession instance via |callback| which it uniquely owns. diff --git a/pw_bluetooth_sapphire/public/pw_bluetooth_sapphire/internal/host/gap/fake_adapter.h b/pw_bluetooth_sapphire/public/pw_bluetooth_sapphire/internal/host/gap/fake_adapter.h index 55321912b..459faa218 100644 --- a/pw_bluetooth_sapphire/public/pw_bluetooth_sapphire/internal/host/gap/fake_adapter.h +++ b/pw_bluetooth_sapphire/public/pw_bluetooth_sapphire/internal/host/gap/fake_adapter.h @@ -115,8 +115,6 @@ class FakeAdapter final : public Adapter { std::optional address_type, AdvertisingStatusCallback status_callback) override; - void StopAdvertising(AdvertisementId advertisement_id) override {} - void StartDiscovery(bool active, SessionCallback callback) override {} void EnablePrivacy(bool enabled) override;