1 /* |
|
2 * Copyright (c) 2002-2005 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: Receives call handling related key presses from accessories and |
|
15 * executes them. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 // INCLUDE FILES |
|
22 #include "phonehandlercontrol.h" |
|
23 #include "phonehandlerservice.h" |
|
24 #include "phonehandleranswercall.h" |
|
25 #include "phonehandlerendcall.h" |
|
26 #include "phonehandlerdialcall.h" |
|
27 #include "phonehandlervoicedial.h" |
|
28 #include "phonehandlerredial.h" |
|
29 #include "phonehandlermultipartycall.h" |
|
30 #include "phonehandlerdtmf.h" |
|
31 #include "phonehandleractive.h" |
|
32 #include "phonehandlerresponse.h" |
|
33 #include "phonehandlercallstate.h" |
|
34 #include "phonehandlerdebug.h" |
|
35 #include <remconinterfaceselector.h> |
|
36 #include <RemConCallHandlingTarget.h> |
|
37 #include <ctsydomainpskeys.h> |
|
38 |
|
39 #if 0 |
|
40 #include <voiceuidomainpskeys.h> |
|
41 #endif |
|
42 |
|
43 #include <connect/sbdefs.h> |
|
44 |
|
45 // EXTERNAL DATA STRUCTURES |
|
46 |
|
47 // EXTERNAL FUNCTION PROTOTYPES |
|
48 |
|
49 // CONSTANTS |
|
50 |
|
51 // MACROS |
|
52 |
|
53 // LOCAL CONSTANTS AND MACROS |
|
54 |
|
55 // MODULE DATA STRUCTURES |
|
56 |
|
57 // LOCAL FUNCTION PROTOTYPES |
|
58 const TInt KMultipartyCallMinParam = 1; |
|
59 const TInt KMultipartyCallMaxParam = 2; |
|
60 |
|
61 // FORWARD DECLARATIONS |
|
62 |
|
63 // ============================= LOCAL FUNCTIONS =============================== |
|
64 |
|
65 |
|
66 // ============================ MEMBER FUNCTIONS =============================== |
|
67 |
|
68 // ----------------------------------------------------------------------------- |
|
69 // CPhoneHandlerControl::CPhoneHandlerControl |
|
70 // C++ default constructor can NOT contain any code, that |
|
71 // might leave. |
|
72 // ----------------------------------------------------------------------------- |
|
73 // |
|
74 CPhoneHandlerControl::CPhoneHandlerControl() |
|
75 : iPrevState( EPSCTsyCallStateNone ) |
|
76 { |
|
77 } |
|
78 |
|
79 // ----------------------------------------------------------------------------- |
|
80 // CPhoneHandlerControl::ConstructL |
|
81 // Symbian 2nd phase constructor can leave. |
|
82 // ----------------------------------------------------------------------------- |
|
83 // |
|
84 void CPhoneHandlerControl::ConstructL( CRemConInterfaceSelector* aIfSelector ) |
|
85 { |
|
86 COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::ConstructL() start" ); |
|
87 |
|
88 if( !aIfSelector ) |
|
89 { |
|
90 COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::ConstructL() Create connection to RemCon." ); |
|
91 |
|
92 // Target connection to RemCon FW hasn't been done. |
|
93 iInterfaceSelector = CRemConInterfaceSelector::NewL(); |
|
94 iTarget = CRemConCallHandlingTarget::NewL( *iInterfaceSelector, *this ); |
|
95 iInterfaceSelector->OpenTargetL(); |
|
96 } |
|
97 else |
|
98 { |
|
99 COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::ConstructL() Don't create connection to RemCon." ); |
|
100 |
|
101 // Connection to RemCon FW as target has already been done in a process. |
|
102 iTarget = CRemConCallHandlingTarget::NewL( *aIfSelector, *this ); |
|
103 } |
|
104 |
|
105 iResponse = CPhoneHandlerResponse::NewL( *this ); |
|
106 iCallStateObserver = CPhoneHandlerCallState::NewL( *this ); |
|
107 |
|
108 COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::ConstructL() end" ); |
|
109 } |
|
110 |
|
111 // ----------------------------------------------------------------------------- |
|
112 // CPhoneHandlerControl::NewL |
|
113 // Two-phased constructor. |
|
114 // ----------------------------------------------------------------------------- |
|
115 // |
|
116 CPhoneHandlerControl* CPhoneHandlerControl::NewL( |
|
117 CRemConInterfaceSelector* aIfSelector ) |
|
118 { |
|
119 COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::NewL() start" ); |
|
120 |
|
121 CPhoneHandlerControl* self = new ( ELeave ) CPhoneHandlerControl(); |
|
122 |
|
123 CleanupStack::PushL( self ); |
|
124 self->ConstructL( aIfSelector ); |
|
125 CleanupStack::Pop( self ); |
|
126 |
|
127 COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::NewL() end" ); |
|
128 |
|
129 return self; |
|
130 } |
|
131 |
|
132 // Destructor |
|
133 CPhoneHandlerControl::~CPhoneHandlerControl() |
|
134 { |
|
135 COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::~CPhoneHandlerControl() start" ); |
|
136 |
|
137 if( iInterfaceSelector ) |
|
138 { |
|
139 delete iInterfaceSelector; |
|
140 } |
|
141 |
|
142 if( iResponse ) |
|
143 { |
|
144 iResponse->Delete(); |
|
145 } |
|
146 |
|
147 if( iCallStateObserver ) |
|
148 { |
|
149 delete iCallStateObserver; |
|
150 } |
|
151 |
|
152 COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::~CPhoneHandlerControl() end" ); |
|
153 } |
|
154 |
|
155 // ----------------------------------------------------------------------------- |
|
156 // CPhoneHandlerControl::TelephoneNumber |
|
157 // Provides phone number for service. |
|
158 // (other items were commented in a header). |
|
159 // ----------------------------------------------------------------------------- |
|
160 // |
|
161 const TPhCltTelephoneNumber& |
|
162 CPhoneHandlerControl::TelephoneNumber() const |
|
163 { |
|
164 return iTelNumber; |
|
165 } |
|
166 |
|
167 // ----------------------------------------------------------------------------- |
|
168 // CPhoneHandlerControl::VoiceDialStatus |
|
169 // Provides voice dial status for service. |
|
170 // (other items were commented in a header). |
|
171 // ----------------------------------------------------------------------------- |
|
172 // |
|
173 const TBool& |
|
174 CPhoneHandlerControl::VoiceDialStatus() const |
|
175 { |
|
176 return iActivate; |
|
177 } |
|
178 |
|
179 // ----------------------------------------------------------------------------- |
|
180 // CPhoneHandlerControl::ChldCommand |
|
181 // Provides CHLD command for service. |
|
182 // (other items were commented in a header). |
|
183 // ----------------------------------------------------------------------------- |
|
184 // |
|
185 const TInt& |
|
186 CPhoneHandlerControl::ChldCommand() const |
|
187 { |
|
188 return iChldCommand; |
|
189 } |
|
190 |
|
191 // ----------------------------------------------------------------------------- |
|
192 // CPhoneHandlerControl::ChldCallNumber |
|
193 // Provides CHLD call number for service. |
|
194 // (other items were commented in a header). |
|
195 // ----------------------------------------------------------------------------- |
|
196 // |
|
197 const TInt& |
|
198 CPhoneHandlerControl::ChldCallNumber() const |
|
199 { |
|
200 return iChldCallNumber; |
|
201 } |
|
202 |
|
203 // ----------------------------------------------------------------------------- |
|
204 // CPhoneHandlerControl::Tone |
|
205 // Provides DTMF tone for service. |
|
206 // (other items were commented in a header). |
|
207 // ----------------------------------------------------------------------------- |
|
208 // |
|
209 const TChar& |
|
210 CPhoneHandlerControl::Tone() const |
|
211 { |
|
212 return iChar; |
|
213 } |
|
214 |
|
215 // ----------------------------------------------------------------------------- |
|
216 // CPhoneHandlerControl::CommandInitiator |
|
217 // Provides API that service uses to send reponse to command. |
|
218 // (other items were commented in a header). |
|
219 // ----------------------------------------------------------------------------- |
|
220 // |
|
221 CRemConCallHandlingTarget& |
|
222 CPhoneHandlerControl::CommandInitiator() const |
|
223 { |
|
224 return *iTarget; |
|
225 } |
|
226 |
|
227 // ----------------------------------------------------------------------------- |
|
228 // CPhoneHandlerControl::NotifyCallState |
|
229 // (other items were commented in a header). |
|
230 // ----------------------------------------------------------------------------- |
|
231 // |
|
232 void CPhoneHandlerControl::NotifyCallState( const TInt aState ) |
|
233 { |
|
234 COM_TRACE_1( "[PHONECMDHANDLER] CPhoneHandlerControl::NotifyCallState() aState=%d", aState ); |
|
235 |
|
236 if( aState == EPSCTsyCallStateConnected && iPrevState != EPSCTsyCallStateHold ) |
|
237 { |
|
238 COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::NotifyCallState(): iActiveCalls++" ); |
|
239 |
|
240 iActiveCalls++; |
|
241 } |
|
242 else if( aState == EPSCTsyCallStateDisconnecting && |
|
243 ( iPrevState == EPSCTsyCallStateConnected || iPrevState == EPSCTsyCallStateHold )) |
|
244 { |
|
245 COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::NotifyCallState(): iActiveCalls--" ); |
|
246 |
|
247 iActiveCalls--; |
|
248 } |
|
249 else if( aState == EPSCTsyCallStateNone ) |
|
250 { |
|
251 COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::NotifyCallState(): iActiveCalls = 0" ); |
|
252 iActiveCalls = 0; |
|
253 } |
|
254 |
|
255 iPrevState = aState; |
|
256 COM_TRACE_1( "[PHONECMDHANDLER] CPhoneHandlerControl::NotifyCallState() iActiveCalls=%d", iActiveCalls ); |
|
257 } |
|
258 |
|
259 // ----------------------------------------------------------------------------- |
|
260 // CPhoneHandlerControl::AnswerCall |
|
261 // (other items were commented in a header). |
|
262 // ----------------------------------------------------------------------------- |
|
263 // |
|
264 void CPhoneHandlerControl::AnswerCall() |
|
265 { |
|
266 COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::AnswerCall() start" ); |
|
267 |
|
268 StartProcessing( ERemConExtAnswerCall ); |
|
269 |
|
270 COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::AnswerCall() end" ); |
|
271 } |
|
272 |
|
273 // ----------------------------------------------------------------------------- |
|
274 // CPhoneHandlerControl::EndCall |
|
275 // (other items were commented in a header). |
|
276 // ----------------------------------------------------------------------------- |
|
277 // |
|
278 void CPhoneHandlerControl::EndCall() |
|
279 { |
|
280 COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::EndCall() start" ); |
|
281 |
|
282 StartProcessing( ERemConExtEndCall ); |
|
283 |
|
284 COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::EndCall() end" ); |
|
285 } |
|
286 |
|
287 // ----------------------------------------------------------------------------- |
|
288 // CPhoneHandlerControl::AnswerEndCall |
|
289 // (other items were commented in a header). |
|
290 // ----------------------------------------------------------------------------- |
|
291 // |
|
292 void CPhoneHandlerControl::AnswerEndCall() |
|
293 { |
|
294 COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::AnswerEndCall() start" ); |
|
295 |
|
296 StartProcessing( ERemConExtAnswerEnd ); |
|
297 |
|
298 COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::AnswerEndCall() end" ); |
|
299 } |
|
300 |
|
301 // ----------------------------------------------------------------------------- |
|
302 // CPhoneHandlerControl::VoiceDial |
|
303 // (other items were commented in a header). |
|
304 // ----------------------------------------------------------------------------- |
|
305 // |
|
306 #if 0 // SCB CR EHSA-7APJWF: SIND subscribes to RemCon directly |
|
307 void CPhoneHandlerControl::VoiceDial( const TBool aActivate ) |
|
308 { |
|
309 COM_TRACE_1( "[PHONECMDHANDLER] CPhoneHandlerControl::VoiceDial() aActivate=%d", aActivate ); |
|
310 |
|
311 TInt callState( EPSCTsyCallStateUninitialized ); |
|
312 iProperty.Get( KPSUidCtsyCallInformation, KCTsyCallState, callState ); |
|
313 |
|
314 COM_TRACE_1( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() call state = %d", callState ); |
|
315 |
|
316 if( callState == EPSCTsyCallStateUninitialized || |
|
317 callState == EPSCTsyCallStateNone ) |
|
318 { |
|
319 TInt voiceUiState( KVoiceUiIsClose ); |
|
320 iProperty.Get( KPSUidVoiceUiAccMonitor, KVoiceUiOpenKey, voiceUiState ); |
|
321 |
|
322 if( voiceUiState == KVoiceUiIsOpen ) |
|
323 { |
|
324 COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::VoiceDial() voice UI is open!" ); |
|
325 iProperty.Set( KPSUidVoiceUiAccMonitor , KVoiceUiAccessoryEvent, ERemConExtVoiceDial ); |
|
326 iResponse->SetResponse( ERemConExtVoiceDial, KErrNone ); |
|
327 iResponse->Process(); |
|
328 } |
|
329 else |
|
330 { |
|
331 iActivate = aActivate; |
|
332 StartProcessing( ERemConExtVoiceDial ); |
|
333 } |
|
334 } |
|
335 else |
|
336 { |
|
337 iResponse->SetResponse( ERemConExtVoiceDial, KErrNone ); |
|
338 iResponse->Process(); |
|
339 } |
|
340 |
|
341 COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::VoiceDial() end" ); |
|
342 } |
|
343 #else |
|
344 void CPhoneHandlerControl::VoiceDial( const TBool /*aActivate*/ ) |
|
345 { |
|
346 COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::VoiceDial()" ); |
|
347 |
|
348 iResponse->SetResponse( ERemConExtVoiceDial, KErrNone ); |
|
349 iResponse->Process(); |
|
350 |
|
351 COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::VoiceDial() end" ); |
|
352 } |
|
353 #endif |
|
354 // ----------------------------------------------------------------------------- |
|
355 // CPhoneHandlerControl::LastNumberRedial |
|
356 // (other items were commented in a header). |
|
357 // ----------------------------------------------------------------------------- |
|
358 // |
|
359 void CPhoneHandlerControl::LastNumberRedial( ) |
|
360 { |
|
361 COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::LastNumberRedial() start" ); |
|
362 |
|
363 StartProcessing( ERemConExtLastNumberRedial ); |
|
364 |
|
365 COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::LastNumberRedial() end" ); |
|
366 } |
|
367 |
|
368 // ----------------------------------------------------------------------------- |
|
369 // CPhoneHandlerControl::DialCall |
|
370 // (other items were commented in a header). |
|
371 // ----------------------------------------------------------------------------- |
|
372 // |
|
373 void CPhoneHandlerControl::DialCall( const TDesC8& aTelNumber ) |
|
374 { |
|
375 COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::DialCall() start" ); |
|
376 |
|
377 // Check aTelNumber range |
|
378 if( KPhCltTelephoneNumberLength < aTelNumber.Length() ) |
|
379 { |
|
380 COM_TRACE_1( "[PHONECMDHANDLER] CPhoneHandlerControl::DialCall() number value=%d too long", aTelNumber.Size() ); |
|
381 iResponse->SetResponse( ERemConExtDialCall, KErrArgument ); |
|
382 iResponse->Process(); |
|
383 return; |
|
384 } |
|
385 |
|
386 iTelNumber.Copy( aTelNumber ); |
|
387 |
|
388 StartProcessing( ERemConExtDialCall ); |
|
389 |
|
390 COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::DialCall() end" ); |
|
391 } |
|
392 |
|
393 // ----------------------------------------------------------------------------- |
|
394 // CPhoneHandlerControl::MultipartyCalling |
|
395 // Method supports multiparty call handling according to BT handsfree profile |
|
396 // (HFP) 1.5. BT HFP 1.5 defines contents of aData parameter as follows: 0, 1, |
|
397 // 1<idx>, 2, 2<idx>, 3 and 4, where: |
|
398 // |
|
399 // 0 = Releases all held calls or sets User Determined User Busy (UDUB) for |
|
400 // a waiting call. |
|
401 // 1 = Releases all active calls (if any exist) and accepts the other |
|
402 // (held or waiting) call. |
|
403 // 1<idx> = Releases specified active call only (<idx> = digit from 1 to 9. |
|
404 // Command is e.g. "11" ). |
|
405 // 2 = Places all active calls (if any exist) on hold and accepts the other |
|
406 // (held or waiting) call. |
|
407 // 2<idx> = Request private consultation mode with specified call (<idx> = |
|
408 // from 1 to 9. Command is e.g. "21" ). |
|
409 // (Place all calls on hold EXCEPT the call indicated by <idx>.) |
|
410 // 3 = Adds a held call to the conversation. |
|
411 // 4 = Connects the two calls and disconnects the subscriber from both calls |
|
412 // (Explicit Call Transfer). Support for this value and its associated |
|
413 // functionality is optional for the HF. |
|
414 // |
|
415 // (other items were commented in a header). |
|
416 // ----------------------------------------------------------------------------- |
|
417 // |
|
418 void CPhoneHandlerControl::MultipartyCalling( const TDesC8& aData ) |
|
419 { |
|
420 TBool error( EFalse ); |
|
421 iChldCommand = 0; |
|
422 iChldCallNumber = 0; |
|
423 TBuf8< KRemConExtParamMaxLength > buf( aData ); |
|
424 buf.Trim(); |
|
425 TInt length = buf.Length(); |
|
426 |
|
427 // Check invalid number of characters |
|
428 if ( length < KMultipartyCallMinParam || length > KMultipartyCallMaxParam ) |
|
429 { |
|
430 error = ETrue; |
|
431 } |
|
432 else |
|
433 { |
|
434 TLex8 param; |
|
435 // Set command |
|
436 param.Assign( buf.Mid( 0, 1 ) ); |
|
437 if( param.Val( iChldCommand ) != KErrNone ) |
|
438 { |
|
439 error = ETrue; |
|
440 } |
|
441 else if ( length == KMultipartyCallMaxParam ) |
|
442 { |
|
443 // Set call number |
|
444 param.Assign( buf.Mid(1) ); |
|
445 if( param.Val( iChldCallNumber ) != KErrNone ) |
|
446 { |
|
447 error = ETrue; |
|
448 } |
|
449 } |
|
450 } |
|
451 |
|
452 if( error ) |
|
453 { |
|
454 // Invalid command |
|
455 iResponse->SetResponse( ERemConExt3WaysCalling, KErrArgument ); |
|
456 iResponse->Process(); |
|
457 return; |
|
458 } |
|
459 |
|
460 COM_TRACE_2( "[PHONECMDHANDLER] CPhoneHandlerControl::MultipartyCalling() iChldCommand=%d, iChldCallNumber=%d", iChldCommand, iChldCallNumber ); |
|
461 |
|
462 StartProcessing( ERemConExt3WaysCalling ); |
|
463 |
|
464 COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::MultipartyCalling() end" ); |
|
465 } |
|
466 |
|
467 // ----------------------------------------------------------------------------- |
|
468 // CPhoneHandlerControl::GenerateDTMF |
|
469 // (other items were commented in a header). |
|
470 // ----------------------------------------------------------------------------- |
|
471 // |
|
472 void CPhoneHandlerControl::GenerateDTMF( const TChar aChar ) |
|
473 { |
|
474 COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::GenerateDTMF() start" ); |
|
475 |
|
476 iChar = aChar; |
|
477 |
|
478 StartProcessing( ERemConExtGenerateDTMF ); |
|
479 |
|
480 COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::GenerateDTMF() end" ); |
|
481 } |
|
482 |
|
483 // ----------------------------------------------------------------------------- |
|
484 // CPhoneHandlerControl::SpeedDial |
|
485 // (other items were commented in a header). |
|
486 // ----------------------------------------------------------------------------- |
|
487 // |
|
488 void CPhoneHandlerControl::SpeedDial( const TInt /*aIndex*/ ) |
|
489 { |
|
490 COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::SpeedDial() - Not Supported" ); |
|
491 } |
|
492 |
|
493 // ----------------------------------------------------------------------------- |
|
494 // CPhoneHandlerControl::StartProcessing |
|
495 // Creates an object that executes call handling command received from |
|
496 // accessory. |
|
497 // (other items were commented in a header). |
|
498 // ----------------------------------------------------------------------------- |
|
499 // |
|
500 void CPhoneHandlerControl::StartProcessing( |
|
501 const TRemConExtCallHandlingApiOperationId aOperation ) |
|
502 { |
|
503 COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::StartProcessing() start" ); |
|
504 |
|
505 // Create a service |
|
506 MPhoneHandlerService* service = NULL; |
|
507 TInt error( KErrNone ); |
|
508 TRAP( error, service = CreateServiceL( aOperation ) ); |
|
509 |
|
510 COM_TRACE_1( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() returned %d", error ); |
|
511 |
|
512 if( error ) |
|
513 { |
|
514 COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::StartProcessing(): service wasn't created succesfully." ); |
|
515 |
|
516 // An error happened. Delete service, if it exists. |
|
517 if( service ) |
|
518 { |
|
519 service->Delete(); |
|
520 service = NULL; |
|
521 } |
|
522 |
|
523 iResponse->SetResponse( aOperation, error ); |
|
524 iResponse->Process(); |
|
525 return; |
|
526 } |
|
527 else |
|
528 { |
|
529 // start service |
|
530 service->Process(); |
|
531 iSwitchCall = EFalse; |
|
532 } |
|
533 |
|
534 COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::StartProcessing() end" ); |
|
535 } |
|
536 |
|
537 // ----------------------------------------------------------------------------- |
|
538 // CPhoneHandlerControl::CreateServiceL |
|
539 // (other items were commented in a header). |
|
540 // ----------------------------------------------------------------------------- |
|
541 // |
|
542 MPhoneHandlerService* CPhoneHandlerControl:: |
|
543 CreateServiceL( const TRemConExtCallHandlingApiOperationId aOperation ) |
|
544 { |
|
545 COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() start" ); |
|
546 |
|
547 MPhoneHandlerService* pService = NULL; |
|
548 |
|
549 switch( aOperation ) |
|
550 { |
|
551 case ERemConExtAnswerCall: |
|
552 { |
|
553 COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() - ERemConExtAnswerCall command" ); |
|
554 COM_TRACE_1( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() - iActiveCalls is %d", iActiveCalls ); |
|
555 |
|
556 /* |
|
557 if( iActiveCalls > 0 ) |
|
558 { |
|
559 // Multiparty call |
|
560 iSwitchCall = ETrue; |
|
561 pService = CPhoneHandlerMultipartyCall::NewL( *this ); |
|
562 } |
|
563 else |
|
564 { |
|
565 // non-multiparty call |
|
566 pService = CPhoneHandlerAnswerCall::NewL( *this ); |
|
567 } |
|
568 */ |
|
569 pService = CPhoneHandlerAnswerCall::NewL( *this ); |
|
570 |
|
571 break; |
|
572 } |
|
573 |
|
574 case ERemConExtEndCall: |
|
575 { |
|
576 COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() - ERemConExtEndCall command" ); |
|
577 |
|
578 pService = CPhoneHandlerEndCall::NewL( *this ); |
|
579 |
|
580 break; |
|
581 } |
|
582 |
|
583 case ERemConExtAnswerEnd: |
|
584 { |
|
585 COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() - ERemConExtAnswerEnd command" ); |
|
586 |
|
587 TInt callState( EPSCTsyCallStateUninitialized ); |
|
588 iProperty.Get( KPSUidCtsyCallInformation, KCTsyCallState, callState ); |
|
589 |
|
590 COM_TRACE_1( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() call state = %d", callState ); |
|
591 |
|
592 if( callState != EPSCTsyCallStateUninitialized && |
|
593 callState != EPSCTsyCallStateNone && |
|
594 callState != EPSCTsyCallStateDisconnecting ) |
|
595 { |
|
596 if( callState == EPSCTsyCallStateAlerting || |
|
597 callState == EPSCTsyCallStateDialling || |
|
598 callState == EPSCTsyCallStateAnswering || |
|
599 callState == EPSCTsyCallStateConnected || |
|
600 callState == EPSCTsyCallStateHold ) |
|
601 { |
|
602 pService = CPhoneHandlerEndCall::NewL( *this, |
|
603 aOperation ); |
|
604 } |
|
605 // callState == EPSTelephonyCallStateRinging |
|
606 else |
|
607 { |
|
608 COM_TRACE_1( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() iActiveCalls = %d", iActiveCalls ); |
|
609 if( iActiveCalls > 0 ) |
|
610 { |
|
611 // multicall case : End call that has existed longer. |
|
612 // (From UI viewpoint ringing call is in waiting state.) |
|
613 pService = CPhoneHandlerEndCall::NewL( *this, |
|
614 aOperation ); |
|
615 if( callState == EPSCTsyCallStateRinging ) |
|
616 { |
|
617 // In multiparty case the telephony key is not |
|
618 // updated. The call amount is updated manually. |
|
619 iActiveCalls--; |
|
620 } |
|
621 } |
|
622 else |
|
623 { |
|
624 pService = CPhoneHandlerAnswerCall::NewL( |
|
625 *this, |
|
626 aOperation ); |
|
627 } |
|
628 } |
|
629 } |
|
630 else |
|
631 { |
|
632 // Send / end button was pressed when there were not |
|
633 // any calls active. Response has to be sent back to accessory |
|
634 // at least for following reasons: |
|
635 |
|
636 // 1. RemCon FW releases message related memory only when response |
|
637 // is sent back to accessory. |
|
638 |
|
639 // 2. BT accessory key press producing ERemConExtAnswerEnd |
|
640 // operation has some other meaning than answer/end call |
|
641 // and it's processed by proper client. However, there |
|
642 // might be a situation where proper client isn't active |
|
643 // and can't process command. In any case RemCon/BT accessory |
|
644 // requires response to command. That's why PhoneCmdHandler |
|
645 // sends reponse to command. |
|
646 |
|
647 iResponse->SetResponse( aOperation, KErrNone ); |
|
648 pService = iResponse; |
|
649 } |
|
650 break; |
|
651 } |
|
652 |
|
653 case ERemConExtDialCall: |
|
654 { |
|
655 COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() - ERemConExtDialCall command" ); |
|
656 |
|
657 pService = CPhoneHandlerDialCall::NewL( *this ); |
|
658 break; |
|
659 } |
|
660 |
|
661 case ERemConExtVoiceDial: |
|
662 { |
|
663 COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() - ERemConExtVoiceDial command" ); |
|
664 |
|
665 pService = CPhoneHandlerVoiceDial::NewL( *this ); |
|
666 break; |
|
667 } |
|
668 |
|
669 case ERemConExtLastNumberRedial: |
|
670 { |
|
671 COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() - ERemConExtLastNumberRedial command" ); |
|
672 |
|
673 pService = CPhoneHandlerLastNumberRedial::NewL( *this ); |
|
674 break; |
|
675 } |
|
676 |
|
677 case ERemConExt3WaysCalling: |
|
678 { |
|
679 COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() - ERemConExt3WaysCalling command" ); |
|
680 |
|
681 pService = CPhoneHandlerMultipartyCall::NewL( *this ); |
|
682 break; |
|
683 } |
|
684 |
|
685 case ERemConExtGenerateDTMF: |
|
686 { |
|
687 COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() - ERemConExtGenerateDTMF command" ); |
|
688 |
|
689 pService = CPhoneHandlerDTMF::NewL( *this ); |
|
690 break; |
|
691 } |
|
692 |
|
693 default: |
|
694 { |
|
695 COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() Unspecified state" ); |
|
696 break; |
|
697 } |
|
698 }; |
|
699 |
|
700 COM_TRACE_1( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() end, %d", pService ); |
|
701 return pService; |
|
702 } |
|
703 |
|
704 // ----------------------------------------------------------------------------- |
|
705 // CPhoneHandlerControl::SwitchCall |
|
706 // (other items were commented in a header). |
|
707 // ----------------------------------------------------------------------------- |
|
708 // |
|
709 TBool CPhoneHandlerControl::SwitchCall() |
|
710 { |
|
711 return iSwitchCall; |
|
712 } |
|
713 // ======================== OTHER EXPORTED FUNCTIONS =========================== |
|
714 |
|
715 // End of File |
|