Home |
Media Transfer Protocol Class Driver Function USBMTPGetFileProperty Function USBMTPSetFileProperty Function USBMTPGetFile |
Function USBMTPGetFileUSBMTPGetFile retrieves a file from a USB MTP device: typedef void (RTTAPI * USBMTPDataCallback) (void * P, void * Data, UINT Len); int USBMTPGetFile(int Dev, USBMTPHandle Handle, USBMTPFileInfo * Info, void * P, USBMTPDataCallback Callback); ParametersDevIndex of the MTP device. This value should be in range 0 .. RTUSBMTPConfig.MaxDevices - 1. HandleHandle of the file to retrieve. This handle could have been retrieved through functions USBMTPFindFirstFile/USBMTPFindNextFile. InfoPointer to a structure to receive information about the specified file. This parameter is optional and may be NULL. For more information about this parameter, please see function USBMTPGetFileInfo. PAn arbitrary value that will be passed on to parameter Callback. CallbackA pointer to a function to be called by USBMTPGetFile to pass the file's data on to the application. return valueIf successful, a value >= RTU_SUCCESS is returned, otherwise, a negative error code. This function reads data from the MTP device into its internal buffer and then calls the function specified in parameter Callback with the parameter P passed to USBMTPGetFile, a pointer to its internal buffer, and the number of bytes in the buffer. The callback should typically write the data to a file or consume the data in some other way. The callback is called repeatedly until all of the file's data has been transferred. Function Get of demo program MTPDemo shows how this function is used. Function USBMTPSetFileProperty
|