32 #include "mmmtpdpconfig.h" |
32 #include "mmmtpdpconfig.h" |
33 #include "mmmtpdputility.h" |
33 #include "mmmtpdputility.h" |
34 #include "cmmmtpdpmetadataaccesswrapper.h" |
34 #include "cmmmtpdpmetadataaccesswrapper.h" |
35 |
35 |
36 static const TUint32 KMTPAll = 0xffffffff; |
36 static const TUint32 KMTPAll = 0xffffffff; |
37 _LIT( KMtpDateTimeFormat, "%F%Y%M%DT%H%T%S" ); |
37 |
38 const TInt KMtpMaxDateTimeStringLength = 15; |
|
39 |
|
40 #if defined(_DEBUG) || defined(MMMTPDP_PERFLOG) |
|
41 _LIT( KSubFormatParse, "SubFormatParse" ); |
|
42 #endif |
|
43 |
38 |
44 // Verification data for the getObjectPropList request |
39 // Verification data for the getObjectPropList request |
45 const TMTPRequestElementInfo KMTPGetObjectPropListPolicy[] = |
40 const TMTPRequestElementInfo KMTPGetObjectPropListPolicy[] = |
46 { |
41 { |
47 { |
42 { |
176 iObject = NULL; |
171 iObject = NULL; |
177 iObject = CMTPObjectMetaData::NewL(); |
172 iObject = CMTPObjectMetaData::NewL(); |
178 |
173 |
179 if ( iFramework.ObjectMgr().ObjectL( handle, *iObject ) ) // Populate the object meta data |
174 if ( iFramework.ObjectMgr().ObjectL( handle, *iObject ) ) // Populate the object meta data |
180 { |
175 { |
181 SetSubFormatCodeL(); |
|
182 |
|
183 err = ServiceOneObjectPropertyL( handle, iPropCode ); |
176 err = ServiceOneObjectPropertyL( handle, iPropCode ); |
184 if ( err != KErrNone && err != KErrNotSupported ) |
177 if ( err != KErrNone && err != KErrNotSupported ) |
185 break; |
178 break; |
186 } |
179 } |
187 } |
180 } |
266 // check if groupCode is supported |
259 // check if groupCode is supported |
267 TInt count = sizeof ( KSupportedGroupCode ) / sizeof ( KSupportedGroupCode[0] ); |
260 TInt count = sizeof ( KSupportedGroupCode ) / sizeof ( KSupportedGroupCode[0] ); |
268 TInt i = 0; |
261 TInt i = 0; |
269 for ( ; i < count; i++ ) |
262 for ( ; i < count; i++ ) |
270 { |
263 { |
271 if ( groupCode == KSupportedGroupCode[i ] ) |
264 if ( groupCode == KSupportedGroupCode[i] ) |
272 break; |
265 break; |
273 } |
266 } |
274 if ( i == count ) |
267 if ( i == count ) |
275 response = EMTPRespCodeSpecificationByGroupUnsupported; |
268 response = EMTPRespCodeSpecificationByGroupUnsupported; |
276 |
269 |
361 } |
354 } |
362 else |
355 else |
363 { |
356 { |
364 CMTPObjectMetaData* meta( iRequestChecker->GetObjectInfo( iHandle ) ); |
357 CMTPObjectMetaData* meta( iRequestChecker->GetObjectInfo( iHandle ) ); |
365 TPtrC suid( meta->DesC( CMTPObjectMetaData::ESuid ) ); |
358 TPtrC suid( meta->DesC( CMTPObjectMetaData::ESuid ) ); |
366 TParsePtrC parse( suid ); |
359 iDpConfig.GetWrapperL().SetStorageRootL( suid ); |
367 iDpConfig.GetWrapperL().SetStorageRootL( parse.Drive() ); |
|
368 |
360 |
369 __ASSERT_DEBUG( meta, Panic( EMmMTPDpObjectNull ) ); |
361 __ASSERT_DEBUG( meta, Panic( EMmMTPDpObjectNull ) ); |
370 |
362 |
371 if ( ( meta->Uint( CMTPObjectMetaData::EFormatCode ) == EMTPFormatCodeAssociation ) |
363 if ( ( meta->Uint( CMTPObjectMetaData::EFormatCode ) == EMTPFormatCodeAssociation ) |
372 && ( meta->Uint( CMTPObjectMetaData::EFormatSubCode ) == EMTPAssociationTypeGenericFolder ) ) |
364 && ( meta->Uint( CMTPObjectMetaData::EFormatSubCode ) == EMTPAssociationTypeGenericFolder ) ) |
387 // Get all object handles (for GetObjectHandlesL) |
379 // Get all object handles (for GetObjectHandlesL) |
388 // ----------------------------------------------------------------------------- |
380 // ----------------------------------------------------------------------------- |
389 // |
381 // |
390 void CGetObjectPropList::GetObjectHandlesL( TUint32 aStorageId, |
382 void CGetObjectPropList::GetObjectHandlesL( TUint32 aStorageId, |
391 TUint32 aParentHandle, |
383 TUint32 aParentHandle, |
392 TUint16 aFormat /*= 0x0000*/) |
384 TUint16 aFormat /*= 0x0000*/ ) |
393 { |
385 { |
394 PRINT2( _L( "MM MTP => CGetObjectPropList::GetObjectHandlesL, aStorageId = 0x%x, aParentHandle = 0x%x" ), |
386 PRINT2( _L( "MM MTP => CGetObjectPropList::GetObjectHandlesL, aStorageId = 0x%x, aParentHandle = 0x%x" ), |
395 aStorageId, |
387 aStorageId, |
396 aParentHandle ); |
388 aParentHandle ); |
397 |
389 |
689 *textData, |
681 *textData, |
690 *iObject ) ); |
682 *iObject ) ); |
691 |
683 |
692 PRINT1( _L( "MM MTP <> CGetObjectPropList::ServiceOneObjectPropertyL err = %d" ), err ); |
684 PRINT1( _L( "MM MTP <> CGetObjectPropList::ServiceOneObjectPropertyL err = %d" ), err ); |
693 |
685 |
694 if ( err == KErrNone ) |
686 iPropertyElement = &(iPropertyList->ReservePropElemL( aHandle, aPropCode ) ); |
695 { |
687 iPropertyElement->SetStringL( CMTPTypeObjectPropListElement::EValue, textData->StringChars() ); |
696 iPropertyElement = &(iPropertyList->ReservePropElemL( aHandle, aPropCode ) ); |
|
697 iPropertyElement->SetStringL( CMTPTypeObjectPropListElement::EValue, textData->StringChars() ); |
|
698 } |
|
699 |
688 |
700 CleanupStack::PopAndDestroy( textData ); // - textData |
689 CleanupStack::PopAndDestroy( textData ); // - textData |
701 break; |
690 break; |
702 } |
691 } |
703 // Else, video DB does not support DateAdded field, use the file system date! |
692 // Else, video DB does not support DateAdded field, use the file system date! |
771 iObject = NULL; |
760 iObject = NULL; |
772 iObject = CMTPObjectMetaData::NewL(); |
761 iObject = CMTPObjectMetaData::NewL(); |
773 |
762 |
774 if ( iFramework.ObjectMgr().ObjectL( handle, *iObject ) ) // Populate the object meta data |
763 if ( iFramework.ObjectMgr().ObjectL( handle, *iObject ) ) // Populate the object meta data |
775 { |
764 { |
776 SetSubFormatCodeL(); |
|
777 |
|
778 if ( iPropCode == KMTPAll ) |
765 if ( iPropCode == KMTPAll ) |
779 err = ServiceAllPropertiesL( handle ); |
766 err = ServiceAllPropertiesL( handle ); |
780 else if ( iPropCode == EMTPObjectPropCodeUndefined ) |
767 else if ( iPropCode == EMTPObjectPropCodeUndefined ) |
781 { |
768 { |
782 err = ServiceGroupPropertiesL( handle ); |
769 err = ServiceGroupPropertiesL( handle ); |
813 // |
800 // |
814 // ----------------------------------------------------------------------------- |
801 // ----------------------------------------------------------------------------- |
815 // |
802 // |
816 EXPORT_C TInt CGetObjectPropList::RunError( TInt aError ) |
803 EXPORT_C TInt CGetObjectPropList::RunError( TInt aError ) |
817 { |
804 { |
818 PRINT1( _L( "MM MTP <> CGetObjectPropList::RunError aError = %d" ), aError ); |
805 if ( aError != KErrNone ) |
819 TRAP_IGNORE( SendResponseL( EMTPRespCodeGeneralError ) ); |
806 PRINT1( _L( "MM MTP <> CGetObjectPropList::RunError aError = %d" ), aError ); |
|
807 |
|
808 TRAP_IGNORE( SendResponseL( EMTPRespCodeGeneralError ) ); |
820 |
809 |
821 return KErrNone; |
810 return KErrNone; |
822 } |
811 } |
823 |
812 |
824 // ----------------------------------------------------------------------------- |
813 // ----------------------------------------------------------------------------- |
845 TInt count = sizeof ( KPropGroupMapTable ) / sizeof ( KPropGroupMapTable[0] ); |
834 TInt count = sizeof ( KPropGroupMapTable ) / sizeof ( KPropGroupMapTable[0] ); |
846 for ( TInt i = 0; i < properties->Count(); i++ ) |
835 for ( TInt i = 0; i < properties->Count(); i++ ) |
847 { |
836 { |
848 for ( TInt j = 0; j < count; j++ ) |
837 for ( TInt j = 0; j < count; j++ ) |
849 { |
838 { |
850 if( KPropGroupMapTable[j].iPropCode == (*properties)[i] |
839 if( KPropGroupMapTable[j].iPropCode == ( *properties )[i] |
851 && KPropGroupMapTable[j].iGroupCode == aGroupCode ) |
840 && KPropGroupMapTable[j].iGroupCode == aGroupCode ) |
852 { |
841 { |
853 aPropArray.Append( (*properties)[i] ); |
842 aPropArray.Append( (*properties)[i] ); |
854 break; |
843 break; |
855 } |
844 } |
856 } |
845 } |
857 } |
846 } |
858 } |
847 } |
859 |
848 |
860 void CGetObjectPropList::SetSubFormatCodeL() |
|
861 { |
|
862 __ASSERT_DEBUG( iObject, Panic( EMmMTPDpObjectNull ) ); |
|
863 |
|
864 // Note: Parsing out subformat code in external enumeration phase. |
|
865 // This process was delayed in internal phase to avoid time-out. |
|
866 TUint16 formatCode = iObject->Uint( CMTPObjectMetaData::EFormatCode ); |
|
867 TUint subFormatCode = iObject->Uint( CMTPObjectMetaData::EFormatSubCode ); |
|
868 PRINT2( _L( "MM MTP <> CGetObjectPropList::SetSubFormatCode, formatCode = 0x%x, subFormatCode = 0x%x" ), |
|
869 formatCode, |
|
870 subFormatCode ); |
|
871 |
|
872 TBool ifNeedParse = ( ( formatCode == EMTPFormatCodeMP4Container ) |
|
873 || ( formatCode == EMTPFormatCode3GPContainer ) |
|
874 || ( formatCode== EMTPFormatCodeASF ) ) |
|
875 && ( subFormatCode == EMTPSubFormatCodeUnknown ); |
|
876 if ( ifNeedParse ) |
|
877 { |
|
878 PERFLOGSTART( KSubFormatParse ); |
|
879 |
|
880 if ( MmMtpDpUtility::IsVideoL( iObject->DesC( CMTPObjectMetaData::ESuid ) ) ) |
|
881 subFormatCode = EMTPSubFormatCodeVideo; |
|
882 else |
|
883 subFormatCode = EMTPSubFormatCodeAudio; |
|
884 |
|
885 PERFLOGSTOP( KSubFormatParse ); |
|
886 |
|
887 iObject->SetUint( CMTPObjectMetaData::EFormatSubCode, subFormatCode ); |
|
888 } |
|
889 } |
|
890 |
|
891 // end of file |
849 // end of file |