2.3.4.3 USB_DEVICE_AUDIO_TransferCancel Function
C
USB_DEVICE_AUDIO_RESULT USB_DEVICE_AUDIO_TransferCancel(
USB_DEVICE_AUDIO_INDEX instanceIndex,
USB_DEVICE_AUDIO_TRANSFER_HANDLE transferHandle
);
Summary
This function cancels a scheduled Audio Device data transfer. The transfer could have been scheduled using the USB_DEVICE_AUDIO_Read, USB_DEVICE_AUDIO_Write, or the USB_DEVICE_AUDIO_SerialStateNotificationSend functions. If a transfer is still in the queue and its processing has not started, the transfer is canceled completely. A transfer that is in progress may or may not get canceled depending on the transaction that is presently in progress. If the last transaction of the transfer is in progress, the transfer will not be canceled. If it is not the last transaction in progress, the in-progress will be allowed to complete. Pending transactions will be canceled. The first transaction of an in progress transfer cannot be canceled.
Precondition
The USB Device should be in a configured state.
Parameters
Parameters | Description |
instanceIndex | AUDIO Function Driver instance index. |
transferHandle | Transfer handle of the transfer to be canceled. |
Returns
- USB_DEVICE_AUDIO_RESULT_OK - The transfer will be canceled completely or partially.
- USB_DEVICE_AUDIO_RESULT_ERROR - The transfer could not be canceled because it has either completed, the transfer handle is invalid or the last transaction is in progress.
Example
// The following code snippet cancels a AUDIO transfer. USB_DEVICE_AUDIO_TRANSFER_HANDLE transferHandle; USB_DEVICE_AUDIO_RESULT result; result = USB_DEVICE_AUDIO_TransferCancel(instanceIndex, transferHandle); if(USB_DEVICE_AUDIO_RESULT_OK == result) { // The transfer cancellation was either completely or // partially successful. }
Remarks
None.