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

◆ shutdown()

void MayaFlux::Core::HIDBackend::shutdown ( )
overridevirtual

Shutdown and release all resources.

Closes all devices and releases backend resources. After this call, initialize() must be called again to use the backend.

Implements MayaFlux::Core::IInputBackend.

Definition at line 90 of file HIDBackend.cpp.

91{
92 if (!m_initialized.load()) {
93 return;
94 }
95
96 stop();
97
98 {
99 std::lock_guard lock(m_devices_mutex);
100 for (auto& [id, state] : m_open_devices) {
101 if (state->handle) {
102 hid_close(state->handle);
103 state->handle = nullptr;
104 }
105 }
106 m_open_devices.clear();
107 m_enumerated_devices.clear();
108 }
109
110 hid_exit();
111 m_initialized.store(false);
112
114 "HIDBackend shutdown complete");
115}
#define MF_INFO(comp, ctx,...)
std::atomic< bool > m_initialized
std::unordered_map< uint32_t, HIDDeviceInfoExt > m_enumerated_devices
void stop() override
Stop listening for input events.
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_enumerated_devices, m_initialized, m_open_devices, MF_INFO, and stop().

Referenced by ~HIDBackend().

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