sysstatemgmt/systemstatemgr/ssm/inc/ssmswptransitionscheduler.h
changeset 0 4e1aa6a622a0
equal deleted inserted replaced
-1:000000000000 0:4e1aa6a622a0
       
     1 // Copyright (c) 2007-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 __SSMSWPTRANSITIONSCHEDULER_H__
       
    17 #define __SSMSWPTRANSITIONSCHEDULER_H__
       
    18 
       
    19 #include <e32base.h>
       
    20 
       
    21 class CSsmSwpTransitionEngine;
       
    22 class CSsmSwpIndividualTransitionScheduler;
       
    23 
       
    24 /**
       
    25 This helper Interface can be used for testing or to monitor the progress of the tranisitons
       
    26 by wrapping the scheduler and registering the wrapper class as a monitor
       
    27 
       
    28 @internalComponent
       
    29 @released
       
    30 */
       
    31 class MSwpSchedulerMonitor
       
    32 	{
       
    33 public:
       
    34 	virtual void SwpTransitionQueued() = 0;
       
    35 	virtual void SwpTransitionStarted() = 0;
       
    36 	virtual void SwpTransitionCompleted(TUint numberCompleted) = 0;
       
    37 	virtual void SwpTransitionFailed(TUint numberFailed) = 0;
       
    38 	};
       
    39 
       
    40 /**
       
    41  The scheduler class is responsible for submitting and scheduling transitions sequencially
       
    42  If  transition is active, the scheduler will queue the transition until all active 
       
    43  and queued transitions have been completed.
       
    44  
       
    45  @internalComponent
       
    46  @released
       
    47  */
       
    48 class CSsmSwpTransitionScheduler : public CTimer
       
    49 	{
       
    50 	// Allow the individual transition schedulers to interact more
       
    51 	// closely with this class
       
    52 	friend class CSsmSwpIndividualTransitionScheduler;
       
    53 	
       
    54 public:
       
    55 	// methods
       
    56 	static CSsmSwpTransitionScheduler* NewL();
       
    57 	static CSsmSwpTransitionScheduler* NewLC();
       
    58 	~CSsmSwpTransitionScheduler();
       
    59 
       
    60 	void SubmitL(CSsmSwpTransitionEngine* aEngine); // takes ownership
       
    61 	void Cancel(CSession2* aSession);
       
    62 		
       
    63 	void SetTransactionMonitor(MSwpSchedulerMonitor* aMonitor)
       
    64 		{
       
    65 		iTransactionMonitor = aMonitor;
       
    66 		}
       
    67 	//used only for testing
       
    68 #ifdef _DEBUG
       
    69 	void CleanupIndividualSchedulerArray();
       
    70 #endif
       
    71 
       
    72 protected:
       
    73 	// From CActive
       
    74 	void RunL();
       
    75 	TInt RunError(TInt aError);
       
    76 
       
    77 private:
       
    78 	// methods
       
    79 	CSsmSwpTransitionScheduler(); // only accessible from factory methods
       
    80 	void ConstructL();
       
    81 
       
    82 	void NotifyTransitionQueued();
       
    83 	void NotifyTransitionStarted();
       
    84 	void NotifyTransitionCompleted();
       
    85 	void NotifyTransitionFailed();
       
    86 	
       
    87 	CSsmSwpIndividualTransitionScheduler* FindScheduler(CSsmSwpTransitionEngine* aEngine);
       
    88 
       
    89 private:
       
    90 	// members
       
    91 	RPointerArray<CSsmSwpIndividualTransitionScheduler> iIndividualTransitionSchedulers;
       
    92 
       
    93 	TLinearOrder<CSsmSwpIndividualTransitionScheduler> iLinearOrder;
       
    94 	
       
    95 	MSwpSchedulerMonitor* iTransactionMonitor;
       
    96 	TUint iNumberOfCompletedTransitions;
       
    97 	TUint iNumberOfFailedTransitions;
       
    98 	};
       
    99 
       
   100 #endif