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 sender Interface instance sending the completion routine.
86    @param type The type of the report that was completed.
87    @param reportID The ID of the report that was completed.
88    @param report Pointer to the buffer containing the contents of the report.
89    @param reportLength Size of the buffer received upon completion.
90*/
91typedef void (*IOHIDReportCallback) (
92                                    void *                  context,
93                                    IOReturn                result,
94                                    void *                  sender,
95                                    IOHIDReportType         type,
96                                    uint32_t                reportID,
97                                    uint8_t *               report,
98                                    CFIndex                 reportLength);
99
100/*! @typedef IOHIDReportCallback
101    @discussion Type and arguments of callout C function that is used when a HID report completion routine is called.
102    @param context void * pointer to your data, often a pointer to an object.
103    @param result Completion result of desired operation.
104    @param sender Interface instance sending the completion routine.
105    @param type The type of the report that was completed.
106    @param reportID The ID of the report that was completed.
107    @param report Pointer to the buffer containing the contents of the report.
108    @param reportLength Size of the buffer received upon completion.
109    @param timeStamp The time at which the report arrived.
110*/
111typedef void (*IOHIDReportWithTimeStampCallback) (
112                                    void *                  context,
113                                    IOReturn                result,
114                                    void *                  sender,
115                                    IOHIDReportType         type,
116                                    uint32_t                reportID,
117                                    uint8_t *               report,
118                                    CFIndex                 reportLength,
119                                    uint64_t                timeStamp);
120
121/*! @typedef IOHIDValueCallback
122    @discussion Type and arguments of callout C function that is used when an element value completion routine is called.
123    @param context void * pointer to more data.
124    @param result Completion result of desired operation.
125    @param sender Interface instance sending the completion routine.
126    @param value IOHIDValueRef containing the returned element value.
127*/
128typedef void (*IOHIDValueCallback) (
129                                    void *                  context,
130                                    IOReturn                result,
131                                    void *                  sender,
132                                    IOHIDValueRef           value);
133
134/*! @typedef IOHIDValueMultipleCallback
135    @discussion Type and arguments of callout C function that is used when an element value completion routine is called.
136    @param context void * pointer to more data.
137    @param result Completion result of desired operation.
138    @param sender Interface instance sending the completion routine.
139    @param multiple CFDictionaryRef containing the returned element key value pairs.
140*/
141typedef void (*IOHIDValueMultipleCallback) (
142                                    void *                  context,
143                                    IOReturn                result,
144                                    void *                  sender,
145                                    CFDictionaryRef         multiple);
146
147/*! @typedef IOHIDDeviceCallback
148    @discussion Type and arguments of callout C function that is used when a device routine is called.
149    @param context void * pointer to more data.
150    @param result Completion result of desired operation.
151    @param device IOHIDDeviceRef containing the sending device.
152*/
153typedef void (*IOHIDDeviceCallback) (
154                                    void *                  context,
155                                    IOReturn                result,
156                                    void *                  sender,
157                                    IOHIDDeviceRef          device);
158
159__END_DECLS
160#endif /* _IOKIT_HID_IOHIDBASE_H_ */
161