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

Commit 6ed81793 authored by Łukasz Rymanowski's avatar Łukasz Rymanowski
Browse files

csis: Add support for getting list of devices per group

This is needed by native modules which are using CSIS groups for some actions e.g. VC

Bug: 150670922
Tag: #feature
Sponsor: jpawlowski@
Test: atest --host bluetooth_csis_test

Change-Id: I328cf99f8899760733e4a0ee116c8e5b3dba1ba8
parent fcea2ba9
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -400,6 +400,21 @@ class CsisClientImpl : public CsisClient {
    if (cb) std::move(cb).Run(group_id, lock, status);
  }

  std::vector<RawAddress> GetDeviceList(int group_id) override {
    std::vector<RawAddress> result;
    auto csis_group = FindCsisGroup(group_id);

    if (!csis_group || csis_group->IsEmpty()) return result;

    auto csis_device = csis_group->GetFirstDevice();
    while (csis_device) {
      result.push_back(csis_device->addr);
      csis_device = csis_group->GetNextDevice(csis_device);
    }

    return result;
  }

  void LockGroup(int group_id, bool lock, CsisLockCb cb) override {
    if (lock)
      DLOG(INFO) << __func__ << " Locking group: " << int(group_id);
+1 −0
Original line number Diff line number Diff line
@@ -46,6 +46,7 @@ class CsisClient {
      const RawAddress& addr,
      bluetooth::Uuid uuid = bluetooth::groups::kGenericContextUuid) = 0;
  virtual void LockGroup(int group_id, bool lock, CsisLockCb cb) = 0;
  virtual std::vector<RawAddress> GetDeviceList(int group_id) = 0;
};
}  // namespace csis
}  // namespace bluetooth
+2 −0
Original line number Diff line number Diff line
@@ -31,6 +31,8 @@ class MockCsisClient : public bluetooth::csis::CsisClient {
  MOCK_METHOD((void), LockGroup,
              (const int group_id, bool lock, bluetooth::csis::CsisLockCb cb),
              (override));
  MOCK_METHOD((std::vector<RawAddress>), GetDeviceList, (int group_id),
              (override));

  /* Called from static methods */
  MOCK_METHOD((void), Initialize,