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

 


IOHIDElement.h

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

Overview

IOHIDElement defines a parsed item contained within a Human Interface Device (HID) object. It is used to obtain properties of the parsed. It can also be used to set properties such as calibration settings. IOHIDElement is a CFType object and as such conforms to all the conventions expected such object.

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 IOHIDElement.h found at /System/Library/Frameworks/IOKit.framework/Headers/hid/IOHIDElement.h.



Functions

IOHIDElementAttach

Establish a relationship between one or more elements.

IOHIDElementCollectionType

Retrieves the collection type for the element.

IOHIDElementCopyAttached

Obtain attached elements.

IOHIDElementCreateWithDictionary

Creates an element from a dictionary.

IOHIDElementDetach

Remove a relationship between one or more elements.

IOHIDElementGetChildren

Returns the children for the element.

IOHIDElementGetCollectionType

Retrieves the collection type for the element.

IOHIDElementGetCookie

Retrieves the cookie for the element.

IOHIDElementGetDevice

Obtain the device associated with the element.

IOHIDElementGetLogicalMax

Returns the maximum value possible for the element.

IOHIDElementGetLogicalMin

Returns the minimum value possible for the element.

IOHIDElementGetMax

Returns the maximum value possible for the element.

IOHIDElementGetName

Returns the name for the element.

IOHIDElementGetParent

Returns the parent for the element.

IOHIDElementGetPhysicalMax

Returns the scaled maximum value possible for the element.

IOHIDElementGetPhysicalMin

Returns the scaled minimum value possible for the element.

IOHIDElementGetProperty

Returns the an element property.

IOHIDElementGetReportCount

Returns the report count for the element.

IOHIDElementGetReportID

Returns the report ID for the element.

IOHIDElementGetReportSize

Returns the report size in bits for the element.

IOHIDElementGetType

Retrieves the type for the element.

IOHIDElementGetTypeID

Returns the type identifier of all IOHIDElement instances.

IOHIDElementGetUnit

Returns the unit property for the element.

IOHIDElementGetUnitExponent

Returns the unit exponenet in base 10 for the element.

IOHIDElementGetUsage

Retrieves the usage for an element.

IOHIDElementGetUsagePage

Retrieves the usage page for an element.

IOHIDElementHasNullState

Returns the null state property for the element.

IOHIDElementHasPreferredState

Returns the preferred state property for the element.

IOHIDElementIsArray

Returns the array property for the element.

IOHIDElementIsNonLinear

Returns the linear property for the element.

IOHIDElementIsRelative

Returns the relative property for the element.

IOHIDElementIsVirtual

Returns the virtual property for the element.

IOHIDElementIsWrapping

Returns the wrap property for the element.

IOHIDElementSetProperty

Sets an element property.


IOHIDElementAttach


Establish a relationship between one or more elements.

CF_EXPORT void IOHIDElementAttach(
    IOHIDElementRef element,
    IOHIDElementRef toAttach) ;  
Parameters
element

The element to be modified. If this parameter is not a valid IOHIDElementRef, the behavior is undefined.

toAttach

The element to be attached. If this parameter is not a valid IOHIDElementRef, the behavior is undefined.

Discussion

This is useful for grouping HID elements with related functionality.

Availability
Introduced in Mac OS X v10.5.

IOHIDElementCollectionType


Retrieves the collection type for the element.

CF_EXPORT IOHIDElementCollectionType IOHIDElementGetCollectionType(
    IOHIDElementRef element) ;  
Parameters
element

The element to be queried. If this parameter is not a valid IOHIDElementRef, the behavior is undefined.

Return Value

Returns the IOHIDElementCollectionType for the element.

Discussion

The value returned by this method only makes sense if the element type is kIOHIDElementTypeCollection.

Availability
Introduced in Mac OS X v10.5.

IOHIDElementCopyAttached


Obtain attached elements.

CF_EXPORT CFArrayRef IOHIDElementCopyAttached(
    IOHIDElementRef element) ;  
Parameters
element

The element to be modified. If this parameter is not a valid IOHIDElementRef, the behavior is undefined.

Return Value

Returns a copy of the current attached elements.

Discussion

Attached elements are those that have been grouped via IOHIDElementAttach.

Availability
Introduced in Mac OS X v10.5.

IOHIDElementCreateWithDictionary


Creates an element from a dictionary.

CF_EXPORT IOHIDElementRef IOHIDElementCreateWithDictionary(
    CFAllocatorRef allocator,
    CFDictionaryRef dictionary) ;  
Parameters
allocator

Allocator to be used during creation.

dictionary

dictionary containing values in which to create element.

Return Value

Returns a new IOHIDElementRef.

Discussion

The dictionary should contain keys defined in IOHIDKeys.h and start with kIOHIDElement. This call is meant be used by a IOHIDDeviceDeviceInterface object.

Availability
Introduced in Mac OS X v10.5.

IOHIDElementDetach


Remove a relationship between one or more elements.

CF_EXPORT void IOHIDElementDetach(
    IOHIDElementRef element,
    IOHIDElementRef toDetach) ;  
Parameters
element

The element to be modified. If this parameter is not a valid IOHIDElementRef, the behavior is undefined.

toDetach

The element to be detached. If this parameter is not a valid IOHIDElementRef, the behavior is undefined.

Discussion

This is useful for grouping HID elements with related functionality.

Availability
Introduced in Mac OS X v10.5.

IOHIDElementGetChildren


Returns the children for the element.

CF_EXPORT CFArrayRef IOHIDElementGetChildren(
    IOHIDElementRef element) ;  
Parameters
element

The element to be queried. If this parameter is not a valid IOHIDElementRef, the behavior is undefined.

Return Value

Returns an CFArrayRef containing element objects of type IOHIDElementRef.

Discussion

An element of type kIOHIDElementTypeCollection usually contains children.

Availability
Introduced in Mac OS X v10.5.

IOHIDElementGetCollectionType


Retrieves the collection type for the element.

CF_EXPORT IOHIDElementCollectionType IOHIDElementGetCollectionType(
    IOHIDElementRef element) ;  
Parameters
element

The element to be queried. If this parameter is not a valid IOHIDElementRef, the behavior is undefined.

Return Value

Returns the IOHIDElementCollectionType for the element.

Discussion

The value returned by this method only makes sense if the element type is kIOHIDElementTypeCollection.

Availability
Introduced in Mac OS X v10.5.

IOHIDElementGetCookie


Retrieves the cookie for the element.

CF_EXPORT IOHIDElementCookie IOHIDElementGetCookie(
    IOHIDElementRef element) ;  
Parameters
element

The element to be queried. If this parameter is not a valid IOHIDElementRef, the behavior is undefined.

Return Value

Returns the IOHIDElementCookie for the element.

Discussion

The IOHIDElementCookie represent a unique identifier for an element within a device.

Availability
Introduced in Mac OS X v10.5.

IOHIDElementGetDevice


Obtain the device associated with the element.

CF_EXPORT IOHIDDeviceRef IOHIDElementGetDevice(
    IOHIDElementRef element) ;  
Parameters
element

IOHIDElement to be queried.

Return Value

Returns the a reference to the device.

Availability
Introduced in Mac OS X v10.5.

IOHIDElementGetLogicalMax


Returns the maximum value possible for the element.

CF_EXPORT CFIndex IOHIDElementGetLogicalMax(
    IOHIDElementRef element) ;  
Parameters
element

The element to be queried. If this parameter is not a valid IOHIDElementRef, the behavior is undefined.

Return Value

Returns the logical maximum.

Discussion

This corresponds to the logical maximum, which indicates the upper bounds of a variable element.

Availability
Introduced in Mac OS X v10.5.

IOHIDElementGetLogicalMin


Returns the minimum value possible for the element.

CF_EXPORT CFIndex IOHIDElementGetLogicalMin(
    IOHIDElementRef element) ;  
Parameters
element

The element to be queried. If this parameter is not a valid IOHIDElementRef, the behavior is undefined.

Return Value

Returns the logical minimum.

Discussion

This corresponds to the logical minimun, which indicates the lower bounds of a variable element.

Availability
Introduced in Mac OS X v10.5.

IOHIDElementGetMax


Returns the maximum value possible for the element.

CF_EXPORT CFIndex IOHIDElementGetLogicalMax(
    IOHIDElementRef element) ;  
Parameters
element

The element to be queried. If this parameter is not a valid IOHIDElementRef, the behavior is undefined.

Return Value

Returns the logical maximum.

Discussion

This corresponds to the logical maximum, which indicates the upper bounds of a variable element.

Availability
Introduced in Mac OS X v10.5.

IOHIDElementGetName


Returns the name for the element.

CF_EXPORT CFStringRef IOHIDElementGetName(
    IOHIDElementRef element) ;  
Parameters
element

The element to be queried. If this parameter is not a valid IOHIDElementRef, the behavior is undefined.

Return Value

Returns CFStringRef containing the element name.

Availability
Introduced in Mac OS X v10.5.

IOHIDElementGetParent


Returns the parent for the element.

CF_EXPORT IOHIDElementRef IOHIDElementGetParent(
    IOHIDElementRef element) ;  
Parameters
element

The element to be queried. If this parameter is not a valid IOHIDElementRef, the behavior is undefined.

Return Value

Returns an IOHIDElementRef referencing the parent element.

Discussion

The parent element can be an element of type kIOHIDElementTypeCollection.

Availability
Introduced in Mac OS X v10.5.

IOHIDElementGetPhysicalMax


Returns the scaled maximum value possible for the element.

CF_EXPORT CFIndex IOHIDElementGetPhysicalMax(
    IOHIDElementRef element) ;  
Parameters
element

The element to be queried. If this parameter is not a valid IOHIDElementRef, the behavior is undefined.

Return Value

Returns the physical maximum.

Discussion

Maximum value for the physical extent of a variable element. This represents the value for the logical maximum with units applied to it.

Availability
Introduced in Mac OS X v10.5.

IOHIDElementGetPhysicalMin


Returns the scaled minimum value possible for the element.

CF_EXPORT CFIndex IOHIDElementGetPhysicalMin(
    IOHIDElementRef element) ;  
Parameters
element

The element to be queried. If this parameter is not a valid IOHIDElementRef, the behavior is undefined.

Return Value

Returns the physical minimum.

Discussion

Minimum value for the physical extent of a variable element. This represents the value for the logical minimum with units applied to it.

Availability
Introduced in Mac OS X v10.5.

IOHIDElementGetProperty


Returns the an element property.

CF_EXPORT CFTypeRef IOHIDElementGetProperty(
    IOHIDElementRef element,
    CFStringRef key) ;  
Parameters
element

The element to be queried. If this parameter is not a valid IOHIDElementRef, the behavior is undefined.

key

The key to be used when querying the element.

Return Value

Returns the property.

Discussion

Property keys are prefixed by kIOHIDElement and declared in IOHIDKeys.h.

Availability
Introduced in Mac OS X v10.5.

IOHIDElementGetReportCount


Returns the report count for the element.

CF_EXPORT uint32_t IOHIDElementGetReportCount(
    IOHIDElementRef element) ;  
Parameters
element

The element to be queried. If this parameter is not a valid IOHIDElementRef, the behavior is undefined.

Return Value

Returns the report count.

Availability
Introduced in Mac OS X v10.5.

IOHIDElementGetReportID


Returns the report ID for the element.

CF_EXPORT uint32_t IOHIDElementGetReportID(
    IOHIDElementRef element) ;  
Parameters
element

The element to be queried. If this parameter is not a valid IOHIDElementRef, the behavior is undefined.

Return Value

Returns the report ID.

Discussion

The report ID represents what report this particular element belongs to.

Availability
Introduced in Mac OS X v10.5.

IOHIDElementGetReportSize


Returns the report size in bits for the element.

CF_EXPORT uint32_t IOHIDElementGetReportSize(
    IOHIDElementRef element) ;  
Parameters
element

The element to be queried. If this parameter is not a valid IOHIDElementRef, the behavior is undefined.

Return Value

Returns the report size.

Availability
Introduced in Mac OS X v10.5.

IOHIDElementGetType


Retrieves the type for the element.

CF_EXPORT IOHIDElementType IOHIDElementGetType(
    IOHIDElementRef element) ;  
Parameters
element

The element to be queried. If this parameter is not a valid IOHIDElementRef, the behavior is undefined.

Return Value

Returns the IOHIDElementType for the element.

Availability
Introduced in Mac OS X v10.5.

IOHIDElementGetTypeID


Returns the type identifier of all IOHIDElement instances.

CF_EXPORT CFTypeID IOHIDElementGetTypeID(
    void) ;  

Availability
Introduced in Mac OS X v10.5.

IOHIDElementGetUnit


Returns the unit property for the element.

CF_EXPORT uint32_t IOHIDElementGetUnit(
    IOHIDElementRef element) ;  
Parameters
element

The element to be queried. If this parameter is not a valid IOHIDElementRef, the behavior is undefined.

Return Value

Returns the unit.

Discussion

The unit property is described in more detail in Section 6.2.2.7 of the "Device Class Definition for Human Interface Devices(HID)" Specification, Version 1.11.

Availability
Introduced in Mac OS X v10.5.

IOHIDElementGetUnitExponent


Returns the unit exponenet in base 10 for the element.

CF_EXPORT uint32_t IOHIDElementGetUnitExponent(
    IOHIDElementRef element) ;  
Parameters
element

The element to be queried. If this parameter is not a valid IOHIDElementRef, the behavior is undefined.

Return Value

Returns the unit exponent.

Discussion

The unit exponent property is described in more detail in Section 6.2.2.7 of the "Device Class Definition for Human Interface Devices(HID)" Specification, Version 1.11.

Availability
Introduced in Mac OS X v10.5.

IOHIDElementGetUsage


Retrieves the usage for an element.

CF_EXPORT uint32_t IOHIDElementGetUsage(
    IOHIDElementRef element) ;  
Parameters
element

The element to be queried. If this parameter is not a valid IOHIDElementRef, the behavior is undefined.

Return Value

Returns the usage for the element.

Availability
Introduced in Mac OS X v10.5.

IOHIDElementGetUsagePage


Retrieves the usage page for an element.

CF_EXPORT uint32_t IOHIDElementGetUsagePage(
    IOHIDElementRef element) ;  
Parameters
element

The element to be queried. If this parameter is not a valid IOHIDElementRef, the behavior is undefined.

Return Value

Returns the usage page for the element.

Availability
Introduced in Mac OS X v10.5.

IOHIDElementHasNullState


Returns the null state property for the element.

CF_EXPORT Boolean IOHIDElementHasNullState(
    IOHIDElementRef element) ;  
Parameters
element

The element to be queried. If this parameter is not a valid IOHIDElementRef, the behavior is undefined.

Return Value

Returns TRUE if null state or FALSE if no null state.

Discussion

Indicates whether the element has a state in which it is not sending meaningful data.

Availability
Introduced in Mac OS X v10.5.

IOHIDElementHasPreferredState


Returns the preferred state property for the element.

CF_EXPORT Boolean IOHIDElementHasPreferredState(
    IOHIDElementRef element) ;  
Parameters
element

The element to be queried. If this parameter is not a valid IOHIDElementRef, the behavior is undefined.

Return Value

Returns TRUE if preferred state or FALSE if no preferred state.

Discussion

Indicates whether the element has a preferred state to which it will return when the user is not physically interacting with the control.

Availability
Introduced in Mac OS X v10.5.

IOHIDElementIsArray


Returns the array property for the element.

CF_EXPORT Boolean IOHIDElementIsArray(
    IOHIDElementRef element) ;  
Parameters
element

The element to be queried. If this parameter is not a valid IOHIDElementRef, the behavior is undefined.

Return Value

Returns TRUE if array or FALSE if variable.

Discussion

Indicates whether the element represents variable or array data values. Variable values represent data from a physical control. An array returns an index in each field that corresponds to the pressed button (like keyboard scan codes).
Note: The HID Manager will represent most elements as "variable" including the possible usages of an array. Array indices will remain as "array" elements with a usage of 0xffffffff.

Availability
Introduced in Mac OS X v10.5.

IOHIDElementIsNonLinear


Returns the linear property for the element.

CF_EXPORT Boolean IOHIDElementIsNonLinear(
    IOHIDElementRef element) ;  
Parameters
element

The element to be queried. If this parameter is not a valid IOHIDElementRef, the behavior is undefined.

Return Value

Returns TRUE if non linear or FALSE if linear.

Discussion

Indicates whether the value for the element has been processed in some way, and no longer represents a linear relationship between what is measured and the value that is reported.

Availability
Introduced in Mac OS X v10.5.

IOHIDElementIsRelative


Returns the relative property for the element.

CF_EXPORT Boolean IOHIDElementIsRelative(
    IOHIDElementRef element) ;  
Parameters
element

The element to be queried. If this parameter is not a valid IOHIDElementRef, the behavior is undefined.

Return Value

Returns TRUE if relative or FALSE if absolute.

Discussion

Indicates whether the data is relative (indicating the change in value from the last report) or absolute (based on a fixed origin).

Availability
Introduced in Mac OS X v10.5.

IOHIDElementIsVirtual


Returns the virtual property for the element.

CF_EXPORT Boolean IOHIDElementIsVirtual(
    IOHIDElementRef element) ;  
Parameters
element

The element to be queried. If this parameter is not a valid IOHIDElementRef, the behavior is undefined.

Return Value

Returns the TRUE if virtual or FALSE if not.

Discussion

Indicates whether the element is a virtual element.

Availability
Introduced in Mac OS X v10.5.

IOHIDElementIsWrapping


Returns the wrap property for the element.

CF_EXPORT Boolean IOHIDElementIsWrapping(
    IOHIDElementRef element) ;  
Parameters
element

The element to be queried. If this parameter is not a valid IOHIDElementRef, the behavior is undefined.

Return Value

Returns TRUE if wrapping or FALSE if non-wrapping.

Discussion

Wrap indicates whether the data "rolls over" when reaching either the extreme high or low value.

Availability
Introduced in Mac OS X v10.5.

IOHIDElementSetProperty


Sets an element property.

CF_EXPORT Boolean IOHIDElementSetProperty(
    IOHIDElementRef element,
    CFStringRef key,
    CFTypeRef property) ;  
Parameters
element

The element to be queried. If this parameter is not a valid IOHIDElementRef, the behavior is undefined.

key

The key to be used when querying the element.

Return Value

Returns TRUE if successful.

Discussion

This method can be used to set arbitrary element properties, such as application specific references.

Availability
Introduced in Mac OS X v10.5.


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