Adding APIs for string and requests.
13 HidDevice::HidDevice():iHidDevice(NULL)
20 int HidDevice::Open(const char* aPath)
24 iHidDevice = hid_open_path(aPath);
28 //Fail to connect our device
38 See hidapi documentation.
40 int HidDevice::Open(unsigned short aVendorId, unsigned short aProductId, const wchar_t* aSerialNumber)
44 iHidDevice = hid_open(aVendorId, aProductId, aSerialNumber);
48 //Fail to connect our device
59 void HidDevice::Close()
61 hid_close(iHidDevice);
64 memset(iVendor,0,sizeof(iVendor));
65 memset(iProduct,0,sizeof(iProduct));
66 memset(iSerialNumber,0,sizeof(iSerialNumber));
71 bool HidDevice::IsOpen()
73 return iHidDevice!=NULL;
79 const wchar_t* HidDevice::Error()
81 return hid_error(iHidDevice);
86 int HidDevice::SetNonBlocking(int aNonBlocking)
88 //Success we are now connected to our HID device
89 //Set read operation as non blocking
90 return hid_set_nonblocking(iHidDevice, aNonBlocking);
95 wchar_t* HidDevice::Vendor()
102 wchar_t* HidDevice::Product()
109 wchar_t* HidDevice::SerialNumber()
111 return iSerialNumber;
117 void HidDevice::FetchStrings()
119 hid_get_manufacturer_string(iHidDevice,iVendor,sizeof(iVendor));
120 hid_get_product_string(iHidDevice,iProduct,sizeof(iProduct));
121 hid_get_serial_number_string(iHidDevice,iSerialNumber,sizeof(iSerialNumber));