diff -r 000000000000 -r 4e1aa6a622a0 devicesrv_plat/powersave_plugin_api/inc/psmpluginbase.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devicesrv_plat/powersave_plugin_api/inc/psmpluginbase.inl Tue Feb 02 00:53:00 2010 +0200 @@ -0,0 +1,86 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Base class for PSM plug-ins +* +*/ + + +#include +#include + +// ----------------------------------------------------------------------------- +// Contructor +// ----------------------------------------------------------------------------- +// +inline CPsmPluginBase::TPsmPluginCTorParams::TPsmPluginCTorParams( + MPsmSettingsProvider& aSettingsProvider ) : + iSettingsProvider( aSettingsProvider ) + { + } + +// ----------------------------------------------------------------------------- +// CPsmPluginBase::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +inline CPsmPluginBase* CPsmPluginBase::NewL( const TUid& aImplementationUid, + MPsmSettingsProvider& aSettingsProvider ) + { + CPsmPluginBase* service = CPsmPluginBase::NewLC( aImplementationUid, + aSettingsProvider ); + CleanupStack::Pop( service ); + return service; + } + +// ----------------------------------------------------------------------------- +// CPsmPluginBase::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +inline CPsmPluginBase* CPsmPluginBase::NewLC( const TUid& aImplementationUid, + MPsmSettingsProvider& aSettingsProvider ) + { + // Create instance using ECom + TPsmPluginCTorParams initParams( aSettingsProvider ); + + TAny* interface = REComSession::CreateImplementationL( + aImplementationUid, + _FOFF( CPsmPluginBase, iDestructorIdKey ), + &initParams ); + + CPsmPluginBase* service = reinterpret_cast( interface ); + CleanupStack::PushL( service ); + + return service; + } + +// ----------------------------------------------------------------------------- +// Base class constructor +// ----------------------------------------------------------------------------- +// +inline CPsmPluginBase::CPsmPluginBase( TPsmPluginCTorParams& aInitParams ) : + iSettingsProvider( aInitParams.iSettingsProvider ) + { + } + +// ----------------------------------------------------------------------------- +// Destructor informs ECom that implementation has been destroyed. +// ----------------------------------------------------------------------------- +// +inline CPsmPluginBase::~CPsmPluginBase() + { + REComSession::DestroyedImplementation( iDestructorIdKey ); + } + +// End of file