USB Libraries Help > USB Device Libraries > USB Device Printer Library > Library Interface > b) Data Types and Constants > USB_DEVICE_PRINTER_EVENT_HANDLER Type
MPLAB Harmony USB Stack
USB_DEVICE_PRINTER_EVENT_HANDLER Type

USB Device Printer Event Handler Function Pointer Type. 

This data type defines the required function signature of the USB Device Printer Function Driver event handling callback function. The application must register a pointer to a Printer Function Driver events handling function whose function signature (parameter and return value types) match the types specified by this function pointer in order to receive event call backs from the Printer Function Driver. The function driver will invoke this function with event relevant parameters. The description of the event handler function parameters is given here. 

instanceIndex - Instance index of the Printer Function Driver that generated the event. 

event - Type of event generated. 

pData - This parameter should be type cast to an event specific pointer type based on the event that has occurred. Refer to the USB_DEVICE_PRINTER_EVENT enumeration description for more details. 

context - Value identifying the context of the application that was registered along with the event handling function.

C
typedef USB_DEVICE_PRINTER_EVENT_RESPONSE (* USB_DEVICE_PRINTER_EVENT_HANDLER)(USB_DEVICE_PRINTER_INDEX instanceIndex, USB_DEVICE_PRINTER_EVENT event, void * pData, uintptr_t context);
Remarks

The event handler function executes in the USB interrupt context when the USB Device Stack is configured for interrupt based operation. It is not advisable to call blocking functions or computationally intensive functions in the event handler. Where the response to a control transfer related event requires extended processing, the response to the control transfer should be deferred and the event handler should be allowed to complete execution.