📄 iohidlib.h
字号:
/* *INDENT-OFF* *//* * * @APPLE_LICENSE_HEADER_START@ * * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. * * This file contains Original Code and/or Modifications of Original Code * as defined in and that are subject to the Apple Public Source License * Version 2.0 (the 'License'). You may not use this file except in * compliance with the License. Please obtain a copy of the License at * http://www.opensource.apple.com/apsl/ and read it before using this * file. * * The Original Code and all software distributed under the License are * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. * Please see the License for the specific language governing rights and * limitations under the License. * * @APPLE_LICENSE_HEADER_END@ */#ifndef _IOKIT_HID_IOHIDLIB_H_#define _IOKIT_HID_IOHIDLIB_H_#include <sys/cdefs.h>__BEGIN_DECLS#include <CoreFoundation/CoreFoundation.h>#if COREFOUNDATION_CFPLUGINCOM_SEPARATE#include <CoreFoundation/CFPlugInCOM.h>#endif#include <IOKit/IOTypes.h>#include <IOKit/IOReturn.h>#include <IOKit/hid/IOHIDKeys.h>struct IOHIDEventStruct{ IOHIDElementType type; IOHIDElementCookie elementCookie; SInt32 value; AbsoluteTime timestamp; UInt32 longValueSize; void * longValue;};typedef struct IOHIDEventStruct IOHIDEventStruct;/* FA12FA38-6F1A-11D4-BA0C-0005028F18D5 */#define kIOHIDDeviceUserClientTypeID CFUUIDGetConstantUUIDWithBytes(NULL, \ 0xFA, 0x12, 0xFA, 0x38, 0x6F, 0x1A, 0x11, 0xD4, \ 0xBA, 0x0C, 0x00, 0x05, 0x02, 0x8F, 0x18, 0xD5)/* 13AA9C44-6F1B-11D4-907C-0005028F18D5 */#define kIOHIDDeviceFactoryID CFUUIDGetConstantUUIDWithBytes(NULL, \ 0x13, 0xAA, 0x9C, 0x44, 0x6F, 0x1B, 0x11, 0xD4, \ 0x90, 0x7C, 0x00, 0x05, 0x02, 0x8F, 0x18, 0xD5)/* 78BD420C-6F14-11D4-9474-0005028F18D5 *//*! @defined kIOHIDDeviceInterfaceID @discussion Interface ID for the IOHIDDeviceInterface. Corresponds to an available HID device. */#define kIOHIDDeviceInterfaceID CFUUIDGetConstantUUIDWithBytes(NULL, \ 0x78, 0xBD, 0x42, 0x0C, 0x6F, 0x14, 0x11, 0xD4, \ 0x94, 0x74, 0x00, 0x05, 0x02, 0x8F, 0x18, 0xD5) /* 7D0B510E-16D5-11D7-9E9B-000393992E38 *//*! @defined kIOHIDDeviceInterfaceID121 @discussion Interface ID for the IOHIDDeviceInterface121. Corresponds to an available HID device that includes methods from IOHIDDeviceInterface. This interface is available on IOHIDLib 1.2.1 and Mac OS X 10.2.3 or later.*/#define kIOHIDDeviceInterfaceID121 CFUUIDGetConstantUUIDWithBytes(NULL, \ 0x7d, 0xb, 0x51, 0xe, 0x16, 0xd5, 0x11, 0xd7, \ 0x9e, 0x9b, 0x0, 0x3, 0x93, 0x99, 0x2e, 0x38)/* B70ABF31-16D5-11D7-AB35-000393992E38 *//*! @defined kIOHIDDeviceInterfaceID122 @discussion Interface ID for the IOHIDDeviceInterface122. Corresponds to an available HID device that includes methods from IOHIDDeviceInterface and IOHIDDeviceInterface121. This interface is available on IOHIDLib 1.2.2 and Mac OS X 10.3 or later.*/#define kIOHIDDeviceInterfaceID122 CFUUIDGetConstantUUIDWithBytes(NULL, \ 0xb7, 0xa, 0xbf, 0x31, 0x16, 0xd5, 0x11, 0xd7, \ 0xab, 0x35, 0x0, 0x3, 0x93, 0x99, 0x2e, 0x38)/* 8138629E-6F14-11D4-970E-0005028F18D5 *//*! @defined kIOHIDQueueInterfaceID @discussion Interface ID for the kIOHIDQueueInterfaceID. Corresponds to a queue for a specific HID device. */#define kIOHIDQueueInterfaceID CFUUIDGetConstantUUIDWithBytes(NULL, \ 0x81, 0x38, 0x62, 0x9E, 0x6F, 0x14, 0x11, 0xD4, \ 0x97, 0x0E, 0x00, 0x05, 0x02, 0x8F, 0x18, 0xD5)/* 80CDCC00-755D-11D4-8E0F-0005028F18D5 *//*! @defined kIOHIDOutputTransactionInterfaceID @discussion Interface ID for the kIOHIDOutputTransactionInterfaceID. Corresponds to an output transaction for one or more report IDs on a specific device. */#define kIOHIDOutputTransactionInterfaceID CFUUIDGetConstantUUIDWithBytes(NULL,\ 0x80, 0xCD, 0xCC, 0x00, 0x75, 0x5D, 0x11, 0xD4, \ 0x80, 0xEF, 0x00, 0x05, 0x02, 0x8F, 0x18, 0xD5)/*! @typedef IOHIDCallbackFunction @discussion Type and arguments of callout C function that is used when a completion routine is called, see IOHIDLib.h:setRemovalCallback(). @param target void * pointer to your data, often a pointer to an object. @param result Completion result of desired operation. @param refcon void * pointer to more data. @param sender Interface instance sending the completion routine.*/typedef void (*IOHIDCallbackFunction) (void * target, IOReturn result, void * refcon, void * sender);/*! @typedef IOHIDElementCallbackFunction @discussion Type and arguments of callout C function that is used when a completion routine is called, see IOHIDLib.h:setElementValue(). @param target void * pointer to your data, often a pointer to an object. @param result Completion result of desired operation. @param refcon void * pointer to more data. @param sender Interface instance sending the completion routine. @param elementCookie Element within interface instance sending completion.*/typedef void (*IOHIDElementCallbackFunction) (void * target, IOReturn result, void * refcon, void * sender, IOHIDElementCookie elementCookie);/*! @typedef IOHIDReportCallbackFunction @discussion Type and arguments of callout C function that is used when a completion routine is called, see IOHIDLib.h:setReport(). @param target void * pointer to your data, often a pointer to an object. @param result Completion result of desired operation. @param refcon void * pointer to more data. @param sender Interface instance sending the completion routine. @param bufferSize Size of the buffer received upon completion.*/typedef void (*IOHIDReportCallbackFunction) (void * target, IOReturn result, void * refcon, void * sender, UInt32 bufferSize); /* Forward declarations of the queue and output transaction interfaces */struct IOHIDQueueInterface;struct IOHIDOutputTransactionInterface;typedef struct IOHIDQueueInterface IOHIDQueueInterface;typedef struct IOHIDOutputTransactionInterface IOHIDOutputTransactionInterface;//// IOHIDDeviceInterface Functions available in version 1.0 (10.0) and higher of Mac OS X//#define IOHIDDEVICEINTERFACE_FUNCS_100 \ IOReturn (*createAsyncEventSource)(void * self, CFRunLoopSourceRef * source); \ CFRunLoopSourceRef (*getAsyncEventSource)(void * self); \ IOReturn (*createAsyncPort)(void * self, mach_port_t * port); \ mach_port_t (*getAsyncPort)(void * self); \ IOReturn (*open)(void * self, UInt32 flags); \ IOReturn (*close)(void * self); \ IOReturn (*setRemovalCallback)(void * self, IOHIDCallbackFunction removalCallback, \ void * removalTarget, void * removalRefcon); \ IOReturn (*getElementValue)(void * self, IOHIDElementCookie elementCookie, \ IOHIDEventStruct * valueEvent); \ IOReturn (*setElementValue)(void * self, IOHIDElementCookie elementCookie, \ IOHIDEventStruct * valueEvent, UInt32 timeoutMS, \ IOHIDElementCallbackFunction callback, \ void * callbackTarget, void * callbackRefcon); \ IOReturn (*queryElementValue)(void * self, IOHIDElementCookie elementCookie, \ IOHIDEventStruct * valueEvent, UInt32 timeoutMS, \ IOHIDElementCallbackFunction callback, \ void * callbackTarget, void * callbackRefcon); \ IOReturn (*startAllQueues)(void * self); \ IOReturn (*stopAllQueues)(void * self); \ IOHIDQueueInterface ** (*allocQueue) (void *self); \ IOHIDOutputTransactionInterface ** (*allocOutputTransaction) (void *self) //// IOHIDDeviceInterface Functions available in version 1.2.1 (10.2.3) and higher of Mac OS X//#define IOHIDDEVICEINTERFACE_FUNCS_121 \ IOReturn (*setReport)(void * self, IOHIDReportType reportType, UInt32 reportID, \ void * reportBuffer, UInt32 reportBufferSize, \ UInt32 timeoutMS, IOHIDReportCallbackFunction callback, \ void * callbackTarget, void * callbackRefcon); \ IOReturn (*getReport)(void * self, IOHIDReportType reportType, \ UInt32 reportID, void * reportBuffer, \ UInt32 * reportBufferSize, UInt32 timeoutMS, \ IOHIDReportCallbackFunction callback, \ void * callbackTarget, void * callbackRefcon) //// IOHIDDeviceInterface Functions available in version 1.2.2 (10.3) and higher of Mac OS X//#define IOHIDDEVICEINTERFACE_FUNCS_122 \ IOReturn (*copyMatchingElements)(void * self, CFDictionaryRef matchingDict, \ CFArrayRef * elements); \ IOReturn (*setInterruptReportHandlerCallback)(void * self, void * reportBuffer, \ UInt32 reportBufferSize, \ IOHIDReportCallbackFunction callback, \ void * callbackTarget, void * callbackRefcon) typedef struct IOHIDDeviceInterface{ IUNKNOWN_C_GUTS; IOHIDDEVICEINTERFACE_FUNCS_100; IOHIDDEVICEINTERFACE_FUNCS_121;} IOHIDDeviceInterface;typedef struct IOHIDDeviceInterface121{ IUNKNOWN_C_GUTS; IOHIDDEVICEINTERFACE_FUNCS_100; IOHIDDEVICEINTERFACE_FUNCS_121;} IOHIDDeviceInterface121;typedef struct IOHIDDeviceInterface122{ IUNKNOWN_C_GUTS; IOHIDDEVICEINTERFACE_FUNCS_100; IOHIDDEVICEINTERFACE_FUNCS_121; IOHIDDEVICEINTERFACE_FUNCS_122;} IOHIDDeviceInterface122;//// IOHIDQueueInterface Functions available in version 1.0 (10.0) and higher of Mac OS X//#define IOHIDQUEUEINTERFACE_FUNCS_100 \ IOReturn (*createAsyncEventSource)(void * self, CFRunLoopSourceRef * source); \ CFRunLoopSourceRef (*getAsyncEventSource)(void * self); \ IOReturn (*createAsyncPort)(void * self, mach_port_t * port); \ mach_port_t (*getAsyncPort)(void * self); \ IOReturn (*create)(void * self, UInt32 flags, UInt32 depth); \ IOReturn (*dispose)(void * self); \ IOReturn (*addElement)(void * self, IOHIDElementCookie elementCookie, UInt32 flags);\ IOReturn (*removeElement)(void * self, IOHIDElementCookie elementCookie); \ Boolean (*hasElement)(void * self, IOHIDElementCookie elementCookie); \ IOReturn (*start)(void * self); \ IOReturn (*stop)(void * self); \ IOReturn (*getNextEvent)(void * self, IOHIDEventStruct * event, \ AbsoluteTime maxTime, UInt32 timeoutMS); \ IOReturn (*setEventCallout)(void * self, IOHIDCallbackFunction callback, \ void * callbackTarget, void * callbackRefcon); \ IOReturn (*getEventCallout)(void * self, IOHIDCallbackFunction * outCallback, \ void ** outCallbackTarget, void ** outCallbackRefcon)struct IOHIDQueueInterface{ IUNKNOWN_C_GUTS; IOHIDQUEUEINTERFACE_FUNCS_100;};//// IOHIDOutputTransactionInterface Functions available in version 1.2 (10.2) and higher of Mac OS X//#define IOHIDOUTPUTTRANSACTIONINTERFACE_FUNCS_120 \ IOReturn (*createAsyncEventSource)(void * self, CFRunLoopSourceRef * source); \ CFRunLoopSourceRef (*getAsyncEventSource)(void * self); \ IOReturn (*createAsyncPort)(void * self, mach_port_t * port); \ mach_port_t (*getAsyncPort)(void * self); \ IOReturn (*create)(void * self); \ IOReturn (*dispose)(void * self); \ IOReturn (*addElement)(void * self, IOHIDElementCookie elementCookie); \ IOReturn (*removeElement)(void * self, IOHIDElementCookie elementCookie); \ Boolean (*hasElement)(void * self, IOHIDElementCookie elementCookie); \ IOReturn (*setElementDefault)(void *self, IOHIDElementCookie elementCookie, \ IOHIDEventStruct * valueEvent); \ IOReturn (*getElementDefault)(void * self, IOHIDElementCookie elementCookie, \ IOHIDEventStruct * outValueEvent); \ IOReturn (*setElementValue)(void * self, IOHIDElementCookie elementCookie, \ IOHIDEventStruct * valueEvent); \ IOReturn (*getElementValue)(void * self, IOHIDElementCookie elementCookie, \ IOHIDEventStruct * outValueEvent); \ IOReturn (*commit)(void * self, UInt32 timeoutMS, IOHIDCallbackFunction callback, \ void * callbackTarget, void * callbackRefcon); \ IOReturn (*clear)(void * self)struct IOHIDOutputTransactionInterface{ IUNKNOWN_C_GUTS; IOHIDOUTPUTTRANSACTIONINTERFACE_FUNCS_120;};
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -