1 /* |
|
2 * Copyright (c) 2002 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 * Utility class for CTimer object |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 #ifndef CPHONETIMER_H |
|
21 #define CPHONETIMER_H |
|
22 |
|
23 // INCLUDES |
|
24 #include <e32base.h> |
|
25 #include "mphonetimer.h" |
|
26 |
|
27 // CLASS DECLARATION |
|
28 |
|
29 /** |
|
30 * Utility class for timer |
|
31 */ |
|
32 class CPhoneTimer : public CTimer |
|
33 { |
|
34 public: // Constructors and destructor |
|
35 |
|
36 /** |
|
37 * Two-phased constructor. |
|
38 */ |
|
39 IMPORT_C static CPhoneTimer* NewL( |
|
40 TInt aPriority = CActive::EPriorityStandard ); |
|
41 |
|
42 /** |
|
43 * Destructor. |
|
44 */ |
|
45 IMPORT_C virtual ~CPhoneTimer(); |
|
46 |
|
47 public: // New functions |
|
48 |
|
49 /** |
|
50 * The Callback function is called after the interval |
|
51 * All former request will be canceled first |
|
52 */ |
|
53 IMPORT_C void After( |
|
54 TTimeIntervalMicroSeconds32 anInterval, |
|
55 TCallBack aCallBack ); |
|
56 |
|
57 /** |
|
58 * Use the maxin class to notify the timer |
|
59 * All former request will be canceled first |
|
60 */ |
|
61 IMPORT_C void After( |
|
62 TTimeIntervalMicroSeconds32 anInterval, |
|
63 MPhoneTimer* aObserver ); |
|
64 |
|
65 /** |
|
66 * Cancel the timer if needed |
|
67 */ |
|
68 IMPORT_C void CancelTimer(); |
|
69 |
|
70 protected: // Functions from base classes |
|
71 |
|
72 /** |
|
73 * From CTimer::RunL() |
|
74 */ |
|
75 virtual void RunL(); |
|
76 |
|
77 /** |
|
78 * From CTimer::DoCancel() |
|
79 */ |
|
80 virtual void DoCancel(); |
|
81 |
|
82 private: |
|
83 |
|
84 /** |
|
85 * C++ default constructor. |
|
86 */ |
|
87 CPhoneTimer( TInt aPriority ); |
|
88 |
|
89 /** |
|
90 * By default Symbian OS constructor is private. |
|
91 */ |
|
92 void ConstructL(); |
|
93 |
|
94 // By default, prohibit copy constructor |
|
95 CPhoneTimer( const CPhoneTimer& ); |
|
96 |
|
97 // Prohibit assigment operator |
|
98 CPhoneTimer& operator=( const CPhoneTimer& ); |
|
99 |
|
100 private: // Data |
|
101 |
|
102 // Used by After( anInterval, aCallBack ) |
|
103 TCallBack iCallBack; |
|
104 |
|
105 // Used by After( anInterval, aObserver ) |
|
106 MPhoneTimer* iTimerObserver; |
|
107 }; |
|
108 |
|
109 #endif // CPhoneTimer_H |
|
110 |
|
111 // End of File |
|