sl@14: // sl@14: // sl@14: // sl@14: sl@14: #ifndef HID_DEVICE_H sl@14: #define HID_DEVICE_H sl@14: sl@14: #include "HidReport.h" sl@14: #include "hidapi.h" sl@14: sl@14: sl@14: /** sl@14: TODO: move to another header sl@14: */ sl@14: class HidDevice sl@14: { sl@14: public: sl@14: int Open(const char* aPath); sl@14: int Open(unsigned short aVendorId, unsigned short aProductId, const wchar_t* aSerialNumber); sl@14: void Close(); sl@14: bool IsOpen(); sl@14: // sl@14: int SetNonBlocking(int aNonBlocking); sl@14: // sl@14: template sl@14: int Write(const HidReport& aOutputReport); sl@14: // sl@14: const wchar_t* Error(); sl@14: sl@14: private: sl@14: ///Our USB HID device sl@14: hid_device* iHidDevice; sl@14: }; sl@14: sl@14: sl@14: /** sl@14: */ sl@14: template sl@14: int HidDevice::Write(const HidReport& aOutputReport) sl@14: { sl@14: return hid_write(iHidDevice,aOutputReport.Buffer(),S); sl@14: } sl@14: sl@14: sl@14: #endif