diff -r bbd31066657e -r 8bb370ba6d1d testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/wrapperutils/src/sysstartplugin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/wrapperutils/src/sysstartplugin.cpp Fri Apr 09 10:46:28 2010 +0800 @@ -0,0 +1,117 @@ +/* +* Copyright (c) 2005-2009 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: +* +*/ + + + +#include +#ifdef SYMBIAN_SYSTEM_STATE_MANAGEMENT +#include +#include +#include +#include + +CSysStartPlugin::CSysStartPlugin() +#else +#include +#include +#include + +CSysStartPlugin::CSysStartPlugin() : CDmDomain(KDmHierarchyIdStartup, KAppServicesDomain3) +#endif + { + + } + +/** + * Destructor + * Frees the resources located in second-phase constructor + */ +CSysStartPlugin::~CSysStartPlugin() + { +#ifdef SYMBIAN_SYSTEM_STATE_MANAGEMENT + if (iStateAwareSession) + { + delete iStateAwareSession; + } +#endif + } + +/** + * Creates, and returns a pointer to CSysStartPlugin object, leave on failure + * @param aName - Path and name of the ini file to be parsed + * @return A pointer to the CSysStartPlugin object + */ +CSysStartPlugin* CSysStartPlugin::NewL() + { + CSysStartPlugin* self = new(ELeave) CSysStartPlugin(); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(); + return self; + } + +void CSysStartPlugin::ConstructL() + { +#ifdef SYMBIAN_SYSTEM_STATE_MANAGEMENT + iStateAwareSession = CSsmStateAwareSession::NewL(KSM2AppServicesDomain3); + iStateAwareSession->AddSubscriberL(*this); + } + +void CSysStartPlugin::StateChanged(TSsmState aSsmState) + { + //if (ESsmNormal==aSsmState.MainState() && ESsmNormalSubState==aSsmState.SubState()) + if (aSsmState.Int() >= ESsmStartupSubStateNonCritical) + { + CActiveScheduler::Stop(); + } +#else + CDmDomain::ConstructL(); +#endif + } + +void CSysStartPlugin::WaitForSystemStartL() + { +#ifdef SYMBIAN_SYSTEM_STATE_MANAGEMENT + TSsmState state = iStateAwareSession->State(); + if (state.Int() < ESsmStartupSubStateNonCritical) + { + CActiveScheduler::Start(); + } + } +#else + TDmDomainState state = GetState(); + if (state < EStartupStateNonCritical) + { + RequestTransitionNotification(); + CActiveScheduler::Start(); + } + } + +void CSysStartPlugin::RunL() + { + TDmDomainState state = GetState(); + if (state >= EStartupStateNonCritical) + { + CActiveScheduler::Stop(); + } + else + { + RequestTransitionNotification(); + } + } + +#endif