Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b938d728 authored by Jakub Pawlowski's avatar Jakub Pawlowski
Browse files

Report proper advertiser status on registration error

When advertiser is not started because too many advertisers are
registered, return proper error code.

Bug: 30622771
Test: sl4a ConcurrentBleAdvertisingTest
Change-Id: Ie8a94b964170edbbf1c56f39b03ad98f745a4861
parent 85defca0
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -173,7 +173,7 @@ class BleAdvertisingManagerImpl
    }

    LOG(INFO) << "no free advertiser instance";
    cb.Run(0xFF, BTM_BLE_MULTI_ADV_FAILURE);
    cb.Run(0xFF, ADVERTISE_FAILED_TOO_MANY_ADVERTISERS);
  }

  void StartAdvertising(uint8_t advertiser_id, MultiAdvCb cb,
+1 −0
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@

#define BTM_BLE_MULTI_ADV_SUCCESS 0
#define BTM_BLE_MULTI_ADV_FAILURE 1
#define ADVERTISE_FAILED_TOO_MANY_ADVERTISERS 0x02

using MultiAdvCb = base::Callback<void(uint8_t /* status */)>;

+1 −1
Original line number Diff line number Diff line
@@ -155,7 +155,7 @@ TEST_F(BleAdvertisingManagerTest, test_registration) {
  // This call should return an error - no more advertisers left.
  BleAdvertisingManager::Get()->RegisterAdvertiser(base::Bind(
      &BleAdvertisingManagerTest::RegistrationCb, base::Unretained(this)));
  EXPECT_EQ(BTM_BLE_MULTI_ADV_FAILURE, reg_status);
  EXPECT_EQ(ADVERTISE_FAILED_TOO_MANY_ADVERTISERS, reg_status);
  // Don't bother checking inst_id, it doesn't matter

  // This will currently trigger a mock message about a call to Enable(). This