// ----------------------------------------------------------------------------- // CSipServerCore::LoadRequestHandlerL // ----------------------------------------------------------------------------- // void CSipServerCore::LoadRequestHandlerL() { RImplInfoPtrArray infoArray; REComSession::ListImplementationsL(KSIPRequestHandlerIFUid, infoArray); CleanupResetAndDestroyPushL(infoArray); if (infoArray.Count() > 0 && infoArray[ 0 ]) { CImplementationInformation& info = *(infoArray[ 0 ]); TSIPRequestHandlerInitParams initParams(KServerUid3, iRoutingRequestStore); TEComResolverParams resolverParams; resolverParams.SetDataType(info.DataType()); iRequestHandler = reinterpret_cast< CSIPRequestHandlerBase* >( REComSession::CreateImplementationL( KSIPRequestHandlerIFUid, _FOFF(CSIPRequestHandlerBase,iInstanceKey), &initParams, resolverParams)); } else { User::Leave(KErrNotFound); } CleanupStack::PopAndDestroy(1); // infoArray }
// ----------------------------------------------------------------------------- // ----------------------------------------------------------------------------- // EXPORT_C CPosLandmarkDatabase* CPosLandmarkDatabase::OpenL() { TUid implementationUid; implementationUid.iUid = KPosLmLocalDatabaseImplUid; // Check if any implementation supports this protocol TUid interfaceUid; interfaceUid.iUid = KPosLmDatabaseIfUid; RImplInfoPtrArray implInfoArray; REComSession::ListImplementationsL(interfaceUid, implInfoArray); if (implInfoArray.Count() == 0) { User::Leave(KErrNotSupported); } else { implInfoArray.ResetAndDestroy(); } TAny* ptr = REComSession::CreateImplementationL( implementationUid, _FOFF(CPosLandmarkDatabase, iDtorIdKey), NULL); return reinterpret_cast<CPosLandmarkDatabase*>(ptr); }
// --------------------------------------------------------------------------- // CASpaPluginManager::LoadPluginsL // Load plugins implementations // --------------------------------------------------------------------------- // void CCaSrvManager::LoadPluginsL() { // Read info about all implementations into infoArray RImplInfoPtrArray infoArray; // Note that a special cleanup function is required to reset and destroy // all items in the array, and then close it. CleanupResetAndDestroyPushL( infoArray ); CCaSrvPlugin::ListAllImplementationsL( infoArray ); // Loop through each info for each implementation // and create and use each in turn CCaSrvPlugin* plug; for( TInt i = 0; i < infoArray.Count(); i++ ) { // Slice off first sub-section in the data section TUid current_plugin = infoArray[i]->ImplementationUid(); TRAPD(err, plug = CCaSrvPlugin::NewL( current_plugin, iPluginParams )); if( KErrNone==iErrorCode ) { // remember error code only if it wasn't set yet iErrorCode = err; } CleanupStack::PushL( plug ); TInt32 key = current_plugin.iUid; iPluginMap.InsertL( key, plug ); CleanupStack::Pop( plug ); plug = NULL; } CleanupStack::PopAndDestroy( &infoArray ); }
// ---------------------------------------------------------------------------- // CSIPClientResolver::ListImplementationsL // ---------------------------------------------------------------------------- // void CSIPClientResolver::ListImplementationsL() { // Create a temporary array to avoid destroying // an existing registry if we run out of memory RPointerArray< CSIPClientData >* tmpRegistry = new( ELeave ) RPointerArray< CSIPClientData >; CleanupStack::PushL( TCleanupItem( ResetAndDestroy, tmpRegistry ) ); // ROM clients TEComResolverParams romResolverParams; RImplInfoPtrArray romClients; REComSession::ListImplementationsL( KSIPResolvedClientIFUid, romResolverParams, KRomOnlyResolverUid, romClients ); CleanupResetAndDestroyPushL( romClients ); ConvertClientDataL( romClients, *tmpRegistry, ETrue ); SIP_CR_INT_LOG("ROM-based plug-ins count", romClients.Count()) // RAM clients RImplInfoPtrArray allClients; REComSession::ListImplementationsL( KSIPResolvedClientIFUid, allClients ); CleanupResetAndDestroyPushL( allClients ); SIP_CR_INT_LOG("All plug-ins count", allClients.Count()) RemoveDuplicates( romClients, allClients ); ConvertClientDataL( allClients, *tmpRegistry, EFalse ); CleanupStack::PopAndDestroy( 1 ); // allClients CleanupStack::PopAndDestroy( 1 ); // romClients RemoveRegistry(); delete iRegistry; iRegistry = tmpRegistry; CleanupStack::Pop( 1 ); // tmpRegistry }
void REComLanguagePluginTest::DoCheckL(TInt testDataId, TUid &aInterfaceId, TDriveUnit aDriveUnit) { RImplInfoPtrArray implArray; REComSession::ListImplementationsL(aInterfaceId, implArray); // Verify results TBuf<100> buf; RDebug::Print(_L("\tArray Count = %d\n"), implArray.Count()); buf.Copy(implArray[0]->OpaqueData()); RDebug::Print(_L("\tOpaque Data = %S\n"), &buf); TInt drive = implArray[0]->Drive(); RDebug::Print(_L("\tDrive = %d\n"), drive); TEST(implArray.Count() == 1); if(aDriveUnit == EDriveZ) { TEST(implArray[0]->OpaqueData() == *(LangTestData2[testDataId].result)); } else { TEST(implArray[0]->OpaqueData() == *(LangTestData[testDataId].result)); } TEST(implArray[0]->Drive() == aDriveUnit); // Post test clean up REComSession::FinalClose(); implArray.ResetAndDestroy(); }
// --------------------------------------------------------------------------- // CLbtStratergyContainer::LoadStratergyL // --------------------------------------------------------------------------- // void CLbtStratergyContainer::LoadStratergyL(MLbtTriggeringSupervisionObserver* aPtr) { FUNC_ENTER("CLbtStratergyContainer::LoadStratergyL"); RImplInfoPtrArray implArray; REComSession::ListImplementationsL(KLocAcquisitionStrategyInterfaceUid, implArray); if(implArray.Count() != 1) { implArray.ResetAndDestroy(); // Leave if there are more than one or no // implementation of stratergy User::Leave(KErrNotFound); } TCleanupItem arrayCleanup( RImpleInfoPtrArrayCleanup, &implArray ); CleanupStack::PushL(arrayCleanup); CImplementationInformation* info = implArray[0]; iStratergy = CLbtStrategyBase::NewL(aPtr); iVersion = info->Version(); CleanupStack::PopAndDestroy(); // implArray iProperty.Set(KPSUidLbtStatusInformation, KLbtLocationTriggeringSupervisionStatus, ELbtLocationTriggeringSupervisionSuccessful); // request ecom framework for ecom change notification iEComSession->NotifyOnChange(iStatus); SetActive(); }
/** Constructs a CObexTransportControllerBase PlugIn object. @internalTechnology @return A new CObexTransportControllerBase PlugIn object @panic TransCTBase EInvalidNumberOfTransportImplementations if there is more than one implementation for a given interface uid and transport name (equal to the default data in the plugin resource file */ EXPORT_C CObexTransportControllerBase* CObexTransportControllerBase::NewL(TObexTransportInfo& aTransportInfo) { LOG_LINE LOG_STATIC_FUNC_ENTRY //Making a copy as Collapse modifies the original iTransportName TBuf<60> transportName = aTransportInfo.iTransportName; TPtrC8 params = transportName.Collapse(); TEComResolverParams resolverParams; resolverParams.SetDataType(*reinterpret_cast<TDesC8*>(¶ms)); RImplInfoPtrArray implInfoArray; REComSession::ListImplementationsL(TUid::Uid(KObexTransportControllerInterfaceUid), resolverParams, KRomOnlyResolverUid, implInfoArray); CleanupResetAndDestroyPushL(implInfoArray); __ASSERT_DEBUG(implInfoArray.Count() <= KMinimumNumImplementations, PANIC(KObexTransportPanicCat, EInvalidNumberOfTransportImplementations) ); if (implInfoArray.Count() < KMinimumNumImplementations) { User::Leave(KErrNotFound); } const TUid uid = implInfoArray[KMinimumNumImplementations - 1]->ImplementationUid(); CleanupStack::PopAndDestroy(&implInfoArray); CObexTransportControllerBase* ptr = reinterpret_cast<CObexTransportControllerBase*> (REComSession::CreateImplementationL(uid, _FOFF(CObexTransportControllerBase, iPrivateEComUID), reinterpret_cast<TAny*>(&aTransportInfo))); CleanupStack::PushL(ptr); // Do any base construction here. This may in future include allocation of // iFuture1. ptr->BaseConstructL(); CleanupStack::Pop(ptr); return ptr; }
void CRecordVideoFile::LoadCodecL() { // Need new version of this to load from a PU based uid RImplInfoPtrArray array; REComSession::ListImplementationsL(TUid::Uid(KUidMdfProcessingUnit), array); TBool found = EFalse; CImplementationInformation* info = NULL; for (TInt i=0;i<array.Count() && !found;i++) { info = array[i]; if (info->ImplementationUid() == TUid::Uid(KUidVideoTestEncoderPu)) { found = ETrue; } } TInt err = KErrNotFound; if (found) { TRAP(err, iVideoHwDevice = CMMFVideoEncodeHwDevice::NewPuAdapterL(*info,*this)); } else { err = KErrNotFound; } array.ResetAndDestroy(); User::LeaveIfError(err); }
// ----------------------------------------------------------------------------- // CUpnpSecurityManager::NewL // Two-phased constructor. // // Create plugin using for identification field default_data in resource file // ----------------------------------------------------------------------------- // EXPORT_C CUpnpSecurityManager* CUpnpSecurityManager::NewL(const TDesC8& aType) { TEComResolverParams resolverParams; resolverParams.SetDataType(aType); // Disable wildcard matching resolverParams.SetWildcardMatch(EFalse); const TUid interfaceuidRemote = {0x2001137B}; RImplInfoPtrArray implArray; // check if remote access branch security plugin is found REComSession::ListImplementationsL(interfaceuidRemote, implArray); if (implArray.Count() > 0) return REINTERPRET_CAST(CUpnpSecurityManager*, REComSession::CreateImplementationL( KCUpnpSecurityManagerUidRemote, _FOFF(CUpnpSecurityManager, iDtor_ID_Key), resolverParams)); // if not, use the standard security plugin return REINTERPRET_CAST(CUpnpSecurityManager*, REComSession::CreateImplementationL( KCUpnpSecurityManagerUid, _FOFF(CUpnpSecurityManager, iDtor_ID_Key), resolverParams)); }
// -------------------------------------------------------------------------- // void CNSmlSOSHandler::ReadTasksFromDBL( RArray<TInt>& aArray ) // -------------------------------------------------------------------------- // void CNSmlSOSHandler::ReadTasksFromDBL( RArray<TInt>& aArray ) { // Get non-overrided data from settings. CNSmlDSSettings* settings = CNSmlDSSettings::NewLC(); CNSmlDSProfile* prof = settings->ProfileL( iCurrentJob->ProfileId() ); if ( prof ) { CleanupStack::PushL(prof); RImplInfoPtrArray implArray; CleanupStack::PushL(PtrArrCleanupItemRArr( CImplementationInformation, &implArray ) ); TUid ifUid = { KNSmlDSInterfaceUid }; REComSession::ListImplementationsL( ifUid, implArray ); for ( TInt i = 0 ; i < implArray.Count() ; i++ ) { CImplementationInformation* implInfo = implArray[i]; CNSmlDSContentType* ctype = prof->ContentType( implInfo->ImplementationUid().iUid ); if ( ctype ) { aArray.AppendL( ctype->IntValue( EDSAdapterTableId ) ); } } CleanupStack::PopAndDestroy(&implArray); CleanupStack::PopAndDestroy(prof); REComSession::FinalClose(); } CleanupStack::PopAndDestroy(settings); }
// --------------------------------------------------------------------------- // CWmDrmDlaUiNotifierImpl::InitializeL // --------------------------------------------------------------------------- // void CWmDrmDlaUiNotifierImpl::InitializeL( TDesC8& aOpaqueData ) { TInt err( KErrNotFound ); LOGFNR( "CWmDrmDlaUiNotifierImpl::InitializeL", err ); LOGHEX( aOpaqueData.Ptr(), aOpaqueData.Length() ); delete iUiPlugin; iUiPlugin = NULL; RImplInfoPtrArray implArray; CleanupStack::PushL( TCleanupItem( DoResetDestroyAndClose, &implArray ) ); REComSession::ListImplementationsL( KWmDrmDlaUiPluginIfUid, implArray ); for ( TInt i( 0 ); i < implArray.Count() && err == KErrNotFound; ++i ) { if ( aOpaqueData.CompareF( implArray[i]->OpaqueData() ) == 0 && implArray[i]->VendorId() == VID_DEFAULT ) { err = KErrNone; iUiPlugin = CWmDrmDlaUiPluginIf::NewL( implArray[i]->ImplementationUid() ); } } if ( err == KErrNotFound ) { err = KErrNone; iUiPlugin = CWmDrmDlaUiPluginIf::NewL( KWmDrmDlaDefaultUiPluginUid ); } CleanupStack::PopAndDestroy( &implArray ); }
/* * Second phase constructor. */ void CMMFDevSound::CBody::ConstructL() { // all these data properties should be NULL, but add ASSERTs to verify. ASSERT(!iDevSoundProxy); iDevSoundProxy = new (ELeave) RMMFDevSoundProxy(); TInt err = iDevSoundProxy->Open(); User::LeaveIfError(err); User::LeaveIfError(iDevSoundProxy->PostOpen()); // create Custom Interface MUX utility iMuxUtility = CMMFDevSoundCIMuxUtility::NewL(this); // Create Custom Interface extension RImplInfoPtrArray pluginArray; CleanupResetAndDestroyPushL(pluginArray); TUid interfaceUid = {KUidDevSoundCIClientExtension}; REComSession::ListImplementationsL(interfaceUid, pluginArray); TUid destructorKey; if (pluginArray.Count() > 0) { // One or more exists - use the 1st one found iCIExtension = static_cast<MDevSoundCIClientExtension*> (REComSession::CreateImplementationL(pluginArray[0]->ImplementationUid(), destructorKey)); } CleanupStack::PopAndDestroy(&pluginArray); if (iCIExtension) { // Extension exists. Complete the setup iCIExtension->PassDestructorKey(destructorKey); User::LeaveIfError(iCIExtension->Setup(*iDevSoundProxy)); } }
// --------------------------------------------------------------------------- // // --------------------------------------------------------------------------- // EXPORT_C CHWRMHapticsEffectDataGetter* CHWRMHapticsEffectDataGetter::NewL() { RImplInfoPtrArray implInfoArray; CleanupClosePushL( implInfoArray ); // list implementations REComSession::ListImplementationsL( KHapticsEffectDataGetterIFUid, implInfoArray ); COMPONENT_TRACE( ( _L( "CHWRMHapticsEffectDataGetter::NewL() - Found %d plugins" ), implInfoArray.Count() ) ); // create plugin, if found CHWRMHapticsEffectDataGetter* effectDataGetter = NULL; if ( implInfoArray.Count() == KHapticsAllowedAmountOfPlugins ) { TUid pluginUid = implInfoArray[0]->ImplementationUid(); // delete implementation info list contents implInfoArray.ResetAndDestroy(); effectDataGetter = static_cast<CHWRMHapticsEffectDataGetter*>( REComSession::CreateImplementationL( pluginUid, _FOFF( CHWRMHapticsEffectDataGetter, iDtor_ID_Key ) ) ); } else { // there are none or unsupported amount of plugins found User::Leave( KErrNotSupported ); } CleanupStack::PopAndDestroy( &implInfoArray ); return effectDataGetter; }
// --------------------------------------------------------- // Factory method to create the instance of CLbtStrategyBase // // (other items were commented in a header). // --------------------------------------------------------- // EXPORT_C CLbtStrategyBase* CLbtStrategyBase::NewL( TAny* aConstructionParameters ) { // Determine list of implementations and load the first available TUid implementationUID; RImplInfoPtrArray implInfoArray; CleanupStack::PushL( TCleanupItem( *ResetAndDestroy, &implInfoArray ) ); REComSession::ListImplementationsL( KLocAcquisitionStrategyInterfaceUid, implInfoArray ); if( implInfoArray.Count() == 0 ) { User::Leave( KErrNotFound ); } const CImplementationInformation* pluginInformation = implInfoArray[0]; implementationUID = pluginInformation->ImplementationUid(); TAny* ptr = REComSession::CreateImplementationL( implementationUID, _FOFF( CLbtStrategyBase, iDtorIdKey ), aConstructionParameters ); CleanupStack::PopAndDestroy( &implInfoArray ); return ( REINTERPRET_CAST( CLbtStrategyBase*, ptr ) ); }
OMX_ERRORTYPE CSymbianOmxComponentLoader::ComponentNameEnum( OMX_STRING aComponentName, OMX_U32 aNameLength, OMX_U32 aIndex) { ASSERT(aComponentName); const TInt KIndexForPopulateList = 0; if ( aIndex == KIndexForPopulateList ) { RImplInfoPtrArray ecomArray; TRAPD(error, REComSession::ListImplementationsL(TUid::Uid(KUidOmxILSymbianComponentIf), ecomArray)); if (error != KErrNone) { return OMX_ErrorUndefined; } TInt index; iComponentNameList.Reset(); const TInt KEcomArrayCount = ecomArray.Count(); // Create Controller Implementation Information for each entry for (index=0; index<KEcomArrayCount; ++index) { CImplementationInformation& info = *(ecomArray[index]); TOmxComponentInfo component; component.iUid = info.ImplementationUid(); if( info.DisplayName().Length() >= OMX_MAX_STRINGNAME_SIZE || info.DataType().Length() >= OMX_MAX_ROLESBUFFER_SIZE ) { error = KErrBadName; break; } component.iComponentName.Copy(info.DisplayName()); component.iRoles.Copy(info.DataType()); error = iComponentNameList.Append(component); if( error != KErrNone ) { break; } } ecomArray.ResetAndDestroy(); if( error != KErrNone ) { return OMX_ErrorUndefined; } } if (aIndex<iComponentNameList.Count()) { TOmxComponentInfo& comp = iComponentNameList[aIndex]; TPtr8 ptr((TUint8*)aComponentName, 0, aNameLength); ptr.Copy(comp.iComponentName); ptr.PtrZ(); } else { return OMX_ErrorNoMore; } return OMX_ErrorNone; }
// ----------------------------------------------------------------------------- // ----------------------------------------------------------------------------- // EXPORT_C CPosLandmarkDatabase* CPosLandmarkDatabase::OpenL( const TDesC& aDatabaseUri) { // Determine which implementation id to use by checking the protocol of // the URI (e.g. http). If no protocol is specified "file" is used. _LIT8(KDefaultProtocol, "file"); _LIT(KProtocolDelimiter, "://"); TInt position = aDatabaseUri.Find(KProtocolDelimiter); TEComResolverParams params; HBufC8* protocol8 = NULL; if (position != KErrNotFound && position != 0) { protocol8 = HBufC8::NewLC(position + 1); protocol8->Des().FillZ(); protocol8->Des().Copy(aDatabaseUri.Left(position)); params.SetDataType(*protocol8); } else { params.SetDataType(KDefaultProtocol); } // Check if any implementation supports this protocol TUid interfaceUid; interfaceUid.iUid = KPosLmDatabaseIfUid; RImplInfoPtrArray implInfoArray; REComSession::ListImplementationsL(interfaceUid, params, implInfoArray); if (implInfoArray.Count() == 0) { User::Leave(KErrNotSupported); } else { implInfoArray.ResetAndDestroy(); } // Send the protocol name to the Ecom server // which determines the implementation. HBufC* strPtr = aDatabaseUri.AllocLC(); TAny* ptr = REComSession::CreateImplementationL( interfaceUid, _FOFF(CPosLandmarkDatabase, iDtorIdKey), strPtr, params); CleanupStack::PopAndDestroy(strPtr); if (protocol8) { CleanupStack::PopAndDestroy(protocol8); } return reinterpret_cast<CPosLandmarkDatabase*>(ptr); }
CMdfProcessingUnit* CPuLoader::LoadProcessingUnitL( const MMdfProcessingUnitObserver& aProcessingUnitObserver, const TDesC8& aSrcDataType, const TDesC8& aDestDataType, const TUid& aImplementationType) { CCodecApiResolverData* customMatchData = CCodecApiResolverData::NewLC(); customMatchData->SetMatchType(EMatchInputAndOutputDataFormat); customMatchData->SetImplementationType(aImplementationType); // string value of the input source data customMatchData->SetInputDataL(aSrcDataType); customMatchData->SetOutputDataL(aDestDataType); HBufC8* package = customMatchData->NewPackLC(); TEComResolverParams resolverParams; // Parameters on which to match resolverParams.SetDataType(package->Des()); RImplInfoPtrArray ecomArray; CleanupResetAndDestroyPushL(ecomArray); REComSession::ListImplementationsL(TUid::Uid(KUidMdfProcessingUnit), resolverParams, TUid::Uid(KUidCodecApiResolverImplementation), ecomArray); // check if there are any TInt noOfProcessingUnits = ecomArray.Count(); if(noOfProcessingUnits == 0) { User::Leave(KErrNotFound); } CMdfProcessingUnit *processingUnit = NULL; TInt index = 0; TInt error = KErrNone; do { // Iterate through the array until a plugin can be created without errors const CImplementationInformation& puInfo = *(ecomArray[index++]); TRAP(error, processingUnit = CMdfProcessingUnit::NewL(puInfo.ImplementationUid())); } while(index < noOfProcessingUnits && error != KErrNone); if(error) { ASSERT(!processingUnit && index <= noOfProcessingUnits); User::Leave(error); } CleanupStack::PopAndDestroy(3, customMatchData); // customMatchData, package, ecomArray TInt err = processingUnit->Create(aProcessingUnitObserver); if (err != KErrNone) { // delete processing unit before leaving delete processingUnit; User::Leave(err); } return processingUnit; }
// --------------------------------------------------------------------------- // Initializes factory plugins list. // --------------------------------------------------------------------------- // void CCIExtnClientPlugin::InitializeFactoryPluginsL() { // 1. Query the implementation ids of plugins implementing // KUidCIFactoryIntfcInterface // 2. Instantiate it and add it to the list of factories DEB_TRACE0(_L("*CI* CCIExtnClientPlugin::InitializeFactoryPluginsL")); iMCIFactoryIntfcList.Reset(); RImplInfoPtrArray factoryEComUids; CleanupResetAndDestroyPushL(factoryEComUids); // List all the factory plugins TUid factoryPluginInterfaceUid = {KUidCIFactoryIntfcInterface}; TEComResolverParams resParams; REComSession::ListImplementationsL( factoryPluginInterfaceUid, resParams, KRomOnlyResolverUid, factoryEComUids ); // Instantiate and add it to the list of factories TUid destructorKey; MCIFactoryIntfc* factoryPlugin(NULL); TInt status(KErrNone); for ( TInt index = 0; index < factoryEComUids.Count(); index++) { //<415-4087> TN: created with ImplementationUid - KRomOnlyResolverUid not used TRAP( status , factoryPlugin = static_cast<MCIFactoryIntfc*> (REComSession::CreateImplementationL( factoryEComUids[index]->ImplementationUid(), destructorKey ) ) ); // If there was problem instantiating factory plugin, continue trying // next one. if ( status != KErrNone) { DEB_TRACE1(_L("*CI* CCIExtnClientPlugin::InitializeFactoryPluginsL create failed status=%d"), status); continue; } // Initialize the factory plugin if ( factoryPlugin->Initialize( *iMCustomCommand, destructorKey ) == KErrNone ) { status = iMCIFactoryIntfcList.Append(factoryPlugin); if ( status != KErrNone ) {// There was problem adding plugin to list, there was a system // wide error. Stop trying and return error code. factoryPlugin->Close(); User::Leave( status ); } } else {// There was problem initializing the factory plugin instance, close // it and continue instantiating the rest factoryPlugin->Close(); } } CleanupStack::PopAndDestroy(&factoryEComUids); }
/** Creates a CMMFCodec object with match parameter in addition to the source and destination fourCC codes (for instance a manufacturer's name). Will attempt match without extra match string if no match. Will Leave if no match on 4CC codes (KErrNotFound). Used where there may be multiple codecs that perform the same conversion to ensure the controller uses the codec specified by aPreferredSupplier. @param aSrcDataType The source data type. @param aDstDataType The destination data type. @param aPreferredSupplier Additional resolution criteria when searching for plug in codec. If this is provided, the list of matching plugins will be further searched for the latest version of a plugin supplied by supplier named. Note that the display name field is parsed for a match. @return An instantiated CMMFCodec derived obeject from an ECOM plugin DLL. */ EXPORT_C CMMFCodec* CMMFCodec::NewL(const TFourCC& aSrcDataType, const TFourCC& aDstDataType, const TDesC& aPreferredSupplier) { // Create a match string using the two FourCC codes. TBufC8<9> fourCCString( KEmptyFourCCString ) ; TPtr8 fourCCPtr = fourCCString.Des() ; TPtr8 fourCCPtr1( &fourCCPtr[0], 4 ) ; TPtr8 fourCCPtr2( &fourCCPtr[5], 4 ) ; aSrcDataType.FourCC( &fourCCPtr1 ) ; aDstDataType.FourCC( &fourCCPtr2 ) ; // Do a list implementations here. RImplInfoPtrArray plugInArray; // Array to return matching decoders in CleanupResetAndDestroyPushL(plugInArray); MmPluginUtils::FindImplementationsL(KUidMmfPluginInterfaceCodec, plugInArray, fourCCPtr); if (plugInArray.Count() == 0) { User::Leave(KErrNotSupported); } TUid chosenUid = {0}; if ( plugInArray.Count() == 1 ) { chosenUid = plugInArray[0]->ImplementationUid() ; } else { // Use the preferred supplier to select a codec. SelectByPreference( plugInArray, aPreferredSupplier ) ; for ( TInt ii = 0 ; ii < plugInArray.Count() ; ii++ ) { if ( !(plugInArray[ii]->Disabled()) ) { // we've found our plugin... chosenUid = plugInArray[ii]->ImplementationUid() ; break ; } } } //Instantiate the chosen one CMMFCodec* theChosenOne = REINTERPRET_CAST( CMMFCodec*, REComSession::CreateImplementationL( chosenUid, _FOFF( CMMFCodec, iDtor_ID_Key ) ) ) ; CleanupStack::PopAndDestroy() ; // pluginArray return theChosenOne ; }
TVerdict RTestStepAudioCodecFindIncorrectInterfaceUid::DoTestStepL() { __UHEAP_MARK; TFourCC aSrcDataType; INFO_PRINTF1(_L("Test attempts to locate the PU with the correct interface UID, but incorrect implementation UID.")); // create the OMX Core CCodecApiResolverData* customMatchData = CCodecApiResolverData::NewLC(); customMatchData->SetMatchType(EMatchInputDataFormat); // Set implementation interface as correct customMatchData->SetImplementationType(TUid::Uid(0x1027379e)); // string value of the input source data HBufC8* packageData = HBufC8::NewLC(KMaxDataTypeLength); TPtr8 sourceData = packageData->Des(); TFourCC srcDataType = KMMFFourCCCodeTestPCM8; srcDataType.FourCC(&sourceData); customMatchData->SetInputDataL(sourceData); TFourCC destDataType = KMMFFourCCCodePCM16; destDataType.FourCC(&sourceData); customMatchData->SetOutputDataL(sourceData); HBufC8* package = customMatchData->NewPackLC(); TPtr8 packageDes = package->Des(); TEComResolverParams resolverParams; // Parameters on which to match resolverParams.SetDataType(packageDes); RImplInfoPtrArray ecomArray; CleanupResetAndDestroyPushL(ecomArray); // Interface Uid is incorrect - from KMmfUidPluginInterfaceDataSource TRAPD(error, REComSession::ListImplementationsL(TUid::Uid(0x101F53AF), resolverParams, TUid::Uid(0x1027379b), ecomArray)); if (error != KErrNone) { CleanupStack::PopAndDestroy(3); // customMatchData, packageData, package return EFail; } // check if there are any TInt noOfProcessingUnits = ecomArray.Count(); CleanupStack::PopAndDestroy(4); // customMatchData, packageData, package, ecomArray REComSession::FinalClose(); __UHEAP_MARKEND; if(noOfProcessingUnits == 0) { // Should be zero, since no implementations return EPass; } return EFail; }
void CheckForPhbkSyncPluginL() { test.Next(_L("Check for PhbkSync test plug-in")); RImplInfoPtrArray implInfoArray; CleanupResetAndDestroyPushL(implInfoArray); REComSession::ListImplementationsL(KUidEcomCntPhBkSyncInterface, implInfoArray); //Find implementations of KUidEcomCntPhBkSyncInterface TInt availCount = implInfoArray.Count(); TInt count; for(count = 0; count < availCount; count++) { const TUid firstImplementationFound = implInfoArray[count]->ImplementationUid(); CImplementationInformation *info = implInfoArray[count]; test.Printf(_L("\n")); test.Printf(_L("PhbkSync plugin #%i, Implementation UID 0x%08X version %i\n"), count + 1, info->ImplementationUid(), info->Version()); test.Printf(_L("Plugin name = \"%S\"\n"), &(info->DisplayName())); } // is telephony's plug-in in the list? for(count = 0; count < availCount; count++) { const TUid firstImplementationFound = implInfoArray[count]->ImplementationUid(); CImplementationInformation *info = implInfoArray[count]; if(info->DisplayName() == KTestPluginName) { test.Printf(_L("\n")); test.Printf(_L("This test has now loaded the test plugin")); test.Printf(_L("\n")); availCount = 1; break; } if(info->DisplayName() == KPluginName) { test.Printf(_L("\n")); test.Printf(_L("This test only works with Contacts the test plugin and not the original phonebooksync plugin.")); test.Printf(_L("Depending on the build to removed the plugin in different ways:")); test.Printf(_L("hardware - delete the line \"ECOM_PLUGIN(phbksyncplugin.dll,1020428c.rsc)\" from phbksync.iby")); test.Printf(_L("winscw - delete phbksyncplugin.dll from %epocroot%/epoc32/release/winscw/udeb or similarly named directory")); test.Printf(_L("\n")); test(0); // stop break; } } // only continue test if there is exactly one plug-in present test(availCount == 1); CleanupStack::PopAndDestroy(&implInfoArray); }
/** The following plugin will be used for test and copied to the C drive. Interface UID DLL UID Imp. UID Version DllFile RSCFile ------------------------------------------------------------------------------------------------------------------------------------------ 0x102797A1 0x102797A0 0x102797A2 1 C:\\sys\\bin\\DefectPlugin.dll C:\\resource\\plugins\\DefectPlugin.RSC **/ LOCAL_C void ValidateRegistryAgainstDllL() { test.Next(_L(" @SYMTestCaseID:SYSLIB-ECOM-CT-1490 ")); __UHEAP_MARK; // before strating the test, kill the EcomServer which is probably running from // the previous tests. KillEComServerL(); // copy the plugin to C drive. CopyPlugin(); TUid interfaceUid= {0x102797A1}; RImplInfoPtrArray implArray; // normal discovery, ECom should discover the plugin REComSession::ListImplementationsL(interfaceUid, implArray); test(implArray.Count()==1); //Check that the implementation uid returned matched the specs above TUid implUid = implArray[0]->ImplementationUid(); TInt version = implArray[0]->Version(); TInt drive = implArray[0]->Drive(); // imp. uid test(implUid.iUid == 0x102797A2); // version test(version == 1); // C drive test(drive == EDriveC); // ECom Server is running. // delete the plugin DLL file not the RSC file, ECom rediscovery is NOT triggered. TRAPD(err, EComTestUtils::FileManDeleteFileL(KEComPluginDLLOnC)); test(err==KErrNone); // copy a RSC file to C:\resource\plugin\ to cause a ECom rediscovery. TRAP(err, EComTestUtils::FileManCopyFileL(KEComInvalidRscOnZ, KEComInvalidRscOnC)); test(err==KErrNone); // Give ECOM a chance to do the rediscovery. // Otherwise ListImplementationsL could fail. User::After(KOneSecond * 3); REComSession::ListImplementationsL(interfaceUid, implArray); // Since the DLL file is deleted, the corresponding DLL should be deleted // from the ECom registry. test(implArray.Count()==0); //clean up implArray.ResetAndDestroy(); REComSession::FinalClose(); KillEComServerL(); __UHEAP_MARKEND; }
// ----------------------------------------------------------------------------- // COMASUPLProtocolManager::LoadOMASUPLPluginsL // // ----------------------------------------------------------------------------- // void COMASUPLProtocolManager::LoadOMASUPLPluginsL() { iTrace->Trace(_L("COMASUPLProtocolManager::LoadOMASUPLPlugins"), KTraceFileName, __LINE__); const TUid KOMASUPLProtocolInterfaceUid = {0x102073CB}; const TUid KOMASuplProtocolImplementationUid1 = {0x2002678D}; const TUid KOMASuplProtocolImplementationUid2 = {0x2002678E}; RImplInfoPtrArray pluginArray; REComSession& EComServerSession = REComSession::OpenL(); CleanupStack::PushL(TCleanupItem(*ResetAndDestroy, &pluginArray)); REComSession::ListImplementationsL(KOMASUPLProtocolInterfaceUid, pluginArray); if(pluginArray.Count() > 0) { TRAPD(err1,iOMASuplProtocolHandler1 = CSUPLProtocolManagerBase::NewL(KOMASuplProtocolImplementationUid1)); TBuf<64> buf(_L("OMA SUPL 1.0 Plugin loaded with error : ")); buf.AppendNum(err1); iTrace->Trace(buf,KTraceFileName, __LINE__); TRAPD(err2,iOMASuplProtocolHandler2 = CSUPLProtocolManagerBase::NewL(KOMASuplProtocolImplementationUid2)); buf.Copy(_L("OMA SUPL 2.0 Plugin loaded with error : ")); buf.AppendNum(err2); iTrace->Trace(buf,KTraceFileName, __LINE__); // if PH1 is not available but PH2 is,then use PH2 whenever there is reference to PH1. if( KErrNone != err1 && KErrNone == err2 ) { isPH2Shared = ETrue; iOMASuplProtocolHandler1 = iOMASuplProtocolHandler2; } } else { iTrace->Trace(_L("No Plugins Found for OMA Implementation..."), KTraceFileName, __LINE__); User::LeaveIfError(KErrArgument); } CleanupStack::PopAndDestroy(1); EComServerSession.Close(); }
OMX_ERRORTYPE CSymbianOmxComponentLoader::InitializeComponentLoader() { RImplInfoPtrArray ecomArray; TRAPD(error,REComSession::ListImplementationsL(TUid::Uid(KUidOmxILSymbianComponentIf),ecomArray)); if( error != KErrNone ) { ecomArray.ResetAndDestroy(); return OMX_ErrorInsufficientResources; } TInt index; CImplementationInformation* info; TOmxComponentInfo component; iComponentNameList.Reset(); const TInt KEcomArrayCount = ecomArray.Count(); for( index=0; index<KEcomArrayCount && error == KErrNone; ++index ) { info = ecomArray[index]; component.iUid = info->ImplementationUid(); if( info->DisplayName().Length() >= OMX_MAX_STRINGNAME_SIZE || info->DataType().Length() >= OMX_MAX_ROLESBUFFER_SIZE ) { error = KErrBadName; break; } component.iComponentName.Copy(info->DisplayName()); component.iRoles.Copy(info->DataType()); error = iComponentNameList.Append(component); if(error) { break; } } ecomArray.ResetAndDestroy(); if( error != KErrNone ) { if( error == KErrNoMemory ) { return OMX_ErrorInsufficientResources; } return OMX_ErrorUndefined; } return OMX_ErrorNone; }
TVerdict RTestStepAudioCodecFindIncorrectInputFourCC::DoTestStepL() { __UHEAP_MARK; TFourCC aSrcDataType; INFO_PRINTF1(_L("Test attempts to locate the PU using the correct version, but incorrect source data type")); // create the OMX Core CCodecApiResolverData* customMatchData = CCodecApiResolverData::NewLC(); customMatchData->SetMatchType(EMatchInputDataFormat); customMatchData->SetImplementationType(TUid::Uid(0x1027379e)); // string value of the input source data HBufC8* packageData = HBufC8::NewLC(KMaxDataTypeLength); TPtr8 sourceData = packageData->Des(); TFourCC srcDataType = KMMFFourCCCodeNULL; srcDataType.FourCC(&sourceData); customMatchData->SetInputDataL(sourceData); // Not setting destination type HBufC8* package = customMatchData->NewPackLC(); TPtr8 packageDes = package->Des(); TEComResolverParams resolverParams; // Parameters on which to match resolverParams.SetDataType(packageDes); RImplInfoPtrArray ecomArray; CleanupResetAndDestroyPushL(ecomArray); TRAPD(error, REComSession::ListImplementationsL(TUid::Uid(KUidMdfProcessingUnit), resolverParams, TUid::Uid(0x1027379b), ecomArray)); if (error != KErrNone) { CleanupStack::PopAndDestroy(3); // customMatchData, packageData, package return EFail; } // check if there are any TInt noOfProcessingUnits = ecomArray.Count(); CleanupStack::PopAndDestroy(4); // customMatchData, packageData, package, ecomArray REComSession::FinalClose(); __UHEAP_MARK; if(noOfProcessingUnits == 0) { // Should be zero, since no implementations of type KCMdfProcessingUnit can deal with KMMFFourCCCodeNULL return EPass; } return EFail; }
/* ------------------------------------------------------------------------------- ------------------------------------------------------------------------------- */ void CEcomHandler::ReFreshHandlersL() { iHandlers.ResetAndDestroy(); RImplInfoPtrArray infoArray; REComSession::ListImplementationsL(KUidYTaskHandUID, infoArray); TFileName CurrName; for ( TInt i = 0; i < infoArray.Count(); i++ ) { CurrName.Zero(); CurrName.Copy(infoArray[i]->DisplayName()); CurrName.TrimAll(); TInt YStart = infoArray[i]->OpaqueData().Find(KtxStrtYTools); TInt YEnd = infoArray[i]->OpaqueData().Find(KtxEnddYTools); if(YStart != KErrNotFound && YEnd != KErrNotFound) { YStart = YStart + KtxStrtYTools().Length(); YEnd = (YEnd - YStart); if(YEnd > 0 ) { if(CurrName.Length() && CheckVersionL(infoArray[i]->OpaqueData().Mid(YStart,YEnd))) { CHandlerItem* newItem = new(ELeave)CHandlerItem(); CleanupStack::PushL(newItem); newItem->iUid = infoArray[i]->ImplementationUid(); newItem->iName = CurrName.AllocL(); newItem->iServerName = ParseInfoL(infoArray[i]->OpaqueData().Mid(YStart,YEnd),KtxStrtSERVER,KtxEnddSERVER); newItem->iIconfile = ParseInfoL(infoArray[i]->OpaqueData().Mid(YStart,YEnd),KtxStrtICONFILE,KtxEnddICONFILE); CleanupStack::Pop(newItem); iHandlers.Append(newItem); } } } } infoArray.ResetAndDestroy(); }
EXPORT_C void CMMFFormatPluginSelectionParameters::ListImplementationsL(RMMFFormatImplInfoArray& aImplementations) const { aImplementations.ResetAndDestroy(); RImplInfoPtrArray ecomArray; CleanupResetAndDestroyPushL(ecomArray); MmPluginUtils::FindImplementationsL(InterfaceUid(), ecomArray); TInt index; // Create Format Implementation Information for each entry for (index=0; index<ecomArray.Count(); index++) { CMMFFormatImplementationInformation* c = NULL; TRAPD(error, c = CMMFFormatImplementationInformation::NewL(*(ecomArray[index]))); if (error == KErrNone) { CleanupStack::PushL(c); // Find out whether this format matches the client's requirements... TInt arrayPos; MatchImplementationToSelectParamsL(aImplementations, *c, arrayPos); if (arrayPos >=0) { // This plugin is suitable - insert it into the array at the suggested position User::LeaveIfError(aImplementations.Insert(c, arrayPos)); CleanupStack::Pop(c); } else { // This plugin isn't suitable so just destroy it CleanupStack::PopAndDestroy(c); } } else if (error != KErrCorrupt) { // Ignore the plugin if it is corrupt. Otherwise, leave. // if error !=KErrNone, c hasn't been constructed so it is safe to leave User::Leave(error); } } CleanupStack::PopAndDestroy();//ecomArray }
/** Selects a codec according to the specified preference. @param aPlugInArray On return, array of plugins. @param aPreferredSupplier Search criteria, a supplier's name for example. */ void CMMFCodec::SelectByPreference( RImplInfoPtrArray& aPlugInArray, const TDesC& aPreferredSupplier ) { // Use the Disabled flag to eliminated all currently enabled matches that // do not match the preferred supplier. TInt firstEnabled = -1 ; // to ensure that we return something valid TInt matchCount = 0 ; for ( TInt ii = 0 ; ii < aPlugInArray.Count() ; ii++ ) { if ( !( aPlugInArray[ii]->Disabled() ) ) { if ( firstEnabled == -1 ) firstEnabled = ii ; if ( aPlugInArray[ii]->DisplayName().FindF( aPreferredSupplier ) == KErrNotFound ) aPlugInArray[ii]->SetDisabled( ETrue ) ; else matchCount++ ; } } // If there are no matches then re-enable the first enabled if ( matchCount == 0 ) aPlugInArray[firstEnabled]->SetDisabled( EFalse ) ; else if ( matchCount > 1 ) { // find the latest version from more than one match TInt highestVersionIndex = -1 ; for ( TInt ii = 0 ; ii < aPlugInArray.Count() ; ii++ ) { if ( !( aPlugInArray[ii]->Disabled() ) ) // only interested in enabled elements { if ( highestVersionIndex == -1 ) { // first match. Store this. Keep it enabled highestVersionIndex = ii ; } else if ( aPlugInArray[ii]->Version() > aPlugInArray[highestVersionIndex]->Version() ) { // a new leader. Disable the previous leader. Keep this one. aPlugInArray[highestVersionIndex]->SetDisabled( ETrue ) ; highestVersionIndex = ii ; } else // we already have a higher version. aPlugInArray[ii]->SetDisabled( ETrue ) ; } } } }
// ---------------------------------------------------------------------------- // CSIPClientResolver::RemoveDuplicates // ---------------------------------------------------------------------------- // void CSIPClientResolver::RemoveDuplicates( const RImplInfoPtrArray& aRomInfo, RImplInfoPtrArray& aAllInfo ) { TInt romInfoCount = aRomInfo.Count(); for( TInt i=0; i<romInfoCount; i++ ) { for( TInt j=aAllInfo.Count()-1; j>=0; j-- ) { CImplementationInformation* info = aAllInfo[j]; if( info->ImplementationUid() == aRomInfo[i]->ImplementationUid() ) { aAllInfo.Remove( j ); delete info; } } } }
EXPORT_C COMASuplAsnHandlerBase* COMASuplAsnHandlerBase::NewL(const TInt& aOMASuplVersion) { RImplInfoPtrArray implInfoArray; CleanupStack::PushL(TCleanupItem(*ResetAndDestroy, &implInfoArray)); REComSession::ListImplementationsL(KAsnHandlerInterfaceDefinitionUid, implInfoArray); TInt cnt = implInfoArray.Count(); TUid ImplementationUid; TBuf<32> buffer(_L("V0")); buffer.AppendNum(aOMASuplVersion); TInt suplVersion = KErrNotFound; for (TInt index = 0; index < cnt; index++) { if ((implInfoArray[index]->DisplayName().Compare(buffer)) == 0) { ImplementationUid = implInfoArray[index]->ImplementationUid(); suplVersion = aOMASuplVersion; break; } } CleanupStack::PopAndDestroy(&implInfoArray); if(suplVersion == KErrNotFound) { User::Leave(KErrNotFound); } TAny* ptr = REComSession::CreateImplementationL(ImplementationUid,_FOFF(COMASuplAsnHandlerBase,iDtor_ID_Key)); COMASuplAsnHandlerBase* OMASuplAsnHandler = REINTERPRET_CAST(COMASuplAsnHandlerBase*, ptr); CleanupStack::PushL(OMASuplAsnHandler); OMASuplAsnHandler->ConstructL(ImplementationUid,suplVersion); CleanupStack::Pop(OMASuplAsnHandler); return OMASuplAsnHandler; }