1/*
2 * Copyright (c) 1999-2008 Apple Computer, Inc.  All Rights Reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
12 *
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23
24#ifndef _IOKIT_HID_IOHIDBASE_H_
25#define _IOKIT_HID_IOHIDBASE_H_
26
27#include <IOKit/hid/IOHIDKeys.h>
28
29__BEGIN_DECLS
30
31/*! @typedef IOHIDDeviceRef
32	This is the type of a reference to the IOHIDDevice.
33*/
34typedef struct __IOHIDDevice * IOHIDDeviceRef;
35
36/*! @typedef IOHIDElementRef
37	This is the type of a reference to the IOHIDElement.
38*/
39typedef struct __IOHIDElement * IOHIDElementRef;
40
41/*! @typedef IOHIDValueRef
42	This is the type of a reference to the IOHIDValue.
43*/
44typedef struct __IOHIDValue * IOHIDValueRef;
45
46/*!
47    @typedef    IOHIDTransactionDirectionType
48    @abstract   Direction for an IOHIDDeviceTransactionInterface.
49    @constant   kIOHIDTransactionDirectionTypeInput Transaction direction used for requesting element values from a device.
50    @constant   kIOHIDTransactionDirectionTypeOutput Transaction direction used for dispatching element values to a device.
51*/
52enum {
53    kIOHIDTransactionDirectionTypeInput,
54    kIOHIDTransactionDirectionTypeOutput
55};
56typedef uint32_t IOHIDTransactionDirectionType;
57
58/*!
59    @enum       IOHIDTransactionOption
60    @abstract   Options to be used in conjuntion with an IOHIDDeviceTransactionInterface.
61    @constant   kIOHIDTransactionOptionDefaultOutputValue Option to set the default element value to be used with an
62                IOHIDDeviceTransactionInterface of direction kIOHIDTransactionDirectionTypeOutput.
63*/
64enum {
65    kIOHIDTransactionOptionDefaultOutputValue = 0x0001
66};
67
68
69/*! @typedef IOHIDCallback
70    @discussion Type and arguments of callout C function that is used when a completion routine is called.
71    @param context void * pointer to your data, often a pointer to an object.
72    @param result Completion result of desired operation.
73    @param refcon void * pointer to more data.
74    @param sender Interface instance sending the completion routine.
75*/
76typedef void (*IOHIDCallback)(
77                                    void *                  context,
78                                    IOReturn                result,
79                                    void *                  sender);
80
81/*! @typedef IOHIDReportCallback
82    @discussion Type and arguments of callout C function that is used when a HID report completion routine is called.
83    @param context void * pointer to your data, often a pointer to an object.
84    @param result Completion result of desired operation.
85    @param refcon void * pointer to more data.
86    @param sender Interface instance sending the completion routine.
87    @param type The type of the report that was completed.
88    @param reportID The ID of the report that was completed.
89    @param report Pointer to the buffer containing the contents of the report.
90    @param reportLength Size of the buffer received upon completion.
91*/
92typedef void (*IOHIDReportCallback) (
93                                    void *                  context,
94                                    IOReturn                result,
95                                    void *                  sender,
96                                    IOHIDReportType         type,
97                                    uint32_t                reportID,
98                                    uint8_t *               report,
99                                    CFIndex                 reportLength);
100
101/*! @typedef IOHIDValueCallback
102    @discussion Type and arguments of callout C function that is used when an element value completion routine is called.
103    @param context void * pointer to more data.
104    @param result Completion result of desired operation.
105    @param sender Interface instance sending the completion routine.
106    @param value IOHIDValueRef containing the returned element value.
107*/
108typedef void (*IOHIDValueCallback) (
109                                    void *                  context,
110                                    IOReturn                result,
111                                    void *                  sender,
112                                    IOHIDValueRef           value);
113
114/*! @typedef IOHIDValueMultipleCallback
115    @discussion Type and arguments of callout C function that is used when an element value completion routine is called.
116    @param context void * pointer to more data.
117    @param result Completion result of desired operation.
118    @param sender Interface instance sending the completion routine.
119    @param multiple CFDictionaryRef containing the returned element key value pairs.
120*/
121typedef void (*IOHIDValueMultipleCallback) (
122                                    void *                  context,
123                                    IOReturn                result,
124                                    void *                  sender,
125                                    CFDictionaryRef         multiple);
126
127/*! @typedef IOHIDDeviceCallback
128    @discussion Type and arguments of callout C function that is used when a device routine is called.
129    @param context void * pointer to more data.
130    @param result Completion result of desired operation.
131    @param device IOHIDDeviceRef containing the sending device.
132*/
133typedef void (*IOHIDDeviceCallback) (
134                                    void *                  context,
135                                    IOReturn                result,
136                                    void *                  sender,
137                                    IOHIDDeviceRef          device);
138
139__END_DECLS
140#endif /* _IOKIT_HID_IOHIDBASE_H_ */
141