resourcemgmt/hwresourcesmgr/common/src/hwrmuipluginservice.cpp
changeset 0 4e1aa6a622a0
equal deleted inserted replaced
-1:000000000000 0:4e1aa6a622a0
       
     1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 #include <ecom/ecom.h>
       
    17 
       
    18 #include "hwrmuipluginservice.h"
       
    19 #include "hwrmuipluginresolver.h"
       
    20 
       
    21 // CONSTANTS
       
    22 // Plugin name must match the default_data field in the resource file (case sensitive!)
       
    23 _LIT8( KPluginName, "HwrmUiPlugin" );
       
    24 
       
    25 
       
    26 // -----------------------------------------------------------------------------
       
    27 // CHwrmUiPluginService::NewL
       
    28 // Factory method to create implementation. Implementation is found via ECom.
       
    29 // -----------------------------------------------------------------------------
       
    30 //
       
    31 CHwrmUiPluginService* CHwrmUiPluginService::NewL()
       
    32 	{
       
    33 	TUid uiPluginUid(TUid::Null());
       
    34 	TAny* interface(NULL);
       
    35 
       
    36 #ifdef _DEBUG
       
    37 		{
       
    38 		CHwrmUiPluginResolver* uiPluginResolver = CHwrmUiPluginResolver::NewLC();
       
    39 		TRAP_IGNORE(uiPluginResolver->GetDesiredPluginL(uiPluginUid));
       
    40 		CleanupStack::PopAndDestroy(uiPluginResolver);
       
    41 		}
       
    42 #endif
       
    43 
       
    44 	if (uiPluginUid == TUid::Null())
       
    45 		{
       
    46 		
       
    47 		// Set resolve parameters to find correct implementation    		            
       
    48 	    TEComResolverParams resolverParams;     
       
    49 	    resolverParams.SetDataType(KPluginName);
       
    50 	    resolverParams.SetWildcardMatch(EFalse);
       
    51 	                   
       
    52 	    interface = REComSession::CreateImplementationL(KHwrmUiPluginServiceInterfaceUid,
       
    53 														_FOFF(CHwrmUiPluginService, iDestructorIDKey),
       
    54 	                                        			resolverParams,
       
    55 														KRomOnlyResolverUid);
       
    56 		}
       
    57 	else
       
    58 		{
       
    59 	    interface = REComSession::CreateImplementationL(uiPluginUid,
       
    60 	    												_FOFF(CHwrmUiPluginService, iDestructorIDKey));
       
    61 		
       
    62 		}
       
    63 		
       
    64 	User::LeaveIfNull(interface);
       
    65 	CHwrmUiPluginService* service = reinterpret_cast<CHwrmUiPluginService*>(interface); 										    
       
    66        
       
    67     return service;	        	
       
    68 
       
    69 	}
       
    70 	
       
    71 // End of File