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

 


IOHIDQueue.h

Includes:
<CoreFoundation/CoreFoundation.h>
<IOKit/hid/IOHIDBase.h>

Overview

IOHIDQueue defines an object used to queue values from input parsed items (IOHIDElement) contained within a Human Interface Device (HID) object. This object is useful when you need to keep track of all values of an input element, rather than just the most recent one. IOHIDQueue is a CFType object and as such conforms to all the conventions expected such object.

IOHIDQueue should be considered optional and is only useful for working with complex input elements. These elements include those whose length are greater than sizeof(CFIndex) or elements that are duplicate items. Whenever possible please defer to using IOHIDManagerRegisterInputValueCallback or IOHIDDeviceRegisterInputValueCallback.

Note:Absolute element values (based on a fixed origin) will only be placed on a queue if there is a change in value.

This documentation assumes that you have a basic understanding of the material contained in Accessing Hardware From Applications For definitions of I/O Kit terms used in this documentation, such as matching dictionary, family, and driver, see the overview of I/O Kit terms and concepts in the "Device Access and the I/O Kit" chapter of Accessing Hardware From Applications.

This documentation also assumes you have read Human Interface Device & Force Feedback. Please review documentation before using this reference.

All of the information described in this document is contained in the header file IOHIDQueue.h found at /System/Library/Frameworks/IOKit.framework/Headers/hid/IOHIDQueue.h.



Functions

IOHIDQueueAddElement

Adds an element to the queue

IOHIDQueueContainsElement

Queries the queue to determine if elemement has been added.

IOHIDQueueCopyNextValue

Dequeues a retained copy of an element value from the head of an IOHIDQueue.

IOHIDQueueCopyNextValueWithTimeout

Dequeues a retained copy of an element value from the head of an IOHIDQueue. This method will block until either a value is available or it times out.

IOHIDQueueCreate

Creates an IOHIDQueue object for the specified device.

IOHIDQueueGetDepth

Obtain the depth of the queue.

IOHIDQueueGetDevice

Obtain the device associated with the queue.

IOHIDQueueGetTypeID

Returns the type identifier of all IOHIDQueue instances.

IOHIDQueueRegisterValueAvailableCallback

Sets callback to be used when the queue transitions to non-empty.

IOHIDQueueRemoveElement

Removes an element from the queue

IOHIDQueueScheduleWithRunLoop

Schedules queue with run loop.

IOHIDQueueSetDepth

Sets the depth of the queue. @disussion Set the appropriate depth value based on the number of elements contained in a queue.

IOHIDQueueStart

Starts element value delivery to the queue.

IOHIDQueueStop

Stops element value delivery to the queue.

IOHIDQueueUnscheduleFromRunLoop

Unschedules queue with run loop.


IOHIDQueueAddElement


Adds an element to the queue

CF_EXPORT void IOHIDQueueAddElement( 
    IOHIDQueueRef queue, 
    IOHIDElementRef element) ;  
Parameters
queue

IOHIDQueue object to be modified.

element

Element to be added to the queue.

Availability
Introduced in Mac OS X v10.5.

IOHIDQueueContainsElement


Queries the queue to determine if elemement has been added.

CF_EXPORT Boolean IOHIDQueueContainsElement( 
    IOHIDQueueRef queue, 
    IOHIDElementRef element) ;  
Parameters
queue

IOHIDQueue object to be queried.

element

Element to be queried.

Return Value

Returns true or false depending if element is present.

Availability
Introduced in Mac OS X v10.5.

IOHIDQueueCopyNextValue


Dequeues a retained copy of an element value from the head of an IOHIDQueue.

CF_EXPORT IOHIDValueRef IOHIDQueueCopyNextValue( 
    IOHIDQueueRef queue) ;  
Parameters
queue

IOHIDQueue object to be queried.

Return Value

Returns valid IOHIDValueRef if data is available.

Discussion

Because the value is a retained copy, it is up to the caller to release the value using CFRelease. Use with setValueCallback to avoid polling the queue for data.

Availability
Introduced in Mac OS X v10.5.

IOHIDQueueCopyNextValueWithTimeout


Dequeues a retained copy of an element value from the head of an IOHIDQueue. This method will block until either a value is available or it times out.

CF_EXPORT IOHIDValueRef IOHIDQueueCopyNextValueWithTimeout( 
    IOHIDQueueRef queue, 
    CFTimeInterval timeout) ;  
Parameters
queue

IOHIDQueue object to be queried.

timeout

Timeout before aborting an attempt to dequeue a value from the head of a queue.

Return Value

Returns valid IOHIDValueRef if data is available.

Discussion

Because the value is a retained copy, it is up to the caller to release the value using CFRelease. Use with setValueCallback to avoid polling the queue for data.

Availability
Introduced in Mac OS X v10.5.

IOHIDQueueCreate


Creates an IOHIDQueue object for the specified device.

CF_EXPORT IOHIDQueueRef IOHIDQueueCreate( 
    CFAllocatorRef allocator, 
    IOHIDDeviceRef device, 
    CFIndex depth, 
    IOOptionBits options) ;  
Parameters
allocator

Allocator to be used during creation.

device

IOHIDDevice object

depth

The number of values that can be handled by the queue.

options

Reserved for future use.

Return Value

Returns a new IOHIDQueueRef.

Discussion

Take care in specifying an appropriate depth to prevent dropping events.

Availability
Introduced in Mac OS X v10.5.

IOHIDQueueGetDepth


Obtain the depth of the queue.

CF_EXPORT CFIndex IOHIDQueueGetDepth( 
    IOHIDQueueRef queue) ;  
Parameters
queue

IOHIDQueue to be queried.

Return Value

Returns the queue depth.

Availability
Introduced in Mac OS X v10.5.

IOHIDQueueGetDevice


Obtain the device associated with the queue.

CF_EXPORT IOHIDDeviceRef IOHIDQueueGetDevice( 
    IOHIDQueueRef queue) ;  
Parameters
queue

IOHIDQueue to be queried.

Return Value

Returns the a reference to the device.

Availability
Introduced in Mac OS X v10.5.

IOHIDQueueGetTypeID


Returns the type identifier of all IOHIDQueue instances.

CF_EXPORT CFTypeID IOHIDQueueGetTypeID(
    void) ;  

Availability
Introduced in Mac OS X v10.5.

IOHIDQueueRegisterValueAvailableCallback


Sets callback to be used when the queue transitions to non-empty.

CF_EXPORT void IOHIDQueueRegisterValueAvailableCallback( 
    IOHIDQueueRef queue, 
    IOHIDCallback callback, 
    void *context) ;  
Parameters
queue

IOHIDQueue object to be modified.

callback

Callback of type IOHIDCallback to be used when data is placed on the queue.

context

Pointer to data to be passed to the callback.

Discussion

In order to make use of asynchronous behavior, the queue needs to be scheduled with the run loop.

Availability
Introduced in Mac OS X v10.5.

IOHIDQueueRemoveElement


Removes an element from the queue

CF_EXPORT void IOHIDQueueRemoveElement( 
    IOHIDQueueRef queue, 
    IOHIDElementRef element) ;  
Parameters
queue

IOHIDQueue object to be modified.

element

Element to be removed from the queue.

Availability
Introduced in Mac OS X v10.5.

IOHIDQueueScheduleWithRunLoop


Schedules queue with run loop.

CF_EXPORT void IOHIDQueueScheduleWithRunLoop( 
    IOHIDQueueRef queue, 
    CFRunLoopRef runLoop, 
    CFStringRef runLoopMode) ;  
Parameters
queue

IOHIDQueue object to be modified.

runLoop

RunLoop to be used when scheduling any asynchronous activity.

runLoopMode

Run loop mode to be used when scheduling any asynchronous activity.

Discussion

Formally associates queue with client's run loop. Scheduling this queue with the run loop is necessary before making use of any asynchronous APIs.

Availability
Introduced in Mac OS X v10.5.

IOHIDQueueSetDepth


Sets the depth of the queue. @disussion Set the appropriate depth value based on the number of elements contained in a queue.

CF_EXPORT void IOHIDQueueSetDepth( 
    IOHIDQueueRef queue, 
    CFIndex depth) ;  
Parameters
queue

IOHIDQueue object to be modified.

depth

The new queue depth.

Availability
Introduced in Mac OS X v10.5.

IOHIDQueueStart


Starts element value delivery to the queue.

CF_EXPORT void IOHIDQueueStart(
    IOHIDQueueRef queue) ;  
Parameters
queue

IOHIDQueue object to be started.

Availability
Introduced in Mac OS X v10.5.

IOHIDQueueStop


Stops element value delivery to the queue.

CF_EXPORT void IOHIDQueueStop(
    IOHIDQueueRef queue) ;  
Parameters
queue

IOHIDQueue object to be stopped.

Availability
Introduced in Mac OS X v10.5.

IOHIDQueueUnscheduleFromRunLoop


Unschedules queue with run loop.

CF_EXPORT void IOHIDQueueUnscheduleFromRunLoop( 
    IOHIDQueueRef queue, 
    CFRunLoopRef runLoop, 
    CFStringRef runLoopMode) ;  
Parameters
queue

IOHIDQueue object to be modified.

runLoop

RunLoop to be used when scheduling any asynchronous activity.

runLoopMode

Run loop mode to be used when scheduling any asynchronous activity.

Discussion

Formally disassociates queue with client's run loop.

Availability
Introduced in Mac OS X v10.5.

Typedefs


IOHIDQueueRef


typedef struct __IOHIDQueue * IOHIDQueueRef;  
Discussion

This is the type of a reference to the IOHIDQueue.


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