#ifndef _IOKIT_HID_IOHIDELEMENT_H
#define _IOKIT_HID_IOHIDELEMENT_H
#include <libkern/c++/OSArray.h>
#include <IOKit/hidsystem/IOHIDDescriptorParser.h>
#include "IOHIDLibUserClient.h"
class IOHIDDevice;
class IOHIDEventQueue;
enum {
kIOHIDTransactionStateIdle,
kIOHIDTransactionStatePending,
};
class IOHIDElement: public OSObject
{
OSDeclareDefaultStructors( IOHIDElement )
protected:
IOHIDDevice * _owner;
IOHIDElementType _type;
IOHIDElementCookie _cookie;
IOHIDElement * _nextReportHandler;
IOHIDElementValue * _elementValue;
void * _elementValueLocation;
IOHIDElement * _parent;
OSArray * _childArray;
OSArray * _queueArray;
UInt32 _flags;
UInt32 _reportSize;
UInt32 _reportCount;
UInt32 _reportStartBit;
UInt32 _reportBits;
UInt8 _reportID;
UInt8 _reportType;
UInt32 _usagePage;
UInt32 _usageMin;
UInt32 _usageMax;
UInt32 _rangeIndex;
UInt32 _logicalMin;
UInt32 _logicalMax;
UInt32 _physicalMin;
UInt32 _physicalMax;
UInt32 _unitExponent;
UInt32 _units;
UInt32 _transactionState;
IOHIDElement * _arrayReportHandler;
OSDictionary * _colArrayReportHandlers;
OSArray * _arrayItems;
UInt32 * _oldArraySelectors;
virtual bool init( IOHIDDevice * owner, IOHIDElementType type );
virtual void free();
virtual IOHIDElement * newSubElement( UInt16 rangeIndex ) const;
virtual bool createSubElements();
static IOHIDElement * arrayHandlerElement(
IOHIDDevice * owner,
IOHIDElementType type,
IOHIDElement * child,
IOHIDElement * parent);
public:
static IOHIDElement * buttonElement(
IOHIDDevice * owner,
IOHIDElementType type,
HIDButtonCapabilitiesPtr button,
IOHIDElement * parent = 0 );
static IOHIDElement * valueElement(
IOHIDDevice * owner,
IOHIDElementType type,
HIDValueCapabilitiesPtr value,
IOHIDElement * parent = 0 );
static IOHIDElement * collectionElement(
IOHIDDevice * owner,
IOHIDElementType type,
HIDCollectionNodePtr collection,
IOHIDElement * parent = 0 );
virtual bool serialize( OSSerialize * s ) const;
virtual bool addChildElement( IOHIDElement * child );
virtual bool processReport( UInt8 reportID,
void * reportData,
UInt32 reportLength,
const AbsoluteTime * timestamp,
IOHIDElement ** next );
virtual bool createReport( UInt8 reportID,
void * reportData, UInt32 * reportLength,
IOHIDElement ** next );
virtual void processArrayReport(void * reportData);
virtual void createArrayReport(void * reportData);
virtual void setArrayElementValue(UInt32 index, UInt32 value);
virtual bool setMemoryForElementValue( IOVirtualAddress address,
void * location );
virtual IOHIDElement * setNextReportHandler( IOHIDElement * element );
virtual UInt32 getElementValueSize() const;
virtual UInt32 getRangeCount() const;
virtual bool getReportType( IOHIDReportType * reportType ) const;
virtual UInt32 setReportSize( UInt32 numberOfBits );
virtual bool addEventQueue( IOHIDEventQueue * queue );
virtual bool removeEventQueue( IOHIDEventQueue * queue );
virtual bool hasEventQueue( IOHIDEventQueue * queue );
inline UInt8 getReportID() const
{ return _reportID; }
inline IOHIDElement * getNextReportHandler() const
{ return _nextReportHandler; }
inline IOHIDElementCookie getElementCookie() const
{ return _cookie; }
inline IOHIDDevice * getOwner() const
{ return _owner; }
inline OSArray * getChildArray() const
{ return _childArray; }
inline IOHIDElementType getElementType() const
{ return _type; }
inline UInt32 getRangeIndex() const
{ return _rangeIndex; }
inline UInt32 getReportSize() const
{ return _reportSize; }
inline void setTransactionState(UInt32 state)
{ _transactionState = state;}
inline UInt32 getTransactionState() const
{ return _transactionState; }
virtual void setOutOfBoundsValue();
};
#endif