|
1 /* |
|
2 * Copyright (c) 2004 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: Asynchronous execution class for Video Telephone application. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef CVTUIACTIVEEXEC_H |
|
21 #define CVTUIACTIVEEXEC_H |
|
22 |
|
23 // INCLUDES |
|
24 #include <e32base.h> |
|
25 |
|
26 // FORWARD DECLARATIONS |
|
27 class CVtUiActiveExec; |
|
28 |
|
29 // CLASS DECLARATION |
|
30 |
|
31 /** |
|
32 * Interface for asynchronous execution. |
|
33 * |
|
34 * @since Series 60 2.6 |
|
35 */ |
|
36 class MVtUiActiveExec |
|
37 { |
|
38 public: // New functions |
|
39 |
|
40 /** |
|
41 * Starts execution of a command. |
|
42 * @param aActiveExec active executor. |
|
43 * @param aState state based on which execution can be started. |
|
44 * @param aNextState next state. |
|
45 * @param aRequest request status, which should be used if operation is |
|
46 * asynchronous. |
|
47 * @return ETrue if operation was synchronous, otherwise EFalse. |
|
48 */ |
|
49 virtual TBool ActiveExecExecuteL( |
|
50 CVtUiActiveExec& aActiveExec, |
|
51 const TInt aState, |
|
52 TInt& aNextState, |
|
53 TRequestStatus& aRequest ) = 0; |
|
54 |
|
55 /** |
|
56 * Decide whether to continue or not. |
|
57 * @param aActiveExec active executor. |
|
58 * @param aState current state, should be updated to new state. |
|
59 * @param aError error code. |
|
60 * @return ETrue if continued, EFalse if stopped. |
|
61 */ |
|
62 virtual TBool ActiveExecContinue( |
|
63 CVtUiActiveExec& aActiveExec, |
|
64 TInt& aState, |
|
65 const TInt aError ) = 0; |
|
66 |
|
67 /** |
|
68 * Cancels operation of specific state. |
|
69 * @param aActiveExec active executor. |
|
70 * @param aState state. |
|
71 */ |
|
72 virtual void ActiveExecCancel( |
|
73 CVtUiActiveExec& aActiveExec, |
|
74 const TInt aState ) = 0; |
|
75 |
|
76 /** |
|
77 * Informs that operation has been finished. |
|
78 * @param aActiveExec active executor. |
|
79 * @param aInitialState initial state. |
|
80 */ |
|
81 virtual void ActiveExecDone( |
|
82 CVtUiActiveExec& aActiveExec, |
|
83 const TInt aInitialState ) = 0; |
|
84 |
|
85 }; |
|
86 |
|
87 /** |
|
88 * Asynchronous execution class for Video Telephone application. |
|
89 * |
|
90 * @since Series 60 2.6 |
|
91 */ |
|
92 class CVtUiActiveExec |
|
93 : public CActive |
|
94 { |
|
95 public: // Constructors and destructor |
|
96 |
|
97 /** |
|
98 * Constructor. |
|
99 * @param aPriority priority of the active object. |
|
100 */ |
|
101 CVtUiActiveExec( |
|
102 const TInt aPriority ); |
|
103 |
|
104 /** |
|
105 * Destructor. |
|
106 */ |
|
107 ~CVtUiActiveExec(); |
|
108 |
|
109 public: // New functions |
|
110 |
|
111 /** |
|
112 * Starts execution. |
|
113 * @param aStartState initial state. |
|
114 * @param aExec executor. |
|
115 */ |
|
116 void Start( |
|
117 TInt aStartState, |
|
118 MVtUiActiveExec& aExec ); |
|
119 |
|
120 /** |
|
121 * Initial state of currently |
|
122 * active operation. |
|
123 * |
|
124 * @return initial state, or KErrNotFound if no operation ongoing. |
|
125 */ |
|
126 TInt InitialState() const; |
|
127 |
|
128 /** |
|
129 * Returns request status. |
|
130 * @return request status. |
|
131 */ |
|
132 TInt RequestStatus() const; |
|
133 |
|
134 public: // Functions from base classes |
|
135 |
|
136 /** |
|
137 * @see CActive::RunL. |
|
138 */ |
|
139 virtual void RunL(); |
|
140 |
|
141 /** |
|
142 * @see CActive::DoCancel. |
|
143 */ |
|
144 virtual void DoCancel(); |
|
145 |
|
146 /** |
|
147 * @see CActive::RunError. |
|
148 */ |
|
149 virtual TInt RunError( TInt aError ); |
|
150 |
|
151 private: |
|
152 |
|
153 // Ref to active executor. |
|
154 MVtUiActiveExec* iActiveExec; |
|
155 |
|
156 // Initial state. |
|
157 TInt iInitialState; |
|
158 |
|
159 // Current state. |
|
160 TInt iCurrentState; |
|
161 |
|
162 // Next state. |
|
163 TInt iNextState; |
|
164 |
|
165 }; |
|
166 |
|
167 #endif // CVTUIACTIVEEXEC_H |
|
168 |
|
169 // End of File |