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

Commit ecd0ea7c authored by Jakub Pawlowski's avatar Jakub Pawlowski Committed by android-build-merger
Browse files

Expose LE advertiser address for easier PTS tests (4/6)

am: 7968d0e1

Change-Id: Ic8fc5e79e6f74aaf778b0c5e39e2308dceb583be
parents c98fa505 7968d0e1
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -107,6 +107,13 @@ class BleAdvertiserInterfaceImpl : public BleAdvertiserInterface {
             base::Unretained(BleAdvertisingManager::Get()), advertiser_id));
  }

  void GetOwnAddress(uint8_t advertiser_id, GetAddressCallback cb) override {
    do_in_bta_thread(FROM_HERE,
                     Bind(&BleAdvertisingManager::GetOwnAddress,
                          base::Unretained(BleAdvertisingManager::Get()),
                          advertiser_id, jni_thread_wrapper(FROM_HERE, cb)));
  }

  void SetParameters(uint8_t advertiser_id, AdvertiseParameters params,
                     ParametersCallback cb) override {
    VLOG(1) << __func__;
+1 −0
Original line number Diff line number Diff line
@@ -47,6 +47,7 @@ class MockAdvertiserHandler : public BleAdvertiserInterface {

  MOCK_METHOD1(RegisterAdvertiser, void(IdStatusCallback));
  MOCK_METHOD1(Unregister, void(uint8_t));
  MOCK_METHOD2(GetOwnAddress, void(uint8_t, GetAddressCallback));
  MOCK_METHOD3(SetParameters,
               void(uint8_t, AdvertiseParameters, ParametersCallback));
  MOCK_METHOD4(SetData, void(int, bool, std::vector<uint8_t>, StatusCallback));
+6 −0
Original line number Diff line number Diff line
@@ -160,6 +160,12 @@ class BleAdvertisingManagerImpl

  ~BleAdvertisingManagerImpl() { adv_inst.clear(); }

  void GetOwnAddress(uint8_t inst_id, GetAddressCallback cb) override {
    bt_bdaddr_t addr;
    memcpy(addr.address, adv_inst[inst_id].own_address, BD_ADDR_LEN);
    cb.Run(adv_inst[inst_id].own_address_type, addr);
  }

  void ReadInstanceCountCb(uint8_t instance_count) {
    this->inst_count = instance_count;
    adv_inst.reserve(inst_count);
+4 −0
Original line number Diff line number Diff line
@@ -150,6 +150,10 @@ class BleAdvertisingManager {
  virtual void OnAdvertisingSetTerminated(
      uint8_t status, uint8_t advertising_handle, uint16_t connection_handle,
      uint8_t num_completed_extended_adv_events) = 0;

  using GetAddressCallback =
      base::Callback<void(uint8_t /* address_type*/, bt_bdaddr_t /*address*/)>;
  virtual void GetOwnAddress(uint8_t inst_id, GetAddressCallback cb) = 0;
};

#endif  // BLE_ADVERTISER_H