sysstatemgmt/systemstatemgr/ss/inc/rvobserver.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 __RVOBSERVER_H__
       
    17 #define __RVOBSERVER_H__
       
    18 
       
    19 #include <e32base.h>
       
    20 #include <apastarter.h>
       
    21 #include <e32debug.h>
       
    22 
       
    23 #include "timeoutwaiternotification.h"
       
    24 #include "rvobservernotification.h"
       
    25 
       
    26 /**
       
    27 @internalTechnology
       
    28 @released
       
    29 */
       
    30 enum TRvObserverState
       
    31 	{
       
    32 	ERvObserverStateNotInvoked = 0,
       
    33 	ERvObserverStateAwaitingRv
       
    34 	};
       
    35 	
       
    36 	
       
    37 	
       
    38 class CTimeoutWaiter;
       
    39 class CSsmStartupProperties;
       
    40 
       
    41 NONSHARABLE_CLASS( CRvObserver ) : public CActive, public MTimeoutWaiterNotification
       
    42 	{
       
    43 public:
       
    44 	static CRvObserver* NewL( RProcess& aProcess, MRvObserverNotification& aObserved, CApaStarter* aApaStarter );
       
    45 	static CRvObserver* NewLC( RProcess& aProcess, MRvObserverNotification& aObserved, CApaStarter* aApaStarter );
       
    46 	~CRvObserver();
       
    47 	
       
    48 	void RvAndObserveL( CSsmStartupProperties* aStartupProperties );
       
    49 	// From MTimeoutWaiterNotification
       
    50 	void NotifyTimeout();
       
    51 
       
    52 protected:
       
    53 	void RunL();
       
    54 	void DoCancel();
       
    55 	TInt RunError( TInt aError );
       
    56 
       
    57 private:
       
    58 	CRvObserver( RProcess& aProcess, MRvObserverNotification& aObserved, CApaStarter* aApaStarter );
       
    59 	void ConstructL();
       
    60 	
       
    61 	void InvokeL();
       
    62 	TInt GetProcessHandle( RProcess& aProcess, const TThreadId& aThreadId );
       
    63 	void NotifyOrRetryL();
       
    64 	TBool GoodStart();
       
    65 	
       
    66 private:
       
    67 	CTimeoutWaiter* iTimeoutWaiter;
       
    68 	CApaStarter* iApaStarter; // not owning
       
    69 	CSsmStartupProperties* iStartupProperties; // Not owning.
       
    70 	MRvObserverNotification& iStarter;
       
    71 	TInt iHandleNumber;
       
    72 	TThreadId iThreadId;
       
    73 	RProcess& iProcess;
       
    74 	TRvObserverState iObserverState;
       
    75 	TInt iRetries;
       
    76 	TBool iTimeOut;
       
    77 	};
       
    78 
       
    79 	
       
    80 	
       
    81 #endif // __RVOBSERVER_H__
       
    82