sysstatemgmt/systemstatemgr/ssm/inc/ssmswpindividualtransitionscheduler.h
changeset 0 4e1aa6a622a0
equal deleted inserted replaced
-1:000000000000 0:4e1aa6a622a0
       
     1 // Copyright (c) 2008-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 #ifndef __SSMSWPINDIVIDUALTRANSITIONSCHEDULER_H__
       
    17 #define __SSMSWPINDIVIDUALTRANSITIONSCHEDULER_H__
       
    18 
       
    19 #include <e32base.h>
       
    20 
       
    21 class CSsmSwpTransitionEngine;
       
    22 class MSwpSchedulerMonitor;
       
    23 
       
    24 class CSsmSwpTransitionScheduler;
       
    25 
       
    26 /**
       
    27  The scheduler class is responsible for submitting and scheduling transitions sequencially
       
    28  If  transition is active, the scheduler will queue the transition until all active 
       
    29  and queued transitions have been completed.
       
    30  
       
    31  @internalComponent
       
    32  @released
       
    33  */
       
    34 class CSsmSwpIndividualTransitionScheduler : public CActive
       
    35 	{
       
    36 
       
    37 public:
       
    38 	// methods
       
    39 	static CSsmSwpIndividualTransitionScheduler* NewLC(TUint aSwpKey, MCleSessionProxy* aCleSession, CSsmSwpTransitionScheduler& aParent);
       
    40 	~CSsmSwpIndividualTransitionScheduler();
       
    41 
       
    42 	void SubmitL(CSsmSwpTransitionEngine* aEngine); // takes ownership
       
    43 	void Cancel(CSession2* aSession);
       
    44 
       
    45 	TUint SwpKey() const;
       
    46 	TBool IsIdle() const;
       
    47 protected: 
       
    48 	//from CActive
       
    49 	void DoCancel();
       
    50 	void RunL();
       
    51 	TInt RunError(TInt aError);
       
    52 
       
    53 private:
       
    54 	// methods
       
    55 	CSsmSwpIndividualTransitionScheduler(TUint aSwpKey, CSsmSwpTransitionScheduler& aParent); // only accessible from factory methods
       
    56 	void ConstructL(MCleSessionProxy* aCleSession);
       
    57 	void DoSubmitL(CSsmSwpTransitionEngine* aEngine);
       
    58 	void ScheduleTransition();
       
    59 	CSsmSwpTransitionEngine* GetNextFromQueue();
       
    60 	void DestroyTransitionQueue();
       
    61 	void CancelTransitionQueue(CSession2* aSession);
       
    62 	TBool CurrentTransitionOriginatesFrom(CSession2* aSession);
       
    63 
       
    64 	void NotifyTransitionQueued();
       
    65 	void NotifyTransitionStarted();
       
    66 	void NotifyTransitionCompleted();
       
    67 	void NotifyTransitionFailed();
       
    68 
       
    69 private:
       
    70 	// constant types
       
    71 	enum TSchedulerStates
       
    72 		{
       
    73 		EIdle,
       
    74 		ERunningTransition
       
    75 		};
       
    76 
       
    77 private:
       
    78 	// members
       
    79 	RPointerArray<CSsmSwpTransitionEngine> iTransitionQueue;
       
    80 	CSsmSwpTransitionEngine* iCurrentTransition;
       
    81 	TSchedulerStates iSchedulerState;
       
    82 	CSession2* iCancellingSession;
       
    83 
       
    84 	MCleSessionProxy* iCleSession;
       
    85 	CSsmSwpPolicyCliSession* iSsmSwpPolicySession;
       
    86 	
       
    87 	TUint iSwpKey;
       
    88 	CSsmSwpTransitionScheduler& iParent;
       
    89 	};
       
    90 
       
    91 #endif