📄 iohidlib.h
字号:
//// BEGIN READABLE STRUCTURE DEFINITIONS // // This portion of uncompiled code provides a more reader friendly representation of // the CFPlugin methods defined above.#if 0/*! @class IOHIDDeviceInterface @discussion CFPlugin object subclass which provides the primary interface to HID devices.*/typedef struct IOHIDDeviceInterface{ IUNKNOWN_C_GUTS;/*! @function createAsyncEventSource @abstract Creates async eventsource. @discussion This method will create an async mach port, if one has not already been created. @param source Reference to CFRunLoopSourceRef that is created. @result Returns an IOReturn code.*/ IOReturn (*createAsyncEventSource)(void * self, CFRunLoopSourceRef * source);/*! @function getAsyncEventSource @abstract Gets the created async event source. @result Returns a CFRunLoopSourceRef.*/ CFRunLoopSourceRef (*getAsyncEventSource)(void * self); /*! @function createAsyncPort @abstract Creates an async port. @discussion The port must be created before any callbacks can be used. @param port Reference to mach port that is created. @result Returns an IOReturn code.*/ IOReturn (*createAsyncPort)(void * self, mach_port_t * port); /*! @function getAsyncPort @abstract Gets the current async port. @result Returns a mach_port_t.*/ mach_port_t (*getAsyncPort)(void * self); /*! @function open @abstract Opens the device. @param flags Flags to be passed down to the user client. @result Returns an IOReturn code.*/ IOReturn (*open)(void * self, UInt32 flags); /*! @function close @abstract Closes the device. @result Returns an IOReturn code.*/ IOReturn (*close)(void * self);/*! @function setRemovalCallback @abstract Sets callback to be used when device is removed. @param removalCallback Called when the device is removed. @param removeTarget Passed to the callback. @param removalRefcon Passed to the callback. @result Returns an IOReturn code.*/ IOReturn (*setRemovalCallback)(void * self, IOHIDCallbackFunction removalCallback, void * removalTarget, void * removalRefcon);/*! @function getElementValue @abstract Obtains the most recent value of an element. @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. @param elementCookie The element of interest. @param valueEvent The event that will be filled. If a long value is present, it is up to the caller to deallocate it. @result Returns an IOReturn code.*/ IOReturn (*getElementValue)(void * self, IOHIDElementCookie elementCookie, IOHIDEventStruct * valueEvent);/*! @function setElementValue @abstract Sets an element value on the device. @discussion This call is most useful for feature type elements. It is recommended to use IOOutputTransaction for output type elements. @param elementCookie The element of interest. @param valueEvent The event that will be filled. If a long value is present, it will be copied. @param timeoutMS UNSUPPORTED. @param callback UNSUPPORTED. @param callbackTarget UNSUPPORTED. @param callbackRefcon UNSUPPORTED. @result Returns an IOReturn code.*/ IOReturn (*setElementValue)(void * self, IOHIDElementCookie elementCookie, IOHIDEventStruct * valueEvent, UInt32 timeoutMS, IOHIDElementCallbackFunction callback, void * callbackTarget, void * callbackRefcon);/*! @function queryElementValue @abstract Obtains the current value of an element. @discussion This call is most useful for feature type elements. This method will poll the device for the current element value. @param elementCookie The element of interest. @param valueEvent The event that will be filled. If a long value is present, it is up to the caller to deallocate it. @param timeoutMS UNSUPPORTED. @param callback UNSUPPORTED. @param callbackTarget UNSUPPORTED. @param callbackRefcon UNSUPPORTED. @result Returns an IOReturn code.*/ IOReturn (*queryElementValue)(void * self, IOHIDElementCookie elementCookie, IOHIDEventStruct * valueEvent, UInt32 timeoutMS, IOHIDElementCallbackFunction callback, void * callbackTarget, void * callbackRefcon);/*! @function startAllQueues @abstract Starts data delivery on all queues for this device. @result Returns an IOReturn code.*/ IOReturn (*startAllQueues)(void * self); /*! @function stopAllQueues @abstract Stops data delivery on all queues for this device. @result Returns an IOReturn code.*/ IOReturn (*stopAllQueues)(void * self);/*! @function allocQueue @abstract Wrapper to return instances of the IOHIDQueueInterface. @result Returns the created IOHIDQueueInterface.*/ IOHIDQueueInterface ** (*allocQueue) (void *self); /*! @function allocOutputTransaction @abstract Wrapper to return instances of the IOHIDOutputTransactionInterface. @result Returns the created IOHIDOutputTransactionInterface.*/ IOHIDOutputTransactionInterface ** (*allocOutputTransaction) (void *self); } IOHIDDeviceInterface;/*! @class IOHIDDeviceInterface121 @discussion CFPlugin object subclass which provides the primary interface to HID devices. This class is a subclass of IOHIDDeviceInterface.*/typedef struct IOHIDDeviceInterface121{ IUNKNOWN_C_GUTS; IOHIDDEVICEINTERFACE_FUNCS_100;/*! @function setReport @abstract Sends a report to the device. @param reportType The report type. @param reportID The report id. @param reportBuffer Pointer to a preallocated buffer. @param reportBufferSize Size of the reportBuffer in bytes. @param timeoutMS @param callback If null, this method will behave synchronously. @param callbackTarget The callback target passed to the callback. @param callbackRefcon The callback refcon passed to the callback. @result Returns an IOReturn code.*/ IOReturn (*setReport) (void * self, IOHIDReportType reportType, UInt32 reportID, void * reportBuffer, UInt32 reportBufferSize, UInt32 timeoutMS, IOHIDReportCallbackFunction callback, void * callbackTarget, void * callbackRefcon);/*! @function getReport @abstract Obtains a report from the device. @param reportType The report type. @param reportID The report ID. @param reportBuffer Pointer to a preallocated buffer. @param reportBufferSize Size of the reportBuffer in bytes. When finished, will contain the actual size of the report. @param timeoutMS @param callback If null, this method will behave synchronously. @param callbackTarget The callback target passed to the callback. @param callbackRefcon The callback refcon passed to the callback. @result Returns an IOReturn code.*/ IOReturn (*getReport) (void * self, IOHIDReportType reportType, UInt32 reportID, void * reportBuffer, UInt32 * reportBufferSize, UInt32 timeoutMS, IOHIDReportCallbackFunction callback, void * callbackTarget, void * callbackRefcon); }IOHIDDeviceInterface121;/*! @class IOHIDDeviceInterface122 @discussion CFPlugin object subclass which provides the primary interface to HID devices. This class is a subclass of IOHIDDeviceInterface121.*/typedef struct IOHIDDeviceInterface122{ IUNKNOWN_C_GUTS; IOHIDDEVICEINTERFACE_FUNCS_100; IOHIDDEVICEINTERFACE_FUNCS_121;/*! @function copyMatchingElements @abstract Obtains specific elements defined by the device. @discussion Using keys defined in IOHIDKeys.h for elements, create a matching dictonary containing items that you wish to search for. A null array indicates that no elements matching that criteria were found. Each item in the array is a reference to the same dictionary item that represents each element in the I/O Registry. It is up to the caller to release the returned array of elements. @param matchingDict Dictionary containg key/value pairs to match on. Pass a null value to match on all elements. @param elements Pointer to a CFArrayRef that will be returned by this method. It is up to the caller to release it when finished. @result Returns an IOReturn code. */ IOReturn (*copyMatchingElements)(void * self, CFDictionaryRef matchingDict, CFArrayRef * elements); /*! @function setInterruptReportHandlerCallback @abstract Sets the report handler callout to be called when the data is received from the Interrupt-In pipe. @discussion In order for this to work correctly, you must call createAsyncPort and createAsyncEventSource. @param reportBuffer Pointer to a preallocated buffer. @param reportBufferSize Size of the reportBuffer in bytes. @param callback If non-NULL, is a callback to be called when data is received from the device. @param callbackTarget The callback target passed to the callback @param callbackRefcon The callback refcon passed to the callback. @result Returns an IOReturn code. */ IOReturn (*setInterruptReportHandlerCallback)( void * self, void * reportBuffer, UInt32 reportBufferSize, IOHIDReportCallbackFunction callback, void * callbackTarget, void * callbackRefcon); }IOHIDDeviceInterface122;/*! @class IOHIDQueueInterface @discussion CFPlugin object subclass which provides an interface for input queues from HID devices. Created by an IOHIDDeviceInterface object.*/typedef struct IOHIDQueueInterface{ IUNKNOWN_C_GUTS;/*! @function createAsyncEventSource @abstract Creates an async event source. @discussion This will be used with setEventCallout. @param source The newly created event source. @result Returns an IOReturn code. */ IOReturn (*createAsyncEventSource)(void * self, CFRunLoopSourceRef * source);/*! @function getAsyncEventSource @abstract Obtains the current event source. @result Returns a CFRunLoopSourceRef.*/ CFRunLoopSourceRef (*getAsyncEventSource)(void * self);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -