Using IOHIDManager as part of a library module for controller support.

I am currently developing a controller support module for a multi-platform middleware library. The goal is to store the state of the controller behind the scenes and then allow the user to poll the current state of the controller, as well as register to receive an event when the state of the controller changes. From what I have gathered thus far there appear to be two frameworks available for this Game Controller and IOHIDManager. I have tested the Game Controller framework however it does not provide support for any of the targeted controllers. The IOHIDManager, on the other hand, appears to at least be able to support the PS4 controller, however, it seems that it only works as part of the appdelegate which I won't have access to when making the library module. Is there a way around the appdelegate or is there another framework I can use for handling controller support?

Replies

What makes you think IOHIDManager only works as part of the app delegate?

While I am not 100 percent sure and I am new to developing on Mac Os I have attempted creating a small demo outside of the appdelegate following the documentation at https://developer.apple.com/library/archive/documentation/DeviceDrivers/Conceptual/HID/intro/intro.html#//apple_ref/doc/uid/TP40000970-CH202-SW1, as well as Apple's HID Calibrator demo which appears to solely uses the IOHIDManager in the appdelegate and properly detects the PS4 controller. However, I was unable to receive any events from the controller in my demo.