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

 


IOHIDDeviceInterface

Declared In:

Overview

CFPlugin object subclass which provides the primary interface to HID devices.



Functions

allocOutputTransaction

Wrapper to return instances of the IOHIDOutputTransactionInterface.

allocQueue

Wrapper to return instances of the IOHIDQueueInterface.

close

Closes the device.

createAsyncEventSource

Creates async eventsource.

createAsyncPort

Creates an async port.

getAsyncEventSource

Gets the created async event source.

getAsyncPort

Gets the current async port.

getElementValue

Obtains the most recent value of an element.

open

Opens the device.

queryElementValue

Obtains the current value of an element.

setElementValue

Sets an element value on the device.

setRemovalCallback

Sets callback to be used when device is removed.

startAllQueues

Starts data delivery on all queues for this device.

stopAllQueues

Stops data delivery on all queues for this device.


allocOutputTransaction


Wrapper to return instances of the IOHIDOutputTransactionInterface.

IOHIDOutputTransactionInterface ** ( *allocOutputTransaction) (
    void *self);  
Return Value

Returns the created IOHIDOutputTransactionInterface.


allocQueue


Wrapper to return instances of the IOHIDQueueInterface.

IOHIDQueueInterface ** ( *allocQueue) (
    void *self);  
Return Value

Returns the created IOHIDQueueInterface.


close


Closes the device.

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

Returns an IOReturn code.


createAsyncEventSource


Creates async eventsource.

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

Reference to CFRunLoopSourceRef that is created.

Return Value

Returns an IOReturn code.

Discussion

This method will create an async mach port, if one has not already been created.


createAsyncPort


Creates an async port.

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

Reference to mach port that is created.

Return Value

Returns an IOReturn code.

Discussion

The port must be created before any callbacks can be used.


getAsyncEventSource


Gets the created async event source.

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

Returns a CFRunLoopSourceRef.


getAsyncPort


Gets the current async port.

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

Returns a mach_port_t.


getElementValue


Obtains the most recent value of an element.

IOReturn ( *getElementValue)(
    void *self, 
    IOHIDElementCookie elementCookie, 
    IOHIDEventStruct *valueEvent);  
Parameters
elementCookie

The element of interest.

valueEvent

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

Return Value

Returns an IOReturn code.

Discussion

This call is most useful for interrupt driven elements, such as input type elements. Since feature type element values need to be polled from the device, it is recommended to use the queryElementValue method to obtain the current value. The timestamp field in the event details the last time the element value was altered.


open


Opens the device.

IOReturn ( *open)(
    void *self,
    uint32_t flags);  
Parameters
flags

Flags to be passed down to the user client.

Return Value

Returns an IOReturn code.


queryElementValue


Obtains the current value of an element.

IOReturn ( *queryElementValue)(
    void *self, 
    IOHIDElementCookie elementCookie, 
    IOHIDEventStruct *valueEvent, 
    uint32_t timeoutMS, 
    IOHIDElementCallbackFunction callback, 
    void *callbackTarget, 
    void *callbackRefcon);  
Parameters
elementCookie

The element of interest.

valueEvent

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

timeoutMS

UNSUPPORTED.

callback

UNSUPPORTED.

callbackTarget

UNSUPPORTED.

callbackRefcon

UNSUPPORTED.

Return Value

Returns an IOReturn code.

Discussion

This call is most useful for feature type elements. This method will poll the device for the current element value.


setElementValue


Sets an element value on the device.

IOReturn ( *setElementValue)(
    void *self, 
    IOHIDElementCookie elementCookie, 
    IOHIDEventStruct *valueEvent, 
    uint32_t timeoutMS, 
    IOHIDElementCallbackFunction callback, 
    void *callbackTarget, 
    void *callbackRefcon);  
Parameters
elementCookie

The element of interest.

valueEvent

The event that will be filled. If a long value is present, it will be copied.

timeoutMS

UNSUPPORTED.

callback

UNSUPPORTED.

callbackTarget

UNSUPPORTED.

callbackRefcon

UNSUPPORTED.

Return Value

Returns an IOReturn code.

Discussion

This call is most useful for feature type elements. It is recommended to use IOOutputTransaction for output type elements.


setRemovalCallback


Sets callback to be used when device is removed.

IOReturn ( *setRemovalCallback)(
    void *self, 
    IOHIDCallbackFunction removalCallback, 
    void *removalTarget, 
    void *removalRefcon);  
Parameters
removalCallback

Called when the device is removed.

removeTarget

Passed to the callback.

removalRefcon

Passed to the callback.

Return Value

Returns an IOReturn code.


startAllQueues


Starts data delivery on all queues for this device.

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

Returns an IOReturn code.


stopAllQueues


Stops data delivery on all queues for this device.

IOReturn ( *stopAllQueues)(
    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