usbdrv/peripheral/public/d32usbdescriptors.h
changeset 33 089413cdde3c
child 55 3b97f0de7605
equal deleted inserted replaced
29:59aa7d6e3e0f 33:089413cdde3c
       
     1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of the License "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 #ifndef D32USBDESCRIPTORS_H
       
    17 #define D32USBDESCRIPTORS_H
       
    18 
       
    19 #include <e32base.h>
       
    20 
       
    21 
       
    22 /*****************************************************************************/
       
    23 /*                                                                           */
       
    24 /* USB descriptors parser framework                                          */
       
    25 /*                                                                           */
       
    26 /*****************************************************************************/
       
    27 
       
    28 class TUsbGenericDescriptor;
       
    29 
       
    30 /**
       
    31 The Symbian USB Descriptor Parsing Framework class.
       
    32 
       
    33 This class is to aid users of USBDI by providing the facilities to parse the
       
    34 raw descriptor data into wrapper classes that allow access to the fields in 
       
    35 the descriptor bodies, and pointers to map the serial data blob into the tree 
       
    36 structure that descriptors logically have.
       
    37 
       
    38 @publishedPartner Intended to be available to 3rd parties later
       
    39 @prototype
       
    40 */
       
    41 NONSHARABLE_CLASS(UsbDescriptorParser)
       
    42 	{
       
    43 public:
       
    44 	typedef TUsbGenericDescriptor* (*TUsbDescriptorParserL)(TPtrC8& aUsbDes, TUsbGenericDescriptor* aPreviousDesc);
       
    45 
       
    46 public:
       
    47 	// Main parse function.
       
    48 	IMPORT_C static TInt Parse(const TDesC8& aUsbDes, TUsbGenericDescriptor*& aDesc);
       
    49 
       
    50 	// Custom parsing framework.
       
    51 	IMPORT_C static void RegisterCustomParserL(TUsbDescriptorParserL aParserFunc);
       
    52 	IMPORT_C static void UnregisterCustomParser(TUsbDescriptorParserL aParserFunc);
       
    53 
       
    54 private:
       
    55 	static TUsbGenericDescriptor* FindParserAndParseAndCheckL(TPtrC8& aUsbDes, TUsbGenericDescriptor* aPreviousDesc);
       
    56 	static TUsbGenericDescriptor* FindParserAndParseL(TPtrC8& aUsbDes, TUsbGenericDescriptor* aPreviousDesc);
       
    57 	static void ParseDescriptorTreeL(TPtrC8& aUsbDes, TUsbGenericDescriptor& aPreviousDesc);
       
    58 	static void BuildTreeL(TUsbGenericDescriptor& aNewDesc, TUsbGenericDescriptor& aPreviousDesc);
       
    59 	static TUsbGenericDescriptor& FindSuitableParentL(TUsbGenericDescriptor& aNewDesc, TUsbGenericDescriptor& aTopParent);
       
    60 	static TUsbGenericDescriptor* UnknownUsbDescriptorParserL(TPtrC8& aUsbDes, TUsbGenericDescriptor* aPreviousDesc);
       
    61 	};
       
    62 
       
    63 
       
    64 /*****************************************************************************/
       
    65 /*                                                                           */
       
    66 /* USB standard descriptors                                                  */
       
    67 /*                                                                           */
       
    68 /*****************************************************************************/
       
    69 
       
    70 
       
    71 /**
       
    72 Base class for USB descriptors.
       
    73 All USB descriptors contain type and length, and may have peers and children.
       
    74 
       
    75 @publishedPartner Intended to be available to 3rd parties later
       
    76 @prototype
       
    77 */
       
    78 class TUsbGenericDescriptor
       
    79 	{
       
    80 public:
       
    81 	IMPORT_C TUsbGenericDescriptor();
       
    82 	
       
    83 	IMPORT_C void DestroyTree();
       
    84 
       
    85 	IMPORT_C TUint8 TUint8At(TInt aOffset) const;
       
    86 	IMPORT_C TUint16 TUint16At(TInt aOffset) const;
       
    87 	IMPORT_C TUint32 TUint32At(TInt aOffset) const;
       
    88 
       
    89 	IMPORT_C TUsbGenericDescriptor& operator=(const TUsbGenericDescriptor& aDescriptor);
       
    90 
       
    91 	/**
       
    92 	Helper function to allow TUsbGenericDescriptor types to be placed on the cleanup stack.
       
    93 	*/
       
    94 	inline operator TCleanupItem() { return TCleanupItem(Cleanup,this); }
       
    95 
       
    96 public:
       
    97 	virtual TBool IsParent(TUsbGenericDescriptor& aPotentialParent);
       
    98 	virtual TBool IsPeer(TUsbGenericDescriptor& aPotentialPeer);
       
    99 	virtual TBool IsChild(TUsbGenericDescriptor& aPotentialChild);
       
   100 
       
   101 private:
       
   102 	IMPORT_C static void Cleanup(TAny* aPtr);
       
   103 	static void WalkAndDelete(TUsbGenericDescriptor* aDesc);
       
   104 
       
   105 public:		// USB standard fields
       
   106 	/**
       
   107 	The offset in a standard USB descriptor to the bLength field.
       
   108 	*/
       
   109 	static const TInt KbLengthOffset = 0;
       
   110 
       
   111 	/**
       
   112 	The offset in a standard USB descriptor to the bDescriptorType field.
       
   113 	*/
       
   114 	static const TInt KbDescriptorTypeOffset = 1;
       
   115 
       
   116 	/**
       
   117 	Standard Length field.
       
   118 	*/
       
   119 	TUint8	ibLength;
       
   120 	
       
   121 	/**
       
   122 	Standard Type field.
       
   123 	*/
       
   124 	TUint8	ibDescriptorType;
       
   125 	
       
   126 public:
       
   127 	/**
       
   128 	The flag to indicate whether the USB descriptor has been recognised
       
   129 	and parsed.
       
   130 	*/
       
   131 	enum TUsbGenericDescriptorFlags
       
   132 		{
       
   133 		EUnrecognised = 0x00,
       
   134 		ERecognised = 0x01,
       
   135 		};
       
   136 	
       
   137 public:		// Symbian generated fields
       
   138 	/**
       
   139 	Flag to show if the descriptor has been recognised and parsed, or if its data can only be represented as a
       
   140 	binary blob.  This field should particularly be checked if writing code which may run on older versions of
       
   141 	the operating system, where a (now) known descriptor may not have been parsed, or before parsing a new
       
   142 	descriptor from a blob, where later versions of the operating system may have already extracted the fields.
       
   143 	*/
       
   144 	TUint8	iRecognisedAndParsed;
       
   145 
       
   146 	/**
       
   147 	A pointer to the next peer of this descriptor, or NULL.
       
   148 	As an example, an endpoint descriptor will contain pointers to any other endpoint descriptors on the same
       
   149 	interface.
       
   150 	*/
       
   151 	TUsbGenericDescriptor* iNextPeer;
       
   152 
       
   153 	/**
       
   154 	A pointer to the first child of this descriptor, or NULL.
       
   155 	As an example, an interface descriptor will contain a pointer to the first endpoint descriptor on the
       
   156 	interface. The iNextPeer member can then be used to examine other endpoints on the interface.
       
   157 	*/
       
   158 	TUsbGenericDescriptor* iFirstChild;
       
   159 	
       
   160 	/**
       
   161 	A pointer to the parent to this descriptor, or NULL.
       
   162 	As an example an endpoint descriptor from a configuration bundle will have the interface that it
       
   163 	is a member of as it's parent.
       
   164 	*/
       
   165 	TUsbGenericDescriptor* iParent;
       
   166 
       
   167 	/**
       
   168 	The binary blob that contains this descriptor
       
   169 	*/
       
   170 	TPtrC8			iBlob;
       
   171 	};
       
   172 
       
   173 enum TUsbDescriptorType
       
   174 	{
       
   175 	EDevice						= 1,
       
   176 	EConfiguration				= 2,
       
   177 	EString						= 3,
       
   178 	EInterface					= 4,
       
   179 	EEndpoint					= 5,
       
   180 	EDeviceQualifier			= 6,
       
   181 	EOtherSpeedConfiguration	= 7,
       
   182 	EInterfacePower				= 8,
       
   183 	EOTG						= 9,
       
   184 	EDebug						= 10,
       
   185 	EInterfaceAssociation		= 11,
       
   186 	};
       
   187 
       
   188 /**
       
   189 Device descriptor.
       
   190 
       
   191 See section 9.6.1 of the USB 2.0 specification.
       
   192 
       
   193 @publishedPartner Intended to be available to 3rd parties later
       
   194 @prototype
       
   195 */
       
   196 NONSHARABLE_CLASS(TUsbDeviceDescriptor) : public TUsbGenericDescriptor
       
   197 	{
       
   198 public:
       
   199 	IMPORT_C TUsbDeviceDescriptor();
       
   200 	IMPORT_C static TUsbDeviceDescriptor* Cast(TUsbGenericDescriptor* aOriginal);
       
   201 
       
   202 public:
       
   203 	static const TInt KSizeInOctets = 18;
       
   204 	enum TFieldOffsets
       
   205 		{
       
   206 		EbcdUSB				= 2,
       
   207 		EbDeviceClass		= 4,
       
   208 		EbDeviceSubClass	= 5,
       
   209 		EbDeviceProtocol	= 6,
       
   210 		EbMaxPacketSize0	= 7,
       
   211 		EidVendor			= 8,
       
   212 		EidProduct			= 10,
       
   213 		EbcdDevice			= 12,
       
   214 		EiManufacturer		= 14,
       
   215 		EiProduct			= 15,
       
   216 		EiSerialNumber		= 16,
       
   217 		EbNumConfigurations	= 17
       
   218 		};
       
   219 
       
   220 public:
       
   221 	IMPORT_C TUint16 USBBcd() const;
       
   222 	IMPORT_C TUint8 DeviceClass() const;
       
   223 	IMPORT_C TUint8 DeviceSubClass() const;
       
   224 	IMPORT_C TUint8 DeviceProtocol() const;
       
   225 	IMPORT_C TUint8 MaxPacketSize0() const;
       
   226 	IMPORT_C TUint16 VendorId() const;
       
   227 	IMPORT_C TUint16 ProductId() const;
       
   228 	IMPORT_C TUint16 DeviceBcd() const;
       
   229 	IMPORT_C TUint8 ManufacturerIndex() const;
       
   230 	IMPORT_C TUint8 ProductIndex() const;
       
   231 	IMPORT_C TUint8 SerialNumberIndex() const;
       
   232 	IMPORT_C TUint8 NumConfigurations() const;
       
   233 
       
   234 public:
       
   235 	static TUsbDeviceDescriptor* ParseL(TPtrC8& aUsbDes, TUsbGenericDescriptor* aPreviousDesc);
       
   236 	virtual TBool IsParent(TUsbGenericDescriptor& aPotentialParent);
       
   237 	virtual TBool IsPeer(TUsbGenericDescriptor& aPotentialPeer);
       
   238 	};
       
   239 
       
   240 
       
   241 /**
       
   242 Device Qualifier descriptor.
       
   243 
       
   244 See section 9.6.2 of the USB 2.0 specification.
       
   245 
       
   246 @publishedPartner Intended to be available to 3rd parties later
       
   247 @prototype
       
   248 */
       
   249 NONSHARABLE_CLASS(TUsbDeviceQualifierDescriptor) : public TUsbGenericDescriptor
       
   250 	{
       
   251 public:
       
   252 	IMPORT_C TUsbDeviceQualifierDescriptor();
       
   253 	IMPORT_C static TUsbDeviceQualifierDescriptor* Cast(TUsbGenericDescriptor* aOriginal);
       
   254 	
       
   255 public:
       
   256 	static const TInt KSizeInOctets = 10;
       
   257 	enum TFieldOffsets
       
   258 		{
       
   259 		EbcdUSB				= 2,
       
   260 		EbDeviceClass		= 4,
       
   261 		EbDeviceSubClass	= 5,
       
   262 		EbDeviceProtocol	= 6,
       
   263 		EbMaxPacketSize0	= 7,
       
   264 		EbNumConfigurations	= 8,
       
   265 		EbReserved			= 9
       
   266 		};
       
   267 
       
   268 public:
       
   269 	IMPORT_C TUint16 USBBcd() const;
       
   270 	IMPORT_C TUint8 DeviceClass() const;
       
   271 	IMPORT_C TUint8 DeviceSubClass() const;
       
   272 	IMPORT_C TUint8 DeviceProtocol() const;
       
   273 	IMPORT_C TUint8 MaxPacketSize0() const;
       
   274 	IMPORT_C TUint8 NumConfigurations() const;
       
   275 	IMPORT_C TUint8 Reserved() const;
       
   276 	
       
   277 public:
       
   278 	static TUsbDeviceQualifierDescriptor* ParseL(TPtrC8& aUsbDes, TUsbGenericDescriptor* aPreviousDesc);
       
   279 	virtual TBool IsParent(TUsbGenericDescriptor& aPotentialParent);
       
   280 	virtual TBool IsPeer(TUsbGenericDescriptor& aPotentialPeer);
       
   281 	};
       
   282 
       
   283 
       
   284 /**
       
   285 Configuration descriptor.
       
   286 
       
   287 See section 9.6.3 of the USB 2.0 specification.
       
   288 
       
   289 @publishedPartner Intended to be available to 3rd parties later
       
   290 @prototype
       
   291 */
       
   292 NONSHARABLE_CLASS(TUsbConfigurationDescriptor) : public TUsbGenericDescriptor
       
   293 	{
       
   294 public:
       
   295 	IMPORT_C TUsbConfigurationDescriptor();
       
   296 	IMPORT_C static TUsbConfigurationDescriptor* Cast(TUsbGenericDescriptor* aOriginal);
       
   297 
       
   298 public:
       
   299 	static const TInt KSizeInOctets = 9;
       
   300 	enum TFieldOffsets
       
   301 		{
       
   302 		EwTotalLength			= 2,
       
   303 		EbNumInterfaces			= 4,
       
   304 		EbConfigurationValue	= 5,
       
   305 		EiConfiguration			= 6,
       
   306 		EbmAttributes			= 7,
       
   307 		EbMaxPower				= 8
       
   308 		};
       
   309 
       
   310 public:
       
   311 	IMPORT_C TUint16 TotalLength() const;
       
   312 	IMPORT_C TUint8 NumInterfaces() const;
       
   313 	IMPORT_C TUint8 ConfigurationValue() const;
       
   314 	IMPORT_C TUint8 ConfigurationIndex() const;
       
   315 	IMPORT_C TUint8 Attributes() const;
       
   316 	IMPORT_C TUint8 MaxPower() const;
       
   317 
       
   318 public:
       
   319 	static TUsbConfigurationDescriptor* ParseL(TPtrC8& aUsbDes, TUsbGenericDescriptor* aPreviousDesc);
       
   320 	virtual TBool IsParent(TUsbGenericDescriptor& aPotentialParent);
       
   321 	virtual TBool IsPeer(TUsbGenericDescriptor& aPotentialPeer);
       
   322 	};
       
   323 
       
   324 
       
   325 /**
       
   326 Other Speed descriptor.
       
   327 
       
   328 See section 9.6.4 of the USB 2.0 specification.
       
   329 
       
   330 @publishedPartner Intended to be available to 3rd parties later
       
   331 @prototype
       
   332 */
       
   333 NONSHARABLE_CLASS(TUsbOtherSpeedDescriptor) : public TUsbGenericDescriptor
       
   334 	{
       
   335 public:
       
   336 	IMPORT_C TUsbOtherSpeedDescriptor();
       
   337 	IMPORT_C static TUsbOtherSpeedDescriptor* Cast(TUsbGenericDescriptor* aOriginal);
       
   338 
       
   339 public:
       
   340 	static const TInt KSizeInOctets = 9;
       
   341 	enum TFieldOffsets
       
   342 		{
       
   343 		EwTotalLength 			= 2,
       
   344 		EbNumInterfaces			= 4,
       
   345 		EbConfigurationValue	= 5,
       
   346 		EiConfiguration			= 6,
       
   347 		EbmAttributes			= 7,
       
   348 		EbMaxPower				= 8
       
   349 		};
       
   350 
       
   351 public:
       
   352 	IMPORT_C TUint16 TotalLength() const;
       
   353 	IMPORT_C TUint8 NumInterfaces() const;
       
   354 	IMPORT_C TUint8 ConfigurationValue() const;
       
   355 	IMPORT_C TUint8 ConfigurationIndex() const;
       
   356 	IMPORT_C TUint8 Attributes() const;
       
   357 	IMPORT_C TUint8 MaxPower() const;
       
   358 	
       
   359 public:
       
   360 	static TUsbOtherSpeedDescriptor* ParseL(TPtrC8& aUsbDes, TUsbGenericDescriptor* aPreviousDesc);
       
   361 	virtual TBool IsParent(TUsbGenericDescriptor& aPotentialParent);
       
   362 	virtual TBool IsPeer(TUsbGenericDescriptor& aPotentialPeer);
       
   363 	};
       
   364 
       
   365 
       
   366 /**
       
   367 Interface Association Descriptor
       
   368 
       
   369 See the USB IAD ECN.
       
   370 
       
   371 @publishedPartner Intended to be available to 3rd parties later
       
   372 @prototype
       
   373 */
       
   374 NONSHARABLE_CLASS(TUsbInterfaceAssociationDescriptor) : public TUsbGenericDescriptor
       
   375 	{
       
   376 public:
       
   377 	IMPORT_C TUsbInterfaceAssociationDescriptor();
       
   378 	IMPORT_C static TUsbInterfaceAssociationDescriptor* Cast(TUsbGenericDescriptor* aOriginal);
       
   379 
       
   380 public:
       
   381 	static const TInt KSizeInOctets = 8;
       
   382 	enum TFieldOffsets
       
   383 		{
       
   384 		EbFirstInterface	= 2,
       
   385 		EbInterfaceCount	= 3,
       
   386 		EbFunctionClass		= 4,
       
   387 		EbFunctionSubClass	= 5,
       
   388 		EbFunctionProtocol	= 6,
       
   389 		EiFunction			= 7
       
   390 		};
       
   391 	
       
   392 public:
       
   393 	IMPORT_C TUint8 FirstInterface() const;
       
   394 	IMPORT_C TUint8 InterfaceCount() const;
       
   395 	IMPORT_C TUint8 FunctionClass() const;
       
   396 	IMPORT_C TUint8 FunctionSubClass() const;
       
   397 	IMPORT_C TUint8 FunctionProtocol() const;
       
   398 	IMPORT_C TUint8 FunctionIndex() const;
       
   399 	
       
   400 public:
       
   401 	static TUsbInterfaceAssociationDescriptor* ParseL(TPtrC8& aUsbDes, TUsbGenericDescriptor* aPreviousDesc);
       
   402 	virtual TBool IsParent(TUsbGenericDescriptor& aPotentialParent);
       
   403 	virtual TBool IsPeer(TUsbGenericDescriptor& aPotentialPeer);
       
   404 	virtual TBool IsChild(TUsbGenericDescriptor& aPotentialChild);
       
   405 	};
       
   406 
       
   407 /**
       
   408 Interface descriptor.
       
   409 
       
   410 See section 9.6.5 of the USB 2.0 specification.
       
   411 
       
   412 @publishedPartner Intended to be available to 3rd parties later
       
   413 @prototype
       
   414 */
       
   415 NONSHARABLE_CLASS(TUsbInterfaceDescriptor) : public TUsbGenericDescriptor
       
   416 	{
       
   417 public:
       
   418 	IMPORT_C TUsbInterfaceDescriptor();
       
   419 	IMPORT_C static TUsbInterfaceDescriptor* Cast(TUsbGenericDescriptor* aOriginal);
       
   420 
       
   421 public:
       
   422 	static const TInt KSizeInOctets = 9;
       
   423 	enum TFieldOffsets
       
   424 		{
       
   425 		EbInterfaceNumber	= 2,
       
   426 		EbAlternateSetting	= 3,
       
   427 		EbNumEndpoints		= 4,
       
   428 		EbInterfaceClass	= 5,
       
   429 		EbInterfaceSubClass	= 6,
       
   430 		EbInterfaceProtocol	= 7,
       
   431 		EiInterface			= 8
       
   432 		};
       
   433 	
       
   434 public:
       
   435 	IMPORT_C TUint8 InterfaceNumber() const;
       
   436 	IMPORT_C TUint8 AlternateSetting() const;
       
   437 	IMPORT_C TUint8 NumEndpoints() const;
       
   438 	IMPORT_C TUint8 InterfaceClass() const;
       
   439 	IMPORT_C TUint8 InterfaceSubClass() const;
       
   440 	IMPORT_C TUint8 InterfaceProtocol() const;
       
   441 	IMPORT_C TUint8 Interface() const;
       
   442 	
       
   443 public:
       
   444 	static TUsbInterfaceDescriptor* ParseL(TPtrC8& aUsbDes, TUsbGenericDescriptor* aPreviousDesc);
       
   445 	virtual TBool IsParent(TUsbGenericDescriptor& aPotentialParent);
       
   446 	virtual TBool IsPeer(TUsbGenericDescriptor& aPotentialPeer);
       
   447 	};
       
   448 
       
   449 /**
       
   450 Endpoint descriptor.
       
   451 
       
   452 See section 9.6.6 of the USB 2.0 specification.
       
   453 Note these exclude support support for:
       
   454 'Standard AC Interrupt Endpoint Descriptor'
       
   455 'Standard AS Isochronous Synch Endpoint Descriptor'
       
   456 'Standard AS Isochronous Audio Data Endpoint Descriptor'
       
   457 as defined in USB Audio Device Class Spec v1.0 which are all 9 bytes in size.
       
   458 To support these custom descriptors may be registered with the
       
   459 parser.
       
   460 
       
   461 @publishedPartner Intended to be available to 3rd parties later
       
   462 @prototype
       
   463 */
       
   464 NONSHARABLE_CLASS(TUsbEndpointDescriptor) : public TUsbGenericDescriptor
       
   465 	{
       
   466 public:
       
   467 	IMPORT_C TUsbEndpointDescriptor();
       
   468 	IMPORT_C static TUsbEndpointDescriptor* Cast(TUsbGenericDescriptor* aOriginal);
       
   469 
       
   470 public:
       
   471 	static const TInt KSizeInOctets = 7;
       
   472 	enum TFieldOffsets
       
   473 		{
       
   474 		EbEndpointAddress	= 2,
       
   475 		EbmAttributes		= 3,
       
   476 		EwMaxPacketSize		= 4,
       
   477 		EbInterval			= 6
       
   478 		};
       
   479 
       
   480 public:
       
   481 	IMPORT_C TUint8 EndpointAddress() const;
       
   482 	IMPORT_C TUint8 Attributes() const;
       
   483 	IMPORT_C TUint16 MaxPacketSize() const;
       
   484 	IMPORT_C TUint8 Interval() const;
       
   485 	
       
   486 public:
       
   487 	static TUsbEndpointDescriptor* ParseL(TPtrC8& aUsbDes, TUsbGenericDescriptor* aPreviousDesc);
       
   488 	virtual TBool IsParent(TUsbGenericDescriptor& aPotentialParent);
       
   489 	virtual TBool IsPeer(TUsbGenericDescriptor& aPotentialPeer);
       
   490 	};
       
   491 
       
   492 /**
       
   493 String descriptor
       
   494 
       
   495 See section 9.6.7 of the USB 2.0 specification.
       
   496 
       
   497 @publishedPartner Intended to be available to 3rd parties later
       
   498 @prototype
       
   499 */
       
   500 NONSHARABLE_CLASS(TUsbStringDescriptor) : public TUsbGenericDescriptor
       
   501 	{
       
   502 public:
       
   503 	IMPORT_C TUsbStringDescriptor();
       
   504 	IMPORT_C static TUsbStringDescriptor* Cast(TUsbGenericDescriptor* aOriginal);
       
   505 
       
   506 public:
       
   507 	IMPORT_C TInt GetLangId(TInt aIndex) const;
       
   508 	IMPORT_C void StringData(TDes16& aString) const;
       
   509 
       
   510 public:
       
   511 	static TUsbStringDescriptor* ParseL(TPtrC8& aUsbDes, TUsbGenericDescriptor* aPreviousDesc);
       
   512 	virtual TBool IsParent(TUsbGenericDescriptor& aPotentialParent);
       
   513 	virtual TBool IsPeer(TUsbGenericDescriptor& aPotentialPeer);
       
   514 	};
       
   515 
       
   516 /**
       
   517 OTG descriptor.
       
   518 
       
   519 See section 6.4 of the USB 2.0 On-The-Go Supplement Revision 1.3
       
   520 
       
   521 @publishedPartner Intended to be available to 3rd parties later
       
   522 @prototype
       
   523 */
       
   524 NONSHARABLE_CLASS(TUsbOTGDescriptor) : public TUsbGenericDescriptor
       
   525 	{
       
   526 public:
       
   527 	IMPORT_C TUsbOTGDescriptor();
       
   528 	IMPORT_C static TUsbOTGDescriptor* Cast(TUsbGenericDescriptor* aOriginal);
       
   529 
       
   530 public:
       
   531 	static const TInt KSizeInOctets = 3;
       
   532 	enum TFieldOffsets
       
   533 		{
       
   534 		EbmAttributes		= 2
       
   535 		};
       
   536 
       
   537 public:
       
   538 	IMPORT_C TUint8 Attributes() const;
       
   539     IMPORT_C TBool HNPSupported() const;
       
   540     IMPORT_C TBool SRPSupported() const;
       
   541 public:
       
   542 	static TUsbOTGDescriptor* ParseL(TPtrC8& aUsbDes, TUsbGenericDescriptor* aPreviousDesc);
       
   543 	virtual TBool IsParent(TUsbGenericDescriptor& aPotentialParent);
       
   544 	virtual TBool IsPeer(TUsbGenericDescriptor& aPotentialPeer);
       
   545 	};
       
   546 
       
   547 
       
   548 #endif	// D32USBDESCRIPTORS_H