16 */ |
16 */ |
17 |
17 |
18 |
18 |
19 #include <mtp/cmtptypestring.h> |
19 #include <mtp/cmtptypestring.h> |
20 #include <mtp/cmtptypearray.h> |
20 #include <mtp/cmtptypearray.h> |
21 #include <mtp/mmtpdataproviderframework.h> |
|
22 #include <mtp/mmtpobjectmgr.h> |
21 #include <mtp/mmtpobjectmgr.h> |
23 #include <mtp/cmtpobjectmetadata.h> |
|
24 #include <f32file.h> |
22 #include <f32file.h> |
25 |
23 |
26 #include "cgetobjectpropvalue.h" |
24 #include "cgetobjectpropvalue.h" |
27 #include "mmmtpdputility.h" |
25 #include "mmmtpdputility.h" |
28 #include "cmmmtpdpmetadataaccesswrapper.h" |
26 #include "cmmmtpdpmetadataaccesswrapper.h" |
29 #include "mmmtpdplogger.h" |
27 #include "mmmtpdplogger.h" |
30 #include "mmmtpdpconfig.h" |
28 #include "mmmtpdpconfig.h" |
31 |
29 #include "tobjectdescription.h" |
32 _LIT( KMtpDateTimeFormat, "%F%Y%M%DT%H%T%S" ); |
30 |
33 const TInt KMtpMaxDateTimeStringLength = 15; |
|
34 |
31 |
35 // ----------------------------------------------------------------------------- |
32 // ----------------------------------------------------------------------------- |
36 // Verification data for the GetObjectPropValue request |
33 // Verification data for the GetObjectPropValue request |
37 // ----------------------------------------------------------------------------- |
34 // ----------------------------------------------------------------------------- |
38 // |
35 // |
136 |
133 |
137 //Get the request information |
134 //Get the request information |
138 TUint32 objectHandle = Request().Uint32( TMTPTypeRequest::ERequestParameter1 ); |
135 TUint32 objectHandle = Request().Uint32( TMTPTypeRequest::ERequestParameter1 ); |
139 TUint32 propCode = Request().Uint32( TMTPTypeRequest::ERequestParameter2 ); |
136 TUint32 propCode = Request().Uint32( TMTPTypeRequest::ERequestParameter2 ); |
140 PRINT2( _L( "MM MTP <> CGetObjectPropValue::ServiceL objectHandle = 0x%x, propCode = 0x%x" ), |
137 PRINT2( _L( "MM MTP <> CGetObjectPropValue::ServiceL objectHandle = 0x%x, propCode = 0x%x" ), |
141 objectHandle, propCode ); |
138 objectHandle, propCode ); |
142 |
139 |
143 // don't have the ownship of the object |
140 // don't have the ownship of the object |
144 iObjectInfo = iRequestChecker->GetObjectInfo( objectHandle ); |
141 iObjectInfo = iRequestChecker->GetObjectInfo( objectHandle ); |
145 TPtrC suid( iObjectInfo->DesC( CMTPObjectMetaData::ESuid ) ); |
142 TPtrC suid( iObjectInfo->DesC( CMTPObjectMetaData::ESuid ) ); |
146 PRINT1( _L( "MM MTP <> CGetObjectPropValue::ServiceL object file name is %S" ), &suid ); |
143 PRINT1( _L( "MM MTP <> CGetObjectPropValue::ServiceL object file name is %S" ), &suid ); |
147 TParsePtrC parse( suid ); |
144 TParsePtrC parse( suid ); |
148 |
145 |
149 iDpConfig.GetWrapperL().SetStorageRootL( parse.Drive() ); |
|
150 |
|
151 if ( iMTPTypeString != NULL ) |
146 if ( iMTPTypeString != NULL ) |
152 { |
147 { |
153 delete iMTPTypeString; |
148 delete iMTPTypeString; |
154 iMTPTypeString = NULL; |
149 iMTPTypeString = NULL; |
155 } |
150 } |
180 // ProtectionStatus |
175 // ProtectionStatus |
181 case EMTPObjectPropCodeProtectionStatus: |
176 case EMTPObjectPropCodeProtectionStatus: |
182 { |
177 { |
183 iMTPTypeUint16.Set( 0 ); |
178 iMTPTypeUint16.Set( 0 ); |
184 iMTPTypeUint16 = MmMtpDpUtility::GetProtectionStatusL( iFramework.Fs(), |
179 iMTPTypeUint16 = MmMtpDpUtility::GetProtectionStatusL( iFramework.Fs(), |
185 iObjectInfo->DesC( CMTPObjectMetaData::ESuid ) ); |
180 iObjectInfo->DesC( CMTPObjectMetaData::ESuid ) ); |
186 SendDataL( iMTPTypeUint16 ); |
181 SendDataL( iMTPTypeUint16 ); |
187 } |
182 } |
188 break; |
183 break; |
189 |
184 |
190 // Object Size |
185 // Object Size |
229 break; |
224 break; |
230 |
225 |
231 // Name and DataAdded (audio only) fall under the same branch while dateadded(video)/modified/created fall under another |
226 // Name and DataAdded (audio only) fall under the same branch while dateadded(video)/modified/created fall under another |
232 case EMTPObjectPropCodeName: // 0xDC44 |
227 case EMTPObjectPropCodeName: // 0xDC44 |
233 case EMTPObjectPropCodeDateAdded: // 0xDC4E |
228 case EMTPObjectPropCodeDateAdded: // 0xDC4E |
234 { |
229 case EMTPObjectPropCodeAlbumArtist: |
235 if ( ( propCode == EMTPObjectPropCodeName) |
230 { |
236 || ( ( !MmMtpDpUtility::IsVideoL(iObjectInfo->DesC( CMTPObjectMetaData::ESuid ), iFramework ) ) |
231 iMTPTypeString = CMTPTypeString::NewL(); |
237 && ( propCode == EMTPObjectPropCodeDateAdded ) ) ) |
232 ServiceMetaDataFromWrapperL( propCode, *iMTPTypeString, *iObjectInfo ); |
238 { |
233 } |
239 iMTPTypeString = CMTPTypeString::NewL(); |
234 break; |
240 ServiceMetaDataFromWrapperL( propCode, *iMTPTypeString, *iObjectInfo ); |
|
241 break; |
|
242 } |
|
243 } |
|
244 //lint -fallthrough |
235 //lint -fallthrough |
245 case EMTPObjectPropCodeDateCreated: |
236 case EMTPObjectPropCodeDateCreated: |
246 case EMTPObjectPropCodeDateModified: |
237 case EMTPObjectPropCodeDateModified: |
247 { |
238 { |
248 TTime dataModified; |
|
249 dataModified = MmMtpDpUtility::GetObjectDateModifiedL( iFramework.Fs(), |
|
250 iObjectInfo->DesC( CMTPObjectMetaData::ESuid ) ); |
|
251 |
|
252 TBuf<KMtpMaxDateTimeStringLength> timeStr; |
239 TBuf<KMtpMaxDateTimeStringLength> timeStr; |
253 dataModified.FormatL( timeStr, KMtpDateTimeFormat ); |
240 MmMtpDpUtility::GetObjectDateModifiedL( iFramework.Fs(), |
|
241 iObjectInfo->DesC( CMTPObjectMetaData::ESuid ), |
|
242 timeStr ); |
|
243 |
254 PRINT1( _L( "MM MTP <> CGetObjectPropValue::ServiceL Date time %S" ), &timeStr ); |
244 PRINT1( _L( "MM MTP <> CGetObjectPropValue::ServiceL Date time %S" ), &timeStr ); |
255 iMTPTypeString = CMTPTypeString::NewL( timeStr ); |
245 iMTPTypeString = CMTPTypeString::NewL( timeStr ); |
256 SendDataL( *iMTPTypeString ); |
246 SendDataL( *iMTPTypeString ); |
257 } |
247 } |
258 break; |
248 break; |
259 |
249 |
260 // Consumable |
250 // Consumable |
261 case EMTPObjectPropCodeNonConsumable: |
251 case EMTPObjectPropCodeNonConsumable: |
262 { |
252 { |
263 iMTPTypeUint8.Set( 0 ); |
253 iMTPTypeUint8.Set( iObjectInfo->Uint( CMTPObjectMetaData::ENonConsumable ) ); |
264 SendDataL( iMTPTypeUint8 ); |
254 SendDataL( iMTPTypeUint8 ); |
265 } |
255 } |
266 break; |
256 break; |
267 |
257 |
268 default: |
258 default: |