telephonyserverplugins/multimodetsy/test/TE_Voice/TE_Voice.cpp
changeset 0 3553901f7fa8
child 24 6638e7f4bd8f
equal deleted inserted replaced
-1:000000000000 0:3553901f7fa8
       
     1 // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // This program is designed the test the Voice functionality of the Basic MM Tsy.
       
    15 // 
       
    16 //
       
    17 
       
    18 /**
       
    19  @file
       
    20 */
       
    21 
       
    22 #include <etelmm.h>
       
    23 
       
    24 #include "TE_Voice.h"
       
    25 #include "TE_VoiceTestStepBase.h"
       
    26 
       
    27 _LIT(KVoiceLineName,"Voice");
       
    28 _LIT(KConsoleTitle, "TE_Voice Test");
       
    29 _LIT(KPleaseRingThePhone, "Please ring the phone\n");
       
    30 
       
    31 const TInt KTenPartOfSec = 100000 ;
       
    32 const TInt KOneSecond=1000000;	// Used in a time out function, 1 second (in microSeconds)
       
    33 const TInt KTenSeconds=10000000;	// Used in a time out function, 10 seconds (in microSeconds)
       
    34  
       
    35 //------------------------------------------------------------------
       
    36 CTestPhoneInfo::CTestPhoneInfo()
       
    37 /* Each test step initialises it's own name
       
    38 */
       
    39 	{
       
    40 	// store the name of this test case
       
    41 	// this is the name that is used by the script file
       
    42 	SetTestStepName(_L("TestPhoneInfo"));
       
    43 	}
       
    44 //------------------------------------------------------------------
       
    45 
       
    46 enum TVerdict CTestPhoneInfo::doTestStepL()
       
    47 //void CTestVoice::TestPhoneInfoL()
       
    48 /**
       
    49  * This function retrieves a snapshot of the phone's GSM information, gets the
       
    50  * number of lines associated with the phone as well as information on the line
       
    51  * and phone. Gets the phone's status and also performs some Cancel Requests.
       
    52  * @test GT83-TVOICE-037.01	Retrieve phone's multimode capabilities and print them to screen.
       
    53  */
       
    54 	{
       
    55 	CConsoleBase* console = Console::NewL(KConsoleTitle,TSize(KConsFullScreen,KConsFullScreen));
       
    56     CleanupStack::PushL(console);
       
    57 	
       
    58 	_LIT(KStartText, "Phone Information test") ; TEST_START(&KStartText) ;
       
    59 	console->Printf(_L("Phone Information Test...\n"));
       
    60 
       
    61 	// Retrieve a snapshot of the current phone information
       
    62 	INFO_PRINTF1(_L("Get Phone Info..."));
       
    63 	console->Printf(_L("Get Phone Info...\n"));
       
    64 	RPhone::TPhoneInfo phoneInfo;
       
    65 	RPhone::TCaps phoneCaps;
       
    66 	TInt ret=iPhone.GetInfo(phoneInfo);
       
    67 	CHECKPOINT_EXPR((ret==KErrNone || ret==KErrNotSupported), _L("*** Failed RMobilePhone::GetInfo() ***"));
       
    68 	if (ret==KErrNotSupported)
       
    69 		{
       
    70 		INFO_PRINTF1(_L("Get Phone info is NOT Supported"));
       
    71 		}
       
    72 	if (ret==KErrNone)
       
    73 		{
       
    74 		INFO_PRINTF1(_L("Get Phone Info is successful."));
       
    75 		TEST_CHECKL(phoneInfo.iDetection, RPhone::EDetectedPresent, _L("GT83-TVOICE-0"));
       
    76 		TESTCHECKL(phoneInfo.iDetection,RPhone::EDetectedPresent);
       
    77 		INFO_PRINTF1(_L("Local Modem has been detected."));
       
    78 		}
       
    79 
       
    80 	//test mobile phone caps
       
    81 	RMobilePhone::TMobilePhoneModeCaps mobileCaps ;
       
    82 	ret = iPhone.GetMultimodeCaps((TUint32&)mobileCaps);
       
    83 	CHECKPOINT(ret, KErrNone, _L("*** Failed RMobilePhone::GetMultimodeCaps() ***")) ;
       
    84 	TESTCHECK(ret, KErrNone);
       
    85 	
       
    86 	Print_TMobilePhoneModeCaps(mobileCaps);
       
    87 
       
    88 	// Number of lines associated with the phone
       
    89 	TInt lineCount=0;
       
    90 	TEST_CHECKL(iPhone.EnumerateLines(lineCount), KErrNone, _L("*** Failed RMobilePhone::EnumerateLines() ***"));
       
    91 	TESTL(lineCount>0);
       
    92 	TESTCHECKCONDITIONL(lineCount>0);
       
    93 	for (;lineCount>0; lineCount--)
       
    94 		{
       
    95 		ret = iPhone.GetLineInfo(lineCount-1, iLineInfo);
       
    96 		CHECKPOINT(ret, KErrNone, _L("*** Failed RMobilePhone::GetLineInfo() ***"));
       
    97 		TESTCHECK(ret, KErrNone);
       
    98 		INFO_PRINTF4(_L("Line %d (%S) cap flags = 0x%x"),
       
    99 			lineCount-1, &iLineInfo.iName,iLineInfo.iLineCapsFlags);
       
   100 		if (iLineInfo.iLineCapsFlags&RLine::KCapsVoice)
       
   101 			{
       
   102 			INFO_PRINTF3(_L("Line %d (%S) has voice capability"), lineCount-1, &iLineInfo.iName);
       
   103 			iLineIndex=lineCount-1;
       
   104 			break;
       
   105 			}
       
   106 		}
       
   107 	TESTL(lineCount>0);
       
   108 	TESTCHECKCONDITIONL(lineCount>0);
       
   109 	// Status of the Phone
       
   110 	INFO_PRINTF1(_L("Get the Phone's Status..."));
       
   111 	RPhone::TStatus phoneStatus;
       
   112 	ret=iPhone.GetStatus(phoneStatus);
       
   113 	CHECKPOINT_EXPR((ret==KErrNone || ret==KErrNotSupported), _L("*** Failed RMobilePhone::GetStatus() ***"));
       
   114 	if (ret==KErrNotSupported)
       
   115 		{
       
   116 		INFO_PRINTF1(_L("Get Phone Status is NOT Supported"));
       
   117 		}
       
   118 	if (ret==KErrNone)
       
   119 		{
       
   120 		INFO_PRINTF1(_L("Get Phone Status is successful."));
       
   121 		TEST_CHECKL(phoneStatus.iMode, RPhone::EModeIdle, _L("GT83-TVOICE-0"));
       
   122 		TESTCHECKL(phoneStatus.iMode, RPhone::EModeIdle);
       
   123 		INFO_PRINTF1(_L("The phone is currently Idle"));
       
   124 		}
       
   125 
       
   126 	// Notification Cancel Requests : Modem Detected
       
   127 	INFO_PRINTF1(_L("Notify Modem Detected Cancel Request..."));
       
   128 	RPhone::TModemDetection detected;
       
   129 	iPhone.NotifyModemDetected(iStatus, detected);
       
   130 	iPhone.NotifyModemDetectedCancel();
       
   131 	User::WaitForRequest(iStatus);
       
   132 	CHECKPOINT_EXPR((ret==KErrNone || ret==KErrCancel), _L("*** Failed RMobilePhone::NotifyModemDetectedCancel() ***"));
       
   133 	INFO_PRINTF2(TRefByValue<const TDesC>(_L("Notify Modem Detected Cancel status: %d")), iStatus.Int());
       
   134 
       
   135 	// Notification Cancel Requests : Caps Change
       
   136 	INFO_PRINTF1(_L("Notify Caps Change Cancel Request..."));
       
   137 	iPhone.NotifyCapsChange(iStatus, phoneCaps);
       
   138 	iPhone.NotifyCapsChangeCancel();
       
   139 	User::WaitForRequest(iStatus);
       
   140 	CHECKPOINT_EXPR((ret==KErrNone || ret==KErrCancel), _L("*** Failed RMobilePhone::NotifyCapsChangeCancel() ***"));
       
   141 	INFO_PRINTF2(TRefByValue<const TDesC>(_L("Notify Caps Change Cancel status: %d")), iStatus.Int());
       
   142 	TEST_END() ;
       
   143 
       
   144 	console->Printf(_L("Finished\n"));
       
   145 	User::After(10*KOneSecond);
       
   146    	CleanupStack::PopAndDestroy(console);
       
   147 
       
   148 	return TestStepResult();
       
   149 	}
       
   150 //------------------------------------------------------------------
       
   151 
       
   152 CTestLineStatusIncomingCall::CTestLineStatusIncomingCall()
       
   153 /* Each test step initialises it's own name
       
   154 */
       
   155 	{
       
   156 	// store the name of this test case
       
   157 	// this is the name that is used by the script file
       
   158 	SetTestStepName(_L("TestLineStatusIncomingCall"));
       
   159 	}
       
   160 //------------------------------------------------------------------
       
   161 
       
   162 enum TVerdict CTestLineStatusIncomingCall::doTestStepL()
       
   163 //void CTestVoice::TestLineStatusIncomingCallL()
       
   164 /**	 Tests line status function
       
   165  * @test GT83-TVOICE-001.01 "Test opening a voice line, specifying the phone that should be used"
       
   166  * @test GT83-TVOICE-004.00 Test retrieval of a voice line's current status (Generic)
       
   167  * @test GT83-TVOICE-004.02 "Test retrieval of a voice line's current status when the line's status is ""Idle"""
       
   168  * @test GT83-TVOICE-004.04 "Test retrieval of a voice line's current status when the line's status is ""Ringing"""
       
   169  * @test GT83-TVOICE-004.07 "Test retrieval of a voice line's current status when the line's status is ""Connected"""
       
   170  * @test GT83-TVOICE-004.08 "Test retrieval of a voice line's current status when the line's status is ""Hanging up"""
       
   171  * @test GT83-TVOICE-008.02 Test for a notification when there is an incoming call on a voice line
       
   172  * @test GT83-TVOICE-015.05 Test opening an existing call from a voice line by specifying the name of the line and the name of an existing call
       
   173  * @test GT83-TVOICE-026.00 Test answering a call on a voice line (Generic)
       
   174  * @test GT83-TVOICE-030.00 Test retrieval of a mobile voice line's current status (Generic)
       
   175  * @test GT83-TVOICE-030.02 "Test retrieval of a mobile voice line's current status when there is only one call on the line and it's status is ""Dialling"""
       
   176  * @test GT83-TVOICE-030.03 "Test retrieval of a mobile voice line's current status when there is only one call on the line and it's status is ""Ringing"""
       
   177  * @test GT83-TVOICE-030.06 "Test retrieval of a mobile voice line's current status when there is only one call on the line and it's status is ""Disconnecting"""
       
   178  * @test GT83-TVOICE-030.07 "Test retrieval of a mobile voice line's current status when there is only one call on the line and it's status is ""on hold"""
       
   179  * @test GT83-TVOICE-031.01 Test setting a request for a notification of a change in the status of the mobile voice line
       
   180 */
       
   181 	{
       
   182 	CConsoleBase* console = Console::NewL(KConsoleTitle, TSize(KConsFullScreen, KConsFullScreen));
       
   183 	CleanupStack::PushL(console);
       
   184 	
       
   185 	_LIT(KStartText, "Test Line Status") ; TEST_START(&KStartText) ;
       
   186 	console->Printf(_L("Test Line Status...\n"));
       
   187 	
       
   188 	//to make sure that line and call will be closed in leave case
       
   189 	CleanupClosePushL(iVoiceCall) ;
       
   190 	CleanupClosePushL(iLine) ;
       
   191 
       
   192 	RCall::TStatus lineStatus;
       
   193 	TBuf<16> GoodNumber ;
       
   194 	GetGoodNumber(GoodNumber) ;
       
   195 	// Open a Voice Line and Call
       
   196 	//GT83-AT-021	Test opening a Voice Line from a phone that supports data functionality
       
   197 	INFO_PRINTF1(_L("Opening Voice Line"));
       
   198 	TInt ret = iLine.Open(iPhone,KVoiceLineName);
       
   199 	TEST_CHECKL(ret, KErrNone, _L("GT83-TVOICE-001.01"));
       
   200 	TESTCHECKL(ret,KErrNone);
       
   201 
       
   202 	/* @test GT83-AT-36	Test retrieval of the current call status when it is idle*/
       
   203 	ret = iLine.GetStatus(lineStatus);
       
   204 	CHECKPOINT(ret, KErrNone, _L("*** Failed RMobileLine::GetStatus() ***"));
       
   205 	TESTCHECK(ret, KErrNone);
       
   206 	CHECKPOINT(lineStatus, RCall::EStatusIdle, _L("GT83-TVOICE-004.02")) ;
       
   207 
       
   208 	RMobileCall::TMobileCallStatus mobileLineStatus;
       
   209 	ret = iLine.GetMobileLineStatus(mobileLineStatus);
       
   210 	CHECKPOINT(ret, KErrNone, _L("*** Failed RMobileLine::GetMobileLineStatus() ***"));
       
   211 	TESTCHECK(ret, KErrNone);
       
   212 	CHECKPOINT(mobileLineStatus, RMobileCall::EStatusIdle, _L("GT83-TVOICE-031.01")) ;
       
   213 
       
   214 	INFO_PRINTF1(_L("Please ring the phone "));
       
   215 	console->Printf(KPleaseRingThePhone);
       
   216 
       
   217 	TName callName;
       
   218 	/* @test GT83-AT-024	Test setting notification of an incoming call on a Voice Line */
       
   219 	iLine.NotifyIncomingCall(iStatus, callName);	// wait for a call
       
   220 	WaitWithTimeout(iStatus,60*KOneSecond);				// but timeout after 60 seconds
       
   221 	ret = iStatus.Int();
       
   222 	CHECKPOINT(ret, KErrNone, _L("GT83-TVOICE-008.02")) ;
       
   223 	TESTCHECK(ret, KErrNone);
       
   224 	INFO_PRINTF2(_L("Voice Call name is %S"), &callName);
       
   225 
       
   226 	/* @test GT83-AT-36	Test retrieval of the current call status when it is ringing*/
       
   227 	ret = iLine.GetStatus(lineStatus);
       
   228 	CHECKPOINT(ret, KErrNone, _L("*** Failed RMobileLine::GetStatus() ***"));
       
   229 	TESTCHECK(ret, KErrNone);
       
   230 	CHECKPOINT(lineStatus, RCall::EStatusRinging, _L("GT83-TVOICE-004.04")) ;
       
   231 
       
   232 	ret = iLine.GetMobileLineStatus(mobileLineStatus);
       
   233 	CHECKPOINT(ret, KErrNone, _L("*** Failed RMobileLine::GetMobileLineStatus() ***"));
       
   234 	TESTCHECK(ret, KErrNone);
       
   235 	CHECKPOINT(mobileLineStatus, RMobileCall::EStatusRinging, _L("GT83-TVOICE-030.003")) ;
       
   236 	INFO_PRINTF1(_L("Phone is ringing..."));
       
   237 	console->Printf(_L("Phone is ringing...\n"));
       
   238 	
       
   239 	//Test for incoming Voice Call
       
   240 	TestLineCapabilitiesL();
       
   241 
       
   242 	/* @test GT83-AT-028	Test opening a new call by specifying the name of a line
       
   243 	*/
       
   244 	ret = iVoiceCall.OpenExistingCall(iLine, callName);
       
   245 	TEST_CHECKL(ret, KErrNone, _L("GT83-TVOICE-015.05 - *** Failed RMobileCall::OpenExistingCall() ***")) ;
       
   246 	TESTCHECKL(ret, KErrNone);
       
   247 	// Answer an incoming call initiated by t_echo.exe and obtain the call's current status
       
   248 	//GT83-AT-032	Test answering a call on a Voice Line (Generic)	RCall::AnswerIncomingCall
       
   249 	iVoiceCall.AnswerIncomingCall(iStatus);
       
   250 	WaitWithTimeout(iStatus,30*KOneSecond);		// but timeout after 2 seconds
       
   251 	TEST_CHECKL(iStatus.Int(), KErrNone, _L("*** Failed RMobileCall::AnswerIncomingCall() ***")) ;
       
   252 	TESTCHECKL(iStatus.Int(), KErrNone);
       
   253 	ret = iLine.GetStatus(lineStatus);
       
   254 	CHECKPOINT(ret, KErrNone, _L("*** Failed RMobileLine::GetStatus() ***")) ;
       
   255 	TESTCHECK(ret, KErrNone);
       
   256 	CHECKPOINT(lineStatus, RCall::EStatusConnected, _L("GT83-TVOICE-004.04")) ;
       
   257 
       
   258 	ret = iLine.GetMobileLineStatus(mobileLineStatus);
       
   259 	CHECKPOINT(ret, KErrNone, _L("*** Failed RMobileLine::GetMobileLineStatus() ***")) ;
       
   260 	TESTCHECK(ret, KErrNone);
       
   261 	CHECKPOINT(mobileLineStatus, RMobileCall::EStatusConnected, _L("GT83-TVOICE-030.03")) ;
       
   262 	TestLineCapabilitiesL();
       
   263 
       
   264 	/* @test GT83-AT-36	Test retrieval of the current call status when it is connected*/
       
   265 	ret = iLine.GetStatus(lineStatus);
       
   266 	CHECKPOINT(ret, KErrNone, _L("*** Failed RMobileLine::GetStatus() ***")) ;
       
   267 	TESTCHECK(ret, KErrNone);
       
   268 	CHECKPOINT(lineStatus, RCall::EStatusConnected, _L("GT83-TVOICE-004.07")) ;
       
   269 
       
   270 	ret = iLine.GetMobileLineStatus(mobileLineStatus);
       
   271 	CHECKPOINT(ret, KErrNone, _L("*** Failed RMobileLine::GetMobileLineStatus() ***")) ;
       
   272 	TESTCHECK(ret, KErrNone);
       
   273 	CHECKPOINT(mobileLineStatus, RMobileCall::EStatusConnected, _L("GT83-TVOICE-030.07")) ;
       
   274 
       
   275 
       
   276 	INFO_PRINTF1(_L("Please stay connected... the test will hang up shortly"));
       
   277 	console->Printf(_L("Please stay connected... the test will hang up shortly\n"));
       
   278 	User::After(10*KOneSecond);
       
   279 
       
   280 	INFO_PRINTF1(_L("Hanging Up"));
       
   281 	console->Printf(_L("Hanging Up\n"));
       
   282 	iVoiceCall.HangUp(iStatus);
       
   283 
       
   284 	/* @test GT83-AT-36	Test retrieval of the current call status when it is hang up*/
       
   285 	ret = iLine.GetStatus(lineStatus);
       
   286 	CHECKPOINT(ret, KErrNone, _L("*** Failed RMobileLine::GetStatus() ***")) ;
       
   287 	TESTCHECK(ret, KErrNone);
       
   288 	CHECKPOINT(lineStatus, RCall::EStatusHangingUp, _L("GT83-TVOICE-004.08")) ;
       
   289 
       
   290 	ret = iLine.GetMobileLineStatus(mobileLineStatus);
       
   291 	CHECKPOINT(ret, KErrNone, _L("*** Failed RMobileLine::GetMobileLineStatus() ***")) ;
       
   292 	TESTCHECK(ret, KErrNone);
       
   293 	CHECKPOINT(mobileLineStatus, RMobileCall::EStatusDisconnecting, _L("GT83-TVOICE-034.09")) ;
       
   294 
       
   295 	User::WaitForRequest(iStatus);
       
   296 	TEST_CHECKL(iStatus.Int(), KErrNone, _L("*** Failed RMobileCall::Hangup() ***")) ;  //???  line 825
       
   297 	TESTCHECKL(iStatus.Int(), KErrNone);
       
   298 	/* @test GT83-AT-36	Test retrieval of the current call status when it is idle*/
       
   299 	ret = iLine.GetStatus(lineStatus);
       
   300 	CHECKPOINT(ret, KErrNone, _L("*** Failed RMobileLine::GetStatus() ***")) ;
       
   301 	TESTCHECK(ret, KErrNone);
       
   302 	CHECKPOINT(lineStatus, RCall::EStatusIdle, _L("GT83-TVOICE-004.02")) ;
       
   303 
       
   304 	ret = iLine.GetMobileLineStatus(mobileLineStatus);
       
   305 	CHECKPOINT(ret, KErrNone, _L("*** Failed RMobileLine::GetMobileLineStatus() ***")) ;
       
   306 	TESTCHECK(ret, KErrNone);
       
   307 	CHECKPOINT(mobileLineStatus, RMobileCall::EStatusIdle, _L("GT83-TVOICE-030.02")) ;
       
   308 
       
   309 	// Close the line and call
       
   310 	CleanupStack::PopAndDestroy(&iLine) ;
       
   311 	CleanupStack::PopAndDestroy(&iVoiceCall) ;
       
   312 
       
   313 	TEST_END() ;
       
   314 
       
   315 	console->Printf(_L("Finished\n"));
       
   316 	User::After(10*KOneSecond);
       
   317 	CleanupStack::PopAndDestroy(console);
       
   318 
       
   319 	return TestStepResult();
       
   320 	}
       
   321 //------------------------------------------------------------------
       
   322 
       
   323 
       
   324 CTestLineStatusOutgoingCall::CTestLineStatusOutgoingCall()
       
   325 /* Each test step initialises it's own name
       
   326 */
       
   327 	{
       
   328 	// store the name of this test case
       
   329 	// this is the name that is used by the script file
       
   330 	SetTestStepName(_L("TestLineStatusOutgoingCall"));
       
   331 	}
       
   332 //------------------------------------------------------------------
       
   333 enum TVerdict CTestLineStatusOutgoingCall::doTestStepL()
       
   334 //void CTestVoice::TestLineStatusOutgoingCallL()
       
   335 /**	 Tests line status function
       
   336  * @test GT83-TVOICE-001.01 "Test opening a voice line, specifying the phone that should be used"
       
   337  * @test GT83-TVOICE-004.00 Test retrieval of a voice line's current status (Generic)
       
   338  * @test GT83-TVOICE-004.01 "Test retrieval of a voice line's current status when the line's status is ""Unknown"""
       
   339  * @test GT83-TVOICE-004.02 "Test retrieval of a voice line's current status when the line's status is ""Idle"""
       
   340  * @test GT83-TVOICE-004.03 "Test retrieval of a voice line's current status when the line's status is ""Dialling"""
       
   341  * @test GT83-TVOICE-004.07 "Test retrieval of a voice line's current status when the line's status is ""Connected"""
       
   342  * @test GT83-TVOICE-004.08 "Test retrieval of a voice line's current status when the line's status is ""Hanging up"""
       
   343  * @test GT83-TVOICE-014.05 "Test opening a new call by specifying the name of a line, and displaying the name of the new call"
       
   344  * @test GT83-TVOICE-030.00 Test retrieval of a mobile voice line's current status (Generic)
       
   345  * @test GT83-TVOICE-030.07 "Test retrieval of a mobile voice line's current status when there is only one call on the line and it's status is ""on hold"""
       
   346  * @test GT83-TVOICE-031.01 Test setting a request for a notification of a change in the status of the mobile voice line
       
   347 */
       
   348 	{
       
   349 	CConsoleBase* console = Console::NewL(KConsoleTitle, TSize(KConsFullScreen, KConsFullScreen));
       
   350 	CleanupStack::PushL(console);
       
   351 	
       
   352 	_LIT(KStartText, "Test Line Status") ; TEST_START(&KStartText) ;
       
   353 	console->Printf(_L("Test Line Status\n"));
       
   354 	
       
   355 	//to make sure that line and call will be closed in leave case
       
   356 	CleanupClosePushL(iVoiceCall) ;
       
   357 	CleanupClosePushL(iLine) ;
       
   358 
       
   359 	RCall::TStatus lineStatus;
       
   360     TName CallName ;
       
   361 	TBuf<16> GoodNumber ;
       
   362 	GetGoodNumber(GoodNumber) ;
       
   363 	// Open a Voice Line and Call
       
   364 	//GT83-AT-021	Test opening a Voice Line from a phone that supports data functionality
       
   365 	INFO_PRINTF1(_L("Opening Voice Line"));
       
   366 	TEST_CHECKL(iLine.Open(iPhone,KVoiceLineName), KErrNone, _L("GT83-TVOICE-001.01"));
       
   367 	
       
   368 
       
   369 	/* @test GT83-AT-36	Test retrieval of the current call status when it is idle*/
       
   370 	TInt ret = iLine.GetStatus(lineStatus);
       
   371 	CHECKPOINT(ret, KErrNone, _L("*** Failed RMobileLine::GetStatus() ***")) ;
       
   372 	TESTCHECK(ret, KErrNone);
       
   373 	CHECKPOINT(lineStatus, RCall::EStatusIdle, _L("GT83-TVOICE-004.02")) ;
       
   374 
       
   375 	RMobileCall::TMobileCallStatus mobileLineStatus;
       
   376 	ret = iLine.GetMobileLineStatus(mobileLineStatus);
       
   377 	CHECKPOINT(ret, KErrNone, _L("*** Failed RMobileLine::GetMobileLineStatus() ***")) ;
       
   378 	TESTCHECK(ret, KErrNone);
       
   379 	CHECKPOINT(mobileLineStatus, RMobileCall::EStatusIdle, _L("GT83-TVOICE-031.01")) ;
       
   380 	/* @test GT83-AT-028	Test opening a new call by specifying the name of a line
       
   381 	*/
       
   382 	INFO_PRINTF1(_L("Opening New Voice Call"));
       
   383 	TEST_CHECKL(iVoiceCall.OpenNewCall(iLine, CallName), KErrNone, _L("GT83-TVOICE-014.05"));
       
   384 	INFO_PRINTF2(_L("Voice Call name is %S"), &CallName);
       
   385 
       
   386 	INFO_PRINTF2(_L("Dialling %S...."),&GoodNumber);
       
   387 	iVoiceCall.Dial(iStatus, GoodNumber);
       
   388 
       
   389 	//doesn't work for MM.TSY
       
   390 	ret = iLine.GetStatus(lineStatus);
       
   391 	CHECKPOINT(ret, KErrNone, _L("GT83-TVOICE-004.00")) ;
       
   392 	TESTCHECK(ret, KErrNone);
       
   393 	//TEST_CHECKL(lineStatus, RCall::EStatusDialling, _L("GT83-TVOICE-004.03")) ;
       
   394 
       
   395 	WaitWithTimeout(iStatus,60*KOneSecond);				// but timeout after 60 seconds
       
   396 	TEST_CHECKL(iStatus.Int(), KErrNone, _L("*** Failed RMobileCall::Dial() ***")) ;
       
   397 	TESTCHECKL(iStatus.Int(), KErrNone);
       
   398 	//Test for outgoing Voice Call
       
   399 	TestLineCapabilitiesL();
       
   400 
       
   401 	/* @test GT83-AT-36	Test retrieval of the current call status when it is connected*/
       
   402 	ret = iLine.GetStatus(lineStatus);
       
   403 	CHECKPOINT(ret, KErrNone, _L("*** Failed RMobileLine::GetStatus() ***")) ;
       
   404 	TESTCHECK(ret, KErrNone);
       
   405 	CHECKPOINT(lineStatus, RCall::EStatusConnected, _L("GT83-TVOICE-004.07")) ;
       
   406 
       
   407 	ret = iLine.GetMobileLineStatus(mobileLineStatus);
       
   408 	CHECKPOINT(ret, KErrNone, _L("*** Failed RMobileLine::GetMobileLineStatus() ***")) ;
       
   409 	TESTCHECK(ret, KErrNone);
       
   410 	CHECKPOINT(mobileLineStatus, RMobileCall::EStatusConnected, _L("GT83-TVOICE-030.07")) ;
       
   411 
       
   412 
       
   413 	INFO_PRINTF1(_L("Please stay connected... the test will hang up shortly"));
       
   414 	console->Printf(_L("Please stay connected... the test will hang up shortly\n"));
       
   415 	User::After(10*KOneSecond);
       
   416 
       
   417 	INFO_PRINTF1(_L("Call connected - listen for 20 seconds..."));
       
   418 	console->Printf(_L("Call connected - listen for 20 seconds...\n"));
       
   419 	User::After(20*KOneSecond); // hold call active for 20 seconds
       
   420 
       
   421 	INFO_PRINTF1(_L("Hanging up"));
       
   422 	iVoiceCall.HangUp(iStatus);
       
   423 	ret = iLine.GetStatus(lineStatus);
       
   424 	CHECKPOINT(ret, KErrNone, _L("*** Failed RMobileLine::GetStatus() ***")) ;
       
   425 	TESTCHECK(ret, KErrNone);
       
   426 	CHECKPOINT(lineStatus, RCall::EStatusHangingUp, _L("GT83-TVOICE-004.08")) ;
       
   427 	User::WaitForRequest(iStatus);
       
   428 	TEST_CHECKL(iStatus.Int(), KErrNone, _L("*** Failed RMobileCall::Hangup() ***")) ;
       
   429 	TESTCHECKL(iStatus.Int(), KErrNone);
       
   430 
       
   431 	//Test for outgoing Voice Call after hang up
       
   432 	TestLineCapabilitiesL();
       
   433 	/* @test GT83-AT-36	Test retrieval of the current call status when it is connected*/
       
   434 	ret = iLine.GetStatus(lineStatus);
       
   435 	CHECKPOINT(ret, KErrNone, _L("*** Failed RMobileLine::GetStatus() ***")) ;
       
   436 	TESTCHECK(ret, KErrNone);
       
   437 	CHECKPOINT(lineStatus, RCall::EStatusIdle, _L("GT83-TVOICE-004.02")) ;
       
   438 
       
   439 	ret = iLine.GetMobileLineStatus(mobileLineStatus);
       
   440 	CHECKPOINT(ret, KErrNone, _L("*** Failed RMobileLine::GetMobileLineStatus() ***")) ;
       
   441 	TESTCHECK(ret, KErrNone);
       
   442 	CHECKPOINT(mobileLineStatus, RMobileCall::EStatusIdle, _L("GT83-TVOICE-004.01")) ;
       
   443 
       
   444 	// Close the line and call
       
   445 	CleanupStack::PopAndDestroy(&iLine) ;
       
   446 	CleanupStack::PopAndDestroy(&iVoiceCall) ;
       
   447 
       
   448 	TEST_END() ;
       
   449 
       
   450 	console->Printf(_L("Finished\n"));
       
   451 	User::After(10*KOneSecond);
       
   452    	CleanupStack::PopAndDestroy(console);
       
   453 
       
   454 	return TestStepResult();
       
   455 	}
       
   456 //------------------------------------------------------------------
       
   457 
       
   458 CTestLineInfo::CTestLineInfo()
       
   459 /* Each test step initialises it's own name
       
   460 */
       
   461 	{
       
   462 	// store the name of this test case
       
   463 	// this is the name that is used by the script file
       
   464 	//iTestStepName = _L("TestLineInfo");  //MODIFIIED -Was Incorrect ("TestLineInfoL")
       
   465 	SetTestStepName(_L("TestLineInfo"));
       
   466 	}
       
   467 //------------------------------------------------------------------
       
   468 
       
   469 enum TVerdict CTestLineInfo::doTestStepL()
       
   470 //void CTestVoice::TestLineInfoL()
       
   471 /**
       
   472  * This function gets the Line capabilities, line information, Number of calls
       
   473  * on the line and call information,
       
   474  * @test NONE	Test the ability to get the current line information of the Voice Line (Generic)
       
   475  * @test GT83-TVOICE-001.01 "Test opening a voice line, specifying the phone that should be used"
       
   476  * @test GT83-TVOICE-005.01 "Test retrieval of the current hook status, when the line is currently ""off hook"""
       
   477  * @test GT83-TVOICE-005.02 "Test retrieval of the current hook status, when the line is currently ""on hook"""
       
   478  * @test GT83-TVOICE-012.01 Test the ability to get the current line information of the voice line. Display the line information to screen.
       
   479  * @test GT83-TVOICE-014.05 "Test opening a new call by specifying the name of a line, and displaying the name of the new call"
       
   480  * @test GT83-TVOICE-026.00 Test answering a call on a voice line (Generic)
       
   481  * @test GT83-TVOICE-027.02 Test the ability to place an asynchronous request to hang up a voice call
       
   482  * @test GT83-TVOICE-006.01 "Test enumeration of the number of calls on a voice line, when there is 0 active call."
       
   483  * @test GT83-TVOICE-006.02 "Test enumeration of the number of calls on a voice line, when there is 1 active call."
       
   484 */
       
   485 	{
       
   486 	CConsoleBase* console = Console::NewL(KConsoleTitle,TSize(KConsFullScreen,KConsFullScreen));
       
   487     CleanupStack::PushL(console);
       
   488 	
       
   489 	_LIT(KStartText, "Test Line Information") ; TEST_START(&KStartText) ;
       
   490 	TInt lineCount=0;
       
   491 
       
   492 	//to make sure that line and call will be closed in leave case
       
   493 	CleanupClosePushL(iVoiceCall) ;
       
   494 	CleanupClosePushL(iLine) ;
       
   495 
       
   496 	// Open a Voice Line and Call
       
   497 	//GT83-AT-021	Test opening a Voice Line from a phone that supports data functionality
       
   498 	INFO_PRINTF1(_L("Opening Voice Line"));
       
   499 	console->Printf(_L("Opening Voice Line\n"));
       
   500 	TEST_CHECKL(iLine.Open(iPhone,KVoiceLineName), KErrNone, _L("*** Failed RMobileLine::Open() ***"));
       
   501 
       
   502    	INFO_PRINTF1(_L("Retrieving no. of calls opened from the line.."));
       
   503    	console->Printf(_L("Retrieving no. of calls opened from the line..\n"));
       
   504 	TEST_CHECKL(iLine.EnumerateCall(lineCount), KErrNone, _L("*** Failed RMobileLine::EnumerateCall() ***"));
       
   505 	INFO_PRINTF2(TRefByValue<const TDesC>(_L("No of calls opened = %d")), lineCount);
       
   506 
       
   507     TName CallName ;
       
   508 	INFO_PRINTF1(_L("Opening New Voice Call"));
       
   509 	console->Printf(_L("Opening New Voice Call\n"));
       
   510 	TEST_CHECKL(iVoiceCall.OpenNewCall(iLine, CallName), KErrNone, _L("GT83-TVOICE-014.05 - *** Failed RMobileCall::OpenNewCall() ***"));
       
   511 	INFO_PRINTF2(_L("Voice Call name is %S"), &CallName);
       
   512 
       
   513 	// Line Information
       
   514 	RLine::TLineInfo lineInfo;
       
   515 	TRAPD(ret, ret=iLine.GetInfo(lineInfo));
       
   516 	TESTCHECK(ret, KErrNone);
       
   517 	CHECKPOINT_EXPR((ret==KErrNone || ret==KErrNotSupported), _L("*** Failed RMobileLine::GetInfo() ***"));
       
   518 	if (ret==KErrNotSupported)
       
   519 		{
       
   520 		INFO_PRINTF1(_L("Get Line Info. is NOT supported"));
       
   521 		}
       
   522 	else
       
   523 		{
       
   524 		INFO_PRINTF1(_L("Get Line Info is successful"));
       
   525 		TESTL(lineInfo.iHookStatus ==  RCall::EHookStatusOn) ;
       
   526 		TESTCHECKL(lineInfo.iHookStatus, RCall::EHookStatusOn);
       
   527 		TESTL(lineInfo.iStatus == RCall::EStatusIdle) ;
       
   528 		TESTCHECKL(lineInfo.iStatus, RCall::EHookStatusOn);
       
   529 		INFO_PRINTF2(TRefByValue<const TDesC>(_L("Name of last call added: %S")), &lineInfo.iNameOfLastCallAdded);
       
   530 		}
       
   531 
       
   532 	// Hook status information
       
   533 	INFO_PRINTF1(_L("Retrieving Hook Status..."));
       
   534 	console->Printf(_L("Retrieving Hook Status...\n"));
       
   535 	RCall::THookStatus hookStatus;
       
   536 	ret=iLine.GetHookStatus(hookStatus);
       
   537 	CHECKPOINT_EXPR((ret==KErrNone || ret==KErrNotSupported), _L("*** Failed RMobileLine::GetHookStatus() ***"));
       
   538 	if (ret==KErrNotSupported)
       
   539 		{
       
   540 		INFO_PRINTF1(_L("Get Hook status is NOT supported"));
       
   541 		}
       
   542 	else
       
   543 		{
       
   544 		TEST_CHECKL(hookStatus, RCall::EHookStatusOn, _L("GT83-TVOICE-005.02")) ;
       
   545 		TESTCHECKL(hookStatus, RCall::EHookStatusOn);
       
   546 		INFO_PRINTF1(_L("The line is currently ON Hook"));
       
   547 		}
       
   548 
       
   549 	INFO_PRINTF1(_L("Please ring the phone "));
       
   550 	console->Printf(KPleaseRingThePhone);
       
   551 
       
   552 	// Answer an incoming call initiated  and obtain the call's current status
       
   553 	iVoiceCall.AnswerIncomingCall(iStatus);
       
   554 
       
   555 	WaitWithTimeout(iStatus,6*KTenSeconds);		// but timeout after 60 seconds
       
   556 	TEST_CHECKL(iStatus.Int(), KErrNone, _L("*** Failed RMobileCall::AnswerIncomingCall() ***")) ;
       
   557 	TESTCHECKL(iStatus.Int(), KErrNone)
       
   558 	// Count the no. of calls on the line & Get call info.
       
   559 	INFO_PRINTF1(_L("Retrieving no. of calls opened from the line.."));
       
   560 	console->Printf(_L("Retrieving no. of calls opened from the line..\n"));
       
   561 	TEST_CHECKL(iLine.EnumerateCall(lineCount), KErrNone, _L("GT83-TVOICE-006.02 - *** Failed RMobileLine::EnumerateCall() ***"));
       
   562 	INFO_PRINTF2(TRefByValue<const TDesC>(_L("No of calls opened = %d")), lineCount);
       
   563 
       
   564 	//doesn't work for MM.TSY
       
   565 	INFO_PRINTF1(_L("Getting Call info.."));
       
   566 	console->Printf(_L("Getting Call info..\n"));
       
   567 	RLine::TCallInfo callInfo;
       
   568 	ret=iLine.GetCallInfo(0,callInfo);
       
   569 	//doesn't work for MM.TSY
       
   570 	CHECKPOINT_EXPR((ret == KErrNotSupported || ret == KErrNone), _L("GT83-TVOICE-007.01 - *** Failed RMobileLine::GetCallInfo() ***"));
       
   571 	if (ret==KErrNotSupported)
       
   572 		{
       
   573 		INFO_PRINTF1(_L("Get Call information is NOT supported"));
       
   574 		}
       
   575 	if (ret==KErrNone)
       
   576 		{
       
   577 		INFO_PRINTF1(_L("Get Call information is successful"));
       
   578 		}
       
   579 
       
   580 	// Get the line's current hook status
       
   581 	ret=iLine.GetHookStatus(hookStatus);
       
   582 	CHECKPOINT_EXPR((ret==KErrNone || ret==KErrNotSupported), _L("*** Failed RMobileLine::GetHookStatus() ***"));
       
   583 	if (ret==KErrNotSupported)
       
   584 		{
       
   585 		INFO_PRINTF1(_L("Get Hook status is NOT supported"));
       
   586 		}
       
   587 	else
       
   588 		{
       
   589 		CHECKPOINT(hookStatus, RCall::EHookStatusOff, _L("GT83-TVOICE-005.01")) ;
       
   590 		INFO_PRINTF1(_L("The line is currently OFF Hook"));
       
   591 		}
       
   592 
       
   593 	INFO_PRINTF1(_L("Please stay connected... the test will hang up shortly"));
       
   594 	console->Printf(_L("Please stay connected... the test will hang up shortly\n"));
       
   595 	User::After(KTenSeconds);
       
   596 
       
   597 	INFO_PRINTF1(_L("Hanging up"));
       
   598 	console->Printf(_L("Hanging up\n"));
       
   599 	iVoiceCall.HangUp(iStatus);
       
   600 	User::WaitForRequest(iStatus);
       
   601 	TEST_CHECKL(iStatus.Int(), KErrNone, _L("GT83-TVOICE-027.02 - *** Failed RMobileCall::Hangup() ***")) ;
       
   602 	// Close the line and call
       
   603 	//GT83-AT-022	Test closing a Voice Line (Generic)	RLine::Close
       
   604 
       
   605 	// Close the line and call
       
   606 	CleanupStack::PopAndDestroy(&iLine) ;
       
   607 	CleanupStack::PopAndDestroy(&iVoiceCall) ;
       
   608 
       
   609 	TEST_END() ;
       
   610 
       
   611 	console->Printf(_L("Finished\n"));
       
   612 	User::After(10*KOneSecond);
       
   613    	CleanupStack::PopAndDestroy(console);	
       
   614 
       
   615 	return TestStepResult();
       
   616 	}
       
   617 //------------------------------------------------------------------
       
   618 
       
   619 CTestLineNotificationsIncomingCall::CTestLineNotificationsIncomingCall()
       
   620 /* Each test step initialises it's own name
       
   621 */
       
   622 	{
       
   623 	// store the name of this test case
       
   624 	// this is the name that is used by the script file
       
   625 	SetTestStepName(_L("TestLineNotificationsIncomingCall"));
       
   626 	}
       
   627 //------------------------------------------------------------------
       
   628 
       
   629 enum TVerdict CTestLineNotificationsIncomingCall::doTestStepL()
       
   630 //void CTestVoice::TestLineNotificationsIncomingCallL()
       
   631 /** Tests line notifications
       
   632  * @test GT83-TVOICE-001.01 "Test opening a voice line, specifying the phone that should be used"
       
   633  * @test GT83-TVOICE-008.02 Test for a notification when there is an incoming call on a voice line
       
   634  * @test GT83-TVOICE-009.01 Test setting notification of a change in hook status of a voice line
       
   635  * @test GT83-TVOICE-009.02 "Test notification of a change in hook status of a voice line from ""off"" to ""on"""
       
   636  * @test GT83-TVOICE-009.03 "Test notification of a change in hook status of a voice line from ""on"" to off"""
       
   637  * @test GT83-TVOICE-010.01 "Test notification of a change in the status of the voice line from ""idle"" to ""ringing"" to ""answering"" to ""connected"" to ""hanging up"" to ""idle""
       
   638  * @test GT83-TVOICE-011.02 Test notification of a call being added to a voice line that currently has no calls
       
   639  * @test GT83-TVOICE-015.05 Test opening an existing call from a voice line by specifying the name of the line and the name of an existing call
       
   640  * @test GT83-TVOICE-026.00 Test answering a call on a voice line (Generic)
       
   641  * @test GT83-TVOICE-031.01 Test setting a request for a notification of a change in the status of the mobile voice line
       
   642  * @test GT83-TVOICE-031.07 "Test for a notification of a change in status of the mobile voice line from ""connected"" to ""disconnecting"""
       
   643  * @test GT83-TVOICE-031.08 "Test for a notification of a change in status of the mobile voice line from ""disconnecting"" to ""idle"""
       
   644  * @test GT83-TVOICE-031.09 "Test for a notification of a change in status of the mobile voice line from ""idle"" to ""ringing"""
       
   645  * @test GT83-TVOICE-031.10 "Test for a notification of a change in status of the mobile voice line from ""ringing"" to ""answering"""
       
   646  * @test GT83-TVOICE-031.11 "Test for a notification of a change in status of the mobile voice line from ""answering"" to ""connected"""
       
   647 */
       
   648 	{
       
   649 	CConsoleBase* console = Console::NewL(KConsoleTitle,TSize(KConsFullScreen,KConsFullScreen));
       
   650     CleanupStack::PushL(console);
       
   651 	
       
   652 	_LIT(KStartText, "Test Line Notifications") ; TEST_START(&KStartText) ;
       
   653 	console->Printf(_L("Test Line Notifications\n"));
       
   654 	
       
   655 	//to make sure that line and call will be closed in leave case
       
   656 	CleanupClosePushL(iVoiceCall) ;
       
   657 	CleanupClosePushL(iLine) ;
       
   658 
       
   659 	TBuf<16> GoodNumber ;
       
   660 	GetGoodNumber(GoodNumber) ;
       
   661 
       
   662 	// NotifyIncomingCall and NotifyStatusChange
       
   663 	TName callName1;
       
   664 	TName callName2;
       
   665 	TInt ret = KErrNone;
       
   666 	RCall::TStatus lineStatus;
       
   667 	RMobileCall::TMobileCallStatus mobileLineStatus;
       
   668 	RCall::THookStatus hookStatus;
       
   669 
       
   670 
       
   671 	//GT83-AT-021	Test opening a Voice Line from a phone that supports data functionality
       
   672 	INFO_PRINTF1(_L("Opening Voice Line"));
       
   673 	console->Printf(_L("Opening Voice Line\n"));
       
   674 	TEST_CHECKL(iLine.Open(iPhone,KVoiceLineName), KErrNone, _L("*** Failed RMobileLine.Open() ***"));
       
   675 
       
   676 	INFO_PRINTF1(_L("Please ring the phone "));
       
   677 	console->Printf(KPleaseRingThePhone);
       
   678 
       
   679 	iLine.NotifyIncomingCall(iStatus, callName1);	// wait for a call
       
   680 
       
   681 	//GT83-AT-026	Test setting notification of a change in the status of the Voice Line
       
   682 	iLine.NotifyStatusChange(iStatus2, lineStatus);
       
   683 
       
   684 	iLine.NotifyMobileLineStatusChange(iStatus3, mobileLineStatus);
       
   685 
       
   686 	//GT83-AT-037	Test setting notification of a change in hook status of a Voice Line	void RLine::NotifyHookChange(TRequestStatus& aStatus, THookStatus& aHookStatus)	Function does not produce any unexpected errors. aStatus = KErrPending
       
   687 	iLine.NotifyHookChange(iStatus4, hookStatus);
       
   688 
       
   689     /* GT83-AT-025	Test notification of a call being added to a Voice Line 	*/
       
   690 	iLine.NotifyCallAdded(iStatus5, callName2);
       
   691 
       
   692 	CHECKPOINT(iStatus.Int(), KRequestPending, _L("GT83-TVOICE-008.02")) ;
       
   693 	CHECKPOINT(iStatus2.Int(), KRequestPending, _L("GT83-TVOICE-010.01")) ;
       
   694 	CHECKPOINT(iStatus3.Int(), KRequestPending, _L("GT83-TVOICE-031.01")) ;
       
   695 	CHECKPOINT(iStatus4.Int(), KRequestPending, _L("GT83-TVOICE-009.01")) ;
       
   696 	CHECKPOINT(iStatus5.Int(), KRequestPending, _L("GT83-TVOICE-0011.01")) ;
       
   697 
       
   698 	WaitWithTimeout(iStatus,60*KOneSecond);				// but timeout after 60 seconds
       
   699 	TEST_CHECKL(iStatus.Int(), KErrNone, _L("GT83-TVOICE-008.02")) ;
       
   700 
       
   701     // @test GT83-AT-026	Test notification of a change in the status of the Voice Line
       
   702 	// from "idle" to "ringing"
       
   703 	User::WaitForRequest(iStatus2);
       
   704 	CHECKPOINT(iStatus2.Int(), KErrNone, _L("GT83-TVOICE-010.02")) ;
       
   705 	CHECKPOINT(lineStatus, RCall::EStatusRinging, _L("GT83-TVOICE-010.02")) ;
       
   706 
       
   707 	User::WaitForRequest(iStatus3);
       
   708 	CHECKPOINT(iStatus3.Int(), KErrNone, _L("GT83-TVOICE-031.09")) ;
       
   709 	CHECKPOINT(mobileLineStatus, RMobileCall::EStatusRinging, _L("GT83-TVOICE-031.09")) ;
       
   710 
       
   711 	/* GT83-AT-025	Test notification of a call being added to a Voice Line
       
   712 	that currently has no calls*/
       
   713 	User::WaitForRequest(iStatus5);
       
   714 	CHECKPOINT(iStatus5.Int(), KErrNone, _L("GT83-TVOICE-011.02")) ;
       
   715 	CHECKPOINT(callName2 == callName1, 1,  _L("GT83-TVOICE-011.02")) ;
       
   716 
       
   717 	INFO_PRINTF1(_L("Phone is ringing... Now answering..."));
       
   718 	console->Printf(_L("Phone is ringing... Now answering...\n"));
       
   719 
       
   720 	/* @test GT83-AT-026	Test notification of a change in the status of the Voice Line from
       
   721 	 "idle" to "ringing" to "answering" to "connected" to "hanging up" to "idle"
       
   722 	 */
       
   723 	iLine.NotifyStatusChange(iStatus2, lineStatus);
       
   724 	iLine.NotifyMobileLineStatusChange(iStatus3, mobileLineStatus);
       
   725 
       
   726 	ret = iVoiceCall.OpenExistingCall(iLine, callName1);
       
   727 	TEST_CHECKL(ret, KErrNone, _L("GT83-TVOICE-015.05")) ;
       
   728 
       
   729 	// Answer an incoming call initiated by t_echo.exe and obtain the call's current status
       
   730 	//GT83-AT-032	Test answering a call on a Voice Line (Generic)	RCall::AnswerIncomingCall
       
   731 	iVoiceCall.AnswerIncomingCall(iStatus);
       
   732     // GT83-AT-026	Test notification of a change in the status of the Voice Line
       
   733 	// from "ringing" to "answering"
       
   734 	User::WaitForRequest(iStatus2);
       
   735 	CHECKPOINT(iStatus2.Int(), KErrNone, _L("GT83-TVOICE-010.01")) ;
       
   736 	CHECKPOINT(lineStatus, RCall::EStatusAnswering, _L("GT83-TVOICE-010.01")) ;
       
   737 
       
   738 	WaitWithTimeout(iStatus,2*KOneSecond);		// but timeout after 2 seconds
       
   739 	TEST_CHECKL(iStatus.Int(), KErrNone, _L("*** Failed RMobileCall::AnswerIncomingCall() ***")) ;	  //wrong code -2147483647
       
   740 
       
   741 
       
   742     // @test GT83-AT-026	Test notification of a change in the status of the Voice Line
       
   743 	// from "answering"	to "connecting"
       
   744 	iLine.NotifyStatusChange(iStatus2, lineStatus);
       
   745 	User::WaitForRequest(iStatus2);
       
   746 	CHECKPOINT(iStatus2.Int(), KErrNone, _L("GT83-TVOICE-010.01")) ;
       
   747 	CHECKPOINT(lineStatus, RCall::EStatusConnected, _L("GT83-TVOICE-010.01")) ;
       
   748 
       
   749 	User::WaitForRequest(iStatus3);
       
   750 	CHECKPOINT(iStatus3.Int(), KErrNone, _L("GT83-TVOICE-031.10")) ;
       
   751 	CHECKPOINT(mobileLineStatus, RMobileCall::EStatusAnswering, _L("GT83-TVOICE-031.10")) ;
       
   752 
       
   753 	iLine.NotifyMobileLineStatusChange(iStatus3, mobileLineStatus);
       
   754 	User::WaitForRequest(iStatus3);
       
   755 	CHECKPOINT(iStatus3.Int(), KErrNone, _L("GT83-TVOICE-031.11")) ;
       
   756 	CHECKPOINT(mobileLineStatus, RMobileCall::EStatusConnected, _L("GT83-TVOICE-031.11")) ;
       
   757 
       
   758 	User::WaitForRequest(iStatus4);
       
   759 	CHECKPOINT(iStatus4.Int(), KErrNone, _L("GT83-TVOICE-009.02")) ;
       
   760 	CHECKPOINT(hookStatus, RCall::EHookStatusOff, _L("GT83-TVOICE-009.02")) ;
       
   761 
       
   762 	// now hangup call
       
   763 	iLine.NotifyStatusChange(iStatus2, lineStatus);
       
   764 	iLine.NotifyMobileLineStatusChange(iStatus3, mobileLineStatus);
       
   765 	iLine.NotifyHookChange(iStatus4, hookStatus);
       
   766 
       
   767 	INFO_PRINTF1(_L("Call connected - now hanging up..."));
       
   768 	console->Printf(_L("Call connected - now hanging up...\n"));
       
   769 	
       
   770 	iVoiceCall.HangUp(iStatus);
       
   771 	User::WaitForRequest(iStatus);
       
   772 	TEST_CHECKL(iStatus.Int(), KErrNone, _L("*** Failed RMobileCall::Hangup() ***")) ;
       
   773 
       
   774     //GT83-AT-026	Test notification of a change in the status of the Voice Line
       
   775 	// from "connecting" to "hanging up"
       
   776 	User::WaitForRequest(iStatus2);
       
   777 	CHECKPOINT(iStatus2.Int(), KErrNone, _L("GT83-TVOICE-010.02")) ;
       
   778 	CHECKPOINT(lineStatus, RCall::EStatusHangingUp, _L("GT83-TVOICE-010.02")) ;
       
   779 
       
   780 	User::WaitForRequest(iStatus3);
       
   781 	CHECKPOINT(iStatus3.Int(), KErrNone, _L("GT83-TVOICE-031.07")) ;
       
   782 	CHECKPOINT(mobileLineStatus, RMobileCall::EStatusDisconnecting, _L("GT83-TVOICE-031.07")) ;
       
   783 
       
   784 	// @test GT83-AT-026	Test notification of a change in the status of the data
       
   785 	// line from "hanging up" to "idle"
       
   786 	iLine.NotifyStatusChange(iStatus2, lineStatus);
       
   787 	User::WaitForRequest(iStatus2);
       
   788 	CHECKPOINT(iStatus2.Int(), KErrNone, _L("GT83-TVOICE-010.02")) ;
       
   789 	CHECKPOINT(lineStatus, RCall::EStatusIdle, _L("GT83-TVOICE-010.02")) ;
       
   790 
       
   791 	iLine.NotifyMobileLineStatusChange(iStatus3, mobileLineStatus);
       
   792 	User::WaitForRequest(iStatus3);
       
   793 	CHECKPOINT(iStatus3.Int(), KErrNone, _L("GT83-TVOICE-031.08")) ;
       
   794 	CHECKPOINT(mobileLineStatus, RMobileCall::EStatusIdle, _L("GT83-TVOICE-031.08")) ;
       
   795 
       
   796 	//!< @test GT83-AT-037	Test notification of a change in hook status of a Voice Line
       
   797 	//!<  from "off" to "on" aHookStatus = EHookStatusOff before the hook status changes,
       
   798 	//!< and EHookStatusOn after the hook status changes
       
   799 	User::WaitForRequest(iStatus4);
       
   800 	CHECKPOINT(iStatus4.Int(), KErrNone, _L("GT83-TVOICE-009.03")) ;
       
   801 	CHECKPOINT(hookStatus, RCall::EHookStatusOn, _L("GT83-TVOICE-009.03")) ;
       
   802 
       
   803 	// Close the line and call
       
   804 	CleanupStack::PopAndDestroy(&iLine) ;
       
   805 	CleanupStack::PopAndDestroy(&iVoiceCall) ;
       
   806 
       
   807 	TEST_END() ;
       
   808 
       
   809 	console->Printf(_L("Finished\n"));
       
   810 	User::After(10*KOneSecond);
       
   811    	CleanupStack::PopAndDestroy(console);
       
   812 
       
   813 	return TestStepResult();
       
   814 	}
       
   815 //------------------------------------------------------------------
       
   816 
       
   817 CTestLineNotificationsOutgoingCall::CTestLineNotificationsOutgoingCall()
       
   818 /* Each test step initialises it's own name
       
   819 */
       
   820 	{
       
   821 	// store the name of this test case
       
   822 	// this is the name that is used by the script file
       
   823 	SetTestStepName(_L("TestLineNotificationsOutgoingCall"));
       
   824 	}
       
   825 //------------------------------------------------------------------
       
   826 
       
   827 enum TVerdict CTestLineNotificationsOutgoingCall::doTestStepL()
       
   828 //void CTestVoice::TestLineNotificationsOutgoingCallL()
       
   829 /** Tests line notifications
       
   830  * @test GT83-TVOICE-001.01 "Test opening a voice line, specifying the phone that should be used"
       
   831  * @test GT83-TVOICE-009.02 "Test notification of a change in hook status of a voice line from ""off"" to ""on"""
       
   832  * @test GT83-TVOICE-009.03 "Test notification of a change in hook status of a voice line from ""on"" to off"""
       
   833  * @test GT83-TVOICE-010.03 "Test notification of a change in the status of the voice line from ""idle"" to ""dialling"" to ""connecting"" to ""connected"" to ""hanging up"" to ""idle""
       
   834  * @test GT83-TVOICE-014.05 "Test opening a new call by specifying the name of a line, and displaying the name of the new call"
       
   835  * @test GT83-TVOICE-031.02 "Test for a notification of a change in status of the mobile voice line from ""idle"" to ""dialling"""
       
   836  * @test GT83-TVOICE-031.04 "Test for a notification of a change in status of the mobile voice line from ""connecting"" to ""connected"""
       
   837  * @test GT83-TVOICE-031.07 "Test for a notification of a change in status of the mobile voice line from ""connected"" to ""disconnecting"""
       
   838  * @test GT83-TVOICE-031.08 "Test for a notification of a change in status of the mobile voice line from ""disconnecting"" to ""idle"""
       
   839 */
       
   840 	{
       
   841 	CConsoleBase* console = Console::NewL(KConsoleTitle,TSize(KConsFullScreen,KConsFullScreen));
       
   842     CleanupStack::PushL(console);
       
   843 	
       
   844 	_LIT(KStartText, "Test Line Notifications") ; TEST_START(&KStartText) ;
       
   845 	console->Printf(_L("Test Line Notifications\n"));
       
   846 	
       
   847 	//to make sure that line and call will be closed in leave case
       
   848 	CleanupClosePushL(iVoiceCall) ;
       
   849 	CleanupClosePushL(iLine) ;
       
   850 
       
   851 	TBuf<16> GoodNumber ;
       
   852 	GetGoodNumber(GoodNumber) ;
       
   853 
       
   854 	// NotifyIncomingCall and NotifyStatusChange
       
   855 	TName callName1;
       
   856 	RCall::TStatus lineStatus;
       
   857 	RMobileCall::TMobileCallStatus mobileLineStatus;
       
   858 	RCall::THookStatus hookStatus;
       
   859 
       
   860 
       
   861 	//GT83-AT-021	Test opening a Voice Line from a phone that supports data functionality
       
   862 	INFO_PRINTF1(_L("Opening Voice Line"));
       
   863 	console->Printf(_L("Opening Voice Line\n"));
       
   864 	TEST_CHECKL(iLine.Open(iPhone,KVoiceLineName), KErrNone, _L("*** Failed RMobileLine.Open() ***"));
       
   865 
       
   866 	INFO_PRINTF1(_L("Opening New Voice Call"));
       
   867 	console->Printf(_L("Opening New Voice Call\n"));
       
   868 	TEST_CHECKL(iVoiceCall.OpenNewCall(iLine, callName1), KErrNone, _L("GT83-TVOICE-014.05"));
       
   869 	INFO_PRINTF2(_L("Voice Call name is %S"), &callName1);
       
   870 
       
   871 	iLine.NotifyStatusChange(iStatus2, lineStatus);
       
   872 	iLine.NotifyMobileLineStatusChange(iStatus3, mobileLineStatus);
       
   873 	iLine.NotifyHookChange(iStatus4, hookStatus);
       
   874 
       
   875 	// Now test call status during an outgoing call
       
   876 	INFO_PRINTF2(_L("Dialling %S...."), &GoodNumber);
       
   877 	console->Printf(_L("Dialling %S....\n"), &GoodNumber);
       
   878 	iVoiceCall.Dial(iStatus, GoodNumber);
       
   879 
       
   880 	User::WaitForRequest(iStatus2);
       
   881 	CHECKPOINT(iStatus2.Int(), KErrNone, _L("GT83-TVOICE-010.03")) ;
       
   882 	CHECKPOINT(lineStatus, RCall::EStatusDialling, _L("GT83-TVOICE-010.03")) ;
       
   883 
       
   884 	User::WaitForRequest(iStatus3);
       
   885 	CHECKPOINT(iStatus3.Int(), KErrNone, _L("GT83-TVOICE-031.02")) ;
       
   886 	CHECKPOINT(mobileLineStatus, RMobileCall::EStatusDialling, _L("GT83-TVOICE-031.02")) ;
       
   887 
       
   888 	User::WaitForRequest(iStatus4);
       
   889 	CHECKPOINT(iStatus4.Int(), KErrNone, _L("GT83-TVOICE-009.03")) ;
       
   890 	CHECKPOINT(hookStatus, RCall::EHookStatusOff, _L("GT83-TVOICE-009.03")) ;
       
   891 
       
   892 	iLine.NotifyStatusChange(iStatus2, lineStatus);
       
   893 	iLine.NotifyMobileLineStatusChange(iStatus3, mobileLineStatus);
       
   894 	iLine.NotifyHookChange(iStatus4, hookStatus);
       
   895 
       
   896 	User::WaitForRequest(iStatus); //end of dial
       
   897 	
       
   898 	User::WaitForRequest(iStatus2);
       
   899 	CHECKPOINT(iStatus2.Int(), KErrNone, _L("GT83-TVOICE-010.03")) ;
       
   900 	CHECKPOINT(lineStatus, RCall::EStatusConnected, _L("GT83-TVOICE-010.03")) ;
       
   901 
       
   902 	User::WaitForRequest(iStatus3);
       
   903 	CHECKPOINT(iStatus3.Int(), KErrNone, _L("GT83-TVOICE-031.04")) ;
       
   904 	CHECKPOINT(mobileLineStatus, RMobileCall::EStatusConnected, _L("GT83-TVOICE-031.04")) ;
       
   905 
       
   906 	INFO_PRINTF1(_L("Call connected - hanging up..."));
       
   907 	console->Printf(_L("Call connected - hanging up...\n"));
       
   908 
       
   909 	iLine.NotifyStatusChange(iStatus2, lineStatus);
       
   910 	iLine.NotifyMobileLineStatusChange(iStatus3, mobileLineStatus);
       
   911 
       
   912 	User::After(10*KOneSecond);
       
   913 	iVoiceCall.HangUp(iStatus);
       
   914 	User::WaitForRequest(iStatus);
       
   915 	TEST_CHECKL(iStatus.Int(), KErrNone, _L("*** Failed RMobileCall::Hangup() ***")) ;
       
   916 
       
   917 	User::WaitForRequest(iStatus2);
       
   918 	CHECKPOINT(iStatus2.Int(), KErrNone, _L("GT83-TVOICE-010.03")) ;
       
   919 	CHECKPOINT(lineStatus, RCall::EStatusHangingUp, _L("GT83-TVOICE-010.03")) ;
       
   920 
       
   921 	User::WaitForRequest(iStatus3);
       
   922 	CHECKPOINT(iStatus3.Int(), KErrNone, _L("GT83-TVOICE-031.07")) ;
       
   923 	CHECKPOINT(mobileLineStatus, RMobileCall::EStatusDisconnecting, _L("GT83-TVOICE-031.07")) ;
       
   924 
       
   925 	/* @test GT83-AT-037	Test notification of a change in hook status of a data
       
   926 	 line from "on" to off"	aHookStatus = EHookStatusOn before the hook status changes,
       
   927 	 */
       
   928 	User::WaitForRequest(iStatus4);
       
   929 	CHECKPOINT(iStatus4.Int(), KErrNone, _L("GT83-TVOICE-009.02")) ;
       
   930 	CHECKPOINT(hookStatus, RCall::EHookStatusOn, _L("GT83-TVOICE-009.02")) ;
       
   931 
       
   932 	iLine.NotifyStatusChange(iStatus2, lineStatus);
       
   933 	iLine.NotifyMobileLineStatusChange(iStatus3, mobileLineStatus);
       
   934 
       
   935 	User::WaitForRequest(iStatus2);
       
   936 	CHECKPOINT(iStatus2.Int(), KErrNone, _L("GT83-TVOICE-010.03")) ;
       
   937 	CHECKPOINT(lineStatus, RCall::EStatusIdle, _L("GT83-TVOICE-010.03")) ;
       
   938 
       
   939 	User::WaitForRequest(iStatus3);
       
   940 	CHECKPOINT(iStatus3.Int(), KErrNone, _L("GT83-TVOICE-031.08")) ;
       
   941 	CHECKPOINT(mobileLineStatus, RMobileCall::EStatusIdle, _L("GT83-TVOICE-031.08")) ;
       
   942 
       
   943 	// Using TESTCHECKL
       
   944 	TESTCHECKL(iStatus.Int(), KErrNone);
       
   945 	TESTCHECKL(iStatus2.Int(), KErrNone);
       
   946 	TESTCHECKL(iStatus3.Int(), KErrNone);
       
   947 	TESTCHECKL(iStatus4.Int(), KErrNone);
       
   948 	TESTCHECKL(iStatus5.Int(), KErrNone);
       
   949 	TESTCHECKL(iStatus6.Int(), KErrNone);
       
   950 	TESTCHECKL(iStatus7.Int(), KErrNone);
       
   951 	
       
   952 	// Close the line and call
       
   953 	CleanupStack::PopAndDestroy(&iLine) ;
       
   954 	CleanupStack::PopAndDestroy(&iVoiceCall) ;
       
   955 
       
   956 	TEST_END() ;
       
   957 
       
   958 	console->Printf(_L("Finished\n"));
       
   959 	User::After(10*KOneSecond);
       
   960    	CleanupStack::PopAndDestroy(console);
       
   961 
       
   962 	return TestStepResult();
       
   963 	}
       
   964 //------------------------------------------------------------------
       
   965 
       
   966 CTestLineCancels::CTestLineCancels()
       
   967 /* Each test step initialises it's own name
       
   968 */
       
   969 	{
       
   970 	// store the name of this test case
       
   971 	// this is the name that is used by the script file
       
   972 
       
   973 	SetTestStepName(_L("TestLineCancels"));
       
   974 	}
       
   975 //------------------------------------------------------------------
       
   976 
       
   977 enum TVerdict CTestLineCancels::doTestStepL()
       
   978 //void CTestVoice::TestLineCancelsL()
       
   979 /**
       
   980  * @test GT83-TVOICE-001.01 "Test opening a voice line, specifying the phone that should be used"
       
   981  * @test GT83-TVOICE-008.01 Test setting notification of an incoming call on a voice line
       
   982  * @test GT83-TVOICE-008.03 Test the ability to cancel the notification of an incoming call on a voice line
       
   983  * @test GT83-TVOICE-009.01 Test setting notification of a change in hook status of a voice line
       
   984  * @test GT83-TVOICE-009.04 Test the ability to cancel a notification of a change in hook status of a voice line
       
   985  * @test GT83-TVOICE-010.04 Test the ability to cancel the notification of a change in the status of the voice line
       
   986  * @test GT83-TVOICE-011.01 Test setting notification of a call being added to a voice line
       
   987  * @test GT83-TVOICE-011.05 Test the ability to cancel a notification of a call being added to a voice line
       
   988 */
       
   989 	{
       
   990 	CConsoleBase* console = Console::NewL(KConsoleTitle,TSize(KConsFullScreen,KConsFullScreen));
       
   991     CleanupStack::PushL(console);
       
   992 
       
   993 	_LIT(KStartText, "Test Line Cancels") ; TEST_START(&KStartText) ;
       
   994 	console->Printf(_L("Test Line Cancels\n"));
       
   995 
       
   996 	//to make sure that line and call will be closed in leave case
       
   997 	CleanupClosePushL(iVoiceCall) ;
       
   998 	CleanupClosePushL(iLine) ;
       
   999 
       
  1000 	// Notify Incoming Call
       
  1001 	TName callName;
       
  1002 	//GT83-AT-021	Test opening a Voice Line from a phone that supports data functionality
       
  1003 	INFO_PRINTF1(_L("Opening Voice Line"));
       
  1004 	console->Printf(_L("Opening Voice Line\n"));
       
  1005 	TEST_CHECKL(iLine.Open(iPhone,KVoiceLineName), KErrNone, _L("*** Failed RMobileLine.Open() ***"));
       
  1006 
       
  1007 	iLine.NotifyIncomingCall(iStatus, callName);
       
  1008 	CHECKPOINT(iStatus.Int(), KRequestPending, _L("GT83-TVOICE-008.01")) ;
       
  1009 	User::After(KTenPartOfSec); //snack some sleep
       
  1010 	iLine.NotifyIncomingCallCancel();
       
  1011 	User::WaitForRequest(iStatus);
       
  1012 	CHECKPOINT(iStatus.Int(), KErrCancel, _L("GT83-TVOICE-008.03")) ;
       
  1013 
       
  1014 	// Notify Status Change
       
  1015 	RCall::TStatus lineStatus;
       
  1016 	iLine.NotifyStatusChange(iStatus, lineStatus);
       
  1017 	CHECKPOINT(iStatus.Int(), KRequestPending, _L("GT83-TVOICE-010.02")) ;
       
  1018 	User::After(KTenPartOfSec); //snack some sleep
       
  1019 	iLine.NotifyStatusChangeCancel();
       
  1020 	User::WaitForRequest(iStatus);
       
  1021 	CHECKPOINT(iStatus.Int(), KErrCancel, _L("GT83-TVOICE-010.04")) ;
       
  1022 
       
  1023 #if 0  //cancel functions don't work yet (?)
       
  1024 	   //any way they are not declared 27.09.2001
       
  1025 	// Notify Mobile Status Change
       
  1026 	RMobileCall::TMobileCallStatus lineStatus2;
       
  1027 	iLine.NotifyMobileLineStatusChange(iStatus, lineStatus2);
       
  1028 	CHECKPOINT(iStatus.Int(), KRequestPending, _L("GT83-TVOICE-0")) ;
       
  1029 	iLine.NotifyMobileLineStatusChangeCancel();
       
  1030 	User::WaitForRequest(iStatus);
       
  1031 	CHECKPOINT(iStatus.Int(), KErrCancel, _L("GT83-TVOICE-0")) ;
       
  1032 #endif
       
  1033 	// Notify Hook Change
       
  1034 	RCall::THookStatus hookStatus;
       
  1035 	iLine.NotifyHookChange(iStatus, hookStatus);
       
  1036 	CHECKPOINT(iStatus.Int(), KRequestPending, _L("GT83-TVOICE-009.01")) ;
       
  1037 	User::After(KTenPartOfSec); //snack some sleep
       
  1038 	iLine.NotifyHookChangeCancel();
       
  1039 	User::WaitForRequest(iStatus);
       
  1040 	CHECKPOINT(iStatus.Int(), KErrCancel, _L("GT83-TVOICE-009.04")) ;
       
  1041 
       
  1042 	// Notify Call Added
       
  1043 	iLine.NotifyCallAdded(iStatus, callName);
       
  1044 	CHECKPOINT(iStatus.Int(), KRequestPending, _L("GT83-TVOICE-011.01")) ;
       
  1045 	User::After(KTenPartOfSec); //snack some sleep
       
  1046 	iLine.NotifyCallAddedCancel();
       
  1047 	User::WaitForRequest(iStatus);
       
  1048 	CHECKPOINT(iStatus.Int(), KErrCancel, _L("GT83-TVOICE-011.05")) ;
       
  1049 
       
  1050 	// Close the line and call
       
  1051 	CleanupStack::PopAndDestroy(&iLine) ;
       
  1052 	CleanupStack::PopAndDestroy(&iVoiceCall) ;
       
  1053 
       
  1054 	TEST_END() ;
       
  1055 
       
  1056 	console->Printf(_L("Finished\n"));
       
  1057 	User::After(10*KOneSecond);
       
  1058    	CleanupStack::PopAndDestroy(console);
       
  1059 
       
  1060 	return TestStepResult();
       
  1061 	}
       
  1062 //------------------------------------------------------------------
       
  1063 
       
  1064 CTestCallInfo::CTestCallInfo()
       
  1065 /* Each test step initialises it's own name
       
  1066 */
       
  1067 	{
       
  1068 	// store the name of this test case
       
  1069 	// this is the name that is used by the script file
       
  1070 	SetTestStepName(_L("TestCallInfo"));
       
  1071 	}
       
  1072 //------------------------------------------------------------------
       
  1073 
       
  1074 enum TVerdict CTestCallInfo::doTestStepL()
       
  1075 //void CTestVoice::TestCallInfoL()
       
  1076 /**
       
  1077  * This function gets information pertaining to a call:
       
  1078  * Bearer Service Information, Call duration
       
  1079  * @test GT83-TVOICE-001.01 "Test opening a voice line, specifying the phone that should be used"
       
  1080  * @test GT83-TVOICE-009.02 "Test notification of a change in hook status of a voice line from ""off"" to ""on"""
       
  1081  * @test GT83-TVOICE-014.05 "Test opening a new call by specifying the name of a line, and displaying the name of the new call"
       
  1082  * @test GT83-TVOICE-019.01 "Test retrieval of the bearer service info of a call. Display to screen, all the bearer service information associated with the call."
       
  1083  * @test GT83-TVOICE-023.01 Test retrieval of the duration of a voice call. Display the call duration to screen
       
  1084  * @test GT83-TVOICE-024.01 Test the ability to get the current call information of the voice call. Display the call information to screen.
       
  1085  * @test GT83-TVOICE-026.00 Test answering a call on a voice line (Generic)
       
  1086  * @test GT83-TVOICE-036.01 Test retreival of the call information and print the call information to screen.
       
  1087 */
       
  1088 	{
       
  1089 	CConsoleBase* console = Console::NewL(KConsoleTitle,TSize(KConsFullScreen,KConsFullScreen));
       
  1090     CleanupStack::PushL(console);
       
  1091 	
       
  1092 	_LIT(KStartText, "Test Call Information") ; TEST_START(&KStartText) ;
       
  1093 	console->Printf(_L("Test Call Information"));
       
  1094 	
       
  1095 	//to make sure that line and call will be closed in leave case
       
  1096 	CleanupClosePushL(iVoiceCall) ;
       
  1097 	CleanupClosePushL(iLine) ;
       
  1098 
       
  1099 	RMobileCall::TMobileCallInfoV1 mobileCallInfo;
       
  1100 	RMobileCall::TMobileCallInfoV1Pckg mobileCallInfoPckg(mobileCallInfo) ;
       
  1101 
       
  1102 	INFO_PRINTF1(_L("Opening Voice Line"));
       
  1103 	console->Printf(_L("Opening Voice Line\n"));
       
  1104 	TEST_CHECKL(iLine.Open(iPhone,KVoiceLineName), KErrNone, _L("*** Failed RMobileLine.Open() ***"));
       
  1105 
       
  1106 	TName CallName ;
       
  1107 	INFO_PRINTF1(_L("Opening New Voice Call"));
       
  1108 	console->Printf(_L("Opening New Voice Call\n"));
       
  1109 	TEST_CHECKL(iVoiceCall.OpenNewCall(iLine, CallName), KErrNone, _L("GT83-TVOICE-014.05 - *** Failed RMobileCall::OpenNewCall() ***"));
       
  1110 	INFO_PRINTF2(_L("Voice Call name is %S"), &CallName);
       
  1111 
       
  1112 	//get status
       
  1113 	RCall::TStatus callStatus;
       
  1114 
       
  1115 	TInt ret = iVoiceCall.GetStatus(callStatus);
       
  1116 	CHECKPOINT(ret, KErrNone, _L("GT83-TD-016.02 - *** Failed RMobileCall::iVoiceCall.GetStatus() ***")) ;
       
  1117 	CHECKPOINT(callStatus, RCall::EStatusIdle, _L("GT83-TD-016.02")) ;
       
  1118 
       
  1119 	INFO_PRINTF2(_L("Call Status = %d"), callStatus);
       
  1120 	Print_RCall_TStatus(callStatus) ;
       
  1121 	// Wait for an incoming call, then get the Call BearerServiceInfo. The
       
  1122 	// Bearer Service Info is only available if the call is currently active
       
  1123 	INFO_PRINTF1(_L("Please ring the phone "));
       
  1124 	console->Printf(KPleaseRingThePhone);
       
  1125 
       
  1126 	// Answer an incoming call initiated by t_echo.exe and obtain the call's current status
       
  1127 	//GT83-AT-032	Test answering a call on a Voice Line (Generic)	RCall::AnswerIncomingCall
       
  1128 	iVoiceCall.AnswerIncomingCall(iStatus);
       
  1129 	WaitWithTimeout(iStatus,60*KOneSecond);		// but timeout after 60 seconds
       
  1130 	TEST_CHECKL(iStatus.Int(), KErrNone, _L("*** Failed RMobileCall::AnswerIncomingCall() ***")) ;
       
  1131 
       
  1132 	// User Information
       
  1133 	INFO_PRINTF1(_L("The call is now connected."));
       
  1134 	console->Printf(_L("The call is now connected.\n"));
       
  1135 	INFO_PRINTF1(_L("Retrieving Call Information."));
       
  1136 	console->Printf(_L("Retrieving Call Information.\n"));
       
  1137 
       
  1138 	// Bearer Service Information
       
  1139 	INFO_PRINTF1(_L("Get Bearer Service Info..."));
       
  1140 	console->Printf(_L("Get Bearer Service Info...\n"));
       
  1141 	RCall::TBearerService bearerServiceInfo;
       
  1142 	ret=iVoiceCall.GetBearerServiceInfo(bearerServiceInfo);
       
  1143 	CHECKPOINT_EXPR((ret == KErrNone || ret == KErrNotSupported), _L("GT83-TVOICE-019.01")) ;
       
  1144 	if (ret==KErrNotSupported)
       
  1145         {
       
  1146 		INFO_PRINTF1(_L("Get BearerService Information is NOT Supported"));
       
  1147         }
       
  1148 	if (ret==KErrNone)
       
  1149         {
       
  1150 		INFO_PRINTF1(_L("Get BearerService Information is successful"));
       
  1151         }
       
  1152 
       
  1153 	// Get Call Information
       
  1154 	INFO_PRINTF1(_L("Get Current Call Info..."));
       
  1155 	console->Printf(_L("Get Current Call Info...\n"));
       
  1156 	ret=iVoiceCall.GetInfo(iCallInfo);
       
  1157 	CHECKPOINT_EXPR((ret==KErrNone || ret==KErrNotSupported), _L("*** Failed RMobileCall::GetInfo() ***"));
       
  1158 	if (ret==KErrNotSupported)
       
  1159 		{
       
  1160 		INFO_PRINTF1(_L("Get Current Call info is NOT Supported"));
       
  1161 		}
       
  1162 	if (ret==KErrNone)
       
  1163 		{
       
  1164 		INFO_PRINTF1(_L("Displaying Information about the Current Call"));
       
  1165 		INFO_PRINTF2(TRefByValue<const TDesC>(_L("Call name: %S")), &iCallInfo.iCallName);
       
  1166 		INFO_PRINTF2(TRefByValue<const TDesC>(_L("Line name: %S")), &iCallInfo.iLineName);
       
  1167 		if (iCallInfo.iHookStatus==RCall::EHookStatusOff)
       
  1168 			{
       
  1169 			INFO_PRINTF1(_L("Current Hook Status: Off"));
       
  1170 			}
       
  1171 		if (iCallInfo.iStatus==RCall::EStatusConnected)
       
  1172 			{
       
  1173 			INFO_PRINTF1(_L("Current Call Status: Connected"));
       
  1174 			}
       
  1175 		INFO_PRINTF2(TRefByValue<const TDesC>(_L("Call Duration: %d seconds")), iCallInfo.iDuration.Int());
       
  1176 		}
       
  1177 
       
  1178 
       
  1179 
       
  1180 	INFO_PRINTF1(_L("Get Current Mobile Call Info..."));
       
  1181 	console->Printf(_L("Get Current Mobile Call Info...\n"));
       
  1182 	ret=iVoiceCall.GetMobileCallInfo(mobileCallInfoPckg);
       
  1183 	//doesn't work for MM.TSY
       
  1184 	//TEST_CHECKL(ret, KErrNone, _L("GT83-TVOICE-036.01")) ;
       
  1185 	CHECKPOINT_EXPR((ret==KErrNone || ret==KErrNotSupported), _L("*** Failed RMobileCall::GetMobileCallInfo() ***"));
       
  1186 	if (ret==KErrNotSupported)
       
  1187 		{
       
  1188 		INFO_PRINTF1(_L("Get Current Call info is NOT Supported"));
       
  1189 		}
       
  1190 
       
  1191 	if (ret==KErrNone)
       
  1192 		{
       
  1193 		INFO_PRINTF1(_L("Displaying Information about the Current Call"));
       
  1194 		INFO_PRINTF2(TRefByValue<const TDesC>(_L("Call name: %S")), &iCallInfo.iCallName);
       
  1195 		INFO_PRINTF2(TRefByValue<const TDesC>(_L("Line name: %S")), &iCallInfo.iLineName);
       
  1196 		if (iCallInfo.iHookStatus==RCall::EHookStatusOff)
       
  1197 			{
       
  1198 			INFO_PRINTF1(_L("Current Hook Status: Off"));
       
  1199 			}
       
  1200 		if (iCallInfo.iStatus==RCall::EStatusConnected)
       
  1201 			{
       
  1202 			INFO_PRINTF1(_L("Current Call Status: Connected"));
       
  1203 			}
       
  1204 		INFO_PRINTF2(TRefByValue<const TDesC>(_L("Call Duration: %d seconds")), iCallInfo.iDuration.Int());
       
  1205 		}
       
  1206 
       
  1207 	// Hang up the Call
       
  1208 	INFO_PRINTF1(_L("Please stay connected... the test will hang up shortly"));
       
  1209 	console->Printf(_L("Please stay connected... the test will hang up shortly\n"));
       
  1210 	User::After(5*KOneSecond);
       
  1211 
       
  1212 	// Call Duration
       
  1213 	INFO_PRINTF1(_L("Get Call Duration..."));
       
  1214 	console->Printf(_L("Get Call Duration...\n"));
       
  1215 	TTimeIntervalSeconds callDuration2;
       
  1216 	ret=iVoiceCall.GetCallDuration(callDuration2);
       
  1217 	CHECKPOINT_EXPR((ret==KErrNone || ret==KErrNotSupported), _L("*** RMobileCall::GetCallDuration() ***"));
       
  1218 	if (ret==KErrNotSupported)
       
  1219 		{
       
  1220 		INFO_PRINTF1(_L("Get Current Call Duration is NOT Supported"));
       
  1221 		}
       
  1222 	if (ret==KErrNone)
       
  1223 		{
       
  1224 		INFO_PRINTF2(TRefByValue<const TDesC>(_L("Call duration = %d")), callDuration2.Int());
       
  1225 		}
       
  1226  
       
  1227 	iVoiceCall.HangUp(iStatus);
       
  1228 	User::WaitForRequest(iStatus);
       
  1229 	TEST_CHECKL(iStatus.Int(), KErrNone, _L("GT83-TVOICE-009.02 - *** Failed RMobileCall::Hangup() ***")) ;
       
  1230 
       
  1231 	// Close the line and call
       
  1232 	CleanupStack::PopAndDestroy(&iLine) ;
       
  1233 	CleanupStack::PopAndDestroy(&iVoiceCall) ;
       
  1234 
       
  1235 	TEST_END() ;
       
  1236 
       
  1237 	console->Printf(_L("Finished\n"));
       
  1238 	User::After(10*KOneSecond);
       
  1239    	CleanupStack::PopAndDestroy(console);
       
  1240 
       
  1241 	return TestStepResult();
       
  1242 	}
       
  1243 //------------------------------------------------------------------
       
  1244 
       
  1245 CTestCallNotificationsIncomingCall::CTestCallNotificationsIncomingCall()
       
  1246 /* Each test step initialises it's own name
       
  1247 */
       
  1248 	{
       
  1249 	// store the name of this test case
       
  1250 	// this is the name that is used by the script file
       
  1251 
       
  1252 	SetTestStepName(_L("TestCallNotificationsIncomingCall"));
       
  1253 	}
       
  1254 //------------------------------------------------------------------
       
  1255 
       
  1256 enum TVerdict CTestCallNotificationsIncomingCall::doTestStepL()
       
  1257 //void CTestVoice::TestCallNotificationsIncomingCallL()
       
  1258 /**
       
  1259  * @test GT83-TVOICE-001.01 "Test opening a voice line, specifying the phone that should be used"
       
  1260  * @test GT83-TVOICE-002.00 Test retrieval of a voice line's capabilities (Generic)
       
  1261  * @test GT83-TVOICE-008.01 Test setting notification of an incoming call on a voice line
       
  1262  * @test GT83-TVOICE-015.05 Test opening an existing call from a voice line by specifying the name of the line and the name of an existing call
       
  1263  * @test GT83-TVOICE-016.04 "Test retrieval of the current call status when the call's status is ""ringing"""
       
  1264  * @test GT83-TVOICE-016.05 "Test retrieval of the current call status when the call's status is ""answering"""
       
  1265  * @test GT83-TVOICE-018.01 Test setting notification of a change in the call's capabilities
       
  1266  * @test GT83-TVOICE-018.02 Test notification of a change in the call's capabilities as the call's state changes (eg. From idle to connected). Print the call's capabilities to screen
       
  1267  * @test GT83-TVOICE-020.01 Test setting notification of a change in hook status of a voice call
       
  1268  * @test GT83-TVOICE-020.02 "Test notification of a change in hook status of a voice call from ""off"" to ""on"""
       
  1269  * @test GT83-TVOICE-020.03 "Test notification of a change in hook status of a voice call from ""on"" to off"""
       
  1270  * @test GT83-TVOICE-021.01 Test setting notification of a change in the status of the voice call
       
  1271  * @test GT83-TVOICE-021.02 "Test notification of a change in the status of the voice call from ""idle"" to ""ringing"" to ""answering"" to ""connected"" to ""hanging up"" to ""idle""
       
  1272  * @test GT83-TVOICE-022.01 Test setting notification of a change in the voice call's duration
       
  1273  * @test GT83-TVOICE-026.00 Test answering a call on a voice line (Generic)
       
  1274  * @test GT83-TVOICE-033.01 Test setting notification of a change in the call's dynamic call control and call event capabilities
       
  1275  * @test GT83-TVOICE-033.02 Test notification of a change in the call's dynamic call control and call event capabilities. Print the call's capabilities to screen
       
  1276  * @test GT83-TVOICE-034.04 "Test retrieval of the current status of the voice call when the call's status is ""ringing"""
       
  1277  * @test GT83-TVOICE-035.01 Test setting a request for a notification of a change in the status of the mobile voice call
       
  1278  * @test GT83-TVOICE-035.07 "Test for a notification of a change in status of the mobile voice call from ""connected"" to ""disconnecting"""
       
  1279  * @test GT83-TVOICE-035.08 "Test for a notification of a change in status of the mobile voice call from ""disconnecting"" to ""idle"""
       
  1280  * @test GT83-TVOICE-035.10 "Test for a notification of a change in status of the mobile voice call from ""ringing"" to ""answering"""
       
  1281  * @test GT83-TVOICE-035.11 "Test for a notification of a change in status of the mobile voice call from ""answering"" to ""connected"""
       
  1282 */
       
  1283 	{
       
  1284 	CConsoleBase* console = Console::NewL(KConsoleTitle,TSize(KConsFullScreen,KConsFullScreen));
       
  1285     CleanupStack::PushL(console);
       
  1286 	
       
  1287 	// Post call status change notifications
       
  1288 	TName callName1;
       
  1289 	//to make sure that line and call will be closed in leave case
       
  1290 	CleanupClosePushL(iVoiceCall) ;
       
  1291 	CleanupClosePushL(iLine) ;
       
  1292 
       
  1293 	RCall::TStatus callStatus;
       
  1294 	RMobileCall::TMobileCallStatus mobileCallStatus;
       
  1295 
       
  1296 	RCall::TCaps caps;
       
  1297 	RCall::THookStatus hookStatus;
       
  1298 	TTimeIntervalSeconds time;
       
  1299 
       
  1300 	RMobileCall::TMobileCallCapsV1 mobileCallCaps;
       
  1301 	RMobileCall::TMobileCallCapsV1Pckg mobileCallCapsPckg(mobileCallCaps);
       
  1302 
       
  1303 	_LIT(KStartText, "Test Call Notifications") ; TEST_START(&KStartText) ;
       
  1304 	console->Printf(_L("Test Call Notifications\n"));
       
  1305 	
       
  1306 	// Open a Voice Line and Call
       
  1307 	//GT83-AT-021	Test opening a Voice Line from a phone that supports data functionality
       
  1308 	INFO_PRINTF1(_L("Opening Voice Line"));
       
  1309 	console->Printf(_L("Opening Voice Line\n"));
       
  1310 	TEST_CHECKL(iLine.Open(iPhone,KVoiceLineName), KErrNone, _L("*** Failed RMobileLine::Open() ***"));
       
  1311 
       
  1312 	INFO_PRINTF1(_L("Please ring the phone "));
       
  1313 	console->Printf(KPleaseRingThePhone);
       
  1314 
       
  1315 	iLine.NotifyIncomingCall(iStatus, callName1);	// wait for a call
       
  1316 	CHECKPOINT(iStatus.Int(), KRequestPending, _L("GT83-TVOICE-008.01")) ;
       
  1317 
       
  1318 	WaitWithTimeout(iStatus,60*KOneSecond);				// but timeout after 60 seconds
       
  1319 	CHECKPOINT(iStatus.Int(), KErrNone, _L("GT83-TVOICE-008.01")) ;
       
  1320 
       
  1321 	TInt ret = iVoiceCall.OpenExistingCall(iLine, callName1);
       
  1322 	TEST_CHECKL(ret, KErrNone, _L("GT83-TVOICE-015.05 - *** Failed RMobileCall::OpenExistingCall()")) ;
       
  1323 
       
  1324 	iVoiceCall.GetStatus(callStatus);
       
  1325 	CHECKPOINT(callStatus, RCall::EStatusRinging, _L("GT83-TVOICE-016.04")) ;
       
  1326 
       
  1327 	iVoiceCall.GetMobileCallStatus(mobileCallStatus);
       
  1328 	CHECKPOINT(mobileCallStatus, RMobileCall::EStatusRinging, _L("GT83-TVOICE-034.04")) ;
       
  1329 
       
  1330 	ret=iVoiceCall.GetCaps(caps);
       
  1331 	TEST_CHECKL(ret, KErrNone, _L("GT83-TVOICE-002.00")) ;
       
  1332 	Print_TCapsEnum(caps) ;
       
  1333 	TEST(caps.iFlags & RCall::KCapsVoice ) ;
       
  1334 	TEST(caps.iFlags & RCall::KCapsAnswer);
       
  1335 
       
  1336 //	INFO_PRINTF1(_L("Opening New Voice Call"));
       
  1337 //	TEST_CHECKL(iiVoiceCall.OpenExistingCall(iLine, callName2), KErrNone, _L("GT83-TVOICE-013.06")) ;
       
  1338 
       
  1339 	iVoiceCall.NotifyStatusChange(iStatus2, callStatus);
       
  1340 	iVoiceCall.NotifyMobileCallStatusChange(iStatus3, mobileCallStatus);
       
  1341 	iVoiceCall.NotifyCapsChange(iStatus4, caps);
       
  1342 	iVoiceCall.NotifyHookChange(iStatus5, hookStatus);
       
  1343 	iVoiceCall.NotifyCallDurationChange(iStatus6, time) ;
       
  1344 	iVoiceCall.NotifyMobileCallCapsChange(iStatus7, mobileCallCapsPckg);
       
  1345 
       
  1346 	INFO_PRINTF1(_L("Phone is ringing... Now answering..."));
       
  1347 	console->Printf(_L("Phone is ringing... Now answering...\n"));
       
  1348 	//GT83-AT-032	Test answering a call on a Voice Line (Generic)	RCall::AnswerIncomingCall
       
  1349 	iVoiceCall.AnswerIncomingCall(iStatus);
       
  1350 
       
  1351 	//doesn't work for MM.TSY iVoiceCall.GetStatus(callStatus);
       
  1352 	//TEST_CHECKL(callStatus, RCall::EStatusAnswering, _L("GT83-TVOICE-016.05")) ;
       
  1353 
       
  1354 	WaitWithTimeout(iStatus,60*KOneSecond);		// but timeout after 2 seconds
       
  1355 	TEST_CHECKL(iStatus.Int(), KErrNone, _L("GT83-TVOICE-026.00 - *** Failed RMobileCall::AnswerIncomingCall() ***")) ;
       
  1356 
       
  1357 
       
  1358 	User::WaitForRequest(iStatus2);
       
  1359 	CHECKPOINT(iStatus2.Int(), KErrNone, _L("GT83-TVOICE-021.01")) ;
       
  1360 	CHECKPOINT(callStatus, RCall::EStatusAnswering, _L("GT83-TVOICE-021.02")) ;
       
  1361 
       
  1362 	User::WaitForRequest(iStatus3);
       
  1363 	CHECKPOINT(iStatus3.Int(), KErrNone, _L("GT83-TVOICE-035.01")) ;
       
  1364 	CHECKPOINT(mobileCallStatus, RMobileCall::EStatusAnswering, _L("GT83-TVOICE-035.10")) ;
       
  1365 
       
  1366 	iVoiceCall.NotifyMobileCallStatusChange(iStatus3, mobileCallStatus);
       
  1367 	User::WaitForRequest(iStatus3);
       
  1368 	CHECKPOINT(iStatus3.Int(), KErrNone, _L("GT83-TVOICE-035.01 - *** Failed RMobileCall::Notify")) ;
       
  1369 	CHECKPOINT(mobileCallStatus, RMobileCall::EStatusConnected, _L("GT83-TVOICE-035.11")) ;
       
  1370 
       
  1371 	User::WaitForRequest(iStatus4);
       
  1372 	CHECKPOINT(iStatus4.Int(), KErrNone, _L("GT83-TVOICE-018.01 - *** Failed RMobileCall::NotifyCapsChange() ***")) ;
       
  1373 	Print_TCapsEnum(caps) ;
       
  1374 	TEST_CHECKL(((caps.iFlags & RCall::KCapsVoice) != 0), ETrue , _L("GT83-TVOICE-018.02")) ;
       
  1375 
       
  1376 	iVoiceCall.NotifyCapsChange(iStatus4, caps);
       
  1377 	User::WaitForRequest(iStatus4);
       
  1378 	CHECKPOINT(iStatus4.Int(), KErrNone, _L("GT83-TVOICE-018.01 - *** Failed RMobileCall::NotifyCapsChange() ***")) ;
       
  1379 	TEST_CHECKL( (caps.iFlags & RCall::KCapsVoice)  !=0 , ETrue, _L("GT83-TVOICE-018.01")) ;
       
  1380 	TEST_CHECKL( (caps.iFlags & RCall::KCapsHangUp)  !=0 , ETrue, _L("GT83-TVOICE-018.01")) ;
       
  1381 
       
  1382 	User::WaitForRequest(iStatus5);
       
  1383 	CHECKPOINT(iStatus5.Int(), KErrNone, _L("GT83-TVOICE-020.01 - *** Failed RMobileCall::NotifyHookChange() ***")) ;
       
  1384 	TEST_CHECKL(hookStatus, RCall::EHookStatusOff, _L("GT83-TVOICE-020.03")) ;
       
  1385 
       
  1386 	User::WaitForRequest(iStatus6);
       
  1387 	CHECKPOINT_EXPR((iStatus6==KErrNone || iStatus6==KErrNotSupported), _L("*** Failed RMobileCall::NotifyCallDurationChange() ***"));
       
  1388 	if (iStatus6==KErrNotSupported)
       
  1389 		{
       
  1390 		INFO_PRINTF1(_L("Notify Call Duration Change is NOT Supported"));
       
  1391 		}
       
  1392 	if (iStatus6==KErrNone)
       
  1393 		{
       
  1394 		INFO_PRINTF2(TRefByValue<const TDesC>(_L("Call duration = %d")), time.Int());
       
  1395 		}
       
  1396 
       
  1397 	User::WaitForRequest(iStatus7);
       
  1398 	CHECKPOINT(iStatus7.Int(), KErrNone, _L("GT83-TVOICE-033.01 - *** Failed RMobileCall::NotifyMobileCallCapsChange() ***")) ;
       
  1399 	TEST_CHECKL(((mobileCallCaps.iCallControlCaps & RCall::KCapsVoice)!=0), ETrue, _L("GT83-TVOICE-033.02")) ;
       
  1400 
       
  1401 	iVoiceCall.NotifyMobileCallCapsChange(iStatus7, mobileCallCapsPckg);
       
  1402 	User::WaitForRequest(iStatus7);
       
  1403 	CHECKPOINT(iStatus7.Int(), KErrNone, _L("GT83-TVOICE-033.01 - *** Failed RMobileCall::NotifyMobileCallCapsChange() ***")) ;
       
  1404 	TEST_CHECKL( (mobileCallCaps.iCallControlCaps & RCall::KCapsHangUp)!=0, ETrue,  _L("GT83-TVOICE-033.02")) ;
       
  1405 	TEST_CHECKL( (mobileCallCaps.iCallControlCaps & RCall::KCapsVoice)!=0, ETrue,  _L("GT83-TVOICE-033.02")) ;
       
  1406 	// now hangup call
       
  1407 	iVoiceCall.NotifyStatusChange(iStatus2, callStatus);
       
  1408 	iVoiceCall.NotifyMobileCallStatusChange(iStatus3, mobileCallStatus);
       
  1409 
       
  1410 	INFO_PRINTF1(_L("Call connected - now hanging up..."));
       
  1411 	console->Printf(_L("Call connected - now hanging up...\n"));
       
  1412 	iVoiceCall.HangUp(iStatus);
       
  1413 	User::WaitForRequest(iStatus);
       
  1414 	TEST_CHECKL(iStatus.Int(), KErrNone, _L("*** Failed RMobileCall::Hangup() ***")) ;	//sometimes timed out -33
       
  1415 
       
  1416 	User::WaitForRequest(iStatus2);
       
  1417 	CHECKPOINT(iStatus2.Int(), KErrNone, _L("GT83-TVOICE-021.01 - *** Failed RMobileCall::NotifyStatusChange() ***")) ;
       
  1418 	TEST_CHECKL(callStatus, RCall::EStatusConnected, _L("GT83-TVOICE-021.02")) ;
       
  1419 
       
  1420 	User::WaitForRequest(iStatus3);
       
  1421 	CHECKPOINT(iStatus3.Int(), KErrNone, _L("GT83-TVOICE-035.07 - *** Failed RMobileCall::NotifyMobileCallStatusChange() ***")) ;
       
  1422 	TEST_CHECKL(mobileCallStatus, RMobileCall::EStatusDisconnecting, _L("GT83-TVOICE-035.07")) ;
       
  1423 
       
  1424 	iVoiceCall.NotifyStatusChange(iStatus2, callStatus);
       
  1425 	User::WaitForRequest(iStatus2);
       
  1426 	CHECKPOINT(iStatus2.Int(), KErrNone, _L("GT83-TVOICE-021.01 - *** Failed RMobileCall::NotifyStatusChange() ***")) ;
       
  1427 	TEST_CHECKL(callStatus, RCall::EStatusHangingUp, _L("GT83-TVOICE-021.02")) ;
       
  1428 
       
  1429 	iVoiceCall.NotifyMobileCallStatusChange(iStatus3, mobileCallStatus);
       
  1430 	User::WaitForRequest(iStatus3);
       
  1431 	CHECKPOINT(iStatus3.Int(), KErrNone, _L("GT83-TVOICE-035.07 - *** Failed RMobileCall::NotifyMobileCallStatusChange() ***")) ;
       
  1432 	TEST_CHECKL(mobileCallStatus, RMobileCall::EStatusIdle, _L("GT83-TVOICE-035.08")) ;
       
  1433 
       
  1434 	// Using TESTCHECKL
       
  1435 	TESTCHECKL(iStatus.Int(), KErrNone);
       
  1436 	TESTCHECKL(iStatus2.Int(), KErrNone);
       
  1437 	TESTCHECKL(iStatus3.Int(), KErrNone);
       
  1438 	TESTCHECKL(iStatus4.Int(), KErrNone);
       
  1439 	TESTCHECKL(iStatus5.Int(), KErrNone);
       
  1440 	TESTCHECKL(iStatus6.Int(), KErrNone);
       
  1441 	TESTCHECKL(iStatus7.Int(), KErrNone);
       
  1442 	
       
  1443 	// Close the line and call
       
  1444 	CleanupStack::PopAndDestroy(&iLine) ;
       
  1445 	CleanupStack::PopAndDestroy(&iVoiceCall) ;
       
  1446 
       
  1447 	TEST_END() ;
       
  1448 
       
  1449 	console->Printf(_L("Finished\n"));
       
  1450 	User::After(10*KOneSecond);
       
  1451    	CleanupStack::PopAndDestroy(console);
       
  1452 
       
  1453 	return TestStepResult();
       
  1454 	}
       
  1455 //------------------------------------------------------------------
       
  1456 
       
  1457 CTestCallNotificationsOutgoingCall::CTestCallNotificationsOutgoingCall()
       
  1458 /* Each test step initialises it's own name
       
  1459 */
       
  1460 	{
       
  1461 	// store the name of this test case
       
  1462 	// this is the name that is used by the script file
       
  1463 	SetTestStepName(_L("TestCallNotificationsOutgoingCall"));
       
  1464 	}
       
  1465 //------------------------------------------------------------------
       
  1466 
       
  1467 enum TVerdict CTestCallNotificationsOutgoingCall::doTestStepL()
       
  1468 //void CTestVoice::TestCallNotificationsOutgoingCallL()
       
  1469 /**
       
  1470 * Post call status change notifications
       
  1471  * @test GT83-TVOICE-001.01 "Test opening a voice line, specifying the phone that should be used"
       
  1472  * @test GT83-TVOICE-014.05 "Test opening a new call by specifying the name of a line, and displaying the name of the new call"
       
  1473  * @test GT83-TVOICE-016.03 "Test retrieval of the current call status when the call's status is ""dialling"""
       
  1474  * @test GT83-TVOICE-016.08 "Test retrieval of the current call status when the call's status is ""hanging up"""
       
  1475  * @test GT83-TVOICE-020.01 Test setting notification of a change in hook status of a voice call
       
  1476  * @test GT83-TVOICE-021.01 Test setting notification of a change in the status of the voice call
       
  1477  * @test GT83-TVOICE-021.03 "Test notification of a change in the status of the voice call from ""idle"" to ""dialling"" to ""connected"" to ""hanging up"" to ""idle"""
       
  1478  * @test GT83-TVOICE-034.03 "Test retrieval of the current status of the voice call when the call's status is ""dialling"""
       
  1479  * @test GT83-TVOICE-035.01 Test setting a request for a notification of a change in the status of the mobile voice call
       
  1480  * @test GT83-TVOICE-035.02 "Test for a notification of a change in status of the mobile voice call from ""idle"" to ""dialling"""
       
  1481 */
       
  1482 	{
       
  1483 	CConsoleBase* console = Console::NewL(KConsoleTitle,TSize(KConsFullScreen,KConsFullScreen));
       
  1484     CleanupStack::PushL(console);	
       
  1485 	
       
  1486 	//to make sure that line and call will be closed in leave case
       
  1487 	CleanupClosePushL(iVoiceCall) ;
       
  1488 	CleanupClosePushL(iLine) ;
       
  1489 
       
  1490     TName CallName ;
       
  1491 
       
  1492 	RCall::TStatus callStatus;
       
  1493 	RMobileCall::TMobileCallStatus mobileCallStatus;
       
  1494 
       
  1495 	//TTimeIntervalSeconds time;
       
  1496  	//RMobileCall::TMobileCallCapsV1 mobileCallCaps;
       
  1497 	//RMobileCall::TMobileCallCapsV1Pckg mobileCallCapsPckg(mobileCallCaps);
       
  1498 
       
  1499 	TBuf<16> GoodNumber ;
       
  1500 	GetGoodNumber(GoodNumber) ;
       
  1501 
       
  1502 	_LIT(KStartText, "Test Call Notifications") ; TEST_START(&KStartText) ;
       
  1503 	console->Printf(_L("Test Call Notifications\n"));
       
  1504 	
       
  1505 	// Open a Voice Line and Call
       
  1506 	//GT83-AT-021	Test opening a Voice Line from a phone that supports data functionality
       
  1507 	INFO_PRINTF1(_L("Opening Voice Line"));
       
  1508 	console->Printf(_L("Opening Voice Line\n"));
       
  1509 	TEST_CHECKL(iLine.Open(iPhone,KVoiceLineName), KErrNone, _L("*** Failed RMobileLine::Open() ***"));
       
  1510 
       
  1511 	INFO_PRINTF1(_L("Opening New Voice Call"));
       
  1512 	console->Printf(_L("Opening New Voice Call\n"));
       
  1513 	TEST_CHECKL(iVoiceCall.OpenNewCall(iLine, CallName), KErrNone, _L("GT83-TVOICE-014.05 - *** RMobileCall::OpenNewCall() ***"));
       
  1514 	INFO_PRINTF2(_L("Voice Call name is %S"), &CallName);
       
  1515 
       
  1516 	iVoiceCall.NotifyStatusChange(iStatus2, callStatus);
       
  1517 	iVoiceCall.NotifyMobileCallStatusChange(iStatus3, mobileCallStatus);
       
  1518 
       
  1519 	// Now test call status during an outgoing call
       
  1520 	INFO_PRINTF2(_L("Dialling %S...."), &GoodNumber);
       
  1521 	console->Printf(_L("Dialling %S....\n"), &GoodNumber);
       
  1522 	iVoiceCall.Dial(iStatus, GoodNumber);
       
  1523 
       
  1524 	User::WaitForRequest(iStatus2);
       
  1525 	CHECKPOINT(iStatus2.Int(), KErrNone, _L("GT83-TVOICE-021.01 - *** Failed RMobileCall::NotifyStatusChange() ***")) ;
       
  1526 	CHECKPOINT(callStatus, RCall::EStatusDialling, _L("GT83-TVOICE-021.03")) ;
       
  1527 	iVoiceCall.GetStatus(callStatus) ;
       
  1528 	CHECKPOINT(callStatus, RCall::EStatusDialling, _L("GT83-TVOICE-016.03 - *** Failed RMobileCall::GetStatus() ***")) ;
       
  1529 
       
  1530 	User::WaitForRequest(iStatus3);
       
  1531 	CHECKPOINT(iStatus3.Int(), KErrNone, _L("GT83-TVOICE-035.01 - *** Failed RMobileCall::NotifyMobileCallStatusChange() ***")) ;
       
  1532 	CHECKPOINT(mobileCallStatus, RMobileCall::EStatusDialling, _L("GT83-TVOICE-035.02")) ;
       
  1533 	iVoiceCall.GetMobileCallStatus(mobileCallStatus) ;
       
  1534 	CHECKPOINT(mobileCallStatus, RMobileCall::EStatusDialling, _L("GT83-TVOICE-034.03 - *** Failed RMobileCall::GetMobileCallStatus() ***")) ;
       
  1535 	WaitWithTimeout(iStatus,60*KOneSecond);		// but timeout after 60 seconds
       
  1536 
       
  1537 	// now hangup call
       
  1538 	iVoiceCall.NotifyStatusChange(iStatus2, callStatus);
       
  1539 	iVoiceCall.NotifyMobileCallStatusChange(iStatus3, mobileCallStatus);
       
  1540 
       
  1541 	INFO_PRINTF1(_L("Call connected - now hanging up..."));
       
  1542 	console->Printf(_L("Call connected - now hanging up...\n"));
       
  1543 	iVoiceCall.HangUp(iStatus);
       
  1544 
       
  1545 	//doesn't work for MM.TSY
       
  1546 	User::WaitForRequest(iStatus2);
       
  1547 	CHECKPOINT(iStatus2.Int(), KErrNone, _L("GT83-TVOICE-021.01 - *** Failed RMobileCall::NotifyStatusChange() ***")) ;
       
  1548 	//TEST_CHECKL(callStatus, RCall::EStatusHangingUp, _L("GT83-TVOICE-021.03")) ;
       
  1549 
       
  1550 	User::WaitForRequest(iStatus3);
       
  1551 	iVoiceCall.GetMobileCallStatus(mobileCallStatus) ;
       
  1552 	TEST_CHECKL(mobileCallStatus, RMobileCall::EStatusHangingUp, _L("GT83-TVOICE-016.08 - *** Failed RMobileCall::GetMobileCallStatus() ***")) ;
       
  1553 
       
  1554 
       
  1555 	User::WaitForRequest(iStatus);
       
  1556 	TEST_CHECKL(iStatus.Int(), KErrNone, _L("*** Failed RMobileCall::Hangup() ***")) ;	//sometimes timed out -33
       
  1557 
       
  1558 	// Close the line and call
       
  1559 	CleanupStack::PopAndDestroy(&iLine) ;
       
  1560 	CleanupStack::PopAndDestroy(&iVoiceCall) ;
       
  1561 
       
  1562 	TEST_END() ;
       
  1563 
       
  1564 	console->Printf(_L("Finished\n"));
       
  1565 	User::After(10*KOneSecond);
       
  1566    	CleanupStack::PopAndDestroy(console);	
       
  1567 
       
  1568 	return TestStepResult();
       
  1569 	}
       
  1570 //------------------------------------------------------------------
       
  1571 
       
  1572 CTestCallStatusIncomingCall::CTestCallStatusIncomingCall()
       
  1573 /* Each test step initialises it's own name
       
  1574 */
       
  1575 	{
       
  1576 	// store the name of this test case
       
  1577 	// this is the name that is used by the script file
       
  1578 	SetTestStepName(_L("TestCallStatusIncomingCall"));
       
  1579 	}
       
  1580 //------------------------------------------------------------------
       
  1581 
       
  1582 enum TVerdict CTestCallStatusIncomingCall::doTestStepL()
       
  1583 //void CTestVoice::TestCallStatusIncomingCallL()
       
  1584 /**
       
  1585  * This function tests call status at various times during calls
       
  1586  * @test GT83-TVOICE-001.01 "Test opening a voice line, specifying the phone that should be used"
       
  1587  * @test GT83-TVOICE-009.01 Test setting notification of a change in hook status of a voice line
       
  1588  * @test GT83-TVOICE-014.05 "Test opening a new call by specifying the name of a line, and displaying the name of the new call"
       
  1589  * @test GT83-TVOICE-016.00 Test retrieval of the current call status (Generic)
       
  1590  * @test GT83-TVOICE-016.02 "Test retrieval of the current call status when the call's status is ""idle"""
       
  1591  * @test GT83-TVOICE-016.04 "Test retrieval of the current call status when the call's status is ""ringing"""
       
  1592  * @test GT83-TVOICE-016.05 "Test retrieval of the current call status when the call's status is ""answering"""
       
  1593  * @test GT83-TVOICE-016.07 "Test retrieval of the current call status when the call's status is ""connected"""
       
  1594  * @test GT83-TVOICE-034.00 Test retrieval of the current status of the voice call (Generic)
       
  1595  * @test GT83-TVOICE-034.02 "Test retrieval of the current status of the voice call when the call's status is ""idle"""
       
  1596  * @test GT83-TVOICE-034.04 "Test retrieval of the current status of the voice call when the call's status is ""ringing"""
       
  1597  * @test GT83-TVOICE-034.05 "Test retrieval of the current status of the voice call when the call's status is ""answering"""
       
  1598  * @test GT83-TVOICE-034.07 "Test retrieval of the current status of the voice call when the call's status is ""connected"""
       
  1599 */
       
  1600 	{
       
  1601 	CConsoleBase* console = Console::NewL(KConsoleTitle,TSize(KConsFullScreen,KConsFullScreen));
       
  1602     CleanupStack::PushL(console);
       
  1603 	
       
  1604 	// Get the Call Status
       
  1605 	_LIT(KStartText, "Get Call Status...") ; TEST_START(&KStartText) ;
       
  1606 	console->Printf(_L("Get Call Status...\n"));
       
  1607 	
       
  1608 	//to make sure that line and call will be closed in leave case
       
  1609 	CleanupClosePushL(iVoiceCall) ;
       
  1610 	CleanupClosePushL(iLine) ;
       
  1611 	RMobileCall::TMobileCallStatus mobileCallStatus;
       
  1612 
       
  1613 	// Open a Voice Line and Call
       
  1614 	INFO_PRINTF1(_L("Opening Voice Line"));
       
  1615 	console->Printf(_L("Opening Voice Line\n"));
       
  1616 
       
  1617 	RCall::TStatus callStatus;
       
  1618 	TBuf<16> GoodNumber ;
       
  1619 	GetGoodNumber(GoodNumber) ;
       
  1620 	INFO_PRINTF1(_L("Opening Voice Line"));
       
  1621 	console->Printf(_L("Opening Voice Line\n"));
       
  1622 	TEST_CHECKL(iLine.Open(iPhone,KVoiceLineName), KErrNone, _L("*** Failed RMobileLine::Open() ***"));
       
  1623 
       
  1624     TName CallName ;
       
  1625 	INFO_PRINTF1(_L("Opening New Voice Call"));
       
  1626 	console->Printf(_L("Opening New Voice Call\n"));
       
  1627 	TEST_CHECKL(iVoiceCall.OpenNewCall(iLine, CallName), KErrNone, _L("GT83-TVOICE-014.05 - *** RMobileCall::OpenNewCall() ***"));
       
  1628 	INFO_PRINTF2(_L("Voice Call name is %S"), &CallName);
       
  1629 
       
  1630 
       
  1631 	TInt ret=iVoiceCall.GetStatus(callStatus);
       
  1632 	CHECKPOINT_EXPR((ret==KErrNone || ret==KErrNotSupported), _L("*** Failed RMobileCall::GetStatus() ***"));
       
  1633 	if (ret==KErrNotSupported)
       
  1634 		{
       
  1635 		INFO_PRINTF1(_L("Get Call Status is NOT Supported"));
       
  1636 		}
       
  1637 
       
  1638 	TInt ret2=iVoiceCall.GetMobileCallStatus(mobileCallStatus);
       
  1639 	CHECKPOINT_EXPR((ret2==KErrNone || ret2==KErrNotSupported), _L("*** Failed RMobileCall::GetMobileCallStatus() ***"));
       
  1640 	if (ret2==KErrNotSupported)
       
  1641 		{
       
  1642 		INFO_PRINTF1(_L("Get Mobile Call Status is NOT Supported"));
       
  1643 		}
       
  1644 
       
  1645 	if ((ret==KErrNone) && (ret2==KErrNone))
       
  1646 		{
       
  1647 		CHECKPOINT(callStatus, RCall::EStatusIdle, _L("GT83-TVOICE-016.02")) ;
       
  1648 		CHECKPOINT(mobileCallStatus, RMobileCall::EStatusIdle, _L("GT83-TVOICE-034.02")) ;
       
  1649 		INFO_PRINTF1(_L("The call is Idle"));
       
  1650 		}
       
  1651 
       
  1652 	// Now test call status during an incoming call
       
  1653 
       
  1654 	// Wait for an incoming call, then get the Call BearerServiceInfo. The
       
  1655 	// Bearer Service Info is only available if the call is currently active
       
  1656 	INFO_PRINTF1(_L("Please ring the phone "));
       
  1657 	console->Printf(KPleaseRingThePhone);
       
  1658 	
       
  1659 	/* GT83-AT-024	Test setting notification of an incoming call on a Voice Line */
       
  1660 
       
  1661 	//I had to comment these lines, because
       
  1662 	// NotifyIncommigCall + AnswerIncommigCall doesn't work
       
  1663 	//in such situation. Any way we can't get any good
       
  1664 	//status without notifycation
       
  1665 
       
  1666 	//iLine.NotifyIncomingCall(iStatus, callName);	// wait for a call
       
  1667 	//WaitWithTimeout(iStatus,60*KOneSecond);				// but timeout after 60 seconds
       
  1668 
       
  1669 	//ret=iVoiceCall.GetStatus(callStatus);
       
  1670 	//TEST_CHECKL(ret, KErrNone, _L("GT83-TVOICE-016.00")) ;
       
  1671 	//doesn't work for MM.TSY
       
  1672 	//TEST_CHECKL(callStatus, RCall::EStatusIdle, _L("GT83-TVOICE-016.01")) ;
       
  1673 
       
  1674 	//ret2=iVoiceCall.GetMobileCallStatus(mobileCallStatus);
       
  1675 	//TEST_CHECKL(ret2, KErrNone, _L("GT83-TVOICE-034.00")) ;
       
  1676 	//doesn't work for MM.TSY
       
  1677 	//TEST_CHECKL(mobileCallStatus, RMobileCall::EStatusIdle, _L("GT83-TVOICE-034.01")) ;
       
  1678 
       
  1679 	// Answer an incoming call initiated by t_echo.exe and obtain the call's current status
       
  1680 	iVoiceCall.AnswerIncomingCall(iStatus);
       
  1681 	ret=iVoiceCall.GetStatus(callStatus);
       
  1682 	CHECKPOINT(ret, KErrNone, _L("GT83-TVOICE-016.00 - *** Failed RMobileCall::GetStatus() ***")) ;
       
  1683 	//doesn't work for MM.TSY
       
  1684 	//TEST_CHECKL(callStatus, RCall::EStatusAnswering, _L("GT83-TVOICE-016.05")) ;
       
  1685 
       
  1686 	ret2=iVoiceCall.GetMobileCallStatus(mobileCallStatus);
       
  1687 	CHECKPOINT(ret2, KErrNone, _L("GT83-TVOICE-034.00 - *** Failed RMobileCall::GetMobileCallStatus() ***")) ;
       
  1688 	//doesn't work for MM.TSY
       
  1689 	//TEST_CHECKL(mobileCallStatus, RMobileCall::EStatusAnswering, _L("GT83-TVOICE-034.05")) ;
       
  1690 	WaitWithTimeout(iStatus,60*KOneSecond);				// but timeout after 60 seconds
       
  1691 
       
  1692 	ret=iVoiceCall.GetStatus(callStatus);
       
  1693 	CHECKPOINT(ret, KErrNone, _L("*** Failed RMobileCall::GetStatus() ***")) ;
       
  1694 	ret2=iVoiceCall.GetMobileCallStatus(mobileCallStatus);
       
  1695 	TEST_CHECKL(ret2, KErrNone, _L("*** Failed RMobileCall::GetMobileCallStatus() ***")) ;
       
  1696 
       
  1697 	if ((ret==KErrNone) && (ret2==KErrNone))
       
  1698 		{
       
  1699 
       
  1700 		Print_RCall_TStatus(callStatus) ;
       
  1701 		CHECKPOINT(callStatus, RCall::EStatusConnected, _L("GT83-TVOICE-016.07")) ;
       
  1702 		CHECKPOINT(mobileCallStatus, RMobileCall::EStatusConnected, _L("GT83-TVOICE-034.07")) ;
       
  1703 		INFO_PRINTF1(_L("The call is Connected"));
       
  1704 		}
       
  1705 	INFO_PRINTF1(_L("Hanging up..."));
       
  1706 	console->Printf(_L("Hanging up...\n"));
       
  1707 	User::After(10*KOneSecond);
       
  1708 	iVoiceCall.HangUp(iStatus);
       
  1709 	User::WaitForRequest(iStatus);
       
  1710 	TEST_CHECKL(iStatus.Int(), KErrNone, _L("GT83-TVOICE-009.01 - *** Failed RMobileCall::Hangup() ***")) ;
       
  1711 
       
  1712 	ret=iVoiceCall.GetStatus(callStatus);
       
  1713 	CHECKPOINT(ret, KErrNone, _L("*** Failed RMobileCall::GetStatus() ***")) ;
       
  1714 	ret2=iVoiceCall.GetMobileCallStatus(mobileCallStatus);
       
  1715 	CHECKPOINT(ret2, KErrNone, _L("*** Failed RMobileCall::GetMobileCallStatus() ***")) ;
       
  1716 
       
  1717 	if ((ret==KErrNone) && (ret2==KErrNone))
       
  1718 		{
       
  1719 		CHECKPOINT(callStatus, RCall::EStatusIdle, _L("GT83-TVOICE-016.02")) ;
       
  1720 		CHECKPOINT(mobileCallStatus, RMobileCall::EStatusIdle, _L("GT83-TVOICE-034.02")) ;
       
  1721 		INFO_PRINTF1(_L("The call is Idle again"));
       
  1722 		}
       
  1723 
       
  1724 	// Close the line and call
       
  1725 	CleanupStack::PopAndDestroy(&iLine) ;
       
  1726 	CleanupStack::PopAndDestroy(&iVoiceCall) ;
       
  1727 
       
  1728 	TEST_END() ;
       
  1729 
       
  1730 	console->Printf(_L("Finished\n"));
       
  1731 	User::After(10*KOneSecond);
       
  1732    	CleanupStack::PopAndDestroy(console);
       
  1733 
       
  1734 	return TestStepResult();
       
  1735 	}
       
  1736 //------------------------------------------------------------------
       
  1737 
       
  1738 CTestCallStatusOutgoingCall::CTestCallStatusOutgoingCall( )
       
  1739 /* Each test step initialises it's own name
       
  1740 */
       
  1741 	{
       
  1742 	// store the name of this test case
       
  1743 	// this is the name that is used by the script file
       
  1744 
       
  1745 	SetTestStepName(_L("TestCallStatusOutgoingCall"));
       
  1746 	}
       
  1747 //------------------------------------------------------------------
       
  1748 
       
  1749 enum TVerdict CTestCallStatusOutgoingCall::doTestStepL()
       
  1750 // void CTestVoice::TestCallStatusOutgoingCallL()
       
  1751 /**
       
  1752  * This function tests call status at various times during calls
       
  1753  * @test GT83-TVOICE-001.01 "Test opening a voice line, specifying the phone that should be used"
       
  1754  * @test GT83-TVOICE-009.01 Test setting notification of a change in hook status of a voice line
       
  1755  * @test GT83-TVOICE-014.05 "Test opening a new call by specifying the name of a line, and displaying the name of the new call"
       
  1756  * @test GT83-TVOICE-016.00 Test retrieval of the current call status (Generic)
       
  1757  * @test GT83-TVOICE-016.02 "Test retrieval of the current call status when the call's status is ""idle"""
       
  1758  * @test GT83-TVOICE-016.07 "Test retrieval of the current call status when the call's status is ""connected"""
       
  1759  * @test GT83-TVOICE-025.00 Test dialling a voice call (Generic)
       
  1760  * @test GT83-TVOICE-034.00 Test retrieval of the current status of the voice call (Generic)
       
  1761  * @test GT83-TVOICE-034.02 "Test retrieval of the current status of the voice call when the call's status is ""idle"""
       
  1762  * @test GT83-TVOICE-034.07 "Test retrieval of the current status of the voice call when the call's status is ""connected"""
       
  1763 */
       
  1764 	{
       
  1765 	CConsoleBase* console = Console::NewL(KConsoleTitle,TSize(KConsFullScreen,KConsFullScreen));
       
  1766     CleanupStack::PushL(console);
       
  1767 	
       
  1768 	// Get the Call Status
       
  1769 	_LIT(KStartText, "Get Call Status...") ; TEST_START(&KStartText) ;
       
  1770 	console->Printf(_L("Get Call Status...\n"));
       
  1771 	
       
  1772 	//to make sure that line and call will be closed in leave case
       
  1773 	CleanupClosePushL(iVoiceCall) ;
       
  1774 	CleanupClosePushL(iLine) ;
       
  1775 
       
  1776 	// Open a Voice Line and Call
       
  1777 	INFO_PRINTF1(_L("Opening Voice Line"));
       
  1778 	console->Printf(_L("Opening Voice Line\n"));
       
  1779 
       
  1780 	RCall::TStatus callStatus;
       
  1781 	RMobileCall::TMobileCallStatus mobileCallStatus;
       
  1782     TName CallName ;
       
  1783 
       
  1784 	TBuf<16> GoodNumber ;
       
  1785 	GetGoodNumber(GoodNumber) ;
       
  1786 	INFO_PRINTF1(_L("Opening Voice Line"));
       
  1787 	console->Printf(_L("Opening Voice Line\n"));
       
  1788 	TEST_CHECKL(iLine.Open(iPhone,KVoiceLineName), KErrNone, _L("*** Failed RMobileLine::Open() ***"));
       
  1789 
       
  1790 	INFO_PRINTF1(_L("Opening New Voice Call"));
       
  1791 	console->Printf(_L("Opening New Voice Call\n"));
       
  1792 	TEST_CHECKL(iVoiceCall.OpenNewCall(iLine, CallName), KErrNone, _L("*** RMobileCall::OpenNewCall() ***"));
       
  1793 	INFO_PRINTF2(_L("Voice Call name is %S"), &CallName);
       
  1794 
       
  1795 	TInt ret=iVoiceCall.GetStatus(callStatus);
       
  1796 	CHECKPOINT_EXPR((ret==KErrNone || ret==KErrNotSupported), _L("*** Failed RMobileCall::GetStatus() ***"));
       
  1797 	if (ret==KErrNotSupported)
       
  1798 		{
       
  1799 		INFO_PRINTF1(_L("Get Call Status is NOT Supported"));
       
  1800 		}
       
  1801 
       
  1802 	TInt ret2=iVoiceCall.GetMobileCallStatus(mobileCallStatus);
       
  1803 	CHECKPOINT_EXPR((ret2==KErrNone || ret2==KErrNotSupported), _L("*** Failed RMobileCall::GetMobileCallStatus() ***"));
       
  1804 	if (ret2==KErrNotSupported)
       
  1805 		{
       
  1806 		INFO_PRINTF1(_L("Get Mobile Call Status is NOT Supported"));
       
  1807 		}
       
  1808 
       
  1809 	if ((ret==KErrNone) && (ret2==KErrNone))
       
  1810 		{
       
  1811 		CHECKPOINT(callStatus, RCall::EStatusIdle, _L("GT83-TVOICE-016.02")) ;
       
  1812 		CHECKPOINT(mobileCallStatus, RMobileCall::EStatusIdle, _L("GT83-TVOICE-034.02")) ;
       
  1813 		INFO_PRINTF1(_L("The call is Idle"));
       
  1814 		}
       
  1815 
       
  1816 	// Now test call status during an outgoing call
       
  1817 
       
  1818 	INFO_PRINTF2(_L("Dialling %S...."), &GoodNumber);
       
  1819 	console->Printf(_L("Dialling %S....\n"), &GoodNumber);
       
  1820 	iVoiceCall.Dial(iStatus, GoodNumber);
       
  1821 	User::WaitForRequest(iStatus);
       
  1822 	TEST_CHECKL(iStatus.Int(), KErrNone, _L("*** Failed RMobileCall::Dial() ***")) ;
       
  1823 
       
  1824 	ret=iVoiceCall.GetStatus(callStatus);
       
  1825 	CHECKPOINT(ret, KErrNone, _L("*** Failed RMobileCall::GetStatus() ***")) ;
       
  1826 	ret2=iVoiceCall.GetMobileCallStatus(mobileCallStatus);
       
  1827 	CHECKPOINT(ret2, KErrNone, _L("*** Failed RMobileCall::GetMobileCallStatus() ***")) ;
       
  1828 
       
  1829 	if ((ret==KErrNone) && (ret2==KErrNone))
       
  1830 		{
       
  1831 
       
  1832 		Print_RCall_TStatus(callStatus) ;
       
  1833 		CHECKPOINT(callStatus, RCall::EStatusConnected, _L("GT83-TVOICE-016.07")) ;
       
  1834 		CHECKPOINT(mobileCallStatus, RMobileCall::EStatusConnected, _L("GT83-TVOICE-034.07")) ;
       
  1835 		INFO_PRINTF1(_L("The call is Connected"));
       
  1836 		}
       
  1837 
       
  1838 	INFO_PRINTF1(_L("Hanging up..."));
       
  1839 	console->Printf(_L("Hanging up...\n"));
       
  1840 
       
  1841 	User::After(10*KOneSecond);
       
  1842 	iVoiceCall.HangUp(iStatus);
       
  1843 	User::WaitForRequest(iStatus);
       
  1844 	TEST_CHECKL(iStatus.Int(), KErrNone, _L("*** Failed RMobileCall::Hangup() ***")) ;
       
  1845 
       
  1846 	ret=iVoiceCall.GetStatus(callStatus);
       
  1847 	CHECKPOINT(ret, KErrNone, _L("*** Failed RMobileCall::GetStatus() ***")) ;
       
  1848 	ret2=iVoiceCall.GetMobileCallStatus(mobileCallStatus);
       
  1849 	CHECKPOINT(ret2, KErrNone, _L("*** Failed RMobileCall::GetMobileCallStatus() ***")) ;
       
  1850 
       
  1851 	if ((ret==KErrNone) && (ret2==KErrNone))
       
  1852 		{
       
  1853 		CHECKPOINT(callStatus, RCall::EStatusIdle, _L("GT83-TVOICE-016.02")) ;
       
  1854 		CHECKPOINT(mobileCallStatus, RMobileCall::EStatusIdle, _L("GT83-TVOICE-034.02")) ;
       
  1855 		INFO_PRINTF1(_L("The call is Idle again"));
       
  1856 		}
       
  1857 
       
  1858 	// Close the line and call
       
  1859 	CleanupStack::PopAndDestroy(&iLine) ;
       
  1860 	CleanupStack::PopAndDestroy(&iVoiceCall) ;
       
  1861 
       
  1862 	TEST_END() ;
       
  1863 
       
  1864 	console->Printf(_L("Finished\n"));
       
  1865 	User::After(10*KOneSecond);
       
  1866    	CleanupStack::PopAndDestroy(console);
       
  1867 
       
  1868 	return TestStepResult();
       
  1869 	}
       
  1870 //------------------------------------------------------------------
       
  1871 
       
  1872 
       
  1873 CTestCallCancels::CTestCallCancels()
       
  1874 /* Each test step initialises it's own name
       
  1875 */
       
  1876 	{
       
  1877 	// store the name of this test case
       
  1878 	// this is the name that is used by the script file
       
  1879 
       
  1880 	SetTestStepName(_L("TestCallCancels"));
       
  1881 	}
       
  1882 //------------------------------------------------------------------
       
  1883 
       
  1884 enum TVerdict CTestCallCancels::doTestStepL()
       
  1885 //void CTestVoice::TestCallCancelsL()
       
  1886 /**
       
  1887  * This function posts and then cancels Call Notifications.
       
  1888  * @test GT83-TVOICE-001.01 "Test opening a voice line, specifying the phone that should be used"
       
  1889  * @test GT83-TVOICE-014.05 "Test opening a new call by specifying the name of a line, and displaying the name of the new call"
       
  1890  * @test GT83-TVOICE-018.01 Test setting notification of a change in the call's capabilities
       
  1891  * @test GT83-TVOICE-018.03 Test the ability to cancel a notification of a change in the call's capabilities
       
  1892  * @test GT83-TVOICE-020.01 Test setting notification of a change in hook status of a voice call
       
  1893  * @test GT83-TVOICE-020.04 Test the ability to cancel a notification of a change in hook status of a voice call
       
  1894  * @test GT83-TVOICE-021.01 Test setting notification of a change in the status of the voice call
       
  1895  * @test GT83-TVOICE-022.01 Test setting notification of a change in the voice call's duration
       
  1896  * @test GT83-TVOICE-022.03 Test cancelling notification of a change in the voice call's duration
       
  1897 */
       
  1898 	{
       
  1899 	CConsoleBase* console = Console::NewL(KConsoleTitle,TSize(KConsFullScreen,KConsFullScreen));
       
  1900     CleanupStack::PushL(console);
       
  1901 	
       
  1902 	_LIT(KStartText, "Test Call Cancels") ; TEST_START(&KStartText) ;
       
  1903 	console->Printf(_L("Test Call Cancels...\n"));
       
  1904 	
       
  1905 	//to make sure that line and call will be closed in leave case
       
  1906 	CleanupClosePushL(iVoiceCall) ;
       
  1907 	CleanupClosePushL(iLine) ;
       
  1908 
       
  1909 	// Open a Voice Line and Call
       
  1910 	//GT83-AT-021	Test opening a Voice Line from a phone that supports data functionality
       
  1911 	INFO_PRINTF1(_L("Opening Voice Line"));
       
  1912 	console->Printf(_L("Opening Voice Line\n"));
       
  1913 	TEST_CHECKL(iLine.Open(iPhone,KVoiceLineName), KErrNone, _L("*** Failed RMobileLine::Open() ***"));
       
  1914 
       
  1915     TName CallName ;
       
  1916     INFO_PRINTF1(_L("Opening New Voice Call"));
       
  1917     console->Printf(_L("Opening New Voice Call\n"));
       
  1918 	TEST_CHECKL(iVoiceCall.OpenNewCall(iLine, CallName), KErrNone, _L("*** Failed RMobileCall::OpenNewCall() ***"));
       
  1919 	INFO_PRINTF2(_L("Voice Call name is %S"), &CallName);
       
  1920 
       
  1921 	// Call Status Change Cancel Request
       
  1922 	RCall::TStatus callStatus;
       
  1923 	iVoiceCall.NotifyStatusChange(iStatus, callStatus);
       
  1924 	CHECKPOINT(iStatus.Int(), KRequestPending, _L("GT83-TVOICE-021.01")) ;
       
  1925 	User::After(KTenPartOfSec); //snack some sleep
       
  1926 	iVoiceCall.NotifyStatusChangeCancel();
       
  1927 	User::WaitForRequest(iStatus);
       
  1928 	CHECKPOINT(iStatus.Int(), KErrCancel, _L("GT83-TVOICE-021.04")) ;
       
  1929 
       
  1930 #if 0  //cancel functions don't work yet (?)
       
  1931 	   //any way they are not declared 27.09.2001
       
  1932 	RMobileCall::TMobileCallStatus mobileCallStatus;
       
  1933 	iVoiceCall.NotifyMobileCallStatusChange(iStatus, mobileCallStatus);
       
  1934 	CHECKPOINT(iStatus.Int(), KRequestPending, _L("GT83-TVOICE-0")) ;
       
  1935 	iVoiceCall.NotifyMobileCallStatusChangeCancel();
       
  1936 	User::WaitForRequest(iStatus);
       
  1937 	CHECKPOINT(iStatus.Int(), KErrCancel, _L("GT83-TVOICE-0")) ;
       
  1938 #endif
       
  1939 	// Hook Change Cancel Request
       
  1940 	RCall::THookStatus hookStatus;
       
  1941 	iVoiceCall.NotifyHookChange(iStatus, hookStatus);
       
  1942 	CHECKPOINT(iStatus.Int(), KRequestPending, _L("GT83-TVOICE-020.01")) ;
       
  1943 	User::After(KTenPartOfSec); //snack some sleep
       
  1944 	iVoiceCall.NotifyHookChangeCancel();
       
  1945 	User::WaitForRequest(iStatus);
       
  1946 	CHECKPOINT(iStatus.Int(), KErrCancel, _L("GT83-TVOICE-020.04")) ;
       
  1947 
       
  1948 	// Test Cancelling Notifications
       
  1949 	RCall::TCaps callCaps;
       
  1950 	iVoiceCall.NotifyCapsChange(iStatus, callCaps);
       
  1951 	CHECKPOINT(iStatus.Int(), KRequestPending, _L("GT83-TVOICE-018.01")) ;
       
  1952 	User::After(KTenPartOfSec); //snack some sleep
       
  1953 	iVoiceCall.NotifyCapsChangeCancel();
       
  1954 	User::WaitForRequest(iStatus);
       
  1955 	CHECKPOINT(iStatus.Int(), KErrCancel, _L("GT83-TVOICE-018.03")) ;
       
  1956 
       
  1957 #if 0  //cancel functions don't work yet (?)
       
  1958 	   //any way they are not declared 27.09.2001
       
  1959 	RMobileCall::TMobileCallCapsV1 mobileCallCaps;
       
  1960 	RMobileCall::TMobileCallCapsV1Pckg mobileCallCapsPckg(mobileCallCaps);
       
  1961 	iVoiceCall.NotifyMobileCallCapsChange(iStatus, mobileCallCapsPckg);
       
  1962 	CHECKPOINT(iStatus.Int(), KRequestPending, _L("GT83-TVOICE-0")) ;
       
  1963 	iVoiceCall.NotifyMobileCallCapsChangeCancel();
       
  1964 	User::WaitForRequest(iStatus);
       
  1965 	CHECKPOINT(iStatus.Int(), KErrCancel, _L("GT83-TVOICE-0")) ;
       
  1966 #endif
       
  1967 
       
  1968 	TTimeIntervalSeconds callDuration;
       
  1969 	iVoiceCall.NotifyCallDurationChange(iStatus, callDuration);
       
  1970 	CHECKPOINT(iStatus.Int(), KRequestPending, _L("GT83-TVOICE-022.01")) ;
       
  1971 	User::After(KTenPartOfSec); //snack some sleep
       
  1972 	iVoiceCall.NotifyCallDurationChangeCancel();
       
  1973 	User::WaitForRequest(iStatus);
       
  1974 	CHECKPOINT(iStatus.Int(), KErrCancel, _L("GT83-TVOICE-022.03")) ;
       
  1975 
       
  1976 	// Close the line and call
       
  1977 	CleanupStack::PopAndDestroy(&iLine) ;
       
  1978 	CleanupStack::PopAndDestroy(&iVoiceCall) ;
       
  1979 
       
  1980 	TEST_END() ;
       
  1981 
       
  1982 	console->Printf(_L("Finished\n"));
       
  1983 	User::After(10*KOneSecond);
       
  1984    	CleanupStack::PopAndDestroy(console);
       
  1985 
       
  1986 	return TestStepResult();
       
  1987 	}
       
  1988 //------------------------------------------------------------------
       
  1989 
       
  1990 CTestMoreCallInfo::CTestMoreCallInfo()
       
  1991 /* Each test step initialises it's own name
       
  1992 */
       
  1993 	{
       
  1994 	// store the name of this test case
       
  1995 	// this is the name that is used by the script file
       
  1996 
       
  1997 	SetTestStepName(_L("TestMoreCallInfo"));
       
  1998 	}
       
  1999 //------------------------------------------------------------------
       
  2000 
       
  2001 enum TVerdict CTestMoreCallInfo::doTestStepL()
       
  2002 //void CTestVoice::TestMoreCallInfoL()
       
  2003 /**
       
  2004  * This function gets more information pertaining to a Voice Call: Call ownership,
       
  2005  * Call parameters, Loan data port requests and Transfer ownership requests.
       
  2006  * @test GT83-TVOICE-001.01 "Test opening a voice line, specifying the phone that should be used"
       
  2007  * @test GT83-TVOICE-014.05 "Test opening a new call by specifying the name of a line, and displaying the name of the new call"
       
  2008  * @test GT83-TVOICE-026.00 Test answering a call on a voice line (Generic)
       
  2009  * @test GT83-TVOICE-028.01 Test the ability to make a request to acquire the ownership of a call
       
  2010  * @test GT83-TVOICE-029.01 Test transferring the call ownership when another client has requested to acquire call ownership
       
  2011 */
       
  2012 	{
       
  2013 	CConsoleBase* console = Console::NewL(KConsoleTitle,TSize(KConsFullScreen,KConsFullScreen));
       
  2014     CleanupStack::PushL(console);
       
  2015 	
       
  2016 	_LIT(KStartText, "More Call Information Tests") ; TEST_START(&KStartText) ;
       
  2017 	console->Printf(_L("More Call Information Tests\n"));
       
  2018 	
       
  2019 	//to make sure that line and call will be closed in leave case
       
  2020 	CleanupClosePushL(iVoiceCall) ;
       
  2021 	CleanupClosePushL(iLine) ;
       
  2022 
       
  2023 	TInt ret ;
       
  2024 
       
  2025 	INFO_PRINTF1(_L("Opening Voice Line"));
       
  2026 	console->Printf(_L("Opening Voice Line\n"));
       
  2027 	TEST_CHECKL(iLine.Open(iPhone,KVoiceLineName), KErrNone, _L("*** Failed RMobileLine::Open() ***"));
       
  2028 
       
  2029     TName CallName ;
       
  2030    // TName CallName2 ;
       
  2031 	INFO_PRINTF1(_L("Opening New Voice Call"));
       
  2032 	console->Printf(_L("Opening New Voice Call\n"));
       
  2033 	TEST_CHECKL(iVoiceCall.OpenNewCall(iLine, CallName), KErrNone, _L("*** Failed RMobileCall::OpenNewCall() ***"));
       
  2034 	INFO_PRINTF2(_L("Voice Call name is %S"), &CallName);
       
  2035 
       
  2036 	// Wait for an incoming Call
       
  2037 	INFO_PRINTF1(_L("Please ring the phone "));
       
  2038 	console->Printf(KPleaseRingThePhone);
       
  2039 
       
  2040 	iVoiceCall.AnswerIncomingCall(iStatus);		// wait for a call
       
  2041 	WaitWithTimeout(iStatus,60*KOneSecond);		// but timeout after 60 seconds
       
  2042 	TEST_CHECKL(iStatus.Int(), KErrNone, _L("*** Failed RMobileCall::AnswerIncomingCall() ***"));
       
  2043 
       
  2044 	// Retrieve Call Ownership information
       
  2045 	INFO_PRINTF1(_L("Get Call Ownership.."));
       
  2046 	RCall::TOwnershipStatus callOwner;
       
  2047 	ret=iVoiceCall.GetOwnershipStatus(callOwner);
       
  2048 	CHECKPOINT_EXPR((ret==KErrNone || ret==KErrNotSupported), _L("*** Failed RMobileCall::GetOwnershipStatus() ***"));
       
  2049 	if (ret==KErrNotSupported)
       
  2050 		{
       
  2051 		INFO_PRINTF1(_L("Get Call OwnerShip is NOT Supported"));
       
  2052 		}
       
  2053 
       
  2054 	if (ret==KErrNone)
       
  2055 		{
       
  2056 		INFO_PRINTF1(_L("Get Call OwnerShip is Supported"));
       
  2057 
       
  2058 		switch(callOwner)
       
  2059 			{
       
  2060 			case RCall::EOwnershipUnowned:
       
  2061 				INFO_PRINTF1(_L("The call is unowned"));
       
  2062 				break;
       
  2063 			case RCall::EOwnershipOwnedByAnotherClient:
       
  2064 				INFO_PRINTF1(_L("The call is owned by another Client"));
       
  2065 				break;
       
  2066 			case RCall::EOwnershipOwnedByThisClient:
       
  2067 				INFO_PRINTF1(_L("The call is owned by this client"));
       
  2068 				break;
       
  2069 			default:
       
  2070 				INFO_PRINTF1(_L("Error in Call Ownership details"));
       
  2071 				break;
       
  2072 			}
       
  2073 		}
       
  2074 
       
  2075 	// Call Parameters
       
  2076 	INFO_PRINTF1(_L("Get Call Parameters..."));
       
  2077 	console->Printf(_L("Get Call Parameters...\n"));
       
  2078 	RCall::TCallParams callParams;
       
  2079 	RCall::TCallParamsPckg callParamsPckg(callParams);
       
  2080 	ret=iVoiceCall.GetCallParams(callParamsPckg);
       
  2081 	CHECKPOINT_EXPR((ret==KErrNone || ret==KErrNotSupported), _L("*** Failed RMobileCall::GetCallParams() ***"));
       
  2082 	if (ret==KErrNotSupported)
       
  2083 		{
       
  2084 		INFO_PRINTF1(_L("Get Call Parameters is NOT Supported"));
       
  2085 		}
       
  2086 	if (ret==KErrNone)
       
  2087 		{
       
  2088 		INFO_PRINTF1(_L("Get Call Parameters is successful"));
       
  2089 		}
       
  2090 
       
  2091 	// Post a 'New call added' notification
       
  2092 	TName callName;
       
  2093 	iLine.NotifyCallAdded(iStatus, callName);
       
  2094 
       
  2095 	// Open a 2nd Voice Call, see BeginTest() function for explanatory comments
       
  2096 	INFO_PRINTF1(_L("Opening another Voice Call"));
       
  2097 	console->Printf(_L("Opening another Voice Call\n"));
       
  2098 	_LIT(KAutomaticName,"::");
       
  2099 	TName callName2(iLineInfo.iName);
       
  2100 	callName2.Append(KAutomaticName);
       
  2101 
       
  2102 	RMobileCall VoiceCall2;
       
  2103 	INFO_PRINTF1(_L("Opening 2nd Voice Call"));
       
  2104 	console->Printf(_L("Opening 2nd Voice Call\n"));
       
  2105 	ret = VoiceCall2.OpenNewCall(iLine, CallName);
       
  2106 	CHECKPOINT_EXPR((ret==KErrNone || ret==KErrNotSupported), _L("*** Failed RMobileCall::OpenNewCall() ***"));
       
  2107 	if(ret == KErrNone)
       
  2108 		{
       
  2109 		INFO_PRINTF1(_L("2nd Voice Call opened successfully"));
       
  2110 		INFO_PRINTF2(_L("Voice Call name is %S"), &CallName);
       
  2111 		}
       
  2112 
       
  2113 	if(ret == KErrNotSupported) //we don't have anything to do, bye...
       
  2114 		{
       
  2115 		INFO_PRINTF1(_L("2nd Voice Call not supported "));
       
  2116 		INFO_PRINTF1(_L("Hanging up"));
       
  2117 		iVoiceCall.HangUp(iStatus);
       
  2118 		User::WaitForRequest(iStatus);
       
  2119 		TEST_CHECKL(iStatus.Int(), KErrNone, _L("GT83-TVOICE-0"));
       
  2120 		INFO_PRINTF1(_L("HangUp successful"));
       
  2121 
       
  2122 		// Close the line and call
       
  2123 		CleanupStack::PopAndDestroy(&iLine) ;
       
  2124 		CleanupStack::PopAndDestroy(&iVoiceCall) ;
       
  2125 
       
  2126 		return EInconclusive;
       
  2127 		}
       
  2128 
       
  2129 
       
  2130 	User::WaitForRequest(iStatus);  // Notify Call added completion
       
  2131 	if (iStatus==KErrNone)
       
  2132 		{
       
  2133 		INFO_PRINTF2(TRefByValue<const TDesC>(_L("Notify Call added status = %d")), iStatus.Int());
       
  2134 		}
       
  2135 
       
  2136 	// Acquire Ownership Cancel Request
       
  2137 	INFO_PRINTF1(_L("AcquireOwnership Cancel Request..."));
       
  2138 	console->Printf(_L("AcquireOwnership Cancel Request...\n"));
       
  2139 	VoiceCall2.AcquireOwnership(iStatus);
       
  2140 	//doesn't work for MM.TSY
       
  2141 	//TEST_CHECKL(iStatus.Int(), KErrNone, _L("GT83-TVOICE-028.01"));
       
  2142 
       
  2143 	VoiceCall2.AcquireOwnershipCancel();
       
  2144 	User::WaitForRequest(iStatus);
       
  2145 	if (iStatus==KErrEtelCallNotActive)
       
  2146 		{
       
  2147 		INFO_PRINTF1(_L("Voice Call 2 is not currently active"));
       
  2148 		}
       
  2149 	else
       
  2150 		{
       
  2151 		INFO_PRINTF2(TRefByValue<const TDesC>(_L("AcquireOwnership Cancel status: %d")), iStatus.Int());
       
  2152 		}
       
  2153 
       
  2154 	// Transfer Ownership Request
       
  2155 	INFO_PRINTF1(_L("Voice Call 1 is trying to Transfer Ownership of the Call.."));
       
  2156 	ret=iVoiceCall.TransferOwnership();
       
  2157 	CHECKPOINT(ret, KErrEtelNoClientInterestedInThisCall, _L("GT83-TVOICE-029.01"));
       
  2158 	INFO_PRINTF1(_L("There is no Client currently interested in Ownership"));
       
  2159 
       
  2160 	// Close the 2nd Voice Call
       
  2161 	VoiceCall2.Close();
       
  2162 	INFO_PRINTF1(_L("Closing the 2nd Voice Call"));
       
  2163 	console->Printf(_L("Closing the 2nd Voice Call\n"));
       
  2164 
       
  2165 	// Hang up the Call
       
  2166 	INFO_PRINTF1(_L("Hanging up"));
       
  2167 	console->Printf(_L("Hanging up\n"));
       
  2168 	iVoiceCall.HangUp(iStatus);
       
  2169 	User::WaitForRequest(iStatus);
       
  2170 	TEST_CHECKL(iStatus.Int(), KErrNone, _L("*** Failed RMobileCall::Hangup() ***"));
       
  2171 	INFO_PRINTF1(_L("HangUp successful"));
       
  2172 	console->Printf(_L("HangUp successful\n"));
       
  2173 	// Close the line and call
       
  2174 	CleanupStack::PopAndDestroy(&iLine) ;
       
  2175 	CleanupStack::PopAndDestroy(&iVoiceCall) ;
       
  2176 
       
  2177 	TEST_END();
       
  2178 
       
  2179 	console->Printf(_L("Finished\n"));
       
  2180 	User::After(10*KOneSecond);
       
  2181    	CleanupStack::PopAndDestroy(console);
       
  2182 
       
  2183 	return TestStepResult();
       
  2184 	}
       
  2185 //------------------------------------------------------------------
       
  2186 
       
  2187 CTestCloseCallWhenActive::CTestCloseCallWhenActive( )
       
  2188 /* Each test step initialises it's own name
       
  2189 */
       
  2190 	{
       
  2191 	// store the name of this test case
       
  2192 	// this is the name that is used by the script file
       
  2193 
       
  2194 	SetTestStepName(_L("TestCloseCallWhenActive"));
       
  2195 	}
       
  2196 //------------------------------------------------------------------
       
  2197 
       
  2198 enum TVerdict CTestCloseCallWhenActive::doTestStepL()
       
  2199 //void CTestVoice::TestCloseCallWhenActiveL()
       
  2200 	{
       
  2201 	CConsoleBase* console = Console::NewL(KConsoleTitle,TSize(KConsFullScreen,KConsFullScreen));
       
  2202     CleanupStack::PushL(console);
       
  2203     console->Printf(_L("Test Call Close When Active..."));
       
  2204 	
       
  2205 	INFO_PRINTF1(_L("Opening Voice Line"));
       
  2206 	console->Printf(_L("Opening Voice Line\n"));
       
  2207 	TEST_CHECKL(iLine.Open(iPhone,KVoiceLineName), KErrNone, _L("GT83-TVOICE-Test15-LineOpened - *** Failed RMobileLine::Open() ***"));
       
  2208 
       
  2209     TName CallName ;
       
  2210 	INFO_PRINTF1(_L("Opening New Voice Call"));
       
  2211 	console->Printf(_L("Opening New Voice Call\n"));
       
  2212 	TEST_CHECKL(iVoiceCall.OpenNewCall(iLine, CallName), KErrNone, _L("*** RMobileCall::OpenNewCall() ***"));
       
  2213 	INFO_PRINTF2(_L("Voice Call name is %S"), &CallName);
       
  2214 
       
  2215 	TBuf<16> GoodNumber ;
       
  2216 	GetGoodNumber(GoodNumber) ;
       
  2217 
       
  2218 	//Activate a call by dialing a number
       
  2219 	INFO_PRINTF2(_L("Dialling %S...."), &GoodNumber);
       
  2220 	console->Printf(_L("Dialling %S....\n"), &GoodNumber);
       
  2221 	iVoiceCall.Dial(iStatus, GoodNumber);
       
  2222 	User::WaitForRequest(iStatus);
       
  2223 	TEST_CHECKL(iStatus.Int(), KErrNone, _L("GT83-TVOICE-Test15-CallDialled - *** Failed RMobileCall::Dial() ***"));
       
  2224 
       
  2225 	// Close call while it is active - without calling HangUp
       
  2226 	User::After(5000000);
       
  2227 	iVoiceCall.Close();
       
  2228 	iLine.Close();
       
  2229 	INFO_PRINTF1(_L("Close successful - check call not active on phone"));
       
  2230 	console->Printf(_L("Close successful - check call not active on phone\n"));
       
  2231 	TEST_END();
       
  2232 	
       
  2233 	console->Printf(_L("Finished\n"));
       
  2234 	User::After(10*KOneSecond);
       
  2235    	CleanupStack::PopAndDestroy(console);
       
  2236 	
       
  2237 	return TestStepResult();
       
  2238 	}
       
  2239 
       
  2240 //SUBSTITUTE CLASS FOR DEFECT FIX DEF010965
       
  2241 
       
  2242 CTestLineCapabilities::CTestLineCapabilities()
       
  2243 /* Each test step initialises it's own name
       
  2244 */
       
  2245 	{
       
  2246 	// store the name of this test case
       
  2247 	// this is the name that is used by the script file
       
  2248 
       
  2249 	SetTestStepName(_L("TestLineCapabilities"));
       
  2250 	}
       
  2251 
       
  2252 //------------------------------------------------------------------
       
  2253 
       
  2254 enum TVerdict CTestLineCapabilities::doTestStepL()
       
  2255 /**
       
  2256 * @test GT83-TVOICE-002.01 Test retrieval of a voice line's capabilities. Display the capabilities to screen
       
  2257 */
       
  2258 	{
       
  2259 	CConsoleBase* console = Console::NewL(KConsoleTitle,TSize(KConsFullScreen,KConsFullScreen));
       
  2260     CleanupStack::PushL(console);	
       
  2261 	
       
  2262 	_LIT(KStartText, "Test Line Capabilities") ; TEST_START(&KStartText) ;
       
  2263 	console->Printf(_L("Test Line Capabilities\n"));
       
  2264 
       
  2265 	CleanupClosePushL(iVoiceCall) ;
       
  2266 	CleanupClosePushL(iLine) ;
       
  2267 
       
  2268 	// Line Capabilities
       
  2269 
       
  2270 	RLine::TCaps lineCaps;
       
  2271 	INFO_PRINTF1(_L("Opening Voice Line"));
       
  2272 	console->Printf(_L("Opening Voice Line\n"));
       
  2273 	TEST_CHECKL(iLine.Open(iPhone,KVoiceLineName), KErrNone, _L("*** Failed RMobileLine::Open() ***"));
       
  2274 	TInt ret=iLine.GetCaps(lineCaps);
       
  2275 	CHECKPOINT_EXPR((ret==KErrNone || ret==KErrNotSupported), _L("*** Failed RMobileLine::GetCaps() ***")) ;
       
  2276 	if (ret==KErrNotSupported)
       
  2277 		{
       
  2278 		INFO_PRINTF1(_L("Get Line Capabilities is NOT supported"));
       
  2279 		}
       
  2280 	else
       
  2281 		{
       
  2282 		if ((lineCaps.iFlags&RLine::KCapsData) !=0)
       
  2283 			{
       
  2284 			INFO_PRINTF1(_L("This line supports Data connections"));
       
  2285 			}
       
  2286 		if ((lineCaps.iFlags&RLine::KCapsFax) !=0)
       
  2287 			{
       
  2288 			INFO_PRINTF1(_L("This line supports Fax connections"));
       
  2289 			}
       
  2290 		if ((lineCaps.iFlags&RLine::KCapsVoice) !=0)
       
  2291 			{
       
  2292 			INFO_PRINTF1(_L("This line supports Voice connections"));
       
  2293 			}
       
  2294 		if ((lineCaps.iFlags&RLine::KCapsEventIncomingCall) !=0)
       
  2295 			{
       
  2296 			INFO_PRINTF1(_L("This line supports Incoming Call Notification requests"));
       
  2297 			}
       
  2298 		}
       
  2299 	
       
  2300 	// Close the line and call
       
  2301 	CleanupStack::PopAndDestroy(&iLine) ;
       
  2302 	CleanupStack::PopAndDestroy(&iVoiceCall) ;
       
  2303 
       
  2304 	TEST_END() ;
       
  2305 	
       
  2306 	console->Printf(_L("Finished\n"));
       
  2307 	User::After(10*KOneSecond);
       
  2308    	CleanupStack::PopAndDestroy(console);
       
  2309 
       
  2310 	return TestStepResult();
       
  2311 	}
       
  2312 
       
  2313 CTestCancelDialRequest::CTestCancelDialRequest()
       
  2314 /* Each test step initialises it's own name
       
  2315 */
       
  2316 	{
       
  2317 	// store the name of this test case
       
  2318 	// this is the name that is used by the script file
       
  2319 	SetTestStepName(_L("TestCancelDialRequest"));
       
  2320 	}
       
  2321 
       
  2322 
       
  2323 enum TVerdict CTestCancelDialRequest::doTestStepL()
       
  2324 {
       
  2325 
       
  2326 // void CTestVoice::TestCancelDialRequestL()
       
  2327 //	{
       
  2328 
       
  2329 	CConsoleBase* console = Console::NewL(KConsoleTitle,TSize(KConsFullScreen,KConsFullScreen));
       
  2330     CleanupStack::PushL(console);
       
  2331     console->Printf(_L("Test Cancel Dial Request...\n"));
       
  2332 
       
  2333 
       
  2334 	User::After(2000000); //settling pause to allow previous test to complete hang up first.
       
  2335 
       
  2336 	//Tests cancelling dial requests for various periods after they are made.
       
  2337 	INFO_PRINTF1(_L("Opening Voice Line"));
       
  2338 	console->Printf(_L("Opening Voice Line\n"));
       
  2339 	TEST_CHECKL(iLine.Open(iPhone,KVoiceLineName), KErrNone, _L("GT83-TVOICE-Test15-LineOpened - *** Failed RMobileLine::Open() ***"));
       
  2340 
       
  2341     TName CallName ;
       
  2342 	INFO_PRINTF1(_L("Opening New Voice Call"));
       
  2343 	console->Printf(_L("Opening New Voice Call\n"));
       
  2344 	TEST_CHECKL(iVoiceCall.OpenNewCall(iLine, CallName), KErrNone, _L("*** RMobileCall::OpenNewCall() ***"));
       
  2345 	INFO_PRINTF2(_L("Voice Call name is %S"), &CallName);
       
  2346 
       
  2347 	TBuf<16> GoodNumber ;
       
  2348 	GetGoodNumber(GoodNumber) ;
       
  2349 
       
  2350 	//Cancel Tests
       
  2351 	
       
  2352 	INFO_PRINTF2(_L("Dialling %S...."), &GoodNumber);
       
  2353 	console->Printf(_L("Dialling %S....\n"), &GoodNumber);
       
  2354 	iVoiceCall.Dial(iStatus, GoodNumber);
       
  2355     User::After(500000);   //cancel after 0.5 second	
       
  2356 	INFO_PRINTF1(_L("Cancelling Dial After 0.5s..."));
       
  2357 	console->Printf(_L("Cancelling Dial After 0.5s...\n"));
       
  2358 	iVoiceCall.DialCancel();
       
  2359 	User::WaitForRequest(iStatus);
       
  2360 	
       
  2361 	if(iStatus==KErrCancel)
       
  2362 		{
       
  2363 		INFO_PRINTF1(_L("Dial Cancelled ok!..."));
       
  2364 		}
       
  2365 	
       
  2366 	if(iStatus==KErrNone)
       
  2367 		{
       
  2368 		INFO_PRINTF1(_L("Dial Cancel Request after 0.5sec of dialling, Failed..."));
       
  2369 		iVoiceCall.HangUp(iStatus);
       
  2370 		INFO_PRINTF1(_L("Call Hang Up Requested..."));
       
  2371 		User::WaitForRequest(iStatus);
       
  2372 		// Removed SetTestStepResult(EFail); here because original TS_Voice test always returns EPass anyway
       
  2373 		}
       
  2374 	
       
  2375 	INFO_PRINTF1(_L("Wait For Next Dial..."));
       
  2376 	console->Printf(_L("Wait For Next Dial...\n"));
       
  2377 	User::After(5000000);	//wait 5 seconds
       
  2378 	
       
  2379 	INFO_PRINTF2(_L("Dialling %S...."), &GoodNumber);
       
  2380 	console->Printf(_L("Dialling %S....\n"), &GoodNumber);
       
  2381 	iVoiceCall.Dial(iStatus, GoodNumber);
       
  2382 	User::After(1000000);	//cancel after 1.0 seconds
       
  2383 	INFO_PRINTF1(_L("Cancelling Dial After 1.0s..."));
       
  2384 	console->Printf(_L("Cancelling Dial After 1.0s...\n"));
       
  2385 	iVoiceCall.DialCancel();
       
  2386 	User::WaitForRequest(iStatus);
       
  2387 	
       
  2388 	if(iStatus==KErrCancel)
       
  2389 		{
       
  2390 		INFO_PRINTF1(_L("Dial Cancelled ok!..."));
       
  2391 		}
       
  2392 	
       
  2393 	else
       
  2394 		{
       
  2395 		INFO_PRINTF1(_L("Dial Cancel Request after 1sec of dialling, Failed..."));
       
  2396 		iVoiceCall.HangUp(iStatus);
       
  2397 		INFO_PRINTF1(_L("Call Hang Up Requested..."));
       
  2398 		User::WaitForRequest(iStatus);
       
  2399 		// Removed SetTestStepResult(EFail); here because original TS_Voice test always returns EPass anyway
       
  2400 		}
       
  2401 	
       
  2402 	INFO_PRINTF1(_L("Wait For Next Dial..."));
       
  2403 	console->Printf(_L("Wait For Next Dial...\n"));
       
  2404 	User::After(3000000);	//wait 3 seconds
       
  2405 	
       
  2406 	INFO_PRINTF2(_L("Dialling %S...."), &GoodNumber);
       
  2407 	console->Printf(_L("Dialling %S....\n"), &GoodNumber);
       
  2408 	iVoiceCall.Dial(iStatus, GoodNumber);
       
  2409 	User::After(1500000);	//cancel after 1.5 seconds
       
  2410 	INFO_PRINTF1(_L("Cancelling Dial After 1.5s..."));
       
  2411 	console->Printf(_L("Cancelling Dial After 1.5s...\n"));
       
  2412 	iVoiceCall.DialCancel();
       
  2413 	User::WaitForRequest(iStatus);
       
  2414 
       
  2415 	if(iStatus==KErrCancel)
       
  2416 		{
       
  2417 		INFO_PRINTF1(_L("Dial Cancelled ok!..."));
       
  2418 		}
       
  2419 
       
  2420 	else
       
  2421 		{
       
  2422 		INFO_PRINTF1(_L("Dial Cancel Request after 1.5sec of dialling, Failed..."));
       
  2423 		iVoiceCall.HangUp(iStatus);
       
  2424 		INFO_PRINTF1(_L("Call Hang Up Requested..."));
       
  2425 		User::WaitForRequest(iStatus);
       
  2426 		// Removed SetTestStepResult(EFail); here because original TS_Voice test always returns EPass anyway
       
  2427 		}
       
  2428 
       
  2429 	INFO_PRINTF1(_L("Wait For Next Dial..."));
       
  2430 	console->Printf(_L("Wait For Next Dial...\n"));
       
  2431 	User::After(3000000);	//wait 3 seconds
       
  2432 	
       
  2433 	INFO_PRINTF2(_L("Dialling %S...."), &GoodNumber);
       
  2434 	console->Printf(_L("Dialling %S....\n"), &GoodNumber);
       
  2435 	iVoiceCall.Dial(iStatus, GoodNumber);
       
  2436 	User::After(2000000);	//cancel after 2.0 seconds
       
  2437 	INFO_PRINTF1(_L("Cancelling Dial After 2.0s..."));
       
  2438 	console->Printf(_L("Cancelling Dial After 2.0s...\n"));
       
  2439 	iVoiceCall.DialCancel();
       
  2440 	User::WaitForRequest(iStatus);
       
  2441 	
       
  2442 	if(iStatus==KErrCancel)
       
  2443 		{
       
  2444 		INFO_PRINTF1(_L("Dial Cancelled ok!..."));
       
  2445 		}
       
  2446 
       
  2447 	else
       
  2448 		{
       
  2449 		INFO_PRINTF1(_L("Dial Cancel Request after 2sec of dialling, Failed..."));
       
  2450 		iVoiceCall.HangUp(iStatus);
       
  2451 		INFO_PRINTF1(_L("Call Hang Up Requested..."));
       
  2452 		User::WaitForRequest(iStatus);
       
  2453 		// Removed SetTestStepResult(EFail); here because original TS_Voice test always returns EPass anyway
       
  2454 		}
       
  2455 
       
  2456 	User::After(3000000);	//wait 3 seconds
       
  2457 
       
  2458 	//Connect without cancelling
       
  2459 	INFO_PRINTF1(_L("Now Dialling without Cancelling..."));
       
  2460 	console->Printf(_L("Now Dialling without Cancelling...\n"));
       
  2461 	INFO_PRINTF2(_L("Dialling %S...."), &GoodNumber);
       
  2462 	console->Printf(_L("Dialling %S....\n"), &GoodNumber);
       
  2463 	iVoiceCall.Dial(iStatus, GoodNumber);
       
  2464 	User::WaitForRequest(iStatus);
       
  2465 	TEST(iStatus.Int() == KErrNone);
       
  2466 	if(iStatus == KErrNone)
       
  2467 		{
       
  2468 		INFO_PRINTF1(_L("Connected Ok. Please wait, will hang up shortly..."));
       
  2469 		}
       
  2470 	else
       
  2471 		{
       
  2472 		INFO_PRINTF1(_L("Failed subsequant dial without cancelling!"));
       
  2473 		}
       
  2474 	
       
  2475 	User::After(10000000);	
       
  2476 	INFO_PRINTF1(_L("Closing call..."));
       
  2477 	console->Printf(_L("Closing call...\n"));
       
  2478 	iVoiceCall.Close();
       
  2479 	iLine.Close();
       
  2480 	
       
  2481 	INFO_PRINTF1(_L("Close successful - check call not active on phone"));
       
  2482 	console->Printf(_L("Close successful - check call not active on phone\n"));
       
  2483 
       
  2484 	console->Printf(_L("Finished\n"));
       
  2485 	User::After(10*KOneSecond);
       
  2486    	CleanupStack::PopAndDestroy(console);
       
  2487 
       
  2488 	// Returns EPass as it is debatable if this is a valid test as the functionality 
       
  2489 	// being tested is very network dependant but test has been left none the less
       
  2490 	SetTestStepResult(EPass);
       
  2491 	return 	EPass;
       
  2492 	}