MayaFlux 0.2.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ initialize_hid_backend()

void MayaFlux::Core::InputSubsystem::initialize_hid_backend ( )
private

Definition at line 299 of file InputSubsystem.cpp.

300{
301 HIDBackend::Config hid_config;
302 hid_config.filters = m_config.hid.filters;
303 hid_config.read_buffer_size = m_config.hid.read_buffer_size;
304 hid_config.poll_timeout_ms = m_config.hid.poll_timeout_ms;
305 hid_config.auto_reconnect = m_config.hid.auto_reconnect;
306 hid_config.reconnect_interval_ms = m_config.hid.reconnect_interval_ms;
307
308 auto hid = std::make_unique<HIDBackend>(hid_config);
309
310 if (add_backend(std::move(hid))) {
311 if (m_config.hid.auto_open) {
312 auto* backend = dynamic_cast<HIDBackend*>(get_backend(InputType::HID));
313 for (const auto& dev : backend->get_devices()) {
314 backend->open_device(dev.id);
315 }
316 }
317 }
318}
bool add_backend(std::unique_ptr< IInputBackend > backend)
Add a custom input backend.
IInputBackend * get_backend(InputType type) const
Get a backend by type.
@ HID
Generic HID devices (game controllers, custom hardware)
HIDBackendInfo hid
HID backend configuration.
size_t read_buffer_size
Per-device read buffer size.
int poll_timeout_ms
Polling timeout in milliseconds.
uint32_t reconnect_interval_ms
Reconnection attempt interval.
bool auto_open
Auto-open matching devices on start.
std::vector< HIDDeviceFilter > filters
Device filters (empty = all devices)
bool auto_reconnect
Auto-reconnect disconnected devices.

References add_backend(), MayaFlux::Core::HIDBackendInfo::auto_open, MayaFlux::Core::HIDBackend::Config::auto_reconnect, MayaFlux::Core::HIDBackendInfo::auto_reconnect, MayaFlux::Core::HIDBackend::Config::filters, MayaFlux::Core::HIDBackendInfo::filters, get_backend(), MayaFlux::Core::GlobalInputConfig::hid, MayaFlux::Core::HID, m_config, MayaFlux::Core::HIDBackend::open_device(), MayaFlux::Core::HIDBackend::Config::poll_timeout_ms, MayaFlux::Core::HIDBackendInfo::poll_timeout_ms, MayaFlux::Core::HIDBackend::Config::read_buffer_size, MayaFlux::Core::HIDBackendInfo::read_buffer_size, MayaFlux::Core::HIDBackend::Config::reconnect_interval_ms, and MayaFlux::Core::HIDBackendInfo::reconnect_interval_ms.

Referenced by initialize().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: