phonecmdhandler/phonecmdhnlr/src/PhoneHandlerControl.cpp
branchRCL_3
changeset 19 7d48bed6ce0c
parent 9 71e7b994dff4
child 20 987c9837762f
equal deleted inserted replaced
18:594d59766373 19:7d48bed6ce0c
    10 * Nokia Corporation - initial contribution.
    10 * Nokia Corporation - initial contribution.
    11 *
    11 *
    12 * Contributors:
    12 * Contributors:
    13 *
    13 *
    14 * Description:  Receives call handling related key presses from accessories and 
    14 * Description:  Receives call handling related key presses from accessories and 
    15 *				 executes them. 
    15 *                executes them. 
    16 *
    16 *
    17 */
    17 */
    18 
    18 
    19 
    19 
    20 
    20 
    21 // INCLUDE FILES
    21 // INCLUDE FILES
    22 #include "PhoneHandlerControl.h"
    22 #include "phonehandlercontrol.h" 
    23 #include "PhoneHandlerService.h"
    23 #include "phonehandlerservice.h" 
    24 #include "PhoneHandlerAnswerCall.h"
    24 #include "phonehandleranswercall.h" 
    25 #include "PhoneHandlerEndCall.h"
    25 #include "phonehandlerendcall.h" 
    26 #include "PhoneHandlerDialCall.h"
    26 #include "phonehandlerdialcall.h" 
    27 #include "PhoneHandlerVoiceDial.h"
    27 #include "phonehandlervoicedial.h" 
    28 #include "PhoneHandlerRedial.h"
    28 #include "phonehandlerredial.h" 
    29 #include "PhoneHandlerMultipartyCall.h"
    29 #include "phonehandlermultipartycall.h" 
    30 #include "PhoneHandlerDTMF.h"
    30 #include "phonehandlerdtmf.h" 
    31 #include "PhoneHandlerActive.h"
    31 #include "phonehandleractive.h" 
    32 #include "PhoneHandlerResponse.h"
    32 #include "phonehandlerresponse.h" 
    33 #include "PhoneHandlerCallState.h"
    33 #include "phonehandlercallstate.h" 
    34 #include "PhoneHandlerDebug.h"
    34 #include "phonehandlerdebug.h" 
    35 #include <remconinterfaceselector.h>
    35 #include <remconinterfaceselector.h>
    36 #include <RemConCallHandlingTarget.h>
    36 #include <RemConCallHandlingTarget.h> 
    37 #include <CPbkContactEngine.h>
       
    38 #include <ctsydomainpskeys.h>
    37 #include <ctsydomainpskeys.h>
       
    38 
       
    39 #if 0
       
    40 #include <voiceuidomainpskeys.h> 
       
    41 #endif
       
    42 
    39 #include <connect/sbdefs.h>
    43 #include <connect/sbdefs.h>
    40 #include <coreapplicationuisdomainpskeys.h>
       
    41 #include "PhoneHandlerCallArray.h"
       
    42 #include <callinformation.h>
       
    43 
    44 
    44 // EXTERNAL DATA STRUCTURES
    45 // EXTERNAL DATA STRUCTURES
    45 
    46 
    46 // EXTERNAL FUNCTION PROTOTYPES  
    47 // EXTERNAL FUNCTION PROTOTYPES  
    47 
    48 
    69 // C++ default constructor can NOT contain any code, that
    70 // C++ default constructor can NOT contain any code, that
    70 // might leave.
    71 // might leave.
    71 // -----------------------------------------------------------------------------
    72 // -----------------------------------------------------------------------------
    72 //
    73 //
    73 CPhoneHandlerControl::CPhoneHandlerControl()
    74 CPhoneHandlerControl::CPhoneHandlerControl()
    74 	: iPrevState( EPSCTsyCallStateNone )
    75     : iPrevState( EPSCTsyCallStateNone )
    75     {
    76     {
    76     }
    77     }
    77 
    78 
    78 // -----------------------------------------------------------------------------
    79 // -----------------------------------------------------------------------------
    79 // CPhoneHandlerControl::ConstructL
    80 // CPhoneHandlerControl::ConstructL
    81 // -----------------------------------------------------------------------------
    82 // -----------------------------------------------------------------------------
    82 //
    83 //
    83 void CPhoneHandlerControl::ConstructL( CRemConInterfaceSelector* aIfSelector )
    84 void CPhoneHandlerControl::ConstructL( CRemConInterfaceSelector* aIfSelector )
    84     {
    85     {
    85     COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::ConstructL() start" );
    86     COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::ConstructL() start" );
    86 		
    87         
    87     if( !aIfSelector )
    88     if( !aIfSelector )
    88     	{
    89         {
    89     	COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::ConstructL() Create connection to RemCon." );
    90         COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::ConstructL() Create connection to RemCon." );
    90 	    	
    91             
    91     	// Target connection to RemCon FW hasn't been done.
    92         // Target connection to RemCon FW hasn't been done.
    92     	iInterfaceSelector = CRemConInterfaceSelector::NewL();
    93         iInterfaceSelector = CRemConInterfaceSelector::NewL();
    93 	   	iTarget = CRemConCallHandlingTarget::NewL( *iInterfaceSelector, *this );
    94         iTarget = CRemConCallHandlingTarget::NewL( *iInterfaceSelector, *this );
    94 		iInterfaceSelector->OpenTargetL();
    95         iInterfaceSelector->OpenTargetL();
    95 		}
    96         }
    96 	else
    97     else
    97 		{
    98         {
    98 		COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::ConstructL() Don't create connection to RemCon." );
    99         COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::ConstructL() Don't create connection to RemCon." );
    99 	    		
   100                 
   100 		// Connection to RemCon FW as target has already been done in a process.
   101         // Connection to RemCon FW as target has already been done in a process.
   101 		iTarget = CRemConCallHandlingTarget::NewL( *aIfSelector, *this );
   102         iTarget = CRemConCallHandlingTarget::NewL( *aIfSelector, *this );
   102 		}
   103         }
   103     	
   104         
   104 	iResponse = CPhoneHandlerResponse::NewL( *this );
   105     iResponse = CPhoneHandlerResponse::NewL( *this );
   105 	iCallStateObserver = CPhoneHandlerCallState::NewL( *this );
   106     iCallStateObserver = CPhoneHandlerCallState::NewL( *this );
   106     iCallArray = CPhoneHandlerCallArray::NewL();
   107             
   107     
   108     COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::ConstructL() end" );
   108 	COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::ConstructL() end" );
   109     }
   109 	}
       
   110 
   110 
   111 // -----------------------------------------------------------------------------
   111 // -----------------------------------------------------------------------------
   112 // CPhoneHandlerControl::NewL
   112 // CPhoneHandlerControl::NewL
   113 // Two-phased constructor.
   113 // Two-phased constructor.
   114 // -----------------------------------------------------------------------------
   114 // -----------------------------------------------------------------------------
   115 //
   115 //
   116 CPhoneHandlerControl* CPhoneHandlerControl::NewL( 
   116 CPhoneHandlerControl* CPhoneHandlerControl::NewL( 
   117 									CRemConInterfaceSelector* aIfSelector )
   117                                     CRemConInterfaceSelector* aIfSelector )
   118     {
   118     {
   119     COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::NewL() start" );
   119     COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::NewL() start" );
   120     
   120     
   121     CPhoneHandlerControl* self = new ( ELeave ) CPhoneHandlerControl();
   121     CPhoneHandlerControl* self = new ( ELeave ) CPhoneHandlerControl();
   122     
   122     
   133 CPhoneHandlerControl::~CPhoneHandlerControl()
   133 CPhoneHandlerControl::~CPhoneHandlerControl()
   134     {
   134     {
   135     COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::~CPhoneHandlerControl() start" );
   135     COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::~CPhoneHandlerControl() start" );
   136     
   136     
   137     if( iInterfaceSelector )
   137     if( iInterfaceSelector )
   138     	{
   138         {
   139     	delete iInterfaceSelector;
   139         delete iInterfaceSelector;
   140        	}
   140         }
   141     
   141     
   142     if( iResponse )
   142     if( iResponse )
   143     	{
   143         {
   144     	iResponse->Delete();
   144         iResponse->Delete();
   145        	}
   145         }
   146        	
   146         
   147     if( iCallStateObserver )
   147     if( iCallStateObserver )
   148     	{
   148         {
   149     	delete iCallStateObserver;
   149         delete iCallStateObserver;
   150     	}
   150         }
   151     
   151             
   152     delete iCallArray;
       
   153     
       
   154     COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::~CPhoneHandlerControl() end" );
   152     COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::~CPhoneHandlerControl() end" );
   155     }
   153     }
   156 
   154 
   157 // -----------------------------------------------------------------------------
   155 // -----------------------------------------------------------------------------
   158 // CPhoneHandlerControl::TelephoneNumber
   156 // CPhoneHandlerControl::TelephoneNumber
   229 // -----------------------------------------------------------------------------
   227 // -----------------------------------------------------------------------------
   230 // CPhoneHandlerControl::NotifyCallState
   228 // CPhoneHandlerControl::NotifyCallState
   231 // (other items were commented in a header).
   229 // (other items were commented in a header).
   232 // -----------------------------------------------------------------------------
   230 // -----------------------------------------------------------------------------
   233 //
   231 //
   234 void CPhoneHandlerControl::NotifyCallStateL( const MCall* aCall )
   232 void CPhoneHandlerControl::NotifyCallState( const TInt aState )
   235     {
   233     {
   236     COM_TRACE_2( "[PHONECMDHANDLER] CPhoneHandlerControl::NotifyCallState() aCall.CallIndex:%d, aCall.CallState:%d",
   234     COM_TRACE_1( "[PHONECMDHANDLER] CPhoneHandlerControl::NotifyCallState() aState=%d", aState );
   237 				aCall->CallIndex(), aCall->CallState() );
   235     
   238     
   236     if( aState == EPSCTsyCallStateConnected && iPrevState != EPSCTsyCallStateHold )
   239     TCallInfo* call = iCallArray->FindCall( aCall->CallIndex() );
   237         {
   240    
   238         COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::NotifyCallState(): iActiveCalls++" );
   241     if ( call )
   239         
   242     	{
   240         iActiveCalls++;
   243     	// If the call is in idle or disconnecting state it can be removed from the array
   241         }
   244     	if ( CCPCall::EStateIdle == aCall->CallState() 
   242     else if( aState == EPSCTsyCallStateDisconnecting && 
   245     			|| CCPCall::EStateDisconnecting == aCall->CallState() )
   243             ( iPrevState == EPSCTsyCallStateConnected || iPrevState == EPSCTsyCallStateHold ))
   246     		{
   244         {
   247     		COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::NotifyCallState(): remove call" );
   245         COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::NotifyCallState(): iActiveCalls--" );
   248         	iCallArray->Remove( call );
   246         
   249     		}
   247         iActiveCalls--;
   250     	else
   248         }
   251     		{
   249     else if( aState == EPSCTsyCallStateNone )
   252     		COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::NotifyCallState(): update existing call" );
   250         {
   253     		iCallArray->Remove( call );
   251         COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::NotifyCallState(): iActiveCalls = 0" );
   254     		iCallArray->AddL( aCall );
   252         iActiveCalls = 0;
   255     		}
   253         }
   256     	}
   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         }
   257     else
   335     else
   258     	{
   336         {
   259     	COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::NotifyCallState(): new call" );
   337         iResponse->SetResponse( ERemConExtVoiceDial, KErrNone );
   260     	iCallArray->AddL( aCall );
   338         iResponse->Process();
   261     	}
   339         }
   262 	COM_TRACE_3( "[PHONECMDHANDLER] CPhoneHandlerControl::NotifyCallState() connected:%d existing:%d total:%d", 
   340 
   263 			iCallArray->ConnectedCallCount(), iCallArray->ExistingCallCount(), iCallArray->CallCount() );
   341     COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::VoiceDial() end" );
   264 	}
   342     }
   265 
   343 #else   
   266 // -----------------------------------------------------------------------------
       
   267 // CPhoneHandlerControl::AnswerCall
       
   268 // (other items were commented in a header).
       
   269 // -----------------------------------------------------------------------------
       
   270 //
       
   271 void CPhoneHandlerControl::AnswerCall()
       
   272 	{
       
   273 	COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::AnswerCall() start" );
       
   274 	
       
   275 	StartProcessing( ERemConExtAnswerCall );
       
   276 	
       
   277 	COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::AnswerCall() end" );
       
   278     }
       
   279 	
       
   280 // -----------------------------------------------------------------------------
       
   281 // CPhoneHandlerControl::EndCall
       
   282 // (other items were commented in a header).
       
   283 // -----------------------------------------------------------------------------
       
   284 //
       
   285 void CPhoneHandlerControl::EndCall()
       
   286 	{
       
   287 	COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::EndCall() start" );
       
   288     
       
   289     StartProcessing( ERemConExtEndCall );
       
   290     	    
       
   291 	COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::EndCall() end" );
       
   292     }
       
   293     
       
   294 // -----------------------------------------------------------------------------
       
   295 // CPhoneHandlerControl::AnswerEndCall
       
   296 // (other items were commented in a header).
       
   297 // -----------------------------------------------------------------------------
       
   298 //
       
   299 void CPhoneHandlerControl::AnswerEndCall()
       
   300 	{
       
   301 	COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::AnswerEndCall() start" );
       
   302     
       
   303     StartProcessing( ERemConExtAnswerEnd );
       
   304     	   
       
   305 	COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::AnswerEndCall() end" );
       
   306     }
       
   307 
       
   308 // -----------------------------------------------------------------------------
       
   309 // CPhoneHandlerControl::VoiceDial
       
   310 // Dummy implementation. Operation implemented in SIND 
       
   311 // (other items were commented in a header).
       
   312 // -----------------------------------------------------------------------------
       
   313 //
       
   314 void CPhoneHandlerControl::VoiceDial( const TBool /*aActivate*/ )
   344 void CPhoneHandlerControl::VoiceDial( const TBool /*aActivate*/ )
   315     {
   345     {
   316     COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::VoiceDial()" );
   346     COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::VoiceDial()" );
   317  
   347 
   318     iResponse->SetResponse( ERemConExtVoiceDial, KErrNone );
   348     iResponse->SetResponse( ERemConExtVoiceDial, KErrNone );
   319     iResponse->Process();
   349     iResponse->Process();
   320 
   350 
   321     COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::VoiceDial() end" );
   351     COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::VoiceDial() end" );
   322     }
   352     }
   323  
   353 #endif
   324 // -----------------------------------------------------------------------------
   354 // -----------------------------------------------------------------------------
   325 // CPhoneHandlerControl::LastNumberRedial
   355 // CPhoneHandlerControl::LastNumberRedial
   326 // (other items were commented in a header).
   356 // (other items were commented in a header).
   327 // -----------------------------------------------------------------------------
   357 // -----------------------------------------------------------------------------
   328 //
   358 //
   329 void CPhoneHandlerControl::LastNumberRedial( )
   359 void CPhoneHandlerControl::LastNumberRedial( )
   330 	{
   360     {
   331 	COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::LastNumberRedial() start" );
   361     COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::LastNumberRedial() start" );
   332 	
   362     
   333 	if ( IsAutoLockOn() && !IsBTAccessoryCmd() )
   363     StartProcessing( ERemConExtLastNumberRedial );
   334         {
   364     
   335         iResponse->SetResponse( ERemConExtLastNumberRedial, KErrAccessDenied );
   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 );
   336         iResponse->Process();
   382         iResponse->Process();
   337         return;
   383         return; 
   338         }
   384         }
   339 
   385     
   340 	StartProcessing( ERemConExtLastNumberRedial );
   386     iTelNumber.Copy( aTelNumber );
   341 	
   387                     
   342 	COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::LastNumberRedial() end" );
       
   343 	}
       
   344 
       
   345 // -----------------------------------------------------------------------------
       
   346 // CPhoneHandlerControl::DialCall
       
   347 // (other items were commented in a header).
       
   348 // -----------------------------------------------------------------------------
       
   349 //
       
   350 void CPhoneHandlerControl::DialCall( const TDesC8& aTelNumber )
       
   351 	{
       
   352 	COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::DialCall() start" );
       
   353     
       
   354 	if ( IsAutoLockOn() && !IsBTAccessoryCmd() )
       
   355 	        {
       
   356  	        iResponse->SetResponse( ERemConExtDialCall, KErrAccessDenied );
       
   357 	        iResponse->Process();
       
   358 	        return;
       
   359 	        }
       
   360  	
       
   361     // Check aTelNumber range    
       
   362    	if( KPhCltTelephoneNumberLength < aTelNumber.Length() )
       
   363    		{
       
   364   		COM_TRACE_1( "[PHONECMDHANDLER] CPhoneHandlerControl::DialCall() number value=%d too long", aTelNumber.Size() );
       
   365   		iResponse->SetResponse( ERemConExtDialCall, KErrArgument );
       
   366   		iResponse->Process();
       
   367   		return; 
       
   368   		}
       
   369   	
       
   370   	iTelNumber.Copy( aTelNumber );
       
   371   	      	  	    
       
   372     StartProcessing( ERemConExtDialCall );
   388     StartProcessing( ERemConExtDialCall );
   373     
   389     
   374 	COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::DialCall() end" );
   390     COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::DialCall() end" );
   375 	}
   391     }
   376 
   392 
   377 // -----------------------------------------------------------------------------
   393 // -----------------------------------------------------------------------------
   378 // CPhoneHandlerControl::MultipartyCalling
   394 // CPhoneHandlerControl::MultipartyCalling
   379 // Method supports multiparty call handling according to BT handsfree profile 
   395 // Method supports multiparty call handling according to BT handsfree profile 
   380 // (HFP) 1.5. BT HFP 1.5 defines contents of aData parameter as follows: 0, 1, 
   396 // (HFP) 1.5. BT HFP 1.5 defines contents of aData parameter as follows: 0, 1, 
   398 // 
   414 // 
   399 // (other items were commented in a header).
   415 // (other items were commented in a header).
   400 // -----------------------------------------------------------------------------
   416 // -----------------------------------------------------------------------------
   401 //
   417 //
   402 void CPhoneHandlerControl::MultipartyCalling( const TDesC8& aData )
   418 void CPhoneHandlerControl::MultipartyCalling( const TDesC8& aData )
   403 	{
   419     {
   404 	TBool error( EFalse );
   420     TBool error( EFalse );
   405 	iChldCommand = 0;
   421     iChldCommand = 0;
   406 	iChldCallNumber = 0;
   422     iChldCallNumber = 0;
   407 	TBuf8< KRemConExtParamMaxLength > buf( aData );
   423     TBuf8< KRemConExtParamMaxLength > buf( aData );
   408 	buf.Trim();
   424     buf.Trim();
   409 	TInt length = buf.Length();
   425     TInt length = buf.Length();
   410 	
   426     
   411 	// Check invalid number of characters
   427     // Check invalid number of characters
   412 	if ( length < KMultipartyCallMinParam || length > KMultipartyCallMaxParam )
   428     if ( length < KMultipartyCallMinParam || length > KMultipartyCallMaxParam )
   413 	    {
   429         {
   414 	    error = ETrue;
   430         error = ETrue;
   415 	    }
   431         }
   416 	else
   432     else
   417 	    {
   433         {
   418 	    TLex8 param;
   434         TLex8 param;
   419 	    // Set command	
   435         // Set command  
   420 		param.Assign( buf.Mid( 0, 1 ) );
   436         param.Assign( buf.Mid( 0, 1 ) );
   421 		if( param.Val( iChldCommand ) != KErrNone )
   437         if( param.Val( iChldCommand ) != KErrNone )
   422 			{
   438             {
   423 			error = ETrue;
   439             error = ETrue;
   424 			}
   440             }
   425 		else if ( length == KMultipartyCallMaxParam )
   441         else if ( length == KMultipartyCallMaxParam )
   426 	    	{
   442             {
   427 			// Set call number
   443             // Set call number
   428 			param.Assign( buf.Mid(1) );
   444             param.Assign( buf.Mid(1) );
   429 			if( param.Val( iChldCallNumber ) != KErrNone )
   445             if( param.Val( iChldCallNumber ) != KErrNone )
   430 				{
   446                 {
   431 				error = ETrue;
   447                 error = ETrue;
   432 				}
   448                 }
   433 	    	}
   449             }
   434 	    }
   450         }
   435 
   451 
   436 	if( error )
   452     if( error )
   437 		{
   453         {
   438 		// Invalid command 
   454         // Invalid command 
   439 		iResponse->SetResponse( ERemConExt3WaysCalling, KErrArgument );
   455         iResponse->SetResponse( ERemConExt3WaysCalling, KErrArgument );
   440   		iResponse->Process();
   456         iResponse->Process();
   441   		return;	
   457         return; 
   442 		}
   458         }
   443 		
   459         
   444 	COM_TRACE_2( "[PHONECMDHANDLER] CPhoneHandlerControl::MultipartyCalling() iChldCommand=%d, iChldCallNumber=%d", iChldCommand, iChldCallNumber );
   460     COM_TRACE_2( "[PHONECMDHANDLER] CPhoneHandlerControl::MultipartyCalling() iChldCommand=%d, iChldCallNumber=%d", iChldCommand, iChldCallNumber );
   445 		
   461         
   446 	StartProcessing( ERemConExt3WaysCalling );
   462     StartProcessing( ERemConExt3WaysCalling );
   447 	
   463     
   448 	COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::MultipartyCalling() end" );
   464     COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::MultipartyCalling() end" );
   449 	}
   465     }
   450 	
   466     
   451 // -----------------------------------------------------------------------------
   467 // -----------------------------------------------------------------------------
   452 // CPhoneHandlerControl::GenerateDTMF
   468 // CPhoneHandlerControl::GenerateDTMF
   453 // (other items were commented in a header).
   469 // (other items were commented in a header).
   454 // -----------------------------------------------------------------------------
   470 // -----------------------------------------------------------------------------
   455 //
   471 //
   456 void CPhoneHandlerControl::GenerateDTMF( const TChar aChar )
   472 void CPhoneHandlerControl::GenerateDTMF( const TChar aChar )
   457 	{
   473     {
   458 	COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::GenerateDTMF() start" );
   474     COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::GenerateDTMF() start" );
   459 	
   475     
   460 	iChar = aChar;
   476     iChar = aChar;
   461 	
   477     
   462 	StartProcessing( ERemConExtGenerateDTMF );
   478     StartProcessing( ERemConExtGenerateDTMF );
   463 	
   479     
   464 	COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::GenerateDTMF() end" );
   480     COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::GenerateDTMF() end" );
   465 	}
   481     }
   466 	
   482     
   467 // -----------------------------------------------------------------------------
   483 // -----------------------------------------------------------------------------
   468 // CPhoneHandlerControl::SpeedDial
   484 // CPhoneHandlerControl::SpeedDial
   469 // (other items were commented in a header).
   485 // (other items were commented in a header).
   470 // -----------------------------------------------------------------------------
   486 // -----------------------------------------------------------------------------
   471 //
   487 //
   472 void CPhoneHandlerControl::SpeedDial( const TInt aIndex )
   488 void CPhoneHandlerControl::SpeedDial( const TInt /*aIndex*/ )
   473 	{
   489     {    
   474 	COM_TRACE_1( "[PHONECMDHANDLER] CPhoneHandlerControl::SpeedDial() aIndex=%d", aIndex );
   490     COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::SpeedDial() - Not Supported" );
   475 
   491     }
   476 	iIndex = aIndex;
       
   477 	
       
   478 	StartProcessing( ERemConExtSpeedDial );
       
   479 	
       
   480 	COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::SpeedDial() end" );
       
   481 	}
       
   482 
   492 
   483 // -----------------------------------------------------------------------------
   493 // -----------------------------------------------------------------------------
   484 // CPhoneHandlerControl::StartProcessing
   494 // CPhoneHandlerControl::StartProcessing
   485 // Creates an object that executes call handling command received from 
   495 // Creates an object that executes call handling command received from 
   486 // accessory.
   496 // accessory.
   487 // (other items were commented in a header).
   497 // (other items were commented in a header).
   488 // -----------------------------------------------------------------------------
   498 // -----------------------------------------------------------------------------
   489 //
   499 //
   490 void CPhoneHandlerControl::StartProcessing(	
   500 void CPhoneHandlerControl::StartProcessing( 
   491 	const TRemConExtCallHandlingApiOperationId aOperation )
   501     const TRemConExtCallHandlingApiOperationId aOperation )
   492 	{
   502     {
   493 	COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::StartProcessing() start" );
   503     COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::StartProcessing() start" );
   494     		
   504             
   495 	// Create a service
   505     // Create a service
   496 	MPhoneHandlerService* service = NULL;
   506     MPhoneHandlerService* service = NULL;
   497 	TInt error( KErrNone );
   507     TInt error( KErrNone );
   498 	TRAP( error, service = CreateServiceL( aOperation ) ); 
   508     TRAP( error, service = CreateServiceL( aOperation ) ); 
   499 		
   509         
   500 	COM_TRACE_1( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() returned %d", error );
   510     COM_TRACE_1( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() returned %d", error );
   501 		
   511         
   502 	if( error )
   512     if( error )
   503 		{
   513         {
   504 		COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::StartProcessing(): service wasn't created succesfully." );
   514         COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::StartProcessing(): service wasn't created succesfully." );
   505 		
   515         
   506 		// An error happened. Delete service, if it exists.
   516         // An error happened. Delete service, if it exists.
   507 		if( service )
   517         if( service )
   508 			{
   518             {
   509 			service->Delete();
   519             service->Delete();
   510 			service = NULL;
   520             service = NULL;
   511 			}
   521             }
   512 		
   522         
   513 		iResponse->SetResponse( aOperation, error );
   523         iResponse->SetResponse( aOperation, error );
   514   		iResponse->Process();
   524         iResponse->Process();
   515   		return;
   525         return;
   516 		}
   526         }
   517 	else
   527     else
   518 		{
   528         {
   519 		// start service
   529         // start service
   520 		service->Process();	
   530         service->Process(); 
   521 		iSwitchCall = EFalse;
   531         iSwitchCall = EFalse;
   522 		}
   532         }
   523 			
   533             
   524 	COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::StartProcessing() end" );
   534     COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::StartProcessing() end" );
   525     }
   535     }
   526     
   536     
   527 // -----------------------------------------------------------------------------
   537 // -----------------------------------------------------------------------------
   528 // CPhoneHandlerControl::CreateServiceL
   538 // CPhoneHandlerControl::CreateServiceL
   529 // (other items were commented in a header).
   539 // (other items were commented in a header).
   530 // -----------------------------------------------------------------------------
   540 // -----------------------------------------------------------------------------
   531 //
   541 //
   532 MPhoneHandlerService* CPhoneHandlerControl::
   542 MPhoneHandlerService* CPhoneHandlerControl::
   533 	CreateServiceL( const TRemConExtCallHandlingApiOperationId aOperation )
   543     CreateServiceL( const TRemConExtCallHandlingApiOperationId aOperation )
   534     {
   544     {
   535     COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() start" );
   545     COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() start" );
   536       
   546       
   537     MPhoneHandlerService* pService = NULL;
   547     MPhoneHandlerService* pService = NULL;
   538 
   548 
   539     switch( aOperation )
   549     switch( aOperation )
   540         {
   550         {
   541         case ERemConExtAnswerCall:
   551         case ERemConExtAnswerCall:
   542 		    {
   552             {
   543 		    COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() - ERemConExtAnswerCall command" );
   553             COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() - ERemConExtAnswerCall command" );
   544 		    COM_TRACE_1( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() - iCallArray->ExistingCallCount() is %d", iCallArray->ExistingCallCount() );
   554             COM_TRACE_1( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() - iActiveCalls is %d", iActiveCalls );
   545 
   555 
   546 			/*    	    
   556             /*          
   547     	    if( iActiveCalls > 0 )
   557             if( iActiveCalls > 0 )
   548     	    	{
   558                 {
   549     	    	// Multiparty call
   559                 // Multiparty call
   550     	    	iSwitchCall = ETrue;
   560                 iSwitchCall = ETrue;
   551     	    	pService = CPhoneHandlerMultipartyCall::NewL( *this );
   561                 pService = CPhoneHandlerMultipartyCall::NewL( *this );
   552     	    	}
   562                 }
   553     	    else
   563             else
   554     	    	{
   564                 {
   555     	    	// non-multiparty call
   565                 // non-multiparty call
   556     	    	pService = CPhoneHandlerAnswerCall::NewL( *this );
   566                 pService = CPhoneHandlerAnswerCall::NewL( *this );
   557     	    	}
   567                 }
   558     	    */
   568             */
   559     	    pService = CPhoneHandlerAnswerCall::NewL( *this );
   569             pService = CPhoneHandlerAnswerCall::NewL( *this );
   560 
   570 
   561             break;	
   571             break;  
   562 		    }
   572             }
   563 		    
   573             
   564         case ERemConExtEndCall:
   574         case ERemConExtEndCall:
   565 		    {
   575             {
   566 		    COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() - ERemConExtEndCall command" );
   576             COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() - ERemConExtEndCall command" );
   567     	    
   577             
   568 		    pService = CPhoneHandlerEndCall::NewL( *this );
   578             pService = CPhoneHandlerEndCall::NewL( *this );
   569 		    
   579             
   570 		    break;	
   580             break;  
   571 		    }
   581             }
   572 		    
   582             
   573         case ERemConExtAnswerEnd:
   583         case ERemConExtAnswerEnd:
   574         	{
   584             {
   575         	COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() - ERemConExtAnswerEnd command" );
   585             COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() - ERemConExtAnswerEnd command" );
   576     	       
   586                         
   577         	if( iCallArray->ExistingCallCount() )
   587             TInt callState( EPSCTsyCallStateUninitialized );
   578           		{
   588             iProperty.Get( KPSUidCtsyCallInformation, KCTsyCallState, callState ); 
   579           		COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() - call(s) exist" );
   589             
   580           		// If only one call exists and it's state is CCPCall::EStateQueued,
   590             COM_TRACE_1( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() call state = %d", callState );
   581           		// it is actually in ringing state and should be answered.
   591                
   582           		if ( NULL == iCallArray->CallByState( CCPCall::EStateRinging ) 
   592             if( callState != EPSCTsyCallStateUninitialized &&
   583 						&& ( iCallArray->ExistingCallCount() == 1 
   593                 callState != EPSCTsyCallStateNone && 
   584 							&& NULL == iCallArray->CallByState( CCPCall::EStateQueued ) ) )
   594                 callState != EPSCTsyCallStateDisconnecting )
   585 						{
   595                 {
   586 						COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() - no ringing calls" );
   596                 if( callState == EPSCTsyCallStateAlerting ||
   587 						pService = CPhoneHandlerEndCall::NewL( *this, 
   597                     callState == EPSCTsyCallStateDialling ||
   588 														   aOperation );
   598                     callState == EPSCTsyCallStateAnswering ||
   589 						}
   599                     callState == EPSCTsyCallStateConnected ||
   590 				// Ringing call(s) exist
   600                     callState == EPSCTsyCallStateHold )
   591 				else
   601                     {
   592 					{
   602                     pService = CPhoneHandlerEndCall::NewL( *this, 
   593 					if( iCallArray->ExistingCallCount() > 1 )
   603                                                        aOperation );
   594 						{
   604                     }
   595 						COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() - several ringing calls" );
   605                 // callState == EPSTelephonyCallStateRinging
   596 						// multicall case : End call that has existed longer.
   606                 else
   597 						// (From UI viewpoint ringing call is in waiting state.)
   607                     {
   598 						pService = CPhoneHandlerEndCall::NewL( *this, 
   608                     COM_TRACE_1( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() iActiveCalls = %d", iActiveCalls );
   599 													   aOperation );
   609                     if( iActiveCalls > 0 )
   600 						}
   610                         {
   601 					else
   611                         // multicall case : End call that has existed longer.
   602 						{
   612                         // (From UI viewpoint ringing call is in waiting state.)
   603 						COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() - single ringing call" );
   613                         pService = CPhoneHandlerEndCall::NewL( *this, 
   604 						pService = CPhoneHandlerAnswerCall::NewL( 
   614                                                        aOperation );
   605 										*this, 
   615                         if( callState == EPSCTsyCallStateRinging )
   606 										aOperation );
   616                             {
   607 						}
   617                             // In multiparty case the telephony key is not
   608 					}
   618                             // updated. The call amount is updated manually.
   609 		    	}
   619                             iActiveCalls--;
   610 		    else
   620                             }
   611 		    	{
   621                         }
   612 		    	// Send / end button was pressed when there were not 
   622                     else
   613 		    	// any calls active. Response has to be sent back to accessory
   623                         {
   614 		    	// at least for following reasons:
   624                         pService = CPhoneHandlerAnswerCall::NewL( 
   615 		    	
   625                                         *this, 
   616 		    	// 1. RemCon FW releases message related memory only when response
   626                                         aOperation );
   617 		    	// is sent back to accessory.
   627                         }
   618 		    	
   628                     }
   619 		    	// 2. BT accessory key press producing ERemConExtAnswerEnd 
   629                 }
   620 		    	// operation has some other meaning than answer/end call 
   630             else
   621 		    	// and it's processed by proper client. However, there 
   631                 {
   622 		    	// might be a situation where proper client isn't active 
   632                 // Send / end button was pressed when there were not 
   623 		    	// and can't process command. In any case RemCon/BT accessory
   633                 // any calls active. Response has to be sent back to accessory
   624 		    	// requires response to command. That's why PhoneCmdHandler 
   634                 // at least for following reasons:
   625 		    	// sends reponse to command. 
   635                 
   626 								
   636                 // 1. RemCon FW releases message related memory only when response
   627 				iResponse->SetResponse( aOperation, KErrNone );
   637                 // is sent back to accessory.
   628 				pService = iResponse;
   638                 
   629 				}
   639                 // 2. BT accessory key press producing ERemConExtAnswerEnd 
   630         	break;
   640                 // operation has some other meaning than answer/end call 
   631         	} 
   641                 // and it's processed by proper client. However, there 
   632 		    
   642                 // might be a situation where proper client isn't active 
   633 		case ERemConExtDialCall:
   643                 // and can't process command. In any case RemCon/BT accessory
   634 		    {
   644                 // requires response to command. That's why PhoneCmdHandler 
   635 		    COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() - ERemConExtDialCall command" );
   645                 // sends reponse to command. 
   636     	    		    
   646                                 
   637 		   	pService = CPhoneHandlerDialCall::NewL( *this );
   647                 iResponse->SetResponse( aOperation, KErrNone );
   638             break;	
   648                 pService = iResponse;
   639 		    }
   649                 }
   640 		    
   650             break;
   641 		case ERemConExtVoiceDial:
   651             } 
   642         	{
   652             
   643 		    COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() - ERemConExtVoiceDial command" );
   653         case ERemConExtDialCall:
   644     	    		    
   654             {
   645 		    pService = CPhoneHandlerVoiceDial::NewL( *this );
   655             COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() - ERemConExtDialCall command" );
   646             break;	
   656                         
   647 		    }
   657             pService = CPhoneHandlerDialCall::NewL( *this );
   648 		    
   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             
   649         case ERemConExtLastNumberRedial:
   669         case ERemConExtLastNumberRedial:
   650         	{
   670             {
   651 		    COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() - ERemConExtLastNumberRedial command" );
   671             COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() - ERemConExtLastNumberRedial command" );
   652     	    		    
   672                         
   653 		    pService = CPhoneHandlerLastNumberRedial::NewL( *this );
   673             pService = CPhoneHandlerLastNumberRedial::NewL( *this );
   654             break;	
   674             break;  
   655 		    }
   675             }
   656 		    
   676             
   657 		case ERemConExt3WaysCalling:
   677         case ERemConExt3WaysCalling:
   658         	{
   678             {
   659 		    COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() - ERemConExt3WaysCalling command" );
   679             COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() - ERemConExt3WaysCalling command" );
   660     	    		    
   680                         
   661 		    pService = CPhoneHandlerMultipartyCall::NewL( *this );
   681             pService = CPhoneHandlerMultipartyCall::NewL( *this );
   662             break;	
   682             break;  
   663 		    }
   683             }
   664 		    
   684             
   665 		case ERemConExtGenerateDTMF:
   685         case ERemConExtGenerateDTMF:
   666         	{
   686             {
   667 		    COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() - ERemConExtGenerateDTMF command" );
   687             COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() - ERemConExtGenerateDTMF command" );
   668     	    		    
   688                         
   669 		    pService = CPhoneHandlerDTMF::NewL( *this );
   689             pService = CPhoneHandlerDTMF::NewL( *this );
   670             break;	
   690             break;  
   671 		    }
   691             }
   672 		    
   692                     
   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 				    
       
   683         default:
   693         default:
   684         	{
   694             {
   685         	COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() Unspecified state" );
   695             COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() Unspecified state" );
   686 			break;
   696             break;
   687 	       	}
   697             }
   688         };
   698         };
   689         
   699         
   690     COM_TRACE_1( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() end, %d", pService );
   700     COM_TRACE_1( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() end, %d", pService );
   691     return pService;
   701     return pService;
   692     }
   702     }
   693 
   703 
   694 // -----------------------------------------------------------------------------
   704 // -----------------------------------------------------------------------------
   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 // -----------------------------------------------------------------------------
       
   730 // CPhoneHandlerControl::SwitchCall
   705 // CPhoneHandlerControl::SwitchCall
   731 // (other items were commented in a header).
   706 // (other items were commented in a header).
   732 // -----------------------------------------------------------------------------
   707 // -----------------------------------------------------------------------------
   733 //
   708 //
   734 TBool CPhoneHandlerControl::SwitchCall()
   709 TBool CPhoneHandlerControl::SwitchCall()
   735     {
   710     {
   736     return iSwitchCall;
   711     return iSwitchCall;
   737 	}
   712     }   
   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  
       
   783 // ======================== OTHER EXPORTED FUNCTIONS ===========================
   713 // ======================== OTHER EXPORTED FUNCTIONS ===========================
   784 
   714 
   785 // End of File
   715 // End of File