branch | RCL_3 |
changeset 9 | bee149131e4b |
parent 0 | a2952bb97e68 |
child 14 | 05b0d2323768 |
4:d45095c2f4f3 | 9:bee149131e4b |
---|---|
63 // Destructor |
63 // Destructor |
64 // ----------------------------------------------------------------------------- |
64 // ----------------------------------------------------------------------------- |
65 // |
65 // |
66 CMediaMtpDataProviderCopyObject::~CMediaMtpDataProviderCopyObject() |
66 CMediaMtpDataProviderCopyObject::~CMediaMtpDataProviderCopyObject() |
67 { |
67 { |
68 |
68 // Do nothing |
69 } |
69 } |
70 |
70 |
71 // ----------------------------------------------------------------------------- |
71 // ----------------------------------------------------------------------------- |
72 // CMediaMtpDataProviderCopyObject::CMediaMtpDataProviderCopyObject |
72 // CMediaMtpDataProviderCopyObject::CMediaMtpDataProviderCopyObject |
73 // Standard c++ constructor |
73 // Standard c++ constructor |
76 CMediaMtpDataProviderCopyObject::CMediaMtpDataProviderCopyObject( MMTPDataProviderFramework& aFramework, |
76 CMediaMtpDataProviderCopyObject::CMediaMtpDataProviderCopyObject( MMTPDataProviderFramework& aFramework, |
77 MMTPConnection& aConnection, |
77 MMTPConnection& aConnection, |
78 MMmMtpDpConfig& aDpConfig ) : |
78 MMmMtpDpConfig& aDpConfig ) : |
79 CCopyObject( aFramework, aConnection, aDpConfig ) |
79 CCopyObject( aFramework, aConnection, aDpConfig ) |
80 { |
80 { |
81 |
81 // Do nothing |
82 } |
82 } |
83 |
83 |
84 // ----------------------------------------------------------------------------- |
84 // ----------------------------------------------------------------------------- |
85 // CMediaMtpDataProviderCopyObject::ServiceSpecificObjectPropertyL |
85 // CMediaMtpDataProviderCopyObject::ServiceSpecificObjectPropertyL |
86 // |
86 // |
122 |
122 |
123 if ( err == KErrNone ) |
123 if ( err == KErrNone ) |
124 { |
124 { |
125 iPropertyElement = &(iPropertyList->ReservePropElemL(aHandle, aPropCode)); |
125 iPropertyElement = &(iPropertyList->ReservePropElemL(aHandle, aPropCode)); |
126 iPropertyElement->SetStringL( CMTPTypeObjectPropListElement::EValue, textData->StringChars()); |
126 iPropertyElement->SetStringL( CMTPTypeObjectPropListElement::EValue, textData->StringChars()); |
127 |
|
128 // iPropertyElement = CMTPTypeObjectPropListElement::NewL( aHandle, |
|
129 // aPropCode, |
|
130 // *textData ); |
|
131 } |
127 } |
132 |
128 |
133 CleanupStack::PopAndDestroy( textData ); // - textData |
129 CleanupStack::PopAndDestroy( textData ); // - textData |
134 } |
130 } |
135 break; |
131 break; |
146 |
142 |
147 if ( err == KErrNone ) |
143 if ( err == KErrNone ) |
148 { |
144 { |
149 iPropertyElement = &(iPropertyList->ReservePropElemL(aHandle, aPropCode)); |
145 iPropertyElement = &(iPropertyList->ReservePropElemL(aHandle, aPropCode)); |
150 iPropertyElement->SetArrayL( CMTPTypeObjectPropListElement::EValue, *desData); |
146 iPropertyElement->SetArrayL( CMTPTypeObjectPropListElement::EValue, *desData); |
151 |
|
152 // iPropertyElement = CMTPTypeObjectPropListElement::NewL( aHandle, |
|
153 // aPropCode, |
|
154 // *desData ); |
|
155 } |
147 } |
156 |
148 |
157 CleanupStack::PopAndDestroy( desData ); // - desData |
149 CleanupStack::PopAndDestroy( desData ); // - desData |
158 } |
150 } |
159 break; |
151 break; |
171 |
163 |
172 if ( err == KErrNone ) |
164 if ( err == KErrNone ) |
173 { |
165 { |
174 iPropertyElement = &(iPropertyList->ReservePropElemL(aHandle, aPropCode)); |
166 iPropertyElement = &(iPropertyList->ReservePropElemL(aHandle, aPropCode)); |
175 iPropertyElement->SetUint16L( CMTPTypeObjectPropListElement::EValue, uint16.Value()); |
167 iPropertyElement->SetUint16L( CMTPTypeObjectPropListElement::EValue, uint16.Value()); |
176 |
168 } |
177 // iPropertyElement = CMTPTypeObjectPropListElement::NewL( aHandle, |
|
178 // aPropCode, |
|
179 // uint16 ); |
|
180 } |
|
181 |
|
182 } |
169 } |
183 break; |
170 break; |
184 |
171 |
185 case EMTPObjectPropCodeWidth: |
172 case EMTPObjectPropCodeWidth: |
186 case EMTPObjectPropCodeHeight: |
173 case EMTPObjectPropCodeHeight: |
202 |
189 |
203 if ( err == KErrNone ) |
190 if ( err == KErrNone ) |
204 { |
191 { |
205 iPropertyElement = &(iPropertyList->ReservePropElemL(aHandle, aPropCode)); |
192 iPropertyElement = &(iPropertyList->ReservePropElemL(aHandle, aPropCode)); |
206 iPropertyElement->SetUint32L( CMTPTypeObjectPropListElement::EValue, uint32.Value()); |
193 iPropertyElement->SetUint32L( CMTPTypeObjectPropListElement::EValue, uint32.Value()); |
207 // iPropertyElement = CMTPTypeObjectPropListElement::NewL( aHandle, |
|
208 // aPropCode, |
|
209 // uint32 ); |
|
210 } |
194 } |
211 } |
195 } |
212 break; |
196 break; |
213 |
197 |
214 case EMTPExtObjectPropCodeOmaDrmStatus: |
198 case EMTPExtObjectPropCodeOmaDrmStatus: |
218 result.Set( 0 ); |
202 result.Set( 0 ); |
219 |
203 |
220 if ( drmStatus == EMTPDrmStatusProtected ) |
204 if ( drmStatus == EMTPDrmStatusProtected ) |
221 result.Set( 1 ); |
205 result.Set( 1 ); |
222 |
206 |
223 iPropertyElement = &(iPropertyList->ReservePropElemL(aHandle, aPropCode)); |
207 iPropertyElement = &( iPropertyList->ReservePropElemL( aHandle, aPropCode ) ); |
224 iPropertyElement->SetUint16L( CMTPTypeObjectPropListElement::EDatatype, EMTPTypeUINT8); |
208 iPropertyElement->SetUint16L( CMTPTypeObjectPropListElement::EDatatype, EMTPTypeUINT8 ); |
225 iPropertyElement->SetUint8L( CMTPTypeObjectPropListElement::EValue, result.Value()); |
209 iPropertyElement->SetUint8L( CMTPTypeObjectPropListElement::EValue, result.Value()); |
226 |
|
227 // iPropertyElement = CMTPTypeObjectPropListElement::NewL( aHandle, |
|
228 // aPropCode, |
|
229 // EMTPTypeUINT8, |
|
230 // result ); |
|
231 } |
210 } |
232 break; |
211 break; |
233 |
212 |
234 default: |
213 default: |
235 { |
214 { |
240 |
219 |
241 // centralize logic to handle error, doing so, that's on need to trap the |
220 // centralize logic to handle error, doing so, that's on need to trap the |
242 // leave for KErrNotSupported in base class like previous version. |
221 // leave for KErrNotSupported in base class like previous version. |
243 if ( ( err == KErrNotFound ) |
222 if ( ( err == KErrNotFound ) |
244 || ( ( err == KErrNotSupported ) |
223 || ( ( err == KErrNotSupported ) |
245 && ( ( aObject.Uint( CMTPObjectMetaData::EFormatCode ) == EMTPFormatCodeASF ) |
224 && ( ( aObject.Uint( CMTPObjectMetaData::EFormatCode ) == EMTPFormatCodeASF ) |
246 || ( aObject.Uint( CMTPObjectMetaData::EFormatCode ) == EMTPFormatCodeMP4Container ) |
225 || ( aObject.Uint( CMTPObjectMetaData::EFormatCode ) == EMTPFormatCodeMP4Container ) |
247 || ( aObject.Uint( CMTPObjectMetaData::EFormatCode ) == EMTPFormatCode3GPContainer ) ) ) ) |
226 || ( aObject.Uint( CMTPObjectMetaData::EFormatCode ) == EMTPFormatCode3GPContainer ) ) ) ) |
248 { |
227 { |
249 iPropertyElement = NULL; |
228 iPropertyElement = NULL; |
250 } |
229 } |
251 else |
230 else |
252 { |
231 { |
253 User::LeaveIfError( err ); |
232 User::LeaveIfError( err ); |
254 } |
233 } |
255 PRINT( _L( "MM MTP <= CMediaMtpDataProviderCopyObject::ServiceSpecificObjectPropertyL" ) ); |
234 PRINT( _L( "MM MTP <= CMediaMtpDataProviderCopyObject::ServiceSpecificObjectPropertyL" ) ); |
256 } |
235 } |
257 |
236 |
258 // ----------------------------------------------------------------------------- |
|
259 // CMediaMtpDataProviderCopyObject::ServiceSetSpecificObjectPropertyL |
|
260 // |
|
261 // ----------------------------------------------------------------------------- |
|
262 // |
|
263 TMTPResponseCode CMediaMtpDataProviderCopyObject::ServiceSetSpecificObjectPropertyL( TUint16 aPropCode, const CMTPObjectMetaData& aObject, |
|
264 const CMTPTypeObjectPropListElement& aElement ) |
|
265 { |
|
266 PRINT( _L( "MM MTP => CMediaMtpDataProviderCopyObject::ServiceSetSpecificObjectPropertyL" ) ); |
|
267 TMTPResponseCode responseCode( EMTPRespCodeOK ); |
|
268 |
|
269 switch ( aPropCode ) |
|
270 { |
|
271 case EMTPObjectPropCodeArtist: |
|
272 case EMTPObjectPropCodeGenre: |
|
273 case EMTPObjectPropCodeComposer: |
|
274 case EMTPObjectPropCodeOriginalReleaseDate: |
|
275 case EMTPObjectPropCodeAlbumName: |
|
276 case EMTPObjectPropCodeParentalRating: |
|
277 case EMTPObjectPropCodeEncodingProfile: |
|
278 { |
|
279 CMTPTypeString* stringData = |
|
280 CMTPTypeString::NewLC( aElement.StringL( CMTPTypeObjectPropListElement::EValue ) );// + stringData |
|
281 |
|
282 responseCode = ServiceMetaDataToWrapper( aPropCode, |
|
283 *stringData, |
|
284 aObject ); |
|
285 |
|
286 CleanupStack::PopAndDestroy( stringData ); // - stringData |
|
287 } |
|
288 break; |
|
289 |
|
290 case EMTPObjectPropCodeVideoBitRate: |
|
291 { |
|
292 responseCode = EMTPRespCodeAccessDenied; |
|
293 } |
|
294 break; |
|
295 |
|
296 case EMTPObjectPropCodeDescription: |
|
297 { |
|
298 CMTPTypeArray* desData = CMTPTypeArray::NewLC( EMTPTypeAUINT16 ); // + desData |
|
299 // aElement.GetL( CMTPTypeObjectPropListElement::EValue, *desData ); |
|
300 desData->SetByDesL(aElement.ArrayL(CMTPTypeObjectPropListElement::EValue)); |
|
301 //desData(aElement.ArrayL(CMTPTypeObjectPropListElement::EValue)); |
|
302 |
|
303 responseCode = ServiceMetaDataToWrapper( aPropCode, |
|
304 *desData, |
|
305 aObject ); |
|
306 CleanupStack::PopAndDestroy( desData ); // - desData |
|
307 } |
|
308 break; |
|
309 |
|
310 case EMTPObjectPropCodeWidth: |
|
311 case EMTPObjectPropCodeHeight: |
|
312 case EMTPObjectPropCodeDuration: |
|
313 case EMTPObjectPropCodeUseCount: |
|
314 case EMTPObjectPropCodeSampleRate: |
|
315 case EMTPObjectPropCodeAudioWAVECodec: |
|
316 case EMTPObjectPropCodeAudioBitRate: |
|
317 case EMTPObjectPropCodeVideoFourCCCodec: |
|
318 case EMTPObjectPropCodeFramesPerThousandSeconds: |
|
319 case EMTPObjectPropCodeKeyFrameDistance: |
|
320 { |
|
321 TMTPTypeUint32 uint32( aElement.Uint32L( CMTPTypeObjectPropListElement::EValue ) ); |
|
322 responseCode = ServiceMetaDataToWrapper( aPropCode, |
|
323 uint32, |
|
324 aObject ); |
|
325 } |
|
326 break; |
|
327 |
|
328 case EMTPObjectPropCodeTrack: |
|
329 case EMTPObjectPropCodeNumberOfChannels: |
|
330 case EMTPObjectPropCodeScanType: |
|
331 case EMTPObjectPropCodeDRMStatus: |
|
332 { |
|
333 TMTPTypeUint16 uint16( aElement.Uint16L( CMTPTypeObjectPropListElement::EValue )); |
|
334 responseCode = ServiceMetaDataToWrapper( aPropCode, |
|
335 uint16, |
|
336 aObject ); |
|
337 } |
|
338 break; |
|
339 |
|
340 case EMTPExtObjectPropCodeOmaDrmStatus: |
|
341 { |
|
342 TInt drmStatus = MmMtpDpUtility::GetDrmStatus( aObject.DesC( CMTPObjectMetaData::ESuid ) ); |
|
343 |
|
344 if (drmStatus == EMTPDrmStatusUnknown) |
|
345 { |
|
346 responseCode = EMTPRespCodeAccessDenied; |
|
347 } |
|
348 else |
|
349 { |
|
350 TMTPTypeUint8 newValue( aElement.Uint8L( CMTPTypeObjectPropListElement::EValue ) ); |
|
351 |
|
352 // there's no DB field to remember the value, so return an error |
|
353 // if there's a mismatch to CAF protection status |
|
354 if ( ( ( drmStatus == EMTPDrmStatusProtected) && ( newValue.Value() == 0 ) ) || |
|
355 ( ( drmStatus == EMTPDrmStatusNotProtected ) && ( newValue.Value() == 1 ) ) ) |
|
356 { |
|
357 responseCode = EMTPRespCodeAccessDenied; |
|
358 } |
|
359 } |
|
360 } |
|
361 break; |
|
362 |
|
363 default: |
|
364 { |
|
365 User::Leave( KErrNotSupported ); |
|
366 } |
|
367 break; |
|
368 } |
|
369 |
|
370 PRINT( _L( "MM MTP <= CMediaMtpDataProviderCopyObject::ServiceSetSpecificObjectPropertyL" ) ); |
|
371 |
|
372 return responseCode; |
|
373 } |
|
374 |
|
375 // end of file |
237 // end of file |