TUsbGenericDescriptor Class Reference

class TUsbGenericDescriptor

Base class for USB descriptors. All USB descriptors contain type and length, and may have peers and children.

Intended to be available to 3rd parties later

Constructor & Destructor Documentation

TUsbGenericDescriptor()

IMPORT_C TUsbGenericDescriptor ( )

Member Functions Documentation

Cleanup(TAny *)

IMPORT_C void Cleanup ( TAny * aPtr ) [private, static]

Ensures no memory is leaked if an owned TUsbGenericDescriptor is no longer needed.

Parameters

TAny * aPtr The TUsbGenericDescriptor that is to be cleaned up.

DestroyTree()

IMPORT_C void DestroyTree ( )

Deletes all child and peer descriptors. Does not delete this descriptor, the caller is responsible for doing this separately.

IsChild(TUsbGenericDescriptor &)

TBool IsChild ( TUsbGenericDescriptor & aPotentialChild ) [virtual]

This function determines whether the given USB descriptor is a child of the descriptor the method is called on. The implementation may be specialised for each type of descriptor to ensure the tree is correctly built up.

Parameters

TUsbGenericDescriptor & aPotentialChild The USB descriptor that is being queried to see if it is a child.

IsParent(TUsbGenericDescriptor &)

TBool IsParent ( TUsbGenericDescriptor & aPotentialParent ) [virtual]

This function determines whether the given USB descriptor is a parent of the descriptor the method is called on. The implementation may be specialised for each type of descriptor to ensure the tree is correctly built up.

Parameters

TUsbGenericDescriptor & aPotentialParent

IsPeer(TUsbGenericDescriptor &)

TBool IsPeer ( TUsbGenericDescriptor & aPotentialPeer ) [virtual]

This function determines whether the given USB descriptor is a peer of the descriptor the method is called on. The implementation may be specialised for each type of descriptor to ensure the tree is correctly built up.

Parameters

TUsbGenericDescriptor & aPotentialPeer The USB descriptor that is being queried to see if it is a peer.

TUint16At(TInt)

IMPORT_C TUint16 TUint16At ( TInt aOffset ) const

Utility method to retrieve a TUint16 value from a given offset in the descriptor.

Parameters

TInt aOffset The offset in the binary blob at which to retrieve the value.

TUint32At(TInt)

IMPORT_C TUint32 TUint32At ( TInt aOffset ) const

Utility method to retrieve a TUint32 value from a given offset in the descriptor.

Parameters

TInt aOffset The offset in the binary blob at which to retrieve the value.

TUint8At(TInt)

IMPORT_C TUint8 TUint8At ( TInt aOffset ) const

Utility method to retrieve a TUint8 value from a given offset in the descriptor.

Parameters

TInt aOffset The offset in the binary blob at which to retrieve the value.

WalkAndDelete(TUsbGenericDescriptor *)

void WalkAndDelete ( TUsbGenericDescriptor * aDesc ) [private, static]

Parameters

TUsbGenericDescriptor * aDesc

operator TCleanupItem()

operator TCleanupItem ( ) [inline]

Helper function to allow TUsbGenericDescriptor types to be placed on the cleanup stack.

operator=(const TUsbGenericDescriptor &)

IMPORT_C TUsbGenericDescriptor & operator= ( const TUsbGenericDescriptor & aDescriptor )

Assignment operator to fill in the TUsbGenericDescriptor fields from a TUsbGenericDescriptor . Note that if a TUsbGenericDescriptor derived class has additional member fields then they should define a specialised assignment overload for that type.

Parameters

const TUsbGenericDescriptor & aDescriptor

Member Enumerations Documentation

Enum TUsbGenericDescriptorFlags

The flag to indicate whether the USB descriptor has been recognised and parsed.

Enumerators

EUnrecognised = 0x00
ERecognised = 0x01

Member Data Documentation

const TInt KbDescriptorTypeOffset

const TInt KbDescriptorTypeOffset [static]

The offset in a standard USB descriptor to the bDescriptorType field.

const TInt KbLengthOffset

const TInt KbLengthOffset [static]

The offset in a standard USB descriptor to the bLength field.

TPtrC8 iBlob

TPtrC8 iBlob

The binary blob that contains this descriptor

TUsbGenericDescriptor * iFirstChild

TUsbGenericDescriptor * iFirstChild

A pointer to the first child of this descriptor, or NULL. As an example, an interface descriptor will contain a pointer to the first endpoint descriptor on the interface. The iNextPeer member can then be used to examine other endpoints on the interface.

TUsbGenericDescriptor * iNextPeer

TUsbGenericDescriptor * iNextPeer

A pointer to the next peer of this descriptor, or NULL. As an example, an endpoint descriptor will contain pointers to any other endpoint descriptors on the same interface.

TUsbGenericDescriptor * iParent

TUsbGenericDescriptor * iParent

A pointer to the parent to this descriptor, or NULL. As an example an endpoint descriptor from a configuration bundle will have the interface that it is a member of as it's parent.

TUint8 iRecognisedAndParsed

TUint8 iRecognisedAndParsed

Flag to show if the descriptor has been recognised and parsed, or if its data can only be represented as a binary blob. This field should particularly be checked if writing code which may run on older versions of the operating system, where a (now) known descriptor may not have been parsed, or before parsing a new descriptor from a blob, where later versions of the operating system may have already extracted the fields.

TUint8 ibDescriptorType

TUint8 ibDescriptorType

Standard Type field.

TUint8 ibLength

TUint8 ibLength

Standard Length field.