16 */ |
16 */ |
17 |
17 |
18 |
18 |
19 #include <bautils.h> |
19 #include <bautils.h> |
20 #include <e32std.h> |
20 #include <e32std.h> |
21 #include <mtp/mmtpdataproviderframework.h> |
21 |
22 #include <mtp/mmtpobjectmgr.h> |
22 #include <mtp/mmtpobjectmgr.h> |
23 #include <mtp/cmtptypeobjectproplist.h> |
23 #include <mtp/cmtptypeobjectproplist.h> |
24 #include <mtp/cmtptypestring.h> |
24 #include <mtp/cmtptypestring.h> |
25 #include <mtp/cmtptypearray.h> |
25 #include <mtp/cmtptypearray.h> |
26 #include <mtp/cmtpobjectmetadata.h> |
|
27 |
26 |
28 #include "tobjectdescription.h" |
27 #include "tobjectdescription.h" |
29 #include "cgetobjectproplist.h" |
28 #include "cgetobjectproplist.h" |
30 #include "tmmmtpdppanic.h" |
29 #include "tmmmtpdppanic.h" |
31 #include "mmmtpdplogger.h" |
30 #include "mmmtpdplogger.h" |
32 #include "mmmtpdpconfig.h" |
31 #include "mmmtpdpconfig.h" |
33 #include "mmmtpdputility.h" |
32 #include "mmmtpdputility.h" |
34 #include "cmmmtpdpmetadataaccesswrapper.h" |
33 #include "cmmmtpdpmetadataaccesswrapper.h" |
35 |
34 |
36 static const TUint32 KMTPAll = 0xffffffff; |
35 static const TUint32 KMTPAll = 0xffffffff; |
37 _LIT( KMtpDateTimeFormat, "%F%Y%M%DT%H%T%S" ); |
36 |
38 const TInt KMtpMaxDateTimeStringLength = 15; |
|
39 |
|
40 #if defined(_DEBUG) || defined(MMMTPDP_PERFLOG) |
|
41 _LIT( KSubFormatParse, "SubFormatParse" ); |
|
42 #endif |
|
43 |
37 |
44 // Verification data for the getObjectPropList request |
38 // Verification data for the getObjectPropList request |
45 const TMTPRequestElementInfo KMTPGetObjectPropListPolicy[] = |
39 const TMTPRequestElementInfo KMTPGetObjectPropListPolicy[] = |
46 { |
40 { |
47 { |
41 { |
80 // ----------------------------------------------------------------------------- |
74 // ----------------------------------------------------------------------------- |
81 // |
75 // |
82 EXPORT_C CGetObjectPropList::CGetObjectPropList( MMTPDataProviderFramework& aFramework, |
76 EXPORT_C CGetObjectPropList::CGetObjectPropList( MMTPDataProviderFramework& aFramework, |
83 MMTPConnection& aConnection, |
77 MMTPConnection& aConnection, |
84 MMmMtpDpConfig& aDpConfig ) : |
78 MMmMtpDpConfig& aDpConfig ) : |
85 CRequestProcessor( aFramework, |
79 CRequestProcessor( aFramework, |
86 aConnection, |
80 aConnection, |
87 sizeof ( KMTPGetObjectPropListPolicy ) / sizeof( TMTPRequestElementInfo ), |
81 sizeof ( KMTPGetObjectPropListPolicy ) / sizeof( TMTPRequestElementInfo ), |
88 KMTPGetObjectPropListPolicy ), |
82 KMTPGetObjectPropListPolicy ), |
89 iHandles ( KMmMtpRArrayGranularity ), |
83 iHandles ( KMmMtpRArrayGranularity ), |
90 iDpConfig( aDpConfig ), |
84 iDpConfig( aDpConfig ), |
91 iPropertyArray( KMmMtpRArrayGranularity ) |
85 iPropertyArray( KMmMtpRArrayGranularity ) |
92 { |
86 { |
93 PRINT( _L( "Operation: GetObjectPropList(0x9805)" ) ); |
87 PRINT( _L( "Operation: GetObjectPropList(0x9805)" ) ); |
94 } |
88 } |
95 |
89 |
96 // ----------------------------------------------------------------------------- |
90 // ----------------------------------------------------------------------------- |
165 else |
159 else |
166 { |
160 { |
167 TInt err = KErrNone; |
161 TInt err = KErrNone; |
168 for ( TInt i = 0; i < numOfObjects; i++ ) |
162 for ( TInt i = 0; i < numOfObjects; i++ ) |
169 { |
163 { |
170 TUint32 handle = iHandles[i ]; |
164 TUint32 handle = iHandles[i]; |
171 |
165 |
172 if ( iFramework.ObjectMgr().ObjectOwnerId( handle ) |
166 if ( iFramework.ObjectMgr().ObjectOwnerId( handle ) |
173 == iFramework.DataProviderId() ) |
167 == iFramework.DataProviderId() ) |
174 { |
168 { |
175 delete iObject; |
169 delete iObject; |
176 iObject = NULL; |
170 iObject = NULL; |
177 iObject = CMTPObjectMetaData::NewL(); |
171 iObject = CMTPObjectMetaData::NewL(); |
178 |
172 |
179 if ( iFramework.ObjectMgr().ObjectL( handle, *iObject ) ) // Populate the object meta data |
173 if ( iFramework.ObjectMgr().ObjectL( handle, *iObject ) ) // Populate the object meta data |
180 { |
174 { |
181 SetSubFormatCodeL(); |
|
182 |
|
183 err = ServiceOneObjectPropertyL( handle, iPropCode ); |
175 err = ServiceOneObjectPropertyL( handle, iPropCode ); |
184 if ( err != KErrNone && err != KErrNotSupported ) |
176 if ( err != KErrNone && err != KErrNotSupported ) |
185 break; |
177 break; |
186 } |
178 } |
187 } |
179 } |
188 } |
180 } |
189 PRINT1( _L( "MM MTP <> CGetObjectPropList::ServiceL, one property was queried, Send data to PC! err = %d" ), err ); |
181 PRINT1( _L( "MM MTP <> CGetObjectPropList::ServiceL, one property was queried, Send data to PC! err = %d" ), err ); |
190 if ( err == KErrNone || err == KErrNotSupported ) |
182 if ( err == KErrNone |
|
183 || ( err == KErrNotSupported && 0 < iPropertyList->NumberOfElements() ) ) |
|
184 // Make sure the dataset which is returned to pc is valid |
191 SendDataL( *iPropertyList ); |
185 SendDataL( *iPropertyList ); |
192 else if ( err == KErrNotFound ) |
186 else if ( err == KErrNotFound || err == KErrNotSupported ) |
|
187 // The object entry is not in db |
|
188 // or the ONLY required metadata is not in db. |
|
189 // The second case is the same with GetObjectPropValue and device has nothing to return. |
193 SendResponseL( EMTPRespCodeAccessDenied ); |
190 SendResponseL( EMTPRespCodeAccessDenied ); |
194 else |
191 else |
195 SendResponseL( EMTPRespCodeGeneralError ); |
192 SendResponseL( EMTPRespCodeGeneralError ); |
196 } |
193 } |
197 |
194 |
198 PRINT( _L( "MM MTP <= CGetObjectPropList::ServiceL" ) ); |
195 PRINT( _L( "MM MTP <= CGetObjectPropList::ServiceL" ) ); |
199 } |
196 } |
200 |
197 |
201 // ----------------------------------------------------------------------------- |
198 // ----------------------------------------------------------------------------- |
202 // CGetObjectPropList::CheckFormatL |
199 // CGetObjectPropList::CheckFormatL |
203 // Ensures the object format operation parameter is valid |
200 // Ensure the object format operation parameter is valid |
204 // ----------------------------------------------------------------------------- |
201 // ----------------------------------------------------------------------------- |
205 // |
202 // |
206 TMTPResponseCode CGetObjectPropList::CheckFormatL() const |
203 TMTPResponseCode CGetObjectPropList::CheckFormatL() const |
207 { |
204 { |
208 TMTPResponseCode response = EMTPRespCodeOK; |
205 TMTPResponseCode response = EMTPRespCodeOK; |
257 // Get group code |
254 // Get group code |
258 TUint32 groupCode = Request().Uint32( TMTPTypeRequest::ERequestParameter4 ); |
255 TUint32 groupCode = Request().Uint32( TMTPTypeRequest::ERequestParameter4 ); |
259 PRINT1( _L( "MM MTP <> CGetObjectPropList::CheckPropCode, Group Code = 0x%x" ), groupCode ); |
256 PRINT1( _L( "MM MTP <> CGetObjectPropList::CheckPropCode, Group Code = 0x%x" ), groupCode ); |
260 |
257 |
261 // check if groupCode is supported |
258 // check if groupCode is supported |
262 TInt count = sizeof ( KSupportedGroupCode ) |
259 TInt count = sizeof ( KSupportedGroupCode ) / sizeof ( KSupportedGroupCode[0] ); |
263 / sizeof ( KSupportedGroupCode[0] ); |
|
264 TInt i = 0; |
260 TInt i = 0; |
265 for ( ; i < count; i++ ) |
261 for ( ; i < count; i++ ) |
266 { |
262 { |
267 if ( groupCode == KSupportedGroupCode[i ] ) |
263 if ( groupCode == KSupportedGroupCode[i] ) |
268 break; |
264 break; |
269 } |
265 } |
270 if ( i == count ) |
266 if ( i == count ) |
271 response = EMTPRespCodeSpecificationByGroupUnsupported; |
267 response = EMTPRespCodeSpecificationByGroupUnsupported; |
272 |
268 |
273 } |
269 } |
274 else if ( iPropCode != KMTPAll ) |
270 else if ( iPropCode != KMTPAll ) |
275 { |
271 { |
276 PRINT1( _L( "MM MTP <> CGetObjectPropList::CheckPropCode, Property(0x%x) was queried." ), iPropCode ); |
272 PRINT1( _L( "MM MTP <> CGetObjectPropList::CheckPropCode, Property(0x%x) was queried." ), iPropCode ); |
277 |
273 |
278 TInt err = KErrNone; |
|
279 const RArray<TUint>* properties = NULL; |
274 const RArray<TUint>* properties = NULL; |
280 if ( formatCode == KMTPFormatsAll ) |
275 if ( formatCode == KMTPFormatsAll ) |
281 properties = iDpConfig.GetAllSupportedProperties(); |
276 properties = iDpConfig.GetAllSupportedProperties(); |
282 else |
277 else |
283 properties = iDpConfig.GetSupportedPropertiesL( formatCode ); |
278 properties = iDpConfig.GetSupportedPropertiesL( formatCode ); |
284 |
279 |
285 User::LeaveIfError( err ); |
|
286 |
|
287 const TInt count = properties->Count(); |
280 const TInt count = properties->Count(); |
288 TInt i = 0; |
281 TInt i = 0; |
289 for ( i = 0; i < count; i++ ) |
282 for ( i = 0; i < count; i++ ) |
290 { |
283 { |
291 if ( (*properties)[i] == iPropCode ) |
284 if ( (*properties)[i] == iPropCode ) |
381 PRINT( _L( "MM MTP <= CGetObjectPropList::GetObjectHandlesL" ) ); |
373 PRINT( _L( "MM MTP <= CGetObjectPropList::GetObjectHandlesL" ) ); |
382 } |
374 } |
383 |
375 |
384 // ----------------------------------------------------------------------------- |
376 // ----------------------------------------------------------------------------- |
385 // CGetObjectPropList::GetObjectHandlesL |
377 // CGetObjectPropList::GetObjectHandlesL |
386 // Gets all object handles (for GetObjectHandlesL) |
378 // Get all object handles (for GetObjectHandlesL) |
387 // ----------------------------------------------------------------------------- |
379 // ----------------------------------------------------------------------------- |
388 // |
380 // |
389 void CGetObjectPropList::GetObjectHandlesL( TUint32 aStorageId, |
381 void CGetObjectPropList::GetObjectHandlesL( TUint32 aStorageId, |
390 TUint32 aParentHandle, |
382 TUint32 aParentHandle, |
391 TUint16 aFormat /*= 0x0000*/) |
383 TUint16 aFormat /*= 0x0000*/ ) |
392 { |
384 { |
393 PRINT2( _L( "MM MTP => CGetObjectPropList::GetObjectHandlesL, aStorageId = 0x%x, aParentHandle = 0x%x" ), |
385 PRINT2( _L( "MM MTP => CGetObjectPropList::GetObjectHandlesL, aStorageId = 0x%x, aParentHandle = 0x%x" ), |
394 aStorageId, |
386 aStorageId, |
395 aParentHandle ); |
387 aParentHandle ); |
396 |
388 |
510 properties = iDpConfig.GetSupportedPropertiesL( formatCode ); |
502 properties = iDpConfig.GetSupportedPropertiesL( formatCode ); |
511 |
503 |
512 const TInt count = properties->Count(); |
504 const TInt count = properties->Count(); |
513 |
505 |
514 TInt err = KErrNone; |
506 TInt err = KErrNone; |
|
507 TBool successQuery = EFalse; |
515 for ( TInt i = 0; i < count; i++ ) |
508 for ( TInt i = 0; i < count; i++ ) |
516 { |
509 { |
517 // no need to do the trap anymore, this is being handle internally in Media DP's ServiceSpecificObjectPropertyL, also, this base class should not know too much of different handling between different formats |
510 // no need to do the trap anymore, this is being handle internally in Media DP's ServiceSpecificObjectPropertyL, |
|
511 // also, this base class should not know too much of different handling between different formats |
518 err = ServiceOneObjectPropertyL( aHandle, (*properties)[i] ); |
512 err = ServiceOneObjectPropertyL( aHandle, (*properties)[i] ); |
519 if ( err == KErrNotSupported ) // Skip |
513 if ( err == KErrNone ) |
|
514 successQuery = ETrue; |
|
515 if ( err == KErrNotSupported || err == KErrNotFound ) // Skip |
520 err = KErrNone; |
516 err = KErrNone; |
521 if ( err != KErrNone ) |
517 if ( err != KErrNone ) |
522 break; |
518 break; |
523 } |
519 } |
524 |
520 |
|
521 // In PC Suite combined mode, a file that was found at the beginning could be deleted by PC Suite protocol |
|
522 // Need to fail it here. |
|
523 if ( successQuery == EFalse ) |
|
524 err = KErrNotFound; |
|
525 |
525 PRINT1( _L( "MM MTP <= CGetObjectPropList::ServiceAllPropertiesL err = %d" ), err ); |
526 PRINT1( _L( "MM MTP <= CGetObjectPropList::ServiceAllPropertiesL err = %d" ), err ); |
526 return err; |
527 return err; |
527 } |
528 } |
528 |
529 |
|
530 // ----------------------------------------------------------------------------- |
|
531 // CGetObjectPropList::ServiceGroupPropertiesL |
|
532 // Get the grouped object properties for specific object |
|
533 // ----------------------------------------------------------------------------- |
|
534 // |
529 TInt CGetObjectPropList::ServiceGroupPropertiesL( TUint32 aHandle ) |
535 TInt CGetObjectPropList::ServiceGroupPropertiesL( TUint32 aHandle ) |
530 { |
536 { |
531 PRINT1( _L( "MM MTP => CGetObjectPropList::ServiceGroupPropertiesL aHandle = 0x%x" ), aHandle ); |
537 PRINT1( _L( "MM MTP => CGetObjectPropList::ServiceGroupPropertiesL aHandle = 0x%x" ), aHandle ); |
532 |
538 |
533 TFileName fileName( iObject->DesC( CMTPObjectMetaData::ESuid ) ); |
539 TFileName fileName( iObject->DesC( CMTPObjectMetaData::ESuid ) ); |
583 { |
589 { |
584 // Storage ID |
590 // Storage ID |
585 case EMTPObjectPropCodeStorageID: |
591 case EMTPObjectPropCodeStorageID: |
586 { |
592 { |
587 TMTPTypeUint32 storageId( iObject->Uint( CMTPObjectMetaData::EStorageId ) ); |
593 TMTPTypeUint32 storageId( iObject->Uint( CMTPObjectMetaData::EStorageId ) ); |
588 iPropertyElement = &(iPropertyList->ReservePropElemL(aHandle, aPropCode)); |
594 iPropertyElement = &( iPropertyList->ReservePropElemL( aHandle, aPropCode ) ); |
589 iPropertyElement->SetUint32L(CMTPTypeObjectPropListElement::EValue, storageId.Value()); |
595 iPropertyElement->SetUint32L( CMTPTypeObjectPropListElement::EValue, storageId.Value() ); |
590 } |
596 } |
591 break; |
597 break; |
592 |
598 |
593 // Format Code |
599 // Format Code |
594 case EMTPObjectPropCodeObjectFormat: |
600 case EMTPObjectPropCodeObjectFormat: |
595 { |
601 { |
596 TMTPTypeUint16 objectFormat( iObject->Uint( CMTPObjectMetaData::EFormatCode ) ); |
602 TMTPTypeUint16 objectFormat( iObject->Uint( CMTPObjectMetaData::EFormatCode ) ); |
597 iPropertyElement = &(iPropertyList->ReservePropElemL(aHandle, aPropCode)); |
603 iPropertyElement = &( iPropertyList->ReservePropElemL( aHandle, aPropCode ) ); |
598 iPropertyElement->SetUint16L(CMTPTypeObjectPropListElement::EValue, objectFormat.Value()); |
604 iPropertyElement->SetUint16L( CMTPTypeObjectPropListElement::EValue, objectFormat.Value() ); |
599 } |
605 } |
600 break; |
606 break; |
601 |
607 |
602 // Protection Status |
608 // Protection Status |
603 case EMTPObjectPropCodeProtectionStatus: |
609 case EMTPObjectPropCodeProtectionStatus: |
604 { |
610 { |
605 TMTPTypeUint16 protectionStatus( MmMtpDpUtility::GetProtectionStatusL( iFramework.Fs(), |
611 TMTPTypeUint16 protectionStatus( MmMtpDpUtility::GetProtectionStatusL( iFramework.Fs(), |
606 iObject->DesC( CMTPObjectMetaData::ESuid ) ) ); |
612 iObject->DesC( CMTPObjectMetaData::ESuid ) ) ); |
607 iPropertyElement = &(iPropertyList->ReservePropElemL(aHandle, aPropCode)); |
613 iPropertyElement = &( iPropertyList->ReservePropElemL( aHandle, aPropCode ) ); |
608 iPropertyElement->SetUint16L(CMTPTypeObjectPropListElement::EValue, protectionStatus.Value()); |
614 iPropertyElement->SetUint16L( CMTPTypeObjectPropListElement::EValue, protectionStatus.Value() ); |
609 } |
615 } |
610 break; |
616 break; |
611 |
617 |
612 // Object Size |
618 // Object Size |
613 case EMTPObjectPropCodeObjectSize: |
619 case EMTPObjectPropCodeObjectSize: |
628 delete log; |
634 delete log; |
629 log = NULL; |
635 log = NULL; |
630 #endif // _DEBUG |
636 #endif // _DEBUG |
631 TParsePtrC parse( iObject->DesC( CMTPObjectMetaData::ESuid ) ); |
637 TParsePtrC parse( iObject->DesC( CMTPObjectMetaData::ESuid ) ); |
632 textData = CMTPTypeString::NewLC( parse.NameAndExt() ); // + textData |
638 textData = CMTPTypeString::NewLC( parse.NameAndExt() ); // + textData |
633 iPropertyElement = &(iPropertyList->ReservePropElemL(aHandle, aPropCode)); |
639 iPropertyElement = &( iPropertyList->ReservePropElemL( aHandle, aPropCode) ); |
634 iPropertyElement->SetStringL(CMTPTypeObjectPropListElement::EValue, textData->StringChars()); |
640 iPropertyElement->SetStringL( CMTPTypeObjectPropListElement::EValue, textData->StringChars() ); |
635 CleanupStack::PopAndDestroy( textData ); // - textData |
641 CleanupStack::PopAndDestroy( textData ); // - textData |
636 } |
642 } |
637 break; |
643 break; |
638 |
644 |
639 // Parent Object |
645 // Parent Object |
640 case EMTPObjectPropCodeParentObject: |
646 case EMTPObjectPropCodeParentObject: |
641 { |
647 { |
642 iPropertyElement = &(iPropertyList->ReservePropElemL(aHandle, aPropCode)); |
648 iPropertyElement = &( iPropertyList->ReservePropElemL( aHandle, aPropCode ) ); |
643 iPropertyElement->SetUint32L(CMTPTypeObjectPropListElement::EValue, iObject->Uint( CMTPObjectMetaData::EParentHandle )); |
649 iPropertyElement->SetUint32L( CMTPTypeObjectPropListElement::EValue, iObject->Uint( CMTPObjectMetaData::EParentHandle ) ); |
644 } |
650 } |
645 break; |
651 break; |
646 |
652 |
647 // PUID |
653 // PUID |
648 case EMTPObjectPropCodePersistentUniqueObjectIdentifier: |
654 case EMTPObjectPropCodePersistentUniqueObjectIdentifier: |
649 { |
655 { |
650 TMTPTypeUint128 puid = iFramework.ObjectMgr().PuidL( aHandle ); |
656 TMTPTypeUint128 puid = iFramework.ObjectMgr().PuidL( aHandle ); |
651 iPropertyElement = &(iPropertyList->ReservePropElemL(aHandle, aPropCode)); |
657 iPropertyElement = &( iPropertyList->ReservePropElemL( aHandle, aPropCode ) ); |
652 iPropertyElement->SetUint128L(CMTPTypeObjectPropListElement::EValue,puid.UpperValue(), puid.LowerValue() ); |
658 iPropertyElement->SetUint128L( CMTPTypeObjectPropListElement::EValue,puid.UpperValue(), puid.LowerValue() ); |
653 } |
659 } |
654 break; |
660 break; |
655 |
661 |
656 case EMTPObjectPropCodeName: |
662 case EMTPObjectPropCodeName: |
657 case EMTPObjectPropCodeDateAdded: |
663 case EMTPObjectPropCodeDateAdded: |
658 { |
664 case EMTPObjectPropCodeAlbumArtist: |
659 if ( ( aPropCode == EMTPObjectPropCodeName ) |
665 { |
660 || ( ( !MmMtpDpUtility::IsVideoL( iObject->DesC( CMTPObjectMetaData::ESuid ), iFramework ) ) |
666 textData = CMTPTypeString::NewLC(); // + textData |
661 && ( aPropCode == EMTPObjectPropCodeDateAdded ) ) ) |
667 |
662 { |
668 TRAP( err, iDpConfig.GetWrapperL().GetObjectMetadataValueL( aPropCode, |
663 textData = CMTPTypeString::NewLC(); // + textData |
669 *textData, |
664 |
670 *iObject ) ); |
665 TRAP( err, iDpConfig.GetWrapperL().GetObjectMetadataValueL( aPropCode, |
671 |
666 *textData, |
672 PRINT1( _L( "MM MTP <> CGetObjectPropList::ServiceOneObjectPropertyL err = %d" ), err ); |
667 *iObject ) ); |
673 |
668 |
674 iPropertyElement = &( iPropertyList->ReservePropElemL( aHandle, aPropCode ) ); |
669 PRINT1( _L( "MM MTP <> CGetObjectPropList::ServiceOneObjectPropertyL err = %d" ), err ); |
675 iPropertyElement->SetStringL( CMTPTypeObjectPropListElement::EValue, textData->StringChars() ); |
670 |
676 |
671 if ( err == KErrNone ) |
677 CleanupStack::PopAndDestroy( textData ); // - textData |
672 { |
|
673 iPropertyElement = &(iPropertyList->ReservePropElemL( aHandle, aPropCode ) ); |
|
674 iPropertyElement->SetStringL(CMTPTypeObjectPropListElement::EValue, textData->StringChars()); |
|
675 } |
|
676 |
|
677 CleanupStack::PopAndDestroy( textData ); // - textData |
|
678 } |
|
679 } |
678 } |
680 break; |
679 break; |
681 |
680 |
682 case EMTPObjectPropCodeDateCreated: |
681 case EMTPObjectPropCodeDateCreated: |
683 case EMTPObjectPropCodeDateModified: |
682 case EMTPObjectPropCodeDateModified: |
684 { |
683 { |
685 TTime dataModified; |
|
686 dataModified = MmMtpDpUtility::GetObjectDateModifiedL( iFramework.Fs(), |
|
687 iObject->DesC( CMTPObjectMetaData::ESuid ) ); |
|
688 |
|
689 TBuf<KMtpMaxDateTimeStringLength> timeStr; |
684 TBuf<KMtpMaxDateTimeStringLength> timeStr; |
690 dataModified.FormatL( timeStr, KMtpDateTimeFormat ); |
685 MmMtpDpUtility::GetObjectDateModifiedL( iFramework.Fs(), |
|
686 iObject->DesC( CMTPObjectMetaData::ESuid ), |
|
687 timeStr ); |
691 PRINT1( _L( "MM MTP <> CGetObjectPropList::ServiceOneObjectPropertyL Date time %S" ), &timeStr ); |
688 PRINT1( _L( "MM MTP <> CGetObjectPropList::ServiceOneObjectPropertyL Date time %S" ), &timeStr ); |
|
689 |
692 CMTPTypeString* datastring = CMTPTypeString::NewLC( timeStr ); // + datastring |
690 CMTPTypeString* datastring = CMTPTypeString::NewLC( timeStr ); // + datastring |
693 |
691 iPropertyElement = &(iPropertyList->ReservePropElemL( aHandle, aPropCode ) ); |
694 iPropertyElement = &(iPropertyList->ReservePropElemL(aHandle, aPropCode)); |
692 iPropertyElement->SetStringL( CMTPTypeObjectPropListElement::EValue, datastring->StringChars() ); |
695 iPropertyElement->SetStringL(CMTPTypeObjectPropListElement::EValue, datastring->StringChars()); |
|
696 CleanupStack::PopAndDestroy( datastring ); // - datastring |
693 CleanupStack::PopAndDestroy( datastring ); // - datastring |
697 } |
694 } |
698 break; |
695 break; |
699 |
696 |
700 // Consumable Value |
697 // Consumable Value |
701 case EMTPObjectPropCodeNonConsumable: |
698 case EMTPObjectPropCodeNonConsumable: |
702 { |
699 { |
703 iPropertyElement = &(iPropertyList->ReservePropElemL(aHandle, aPropCode)); |
700 iPropertyElement = &(iPropertyList->ReservePropElemL(aHandle, aPropCode)); |
704 iPropertyElement->SetUint8L(CMTPTypeObjectPropListElement::EValue,0); |
701 iPropertyElement->SetUint8L( CMTPTypeObjectPropListElement::EValue, |
|
702 iObject->Uint( CMTPObjectMetaData::ENonConsumable ) ); |
705 } |
703 } |
706 break; |
704 break; |
707 |
705 |
708 default: |
706 default: |
709 { |
707 { |
|
708 // "err == KErrNotFound" means the object entry does not exist in DB, |
|
709 // "err == KErrNotSupported" means the entry is there but this metadata not. |
710 err = ServiceSpecificObjectPropertyL( aPropCode, aHandle ); |
710 err = ServiceSpecificObjectPropertyL( aPropCode, aHandle ); |
711 } |
711 } |
712 break; |
712 break; |
713 } |
713 } |
714 |
714 |
817 TInt count = sizeof ( KPropGroupMapTable ) / sizeof ( KPropGroupMapTable[0] ); |
816 TInt count = sizeof ( KPropGroupMapTable ) / sizeof ( KPropGroupMapTable[0] ); |
818 for ( TInt i = 0; i < properties->Count(); i++ ) |
817 for ( TInt i = 0; i < properties->Count(); i++ ) |
819 { |
818 { |
820 for ( TInt j = 0; j < count; j++ ) |
819 for ( TInt j = 0; j < count; j++ ) |
821 { |
820 { |
822 if( KPropGroupMapTable[j].iPropCode == (*properties)[i] |
821 if( KPropGroupMapTable[j].iPropCode == ( *properties )[i] |
823 && KPropGroupMapTable[j].iGroupCode == aGroupCode ) |
822 && KPropGroupMapTable[j].iGroupCode == aGroupCode ) |
824 { |
823 { |
825 aPropArray.Append( (*properties)[i] ); |
824 aPropArray.Append( (*properties)[i] ); |
826 break; |
825 break; |
827 } |
826 } |
828 } |
827 } |
829 } |
828 } |
830 } |
829 } |
831 |
830 |
832 void CGetObjectPropList::SetSubFormatCodeL() |
|
833 { |
|
834 __ASSERT_DEBUG( iObject, Panic( EMmMTPDpObjectNull ) ); |
|
835 |
|
836 // Note: Parsing out subformat code in external enumeration phase. |
|
837 // This process was delayed in internal phase to avoid time-out. |
|
838 TUint16 formatCode = iObject->Uint( CMTPObjectMetaData::EFormatCode ); |
|
839 TUint subFormatCode = iObject->Uint( CMTPObjectMetaData::EFormatSubCode ); |
|
840 PRINT2( _L( "MM MTP <> CGetObjectPropList::SetSubFormatCode, formatCode = 0x%x, subFormatCode = 0x%x" ), |
|
841 formatCode, |
|
842 subFormatCode ); |
|
843 |
|
844 TBool ifNeedParse = ( ( formatCode == EMTPFormatCodeMP4Container ) |
|
845 || ( formatCode == EMTPFormatCode3GPContainer ) |
|
846 || ( formatCode== EMTPFormatCodeASF ) ) |
|
847 && ( subFormatCode == EMTPSubFormatCodeUnknown ); |
|
848 if ( ifNeedParse ) |
|
849 { |
|
850 PERFLOGSTART( KSubFormatParse ); |
|
851 |
|
852 if ( MmMtpDpUtility::IsVideoL( iObject->DesC( CMTPObjectMetaData::ESuid ) ) ) |
|
853 subFormatCode = EMTPSubFormatCodeVideo; |
|
854 else |
|
855 subFormatCode = EMTPSubFormatCodeAudio; |
|
856 |
|
857 PERFLOGSTOP( KSubFormatParse ); |
|
858 |
|
859 iObject->SetUint( CMTPObjectMetaData::EFormatSubCode, subFormatCode ); |
|
860 } |
|
861 } |
|
862 |
|
863 // end of file |
831 // end of file |