telephonyserverplugins/simtsy/test/Te_SimMisc/Te_SimMisc.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 //
       
    15 
       
    16 /**
       
    17  @file
       
    18 */
       
    19 
       
    20 #include "Te_SimMisc.h"
       
    21 
       
    22 #include "../../inc/simtsyglobalproperties.h"
       
    23 
       
    24 const TInt KOneSecond=1000000;	// Used in a time out function, 1 second (in microSeconds)
       
    25  
       
    26 
       
    27 //------------------------------------------------------------------
       
    28 //			** TEST SimMisc STEPS ***
       
    29 
       
    30 //------------------------------------------------------------------
       
    31 
       
    32 CSignalAndBatteryStrengthTest::CSignalAndBatteryStrengthTest()
       
    33 /** Each test step initialises it's own name
       
    34 */
       
    35 	{
       
    36 	// store the name of this test case
       
    37 	// this is the name that is used by the script file
       
    38 	SetTestStepName(_L("SignalAndBatteryStrengthTest"));
       
    39 	}
       
    40 //------------------------------------------------------------------
       
    41 
       
    42 TVerdict CSignalAndBatteryStrengthTest::doTestStepL( void )
       
    43 /** 
       
    44  * This method retrieves a phone's Signal and Battery Strength Information.
       
    45  */
       
    46 	{
       
    47     INFO_PRINTF1(_L("Get Signal Strength Information"));
       
    48 
       
    49 	// Get Signal caps
       
    50 
       
    51 	INFO_PRINTF1(_L("Calling RMobilePhone::GetSignalCaps()"));
       
    52 	TUint32 capabilities;
       
    53 	TInt ret = iPhone.GetSignalCaps(capabilities);
       
    54 	if(ret) 
       
    55 		{
       
    56 		INFO_PRINTF2(_L("RMobilePhone::GetSignalCaps() returned %d"), ret);
       
    57 		return EFail;
       
    58 		}
       
    59 
       
    60 	if(capabilities & RMobilePhone::KCapsGetSignalStrength)
       
    61 		{
       
    62 		INFO_PRINTF1(_L("Phone supports requests to get the current signal strength"));
       
    63 		}
       
    64 	if(capabilities & RMobilePhone::KCapsNotifySignalStrengthChange)
       
    65 		{
       
    66 		INFO_PRINTF1(_L("Phone supports requests for notification of change in signal strength"));
       
    67 		}
       
    68 
       
    69 	TInt32 signalStrength;
       
    70 	TInt8 bars;
       
    71 	RMobilePhone::TMobilePhoneBatteryInfoV1 battery;
       
    72 	// Get Battery Caps
       
    73 
       
    74 	INFO_PRINTF1(_L("Calling RMobilePhone::GetBatteryCaps()"));
       
    75 	ret = iPhone.GetBatteryCaps(capabilities);
       
    76 	if (ret)
       
    77 		{
       
    78 		INFO_PRINTF2(_L("RMobilePhone::GetBatteryCaps() returned: %d"), ret);
       
    79 		return EFail;
       
    80 		}
       
    81 
       
    82 	if(capabilities & RMobilePhone::KCapsGetBatteryInfo)
       
    83 		INFO_PRINTF1(_L("Phone supports requests to get the current battery info"));
       
    84 	if(capabilities & RMobilePhone::KCapsNotifyBatteryInfoChange)
       
    85 		INFO_PRINTF1(_L("Phone supports requests for notification of change in battery information."));
       
    86 
       
    87 	INFO_PRINTF1(_L("Calling RMobilePhone::GetSignalStrength()"));
       
    88 	iPhone.GetSignalStrength(iStatus, signalStrength, bars);
       
    89 	User::WaitForRequest(iStatus);
       
    90 	if (iStatus==KErrNone)
       
    91 		{
       
    92 		INFO_PRINTF2(TRefByValue<const TDesC>(_L("Signal strength (in dBm) : %d")), signalStrength);
       
    93 		INFO_PRINTF2(TRefByValue<const TDesC>(_L("Signal strength (in display bars) : %d")), bars);
       
    94 		}
       
    95 	else{
       
    96 		INFO_PRINTF2(TRefByValue<const TDesC>(_L("Signal strength, Error %d returned.")), ret);
       
    97 		return EFail;
       
    98 		}
       
    99 
       
   100 
       
   101 	INFO_PRINTF1(_L("Calling RMobilePhone::GetBatteryInfo()"));
       
   102 	iPhone.GetBatteryInfo(iStatus, battery);
       
   103 	User::WaitForRequest(iStatus);
       
   104 	if (iStatus==KErrNone)
       
   105 		{
       
   106 		INFO_PRINTF2(TRefByValue<const TDesC>(_L("Battery status : %d")), battery.iStatus);
       
   107 		INFO_PRINTF2(TRefByValue<const TDesC>(_L("Battery charge level : %d")), battery.iChargeLevel);
       
   108 		}
       
   109 	else{
       
   110 		INFO_PRINTF2(TRefByValue<const TDesC>(_L("Battery charge, Error %d returned.")), ret);
       
   111 		return EFail;
       
   112 	}
       
   113 
       
   114 
       
   115 	// Cancel Requests
       
   116 	INFO_PRINTF1(_L("Performing Cancel Requests for the above functions"));
       
   117 
       
   118 	iPhone.GetSignalStrength(iStatus, signalStrength, bars);
       
   119 	iPhone.CancelAsyncRequest(EMobilePhoneGetSignalStrength);
       
   120 	User::WaitForRequest(iStatus);
       
   121 	INFO_PRINTF2(TRefByValue<const TDesC>(_L("GetSignalStrength Cancel status = %d")), iStatus.Int());
       
   122 
       
   123 	return TestStepResult();
       
   124 	}
       
   125 //------------------------------------------------------------------
       
   126 
       
   127 CSubscriberIdTest::CSubscriberIdTest()
       
   128 /** Each test step initialises it's own name
       
   129 */
       
   130 	{
       
   131 	// store the name of this test case
       
   132 	// this is the name that is used by the script file
       
   133 	SetTestStepName(_L("SubscriberIdTest"));
       
   134 	}
       
   135 //------------------------------------------------------------------
       
   136 
       
   137 TVerdict CSubscriberIdTest::doTestStepL( void )
       
   138 	{
       
   139     INFO_PRINTF1(_L("Get Subscriber ID"));
       
   140 
       
   141 	RMobilePhone::TMobilePhoneSubscriberId subId;
       
   142 	iPhone.GetSubscriberId(iStatus, subId);
       
   143 	User::WaitForRequest(iStatus);
       
   144 	if (iStatus==KErrNone)
       
   145 		{
       
   146 		INFO_PRINTF2(TRefByValue<const TDesC>(_L("SubscriberId: %S")), &subId);
       
   147 		}
       
   148 	else
       
   149 		{
       
   150 		INFO_PRINTF2(TRefByValue<const TDesC>(_L("GetSubscriberId status %d")), iStatus.Int());
       
   151 		return EFail;
       
   152 		}
       
   153 	
       
   154 	iPhone.GetSubscriberId(iStatus, subId);
       
   155 	iPhone.CancelAsyncRequest(EMobilePhoneGetSubscriberId);
       
   156 	User::WaitForRequest(iStatus);
       
   157 	INFO_PRINTF2(TRefByValue<const TDesC>(_L("RMobilePhone::GetSubscriberIdCancel status = %d")), iStatus.Int());
       
   158 	return TestStepResult();
       
   159 	}
       
   160 //------------------------------------------------------------------
       
   161 
       
   162 CPhoneStoreTest::CPhoneStoreTest()
       
   163 /** Each test step initialises it's own name
       
   164 */
       
   165 	{
       
   166 	// store the name of this test case
       
   167 	// this is the name that is used by the script file
       
   168 	SetTestStepName(_L("PhoneStoreTest"));
       
   169 	}
       
   170 //------------------------------------------------------------------
       
   171 
       
   172 TVerdict CPhoneStoreTest::doTestStepL( void )
       
   173 	{
       
   174 	// Get phone store info for various phonebooks
       
   175 	RMobilePhoneStore::TMobilePhoneStoreInfoV1 info;
       
   176 	RMobilePhoneStore::TMobilePhoneStoreInfoV1Pckg infoPckg(info);
       
   177 
       
   178     INFO_PRINTF1(_L("Test the phone stores"));
       
   179 
       
   180 	iPhone.GetPhoneStoreInfo(iStatus, infoPckg, KETelIccAdnPhoneBook);
       
   181 	User::WaitForRequest(iStatus);
       
   182 	if(iStatus.Int())
       
   183 		{
       
   184 		return EFail;
       
   185 		}
       
   186 	
       
   187 
       
   188 	INFO_PRINTF2(TRefByValue<const TDesC>(_L("Store Name: %S")), &info.iName);
       
   189 	TESTL(info.iType==RMobilePhoneStore::EPhoneBookStore);
       
   190 	INFO_PRINTF2(TRefByValue<const TDesC>(_L("Number of used entries: %d")), info.iUsedEntries);
       
   191 	INFO_PRINTF2(TRefByValue<const TDesC>(_L("Number of total entries: %d")), info.iTotalEntries);
       
   192 
       
   193 	RMobilePhoneBookStore::TMobilePhoneBookInfoV1 phbkInfo;
       
   194 	RMobilePhoneBookStore::TMobilePhoneBookInfoV1Pckg phbkInfoPckg(phbkInfo);
       
   195 
       
   196 
       
   197 	iPhone.GetPhoneStoreInfo(iStatus, phbkInfoPckg, KETelIccAdnPhoneBook);
       
   198 	User::WaitForRequest(iStatus);
       
   199 	if(iStatus.Int())
       
   200 		{
       
   201 		return EFail;
       
   202 		}
       
   203 
       
   204 	INFO_PRINTF2(TRefByValue<const TDesC>(_L("Store Name: %S")), &phbkInfo.iName);
       
   205 	TESTL(phbkInfo.iType==RMobilePhoneStore::EPhoneBookStore);
       
   206 	INFO_PRINTF2(TRefByValue<const TDesC>(_L("Number of used entries: %d")), phbkInfo.iUsedEntries);
       
   207 	INFO_PRINTF2(TRefByValue<const TDesC>(_L("Number of total entries: %d")), phbkInfo.iTotalEntries);
       
   208 	INFO_PRINTF2(TRefByValue<const TDesC>(_L("Max text length: %d")), phbkInfo.iMaxTextLength);
       
   209 	INFO_PRINTF2(TRefByValue<const TDesC>(_L("Max number length: %d")), phbkInfo.iMaxNumLength);
       
   210 	return TestStepResult();
       
   211 	}
       
   212 //------------------------------------------------------------------
       
   213 
       
   214 CGetCaps::CGetCaps()
       
   215 /** Each test step initialises it's own name
       
   216 */
       
   217 	{
       
   218 	// store the name of this test case
       
   219 	// this is the name that is used by the script file
       
   220 	SetTestStepName(_L("GetCaps"));
       
   221 	}
       
   222 //------------------------------------------------------------------
       
   223 
       
   224 TVerdict CGetCaps::doTestStepL( void )
       
   225 	{
       
   226 	RPhone::TCaps capabilities;
       
   227 	RPhone::TStatus phoneStatus;
       
   228 	RPhone::TPhoneInfo phoneInfo;
       
   229 	TInt ret;
       
   230     INFO_PRINTF1(_L("Get Phone Capabilities"));
       
   231 
       
   232 // Get Caps and print them
       
   233 	INFO_PRINTF1(_L("Calling RMobilePhone::GetCaps()"));
       
   234 	ret = iPhone.GetCaps(capabilities);
       
   235 	if(ret) 
       
   236 		{
       
   237 		INFO_PRINTF2(_L("RMobilePhone::GetCaps() returned: %d"), ret);
       
   238 		return EFail;
       
   239 		}
       
   240 
       
   241 	if(capabilities.iFlags & RPhone::KCapsUnknown)
       
   242 		{
       
   243 		INFO_PRINTF1(_L("The capabilities of the phone are not currently known"));
       
   244 		}
       
   245 	if(capabilities.iFlags & RPhone::KCapsData)
       
   246 		{
       
   247 		INFO_PRINTF1(_L("The phone supports data calls"));
       
   248 		}
       
   249 	if(capabilities.iFlags & RPhone::KCapsFaxClassOne)
       
   250 		{
       
   251 		INFO_PRINTF1(_L("The phone supports the fax class 1 interface"));
       
   252 		}
       
   253 	if(capabilities.iFlags &	RPhone::KCapsFaxClassOnePointZero)
       
   254 		{
       
   255 		INFO_PRINTF1(_L("The phone supports the fax class 1.0 interface"));
       
   256 		}
       
   257 	if(capabilities.iFlags & RPhone::KCapsFaxClassTwo)
       
   258 		{
       
   259 		INFO_PRINTF1(_L("The phone supports the fax class 2 interface"));
       
   260 		}
       
   261 	if(capabilities.iFlags & RPhone::KCapsFaxClassTwoPointZero)
       
   262 		{
       
   263 		INFO_PRINTF1(_L("The phone supports the fax class 2.0 interface"));
       
   264 		}
       
   265 	if(capabilities.iFlags & RPhone::KCapsFaxClassTwoPointOne)
       
   266 		{
       
   267 		INFO_PRINTF1(_L("The phone supports the fax class 2.1 interface"));
       
   268 		}
       
   269 	if(capabilities.iFlags & RPhone::KCapsVoice)
       
   270 		{
       
   271 		INFO_PRINTF1(_L("The phone supports voice calls"));
       
   272 		}
       
   273 	if(capabilities.iFlags & RPhone::KCapsEventModemDetection)
       
   274 		{
       
   275 		INFO_PRINTF1(_L("The phone supports modem detection events"));
       
   276 		}
       
   277 	if(capabilities.iFlags & RPhone::KCapsStealCommPort)
       
   278 		{
       
   279 		INFO_PRINTF1(_L("The phone supports the ability to take the comms port "));
       
   280 		}
       
   281 // Gets Status and prints info
       
   282 	
       
   283 	INFO_PRINTF1(_L("Calling RMobilePhone::GetStatus()"));	
       
   284 	ret = iPhone.GetStatus(phoneStatus);
       
   285 	if(ret) 
       
   286 		{
       
   287 		INFO_PRINTF2(_L("RMobilePhone::GetStatus() returned %d"), ret);
       
   288 		return EFail;
       
   289 		}
       
   290 
       
   291 	switch(phoneStatus.iMode)
       
   292 	{
       
   293 	case RPhone::EModeUnknown:
       
   294 		INFO_PRINTF1(_L("The phone is currently in an unknown state"));
       
   295 		break;
       
   296 
       
   297 	case RPhone::EModeIdle:
       
   298 		INFO_PRINTF1(_L("The phone is currently idle"));
       
   299 		break;
       
   300 
       
   301 	case RPhone::EModeEstablishingLink:
       
   302 		INFO_PRINTF1(_L("The phone is currently trying to establish a call"));
       
   303 		break;
       
   304 
       
   305 	case RPhone::EModeOnlineData:
       
   306 		INFO_PRINTF1(_L("The phone is in the connected and \"on-line data\" state"));
       
   307 		break;
       
   308 
       
   309 	case RPhone::EModeOnlineCommand:
       
   310 		INFO_PRINTF1(_L("The phone is in the connected and \"on-line command\" state"));
       
   311 		break;
       
   312 
       
   313 	}
       
   314 
       
   315 	// Gives time to read the results
       
   316 	INFO_PRINTF1(_L("Calling RMobilePhone::GetInfo()"));
       
   317 	ret = iPhone.GetInfo(phoneInfo);
       
   318 	if(ret) {
       
   319 		INFO_PRINTF2(_L("RMobilePhone::GetInfo() returned %d"), ret);
       
   320 		return EFail;
       
   321 	}
       
   322 
       
   323 	switch(phoneInfo.iDetection)
       
   324 	{
       
   325 		case RPhone::EDetectedPresent:
       
   326 			INFO_PRINTF1(_L("The local modem is present"));
       
   327 			break;
       
   328 
       
   329 		case RPhone::EDetectedNotPresent:
       
   330 			INFO_PRINTF1(_L("The local modem is not present"));
       
   331 			break;
       
   332 
       
   333 		case RPhone::EDetectedUnknown:
       
   334 			INFO_PRINTF1(_L("Status of the local modem not detected"));
       
   335 			break;
       
   336 
       
   337 	}
       
   338 	return TestStepResult();
       
   339 	}
       
   340 //------------------------------------------------------------------
       
   341 
       
   342 CGetLinesStatus::CGetLinesStatus()
       
   343 /** Each test step initialises it's own name
       
   344 */
       
   345 	{
       
   346 	// store the name of this test case
       
   347 	// this is the name that is used by the script file
       
   348 	SetTestStepName(_L("GetLinesStatus"));
       
   349 	}
       
   350 //------------------------------------------------------------------
       
   351 
       
   352 TVerdict CGetLinesStatus::doTestStepL( void )
       
   353 	{
       
   354 	TInt aCount;
       
   355 	TInt i;					// Loop counter
       
   356 	RPhone::TLineInfo	lineInfo;
       
   357 
       
   358     INFO_PRINTF1(_L("Testing the line(s) status"));
       
   359 
       
   360 	TInt ret = iPhone.EnumerateLines(aCount);
       
   361 	INFO_PRINTF2(_L("There are %d lines on this phone"), aCount);
       
   362 	if(ret)
       
   363 		{
       
   364 		return EFail;
       
   365 		}
       
   366 
       
   367 	for(i=0;i<aCount;i++)
       
   368 		{
       
   369 		iPhone.GetLineInfo(i+1, lineInfo);
       
   370 		switch(lineInfo.iStatus)
       
   371 			{
       
   372 			case RCall::EStatusUnknown:
       
   373 				INFO_PRINTF3(_L("Line index %d: %S, Status: The call status is not currently known"), i+1, &lineInfo.iName);
       
   374 				break;
       
   375 
       
   376 			case RCall::EStatusIdle:
       
   377 				INFO_PRINTF3(_L("Line index %d: %S, Status: The call is idle"), i+1, &lineInfo.iName);
       
   378 				break;
       
   379 			
       
   380 			case RCall::EStatusDialling:   
       
   381 				INFO_PRINTF3(_L("Line index %d: %S, Status: The call is dialling."), i+1, &lineInfo.iName);
       
   382 				break;
       
   383 
       
   384 			case RCall::EStatusRinging:
       
   385 				INFO_PRINTF3(_L("Line index %d: %S, Status: The call is ringing "), i+1, &lineInfo.iName);
       
   386 				break;
       
   387 
       
   388 			case RCall::EStatusAnswering:
       
   389 				INFO_PRINTF3(_L("Line index %d: %S, Status: The call is being answered"), i+1, &lineInfo.iName);
       
   390 				break;
       
   391 
       
   392 			case RCall::EStatusConnecting:
       
   393 				INFO_PRINTF3(_L("Line index %d: %S, Status: The call is connecting"), i+1, &lineInfo.iName);
       
   394 				break;
       
   395 
       
   396 			case RCall::EStatusConnected:
       
   397 				INFO_PRINTF3(_L("Line index %d: %S, Status: The call is connected and active"), i+1, &lineInfo.iName);
       
   398 				break;
       
   399 
       
   400 			case RCall::EStatusHangingUp:
       
   401 				INFO_PRINTF3(_L("Line index %d: %S, Status: The call is being terminated"), i+1, &lineInfo.iName);
       
   402 				break;
       
   403 
       
   404 			}
       
   405 
       
   406 		// Waits a bit
       
   407 		User::After( 3 * KOneSecond);
       
   408 
       
   409 		if(lineInfo.iLineCapsFlags & RLine::KCapsData)
       
   410 			{
       
   411 			INFO_PRINTF1(_L("The line supports data connections"));
       
   412 			}
       
   413 		if(lineInfo.iLineCapsFlags & RLine::KCapsFax)
       
   414 			{
       
   415 			INFO_PRINTF1(_L("The line supports fax connections"));
       
   416 			}
       
   417 		if(lineInfo.iLineCapsFlags & RLine::KCapsVoice)
       
   418 			{
       
   419 			INFO_PRINTF1(_L("The line supports voice connections"));
       
   420 			}
       
   421 		if(lineInfo.iLineCapsFlags & RLine::KCapsEventIncomingCall)
       
   422 			{
       
   423 			INFO_PRINTF1(_L("The line supports incoming call notification requests"));
       
   424 			}
       
   425 	
       
   426 		}
       
   427 
       
   428 	return TestStepResult();
       
   429 	}
       
   430 //------------------------------------------------------------------
       
   431 
       
   432 CGetMultimodeCaps::CGetMultimodeCaps()
       
   433 /** Each test step initialises it's own name
       
   434 */
       
   435 	{
       
   436 	// store the name of this test case
       
   437 	// this is the name that is used by the script file
       
   438 	SetTestStepName(_L("GetMultimodeCaps"));
       
   439 	}
       
   440 //------------------------------------------------------------------
       
   441 
       
   442 TVerdict CGetMultimodeCaps::doTestStepL( void )
       
   443 {
       
   444 	TUint32 capabilities;
       
   445 
       
   446     INFO_PRINTF1(_L("Testing the Multimode caps"));
       
   447 	
       
   448 	INFO_PRINTF1(_L("Calling RMobilePhone::GetMultimodeCaps()"));
       
   449 	TInt ret = iPhone.GetMultimodeCaps(capabilities);
       
   450 	if(ret) 
       
   451 	{
       
   452 		INFO_PRINTF2(_L("RMobilePhone::GetMultimodeCaps returned %d"), ret);
       
   453 		return EFail;
       
   454 	}
       
   455 
       
   456 	if(capabilities & RMobilePhone::KCapsGsmSupported)	
       
   457 		{
       
   458 		INFO_PRINTF1(_L("Phone can operate in GSM 900/1800/1900 mode"));
       
   459 		}
       
   460 	if(capabilities & RMobilePhone::KCapsGprsSupported)
       
   461 		{
       
   462 		INFO_PRINTF1(_L("Phone can operate in GPRS mode"));
       
   463 		}
       
   464 	if(capabilities & RMobilePhone::KCapsAmpsSupported)
       
   465 		{
       
   466 		INFO_PRINTF1(_L("Phone can operate in AMPS 800 mode"));
       
   467 		}
       
   468 	if(capabilities & RMobilePhone::KCapsWcdmaSupported)
       
   469 		{
       
   470 		INFO_PRINTF1(_L("Phone can operate in W-CDMA mode"));
       
   471 		}
       
   472 
       
   473 	return TestStepResult();
       
   474 	}
       
   475 //------------------------------------------------------------------
       
   476 
       
   477 CGetNetworkCaps::CGetNetworkCaps()
       
   478 /** Each test step initialises it's own name
       
   479 */
       
   480 	{
       
   481 	// store the name of this test case
       
   482 	// this is the name that is used by the script file
       
   483 	SetTestStepName(_L("GetNetworkCaps"));
       
   484 	}
       
   485 //------------------------------------------------------------------
       
   486 
       
   487 TVerdict CGetNetworkCaps::doTestStepL( void )
       
   488 {
       
   489 	TUint32 aCaps;
       
   490 
       
   491     INFO_PRINTF1(_L("Getting the phone network caps"));
       
   492 
       
   493 	INFO_PRINTF1(_L("Calling RMobilePhone::GetNetworkCaps()"));
       
   494 	TInt ret = iPhone.GetNetworkCaps(aCaps);
       
   495 	if(ret) 
       
   496 	{
       
   497 		INFO_PRINTF2(_L("RMobilePhone::GetNetworkCaps() returned %d"), ret);
       
   498 		return EFail;
       
   499 	}
       
   500 
       
   501 	if(aCaps & RMobilePhone::KCapsGetRegistrationStatus)
       
   502 		{
       
   503 		INFO_PRINTF1(_L("The phone supports retrieval of current registration status"));
       
   504 		}
       
   505 	if(aCaps & RMobilePhone::KCapsNotifyRegistrationStatus)
       
   506 		{
       
   507 		INFO_PRINTF1(_L("The phone supports notifications of change in registration status"));
       
   508 		}
       
   509 	if(aCaps & RMobilePhone::KCapsGetCurrentMode)
       
   510 		{
       
   511 		INFO_PRINTF1(_L("The phone supports retrieval of current mode"));
       
   512 		}
       
   513 	if(aCaps & RMobilePhone::KCapsNotifyMode)
       
   514 		{
       
   515 		INFO_PRINTF1(_L("The phone supports notification of change in mode"));
       
   516 		}
       
   517 	if(aCaps & RMobilePhone::KCapsGetCurrentNetwork)
       
   518 		{
       
   519 		INFO_PRINTF1(_L("phone supports retrieval of current network information"));
       
   520 		}
       
   521 	if(aCaps & RMobilePhone::KCapsNotifyCurrentNetwork)
       
   522 		{
       
   523 		INFO_PRINTF1(_L("The phone supports notification of change of current network"));
       
   524 		}
       
   525 	if(aCaps & RMobilePhone::KCapsGetHomeNetwork)
       
   526 		{
       
   527 		INFO_PRINTF1(_L("The phone supports retrieval of home network information"));
       
   528 		}
       
   529 	if(aCaps & RMobilePhone::KCapsGetDetectedNetworks)
       
   530 		{
       
   531 		INFO_PRINTF1(_L("The phone supports retrieval of a list of detected networks"));
       
   532 		}
       
   533 	if(aCaps & RMobilePhone::KCapsManualNetworkSelection)
       
   534 		{
       
   535 		INFO_PRINTF1(_L("The phone supports manual network selection mode"));
       
   536 		}
       
   537 	if(aCaps & RMobilePhone::KCapsGetNITZInfo)
       
   538 		{
       
   539 		INFO_PRINTF1(_L("The phone supports retrieval of time/date from the network"));
       
   540 		}
       
   541 	if(aCaps & RMobilePhone::KCapsNotifyNITZInfo)
       
   542 		{
       
   543 		INFO_PRINTF1(_L("The phone supports notification of new updates of time/date from the network"));
       
   544 		}
       
   545 
       
   546 	return TestStepResult();
       
   547 	}
       
   548 //------------------------------------------------------------------
       
   549 
       
   550 CGetCurrentMode::CGetCurrentMode()
       
   551 /** Each test step initialises it's own name
       
   552 */
       
   553 	{
       
   554 	// store the name of this test case
       
   555 	// this is the name that is used by the script file
       
   556 	SetTestStepName(_L("GetCurrentMode"));
       
   557 	}
       
   558 //------------------------------------------------------------------
       
   559 
       
   560 TVerdict CGetCurrentMode::doTestStepL( void )
       
   561 	{
       
   562 	RMobilePhone::TMobilePhoneNetworkMode netMode;
       
   563     INFO_PRINTF1(_L("Testing the current mode and notification"));
       
   564 
       
   565 	INFO_PRINTF1(_L("Calling RMobilePhone::GetCurrentMode()"));
       
   566 	TInt ret = iPhone.GetCurrentMode(netMode);
       
   567 	if(ret)
       
   568 		{
       
   569 		INFO_PRINTF2(_L("RMobilePhone::GetCurrentMode() returned %d"), ret);
       
   570 		return EFail;
       
   571 		}
       
   572 
       
   573 	switch(netMode)
       
   574 	{
       
   575 		case RMobilePhone::	ENetworkModeUnregistered:
       
   576 			INFO_PRINTF1(_L("ME is not registered."));
       
   577 			break;
       
   578 
       
   579 		case RMobilePhone::ENetworkModeGsm:
       
   580 			INFO_PRINTF1(_L("GSM or DCS1800 network."));
       
   581 			break;
       
   582 
       
   583 		case RMobilePhone::ENetworkModeAmps:
       
   584 			INFO_PRINTF1(_L("AMPS network"));
       
   585 			break;
       
   586 
       
   587 		case RMobilePhone::ENetworkModeCdma95:
       
   588 			INFO_PRINTF1(_L("CDMA network."));
       
   589 			break;
       
   590 
       
   591 		case RMobilePhone::ENetworkModeCdma2000:
       
   592 			INFO_PRINTF1(_L("CDMA network."));
       
   593 			break;
       
   594 
       
   595 		case RMobilePhone::ENetworkModeWcdma:
       
   596 			INFO_PRINTF1(_L("WCDMA network"));
       
   597 			break;
       
   598 			
       
   599 		case RMobilePhone::ENetworkModeTdcdma:
       
   600 			INFO_PRINTF1(_L("TD-CDMA network"));
       
   601 			break;
       
   602 			
       
   603 		case RMobilePhone::ENetworkModeUnknown:
       
   604 		default:
       
   605 			INFO_PRINTF1(_L("Network mode is unknown"));
       
   606 			break;
       
   607 		}
       
   608 	
       
   609 	return TestStepResult();
       
   610 	}
       
   611 
       
   612 
       
   613 CGetPhoneId::CGetPhoneId()
       
   614 /** Each test step initialises it's own name
       
   615 */
       
   616 	{
       
   617 	// store the name of this test case
       
   618 	// this is the name that is used by the script file
       
   619 	SetTestStepName(_L("GetPhoneIdAndCaps"));
       
   620 	}
       
   621 
       
   622 TVerdict CGetPhoneId::doTestStepL( void )
       
   623 	{
       
   624 	TUint32 aCaps;
       
   625 
       
   626     INFO_PRINTF1(_L("Getting the phone identity caps"));
       
   627 
       
   628 	INFO_PRINTF1(_L("Calling RMobilePhone::GetIdentityCaps()"));
       
   629 	TInt ret = iPhone.GetIdentityCaps(aCaps);
       
   630 	if(ret) 
       
   631 		{
       
   632 		INFO_PRINTF2(_L("RMobilePhone::GetIdentityCaps() returned %d"), ret);
       
   633 		return EFail;
       
   634 		}
       
   635 
       
   636 	if(aCaps & RMobilePhone::  KCapsGetManufacturer)
       
   637 		{
       
   638 		INFO_PRINTF1(_L("The phone supports retrieval of manufacturer identity."));
       
   639 		}
       
   640 		
       
   641 	if(aCaps & RMobilePhone:: KCapsGetModel)
       
   642 		{
       
   643 		INFO_PRINTF1(_L("The phone supports retrieval of model identity."));
       
   644 		}
       
   645 		
       
   646 	if(aCaps & RMobilePhone:: KCapsGetRevision)
       
   647 		{
       
   648 		INFO_PRINTF1(_L("The phone supports retrieval of revision identity."));
       
   649 		}
       
   650 		
       
   651 	if(aCaps & RMobilePhone:: KCapsGetSerialNumber)
       
   652 		{
       
   653 		INFO_PRINTF1(_L("The phone supports retrieval of serial number identity."));
       
   654 		}
       
   655 		
       
   656 	if(aCaps & RMobilePhone:: KCapsGetSubscriberId)
       
   657 		{
       
   658 		INFO_PRINTF1(_L("The phone supports retrieval of subscriber identity."));
       
   659 		} 
       
   660 		
       
   661 	//Test GePhoneId()
       
   662 	RMobilePhone::TMobilePhoneIdentityV1 phoneId;
       
   663 	iPhone.GetPhoneId(iStatus, phoneId);
       
   664 	User::WaitForRequest(iStatus);
       
   665 	if(iStatus.Int())
       
   666 		{
       
   667 		return EFail;
       
   668 		}
       
   669 	
       
   670 	INFO_PRINTF2(TRefByValue<const TDesC>(_L("Phone manufacturer: %S")), &(phoneId.iManufacturer));
       
   671 	INFO_PRINTF2(TRefByValue<const TDesC>(_L("Phone model: %S")), &(phoneId. iModel));
       
   672 	INFO_PRINTF2(TRefByValue<const TDesC>(_L("Phone revision: %S")), &(phoneId. iRevision));
       
   673 	INFO_PRINTF2(TRefByValue<const TDesC>(_L("Phone serial number: %S")), &(phoneId. iSerialNumber));	
       
   674 	
       
   675 	//Test cancel
       
   676 	iPhone.GetPhoneId(iStatus, phoneId);
       
   677 	iPhone.CancelAsyncRequest(EMobilePhoneGetPhoneId);
       
   678 	User::WaitForRequest(iStatus);
       
   679 	INFO_PRINTF2(TRefByValue<const TDesC>(_L("GetPhoneId Cancel status = %d")), iStatus.Int());
       
   680 		  
       
   681 	return TestStepResult();	
       
   682 	}
       
   683 	
       
   684 CPubSubMode::CPubSubMode()
       
   685 /** Each test step initialises it's own name
       
   686 */
       
   687 	{
       
   688 	// store the name of this test case
       
   689 	// this is the name that is used by the script file
       
   690 	SetTestStepName(_L("PubSubMode"));
       
   691 	}
       
   692 
       
   693 TVerdict CPubSubMode::doTestStepL( void )
       
   694 	{
       
   695     INFO_PRINTF1(_L("Test changing test number P&S methods"));
       
   696 
       
   697 	DisconnectFromEtel();
       
   698 	
       
   699 	TInt testnumber = 5;
       
   700 	TInt ret;
       
   701 	RMobilePhone::TMobilePhoneIdentityV1 phoneId;
       
   702 	TBuf<25> manufacturerid;
       
   703 	TBuf<25> modelid;
       
   704 	TBuf<25> serialid;
       
   705 	TBuf<25> revision;
       
   706 		
       
   707 	//Test 1: Set the test number using P&S	
       
   708 	INFO_PRINTF1(_L("Set the test number using P&S."));
       
   709 	testnumber = 6;
       
   710 	DisconnectFromEtel();
       
   711 	
       
   712 	ret = RProperty::Set(KUidPSSimTsyCategory,	KPSSimTsyTestNumber, testnumber);
       
   713 	TEST(ret == KErrNone);
       
   714 	
       
   715 	TInt value;
       
   716 	ret = RProperty::Get(KUidPSSimTsyCategory,	KPSSimTsyTestNumber, value);
       
   717 	TEST(value == testnumber);
       
   718 	
       
   719 	if ( (ret = ConnectToEtelL()) !=KErrNone)
       
   720 		{
       
   721 		ERR_PRINTF2(_L("Failed to initialise the phone (%d)"), ret);
       
   722 		SetTestStepResult(EFail);
       
   723 		}
       
   724 	
       
   725 	iPhone.GetPhoneId(iStatus, phoneId);
       
   726 	User::WaitForRequest(iStatus);
       
   727 	if(iStatus.Int())
       
   728 		{
       
   729 		SetTestStepResult(EFail);
       
   730 		}
       
   731 	
       
   732 	manufacturerid=_L("yPSIONy");
       
   733 	modelid=_L("y666y");
       
   734 	serialid=_L("y1234567890y");
       
   735 	revision=_L("y1.1y");
       
   736 	
       
   737 	TEST(phoneId.iManufacturer == manufacturerid);
       
   738 	TEST(phoneId.iModel == modelid);
       
   739 	TEST(phoneId.iRevision == revision);
       
   740 	TEST(phoneId.iSerialNumber == serialid);
       
   741 	
       
   742 	//Test 2: Test phone power uid with P&S
       
   743 	INFO_PRINTF1(_L("Test phone power uid with and P&S."));
       
   744 	testnumber = 7;
       
   745 	DisconnectFromEtel();	
       
   746 	
       
   747 	ret = RProperty::Set(KUidPSSimTsyCategory,	KPSSimTsyTestNumber, testnumber);
       
   748 	TEST(ret == KErrNone);
       
   749 	
       
   750 	if ( (ret = ConnectToEtelL()) !=KErrNone)
       
   751 		{
       
   752 		ERR_PRINTF2(_L("Failed to initialise the phone (%d)"), ret);
       
   753 		SetTestStepResult(EFail);
       
   754 		}
       
   755 
       
   756 	testnumber = 0;
       
   757 	DisconnectFromEtel();
       
   758 	
       
   759 	ret = RProperty::Set(KUidPSSimTsyCategory,	KPSSimTsyTestNumber, testnumber);
       
   760 	TEST(ret == KErrNone);
       
   761 	
       
   762 	if ( (ret = ConnectToEtelL()) !=KErrNone)
       
   763 		{
       
   764 		ERR_PRINTF2(_L("Failed to initialise the phone (%d)"), ret);
       
   765 		SetTestStepResult(EFail);
       
   766 		}
       
   767 	
       
   768 	//Test 3: Initiate voice call using P&S
       
   769 	INFO_PRINTF1(_L("Initiate voice call using P&S."));		
       
   770 
       
   771 	TestCallInitiationL(KVoiceLineName, KUidPSSimTsyCategory, KPSSimTsyIncomingVoiceCall);
       
   772 	
       
   773 	//Test 4: Initiate data call using P&S
       
   774 	INFO_PRINTF1(_L("Initiate data call using P&S."));		
       
   775 
       
   776 	TestCallInitiationL(KDataLineName, KUidPSSimTsyCategory, KPSSimTsyIncomingDataCall);
       
   777 
       
   778 	//Test 5: Test reg status using old P&S uid (KUidSimtsyCategory/KSimtsyRegStatChange) and new P&S uid (KUidPSSimTsyCategory/KPSSimTsyRegStatChange)
       
   779 	INFO_PRINTF1(_L("Test reg status."));	
       
   780 	
       
   781 	//KUidSimtsyCategory/KSimtsyRegStatChange (Regression)
       
   782 	
       
   783 	TInt dummy;	
       
   784 	ret = RProperty::Get(KUidSimtsyCategoryLocal, KSimtsyRegStatChange, dummy);
       
   785 	if(ret == KErrNotFound)
       
   786 		{
       
   787 		RProperty::Define(KUidSimtsyCategoryLocal, KSimtsyRegStatChange, KSimtsyRegStatChangeType);
       
   788 		}
       
   789 
       
   790 	RMobilePhone::TMobilePhoneRegistrationStatus regStatus;
       
   791 	iPhone.NotifyNetworkRegistrationStatusChange(iStatus,regStatus);
       
   792 	
       
   793 	//change it using KUidSimtsyCategory/KSimtsySignalStrengthChange - this only changes the bar level
       
   794 	RMobilePhone::TMobilePhoneRegistrationStatus expectedRegStatus = RMobilePhone::ENotRegisteredEmergencyOnly;
       
   795 	ret = RProperty::Set(KUidSimtsyCategoryLocal, KSimtsyRegStatChange, expectedRegStatus);
       
   796 	TEST(ret == KErrNone);	
       
   797 	
       
   798 	User::WaitForRequest(iStatus);
       
   799 	TEST(iStatus==KErrNone);
       
   800 	TEST(regStatus == expectedRegStatus);
       
   801 	
       
   802 	//KUidPSSimTsyCategory/KPSSimTsyRegStatChange
       
   803 	iPhone.NotifyNetworkRegistrationStatusChange(iStatus,regStatus);
       
   804 	
       
   805 	//change it using KUidSimtsyCategory/KSimtsySignalStrengthChange - this only changes the bar level
       
   806 	expectedRegStatus = RMobilePhone::ERegisteredRoaming;
       
   807 	ret = RProperty::Set(KUidPSSimTsyCategory, KPSSimTsyRegStatChange, expectedRegStatus);
       
   808 	TEST(ret == KErrNone);	
       
   809 	
       
   810 	User::WaitForRequest(iStatus);
       
   811 	TEST(iStatus==KErrNone);
       
   812 	TEST(regStatus == expectedRegStatus);	
       
   813 
       
   814 	//Test 6:  Test signal strength status using old P&S uid (KUidSimtsyCategory/KSimtsySignalStrengthChange) and new P&S uid (KUidPSSimTsyCategory/KPSSimTsySignalStrengthChange)
       
   815 	INFO_PRINTF1(_L("Test signal strength status."));
       
   816 	//KUidSimtsyCategory/KSimtsySignalStrengthChange    (Regression)
       
   817 
       
   818 	ret = RProperty::Get(KUidSimtsyCategoryLocal, KSimtsySignalStrengthChange, dummy);
       
   819 	if(ret == KErrNotFound)
       
   820 		{
       
   821 		RProperty::Define(KUidSimtsyCategoryLocal, KSimtsySignalStrengthChange, KSimtsySignalStrengthChangeType);
       
   822 		}
       
   823 
       
   824 	TInt32 signalStrength;
       
   825 	TInt8 barLevel;
       
   826 	iPhone.NotifySignalStrengthChange(iStatus,signalStrength,barLevel);
       
   827 	
       
   828 	//change it using KUidSimtsyCategory/KSimtsySignalStrengthChange - this only changes the bar level
       
   829 	TInt8 expectedBarLevel = 11;
       
   830 	ret = RProperty::Set(KUidSimtsyCategoryLocal, KSimtsySignalStrengthChange, expectedBarLevel);
       
   831 	TEST(ret == KErrNone);	
       
   832 	
       
   833 	User::WaitForRequest(iStatus);
       
   834 	TEST(iStatus.Int()==KErrNone);
       
   835 	TEST(barLevel == expectedBarLevel);
       
   836 	
       
   837 	//KUidPSSimTsyCategory/KPSSimTsySignalStrengthChange
       
   838 	
       
   839 	//do not have to define this property as defined by simtsy
       
   840 	iPhone.NotifySignalStrengthChange(iStatus,signalStrength,barLevel);
       
   841 	
       
   842 	//change it using KUidSimtsyCategory/KSimtsySignalStrengthChange - this only changes the bar level
       
   843 	expectedBarLevel = 4;
       
   844 	ret = RProperty::Set(KUidSimtsyCategoryLocal, KSimtsySignalStrengthChange, expectedBarLevel);
       
   845 	TEST(ret == KErrNone);	
       
   846 	
       
   847 	User::WaitForRequest(iStatus);
       
   848 	TEST(iStatus.Int()==KErrNone);
       
   849 	TEST(barLevel == expectedBarLevel);	
       
   850 	
       
   851 
       
   852 	return TestStepResult();
       
   853 	}
       
   854 	
       
   855 void CPubSubMode::DisconnectFromEtel()
       
   856 	{	
       
   857 	//disconnect phone session
       
   858 	iPhone.Close();
       
   859 	}
       
   860 
       
   861 TInt CPubSubMode::ConnectToEtelL()
       
   862 	{
       
   863 	User::LeaveIfError(iPhone.Open(iTelServer,KPhoneName)) ;
       
   864 	// Initialize the Phone
       
   865 	return iPhone.Initialise();
       
   866 	}
       
   867 	
       
   868 void CPubSubMode::TestCallInitiationL(const TDesC& aLineName, TUid aPSCallInitCategory, const TInt aPSCallInitKey)
       
   869 	{		
       
   870 	RLine line;
       
   871 	CleanupClosePushL(line); 
       
   872 	
       
   873 	TName callName;
       
   874 	
       
   875 	INFO_PRINTF2(_L("Opening %S Line"), &aLineName);
       
   876 
       
   877 	TInt ret = line.Open(iPhone,aLineName);
       
   878 	TEST(ret==KErrNone);
       
   879 
       
   880 	TInt callID = 0;
       
   881 	RCall call;
       
   882 
       
   883 	//Test  Initiate call using P&S
       
   884 	
       
   885 	line.NotifyIncomingCall(iStatus, callName);	// wait for a call
       
   886 	
       
   887 	ret = RProperty::Set(aPSCallInitCategory, aPSCallInitKey, callID);
       
   888 	TEST(ret == KErrNone);
       
   889 	callID++;
       
   890 	
       
   891 	User::WaitForRequest(iStatus);
       
   892 	TEST(iStatus == KErrNone);	
       
   893 	
       
   894 	//answer the call then hangup.
       
   895 	ret = call.OpenExistingCall(line, callName);
       
   896 	TEST(ret == KErrNone);
       
   897 	call.AnswerIncomingCall(iStatus);
       
   898 	User::WaitForRequest(iStatus);	
       
   899 	call.HangUp();
       
   900 	call.Close();
       
   901 	
       
   902 	CleanupStack::PopAndDestroy(); //call	
       
   903 	}