devicesrv_plat/powersave_plugin_api/inc/psmpluginbase.inl
changeset 0 4e1aa6a622a0
equal deleted inserted replaced
-1:000000000000 0:4e1aa6a622a0
       
     1 /*
       
     2 * Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Base class for PSM plug-ins
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include <ecom/ecom.h>
       
    20 #include <psmsettingsprovider.h>
       
    21 
       
    22 // -----------------------------------------------------------------------------
       
    23 // Contructor
       
    24 // -----------------------------------------------------------------------------
       
    25 //
       
    26 inline CPsmPluginBase::TPsmPluginCTorParams::TPsmPluginCTorParams( 
       
    27                                     MPsmSettingsProvider& aSettingsProvider ) :
       
    28     iSettingsProvider( aSettingsProvider )
       
    29     {
       
    30     }
       
    31     
       
    32 // -----------------------------------------------------------------------------
       
    33 // CPsmPluginBase::NewL
       
    34 // Two-phased constructor.
       
    35 // -----------------------------------------------------------------------------
       
    36 //
       
    37 inline CPsmPluginBase* CPsmPluginBase::NewL( const TUid& aImplementationUid,
       
    38                                              MPsmSettingsProvider& aSettingsProvider )
       
    39     {
       
    40     CPsmPluginBase* service = CPsmPluginBase::NewLC( aImplementationUid,
       
    41                                                      aSettingsProvider );
       
    42     CleanupStack::Pop( service );
       
    43     return service;
       
    44     }
       
    45 
       
    46 // -----------------------------------------------------------------------------
       
    47 // CPsmPluginBase::NewL
       
    48 // Two-phased constructor.
       
    49 // -----------------------------------------------------------------------------
       
    50 //
       
    51 inline CPsmPluginBase* CPsmPluginBase::NewLC( const TUid& aImplementationUid,
       
    52                                               MPsmSettingsProvider& aSettingsProvider )
       
    53     {
       
    54     // Create instance using ECom
       
    55     TPsmPluginCTorParams initParams( aSettingsProvider );
       
    56     
       
    57     TAny* interface = REComSession::CreateImplementationL( 
       
    58                                 aImplementationUid, 
       
    59                                 _FOFF( CPsmPluginBase, iDestructorIdKey ),
       
    60                                 &initParams );
       
    61 
       
    62     CPsmPluginBase* service = reinterpret_cast<CPsmPluginBase*>( interface );
       
    63     CleanupStack::PushL( service );
       
    64 
       
    65     return service;
       
    66     }
       
    67 
       
    68 // -----------------------------------------------------------------------------
       
    69 // Base class constructor
       
    70 // -----------------------------------------------------------------------------
       
    71 //
       
    72 inline CPsmPluginBase::CPsmPluginBase( TPsmPluginCTorParams& aInitParams ) :
       
    73     iSettingsProvider( aInitParams.iSettingsProvider )
       
    74     {
       
    75     }
       
    76 
       
    77 // -----------------------------------------------------------------------------
       
    78 // Destructor informs ECom that implementation has been destroyed.
       
    79 // -----------------------------------------------------------------------------
       
    80 //
       
    81 inline CPsmPluginBase::~CPsmPluginBase()
       
    82     {
       
    83     REComSession::DestroyedImplementation( iDestructorIdKey );
       
    84     }
       
    85 
       
    86 // End of file