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