///////////////////////////////////////////////////////
| 70 | |
| 71 | //////////////////////////////////////////////////////////// |
| 72 | HIDJoystickManager::HIDJoystickManager() |
| 73 | { |
| 74 | m_manager = IOHIDManagerCreate(kCFAllocatorDefault, kIOHIDOptionsTypeNone); |
| 75 | |
| 76 | CFDictionaryRef mask0 = HIDInputManager::copyDevicesMask(kHIDPage_GenericDesktop, kHIDUsage_GD_Joystick); |
| 77 | |
| 78 | CFDictionaryRef mask1 = HIDInputManager::copyDevicesMask(kHIDPage_GenericDesktop, kHIDUsage_GD_GamePad); |
| 79 | |
| 80 | std::array maskArray = {mask0, mask1}; |
| 81 | CFArrayRef mask = CFArrayCreate(nullptr, reinterpret_cast<const void**>(maskArray.data()), maskArray.size(), nullptr); |
| 82 | |
| 83 | IOHIDManagerSetDeviceMatchingMultiple(m_manager, mask); |
| 84 | CFRelease(mask); |
| 85 | CFRelease(mask1); |
| 86 | CFRelease(mask0); |
| 87 | |
| 88 | |
| 89 | IOHIDManagerRegisterDeviceMatchingCallback(m_manager, pluggedIn, this); |
| 90 | IOHIDManagerRegisterDeviceRemovalCallback(m_manager, pluggedOut, this); |
| 91 | |
| 92 | IOHIDManagerScheduleWithRunLoop(m_manager, CFRunLoopGetCurrent(), runLoopMode); |
| 93 | |
| 94 | IOHIDManagerOpen(m_manager, kIOHIDOptionsTypeNone); |
| 95 | } |
| 96 | |
| 97 | |
| 98 | //////////////////////////////////////////////////////////// |
nothing calls this directly
no outgoing calls
no test coverage detected