Skip to content

Commit

Permalink
pw_bluetooth_sapphire: Remove Adapter::LowEnergy::StopAdvertising
Browse files Browse the repository at this point in the history
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 🤖 <android-build-ayeaye@system.gserviceaccount.com>
Commit-Queue: Auto-Submit <auto-submit@pigweed-service-accounts.iam.gserviceaccount.com>
Reviewed-by: Lulu Wang <luluwang@google.com>
Docs-Not-Needed: Ben Lawson <benlawson@google.com>
Pigweed-Auto-Submit: Ben Lawson <benlawson@google.com>
  • Loading branch information
BenjaminLawson authored and CQ Bot Account committed Nov 8, 2024
1 parent a150a8d commit cdc401f
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 15 deletions.
5 changes: 0 additions & 5 deletions pw_bluetooth_sapphire/host/gap/adapter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
8 changes: 4 additions & 4 deletions pw_bluetooth_sapphire/host/gap/adapter_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -662,7 +662,7 @@ TEST_F(AdapterTest, LocalAddressForLegacyAdvertising) {
test_device()->set_settings(settings);
InitializeAdapter([](bool) {});

AdvertisementInstance instance;
std::optional<AdvertisementInstance> instance;
auto adv_cb = [&](auto i, hci::Result<> status) {
instance = std::move(i);
EXPECT_EQ(fit::ok(), status);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -242,10 +242,6 @@ class Adapter {
std::optional<DeviceAddress::Type> 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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,6 @@ class FakeAdapter final : public Adapter {
std::optional<DeviceAddress::Type> address_type,
AdvertisingStatusCallback status_callback) override;

void StopAdvertising(AdvertisementId advertisement_id) override {}

void StartDiscovery(bool active, SessionCallback callback) override {}

void EnablePrivacy(bool enabled) override;
Expand Down

0 comments on commit cdc401f

Please sign in to comment.