USB Libraries Help > USB Host Libraries > USB Audio v1.0 Host Client Driver Library > Library Interface > a) Audio Device Access Functions > USB_HOST_AUDIO_V1_AttachEventHandlerSet Function
MPLAB Harmony USB Stack
USB_HOST_AUDIO_V1_AttachEventHandlerSet Function

This function will set an attach event handler. The attach event handler will be called when a Audio v1.0 Device has been attached or detached. The context will be returned in the event handler. This function should be called before the bus has been enabled.

C
USB_HOST_AUDIO_V1_RESULT USB_HOST_AUDIO_V1_AttachEventHandlerSet(
    USB_HOST_AUDIO_V1_ATTACH_EVENT_HANDLER eventHandler, 
    uintptr_t context
);
Preconditions

None.

Parameters
Parameters 
Description 
eventHandler 
Pointer to the attach event handler. 
context 
An application defined context that will be returned in the event handler. 
Returns
  • USB_HOST_AUDIO_V1_RESULT_SUCCESS - If the attach event handler was registered successfully
  • USB_HOST_AUDIO_V1_RESULT_FAILURE - If the number of registered event handlers has exceeded USB_HOST_AUDIO_V1_ATTACH_LISTENERS_NUMBER
Remarks

This function should be called before the USB_HOST_BusEnable function is called.