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

◆ close_device()

void MayaFlux::Core::HIDBackend::close_device ( uint32_t  device_id)
overridevirtual

Close a previously opened device.

Parameters
device_idDevice identifier

Implements MayaFlux::Core::IInputBackend.

Definition at line 268 of file HIDBackend.cpp.

269{
270 std::lock_guard lock(m_devices_mutex);
271
272 auto it = m_open_devices.find(device_id);
273 if (it == m_open_devices.end()) {
274 return;
275 }
276
277 it->second->active.store(false);
278 if (it->second->handle) {
279 hid_close(it->second->handle);
280 }
281
283 "Closed HID device {}: {}", device_id, it->second->info.name);
284
285 m_open_devices.erase(it);
286}
#define MF_INFO(comp, ctx,...)
std::unordered_map< uint32_t, std::shared_ptr< HIDDeviceState > > m_open_devices
@ InputBackend
Input device backend (HID, MIDI, OSC)
@ Core
Core engine, backend, subsystems.

References MayaFlux::Journal::Core, MayaFlux::Journal::InputBackend, m_devices_mutex, m_open_devices, and MF_INFO.