|
1 /* |
|
2 * Copyright (c) 2006 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: Hold controller, interface class for handling hold |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef SVPHOLDCONTROLLER_H |
|
20 #define SVPHOLDCONTROLLER_H |
|
21 |
|
22 #include <e32base.h> |
|
23 #include <mccpcallobserver.h> |
|
24 #include "svpholdcontext.h" |
|
25 #include "svputdefs.h" |
|
26 |
|
27 class CMceSession; |
|
28 class MSVPHoldObserver; |
|
29 class CSVPSessionBase; |
|
30 |
|
31 const TInt KErrSVPHoldErrorBase = -2000; |
|
32 const TInt KErrSVPHoldStateError = KErrSVPHoldErrorBase - 1; |
|
33 const TInt KErrSVPHoldInProgress = KErrSVPHoldErrorBase - 2; |
|
34 const TInt KErrSVPHoldResumeInProgress = KErrSVPHoldErrorBase - 3; |
|
35 const TInt KErrSVPHoldRequestPending = KErrSVPHoldErrorBase - 4; |
|
36 const TInt KErrSVPHoldNotHoldRequest = KErrSVPHoldErrorBase - 5; |
|
37 const TInt KErrSVPHoldUnacceptableResponseAttribute = KErrSVPHoldErrorBase - 6; |
|
38 const TInt KErrSVPHoldLocalOldwayholdNeeded = KErrSVPHoldErrorBase - 7; |
|
39 const TInt KErrSVPHoldRequestProcessingNotReady = KErrSVPHoldErrorBase - 8; |
|
40 |
|
41 |
|
42 /** |
|
43 * Hold controller. |
|
44 * @lib svp.dll |
|
45 * @since Series 60 3.2 |
|
46 */ |
|
47 class CSVPHoldController : public CBase |
|
48 { |
|
49 public: // Constructors and destructor |
|
50 |
|
51 /** |
|
52 * Two-phased constructor. |
|
53 */ |
|
54 static CSVPHoldController* NewL( |
|
55 CMceSession& aSession, |
|
56 TMceTransactionDataContainer& aContainer, |
|
57 MSVPHoldObserver* aObserver, |
|
58 TBool aIsMobileOriginated ); |
|
59 |
|
60 /** |
|
61 * Two-phased constructor. |
|
62 */ |
|
63 static CSVPHoldController* NewLC( |
|
64 CMceSession& aSession, |
|
65 TMceTransactionDataContainer& aContainer, |
|
66 MSVPHoldObserver* aObserver, |
|
67 TBool aIsMobileOriginated ); |
|
68 |
|
69 /** |
|
70 * Destructor. |
|
71 */ |
|
72 virtual ~CSVPHoldController(); |
|
73 |
|
74 public: // Methods |
|
75 |
|
76 /** |
|
77 * Holds session. If hold fails then observer method is called |
|
78 * @since Series 60 3.2 |
|
79 * @param aSession Session object. Ownership not transferred |
|
80 * @return Error code |
|
81 */ |
|
82 TInt HoldSession( CMceSession* aSession ); |
|
83 |
|
84 /** |
|
85 * Resumes session. If resume fails then observer method is called |
|
86 * @since Series 60 3.2 |
|
87 * @param aSession Session object. Ownership not transferred |
|
88 * @return Error code |
|
89 */ |
|
90 TInt ResumeSession( CMceSession* aSession ); |
|
91 |
|
92 /** |
|
93 * Retries previous failed request |
|
94 * @since Series 60 3.2 |
|
95 * @param aSession Session object. Ownership not transferred |
|
96 * @return Error code |
|
97 */ |
|
98 TInt RetryHoldRequest( CMceSession* aSession ); |
|
99 |
|
100 /** |
|
101 * This method must be called after hold/resume expiration time is |
|
102 * exceeded. |
|
103 * @since Series 60 3.2 |
|
104 */ |
|
105 void TimedOut(); |
|
106 |
|
107 /** |
|
108 * Examines incoming request for the case of hold/resume. |
|
109 * @since Series 60 3.2 |
|
110 * @param aSession Session object. Ownership not transferred |
|
111 * @return KErrSVPHoldNot if is other type than hold/resume, |
|
112 * system wide error code or KErrNone if succesful. |
|
113 * If KErrNone, observer methods are called. |
|
114 */ |
|
115 TInt IncomingRequest( CMceSession* aSession ); |
|
116 |
|
117 /** |
|
118 * Examines response for hold request. |
|
119 * @since Series 60 3.2 |
|
120 * @param aSession Session object. Ownership not transferred |
|
121 * @param aStatusCode Status code of the response |
|
122 * @return KErrSVPHoldNotHoldRequest if is other type than hold/resume, |
|
123 * system wide error code or KErrNone if succesful. |
|
124 * If KErrNone, observer methods are called. |
|
125 */ |
|
126 TInt IncomingResponse( CMceSession* aSession, TInt aStatusCode ); |
|
127 |
|
128 /** |
|
129 * Returns ETrue if holding/resuming session is ongoing. |
|
130 * @since Series 60 3.2 |
|
131 * @return ETrue if holding/resuming of session is ongoing |
|
132 */ |
|
133 TBool HoldInProgress() const; |
|
134 |
|
135 /** |
|
136 * Returns ETrue if holding/resuming error caused hold state |
|
137 * to roll back to its previous state |
|
138 * @since Series 60 3.2 |
|
139 * @return ETrue if holding/resuming rolleed back |
|
140 */ |
|
141 TBool HoldRolledBack() const; |
|
142 |
|
143 /** |
|
144 * Returns Hold failed -boolean value. After this function call |
|
145 * flag is cleared. |
|
146 * @since Series 60 3.2 |
|
147 * @return ETrue if hold failed, EFalse otherways |
|
148 */ |
|
149 TBool HoldFailed(); |
|
150 |
|
151 /** |
|
152 * Returns Resume failed -boolean value. If resume has failed, session |
|
153 * must be terminated, and it cannot do before MCE session state is |
|
154 * in connected state. |
|
155 * @since Series 60 3.2 |
|
156 * @return ETrue if resume failed, EFalse otherways |
|
157 */ |
|
158 TBool ResumeFailed(); |
|
159 |
|
160 /** |
|
161 * Continues processing of local hold/resume request. |
|
162 * @since Series 60 3.2 |
|
163 * @param aSession MCE session |
|
164 * @return error code |
|
165 */ |
|
166 TInt ContinueHoldProcessing( CMceSession& aSession ); |
|
167 |
|
168 /** |
|
169 * Hold / Resume request has failed |
|
170 * @since Series 60 3.2 |
|
171 * @param aSession MCE session |
|
172 * @param aStatusCode reason |
|
173 * @param aBase SVP session base |
|
174 * @return error code |
|
175 */ |
|
176 TInt RequestFailed( CMceSession& aSession, TInt aStatusCode, CSVPSessionBase& aBase ); |
|
177 |
|
178 /** |
|
179 * Checks if currently crossover situation |
|
180 * @since Series 60 3.2 |
|
181 * @param aBase SVP session base |
|
182 */ |
|
183 void CheckCrossOver( CSVPSessionBase& aBase ); |
|
184 |
|
185 /** |
|
186 * Returns session hold state |
|
187 * @since Series 60 3.2 |
|
188 * @return Current hold state (Holded only if local stream on hold) |
|
189 */ |
|
190 TSVPSessionHoldState HoldState() const; |
|
191 |
|
192 /** |
|
193 * Returns session hold request type |
|
194 * @since Series 60 3.2 |
|
195 * @return Current hold request type |
|
196 */ |
|
197 TSVPHoldRequestType HoldRequest() const; |
|
198 |
|
199 /** |
|
200 * After completed & succesful IN / OUT Request, returns occurred event. |
|
201 * @since Series 60 3.2 |
|
202 * @return Occurred event to be informed to client application |
|
203 */ |
|
204 MCCPCallObserver::TCCPCallEvent HoldEvent(); |
|
205 |
|
206 /** |
|
207 * Sets mute state to Hold Controller |
|
208 * @since Series 60 3.2 |
|
209 * @param aMuted Boolean value for mute value |
|
210 */ |
|
211 void Muted( TBool aMuted ); |
|
212 |
|
213 /** |
|
214 * Refreshes hold state in local hold state when non-hold re-invite received |
|
215 * @since Series 60 3.2 |
|
216 * @param |
|
217 */ |
|
218 void RefreshHoldStateL(); |
|
219 |
|
220 private: |
|
221 |
|
222 /** |
|
223 * C++ default constructor. |
|
224 */ |
|
225 CSVPHoldController(); |
|
226 |
|
227 /** |
|
228 * By default Symbian 2nd phase constructor is private. |
|
229 */ |
|
230 void ConstructL( CMceSession& aSession, |
|
231 TMceTransactionDataContainer& aContainer, |
|
232 MSVPHoldObserver* aObserver, |
|
233 TBool aIsMobileOriginated ); |
|
234 |
|
235 /** |
|
236 * HoldAllowed |
|
237 */ |
|
238 TBool HoldAllowed(); |
|
239 |
|
240 /** |
|
241 * ResumeAllowed |
|
242 */ |
|
243 TBool ResumeAllowed(); |
|
244 |
|
245 /** |
|
246 * IncomingRequestAllowed |
|
247 */ |
|
248 TBool IncomingRequestAllowed(); |
|
249 |
|
250 /** |
|
251 * IncomingResponseAllowed |
|
252 */ |
|
253 TBool IncomingResponseAllowed(); |
|
254 |
|
255 /** |
|
256 * Refresh hold state |
|
257 * @since S60 3.2 |
|
258 * @param aMediaStream Representation of MCE media stream |
|
259 */ |
|
260 void RefreshL( CMceMediaStream& aMediaStream ); |
|
261 |
|
262 private: // data |
|
263 |
|
264 // Context of hold |
|
265 CSVPHoldContext* iContext; |
|
266 |
|
267 // Previous hold state |
|
268 TSVPHoldState iPreviousHoldState; |
|
269 |
|
270 // Flag for readyness of hold request |
|
271 TBool iHoldRequestCompleted; |
|
272 |
|
273 // Desired hold request for re-Invite crossover case |
|
274 TSVPHoldDesiredTransition iHoldRequest; |
|
275 |
|
276 // Reinvite crossover flag (race condition) |
|
277 TBool iReinviteCrossover; |
|
278 |
|
279 private: |
|
280 |
|
281 // For testing |
|
282 SVP_UT_DEFS |
|
283 |
|
284 }; |
|
285 |
|
286 #endif // SVPHOLDCONTROLLER_H |
|
287 |