mtptransports/mtpptpiptransport/ptpipdatatypes/inc/cptpipgenericcontainer.h
changeset 0 d0791faffa3f
equal deleted inserted replaced
-1:000000000000 0:d0791faffa3f
       
     1 // Copyright (c) 2008-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 "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 /**
       
    17  @internalComponent
       
    18 */
       
    19 
       
    20 #ifndef CPTPIPGENERICCONTAINER_H_
       
    21 #define CPTPIPGENERICCONTAINER_H_
       
    22 
       
    23 #include "ptpipdatatypes.h"
       
    24 #include <mtp/cmtptypecompoundbase.h>
       
    25 
       
    26 /**
       
    27  Defines the PTPIP  device class generic bulk container dataset. This is used to hold all the PTPIP packets except data packets
       
    28  by changing the payload. It holds the packet length and packet type as its first two elements, after which it holds a payload, 
       
    29  which will change, depending on the kind of PTPIPpacket. For eg this could be a request packet, a cancel packet or a start
       
    30  data packet. 
       
    31 
       
    32  Eg :  the structure of the class while getting a request can be as follows
       
    33  1. packet length	4 bytes
       
    34  2. packet size		4 bytes
       
    35  3. payload = request packet.
       
    36  */
       
    37 class CPTPIPGenericContainer : public CMTPTypeCompoundBase
       
    38 	{
       
    39 public:
       
    40 
       
    41 	/**
       
    42 	 PTPIP operation dataset element identifiers.
       
    43 	 */
       
    44 	enum TElements
       
    45 		{
       
    46 		EPacketLength,
       
    47 		EPacketType,
       
    48 		EPayload,
       
    49 		ENumElements
       
    50 		};
       
    51 
       
    52 public:
       
    53 	IMPORT_C static CPTPIPGenericContainer* NewL();
       
    54 	IMPORT_C ~CPTPIPGenericContainer();
       
    55 
       
    56 	IMPORT_C MMTPType* Payload() const;
       
    57 	IMPORT_C void SetPayloadL(MMTPType* aPayload);
       
    58 
       
    59 	// from MTP
       
    60 	IMPORT_C TUint Type() const;
       
    61 
       
    62 private:
       
    63 	// from CMTPTypeCompoundBase
       
    64 	const TElementInfo& ElementInfo(TInt aElementId ) const;
       
    65 
       
    66 private:
       
    67 	CPTPIPGenericContainer( );
       
    68 	void ConstructL( );
       
    69 
       
    70 private:
       
    71 
       
    72 	/**
       
    73 	 Data chunk identifiers.
       
    74 	 */
       
    75 	enum TChunkIds
       
    76 		{
       
    77 		/**
       
    78 		 The flat data chunk ID.
       
    79 		 */
       
    80 		EIdFlatChunk,
       
    81 
       
    82 		/**
       
    83 		 The EMTPExtensions element data chunk ID.
       
    84 		 */
       
    85 		EIdPayloadChunk,
       
    86 
       
    87 		/**
       
    88 		 The number of data chunks.
       
    89 		 */
       
    90 		EIdNumChunks
       
    91 		};
       
    92 
       
    93 	/**
       
    94 	 The flat data chunk comprising the header elements EPacketLength & EPacketType
       
    95 	 */
       
    96 	RMTPTypeCompoundFlatChunk iChunkHeader;
       
    97 
       
    98 	/**
       
    99 	 The dataset element metadata table content.
       
   100 	 */
       
   101 	static const CMTPTypeCompoundBase::TElementInfo iElementMetaData[];
       
   102 
       
   103 	/**
       
   104 	 The dataset element metadata table.
       
   105 	 */
       
   106 	const TFixedArray<TElementInfo, ENumElements> iElementInfo;
       
   107 
       
   108 	/**
       
   109 	 The size in bytes of the header data chunk.
       
   110 	 */
       
   111 	static const TUint KFlatChunkSize;
       
   112 
       
   113 private:
       
   114 	// Not owned
       
   115 
       
   116 	MMTPType* iPayload;
       
   117 	};
       
   118 
       
   119 #endif /*CPTPIPGENERICCONTAINER_H_*/