multimediacommscontroller/mmccshared/inc/mccexpirationhandler.h
changeset 0 1bce908db942
equal deleted inserted replaced
-1:000000000000 0:1bce908db942
       
     1 /*
       
     2 * Copyright (c) 2006 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:    This header file is included by the subsystems which are
       
    15 *                  using timer services, but are not responsible for creating
       
    16 *                  the CMccTimerManager instance.
       
    17 *
       
    18 */
       
    19 
       
    20 
       
    21 
       
    22 #ifndef MCCEXPIRATIONHANDLER_H
       
    23 #define MCCEXPIRATIONHANDLER_H
       
    24 
       
    25 // INCLUDES
       
    26 #include <e32def.h>
       
    27 
       
    28 /// Every timer is associated with an identifier of this type.
       
    29 /// When a timer is set, TMccTimerId is returned to the user of the Lightweight
       
    30 /// timer subsystem.
       
    31 /// When a timer expires, its TMccTimerId is passed in the callback.
       
    32 /// If the user wishes to stop or adjust a certain timer, it has to pass the
       
    33 /// TMccTimerId of the timer in question to the Lightweight timer subsystem.
       
    34 typedef TUint32 TMccTimerId;
       
    35 
       
    36 // CLASS DEFINITION
       
    37 /**
       
    38  * When a timer expires, this interface is called by MMccTimerManager
       
    39  */
       
    40 class MMccExpirationHandler
       
    41 	{
       
    42 	public: // Abstract methods
       
    43 
       
    44 		/**
       
    45 		 * Indicates that a timer has expired.
       
    46 		 *
       
    47 		 * @param aTimerId Identifies the expired timer
       
    48 		 * @param aTimerParam User specified value which was given when the timer
       
    49 		 *	was set. It can be used to identify the timer in case multiple timers
       
    50 		 *  are running simultaneously. Value is NULL if the timer was set using
       
    51 		 *  CTimerManager::StartL() without parameter aTimerParam. Ownership isn't
       
    52 	     *  transferred.
       
    53 		 */
       
    54 		virtual void TimerExpiredL( TMccTimerId aTimerId, TAny* aTimerParam ) = 0;
       
    55 	};
       
    56 
       
    57 
       
    58 // CLASS DEFINITION
       
    59 /**
       
    60  * MMccTimerManager provides methods for starting, stopping and adjusting timers.
       
    61  */
       
    62 class MMccTimerManager
       
    63 	{
       
    64 	public: // Enumerations
       
    65 
       
    66 		/// This exists for backward compatibility
       
    67 		enum TMccTimerIdValues
       
    68 			{
       
    69 			/// TimerId that is never used with a valid timer
       
    70 			KNoSuchTimer = 0
       
    71 			};
       
    72 
       
    73 	public: // Constructors and destructor
       
    74 
       
    75 		/// Virtual destructor
       
    76 		virtual ~MMccTimerManager() {}
       
    77 
       
    78 	public:	// Abstract methods
       
    79 
       
    80 		/**
       
    81 		 * Creates a new timer and starts it.
       
    82 		 *
       
    83 		 * @pre aObserver != NULL
       
    84 		 * @see See also this method 'MMccExpirationHandler::TimerExpiredL'
       
    85 		 *
       
    86 		 * @param aObserver	IN: Callback to use when timer expires. Ownership is
       
    87 		 *	not transferred.
       
    88 		 * @param aMilliseconds	Timer duration in milliseconds (with 32 bits, the
       
    89 		 *	max value is ~50 days)
       
    90 		 * @return value TimerId value identifying the new timer
       
    91 		 *
       
    92 		 * In case of an error, this function leaves.
       
    93 		 */
       
    94 		virtual TMccTimerId StartL( MMccExpirationHandler* aObserver,
       
    95 							     TUint aMilliseconds ) = 0;
       
    96 							     
       
    97 		/**
       
    98 		 * Creates a new timer and starts it.
       
    99 		 *
       
   100 		 * @pre aObserver != NULL
       
   101 		 * @see See also this method 'MMccExpirationHandler::TimerExpiredL'
       
   102 		 *
       
   103 		 * @param aObserver	IN: Callback to use when timer expires. Ownership is
       
   104 		 *	not transferred.
       
   105 		 * @param aMilliseconds	Timer duration in milliseconds (with 32 bits, the
       
   106 		 *	max value is ~50 days)
       
   107 		 * @param aTimerParam User specified value which will be passed to the
       
   108 		 *	aObserver function MMccExpirationHandler::TimerExpiredL() when the timer
       
   109 		 *	expires. Ownership isn't transferred.
       
   110 		 * @return value TimerId value identifying the new timer
       
   111 		 *
       
   112 		 * In case of an error, this function leaves.
       
   113 		 */
       
   114 		virtual TMccTimerId StartL( MMccExpirationHandler* aObserver,
       
   115 							     TUint aMilliseconds,
       
   116 							     TAny* aTimerParam ) = 0;							     
       
   117 
       
   118 		/**
       
   119 		 * Stops the specified timer.
       
   120 		 *
       
   121 		 * This function doesn't leave in case of error, as it is thought that this
       
   122 		 * function is usually also called from destructors.
       
   123 		 *
       
   124 		 * @param aTimerId Identifies the timer to be stopped
       
   125 		 * @return value KErrNone: successful
       
   126 	     *               KErrNotFound : no such timer exists
       
   127 		 */
       
   128 		virtual TInt Stop( TMccTimerId aTimerId ) = 0;
       
   129 
       
   130 		/**
       
   131 		 * Checks if there exists a timer which hasn't expired yet, with the
       
   132 		 * specified TimerId.
       
   133 		 *
       
   134 		 * @param aTimerId Identifies the timer
       
   135 		 * @return value ETrue: timer exists, KFalse: no such timer
       
   136 		 */
       
   137 		virtual TBool IsRunning( TMccTimerId aTimerId ) const = 0;
       
   138 
       
   139 	};
       
   140 
       
   141 #endif // MCCEXPIRATIONHANDLER_H
       
   142 
       
   143