// -----------------------------------------------------------------------------
// 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();
    }
// -----------------------------------------------------------------------------
// 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;
    }
TVerdict RRamPluginLoadTest::DoTestStepL()
	{
	TVerdict result = EPass;
#ifndef __WINSCW__
	TBuf<KMaxFileName*2> dllNames(KOriginalDllOnZ);
	TBuf<KMaxFileName*2> rscNames(KOriginalRscFileOnZ);

	dllNames.Append(KSeparator);
	dllNames.Append(KMovedDllOnC);
	rscNames.Append(KSeparator);
	rscNames.Append(KMovedRscFileOnC);
	TBufC<KMaxProcessNameLength> copyProcess(KProcessFileManCopyFile);

	// launch copyfile.exe to copy plugin from z: to c:
	TRAPD(ret, LaunchProcessL(copyProcess, dllNames));
	if(ret == KErrNone)
		{
		INFO_PRINTF1(_L("Succesfully copied dll"));
		}
	else
		{
		INFO_PRINTF2(_L("Copying dll failed with %d"), ret);
		result = EFail;
		return result;
		}
	TRAP(ret, LaunchProcessL(copyProcess, rscNames));
	if(ret == KErrNone)
		{
		INFO_PRINTF1(_L("Succesfully copied rsc file"));
		}
	else
		{
		INFO_PRINTF2(_L("Copying rsc file failed with %d"), ret);
		result = EFail;
		return result;
		}

	User::After(KWaitThreeSeconds); // Wait for ECom to re-scan drives so it can pick up new plugin now on c:
#endif
	_LIT(KRamPluginDisplayName, "Ram ECam Plugin");
	TBufC<15> expectedName(KRamPluginDisplayName);

	TBool pluginFound = EFalse;
	TInt error = KErrNone;

	INFO_PRINTF1(_L("Listing available plugins using REComSession::ListImplementationsL()..."));
	TUid interfaceUid = {KUidOnboardCameraPlugin};
	TEComResolverParams resolverParams;
	resolverParams.SetDataType(KECamPluginMatchString);
	RImplInfoPtrArray pluginArray;

	TRAP(error, REComSession::ListImplementationsL(interfaceUid, resolverParams, pluginArray));	
	if (error != KErrNone)
		{
		INFO_PRINTF2(_L("ListImplementationsL() failed - %d"), error);
		result = EFail;
		return result;
		}
	else
		{
		pluginArray.Sort(VersionLinearOrderFunction);
		for (TInt i = 0; i < pluginArray.Count(); ++i)
			{
			TBuf<2> drive;
			drive = pluginArray[i]->Drive().Name();
			INFO_PRINTF3(_L("%S located on drive %S"), &(pluginArray[i]->DisplayName()), &(drive));
			if((pluginArray[i]->DisplayName() == expectedName) && (pluginArray[i]->Drive() == 2))
				{
				pluginFound = ETrue;
				}
			}
		pluginArray.Close();

		if(!pluginFound)
			{
			INFO_PRINTF1(_L("REComSession::ListImplementationsL() could not find plugin in RAM"));
			}
		}

	INFO_PRINTF1(_L("Checking if CCamera::New2L() can successfully load plugin residing in RAM"));
	MCameraObserver2* observer2 = NULL;
	TRAP(error, CCamera* camera = CCamera::New2L(*observer2, 0, 0));
#ifdef _DEBUG
	if(error == KErrNone)
		{
		INFO_PRINTF1(_L("UDEB mode: Expected behaviour - successfully loaded plugin"));
		}
	else
		{
		INFO_PRINTF2(_L("UDEB mode: Unexpected behaviour - could not load plugin, error = %d"), error);
		result = EFail;
		}
#else
	if (error == KErrNone)
		{
		INFO_PRINTF1(_L("UREL mode: Unexpected behaviour - successfully loaded plugin"));
		result = EFail;
		}
	else
		{
		INFO_PRINTF2(_L("UREL mode: Expected behaviour - could not load plugin, error = %d"), error);
		}
#endif

	return result;
	}
示例#4
0
// Used for cleanup support of locally declared arrays
void CleanUpEComInfoArray(TAny* aInfoArray)
	{
	RImplInfoPtrArray* infoArray = (static_cast<RImplInfoPtrArray*>(aInfoArray));
	infoArray->ResetAndDestroy();
	infoArray->Close();
	}