0
|
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:
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
#ifndef _C_SYS_TIMER_H_
|
|
21 |
#define _C_SYS_TIMER_H_
|
|
22 |
|
|
23 |
// Includes
|
|
24 |
#include <e32base.h>
|
|
25 |
|
|
26 |
// Derive user class from this
|
|
27 |
class CSysTimer_if
|
|
28 |
{
|
|
29 |
friend class CSysTimer;
|
|
30 |
protected:
|
|
31 |
// The num parameter is the same value as give to CSysTimer's
|
|
32 |
// constructor. If you have several timers, use this toidentify
|
|
33 |
// which timer timed out
|
|
34 |
virtual void Timer(int num) = 0;
|
|
35 |
};
|
|
36 |
|
|
37 |
// Main class definition
|
|
38 |
class CSysTimer : public CTimer
|
|
39 |
{
|
|
40 |
protected:
|
|
41 |
IMPORT_C CSysTimer(TInt aPriority);
|
|
42 |
IMPORT_C void ConstructL(CSysTimer_if* client, int num);
|
|
43 |
public:
|
|
44 |
IMPORT_C static CSysTimer* NewL(CSysTimer_if* client
|
|
45 |
, int num // Enter here number to be passed to
|
|
46 |
// CSysTimer_if::Timer
|
|
47 |
// The point of this number is that
|
|
48 |
// it is possible for user class to
|
|
49 |
// own several CSysTimers
|
|
50 |
, TInt aPriority = EPriorityHigh);
|
|
51 |
|
|
52 |
IMPORT_C virtual ~CSysTimer();
|
|
53 |
|
|
54 |
IMPORT_C void RunL();
|
|
55 |
|
|
56 |
IMPORT_C void Seconds(int s=1); // Launch after second(s)
|
|
57 |
|
|
58 |
IMPORT_C void MilliSeconds(int s=1); // Launch after millisecond(s)
|
|
59 |
|
|
60 |
IMPORT_C void MicroSeconds(int s=1); // Launch after microsecond(s)
|
|
61 |
|
|
62 |
protected:
|
|
63 |
CSysTimer_if* iClient; // Parent
|
|
64 |
int iUserNum; // Number to be pased to parent
|
|
65 |
};
|
|
66 |
|
|
67 |
#endif // _C_SYS_TIMER_H_
|