Select best driver for channel data (used by Channel::showPixels)
- Parameters
-
| data | Channel data to route (chipset configuration) |
| affinity | Engine affinity name (empty = no affinity, dynamic selection) |
- Returns
- Shared pointer to selected driver, or nullptr if none compatible
- Note
- Iterates drivers by priority (already sorted descending) and returns first that canHandle()
-
This is called lazily in Channel::showPixels() if no driver is bound
Definition at line 418 of file manager.cpp.hpp.
418 {
419 if (!data) {
420 FL_ERROR(
"ChannelManager::selectDriverForChannel() - Null channel data");
421 return fl::shared_ptr<IChannelDriver>();
422 }
423
424
425
426
427
428
429
430 do {
431 if (affinity.
empty()) {
432 break;
433 }
435 if (!driver) {
436 break;
437 }
438 if (!driver->canHandle(data)) {
439 FL_WARN_ONCE(
"ChannelManager: Affinity driver '" << affinity <<
"' cannot handle channel data (chipset/bus mismatch). Falling back to AUTO/priority dispatch.");
440 break;
441 }
442 return driver;
443 } while (false);
444
445
446
447 for (
const auto& entry :
mDrivers) {
448 if (!entry.enabled) continue;
449 if (entry.driver->canHandle(data)) {
450 return entry.driver;
451 }
452 }
453
454 FL_ERROR(
"ChannelManager: No compatible driver found for channel data");
455 return fl::shared_ptr<IChannelDriver>();
456}
fl::shared_ptr< IChannelDriver > findDriverByName(const fl::string &name) const FL_NO_EXCEPT
Silent counterpart to getDriverByName().
fl::vector< EngineEntry > mDrivers
Shared drivers sorted by priority descending (higher values first)
bool empty() const FL_NO_EXCEPT
#define FL_WARN_ONCE(...)
References findDriverByName(), FL_ERROR, fl::FL_NO_EXCEPT, FL_WARN_ONCE, and mDrivers.
Referenced by fl::SlimSpiBridgeController< CHIPSET, RGB_ORDER, B, B_WHICH >::resolveDriver(), and fl::Channel::resolveDynamicDriver().