telephonyserverplugins/multimodetsy/test/Te_Data/Te_Data.cpp
changeset 0 3553901f7fa8
child 24 6638e7f4bd8f
equal deleted inserted replaced
-1:000000000000 0:3553901f7fa8
       
     1 // Copyright (c) 2002-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 to test the Data Line abilities of MMTSY and ETel.
       
    15 // 
       
    16 //
       
    17 
       
    18 /**
       
    19  @file
       
    20 */
       
    21 
       
    22 #include "Te_Data.h"
       
    23 
       
    24 _LIT(KDataLineName,"Data");
       
    25 _LIT(KCsyName, "ECUART.CSY");
       
    26 _LIT(KConsoleTitle,"Action Required");
       
    27 
       
    28 const TInt KTenPartOfSec = 100000 ;
       
    29 const TInt KOneSecond=1000000;	// Used in a time out function, 1 second (in microSeconds)
       
    30 const TInt KTenSeconds=10000000;	// Used in a time out function, 10 seconds (in microSeconds)
       
    31 const TInt KFifteenSeconds=15000000;	// 5 seconds (in microSeconds)
       
    32 
       
    33 _LIT8(KWriteTestData,"MM  TSY Data and Echo Server Test is in progress...");
       
    34 
       
    35 
       
    36 CTestLineStatusIncommingCall::CTestLineStatusIncommingCall()
       
    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("TestLineStatusIncommingCall"));
       
    43 	}
       
    44 //------------------------------------------------------------------
       
    45 
       
    46 TVerdict CTestLineStatusIncommingCall::doTestStepL( void )
       
    47 /**	 Tests line status function
       
    48  * @test GT83-TDATA-001.01 Test opening a data line from a phone that supports data functionality
       
    49  * @test GT83-TDATA-004.00 Test retrieval of a data line's current status (Generic)
       
    50  * @test GT83-TDATA-004.02 "Test retrieval of a data line's current status when the line's status is ""Idle"""
       
    51  * @test GT83-TDATA-004.04 "Test retrieval of a data line's current status when the line's status is ""Ringing"""
       
    52  * @test GT83-TDATA-004.07 "Test retrieval of a data line's current status when the line's status is ""Connected"""
       
    53  * @test GT83-TDATA-004.08 "Test retrieval of a data line's current status when the line's status is ""Hanging up"""
       
    54  * @test GT83-TDATA-014.05 Test opening an existing call from a data line by specifying the name of the line and the name of an existing call
       
    55  * @test GT83-TDATA-025.00 Test answering a call on a data line (Generic)
       
    56  * @test GT83-TDATA-031.00 Test retrieval of a mobile data line's current status (Generic)
       
    57  * @test GT83-TDATA-031.01 "Test retrieval of a mobile data line's current status when there is only one call on the line and it's status is ""Idle"""
       
    58  * @test GT83-TDATA-031.04 "Test retrieval of a mobile data line's current status when there is only one call on the line and it's status is ""Answering"""
       
    59  * @test GT83-TDATA-031.07 "Test retrieval of a mobile data line's current status when there is only one call on the line and it's status is ""Waiting CCBS Recall"""
       
    60 */
       
    61 	{
       
    62 	INFO_PRINTF1(_L("======Start test Test Line Status"));
       
    63 	RMobileCall::TMobileDataCallParamsV1 callDataParams;
       
    64 	RMobileCall::TMobileDataCallParamsV1Pckg callDataParamsPckg(callDataParams);
       
    65     //to make sure that line and call will be closed in leave case
       
    66 	CleanupStack::PushL(*this) ; ;
       
    67 
       
    68 	RCall::TStatus lineStatus;
       
    69 	TBuf<16> GoodNumber ;
       
    70 	GetRemoteNumber(GoodNumber) ;
       
    71 	// Open a Data line and Call
       
    72 	//GT83-AT-021	Test opening a data line from a phone that supports data functionality
       
    73 	INFO_PRINTF1(_L("Opening Data Line"));
       
    74 	TEST_CHECKL(iLine.Open(iPhone,  KDataLineName), KErrNone, _L("GT83-TDATA-001.01"));
       
    75 
       
    76 	/* @test GT83-AT-36	Test retrieval of the current call status when it is idle*/
       
    77 	TInt ret = iLine.GetStatus(lineStatus);
       
    78 	CHECKPOINT(ret, KErrNone, _L("GT83-TDATA-004.00 - *** Failed RMobileLine::GetStatus() ***")) ;
       
    79 	CHECKPOINT(lineStatus, RCall::EStatusIdle, _L("GT83-TDATA-004.02")) ;
       
    80 
       
    81 	RMobileCall::TMobileCallStatus mobileLineStatus;
       
    82 	ret = iLine.GetMobileLineStatus(mobileLineStatus);
       
    83 	CHECKPOINT(ret, KErrNone, _L("GT83-TDATA-031.00 - *** Failed RMobileLine::GetMobileLineStatus() ")) ;
       
    84 	CHECKPOINT(mobileLineStatus, RMobileCall::EStatusIdle, _L("GT83-TDATA-031.01")) ;
       
    85 
       
    86 	CConsoleBase* console = Console::NewL(KConsoleTitle,TSize(KConsFullScreen,KConsFullScreen));
       
    87     CleanupStack::PushL(console);
       
    88 	console->Printf(_L("Please ring the phone\n"));
       
    89 
       
    90 	TName callName;
       
    91 	/* @test GT83-AT-024	Test setting notification of an incoming call on a data line */
       
    92 	iLine.NotifyIncomingCall(iStatus, callName);	// wait for a call
       
    93 	WaitWithTimeoutL(iStatus,60*KOneSecond);		// but timeout after 60 second
       
    94 
       
    95 
       
    96 	CHECKPOINT(iStatus.Int(), KErrNone, _L("GT83-TDATA-0 - *** Failed RMobileLine::NotifyIncomingCall() ***")) ;
       
    97 	if(iStatus.Int() == KRequestPending)
       
    98 		{
       
    99 		iLine.NotifyIncomingCallCancel();
       
   100 		User::WaitForRequest(iStatus);
       
   101 		}
       
   102 
       
   103 	/* @test GT83-AT-36	Test retrieval of the current call status when it is ringing*/
       
   104 	ret = iLine.GetStatus(lineStatus);
       
   105 	CHECKPOINT(ret, KErrNone, _L("GT83-TDATA-0 - *** Failed RMobileLine::GetStatus() *** ")) ;
       
   106 	CHECKPOINT(lineStatus, RCall::EStatusRinging, _L("GT83-TDATA-0")) ;
       
   107 
       
   108 	ret = iLine.GetMobileLineStatus(mobileLineStatus);
       
   109 	CHECKPOINT(ret, KErrNone, _L("GT83-TDATA-0 - *** Failed RMobileLine::GetMobileLineStatus() *** ")) ;
       
   110 	CHECKPOINT(mobileLineStatus, RMobileCall::EStatusRinging, _L("GT83-TDATA-008.001")) ;
       
   111 	INFO_PRINTF1(_L("Phone is ringing..."));
       
   112 
       
   113 	//Test for incomming data call
       
   114 	TestLineCapabilitiesL(iLine);
       
   115 
       
   116 	/* @test GT83-AT-028	Test opening a new call by specifying the name of a line
       
   117 	*/
       
   118 	ret = iDataCall.OpenExistingCall(iLine, callName);
       
   119 	TEST_CHECKL(ret, KErrNone, _L("GT83-TDATA-014.05 - *** Failed RMobileCall::OpenExistingCall() ***")) ;
       
   120 
       
   121 	callDataParams.iService = RMobileCall::EServiceDataCircuitAsync;
       
   122 	callDataParams.iSpeed = RMobileCall::ESpeed9600;
       
   123 	callDataParams.iProtocol = RMobileCall::EProtocolV32;
       
   124 	//callDataParams.iProtocol = RMobileCall::EProtocolIsdnMultimedia;
       
   125 
       
   126 	callDataParams.iQoS = RMobileCall::EQoSNonTransparent;
       
   127 
       
   128 
       
   129 	// Answer an incoming call initiated by t_echo.exe and obtain the call's current status
       
   130 	//GT83-AT-032	Test answering a call on a data line (Generic)	RCall::AnswerIncomingCall
       
   131 	iDataCall.AnswerIncomingCall(iStatus, callDataParamsPckg);
       
   132 
       
   133 	// DEF55659-NCh : timout changed from 30 to 60 s. Current version of MM.TSY is pretty slow, due
       
   134 	// to the way it deal with the new comms repository. This timeout must be changed back to 30s
       
   135 	// when comms repository access code is updated.
       
   136 	WaitWithTimeoutL(iStatus,60*KOneSecond);		// but timeout after 60 seconds
       
   137 
       
   138 	//cancel AnswerIncomingCall if request is still pending
       
   139 	if(iStatus.Int() == KRequestPending)
       
   140 		{
       
   141 		iDataCall.AnswerIncomingCallCancel();
       
   142 		User::WaitForRequest(iStatus);
       
   143 		}
       
   144 
       
   145 	console->Printf(_L("Please stay connected... the test will hang up shortly\n"));
       
   146 
       
   147 	TEST_CHECKL(iStatus.Int(), KErrNone, _L("GT83-TDATA-025.00 -  *** Failed RMobileCall::AnswerIncomingCall() ***")) ;
       
   148 	ret = iLine.GetStatus(lineStatus);
       
   149 	CHECKPOINT(ret, KErrNone, _L("GT83-TDATA-004.04 - *** Failed RMobileLine::GetStatus() ***")) ;
       
   150 	CHECKPOINT(lineStatus, RCall::EStatusConnected, _L("GT83-TDATA-004.04")) ;
       
   151 
       
   152 	ret = iLine.GetMobileLineStatus(mobileLineStatus);
       
   153 	CHECKPOINT(ret, KErrNone, _L("GT83-TDATA-031.04 - *** Failed RMobileLine::GetMobileLineStatus() ***")) ;
       
   154 	CHECKPOINT(mobileLineStatus, RMobileCall::EStatusConnected, _L("GT83-TDATA-031.04")) ;
       
   155 	TestLineCapabilitiesL(iLine);
       
   156 
       
   157 	/* @test GT83-AT-36	Test retrieval of the current call status when it is connected*/
       
   158 	ret = iLine.GetStatus(lineStatus);
       
   159 	CHECKPOINT(ret, KErrNone, _L("GT83-TDATA-004.07 - *** Failed RMobileLine::GetMobileLineStatus() ***")) ;
       
   160 	CHECKPOINT(lineStatus, RCall::EStatusConnected, _L("GT83-TDATA-004.07")) ;
       
   161 
       
   162 	ret = iLine.GetMobileLineStatus(mobileLineStatus);
       
   163 	CHECKPOINT(ret, KErrNone, _L("GT83-TDATA-031.07 - *** Failed RMobileLine::GetMobileLineStatus() ***")) ;
       
   164 	CHECKPOINT(mobileLineStatus, RMobileCall::EStatusConnected, _L("GT83-TDATA-031.07")) ;
       
   165 
       
   166 	User::After(10*KOneSecond);
       
   167 
       
   168 	INFO_PRINTF1(_L("Hanging Up"));
       
   169 	iDataCall.HangUp(iStatus);
       
   170 
       
   171 	/* @test GT83-AT-36	Test retrieval of the current call status when it is hang up*/
       
   172 	ret = iLine.GetStatus(lineStatus);
       
   173 	CHECKPOINT(ret, KErrNone, _L("GT83-TDATA-004.08 - *** Failed RMobileLine::GetStatus() *** ")) ;
       
   174 	CHECKPOINT(lineStatus, RCall::EStatusHangingUp, _L("GT83-TDATA-0")) ;
       
   175 
       
   176 	ret = iLine.GetMobileLineStatus(mobileLineStatus);
       
   177 	CHECKPOINT(ret, KErrNone, _L("GT83-TDATA-004.09 - *** Failed RMobileLine::GetMobileLineStatus() ***")) ;
       
   178 	CHECKPOINT(mobileLineStatus, RMobileCall::EStatusDisconnecting, _L("GT83-TDATA-004.09")) ;
       
   179 
       
   180 	User::WaitForRequest(iStatus);
       
   181 	TEST_CHECKL(iStatus.Int(), KErrNone, _L("*** Failed to Hang Up. If you are using an Ericsson phone, this is a PHONE related problem! ***")) ;  //???  line 825
       
   182 
       
   183 	//This test has some trobles with Ericsson phones
       
   184 	//R520m could return KErrGeneral
       
   185 	//SH888 could return KErrTimedOut
       
   186 	INFO_PRINTF2(_L("iDataCall.HangUp() returned status %d"), iStatus.Int()) ;
       
   187 
       
   188 	//Check that line status is now idle. If line is still connected, Fail check and leave to 
       
   189 	//prevent problems down the line
       
   190 	/* @test GT83-AT-36	Test retrieval of the current call status when it is idle*/
       
   191 	ret = iLine.GetStatus(lineStatus);
       
   192 	CHECKPOINT(ret, KErrNone, _L("GT83-TDATA-004.02 - *** Failed RMobileLine::GetStatus() ***")) ;
       
   193 	TEST_CHECKL(lineStatus, RCall::EStatusIdle, _L("GT83-TDATA-004.02 - *** FAILED TO HANGUP CALL!! ***" )) ;
       
   194 
       
   195 	ret = iLine.GetMobileLineStatus(mobileLineStatus);
       
   196 	CHECKPOINT(ret, KErrNone, _L("GT83-TDATA-004.02 - *** Failed RMobileLine::GetMobileLineStatus() ***")) ;
       
   197 	CHECKPOINT(mobileLineStatus, RMobileCall::EStatusIdle, _L("GT83-TDATA-004.02")) ;
       
   198 
       
   199 	/* @test GT83-AT-36	Test retrieval of the current call status when it is idle*/
       
   200 	ret = iLine.GetStatus(lineStatus);
       
   201 	CHECKPOINT(ret, KErrNone, _L("GT83-TDATA-004.02")) ;
       
   202 	TEST_CHECKL(lineStatus, RCall::EStatusIdle, _L("GT83-TDATA-004.02")) ;
       
   203 
       
   204 	console->Printf(_L("...Disconnected\n"));
       
   205 	User::After(10*KOneSecond);
       
   206     CleanupStack::PopAndDestroy(console);
       
   207 
       
   208 	// Close the line and call
       
   209 	CleanupStack::PopAndDestroy() ;
       
   210 
       
   211 	INFO_PRINTF1(_L("======End test ====="));
       
   212 	return TestStepResult() ;
       
   213 	}
       
   214 //------------------------------------------------------------------
       
   215 
       
   216 CTestLineStatusOutgoingCall::CTestLineStatusOutgoingCall()
       
   217 /** Each test step initialises it's own name
       
   218 */
       
   219 	{
       
   220 	// store the name of this test case
       
   221 	// this is the name that is used by the script file
       
   222 	SetTestStepName(_L("TestLineStatusOutgoingCall"));
       
   223 	}
       
   224 //------------------------------------------------------------------
       
   225 
       
   226 TVerdict CTestLineStatusOutgoingCall::doTestStepL( void )
       
   227 /**	 Tests line status function
       
   228  * @test GT83-TDATA-001.01 Test opening a data line from a phone that supports data functionality
       
   229  * @test GT83-TDATA-004.00 Test retrieval of a data line's current status (Generic)
       
   230  * @test GT83-TDATA-004.02 "Test retrieval of a data line's current status when the line's status is ""Idle"""
       
   231  * @test GT83-TDATA-004.03 "Test retrieval of a data line's current status when the line's status is ""Dialling"""
       
   232  * @test GT83-TDATA-004.07 "Test retrieval of a data line's current status when the line's status is ""Connected"""
       
   233  * @test GT83-TDATA-004.08 "Test retrieval of a data line's current status when the line's status is ""Hanging up"""
       
   234  * @test GT83-TDATA-014.05 Test opening an existing call from a data line by specifying the name of the line and the name of an existing call
       
   235  * @test GT83-TDATA-031.00 Test retrieval of a mobile data line's current status (Generic)
       
   236  * @test GT83-TDATA-031.01 "Test retrieval of a mobile data line's current status when there is only one call on the line and it's status is ""Idle"""
       
   237 */
       
   238 	{
       
   239 	INFO_PRINTF1(_L("======Start test Test Line Status"));
       
   240 
       
   241 	RMobileCall::TMobileDataCallParamsV1 callDataParams;
       
   242 	RMobileCall::TMobileDataCallParamsV1Pckg callDataParamsPckg(callDataParams);
       
   243     //to make sure that line and call will be closed in leave case
       
   244 	CleanupStack::PushL(*this) ; ;
       
   245 
       
   246 	TName callName;
       
   247 
       
   248 	RCall::TStatus lineStatus;
       
   249 	TBuf<16> GoodNumber ;
       
   250 	GetRemoteNumber(GoodNumber) ;
       
   251 	// Open a Data line and Call
       
   252 	//GT83-AT-021	Test opening a data line from a phone that supports data functionality
       
   253 	INFO_PRINTF1(_L("Opening Data Line"));
       
   254 	TEST_CHECKL(iLine.Open(iPhone, KDataLineName), KErrNone, _L("GT83-TDATA-001.01"));
       
   255 
       
   256 	/* @test GT83-AT-36	Test retrieval of the current call status when it is idle*/
       
   257 	TInt ret = iLine.GetStatus(lineStatus);
       
   258 	CHECKPOINT(ret, KErrNone, _L("GT83-TDATA-004.00 - *** Failed RMobileLine::GetStatus() ***")) ;
       
   259 	CHECKPOINT(lineStatus, RCall::EStatusIdle, _L("GT83-TDATA-004.02")) ;
       
   260 
       
   261 	RMobileCall::TMobileCallStatus mobileLineStatus;
       
   262 	ret = iLine.GetMobileLineStatus(mobileLineStatus);
       
   263 	CHECKPOINT(ret, KErrNone, _L("GT83-TDATA-031.00 - *** Failed RMobileLine::GetMobileLineStatus() ")) ;
       
   264 	CHECKPOINT(mobileLineStatus, RMobileCall::EStatusIdle, _L("GT83-TDATA-031.01")) ;
       
   265 
       
   266 	/* @test GT83-AT-028	Test opening a new call by specifying the name of a line
       
   267 	*/
       
   268 	ret = iDataCall.OpenNewCall(iLine, callName);
       
   269 	TEST_CHECKL(ret, KErrNone, _L("GT83-TDATA-014.05 - *** Failed RMobileCall::OpenNewCall() ***")) ;
       
   270 
       
   271 	callDataParams.iService = RMobileCall::EServiceDataCircuitAsync;
       
   272 	callDataParams.iSpeed = RMobileCall::ESpeed9600;
       
   273 	callDataParams.iProtocol = RMobileCall::EProtocolV32;
       
   274 	//callDataParams.iProtocol = RMobileCall::EProtocolIsdnMultimedia;
       
   275 
       
   276 	callDataParams.iQoS = RMobileCall::EQoSNonTransparent;
       
   277 
       
   278 	CConsoleBase* console = Console::NewL(KConsoleTitle,TSize(KConsFullScreen,KConsFullScreen));
       
   279     CleanupStack::PushL(console);
       
   280 	console->Printf(_L("Calling...\n"));
       
   281 
       
   282 	INFO_PRINTF2(_L("Dialling %S...."), &GoodNumber);
       
   283 	iDataCall.Dial(iStatus, callDataParamsPckg, GoodNumber);
       
   284 	ret = iLine.GetStatus(lineStatus);
       
   285 	CHECKPOINT(ret, KErrNone, _L("GT83-TDATA-0 - *** Failed RMobileLine::GetStatus() *** ")) ;
       
   286 	//Commented out because phone does not report that it is going into this state
       
   287 	//TEST_CHECKL(lineStatus, RCall::EStatusDialling, _L("GT83-TDATA-004.03")) ;
       
   288 	WaitWithTimeoutL(iStatus,90*KOneSecond); // but timeout after 90 seconds
       
   289 	CHECKPOINT(iStatus.Int(), KErrNone, _L("GT83-TDATA-0")) ;
       
   290 	
       
   291 	if(iStatus.Int() == KRequestPending)
       
   292 		{
       
   293 		iDataCall.DialCancel();
       
   294 		User::WaitForRequest(iStatus);
       
   295 		}
       
   296 	
       
   297 	//Test for outgoing data call
       
   298 	TestLineCapabilitiesL(iLine);
       
   299 
       
   300 	/* @test GT83-AT-36	Test retrieval of the current call status when it is connected*/
       
   301 	ret = iLine.GetStatus(lineStatus);
       
   302 	CHECKPOINT(ret, KErrNone, _L("GT83-TDATA-004.07 - *** Failed RMobileLine::GetStatus() *** ")) ;
       
   303 	CHECKPOINT(lineStatus, RCall::EStatusConnected, _L("GT83-TDATA-004.07")) ;
       
   304 
       
   305 	ret = iLine.GetMobileLineStatus(mobileLineStatus);
       
   306 	CHECKPOINT(ret, KErrNone, _L("GT83-TDATA-0 - *** Failed RMobileLine::GetMobileLineStatus() ***")) ;
       
   307 	CHECKPOINT(mobileLineStatus, RMobileCall::EStatusConnected, _L("GT83-TDATA-0")) ;
       
   308 
       
   309 	console->Printf(_L("Please stay connected... the test will hang up shortly\n"));
       
   310 	User::After(10*KOneSecond);
       
   311 
       
   312 	INFO_PRINTF1(_L("Call connected - listen for 20 seconds..."));
       
   313 
       
   314 	User::After(20*KOneSecond); // hold call active for 20 seconds
       
   315 
       
   316 	INFO_PRINTF1(_L("Hanging up"));
       
   317 	iDataCall.HangUp(iStatus);
       
   318 
       
   319 	ret = iLine.GetStatus(lineStatus);
       
   320 	CHECKPOINT(ret, KErrNone, _L("GT83-TDATA-004.08 - *** Failed RMobileLine::GetStatus() ***  ")) ;
       
   321 	CHECKPOINT(lineStatus, RCall::EStatusHangingUp, _L("GT83-TDATA-004.08")) ;
       
   322 
       
   323 	User::WaitForRequest(iStatus);
       
   324 	TEST_CHECKL(iStatus.Int(), KErrNone, _L("*** Failed to Hang Up. If you are using an Ericsson phone, this is a PHONE related problem! ***")) ;
       
   325 
       
   326 	//This test has some troubles with Ericsson phones
       
   327 	//R520m could return KErrGeneral
       
   328 	//SH888 could return KErrTimedOut
       
   329 	INFO_PRINTF2(_L("iDataCall.HangUp() returned status %d"), iStatus.Int()) ;
       
   330 
       
   331 	//Test line capabilities
       
   332 	TestLineCapabilitiesL(iLine);
       
   333 
       
   334 	ret = iLine.GetStatus(lineStatus);
       
   335 	CHECKPOINT(ret, KErrNone, _L("GT83-TDATA-004.02")) ;
       
   336 	TEST_CHECKL(lineStatus, RCall::EStatusIdle, _L("GT83-TDATA-004.02 - *** Phone Failed to hang up ***")) ;
       
   337 
       
   338 	ret = iLine.GetMobileLineStatus(mobileLineStatus);
       
   339 	CHECKPOINT(ret, KErrNone, _L("GT83-TDATA-031.01 -  *** Failed RMobileLine::GetMobileLineStatus() *** ")) ;
       
   340 	CHECKPOINT(mobileLineStatus, RMobileCall::EStatusIdle, _L("GT83-TDATA-031.01")) ;
       
   341 
       
   342 	console->Printf(_L("...Disconnected\n"));
       
   343 	User::After(10*KOneSecond);
       
   344     CleanupStack::PopAndDestroy(console);
       
   345 
       
   346 	// Close the line and call
       
   347 	CleanupStack::PopAndDestroy() ;
       
   348 
       
   349 	INFO_PRINTF1(_L("======End test ====="));
       
   350 	return TestStepResult() ;
       
   351 	}
       
   352 //------------------------------------------------------------------
       
   353 
       
   354 CTestLineInfo::CTestLineInfo()
       
   355 /** Each test step initialises it's own name
       
   356 */
       
   357 	{
       
   358 	// store the name of this test case
       
   359 	// this is the name that is used by the script file
       
   360 	SetTestStepName(_L("TestLineInfo"));
       
   361 	}
       
   362 //------------------------------------------------------------------
       
   363 
       
   364 TVerdict CTestLineInfo::doTestStepL( void )
       
   365 /**
       
   366  * This function gets the Line capabilities, line information, Number of calls
       
   367  * on the line and call information,
       
   368  * @test NONE	Test the ability to get the current line information of the data line (Generic)
       
   369  * @test GT83-TDATA-001.01 Test opening a data line from a phone that supports data functionality
       
   370  * @test GT83-TDATA-005.01 "Test retrieval of the current hook status, when the line is currently ""off hook"""
       
   371  * @test GT83-TDATA-005.02 "Test retrieval of the current hook status, when the line is currently ""on hook"""
       
   372  * @test GT83-TDATA-013.06 Test opening a new call by specifying the name of a line
       
   373  * @test GT83-TDATA-025.00 Test answering a call on a data line (Generic)
       
   374  * @test GT83-TDATA-026.02 Test the ability to place an asynchronous request to hang up a data call
       
   375  */
       
   376 	{
       
   377 	INFO_PRINTF1(_L("======Start test Test Line Information"));
       
   378     //to make sure that line and call will be closed in leave case
       
   379 	CleanupStack::PushL(*this) ; ;
       
   380 	INFO_PRINTF1(_L("Opening Data Line"));
       
   381 	TEST_CHECKL(iLine.Open(iPhone, KDataLineName), KErrNone, _L("GT83-TDATA-001.01 - *** Failed RMobileLine::Open() ***"));
       
   382 	INFO_PRINTF1(_L("Opening New Data Call"));
       
   383 	TEST_CHECKL(iDataCall.OpenNewCall(iLine), KErrNone, _L("GT83-TDATA-013.06 - *** Failed RMobileCall::OpenNewCall() ***"));
       
   384 
       
   385 	// Line Information
       
   386 	RLine::TLineInfo lineInfo;
       
   387 	TRAPD(ret, ret=iLine.GetInfo(lineInfo));
       
   388 	CHECKPOINT(ret, KErrNone, _L("*** Failed RMobileLine::GetInfo ***"));
       
   389 	if (ret!=KErrNone)
       
   390 		{
       
   391 		INFO_PRINTF1(_L("Get Line Info. is NOT supported"));
       
   392 		}
       
   393 	else
       
   394 		{
       
   395 		INFO_PRINTF1(_L("Get Line Info is successful"));
       
   396 		CHECKPOINT(lineInfo.iHookStatus,  RCall::EHookStatusOn, _L("GT83-TDATA-0")) ;
       
   397 		TEST(lineInfo.iStatus == RCall::EStatusIdle) ;
       
   398 		INFO_PRINTF2(TRefByValue<const TDesC>(_L("Name of last call added: %S")), &lineInfo.iNameOfLastCallAdded);
       
   399 		}
       
   400 
       
   401 	// Hook status information
       
   402 	INFO_PRINTF1(_L("\nRetrieving Hook Status..."));
       
   403 	RCall::THookStatus hookStatus;
       
   404 	ret=iLine.GetHookStatus(hookStatus);
       
   405 	if (ret!=KErrNone)
       
   406 		{
       
   407 		INFO_PRINTF1(_L("Get Hook status is NOT supported"));
       
   408 		}
       
   409 	else
       
   410 		{
       
   411 		CHECKPOINT(hookStatus, RCall::EHookStatusOn, _L("GT83-TDATA-005.02")) ;
       
   412 		INFO_PRINTF1(_L("The line is currently ON Hook"));
       
   413 		}
       
   414 
       
   415 	// Post 'Answer a Call' Notifications
       
   416 	RMobileCall::TMobileDataCallParamsV1 callDataParams;
       
   417 	RMobileCall::TMobileDataCallParamsV1Pckg callDataParamsPckg(callDataParams);
       
   418 
       
   419 
       
   420 	callDataParams.iService = RMobileCall::EServiceDataCircuitAsync;
       
   421 	callDataParams.iSpeed = RMobileCall::ESpeed9600;
       
   422 	callDataParams.iProtocol = RMobileCall::EProtocolV32;
       
   423 	//callDataParams.iProtocol = RMobileCall::EProtocolIsdnMultimedia;
       
   424 
       
   425 	callDataParams.iQoS = RMobileCall::EQoSNonTransparent;
       
   426 
       
   427 	CConsoleBase* console = Console::NewL(KConsoleTitle,TSize(KConsFullScreen,KConsFullScreen));
       
   428     CleanupStack::PushL(console);
       
   429 	console->Printf(_L("Please ring the phone\n"));
       
   430 
       
   431 	// Answer an incoming call initiated by t_echo.exe and obtain the call's current status
       
   432 	//GT83-AT-032	Test answering a call on a data line (Generic)	RCall::AnswerIncomingCall
       
   433 	iDataCall.AnswerIncomingCall(iStatus, callDataParamsPckg);
       
   434 
       
   435 	WaitWithTimeoutL(iStatus,6*KTenSeconds);		// but timeout after 60 seconds
       
   436 
       
   437 	//cancel AnswerIncomingCall if request is still pending
       
   438 	if(iStatus.Int() == KRequestPending)
       
   439 		{
       
   440 		iDataCall.AnswerIncomingCallCancel();
       
   441 		User::WaitForRequest(iStatus);
       
   442 		}
       
   443 
       
   444 	console->Printf(_L("Please stay connected... the test will hang up shortly\n"));
       
   445 
       
   446 	TEST_CHECKL(iStatus.Int(), KErrNone, _L("GT83-TDATA-025.00 - *** Failed RMobileCall::AnswerIncomingCall() ***")) ;
       
   447 
       
   448 	// Count the no. of calls on the line & Get call info.
       
   449 	INFO_PRINTF1(_L("Retrieving no. of calls opened from the line.."));
       
   450 	TInt lineCount=0;
       
   451 	TEST(KErrNone == iLine.EnumerateCall(lineCount));
       
   452 	INFO_PRINTF2(TRefByValue<const TDesC>(_L("No of calls opened = %d")), lineCount);
       
   453 
       
   454 	INFO_PRINTF1(_L("Getting Call info.."));
       
   455 	RLine::TCallInfo callInfo;
       
   456 	ret=iLine.GetCallInfo(0,callInfo);
       
   457 	if (ret==KErrNotSupported)
       
   458 		{
       
   459 		INFO_PRINTF1(_L("Get Call information is NOT supported"));
       
   460 		}
       
   461 	if (ret==KErrNone)
       
   462 		{
       
   463 		INFO_PRINTF1(_L("Get Call information is successful"));
       
   464 		}
       
   465 
       
   466 	// Get the line's current hook status
       
   467 	ret=iLine.GetHookStatus(hookStatus);
       
   468 	if (ret!=KErrNone)
       
   469 		{
       
   470 		INFO_PRINTF1(_L("Get Hook status is NOT supported"));
       
   471 		}
       
   472 	else
       
   473 		{
       
   474 		TEST_CHECKL(hookStatus, RCall::EHookStatusOff, _L("GT83-TDATA-005.01")) ;
       
   475 		INFO_PRINTF1(_L("The line is currently OFF Hook"));
       
   476 		}
       
   477 
       
   478 	User::After(KTenSeconds);
       
   479 
       
   480 	INFO_PRINTF1(_L("Hanging up"));
       
   481 	iDataCall.HangUp(iStatus);
       
   482 	User::WaitForRequest(iStatus);
       
   483 	TEST_CHECKL(iStatus.Int(), KErrNone, _L("*** Failed to Hang Up. If you are using an Ericsson phone, this is a PHONE related problem! ***")) ;
       
   484 
       
   485 	//This test has some trobles with Ericsson phones
       
   486 	//R520m could return KErrGeneral
       
   487 	//SH888 could return KErrTimedOut
       
   488 	INFO_PRINTF2(_L("iDataCall.HangUp() returned status %d"), iStatus.Int()) ;
       
   489 
       
   490 	console->Printf(_L("...Disconnected\n"));
       
   491 	User::After(10*KOneSecond);
       
   492     CleanupStack::PopAndDestroy(console);
       
   493 
       
   494 	// Close the line and call
       
   495 	CleanupStack::PopAndDestroy() ;
       
   496 
       
   497 	INFO_PRINTF1(_L("======End test ====="));
       
   498 	return TestStepResult() ;
       
   499 	}
       
   500 //------------------------------------------------------------------
       
   501 
       
   502 CTestLineNotificationsIncommingCall::CTestLineNotificationsIncommingCall()
       
   503 /** Each test step initialises it's own name
       
   504 */
       
   505 	{
       
   506 	// store the name of this test case
       
   507 	// this is the name that is used by the script file
       
   508 	SetTestStepName(_L("TestLineNotificationsIncommingCall"));
       
   509 	}
       
   510 //------------------------------------------------------------------
       
   511 
       
   512 TVerdict CTestLineNotificationsIncommingCall::doTestStepL( void )
       
   513 /** Tests line notifications
       
   514  * @test GT83-TDATA-001.01 Test opening a data line from a phone that supports data functionality
       
   515  * @test GT83-TDATA-008.01 Test setting notification of an incoming call on a data line
       
   516  * @test GT83-TDATA-008.02 Test for a notification when there is an incoming call on a data line
       
   517  * @test GT83-TDATA-009.01 Test setting notification of a change in hook status of a data line
       
   518  * @test GT83-TDATA-009.02 "Test notification of a change in hook status of a data line from ""off"" to ""on"""
       
   519  * @test GT83-TDATA-009.03 "Test notification of a change in hook status of a data line from ""on"" to off"""
       
   520  * @test GT83-TDATA-010.01 Test setting notification of a change in the status of the data line
       
   521  * @test GT83-TDATA-010.02 "Test notification of a change in the status of the data line from ""idle"" to ""ringing"" to ""answering"" to ""connected"" to ""hanging up"" to ""idle"""
       
   522  * @test GT83-TDATA-011.01 Test setting notification of a call being added to a data line
       
   523  * @test GT83-TDATA-014.05 Test opening an existing call from a data line by specifying the name of the line and the name of an existing call
       
   524  * @test GT83-TDATA-025.00 Test answering a call on a data line (Generic)
       
   525  * @test GT83-TDATA-032.01 Test setting a request for a notification of a change in the status of the mobile data line
       
   526  * @test GT83-TDATA-032.07 "Test for a notification of a change in status of the mobile data line from ""connected"" to ""disconnecting"""
       
   527  * @test GT83-TDATA-032.08 "Test for a notification of a change in status of the mobile data line from ""disconnecting"" to ""idle"""
       
   528  * @test GT83-TDATA-032.09 "Test for a notification of a change in status of the mobile data line from ""idle"" to ""ringing"""
       
   529  * @test GT83-TDATA-032.10 "Test for a notification of a change in status of the mobile data line from ""ringing"" to ""answering"""
       
   530  * @test GT83-TDATA-032.11 "Test for a notification of a change in status of the mobile data line from ""answering"" to ""connected"""
       
   531 */
       
   532 	{
       
   533 	INFO_PRINTF1(_L("======Start test Test Line Notifications"));
       
   534     //to make sure that line and call will be closed in leave case
       
   535 	CleanupStack::PushL(*this) ; 
       
   536 
       
   537 	TBuf<16> GoodNumber ;
       
   538 	GetRemoteNumber(GoodNumber) ;
       
   539 
       
   540 	// NotifyIncomingCall and NotifyStatusChange
       
   541 	TName callName1;
       
   542 	TName callName2;
       
   543 	TInt ret = KErrNone;
       
   544 	RCall::TStatus lineStatus;
       
   545 	RMobileCall::TMobileCallStatus mobileLineStatus;
       
   546 	RCall::THookStatus hookStatus;
       
   547 	RMobileCall::TMobileDataCallParamsV1 callDataParams;
       
   548 	RMobileCall::TMobileDataCallParamsV1Pckg callDataParamsPckg(callDataParams);
       
   549 
       
   550 
       
   551 	//GT83-AT-021	Test opening a data line from a phone that supports data functionality
       
   552 	INFO_PRINTF1(_L("Opening Data Line"));
       
   553 	TEST_CHECKL(iLine.Open(iPhone, KDataLineName), KErrNone, _L("GT83-TDATA-001.01"));
       
   554 
       
   555 	CConsoleBase* console = Console::NewL(KConsoleTitle,TSize(KConsFullScreen,KConsFullScreen));
       
   556     CleanupStack::PushL(console);
       
   557 	console->Printf(_L("Please ring the phone\n"));
       
   558 
       
   559 	iLine.NotifyIncomingCall(iStatus, callName1);	// wait for a call
       
   560 
       
   561 	// @test GT83-AT-026	Test setting notification of a change in the status of the data line
       
   562 	iLine.NotifyStatusChange(iStatus2, lineStatus);
       
   563 
       
   564 	iLine.NotifyMobileLineStatusChange(iStatus3, mobileLineStatus);
       
   565 
       
   566 	// @test GT83-AT-037	Test setting notification of a change in hook status of a data line	void RLine::NotifyHookChange(TRequestStatus& aStatus, THookStatus& aHookStatus)	Function does not produce any unexpected errors. aStatus = KErrPending
       
   567 	iLine.NotifyHookChange(iStatus4, hookStatus);
       
   568 
       
   569     /* @test GT83-AT-025	Test notification of a call being added to a data line 	*/
       
   570 	iLine.NotifyCallAdded(iStatus5, callName2);
       
   571 
       
   572 	CHECKPOINT(iStatus.Int(), KRequestPending, _L("GT83-TDATA-008.01")) ;
       
   573 	CHECKPOINT(iStatus2.Int(), KRequestPending, _L("GT83-TDATA-010.02")) ;
       
   574 	CHECKPOINT(iStatus3.Int(), KRequestPending, _L("GT83-TDATA-032.01")) ;
       
   575 	CHECKPOINT(iStatus4.Int(), KRequestPending, _L("GT83-TDATA-011.01")) ;
       
   576 	CHECKPOINT(iStatus5.Int(), KRequestPending, _L("GT83-TDATA-009.01")) ;
       
   577 
       
   578 	WaitWithTimeoutL(iStatus,90*KOneSecond); // but timeout after 90 seconds
       
   579 	CHECKPOINT(iStatus.Int(), KErrNone, _L("GT83-TDATA-008.02")) ;
       
   580 
       
   581 	if(iStatus.Int() == KRequestPending)
       
   582 		{
       
   583 		iLine.NotifyIncomingCallCancel();
       
   584 		User::WaitForRequest(iStatus);
       
   585 		}
       
   586 
       
   587     // @test GT83-AT-026	Test notification of a change in the status of the data line
       
   588 	// from "idle" to "ringing"
       
   589 	User::WaitForRequest(iStatus2);
       
   590 	CHECKPOINT(iStatus2.Int(), KErrNone, _L("GT83-TDATA-010.02")) ;
       
   591 	CHECKPOINT(lineStatus, RCall::EStatusRinging, _L("GT83-TDATA-010.02")) ;
       
   592 
       
   593 	User::WaitForRequest(iStatus3);
       
   594 	CHECKPOINT(iStatus3.Int(), KErrNone, _L("GT83-TDATA-032.09")) ;
       
   595 	CHECKPOINT(mobileLineStatus, RMobileCall::EStatusRinging, _L("GT83-TDATA-032.09")) ;
       
   596 
       
   597 	/* @test GT83-AT-025	Test notification of a call being added to a data line
       
   598 	that currently has no calls*/
       
   599 	User::WaitForRequest(iStatus5);
       
   600 	CHECKPOINT(iStatus5.Int(), KErrNone, _L("GT83-TDATA-011.01")) ;
       
   601 	CHECKPOINT(callName2 == callName1, 1,  _L("GT83-TDATA-011")) ;
       
   602 
       
   603 	console->Printf(_L("Please stay connected... the test will hang up shortly\n"));
       
   604 
       
   605 	INFO_PRINTF1(_L("Phone is ringing... Now answering..."));
       
   606 
       
   607 	/* @test GT83-AT-026	Test notification of a change in the status of the data line from
       
   608 	 "idle" to "ringing" to "answering" to "connected" to "hanging up" to "idle"
       
   609 	 */
       
   610 	iLine.NotifyStatusChange(iStatus2, lineStatus);
       
   611 	iLine.NotifyMobileLineStatusChange(iStatus3, mobileLineStatus);
       
   612 
       
   613 	ret = iDataCall.OpenExistingCall(iLine, callName1);
       
   614 	TEST_CHECKL(ret, KErrNone, _L("GT83-TDATA-014.05")) ;
       
   615 
       
   616 	callDataParams.iService = RMobileCall::EServiceDataCircuitAsync;
       
   617 	callDataParams.iSpeed = RMobileCall::ESpeed9600;
       
   618 	callDataParams.iProtocol = RMobileCall::EProtocolV32;
       
   619 	//callDataParams.iProtocol = RMobileCall::EProtocolIsdnMultimedia;
       
   620 
       
   621 	callDataParams.iQoS = RMobileCall::EQoSNonTransparent;
       
   622 
       
   623 
       
   624 	// Answer an incoming call initiated by t_echo.exe and obtain the call's current status
       
   625 	//GT83-AT-032	Test answering a call on a data line (Generic)	RCall::AnswerIncomingCall
       
   626 	iDataCall.AnswerIncomingCall(iStatus, callDataParamsPckg);
       
   627     // @test GT83-AT-026	Test notification of a change in the status of the data line
       
   628 	// from "ringing" to "answering"
       
   629 	User::WaitForRequest(iStatus2);
       
   630 	CHECKPOINT(iStatus2.Int(), KErrNone, _L("GT83-TDATA-010.01")) ;
       
   631 	CHECKPOINT(lineStatus, RCall::EStatusAnswering, _L("GT83-TDATA-010.01")) ;
       
   632 
       
   633 	User::WaitForRequest(iStatus3);
       
   634 	CHECKPOINT(iStatus3.Int(), KErrNone, _L("GT83-TDATA-032.10")) ;
       
   635 	CHECKPOINT(mobileLineStatus, RMobileCall::EStatusAnswering, _L("GT83-TDATA-032.10")) ;
       
   636 	WaitWithTimeoutL(iStatus,30*KOneSecond);		// but timeout after 30 seconds
       
   637 
       
   638 	//cancel AnswerIncomingCall if request is still pending
       
   639 	if(iStatus.Int() == KRequestPending)
       
   640 		{
       
   641 		iDataCall.AnswerIncomingCallCancel();
       
   642 		User::WaitForRequest(iStatus);
       
   643 		}
       
   644 
       
   645 	TEST_CHECKL(iStatus.Int(), KErrNone, _L("GT83-TDATA-025.00")) ;	  //wrong code -2147483647
       
   646 
       
   647 
       
   648     // @test GT83-AT-026	Test notification of a change in the status of the data line
       
   649 	// from "answering"	to "connected"
       
   650 	iLine.NotifyStatusChange(iStatus2, lineStatus);
       
   651 	User::WaitForRequest(iStatus2);
       
   652 	CHECKPOINT(iStatus2.Int(), KErrNone, _L("GT83-TDATA-010.01")) ;
       
   653 	CHECKPOINT(lineStatus, RCall::EStatusConnected, _L("GT83-TDATA-010.01")) ;
       
   654 
       
   655 
       
   656 	iLine.NotifyMobileLineStatusChange(iStatus3, mobileLineStatus);
       
   657 	User::WaitForRequest(iStatus3);
       
   658 	CHECKPOINT(iStatus3.Int(), KErrNone, _L("GT83-TDATA-032.11")) ;
       
   659 	CHECKPOINT(mobileLineStatus, RMobileCall::EStatusConnected, _L("GT83-TDATA-032.11")) ;
       
   660 
       
   661 	User::WaitForRequest(iStatus4);
       
   662 	CHECKPOINT(iStatus4.Int(), KErrNone, _L("GT83-TDATA-009.02")) ;
       
   663 	CHECKPOINT(hookStatus, RCall::EHookStatusOff, _L("GT83-TDATA-009.02")) ;
       
   664 
       
   665 	// now hangup call
       
   666 	iLine.NotifyStatusChange(iStatus2, lineStatus);
       
   667 	iLine.NotifyMobileLineStatusChange(iStatus3, mobileLineStatus);
       
   668 	iLine.NotifyHookChange(iStatus4, hookStatus);
       
   669 
       
   670 	INFO_PRINTF1(_L("Call connected - now hanging up..."));
       
   671 	iDataCall.HangUp(iStatus);
       
   672 	User::WaitForRequest(iStatus);
       
   673 
       
   674 	//This test has some trobles with Ericsson phones
       
   675 	//R520m could return KErrGeneral
       
   676 	//SH888 could return KErrTimedOut
       
   677 	INFO_PRINTF2(_L("iDataCall.HangUp() returned status %d"), iStatus.Int()) ;
       
   678 
       
   679     // @test GT83-AT-026	Test notification of a change in the status of the data line
       
   680 	// from "connecting" to "hanging up"
       
   681 	User::WaitForRequest(iStatus2);
       
   682 	CHECKPOINT(iStatus2.Int(), KErrNone, _L("GT83-TDATA-010.02")) ;
       
   683 	CHECKPOINT(lineStatus, RCall::EStatusHangingUp, _L("GT83-TDATA-010.02")) ;
       
   684 
       
   685 	User::WaitForRequest(iStatus3);
       
   686 	CHECKPOINT(iStatus3.Int(), KErrNone, _L("GT83-TDATA-032.07")) ;
       
   687 	CHECKPOINT(mobileLineStatus, RMobileCall::EStatusDisconnecting, _L("GT83-TDATA-032.07")) ;
       
   688 
       
   689 	// @test GT83-AT-026	Test notification of a change in the status of the data
       
   690 	// line from "hanging up" to "idle"
       
   691 	iLine.NotifyStatusChange(iStatus2, lineStatus);
       
   692 	User::WaitForRequest(iStatus2);
       
   693 	CHECKPOINT(iStatus2.Int(), KErrNone, _L("GT83-TDATA-010.02")) ;
       
   694 	CHECKPOINT(lineStatus, RCall::EStatusIdle, _L("GT83-TDATA-010.02")) ;
       
   695 
       
   696 	iLine.NotifyMobileLineStatusChange(iStatus3, mobileLineStatus);
       
   697 	User::WaitForRequest(iStatus3);
       
   698 	CHECKPOINT(iStatus3.Int(), KErrNone, _L("GT83-TDATA-032.08")) ;
       
   699 	CHECKPOINT(mobileLineStatus, RMobileCall::EStatusIdle, _L("GT83-TDATA-032.08")) ;
       
   700 
       
   701 	//!< @test GT83-AT-037	Test notification of a change in hook status of a data line
       
   702 	//!<  from "off" to "on" aHookStatus = EHookStatusOff before the hook status changes,
       
   703 	//!< and EHookStatusOn after the hook status changes
       
   704 	User::WaitForRequest(iStatus4);
       
   705 	CHECKPOINT(iStatus4.Int(), KErrNone, _L("GT83-TDATA-009.03")) ;
       
   706 	CHECKPOINT(hookStatus, RCall::EHookStatusOn, _L("GT83-TDATA-009.03")) ;
       
   707 	//check that all request has been finished
       
   708 	TEST(iStatus.Int()!= KRequestPending) ;
       
   709 	TEST(iStatus2.Int() != KRequestPending) ;
       
   710 	TEST(iStatus3.Int() != KRequestPending) ;
       
   711 	TEST(iStatus4.Int() != KRequestPending) ;
       
   712 	TEST(iStatus5.Int() != KRequestPending) ;
       
   713 
       
   714 	console->Printf(_L("...Disconnected\n"));
       
   715 	User::After(10*KOneSecond);
       
   716     CleanupStack::PopAndDestroy(console);
       
   717 
       
   718 	// Close the line and call
       
   719 	CleanupStack::PopAndDestroy() ;
       
   720 
       
   721 	INFO_PRINTF1(_L("======End test ====="));
       
   722 	return TestStepResult() ;
       
   723 	}
       
   724 //------------------------------------------------------------------
       
   725 
       
   726 CTestLineNotificationsOutgoingCall::CTestLineNotificationsOutgoingCall()
       
   727 /** Each test step initialises it's own name
       
   728 */
       
   729 	{
       
   730 	// store the name of this test case
       
   731 	// this is the name that is used by the script file
       
   732 	SetTestStepName(_L("TestLineNotificationsOutgoingCall"));
       
   733 	}
       
   734 //------------------------------------------------------------------
       
   735 
       
   736 TVerdict CTestLineNotificationsOutgoingCall::doTestStepL( void )
       
   737 /** Tests line notifications
       
   738  * @test GT83-TDATA-001.01 Test opening a data line from a phone that supports data functionality
       
   739  * @test GT83-TDATA-009.02 "Test notification of a change in hook status of a data line from ""off"" to ""on"""
       
   740  * @test GT83-TDATA-009.03 "Test notification of a change in hook status of a data line from ""on"" to off"""
       
   741  * @test GT83-TDATA-010.03 "Test notification of a change in the status of the data line from ""idle"" to ""dialling"" to ""connecting"" to ""connected"" to ""hanging up"" to ""idle"""
       
   742  * @test GT83-TDATA-014.05 Test opening an existing call from a data line by specifying the name of the line and the name of an existing call
       
   743  * @test GT83-TDATA-032.02 "Test for a notification of a change in status of the mobile data line from ""idle"" to ""dialling"""
       
   744  * @test GT83-TDATA-032.04 "Test for a notification of a change in status of the mobile data line from ""connecting"" to ""connected"""
       
   745  * @test GT83-TDATA-032.07 "Test for a notification of a change in status of the mobile data line from ""connected"" to ""disconnecting"""
       
   746  * @test GT83-TDATA-032.08 "Test for a notification of a change in status of the mobile data line from ""disconnecting"" to ""idle"""
       
   747 */
       
   748 	{
       
   749 	INFO_PRINTF1(_L("======Start test Test Line Notifications"));
       
   750     //to make sure that line and call will be closed in leave case
       
   751 	CleanupStack::PushL(*this) ; 
       
   752 
       
   753 	TBuf<16> GoodNumber ;
       
   754 	GetRemoteNumber(GoodNumber) ;
       
   755 
       
   756 	// NotifyIncomingCall and NotifyStatusChange
       
   757 	TInt ret = KErrNone;
       
   758 	RCall::TStatus lineStatus;
       
   759 	RMobileCall::TMobileCallStatus mobileLineStatus;
       
   760 	RCall::THookStatus hookStatus;
       
   761 	RMobileCall::TMobileDataCallParamsV1 callDataParams;
       
   762 	RMobileCall::TMobileDataCallParamsV1Pckg callDataParamsPckg(callDataParams);
       
   763 
       
   764 
       
   765 	//GT83-AT-021	Test opening a data line from a phone that supports data functionality
       
   766 	INFO_PRINTF1(_L("Opening Data Line"));
       
   767 	TEST_CHECKL(iLine.Open(iPhone, KDataLineName), KErrNone, _L("GT83-TDATA-001.01"));
       
   768 
       
   769 	ret = iDataCall.OpenNewCall(iLine);
       
   770 	TEST_CHECKL(ret, KErrNone, _L("GT83-TDATA-014.05")) ;
       
   771 	// Now test call status during an outgoing call
       
   772 	callDataParams.iService = RMobileCall::EServiceDataCircuitAsync;
       
   773 	callDataParams.iSpeed = RMobileCall::ESpeed9600;
       
   774 	callDataParams.iProtocol = RMobileCall::EProtocolV32;
       
   775 	callDataParams.iQoS = RMobileCall::EQoSNonTransparent;
       
   776 
       
   777 	iLine.NotifyStatusChange(iStatus2, lineStatus);
       
   778 	iLine.NotifyMobileLineStatusChange(iStatus3, mobileLineStatus);
       
   779 	iLine.NotifyHookChange(iStatus4, hookStatus);
       
   780 
       
   781 	CConsoleBase* console = Console::NewL(KConsoleTitle,TSize(KConsFullScreen,KConsFullScreen));
       
   782     CleanupStack::PushL(console);
       
   783 	console->Printf(_L("Calling...\n"));
       
   784 
       
   785 	INFO_PRINTF2(_L("Dialling %S...."), &GoodNumber);
       
   786 	iDataCall.Dial(iStatus, callDataParamsPckg, GoodNumber);
       
   787 
       
   788 	User::WaitForRequest(iStatus2);
       
   789 	CHECKPOINT(iStatus2.Int(), KErrNone, _L("GT83-TDATA-010.03")) ;
       
   790 	CHECKPOINT(lineStatus, RCall::EStatusDialling, _L("GT83-TDATA-010.03")) ;
       
   791 
       
   792 	User::WaitForRequest(iStatus3);
       
   793 	CHECKPOINT(iStatus3.Int(), KErrNone, _L("GT83-TDATA-032.02")) ;
       
   794 	CHECKPOINT(mobileLineStatus, RMobileCall::EStatusDialling, _L("GT83-TDATA-032.02")) ;
       
   795 
       
   796 	User::WaitForRequest(iStatus); //whaiting for dial
       
   797 	TEST_CHECKL(iStatus.Int(), KErrNone, _L("GT83-TDATA-0")) ;
       
   798 
       
   799 	User::WaitForRequest(iStatus4);
       
   800 	CHECKPOINT(iStatus4.Int(), KErrNone, _L("GT83-TDATA-009.03")) ;
       
   801 	CHECKPOINT(hookStatus, RCall::EHookStatusOff, _L("GT83-TDATA-009.03")) ;
       
   802 
       
   803 	iLine.NotifyStatusChange(iStatus2, lineStatus);
       
   804 	iLine.NotifyMobileLineStatusChange(iStatus3, mobileLineStatus);
       
   805 
       
   806 	User::WaitForRequest(iStatus2);
       
   807 	CHECKPOINT(iStatus2.Int(), KErrNone, _L("GT83-TDATA-010.03")) ;
       
   808 	CHECKPOINT(lineStatus, RCall::EStatusConnected, _L("GT83-TDATA-010.03")) ;
       
   809 
       
   810 	User::WaitForRequest(iStatus3);
       
   811 	CHECKPOINT(iStatus3.Int(), KErrNone, _L("GT83-TDATA-032.13")) ;
       
   812 	CHECKPOINT(mobileLineStatus, RMobileCall::EStatusConnected, _L("GT83-TDATA-032.13")) ;
       
   813 
       
   814 	console->Printf(_L("Please stay connected... the test will hang up shortly\n"));
       
   815 
       
   816 	INFO_PRINTF1(_L("Call connected - hanging up..."));
       
   817 
       
   818 	iLine.NotifyStatusChange(iStatus2, lineStatus);
       
   819 	iLine.NotifyMobileLineStatusChange(iStatus3, mobileLineStatus);
       
   820 	iLine.NotifyHookChange(iStatus4, hookStatus);
       
   821 
       
   822 	//HANG UP
       
   823 	User::After(10*KOneSecond);
       
   824 	iDataCall.HangUp(iStatus);
       
   825 	User::WaitForRequest(iStatus);
       
   826 	TEST_CHECKL(iStatus.Int(), KErrNone, _L("*** Failed to Hang Up. If you are using an Ericsson phone, this is a PHONE related problem! ***")) ;
       
   827 
       
   828 	//This test has some trobles with Ericsson phones
       
   829 	//R520m could return KErrGeneral
       
   830 	//SH888 could return KErrTimedOut
       
   831 	INFO_PRINTF2(_L("iDataCall.HangUp() returned status %d"), iStatus.Int()) ;
       
   832 
       
   833 	User::WaitForRequest(iStatus2);
       
   834 	CHECKPOINT(iStatus2.Int(), KErrNone, _L("GT83-TDATA-010.03")) ;
       
   835 	CHECKPOINT(lineStatus, RCall::EStatusHangingUp, _L("GT83-TDATA-010.03")) ;
       
   836 
       
   837 	User::WaitForRequest(iStatus3);
       
   838 	CHECKPOINT(iStatus3.Int(), KErrNone, _L("GT83-TDATA-032.07")) ;
       
   839 	CHECKPOINT(mobileLineStatus, RMobileCall::EStatusDisconnecting, _L("GT83-TDATA-032.07")) ;
       
   840 
       
   841 	/* @test GT83-AT-037	Test notification of a change in hook status of a data
       
   842 	 line from "on" to off"	aHookStatus = EHookStatusOn before the hook status changes,
       
   843 	 */
       
   844 	User::WaitForRequest(iStatus4);
       
   845 	CHECKPOINT(iStatus4.Int(), KErrNone, _L("GT83-TDATA-009.02")) ;
       
   846 	CHECKPOINT(hookStatus, RCall::EHookStatusOn, _L("GT83-TDATA-009.02")) ;
       
   847 
       
   848 	iLine.NotifyStatusChange(iStatus2, lineStatus);
       
   849 	iLine.NotifyMobileLineStatusChange(iStatus3, mobileLineStatus);
       
   850 
       
   851 	User::WaitForRequest(iStatus2);
       
   852 	CHECKPOINT(iStatus2.Int(), KErrNone, _L("GT83-TDATA-010.03")) ;
       
   853 	CHECKPOINT(lineStatus, RCall::EStatusIdle, _L("GT83-TDATA-010.03")) ;
       
   854 
       
   855 	User::WaitForRequest(iStatus3);
       
   856 	CHECKPOINT(iStatus3.Int(), KErrNone, _L("GT83-TDATA-032.08")) ;
       
   857 	CHECKPOINT(mobileLineStatus, RMobileCall::EStatusIdle, _L("GT83-TDATA-032.08")) ;
       
   858 
       
   859 	TEST(iStatus != KRequestPending) ;
       
   860 	TEST(iStatus2 != KRequestPending) ;
       
   861 	TEST(iStatus3 != KRequestPending) ;
       
   862 	TEST(iStatus4 != KRequestPending) ;
       
   863 
       
   864 	console->Printf(_L("...Disconnected\n"));
       
   865 	User::After(10*KOneSecond);
       
   866     CleanupStack::PopAndDestroy(console);
       
   867 
       
   868 	// Close the line and call
       
   869 	CleanupStack::PopAndDestroy() ;
       
   870 
       
   871 	INFO_PRINTF1(_L("======End test ====="));
       
   872 	return TestStepResult() ;
       
   873 	}
       
   874 //------------------------------------------------------------------
       
   875 
       
   876 CTestLineCancels::CTestLineCancels()
       
   877 /** Each test step initialises it's own name
       
   878 */
       
   879 	{
       
   880 	// store the name of this test case
       
   881 	// this is the name that is used by the script file
       
   882 	SetTestStepName(_L("TestLineCancels"));
       
   883 	}
       
   884 //------------------------------------------------------------------
       
   885 
       
   886 TVerdict CTestLineCancels::doTestStepL( void )
       
   887 /**
       
   888  * @test GT83-TDATA-001.01 Test opening a data line from a phone that supports data functionality
       
   889  * @test GT83-TDATA-008.02 Test for a notification when there is an incoming call on a data line
       
   890  * @test GT83-TDATA-008.03 Test the ability to cancel the notification of an incoming call on a data line
       
   891  * @test GT83-TDATA-009.01 Test setting notification of a change in hook status of a data line
       
   892  * @test GT83-TDATA-009.04 Test the ability to cancel a notification of a change in hook status of a data line
       
   893  * @test GT83-TDATA-010.02 "Test notification of a change in the status of the data line from ""idle"" to ""ringing"" to ""answering"" to ""connected"" to ""hanging up"" to ""idle"""
       
   894  * @test GT83-TDATA-010.04 Test the ability to cancel the notification of a change in the status of the data line
       
   895  * @test GT83-TDATA-011.01 Test setting notification of a call being added to a data line
       
   896  * @test GT83-TDATA-011.03 Test the ability to cancel a notification of a call being added to a data line
       
   897 */
       
   898 	{
       
   899 	INFO_PRINTF1(_L("======Start test Test Line Cancels"));
       
   900     //to make sure that line and call will be closed in leave case
       
   901 	CleanupStack::PushL(*this) ; ;
       
   902 
       
   903 	// Notify Incoming Call
       
   904 	TName callName;
       
   905 	//GT83-AT-021	Test opening a data line from a phone that supports data functionality
       
   906 	INFO_PRINTF1(_L("Opening Data Line"));
       
   907 	TEST_CHECKL(iLine.Open(iPhone, KDataLineName), KErrNone, _L("GT83-TDATA-001.01"));
       
   908 
       
   909 	iLine.NotifyIncomingCall(iStatus, callName);
       
   910 	CHECKPOINT(iStatus.Int(), KRequestPending, _L("GT83-TDATA-008.02")) ;
       
   911 	iLine.NotifyIncomingCallCancel();
       
   912 	User::WaitForRequest(iStatus);
       
   913 	CHECKPOINT(iStatus.Int(), KErrCancel, _L("GT83-TDATA-008.03")) ;
       
   914 
       
   915 	// Notify Status Change
       
   916 	RCall::TStatus lineStatus;
       
   917 	iLine.NotifyStatusChange(iStatus, lineStatus);
       
   918 	CHECKPOINT(iStatus.Int(), KRequestPending, _L("GT83-TDATA-010.02")) ;
       
   919 	User::After(KTenPartOfSec); //snack some sleep
       
   920 	/** @test GT83-AT-026 Test the ability to cancel the notification of a change in the
       
   921 	 status of the data line	aStatus = KErrCancel provided that the function
       
   922 	 being cancelled has not already completed */
       
   923 	iLine.NotifyStatusChangeCancel();
       
   924 	User::WaitForRequest(iStatus);
       
   925 	CHECKPOINT(iStatus.Int(), KErrCancel, _L("GT83-TDATA-010.04")) ;
       
   926 #if 0  //cancel functions don't work yet (?)
       
   927 	   //any way they are not declared 27.09.2001
       
   928 	// Notify Mobile Status Change
       
   929 	RMobileCall::TMobileCallStatus lineStatus2;
       
   930 	iLine.NotifyMobileLineStatusChange(iStatus, lineStatus2);
       
   931 	CHECKPOINT(iStatus.Int(), KRequestPending, _L("GT83-TDATA-0")) ;
       
   932 	iLine.NotifyMobileLineStatusChangeCancel();
       
   933 	User::WaitForRequest(iStatus);
       
   934 	CHECKPOINT(iStatus.Int(), KErrCancel, _L("GT83-TDATA-0")) ;
       
   935 #endif
       
   936 	// Notify Hook Change
       
   937 	RCall::THookStatus hookStatus;
       
   938 	iLine.NotifyHookChange(iStatus, hookStatus);
       
   939 	CHECKPOINT(iStatus.Int(), KRequestPending, _L("GT83-TDATA-009.01")) ;
       
   940 	User::After(KTenPartOfSec); //snack some sleep
       
   941 	// @test GT83-AT-037	Test the ability to cancel a notification of a
       
   942 	// change in hook status of a data line
       
   943 	// aStatus = KErrCancel provided that the function being cancelled has not already completed
       
   944 	iLine.NotifyHookChangeCancel();
       
   945 	User::WaitForRequest(iStatus);
       
   946 	CHECKPOINT(iStatus.Int(), KErrCancel, _L("GT83-TDATA-009.04")) ;
       
   947 
       
   948 	// Notify Call Added
       
   949 	iLine.NotifyCallAdded(iStatus, callName);
       
   950 	CHECKPOINT(iStatus.Int(), KRequestPending, _L("GT83-TDATA-011.01")) ;
       
   951 	User::After(KTenPartOfSec); //snack some sleep
       
   952 	/** GT83-AT-025	Test the ability to cancel a notification of a call being added
       
   953 	to a data line*/
       
   954 	iLine.NotifyCallAddedCancel();
       
   955 	User::WaitForRequest(iStatus);
       
   956 	CHECKPOINT(iStatus.Int(), KErrCancel, _L("GT83-TDATA-011.03")) ;
       
   957 
       
   958 	// Close the line and call
       
   959 	CleanupStack::PopAndDestroy() ;
       
   960 
       
   961 	INFO_PRINTF1(_L("======End test ====="));
       
   962 	return TestStepResult() ;
       
   963 	}
       
   964 //------------------------------------------------------------------
       
   965 
       
   966 CTestCallInfo::CTestCallInfo()
       
   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 	SetTestStepName(_L("TestCallInfo"));
       
   973 	}
       
   974 //------------------------------------------------------------------
       
   975 
       
   976 TVerdict CTestCallInfo::doTestStepL( void )
       
   977 /**
       
   978  * This function gets information pertaining to a call:
       
   979  * Bearer Service Information, Call duration
       
   980  * @test GT83-TDATA-001.01 Test opening a data line from a phone that supports data functionality
       
   981  * @test GT83-TDATA-009.02 "Test notification of a change in hook status of a data line from ""off"" to ""on"""
       
   982  * @test GT83-TDATA-013.06 Test opening a new call by specifying the name of a line
       
   983  * @test GT83-TDATA-018.01 "Test retrieval of the bearer service info of a call. Display to screen, all the bearer service information associated with the call."
       
   984  * @test GT83-TDATA-022.01 Test retrieval of the duration of a data call. Display the call duration to screen
       
   985  * @test GT83-TDATA-023.01 Test the ability to get the current call information of the data call. Display the call information to screen.
       
   986  * @test GT83-TDATA-025.00 Test answering a call on a data line (Generic)
       
   987  */
       
   988 	{
       
   989 	INFO_PRINTF1(_L("======Start test Test Call Information"));
       
   990     //to make sure that line and call will be closed in leave case
       
   991 	CleanupStack::PushL(*this) ; ;
       
   992 	// Open a Data line and Call
       
   993 	//GT83-AT-021	Test opening a data line from a phone that supports data functionality
       
   994 	RMobileCall::TMobileDataCallParamsV1 callDataParams;
       
   995 	RMobileCall::TMobileDataCallParamsV1Pckg callDataParamsPckg(callDataParams);
       
   996 
       
   997 	INFO_PRINTF1(_L("Opening Data Line"));
       
   998 	TEST_CHECKL(iLine.Open(iPhone, KDataLineName), KErrNone, _L("GT83-TDATA-001.01"));
       
   999 	INFO_PRINTF1(_L("Opening New Data Call"));
       
  1000 	TEST_CHECKL(iDataCall.OpenNewCall(iLine), KErrNone, _L("GT83-TDATA-013.06"));
       
  1001 	//get status
       
  1002 	//GT83-AT-026	Test retrieval of a data line's current status.
       
  1003 	RCall::TStatus callStatus;
       
  1004 	CHECKPOINT(iDataCall.GetStatus(callStatus), KErrNone, _L("GT83-TD-015.02")) ;
       
  1005 	CHECKPOINT(callStatus, RCall::EStatusIdle, _L("GT83-TD-015.02")) ;
       
  1006 
       
  1007 	INFO_PRINTF2(_L("Call Status = %d"), callStatus);
       
  1008 	Print_RCall_TStatus(callStatus) ;
       
  1009 
       
  1010 
       
  1011 	callDataParams.iService = RMobileCall::EServiceDataCircuitAsync;
       
  1012 	callDataParams.iSpeed = RMobileCall::ESpeed9600;
       
  1013 	callDataParams.iProtocol = RMobileCall::EProtocolV32;
       
  1014 	callDataParams.iQoS = RMobileCall::EQoSNonTransparent;
       
  1015 
       
  1016 
       
  1017 	// Wait for an incoming call, then get the Call BearerServiceInfo. The
       
  1018 	// Bearer Service Info is only available if the call is currently active
       
  1019 	CConsoleBase* console = Console::NewL(KConsoleTitle,TSize(KConsFullScreen,KConsFullScreen));
       
  1020     CleanupStack::PushL(console);
       
  1021 	console->Printf(_L("Please ring the phone\n"));
       
  1022 
       
  1023 	// Answer an incoming call initiated by t_echo.exe and obtain the call's current status
       
  1024 	//GT83-AT-032	Test answering a call on a data line (Generic)	RCall::AnswerIncomingCall
       
  1025 	iDataCall.AnswerIncomingCall(iStatus, callDataParamsPckg);
       
  1026 	WaitWithTimeoutL(iStatus,60*KOneSecond);		// but timeout after 60 seconds
       
  1027 
       
  1028 	//cancel AnswerIncomingCall if request is still pending
       
  1029 	if(iStatus.Int() == KRequestPending)
       
  1030 		{
       
  1031 		iDataCall.AnswerIncomingCallCancel();
       
  1032 		User::WaitForRequest(iStatus);
       
  1033 		}
       
  1034 	console->Printf(_L("Please stay connected... the test will hang up shortly\n"));
       
  1035 
       
  1036 	TEST_CHECKL(iStatus.Int(), KErrNone, _L("GT83-TDATA-025.00")) ;
       
  1037 
       
  1038 	// User Information
       
  1039 	INFO_PRINTF1(_L("\nThe call is now connected.\nRetrieving Call Information."));
       
  1040 
       
  1041 	// Bearer Service Information
       
  1042 	INFO_PRINTF1(_L("\nGet Bearer Service Info..."));
       
  1043 	RCall::TBearerService bearerServiceInfo;
       
  1044 	TInt ret=iDataCall.GetBearerServiceInfo(bearerServiceInfo);
       
  1045 	CHECKPOINT_EXPR((ret==KErrNone || ret==KErrNotSupported), _L("GT83-TDATA-018.01")) ;
       
  1046 	if (ret==KErrNotSupported)
       
  1047 		INFO_PRINTF1(_L("Get BearerService Information is NOT Supported"));
       
  1048 	if (ret==KErrNone)
       
  1049 		INFO_PRINTF1(_L("Get BearerService Information is successful"));
       
  1050 
       
  1051 	// Get Call Information
       
  1052 	INFO_PRINTF1(_L("\nGet Current Call Info..."));
       
  1053 	ret=iDataCall.GetInfo(iCallInfo);
       
  1054 	CHECKPOINT_EXPR((ret==KErrNone || ret==KErrNotSupported), _L("GT83-TDATA-023.01")) ;
       
  1055 	if (ret==KErrNotSupported)
       
  1056 		{
       
  1057 		INFO_PRINTF1(_L("Get Current Call info is NOT Supported"));
       
  1058 		}
       
  1059 	if (ret==KErrNone)
       
  1060 		{
       
  1061 		INFO_PRINTF1(_L("Displaying Information about the Current Call"));
       
  1062 		INFO_PRINTF2(TRefByValue<const TDesC>(_L("Call name: %S")), &iCallInfo.iCallName);
       
  1063 		INFO_PRINTF2(TRefByValue<const TDesC>(_L("Line name: %S")), &iCallInfo.iLineName);
       
  1064 		if (iCallInfo.iHookStatus==RCall::EHookStatusOff)
       
  1065 			{
       
  1066 			INFO_PRINTF1(_L("Current Hook Status: Off"));
       
  1067 			}
       
  1068 		if (iCallInfo.iStatus==RCall::EStatusConnected)
       
  1069 			{
       
  1070 			INFO_PRINTF1(_L("Current Call Status: Connected"));
       
  1071 			}
       
  1072 		INFO_PRINTF2(TRefByValue<const TDesC>(_L("Call Duration: %d seconds")), iCallInfo.iDuration.Int());
       
  1073 		}
       
  1074 
       
  1075 	// Hang up the Call
       
  1076 	User::After(5*KOneSecond);
       
  1077 
       
  1078 	// Call Duration
       
  1079 	INFO_PRINTF1(_L("Get Call Duration..."));
       
  1080 	TTimeIntervalSeconds callDuration2;
       
  1081 	ret=iDataCall.GetCallDuration(callDuration2);
       
  1082 	CHECKPOINT_EXPR((ret==KErrNone || ret==KErrNotSupported), _L("GT83-TDATA-022.01")) ;
       
  1083 	if (ret==KErrNotSupported)
       
  1084 		{
       
  1085 		INFO_PRINTF1(_L("Get Current Call Duration is NOT Supported"));
       
  1086 		}
       
  1087 	if (ret==KErrNone)
       
  1088 		{
       
  1089 		INFO_PRINTF2(TRefByValue<const TDesC>(_L("Call duration = %d")), callDuration2.Int());
       
  1090 		}
       
  1091 
       
  1092 	iDataCall.HangUp(iStatus);
       
  1093 	User::WaitForRequest(iStatus);
       
  1094 	TEST_CHECKL(iStatus.Int(), KErrNone, _L("*** Failed to Hang Up. If you are using an Ericsson phone, this is a PHONE related problem! ***")) ;
       
  1095 
       
  1096 	//This test has some trobles with Ericsson phones
       
  1097 	//R520m could return KErrGeneral
       
  1098 	//SH888 could return KErrTimedOut
       
  1099 	INFO_PRINTF2(_L("iDataCall.HangUp() returned status %d"), iStatus.Int()) ;
       
  1100 
       
  1101 	console->Printf(_L("...Disconnected\n"));
       
  1102 	User::After(10*KOneSecond);
       
  1103     CleanupStack::PopAndDestroy(console);
       
  1104 
       
  1105 	// Close the line and call
       
  1106 	CleanupStack::PopAndDestroy() ;
       
  1107 
       
  1108 	INFO_PRINTF1(_L("======End test ====="));
       
  1109 	return TestStepResult() ;
       
  1110 	}
       
  1111 //------------------------------------------------------------------
       
  1112 
       
  1113 CTestCallNotifications::CTestCallNotifications()
       
  1114 /** Each test step initialises it's own name
       
  1115 */
       
  1116 	{
       
  1117 	// store the name of this test case
       
  1118 	// this is the name that is used by the script file
       
  1119 	SetTestStepName(_L("TestCallNotifications"));
       
  1120 	}
       
  1121 //------------------------------------------------------------------
       
  1122 
       
  1123 TVerdict CTestCallNotifications::doTestStepL( void )
       
  1124 /**
       
  1125  * @test GT83-TDATA-001.01 Test opening a data line from a phone that supports data functionality
       
  1126  * @test GT83-TDATA-002.01 Test retrieval of a data line's capabilities. Display the capabilities to screen
       
  1127  * @test GT83-TDATA-008.01 Test setting notification of an incoming call on a data line
       
  1128  * @test GT83-TDATA-009.02 "Test notification of a change in hook status of a data line from ""off"" to ""on"""
       
  1129  * @test GT83-TDATA-009.03 "Test notification of a change in hook status of a data line from ""on"" to off"""
       
  1130  * @test GT83-TDATA-013.06 Test opening a new call by specifying the name of a line
       
  1131  * @test GT83-TDATA-014.05 Test opening an existing call from a data line by specifying the name of the line and the name of an existing call
       
  1132  * @test GT83-TDATA-015.04 "Test retrieval of the current call status when the call's status is ""ringing"""
       
  1133  * @test GT83-TDATA-015.05 "Test retrieval of the current call status when the call's status is ""answering"""
       
  1134  * @test GT83-TDATA-017.02 Test notification of a change in the call's capabilities. Print the call's capabilities to screen
       
  1135  * @test GT83-TDATA-020.02 "Test notification of a change in the status of the data call from ""idle"" to ""ringing"" to ""answering"" to ""connected"" to ""hanging up"" to ""idle"""
       
  1136  * @test GT83-TDATA-021.01 Test setting notification of a change in the data call's duration
       
  1137  * @test GT83-TDATA-025.00 Test answering a call on a data line (Generic)
       
  1138  * @test GT83-TDATA-034.01 Test setting notification of a change in the call's dynamic call control and call event capabilities
       
  1139  * @test GT83-TDATA-034.02 Test notification of a change in the call's dynamic call control and call event capabilities. Print the call's capabilities to screen
       
  1140  * @test GT83-TDATA-035.04 "Test retrieval of the current status of the data call when the call's status is ""ringing"""
       
  1141  * @test GT83-TDATA-036.07 "Test for a notification of a change in status of the mobile data call from ""connected"" to ""disconnecting"""
       
  1142  * @test GT83-TDATA-036.08 "Test for a notification of a change in status of the mobile data call from ""disconnecting"" to ""idle"""
       
  1143  * @test GT83-TDATA-036.10 "Test for a notification of a change in status of the mobile data call from ""ringing"" to ""answering"""
       
  1144  * @test GT83-TDATA-036.11 "Test for a notification of a change in status of the mobile data call from ""answering"" to ""connected"""
       
  1145 */
       
  1146 
       
  1147 	{
       
  1148 	// Post call status change notifications
       
  1149 	INFO_PRINTF1(_L("======Start test Test Call Notifications"));
       
  1150 	TName callName1;
       
  1151     //to make sure that line and call will be closed in leave case
       
  1152 	CleanupStack::PushL(*this) ; ;
       
  1153 
       
  1154 	RMobileCall::TMobileDataCallParamsV1 callDataParams;
       
  1155 	RMobileCall::TMobileDataCallParamsV1Pckg callDataParamsPckg(callDataParams);
       
  1156 
       
  1157 	RCall::TStatus callStatus;
       
  1158 	RMobileCall::TMobileCallStatus mobileCallStatus;
       
  1159 
       
  1160 	RCall::TCaps caps;
       
  1161 	RCall::THookStatus hookStatus;
       
  1162 	TTimeIntervalSeconds time;
       
  1163 
       
  1164 	RMobileCall::TMobileCallCapsV1 mobileCallCaps;
       
  1165 	RMobileCall::TMobileCallCapsV1Pckg mobileCallCapsPckg(mobileCallCaps);
       
  1166 
       
  1167 	// Open a Data line and Call
       
  1168 	//GT83-AT-021	Test opening a data line from a phone that supports data functionality
       
  1169 	INFO_PRINTF1(_L("Opening Data Line"));
       
  1170 	TEST_CHECKL(iLine.Open(iPhone, KDataLineName), KErrNone, _L("GT83-TDATA-001.01"));
       
  1171 
       
  1172 	iLine.NotifyIncomingCall(iStatus, callName1);	// wait for a call
       
  1173 
       
  1174 	CHECKPOINT(iStatus.Int(), KRequestPending, _L("GT83-TDATA-008.01")) ;
       
  1175 	CConsoleBase* console = Console::NewL(KConsoleTitle,TSize(KConsFullScreen,KConsFullScreen));
       
  1176     CleanupStack::PushL(console);
       
  1177 	console->Printf(_L("Please ring the phone\n"));
       
  1178 
       
  1179 	WaitWithTimeoutL(iStatus,90*KOneSecond); // but timeout after 90 seconds
       
  1180 	CHECKPOINT(iStatus.Int(), KErrNone, _L("GT83-TDATA-008.01")) ;
       
  1181 	if(iStatus.Int() == KRequestPending)
       
  1182 		{
       
  1183 		iLine.NotifyIncomingCallCancel();
       
  1184 		User::WaitForRequest(iStatus);
       
  1185 		}
       
  1186 
       
  1187 
       
  1188 	TInt ret = iDataCall.OpenExistingCall(iLine, callName1);
       
  1189 	TEST_CHECKL(ret, KErrNone, _L("GT83-TDATA-014.05")) ;
       
  1190 
       
  1191 	iDataCall.GetStatus(callStatus);
       
  1192 	CHECKPOINT(callStatus, RCall::EStatusRinging, _L("GT83-TDATA-015.04")) ;
       
  1193 	iDataCall.GetMobileCallStatus(mobileCallStatus);
       
  1194 	CHECKPOINT(mobileCallStatus, RMobileCall::EStatusRinging, _L("GT83-TDATA-035.04")) ;
       
  1195 
       
  1196 	ret=iDataCall.GetCaps(caps);
       
  1197 	Print_TCapsEnum(caps) ;
       
  1198 	CHECKPOINT(ret, KErrNone, _L("GT83-TDATA-002.01")) ;
       
  1199 	TEST(caps.iFlags==(RCall::KCapsData | RCall::KCapsAnswer));
       
  1200 
       
  1201 //	INFO_PRINTF1(_L("Opening New Data Call"));
       
  1202 //	TEST_CHECKL(iiDataCall.OpenExistingCall(theLine, callName2), KErrNone, _L("GT83-TDATA-013.06")) ;
       
  1203 
       
  1204 	iDataCall.NotifyStatusChange(iStatus2, callStatus);
       
  1205 	iDataCall.NotifyMobileCallStatusChange(iStatus3, mobileCallStatus);
       
  1206 	iDataCall.NotifyCapsChange(iStatus4, caps);
       
  1207 	iDataCall.NotifyHookChange(iStatus5, hookStatus);
       
  1208 	iDataCall.NotifyCallDurationChange(iStatus6, time) ;
       
  1209 	iDataCall.NotifyMobileCallCapsChange(iStatus7, mobileCallCapsPckg);
       
  1210 
       
  1211 	console->Printf(_L("Please stay connected... the test will hang up shortly\n"));
       
  1212 
       
  1213 	INFO_PRINTF1(_L("Phone is ringing... Now answering..."));
       
  1214 
       
  1215 	callDataParams.iService = RMobileCall::EServiceDataCircuitAsync;
       
  1216 	callDataParams.iSpeed = RMobileCall::ESpeed9600;
       
  1217 	callDataParams.iProtocol = RMobileCall::EProtocolV32;
       
  1218 	//callDataParams.iProtocol = RMobileCall::EProtocolIsdnMultimedia;
       
  1219 	callDataParams.iQoS = RMobileCall::EQoSNonTransparent;
       
  1220 	//GT83-AT-032	Test answering a call on a data line (Generic)	RCall::AnswerIncomingCall
       
  1221 	iDataCall.AnswerIncomingCall(iStatus, callDataParamsPckg);
       
  1222 
       
  1223 	iDataCall.GetStatus(callStatus);
       
  1224 	CHECKPOINT(callStatus, RCall::EStatusRinging, _L("GT83-TDATA-015.05")) ;
       
  1225 
       
  1226 	WaitWithTimeoutL(iStatus,60*KOneSecond);		// but timeout after 60 seconds
       
  1227 
       
  1228 	//cancel AnswerIncomingCall if request is still pending
       
  1229 	if(iStatus.Int() == KRequestPending)
       
  1230 		{
       
  1231 		iDataCall.AnswerIncomingCallCancel();
       
  1232 		User::WaitForRequest(iStatus);
       
  1233 		}
       
  1234 
       
  1235 	TEST_CHECKL(iStatus.Int(), KErrNone, _L("GT83-TDATA-025.00")) ;
       
  1236 
       
  1237 
       
  1238 	//iDataCall.NotifyStatusChange(iStatus2, callStatus);
       
  1239 	User::WaitForRequest(iStatus2);
       
  1240 	CHECKPOINT(iStatus2.Int(), KErrNone, _L("GT83-TDATA-020.02")) ;
       
  1241 	CHECKPOINT(callStatus, RCall::EStatusAnswering, _L("GT83-TDATA-020.10")) ;
       
  1242 
       
  1243 	User::WaitForRequest(iStatus3);
       
  1244 	CHECKPOINT(iStatus3.Int(), KErrNone, _L("GT83-TDATA-036.10")) ;
       
  1245 	CHECKPOINT(mobileCallStatus, RMobileCall::EStatusAnswering, _L("GT83-TDATA-036.10")) ;
       
  1246 
       
  1247 	iDataCall.NotifyStatusChange(iStatus2, callStatus);
       
  1248 	User::WaitForRequest(iStatus2);
       
  1249 	CHECKPOINT(iStatus2.Int(), KErrNone, _L("GT83-TDATA-020.02")) ;
       
  1250 	CHECKPOINT(callStatus, RCall::EStatusConnected, _L("GT83-TDATA-020.02")) ;
       
  1251 
       
  1252 	iDataCall.NotifyMobileCallStatusChange(iStatus3, mobileCallStatus);
       
  1253 	User::WaitForRequest(iStatus3);
       
  1254 	CHECKPOINT(iStatus3.Int(), KErrNone, _L("GT83-TDATA-036.11")) ;
       
  1255 	CHECKPOINT(mobileCallStatus, RMobileCall::EStatusConnected, _L("GT83-TDATA-036.11")) ;
       
  1256 
       
  1257 	User::WaitForRequest(iStatus4);
       
  1258 	CHECKPOINT(iStatus4.Int(), KErrNone, _L("GT83-TDATA-017.02")) ;
       
  1259 	Print_TCapsEnum(caps) ;
       
  1260 	CHECKPOINT(caps.iFlags, RCall::KCapsData, _L("GT83-TDATA-017.02")) ;
       
  1261 
       
  1262 	iDataCall.NotifyCapsChange(iStatus4, caps);
       
  1263 	User::WaitForRequest(iStatus4);
       
  1264 	CHECKPOINT(iStatus4.Int(), KErrNone, _L("GT83-TDATA-017.02")) ;
       
  1265 	//TEST_CHECKL(caps.iFlags, (RCall::KCapsData | RCall::KCapsHangUp), _L("GT83-TDATA-017.02")) ;
       
  1266 	//MKV error
       
  1267 
       
  1268 	User::WaitForRequest(iStatus5);
       
  1269 	CHECKPOINT(iStatus5.Int(), KErrNone, _L("GT83-TDATA-009.03")) ;
       
  1270 	CHECKPOINT(hookStatus, RCall::EHookStatusOff, _L("GT83-TDATA-009.03")) ;
       
  1271 
       
  1272 	User::WaitForRequest(iStatus6);
       
  1273 	CHECKPOINT_EXPR((iStatus6.Int()==KErrNone || iStatus6.Int()==KErrNotSupported), _L("GT83-TDATA-021.01")) ;
       
  1274 	if (iStatus6==KErrNotSupported)
       
  1275 		{
       
  1276 		INFO_PRINTF1(_L("Notify Call Duration Change is NOT Supported"));
       
  1277 		}
       
  1278 	if (iStatus6==KErrNone)
       
  1279 		{
       
  1280 		INFO_PRINTF2(TRefByValue<const TDesC>(_L("Call duration = %d")), time.Int());
       
  1281 		}
       
  1282 
       
  1283 	User::WaitForRequest(iStatus7);
       
  1284 	CHECKPOINT(iStatus7.Int(), KErrNone, _L("GT83-TDATA-034.01")) ;
       
  1285 	CHECKPOINT(mobileCallCaps.iCallControlCaps, RCall::KCapsData, _L("GT83-TDATA-034.01")) ;
       
  1286 	iDataCall.NotifyMobileCallCapsChange(iStatus7, mobileCallCapsPckg);
       
  1287 	User::WaitForRequest(iStatus7);
       
  1288 	CHECKPOINT(iStatus7.Int(), KErrNone, _L("GT83-TDATA-034.02")) ;
       
  1289 	//TEST_CHECKL(mobileCallCaps.iCallControlCaps, (RCall::KCapsData | RCall::KCapsHangUp), _L("GT83-TDATA-034.02")) ;
       
  1290 	//MKV error
       
  1291 
       
  1292 	// now hangup call
       
  1293 	iDataCall.NotifyStatusChange(iStatus2, callStatus);
       
  1294 	iDataCall.NotifyMobileCallStatusChange(iStatus3, mobileCallStatus);
       
  1295 
       
  1296 	INFO_PRINTF1(_L("Call connected - now hanging up..."));
       
  1297 	iDataCall.HangUp(iStatus);
       
  1298 	User::WaitForRequest(iStatus);
       
  1299 	TEST_CHECKL(iStatus.Int(), KErrNone, _L("*** Failed to Hang Up. If you are using an Ericsson phone, this is a PHONE related problem! ***")) ;	//sometimes timed out -33
       
  1300 
       
  1301 	//This test has some trobles with Ericsson phones
       
  1302 	//R520m could return KErrGeneral
       
  1303 	//SH888 could return KErrTimedOut
       
  1304 	INFO_PRINTF2(_L("iDataCall.HangUp() returned status %d"), iStatus.Int()) ;
       
  1305 
       
  1306 	User::WaitForRequest(iStatus2);
       
  1307 	CHECKPOINT(iStatus2.Int(), KErrNone, _L("GT83-TDATA-020.02")) ;
       
  1308 	CHECKPOINT(callStatus, RCall::EStatusHangingUp, _L("GT83-TDATA-020.02")) ;
       
  1309 
       
  1310 	User::WaitForRequest(iStatus3);
       
  1311 	CHECKPOINT(iStatus3.Int(), KErrNone, _L("GT83-TDATA-036.07")) ;
       
  1312 	CHECKPOINT(mobileCallStatus, RMobileCall::EStatusDisconnecting, _L("GT83-TDATA-036.07")) ;
       
  1313 
       
  1314 	iDataCall.NotifyStatusChange(iStatus2, callStatus);
       
  1315 	User::WaitForRequest(iStatus2);
       
  1316 	CHECKPOINT(iStatus2.Int(), KErrNone, _L("GT83-TDATA-020.02")) ;
       
  1317 	CHECKPOINT(callStatus, RCall::EStatusIdle, _L("GT83-TDATA-020.02")) ;
       
  1318 
       
  1319 	iDataCall.NotifyMobileCallStatusChange(iStatus3, mobileCallStatus);
       
  1320 	User::WaitForRequest(iStatus3);
       
  1321 	CHECKPOINT(iStatus3.Int(), KErrNone, _L("GT83-TDATA-036.08")) ;
       
  1322 	CHECKPOINT(mobileCallStatus, RMobileCall::EStatusIdle, _L("GT83-TDATA-036.08")) ;
       
  1323 
       
  1324 	TEST(iStatus != KRequestPending) ;
       
  1325 	TEST(iStatus2 != KRequestPending) ;
       
  1326 	TEST(iStatus3 != KRequestPending) ;
       
  1327 	TEST(iStatus4 != KRequestPending) ;
       
  1328 	TEST(iStatus5 != KRequestPending) ;
       
  1329 	TEST(iStatus6 != KRequestPending) ;
       
  1330 
       
  1331 	console->Printf(_L("...Disconnected\n"));
       
  1332 	User::After(10*KOneSecond);
       
  1333     CleanupStack::PopAndDestroy(console);
       
  1334 
       
  1335 	// Close the line and call
       
  1336 	CleanupStack::PopAndDestroy() ;
       
  1337 
       
  1338 	INFO_PRINTF1(_L("======End test ====="));
       
  1339 	return TestStepResult() ;
       
  1340 	}
       
  1341 //------------------------------------------------------------------
       
  1342 
       
  1343 CTestCallStatusIncommingCall::CTestCallStatusIncommingCall()
       
  1344 /** Each test step initialises it's own name
       
  1345 */
       
  1346 	{
       
  1347 	// store the name of this test case
       
  1348 	// this is the name that is used by the script file
       
  1349 	SetTestStepName(_L("TestCallStatusIncommingCall"));
       
  1350 	}
       
  1351 //------------------------------------------------------------------
       
  1352 
       
  1353 TVerdict CTestCallStatusIncommingCall::doTestStepL( void )
       
  1354 /**
       
  1355  * This function tests call status at various times during calls
       
  1356  * @test GT83-TDATA-001.01 Test opening a data line from a phone that supports data functionality
       
  1357  * @test GT83-TDATA-009.01 Test setting notification of a change in hook status of a data line
       
  1358  * @test GT83-TDATA-013.06 Test opening a new call by specifying the name of a line
       
  1359  * @test GT83-TDATA-023.01 Test the ability to get the current call information of the data call. Display the call information to screen.
       
  1360  * @test GT83-TDATA-035.02 "Test retrieval of the current status of the data call when the call's status is ""idle"""
       
  1361  * @test GT83-TDATA-035.04 "Test retrieval of the current status of the data call when the call's status is ""ringing"""
       
  1362  * @test GT83-TDATA-035.05 "Test retrieval of the current status of the data call when the call's status is ""answering"""
       
  1363  * @test GT83-TDATA-035.07 "Test retrieval of the current status of the data call when the call's status is ""connected"""
       
  1364  */
       
  1365 	{
       
  1366 	// Get the Call Status
       
  1367 	INFO_PRINTF1(_L("======Start test Get Call Status"));
       
  1368     //to make sure that line and call will be closed in leave case
       
  1369 	CleanupStack::PushL(*this) ; ;
       
  1370 
       
  1371 	// Open a Data line and Call
       
  1372 	RCall::TStatus callStatus;
       
  1373 	RMobileCall::TMobileCallStatus mobileCallStatus;
       
  1374 
       
  1375 	RMobileCall::TMobileDataCallParamsV1 callDataParams;
       
  1376 	RMobileCall::TMobileDataCallParamsV1Pckg callDataParamsPckg(callDataParams);
       
  1377 
       
  1378 	TBuf<16> GoodNumber ;
       
  1379 	GetRemoteNumber(GoodNumber) ;
       
  1380 	INFO_PRINTF1(_L("Opening Data Line"));
       
  1381 	TEST_CHECKL(iLine.Open(iPhone, KDataLineName), KErrNone, _L("GT83-TDATA-001.01"));
       
  1382 	INFO_PRINTF1(_L("Opening New Data Call"));
       
  1383 	TEST_CHECKL(iDataCall.OpenNewCall(iLine), KErrNone, _L("GT83-TDATA-013.06"));
       
  1384 
       
  1385 
       
  1386 	TInt ret=iDataCall.GetStatus(callStatus);
       
  1387 	CHECKPOINT(ret, KErrNone, _L("GT83-TDATA-004.02")) ;
       
  1388 	TInt ret2=iDataCall.GetMobileCallStatus(mobileCallStatus);
       
  1389 	CHECKPOINT_EXPR((ret2==KErrNone || ret2==KErrNotSupported), _L("GT83-TDATA-035.02")) ;
       
  1390 	if (ret==KErrNotSupported)
       
  1391 		{
       
  1392 		INFO_PRINTF1(_L("Get Call Status is NOT Supported"));
       
  1393 		}
       
  1394 
       
  1395 	if (ret2==KErrNotSupported)
       
  1396 		{
       
  1397 		INFO_PRINTF1(_L("Get Mobile Call Status is NOT Supported"));
       
  1398 		}
       
  1399 
       
  1400 	if ((ret==KErrNone) && (ret2==KErrNone))
       
  1401 		{
       
  1402 		CHECKPOINT(callStatus, RCall::EStatusIdle, _L("GT83-TDATA-004.02")) ;
       
  1403 		CHECKPOINT(mobileCallStatus, RMobileCall::EStatusIdle, _L("GT83-TDATA-035.02")) ;
       
  1404 		INFO_PRINTF1(_L("The call is Idle"));
       
  1405 		}
       
  1406 
       
  1407 	// Now test call status during an incomming call
       
  1408 
       
  1409 	// Wait for an incoming call, then get the Call BearerServiceInfo. The
       
  1410 	// Bearer Service Info is only available if the call is currently active
       
  1411 
       
  1412 	CConsoleBase* console = Console::NewL(KConsoleTitle,TSize(KConsFullScreen,KConsFullScreen));
       
  1413     CleanupStack::PushL(console);
       
  1414 	console->Printf(_L("Please ring the phone\n"));
       
  1415 
       
  1416 	/* @test GT83-AT-024	Test setting notification of an incoming call on a data line */
       
  1417 	//commented out because connecting process too long and modem breaks connection
       
  1418 	// by temeout
       
  1419 //	iLine.NotifyIncomingCall(iStatus, callName);	// wait for a call
       
  1420 //	WaitWithTimeoutL(iStatus,90*KOneSecond); // but timeout after 90 seconds
       
  1421 
       
  1422 	ret=iDataCall.GetStatus(callStatus);
       
  1423 	CHECKPOINT(ret, KErrNone, _L("GT83-TDATA-004.04")) ;
       
  1424 //	TEST_CHECKL(callStatus, RCall::EStatusRinging, _L("GT83-TDATA-004.04.01")) ;
       
  1425 	ret2=iDataCall.GetMobileCallStatus(mobileCallStatus);
       
  1426 	CHECKPOINT(ret2, KErrNone, _L("GT83-TDATA-035.07")) ;
       
  1427 //	TEST_CHECKL(mobileCallStatus, RMobileCall::EStatusRinging, _L("GT83-TDATA-035.04")) ;
       
  1428 
       
  1429 //	INFO_PRINTF1(_L("Phone is ringing..."));
       
  1430 
       
  1431 	callDataParams.iService = RMobileCall::EServiceDataCircuitAsync;
       
  1432 	callDataParams.iSpeed = RMobileCall::ESpeed9600;
       
  1433 	callDataParams.iProtocol = RMobileCall::EProtocolV32;
       
  1434 	callDataParams.iQoS = RMobileCall::EQoSNonTransparent;
       
  1435 	// Answer an incoming call initiated by t_echo.exe and obtain the call's current status
       
  1436 	//GT83-AT-032	Test answering a call on a data line (Generic)	RCall::AnswerIncomingCall
       
  1437 	iDataCall.AnswerIncomingCall(iStatus, callDataParamsPckg);
       
  1438 	ret=iDataCall.GetStatus(callStatus);
       
  1439 	//TEST_CHECKL(callStatus, RCall::EStatusAnswering, _L("GT83-TDATA-023.01")) ;
       
  1440 	ret2=iDataCall.GetMobileCallStatus(mobileCallStatus);
       
  1441 	//TEST_CHECKL(mobileCallStatus, RMobileCall::EStatusAnswering, _L("GT83-TDATA-035.05")) ;
       
  1442 	WaitWithTimeoutL(iStatus,90*KOneSecond); // but timeout after 90 seconds
       
  1443 
       
  1444 	//cancel AnswerIncomingCall if request is still pending
       
  1445 	if(iStatus.Int() == KRequestPending)
       
  1446 		{
       
  1447 		iDataCall.AnswerIncomingCallCancel();
       
  1448 		User::WaitForRequest(iStatus);
       
  1449 		}
       
  1450 
       
  1451 	console->Printf(_L("Please stay connected... the test will hang up shortly\n"));
       
  1452 
       
  1453 	ret=iDataCall.GetStatus(callStatus);
       
  1454 	CHECKPOINT(ret, KErrNone, _L("GT83-TDATA-004.07")) ;
       
  1455 	ret2=iDataCall.GetMobileCallStatus(mobileCallStatus);
       
  1456 	CHECKPOINT(ret2, KErrNone, _L("GT83-TDATA-035.07")) ;
       
  1457 
       
  1458 	if ((ret==KErrNone) && (ret2==KErrNone))
       
  1459 		{
       
  1460 		Print_RCall_TStatus(callStatus) ;
       
  1461 		CHECKPOINT(callStatus, RCall::EStatusConnected, _L("GT83-TDATA-004.07")) ;
       
  1462 		CHECKPOINT(mobileCallStatus, RMobileCall::EStatusConnected, _L("GT83-TDATA-035.07")) ;
       
  1463 		INFO_PRINTF1(_L("The call is Connected"));
       
  1464 		}
       
  1465 
       
  1466 	INFO_PRINTF1(_L("Hanging up..."));
       
  1467 
       
  1468 	User::After(10*KOneSecond);
       
  1469 	iDataCall.HangUp(iStatus);
       
  1470 	User::WaitForRequest(iStatus);
       
  1471 	TEST_CHECKL(iStatus.Int(), KErrNone, _L("*** Failed to Hang Up. If you are using an Ericsson phone, this is a PHONE related problem! ***")) ;
       
  1472 
       
  1473 	//This test has some trobles with Ericsson phones
       
  1474 	//R520m could return KErrGeneral
       
  1475 	//SH888 could return KErrTimedOut
       
  1476 	INFO_PRINTF2(_L("iDataCall.HangUp() returned status %d"), iStatus.Int()) ;
       
  1477 
       
  1478 	ret=iDataCall.GetStatus(callStatus);
       
  1479 	CHECKPOINT(ret, KErrNone, _L("GT83-TDATA-004.02")) ;
       
  1480 	ret2=iDataCall.GetMobileCallStatus(mobileCallStatus);
       
  1481 	CHECKPOINT(ret2, KErrNone, _L("GT83-TDATA-035.02")) ;
       
  1482 
       
  1483 	if ((ret==KErrNone) && (ret2==KErrNone))
       
  1484 		{
       
  1485 		CHECKPOINT(callStatus, RCall::EStatusIdle, _L("GT83-TDATA-004.02")) ;
       
  1486 		CHECKPOINT(mobileCallStatus, RMobileCall::EStatusIdle, _L("GT83-TDATA-035.02")) ;
       
  1487 		INFO_PRINTF1(_L("The call is Idle again"));
       
  1488 		}
       
  1489 
       
  1490 	console->Printf(_L("...Disconnected\n"));
       
  1491 	User::After(10*KOneSecond);
       
  1492     CleanupStack::PopAndDestroy(console);
       
  1493 
       
  1494 	// Close the line and call
       
  1495 	CleanupStack::PopAndDestroy() ;
       
  1496 
       
  1497 	INFO_PRINTF1(_L("======End test ====="));
       
  1498 	return TestStepResult() ;
       
  1499 	}
       
  1500 //------------------------------------------------------------------
       
  1501 
       
  1502 CTestCallStatusOutgoingCall::CTestCallStatusOutgoingCall()
       
  1503 /** Each test step initialises it's own name
       
  1504 */
       
  1505 	{
       
  1506 	// store the name of this test case
       
  1507 	// this is the name that is used by the script file
       
  1508 	SetTestStepName(_L("TestCallStatusOutgoingCall"));
       
  1509 	}
       
  1510 //------------------------------------------------------------------
       
  1511 
       
  1512 TVerdict CTestCallStatusOutgoingCall::doTestStepL( void )
       
  1513 /**
       
  1514  * This function tests call status at various times during calls
       
  1515  * @test GT83-TDATA-001.01 Test opening a data line from a phone that supports data functionality
       
  1516  * @test GT83-TDATA-009.01 Test setting notification of a change in hook status of a data line
       
  1517  * @test GT83-TDATA-013.06 Test opening a new call by specifying the name of a line
       
  1518  * @test GT83-TDATA-023.01 Test the ability to get the current call information of the data call. Display the call information to screen.
       
  1519  * @test GT83-TDATA-024.00 Test dialling a data call (Generic)
       
  1520  * @test GT83-TDATA-035.02 "Test retrieval of the current status of the data call when the call's status is ""idle"""
       
  1521  * @test GT83-TDATA-035.07 "Test retrieval of the current status of the data call when the call's status is ""connected"""
       
  1522  */
       
  1523 	{
       
  1524 	// Get the Call Status
       
  1525 	INFO_PRINTF1(_L("======Start test Get Call Status..."));
       
  1526     //to make sure that line and call will be closed in leave case
       
  1527 	CleanupStack::PushL(*this) ; ;
       
  1528 	// Open a Data line and Call
       
  1529 	//GT83-AT-021	Test opening a data line from a phone that supports data functionality
       
  1530 	INFO_PRINTF1(_L("Opening Data Line"));
       
  1531 
       
  1532 	RCall::TStatus callStatus;
       
  1533 	RMobileCall::TMobileCallStatus mobileCallStatus;
       
  1534 
       
  1535 	RMobileCall::TMobileDataCallParamsV1 callDataParams;
       
  1536 	RMobileCall::TMobileDataCallParamsV1Pckg callDataParamsPckg(callDataParams);
       
  1537 
       
  1538 	TBuf<16> GoodNumber ;
       
  1539 	GetRemoteNumber(GoodNumber) ;
       
  1540 	INFO_PRINTF1(_L("Opening Data Line"));
       
  1541 	TEST_CHECKL(iLine.Open(iPhone, KDataLineName), KErrNone, _L("GT83-TDATA-001.01"));
       
  1542 	INFO_PRINTF1(_L("Opening New Data Call"));
       
  1543 	TEST_CHECKL(iDataCall.OpenNewCall(iLine), KErrNone, _L("GT83-TDATA-013.06"));
       
  1544 
       
  1545 
       
  1546 	TInt ret=iDataCall.GetStatus(callStatus);
       
  1547 	CHECKPOINT_EXPR((ret==KErrNone || ret==KErrNotSupported), _L("GT83-TDATA-004.02")) ;
       
  1548 	TInt ret2=iDataCall.GetMobileCallStatus(mobileCallStatus);
       
  1549 	CHECKPOINT_EXPR((ret2==KErrNone || ret==KErrNotSupported), _L("GT83-TDATA-035.02")) ;
       
  1550 
       
  1551 	if (ret==KErrNotSupported)
       
  1552 		{
       
  1553 		INFO_PRINTF1(_L("Get Call Status is NOT Supported"));
       
  1554 		}
       
  1555 
       
  1556 	if (ret2==KErrNotSupported)
       
  1557 		{
       
  1558 		INFO_PRINTF1(_L("Get Mobile Call Status is NOT Supported"));
       
  1559 		}
       
  1560 
       
  1561 	if ((ret==KErrNone) && (ret2==KErrNone))
       
  1562 		{
       
  1563 		CHECKPOINT(callStatus, RCall::EStatusIdle, _L("GT83-TDATA-004.02")) ;
       
  1564 		CHECKPOINT(mobileCallStatus, RMobileCall::EStatusIdle, _L("GT83-TDATA-035.02")) ;
       
  1565 		INFO_PRINTF1(_L("The call is Idle"));
       
  1566 		}
       
  1567 
       
  1568 	// Now test call status during an outgoing call
       
  1569 	callDataParams.iService = RMobileCall::EServiceDataCircuitAsync;
       
  1570 	callDataParams.iSpeed = RMobileCall::ESpeed9600;
       
  1571 	callDataParams.iProtocol = RMobileCall::EProtocolV32;
       
  1572 	callDataParams.iQoS = RMobileCall::EQoSNonTransparent;
       
  1573 
       
  1574 
       
  1575 	CConsoleBase* console = Console::NewL(KConsoleTitle,TSize(KConsFullScreen,KConsFullScreen));
       
  1576     CleanupStack::PushL(console);
       
  1577 	console->Printf(_L("Calling...\n"));
       
  1578 
       
  1579 	INFO_PRINTF2(_L("Dialling %S...."), &GoodNumber);
       
  1580 	iDataCall.Dial(iStatus, callDataParamsPckg, GoodNumber);
       
  1581 	User::WaitForRequest(iStatus);
       
  1582 	TEST_CHECKL(iStatus.Int(), KErrNone, _L("GT83-TDATA-024.00")) ;
       
  1583 
       
  1584 	ret=iDataCall.GetStatus(callStatus);
       
  1585 	CHECKPOINT(ret, KErrNone, _L("GT83-TDATA-004.07")) ;
       
  1586 	ret2=iDataCall.GetMobileCallStatus(mobileCallStatus);
       
  1587 	CHECKPOINT(ret2, KErrNone, _L("GT83-TDATA-035.07")) ;
       
  1588 
       
  1589 	if ((ret==KErrNone) && (ret2==KErrNone))
       
  1590 		{
       
  1591 
       
  1592 		Print_RCall_TStatus(callStatus) ;
       
  1593 		CHECKPOINT(callStatus, RCall::EStatusConnected, _L("GT83-TDATA-004.07")) ;
       
  1594 		CHECKPOINT(mobileCallStatus, RMobileCall::EStatusConnected, _L("GT83-TDATA-035.07")) ;
       
  1595 		INFO_PRINTF1(_L("The call is Connected"));
       
  1596 		}
       
  1597 
       
  1598 	console->Printf(_L("Please stay connected... the test will hang up shortly\n"));
       
  1599 
       
  1600 	INFO_PRINTF1(_L("Hanging up..."));
       
  1601 
       
  1602 	User::After(10*KOneSecond);
       
  1603 	iDataCall.HangUp(iStatus);
       
  1604 	User::WaitForRequest(iStatus);
       
  1605 	TEST_CHECKL(iStatus.Int(), KErrNone, _L("*** Failed to Hang Up. If you are using an Ericsson phone, this is a PHONE related problem! ***")) ;
       
  1606 
       
  1607 	//This test has some trobles with Ericsson phones
       
  1608 	//R520m could return KErrGeneral
       
  1609 	//SH888 could return KErrTimedOut
       
  1610 	INFO_PRINTF2(_L("iDataCall.HangUp() returned status %d"), iStatus.Int()) ;
       
  1611 
       
  1612 	ret=iDataCall.GetStatus(callStatus);
       
  1613 	CHECKPOINT(ret, KErrNone, _L("GT83-TDATA-004.02")) ;
       
  1614 	ret2=iDataCall.GetMobileCallStatus(mobileCallStatus);
       
  1615 	CHECKPOINT(ret2, KErrNone, _L("GT83-TDATA-035.02")) ;
       
  1616 
       
  1617 	if ((ret==KErrNone) && (ret2==KErrNone))
       
  1618 		{
       
  1619 		CHECKPOINT(callStatus, RCall::EStatusIdle, _L("GT83-TDATA-004.02")) ;
       
  1620 		CHECKPOINT(mobileCallStatus, RMobileCall::EStatusIdle, _L("GT83-TDATA-035.02")) ;
       
  1621 		INFO_PRINTF1(_L("The call is Idle again"));
       
  1622 		}
       
  1623 
       
  1624 	console->Printf(_L("...Disconnected\n"));
       
  1625 	User::After(10*KOneSecond);
       
  1626     CleanupStack::PopAndDestroy(console);
       
  1627 
       
  1628 	// Close the line and call
       
  1629 	CleanupStack::PopAndDestroy() ;
       
  1630 
       
  1631 	INFO_PRINTF1(_L("======End test ====="));
       
  1632 	return TestStepResult() ;
       
  1633 	}
       
  1634 //------------------------------------------------------------------
       
  1635 
       
  1636 CTestCallCancels::CTestCallCancels()
       
  1637 /** Each test step initialises it's own name
       
  1638 */
       
  1639 	{
       
  1640 	// store the name of this test case
       
  1641 	// this is the name that is used by the script file
       
  1642 	SetTestStepName(_L("TestCallCancels"));
       
  1643 	}
       
  1644 //------------------------------------------------------------------
       
  1645 
       
  1646 TVerdict CTestCallCancels::doTestStepL( void )
       
  1647 /**
       
  1648  * This function posts and then cancels Call Notifications.
       
  1649  * @test GT83-TDATA-001.01 Test opening a data line from a phone that supports data functionality
       
  1650  * @test GT83-TDATA-013.06 Test opening a new call by specifying the name of a line
       
  1651  * @test GT83-TDATA-017.01 Test setting notification of a change in the call's capabilities
       
  1652  * @test GT83-TDATA-017.03 Test the ability to cancel a notification of a change in the call's capabilities
       
  1653  * @test GT83-TDATA-019.01 Test setting notification of a change in hook status of a data call
       
  1654  * @test GT83-TDATA-019.04 Test the ability to cancel a notification of a change in hook status of a data call
       
  1655  * @test GT83-TDATA-020.02 "Test notification of a change in the status of the data call from ""idle"" to ""ringing"" to ""answering"" to ""connected"" to ""hanging up"" to ""idle"""
       
  1656  * @test GT83-TDATA-021.01 Test setting notification of a change in the data call's duration
       
  1657  * @test GT83-TDATA-021.03 Test cancelling notification of a change in the data call's duration
       
  1658  */
       
  1659 	{
       
  1660 	INFO_PRINTF1(_L("======Start test Test Call Cancels"));
       
  1661     //to make sure that line and call will be closed in leave case
       
  1662 	CleanupStack::PushL(*this) ; 
       
  1663 
       
  1664 	// Open a Data line and Call
       
  1665 	//GT83-AT-021	Test opening a data line from a phone that supports data functionality
       
  1666 	INFO_PRINTF1(_L("Opening Data Line"));
       
  1667 	TEST_CHECKL(iLine.Open(iPhone, KDataLineName), KErrNone, _L("GT83-TDATA-001.01"));
       
  1668 	INFO_PRINTF1(_L("Opening New Data Call"));
       
  1669 	TEST_CHECKL(iDataCall.OpenNewCall(iLine), KErrNone, _L("GT83-TDATA-013.06"));
       
  1670 
       
  1671 	// Call Status Change Cancel Request
       
  1672 	RCall::TStatus callStatus;
       
  1673 	iDataCall.NotifyStatusChange(iStatus, callStatus);
       
  1674 	CHECKPOINT(iStatus.Int(), KRequestPending, _L("GT83-TDATA-020.02")) ;
       
  1675 	User::After(KTenPartOfSec); //snack some sleep
       
  1676 	iDataCall.NotifyStatusChangeCancel();
       
  1677 	User::WaitForRequest(iStatus);
       
  1678 	CHECKPOINT(iStatus.Int(), KErrCancel, _L("GT83-TDATA-020.4")) ;
       
  1679 
       
  1680 #if 0  //cancel functions don't work yet (?)
       
  1681 	   //any way they are not declared 27.09.2001
       
  1682 	RMobileCall::TMobileCallStatus mobileCallStatus;
       
  1683 	iiDataCall.NotifyMobileCallStatusChange(iStatus, mobileCallStatus);
       
  1684 	TEST_CHECKL(iStatus.Int(), KRequestPending, _L("GT83-TDATA-0")) ;
       
  1685 	iiDataCall.NotifyMobileCallStatusChangeCancel();
       
  1686 	User::WaitForRequest(iStatus);
       
  1687 	TEST_CHECKL(iStatus.Int(), KErrCancel, _L("GT83-TDATA-0")) ;
       
  1688 #endif
       
  1689 	// Hook Change Cancel Request
       
  1690 	RCall::THookStatus hookStatus;
       
  1691 	iDataCall.NotifyHookChange(iStatus, hookStatus);
       
  1692 	CHECKPOINT(iStatus.Int(), KRequestPending, _L("GT83-TDATA-019.01")) ;
       
  1693 	User::After(KTenPartOfSec); //snack some sleep
       
  1694 	iDataCall.NotifyHookChangeCancel();
       
  1695 	User::WaitForRequest(iStatus);
       
  1696 	CHECKPOINT(iStatus.Int(), KErrCancel, _L("GT83-TDATA-019.04")) ;
       
  1697 
       
  1698 	// Test Cancelling Notifications
       
  1699 	RCall::TCaps callCaps;
       
  1700 	iDataCall.NotifyCapsChange(iStatus, callCaps);
       
  1701 	TEST_CHECKL(iStatus.Int(), KRequestPending, _L("GT83-TDATA-017.01")) ;
       
  1702 	User::After(KTenPartOfSec); //snack some sleep
       
  1703 	iDataCall.NotifyCapsChangeCancel();
       
  1704 	User::WaitForRequest(iStatus);
       
  1705 	CHECKPOINT(iStatus.Int(), KErrCancel, _L("GT83-TDATA-017.03")) ;
       
  1706 
       
  1707 #if 0  //cancel functions don't work yet (?)
       
  1708 	   //any way they are not declared 27.09.2001
       
  1709 	RMobileCall::TMobileCallCapsV1 mobileCallCaps;
       
  1710 	RMobileCall::TMobileCallCapsV1Pckg mobileCallCapsPckg(mobileCallCaps);
       
  1711 	iDataCall.NotifyMobileCallCapsChange(iStatus, mobileCallCapsPckg);
       
  1712 	CHECKPOINT(iStatus.Int(), KRequestPending, _L("GT83-TDATA-0")) ;
       
  1713 	iDataCall.NotifyMobileCallCapsChangeCancel();
       
  1714 	User::WaitForRequest(iStatus);
       
  1715 	CHECKPOINT(iStatus.Int(), KErrCancel, _L("GT83-TDATA-0")) ;
       
  1716 #endif
       
  1717 
       
  1718 	TTimeIntervalSeconds callDuration;
       
  1719 	iDataCall.NotifyCallDurationChange(iStatus, callDuration);
       
  1720 	CHECKPOINT(iStatus.Int(), KRequestPending, _L("GT83-TDATA-021.01")) ;
       
  1721 	User::After(KTenPartOfSec); //snack some sleep
       
  1722 	iDataCall.NotifyCallDurationChangeCancel();
       
  1723 	User::WaitForRequest(iStatus);
       
  1724 	CHECKPOINT(iStatus.Int(), KErrCancel, _L("GT83-TDATA-021.03")) ;
       
  1725 
       
  1726 	// Close the line and call
       
  1727 	CleanupStack::PopAndDestroy() ;
       
  1728 
       
  1729 	INFO_PRINTF1(_L("======End test ====="));
       
  1730 	return TestStepResult() ;
       
  1731 	}
       
  1732 //------------------------------------------------------------------
       
  1733 
       
  1734 CTestHandShake::CTestHandShake()
       
  1735 /** Each test step initialises it's own name
       
  1736 */
       
  1737 	{
       
  1738 	CConsoleBase* console = Console::NewL(KConsoleTitle,TSize(KConsFullScreen,KConsFullScreen));
       
  1739     CleanupStack::PushL(console);
       
  1740 	console->Printf(_L("Start the echo batch file then press any key to continue.\n"));
       
  1741 	console->Getch();
       
  1742 	console->Printf(_L("Te_echo.script is running.\n"));
       
  1743 	CleanupStack::PopAndDestroy(console);
       
  1744 	// store the name of this test case
       
  1745 	// this is the name that is used by the script file
       
  1746 	SetTestStepName(_L("TestHandShake"));
       
  1747 	}
       
  1748 //------------------------------------------------------------------
       
  1749 TInt CTestHandShake::DialRemoteModemTestL()
       
  1750 /**
       
  1751  * Dials a data call.
       
  1752  * This method opens a data line and call, and retrieves the status of the call.
       
  1753  * It then dials a remote modem (initiated by t_data.exe), loans the Comm port,
       
  1754  * connects to the Comms Server, opens a serial port and proceeds to transmit data to
       
  1755  * the remote modem. It subsequently reads the data echoed back by the remote modem and
       
  1756  * compares the transmitted and received data. The serial port, the connection to the
       
  1757  * Comms Server, the data port, call and line are then closed.
       
  1758  * @return TBool indicating whether this test was successful. If it's unsuccessful, the
       
  1759  * test exits because it will not be possible to do the AnswerTest as the telephone no.
       
  1760  * of the phone was not transferred due to the failure of the DialTest.
       
  1761  *
       
  1762  * @test GT83-TDATA-001.01 Test opening a data line from a phone that supports data functionality
       
  1763  * @test GT83-TDATA-004.02 "Test retrieval of a data line's current status when the line's status is ""Idle"""
       
  1764  * @test GT83-TDATA-013.06 Test opening a new call by specifying the name of a line
       
  1765  * @test GT83-TDATA-024.00 Test dialling a data call (Generic)
       
  1766  * @test GT83-TDATA-026.02 Test the ability to place an asynchronous request to hang up a data call
       
  1767  * @test GT83-TDATA-028.02 Test the ability to recover a loaned port that was requested by an asynchronous request and the request completed
       
  1768  */
       
  1769 	{
       
  1770 
       
  1771 	INFO_PRINTF1(_L("======Start test Dial Remote Modem test"));
       
  1772     //to make sure that line and call will be closed in leave case
       
  1773 	CleanupStack::PushL(*this) ; ;
       
  1774 	const TInt KNumOfBytes=51;		// Number of bytes of data to send to remote end
       
  1775 
       
  1776 	// Open a data line and call
       
  1777 	INFO_PRINTF1(_L("Opening Data Line"));
       
  1778 	// GT83-AT-021	Test opening a data line from a phone that supports data functionality
       
  1779 	TEST_CHECKL(iLine.Open(iPhone, KDataLineName), KErrNone, _L("GT83-TDATA-001.01"));
       
  1780 	INFO_PRINTF1(_L("Opening New Data Call"));
       
  1781 
       
  1782 	//GT83-AT-028	Test opening a new call from data line (Generic)
       
  1783 	TEST_CHECKL(iDataCall.OpenNewCall(iLine), KErrNone, _L("GT83-TDATA-013.06"));
       
  1784 
       
  1785 	// Get the call's status
       
  1786 	RCall::TStatus callStatus;
       
  1787 	CHECKPOINT(iDataCall.GetStatus(callStatus), KErrNone, _L("GT83-TDATA-004.02"));
       
  1788 	INFO_PRINTF2(_L("Call Status = %d"), callStatus);
       
  1789 	Print_RCall_TStatus(callStatus) ;
       
  1790 	TestGetCallCapabilitiesL(iDataCall) ;
       
  1791 
       
  1792 	// Dial remote modem and obtain the call's current status
       
  1793 	TBuf<16> remoteNum;
       
  1794 	GetRemoteNumber(remoteNum);	
       
  1795 
       
  1796 	INFO_PRINTF2(_L("Dialling %S...."), &remoteNum);
       
  1797 
       
  1798 	// new stuff
       
  1799 	RMobileCall::TMobileDataCallParamsV1 callDataParams;
       
  1800 	RMobileCall::TMobileDataCallParamsV1Pckg callDataParamsPckg(callDataParams);
       
  1801 
       
  1802 
       
  1803 	callDataParams.iService = RMobileCall::EServiceDataCircuitAsync;
       
  1804 	callDataParams.iSpeed = RMobileCall::ESpeed9600;
       
  1805 	callDataParams.iProtocol = RMobileCall::EProtocolV32;
       
  1806 	//callDataParams.iProtocol = RMobileCall::EProtocolIsdnMultimedia;
       
  1807 
       
  1808 	callDataParams.iQoS = RMobileCall::EQoSNonTransparent;
       
  1809 
       
  1810 	INFO_PRINTF2(_L("Dialling %S...."), &remoteNum);
       
  1811 	iDataCall.Dial(iStatus, callDataParamsPckg, remoteNum);
       
  1812 	User::WaitForRequest(iStatus);
       
  1813 	TEST_CHECKL(iStatus.Int(), KErrNone, _L("GT83-TDATA-024.00"));
       
  1814 
       
  1815 	CHECKPOINT(iDataCall.GetStatus(callStatus), KErrNone, _L("GT83-TDATA-024.00"));
       
  1816 	INFO_PRINTF2(_L("Call Status = %d"), callStatus);
       
  1817 	Print_RCall_TStatus(callStatus) ;
       
  1818 
       
  1819 	// Loan the Comm port
       
  1820 	TInt retValue=KErrNone;	// return value for the test
       
  1821 	RCall::TCommPort commPort;
       
  1822 	iDataCall.LoanDataPort(iStatus,commPort);
       
  1823 	User::WaitForRequest(iStatus);
       
  1824 	if (iStatus==KErrNone)
       
  1825 		{
       
  1826 		INFO_PRINTF1(_L("Comm port loaned successfully"));
       
  1827 		}
       
  1828 	else if (iStatus==KErrCommsLineFail)
       
  1829 		{
       
  1830 		INFO_PRINTF1(_L("Loan Data port error: 'KErrCommsLineFail'."));
       
  1831 		INFO_PRINTF1(_L("This error is currently known to only happen with the Motorola"));
       
  1832 		INFO_PRINTF1(_L("Time port. Please see the PhoneInfo.cpp file for more information."));
       
  1833 		retValue=iStatus.Int();
       
  1834 		iDataCall.Close();
       
  1835 		iLine.Close();
       
  1836 		return retValue;
       
  1837 		}
       
  1838 	else
       
  1839 		{
       
  1840 		INFO_PRINTF2(_L("Error %d occured during"), iStatus.Int());
       
  1841 		INFO_PRINTF1(_L("Loan comm port request.\nUnable to continue."));
       
  1842 		retValue=iStatus.Int();
       
  1843 		iDataCall.Close();
       
  1844 		iLine.Close();
       
  1845 		return retValue;
       
  1846 		}
       
  1847 
       
  1848 	// Connect to the Comms Server and load the CSY
       
  1849 	RCommServ cs;
       
  1850 	TEST_CHECKL(cs.Connect(), KErrNone, _L("GT83-TDATA-0"));
       
  1851 	TInt ret=cs.LoadCommModule(KCsyName);
       
  1852 	TESTL(ret==KErrNone || ret==KErrAlreadyExists);
       
  1853 
       
  1854 	// Open a serial port
       
  1855 	RComm port;
       
  1856 	TEST_CHECKL(port.Open(cs,commPort.iPort,ECommShared), KErrNone, _L("*** Failed to open serial port ***"));
       
  1857 	INFO_PRINTF1(_L("Serial port opened successfully"));
       
  1858 
       
  1859 	// Write own telephone number to the Data Port.
       
  1860 	TBuf<16> localNumUnicode;
       
  1861 	TBuf8<16> localNum;		// We need this to be large 
       
  1862 
       
  1863 	GetLocalNumber(localNumUnicode);		// Get out own phone number in unicode
       
  1864 	localNum.Copy(localNumUnicode);		// Convert unicode to 8 bit string
       
  1865 
       
  1866 	// The T_ECHO client we are talking to expects the localNum to be 12 chars.
       
  1867 	// Therefore we have to ensure our localNum is exactly 12 chars by padding with spaces.
       
  1868 	const TInt len=localNum.Length();
       
  1869 	if(len<12)
       
  1870 		localNum.AppendFill(TChar(' '),12-len);	
       
  1871 	localNum.SetLength(12);
       
  1872 	
       
  1873 	port.Write(iStatus,localNum);
       
  1874 	User::WaitForRequest(iStatus);
       
  1875 	TEST_CHECKL(iStatus.Int(), KErrNone, _L("*** Failed to write to comm port ***"));
       
  1876 	INFO_PRINTF1(_L("Data stream 1 (tel. no.) written successfully"));
       
  1877 
       
  1878 	// Write more data
       
  1879 	port.Write(iStatus, KWriteTestData);
       
  1880 	User::WaitForRequest(iStatus);
       
  1881 	TEST_CHECKL(iStatus.Int(), KErrNone, _L("*** Failed to write to comm port***")) ;
       
  1882 	INFO_PRINTF1(_L("Data stream 2 written successfully"));
       
  1883 
       
  1884 	// Receive the echoed data from the remote machine
       
  1885 	TInt success=EFalse;
       
  1886 	TBuf8<KNumOfBytes> echoedData;
       
  1887 	port.Read(iStatus,KFifteenSeconds,echoedData);
       
  1888 	User::WaitForRequest(iStatus);
       
  1889 	CHECKPOINT(iStatus, KErrNone, _L("*** Failed to read echoed data!! ***"));
       
  1890 
       
  1891 	if (iStatus==KErrTimedOut)
       
  1892 		{
       
  1893 		INFO_PRINTF1(_L("A Time out error occured during the read"));
       
  1894 		}
       
  1895 	else if (iStatus==KErrNone)
       
  1896 		{
       
  1897 		INFO_PRINTF1(_L("Data stream read successfully"));
       
  1898 		success=ETrue;
       
  1899 		}
       
  1900     else
       
  1901 		{
       
  1902 		INFO_PRINTF2(_L("Error %d occured"), iStatus.Int());
       
  1903 		}
       
  1904 
       
  1905 	// Compare the received data and then display the data
       
  1906 	if (success)
       
  1907 		{
       
  1908 		TEST(echoedData == KWriteTestData) ;
       
  1909 
       
  1910 		TBuf<KNumOfBytes> convertData;	// Convert the 8-bit data read from serial port to 16-
       
  1911 		convertData.Copy(echoedData);	// bit so that it can be displayed to the user.
       
  1912 		INFO_PRINTF2(_L("Echoed Data stream = %S"), &convertData);
       
  1913 		}
       
  1914 
       
  1915 	// Close the serial port, connection to Comms Server and recover the data port
       
  1916 	port.Close();
       
  1917 	cs.Close();
       
  1918 	//GT83-AT-034	Test the ability to recover a loaned port (Generic)	RCall::RecoverDataPort
       
  1919 	TEST_CHECKL(iDataCall.RecoverDataPort(), KErrNone, _L("GT83-TDATA-028.02")) ;
       
  1920 
       
  1921 	// Hang up the call
       
  1922 	INFO_PRINTF1(_L("Hanging up the Data call"));
       
  1923 	//GT83-AT-035	Test hanging up a data call (Generic)	RCall::HangUp
       
  1924 	//This test has some trobles with Ericsson phones
       
  1925 	//R520m could return KErrGeneral
       
  1926 	//SH888 could return KErrTimedOut
       
  1927 	TEST_CHECKL(iDataCall.HangUp(), KErrNone, _L("*** Failed to Hang Up. If you are using an Ericsson phone, this is a PHONE related problem! ***")) ;
       
  1928 	INFO_PRINTF2(_L("DataCall.HangUp() returns %d"), iDataCall.HangUp()) ;
       
  1929 	// Close the line and call.
       
  1930 	//GT83-AT-022	Test closing a data line (Generic)	RLine::Close
       
  1931 
       
  1932 	// Close the line and call
       
  1933 	CleanupStack::PopAndDestroy() ;
       
  1934 
       
  1935 	INFO_PRINTF1(_L("======End test ====="));
       
  1936 	return retValue;
       
  1937 	}
       
  1938 
       
  1939 //------------------------------------------------------------------
       
  1940 void CTestHandShake::AnswerIncomingCallTestL()
       
  1941 /**
       
  1942  * Answers an incoming data call.
       
  1943  * This method opens a data line and call, and retrieves the status of the call.
       
  1944  * It then answers an incoming call from a remote modem (initiated by t_echo.exe),
       
  1945  * loans the Comm port, connects to the Comms Server, opens a serial port and proceeds
       
  1946  * to read data transmitted by the remote modem. It then echoes the received data
       
  1947  * closes the serial port, its connection to the Comms Server, the data port, call and
       
  1948  * line.
       
  1949  * @test GT83-TDATA-001.01 Test opening a data line from a phone that supports data functionality
       
  1950  * @test GT83-TDATA-004.02 "Test retrieval of a data line's current status when the line's status is ""Idle"""
       
  1951  * @test GT83-TDATA-013.06 Test opening a new call by specifying the name of a line
       
  1952  * @test GT83-TDATA-015.05 "Test retrieval of the current call status when the call's status is ""answering"""
       
  1953  * @test GT83-TDATA-025.00 Test answering a call on a data line (Generic)
       
  1954  * @test GT83-TDATA-026.02 Test the ability to place an asynchronous request to hang up a data call
       
  1955  * @test GT83-TDATA-027.03 Test support for asynchronous loaning of the data port to the client when a connection has been established to a remote modem
       
  1956  * @test GT83-TDATA-028.02 Test the ability to recover a loaned port that was requested by an asynchronous request and the request completed
       
  1957 */
       
  1958 	{
       
  1959 	INFO_PRINTF1(_L("======Start test Answer Incoming call test"));
       
  1960     //to make sure that line and call will be closed in leave case
       
  1961 	CleanupStack::PushL(*this) ; ;
       
  1962 	const TInt KExpectedBytes=57;		// Number of bytes of data expected from remote end
       
  1963 
       
  1964 	// Open a Data line and Call
       
  1965 	//GT83-AT-021	Test opening a data line from a phone that supports data functionality
       
  1966 	INFO_PRINTF1(_L("Opening Data Line"));
       
  1967 
       
  1968 	TEST_CHECKL(iLine.Open(iPhone, KDataLineName), KErrNone, _L("GT83-TDATA-001.01"));
       
  1969 	INFO_PRINTF1(_L("Opening New Data Call"));
       
  1970 	TEST_CHECKL(iDataCall.OpenNewCall(iLine), KErrNone, _L("GT83-TDATA-013.06"));
       
  1971 
       
  1972 	//get status
       
  1973 	//GT83-AT-026	Test retrieval of a data line's current status.
       
  1974 	RCall::TStatus callStatus;
       
  1975 	CHECKPOINT(iDataCall.GetStatus(callStatus), KErrNone, _L("GT83-TDATA-004.02"));
       
  1976 	INFO_PRINTF2(_L("Call Status = %d"), callStatus);
       
  1977 	Print_RCall_TStatus(callStatus) ;
       
  1978 
       
  1979 	RMobileCall::TMobileDataCallParamsV1 callDataParams;
       
  1980 	RMobileCall::TMobileDataCallParamsV1Pckg callDataParamsPckg(callDataParams);
       
  1981 
       
  1982 
       
  1983 	callDataParams.iService = RMobileCall::EServiceDataCircuitAsync;
       
  1984 	callDataParams.iSpeed = RMobileCall::ESpeed9600;
       
  1985 	callDataParams.iProtocol = RMobileCall::EProtocolV32;
       
  1986 	//callDataParams.iProtocol = RMobileCall::EProtocolIsdnMultimedia;
       
  1987 
       
  1988 	callDataParams.iQoS = RMobileCall::EQoSNonTransparent;
       
  1989 
       
  1990 
       
  1991 	// Answer an incoming call initiated by t_echo.exe and obtain the call's current status
       
  1992 	//GT83-AT-032	Test answering a call on a data line (Generic)	RCall::AnswerIncomingCall
       
  1993 	iDataCall.AnswerIncomingCall(iStatus, callDataParamsPckg);
       
  1994 	INFO_PRINTF1(_L("Waiting for incoming call..."));
       
  1995 
       
  1996 	// DEF55659-NCh : timout changed from 60s to 120s. Must be changed back to 10s when MMTSY is optimized
       
  1997 	WaitWithTimeoutL(iStatus,120*KOneSecond);	// but timeout after 120 seconds
       
  1998 
       
  1999 	//cancel AnswerIncomingCall if request is still pending
       
  2000 	if(iStatus.Int() == KRequestPending)
       
  2001 		{
       
  2002 		iDataCall.AnswerIncomingCallCancel();
       
  2003 		User::WaitForRequest(iStatus);
       
  2004 		}
       
  2005 
       
  2006 	TEST_CHECKL(iStatus.Int(), KErrNone, _L("*** Failed AnswerIncomingCallTestL() ***")) ;
       
  2007 
       
  2008 	CHECKPOINT(iDataCall.GetStatus(callStatus), KErrNone, _L("GT83-TDATA-015.05"));
       
  2009 	INFO_PRINTF2(_L("Call Status = %d"), callStatus);
       
  2010 	TestGetCallCapabilitiesL(iDataCall) ;
       
  2011 
       
  2012 	// Loan the Comm port
       
  2013 	RCall::TCommPort commPort;
       
  2014 
       
  2015 	// GT83-AT-033	Test support for loaning the data port to the client (Generic) RCall::LoanDataPort
       
  2016 	iDataCall.LoanDataPort(iStatus,commPort);
       
  2017 	User::WaitForRequest(iStatus);
       
  2018 	CHECKPOINT(iStatus.Int(), KErrNone, _L("GT83-TDATA-027.03"));
       
  2019 	if (iStatus==KErrNone)
       
  2020 		{
       
  2021 		INFO_PRINTF1(_L("Comm port loaned successfully"));
       
  2022 		}
       
  2023 	else if (iStatus==KErrCommsLineFail)
       
  2024 		{
       
  2025 		INFO_PRINTF1(_L("Loan Data port Error: 'KErrCommsLineFail'."));
       
  2026 		INFO_PRINTF1(_L("This error is currently known to only happen with the Motorola"));
       
  2027 		INFO_PRINTF1(_L("Time port. Please see the PhoneInfo.cpp file for more information."));
       
  2028 		return;
       
  2029 		}
       
  2030 	else
       
  2031 		{
       
  2032 		INFO_PRINTF2(_L("Error %d occured during"), iStatus.Int());
       
  2033 		INFO_PRINTF1(_L("Loan comm port request.\nUnable to continue."));
       
  2034 		return;
       
  2035 		}
       
  2036 
       
  2037 	// Connect to the Comms Server and load the CSY
       
  2038 	RCommServ cs;
       
  2039 	TESTL(cs.Connect() == KErrNone);
       
  2040 	TInt ret=cs.LoadCommModule(KCsyName);
       
  2041 	CHECKPOINT_EXPR((ret==KErrNone || ret==KErrAlreadyExists), _L("*** Failed to load CSY ***"));
       
  2042 
       
  2043 	// Open a serial port
       
  2044 	RComm port;
       
  2045 	TEST_CHECKL(port.Open(cs,commPort.iPort,ECommShared), KErrNone, _L("*** Failed to open serial port ***"));
       
  2046 	INFO_PRINTF1(_L("Serial port opened successfully"));
       
  2047 
       
  2048 	// Read a stream of data from the serial port
       
  2049 	TInt success=EFalse;		// Boolean indicating whether data read has been successful
       
  2050 
       
  2051 	TBuf8<KExpectedBytes> readData;
       
  2052 	INFO_PRINTF1(_L("Posting a read..."));
       
  2053 	// DEF55659-NCh : timout changed from 20s to 40s. Must be changed back when MMTSY is optimized	
       
  2054 	port.Read(iStatus,KTenSeconds*4,readData);
       
  2055 	User::WaitForRequest(iStatus);
       
  2056 	CHECKPOINT(iStatus, KErrNone, _L("*** Failed to read data from serial port ***"));
       
  2057 
       
  2058 	if (iStatus==KErrTimedOut)
       
  2059 		{
       
  2060 		INFO_PRINTF1(_L("A Time out error occured during the read"));
       
  2061 		}
       
  2062 	else if (iStatus==KErrNone)
       
  2063 		{
       
  2064 		INFO_PRINTF1(_L("Data stream read successfully"));
       
  2065 		success=ETrue;
       
  2066 		}
       
  2067     else
       
  2068 		{
       
  2069 		INFO_PRINTF2(_L("Error %d occured"), iStatus.Int());
       
  2070 		}
       
  2071 
       
  2072 	// Display and then echo the received data
       
  2073 	if (success)
       
  2074 		{
       
  2075 		TBuf<KExpectedBytes> convertData;	// Convert the 8-bit data read from serial port to 16-bit
       
  2076 		convertData.Copy(readData); // so that it can be displayed to the screen
       
  2077 		INFO_PRINTF2(_L("Data stream = %S"), &convertData);
       
  2078 
       
  2079 		// Echo the data
       
  2080 		//User::After(KFiveSeconds);		// Give remote end time to post a read request
       
  2081 		port.Write(iStatus,readData);
       
  2082 		User::WaitForRequest(iStatus);
       
  2083 		TESTL(iStatus == KErrNone);
       
  2084 		INFO_PRINTF1(_L("Data stream echoed successfully"));
       
  2085 		}
       
  2086 
       
  2087 	// Close the serial port, connection to Comms Server and recover the data port
       
  2088 	port.Close();
       
  2089 	cs.Close();
       
  2090 	//GT83-AT-034	Test the ability to recover a loaned port (Generic)	RCall::RecoverDataPort
       
  2091 	TEST_CHECKL(iDataCall.RecoverDataPort(),KErrNone, _L("GT83-TDATA-028.02"));
       
  2092 
       
  2093 	// Hang up the call
       
  2094 	INFO_PRINTF1(_L("Hanging up the Data call"));
       
  2095 	TEST_CHECKL(iDataCall.HangUp(), KErrNone, _L("*** Failed to Hang Up. If you are using an Ericsson phone, this is a PHONE related problem! ***"));
       
  2096 
       
  2097 	//This test has some trobles with Ericsson phones
       
  2098 	//R520m could return KErrGeneral
       
  2099 	//SH888 could return KErrTimedOut
       
  2100 	INFO_PRINTF2(_L("DataCall.HangUp() returned status %d"), iDataCall.HangUp()) ;
       
  2101 
       
  2102 	// Close the line and call
       
  2103 	//GT83-AT-022	Test closing a data line (Generic)	RLine::Close
       
  2104 
       
  2105 	// Close the line and call
       
  2106 	CleanupStack::PopAndDestroy() ;
       
  2107 
       
  2108 	INFO_PRINTF1(_L("======End test ====="));
       
  2109 	}
       
  2110 //------------------------------------------------------------------
       
  2111 
       
  2112 TVerdict CTestHandShake::doTestStepL()
       
  2113 	{
       
  2114 	// DEF55659-NCh : this warning must be removed when the MMSTY is optimised.
       
  2115 	INFO_PRINTF1(_L("\n*** NOTE: this test is not reliable  and takes time     ***"));
       
  2116 	INFO_PRINTF1(_L("*** to run because timeout where changed due to the     ***"));
       
  2117 	INFO_PRINTF1(_L("*** way the TSY fetches info from the Comms repository. ***"));
       
  2118 
       
  2119 	TInt ret = DialRemoteModemTestL();
       
  2120 	if (ret==KErrNone)
       
  2121 		{
       
  2122 		INFO_PRINTF1(_L("The next test will start shortly..."));
       
  2123 		User::After(KTenSeconds);
       
  2124 		AnswerIncomingCallTestL();
       
  2125 		}
       
  2126 	else
       
  2127 		INFO_PRINTF1(_L("An error occured during the DialRemoteModemTest\n."));
       
  2128 	return TestStepResult() ;
       
  2129 	}
       
  2130 //------------------------------------------------------------------
       
  2131 
       
  2132 CTestGetMobileDataCallCaps::CTestGetMobileDataCallCaps()
       
  2133 /** Each test step initialises it's own name
       
  2134 */
       
  2135 	{
       
  2136 	SetTestStepName(_L("TestGetMobileDataCallCapsL"));
       
  2137 	}
       
  2138 //------------------------------------------------------------------
       
  2139 
       
  2140 TVerdict CTestGetMobileDataCallCaps::doTestStepL()
       
  2141 	{
       
  2142 	RMobileLine line;
       
  2143 	TEST_CHECKL(line.Open(iPhone, KDataLineName), KErrNone, _L("GT83-TDATA-001.01"));
       
  2144 	RMobileCall call ;
       
  2145 	TEST_CHECKL(call.OpenNewCall(line), KErrNone, _L("GT83-TDATA-013.06"));
       
  2146 
       
  2147 	RMobileCall::TMobileCallDataCapsV1 caps;
       
  2148 	RMobileCall::TMobileCallDataCapsV1Pckg capsPckg(caps);
       
  2149 	TEST(KErrNone == call.GetMobileDataCallCaps(capsPckg));
       
  2150 
       
  2151 	User::After(KTenSeconds);
       
  2152 
       
  2153 	call.Close();
       
  2154 	line.Close();
       
  2155 	return TestStepResult() ;
       
  2156 	}
       
  2157 
       
  2158 //New object to load and parse the test config file
       
  2159 
       
  2160 CConfigParams* CConfigParams::NewL(const TDesC &aCfgFileName)
       
  2161 	{
       
  2162 	CConfigParams *f;
       
  2163 	f=new (ELeave) CConfigParams();
       
  2164 	CleanupStack::PushL(f);
       
  2165 	//A leave during the ConstrucL is not fatal, just means there's no param file
       
  2166 	TRAP_IGNORE(f->ConstructL(aCfgFileName));
       
  2167 	CleanupStack::Pop();
       
  2168 	return f;
       
  2169 	}
       
  2170 
       
  2171 void CConfigParams::ConstructL(const TDesC &aCfgFileName)
       
  2172 	{
       
  2173 	//Find the config file
       
  2174 	TAutoClose<RFs> fs;
       
  2175 	User::LeaveIfError(fs.iObj.Connect());
       
  2176 	fs.PushL();
       
  2177 	//Location for the test parameter config file
       
  2178 	_LIT(KTinetConfigFilePaths,"\\;\\system\\data\\");
       
  2179 	TFindFile filePath(fs.iObj);
       
  2180 	User::LeaveIfError(filePath.FindByPath(aCfgFileName,&KTinetConfigFilePaths));
       
  2181 	//read the content of the file
       
  2182 	TAutoClose<RFile> fl;
       
  2183 	fl.PushL();
       
  2184 	User::LeaveIfError(fl.iObj.Open(fs.iObj,filePath.File(),EFileShareExclusive));
       
  2185 	User::LeaveIfError(fl.iObj.Read(iConfigParamBuf8));
       
  2186 	iConfigParamBuf.Copy(iConfigParamBuf8);
       
  2187 	CleanupStack::PopAndDestroy(2);
       
  2188 	iFileExist = ETrue;
       
  2189 	}
       
  2190 
       
  2191 const TPtrC CConfigParams::FindAlphaVar(const TDesC &aVarName, const TDesC &aDefault)
       
  2192 	{
       
  2193 	if(!iFileExist)
       
  2194 		return TPtrC(aDefault);
       
  2195 	TInt pos=iConfigParamBuf.Find(aVarName);
       
  2196 	if (pos==KErrNotFound)
       
  2197 		return TPtrC(aDefault);
       
  2198 	TLex lex(iConfigParamBuf.Mid(pos));
       
  2199 	lex.SkipCharacters();
       
  2200 	lex.SkipSpaceAndMark();		// Should be at the start of the data
       
  2201 	lex.SkipCharacters();
       
  2202 	return TPtrC(lex.MarkedToken().Ptr(),lex.MarkedToken().Length());
       
  2203 	}
       
  2204 
       
  2205 TInt CConfigParams::FindNumVar(const TDesC &aVarName, const TInt aDefault)
       
  2206 	{
       
  2207 	TInt result;
       
  2208 	TPtrC ptr = FindAlphaVar(aVarName,KNullDesC);
       
  2209 	if(ptr.Length())
       
  2210 		{
       
  2211 		TLex lex(ptr);
       
  2212 		if (lex.Val(result)==KErrNone)
       
  2213 			return result;
       
  2214 		}
       
  2215 	return aDefault;
       
  2216 	}
       
  2217 
       
  2218 TBool CConfigParams::ConfigFileExist()
       
  2219 	{
       
  2220 	return iFileExist;
       
  2221 	}
       
  2222