MCPcopy Create free account
hub / github.com/TactilityProject/Tactility / findDevice

Function findDevice

Modules/hal-device-module/source/hal/Device.cpp:91–103  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

89}
90
91std::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
105std::shared_ptr<Device> findDevice(std::string name) {
106 return findDevice([&name](auto& device){

Callers 5

powerOffMethod · 0.85
initBootFunction · 0.85
HalDeviceTest.cppFile · 0.85
findValidTouchDeviceFunction · 0.85
findValidDisplayDeviceFunction · 0.85

Calls 5

getDevicesFunction · 0.85
asScopedLockMethod · 0.80
getIdMethod · 0.80
lockMethod · 0.45
getNameMethod · 0.45

Tested by

no test coverage detected