each device is accessed through different ways and they are not generic.
Right. Did I mention that this was not easy?
Requesting to direct how it could be done in C++
Hmmm, you seem to have a very different understanding of I/O Kit than I do. There’s not a single instance of
NSObject
in the IOKit framework:
% grep NSObject -r /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/IOKit.framework
%
Even on the kernel side there’s no Objective-C in I/O Kit; rather, the kernel side of I/O Kit uses C++, and likewise for DriverKit [1].
Despite that, your desire to do this entirely in C++ is going to make a hard problem even harder. While the IOKit framework is entirely C based, there are numerous other frameworks that are not, and thus artificially restricting yourself to C++ is effectively tying one hand behind your back. This code is all specific to Apple platforms, so there should be no problem with your using (at least) Objective-C++, which will give you access to these Objective-C frameworks.
Share and Enjoy
—
Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware
let myEmail = "eskimo" + "1" + "@apple.com"
[1] Ironically, DriverKit was also the name for the I/O Kit equivalent on NeXT systems, and it was written in Objective-C (-: