SLAA453A january 2011 – may 2023
Description
Obtains bufferSize bytes of payload data from the HID device designated by pStrHidDevice, and stores it in buffer. It does this by reading as many HID reports as necessary until bufferSize bytes have been returned.
If the function returns HID_DEVICE_SUCCESS, then bytesReturned will equal bufferSize. bytesReturned will only be less than bufferSize in the event of one of the other return codes.
This function receives the data by using HID reports as "packets". If any attempt to fetch a packet from the USB device times out, according to the value pStrHidDevice.uGetReportTimeout, then the function returns HID_DEVICE_TRANSFER_TIMEOUT.
There is no inherent limit to the number of bytes that can be received, other than the limitation imposed by bufferSize being a DWORD value. Packetization is handled automatically.
Parameters
strHidDevice* pstrHidDevice | The structure containing the HID device information. |
BYTE* buffer | An array to contain the received data |
DWORD bufferSize | Size of buffer, indicating the maximum amount of bytes intended to be received |
DWORD* bytesReturned | The number of bytes actually received (in the event of an error) |
returns | HID_DEVICE_NOT_OPENED. The HID device failed to open. |
HID_DEVICE_TRANSFER_TIMEOUT. A report request timed out. | |
HID_DEVICE_TRANSFER_FAILED. The transmission failed for unspecified reasons. | |
HID_DEVICE_SUCCESS. The correct number of bytes were received. |