phonecmdhandler/phonecmdhnlr/src/PhoneHandlerControl.cpp
changeset 12 ae8abd0db65c
parent 0 ff3b6d0fd310
child 13 e32024264ebb
equal deleted inserted replaced
0:ff3b6d0fd310 12:ae8abd0db65c
    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>
    37 // <-- QT PHONE START -->
       
    38 //#include <cpbkcontactengine.h> 
       
    39 // <-- QT PHONE END-->
    38 #include <ctsydomainpskeys.h>
    40 #include <ctsydomainpskeys.h>
    39 
    41 
    40 #if 0
    42 #if 0
    41 #include <VoiceUIDomainPSKeys.h>
    43 #include <voiceuidomainpskeys.h> 
    42 #endif
    44 #endif
    43 
    45 
    44 #include <connect/sbdefs.h>
    46 #include <connect/sbdefs.h>
    45 #include <coreapplicationuisdomainpskeys.h>
       
    46 
    47 
    47 // EXTERNAL DATA STRUCTURES
    48 // EXTERNAL DATA STRUCTURES
    48 
    49 
    49 // EXTERNAL FUNCTION PROTOTYPES  
    50 // EXTERNAL FUNCTION PROTOTYPES  
    50 
    51 
    72 // C++ default constructor can NOT contain any code, that
    73 // C++ default constructor can NOT contain any code, that
    73 // might leave.
    74 // might leave.
    74 // -----------------------------------------------------------------------------
    75 // -----------------------------------------------------------------------------
    75 //
    76 //
    76 CPhoneHandlerControl::CPhoneHandlerControl()
    77 CPhoneHandlerControl::CPhoneHandlerControl()
    77 	: iPrevState( EPSCTsyCallStateNone )
    78     : iPrevState( EPSCTsyCallStateNone )
    78     {
    79     {
    79     }
    80     }
    80 
    81 
    81 // -----------------------------------------------------------------------------
    82 // -----------------------------------------------------------------------------
    82 // CPhoneHandlerControl::ConstructL
    83 // CPhoneHandlerControl::ConstructL
    84 // -----------------------------------------------------------------------------
    85 // -----------------------------------------------------------------------------
    85 //
    86 //
    86 void CPhoneHandlerControl::ConstructL( CRemConInterfaceSelector* aIfSelector )
    87 void CPhoneHandlerControl::ConstructL( CRemConInterfaceSelector* aIfSelector )
    87     {
    88     {
    88     COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::ConstructL() start" );
    89     COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::ConstructL() start" );
    89 		
    90         
    90     if( !aIfSelector )
    91     if( !aIfSelector )
    91     	{
    92         {
    92     	COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::ConstructL() Create connection to RemCon." );
    93         COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::ConstructL() Create connection to RemCon." );
    93 	    	
    94             
    94     	// Target connection to RemCon FW hasn't been done.
    95         // Target connection to RemCon FW hasn't been done.
    95     	iInterfaceSelector = CRemConInterfaceSelector::NewL();
    96         iInterfaceSelector = CRemConInterfaceSelector::NewL();
    96 	   	iTarget = CRemConCallHandlingTarget::NewL( *iInterfaceSelector, *this );
    97         iTarget = CRemConCallHandlingTarget::NewL( *iInterfaceSelector, *this );
    97 		iInterfaceSelector->OpenTargetL();
    98         iInterfaceSelector->OpenTargetL();
    98 		}
    99         }
    99 	else
   100     else
   100 		{
   101         {
   101 		COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::ConstructL() Don't create connection to RemCon." );
   102         COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::ConstructL() Don't create connection to RemCon." );
   102 	    		
   103                 
   103 		// Connection to RemCon FW as target has already been done in a process.
   104         // Connection to RemCon FW as target has already been done in a process.
   104 		iTarget = CRemConCallHandlingTarget::NewL( *aIfSelector, *this );
   105         iTarget = CRemConCallHandlingTarget::NewL( *aIfSelector, *this );
   105 		}
   106         }
   106     	
   107         
   107 	iResponse = CPhoneHandlerResponse::NewL( *this );
   108     iResponse = CPhoneHandlerResponse::NewL( *this );
   108 	iCallStateObserver = CPhoneHandlerCallState::NewL( *this );
   109     iCallStateObserver = CPhoneHandlerCallState::NewL( *this );
   109 			
   110             
   110 	COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::ConstructL() end" );
   111     COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::ConstructL() end" );
   111 	}
   112     }
   112 
   113 
   113 // -----------------------------------------------------------------------------
   114 // -----------------------------------------------------------------------------
   114 // CPhoneHandlerControl::NewL
   115 // CPhoneHandlerControl::NewL
   115 // Two-phased constructor.
   116 // Two-phased constructor.
   116 // -----------------------------------------------------------------------------
   117 // -----------------------------------------------------------------------------
   117 //
   118 //
   118 CPhoneHandlerControl* CPhoneHandlerControl::NewL( 
   119 CPhoneHandlerControl* CPhoneHandlerControl::NewL( 
   119 									CRemConInterfaceSelector* aIfSelector )
   120                                     CRemConInterfaceSelector* aIfSelector )
   120     {
   121     {
   121     COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::NewL() start" );
   122     COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::NewL() start" );
   122     
   123     
   123     CPhoneHandlerControl* self = new ( ELeave ) CPhoneHandlerControl();
   124     CPhoneHandlerControl* self = new ( ELeave ) CPhoneHandlerControl();
   124     
   125     
   135 CPhoneHandlerControl::~CPhoneHandlerControl()
   136 CPhoneHandlerControl::~CPhoneHandlerControl()
   136     {
   137     {
   137     COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::~CPhoneHandlerControl() start" );
   138     COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::~CPhoneHandlerControl() start" );
   138     
   139     
   139     if( iInterfaceSelector )
   140     if( iInterfaceSelector )
   140     	{
   141         {
   141     	delete iInterfaceSelector;
   142         delete iInterfaceSelector;
   142        	}
   143         }
   143     
   144     
   144     if( iResponse )
   145     if( iResponse )
   145     	{
   146         {
   146     	iResponse->Delete();
   147         iResponse->Delete();
   147        	}
   148         }
   148        	
   149         
   149     if( iCallStateObserver )
   150     if( iCallStateObserver )
   150     	{
   151         {
   151     	delete iCallStateObserver;
   152         delete iCallStateObserver;
   152     	}
   153         }
   153             
   154             
   154     COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::~CPhoneHandlerControl() end" );
   155     COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::~CPhoneHandlerControl() end" );
   155     }
   156     }
   156 
   157 
   157 // -----------------------------------------------------------------------------
   158 // -----------------------------------------------------------------------------
   233 //
   234 //
   234 void CPhoneHandlerControl::NotifyCallState( const TInt aState )
   235 void CPhoneHandlerControl::NotifyCallState( const TInt aState )
   235     {
   236     {
   236     COM_TRACE_1( "[PHONECMDHANDLER] CPhoneHandlerControl::NotifyCallState() aState=%d", aState );
   237     COM_TRACE_1( "[PHONECMDHANDLER] CPhoneHandlerControl::NotifyCallState() aState=%d", aState );
   237     
   238     
   238 	if( aState == EPSCTsyCallStateConnected && iPrevState != EPSCTsyCallStateHold )
   239     if( aState == EPSCTsyCallStateConnected && iPrevState != EPSCTsyCallStateHold )
   239 		{
   240         {
   240 		COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::NotifyCallState(): iActiveCalls++" );
   241         COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::NotifyCallState(): iActiveCalls++" );
   241 		
   242         
   242 		iActiveCalls++;
   243         iActiveCalls++;
   243 		}
   244         }
   244 	else if( aState == EPSCTsyCallStateDisconnecting && 
   245     else if( aState == EPSCTsyCallStateDisconnecting && 
   245 			( iPrevState == EPSCTsyCallStateConnected || iPrevState == EPSCTsyCallStateHold ))
   246             ( iPrevState == EPSCTsyCallStateConnected || iPrevState == EPSCTsyCallStateHold ))
   246 		{
   247         {
   247 		COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::NotifyCallState(): iActiveCalls--" );
   248         COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::NotifyCallState(): iActiveCalls--" );
   248 		
   249         
   249 		iActiveCalls--;
   250         iActiveCalls--;
   250 		}
   251         }
   251 	else if( aState == EPSCTsyCallStateNone )
   252     else if( aState == EPSCTsyCallStateNone )
   252 		{
   253         {
   253 		COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::NotifyCallState(): iActiveCalls = 0" );
   254         COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::NotifyCallState(): iActiveCalls = 0" );
   254 		iActiveCalls = 0;
   255         iActiveCalls = 0;
   255 		}
   256         }
   256 		
   257         
   257 	iPrevState = aState;
   258     iPrevState = aState;
   258 	COM_TRACE_1( "[PHONECMDHANDLER] CPhoneHandlerControl::NotifyCallState() iActiveCalls=%d", iActiveCalls );
   259     COM_TRACE_1( "[PHONECMDHANDLER] CPhoneHandlerControl::NotifyCallState() iActiveCalls=%d", iActiveCalls );
   259 	}
   260     }
   260 
   261 
   261 // -----------------------------------------------------------------------------
   262 // -----------------------------------------------------------------------------
   262 // CPhoneHandlerControl::AnswerCall
   263 // CPhoneHandlerControl::AnswerCall
   263 // (other items were commented in a header).
   264 // (other items were commented in a header).
   264 // -----------------------------------------------------------------------------
   265 // -----------------------------------------------------------------------------
   265 //
   266 //
   266 void CPhoneHandlerControl::AnswerCall()
   267 void CPhoneHandlerControl::AnswerCall()
   267 	{
   268     {
   268 	COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::AnswerCall() start" );
   269     COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::AnswerCall() start" );
   269 	
   270     
   270 	StartProcessing( ERemConExtAnswerCall );
   271     StartProcessing( ERemConExtAnswerCall );
   271 	
   272     
   272 	COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::AnswerCall() end" );
   273     COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::AnswerCall() end" );
   273     }
   274     }
   274 	
   275     
   275 // -----------------------------------------------------------------------------
   276 // -----------------------------------------------------------------------------
   276 // CPhoneHandlerControl::EndCall
   277 // CPhoneHandlerControl::EndCall
   277 // (other items were commented in a header).
   278 // (other items were commented in a header).
   278 // -----------------------------------------------------------------------------
   279 // -----------------------------------------------------------------------------
   279 //
   280 //
   280 void CPhoneHandlerControl::EndCall()
   281 void CPhoneHandlerControl::EndCall()
   281 	{
   282     {
   282 	COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::EndCall() start" );
   283     COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::EndCall() start" );
   283     
   284     
   284     StartProcessing( ERemConExtEndCall );
   285     StartProcessing( ERemConExtEndCall );
   285     	    
   286             
   286 	COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::EndCall() end" );
   287     COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::EndCall() end" );
   287     }
   288     }
   288     
   289     
   289 // -----------------------------------------------------------------------------
   290 // -----------------------------------------------------------------------------
   290 // CPhoneHandlerControl::AnswerEndCall
   291 // CPhoneHandlerControl::AnswerEndCall
   291 // (other items were commented in a header).
   292 // (other items were commented in a header).
   292 // -----------------------------------------------------------------------------
   293 // -----------------------------------------------------------------------------
   293 //
   294 //
   294 void CPhoneHandlerControl::AnswerEndCall()
   295 void CPhoneHandlerControl::AnswerEndCall()
   295 	{
   296     {
   296 	COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::AnswerEndCall() start" );
   297     COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::AnswerEndCall() start" );
   297     
   298     
   298     StartProcessing( ERemConExtAnswerEnd );
   299     StartProcessing( ERemConExtAnswerEnd );
   299     	   
   300            
   300 	COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::AnswerEndCall() end" );
   301     COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::AnswerEndCall() end" );
   301     }
   302     }
   302 
   303 
   303 // -----------------------------------------------------------------------------
   304 // -----------------------------------------------------------------------------
   304 // CPhoneHandlerControl::VoiceDial
   305 // CPhoneHandlerControl::VoiceDial
   305 // (other items were commented in a header).
   306 // (other items were commented in a header).
   306 // -----------------------------------------------------------------------------
   307 // -----------------------------------------------------------------------------
   307 //
   308 //
   308 #if 0 // SCB CR EHSA-7APJWF: SIND subscribes to RemCon directly	
   309 #if 0 // SCB CR EHSA-7APJWF: SIND subscribes to RemCon directly 
   309 void CPhoneHandlerControl::VoiceDial( const TBool aActivate )
   310 void CPhoneHandlerControl::VoiceDial( const TBool aActivate )
   310     {
   311     {
   311     COM_TRACE_1( "[PHONECMDHANDLER] CPhoneHandlerControl::VoiceDial() aActivate=%d", aActivate );
   312     COM_TRACE_1( "[PHONECMDHANDLER] CPhoneHandlerControl::VoiceDial() aActivate=%d", aActivate );
   312 
   313 
   313     TInt callState( EPSCTsyCallStateUninitialized );
   314     TInt callState( EPSCTsyCallStateUninitialized );
   320         {
   321         {
   321         TInt voiceUiState( KVoiceUiIsClose );
   322         TInt voiceUiState( KVoiceUiIsClose );
   322         iProperty.Get( KPSUidVoiceUiAccMonitor, KVoiceUiOpenKey, voiceUiState ); 
   323         iProperty.Get( KPSUidVoiceUiAccMonitor, KVoiceUiOpenKey, voiceUiState ); 
   323 
   324 
   324         if( voiceUiState == KVoiceUiIsOpen )
   325         if( voiceUiState == KVoiceUiIsOpen )
   325 	        {
   326             {
   326 	        COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::VoiceDial() voice UI is open!" );
   327             COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::VoiceDial() voice UI is open!" );
   327 	        iProperty.Set( KPSUidVoiceUiAccMonitor , KVoiceUiAccessoryEvent, ERemConExtVoiceDial );
   328             iProperty.Set( KPSUidVoiceUiAccMonitor , KVoiceUiAccessoryEvent, ERemConExtVoiceDial );
   328 	        iResponse->SetResponse( ERemConExtVoiceDial, KErrNone );
   329             iResponse->SetResponse( ERemConExtVoiceDial, KErrNone );
   329 	        iResponse->Process();
   330             iResponse->Process();
   330 	        }
   331             }
   331         else
   332         else
   332 	        {
   333             {
   333 	        iActivate = aActivate;
   334             iActivate = aActivate;
   334 	        StartProcessing( ERemConExtVoiceDial );
   335             StartProcessing( ERemConExtVoiceDial );
   335 	        }
   336             }
   336         }
   337         }
   337     else
   338     else
   338         {
   339         {
   339         iResponse->SetResponse( ERemConExtVoiceDial, KErrNone );
   340         iResponse->SetResponse( ERemConExtVoiceDial, KErrNone );
   340         iResponse->Process();
   341         iResponse->Process();
   341         }
   342         }
   342 
   343 
   343     COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::VoiceDial() end" );
   344     COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::VoiceDial() end" );
   344     }
   345     }
   345 #else	
   346 #else   
   346 void CPhoneHandlerControl::VoiceDial( const TBool /*aActivate*/ )
   347 void CPhoneHandlerControl::VoiceDial( const TBool /*aActivate*/ )
   347     {
   348     {
   348     COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::VoiceDial()" );
   349     COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::VoiceDial()" );
   349 
   350 
   350     if ( IsAutoLockOn() && !IsBTAccessoryCmd() )
       
   351         {
       
   352         iResponse->SetResponse( ERemConExtVoiceDial, KErrAccessDenied );
       
   353         iResponse->Process();
       
   354         return;
       
   355         }
       
   356         
       
   357     iResponse->SetResponse( ERemConExtVoiceDial, KErrNone );
   351     iResponse->SetResponse( ERemConExtVoiceDial, KErrNone );
   358     iResponse->Process();
   352     iResponse->Process();
   359 
   353 
   360     COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::VoiceDial() end" );
   354     COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::VoiceDial() end" );
   361     }
   355     }
   364 // CPhoneHandlerControl::LastNumberRedial
   358 // CPhoneHandlerControl::LastNumberRedial
   365 // (other items were commented in a header).
   359 // (other items were commented in a header).
   366 // -----------------------------------------------------------------------------
   360 // -----------------------------------------------------------------------------
   367 //
   361 //
   368 void CPhoneHandlerControl::LastNumberRedial( )
   362 void CPhoneHandlerControl::LastNumberRedial( )
   369 	{
   363     {
   370 	COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::LastNumberRedial() start" );
   364     COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::LastNumberRedial() start" );
   371 	
   365     
   372 	if ( IsAutoLockOn() && !IsBTAccessoryCmd() )
   366     StartProcessing( ERemConExtLastNumberRedial );
   373         {
   367     
   374         iResponse->SetResponse( ERemConExtLastNumberRedial, KErrAccessDenied );
   368     COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::LastNumberRedial() end" );
       
   369     }
       
   370 
       
   371 // -----------------------------------------------------------------------------
       
   372 // CPhoneHandlerControl::DialCall
       
   373 // (other items were commented in a header).
       
   374 // -----------------------------------------------------------------------------
       
   375 //
       
   376 void CPhoneHandlerControl::DialCall( const TDesC8& aTelNumber )
       
   377     {
       
   378     COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::DialCall() start" );
       
   379     
       
   380     // Check aTelNumber range    
       
   381     if( KPhCltTelephoneNumberLength < aTelNumber.Length() )
       
   382         {
       
   383         COM_TRACE_1( "[PHONECMDHANDLER] CPhoneHandlerControl::DialCall() number value=%d too long", aTelNumber.Size() );
       
   384         iResponse->SetResponse( ERemConExtDialCall, KErrArgument );
   375         iResponse->Process();
   385         iResponse->Process();
   376         return;
   386         return; 
   377         }
   387         }
   378 
   388     
   379 	StartProcessing( ERemConExtLastNumberRedial );
   389     iTelNumber.Copy( aTelNumber );
   380 	
   390                     
   381 	COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::LastNumberRedial() end" );
       
   382 	}
       
   383 
       
   384 // -----------------------------------------------------------------------------
       
   385 // CPhoneHandlerControl::DialCall
       
   386 // (other items were commented in a header).
       
   387 // -----------------------------------------------------------------------------
       
   388 //
       
   389 void CPhoneHandlerControl::DialCall( const TDesC8& aTelNumber )
       
   390 	{
       
   391 	COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::DialCall() start" );
       
   392     
       
   393 	if ( IsAutoLockOn() && !IsBTAccessoryCmd() )
       
   394 	        {
       
   395  	        iResponse->SetResponse( ERemConExtDialCall, KErrAccessDenied );
       
   396 	        iResponse->Process();
       
   397 	        return;
       
   398 	        }
       
   399  	
       
   400     // Check aTelNumber range    
       
   401    	if( KPhCltTelephoneNumberLength < aTelNumber.Length() )
       
   402    		{
       
   403   		COM_TRACE_1( "[PHONECMDHANDLER] CPhoneHandlerControl::DialCall() number value=%d too long", aTelNumber.Size() );
       
   404   		iResponse->SetResponse( ERemConExtDialCall, KErrArgument );
       
   405   		iResponse->Process();
       
   406   		return; 
       
   407   		}
       
   408   	
       
   409   	iTelNumber.Copy( aTelNumber );
       
   410   	      	  	    
       
   411     StartProcessing( ERemConExtDialCall );
   391     StartProcessing( ERemConExtDialCall );
   412     
   392     
   413 	COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::DialCall() end" );
   393     COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::DialCall() end" );
   414 	}
   394     }
   415 
   395 
   416 // -----------------------------------------------------------------------------
   396 // -----------------------------------------------------------------------------
   417 // CPhoneHandlerControl::MultipartyCalling
   397 // CPhoneHandlerControl::MultipartyCalling
   418 // Method supports multiparty call handling according to BT handsfree profile 
   398 // Method supports multiparty call handling according to BT handsfree profile 
   419 // (HFP) 1.5. BT HFP 1.5 defines contents of aData parameter as follows: 0, 1, 
   399 // (HFP) 1.5. BT HFP 1.5 defines contents of aData parameter as follows: 0, 1, 
   437 // 
   417 // 
   438 // (other items were commented in a header).
   418 // (other items were commented in a header).
   439 // -----------------------------------------------------------------------------
   419 // -----------------------------------------------------------------------------
   440 //
   420 //
   441 void CPhoneHandlerControl::MultipartyCalling( const TDesC8& aData )
   421 void CPhoneHandlerControl::MultipartyCalling( const TDesC8& aData )
   442 	{
   422     {
   443 	TBool error( EFalse );
   423     TBool error( EFalse );
   444 	iChldCommand = 0;
   424     iChldCommand = 0;
   445 	iChldCallNumber = 0;
   425     iChldCallNumber = 0;
   446 	TBuf8< KRemConExtParamMaxLength > buf( aData );
   426     TBuf8< KRemConExtParamMaxLength > buf( aData );
   447 	buf.Trim();
   427     buf.Trim();
   448 	TInt length = buf.Length();
   428     TInt length = buf.Length();
   449 	
   429     
   450 	// Check invalid number of characters
   430     // Check invalid number of characters
   451 	if ( length < KMultipartyCallMinParam || length > KMultipartyCallMaxParam )
   431     if ( length < KMultipartyCallMinParam || length > KMultipartyCallMaxParam )
   452 	    {
   432         {
   453 	    error = ETrue;
   433         error = ETrue;
   454 	    }
   434         }
   455 	else
   435     else
   456 	    {
   436         {
   457 	    TLex8 param;
   437         TLex8 param;
   458 	    // Set command	
   438         // Set command  
   459 		param.Assign( buf.Mid( 0, 1 ) );
   439         param.Assign( buf.Mid( 0, 1 ) );
   460 		if( param.Val( iChldCommand ) != KErrNone )
   440         if( param.Val( iChldCommand ) != KErrNone )
   461 			{
   441             {
   462 			error = ETrue;
   442             error = ETrue;
   463 			}
   443             }
   464 		else if ( length == KMultipartyCallMaxParam )
   444         else if ( length == KMultipartyCallMaxParam )
   465 	    	{
   445             {
   466 			// Set call number
   446             // Set call number
   467 			param.Assign( buf.Mid(1) );
   447             param.Assign( buf.Mid(1) );
   468 			if( param.Val( iChldCallNumber ) != KErrNone )
   448             if( param.Val( iChldCallNumber ) != KErrNone )
   469 				{
   449                 {
   470 				error = ETrue;
   450                 error = ETrue;
   471 				}
   451                 }
   472 	    	}
   452             }
   473 	    }
   453         }
   474 
   454 
   475 	if( error )
   455     if( error )
   476 		{
   456         {
   477 		// Invalid command 
   457         // Invalid command 
   478 		iResponse->SetResponse( ERemConExt3WaysCalling, KErrArgument );
   458         iResponse->SetResponse( ERemConExt3WaysCalling, KErrArgument );
   479   		iResponse->Process();
   459         iResponse->Process();
   480   		return;	
   460         return; 
   481 		}
   461         }
   482 		
   462         
   483 	COM_TRACE_2( "[PHONECMDHANDLER] CPhoneHandlerControl::MultipartyCalling() iChldCommand=%d, iChldCallNumber=%d", iChldCommand, iChldCallNumber );
   463     COM_TRACE_2( "[PHONECMDHANDLER] CPhoneHandlerControl::MultipartyCalling() iChldCommand=%d, iChldCallNumber=%d", iChldCommand, iChldCallNumber );
   484 		
   464         
   485 	StartProcessing( ERemConExt3WaysCalling );
   465     StartProcessing( ERemConExt3WaysCalling );
   486 	
   466     
   487 	COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::MultipartyCalling() end" );
   467     COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::MultipartyCalling() end" );
   488 	}
   468     }
   489 	
   469     
   490 // -----------------------------------------------------------------------------
   470 // -----------------------------------------------------------------------------
   491 // CPhoneHandlerControl::GenerateDTMF
   471 // CPhoneHandlerControl::GenerateDTMF
   492 // (other items were commented in a header).
   472 // (other items were commented in a header).
   493 // -----------------------------------------------------------------------------
   473 // -----------------------------------------------------------------------------
   494 //
   474 //
   495 void CPhoneHandlerControl::GenerateDTMF( const TChar aChar )
   475 void CPhoneHandlerControl::GenerateDTMF( const TChar aChar )
   496 	{
   476     {
   497 	COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::GenerateDTMF() start" );
   477     COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::GenerateDTMF() start" );
   498 	
   478     
   499 	iChar = aChar;
   479     iChar = aChar;
   500 	
   480     
   501 	StartProcessing( ERemConExtGenerateDTMF );
   481     StartProcessing( ERemConExtGenerateDTMF );
   502 	
   482     
   503 	COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::GenerateDTMF() end" );
   483     COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::GenerateDTMF() end" );
   504 	}
   484     }
   505 	
   485     
   506 // -----------------------------------------------------------------------------
   486 // -----------------------------------------------------------------------------
   507 // CPhoneHandlerControl::SpeedDial
   487 // CPhoneHandlerControl::SpeedDial
   508 // (other items were commented in a header).
   488 // (other items were commented in a header).
   509 // -----------------------------------------------------------------------------
   489 // -----------------------------------------------------------------------------
   510 //
   490 //
   511 void CPhoneHandlerControl::SpeedDial( const TInt aIndex )
   491 void CPhoneHandlerControl::SpeedDial( const TInt aIndex )
   512 	{
   492     {
   513 	COM_TRACE_1( "[PHONECMDHANDLER] CPhoneHandlerControl::SpeedDial() aIndex=%d", aIndex );
   493     COM_TRACE_1( "[PHONECMDHANDLER] CPhoneHandlerControl::SpeedDial() aIndex=%d", aIndex );
   514 
   494 
   515 	iIndex = aIndex;
   495     iIndex = aIndex;
   516 	
   496     
   517 	StartProcessing( ERemConExtSpeedDial );
   497     StartProcessing( ERemConExtSpeedDial );
   518 	
   498     
   519 	COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::SpeedDial() end" );
   499     COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::SpeedDial() end" );
   520 	}
   500     }
   521 
   501 
   522 // -----------------------------------------------------------------------------
   502 // -----------------------------------------------------------------------------
   523 // CPhoneHandlerControl::StartProcessing
   503 // CPhoneHandlerControl::StartProcessing
   524 // Creates an object that executes call handling command received from 
   504 // Creates an object that executes call handling command received from 
   525 // accessory.
   505 // accessory.
   526 // (other items were commented in a header).
   506 // (other items were commented in a header).
   527 // -----------------------------------------------------------------------------
   507 // -----------------------------------------------------------------------------
   528 //
   508 //
   529 void CPhoneHandlerControl::StartProcessing(	
   509 void CPhoneHandlerControl::StartProcessing( 
   530 	const TRemConExtCallHandlingApiOperationId aOperation )
   510     const TRemConExtCallHandlingApiOperationId aOperation )
   531 	{
   511     {
   532 	COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::StartProcessing() start" );
   512     COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::StartProcessing() start" );
   533     		
   513             
   534 	// Create a service
   514     // Create a service
   535 	MPhoneHandlerService* service = NULL;
   515     MPhoneHandlerService* service = NULL;
   536 	TInt error( KErrNone );
   516     TInt error( KErrNone );
   537 	TRAP( error, service = CreateServiceL( aOperation ) ); 
   517     TRAP( error, service = CreateServiceL( aOperation ) ); 
   538 		
   518         
   539 	COM_TRACE_1( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() returned %d", error );
   519     COM_TRACE_1( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() returned %d", error );
   540 		
   520         
   541 	if( error )
   521     if( error )
   542 		{
   522         {
   543 		COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::StartProcessing(): service wasn't created succesfully." );
   523         COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::StartProcessing(): service wasn't created succesfully." );
   544 		
   524         
   545 		// An error happened. Delete service, if it exists.
   525         // An error happened. Delete service, if it exists.
   546 		if( service )
   526         if( service )
   547 			{
   527             {
   548 			service->Delete();
   528             service->Delete();
   549 			service = NULL;
   529             service = NULL;
   550 			}
   530             }
   551 		
   531         
   552 		iResponse->SetResponse( aOperation, error );
   532         iResponse->SetResponse( aOperation, error );
   553   		iResponse->Process();
   533         iResponse->Process();
   554   		return;
   534         return;
   555 		}
   535         }
   556 	else
   536     else
   557 		{
   537         {
   558 		// start service
   538         // start service
   559 		service->Process();	
   539         service->Process(); 
   560 		iSwitchCall = EFalse;
   540         iSwitchCall = EFalse;
   561 		}
   541         }
   562 			
   542             
   563 	COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::StartProcessing() end" );
   543     COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::StartProcessing() end" );
   564     }
   544     }
   565     
   545     
   566 // -----------------------------------------------------------------------------
   546 // -----------------------------------------------------------------------------
   567 // CPhoneHandlerControl::CreateServiceL
   547 // CPhoneHandlerControl::CreateServiceL
   568 // (other items were commented in a header).
   548 // (other items were commented in a header).
   569 // -----------------------------------------------------------------------------
   549 // -----------------------------------------------------------------------------
   570 //
   550 //
   571 MPhoneHandlerService* CPhoneHandlerControl::
   551 MPhoneHandlerService* CPhoneHandlerControl::
   572 	CreateServiceL( const TRemConExtCallHandlingApiOperationId aOperation )
   552     CreateServiceL( const TRemConExtCallHandlingApiOperationId aOperation )
   573     {
   553     {
   574     COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() start" );
   554     COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() start" );
   575       
   555       
   576     MPhoneHandlerService* pService = NULL;
   556     MPhoneHandlerService* pService = NULL;
   577 
   557 
   578     switch( aOperation )
   558     switch( aOperation )
   579         {
   559         {
   580         case ERemConExtAnswerCall:
   560         case ERemConExtAnswerCall:
   581 		    {
   561             {
   582 		    COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() - ERemConExtAnswerCall command" );
   562             COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() - ERemConExtAnswerCall command" );
   583 		    COM_TRACE_1( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() - iActiveCalls is %d", iActiveCalls );
   563             COM_TRACE_1( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() - iActiveCalls is %d", iActiveCalls );
   584 
   564 
   585 			/*    	    
   565             /*          
   586     	    if( iActiveCalls > 0 )
   566             if( iActiveCalls > 0 )
   587     	    	{
   567                 {
   588     	    	// Multiparty call
   568                 // Multiparty call
   589     	    	iSwitchCall = ETrue;
   569                 iSwitchCall = ETrue;
   590     	    	pService = CPhoneHandlerMultipartyCall::NewL( *this );
   570                 pService = CPhoneHandlerMultipartyCall::NewL( *this );
   591     	    	}
   571                 }
   592     	    else
   572             else
   593     	    	{
   573                 {
   594     	    	// non-multiparty call
   574                 // non-multiparty call
   595     	    	pService = CPhoneHandlerAnswerCall::NewL( *this );
   575                 pService = CPhoneHandlerAnswerCall::NewL( *this );
   596     	    	}
   576                 }
   597     	    */
   577             */
   598     	    pService = CPhoneHandlerAnswerCall::NewL( *this );
   578             pService = CPhoneHandlerAnswerCall::NewL( *this );
   599 
   579 
   600             break;	
   580             break;  
   601 		    }
   581             }
   602 		    
   582             
   603         case ERemConExtEndCall:
   583         case ERemConExtEndCall:
   604 		    {
   584             {
   605 		    COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() - ERemConExtEndCall command" );
   585             COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() - ERemConExtEndCall command" );
   606     	    
   586             
   607 		    pService = CPhoneHandlerEndCall::NewL( *this );
   587             pService = CPhoneHandlerEndCall::NewL( *this );
   608 		    
   588             
   609 		    break;	
   589             break;  
   610 		    }
   590             }
   611 		    
   591             
   612         case ERemConExtAnswerEnd:
   592         case ERemConExtAnswerEnd:
   613         	{
   593             {
   614         	COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() - ERemConExtAnswerEnd command" );
   594             COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() - ERemConExtAnswerEnd command" );
   615     	            	
   595                         
   616         	TInt callState( EPSCTsyCallStateUninitialized );
   596             TInt callState( EPSCTsyCallStateUninitialized );
   617     		iProperty.Get( KPSUidCtsyCallInformation, KCTsyCallState, callState ); 
   597             iProperty.Get( KPSUidCtsyCallInformation, KCTsyCallState, callState ); 
   618     		
   598             
   619     		COM_TRACE_1( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() call state = %d", callState );
   599             COM_TRACE_1( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() call state = %d", callState );
   620 			   
   600                
   621 		    if( callState != EPSCTsyCallStateUninitialized &&
   601             if( callState != EPSCTsyCallStateUninitialized &&
   622 		    	callState != EPSCTsyCallStateNone && 
   602                 callState != EPSCTsyCallStateNone && 
   623 		    	callState != EPSCTsyCallStateDisconnecting )
   603                 callState != EPSCTsyCallStateDisconnecting )
   624 		    	{
   604                 {
   625 		    	if( callState == EPSCTsyCallStateAlerting ||
   605                 if( callState == EPSCTsyCallStateAlerting ||
   626 		    		callState == EPSCTsyCallStateDialling ||
   606                     callState == EPSCTsyCallStateDialling ||
   627 		    		callState == EPSCTsyCallStateAnswering ||
   607                     callState == EPSCTsyCallStateAnswering ||
   628 		    		callState == EPSCTsyCallStateConnected ||
   608                     callState == EPSCTsyCallStateConnected ||
   629 		    		callState == EPSCTsyCallStateHold )
   609                     callState == EPSCTsyCallStateHold )
   630 		    		{
   610                     {
   631 		    		pService = CPhoneHandlerEndCall::NewL( *this, 
   611                     pService = CPhoneHandlerEndCall::NewL( *this, 
   632 		    									   	   aOperation );
   612                                                        aOperation );
   633 		    		}
   613                     }
   634 		    	// callState == EPSTelephonyCallStateRinging
   614                 // callState == EPSTelephonyCallStateRinging
   635 		    	else
   615                 else
   636 		    		{
   616                     {
   637 		    		COM_TRACE_1( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() iActiveCalls = %d", iActiveCalls );
   617                     COM_TRACE_1( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() iActiveCalls = %d", iActiveCalls );
   638 		    		if( iActiveCalls > 0 )
   618                     if( iActiveCalls > 0 )
   639 		    			{
   619                         {
   640 		    			// multicall case : End call that has existed longer.
   620                         // multicall case : End call that has existed longer.
   641 		    			// (From UI viewpoint ringing call is in waiting state.)
   621                         // (From UI viewpoint ringing call is in waiting state.)
   642 		    			pService = CPhoneHandlerEndCall::NewL( *this, 
   622                         pService = CPhoneHandlerEndCall::NewL( *this, 
   643 		    									   	   aOperation );
   623                                                        aOperation );
   644 		    	        if( callState == EPSCTsyCallStateRinging )
   624                         if( callState == EPSCTsyCallStateRinging )
   645 		    	            {
   625                             {
   646 		    	            // In multiparty case the telephony key is not
   626                             // In multiparty case the telephony key is not
   647 		    	            // updated. The call amount is updated manually.
   627                             // updated. The call amount is updated manually.
   648 		    	            iActiveCalls--;
   628                             iActiveCalls--;
   649 		    	            }
   629                             }
   650 		    			}
   630                         }
   651 		    		else
   631                     else
   652 		    			{
   632                         {
   653 		    			pService = CPhoneHandlerAnswerCall::NewL( 
   633                         pService = CPhoneHandlerAnswerCall::NewL( 
   654 		    							*this, 
   634                                         *this, 
   655 		    							aOperation );
   635                                         aOperation );
   656 		    			}
   636                         }
   657 		    		}
   637                     }
   658 		    	}
   638                 }
   659 		    else
   639             else
   660 		    	{
   640                 {
   661 		    	// Send / end button was pressed when there were not 
   641                 // Send / end button was pressed when there were not 
   662 		    	// any calls active. Response has to be sent back to accessory
   642                 // any calls active. Response has to be sent back to accessory
   663 		    	// at least for following reasons:
   643                 // at least for following reasons:
   664 		    	
   644                 
   665 		    	// 1. RemCon FW releases message related memory only when response
   645                 // 1. RemCon FW releases message related memory only when response
   666 		    	// is sent back to accessory.
   646                 // is sent back to accessory.
   667 		    	
   647                 
   668 		    	// 2. BT accessory key press producing ERemConExtAnswerEnd 
   648                 // 2. BT accessory key press producing ERemConExtAnswerEnd 
   669 		    	// operation has some other meaning than answer/end call 
   649                 // operation has some other meaning than answer/end call 
   670 		    	// and it's processed by proper client. However, there 
   650                 // and it's processed by proper client. However, there 
   671 		    	// might be a situation where proper client isn't active 
   651                 // might be a situation where proper client isn't active 
   672 		    	// and can't process command. In any case RemCon/BT accessory
   652                 // and can't process command. In any case RemCon/BT accessory
   673 		    	// requires response to command. That's why PhoneCmdHandler 
   653                 // requires response to command. That's why PhoneCmdHandler 
   674 		    	// sends reponse to command. 
   654                 // sends reponse to command. 
   675 								
   655                                 
   676 				iResponse->SetResponse( aOperation, KErrNone );
   656                 iResponse->SetResponse( aOperation, KErrNone );
   677 				pService = iResponse;
   657                 pService = iResponse;
   678 				}
   658                 }
   679         	break;
   659             break;
   680         	} 
   660             } 
   681 		    
   661             
   682 		case ERemConExtDialCall:
   662         case ERemConExtDialCall:
   683 		    {
   663             {
   684 		    COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() - ERemConExtDialCall command" );
   664             COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() - ERemConExtDialCall command" );
   685     	    		    
   665                         
   686 		   	pService = CPhoneHandlerDialCall::NewL( *this );
   666             pService = CPhoneHandlerDialCall::NewL( *this );
   687             break;	
   667             break;  
   688 		    }
   668             }
   689 		    
   669             
   690 		case ERemConExtVoiceDial:
   670         case ERemConExtVoiceDial:
   691         	{
   671             {
   692 		    COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() - ERemConExtVoiceDial command" );
   672             COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() - ERemConExtVoiceDial command" );
   693     	    		    
   673                         
   694 		    pService = CPhoneHandlerVoiceDial::NewL( *this );
   674             pService = CPhoneHandlerVoiceDial::NewL( *this );
   695             break;	
   675             break;  
   696 		    }
   676             }
   697 		    
   677             
   698         case ERemConExtLastNumberRedial:
   678         case ERemConExtLastNumberRedial:
   699         	{
   679             {
   700 		    COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() - ERemConExtLastNumberRedial command" );
   680             COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() - ERemConExtLastNumberRedial command" );
   701     	    		    
   681                         
   702 		    pService = CPhoneHandlerLastNumberRedial::NewL( *this );
   682             pService = CPhoneHandlerLastNumberRedial::NewL( *this );
   703             break;	
   683             break;  
   704 		    }
   684             }
   705 		    
   685             
   706 		case ERemConExt3WaysCalling:
   686         case ERemConExt3WaysCalling:
   707         	{
   687             {
   708 		    COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() - ERemConExt3WaysCalling command" );
   688             COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() - ERemConExt3WaysCalling command" );
   709     	    		    
   689                         
   710 		    pService = CPhoneHandlerMultipartyCall::NewL( *this );
   690             pService = CPhoneHandlerMultipartyCall::NewL( *this );
   711             break;	
   691             break;  
   712 		    }
   692             }
   713 		    
   693             
   714 		case ERemConExtGenerateDTMF:
   694         case ERemConExtGenerateDTMF:
   715         	{
   695             {
   716 		    COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() - ERemConExtGenerateDTMF command" );
   696             COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() - ERemConExtGenerateDTMF command" );
   717     	    		    
   697                         
   718 		    pService = CPhoneHandlerDTMF::NewL( *this );
   698             pService = CPhoneHandlerDTMF::NewL( *this );
   719             break;	
   699             break;  
   720 		    }
   700             }
   721 		    
   701             
   722         case ERemConExtSpeedDial:
   702         case ERemConExtSpeedDial:
   723         	{
   703             {
   724         	COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() - ERemConExtSpeedDial command" );
   704             COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() - ERemConExtSpeedDial command" );
   725     	            	
   705                         
   726         	InitializeSpeedDialL();
   706             InitializeSpeedDialL();
   727         	pService = CPhoneHandlerDialCall::NewL( *this, 
   707             pService = CPhoneHandlerDialCall::NewL( *this, 
   728         											aOperation );
   708                                                     aOperation );
   729             break;	
   709             break;  
   730 		    } 
   710             } 
   731 				    
   711                     
   732         default:
   712         default:
   733         	{
   713             {
   734         	COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() Unspecified state" );
   714             COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() Unspecified state" );
   735 			break;
   715             break;
   736 	       	}
   716             }
   737         };
   717         };
   738         
   718         
   739     COM_TRACE_1( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() end, %d", pService );
   719     COM_TRACE_1( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() end, %d", pService );
   740     return pService;
   720     return pService;
   741     }
   721     }
   745 // (other items were commented in a header).
   725 // (other items were commented in a header).
   746 // -----------------------------------------------------------------------------
   726 // -----------------------------------------------------------------------------
   747 //
   727 //
   748 void CPhoneHandlerControl::InitializeSpeedDialL()
   728 void CPhoneHandlerControl::InitializeSpeedDialL()
   749     {
   729     {
       
   730     
       
   731 // <-- QT PHONE START -->
       
   732 /*
   750     COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::InitializeSpeedDialL() start" );
   733     COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::InitializeSpeedDialL() start" );
   751     
   734     
   752     // first check contack engine is not in busy
   735     // first check contack engine is not in busy
   753   TInt cntEngState( 0 );
   736   TInt cntEngState( 0 );
   754 	TInt err = iProperty.Get( KUidSystemCategory, conn::KUidBackupRestoreKey, cntEngState ); 
   737     TInt err = iProperty.Get( KUidSystemCategory, conn::KUidBackupRestoreKey, cntEngState ); 
   755   
   738   
   756 	if( err == KErrNotFound || cntEngState == 0 || 
   739     if( err == KErrNotFound || cntEngState == 0 || 
   757 			cntEngState & conn::KBURPartTypeMask == conn::EBURNormal || 
   740             cntEngState & conn::KBURPartTypeMask == conn::EBURNormal || 
   758 			cntEngState & conn::KBackupIncTypeMask == conn::ENoBackup )
   741             cntEngState & conn::KBackupIncTypeMask == conn::ENoBackup )
   759 		{
   742         {
   760 	    // Get phone number from phonebook by index	
   743         // Get phone number from phonebook by index 
   761 		CPbkContactEngine* ptr = CPbkContactEngine::NewL();
   744         CPbkContactEngine* ptr = CPbkContactEngine::NewL();
   762     CleanupStack::PushL( ptr );       
   745     CleanupStack::PushL( ptr );       
   763 		TRACE_ASSERT( ptr != NULL );
   746         TRACE_ASSERT( ptr != NULL );
   764 		ptr->GetSpeedDialFieldL( iIndex, iTelNumber );
   747         ptr->GetSpeedDialFieldL( iIndex, iTelNumber );
   765 		COM_TRACE_1( "[PHONECMDHANDLER] CPhoneHandlerControl::InitializeSpeedDialL() speed dial number is %S", &iTelNumber );
   748         COM_TRACE_1( "[PHONECMDHANDLER] CPhoneHandlerControl::InitializeSpeedDialL() speed dial number is %S", &iTelNumber );
   766 		CleanupStack::PopAndDestroy( ptr );
   749         CleanupStack::PopAndDestroy( ptr );
   767 		}
   750         }
   768 	else
   751     else
   769 		{
   752         {
   770 		// contact engine is in busy
   753         // contact engine is in busy
   771 		COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::InitializeSpeedDialL() contact engine is in backup/restore" );
   754         COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::InitializeSpeedDialL() contact engine is in backup/restore" );
   772 		User::Leave( KErrInUse );
   755         User::Leave( KErrInUse );
   773 		}
   756         }
   774 		
   757 */  
   775 	COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::InitializeSpeedDialL() end" );
   758 // <-- QT PHONE END -->
   776 	}
   759 
       
   760     COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::InitializeSpeedDialL() end" );
       
   761     }
   777 
   762 
   778 // -----------------------------------------------------------------------------
   763 // -----------------------------------------------------------------------------
   779 // CPhoneHandlerControl::SwitchCall
   764 // CPhoneHandlerControl::SwitchCall
   780 // (other items were commented in a header).
   765 // (other items were commented in a header).
   781 // -----------------------------------------------------------------------------
   766 // -----------------------------------------------------------------------------
   782 //
   767 //
   783 TBool CPhoneHandlerControl::SwitchCall()
   768 TBool CPhoneHandlerControl::SwitchCall()
   784     {
   769     {
   785     return iSwitchCall;
   770     return iSwitchCall;
   786 	}
   771     }   
   787 
       
   788 // ---------------------------------------------------------
       
   789 // CPhoneHandlerControl::IsAutoLockOn
       
   790 // ---------------------------------------------------------
       
   791 //
       
   792 TBool CPhoneHandlerControl::IsAutoLockOn() const
       
   793     {
       
   794     COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::IsAutoLockOn() start " );
       
   795     TInt err( KErrNone );
       
   796     TInt value( EAutolockStatusUninitialized );
       
   797 
       
   798     err = RProperty::Get( KPSUidCoreApplicationUIs, KCoreAppUIsAutolockStatus, value );
       
   799     if ( err != KErrNone )
       
   800         {
       
   801         value = err;
       
   802         }
       
   803     COM_TRACE_1( "[PHONECMDHANDLER] CPhoneHandlerControl::IsAutoLockOn() autolock value = %d", value );
       
   804     
       
   805     return value > EAutolockOff ? ETrue : EFalse;
       
   806       
       
   807     }
       
   808 // ---------------------------------------------------------
       
   809 // CPhoneHandlerControl::IsBTAccessoryCmd
       
   810 // ---------------------------------------------------------
       
   811 //
       
   812 TBool CPhoneHandlerControl::IsBTAccessoryCmd() const
       
   813     {
       
   814     COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::IsBTAccessoryCmd() start " );
       
   815     TBool retval( EFalse );
       
   816     
       
   817     TRemConExtCmdSource source;             
       
   818     iTarget->GetCommandSourceInfo( source );
       
   819     if ( source == ERemConExtCmdSourceBluetooth )
       
   820         {       
       
   821         retval = ETrue;
       
   822         }
       
   823     
       
   824     COM_TRACE_1( "[PHONECMDHANDLER] CPhoneHandlerControl::IsBTAccessoryCmd() GetCommandSourceInfo = %d", source );
       
   825        
       
   826     return retval;
       
   827     }
       
   828 
       
   829  
       
   830 
       
   831  
       
   832 // ======================== OTHER EXPORTED FUNCTIONS ===========================
   772 // ======================== OTHER EXPORTED FUNCTIONS ===========================
   833 
   773 
   834 // End of File
   774 // End of File