sysstatemgmt/systemstatemgr/ssm/inc/ssmstatepolicyframe.h
author William Roberts <williamr@symbian.org>
Wed, 23 Jun 2010 22:58:50 +0100
branchGCC_SURGE
changeset 38 61516c5786af
parent 0 4e1aa6a622a0
permissions -rw-r--r--
Select correct DEF file for GCCE builds, and remove obsolete eabi deffiles which were used instead - bug 2965

// Copyright (c) 2007-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:
//

#ifndef __SSMSTATEPOLICYFRAME_H__
#define __SSMSTATEPOLICYFRAME_H__

#include <e32base.h>
#include <ssm/ssmstatepolicy.h>

class CSsmCommandList;
class TSsmState;
class TSsmStateTransition;

/**
This class owns the MSsmStatePolicy instance created from the System State Policy DLL.
Its main purpose is to construct and delete the MSsmStatePolicy object, and to guarantee 
correctness from the CSsmStateTransitionEngine.
@internalComponent
@released
*/
class CSsmStatePolicyFrame : public CBase
  	{
public:
	static CSsmStatePolicyFrame* NewL(TLibraryFunction aNewLFunc);
	CSsmStatePolicyFrame(MSsmStatePolicy* aStatePolicy);
	~CSsmStatePolicyFrame();

	TUint16 StatePolicyId() const;
	void SetStatePolicyId(TUint16 aMainState);
	inline TBool Initialized() const { return iInitializeCalled; }
	
	void CallInitialize(TRequestStatus& aStatus);
	void CallInitializeCancel();
	MSsmStatePolicy::TResponse CallTransitionAllowed(const TSsmStateTransition& aRequest, TSsmStateTransition const* aCurrent, TSsmStateTransition const* aQueued, const RMessagePtr2& aMessage);
	void CallPrepareCommandList(TSsmState aTargetState, TInt aReason, TRequestStatus& aStatus);
	void CallPrepareCommandListCancel();
	CSsmCommandList* CallCommandList();
	TBool CallGetNextState(TSsmState aCurrentTransition, TInt aReason, TInt aError, TInt aSeverity, TSsmState& aNextState);

private:
	CSsmStatePolicyFrame();
	void ConstructL(TLibraryFunction aNewLFunc);
	
private:				
	enum TInternalActions
		{
		EInitialize,
		EPrepare,
		EGet,
		ENext
		};
	/** the policy that has been loaded */
	MSsmStatePolicy* iStatePolicy;
	/** used to track the internal state of the object for extra integrity */
	TInternalActions iNextAction;
	TUint16 iStatePolicyId;
	TBool iInitializeCalled;	
	};
	
#endif