227 // ----------------------------------------------------------------------------- |
229 // ----------------------------------------------------------------------------- |
228 // CPhoneHandlerControl::NotifyCallState |
230 // CPhoneHandlerControl::NotifyCallState |
229 // (other items were commented in a header). |
231 // (other items were commented in a header). |
230 // ----------------------------------------------------------------------------- |
232 // ----------------------------------------------------------------------------- |
231 // |
233 // |
232 void CPhoneHandlerControl::NotifyCallState( const TInt aState ) |
234 void CPhoneHandlerControl::NotifyCallStateL( const MCall* aCall ) |
233 { |
235 { |
234 COM_TRACE_1( "[PHONECMDHANDLER] CPhoneHandlerControl::NotifyCallState() aState=%d", aState ); |
236 COM_TRACE_2( "[PHONECMDHANDLER] CPhoneHandlerControl::NotifyCallState() aCall.CallIndex:%d, aCall.CallState:%d", |
235 |
237 aCall->CallIndex(), aCall->CallState() ); |
236 if( aState == EPSCTsyCallStateConnected && iPrevState != EPSCTsyCallStateHold ) |
238 |
237 { |
239 TCallInfo* call = iCallArray->FindCall( aCall->CallIndex() ); |
238 COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::NotifyCallState(): iActiveCalls++" ); |
240 |
239 |
241 if ( call ) |
240 iActiveCalls++; |
242 { |
241 } |
243 // If the call is in idle or disconnecting state it can be removed from the array |
242 else if( aState == EPSCTsyCallStateDisconnecting && |
244 if ( CCPCall::EStateIdle == aCall->CallState() |
243 ( iPrevState == EPSCTsyCallStateConnected || iPrevState == EPSCTsyCallStateHold )) |
245 || CCPCall::EStateDisconnecting == aCall->CallState() ) |
244 { |
246 { |
245 COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::NotifyCallState(): iActiveCalls--" ); |
247 COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::NotifyCallState(): remove call" ); |
246 |
248 iCallArray->Remove( call ); |
247 iActiveCalls--; |
249 } |
248 } |
250 else |
249 else if( aState == EPSCTsyCallStateNone ) |
251 { |
250 { |
252 COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::NotifyCallState(): update existing call" ); |
251 COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::NotifyCallState(): iActiveCalls = 0" ); |
253 iCallArray->Remove( call ); |
252 iActiveCalls = 0; |
254 iCallArray->AddL( aCall ); |
253 } |
255 } |
254 |
256 } |
255 iPrevState = aState; |
257 else |
256 COM_TRACE_1( "[PHONECMDHANDLER] CPhoneHandlerControl::NotifyCallState() iActiveCalls=%d", iActiveCalls ); |
258 { |
257 } |
259 COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::NotifyCallState(): new call" ); |
|
260 iCallArray->AddL( aCall ); |
|
261 } |
|
262 COM_TRACE_3( "[PHONECMDHANDLER] CPhoneHandlerControl::NotifyCallState() connected:%d existing:%d total:%d", |
|
263 iCallArray->ConnectedCallCount(), iCallArray->ExistingCallCount(), iCallArray->CallCount() ); |
|
264 } |
258 |
265 |
259 // ----------------------------------------------------------------------------- |
266 // ----------------------------------------------------------------------------- |
260 // CPhoneHandlerControl::AnswerCall |
267 // CPhoneHandlerControl::AnswerCall |
261 // (other items were commented in a header). |
268 // (other items were commented in a header). |
262 // ----------------------------------------------------------------------------- |
269 // ----------------------------------------------------------------------------- |
263 // |
270 // |
264 void CPhoneHandlerControl::AnswerCall() |
271 void CPhoneHandlerControl::AnswerCall() |
265 { |
272 { |
266 COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::AnswerCall() start" ); |
273 COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::AnswerCall() start" ); |
267 |
274 |
268 StartProcessing( ERemConExtAnswerCall ); |
275 StartProcessing( ERemConExtAnswerCall ); |
269 |
276 |
270 COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::AnswerCall() end" ); |
277 COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::AnswerCall() end" ); |
271 } |
278 } |
272 |
279 |
273 // ----------------------------------------------------------------------------- |
280 // ----------------------------------------------------------------------------- |
274 // CPhoneHandlerControl::EndCall |
281 // CPhoneHandlerControl::EndCall |
275 // (other items were commented in a header). |
282 // (other items were commented in a header). |
276 // ----------------------------------------------------------------------------- |
283 // ----------------------------------------------------------------------------- |
277 // |
284 // |
278 void CPhoneHandlerControl::EndCall() |
285 void CPhoneHandlerControl::EndCall() |
279 { |
286 { |
280 COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::EndCall() start" ); |
287 COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::EndCall() start" ); |
281 |
288 |
282 StartProcessing( ERemConExtEndCall ); |
289 StartProcessing( ERemConExtEndCall ); |
283 |
290 |
284 COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::EndCall() end" ); |
291 COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::EndCall() end" ); |
285 } |
292 } |
286 |
293 |
287 // ----------------------------------------------------------------------------- |
294 // ----------------------------------------------------------------------------- |
288 // CPhoneHandlerControl::AnswerEndCall |
295 // CPhoneHandlerControl::AnswerEndCall |
289 // (other items were commented in a header). |
296 // (other items were commented in a header). |
290 // ----------------------------------------------------------------------------- |
297 // ----------------------------------------------------------------------------- |
291 // |
298 // |
292 void CPhoneHandlerControl::AnswerEndCall() |
299 void CPhoneHandlerControl::AnswerEndCall() |
293 { |
300 { |
294 COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::AnswerEndCall() start" ); |
301 COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::AnswerEndCall() start" ); |
295 |
302 |
296 StartProcessing( ERemConExtAnswerEnd ); |
303 StartProcessing( ERemConExtAnswerEnd ); |
297 |
304 |
298 COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::AnswerEndCall() end" ); |
305 COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::AnswerEndCall() end" ); |
299 } |
306 } |
300 |
307 |
301 // ----------------------------------------------------------------------------- |
308 // ----------------------------------------------------------------------------- |
302 // CPhoneHandlerControl::VoiceDial |
309 // CPhoneHandlerControl::VoiceDial |
303 // (other items were commented in a header). |
310 // Dummy implementation. Operation implemented in SIND |
304 // ----------------------------------------------------------------------------- |
311 // (other items were commented in a header). |
305 // |
312 // ----------------------------------------------------------------------------- |
306 #if 0 // SCB CR EHSA-7APJWF: SIND subscribes to RemCon directly |
313 // |
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*/ ) |
314 void CPhoneHandlerControl::VoiceDial( const TBool /*aActivate*/ ) |
345 { |
315 { |
346 COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::VoiceDial()" ); |
316 COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::VoiceDial()" ); |
347 |
317 |
348 iResponse->SetResponse( ERemConExtVoiceDial, KErrNone ); |
318 iResponse->SetResponse( ERemConExtVoiceDial, KErrNone ); |
349 iResponse->Process(); |
319 iResponse->Process(); |
350 |
320 |
351 COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::VoiceDial() end" ); |
321 COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::VoiceDial() end" ); |
352 } |
322 } |
353 #endif |
323 |
354 // ----------------------------------------------------------------------------- |
324 // ----------------------------------------------------------------------------- |
355 // CPhoneHandlerControl::LastNumberRedial |
325 // CPhoneHandlerControl::LastNumberRedial |
356 // (other items were commented in a header). |
326 // (other items were commented in a header). |
357 // ----------------------------------------------------------------------------- |
327 // ----------------------------------------------------------------------------- |
358 // |
328 // |
359 void CPhoneHandlerControl::LastNumberRedial( ) |
329 void CPhoneHandlerControl::LastNumberRedial( ) |
360 { |
330 { |
361 COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::LastNumberRedial() start" ); |
331 COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::LastNumberRedial() start" ); |
362 |
332 |
363 StartProcessing( ERemConExtLastNumberRedial ); |
333 if ( IsAutoLockOn() && !IsBTAccessoryCmd() ) |
364 |
334 { |
365 COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::LastNumberRedial() end" ); |
335 iResponse->SetResponse( ERemConExtLastNumberRedial, KErrAccessDenied ); |
366 } |
336 iResponse->Process(); |
|
337 return; |
|
338 } |
|
339 |
|
340 StartProcessing( ERemConExtLastNumberRedial ); |
|
341 |
|
342 COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::LastNumberRedial() end" ); |
|
343 } |
367 |
344 |
368 // ----------------------------------------------------------------------------- |
345 // ----------------------------------------------------------------------------- |
369 // CPhoneHandlerControl::DialCall |
346 // CPhoneHandlerControl::DialCall |
370 // (other items were commented in a header). |
347 // (other items were commented in a header). |
371 // ----------------------------------------------------------------------------- |
348 // ----------------------------------------------------------------------------- |
372 // |
349 // |
373 void CPhoneHandlerControl::DialCall( const TDesC8& aTelNumber ) |
350 void CPhoneHandlerControl::DialCall( const TDesC8& aTelNumber ) |
374 { |
351 { |
375 COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::DialCall() start" ); |
352 COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::DialCall() start" ); |
376 |
353 |
|
354 if ( IsAutoLockOn() && !IsBTAccessoryCmd() ) |
|
355 { |
|
356 iResponse->SetResponse( ERemConExtDialCall, KErrAccessDenied ); |
|
357 iResponse->Process(); |
|
358 return; |
|
359 } |
|
360 |
377 // Check aTelNumber range |
361 // Check aTelNumber range |
378 if( KPhCltTelephoneNumberLength < aTelNumber.Length() ) |
362 if( KPhCltTelephoneNumberLength < aTelNumber.Length() ) |
379 { |
363 { |
380 COM_TRACE_1( "[PHONECMDHANDLER] CPhoneHandlerControl::DialCall() number value=%d too long", aTelNumber.Size() ); |
364 COM_TRACE_1( "[PHONECMDHANDLER] CPhoneHandlerControl::DialCall() number value=%d too long", aTelNumber.Size() ); |
381 iResponse->SetResponse( ERemConExtDialCall, KErrArgument ); |
365 iResponse->SetResponse( ERemConExtDialCall, KErrArgument ); |
382 iResponse->Process(); |
366 iResponse->Process(); |
383 return; |
367 return; |
384 } |
368 } |
385 |
369 |
386 iTelNumber.Copy( aTelNumber ); |
370 iTelNumber.Copy( aTelNumber ); |
387 |
371 |
388 StartProcessing( ERemConExtDialCall ); |
372 StartProcessing( ERemConExtDialCall ); |
389 |
373 |
390 COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::DialCall() end" ); |
374 COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::DialCall() end" ); |
391 } |
375 } |
392 |
376 |
393 // ----------------------------------------------------------------------------- |
377 // ----------------------------------------------------------------------------- |
394 // CPhoneHandlerControl::MultipartyCalling |
378 // CPhoneHandlerControl::MultipartyCalling |
395 // Method supports multiparty call handling according to BT handsfree profile |
379 // 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, |
380 // (HFP) 1.5. BT HFP 1.5 defines contents of aData parameter as follows: 0, 1, |
414 // |
398 // |
415 // (other items were commented in a header). |
399 // (other items were commented in a header). |
416 // ----------------------------------------------------------------------------- |
400 // ----------------------------------------------------------------------------- |
417 // |
401 // |
418 void CPhoneHandlerControl::MultipartyCalling( const TDesC8& aData ) |
402 void CPhoneHandlerControl::MultipartyCalling( const TDesC8& aData ) |
419 { |
403 { |
420 TBool error( EFalse ); |
404 TBool error( EFalse ); |
421 iChldCommand = 0; |
405 iChldCommand = 0; |
422 iChldCallNumber = 0; |
406 iChldCallNumber = 0; |
423 TBuf8< KRemConExtParamMaxLength > buf( aData ); |
407 TBuf8< KRemConExtParamMaxLength > buf( aData ); |
424 buf.Trim(); |
408 buf.Trim(); |
425 TInt length = buf.Length(); |
409 TInt length = buf.Length(); |
426 |
410 |
427 // Check invalid number of characters |
411 // Check invalid number of characters |
428 if ( length < KMultipartyCallMinParam || length > KMultipartyCallMaxParam ) |
412 if ( length < KMultipartyCallMinParam || length > KMultipartyCallMaxParam ) |
429 { |
413 { |
430 error = ETrue; |
414 error = ETrue; |
431 } |
415 } |
432 else |
416 else |
433 { |
417 { |
434 TLex8 param; |
418 TLex8 param; |
435 // Set command |
419 // Set command |
436 param.Assign( buf.Mid( 0, 1 ) ); |
420 param.Assign( buf.Mid( 0, 1 ) ); |
437 if( param.Val( iChldCommand ) != KErrNone ) |
421 if( param.Val( iChldCommand ) != KErrNone ) |
438 { |
422 { |
439 error = ETrue; |
423 error = ETrue; |
440 } |
424 } |
441 else if ( length == KMultipartyCallMaxParam ) |
425 else if ( length == KMultipartyCallMaxParam ) |
442 { |
426 { |
443 // Set call number |
427 // Set call number |
444 param.Assign( buf.Mid(1) ); |
428 param.Assign( buf.Mid(1) ); |
445 if( param.Val( iChldCallNumber ) != KErrNone ) |
429 if( param.Val( iChldCallNumber ) != KErrNone ) |
446 { |
430 { |
447 error = ETrue; |
431 error = ETrue; |
448 } |
432 } |
449 } |
433 } |
450 } |
434 } |
451 |
435 |
452 if( error ) |
436 if( error ) |
453 { |
437 { |
454 // Invalid command |
438 // Invalid command |
455 iResponse->SetResponse( ERemConExt3WaysCalling, KErrArgument ); |
439 iResponse->SetResponse( ERemConExt3WaysCalling, KErrArgument ); |
456 iResponse->Process(); |
440 iResponse->Process(); |
457 return; |
441 return; |
458 } |
442 } |
459 |
443 |
460 COM_TRACE_2( "[PHONECMDHANDLER] CPhoneHandlerControl::MultipartyCalling() iChldCommand=%d, iChldCallNumber=%d", iChldCommand, iChldCallNumber ); |
444 COM_TRACE_2( "[PHONECMDHANDLER] CPhoneHandlerControl::MultipartyCalling() iChldCommand=%d, iChldCallNumber=%d", iChldCommand, iChldCallNumber ); |
461 |
445 |
462 StartProcessing( ERemConExt3WaysCalling ); |
446 StartProcessing( ERemConExt3WaysCalling ); |
463 |
447 |
464 COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::MultipartyCalling() end" ); |
448 COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::MultipartyCalling() end" ); |
465 } |
449 } |
466 |
450 |
467 // ----------------------------------------------------------------------------- |
451 // ----------------------------------------------------------------------------- |
468 // CPhoneHandlerControl::GenerateDTMF |
452 // CPhoneHandlerControl::GenerateDTMF |
469 // (other items were commented in a header). |
453 // (other items were commented in a header). |
470 // ----------------------------------------------------------------------------- |
454 // ----------------------------------------------------------------------------- |
471 // |
455 // |
472 void CPhoneHandlerControl::GenerateDTMF( const TChar aChar ) |
456 void CPhoneHandlerControl::GenerateDTMF( const TChar aChar ) |
473 { |
457 { |
474 COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::GenerateDTMF() start" ); |
458 COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::GenerateDTMF() start" ); |
475 |
459 |
476 iChar = aChar; |
460 iChar = aChar; |
477 |
461 |
478 StartProcessing( ERemConExtGenerateDTMF ); |
462 StartProcessing( ERemConExtGenerateDTMF ); |
479 |
463 |
480 COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::GenerateDTMF() end" ); |
464 COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::GenerateDTMF() end" ); |
481 } |
465 } |
482 |
466 |
483 // ----------------------------------------------------------------------------- |
467 // ----------------------------------------------------------------------------- |
484 // CPhoneHandlerControl::SpeedDial |
468 // CPhoneHandlerControl::SpeedDial |
485 // (other items were commented in a header). |
469 // (other items were commented in a header). |
486 // ----------------------------------------------------------------------------- |
470 // ----------------------------------------------------------------------------- |
487 // |
471 // |
488 void CPhoneHandlerControl::SpeedDial( const TInt /*aIndex*/ ) |
472 void CPhoneHandlerControl::SpeedDial( const TInt aIndex ) |
489 { |
473 { |
490 COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::SpeedDial() - Not Supported" ); |
474 COM_TRACE_1( "[PHONECMDHANDLER] CPhoneHandlerControl::SpeedDial() aIndex=%d", aIndex ); |
491 } |
475 |
|
476 iIndex = aIndex; |
|
477 |
|
478 StartProcessing( ERemConExtSpeedDial ); |
|
479 |
|
480 COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::SpeedDial() end" ); |
|
481 } |
492 |
482 |
493 // ----------------------------------------------------------------------------- |
483 // ----------------------------------------------------------------------------- |
494 // CPhoneHandlerControl::StartProcessing |
484 // CPhoneHandlerControl::StartProcessing |
495 // Creates an object that executes call handling command received from |
485 // Creates an object that executes call handling command received from |
496 // accessory. |
486 // accessory. |
497 // (other items were commented in a header). |
487 // (other items were commented in a header). |
498 // ----------------------------------------------------------------------------- |
488 // ----------------------------------------------------------------------------- |
499 // |
489 // |
500 void CPhoneHandlerControl::StartProcessing( |
490 void CPhoneHandlerControl::StartProcessing( |
501 const TRemConExtCallHandlingApiOperationId aOperation ) |
491 const TRemConExtCallHandlingApiOperationId aOperation ) |
502 { |
492 { |
503 COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::StartProcessing() start" ); |
493 COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::StartProcessing() start" ); |
504 |
494 |
505 // Create a service |
495 // Create a service |
506 MPhoneHandlerService* service = NULL; |
496 MPhoneHandlerService* service = NULL; |
507 TInt error( KErrNone ); |
497 TInt error( KErrNone ); |
508 TRAP( error, service = CreateServiceL( aOperation ) ); |
498 TRAP( error, service = CreateServiceL( aOperation ) ); |
509 |
499 |
510 COM_TRACE_1( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() returned %d", error ); |
500 COM_TRACE_1( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() returned %d", error ); |
511 |
501 |
512 if( error ) |
502 if( error ) |
513 { |
503 { |
514 COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::StartProcessing(): service wasn't created succesfully." ); |
504 COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::StartProcessing(): service wasn't created succesfully." ); |
515 |
505 |
516 // An error happened. Delete service, if it exists. |
506 // An error happened. Delete service, if it exists. |
517 if( service ) |
507 if( service ) |
518 { |
508 { |
519 service->Delete(); |
509 service->Delete(); |
520 service = NULL; |
510 service = NULL; |
521 } |
511 } |
522 |
512 |
523 iResponse->SetResponse( aOperation, error ); |
513 iResponse->SetResponse( aOperation, error ); |
524 iResponse->Process(); |
514 iResponse->Process(); |
525 return; |
515 return; |
526 } |
516 } |
527 else |
517 else |
528 { |
518 { |
529 // start service |
519 // start service |
530 service->Process(); |
520 service->Process(); |
531 iSwitchCall = EFalse; |
521 iSwitchCall = EFalse; |
532 } |
522 } |
533 |
523 |
534 COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::StartProcessing() end" ); |
524 COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::StartProcessing() end" ); |
535 } |
525 } |
536 |
526 |
537 // ----------------------------------------------------------------------------- |
527 // ----------------------------------------------------------------------------- |
538 // CPhoneHandlerControl::CreateServiceL |
528 // CPhoneHandlerControl::CreateServiceL |
539 // (other items were commented in a header). |
529 // (other items were commented in a header). |
540 // ----------------------------------------------------------------------------- |
530 // ----------------------------------------------------------------------------- |
541 // |
531 // |
542 MPhoneHandlerService* CPhoneHandlerControl:: |
532 MPhoneHandlerService* CPhoneHandlerControl:: |
543 CreateServiceL( const TRemConExtCallHandlingApiOperationId aOperation ) |
533 CreateServiceL( const TRemConExtCallHandlingApiOperationId aOperation ) |
544 { |
534 { |
545 COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() start" ); |
535 COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() start" ); |
546 |
536 |
547 MPhoneHandlerService* pService = NULL; |
537 MPhoneHandlerService* pService = NULL; |
548 |
538 |
549 switch( aOperation ) |
539 switch( aOperation ) |
550 { |
540 { |
551 case ERemConExtAnswerCall: |
541 case ERemConExtAnswerCall: |
552 { |
542 { |
553 COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() - ERemConExtAnswerCall command" ); |
543 COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() - ERemConExtAnswerCall command" ); |
554 COM_TRACE_1( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() - iActiveCalls is %d", iActiveCalls ); |
544 COM_TRACE_1( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() - iCallArray->ExistingCallCount() is %d", iCallArray->ExistingCallCount() ); |
555 |
545 |
556 /* |
546 /* |
557 if( iActiveCalls > 0 ) |
547 if( iActiveCalls > 0 ) |
558 { |
548 { |
559 // Multiparty call |
549 // Multiparty call |
560 iSwitchCall = ETrue; |
550 iSwitchCall = ETrue; |
561 pService = CPhoneHandlerMultipartyCall::NewL( *this ); |
551 pService = CPhoneHandlerMultipartyCall::NewL( *this ); |
562 } |
552 } |
563 else |
553 else |
564 { |
554 { |
565 // non-multiparty call |
555 // non-multiparty call |
566 pService = CPhoneHandlerAnswerCall::NewL( *this ); |
556 pService = CPhoneHandlerAnswerCall::NewL( *this ); |
567 } |
557 } |
568 */ |
558 */ |
569 pService = CPhoneHandlerAnswerCall::NewL( *this ); |
559 pService = CPhoneHandlerAnswerCall::NewL( *this ); |
570 |
560 |
571 break; |
561 break; |
572 } |
562 } |
573 |
563 |
574 case ERemConExtEndCall: |
564 case ERemConExtEndCall: |
575 { |
565 { |
576 COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() - ERemConExtEndCall command" ); |
566 COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() - ERemConExtEndCall command" ); |
577 |
567 |
578 pService = CPhoneHandlerEndCall::NewL( *this ); |
568 pService = CPhoneHandlerEndCall::NewL( *this ); |
579 |
569 |
580 break; |
570 break; |
581 } |
571 } |
582 |
572 |
583 case ERemConExtAnswerEnd: |
573 case ERemConExtAnswerEnd: |
584 { |
574 { |
585 COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() - ERemConExtAnswerEnd command" ); |
575 COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() - ERemConExtAnswerEnd command" ); |
586 |
576 |
587 TInt callState( EPSCTsyCallStateUninitialized ); |
577 if( iCallArray->ExistingCallCount() ) |
588 iProperty.Get( KPSUidCtsyCallInformation, KCTsyCallState, callState ); |
578 { |
589 |
579 COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() - call(s) exist" ); |
590 COM_TRACE_1( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() call state = %d", callState ); |
580 // If only one call exists and it's state is CCPCall::EStateQueued, |
591 |
581 // it is actually in ringing state and should be answered. |
592 if( callState != EPSCTsyCallStateUninitialized && |
582 if ( NULL == iCallArray->CallByState( CCPCall::EStateRinging ) |
593 callState != EPSCTsyCallStateNone && |
583 && ( iCallArray->ExistingCallCount() == 1 |
594 callState != EPSCTsyCallStateDisconnecting ) |
584 && NULL == iCallArray->CallByState( CCPCall::EStateQueued ) ) ) |
595 { |
585 { |
596 if( callState == EPSCTsyCallStateAlerting || |
586 COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() - no ringing calls" ); |
597 callState == EPSCTsyCallStateDialling || |
587 pService = CPhoneHandlerEndCall::NewL( *this, |
598 callState == EPSCTsyCallStateAnswering || |
588 aOperation ); |
599 callState == EPSCTsyCallStateConnected || |
589 } |
600 callState == EPSCTsyCallStateHold ) |
590 // Ringing call(s) exist |
601 { |
591 else |
602 pService = CPhoneHandlerEndCall::NewL( *this, |
592 { |
603 aOperation ); |
593 if( iCallArray->ExistingCallCount() > 1 ) |
604 } |
594 { |
605 // callState == EPSTelephonyCallStateRinging |
595 COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() - several ringing calls" ); |
606 else |
596 // multicall case : End call that has existed longer. |
607 { |
597 // (From UI viewpoint ringing call is in waiting state.) |
608 COM_TRACE_1( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() iActiveCalls = %d", iActiveCalls ); |
598 pService = CPhoneHandlerEndCall::NewL( *this, |
609 if( iActiveCalls > 0 ) |
599 aOperation ); |
610 { |
600 } |
611 // multicall case : End call that has existed longer. |
601 else |
612 // (From UI viewpoint ringing call is in waiting state.) |
602 { |
613 pService = CPhoneHandlerEndCall::NewL( *this, |
603 COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() - single ringing call" ); |
614 aOperation ); |
604 pService = CPhoneHandlerAnswerCall::NewL( |
615 if( callState == EPSCTsyCallStateRinging ) |
605 *this, |
616 { |
606 aOperation ); |
617 // In multiparty case the telephony key is not |
607 } |
618 // updated. The call amount is updated manually. |
608 } |
619 iActiveCalls--; |
609 } |
620 } |
610 else |
621 } |
611 { |
622 else |
612 // Send / end button was pressed when there were not |
623 { |
613 // any calls active. Response has to be sent back to accessory |
624 pService = CPhoneHandlerAnswerCall::NewL( |
614 // at least for following reasons: |
625 *this, |
615 |
626 aOperation ); |
616 // 1. RemCon FW releases message related memory only when response |
627 } |
617 // is sent back to accessory. |
628 } |
618 |
629 } |
619 // 2. BT accessory key press producing ERemConExtAnswerEnd |
630 else |
620 // operation has some other meaning than answer/end call |
631 { |
621 // and it's processed by proper client. However, there |
632 // Send / end button was pressed when there were not |
622 // might be a situation where proper client isn't active |
633 // any calls active. Response has to be sent back to accessory |
623 // and can't process command. In any case RemCon/BT accessory |
634 // at least for following reasons: |
624 // requires response to command. That's why PhoneCmdHandler |
635 |
625 // sends reponse to command. |
636 // 1. RemCon FW releases message related memory only when response |
626 |
637 // is sent back to accessory. |
627 iResponse->SetResponse( aOperation, KErrNone ); |
638 |
628 pService = iResponse; |
639 // 2. BT accessory key press producing ERemConExtAnswerEnd |
629 } |
640 // operation has some other meaning than answer/end call |
630 break; |
641 // and it's processed by proper client. However, there |
631 } |
642 // might be a situation where proper client isn't active |
632 |
643 // and can't process command. In any case RemCon/BT accessory |
633 case ERemConExtDialCall: |
644 // requires response to command. That's why PhoneCmdHandler |
634 { |
645 // sends reponse to command. |
635 COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() - ERemConExtDialCall command" ); |
646 |
636 |
647 iResponse->SetResponse( aOperation, KErrNone ); |
637 pService = CPhoneHandlerDialCall::NewL( *this ); |
648 pService = iResponse; |
638 break; |
649 } |
639 } |
650 break; |
640 |
651 } |
641 case ERemConExtVoiceDial: |
652 |
642 { |
653 case ERemConExtDialCall: |
643 COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() - ERemConExtVoiceDial command" ); |
654 { |
644 |
655 COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() - ERemConExtDialCall command" ); |
645 pService = CPhoneHandlerVoiceDial::NewL( *this ); |
656 |
646 break; |
657 pService = CPhoneHandlerDialCall::NewL( *this ); |
647 } |
658 break; |
648 |
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: |
649 case ERemConExtLastNumberRedial: |
670 { |
650 { |
671 COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() - ERemConExtLastNumberRedial command" ); |
651 COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() - ERemConExtLastNumberRedial command" ); |
672 |
652 |
673 pService = CPhoneHandlerLastNumberRedial::NewL( *this ); |
653 pService = CPhoneHandlerLastNumberRedial::NewL( *this ); |
674 break; |
654 break; |
675 } |
655 } |
676 |
656 |
677 case ERemConExt3WaysCalling: |
657 case ERemConExt3WaysCalling: |
678 { |
658 { |
679 COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() - ERemConExt3WaysCalling command" ); |
659 COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() - ERemConExt3WaysCalling command" ); |
680 |
660 |
681 pService = CPhoneHandlerMultipartyCall::NewL( *this ); |
661 pService = CPhoneHandlerMultipartyCall::NewL( *this ); |
682 break; |
662 break; |
683 } |
663 } |
684 |
664 |
685 case ERemConExtGenerateDTMF: |
665 case ERemConExtGenerateDTMF: |
686 { |
666 { |
687 COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() - ERemConExtGenerateDTMF command" ); |
667 COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() - ERemConExtGenerateDTMF command" ); |
688 |
668 |
689 pService = CPhoneHandlerDTMF::NewL( *this ); |
669 pService = CPhoneHandlerDTMF::NewL( *this ); |
690 break; |
670 break; |
691 } |
671 } |
692 |
672 |
|
673 case ERemConExtSpeedDial: |
|
674 { |
|
675 COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() - ERemConExtSpeedDial command" ); |
|
676 |
|
677 InitializeSpeedDialL(); |
|
678 pService = CPhoneHandlerDialCall::NewL( *this, |
|
679 aOperation ); |
|
680 break; |
|
681 } |
|
682 |
693 default: |
683 default: |
694 { |
684 { |
695 COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() Unspecified state" ); |
685 COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() Unspecified state" ); |
696 break; |
686 break; |
697 } |
687 } |
698 }; |
688 }; |
699 |
689 |
700 COM_TRACE_1( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() end, %d", pService ); |
690 COM_TRACE_1( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() end, %d", pService ); |
701 return pService; |
691 return pService; |
702 } |
692 } |
703 |
693 |
704 // ----------------------------------------------------------------------------- |
694 // ----------------------------------------------------------------------------- |
|
695 // CPhoneHandlerControl::InitializeSpeedDialL |
|
696 // (other items were commented in a header). |
|
697 // ----------------------------------------------------------------------------- |
|
698 // |
|
699 void CPhoneHandlerControl::InitializeSpeedDialL() |
|
700 { |
|
701 COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::InitializeSpeedDialL() start" ); |
|
702 |
|
703 // first check contack engine is not in busy |
|
704 TInt cntEngState( 0 ); |
|
705 TInt err = iProperty.Get( KUidSystemCategory, conn::KUidBackupRestoreKey, cntEngState ); |
|
706 |
|
707 if( err == KErrNotFound || cntEngState == 0 || |
|
708 cntEngState & conn::KBURPartTypeMask == conn::EBURNormal || |
|
709 cntEngState & conn::KBackupIncTypeMask == conn::ENoBackup ) |
|
710 { |
|
711 // Get phone number from phonebook by index |
|
712 CPbkContactEngine* ptr = CPbkContactEngine::NewL(); |
|
713 CleanupStack::PushL( ptr ); |
|
714 TRACE_ASSERT( ptr != NULL ); |
|
715 ptr->GetSpeedDialFieldL( iIndex, iTelNumber ); |
|
716 COM_TRACE_1( "[PHONECMDHANDLER] CPhoneHandlerControl::InitializeSpeedDialL() speed dial number is %S", &iTelNumber ); |
|
717 CleanupStack::PopAndDestroy( ptr ); |
|
718 } |
|
719 else |
|
720 { |
|
721 // contact engine is in busy |
|
722 COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::InitializeSpeedDialL() contact engine is in backup/restore" ); |
|
723 User::Leave( KErrInUse ); |
|
724 } |
|
725 |
|
726 COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::InitializeSpeedDialL() end" ); |
|
727 } |
|
728 |
|
729 // ----------------------------------------------------------------------------- |
705 // CPhoneHandlerControl::SwitchCall |
730 // CPhoneHandlerControl::SwitchCall |
706 // (other items were commented in a header). |
731 // (other items were commented in a header). |
707 // ----------------------------------------------------------------------------- |
732 // ----------------------------------------------------------------------------- |
708 // |
733 // |
709 TBool CPhoneHandlerControl::SwitchCall() |
734 TBool CPhoneHandlerControl::SwitchCall() |
710 { |
735 { |
711 return iSwitchCall; |
736 return iSwitchCall; |
712 } |
737 } |
|
738 |
|
739 // --------------------------------------------------------- |
|
740 // CPhoneHandlerControl::IsAutoLockOn |
|
741 // --------------------------------------------------------- |
|
742 // |
|
743 TBool CPhoneHandlerControl::IsAutoLockOn() const |
|
744 { |
|
745 COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::IsAutoLockOn() start " ); |
|
746 TInt err( KErrNone ); |
|
747 TInt value( EAutolockStatusUninitialized ); |
|
748 |
|
749 err = RProperty::Get( KPSUidCoreApplicationUIs, KCoreAppUIsAutolockStatus, value ); |
|
750 if ( err != KErrNone ) |
|
751 { |
|
752 value = err; |
|
753 } |
|
754 COM_TRACE_1( "[PHONECMDHANDLER] CPhoneHandlerControl::IsAutoLockOn() autolock value = %d", value ); |
|
755 |
|
756 return value > EAutolockOff ? ETrue : EFalse; |
|
757 |
|
758 } |
|
759 // --------------------------------------------------------- |
|
760 // CPhoneHandlerControl::IsBTAccessoryCmd |
|
761 // --------------------------------------------------------- |
|
762 // |
|
763 TBool CPhoneHandlerControl::IsBTAccessoryCmd() const |
|
764 { |
|
765 COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::IsBTAccessoryCmd() start " ); |
|
766 TBool retval( EFalse ); |
|
767 |
|
768 TRemConExtCmdSource source; |
|
769 iTarget->GetCommandSourceInfo( source ); |
|
770 if ( source == ERemConExtCmdSourceBluetooth ) |
|
771 { |
|
772 retval = ETrue; |
|
773 } |
|
774 |
|
775 COM_TRACE_1( "[PHONECMDHANDLER] CPhoneHandlerControl::IsBTAccessoryCmd() GetCommandSourceInfo = %d", source ); |
|
776 |
|
777 return retval; |
|
778 } |
|
779 |
|
780 |
|
781 |
|
782 |
713 // ======================== OTHER EXPORTED FUNCTIONS =========================== |
783 // ======================== OTHER EXPORTED FUNCTIONS =========================== |
714 |
784 |
715 // End of File |
785 // End of File |