mtpfws/mtpfw/datatypes/interface/cmtptypeinterdependentpropdesc.h
changeset 0 d0791faffa3f
equal deleted inserted replaced
-1:000000000000 0:d0791faffa3f
       
     1 // Copyright (c) 2006-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  @file
       
    18  @publishedPartner
       
    19  @released
       
    20 */
       
    21 
       
    22 #ifndef CMTPTYPEINTERDEPENDENTPROPDESC_H
       
    23 #define CMTPTYPEINTERDEPENDENTPROPDESC_H
       
    24 
       
    25 #include <e32std.h>
       
    26 #include <mtp/cmtptypecompoundbase.h>
       
    27 
       
    28 class CMTPTypeInterdependentProperties;
       
    29 class CMTPTypeObjectPropDesc;
       
    30 
       
    31 /** 
       
    32 Defines the MTP InterdependentPropDesc dataset. The InterdependentPropDesc 
       
    33 implements an array of MTP ObjectPropDesc arrays, each describing a permissable
       
    34 collection of ranges. Each array of MTP ObjectPropDesc datasets gives one 
       
    35 possible definition for the interdependent properties that are contained in 
       
    36 that array; properties not found in that array are constrained only by the 
       
    37 usual ObjectPropDesc datasets. This dataset is used in the 
       
    38 GetInterdependentPropDesc request.
       
    39 @publishedPartner
       
    40 @released 
       
    41 */ 
       
    42 class CMTPTypeInterdependentPropDesc : public CMTPTypeCompoundBase
       
    43     {
       
    44 public:
       
    45     
       
    46     IMPORT_C static CMTPTypeInterdependentPropDesc* NewL();
       
    47     IMPORT_C static CMTPTypeInterdependentPropDesc* NewLC();
       
    48 
       
    49     IMPORT_C virtual ~CMTPTypeInterdependentPropDesc();  
       
    50     
       
    51     IMPORT_C void AppendL(CMTPTypeInterdependentProperties* aInterdependentProperties);
       
    52     
       
    53     IMPORT_C TUint32 NumberOfInterdependencies() const;
       
    54     IMPORT_C CMTPTypeInterdependentProperties& InterdependentProperties(TUint aIndex) const;  
       
    55      
       
    56 public: // From CMTPTypeCompoundBase
       
    57 
       
    58     IMPORT_C TInt FirstWriteChunk(TPtr8& aChunk);
       
    59     IMPORT_C TInt NextWriteChunk(TPtr8& aChunk);
       
    60     IMPORT_C TUint Type() const;
       
    61     IMPORT_C TBool CommitRequired() const;
       
    62     IMPORT_C MMTPType* CommitChunkL(TPtr8& aChunk); 
       
    63         
       
    64 private: // From CMTPTypeCompoundBase
       
    65     
       
    66     const TElementInfo& ElementInfo(TInt aElementId) const;
       
    67     TInt ValidateChunkCount() const;
       
    68     
       
    69 private:
       
    70 
       
    71     CMTPTypeInterdependentPropDesc();
       
    72     void ConstructL();
       
    73     
       
    74     void AppendElementChunkL(CMTPTypeInterdependentProperties* aElement);
       
    75     TInt UpdateWriteSequenceErr(TInt aErr);
       
    76 
       
    77 private: // Owned
       
    78 
       
    79     /**
       
    80     The write data stream states.
       
    81     */
       
    82     enum TReadWriteSequenceState
       
    83         {
       
    84         /**
       
    85         Data stream is inactive.
       
    86         */
       
    87         EIdle,
       
    88         
       
    89         /**
       
    90         Data stream is in progress.
       
    91         */
       
    92         EInProgress            
       
    93         };
       
    94     
       
    95     /**
       
    96     The NumberOfInterdependencies element data chunk ID.
       
    97     */
       
    98     static const TUint                              KNumberOfInterdependenciesChunk;
       
    99     
       
   100     /**
       
   101     The InterdependentProperties array starting element data chunk ID.
       
   102     */
       
   103     static const TUint                              KInterdependentPropertiesChunks;
       
   104 
       
   105     /**
       
   106     The write data stream error state. 
       
   107     */
       
   108     TInt                                            iWriteSequenceErr;
       
   109     
       
   110     /**
       
   111     The write data stream state variable. 
       
   112     */
       
   113     TUint                                           iWriteSequenceState;
       
   114     
       
   115     /**
       
   116     The NumberOfInterdependencies element metadata content.
       
   117     */
       
   118     CMTPTypeCompoundBase::TElementInfo              iInfoNumberOfInterdependencies;
       
   119     
       
   120     /**
       
   121     The InterdependentProperties elements array metadata content. Note that this is 
       
   122     declared mutable to allow state updates while processing a read data stream.
       
   123     */
       
   124     mutable CMTPTypeCompoundBase::TElementInfo      iInfoInterdependentProperties;
       
   125     
       
   126     /**
       
   127     The NumberOfInterdependencies data chunk.
       
   128     */
       
   129     TMTPTypeUint32                                  iChunkNumberOfInterdependencies;
       
   130     
       
   131     /**
       
   132     The InterdependentProperties elements array data chunks.
       
   133     */
       
   134     RPointerArray<CMTPTypeInterdependentProperties> iChunksInterdependentProperties;
       
   135     };
       
   136 
       
   137 /**
       
   138 Defines the MTP InterdependentPropDesc array element dataset. The 
       
   139 InterdependentPropDesc array element dataset is itself an array of MTP 
       
   140 ObjectPropDesc datasets that specifies one possible definition for the 
       
   141 interdependent properties that are contained in that array.
       
   142 */
       
   143 class CMTPTypeInterdependentProperties : public CMTPTypeCompoundBase
       
   144     {
       
   145 public:
       
   146     
       
   147     IMPORT_C static CMTPTypeInterdependentProperties* NewL();
       
   148     IMPORT_C static CMTPTypeInterdependentProperties* NewLC();
       
   149 
       
   150     IMPORT_C virtual ~CMTPTypeInterdependentProperties();  
       
   151     
       
   152     IMPORT_C void AppendL(CMTPTypeObjectPropDesc* aObjectPropDesc);
       
   153     
       
   154     IMPORT_C TUint32 NumberOfPropDescs() const;
       
   155     IMPORT_C CMTPTypeObjectPropDesc& ObjectPropDesc(TUint aIndex) const;  
       
   156      
       
   157 public: // From CMTPTypeCompoundBase
       
   158 
       
   159     IMPORT_C TInt FirstWriteChunk(TPtr8& aChunk);
       
   160     IMPORT_C TInt NextWriteChunk(TPtr8& aChunk);
       
   161     IMPORT_C TUint Type() const;
       
   162     IMPORT_C TBool CommitRequired() const;
       
   163     IMPORT_C MMTPType* CommitChunkL(TPtr8& aChunk); 
       
   164         
       
   165 private: // From CMTPTypeCompoundBase
       
   166     
       
   167     const TElementInfo& ElementInfo(TInt aElementId) const;
       
   168     TInt ValidateChunkCount() const;
       
   169     
       
   170 private:
       
   171 
       
   172     CMTPTypeInterdependentProperties();
       
   173     void ConstructL();
       
   174     
       
   175     void AppendElementChunkL(CMTPTypeObjectPropDesc* aElement);
       
   176     TInt UpdateWriteSequenceErr(TInt aErr);
       
   177 
       
   178 private: // Owned
       
   179 
       
   180     /**
       
   181     The write data stream states.
       
   182     */
       
   183     enum TReadWriteSequenceState
       
   184         {
       
   185         /**
       
   186         Data stream is inactive.
       
   187         */
       
   188         EIdle,
       
   189         
       
   190         /**
       
   191         Data stream is in progress.
       
   192         */
       
   193         EInProgress            
       
   194         };
       
   195     
       
   196     /**
       
   197     The NumberOfPropDescs element data chunk ID.
       
   198     */
       
   199     static const TUint                          KNumberOfPropDescsChunk;
       
   200     
       
   201     /**
       
   202     The ObjectPropDesc array starting element data chuck ID.
       
   203     */
       
   204     static const TUint                          KObjectPropDescChunks;
       
   205 
       
   206     /**
       
   207     The write data stream error state. 
       
   208     */
       
   209     TInt                                        iWriteSequenceErr;
       
   210     
       
   211     /**
       
   212     The write data stream state variable. 
       
   213     */
       
   214     TUint                                       iWriteSequenceState;
       
   215     
       
   216     /**
       
   217     The NumberOfPropDescs element metadata content.
       
   218     */
       
   219     CMTPTypeCompoundBase::TElementInfo          iInfoNumberOfPropDescs;
       
   220     
       
   221     /**
       
   222     The ObjectPropDesc array elements metadata content. Note that this is 
       
   223     declared mutable to allow state updates while processing a read data stream.
       
   224     */
       
   225     mutable CMTPTypeCompoundBase::TElementInfo  iInfoObjectPropDesc;
       
   226     
       
   227     /**
       
   228     The NumberOfPropDescs element data chunk.
       
   229     */
       
   230     TMTPTypeUint32                              iChunkNumberOfPropDescs;
       
   231     
       
   232     /**
       
   233     The ObjectPropDesc elements array data chunks.
       
   234     */
       
   235     RPointerArray<CMTPTypeObjectPropDesc>       iChunksObjectPropDesc;
       
   236     };
       
   237 
       
   238 #endif // CMTPTYPEINTERDEPENDENTPROPDESC_H