#ifndef _IOKIT_IOHIDQueueClass_H
#define _IOKIT_IOHIDQueueClass_H
#include <IOKit/IODataQueueShared.h>
#include "IOHIDDeviceClass.h"
class IOHIDQueueClass : public IOHIDIUnknown
{
private:
friend class IOHIDDeviceClass;
IOHIDQueueClass(IOHIDQueueClass &src);
void operator =(IOHIDQueueClass &src);
protected:
IOHIDQueueClass();
virtual ~IOHIDQueueClass();
static IOHIDQueueInterface sHIDQueueInterfaceV1;
struct InterfaceMap fHIDQueue;
mach_port_t fAsyncPort;
CFRunLoopSourceRef fCFSource;
bool fIsCreated;
UInt32 fCreatedFlags;
UInt32 fCreatedDepth;
unsigned int fQueueRef;
IODataQueueMemory * fQueueMappedMemory;
vm_size_t fQueueMappedMemorySize;
IOHIDDeviceClass * fOwningDevice;
static void queueEventSourceCallback(CFMachPortRef *cfPort, mach_msg_header_t *msg, CFIndex size, void *info);
IOHIDCallbackFunction fEventCallback;
void * fEventTarget;
void * fEventRefcon;
public:
void setOwningDevice (IOHIDDeviceClass * owningDevice) { fOwningDevice = owningDevice; };
void * getInterfaceMap (void) { return &fHIDQueue; };
virtual HRESULT queryInterface(REFIID iid, void **ppv);
virtual IOReturn createAsyncEventSource(CFRunLoopSourceRef *source);
virtual CFRunLoopSourceRef getAsyncEventSource();
virtual IOReturn createAsyncPort(mach_port_t *port);
virtual mach_port_t getAsyncPort();
virtual IOReturn create (UInt32 flags,
UInt32 depth);
virtual IOReturn dispose ();
virtual IOReturn addElement (IOHIDElementCookie elementCookie,
UInt32 flags);
virtual IOReturn removeElement (IOHIDElementCookie elementCookie);
virtual Boolean hasElement (IOHIDElementCookie elementCookie);
virtual IOReturn start ();
virtual IOReturn stop ();
virtual IOReturn getNextEvent (
IOHIDEventStruct * event,
AbsoluteTime maxTime,
UInt32 timeoutMS);
virtual IOReturn setEventCallout (
IOHIDCallbackFunction callback,
void * callbackTarget,
void * callbackRefcon);
virtual IOReturn getEventCallout (
IOHIDCallbackFunction * outCallback,
void ** outCallbackTarget,
void ** outCallbackRefcon);
protected:
static inline IOHIDQueueClass *getThis(void *self)
{ return (IOHIDQueueClass *) ((InterfaceMap *) self)->obj; };
static IOReturn queueCreateAsyncEventSource(void *self,
CFRunLoopSourceRef *source);
static CFRunLoopSourceRef queueGetAsyncEventSource(void *self);
static IOReturn queueCreateAsyncPort(void *self, mach_port_t *port);
static mach_port_t queueGetAsyncPort(void *self);
static IOReturn queueCreate (void * self,
UInt32 flags,
UInt32 depth);
static IOReturn queueDispose (void * self);
static IOReturn queueAddElement (void * self,
IOHIDElementCookie elementCookie,
UInt32 flags);
static IOReturn queueRemoveElement (void * self, IOHIDElementCookie elementCookie);
static Boolean queueHasElement (void * self, IOHIDElementCookie elementCookie);
static IOReturn queueStart (void * self);
static IOReturn queueStop (void * self);
static IOReturn queueGetNextEvent (
void * self,
IOHIDEventStruct * event,
AbsoluteTime maxTime,
UInt32 timeoutMS);
static IOReturn queueSetEventCallout (
void * self,
IOHIDCallbackFunction callback,
void * callbackTarget,
void * callbackRefcon);
static IOReturn queueGetEventCallout (
void * self,
IOHIDCallbackFunction * outCallback,
void ** outCallbackTarget,
void ** outCallbackRefcon);
};
#endif