]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/mac/classic/private/hid.h
2 #include <IOKit/IOKitLib.h>
3 #include <IOKit/IOCFPlugIn.h>
4 #include <IOKit/hid/IOHIDLib.h>
5 #include <IOKit/hid/IOHIDKeys.h>
6 #include <Kernel/IOKit/hidsystem/IOHIDUsageTables.h>
10 //Utility wrapper around CFArray
14 wxCFArray(CFTypeRef pData
) : pArray((CFArrayRef
) pData
) {}
15 CFTypeRef
operator [] (const int& nIndex
) {return CFArrayGetValueAtIndex(pArray
, nIndex
); }
16 int Count() {return CFArrayGetCount(pArray
);}
22 // A wrapper around OS X HID Manager procedures.
23 // The tutorial "Working With HID Class Device Interfaces" Is
24 // Quite good, as is the sample program associated with it
25 // (Depite the author's protests!).
29 wxHIDDevice() : m_ppDevice(NULL
), m_ppQueue(NULL
), m_pCookies(NULL
) {}
30 //kHIDPage_GenericDesktop
31 //kHIDUsage_GD_Joystick,kHIDUsage_GD_Mouse,kHIDUsage_GD_Keyboard
32 bool Create (const int& nClass
= -1, const int& nType
= -1);
34 inline void AddCookie(CFTypeRef Data
, const int& i
);
35 inline void AddCookieInQueue(CFTypeRef Data
, const int& i
);
36 inline void InitCookies(const size_t& dwSize
, bool bQueue
= false);
38 //Must be implemented by derived classes
39 //builds the cookie array -
40 //first call InitCookies to initialize the cookie
41 //array, then AddCookie to add a cookie at a certain point in an array
42 virtual void BuildCookies(wxCFArray
& Array
) = 0;
44 //checks to see whether the cookie at index nIndex is active (element value != 0)
45 bool IsActive(const int& nIndex
);
47 //closes the device and cleans the queue and cookies
48 virtual ~wxHIDDevice();
50 IOHIDDeviceInterface
** m_ppDevice
; //this, essentially
51 IOHIDQueueInterface
** m_ppQueue
; //queue (if we want one)
52 IOHIDElementCookie
* m_pCookies
; //cookies
54 const char* m_szName
; //(product) name
58 class wxHIDKeyboard
: public wxHIDDevice
62 virtual void BuildCookies(wxCFArray
& Array
);