apicompatanamdw/bcdrivers/os/cellularsrv/IsvTelephonyTest/src/IsvTelephonyTestEngine.cpp
changeset 2 0cb2248d0edc
equal deleted inserted replaced
1:61e9400fe245 2:0cb2248d0edc
       
     1 /*
       
     2 * Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:
       
    15 *
       
    16 */
       
    17 
       
    18 /* Changed by Vaibhav - 13Aug07 for Removing CodeScanner Warnings - High/medium */
       
    19 
       
    20 
       
    21 // INCLUDE FILES
       
    22 #include <e32std.h>
       
    23 #include <c32comm.h>
       
    24 #include <etel.h> 
       
    25 #include <Etel3rdParty.h>
       
    26 #include "IsvTelephonyTestEngine.h"
       
    27 
       
    28 // ================= MEMBER FUNCTIONS =========================================
       
    29 
       
    30 // ----------------------------------------------------------------------------
       
    31 // CIsvTelephonyTestEngine* CIsvTelephonyTestEngine::NewL
       
    32 // Two-phased constructor.
       
    33 // ----------------------------------------------------------------------------
       
    34 //
       
    35 CIsvTelephonyTestEngine* CIsvTelephonyTestEngine::NewL()
       
    36     {
       
    37     CIsvTelephonyTestEngine* self = new (ELeave) CIsvTelephonyTestEngine;        
       
    38     CleanupStack::PushL( self );
       
    39     self->ConstructL();
       
    40     CleanupStack::Pop();    
       
    41     return self;
       
    42     }
       
    43 
       
    44 // ----------------------------------------------------------------------------
       
    45 // CIsvTelephonyTestEngine::~CIsvTelephonyTestEngine
       
    46 // Destructor.
       
    47 // ----------------------------------------------------------------------------
       
    48 //
       
    49 CIsvTelephonyTestEngine::~CIsvTelephonyTestEngine()
       
    50     {
       
    51     Cancel();    
       
    52     delete iTelephony; 
       
    53     }
       
    54 
       
    55 // ----------------------------------------------------------------------------
       
    56 // CIsvTelephonyTestEngine::RunL
       
    57 // Handles the active object’s request completion event.
       
    58 // ----------------------------------------------------------------------------
       
    59 //
       
    60 void CIsvTelephonyTestEngine::RunL()
       
    61     {
       
    62     iWait.AsyncStop();
       
    63     }
       
    64 
       
    65 // ----------------------------------------------------------------------------
       
    66 // CIsvTelephonyTestEngine::DoCancel
       
    67 // Implements cancellation of an outstanding request.
       
    68 // ----------------------------------------------------------------------------
       
    69 //
       
    70 void CIsvTelephonyTestEngine::DoCancel()
       
    71     {
       
    72     //Based on the command, invoke the appropriate CancelAsync APIs
       
    73     switch( iTelApiCmd )
       
    74         {
       
    75 		case EGetPhoneId :
       
    76             iTelephony->CancelAsync( CTelephony::EGetPhoneIdCancel );
       
    77             break;
       
    78 		case EGetSubscriberId :
       
    79             iTelephony->CancelAsync( CTelephony::EGetSubscriberIdCancel );
       
    80             break;
       
    81 		case EGetFlightMode :
       
    82             iTelephony->CancelAsync( CTelephony::EGetFlightModeCancel );
       
    83             break;
       
    84 		case EGetIndicator :
       
    85             iTelephony->CancelAsync( CTelephony::EGetIndicatorCancel );
       
    86             break;
       
    87         case EGetBatteryInfo : 
       
    88             iTelephony->CancelAsync( CTelephony::EGetBatteryInfoCancel );
       
    89             break;
       
    90         case EGetSignalStrength :
       
    91             iTelephony->CancelAsync( CTelephony::EGetSignalStrengthCancel );
       
    92             break;
       
    93         case EGetLockInfo :
       
    94             iTelephony->CancelAsync( CTelephony::EGetLockInfoCancel );
       
    95             break;        
       
    96 		case ESendDTMFTones:
       
    97             iTelephony->CancelAsync( CTelephony::ESendDTMFTonesCancel );
       
    98             break;
       
    99       	case EDialNewCall :
       
   100             iTelephony->CancelAsync( CTelephony::EDialNewCallCancel );
       
   101             break;        
       
   102       	case EHold :
       
   103             iTelephony->CancelAsync( CTelephony::EHoldCancel );
       
   104             break;        
       
   105       	case EResume :
       
   106             iTelephony->CancelAsync( CTelephony::EResumeCancel );
       
   107             break;        
       
   108       	case ESwap :
       
   109             iTelephony->CancelAsync( CTelephony::ESwapCancel );
       
   110             break;        
       
   111       	case EHangup :
       
   112             iTelephony->CancelAsync( CTelephony::EHangupCancel );
       
   113             break;        
       
   114       	case EAnswerIncomingCall :
       
   115             iTelephony->CancelAsync( CTelephony::EAnswerIncomingCallCancel );
       
   116             break;        
       
   117 		case ENwRegistrationStatus :
       
   118             iTelephony->CancelAsync( CTelephony::EGetNetworkRegistrationStatusCancel );
       
   119             break;
       
   120 		case EGetCurrentNetworkInfo :
       
   121             iTelephony->CancelAsync( CTelephony::EGetCurrentNetworkInfoCancel );
       
   122             break;
       
   123 		case EGetCurrentNetworkName:
       
   124             iTelephony->CancelAsync( CTelephony::EGetCurrentNetworkNameCancel );
       
   125             break;            
       
   126       	case EGetOperatorName :
       
   127             iTelephony->CancelAsync( CTelephony::EGetOperatorNameCancel );
       
   128             break;        
       
   129         case EGetCallForwardingStatus :
       
   130             iTelephony->CancelAsync( CTelephony::EGetCallForwardingStatusCancel );
       
   131             break;        
       
   132         case EGetBarringStatus :
       
   133             iTelephony->CancelAsync( CTelephony::EGetCallBarringStatusCancel );
       
   134             break;        
       
   135         case EGetWaitingStatus :
       
   136             iTelephony->CancelAsync( CTelephony::EGetCallWaitingStatusCancel );
       
   137             break;        
       
   138         case EGetIdentityStatus :
       
   139             iTelephony->CancelAsync( CTelephony::EGetIdentityServiceStatusCancel );
       
   140             break;        
       
   141       	case ENotifyChange :
       
   142       		switch( iNotificationEvent )
       
   143       			{
       
   144       			case CTelephony::EOwnedCall1StatusChange : 
       
   145       				iTelephony->CancelAsync( CTelephony::EOwnedCall1StatusChangeCancel );
       
   146       				break; 
       
   147       			case CTelephony::EOwnedCall2StatusChange : 
       
   148       				iTelephony->CancelAsync( CTelephony::EOwnedCall2StatusChangeCancel );
       
   149       				break; 
       
   150       			case CTelephony::EVoiceLineStatusChange : 
       
   151       				iTelephony->CancelAsync( CTelephony::EVoiceLineStatusChangeCancel );
       
   152       				break; 
       
   153       			default: 
       
   154       				break; 
       
   155       			}            
       
   156             break;                    
       
   157         default :
       
   158             break;
       
   159         }
       
   160     }
       
   161 
       
   162 // ----------------------------------------------------------------------------
       
   163 // CIsvTelephonyTestEngine::CIsvTelephonyTestEngine
       
   164 // Default constructor.
       
   165 // ----------------------------------------------------------------------------
       
   166 //
       
   167 CIsvTelephonyTestEngine::CIsvTelephonyTestEngine()
       
   168     :CActive( EPriorityStandard )    
       
   169     { 
       
   170     CActiveScheduler::Add( this );
       
   171     }
       
   172 
       
   173 // ----------------------------------------------------------------------------
       
   174 // CIsvTelephonyTestEngine::ConstructL
       
   175 // It creates a CTelephony object and initializes a locally 
       
   176 // contained command table.
       
   177 // ----------------------------------------------------------------------------
       
   178 //
       
   179 void CIsvTelephonyTestEngine::ConstructL()
       
   180     {
       
   181     //Creating Telephony object. 
       
   182     iTelephony = CTelephony::NewL();
       
   183     }
       
   184 
       
   185 // ----------------------------------------------------------------------------
       
   186 // CIsvTelephonyTestEngine::StartWait
       
   187 // Checks for the active scheduler wait class's start state and then starts the
       
   188 // wait
       
   189 // ----------------------------------------------------------------------------
       
   190 //
       
   191 void CIsvTelephonyTestEngine::StartWait( )
       
   192     {
       
   193     // For testing CancelAsync     
       
   194     if( iCancelAsyncs == (TBool) ETrue )
       
   195     	{
       
   196     	DoCancel();     	    	
       
   197     	}    
       
   198     	    
       
   199     if ( iWait.IsStarted() != (TBool) ETrue )
       
   200         {
       
   201         iWait.Start();
       
   202         }
       
   203     }
       
   204 
       
   205 // ----------------------------------------------------------------------------
       
   206 // CIsvTelephonyTestEngine::SetCancelAsyncs
       
   207 // Cancels the asynchronous tests with CancelAsync
       
   208 // until flag aSetting is cleared 
       
   209 // ----------------------------------------------------------------------------
       
   210 //
       
   211 void CIsvTelephonyTestEngine::SetCancelAsyncs( TBool aSetting )
       
   212 	{	
       
   213 	iCancelAsyncs = aSetting; 
       
   214 	}
       
   215 
       
   216 // ----------------------------------------------------------------------------
       
   217 // CIsvTelephonyTestEngine::TestGetVersion
       
   218 // Test function that calls Version of CTelephony class.
       
   219 // ----------------------------------------------------------------------------
       
   220 //
       
   221 TInt CIsvTelephonyTestEngine::TestGetVersion( TVersion& aVersion )
       
   222 	{
       
   223 	aVersion = iTelephony->Version(); 
       
   224 	
       
   225 	return KErrNone; 
       
   226 	}
       
   227 
       
   228 // ----------------------------------------------------------------------------
       
   229 // CIsvTelephonyTestEngine::TestGetPhoneId
       
   230 // Test function that calls GetPhoneId of CTelephony class.
       
   231 // ----------------------------------------------------------------------------
       
   232 //
       
   233 TInt CIsvTelephonyTestEngine::TestGetPhoneId( 
       
   234 	CTelephony::TPhoneIdV1& aPhoneId )
       
   235 	{
       
   236     CTelephony::TPhoneIdV1Pckg aPhoneIdPckg( aPhoneId );
       
   237     
       
   238     iTelApiCmd = EGetPhoneId;    
       
   239      
       
   240     iTelephony->GetPhoneId( iStatus, aPhoneIdPckg );
       
   241     SetActive();
       
   242     StartWait(); 
       
   243 						
       
   244 	return iStatus.Int(); 
       
   245 	}
       
   246 
       
   247 // ----------------------------------------------------------------------------
       
   248 // CIsvTelephonyTestEngine::TestGetSubscriberId
       
   249 // Test function that calls GetSubscriberId of CTelephony class.
       
   250 // ----------------------------------------------------------------------------
       
   251 //
       
   252 TInt CIsvTelephonyTestEngine::TestGetSubscriberId( 
       
   253 	CTelephony::TSubscriberIdV1& aSubscriberId )
       
   254 	{
       
   255     CTelephony::TSubscriberIdV1Pckg aSubscriberIdPckg( aSubscriberId );
       
   256     
       
   257     iTelApiCmd = EGetSubscriberId;
       
   258     
       
   259     iTelephony->GetSubscriberId( iStatus, aSubscriberIdPckg );
       
   260     SetActive();
       
   261     StartWait(); 
       
   262 						
       
   263 	return iStatus.Int(); 
       
   264 	}
       
   265 
       
   266 // ----------------------------------------------------------------------------
       
   267 // CIsvTelephonyTestEngine::TestGetFlightMode
       
   268 // Test function that calls GetFlightMode of CTelephony class.
       
   269 // ----------------------------------------------------------------------------
       
   270 //
       
   271 TInt CIsvTelephonyTestEngine::TestGetFlightMode( 
       
   272 	CTelephony::TFlightModeV1& aFlightMode )
       
   273 	{
       
   274     CTelephony::TFlightModeV1Pckg flightModePckg( aFlightMode ); 
       
   275     
       
   276     iTelApiCmd = EGetFlightMode;
       
   277     
       
   278     iTelephony->GetFlightMode( iStatus, flightModePckg );
       
   279     SetActive();
       
   280     StartWait(); 
       
   281 						
       
   282 	return iStatus.Int(); 
       
   283 	}
       
   284 
       
   285 // ----------------------------------------------------------------------------
       
   286 // CIsvTelephonyTestEngine::TestGetIndicator
       
   287 // Test function that calls GetIndicator of CTelephony class.
       
   288 // ----------------------------------------------------------------------------
       
   289 //
       
   290 TInt CIsvTelephonyTestEngine::TestGetIndicator( 	
       
   291 	CTelephony::TIndicatorV1& aIndicator )
       
   292 	{
       
   293     CTelephony::TIndicatorV1Pckg indicatorPckg( aIndicator );  
       
   294     
       
   295     iTelApiCmd = EGetIndicator;
       
   296     
       
   297     iTelephony->GetIndicator( iStatus, indicatorPckg );
       
   298     SetActive();
       
   299     StartWait(); 
       
   300 						
       
   301 	return iStatus.Int(); 
       
   302 	}
       
   303 
       
   304 // ----------------------------------------------------------------------------
       
   305 // CIsvTelephonyTestEngine::TestGetBatteryInfo
       
   306 // Test function that calls GetBatteryInfo of CTelephony class.
       
   307 // ----------------------------------------------------------------------------
       
   308 //
       
   309 TInt CIsvTelephonyTestEngine::TestGetBatteryInfo( 
       
   310 	CTelephony::TBatteryInfoV1& aBatteryInfo )
       
   311 	{
       
   312     CTelephony::TBatteryInfoV1Pckg batteryInfoPckg( aBatteryInfo );  
       
   313     
       
   314     iTelApiCmd = EGetBatteryInfo;
       
   315     
       
   316     iTelephony->GetBatteryInfo( iStatus, batteryInfoPckg );
       
   317     SetActive();
       
   318     StartWait(); 
       
   319 						
       
   320 	return iStatus.Int(); 
       
   321 	}        	
       
   322     
       
   323 // ----------------------------------------------------------------------------
       
   324 // CIsvTelephonyTestEngine::TestGetSignalStrength
       
   325 // Test function that calls GetSignalStrength of CTelephony class.
       
   326 // ----------------------------------------------------------------------------
       
   327 //
       
   328 TInt CIsvTelephonyTestEngine::TestGetSignalStrength( 
       
   329 	CTelephony::TSignalStrengthV1& aSignalStrength )        	
       
   330 	{
       
   331     CTelephony::TSignalStrengthV1Pckg signalStrengthPckg( aSignalStrength );  
       
   332     
       
   333     iTelApiCmd = EGetSignalStrength;
       
   334     
       
   335     iTelephony->GetSignalStrength( iStatus, signalStrengthPckg );
       
   336     SetActive();
       
   337     StartWait(); 
       
   338 						
       
   339 	return iStatus.Int(); 
       
   340 	}    	
       
   341 
       
   342 // ----------------------------------------------------------------------------
       
   343 // CIsvTelephonyTestEngine::TestGetLockInfo
       
   344 // Test function that calls GetLockInfo of CTelephony class.
       
   345 // ----------------------------------------------------------------------------
       
   346 //
       
   347 TInt CIsvTelephonyTestEngine::TestGetLockInfo( 
       
   348 	CTelephony::TIccLock& aLock, 
       
   349 	CTelephony::TIccLockInfoV1& aLockInfo )
       
   350 	{
       
   351     CTelephony::TIccLockInfoV1Pckg lockInfoPckg( aLockInfo );  
       
   352     
       
   353     iTelApiCmd = EGetLockInfo;
       
   354     
       
   355     iTelephony->GetLockInfo( iStatus, aLock, lockInfoPckg );
       
   356     SetActive();
       
   357     StartWait(); 
       
   358 						
       
   359 	return iStatus.Int(); 
       
   360 	}    	
       
   361 
       
   362 // ----------------------------------------------------------------------------
       
   363 // CIsvTelephonyTestEngine::TestSendDTMFTones
       
   364 // Test function that calls SendDTMFTones of CTelephony class.
       
   365 // ----------------------------------------------------------------------------
       
   366 //
       
   367 TInt CIsvTelephonyTestEngine::TestSendDTMFTones(
       
   368 	const TDesC& aDTMFTones )
       
   369 	{
       
   370     iTelApiCmd = ESendDTMFTones;
       
   371     
       
   372     iTelephony->SendDTMFTones( iStatus, aDTMFTones );
       
   373     SetActive();
       
   374     StartWait(); 
       
   375 						
       
   376 	return iStatus.Int(); 
       
   377 	}    	
       
   378 	
       
   379 // ----------------------------------------------------------------------------
       
   380 // CIsvTelephonyTestEngine::TestGetLineStatus
       
   381 // Test function that calls GetLineStatus of CTelephony class.
       
   382 // ----------------------------------------------------------------------------
       
   383 //
       
   384 TInt CIsvTelephonyTestEngine::TestGetLineStatus(
       
   385 	CTelephony::TPhoneLine& aPhoneLine,
       
   386 	CTelephony::TCallStatusV1& aCallStatus )
       
   387 	{
       
   388     TInt result; 	
       
   389     
       
   390     iTelApiCmd = EGetLockInfo;
       
   391     
       
   392     CTelephony::TCallStatusV1Pckg callStatusPckg( aCallStatus );  
       
   393     result = iTelephony->GetLineStatus( aPhoneLine, callStatusPckg );
       
   394 						
       
   395 	return result; 
       
   396 	}  
       
   397 
       
   398 // ----------------------------------------------------------------------------
       
   399 // CIsvTelephonyTestEngine::TestGetCallInfo
       
   400 // Test function that calls GetCallInfo of CTelephony class.
       
   401 // ----------------------------------------------------------------------------
       
   402 //
       
   403 TInt CIsvTelephonyTestEngine::TestGetCallInfo( 
       
   404 	CTelephony::TCallSelectionV1& aCallSelection, 
       
   405 	CTelephony::TCallInfoV1& aCallInfo, 
       
   406 	CTelephony::TRemotePartyInfoV1& aRemotePartyInfo )	    			
       
   407 	{
       
   408 	TInt result; 
       
   409 
       
   410     iTelApiCmd = EGetCallInfo;
       
   411     
       
   412 	CTelephony::TCallSelectionV1Pckg callSelectionPckg( aCallSelection );   
       
   413     CTelephony::TCallInfoV1Pckg callInfoPckg( aCallInfo );  
       
   414 	CTelephony::TRemotePartyInfoV1Pckg remotePartyInfoPckg( aRemotePartyInfo );  	    			
       
   415     
       
   416     result = iTelephony->GetCallInfo( 
       
   417     	callSelectionPckg, 
       
   418     	callInfoPckg, 
       
   419     	remotePartyInfoPckg );
       
   420 
       
   421 	return result; 
       
   422 	}  
       
   423 
       
   424 // ----------------------------------------------------------------------------
       
   425 // CIsvTelephonyTestEngine::TestGetNetworkRegistrationStatus
       
   426 // Test function that calls GetNetworkRegistrationStatus of CTelephony class.
       
   427 // ----------------------------------------------------------------------------
       
   428 //
       
   429 TInt CIsvTelephonyTestEngine::TestGetNetworkRegistrationStatus(
       
   430 	CTelephony::TNetworkRegistrationV1& aNetworkRegistration )        		
       
   431     {    
       
   432 	CTelephony::TNetworkRegistrationV1Pckg 
       
   433 		networkRegistrationPckg( aNetworkRegistration );
       
   434 
       
   435     iTelApiCmd = ENwRegistrationStatus;
       
   436 		
       
   437     iTelephony->GetNetworkRegistrationStatus( iStatus, networkRegistrationPckg );    
       
   438     SetActive();
       
   439     StartWait(); 
       
   440 						
       
   441 	return iStatus.Int(); 
       
   442     }
       
   443 	
       
   444 // ----------------------------------------------------------------------------
       
   445 // CIsvTelephonyTestEngine::TestGetCurrentNetworkInfo
       
   446 // Test function that calls GetCurrentNetworkInfo of CTelephony class.
       
   447 // ----------------------------------------------------------------------------
       
   448 //
       
   449 TInt CIsvTelephonyTestEngine::TestGetCurrentNetworkInfo( 
       
   450 	CTelephony::TNetworkInfoV1& aNetworkInfo )
       
   451     {    
       
   452 	CTelephony::TNetworkInfoV1Pckg networkInfoPckg( aNetworkInfo );
       
   453 
       
   454     iTelApiCmd = EGetCurrentNetworkInfo;
       
   455 
       
   456     iTelephony->GetCurrentNetworkInfo( iStatus, networkInfoPckg );    
       
   457     SetActive();
       
   458     StartWait(); 
       
   459 						
       
   460 	return iStatus.Int(); 
       
   461     }
       
   462 
       
   463 // ----------------------------------------------------------------------------
       
   464 // CIsvTelephonyTestEngine::TestGetCurrentNetworkName
       
   465 // Test function that calls GetCurrentNetworkName of CTelephony class.
       
   466 // ----------------------------------------------------------------------------
       
   467 //
       
   468 TInt CIsvTelephonyTestEngine::TestGetCurrentNetworkName( 
       
   469 	CTelephony::TNetworkNameV1& aNetworkName )
       
   470     {    
       
   471 	CTelephony::TNetworkNameV1Pckg networkNamePckg( aNetworkName );
       
   472 
       
   473     iTelApiCmd = EGetCurrentNetworkName;
       
   474 
       
   475     iTelephony->GetCurrentNetworkName( iStatus, networkNamePckg );    
       
   476     SetActive();
       
   477     StartWait(); 
       
   478 						
       
   479 	return iStatus.Int(); 
       
   480     }
       
   481 
       
   482 // ----------------------------------------------------------------------------
       
   483 // CIsvTelephonyTestEngine::TestGetOperatorName
       
   484 // Test function that calls GetCurrentNetworkName of CTelephony class.
       
   485 // ----------------------------------------------------------------------------
       
   486 //
       
   487 TInt CIsvTelephonyTestEngine::TestGetOperatorName( 
       
   488 	CTelephony::TOperatorNameV1& aOperatorName )
       
   489     {    
       
   490 	CTelephony::TOperatorNameV1Pckg operatorNamePckg( aOperatorName );
       
   491 
       
   492     iTelApiCmd = EGetOperatorName;
       
   493 
       
   494     iTelephony->GetOperatorName( iStatus, operatorNamePckg );    
       
   495     SetActive();
       
   496     StartWait(); 
       
   497 						
       
   498 	return iStatus.Int(); 
       
   499     }
       
   500     	
       
   501 // ----------------------------------------------------------------------------
       
   502 // CIsvTelephonyTestEngine::TestGetCallForwardingStatus
       
   503 // Test function that calls GetCallForwardingStatus of CTelephony class.
       
   504 // ----------------------------------------------------------------------------
       
   505 //
       
   506 TInt CIsvTelephonyTestEngine::TestGetCallForwardingStatus( 
       
   507  	CTelephony::TCallForwardingCondition& aCallForwardingCondition, 
       
   508  	CTelephony::TCallForwardingSupplServicesV1& aCallForwardingStatus, 
       
   509  	CTelephony::TServiceGroup& aServiceGroup )    	
       
   510     {    
       
   511 	CTelephony::TCallForwardingSupplServicesV1Pckg 
       
   512 		callForwardingStatusPckg( aCallForwardingStatus );		
       
   513 
       
   514     iTelApiCmd = EGetCallForwardingStatus;
       
   515 
       
   516     iTelephony->GetCallForwardingStatus( 
       
   517     	iStatus, 
       
   518     	aCallForwardingCondition, 
       
   519     	callForwardingStatusPckg,
       
   520     	aServiceGroup );        	
       
   521     SetActive();
       
   522     StartWait(); 
       
   523 						
       
   524 	return iStatus.Int(); 
       
   525     }
       
   526     
       
   527 // ----------------------------------------------------------------------------
       
   528 // CIsvTelephonyTestEngine::TestGetCallBarringStatus
       
   529 // Test function that calls GetCallBarringStatus of CTelephony class.
       
   530 // ----------------------------------------------------------------------------
       
   531 //
       
   532 TInt CIsvTelephonyTestEngine::TestGetCallBarringStatus( 
       
   533  	CTelephony::TCallBarringCondition& aCallBarringCondition, 		 	
       
   534  	CTelephony::TCallBarringSupplServicesV1& aCallBarringStatus,
       
   535  	CTelephony::TServiceGroup& aServiceGroup )    
       
   536     {    
       
   537 	CTelephony::TCallBarringSupplServicesV1Pckg 
       
   538 		callBarringStatusPckg( aCallBarringStatus );		
       
   539 
       
   540     iTelApiCmd = EGetBarringStatus;
       
   541 
       
   542     iTelephony->GetCallBarringStatus( 
       
   543     	iStatus, 
       
   544     	aCallBarringCondition, 
       
   545     	callBarringStatusPckg,
       
   546     	aServiceGroup );        	
       
   547     SetActive();
       
   548     StartWait(); 
       
   549 						
       
   550 	return iStatus.Int(); 
       
   551     }
       
   552 
       
   553 // ----------------------------------------------------------------------------
       
   554 // CIsvTelephonyTestEngine::TestGetCallBarringStatus
       
   555 // Test function that calls GetCallBarringStatus of CTelephony class.
       
   556 // ----------------------------------------------------------------------------
       
   557 //
       
   558 TInt CIsvTelephonyTestEngine::TestGetCallWaitingStatus( 		 	
       
   559  	CTelephony::TCallWaitingSupplServicesV1& aCallWaitingStatus,
       
   560  	CTelephony::TServiceGroup& aServiceGroup )    		 	
       
   561     {    
       
   562 	CTelephony::TCallWaitingSupplServicesV1Pckg 
       
   563 		callWaitingStatusPckg( aCallWaitingStatus );		
       
   564 
       
   565     iTelApiCmd = EGetWaitingStatus;
       
   566 
       
   567     iTelephony->GetCallWaitingStatus( 
       
   568     	iStatus,     	
       
   569     	callWaitingStatusPckg,
       
   570     	aServiceGroup );        	
       
   571     SetActive();
       
   572     StartWait(); 
       
   573 						
       
   574 	return iStatus.Int(); 
       
   575     }
       
   576 
       
   577 // ----------------------------------------------------------------------------
       
   578 // CIsvTelephonyTestEngine::TestGetIdentityServiceStatus
       
   579 // Test function that calls GetIdentityServiceStatus of CTelephony class.
       
   580 // ----------------------------------------------------------------------------
       
   581 //
       
   582 TInt CIsvTelephonyTestEngine::TestGetIdentityServiceStatus( 		 	
       
   583  	CTelephony::TIdentityService& aIdentityService,
       
   584  	CTelephony::TIdentityServiceV1& aIdentityServiceStatus )
       
   585     {    
       
   586 	CTelephony::TIdentityServiceV1Pckg
       
   587 		identityServiceStatusPckg( aIdentityServiceStatus );		
       
   588 
       
   589     iTelApiCmd = EGetIdentityStatus;
       
   590 
       
   591     iTelephony->GetIdentityServiceStatus( 
       
   592     	iStatus,     	
       
   593     	aIdentityService,
       
   594     	identityServiceStatusPckg );        	
       
   595     SetActive();
       
   596     StartWait(); 
       
   597 						
       
   598 	return iStatus.Int(); 
       
   599     }
       
   600 
       
   601 // ----------------------------------------------------------------------------
       
   602 // CIsvTelephonyTestEngine::TestDialNewCall
       
   603 // Test function that calls DialNewCall of CTelephony class.
       
   604 // ----------------------------------------------------------------------------
       
   605 //
       
   606 TInt CIsvTelephonyTestEngine::TestDialNewCall( 
       
   607  	CTelephony::TCallParamsV1& aCallParams, 
       
   608  	CTelephony::TTelNumber& aTelNumber, 
       
   609 	CTelephony::TCallId& aCallId, 
       
   610 	CTelephony::TPhoneLine& aPhoneLine )
       
   611     {    
       
   612 	CTelephony::TCallParamsV1Pckg callParamsPckg( aCallParams );		
       
   613 
       
   614     iTelApiCmd = EDialNewCall;
       
   615 
       
   616     iTelephony->DialNewCall( 
       
   617     	iStatus,     	
       
   618     	callParamsPckg,
       
   619     	aTelNumber,
       
   620     	aCallId,
       
   621     	aPhoneLine );        	
       
   622     SetActive();
       
   623     StartWait(); 
       
   624 						
       
   625 	return iStatus.Int(); 
       
   626     }	
       
   627 
       
   628 // ----------------------------------------------------------------------------
       
   629 // CIsvTelephonyTestEngine::TestGetCallDynamicCaps
       
   630 // Test function that calls GetCallDynamicCaps of CTelephony class.
       
   631 // ----------------------------------------------------------------------------
       
   632 //
       
   633 TInt CIsvTelephonyTestEngine::TestGetCallDynamicCaps( 		 	
       
   634 	CTelephony::TCallId& aCallId, 
       
   635 	CTelephony::TCallCapsV1& aCallCaps )
       
   636     {    
       
   637 	CTelephony::TCallCapsV1Pckg callCapsPckg( aCallCaps );		
       
   638 	TInt result; 		
       
   639 
       
   640     iTelApiCmd = EGetCallDynamicCaps;
       
   641 
       
   642     result = iTelephony->GetCallDynamicCaps(     	
       
   643     	aCallId,
       
   644     	callCapsPckg );        	
       
   645 	
       
   646 	return result; 
       
   647     }	
       
   648     	
       
   649 // ----------------------------------------------------------------------------
       
   650 // CIsvTelephonyTestEngine::TestGetCallStatus
       
   651 // Test function that calls GetCallStatus of CTelephony class.
       
   652 // ----------------------------------------------------------------------------
       
   653 //
       
   654 TInt CIsvTelephonyTestEngine::TestGetCallStatus( 		 	
       
   655 	CTelephony::TCallId& aCallId, 
       
   656 	CTelephony::TCallStatusV1& aCallStatus )
       
   657     {    
       
   658 	CTelephony::TCallStatusV1Pckg callStatusPckg( aCallStatus );		
       
   659 	TInt result; 		
       
   660 
       
   661     iTelApiCmd = EGetCallStatus;
       
   662 
       
   663     result = iTelephony->GetCallStatus(     	
       
   664     	aCallId,
       
   665     	callStatusPckg );        	
       
   666 	
       
   667 	return result; 
       
   668     }	
       
   669 
       
   670 // ----------------------------------------------------------------------------
       
   671 // CIsvTelephonyTestEngine::TestHold
       
   672 // Test function that calls Hold of CTelephony class.
       
   673 // ----------------------------------------------------------------------------
       
   674 //
       
   675 TInt CIsvTelephonyTestEngine::TestHold( 
       
   676 	CTelephony::TCallId& aCallId )
       
   677     {    		
       
   678     iTelApiCmd = EHold;
       
   679 
       
   680     iTelephony->Hold(  
       
   681     	iStatus,   	
       
   682     	aCallId );        	
       
   683     SetActive();
       
   684     StartWait(); 
       
   685 	
       
   686 	return iStatus.Int(); 
       
   687     }	
       
   688 
       
   689 // ----------------------------------------------------------------------------
       
   690 // CIsvTelephonyTestEngine::TestResume
       
   691 // Test function that calls Resume of CTelephony class.
       
   692 // ----------------------------------------------------------------------------
       
   693 //
       
   694 TInt CIsvTelephonyTestEngine::TestResume( 
       
   695 	CTelephony::TCallId& aCallId )
       
   696     {    		
       
   697     iTelApiCmd = EResume;
       
   698 
       
   699     iTelephony->Resume(  
       
   700     	iStatus,   	
       
   701     	aCallId );        	
       
   702     SetActive();
       
   703     StartWait(); 
       
   704 	
       
   705 	return iStatus.Int(); 
       
   706     }					    	
       
   707 
       
   708 // ----------------------------------------------------------------------------
       
   709 // CIsvTelephonyTestEngine::TestSwap
       
   710 // Test function that calls Swap of CTelephony class.
       
   711 // ----------------------------------------------------------------------------
       
   712 //
       
   713 TInt CIsvTelephonyTestEngine::TestSwap( 
       
   714 	CTelephony::TCallId& aCallId1,
       
   715 	CTelephony::TCallId& aCallId2 )
       
   716     {    		
       
   717     iTelApiCmd = ESwap;
       
   718 
       
   719     iTelephony->Swap(  
       
   720     	iStatus,   	
       
   721     	aCallId1,
       
   722     	aCallId2 );        	
       
   723     SetActive();
       
   724     StartWait(); 
       
   725 	
       
   726 	return iStatus.Int(); 
       
   727     }					    	
       
   728 
       
   729 // ----------------------------------------------------------------------------
       
   730 // CIsvTelephonyTestEngine::TestHangup
       
   731 // Test function that calls Hangup of CTelephony class.
       
   732 // ----------------------------------------------------------------------------
       
   733 //
       
   734 TInt CIsvTelephonyTestEngine::TestHangup( 
       
   735 	CTelephony::TCallId& aCallId )
       
   736     {    		
       
   737     iTelApiCmd = EHangup;
       
   738 
       
   739     iTelephony->Hangup(  
       
   740     	iStatus,   	
       
   741     	aCallId );        	
       
   742     SetActive();
       
   743     StartWait(); 
       
   744 	
       
   745 	return iStatus.Int(); 
       
   746     }					    	
       
   747                 
       
   748 // ----------------------------------------------------------------------------
       
   749 // CIsvTelephonyTestEngine::TestAnswerIncomingCall
       
   750 // Test function that calls AnswerIncomingCall of CTelephony class.
       
   751 // ----------------------------------------------------------------------------
       
   752 //
       
   753 TInt CIsvTelephonyTestEngine::TestAnswerIncomingCall( 		 	
       
   754 	CTelephony::TCallId& aCallId, 
       
   755 	CTelephony::TPhoneLine& aPhoneLine )
       
   756     {    		
       
   757     // AnswerIncomingCall needs special test approach, calling 
       
   758     // CTelephony::AnswerIncomingCall function opens a new timer handle
       
   759     // that is not closed while CTelephony object exists. STIF tool recognizes 
       
   760     // this as handle leak unless CTelephony is constructed and deleted within the 
       
   761     // AnswerIncomingCall function (not a real leak)    
       
   762     TInt result;
       
   763 	CTelephony::TCallStatusV1 callStatus; 
       
   764 	CTelephony::TCallStatusV1Pckg callStatusPckg( callStatus );
       
   765 
       
   766     iTelApiCmd = EAnswerIncomingCall;
       
   767 	
       
   768 	// Precondition: wait incoming call
       
   769  	result = TestNotifyChangeVoiceLineStatus ( 
       
   770  		CTelephony::EVoiceLineStatusChange,
       
   771  		callStatusPckg ); 			
       
   772 	// Execute test
       
   773 	if( KErrNone == result && CTelephony::EStatusRinging == callStatus.iStatus )
       
   774 	    {
       
   775     	// Test AnswerIncomingCall
       
   776         iTelephony->AnswerIncomingCall(
       
   777         	iStatus,      	
       
   778         	aCallId,
       
   779         	aPhoneLine );        	
       
   780         SetActive();
       
   781         StartWait(); 	    
       
   782         result = iStatus.Int(); 	
       
   783 	    }
       
   784     // Restore initial state: end call   		 
       
   785     TestHangup( aCallId );
       
   786     
       
   787     // Delete and re-construct the CTelephony in order to overcome false handle 
       
   788     // leak detection problem described earlier
       
   789     delete iTelephony; 
       
   790     iTelephony = NULL;	
       
   791     TRAPD(err, iTelephony = CTelephony::NewL());
       
   792     if(err != KErrNone)
       
   793     return err;
       
   794         
       
   795 	return result; 
       
   796     }	
       
   797 
       
   798 // ----------------------------------------------------------------------------
       
   799 // CIsvTelephonyTestEngine::TestNotifyChangeVoiceLineStatus 
       
   800 // Test function that calls NotifyChange of CTelephony class.
       
   801 // ----------------------------------------------------------------------------
       
   802 //
       
   803 TInt CIsvTelephonyTestEngine::TestNotifyChangeVoiceLineStatus (	
       
   804 	CTelephony::TNotificationEvent aNotificationEvent,
       
   805 	TDes8& aNotificationPckg )
       
   806     {
       
   807 	iTelApiCmd = ENotifyChange;    	
       
   808 	iNotificationEvent = aNotificationEvent; 
       
   809 	
       
   810 	iTelephony->NotifyChange(
       
   811 		iStatus, 
       
   812 		iNotificationEvent, 
       
   813 		aNotificationPckg );
       
   814 	SetActive();
       
   815 	StartWait(); 				
       
   816 	
       
   817 	return iStatus.Int(); 	
       
   818     }    	                
       
   819     
       
   820 // ----------------------------------------------------------------------------
       
   821 // CIsvTelephonyTestEngine::TestFindDeviceStatus
       
   822 // Test function that calls FindDeviceStatus of CTelephony class.
       
   823 // ----------------------------------------------------------------------------
       
   824 //
       
   825 TInt CIsvTelephonyTestEngine::TestFindDeviceStatus()
       
   826     {
       
   827 	TInt result;  	
       
   828 	TInt deviceStatus; 		
       
   829 
       
   830 	iTelApiCmd = EFindDeviceStatus;		
       
   831 	
       
   832 	// FindDeviceStatus is deprecated and should return KErrNotSupported	
       
   833 	result = iTelephony->FindDeviceStatus( deviceStatus ); 
       
   834 		
       
   835 	return result; 
       
   836     }    
       
   837     
       
   838 // ----------------------------------------------------------------------------
       
   839 // CIsvTelephonyTestEngine::TestEstablishDataCall
       
   840 // Test function that calls EstablishDataCall of CTelephony class.
       
   841 // ----------------------------------------------------------------------------
       
   842 //
       
   843 TInt CIsvTelephonyTestEngine::TestEstablishDataCall()
       
   844     {
       
   845 	TInt result;  	
       
   846 	TInt dataChannel; 
       
   847 
       
   848 	iTelApiCmd = EEstablishDataCall;	
       
   849 		
       
   850 	// EstablishDataCall is deprecated and should return KErrNotSupported	
       
   851 	result = iTelephony->EstablishDataCall( dataChannel, KNullDesC ); 
       
   852 	
       
   853 	return result; 
       
   854     }    
       
   855 
       
   856 // ----------------------------------------------------------------------------
       
   857 // CIsvTelephonyTestEngine::TestEstablishDataCallAsync
       
   858 // Test function that calls EstablishDataCall of CTelephony class.
       
   859 // ----------------------------------------------------------------------------
       
   860 //
       
   861 TInt CIsvTelephonyTestEngine::TestEstablishDataCallAsync()
       
   862     {
       
   863 	TInt dataChannel; 	
       
   864 
       
   865 	iTelApiCmd = EEstablishDataCall;		
       
   866 	
       
   867 	// EstablishDataCall is deprecated and should return KErrNotSupported	
       
   868 	iTelephony->EstablishDataCall( iStatus, dataChannel, KNullDesC );
       
   869 	SetActive();
       
   870 	StartWait(); 				
       
   871 	
       
   872 	return iStatus.Int(); 	
       
   873     }    
       
   874     
       
   875 // ----------------------------------------------------------------------------
       
   876 // CIsvTelephonyTestEngine::TestTerminateDataCall
       
   877 // Test function that calls TerminateDataCall of CTelephony class.
       
   878 // ----------------------------------------------------------------------------
       
   879 //
       
   880 TInt CIsvTelephonyTestEngine::TestTerminateDataCall()		
       
   881     {
       
   882 	TInt result;  	
       
   883 
       
   884 	iTelApiCmd = ETerminateDataCall;	
       
   885 	
       
   886 	// TerminateDataCall is deprecated and should return KErrNotSupported	
       
   887 	result = iTelephony->TerminateDataCall();
       
   888 	
       
   889 	return result; 
       
   890     }    
       
   891     
       
   892 // ----------------------------------------------------------------------------
       
   893 // CIsvTelephonyTestEngine::TestReceiveDataCall
       
   894 // Test function that calls ReceiveDataCall of CTelephony class.
       
   895 // ----------------------------------------------------------------------------
       
   896 //
       
   897 TInt CIsvTelephonyTestEngine::TestReceiveDataCall()		
       
   898     {
       
   899 	TInt result; 
       
   900 	TInt dataChannel; 
       
   901 
       
   902 	iTelApiCmd = EReceiveDataCall;	
       
   903 	
       
   904 	// ReceiveDataCall is deprecated and should return KErrNotSupported	
       
   905 	result = iTelephony->ReceiveDataCall( dataChannel );
       
   906 	
       
   907 	return result; 
       
   908     }    
       
   909     
       
   910 // ----------------------------------------------------------------------------
       
   911 // CIsvTelephonyTestEngine::TestReceiveDataCallAsync
       
   912 // Test function that calls ReceiveDataCall of CTelephony class.
       
   913 // ----------------------------------------------------------------------------
       
   914 //
       
   915 TInt CIsvTelephonyTestEngine::TestReceiveDataCallAsync()
       
   916     {
       
   917 	TInt dataChannel; 
       
   918 
       
   919 	iTelApiCmd = EReceiveDataCall;	
       
   920 	
       
   921 	// ReceiveDataCall is deprecated and should return KErrNotSupported	
       
   922 	iTelephony->ReceiveDataCall( iStatus, dataChannel );
       
   923 	SetActive();
       
   924 	StartWait(); 				
       
   925 	
       
   926 	return iStatus.Int(); 	
       
   927     }    		
       
   928 
       
   929 // ----------------------------------------------------------------------------
       
   930 // CIsvTelephonyTestEngine::TestCancelEstablishDataCall
       
   931 // Test function that calls CancelEstablishDataCall of CTelephony class.
       
   932 // ----------------------------------------------------------------------------
       
   933 //
       
   934 TInt CIsvTelephonyTestEngine::TestCancelEstablishDataCall()		
       
   935     {
       
   936 	TInt result; 
       
   937 
       
   938 	iTelApiCmd = ECancelEstablishDataCall;	
       
   939 	
       
   940 	// CancelEstablishDataCall is deprecated
       
   941 	iTelephony->CancelEstablishDataCall();
       
   942 	result = KErrNone; 
       
   943 	
       
   944 	return result; 
       
   945     }    
       
   946     
       
   947 // ----------------------------------------------------------------------------
       
   948 // CIsvTelephonyTestEngine::TestCancelReceiveDataCall
       
   949 // Test function that calls CancelReceiveDataCall of CTelephony class.
       
   950 // ----------------------------------------------------------------------------
       
   951 //
       
   952 TInt CIsvTelephonyTestEngine::TestCancelReceiveDataCall()
       
   953     {
       
   954 	TInt result; 
       
   955 
       
   956 	iTelApiCmd = ECancelReceiveDataCall;	
       
   957 	
       
   958 	// CancelReceiveDataCall is deprecated
       
   959 	iTelephony->CancelReceiveDataCall();
       
   960 	result = KErrNone; 
       
   961     
       
   962     return result;
       
   963     }    	    
       
   964 
       
   965 // End of File