cmmanager/cmmgr/cmmserver/src/cmmcache.cpp
changeset 61 8b0c979bbe8c
parent 44 a0c4ceac30d0
equal deleted inserted replaced
59:2709c04a4af5 61:8b0c979bbe8c
   455             break;
   455             break;
   456             }
   456             }
   457         }
   457         }
   458     if ( !plugin )
   458     if ( !plugin )
   459         {
   459         {
   460         User::Leave( KErrArgument );
   460         TInt index = RefreshPluginL( aBearerType );
       
   461         if ( index < 0 || index >= iPlugins->Count() )
       
   462             {
       
   463             User::Leave( KErrArgument );
       
   464             }
       
   465         else
       
   466             {
       
   467             TCmPluginInitParam pluginParams( Session() );
       
   468             plugin = ( *iPlugins )[index]->CreateInstanceL( pluginParams );
       
   469             CleanupStack::PushL( plugin );
       
   470             plugin->CreateNewL( aConnMethodId );
       
   471             }
   461         }
   472         }
   462 
   473 
   463 
   474 
   464     // Store the connection method into cache.
   475     // Store the connection method into cache.
   465     // Use connMethodId here, so ID is either a real ID or a temporary ID.
   476     // Use connMethodId here, so ID is either a real ID or a temporary ID.
  1787         }
  1798         }
  1788     OstTraceFunctionExit0( CCMMCACHE_NOTIFYPLUGINSFORTABLECHANGESL_EXIT );
  1799     OstTraceFunctionExit0( CCMMCACHE_NOTIFYPLUGINSFORTABLECHANGESL_EXIT );
  1789     }
  1800     }
  1790 
  1801 
  1791 // ---------------------------------------------------------------------------
  1802 // ---------------------------------------------------------------------------
       
  1803 // Try to load unknown plugin dynamically during running-time. Some plugin
       
  1804 // (e.g., VPN) might be installed after CmManager starts up. So, try to load
       
  1805 // it. Only one plugin can be possibly loaded in a time.
       
  1806 // ---------------------------------------------------------------------------
       
  1807 //
       
  1808 TInt CCmmCache::RefreshPluginL( const TUint32 aBearerType )
       
  1809     {
       
  1810     OstTraceFunctionEntry0( CCMMCACHE_REFRESHPLUGIN_ENTRY );
       
  1811 
       
  1812     TInt ret( KErrNotFound );
       
  1813     
       
  1814     // Get a list of all the bearer types.
       
  1815     RPointerArray<CImplementationInformation> implArray;
       
  1816     CmmCleanupResetAndDestroyPushL( implArray );
       
  1817     REComSession::ListImplementationsL( TUid::Uid( KCMPluginInterfaceUid ), implArray );
       
  1818 
       
  1819     CCmPluginBaseEng* plugin = NULL;
       
  1820     for ( TInt i = 0; i < implArray.Count(); i++ )
       
  1821         {
       
  1822         TUid uid = ( implArray )[i]->ImplementationUid();
       
  1823         
       
  1824         if ( uid.iUid == aBearerType )
       
  1825             {
       
  1826             TCmPluginInitParam params( iTrans->Session() );
       
  1827             
       
  1828             TRAPD( err, plugin = STATIC_CAST( CCmPluginBaseEng*, REComSession::CreateImplementationL(
       
  1829                     uid,
       
  1830                     _FOFF( CCmPluginBaseEng, iDtor_ID_Key ),
       
  1831                     ( TAny* )&params ) ) );
       
  1832             
       
  1833             if ( !err )
       
  1834                 {
       
  1835                 CleanupStack::PushL( plugin );
       
  1836                 
       
  1837                 // We may not think the priority position in the plugin array for this newly loaded plugin
       
  1838                 // and just simply append it in the end of the plugin array
       
  1839                 iPlugins->AppendL( plugin );
       
  1840                 
       
  1841                 ret = iPlugins->Count() - 1;
       
  1842                 
       
  1843                 CleanupStack::Pop( plugin );
       
  1844                 }
       
  1845  
       
  1846             // Don't need to go further in the for loop
       
  1847             break;
       
  1848             }
       
  1849         }
       
  1850 
       
  1851     CleanupStack::PopAndDestroy( &implArray );
       
  1852 
       
  1853     OstTraceFunctionExit0( CCMMCACHE_REFRESHPLUGIN_EXIT );
       
  1854     return ret;
       
  1855     }
       
  1856 
       
  1857 // ---------------------------------------------------------------------------
  1792 // Tells the cache that an error has occured with a database listener. Any
  1858 // Tells the cache that an error has occured with a database listener. Any
  1793 // reads to this table need go through the database, since cache can't know if
  1859 // reads to this table need go through the database, since cache can't know if
  1794 // it has up-to-date information.
  1860 // it has up-to-date information.
  1795 // ---------------------------------------------------------------------------
  1861 // ---------------------------------------------------------------------------
  1796 //
  1862 //