M2M_API_RESULT m2m_hw_usb_read (M2M_T_HW_USB_HANDLE handle,
CHAR *buffer, INT32 len, INT32 *len_read)
Description: the function receives data from USB channel. The receiving modes are set by the function m2m_hw_usb_ioctl.
If USB cable is not plugged in, the function returns a fail. If the cable is disconnected during running operation, the function returns the bytes received up to the cable disconnection events. If no bytes have been received, the function returns zero. This behavior is independent from the read blocking mode set.
Parameters:
handle: USB channel handle
buffer:
pointer to the allocated buffer that will be filled with received data
len:
number of characters to be read
len_read: pointer to the allocated variable that will be filled with the number of data read (bytes)
Return value:
refer to M2M_API_RESULT
enum
Output
data:
on
success: "buffer" points to the buffer filled with the read
data.
"len_read" points to the number of characters in the buffer.
on failure: len_sent = 0, buffer content unchanged