mtptransports/mtpptpiptransport/ptpipdatatypes/inc/cptpipdatacontainer.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 CPTPIPDATACONTINER_H_
       
    21 #define CPTPIPDATACONTINER_H_
       
    22 
       
    23 #include "ptpipdatatypes.h"
       
    24 
       
    25 /**
       
    26  Defines the MTP PTPIP device class generic container dataset. 
       
    27  This will contain a data payload which will have the actual mtp data. 
       
    28 
       
    29  The structure would be as follows:
       
    30  1. packet length	4 bytes
       
    31  2. packet size		4 bytes
       
    32  3. payload = mtp data.
       
    33 
       
    34  */
       
    35 class CPTPIPDataContainer : public CMTPTypeCompoundBase
       
    36 	{
       
    37 public:
       
    38 
       
    39 	/**
       
    40 	 PTPIP operation request dataset element identifiers.
       
    41 	 */
       
    42 	enum TElements
       
    43 		{
       
    44 		EPacketLength,
       
    45 		EPacketType,
       
    46 		ETransactionId,
       
    47 		EPayload,
       
    48 		ENumElements
       
    49 		};
       
    50 		
       
    51 public:
       
    52 	IMPORT_C static CPTPIPDataContainer* NewL();
       
    53 	IMPORT_C ~CPTPIPDataContainer();
       
    54 
       
    55 	IMPORT_C MMTPType* Payload() const;
       
    56 	IMPORT_C void SetPayloadL(MMTPType* aPayload);
       
    57 	IMPORT_C TInt FirstWriteChunk(TPtr8& aChunk);	
       
    58 	IMPORT_C MMTPType* CommitChunkL(TPtr8& aChunk);
       
    59 
       
    60 public:
       
    61 	// From MMTPType	
       
    62 	IMPORT_C TUint Type() const;
       
    63 
       
    64 private:
       
    65 	// From CMTPTypeCompoundBase
       
    66 
       
    67 	const TElementInfo& ElementInfo(TInt aElementId ) const;	
       
    68 
       
    69 private:
       
    70 	CPTPIPDataContainer( );
       
    71 	void ConstructL( );
       
    72 
       
    73 private:
       
    74 
       
    75 	/**
       
    76 	 Data chunk identifiers.
       
    77 	 */
       
    78 	enum TChunkIds
       
    79 		{
       
    80 		/**
       
    81 		 The flat data chunk ID.
       
    82 		 */
       
    83 		EIdFlatChunk,
       
    84 
       
    85 		/**
       
    86 		 The EMTPExtensions element data chunk ID.
       
    87 		 */
       
    88 		EIdPayloadChunk,
       
    89 
       
    90 		/**
       
    91 		 The number of data chunks.
       
    92 		 */
       
    93 		EIdNumChunks
       
    94 		};
       
    95 
       
    96 	/**
       
    97 	 The flat data chunk comprising the header elements EPacketLength, EPacketType and the transaction Id
       
    98 	 */
       
    99 	RMTPTypeCompoundFlatChunk iChunkHeader;
       
   100 
       
   101 	/**
       
   102 	 The dataset element metadata table content.
       
   103 	 */
       
   104 	static const CMTPTypeCompoundBase::TElementInfo iElementMetaData[];
       
   105 
       
   106 	/**
       
   107 	 The dataset element metadata table.
       
   108 	 */
       
   109 	const TFixedArray<TElementInfo, ENumElements> iElementInfo;
       
   110 
       
   111 	/**
       
   112 	 The size in bytes of the header data chunk.
       
   113 	 */
       
   114 	static const TUint KFlatChunkSize;
       
   115 
       
   116 private:
       
   117 	MMTPType* iPayload;  // Not owned
       
   118 	
       
   119 	// If the Initiator sends the data in this form,
       
   120 	// | ptp header| content part1 | ptp header | content part2 |
       
   121 	// But,mtp framework gives us the payload as | content part1 | content part2 |
       
   122 	// thus we need to ignore the ptp header that comes second time onwards.
       
   123 	TInt iIsNextHeader;
       
   124 	
       
   125 	
       
   126 
       
   127 	};
       
   128 
       
   129 #endif /*CPTPIPCONTINERDATA_H_*/