| 89 | } |
| 90 | |
| 91 | std::shared_ptr<Device> findDevice(const std::function<bool(const std::shared_ptr<Device>&)>& filterFunction) { |
| 92 | auto scoped_mutex = mutex.asScopedLock(); |
| 93 | scoped_mutex.lock(); |
| 94 | |
| 95 | auto result_set = getDevices() | std::views::filter([&filterFunction](auto& device) { |
| 96 | return filterFunction(device); |
| 97 | }); |
| 98 | if (!result_set.empty()) { |
| 99 | return result_set.front(); |
| 100 | } else { |
| 101 | return nullptr; |
| 102 | } |
| 103 | } |
| 104 | |
| 105 | std::shared_ptr<Device> findDevice(std::string name) { |
| 106 | return findDevice([&name](auto& device){ |
no test coverage detected