1 #include "OISConfig.h" 2 #ifdef OIS_WIN32_WIIMOTE_SUPPORT 3 //cWiimote 0.2 by Kevin Forbes (http://simulatedcomicproduct.com) 4 //This code is public domain, and comes with no warranty. The user takes full responsibility for anything that happens as a result from using this code. 5 6 #ifndef HIDDEVICE_H 7 #define HIDDEVICE_H 8 9 #include <windows.h> 10 11 class cHIDDevice 12 { 13 public: 14 cHIDDevice(); 15 ~cHIDDevice(); 16 bool Disconnect(); 17 bool Connect(unsigned short device_id, unsigned short vendor_id, int index=0); 18 bool IsConnected() const {return mConnected;} 19 20 bool WriteToDevice(unsigned const char * OutputReport, int num_bytes); 21 bool ReadFromDevice(unsigned const char * buffer, int max_bytes, int & bytes_read, int timeout=50); 22 private: 23 24 //bool OpenDevice(int index, unsigned short device_id, unsigned short vendor_id); 25 bool OpenDevice(unsigned short device_id, unsigned short vendor_id, int index); 26 //bool FindWiimote(); 27 void GetCapabilities(); 28 void PrepareForOverlappedTransfer(); 29 30 HANDLE mHandle; 31 HANDLE mEvent; 32 HANDLE WriteHandle; 33 HANDLE ReadHandle; 34 OVERLAPPED mOverlapped; 35 OVERLAPPED HIDOverlapped; 36 // HIDP_CAPS Capabilities; 37 bool mConnected; 38 39 }; 40 #endif 41 #endif 42