|
1 /* |
|
2 * Copyright (c) 2006-2008 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: Default implementations for the VCC state machine functions |
|
15 * |
|
16 */ |
|
17 |
|
18 #include "tvccstate.h" |
|
19 #include "cvccperformer.h" |
|
20 #include "rubydebug.h" |
|
21 |
|
22 |
|
23 // ----------------------------------------------------------------------------- |
|
24 // c'tor |
|
25 // ----------------------------------------------------------------------------- |
|
26 // |
|
27 |
|
28 TVccState::TVccState() |
|
29 { |
|
30 RUBY_DEBUG_BLOCK( "TVccState::TVccState" ); |
|
31 } |
|
32 |
|
33 |
|
34 // ----------------------------------------------------------------------------- |
|
35 // User has answered the incoming call |
|
36 // ----------------------------------------------------------------------------- |
|
37 // |
|
38 TInt TVccState::Answer( MCCPCall& aCall ) |
|
39 { |
|
40 RUBY_DEBUG_BLOCK( "TVccState::Answer" ); |
|
41 return aCall.Answer(); |
|
42 } |
|
43 |
|
44 // ----------------------------------------------------------------------------- |
|
45 // User has rejected the incoming call |
|
46 // ----------------------------------------------------------------------------- |
|
47 // |
|
48 TInt TVccState::Reject( MCCPCall& aCall ) |
|
49 { |
|
50 RUBY_DEBUG_BLOCK( "TVccState::Reject" ); |
|
51 return aCall.Reject(); |
|
52 } |
|
53 |
|
54 // ----------------------------------------------------------------------------- |
|
55 // Queue incoming call |
|
56 // ----------------------------------------------------------------------------- |
|
57 // |
|
58 TInt TVccState::Queue( MCCPCall& aCall ) |
|
59 { |
|
60 RUBY_DEBUG_BLOCK( "TVccState::Queue" ); |
|
61 return aCall.Queue(); |
|
62 } |
|
63 |
|
64 // ----------------------------------------------------------------------------- |
|
65 // Dial a new call |
|
66 // ----------------------------------------------------------------------------- |
|
67 // |
|
68 TInt TVccState::Dial( MCCPCall& aCall ) |
|
69 { |
|
70 RUBY_DEBUG_BLOCK( "TVccState::Dial" ); |
|
71 return aCall.Dial(); |
|
72 } |
|
73 |
|
74 // ----------------------------------------------------------------------------- |
|
75 // MT call user ringing now |
|
76 // ----------------------------------------------------------------------------- |
|
77 // |
|
78 TInt TVccState::Ringing( MCCPCall& aCall ) |
|
79 { |
|
80 RUBY_DEBUG_BLOCK( "TVccState::Ringing" ); |
|
81 return aCall.Ringing(); |
|
82 } |
|
83 |
|
84 // ----------------------------------------------------------------------------- |
|
85 // End current call |
|
86 // ----------------------------------------------------------------------------- |
|
87 // |
|
88 TInt TVccState::HangUp( CVccPerformer& /*aContext*/, MCCPCall& aCall ) |
|
89 { |
|
90 RUBY_DEBUG_BLOCK( "TVccState::HangUp" ); |
|
91 return aCall.HangUp(); |
|
92 |
|
93 } |
|
94 |
|
95 // ----------------------------------------------------------------------------- |
|
96 // Cancel ongoing request |
|
97 // ----------------------------------------------------------------------------- |
|
98 // |
|
99 TInt TVccState::Cancel( MCCPCall& aCall ) |
|
100 { |
|
101 RUBY_DEBUG_BLOCK( "TVccState::Cancel" ); |
|
102 return aCall.Cancel(); |
|
103 } |
|
104 |
|
105 |
|
106 // ----------------------------------------------------------------------------- |
|
107 // Hold call |
|
108 // ----------------------------------------------------------------------------- |
|
109 // |
|
110 TInt TVccState::Hold( MCCPCall& aCall ) |
|
111 { |
|
112 RUBY_DEBUG_BLOCK( "TVccState::Hold" ); |
|
113 return aCall.Hold(); |
|
114 |
|
115 } |
|
116 |
|
117 |
|
118 // ----------------------------------------------------------------------------- |
|
119 // Resume held call |
|
120 // ----------------------------------------------------------------------------- |
|
121 // |
|
122 TInt TVccState::Resume( MCCPCall& aCall ) |
|
123 { |
|
124 RUBY_DEBUG_BLOCK( "TVccState::Resume" ); |
|
125 return aCall.Resume(); |
|
126 } |
|
127 |
|
128 |
|
129 // ----------------------------------------------------------------------------- |
|
130 // Swap hold/resume states |
|
131 // ----------------------------------------------------------------------------- |
|
132 // |
|
133 TInt TVccState::Swap( MCCPCall& /*aCall*/ ) |
|
134 { |
|
135 RUBY_DEBUG_BLOCK( "TVccState::Swap" ); |
|
136 //return aCall.Swap(); |
|
137 return KErrArgument; //not allowed |
|
138 |
|
139 } |
|
140 |
|
141 |
|
142 // ----------------------------------------------------------------------------- |
|
143 // Get call recipient |
|
144 // ----------------------------------------------------------------------------- |
|
145 // |
|
146 const TDesC& TVccState::RemoteParty( const MCCPCall& aCall ) const |
|
147 { |
|
148 RUBY_DEBUG_BLOCK( "TVccState::RemoteParty" ); |
|
149 return aCall.RemoteParty(); |
|
150 } |
|
151 |
|
152 |
|
153 // ----------------------------------------------------------------------------- |
|
154 // Get call recipient |
|
155 // ----------------------------------------------------------------------------- |
|
156 // |
|
157 const TDesC& TVccState::DialledParty( const MCCPCall& aCall ) const |
|
158 { |
|
159 RUBY_DEBUG_BLOCK( "TVccState::DialledParty" ); |
|
160 return aCall.DialledParty(); |
|
161 |
|
162 } |
|
163 |
|
164 |
|
165 |
|
166 // ----------------------------------------------------------------------------- |
|
167 // Is call forwarded or not |
|
168 // ----------------------------------------------------------------------------- |
|
169 // |
|
170 TBool TVccState::IsCallForwarded( const MCCPCall& aCall ) const |
|
171 { |
|
172 RUBY_DEBUG_BLOCK( "TVccState::IsCallForwarded" ); |
|
173 return aCall.IsCallForwarded(); |
|
174 } |
|
175 |
|
176 |
|
177 // ----------------------------------------------------------------------------- |
|
178 // Is call mobile originated or not |
|
179 // ----------------------------------------------------------------------------- |
|
180 // |
|
181 TBool TVccState::IsMobileOriginated( const MCCPCall& aCall ) const |
|
182 { |
|
183 RUBY_DEBUG_BLOCK( "TVccState::IsMobileOriginated" ); |
|
184 return aCall.IsMobileOriginated(); |
|
185 } |
|
186 |
|
187 |
|
188 // ----------------------------------------------------------------------------- |
|
189 // Get current call state |
|
190 // ----------------------------------------------------------------------------- |
|
191 // |
|
192 MCCPCallObserver::TCCPCallState TVccState::State( const MCCPCall& aCall ) const |
|
193 { |
|
194 RUBY_DEBUG_BLOCK( "TVccState::State" ); |
|
195 return aCall.State(); |
|
196 } |
|
197 |
|
198 |
|
199 // ----------------------------------------------------------------------------- |
|
200 // get call capabilities |
|
201 // ----------------------------------------------------------------------------- |
|
202 // |
|
203 MCCPCallObserver::TCCPCallControlCaps TVccState::Caps( const MCCPCall& aCall ) const |
|
204 { |
|
205 RUBY_DEBUG_BLOCK( "TVccState::Caps" ); |
|
206 return aCall.Caps(); |
|
207 } |
|
208 |
|
209 // ----------------------------------------------------------------------------- |
|
210 // SecureSpecified |
|
211 // ----------------------------------------------------------------------------- |
|
212 // |
|
213 TBool TVccState::SecureSpecified( const MCCPCall& aCall ) const |
|
214 { |
|
215 return aCall.SecureSpecified(); |
|
216 } |
|
217 |
|
218 // ----------------------------------------------------------------------------- |
|
219 // Is call secured |
|
220 // ----------------------------------------------------------------------------- |
|
221 // |
|
222 TBool TVccState::IsSecured( const MCCPCall& aCall ) const |
|
223 { |
|
224 RUBY_DEBUG_BLOCK( "TVccState::IsSecured" ); |
|
225 return aCall.IsSecured(); |
|
226 } |
|
227 |
|
228 |
|
229 // ----------------------------------------------------------------------------- |
|
230 // Set paramaters |
|
231 // ----------------------------------------------------------------------------- |
|
232 // |
|
233 void TVccState::SetParameters( const CCCPCallParameters& /*aNewParams*/ ) |
|
234 { |
|
235 RUBY_DEBUG_BLOCK( "TVccState::SetParameters" ); |
|
236 //not implemented |
|
237 } |
|
238 |
|
239 // ----------------------------------------------------------------------------- |
|
240 // Get paramaters |
|
241 // ----------------------------------------------------------------------------- |
|
242 // |
|
243 const CCCPCallParameters& TVccState::Parameters( const MCCPCall& aCall ) const |
|
244 { |
|
245 RUBY_DEBUG_BLOCK( "TVccState::Parameters" ); |
|
246 return aCall.Parameters(); |
|
247 |
|
248 } |
|
249 |
|
250 // ----------------------------------------------------------------------------- |
|
251 // Return used tone. |
|
252 // ----------------------------------------------------------------------------- |
|
253 // |
|
254 TCCPTone TVccState::Tone( const MCCPCall& aCall ) const |
|
255 { |
|
256 RUBY_DEBUG_BLOCK( "TVccState::Tone" ); |
|
257 return aCall.Tone(); |
|
258 } |
|
259 |
|
260 |
|
261 // ----------------------------------------------------------------------------- |
|
262 // Add observer. |
|
263 // ----------------------------------------------------------------------------- |
|
264 // |
|
265 void TVccState::AddObserverL( const MCCPCallObserver& aObserver, |
|
266 MCCPCall& aCall ) |
|
267 { |
|
268 RUBY_DEBUG_BLOCKL( "TVccState::AddObserverL" ); |
|
269 aCall.AddObserverL(aObserver); |
|
270 } |
|
271 |
|
272 // ----------------------------------------------------------------------------- |
|
273 // Add observer. |
|
274 // ----------------------------------------------------------------------------- |
|
275 // |
|
276 TInt TVccState::RemoveObserver( const MCCPCallObserver& aObserver, |
|
277 MCCPCall& aCall ) |
|
278 { |
|
279 RUBY_DEBUG_BLOCK( "TVccState::RemoveObserver" ); |
|
280 return aCall.RemoveObserver(aObserver); |
|
281 } |
|
282 |
|
283 |
|
284 // ----------------------------------------------------------------------------- |
|
285 // Dial from MCCPCSCall |
|
286 // ----------------------------------------------------------------------------- |
|
287 // |
|
288 TInt TVccState::Dial( const TDesC8& aCallParams, MCCPCSCall& aCall ) |
|
289 { |
|
290 RUBY_DEBUG_BLOCK( "TVccState::Dial" ); |
|
291 return aCall.Dial(aCallParams); |
|
292 //!!!!!!!!!!!!!!-> check if "if" is really as this cannot be really invoked |
|
293 // for non-cs call |
|
294 } |
|
295 |
|
296 // ----------------------------------------------------------------------------- |
|
297 // NoFDNCheck from MCCPCSCall |
|
298 // ----------------------------------------------------------------------------- |
|
299 // |
|
300 void TVccState::NoFDNCheck( MCCPCSCall& aCall ) |
|
301 { |
|
302 RUBY_DEBUG_BLOCK( "TVccState::NoFDNCheck" ); |
|
303 aCall.NoFDNCheck(); |
|
304 } |
|
305 |
|
306 // ----------------------------------------------------------------------------- |
|
307 // GetMobileCallInfo from MCCPCSCall |
|
308 // ----------------------------------------------------------------------------- |
|
309 // |
|
310 TInt TVccState::GetMobileCallInfo( TDes8& aCallInfo, |
|
311 const MCCPCSCall& aCall ) const |
|
312 { |
|
313 RUBY_DEBUG_BLOCK( "TVccState::GetMobileCallInfo" ); |
|
314 return aCall.GetMobileCallInfo(aCallInfo); |
|
315 |
|
316 } |
|
317 |
|
318 // ----------------------------------------------------------------------------- |
|
319 // SwitchAlternatingCall from MCCPCSCall |
|
320 // ----------------------------------------------------------------------------- |
|
321 // |
|
322 TInt TVccState::SwitchAlternatingCall( MCCPCSCall& aCall ) |
|
323 { |
|
324 RUBY_DEBUG_BLOCK( "TVccState::SwitchAlternatingCall" ); |
|
325 return aCall.SwitchAlternatingCall(); |
|
326 } |
|
327 |
|
328 // ----------------------------------------------------------------------------- |
|
329 // SwitchAlternatingCall from MCCPCSCall |
|
330 // ----------------------------------------------------------------------------- |
|
331 // |
|
332 TInt TVccState::GetMobileDataCallCaps( TDes8& aCaps, |
|
333 const MCCPCSCall& aCall) const |
|
334 { |
|
335 RUBY_DEBUG_BLOCK( "TVccState::GetMobileDataCallCaps" ); |
|
336 return aCall.GetMobileDataCallCaps(aCaps); |
|
337 } |
|
338 |
|
339 // ----------------------------------------------------------------------------- |
|
340 // LogDialedNumber from MCCPCSCall |
|
341 // ----------------------------------------------------------------------------- |
|
342 // |
|
343 TBool TVccState::LogDialedNumber( const MCCPCSCall& aCall ) const |
|
344 { |
|
345 RUBY_DEBUG_BLOCK( "TVccState::GetMobileDataCallCaps" ); |
|
346 return aCall.LogDialedNumber(); |
|
347 } |
|
348 // Releases ongoing call |
|
349 // ----------------------------------------------------------------------------- |
|
350 // |
|
351 TInt TVccState::ReleaseCall( MCCPCall& aCall, |
|
352 RPointerArray<CConvergedCallProvider>& aProvs ) |
|
353 { |
|
354 RUBY_DEBUG_BLOCK( "TVccState::ReleaseCall" ); |
|
355 TInt err = KErrNotFound; |
|
356 for (TUint i=0; i < aProvs.Count(); i++) |
|
357 { |
|
358 err = aProvs[i]->ReleaseCall(aCall); |
|
359 if (err == KErrNone) |
|
360 { |
|
361 break; |
|
362 } |
|
363 } |
|
364 return err; |
|
365 } |
|
366 |
|
367 // ----------------------------------------------------------------------------- |
|
368 // Releases ongoing call |
|
369 // ----------------------------------------------------------------------------- |
|
370 // |
|
371 TInt TVccState::ReleaseCall(CVccPerformer& aContext, |
|
372 MCCPCall& aCall, |
|
373 TVccState& aState, |
|
374 TUint aHoValue ) |
|
375 { |
|
376 RUBY_DEBUG_BLOCK( "TVccState::ReleaseCall" ); |
|
377 TInt err = KErrNotFound; |
|
378 err = aContext.CsProvider().ReleaseCall(aCall); |
|
379 if (err!=KErrNone) |
|
380 { |
|
381 aContext.PsProvider().ReleaseCall(aCall); |
|
382 } |
|
383 |
|
384 if( aHoValue == KVccHoNok ) |
|
385 { |
|
386 //MT party of the call disconnected the call during HO |
|
387 TRAP_IGNORE(aContext.Notifier().NotifySubscriberL( EVccCsToPsHoFailure, |
|
388 KErrGeneral ) ); |
|
389 } |
|
390 else |
|
391 { |
|
392 aContext.HandoverReady(); |
|
393 TRAP_IGNORE(aContext.Notifier().NotifySubscriberL(EVccCsToPsHoSuccessful, |
|
394 KErrNone) ); |
|
395 } |
|
396 //-> Set Next State |
|
397 aContext.SetState(aState); |
|
398 return err; |
|
399 } |
|
400 |
|
401 // ----------------------------------------------------------------------------- |
|
402 // From MCCPCallObserver |
|
403 // ----------------------------------------------------------------------------- |
|
404 // |
|
405 void TVccState::ErrorOccurred(CVccPerformer& /*aContext*/, |
|
406 const TCCPError /*aError*/, |
|
407 MCCPCall* /*aCall*/ ) |
|
408 { |
|
409 RUBY_DEBUG_BLOCK( "TVccState::ErrorOccurred" ); |
|
410 } |
|
411 |
|
412 // ----------------------------------------------------------------------------- |
|
413 // From MCCPCallObserver |
|
414 // ----------------------------------------------------------------------------- |
|
415 // |
|
416 void TVccState::CallStateChanged(CVccPerformer& /*aContext*/, |
|
417 const MCCPCallObserver::TCCPCallState /*aState*/, |
|
418 MCCPCall* /*aCall*/ ) |
|
419 { |
|
420 RUBY_DEBUG_BLOCK( "TVccState::CallStateChanged" ); |
|
421 } |
|
422 |
|
423 // ----------------------------------------------------------------------------- |
|
424 // From MCCPCallObserver |
|
425 // ----------------------------------------------------------------------------- |
|
426 // |
|
427 void TVccState::CallStateChangedWithInband(CVccPerformer& /*aContext*/, |
|
428 const MCCPCallObserver::TCCPCallState /*aState*/, |
|
429 MCCPCall* /*aCall*/ ) |
|
430 { |
|
431 RUBY_DEBUG_BLOCK( "TVccState::CallStateChangedWithInband" ); |
|
432 |
|
433 } |
|
434 |
|
435 // ----------------------------------------------------------------------------- |
|
436 // From MCCPCallObserver |
|
437 // ----------------------------------------------------------------------------- |
|
438 // |
|
439 void TVccState::CallEventOccurred(CVccPerformer& /*aContext*/, |
|
440 const MCCPCallObserver::TCCPCallEvent /*aEvent*/, |
|
441 MCCPCall* /*aCall*/ ) |
|
442 { |
|
443 RUBY_DEBUG_BLOCK( "TVccState::CallEventOccurred" ); |
|
444 } |
|
445 // ----------------------------------------------------------------------------- |
|
446 // From MCCPCallObserver |
|
447 // ----------------------------------------------------------------------------- |
|
448 // |
|
449 void TVccState::CallCapsChanged(CVccPerformer& aContext, |
|
450 const TUint32 aCapsFlags, |
|
451 MCCPCall* aCall ) |
|
452 { |
|
453 RUBY_DEBUG_BLOCK( "TVccState::CallCapsChanged" ); |
|
454 aContext.CallObserver()->CallCapsChanged( aCapsFlags, aCall ); |
|
455 } |
|
456 |
|
457 // ----------------------------------------------------------------------------- |
|
458 // SwitchL() |
|
459 // ----------------------------------------------------------------------------- |
|
460 // |
|
461 void TVccState::SwitchL(CVccPerformer& /*aContext*/) |
|
462 { |
|
463 RUBY_DEBUG_BLOCK( "TVccState::SwitchL" ); |
|
464 User::Leave(KErrCompletion); |
|
465 } |