|
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: Implement the operation: getobjectpropvalue |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include <mtp/mmtpdataproviderframework.h> |
|
20 #include <mtp/cmtptypestring.h> |
|
21 #include <mtp/cmtptypearray.h> |
|
22 |
|
23 #include "cmediamtpdataprovidergetobjectpropvalue.h" |
|
24 #include "mediamtpdataproviderconst.h" |
|
25 #include "mmmtpdplogger.h" |
|
26 #include "mmmtpdputility.h" |
|
27 #include "cmmmtpdpmetadataaccesswrapper.h" |
|
28 #include "mmmtpdpdefs.h" |
|
29 #include "mmmtpdpconfig.h" |
|
30 |
|
31 // ----------------------------------------------------------------------------- |
|
32 // CMediaMtpDataProviderGetObjectPropValue::NewL |
|
33 // Two-phase construction method |
|
34 // ----------------------------------------------------------------------------- |
|
35 // |
|
36 MMmRequestProcessor* CMediaMtpDataProviderGetObjectPropValue::NewL( MMTPDataProviderFramework& aFramework, |
|
37 MMTPConnection& aConnection, |
|
38 MMmMtpDpConfig& aDpConfig ) |
|
39 { |
|
40 CMediaMtpDataProviderGetObjectPropValue* self = |
|
41 new ( ELeave ) CMediaMtpDataProviderGetObjectPropValue( aFramework, |
|
42 aConnection, |
|
43 aDpConfig ); |
|
44 CleanupStack::PushL( self ); |
|
45 self->ConstructL(); |
|
46 CleanupStack::Pop( self ); |
|
47 return self; |
|
48 } |
|
49 |
|
50 // ----------------------------------------------------------------------------- |
|
51 // CMediaMtpDataProviderGetObjectPropValue::ConstructL |
|
52 // Two-phase construction method |
|
53 // ----------------------------------------------------------------------------- |
|
54 // |
|
55 void CMediaMtpDataProviderGetObjectPropValue::ConstructL() |
|
56 { |
|
57 |
|
58 } |
|
59 |
|
60 // ----------------------------------------------------------------------------- |
|
61 // CMediaMtpDataProviderGetObjectPropValue::~CMediaMtpDataProviderGetObjectPropValue |
|
62 // Destructor |
|
63 // ----------------------------------------------------------------------------- |
|
64 // |
|
65 CMediaMtpDataProviderGetObjectPropValue::~CMediaMtpDataProviderGetObjectPropValue() |
|
66 { |
|
67 |
|
68 } |
|
69 |
|
70 // ----------------------------------------------------------------------------- |
|
71 // CMediaMtpDataProviderGetObjectPropValue::CMediaMtpDataProviderGetObjectPropValue |
|
72 // Standard c++ constructor |
|
73 // ----------------------------------------------------------------------------- |
|
74 // |
|
75 CMediaMtpDataProviderGetObjectPropValue::CMediaMtpDataProviderGetObjectPropValue( MMTPDataProviderFramework& aFramework, |
|
76 MMTPConnection& aConnection, |
|
77 MMmMtpDpConfig& aDpConfig ) : |
|
78 CGetObjectPropValue( aFramework, aConnection, aDpConfig ) |
|
79 { |
|
80 |
|
81 } |
|
82 |
|
83 void CMediaMtpDataProviderGetObjectPropValue::ServiceSpecificObjectPropertyL(TUint16 aPropCode) |
|
84 { |
|
85 PRINT( _L( "MM MTP => CMediaMtpDataProviderGetObjectPropValue::ServiceSpecificObjectPropertyL" ) ); |
|
86 switch ( aPropCode ) |
|
87 { |
|
88 case EMTPObjectPropCodeArtist: // 0xDC46 |
|
89 case EMTPObjectPropCodeGenre: // 0xDC8C |
|
90 case EMTPObjectPropCodeParentalRating: // 0xDC94 |
|
91 case EMTPObjectPropCodeComposer: // 0xDC96 |
|
92 case EMTPObjectPropCodeOriginalReleaseDate: // 0xDC99 |
|
93 case EMTPObjectPropCodeAlbumName: // 0xDC9A |
|
94 case EMTPObjectPropCodeEncodingProfile: // 0xDEA1 |
|
95 { |
|
96 if ( iMTPTypeString != NULL ) |
|
97 { |
|
98 delete iMTPTypeString; |
|
99 iMTPTypeString = NULL; |
|
100 } |
|
101 |
|
102 iMTPTypeString = CMTPTypeString::NewL(); |
|
103 ServiceMetaDataFromWrapperL( aPropCode, *iMTPTypeString, *iObjectInfo ); |
|
104 } |
|
105 break; |
|
106 |
|
107 case EMTPObjectPropCodeDescription: |
|
108 { |
|
109 if ( iMTPTypeArray != NULL ) |
|
110 { |
|
111 delete iMTPTypeArray; |
|
112 iMTPTypeArray = NULL; |
|
113 } |
|
114 |
|
115 iMTPTypeArray = CMTPTypeArray::NewL( EMTPTypeAUINT16 ); |
|
116 ServiceMetaDataFromWrapperL( aPropCode, *iMTPTypeArray, *iObjectInfo ); |
|
117 } |
|
118 break; |
|
119 |
|
120 case EMTPObjectPropCodeWidth: // 0xDC87 |
|
121 case EMTPObjectPropCodeHeight: // 0xDC88 |
|
122 case EMTPObjectPropCodeDuration: // 0xDC89 |
|
123 case EMTPObjectPropCodeUseCount: // 0xDC91 |
|
124 case EMTPObjectPropCodeSampleRate: // 0xDE93 |
|
125 case EMTPObjectPropCodeAudioWAVECodec: // 0xDE99 |
|
126 case EMTPObjectPropCodeAudioBitRate: // 0xDE9A |
|
127 case EMTPObjectPropCodeVideoFourCCCodec: // 0xDE9B |
|
128 case EMTPObjectPropCodeVideoBitRate: // 0xDE9C |
|
129 case EMTPObjectPropCodeFramesPerThousandSeconds: // 0xDE9D |
|
130 case EMTPObjectPropCodeKeyFrameDistance: // 0xDE9E |
|
131 { |
|
132 iMTPTypeUint32.Set( 0 ); |
|
133 ServiceMetaDataFromWrapperL( aPropCode, iMTPTypeUint32, *iObjectInfo ); |
|
134 } |
|
135 break; |
|
136 |
|
137 case EMTPObjectPropCodeTrack: // 0xDC8B |
|
138 case EMTPObjectPropCodeDRMStatus: // 0xDC9D |
|
139 case EMTPObjectPropCodeNumberOfChannels: // 0xDE94 |
|
140 case EMTPObjectPropCodeScanType: // 0xDE97 |
|
141 { |
|
142 iMTPTypeUint16.Set( 0 ); |
|
143 ServiceMetaDataFromWrapperL( aPropCode, iMTPTypeUint16, *iObjectInfo ); |
|
144 |
|
145 PRINT1( _L( "MM MTP <> CGetObjectPropValue::ServiceL value = %d" ), iMTPTypeUint16.Value() ); |
|
146 } |
|
147 break; |
|
148 |
|
149 case EMTPExtObjectPropCodeOmaDrmStatus: |
|
150 { |
|
151 TInt drmStatus = MmMtpDpUtility::GetDrmStatus( iObjectInfo->DesC( CMTPObjectMetaData::ESuid ) ); |
|
152 iMTPTypeUint8.Set( 0 ); |
|
153 |
|
154 if (drmStatus == EMTPDrmStatusProtected) |
|
155 iMTPTypeUint8.Set( 1 ); |
|
156 |
|
157 SendDataL( iMTPTypeUint8 ); |
|
158 } |
|
159 break; |
|
160 |
|
161 default: |
|
162 { |
|
163 User::Leave( KErrNotSupported ); |
|
164 } |
|
165 break; |
|
166 } |
|
167 |
|
168 PRINT( _L( "MM MTP <= CMediaMtpDataProviderGetObjectPropValue::ServiceSpecificObjectPropertyL" ) ); |
|
169 } |
|
170 |
|
171 // end of file |