|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Media dp specific property description construction utility. |
|
15 * Used by all request processors which related to property description |
|
16 * |
|
17 */ |
|
18 |
|
19 #include <mtp/mtpprotocolconstants.h> |
|
20 #include <mtp/cmtptypeobjectpropdesc.h> |
|
21 #include <mtp/cmtptypestring.h> |
|
22 |
|
23 #include "cabstractmediamtpdataproviderdescriptionutility.h" |
|
24 #include "abstractmediamtpdataproviderconst.h" |
|
25 #include "mmmtpdpconfig.h" |
|
26 #include "mmmtpdplogger.h" |
|
27 |
|
28 // ----------------------------------------------------------------------------- |
|
29 // CAbstractMediaMtpDataProviderDescriptionUtility::NewL |
|
30 // |
|
31 // ----------------------------------------------------------------------------- |
|
32 // |
|
33 CAbstractMediaMtpDataProviderDescriptionUtility* CAbstractMediaMtpDataProviderDescriptionUtility::NewL() |
|
34 { |
|
35 CAbstractMediaMtpDataProviderDescriptionUtility* self = |
|
36 new( ELeave ) CAbstractMediaMtpDataProviderDescriptionUtility(); |
|
37 |
|
38 return self; |
|
39 } |
|
40 |
|
41 CAbstractMediaMtpDataProviderDescriptionUtility::CAbstractMediaMtpDataProviderDescriptionUtility() |
|
42 { |
|
43 // Do nothing |
|
44 } |
|
45 |
|
46 CAbstractMediaMtpDataProviderDescriptionUtility::~CAbstractMediaMtpDataProviderDescriptionUtility() |
|
47 { |
|
48 // Do nothing |
|
49 } |
|
50 |
|
51 // ----------------------------------------------------------------------------- |
|
52 // CAbstractMediaMtpDataProviderDescriptionUtility::NewInterdepentPropDescL |
|
53 // Construct media dp specific interdependent property description. |
|
54 // ----------------------------------------------------------------------------- |
|
55 // |
|
56 CMTPTypeInterdependentPropDesc* CAbstractMediaMtpDataProviderDescriptionUtility::NewInterdepentPropDescL( MMmMtpDpConfig& /*aDpConfig*/, |
|
57 TUint /*aFormatCode*/ ) |
|
58 { |
|
59 PRINT( _L( "MM MTP => CAbstractMediaMtpDataProviderDescriptionUtility::NewInterdepentPropDescL" ) ); |
|
60 |
|
61 CMTPTypeInterdependentPropDesc* interdependentPropDesc = CMTPTypeInterdependentPropDesc::NewL(); |
|
62 |
|
63 PRINT( _L( "MM MTP <= CAbstractMediaMtpDataProviderDescriptionUtility::NewInterdepentPropDescL" ) ); |
|
64 return interdependentPropDesc; |
|
65 } |
|
66 |
|
67 // ----------------------------------------------------------------------------- |
|
68 // CAbstractMediaMtpDataProviderDescriptionUtility::NewSpecificPropDescL |
|
69 // Construct media dp specific property description. |
|
70 // ----------------------------------------------------------------------------- |
|
71 // |
|
72 CMTPTypeObjectPropDesc* CAbstractMediaMtpDataProviderDescriptionUtility::NewSpecificPropDescL( TUint aFormatCode, |
|
73 TUint16 aPropCode ) |
|
74 { |
|
75 CMTPTypeObjectPropDesc* propertyDesc = NULL; |
|
76 if( aFormatCode == EMTPFormatCodeAbstractAudioAlbum ) |
|
77 { |
|
78 switch ( aPropCode ) |
|
79 { |
|
80 case EMTPObjectPropCodeRepresentativeSampleFormat: |
|
81 propertyDesc = NewRepresentativeSampleFormatL(); |
|
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 } |
|
103 } |
|
104 return propertyDesc; |
|
105 } |
|
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 |
|
224 // end of file |