// --------------------------------------------------------------------------
// 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);
    }
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);
	}
// ----------------------------------------------------------------------------
// CSIPClientResolver::AddClientDataL
// ----------------------------------------------------------------------------
//
void CSIPClientResolver::AddClientDataL( 
    RPointerArray< CSIPClientData >& aRegistry,
    CImplementationInformation& aInfo, 
    TBool aRomClient )
    {
	TLex8 lex( aInfo.DataType() );
    TUint32 uidValue( 0 );
    User::LeaveIfError( lex.Val( uidValue, EHex ) );
    TUid clientUid;
    clientUid.iUid = uidValue;     
    const TBool romBased = ( aRomClient && aInfo.RomBased() );
    TPtrC8 xml( aInfo.OpaqueData() );
    const TBool dynamicCaps = ( xml.Length() == 0 );
    
    CSIPClientData* clientData = 
        CSIPClientData::NewLC( aInfo.ImplementationUid(), clientUid,
                               romBased, dynamicCaps );    
    if ( !dynamicCaps )
        {
        // XML specified in resource-file.
        iClientDataParser->ParseL( clientData, xml );
        }
    aRegistry.AppendL( clientData );
    CleanupStack::Pop( clientData );
    }
 TCFActionLoaderInfo( CImplementationInformation& aImplementationInfo,
     CCFActivatorEngineActionPluginManager& aManager ):
     iImplUid( aImplementationInfo.ImplementationUid() ),
     iImplVersion( aImplementationInfo.Version() ),
     iManager( aManager )
     {
     }
void GetResolvedDllInfo_OOMTestL()
	{
	TInt processHandlesS = 0;
	TInt threadHandlesS = 0;
	TInt processHandlesE = 0;
	TInt threadHandlesE = 0;
	RThread().HandleCount(processHandlesS, threadHandlesS);

	CEComServer* ecomServer = CEComServer::NewLC();
	TClientRequest clientReq;
	RArray<TUid> extendedInterfaces;
	CleanupClosePushL(extendedInterfaces);
	RImplInfoArray* implInfoArray = ecomServer->ListImplementationsL(KCExampleInterfaceUid,extendedInterfaces,clientReq);
	CleanupStack::PopAndDestroy(&extendedInterfaces);

	TEST(implInfoArray->Count() > 0);

	for(TInt count=1;;++count)
		{
		// Setting Heap failure for OOM test
		__UHEAP_SETFAIL(RHeap::EDeterministic, count);
		__UHEAP_MARK;

		TEntry dllInfo;
		TUid dtorIdKey;
		TClientRequest clntRq;
		CImplementationInformation* info = (*implInfoArray)[0];
		TRAPD(err, ecomServer->GetResolvedDllInfoL(info->ImplementationUid(),
												   dllInfo, dtorIdKey, clntRq));
		if(err == KErrNoMemory)
			{
			__UHEAP_MARKEND;
			}
		else if(err == KErrNone)
			{
			__UHEAP_MARKEND;
			RDebug::Print(_L("The test succeeded at heap failure rate=%d.\n"), count);
			break;
			}
		else
			{
			__UHEAP_MARKEND;
			TEST2(err, KErrNone);
			}
		__UHEAP_RESET;
		}
	__UHEAP_RESET;
	//implInfoArray should be deleted! The caller takes the ownership.
	if (implInfoArray!=NULL)
		{
		implInfoArray->Close();
		delete implInfoArray;
		}
	CleanupStack::PopAndDestroy(ecomServer);
	RThread().HandleCount(processHandlesE, threadHandlesE);
	TEST(processHandlesS == processHandlesE);
	TEST(threadHandlesS == threadHandlesE);
	}
void CMMFControllerImplementationInformation::ConstructL(const CImplementationInformation& aImplInfo)
	{
	iUriSchemes = new(ELeave) CDesC8ArrayFlat(KDesCArrayGranularity);
	iUid = aImplInfo.ImplementationUid();
	iDisplayName = aImplInfo.DisplayName().AllocL();
	iVersion = aImplInfo.Version();

	// Parse the opaque data...
	TaggedDataParser::ParseTaggedDataL(aImplInfo.OpaqueData(), *this);
	}
//----------------------------------------------------------------------------
// CCFActionPlugInThread::CCFActionPlugInThread
//----------------------------------------------------------------------------
//
CCFActionPlugInThread::CCFActionPlugInThread(
	CCFActivatorEngineActionPluginManager& aActionPluginManager,
	CImplementationInformation& aImplInfo )
	: iPlugInUid( aImplInfo.ImplementationUid() ),
    iImplVersion( aImplInfo.Version() ),
	iActionPluginManager( &aActionPluginManager )
	{
    FUNC_LOG;

	}
// -----------------------------------------------------------------------------
// Get array of know emergency plugins
// -----------------------------------------------------------------------------
//  
RArray<TUid>& CCCEPluginManager::AlternativeEmergencyPlugins()
    {
    CCELOGSTRING("CCCEPluginManager::AlternativeEmergencyPlugins ");
    RImplInfoPtrArray implementations;
    TRAP_IGNORE( CConvergedCallProvider::ListImplementationsL(implementations) );
    iAlternativeEmergencyPlugins.Reset();
        
    for( TInt i=0; i<implementations.Count(); i++ )
        {
        CImplementationInformation *info = implementations[i];
        CCELOGSTRING2("CCCEPluginManager::AlternativeEmergencyPlugins: Found %d ", info->ImplementationUid());
        AddToAlternativeEmergencyArray(info->ImplementationUid());
        }
         
    implementations.ResetAndDestroy();
    implementations.Close();  
 
    return iAlternativeEmergencyPlugins;
    }
void CMMFFormatImplementationInformation::ConstructL(const CImplementationInformation& aImplInfo)
	{
	iUid = aImplInfo.ImplementationUid();
	iDisplayName = aImplInfo.DisplayName().AllocL();

	iBody = CMMFFormatImplementationInformation::CBody::NewL();

	// Extract the rest of the data from the opaque data field of aImplInfo...
	// Parse the opaque data...
	TaggedDataParser::ParseTaggedDataL(aImplInfo.OpaqueData(), *this);
	}
// ---------------------------------------------------------------------------
// Prepares filename from the displayname of the implementation.
// ---------------------------------------------------------------------------
//
void COMASuplPosTesterModuleCfg::PrepareFileName(TFileName& aOutputFileName, 
							const CImplementationInformation& aImplInfo)
	{
	TInt count = 0;
	TInt displayNameLength = aImplInfo.DisplayName().Length();

	for(count = 0; count < displayNameLength 
					&& count < KMaxFileName - 12; count++)
		{
		if(IsValidFileNameChar(aImplInfo.DisplayName().Ptr() + count))
			{
			aOutputFileName.Append(aImplInfo.DisplayName().Ptr() + count, 1);
			}
		}

	aOutputFileName.Append(_L("_"));
	aOutputFileName.Append(aImplInfo.ImplementationUid().Name().Ptr() + 1
					, aImplInfo.ImplementationUid().Name().Length() - 2);
	//Append file extension
	aOutputFileName.Append(_L(".txt"));
	}
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);
	}
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;
	}
// ----------------------------------------------------------------------------
// 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;
                }
            }
        }
    }
// -----------------------------------------------------------------------------
// Load EBootstrapCallProvider marked or enabled plugins
// -----------------------------------------------------------------------------
//
void CCCEPluginManager::LoadBootPluginsL()
    {
    //List implementations
#ifdef _DEBUG
    RImplInfoPtrArray implementations;
    CConvergedCallProvider::ListImplementationsL(implementations);
    CCELOGSTRING2("CCCEPluginManager::GetPluginL: %d Implementation(s) found", 
        implementations.Count() );
        
    for( TInt i=0; i<implementations.Count(); i++ )
        {
        CImplementationInformation *info = implementations[i];
        
        CCELOGSTRING3("CCCEPluginManager::GetPluginL: Uid = %d, Name = %S", 
            info->ImplementationUid().iUid, &info->DisplayName() );
        CCELOGSTRING3("CCCEPluginManager::GetPluginL: ->RomBased = %d, RomOnly = %d", 
            info->RomBased(), info->RomOnly() );
        }
  
    implementations.ResetAndDestroy();
    implementations.Close();
#endif // _DEBUG
    
    RIdArray serviceIDArray;
    CleanupClosePushL( serviceIDArray );
    iSPSettings->GetServicesL( serviceIDArray );
    const TInt serviceCount = serviceIDArray.Count();
    iPrimaryEmergencyCallPlugin = NULL;
    TInt err = KErrNone;
    
    CCELOGSTRING2("CCCEPluginManager::LoadBootPluginsL: Service count: %d", serviceCount );
    for( TInt service = 0; service < serviceCount; service++ )
        {
        CCELOGSTRING2("CCCEPluginManager::LoadBootPluginsL: Processing service: %d", service );
        CCELOGSTRING2("CCCEPluginManager::LoadBootPluginsL: ServiceID: %d", serviceIDArray[service] );
        
        TRAP( err, LoadBootPluginL( serviceIDArray[service] ) )
        
        CCELOGSTRING2("CCCEPluginManager::LoadBootPluginsL: Result %i", err );
        }

    CleanupStack::PopAndDestroy();
    }
// ---------------------------------------------------------------------------
// Load ECom plug-ins
// ---------------------------------------------------------------------------
//
void CBTUIPluginMan::LoadPluginsL()
	{
	TRACE_FUNC_ENTRY
	
	REComSession::ListImplementationsL( KCBtuiPluginInterfaceUid, iPluginInfoArray );
	TInt count = iPluginInfoArray.Count();
	TRACE_INFO( ( _L( "[BTUI]\t CBTUIPluginMan::LoadSettingPluginL() PluginArray count=%d" ), count) )

    iPluginArray.Reset();
	for ( TUint ii = 0 ; ii < count; ++ii )
		{
		CImplementationInformation* impl = iPluginInfoArray[ii];
		//Only append the plugins which datatype() is for HID devices. 
	    if(impl->DataType().Length())
	    	{
	    	TLex8 lex( impl->DataType() );
	    	TUint major = 0, minor = 0;
	    	TInt err1 = lex.Val(major, EHex);
	    	lex.SkipSpace();
	    	TInt err2 = lex.Val(minor, EHex);
	    	if( !err1 && !err2)
	    	    {
	    	    TRACE_INFO( ( _L( "[BTUI]\t CBTUIPluginMan::LoadSettingPluginL() MajorCOD=%d MinorCOD=%d" ), major, minor) )
 	            TBTDeviceClass cod(0x00, major, minor);
	    	                
	    	    CBtuiPluginInterface* plugin = NULL;
	    	    TRAPD( ret, plugin = CBtuiPluginInterface::NewL( impl->ImplementationUid() ) );
	    	    if( !ret )
	    	        {
	    	        CleanupStack::PushL(plugin);
	    	        
	    	        // Transfer the ownership to AppUi
	    	        iAppUi->AddViewL( (CAknView*)plugin ); 
	    	        plugin->SetCOD(cod);
	    	        iPluginArray.AppendL(plugin);
	    	        CleanupStack::Pop(plugin);              
	    	        }	    	        
	    	    }
	        }
		}
	
	TRACE_FUNC_EXIT
	}
Beispiel #16
0
TInt CLayoutLibrary::SetLayout(TInt aId)
    {
    TInt err = KErrNone;
    TBool foundLayout = EFalse;

    // Implementation info array
    RImplInfoPtrArray implInfoArray;

    TRACE_INFO( (_L("[HID]\tCLayoutLibrary::SetLayout: id=%d"), aId));

    if( aId == iId )
        {
        TRACE_INFO( (_L("[HID]\tCLayoutLibrary::SetLayout: Same layout id=%d, don't load twice"), aId));
        return KErrNone;
        }

    // Plain ignore is enough. If listing leaves, the array is just empty.
    TRAP_IGNORE( REComSession::ListImplementationsL( KHidLayoutPluginInterfaceUid, implInfoArray ) );

    TRACE_INFO( (_L("[HID]\tCLayoutLibrary::SetLayout: %d plugins listed"),implInfoArray.Count() ));

    if ( 0 == implInfoArray.Count())
        {
        TRACE_INFO( (_L("[HID]\tCLayoutLibrary::SetLayout: No Drivers found")));
        err = KErrNotFound;
        }
    else
        {
        for (TInt i=0; i<implInfoArray.Count() && !foundLayout; i++)
            {
            // parse implementation UID
            CImplementationInformation* info = implInfoArray[ i ];
            TUid implUid = info->ImplementationUid();
            TRACE_INFO( (_L("[HID]\tCLayoutLibrary::SetLayout: load plugin 0x%08x"),implUid ));
            // load driver
            // Trap so other drivers will be enumerated even if
            // this fails:
            CHidLayoutPluginInterface* plugin = NULL;
            TRAPD( err,
                   plugin = CHidLayoutPluginInterface::NewL( implUid );
                   TRACE_INFO( (_L("[HID]\tCLayoutLibrary::SetLayout: plugin loaded")));
                 );

            if( err == KErrNone)
                {
                CKeyboardLayout* layout = reinterpret_cast<CKeyboardLayout*>(plugin);
                if (aId == layout->LayoutId())
                    {
                    TRACE_INFO( (_L("[HID]\tCLayoutLibrary::SetLayout: Found layout %d!"), aId));
                    foundLayout = ETrue;
                    // Swap the current layout object:
                    CKeyboardLayout* tmpLayout = iLayout;
                    iLayout = layout;
                    iId = aId;
                    iLoaded = ETrue;
                    TRACE_INFO( (_L("[HID]\tCLayoutLibrary::SetLayout: delete old layout")));
                    delete tmpLayout;
                    }
                else
                    {
                    TRACE_INFO( (_L("[HID]\tCLayoutLibrary::SetLayout: wrong layout, delete plugin")));
                    delete plugin;
                    }
                }
            else
                {
                TRACE_INFO( (_L("[HID]\tCLayoutLibrary::SetLayout: plugin creation failed")));
                }
            }// end of for loop
        }
// ---------------------------------------------------------
// CNSmlDsProvisioningAdapter::StoreAttributesL
// ---------------------------------------------------------
void CNSmlDsProvisioningAdapter::StoreAttributesL( const TDesC& aType )
    {
    _DBG_FILE("CNSmlDsProvisioningAdapter::StoreAttributesL(): begin");
    
    TInt iDataProvElementCount = iProfiles[iProfiles.Count()-1]->iDataProvElement.Count()-1;
	// Leave if aType cannot be assigned
    if( ( aType.Length() > 0 ) &&
        ( iProfiles[iProfiles.Count()-1]->iDataProvElement[iDataProvElementCount]->iRemoteDBUri ) )
        {
        TBool dataProvIdFoundInZ = FALSE;
        TSmlDataProviderId firstDataProvIdFound = 0;
        TSmlDataProviderId uidFound = 0;

        TBool doSearch = ETrue;
        if ( aType.FindF( KXVcardMimeType ) != KErrNotFound )
            {
            if ( IsOperatorProfile( *iProfiles[iProfiles.Count()-1] ) )
                {
                const CNSmlDsProfileElement& profile = *iProfiles[iProfiles.Count()-1];
                StoreOperatorUrlL( *profile.iHostAddress );
                
                // Do not make a search through adapter implementations
                doSearch = EFalse;
                uidFound = OperatorAdapterUid();
                if ( !uidFound )
                    {
                    // If OperatorAdapterUid returns 0, do a search
                    doSearch = ETrue;
                    }
                }
            }
		// look through every implementation adapter until one found
		// which supports MIME type in question
		
		// The first one located in ROM is chosen. If none found in ROM then
		// the first adapter found is chosen.

		HBufC8 *type = HBufC8::NewLC(aType.Size());
		TPtr8 typePtr = type->Des();
		CnvUtfConverter::ConvertFromUnicodeToUtf8( typePtr, aType);

		// get list of dataproviderIds
		RImplInfoPtrArray implArray;
		CleanupStack::PushL( PtrArrCleanupItemRArr( CImplementationInformation, &implArray ) );
		TUid ifUid = { KNSmlDSInterfaceUid };
		REComSession::ListImplementationsL( ifUid, implArray );
		
        if ( doSearch )
            {
            TInt countProviders = implArray.Count();
            for( TInt i = 0; i < countProviders; i++ )
                {
                CImplementationInformation* implInfo = implArray[i];

                RSyncMLDataProvider dataProvider;
                dataProvider.OpenL( iSession, implInfo->ImplementationUid().iUid );
                CleanupClosePushL( dataProvider );

                TInt mimeTypeCount = dataProvider.MimeTypeCount();
                for( TInt j = 0; j < mimeTypeCount; j++ )
                    {
                    HBufC* mimeType = dataProvider.MimeType( j ).AllocLC();
                    TPtrC8 convMimeType = ConvertTo8LC( *mimeType );
                    if( typePtr.Find( convMimeType ) == 0)
                        {
                        // MIME type in question was found
                        uidFound = implInfo->ImplementationUid().iUid;

                        if( firstDataProvIdFound == 0 )
                            {
                            // save the first in case of none found from ROM
                            firstDataProvIdFound = uidFound;
                            }
					
                        // check whether the provider is located in ROM (drive Z)
                        if( implInfo->Drive() == EDriveZ )
                            {
                            dataProvIdFoundInZ = TRUE;
                            }
                        }
				
                    CleanupStack::PopAndDestroy(2); // mimetype, ConvertTo8LC

                    if( uidFound )
                        {
                        break;
                        }
                    }
				
                CleanupStack::PopAndDestroy(); // dataProvider
			
                if ( dataProvIdFoundInZ )
                    {
                    break;
                    }
                else
                    {
                    uidFound = firstDataProvIdFound;
                    }
                }
            }
        
		REComSession::FinalClose();
		CleanupStack::PopAndDestroy( 2 ); // type, implArray

		if( uidFound )
			{
			iProfiles[iProfiles.Count()-1]->iDataProvElement[iDataProvElementCount]->iUid = uidFound;
			}		
        }
	
	_DBG_FILE("CNSmlDsProvisioningAdapter::StoreAttributesL(): end");
	}