sdkcreationmw/sdkcommonutils/util/Inc/SysTimer.h
author rajpuroh
Wed, 21 Apr 2010 09:56:53 +0530
changeset 1 ac50fd48361b
parent 0 b26acd06ea60
permissions -rw-r--r--
Second Contribution
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
     1
/*
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
     2
* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies).
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
     3
* All rights reserved.
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
     4
* This component and the accompanying materials are made available
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
     5
* under the terms of "Eclipse Public License v1.0"
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
     6
* which accompanies this distribution, and is available
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
     8
*
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
     9
* Initial Contributors:
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    11
*
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    12
* Contributors:
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    13
*
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    14
* Description: 
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    15
*
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    16
*/
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    17
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    18
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    19
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    20
#ifndef _C_SYS_TIMER_H_
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    21
#define _C_SYS_TIMER_H_
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    22
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    23
// Includes
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    24
#include <e32base.h>
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    25
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    26
// Derive user class from this
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    27
class CSysTimer_if
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    28
	{
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    29
friend class CSysTimer;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    30
protected:
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    31
	// The num parameter is the same value as give to CSysTimer's
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    32
	// constructor. If you have several timers, use this toidentify
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    33
	// which timer timed out
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    34
	virtual void Timer(int num) = 0;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    35
	};
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    36
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    37
// Main class definition
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    38
class CSysTimer  : public CTimer
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    39
{
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    40
protected:
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    41
	IMPORT_C CSysTimer(TInt aPriority);
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    42
	IMPORT_C void ConstructL(CSysTimer_if* client, int num);
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    43
public:
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    44
	IMPORT_C static CSysTimer* NewL(CSysTimer_if* client
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    45
		, int num							// Enter here number to be passed to 
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    46
											// CSysTimer_if::Timer
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    47
											// The point of this number is that 
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    48
											// it is possible for user class to 
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    49
											// own several CSysTimers
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    50
		, TInt aPriority = EPriorityHigh);
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    51
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    52
	IMPORT_C virtual ~CSysTimer();
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    53
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    54
	IMPORT_C void RunL();
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    55
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    56
	IMPORT_C void Seconds(int s=1);			// Launch after second(s)
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    57
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    58
	IMPORT_C void MilliSeconds(int s=1);	// Launch after millisecond(s)
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    59
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    60
	IMPORT_C void MicroSeconds(int s=1);	// Launch after microsecond(s)
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    61
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    62
protected:
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    63
	CSysTimer_if*	iClient;				// Parent
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    64
	int				iUserNum;				// Number to be pased to parent
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    65
};
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    66
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    67
#endif // _C_SYS_TIMER_H_