ADC Home > Reference Library > Reference > Hardware & Drivers > I/O Kit Framework Reference

 


IOHIDQueueInterface

Declared In:

Overview

CFPlugin object subclass which provides an interface for input queues from HID devices. Created by an IOHIDDeviceInterface object.



Functions

addElement

Adds an element to the queue.

create(void *)

Disposes of the current queue.

create(void *, uint32_t, uint32_t)

Creates the current queue.

createAsyncEventSource

Creates an async event source.

createAsyncPort

Creates an async port.

dispose

Disposes of the current queue.

getAsyncEventSource

Obtains the current event source.

getAsyncPort

Obtains the current async port.

getEventCallout

Gets the event callout.

getNextEvent

Reads next event from the queue.

hasElement

Checks whether an element has been added to the queue.

removeElement

Removes an element from the queue.

setEventCallout

Sets the event callout to be called when the queue transitions to non-empty.

start

Starts event delivery to the queue.

stop

Stops event delivery to the queue.


addElement


Adds an element to the queue.

IOReturn ( *addElement)(
    void *self, 
    IOHIDElementCookie elementCookie, 
    uint32_t flags);  
Parameters
elementCookie

The element of interest.

flags
Return Value

Returns an IOReturn code.

Discussion

If the element has already been added to queue, an error will be returned.


create(void *)


Disposes of the current queue.

IOReturn ( *dispose)(
    void *self);  
Return Value

Returns an IOReturn code.


create(void *, uint32_t, uint32_t)


Creates the current queue.

IOReturn ( *create)(
    void *self, 
    uint32_t flags, 
    uint32_t depth);  
Parameters
flags

Pass kIOHIDQueueOptionsTypeEnqueueAll option to force the IOHIDQueue to enqueue all events, relative or absolute, regardless of change.

depth

The maximum number of elements in the queue before the oldest elements in the queue begin to be lost.

Return Value

Returns an IOReturn code.


createAsyncEventSource


Creates an async event source.

IOReturn ( *createAsyncEventSource)(
    void *self, 
    CFRunLoopSourceRef *source);  
Parameters
source

The newly created event source.

Return Value

Returns an IOReturn code.

Discussion

This will be used with setEventCallout.


createAsyncPort


Creates an async port.

IOReturn ( *createAsyncPort)(
    void *self,
    mach_port_t *port);  
Parameters
port

The newly created async port.

Return Value

Returns an IOReturn code.

Discussion

This will be used with createAsyncEventSource.


dispose


Disposes of the current queue.

IOReturn ( *dispose)(
    void *self);  
Return Value

Returns an IOReturn code.


getAsyncEventSource


Obtains the current event source.

CFRunLoopSourceRef ( *getAsyncEventSource)(
    void *self);  
Return Value

Returns a CFRunLoopSourceRef.


getAsyncPort


Obtains the current async port.

mach_port_t ( *getAsyncPort)(
    void *self);  
Return Value

Returns a mach_port_t.


getEventCallout


Gets the event callout.

IOReturn ( *getEventCallout)(
    void *self, 
    IOHIDCallbackFunction *outCallback, 
    void **outCallbackTarget, 
    void **outCallbackRefcon);  
Parameters
callback

if non-NULL is a callback to be called when data is inserted to the queue

callbackTarget

The callback target passed to the callback

callbackRefcon

The callback refcon passed to the callback

Return Value

Returns an IOReturn code.

Discussion

This callback will be called the queue transitions to non-empty.


getNextEvent


Reads next event from the queue.

IOReturn ( *getNextEvent)(
    void *self, 
    IOHIDEventStruct *event, 
    AbsoluteTime maxTime, 
    uint32_t timeoutMS);  
Parameters
event

The event that will be filled. If a long value is present, it is up to the caller to deallocate it.

maxtime

UNSUPPORTED. If non-zero, limits read events to those that occured on or before maxTime.

timoutMS

UNSUPPORTED. The timeout in milliseconds, a zero timeout will cause this call to be non-blocking (returning queue empty) if there is a NULL callback, and blocking forever until the queue is non-empty if there is a valid callback.

Return Value

Returns an IOReturn code.


hasElement


Checks whether an element has been added to the queue.

Boolean ( *hasElement)(
    void *self,
    IOHIDElementCookie elementCookie);  
Parameters
elementCookie

The element of interest.

Return Value

Returns a Boolean value.

Discussion

Will return true if present, otherwise will return false.


removeElement


Removes an element from the queue.

IOReturn ( *removeElement)(
    void *self,
    IOHIDElementCookie elementCookie);  
Parameters
elementCookie

The element of interest.

Return Value

Returns an IOReturn code.

Discussion

If the element has not been added to queue, an error will be returned.


setEventCallout


Sets the event callout to be called when the queue transitions to non-empty.

IOReturn ( *setEventCallout)(
    void *self, 
    IOHIDCallbackFunction callback, 
    void *callbackTarget, 
    void *callbackRefcon);  
Parameters
callback

if non-NULL is a callback to be called when data is inserted to the queue

callbackTarget

The callback target passed to the callback

callbackRefcon

The callback refcon passed to the callback.

Return Value

Returns an IOReturn code.

Discussion

In order for this to work correctly, you must call createAsyncPort and createAsyncEventSource.


start


Starts event delivery to the queue.

IOReturn ( *start)(
    void *self);  
Return Value

Returns an IOReturn code.


stop


Stops event delivery to the queue.

IOReturn ( *stop)(
    void *self);  
Return Value

Returns an IOReturn code.


Did this document help you?
Yes: Tell us what works for you.
It’s good, but: Report typos, inaccuracies, and so forth.
It wasn’t helpful: Tell us what would have helped.

 

Last Updated: 2009-02-23