CParser Class Reference
class CParser : public CBase |
HID parser CParser parses a HID report descriptor. It outputs a CReportRoot containing a tree of CCollection and CField objects representing the descriptor information. A HID device driver can then use this, in conjunction with TReportTranslator and CReportGenerator objects, to facilitate communication with a HID device.
The parsing process conforms to the HID class specification document: "USB Device Class Definition for Human Interface Devices
(HID)", Firmware Specification, Version 1.11, USB Implementers' Forum, June 2001.
generichid.lib
- Since
- S60 v5.0
Private Member Enumerations |
---|
enum | THidGlobalTags { EGlobalUsagePage = 0x00, EGlobalLogicalMinimum = 0x01, EGlobalLogicalMaximum = 0x02, EGlobalPhysicalMinimum = 0x03, EGlobalPhysicalMaximum = 0x04, EGlobalUnitExponent = 0x05, EGlobalUnit = 0x06, EGlobalReportSize = 0x07, EGlobalReportId = 0x08, EGlobalReportCount = 0x09, EGlobalPush = 0x0a, EGlobalPop = 0x0b } |
enum | THidItem { EUsagePage = 1<<0, ELogicalMin = 1<<1, ELogicalMax = 1<<2, EReportSize = 1<<3, EReportCount = 1<<4, EReportId = 1<<5, EUsageMin = 1<<6, EUsageMax = 1<<7, EPhysicalMin = 1<<8, EPhysicalMax = 1<<9, EUnit = 1<<10, EUnitExponent = 1<<11, EDesignatorIndex = 1<<12, EDesignatorMin = 1<<13, EDesignatorMax = 1<<14, EStringIndex = 1<<15, EStringMin = 1<<16, EStringMax = 1<<17, EInputReport = 1<<18, EOutputReport = 1<<19, EFeatureReport = 1<<20, EDelimiter = 1<<21, EUsageId = 1<<22 } |
enum | THidLocalTags { ELocalUsage = 0x00, ELocalUsageMinimum = 0x01, ELocalUsageMaximum = 0x02, ELocalDesignatorIndex = 0x03, ELocalDesignatorMinimum = 0x04, ELocalDesignatorMaximum = 0x05, ELocalStringIndex = 0x07, ELocalStringMinimum = 0x08, ELocalStringMaximum = 0x09, ELocalDelimiter = 0x0a } |
enum | THidMainTags { EMainInput = 0x08, EMainOutput = 0x09, EMainFeature = 0x0b, EMainCollection = 0x0a, EMainEndCollection = 0x0c } |
Constructor & Destructor Documentation
Member Functions Documentation
BitsToRepresentRange(TInt, TInt)
TInt
| BitsToRepresentRange | ( | TInt | aMin, |
| TInt | aMax |
| ) | [private, static] |
BitsToRepresentRange() returns the number of bits required to represent all values in a given range. It is used to check that the report field size is appropriate for the given logical minimum and maximum.
If the range is all positive then it is assumed that there is no sign bit, otherwise twos complement format is assumed, as per the HID class specification, v1.11, Section 6.2.2.7.
Parameters
TInt aMin | Logical minimum |
TInt aMax | Logical maximum |
CheckAllReportSizes()
TBool
| CheckAllReportSizes | ( | ) | const [private] |
CheckDesignatorMinAndMaxErrors()
TInt
| CheckDesignatorMinAndMaxErrors | ( | ) | [private] |
CheckDesignatorMinAndMaxErrors
CheckFieldBitNeeded(CField::TType, TUint32)
CheckForCollectionErrors(TUint32)
CheckForCollectionErrors() validates the current collection object. It adds non-critical errors to the warnings list. It returns an error code if a critical error is encountered.
Parameters
TUint32 aType | The type of the collection (one of the CCollection::TType values, or vendor defined). |
CheckForFieldErrors(CField::TType, TUint32)
CheckForFieldErrors() validates the current global and local item state in preparation for creating a CField object. It adds non-critical errors to the warnings list. It returns an error code if a critical error is encountered.
CheckForMainErrors()
TInt
| CheckForMainErrors | ( | ) | [private] |
CheckLogicalMinAndMax(TUint32)
void | CheckLogicalMinAndMax | ( | TUint32 | aAttributes | ) | [private] |
CheckLogicalMinAndMax Check if logical minimum and maximum must match the number of usage values
CheckMandatoryFieldErrors(CField::TType, TUint32)
CheckMandatoryFieldExistence(CField::TType, TUint32)
CheckParseErrors()
void | CheckParseErrors | ( | ) | [private] |
CheckStringMinAndMaxErrors()
TInt
| CheckStringMinAndMaxErrors | ( | ) | [private] |
CheckStringMinAndMaxErrors
CheckUsageMinAndMaxErrors()
TInt
| CheckUsageMinAndMaxErrors | ( | ) | [private] |
CheckUsageMinAndMaxErrors
ClearLocalState()
void | ClearLocalState | ( | ) | [private] |
Collection()
Used to access the current collection object, i.e. the object at the top of the collection stack (iCollectionStack).
ConstructL()
void | ConstructL | ( | ) | [private] |
CreateCollectionL(TUint32)
Parameters
TUint32 aType | The type of the collection. This can be one of the seven standard types defined in CCollection::TType, or a vendor defined value. |
CreateFieldL(CField::TType, TUint32)
CreateFieldL() is called to instantiate a new CField object when an input, output or feature item is encountered in the report descriptor.
The current local and global states extracted from the report descriptor are copied to the CField, which is placed into the current CCollection.
Parameters
CField::TType aType | The type of field: input, output or feature |
TUint32 aAttributes | The attributes for the field (e.g. Data, Array, Absolute.) |
DumpStateTableL(CField *)
void | DumpStateTableL | ( | CField * | aField | ) | const [private] |
Parameters
CField * aField | The field object to receive the data |
GlobalItemL(const TItem &)
TInt
| GlobalItemL | ( | const TItem & | aItem | ) | [private] |
Handle a HID descriptor global item. Stores the data in the appropriate member of the current global state object, iGlobal.
Parameters
const TItem & aItem | The current report descriptor tag and its associated data |
HandleGlobalLogicalMaximum(const TItem &)
TInt
| HandleGlobalLogicalMaximum | ( | const TItem & | aItem | ) | [private] |
HandleGlobalLogicalMaximum
- Since
- S60 ?S60_version *** for example, S60 v3.0
Parameters
const TItem & aItem | a Hid field item |
HandleGlobalLogicalMinimum(const TItem &)
TInt
| HandleGlobalLogicalMinimum | ( | const TItem & | aItem | ) | [private] |
HandleGlobalLogicalMinimum
Parameters
const TItem & aItem | a Hid field item |
HandleGlobalPhysicalMaximum(const TItem &)
TInt
| HandleGlobalPhysicalMaximum | ( | const TItem & | aItem | ) | [private] |
HandleGlobalPhysicalMinimum
Parameters
const TItem & aItem | a Hid field item |
HandleGlobalPhysicalMinimum(const TItem &)
TInt
| HandleGlobalPhysicalMinimum | ( | const TItem & | aItem | ) | [private] |
HandleGlobalPhysicalMinimum
Parameters
const TItem & aItem | a Hid field item |
HandleGlobalPop(const TItem &)
TInt
| HandleGlobalPop | ( | const TItem & | aItem | ) | [private] |
Parameters
const TItem & aItem | a Hid field item |
HandleGlobalPushL(const TItem &)
TInt
| HandleGlobalPushL | ( | const TItem & | aItem | ) | [private] |
Parameters
const TItem & aItem | a Hid field item |
HandleGlobalReportCount(const TItem &)
TInt
| HandleGlobalReportCount | ( | const TItem & | aItem | ) | [private] |
Parameters
const TItem & aItem | a Hid field item |
HandleGlobalReportId(const TItem &)
TInt
| HandleGlobalReportId | ( | const TItem & | aItem | ) | [private] |
Parameters
const TItem & aItem | a Hid field item |
HandleGlobalReportSize(const TItem &)
TInt
| HandleGlobalReportSize | ( | const TItem & | aItem | ) | [private] |
Parameters
const TItem & aItem | a Hid field item |
HandleGlobalUnit(const TItem &)
TInt
| HandleGlobalUnit | ( | const TItem & | aItem | ) | [private] |
Parameters
const TItem & aItem | a Hid field item |
HandleGlobalUnitExponent(const TItem &)
TInt
| HandleGlobalUnitExponent | ( | const TItem & | aItem | ) | [private] |
Parameters
const TItem & aItem | a Hid field item |
HandleGlobalUsagePage(const TItem &)
TInt
| HandleGlobalUsagePage | ( | const TItem & | aItem | ) | [private] |
Parameters
const TItem & aItem | a Hid field item |
HandleItemL(TItem &)
void | HandleItemL | ( | TItem & | aItem | ) | [private] |
HandleLocalDelimiter(const TItem &)
TInt
| HandleLocalDelimiter | ( | const TItem & | aItem | ) | [private] |
Parameters
const TItem & aItem | a Hid field item |
HandleLocalDesignatorIndex(const TItem &)
TInt
| HandleLocalDesignatorIndex | ( | const TItem & | aItem | ) | [private] |
HandleLocalDesignatorIndex
Parameters
const TItem & aItem | a Hid field item |
HandleLocalDesignatorMaximum(const TItem &)
TInt
| HandleLocalDesignatorMaximum | ( | const TItem & | aItem | ) | [private] |
HandleLocalDesignatorMaximum
Parameters
const TItem & aItem | a Hid field item |
HandleLocalDesignatorMinimum(const TItem &)
TInt
| HandleLocalDesignatorMinimum | ( | const TItem & | aItem | ) | [private] |
HandleLocalDesignatorMinimum
Parameters
const TItem & aItem | a Hid field item |
HandleLocalStringIndex(const TItem &)
TInt
| HandleLocalStringIndex | ( | const TItem & | aItem | ) | [private] |
Parameters
const TItem & aItem | a Hid field item |
HandleLocalStringMaximum(const TItem &)
TInt
| HandleLocalStringMaximum | ( | const TItem & | aItem | ) | [private] |
Parameters
const TItem & aItem | a Hid field item |
HandleLocalStringMinimum(const TItem &)
TInt
| HandleLocalStringMinimum | ( | const TItem & | aItem | ) | [private] |
Parameters
const TItem & aItem | a Hid field item |
HandleLocalUsageL(const TItem &)
TInt
| HandleLocalUsageL | ( | const TItem & | aItem | ) | [private] |
Parameters
const TItem & aItem | a Hid field item |
HandleLocalUsageMaximum(const TItem &)
TInt
| HandleLocalUsageMaximum | ( | const TItem & | aItem | ) | [private] |
Parameters
const TItem & aItem | a Hid field item |
HandleLocalUsageMinimum(const TItem &)
TInt
| HandleLocalUsageMinimum | ( | const TItem & | aItem | ) | [private] |
Parameters
const TItem & aItem | a Hid field item |
HandleMainCollectionL(const TItem &)
TInt
| HandleMainCollectionL | ( | const TItem & | aItem | ) | [private] |
Parameters
const TItem & aItem | a Hid field item |
HandleMainEndCollection(const TItem &)
TInt
| HandleMainEndCollection | ( | const TItem & | aItem | ) | [private] |
Parameters
const TItem & aItem | a Hid field item |
HandleMainFeatureL(const TItem &)
TInt
| HandleMainFeatureL | ( | const TItem & | aItem | ) | [private] |
Parameters
const TItem & aItem | a Hid field item |
HandleMainInputTagL(const TItem &)
TInt
| HandleMainInputTagL | ( | const TItem & | aItem | ) | [private] |
Parameters
const TItem & aItem | a Hid field item |
HandleMainOutputTagL(const TItem &)
TInt
| HandleMainOutputTagL | ( | const TItem & | aItem | ) | [private] |
Parameters
const TItem & aItem | a Hid field item |
IsReservedUsagePage(TInt)
TBool
| IsReservedUsagePage | ( | TInt | aUsagePage | ) | [private, static] |
IsReservedUsagePage() checks if the given HID usage page is listed as reserved according to the HID clas specification, v1.11.
Parameters
TInt aUsagePage | The usage page to check. |
IssueWarning(TInt)
void | IssueWarning | ( | TInt | aHidWarningCode | ) | [private] |
Parameters
TInt aHidWarningCode | The error or warning code, which should be in the standard HID format. |
LocalItemL(const TItem &)
Handle a HID descriptor local item. Stores the data in the appropriate member of the local state object, *iLocal.
Parameters
const TItem & aItem | The current report descriptor tag and its associated data |
MainItemL(const TItem &)
Handle a HID descriptor main item. This includes the creation of new field objects in the current collection and management of the global item state stack.
Parameters
const TItem & aItem | The current report descriptor tag and its associated data |
NumberOfLeadingZeros(TUint32)
TInt
| NumberOfLeadingZeros | ( | TUint32 | aValue | ) | [private, static] |
Parameters
TUint32 aValue | Unsigned 32-bit value |
ParseL(const TDesC8 &)
ParseL() parses a string of bytes representing a HID report descriptor. It returns a tree of collection and field objects (a CReportRoot). Ownership of the CReportRoot is transferred to the caller.
Warning messages produced during the parse process are added to a list which the driver can retrieve using the Warnings() function. Note that the list will be overwritten by the next ParseL() operation.
Errors and warnings are represented using the format described in "HID Parser Error Codes", Revision 1.2, USB Implementers' Forum, February 2000.
Parameters
const TDesC8 & aRawData | The report descriptor data to be processed |
PopCollection()
void | PopCollection | ( | ) | [private] |
Pushes a pointer to the current collection object on to the collection stack.
Note that the collection stack is used to create the tree of collections. It should not be confused with the global state stack, iGlobalStack.
PushCollectionL(const CCollection *)
void | PushCollectionL | ( | const CCollection * | aCollection | ) | [private] |
Pushes a pointer to the current collection object on to the collection stack.
Note that the collection stack is used to create the tree of collections. It should not be confused with the global state stack, iGlobalStack.
Parameters
const CCollection * aCollection | The collection to be pushed onto the stack |
ResetParserL()
void | ResetParserL | ( | ) | [private] |
Member Enumerations Documentation
Enum THidGlobalTags
Enumerators
EGlobalUsagePage = 0x00 | |
EGlobalLogicalMinimum = 0x01 | |
EGlobalLogicalMaximum = 0x02 | |
EGlobalPhysicalMinimum = 0x03 | |
EGlobalPhysicalMaximum = 0x04 | |
EGlobalUnitExponent = 0x05 | |
EGlobalUnit = 0x06 | |
EGlobalReportSize = 0x07 | |
EGlobalReportId = 0x08 | |
EGlobalReportCount = 0x09 | |
EGlobalPush = 0x0a | |
EGlobalPop = 0x0b | |
Enum THidItem
THidItem defineds a set of flags used for keeping track of which items have been encountered in the report descriptor for the current report field. The flags are used with the iItemsDefined and iGlobalItemsDefined data members.
Enumerators
EUsagePage = 1<<0 | |
ELogicalMin = 1<<1 | |
ELogicalMax = 1<<2 | |
EReportSize = 1<<3 | |
EReportCount = 1<<4 | |
EReportId = 1<<5 | |
EUsageMin = 1<<6 | |
EUsageMax = 1<<7 | |
EPhysicalMin = 1<<8 | |
EPhysicalMax = 1<<9 | |
EUnit = 1<<10 | |
EUnitExponent = 1<<11 | |
EDesignatorIndex = 1<<12 | |
EDesignatorMin = 1<<13 | |
EDesignatorMax = 1<<14 | |
EStringIndex = 1<<15 | |
EStringMin = 1<<16 | |
EStringMax = 1<<17 | |
EInputReport = 1<<18 | |
EOutputReport = 1<<19 | |
EFeatureReport = 1<<20 | |
EDelimiter = 1<<21 | |
EUsageId = 1<<22 | |
Enum THidLocalTags
Enumerators
ELocalUsage = 0x00 | |
ELocalUsageMinimum = 0x01 | |
ELocalUsageMaximum = 0x02 | |
ELocalDesignatorIndex = 0x03 | |
ELocalDesignatorMinimum = 0x04 | |
ELocalDesignatorMaximum = 0x05 | |
ELocalStringIndex = 0x07 | |
ELocalStringMinimum = 0x08 | |
ELocalStringMaximum = 0x09 | |
ELocalDelimiter = 0x0a | |
Enum THidMainTags
Enumerators
EMainInput = 0x08 | |
EMainOutput = 0x09 | |
EMainFeature = 0x0b | |
EMainCollection = 0x0a | |
EMainEndCollection = 0x0c | |
Member Data Documentation
const TUint32 KLocalItemMask
const TUint32 | KLocalItemMask | [private, static] |
A bitmask containing the THidItem flags which represent local (as opposed to main or global) items.
const TUint32 KMandatoryItemMask
const TUint32 | KMandatoryItemMask | [private, static] |
A bitmask containing the THidItem flags which represent mandatory items.
const TUint32 KReportItemMask
const TUint32 | KReportItemMask | [private, static] |
A bitmask containing the THidItem flags which represent report items.
const TUint32 KUnusedLocalItemsMask
const TUint32 | KUnusedLocalItemsMask | [private, static] |
A bitmask containing the THidItem flags which represent local unused items.
TInt
iAliasCount
TInt
| iAliasCount | [private] |
Count of alternate USAGE declarations so far
TInt
iAliasCountMax
TInt
| iAliasCountMax | [private] |
Count of alternate USAGE_MAX declarations
TInt
iAliasCountMin
TInt
| iAliasCountMin | [private] |
Count of alternate USAGE_MIN declarations
RPointerArray< CCollection > iCollectionStack
Stack used to create the collection tree
TInt
iErrorCode
Record of any critical error encountered
TInt
iFieldCount
TInt
| iFieldCount | [private] |
TParserGlobalState
iGlobal
TUint32
iGlobalItemsDefined
TUint32
| iGlobalItemsDefined | [private] |
Global items seen since the last main tag
RArray< TParserGlobalState > iGlobalStack
Global state stack, to allow HID descriptor PUSH and POP commands
TInt
iItemNumber
TInt
| iItemNumber | [private] |
Number of the item we're currently processing
TUint32
iItemsDefined
All items forming the current item state
CField * iLocal
The local state, cleared after each "Main" item Own.
TBool
iLocalMultipleUse
TBool
| iLocalMultipleUse | [private] |
ETrue if a redundant local item is seen
CReportRoot * iReportRoot
The root node of the collection tree Own.
TBool
iWithinDelimiter
TBool
| iWithinDelimiter | [private] |
ETrue if currently within a delimiter pair
Copyright ©2010 Nokia Corporation and/or its subsidiary(-ies).
All rights
reserved. Unless otherwise stated, these materials are provided under the terms of the Eclipse Public License
v1.0.