|
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: CCSconTimeOut header file |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CSCONTIMEOUT_H |
|
20 #define CSCONTIMEOUT_H |
|
21 |
|
22 #include <e32base.h> // For CActive, link against: euser.lib |
|
23 #include <e32std.h> // For RTimer, link against: euser.lib |
|
24 |
|
25 class MTimeOutObserver |
|
26 { |
|
27 public: |
|
28 virtual void TimeOut() = 0; |
|
29 }; |
|
30 |
|
31 class CCSconTimeOut : public CActive |
|
32 { |
|
33 public: |
|
34 // Cancel and destroy |
|
35 ~CCSconTimeOut(); |
|
36 |
|
37 // Two-phased constructor. |
|
38 static CCSconTimeOut* NewL( MTimeOutObserver& aTimeOutObserver ); |
|
39 |
|
40 public: |
|
41 // New functions |
|
42 // Function for making the timeout request |
|
43 void Start(TTimeIntervalMicroSeconds32 aDelay); |
|
44 |
|
45 private: |
|
46 // C++ constructor |
|
47 CCSconTimeOut( MTimeOutObserver& aTimeOutObserver ); |
|
48 |
|
49 // Second-phase constructor |
|
50 void ConstructL(); |
|
51 |
|
52 private: |
|
53 // From CActive |
|
54 // Handle completion |
|
55 void RunL(); |
|
56 |
|
57 // How to cancel me |
|
58 void DoCancel(); |
|
59 |
|
60 // Override to handle leaves from RunL(). Default implementation causes |
|
61 // the active scheduler to panic. |
|
62 TInt RunError(TInt aError); |
|
63 |
|
64 private: |
|
65 enum TCSconTimeOutState |
|
66 { |
|
67 EUninitialized, // Uninitialized |
|
68 EInitialized, // Initalized |
|
69 EError |
|
70 // Error condition |
|
71 }; |
|
72 |
|
73 private: |
|
74 TInt iState; // State of the active object |
|
75 RTimer iTimer; // Provides async timing service |
|
76 MTimeOutObserver& iTimeOutObserver; |
|
77 }; |
|
78 |
|
79 #endif // CSCONTIMEOUT_H |