Working on GP1212A02 support.
13 HidDevice::HidDevice():iHidDevice(NULL)
20 HidDevice::~HidDevice()
28 int HidDevice::Open(const char* aPath)
32 iHidDevice = hid_open_path(aPath);
36 //Fail to connect our device
46 See hidapi documentation.
48 int HidDevice::Open(unsigned short aVendorId, unsigned short aProductId, const wchar_t* aSerialNumber)
52 iHidDevice = hid_open(aVendorId, aProductId, aSerialNumber);
56 //Fail to connect our device
68 void HidDevice::Close()
70 hid_close(iHidDevice); //No effect if device is null
73 memset(iVendor,0,sizeof(iVendor));
74 memset(iProduct,0,sizeof(iProduct));
75 memset(iSerialNumber,0,sizeof(iSerialNumber));
80 bool HidDevice::IsOpen()
82 return iHidDevice!=NULL;
88 const wchar_t* HidDevice::Error()
90 return hid_error(iHidDevice);
95 int HidDevice::SetNonBlocking(int aNonBlocking)
97 //Success we are now connected to our HID device
98 //Set read operation as non blocking
99 return hid_set_nonblocking(iHidDevice, aNonBlocking);
104 wchar_t* HidDevice::Vendor()
111 wchar_t* HidDevice::Product()
118 wchar_t* HidDevice::SerialNumber()
120 return iSerialNumber;
126 void HidDevice::FetchStrings()
128 hid_get_manufacturer_string(iHidDevice,iVendor,sizeof(iVendor));
129 hid_get_product_string(iHidDevice,iProduct,sizeof(iProduct));
130 hid_get_serial_number_string(iHidDevice,iSerialNumber,sizeof(iSerialNumber));