multimediacommsengine/tsrc/testdriver/testclient/watcher/inc/CTcWatcher.h
changeset 0 1bce908db942
equal deleted inserted replaced
-1:000000000000 0:1bce908db942
       
     1 /*
       
     2 * Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  See class definition below.
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef __CTCWATCHER_H__
       
    19 #define __CTCWATCHER_H__
       
    20 
       
    21 //  INCLUDES
       
    22 #include <e32base.h>
       
    23 #include "RTcWatcher.h"
       
    24 
       
    25 //  CLASS DEFINITION
       
    26 /**
       
    27  * CTcWatcher implements a wrapper on top of RTcWatcher providing
       
    28  * a timer for automatically calling RTcWatcher::Ping().
       
    29  * This class should be preferred by clients instead of RTcWatcher.
       
    30  */
       
    31 class CTcWatcher
       
    32     : public CActive
       
    33     {
       
    34     public: // Constructors and destructor
       
    35 
       
    36 		/**
       
    37 		 * Static constructor.
       
    38 		 *
       
    39 		 * @param aAppName Application name and full path, for restarting.
       
    40 		 * @param aTimeout Life timeout
       
    41 		 * @return An initialised instance of this class.
       
    42 		 */
       
    43 		IMPORT_C static CTcWatcher* NewL( const TDesC& aAppName, TInt aTimeout );
       
    44 
       
    45 		/// Destructor
       
    46 		IMPORT_C ~CTcWatcher();
       
    47 
       
    48     private: // Constructors
       
    49 
       
    50 		/// Default constructor.
       
    51 		CTcWatcher();
       
    52 
       
    53 		/**
       
    54 		 * Constructor.
       
    55 		 *
       
    56 		 * @param aAppName Application name and full path, for restarting.
       
    57 		 * @param aTimeout Life timeout
       
    58 		 */
       
    59         void ConstructL( const TDesC& aAppName, TInt aTimeout );
       
    60 
       
    61 	protected: // from CActive
       
    62 
       
    63 		void DoCancel();
       
    64 		void RunL();
       
    65 
       
    66 	private: // Data
       
    67 
       
    68 		/// Timeout timer. Owned.
       
    69 		RTimer iTimer;
       
    70 
       
    71 		/// Life timeout
       
    72 		TTimeIntervalMicroSeconds32 iTimeout;
       
    73 
       
    74 		/// Watcher client. Owned.
       
    75 		RTcWatcher iWatcher;
       
    76 
       
    77     };
       
    78 
       
    79 #endif // __CTCWATCHER_H__