idlefw/src/framework/aipluginfactory.cpp
branchRCL_3
changeset 14 15e4dd19031c
parent 11 bd874ee5e5e2
child 15 a0713522ab97
equal deleted inserted replaced
12:502e5d91ad42 14:15e4dd19031c
   231         plugin = NULL;            
   231         plugin = NULL;            
   232         }
   232         }
   233     
   233     
   234     __PRINTS( "*** CAiPluginFactory::DestroyPlugin: Done ***" );
   234     __PRINTS( "*** CAiPluginFactory::DestroyPlugin: Done ***" );
   235     }
   235     }
   236         
   236 
       
   237 // ----------------------------------------------------------------------------
       
   238 // CAiPluginFactory::DestroyPlugin()
       
   239 //
       
   240 // ----------------------------------------------------------------------------
       
   241 //
       
   242 void CAiPluginFactory::DestroyPlugin( const TUid& aUid )
       
   243     {
       
   244     __PRINTS( "*** CAiPluginFactory::DestroyPlugin: Start ***" );
       
   245     
       
   246     CHsContentPublisher* plugin( PluginByUid( aUid ) );
       
   247     
       
   248     while ( plugin )
       
   249         {
       
   250         iPublishers.Remove( iPublishers.Find( plugin ) );
       
   251         
       
   252         __PRINT( __DBG_FORMAT( 
       
   253             "CAiPluginFactory::DestroyPlugin: name: %S" ), &plugin->PublisherInfo().Name() ); 
       
   254 
       
   255         delete plugin;
       
   256         plugin = NULL;            
       
   257         }
       
   258     
       
   259     __PRINTS( "*** CAiPluginFactory::DestroyPlugin: Done ***" );
       
   260     }
       
   261 
   237 // ----------------------------------------------------------------------------
   262 // ----------------------------------------------------------------------------
   238 // CAiPluginFactory::CreatePluginL()
   263 // CAiPluginFactory::CreatePluginL()
   239 //
   264 //
   240 // ----------------------------------------------------------------------------
   265 // ----------------------------------------------------------------------------
   241 //
   266 //
   251     
   276     
   252     __TIME( "CAiPluginFactory::CreatePluginL Create plug-in:",                                  
   277     __TIME( "CAiPluginFactory::CreatePluginL Create plug-in:",                                  
   253     plugin = CHsContentPublisher::NewL( aPublisherInfo ) );            
   278     plugin = CHsContentPublisher::NewL( aPublisherInfo ) );            
   254     
   279     
   255     CleanupStack::PushL( plugin );
   280     CleanupStack::PushL( plugin );
       
   281     
       
   282     plugin->SetProperty( CHsContentPublisher::ECpsCmdBuffer, iCommandBuffer );
   256     
   283     
   257     __TIME( "FW: Subscribe content observers",    
   284     __TIME( "FW: Subscribe content observers",    
   258     SubscribeContentObserversL( *plugin, aPublisherInfo ) );             
   285     SubscribeContentObserversL( *plugin, aPublisherInfo ) );             
   259                                                       
   286                                                       
   260     __TIME( "FW: Configure Plugin",
   287     __TIME( "FW: Configure Plugin",
   388     {
   415     {
   389     return iPublishers;
   416     return iPublishers;
   390     }
   417     }
   391 
   418 
   392 // ----------------------------------------------------------------------------
   419 // ----------------------------------------------------------------------------
   393 // CAiPluginFactory::ResolvePluginsToUpgradeL()
   420 // CAiPluginFactory::SetCommandBuffer()
   394 //
   421 //
   395 // ----------------------------------------------------------------------------
   422 // ----------------------------------------------------------------------------
   396 //
   423 //
   397 void CAiPluginFactory::ResolvePluginsToUpgradeL( 
   424 void CAiPluginFactory::SetCommandBuffer( MAiCpsCommandBuffer* aCommandBuffer )
   398     RArray< THsPublisherInfo >& aArray )
   425     {
   399     {
   426     iCommandBuffer = aCommandBuffer;
   400     RImplInfoPtrArray ecomPlugins;
       
   401     CleanupResetAndDestroyPushL( ecomPlugins );
       
   402         
       
   403     REComSession::ListImplementationsL( 
       
   404         KInterfaceUidHsContentPlugin, ecomPlugins );
       
   405     
       
   406     for ( TInt i = 0; i < ecomPlugins.Count(); i++ )
       
   407         {
       
   408         CImplementationInformation* newInformation( ecomPlugins[i] );
       
   409                  
       
   410         for( TInt j = 0; j < iEComPlugins.Count(); j++ )
       
   411             {            
       
   412             CImplementationInformation* oldInformation( iEComPlugins[j] );
       
   413                                                                  
       
   414             if( newInformation->ImplementationUid() == oldInformation->ImplementationUid() )
       
   415                 {
       
   416                 if( newInformation->Version() != oldInformation->Version() )
       
   417                     {                        
       
   418                     for ( TInt k = 0; k < iPublishers.Count(); k++ )
       
   419                         {
       
   420                         const THsPublisherInfo& info( 
       
   421                             iPublishers[k]->PublisherInfo() );
       
   422                                                 
       
   423                         if ( info.Uid() == newInformation->ImplementationUid() )
       
   424                             {                            
       
   425                             __PRINT( __DBG_FORMAT( "\t[I]\t Plug-in to update uid=%x name=%S namespace=%S, version update %d to %d"), 
       
   426                                 info.Uid(), &(info.Name()), &(info.Namespace()), oldInformation->Version(), newInformation->Version()  );
       
   427                             
       
   428                             aArray.Append( info );
       
   429                             }
       
   430                         }
       
   431                                                          
       
   432                     break;
       
   433                     }
       
   434                 }                
       
   435             }
       
   436         }
       
   437     
       
   438     CleanupStack::PopAndDestroy( &ecomPlugins );
       
   439            
       
   440     // Update ecom plugin array
       
   441     iEComPlugins.ResetAndDestroy();
       
   442     
       
   443     REComSession::ListImplementationsL( 
       
   444         KInterfaceUidHsContentPlugin, iEComPlugins );
       
   445     }
   427     }
   446 
   428 
   447 // End of file
   429 // End of file