mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/abstractmediamtpdataprovider/src/cabstractmediamtpdataproviderdescriptionutility.cpp
branchRCL_3
changeset 17 780c925249c1
parent 9 bee149131e4b
equal deleted inserted replaced
15:d240f0a77280 17:780c925249c1
    14 * Description:  Media dp specific property description construction utility.
    14 * Description:  Media dp specific property description construction utility.
    15 *              Used by all request processors which related to property description
    15 *              Used by all request processors which related to property description
    16 *
    16 *
    17 */
    17 */
    18 
    18 
       
    19 #include <mtp/mtpprotocolconstants.h>
    19 #include <mtp/cmtptypeobjectpropdesc.h>
    20 #include <mtp/cmtptypeobjectpropdesc.h>
    20 #include <mtp/cmtptypestring.h>
    21 #include <mtp/cmtptypestring.h>
    21 
    22 
    22 #include "cabstractmediamtpdataproviderdescriptionutility.h"
    23 #include "cabstractmediamtpdataproviderdescriptionutility.h"
       
    24 #include "abstractmediamtpdataproviderconst.h"
    23 #include "mmmtpdpconfig.h"
    25 #include "mmmtpdpconfig.h"
    24 #include "mmmtpdplogger.h"
    26 #include "mmmtpdplogger.h"
    25 
    27 
    26 // -----------------------------------------------------------------------------
    28 // -----------------------------------------------------------------------------
    27 // CAbstractMediaMtpDataProviderDescriptionUtility::NewL
    29 // CAbstractMediaMtpDataProviderDescriptionUtility::NewL
    65 // -----------------------------------------------------------------------------
    67 // -----------------------------------------------------------------------------
    66 // CAbstractMediaMtpDataProviderDescriptionUtility::NewSpecificPropDescL
    68 // CAbstractMediaMtpDataProviderDescriptionUtility::NewSpecificPropDescL
    67 // Construct media dp specific property description.
    69 // Construct media dp specific property description.
    68 // -----------------------------------------------------------------------------
    70 // -----------------------------------------------------------------------------
    69 //
    71 //
    70 CMTPTypeObjectPropDesc* CAbstractMediaMtpDataProviderDescriptionUtility::NewSpecificPropDescL( TUint /*aFormatCode*/,
    72 CMTPTypeObjectPropDesc* CAbstractMediaMtpDataProviderDescriptionUtility::NewSpecificPropDescL( TUint aFormatCode,
    71     TUint16 aPropCode )
    73     TUint16 aPropCode )
    72     {
    74     {
    73     CMTPTypeObjectPropDesc* propertyDesc = NULL;
    75     CMTPTypeObjectPropDesc* propertyDesc = NULL;
    74 
    76     if( aFormatCode == EMTPFormatCodeAbstractAudioAlbum )
    75     switch ( aPropCode )
       
    76         {
    77         {
    77         // format specific
    78         switch ( aPropCode )
    78         // May need add implementation here for further extension.
    79             {
    79         default:
    80             case EMTPObjectPropCodeRepresentativeSampleFormat:
    80             // Do nothing now.
    81                 propertyDesc = NewRepresentativeSampleFormatL();                   
    81             break;
    82                 break;
       
    83     
       
    84             case EMTPObjectPropCodeRepresentativeSampleSize:
       
    85                 propertyDesc = NewRepresentativeSampleSizeL();
       
    86                 break;
       
    87     
       
    88             case EMTPObjectPropCodeRepresentativeSampleHeight:
       
    89                 propertyDesc = NewRepresentativeSampleHeightL();
       
    90                 break;
       
    91     
       
    92             case EMTPObjectPropCodeRepresentativeSampleWidth:
       
    93                 propertyDesc = NewRepresentativeSampleWidthL();
       
    94                 break;
       
    95     
       
    96             case EMTPObjectPropCodeRepresentativeSampleData:
       
    97                 propertyDesc = NewRepresentativeSampleDataL();
       
    98                 break;
       
    99             default:
       
   100                 // do nothing
       
   101                 break;
       
   102             }
    82         }
   103         }
    83     return propertyDesc;
   104     return propertyDesc;
    84     }
   105     }
    85 
   106 
       
   107 // -----------------------------------------------------------------------------
       
   108 // CAbstractMediaMtpDataProviderDescriptionUtility::NewRepresentativeSampleFormatL
       
   109 // 
       
   110 // -----------------------------------------------------------------------------
       
   111 //
       
   112 CMTPTypeObjectPropDesc* CAbstractMediaMtpDataProviderDescriptionUtility::NewRepresentativeSampleFormatL()
       
   113     {
       
   114     CMTPTypeObjectPropDescEnumerationForm* form =
       
   115         CMTPTypeObjectPropDescEnumerationForm::NewL( EMTPTypeUINT16 );
       
   116     CleanupStack::PushL( form ); // + form
       
   117 
       
   118     TInt numValues = sizeof ( TMmMtpSupportedSampleFormat ) / sizeof ( TMmMtpSupportedSampleFormat[0] );
       
   119     for ( TInt i = 0; i < numValues; i++ )
       
   120         {
       
   121         TMTPTypeUint16 data( TMmMtpSupportedSampleFormat[i] );
       
   122         form->AppendSupportedValueL( data );
       
   123         }
       
   124 
       
   125     CMTPTypeObjectPropDesc::TPropertyInfo propertyInfo;
       
   126     propertyInfo.iDataType = EMTPTypeUINT16;
       
   127     propertyInfo.iFormFlag = CMTPTypeObjectPropDesc::EEnumerationForm;
       
   128     propertyInfo.iGetSet = CMTPTypeObjectPropDesc::EReadOnly;
       
   129     CMTPTypeObjectPropDesc* propertyDesc = CMTPTypeObjectPropDesc::NewL( EMTPObjectPropCodeRepresentativeSampleFormat,
       
   130         propertyInfo,
       
   131         form );
       
   132     CleanupStack::PopAndDestroy( form ); // - form
       
   133     return propertyDesc;
       
   134     }
       
   135 
       
   136 // -----------------------------------------------------------------------------
       
   137 // CAbstractMediaMtpDataProviderDescriptionUtility::NewRepresentativeSampleSizeL
       
   138 // 
       
   139 // -----------------------------------------------------------------------------
       
   140 //
       
   141 CMTPTypeObjectPropDesc* CAbstractMediaMtpDataProviderDescriptionUtility::NewRepresentativeSampleSizeL()
       
   142     {
       
   143     CMTPTypeObjectPropDescRangeForm* form =
       
   144         CMTPTypeObjectPropDescRangeForm::NewLC( EMTPTypeUINT32 ); // + form
       
   145 
       
   146     // Set expected values
       
   147     form->SetUint32L( CMTPTypeObjectPropDescRangeForm::EMinimumValue, EMTPMinSampleSize );
       
   148     form->SetUint32L( CMTPTypeObjectPropDescRangeForm::EMaximumValue, EMTPMaxSampleSize );
       
   149     form->SetUint32L( CMTPTypeObjectPropDescRangeForm::EStepSize, EMTPStepSampleSize );
       
   150 
       
   151     CMTPTypeObjectPropDesc::TPropertyInfo propertyInfo;
       
   152     propertyInfo.iDataType = EMTPTypeUINT32;
       
   153     propertyInfo.iFormFlag = CMTPTypeObjectPropDesc::ERangeForm;
       
   154     propertyInfo.iGetSet = CMTPTypeObjectPropDesc::EReadOnly;
       
   155     CMTPTypeObjectPropDesc* propertyDesc = CMTPTypeObjectPropDesc::NewL( EMTPObjectPropCodeRepresentativeSampleSize,
       
   156         propertyInfo,
       
   157         form );
       
   158     CleanupStack::PopAndDestroy( form ); // - form
       
   159     return propertyDesc;
       
   160     }
       
   161 
       
   162 // -----------------------------------------------------------------------------
       
   163 // CAbstractMediaMtpDataProviderDescriptionUtility::NewRepresentativeSampleHeightL
       
   164 // 
       
   165 // -----------------------------------------------------------------------------
       
   166 //
       
   167 CMTPTypeObjectPropDesc* CAbstractMediaMtpDataProviderDescriptionUtility::NewRepresentativeSampleHeightL()
       
   168     {
       
   169     CMTPTypeObjectPropDescRangeForm* form =
       
   170         CMTPTypeObjectPropDescRangeForm::NewLC( EMTPTypeUINT32 ); // + form
       
   171 
       
   172     // Set expected values
       
   173     form->SetUint32L( CMTPTypeObjectPropDescRangeForm::EMinimumValue, EMTPSampleMinHeight );
       
   174     form->SetUint32L( CMTPTypeObjectPropDescRangeForm::EMaximumValue, EMTPSampleMaxHeight );
       
   175     form->SetUint32L( CMTPTypeObjectPropDescRangeForm::EStepSize, EMTPSampleStepHeight );
       
   176 
       
   177     CMTPTypeObjectPropDesc::TPropertyInfo propertyInfo;
       
   178     propertyInfo.iDataType = EMTPTypeUINT32;
       
   179     propertyInfo.iFormFlag = CMTPTypeObjectPropDesc::ERangeForm;
       
   180     propertyInfo.iGetSet = CMTPTypeObjectPropDesc::EReadOnly;
       
   181     CMTPTypeObjectPropDesc* propertyDesc = CMTPTypeObjectPropDesc::NewL( EMTPObjectPropCodeRepresentativeSampleHeight,
       
   182         propertyInfo,
       
   183         form );
       
   184     CleanupStack::PopAndDestroy( form ); // - form
       
   185     return propertyDesc;
       
   186     }
       
   187 
       
   188 // -----------------------------------------------------------------------------
       
   189 // CAbstractMediaMtpDataProviderDescriptionUtility::NewRepresentativeSampleWidthL
       
   190 // 
       
   191 // -----------------------------------------------------------------------------
       
   192 //
       
   193 CMTPTypeObjectPropDesc* CAbstractMediaMtpDataProviderDescriptionUtility::NewRepresentativeSampleWidthL()
       
   194     {
       
   195     CMTPTypeObjectPropDescRangeForm* form =
       
   196         CMTPTypeObjectPropDescRangeForm::NewLC( EMTPTypeUINT32 ); // + form
       
   197 
       
   198     // Set expected values
       
   199     form->SetUint32L( CMTPTypeObjectPropDescRangeForm::EMinimumValue, EMTPSampleMinWidth );
       
   200     form->SetUint32L( CMTPTypeObjectPropDescRangeForm::EMaximumValue, EMTPSampleMaxWidth );
       
   201     form->SetUint32L( CMTPTypeObjectPropDescRangeForm::EStepSize, EMTPSampleStepWidth );
       
   202 
       
   203     CMTPTypeObjectPropDesc::TPropertyInfo propertyInfo;
       
   204     propertyInfo.iDataType = EMTPTypeUINT32;
       
   205     propertyInfo.iFormFlag = CMTPTypeObjectPropDesc::ERangeForm;
       
   206     propertyInfo.iGetSet = CMTPTypeObjectPropDesc::EReadOnly;
       
   207     CMTPTypeObjectPropDesc* propertyDesc = CMTPTypeObjectPropDesc::NewL( EMTPObjectPropCodeRepresentativeSampleWidth,
       
   208         propertyInfo,
       
   209         form );
       
   210     CleanupStack::PopAndDestroy( form ); // - form
       
   211     return propertyDesc;
       
   212     }
       
   213 
       
   214 // -----------------------------------------------------------------------------
       
   215 // CAbstractMediaMtpDataProviderDescriptionUtility::NewRepresentativeSampleDataL
       
   216 // 
       
   217 // -----------------------------------------------------------------------------
       
   218 //
       
   219 CMTPTypeObjectPropDesc* CAbstractMediaMtpDataProviderDescriptionUtility::NewRepresentativeSampleDataL() 
       
   220     {
       
   221     return CMTPTypeObjectPropDesc::NewL( EMTPObjectPropCodeRepresentativeSampleData );
       
   222     }
       
   223 
    86 // end of file
   224 // end of file