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

Commit 6cfac25e authored by Jakub Pawlowski's avatar Jakub Pawlowski Committed by Gerrit Code Review
Browse files

Merge changes Ib6036060,I328cf99f

* changes:
  csis: Make sure device list is ordered
  csis: Add support for getting list of devices per group
parents 91c70e5a 80e74979
Loading
Loading
Loading
Loading
+17 −1
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);
@@ -455,7 +470,6 @@ class CsisClientImpl : public CsisClient {
      return;
    }

    csis_group->SortByCsisRank();
    csis_group->SetTargetLockState(new_lock_state, std::move(cb));

    if (lock) {
@@ -986,6 +1000,8 @@ class CsisClientImpl : public CsisClient {
    }

    csis_instance->SetRank((value[0]));
    auto csis_group = FindCsisGroup(csis_instance->GetGroupId());
    csis_group->SortByCsisRank();
  }

  void OnCsisObserveCompleted(void) {
+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,