// ---------------------------------------------------------------------------------------------------------- // Remove an item from the collection database using the given path // ---------------------------------------------------------------------------------------------------------- // void CTestCollectionPlugin::RemoveL (const CMPXCollectionPath& aPath) { LOG1(_L("CTestCollectionPlugin::RemoveL")); LogPath( aPath ); CDesCArrayFlat* fp = new (ELeave) CDesCArrayFlat(8); CleanupStack::PushL( fp ); switch( aPath.Levels() ) { case 2: if(aPath.Id() == 14) { // Test0091 iObs->HandleRemove( *fp, KErrNotFound ); } break; case 3: if(aPath.Id() == 212) { // Test0090 fp->AppendL( _L("\\song3121.ts") ); fp->AppendL( _L("\\song3122.ts") ); fp->AppendL( _L("\\song3123.tp") ); iObs->HandleRemove( *fp, KErrNone ); } break; case 4: if(aPath.Id() == 3111) { // Test0088 fp->AppendL( _L("\\song3111.ts") ); iObs->HandleRemove( *fp, KErrNone ); } break; default: User::Panic(_L("CTestCollectionPlugin::RemoveL panic"), 1); // magic number } CleanupStack::PopAndDestroy( fp ); }
// ---------------------------------------------------------------------------------------------------------- // Get the extended properties of the current file (async) // ---------------------------------------------------------------------------------------------------------- // void CTestCollectionPlugin::MediaL (const CMPXCollectionPath& aPath, const TArray<TMPXAttribute>& aAttrs, const TArray<TCapability>& aCaps, CMPXAttributeSpecs* aSpecs) { LOG1(_L("CTestCollectionPlugin::MediaL")); LogPath( aPath ); TMPXOpenMode openMode = aPath.OpenNextMode(); //TInt idIndex = aPath.Levels() - 1; LOG2(_L("TMPXOpendMode=%d"), openMode); LOG2(_L("aAttrs.Count()=%d"), aAttrs.Count()); LOG2(_L("aCaps.Count()=%d"), aCaps.Count()); LOG2(_L("aSpecs=0x%x"), aSpecs); switch( (TInt)aPath.Id(1) ) { case 14: // Test0146 { iObs->HandleMedia(NULL, KErrNone); break; } case 15: // Test0147 { CMPXMedia* media = CMPXMedia::NewL(); CleanupStack::PushL( media ); iObs->HandleMedia(media, KErrNone); CleanupStack::PopAndDestroy( media ); break; } case 16: // Test0148 { CMPXMedia* media = CMPXMedia::NewL(); CleanupStack::PushL( media ); iObs->HandleMedia(media, KErrNotFound); CleanupStack::PopAndDestroy( media ); break; } case 17: // Test0149 { CMPXMedia* media = CMPXMedia::NewL(); CleanupStack::PushL( media ); (*media) = *aSpecs; iObs->HandleMedia(media, KErrNone); CleanupStack::PopAndDestroy( media ); break; } case 990: // Test data for playback framework teests { CMPXMedia* media = CMPXMedia::NewL(); CleanupStack::PushL( media ); switch( (TInt)aPath.Id(2) ) { case 9901: AddAttrbuteL(*media, 9901, _L("song9901"), _L("\\song9901.ts"), aAttrs); AddAttributePlaybackFwTestL(*media, 9901, aAttrs); break; case 9902: AddAttrbuteL(*media, 9902, _L("song9902"), _L("\\song9902.ts"), aAttrs); AddAttributePlaybackFwTestL(*media, 9902, aAttrs); break; case 9903: AddAttrbuteL(*media, 9903, _L("song9903"), _L("\\song9903.ts"), aAttrs); AddAttributePlaybackFwTestL(*media, 9903, aAttrs); break; case 9904: AddAttrbuteL(*media, 9904, _L("song9904"), _L("\\song9904.ts"), aAttrs); AddAttributePlaybackFwTestL(*media, 9904, aAttrs); break; case 9905: AddAttrbuteL(*media, 9905, _L("song9905"), _L("\\song9905.ts"), aAttrs); AddAttributePlaybackFwTestL(*media, 9905, aAttrs); break; case 9906: AddAttrbuteL(*media, 9906, _L("song9906"), _L("\\song9906.ts"), aAttrs); AddAttributePlaybackFwTestL(*media, 9906, aAttrs); break; case 9907: AddAttrbuteL(*media, 9907, _L("song9907"), _L("\\song9907.ts"), aAttrs); AddAttributePlaybackFwTestL(*media, 9907, aAttrs); break; }; iObs->HandleMedia(media, KErrNone); CleanupStack::PopAndDestroy( media ); break; } default: User::Leave( KErrNotFound ); }; }
// ---------------------------------------------------------------------------------------------------------- // Navigates to the given path // ---------------------------------------------------------------------------------------------------------- // void CTestCollectionPlugin::OpenL(const CMPXCollectionPath& aPath, const TArray<TMPXAttribute>& aAttrs, CMPXFilter* aFilter) { LOG1(_L("CTestCollectionPlugin::OpenL")); LogPath( aPath ); TMPXOpenMode openMode = aPath.OpenNextMode(); TInt idIndex = aPath.Levels() - 1; LOG2(_L("TMPXOpendMode=%d"), openMode); LOG2(_L("aFilter=%x"), aFilter); RArray<TInt> supportedIds; CleanupClosePushL(supportedIds); supportedIds.AppendL(KMPXMediaIdContainer); supportedIds.AppendL(KMPXMediaIdGeneral); CMPXMedia* entries = CMPXMedia::NewL(supportedIds.Array()); CleanupStack::PopAndDestroy(&supportedIds); CleanupStack::PushL(entries); entries->SetTObjectValueL<TMPXItemId>(TMPXAttribute(KMPXMediaIdGeneral,EMPXMediaGeneralId), aPath.Id(idIndex)); if(aPath.Levels() == 1) { // Plugin's root level RArray<TInt> ids; CleanupClosePushL( ids ); ids.Append( 11 ); ids.Append( 12 ); ids.Append( 13 ); ids.Append( 990 ); // for Playback Framework Test RArray<TMPXAttribute> attrs; CleanupClosePushL( attrs ); attrs.Append( KMPXMediaGeneralId ); attrs.Append( KMPXMediaGeneralUri ); attrs.Append( KMPXMediaGeneralTitle ); CMPXMediaArray* array=CMPXMediaArray::NewL(); CleanupStack::PushL( array ); const TArray<TMPXAttribute>& tempRef = aAttrs.Count() == 0? attrs.Array() : aAttrs; AddMediaL(*array, ids, tempRef); FilterMediaArray(*array, aFilter); entries->SetCObjectValueL (TMPXAttribute(KMPXMediaIdContainer,EMPXMediaArrayContents),array); entries->SetTObjectValueL (TMPXAttribute(KMPXMediaIdContainer,EMPXMediaArrayCount),array->Count()); iObs->HandleOpen (entries, KErrNone); CleanupStack::PopAndDestroy(3, &ids); // attrs, array, ids } else if(aPath.Levels() == 2) { // Opening plugin's root menu TInt topLevId = aPath.Id(1); RArray<TInt> ids; CleanupClosePushL( ids ); RArray<TMPXAttribute> attrs; CleanupClosePushL( attrs ); CMPXMediaArray* array=CMPXMediaArray::NewL(); CleanupStack::PushL( array ); attrs.Append( KMPXMediaGeneralId ); attrs.Append( KMPXMediaGeneralUri ); attrs.Append( KMPXMediaGeneralTitle ); if(topLevId == 11) { ids.Append( 211 ); ids.Append( 212 ); ids.Append( 213 ); } else if(topLevId == 12) { ids.Append( 221 ); } else if(topLevId == 13) { ids.Append( 231 ); ids.Append( 232 ); } else if(topLevId == 990) { ids.Append( 9901 ); ids.Append( 9902 ); ids.Append( 9903 ); ids.Append( 9904 ); ids.Append( 9905 ); ids.Append( 9906 ); ids.Append( 9907 ); } const TArray<TMPXAttribute>& tempRef = aAttrs.Count() == 0? attrs.Array() : aAttrs; AddMediaL(*array, ids, tempRef); FilterMediaArray(*array, aFilter); entries->SetCObjectValueL (TMPXAttribute(KMPXMediaIdContainer,EMPXMediaArrayContents),array); entries->SetTObjectValueL (TMPXAttribute(KMPXMediaIdContainer,EMPXMediaArrayCount),array->Count()); iObs->HandleOpen (entries, KErrNone); CleanupStack::PopAndDestroy(3, &ids); // attrs, array, ids } else if(aPath.Levels() == 3) { // Opening plugin's 2nd TInt secLevId = aPath.Id(2); RArray<TInt> ids; CleanupClosePushL( ids ); RArray<TMPXAttribute> attrs; CleanupClosePushL( attrs ); CMPXMediaArray* array=CMPXMediaArray::NewL(); CleanupStack::PushL( array ); attrs.Append( KMPXMediaGeneralId ); attrs.Append( KMPXMediaGeneralUri ); attrs.Append( KMPXMediaGeneralTitle ); switch( secLevId ) { case 211: ids.Append( 3111 ); break; case 212: ids.Append( 3121 ); break; case 213: ids.Append( 3131 ); break; case 221: // Empty break; case 231: ids.Append( 3311 ); break; case 232: ids.Append( 3321 ); break; }; const TArray<TMPXAttribute>& tempRef = aAttrs.Count() == 0? attrs.Array() : aAttrs; AddMediaL(*array, ids, tempRef); FilterMediaArray(*array, aFilter); entries->SetCObjectValueL (TMPXAttribute(KMPXMediaIdContainer,EMPXMediaArrayContents),array); entries->SetTObjectValueL (TMPXAttribute(KMPXMediaIdContainer,EMPXMediaArrayCount),array->Count()); iObs->HandleOpen (entries, KErrNone); CleanupStack::PopAndDestroy(3, &ids); // attrs, array, ids } else { User::Leave( KErrNotFound ); } CleanupStack::PopAndDestroy( entries ); }