|
1 /* |
|
2 * Copyright (c) 2009 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 |
|
21 #ifndef __TIMEOUTTIMER_H__ |
|
22 #define __TIMEOUTTIMER_H__ |
|
23 |
|
24 // INCLUDE FILES |
|
25 #include <e32base.h> |
|
26 |
|
27 // CLASS DECLARATIONS |
|
28 |
|
29 /** |
|
30 * A class for notifying of a timeout event. |
|
31 */ |
|
32 class MTimeoutNotifier |
|
33 { |
|
34 public: |
|
35 |
|
36 /* |
|
37 * Called when the timer raises an event. |
|
38 */ |
|
39 virtual void TimerExpired() = 0; |
|
40 }; |
|
41 |
|
42 /** |
|
43 * A class that raises timeout events. |
|
44 */ |
|
45 class CTimeOutTimer : public CTimer |
|
46 { |
|
47 public: |
|
48 |
|
49 /** |
|
50 * Standard Symbian two-phase construction |
|
51 * @param aPriority Priority of the active object. |
|
52 * @param aNotify Timer observer. |
|
53 */ |
|
54 static CTimeOutTimer* NewL( const TInt aPriority, |
|
55 MTimeoutNotifier& aNotify ); |
|
56 /** |
|
57 * Standard Symbian two-phase construction |
|
58 * @param aPriority Priority of the active object. |
|
59 * @param aNotify A handle to the class to be notified of a timeout event. |
|
60 */ |
|
61 static CTimeOutTimer* NewLC( const TInt aPriority, |
|
62 MTimeoutNotifier& aNotify ); |
|
63 /** |
|
64 * Destructor |
|
65 */ |
|
66 virtual ~CTimeOutTimer(); |
|
67 |
|
68 protected: // from CTimer |
|
69 |
|
70 /** |
|
71 * Active object post-request handling. |
|
72 */ |
|
73 void RunL(); |
|
74 |
|
75 /** |
|
76 * Handles a leave occurring in the request completion event handler RunL() |
|
77 */ |
|
78 TInt RunError( TInt aError ); |
|
79 |
|
80 private: |
|
81 |
|
82 /** |
|
83 * Constructor. |
|
84 * @param aPriority Priority of the active object. |
|
85 * @param aNotify A handle to the class to be notified of a timeout event. |
|
86 */ |
|
87 CTimeOutTimer( const TInt aPriority, |
|
88 MTimeoutNotifier& aNotify); |
|
89 |
|
90 /** |
|
91 * Standard Symbian second-phase construction. |
|
92 */ |
|
93 void ConstructL(); |
|
94 |
|
95 private: |
|
96 |
|
97 // Handle to the class to be notified of a timeout event. |
|
98 MTimeoutNotifier& iNotify; |
|
99 }; |
|
100 |
|
101 #endif |
|
102 |
|
103 // End of file |