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