telephonyutils/etel3rdpartyapi/Test/te_etelIsv/TE_EtelIsvNotifiers.cpp
changeset 0 3553901f7fa8
child 24 6638e7f4bd8f
equal deleted inserted replaced
-1:000000000000 0:3553901f7fa8
       
     1 // Copyright (c) 2003-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 #include "TE_EtelIsvbase.h"
       
    17 #include "TE_EtelIsvNotifiers.h"
       
    18 #include "TE_EtelIsvCallFunc.h"
       
    19  
       
    20 
       
    21 /**
       
    22 Each test step initialises it's own name
       
    23 */
       
    24 CTestNotifyChange::CTestNotifyChange()
       
    25 	{
       
    26 	// store the name of this test case
       
    27 	// this is the name that is used by the script file
       
    28 	SetTestStepName(_L("TestRegisterForNotification"));
       
    29 	}
       
    30 
       
    31 /**
       
    32 @SYMTestCaseID Etel3rdParty 26.1, TestNotifyChange
       
    33 @SYMTestCaseDesc Test NotifyChange 3rd party API
       
    34 @SYMFssID SGL.GT0166.054 v1.3 A2_Telephony_Functional_Specification.doc,
       
    35 REQ 2116.4.2, 2116.4.3, 2116.4.3, 2116.4.4, 2116.4.6, 2116.3.2
       
    36 */ 
       
    37 TVerdict CTestNotifyChange::doTestStepL()
       
    38 	{
       
    39 	INFO_PRINTF1(_L("Test notifications"));
       
    40 	
       
    41 	TInt numberNotifierTestsActive = 0;	
       
    42 	
       
    43 	const TInt invalidNotificationEvent = 61;
       
    44 	
       
    45 	//Test 1: Try send a request for an invalid event range
       
    46 	SetTestNumber(16);
       
    47 	INFO_PRINTF1(_L("Testing invalid event notification"));
       
    48 	CTelephony::TFlightModeV1 notifierStatus;
       
    49 	CTelephony::TFlightModeV1Pckg notifierStatusPckg(notifierStatus);	
       
    50 	TDes8* notifierStatusData;
       
    51 	if (iBufferMode)
       
    52 		{
       
    53 		notifierStatusData = &iNotifierStatusBuff;
       
    54 		}
       
    55 	else
       
    56 		{
       
    57 		notifierStatusData = &notifierStatusPckg;
       
    58 		}
       
    59 		
       
    60 	CTestRegisterNotifierAct* modeChangeAct = CTestRegisterNotifierAct::NewLC(this, iTelephony, numberNotifierTestsActive, (CTelephony::TNotificationEvent)invalidNotificationEvent);	
       
    61 	//add the number of notification status objects for the test
       
    62 	CTelephony::TFlightModeV1 expNotifierStatus1;
       
    63 	CTelephony::TFlightModeV1Pckg expNotifierStatusPckg1(expNotifierStatus1);	
       
    64 	expNotifierStatus1.iFlightModeStatus = CTelephony::EFlightModeOn;	
       
    65 	modeChangeAct->iExpNotificationCompleteList.Append(expNotifierStatusPckg1);
       
    66 	
       
    67 	numberNotifierTestsActive = 0;
       
    68 	modeChangeAct->StartNotifier(*notifierStatusData, KErrArgument);	
       
    69 	CActiveScheduler::Start();
       
    70 	CleanupStack::PopAndDestroy(modeChangeAct);	
       
    71 
       
    72 	//Notification Test 2: EFlightModeChange
       
    73 	SetTestNumber(16);
       
    74 	INFO_PRINTF1(_L("Testing EFlightModeChange notification"));
       
    75 	CTelephony::TFlightModeV1 fmNotifierStatus;
       
    76 	CTelephony::TFlightModeV1Pckg fmNotifierStatusPckg(fmNotifierStatus);	
       
    77 	
       
    78 	TDes8* fmNotifierStatusData;
       
    79 	if (iBufferMode)
       
    80 		{
       
    81 		fmNotifierStatusData = &iFmNotifierStatusBuff;
       
    82 		}
       
    83 	else
       
    84 		{
       
    85 		fmNotifierStatusData = &fmNotifierStatusPckg;
       
    86 		}
       
    87 		
       
    88 	CTestRegisterNotifierAct* FlightModeChangeAct = CTestRegisterNotifierAct::NewLC(this, iTelephony, numberNotifierTestsActive, CTelephony::EFlightModeChange);
       
    89 	
       
    90 	//add the number of notification status objects for the test	
       
    91 	CTelephony::TFlightModeV1 fmExpNotifierStatus1;
       
    92 	CTelephony::TFlightModeV1Pckg fmExpNotifierStatusPckg1(fmExpNotifierStatus1);	
       
    93 	fmExpNotifierStatus1.iFlightModeStatus = CTelephony::EFlightModeOff;	
       
    94 	FlightModeChangeAct->iExpNotificationCompleteList.Append(fmExpNotifierStatusPckg1);
       
    95 	
       
    96 	CTelephony::TFlightModeV1 fmExpNotifierStatus2;
       
    97 	CTelephony::TFlightModeV1Pckg fmExpNotifierStatusPckg2(fmExpNotifierStatus2);	
       
    98 	fmExpNotifierStatus2.iFlightModeStatus = CTelephony::EFlightModeOn;
       
    99 	FlightModeChangeAct->iExpNotificationCompleteList.Append(fmExpNotifierStatusPckg2);
       
   100 	
       
   101 	CTelephony::TFlightModeV1 fmExpNotifierStatus3;
       
   102 	CTelephony::TFlightModeV1Pckg fmExpNotifierStatusPckg3(fmExpNotifierStatus3);	
       
   103 	fmExpNotifierStatus3.iFlightModeStatus = CTelephony::EFlightModeOff;
       
   104 	FlightModeChangeAct->iExpNotificationCompleteList.Append(fmExpNotifierStatusPckg3);
       
   105 	
       
   106 	numberNotifierTestsActive = 0;
       
   107 	FlightModeChangeAct->StartNotifier(*fmNotifierStatusData, KErrNone, ETrue);
       
   108 	CActiveScheduler::Start();
       
   109 	CleanupStack::PopAndDestroy(FlightModeChangeAct);
       
   110 
       
   111 	//Notification Test 3: EIndicatorChange
       
   112 	SetTestNumber(17);
       
   113 	INFO_PRINTF1(_L("Testing EIndicatorChange notification"));
       
   114 	CTelephony::TIndicatorV1 indNotifierStatus;
       
   115 	CTelephony::TIndicatorV1Pckg indNotifierStatusPckg(indNotifierStatus);	
       
   116 
       
   117 	TDes8* indNotifierStatusData;
       
   118 	if (iBufferMode)
       
   119 		{
       
   120 		indNotifierStatusData = &iIndNotifierStatusBuff;
       
   121 		}
       
   122 	else
       
   123 		{
       
   124 		indNotifierStatusData = &indNotifierStatusPckg;
       
   125 		}
       
   126 		
       
   127 	CTestRegisterNotifierAct* IndicatorChangeAct = CTestRegisterNotifierAct::NewLC(this, iTelephony, numberNotifierTestsActive, CTelephony::EIndicatorChange);
       
   128 	
       
   129 	//add the number of notification status objects for the test	
       
   130 	CTelephony::TIndicatorV1 indExpNotifierStatus1;
       
   131 	CTelephony::TIndicatorV1Pckg indExpNotifierStatusPckg1(indExpNotifierStatus1);	
       
   132 	indExpNotifierStatus1.iCapabilities = CTelephony::KIndChargerConnected | CTelephony::KIndNetworkAvailable | CTelephony::KIndCallInProgress;
       
   133 	indExpNotifierStatus1.iIndicator = CTelephony::KIndChargerConnected;
       
   134 	IndicatorChangeAct->iExpNotificationCompleteList.Append(indExpNotifierStatusPckg1);
       
   135 	
       
   136 	#if defined(_DEBUG)
       
   137 	//test OOM case
       
   138 		numberNotifierTestsActive = 0;
       
   139 		__UHEAP_FAILNEXT(1);
       
   140 		IndicatorChangeAct->StartNotifier(*indNotifierStatusData, KErrNoMemory);
       
   141 		CActiveScheduler::Start();
       
   142 		__UHEAP_RESET;
       
   143 	#endif
       
   144 	
       
   145 	CTelephony::TIndicatorV1 indExpNotifierStatus2;
       
   146 	CTelephony::TIndicatorV1Pckg indExpNotifierStatusPckg2(indExpNotifierStatus2);	
       
   147 	indExpNotifierStatus2.iCapabilities = CTelephony::KIndChargerConnected | CTelephony::KIndNetworkAvailable | CTelephony::KIndCallInProgress;
       
   148 	indExpNotifierStatus2.iIndicator = CTelephony::KIndChargerConnected | CTelephony::KIndNetworkAvailable;
       
   149 	IndicatorChangeAct->iExpNotificationCompleteList.Append(indExpNotifierStatusPckg2);
       
   150 	
       
   151 	CTelephony::TIndicatorV1 indExpNotifierStatus3;
       
   152 	CTelephony::TIndicatorV1Pckg indExpNotifierStatusPckg3(indExpNotifierStatus3);	
       
   153 	indExpNotifierStatus3.iCapabilities = CTelephony::KIndChargerConnected | CTelephony::KIndNetworkAvailable | CTelephony::KIndCallInProgress;
       
   154 	indExpNotifierStatus3.iIndicator = CTelephony::KIndChargerConnected;
       
   155 	IndicatorChangeAct->iExpNotificationCompleteList.Append(indExpNotifierStatusPckg3);
       
   156 	
       
   157 	numberNotifierTestsActive = 0;
       
   158 	IndicatorChangeAct->StartNotifier(*indNotifierStatusData, KErrNone, ETrue);
       
   159 	CActiveScheduler::Start();
       
   160 	CleanupStack::PopAndDestroy(IndicatorChangeAct);
       
   161 
       
   162 	//Notification Test 4: EBatteryInfoChange
       
   163 	SetTestNumber(18);
       
   164 	INFO_PRINTF1(_L("Testing EBatteryInfoChange notification"));
       
   165 	CTelephony::TBatteryInfoV1 batNotifierStatus;
       
   166 	CTelephony::TBatteryInfoV1Pckg batNotifierStatusPckg(batNotifierStatus);	
       
   167 	
       
   168 	TDes8* batNotifierStatusData;
       
   169 	if (iBufferMode)
       
   170 		{
       
   171 		batNotifierStatusData = &iBatNotifierStatusBuff;
       
   172 		}
       
   173 	else
       
   174 		{
       
   175 		batNotifierStatusData = &batNotifierStatusPckg;
       
   176 		}
       
   177 	
       
   178 	CTestRegisterNotifierAct* batteryInfoChangeAct = CTestRegisterNotifierAct::NewLC(this, iTelephony, numberNotifierTestsActive, CTelephony::EBatteryInfoChange);
       
   179 
       
   180 	CTelephony::TBatteryInfoV1 batExpNotifierStatus1;
       
   181 	CTelephony::TBatteryInfoV1Pckg batExpNotifierStatusPckg1(batExpNotifierStatus1);	
       
   182 	batExpNotifierStatus1.iChargeLevel = 2;
       
   183 	batExpNotifierStatus1.iStatus = CTelephony::EBatteryConnectedButExternallyPowered;
       
   184 	batteryInfoChangeAct->iExpNotificationCompleteList.Append(batExpNotifierStatusPckg1);
       
   185 
       
   186 	#if defined(_DEBUG)	
       
   187 	//test OOM case
       
   188 		numberNotifierTestsActive = 0;
       
   189 		__UHEAP_FAILNEXT(1);
       
   190 		batteryInfoChangeAct->StartNotifier(*batNotifierStatusData, KErrNoMemory);
       
   191 		CActiveScheduler::Start();
       
   192 		__UHEAP_RESET;
       
   193 	#endif
       
   194 	
       
   195 	CTelephony::TBatteryInfoV1 batExpNotifierStatus2;
       
   196 	CTelephony::TBatteryInfoV1Pckg batExpNotifierStatusPckg2(batExpNotifierStatus2);	
       
   197 	batExpNotifierStatus2.iChargeLevel = 3;
       
   198 	batExpNotifierStatus2.iStatus = CTelephony::ENoBatteryConnected;
       
   199 	batteryInfoChangeAct->iExpNotificationCompleteList.Append(batExpNotifierStatusPckg2);	
       
   200 
       
   201 	numberNotifierTestsActive = 0;
       
   202 	batteryInfoChangeAct->StartNotifier(*batNotifierStatusData, KErrNone, ETrue);
       
   203 	CActiveScheduler::Start();
       
   204 	CleanupStack::PopAndDestroy(batteryInfoChangeAct);
       
   205 	
       
   206 	//Notification Test 5: ESignalStrengthChange
       
   207 	SetTestNumber(19);
       
   208 	INFO_PRINTF1(_L("Testing ESignalStrengthChange notification"));
       
   209 	CTelephony::TSignalStrengthV1 sigNotifierStatus;
       
   210 	CTelephony::TSignalStrengthV1Pckg sigNotifierStatusPckg(sigNotifierStatus);	
       
   211 	
       
   212 	TDes8* sigNotifierStatusData;
       
   213 	if (iBufferMode)
       
   214 		{
       
   215 		sigNotifierStatusData = &iSigNotifierStatusBuff;
       
   216 		}
       
   217 	else
       
   218 		{
       
   219 		sigNotifierStatusData = &sigNotifierStatusPckg;
       
   220 		}
       
   221 		
       
   222 	CTestRegisterNotifierAct* signalStrengthChangeAct = CTestRegisterNotifierAct::NewLC(this, iTelephony, numberNotifierTestsActive, CTelephony::ESignalStrengthChange);
       
   223 
       
   224 	CTelephony::TSignalStrengthV1 sigExpNotifierStatus1;
       
   225 	CTelephony::TSignalStrengthV1Pckg sigExpNotifierStatusPckg1(sigExpNotifierStatus1);	
       
   226 	sigExpNotifierStatus1.iBar = 3;
       
   227 	sigExpNotifierStatus1.iSignalStrength = -51;
       
   228 	signalStrengthChangeAct->iExpNotificationCompleteList.Append(sigExpNotifierStatusPckg1);
       
   229 	
       
   230 	#if defined(_DEBUG)
       
   231 	//test OOM case
       
   232 		numberNotifierTestsActive = 0;
       
   233 		__UHEAP_FAILNEXT(1);
       
   234 		signalStrengthChangeAct->StartNotifier(*sigNotifierStatusData, KErrNoMemory);
       
   235 		CActiveScheduler::Start();
       
   236 		__UHEAP_RESET;
       
   237 	#endif
       
   238 	
       
   239 	CTelephony::TSignalStrengthV1 sigExpNotifierStatus2;
       
   240 	CTelephony::TSignalStrengthV1Pckg sigExpNotifierStatusPckg2(sigExpNotifierStatus2);	
       
   241 	sigExpNotifierStatus2.iBar = 2;
       
   242 	sigExpNotifierStatus2.iSignalStrength = -40;
       
   243 	signalStrengthChangeAct->iExpNotificationCompleteList.Append(sigExpNotifierStatusPckg2);
       
   244 
       
   245 	numberNotifierTestsActive = 0;
       
   246 	signalStrengthChangeAct->StartNotifier(*sigNotifierStatusData,KErrNone, ETrue);
       
   247 	CActiveScheduler::Start();
       
   248 	CleanupStack::PopAndDestroy(signalStrengthChangeAct);
       
   249 
       
   250 	//Notification Test 6: EPin1LockInfoChange
       
   251 	SetTestNumber(20);
       
   252 	INFO_PRINTF1(_L("Testing EPin1LockInfoChange notification"));
       
   253 	CTelephony::TIccLockInfoV1 locNotifierStatus;
       
   254 	CTelephony::TIccLockInfoV1Pckg locNotifierStatusPckg(locNotifierStatus);
       
   255 	
       
   256 	TDes8* locNotifierStatusData;
       
   257 	if (iBufferMode)
       
   258 		{
       
   259 		locNotifierStatusData = &iLocNotifierStatusBuff;
       
   260 		}
       
   261 	else
       
   262 		{
       
   263 		locNotifierStatusData = &locNotifierStatusPckg;
       
   264 		}
       
   265 	
       
   266 	CTestRegisterNotifierAct* pin1lockInfoChangeAct = CTestRegisterNotifierAct::NewLC(this, iTelephony, numberNotifierTestsActive, CTelephony::EPin1LockInfoChange);
       
   267 	
       
   268 	CTelephony::TIccLockInfoV1 locExpNotifierStatus1;
       
   269 	CTelephony::TIccLockInfoV1Pckg locExpNotifierStatusPckg1(locExpNotifierStatus1);	
       
   270 	locExpNotifierStatus1.iSetting = CTelephony::ELockSetEnabled;
       
   271 	locExpNotifierStatus1.iStatus = CTelephony::EStatusUnlocked;
       
   272 	pin1lockInfoChangeAct->iExpNotificationCompleteList.Append(locExpNotifierStatusPckg1);
       
   273 	
       
   274 	#if defined(_DEBUG)
       
   275 	//test OOM case
       
   276 		numberNotifierTestsActive = 0;
       
   277 		__UHEAP_FAILNEXT(1);
       
   278 		pin1lockInfoChangeAct->StartNotifier(*locNotifierStatusData, KErrNoMemory);
       
   279 		CActiveScheduler::Start();
       
   280 		__UHEAP_RESET;
       
   281 	#endif
       
   282 
       
   283 	//try initiating both pin1 & pin2 request notification. The test should pass.
       
   284 	CTestRegisterNotifierAct* temppin2lockInfoChangeAct = CTestRegisterNotifierAct::NewLC(this, iTelephony, numberNotifierTestsActive, CTelephony::EPin2LockInfoChange);
       
   285 	temppin2lockInfoChangeAct->iExpNotificationCompleteList.Append(locExpNotifierStatusPckg1);
       
   286 		
       
   287 	CTelephony::TIccLockInfoV1 locExpNotifierStatus2;
       
   288 	CTelephony::TIccLockInfoV1Pckg locExpNotifierStatusPckg2(locExpNotifierStatus2);	
       
   289 	locExpNotifierStatus2.iSetting = CTelephony::ELockSetDisabled;
       
   290 	locExpNotifierStatus2.iStatus = CTelephony::EStatusUnlocked;
       
   291 	pin1lockInfoChangeAct->iExpNotificationCompleteList.Append(locExpNotifierStatusPckg2);	
       
   292 	
       
   293 	numberNotifierTestsActive = 0;
       
   294 	pin1lockInfoChangeAct->StartNotifier(*locNotifierStatusData, KErrNone, ETrue);
       
   295 	temppin2lockInfoChangeAct->StartNotifier(*locNotifierStatusData, KErrNone, ETrue);
       
   296 	CActiveScheduler::Start();
       
   297 	
       
   298 	CleanupStack::PopAndDestroy(temppin2lockInfoChangeAct);
       
   299 	CleanupStack::PopAndDestroy(pin1lockInfoChangeAct);
       
   300 
       
   301 	//Notification Test 6b: EPin2LockInfoChange
       
   302 	INFO_PRINTF1(_L("Testing EPin2LockInfoChange notification"));
       
   303 	CTestRegisterNotifierAct* pin2lockInfoChangeAct = CTestRegisterNotifierAct::NewLC(this, iTelephony, numberNotifierTestsActive, CTelephony::EPin2LockInfoChange);
       
   304 	
       
   305 	locExpNotifierStatus1.iSetting = CTelephony::ELockSetDisabled;
       
   306 	locExpNotifierStatus1.iStatus = CTelephony::EStatusLocked;
       
   307 	pin2lockInfoChangeAct->iExpNotificationCompleteList.Append(locExpNotifierStatusPckg1);	
       
   308 	
       
   309 	locExpNotifierStatus2.iSetting = CTelephony::ELockSetUnknown;
       
   310 	locExpNotifierStatus2.iStatus = CTelephony::EStatusLocked;
       
   311 	pin2lockInfoChangeAct->iExpNotificationCompleteList.Append(locExpNotifierStatusPckg2);	
       
   312 	
       
   313 	numberNotifierTestsActive = 0;	
       
   314 	pin2lockInfoChangeAct->StartNotifier(*locNotifierStatusData, KErrNone, ETrue);
       
   315 	CActiveScheduler::Start();
       
   316 	CleanupStack::PopAndDestroy(pin2lockInfoChangeAct);
       
   317 	
       
   318 
       
   319 	//Notification Test 7: EVoiceLineStatusChange
       
   320 	SetTestNumber(21);
       
   321 	INFO_PRINTF1(_L("Testing EVoiceLineStatusChange notification"));
       
   322 	CTelephony::TCallStatusV1 linNotifierStatus;
       
   323 	CTelephony::TCallStatusV1Pckg linNotifierStatusPckg(linNotifierStatus);	
       
   324 
       
   325 	TDes8* linNotifierStatusData;
       
   326 	if (iBufferMode)
       
   327 		{
       
   328 		linNotifierStatusData = &iLinNotifierStatusBuff;
       
   329 		}
       
   330 	else
       
   331 		{
       
   332 		linNotifierStatusData = &linNotifierStatusPckg;
       
   333 		}
       
   334 		
       
   335 	CTestRegisterNotifierAct* lineStatusChangeAct = CTestRegisterNotifierAct::NewLC(this, iTelephony, numberNotifierTestsActive, CTelephony::EVoiceLineStatusChange);
       
   336 
       
   337 	CTelephony::TCallStatusV1 linExpNotifierStatus1;
       
   338 	CTelephony::TCallStatusV1Pckg linExpNotifierStatusPckg1(linExpNotifierStatus1);	
       
   339 	linExpNotifierStatus1.iStatus = CTelephony::EStatusDialling;
       
   340 	lineStatusChangeAct->iExpNotificationCompleteList.Append(linExpNotifierStatusPckg1);
       
   341 	
       
   342 	CTelephony::TCallStatusV1 linExpNotifierStatus2;
       
   343 	CTelephony::TCallStatusV1Pckg linExpNotifierStatusPckg2(linExpNotifierStatus2);	
       
   344 	linExpNotifierStatus2.iStatus = CTelephony::EStatusConnecting;
       
   345 	lineStatusChangeAct->iExpNotificationCompleteList.Append(linExpNotifierStatusPckg2);
       
   346 	
       
   347 	CTelephony::TCallStatusV1 linExpNotifierStatus3;
       
   348 	CTelephony::TCallStatusV1Pckg linExpNotifierStatusPckg3(linExpNotifierStatus3);	
       
   349 	linExpNotifierStatus3.iStatus = CTelephony::EStatusConnected;
       
   350 	lineStatusChangeAct->iExpNotificationCompleteList.Append(linExpNotifierStatusPckg3);	
       
   351 	
       
   352 	CTelephony::TCallStatusV1 linExpNotifierStatus4;
       
   353 	CTelephony::TCallStatusV1Pckg linExpNotifierStatusPckg4(linExpNotifierStatus4);	
       
   354 	linExpNotifierStatus4.iStatus = CTelephony::EStatusDisconnecting;
       
   355 	lineStatusChangeAct->iExpNotificationCompleteList.Append(linExpNotifierStatusPckg4);
       
   356 	
       
   357 	CTelephony::TCallStatusV1 linExpNotifierStatus5;
       
   358 	CTelephony::TCallStatusV1Pckg linExpNotifierStatusPckg5(linExpNotifierStatus5);	
       
   359 	linExpNotifierStatus5.iStatus = CTelephony::EStatusIdle;
       
   360 	lineStatusChangeAct->iExpNotificationCompleteList.Append(linExpNotifierStatusPckg5);	
       
   361 	
       
   362 	numberNotifierTestsActive = 0;
       
   363 	lineStatusChangeAct->StartNotifier(*linNotifierStatusData, KErrNone, ETrue);
       
   364 	CActiveScheduler::Start();
       
   365 	CleanupStack::PopAndDestroy(lineStatusChangeAct);
       
   366 
       
   367 	//Notification Test 7a: EFaxLineStatusChange & EDataLineStatusChange
       
   368 	INFO_PRINTF1(_L("Testing EFaxLineStatusChange & EDataLineStatusChange notification"));
       
   369 	TRequestStatus faxDataNotifierStatus(0);
       
   370 	CTelephony::TCallStatusV1 faxDataLinExpNotifierStatus;
       
   371 	CTelephony::TCallStatusV1Pckg faxDataLinExpNotifierStatusPckg(faxDataLinExpNotifierStatus);
       
   372 	
       
   373 	TDes8* faxDataLinExpNotifierStatusData;
       
   374 	if (iBufferMode)
       
   375 		{
       
   376 		faxDataLinExpNotifierStatusData = &iFaxDataLinExpNotifierStatusBuff;
       
   377 		}
       
   378 	else
       
   379 		{
       
   380 		faxDataLinExpNotifierStatusData = &faxDataLinExpNotifierStatusPckg;
       
   381 		}
       
   382 	
       
   383 
       
   384 	CTelephony::TNotificationEvent telEvent = CTelephony::EFaxLineStatusChange;
       
   385 	iTelephony->NotifyChange(faxDataNotifierStatus, telEvent, *faxDataLinExpNotifierStatusData);
       
   386 	User::WaitForRequest(faxDataNotifierStatus);
       
   387 	TEST(faxDataNotifierStatus == KErrNotSupported);
       
   388 
       
   389 	faxDataNotifierStatus = 0;
       
   390 	telEvent = CTelephony::EDataLineStatusChange;
       
   391 	iTelephony->NotifyChange(faxDataNotifierStatus, telEvent, *faxDataLinExpNotifierStatusData);
       
   392 	User::WaitForRequest(faxDataNotifierStatus);
       
   393 	TEST(faxDataNotifierStatus == KErrNotSupported);
       
   394 
       
   395 	//Notification Test 8: EOwnedCall1CallStatusChange
       
   396 	//don't need to set test number as previous test (line notifier) is the same
       
   397 	INFO_PRINTF1(_L("Testing EOwnedCall1CallStatusChange notification"));
       
   398 	CTelephony::TCallStatusV1 calNotifierStatus;
       
   399 	CTelephony::TCallStatusV1Pckg calNotifierStatusPckg(calNotifierStatus);	
       
   400 	TDes8* calNotifierStatusData;
       
   401 	if (iBufferMode)
       
   402 		{
       
   403 		calNotifierStatusData = &iCalNotifierStatusBuff;
       
   404 		}
       
   405 	else
       
   406 		{
       
   407 		calNotifierStatusData = &calNotifierStatusPckg;
       
   408 		}
       
   409 		
       
   410 	CTestRegisterNotifierAct* call1StatusChangeAct = CTestRegisterNotifierAct::NewLC(this, iTelephony, numberNotifierTestsActive, CTelephony::EOwnedCall1StatusChange);
       
   411 
       
   412 	CTelephony::TCallStatusV1 calExpNotifierStatus1;
       
   413 	CTelephony::TCallStatusV1Pckg calExpNotifierStatusPckg1(calExpNotifierStatus1);	
       
   414 		
       
   415 	calExpNotifierStatus1.iStatus = CTelephony::EStatusDisconnecting;
       
   416 	call1StatusChangeAct->iExpNotificationCompleteList.Append(calExpNotifierStatusPckg1);
       
   417 	
       
   418 	CTelephony::TCallStatusV1 calExpNotifierStatus2;
       
   419 	CTelephony::TCallStatusV1Pckg calExpNotifierStatusPckg2(calExpNotifierStatus2);	
       
   420 	calExpNotifierStatus2.iStatus = CTelephony::EStatusIdle;
       
   421 	call1StatusChangeAct->iExpNotificationCompleteList.Append(calExpNotifierStatusPckg2);	
       
   422 		
       
   423 	//make call
       
   424 	call1StatusChangeAct->MakeCallL();
       
   425 	CActiveScheduler::Start();
       
   426 
       
   427 	numberNotifierTestsActive = 0;
       
   428 	call1StatusChangeAct->StartNotifier(*calNotifierStatusData, KErrNone, ETrue);
       
   429 	CActiveScheduler::Start();
       
   430 	CleanupStack::PopAndDestroy(call1StatusChangeAct);
       
   431 	
       
   432 	//Notification Test 8b: EOwnedCall2CallStatusChange
       
   433 	//don't need to set test number as previous test (line notifier) is the same
       
   434 	INFO_PRINTF1(_L("Testing EOwnedCall2CallStatusChange notification"));
       
   435 	CTestRegisterNotifierAct* call2StatusChangeAct = CTestRegisterNotifierAct::NewLC(this, iTelephony, numberNotifierTestsActive, CTelephony::EOwnedCall2StatusChange);
       
   436 
       
   437 	calExpNotifierStatus1.iStatus = CTelephony::EStatusDisconnecting;
       
   438 	call2StatusChangeAct->iExpNotificationCompleteList.Append(calExpNotifierStatusPckg1);
       
   439 	
       
   440 	calExpNotifierStatus2.iStatus = CTelephony::EStatusIdle;
       
   441 	call2StatusChangeAct->iExpNotificationCompleteList.Append(calExpNotifierStatusPckg2);
       
   442 	
       
   443 	//make first call
       
   444 	CTelephony::TCallParamsV1 callParams1;
       
   445 	callParams1.iIdRestrict = CTelephony::ESendMyId;
       
   446 	CTelephony::TCallParamsV1Pckg callParamsPckg1(callParams1);	
       
   447 	
       
   448 	CTelephony::TCallStatusV1 status;
       
   449 	CTelephony::TCallStatusV1Pckg statusPckg(status);
       
   450 	
       
   451 	TTestCallParams testCallParams1;
       
   452 	testCallParams1.iLine = CTelephony::EVoiceLine;
       
   453 	testCallParams1.iCallParamsV1Pckg = &callParamsPckg1;
       
   454 	testCallParams1.iTelAddress.iTelNumber = _L("1234");
       
   455 	testCallParams1.iExpStat = KErrNone;
       
   456 	CTestDialNewCallAct* testDialNewCallAct1 = CTestDialNewCallAct::NewLC(this, iTelephony);	
       
   457 		
       
   458 	// Create a call - should succeed
       
   459 	testCallParams1.iCallId = CTelephony::EISVMaxNumOfCalls;
       
   460 	testDialNewCallAct1->TestDialNewCall(testCallParams1);
       
   461 	CActiveScheduler::Start();
       
   462 	
       
   463 	//should be conected
       
   464 	TInt err = iTelephony->GetCallStatus(testCallParams1.iCallId,  statusPckg);
       
   465 	TEST1(err == KErrNone, ETrue);
       
   466 	TEST1(status.iStatus == CTelephony::EStatusConnected, ETrue);
       
   467 	
       
   468 	//put first call on hold
       
   469 	CTestHoldAct* TestHoldAct = CTestHoldAct::NewLC(this, iTelephony);	
       
   470 	TestHoldAct->TestHold(testCallParams1);
       
   471 	CActiveScheduler::Start();	
       
   472 	
       
   473 	//make second call
       
   474 	call2StatusChangeAct->MakeCallL();
       
   475 	CActiveScheduler::Start();
       
   476 	
       
   477 	//hangup first call
       
   478 	CTestHangupAct* testHangupAct1 = CTestHangupAct::NewLC(this, iTelephony);
       
   479 
       
   480 	testHangupAct1->TestHangup(testCallParams1);
       
   481 	CActiveScheduler::Start();
       
   482 	
       
   483 	CleanupStack::PopAndDestroy(testHangupAct1);
       
   484 	CleanupStack::PopAndDestroy(TestHoldAct);
       
   485 	CleanupStack::PopAndDestroy(testDialNewCallAct1);
       
   486 	
       
   487 	err = iTelephony->GetLineStatus(testCallParams1.iLine,  statusPckg);
       
   488 	TEST1(err == KErrNone, ETrue);
       
   489 	TEST1(status.iStatus == CTelephony::EStatusConnected, ETrue);	
       
   490 	
       
   491 	//set notifier going for the second owned call
       
   492 	numberNotifierTestsActive = 0;
       
   493 	call2StatusChangeAct->StartNotifier(*calNotifierStatusData, KErrNone);
       
   494 	CActiveScheduler::Start();
       
   495 	CleanupStack::PopAndDestroy(call2StatusChangeAct);
       
   496 
       
   497 	//Notification Test 9: EOwnedCall1RemotePartyInfoChange
       
   498 	SetTestNumber(22);
       
   499 	INFO_PRINTF1(_L("Testing EOwnedCall1RemotePartyInfoChange notification"));
       
   500 	CTelephony::TRemotePartyInfoV1 remNotifierStatus;
       
   501 	CTelephony::TRemotePartyInfoV1Pckg remNotifierStatusPckg(remNotifierStatus);	
       
   502 		
       
   503 	TDes8* remNotifierStatusData;
       
   504 	if (iBufferMode)
       
   505 		{
       
   506 		remNotifierStatusData = &iRemNotifierStatusBuff;
       
   507 		}
       
   508 	else
       
   509 		{
       
   510 		remNotifierStatusData = &remNotifierStatusPckg;
       
   511 		}
       
   512 		
       
   513 	CTestRegisterNotifierAct*call1RemotePartyInfoChangeAct = CTestRegisterNotifierAct::NewLC(this, iTelephony, numberNotifierTestsActive, CTelephony::EOwnedCall1RemotePartyInfoChange);
       
   514 
       
   515 	CTelephony::TRemotePartyInfoV1 remExpNotifierStatus1;
       
   516 	CTelephony::TRemotePartyInfoV1Pckg remExpNotifierStatusPckg1(remExpNotifierStatus1);	
       
   517 	remExpNotifierStatus1.iCallingName = _L("call0");
       
   518 	remExpNotifierStatus1.iDirection = CTelephony::EMobileOriginated;
       
   519 	remExpNotifierStatus1.iRemoteIdStatus = CTelephony::ERemoteIdentityAvailable;
       
   520 	remExpNotifierStatus1.iRemoteNumber.iTypeOfNumber = CTelephony::EInternationalNumber;
       
   521 	remExpNotifierStatus1.iRemoteNumber.iNumberPlan = CTelephony::EIsdnNumberPlan;
       
   522 	remExpNotifierStatus1.iRemoteNumber.iTelNumber = _L("12345678");
       
   523 	call1RemotePartyInfoChangeAct->iExpNotificationCompleteList.Append(remExpNotifierStatusPckg1);
       
   524 	
       
   525 	//make call
       
   526 	call1RemotePartyInfoChangeAct->MakeCallL();
       
   527 	CActiveScheduler::Start();
       
   528 	
       
   529 	#if defined(_DEBUG)
       
   530 	//test OOM case
       
   531 		numberNotifierTestsActive = 0;
       
   532 		__UHEAP_FAILNEXT(1);
       
   533 		call1RemotePartyInfoChangeAct->StartNotifier(*remNotifierStatusData, KErrNoMemory);
       
   534 		CActiveScheduler::Start();
       
   535 		__UHEAP_RESET;
       
   536 	#endif
       
   537 	
       
   538 	numberNotifierTestsActive = 0;
       
   539 	call1RemotePartyInfoChangeAct->StartNotifier(*remNotifierStatusData, KErrNone, ETrue);
       
   540 	CActiveScheduler::Start();
       
   541 	
       
   542 	CleanupStack::PopAndDestroy(call1RemotePartyInfoChangeAct);	
       
   543 
       
   544 	//Notification Test 9b: EOwnedCall2RemotePartyInfoChange
       
   545 	INFO_PRINTF1(_L("Testing EOwnedCall2RemotePartyInfoChange notification"));
       
   546 	//put first call on hold
       
   547 	TestHoldAct = CTestHoldAct::NewLC(this, iTelephony);	
       
   548 	TestHoldAct->TestHold(testCallParams1);
       
   549 	CActiveScheduler::Start();	
       
   550 	CleanupStack::PopAndDestroy(TestHoldAct);
       
   551 	
       
   552 	err = iTelephony->GetLineStatus(testCallParams1.iLine,  statusPckg);
       
   553 	TEST1(err == KErrNone, ETrue);
       
   554 	TEST1(status.iStatus == CTelephony::EStatusHold, ETrue);
       
   555 	
       
   556 	//make 2nd call
       
   557 	testDialNewCallAct1 = CTestDialNewCallAct::NewLC(this, iTelephony);
       
   558 	testDialNewCallAct1->TestDialNewCall(testCallParams1);
       
   559 	CActiveScheduler::Start();
       
   560 	CleanupStack::PopAndDestroy(testDialNewCallAct1);
       
   561 	
       
   562 	err = iTelephony->GetLineStatus(testCallParams1.iLine,  statusPckg);
       
   563 	TEST1(err == KErrNone, ETrue);
       
   564 	TEST1(status.iStatus == CTelephony::EStatusConnected, ETrue);
       
   565 	
       
   566 	CTestRegisterNotifierAct*call2RemotePartyInfoChangeAct = CTestRegisterNotifierAct::NewLC(this, iTelephony, numberNotifierTestsActive, CTelephony::EOwnedCall2RemotePartyInfoChange);
       
   567 	
       
   568 	//use same parameters as last test.
       
   569 	call2RemotePartyInfoChangeAct->iExpNotificationCompleteList.Append(remExpNotifierStatusPckg1);
       
   570 	
       
   571 	numberNotifierTestsActive = 0;
       
   572 	call2RemotePartyInfoChangeAct->StartNotifier(*remNotifierStatusData, KErrNone);
       
   573 	CActiveScheduler::Start();
       
   574 	
       
   575 	CleanupStack::PopAndDestroy(call2RemotePartyInfoChangeAct);	
       
   576 	
       
   577 	//Notification Test 10: ENetworkRegistrationStatusChange
       
   578 	SetTestNumber(23);
       
   579 	INFO_PRINTF1(_L("Testing ENetworkRegistrationStatusChange notification"));
       
   580 	CTelephony::TNetworkRegistrationV1 regNotifierStatus;
       
   581 	CTelephony::TNetworkRegistrationV1Pckg regNotifierStatusPckg(regNotifierStatus);	
       
   582 	
       
   583 	TDes8* regNotifierStatusData;
       
   584 	if (iBufferMode)
       
   585 		{
       
   586 		regNotifierStatusData = &iRegNotifierStatusBuff;
       
   587 		}
       
   588 	else
       
   589 		{
       
   590 		regNotifierStatusData = &regNotifierStatusPckg;
       
   591 		}
       
   592 	
       
   593 	CTestRegisterNotifierAct*NetworkRegistrationChangeAct = CTestRegisterNotifierAct::NewLC(this, iTelephony, numberNotifierTestsActive, CTelephony::ENetworkRegistrationStatusChange);
       
   594 	
       
   595 	CTelephony::TNetworkRegistrationV1 regExpNotifierStatus1;
       
   596 	CTelephony::TNetworkRegistrationV1Pckg regExpNotifierStatusPckg1(regExpNotifierStatus1);	
       
   597 	regExpNotifierStatus1.iRegStatus = CTelephony::ENotRegisteredNoService;
       
   598 	NetworkRegistrationChangeAct->iExpNotificationCompleteList.Append(regExpNotifierStatusPckg1);
       
   599 	
       
   600 	#if defined(_DEBUG)
       
   601 	//test OOM case
       
   602 		numberNotifierTestsActive = 0;
       
   603 		__UHEAP_FAILNEXT(1);
       
   604 		NetworkRegistrationChangeAct->StartNotifier(*regNotifierStatusData, KErrNoMemory);
       
   605 		CActiveScheduler::Start();
       
   606 		__UHEAP_RESET;
       
   607 	#endif
       
   608 	
       
   609 	CTelephony::TNetworkRegistrationV1 regExpNotifierStatus2;
       
   610 	CTelephony::TNetworkRegistrationV1Pckg regExpNotifierStatusPckg2(regExpNotifierStatus2);	
       
   611 	regExpNotifierStatus2.iRegStatus = CTelephony::ENotRegisteredSearching;
       
   612 	NetworkRegistrationChangeAct->iExpNotificationCompleteList.Append(regExpNotifierStatusPckg2);
       
   613 	
       
   614 	CTelephony::TNetworkRegistrationV1 regExpNotifierStatus3;
       
   615 	CTelephony::TNetworkRegistrationV1Pckg regExpNotifierStatusPckg3(regExpNotifierStatus3);	
       
   616 	regExpNotifierStatus3.iRegStatus = CTelephony::ERegisteredOnHomeNetwork;
       
   617 	NetworkRegistrationChangeAct->iExpNotificationCompleteList.Append(regExpNotifierStatusPckg3);
       
   618 		
       
   619 	numberNotifierTestsActive = 0;
       
   620 	NetworkRegistrationChangeAct->StartNotifier(*regNotifierStatusData, KErrNone, ETrue);
       
   621 	CActiveScheduler::Start();
       
   622 	CleanupStack::PopAndDestroy(NetworkRegistrationChangeAct);
       
   623 
       
   624 	//Notification Test 11: ENetworkInfoChange
       
   625 	SetTestNumber(24);
       
   626 	INFO_PRINTF1(_L("Testing ENetworkInfoChange notification"));
       
   627 	CTelephony::TNetworkInfoV1 netNotifierStatus;
       
   628 	CTelephony::TNetworkInfoV1Pckg netNotifierStatusPckg(netNotifierStatus);	
       
   629 		
       
   630 	TDes8* netNotifierStatusData;
       
   631 	if (iBufferMode)
       
   632 		{
       
   633 		netNotifierStatusData = &iNetNotifierStatusBuff;
       
   634 		}
       
   635 	else
       
   636 		{
       
   637 		netNotifierStatusData = &netNotifierStatusPckg;
       
   638 		}
       
   639 		
       
   640 	CTestRegisterNotifierAct*NetworkInfoChangeAct = CTestRegisterNotifierAct::NewLC(this, iTelephony, numberNotifierTestsActive, CTelephony::ECurrentNetworkInfoChange);
       
   641 	NetworkInfoChangeAct->SetNetworkInfoVersion(1);
       
   642 	
       
   643 	CTelephony::TNetworkInfoV1 netExpNotifierStatus1;
       
   644 	CTelephony::TNetworkInfoV1Pckg netExpNotifierStatusPckg1(netExpNotifierStatus1);	
       
   645 	netExpNotifierStatus1.iCountryCode=_L("ABCD");
       
   646 	netExpNotifierStatus1.iNetworkId=_L("Network0");
       
   647 	netExpNotifierStatus1.iDisplayTag=_L("Vodafone");
       
   648 	netExpNotifierStatus1.iShortName=_L("Voda");
       
   649 	netExpNotifierStatus1.iLongName=_L("Vodafone_UK");	
       
   650 	netExpNotifierStatus1.iMode=CTelephony::ENetworkModeGsm;
       
   651 	netExpNotifierStatus1.iStatus = CTelephony::ENetworkStatusUnknown;
       
   652 	netExpNotifierStatus1.iBandInfo=CTelephony::EBandUnknown;
       
   653 	netExpNotifierStatus1.iCdmaSID.SetLength(0);
       
   654 	netExpNotifierStatus1.iAccess = CTelephony::ENetworkAccessGsm; //If v1=ENetworkAccessUnknown, if V2=ENetworkAccessGsm
       
   655 	netExpNotifierStatus1.iAreaKnown = EFalse;
       
   656 	netExpNotifierStatus1.iLocationAreaCode = 0;
       
   657 	netExpNotifierStatus1.iCellId = 0;
       
   658 	NetworkInfoChangeAct->iExpNotificationCompleteList.Append(netExpNotifierStatusPckg1);
       
   659 	
       
   660 	#if defined(_DEBUG)
       
   661 	//test OOM case
       
   662 		numberNotifierTestsActive = 0;
       
   663 		__UHEAP_FAILNEXT(1);
       
   664 		NetworkInfoChangeAct->StartNotifier(*netNotifierStatusData, KErrNoMemory);
       
   665 		CActiveScheduler::Start();
       
   666 		__UHEAP_RESET;
       
   667 	#endif
       
   668 	
       
   669 	CTelephony::TNetworkInfoV1 netExpNotifierStatus2;
       
   670 	CTelephony::TNetworkInfoV1Pckg netExpNotifierStatusPckg2(netExpNotifierStatus2);	
       
   671 	netExpNotifierStatus2 = netExpNotifierStatus1;
       
   672 	netExpNotifierStatus2.iCountryCode=_L("EFGH");
       
   673 	netExpNotifierStatus2.iNetworkId=_L("Network1");
       
   674 	netExpNotifierStatus2.iDisplayTag=_L("Cellnet");
       
   675 	netExpNotifierStatus2.iShortName=_L("Cell");
       
   676 	netExpNotifierStatus2.iLongName=_L("Cellnet_UK");	
       
   677 	netExpNotifierStatus2.iStatus = CTelephony::ENetworkStatusAvailable;
       
   678 	NetworkInfoChangeAct->iExpNotificationCompleteList.Append(netExpNotifierStatusPckg2);
       
   679 	
       
   680 	CTelephony::TNetworkInfoV1 netExpNotifierStatus3;
       
   681 	CTelephony::TNetworkInfoV1Pckg netExpNotifierStatusPckg3(netExpNotifierStatus3);	
       
   682 	netExpNotifierStatus3 = netExpNotifierStatus1;
       
   683 	netExpNotifierStatus3.iCountryCode=_L("IJKL");
       
   684 	netExpNotifierStatus3.iNetworkId=_L("Network2");
       
   685 	netExpNotifierStatus3.iDisplayTag=_L("One2One");
       
   686 	netExpNotifierStatus3.iShortName=_L("121");
       
   687 	netExpNotifierStatus3.iLongName=_L("One2One_UK");	
       
   688 	netExpNotifierStatus3.iStatus = CTelephony::ENetworkStatusCurrent;
       
   689 	NetworkInfoChangeAct->iExpNotificationCompleteList.Append(netExpNotifierStatusPckg3);
       
   690 	
       
   691 	numberNotifierTestsActive = 0;
       
   692 	NetworkInfoChangeAct->StartNotifier(*netNotifierStatusData, KErrNone, ETrue);
       
   693 	CActiveScheduler::Start();
       
   694 	CleanupStack::PopAndDestroy(NetworkInfoChangeAct);
       
   695 	
       
   696 	// V2
       
   697 	INFO_PRINTF1(_L("Testing ENetworkInfoChange notification using TNetworkInfoV2"));
       
   698 	CTelephony::TNetworkInfoV2 netNotifierStatusV2;
       
   699 	CTelephony::TNetworkInfoV2Pckg netNotifierStatusPckgV2(netNotifierStatusV2);
       
   700 	TDes8* netNotifierStatusDataV2;
       
   701 	if (iBufferMode)
       
   702 		{
       
   703 		netNotifierStatusDataV2 = &iNetNotifierStatusBuffV2;
       
   704 		}
       
   705 	else
       
   706 		{
       
   707 		netNotifierStatusDataV2 = &netNotifierStatusPckgV2;
       
   708 		}
       
   709 		
       
   710 	CTestRegisterNotifierAct*NetworkInfoChangeActV2 = CTestRegisterNotifierAct::NewLC(this, iTelephony, numberNotifierTestsActive, CTelephony::ECurrentNetworkInfoChange);
       
   711 	NetworkInfoChangeAct->SetNetworkInfoVersion(2);
       
   712 	
       
   713 	CTelephony::TNetworkInfoV2 netExpNotifierStatus4;
       
   714 	CTelephony::TNetworkInfoV2Pckg netExpNotifierStatusPckg4(netExpNotifierStatus4);
       
   715 	netExpNotifierStatus4.iCountryCode=_L("QRST");
       
   716 	netExpNotifierStatus4.iNetworkId=_L("Network4");
       
   717 	netExpNotifierStatus4.iDisplayTag=_L("Symbian");
       
   718 	netExpNotifierStatus4.iShortName=_L("SymbianNe");
       
   719 	netExpNotifierStatus4.iLongName=_L("SymbianNetwor");	
       
   720 	netExpNotifierStatus4.iMode=CTelephony::ENetworkModeGsm;
       
   721 	netExpNotifierStatus4.iStatus = CTelephony::ENetworkStatusUnknown;
       
   722 	netExpNotifierStatus4.iBandInfo=CTelephony::EBandUnknown;
       
   723 	netExpNotifierStatus4.iCdmaSID.SetLength(0);
       
   724 	netExpNotifierStatus4.iAccess = CTelephony::ENetworkAccessGsm; //If v1=ENetworkAccessUnknown, if V2=ENetworkAccessGsm
       
   725 	netExpNotifierStatus4.iAreaKnown = EFalse;
       
   726 	netExpNotifierStatus4.iLocationAreaCode = 0;
       
   727 	netExpNotifierStatus4.iCellId = 0;
       
   728 	NetworkInfoChangeActV2->iExpNotificationCompleteList.Append(netExpNotifierStatusPckg4);
       
   729 	
       
   730 	numberNotifierTestsActive = 0;
       
   731 	NetworkInfoChangeActV2->StartNotifier(*netNotifierStatusDataV2, KErrNone, ETrue);
       
   732 	CActiveScheduler::Start();
       
   733 	CleanupStack::PopAndDestroy(NetworkInfoChangeActV2);
       
   734 	
       
   735 	return TestStepResult();	
       
   736 	}
       
   737 
       
   738 CTestNotifyChangeCancel::CTestNotifyChangeCancel()
       
   739 /** Each test step initialises it's own name
       
   740 */
       
   741 	{
       
   742 	// store the name of this test case
       
   743 	// this is the name that is used by the script file
       
   744 	SetTestStepName(_L("TestRegisterForNotificationCancel"));
       
   745 	}
       
   746 
       
   747 TVerdict CTestNotifyChangeCancel::doTestStepL()
       
   748 {
       
   749 	INFO_PRINTF1(_L("Test cancelling notifications"));
       
   750 	CTestCanceller* canceller = NULL;
       
   751 
       
   752 //Cancel Notification Test 1: EFlightModeChange
       
   753 	SetTestNumber(25);	
       
   754 	INFO_PRINTF1(_L("Testing EFlightModeChange notification cancel"));
       
   755 	CTelephony::TFlightModeV1 fmNotifierStatus;
       
   756 	CTelephony::TFlightModeV1Pckg fmNotifierStatusPckg(fmNotifierStatus);	
       
   757 	CTestCancelRegisterNotifierAct* FlightModeChangeAct = CTestCancelRegisterNotifierAct::NewLC(this, iTelephony, CTelephony::EFlightModeChange);
       
   758 	 canceller = FlightModeChangeAct->RetrieveCanceller();
       
   759 
       
   760 	TInt cancelerr = iTelephony->CancelAsync(CTelephony::EFlightModeChangeCancel);
       
   761 	TEST1(cancelerr == KErrNotFound, ETrue);
       
   762 	FlightModeChangeAct->StartNotifier(fmNotifierStatusPckg, KErrNone);
       
   763 	canceller->Call();
       
   764 	CActiveScheduler::Start();	
       
   765 	TEST1(FlightModeChangeAct->iStatus.Int() == KErrCancel, ETrue);	
       
   766 	CleanupStack::PopAndDestroy(FlightModeChangeAct);
       
   767 	
       
   768 //Notification Test 2: EIndicatorChange
       
   769 	SetTestNumber(26);	
       
   770 	INFO_PRINTF1(_L("Testing EIndicatorChange notification cancel"));
       
   771 	CTelephony::TIndicatorV1 indNotifierStatus;
       
   772 	CTelephony::TIndicatorV1Pckg indNotifierStatusPckg(indNotifierStatus);	
       
   773 	CTestCancelRegisterNotifierAct* IndicatorChangeAct = CTestCancelRegisterNotifierAct::NewLC(this, iTelephony, CTelephony::EIndicatorChange);
       
   774 	canceller = IndicatorChangeAct->RetrieveCanceller();
       
   775 	
       
   776 	cancelerr = iTelephony->CancelAsync(CTelephony::EIndicatorChangeCancel);
       
   777 	TEST1(cancelerr == KErrNotFound, ETrue);
       
   778 	IndicatorChangeAct->StartNotifier(indNotifierStatusPckg, KErrNone);
       
   779 	canceller->Call();
       
   780 	CActiveScheduler::Start();	
       
   781 	TEST1(IndicatorChangeAct->iStatus.Int() == KErrCancel, ETrue);	
       
   782 	CleanupStack::PopAndDestroy(IndicatorChangeAct);
       
   783 	
       
   784 //Cancel Notification Test 3: EBatteryInfoChange
       
   785 	SetTestNumber(27);	
       
   786 	INFO_PRINTF1(_L("Testing EBatteryInfoChange notification cancel"));
       
   787 	CTelephony::TBatteryInfoV1 batNotifierStatus;
       
   788 	CTelephony::TBatteryInfoV1Pckg batNotifierStatusPckg(batNotifierStatus);	
       
   789 	CTestCancelRegisterNotifierAct* batteryInfoChangeAct = CTestCancelRegisterNotifierAct::NewLC(this, iTelephony, CTelephony::EBatteryInfoChange);
       
   790 	canceller = batteryInfoChangeAct->RetrieveCanceller();
       
   791 	
       
   792 	cancelerr = iTelephony->CancelAsync(CTelephony::EBatteryInfoChangeCancel);
       
   793 	TEST1(cancelerr == KErrNotFound, ETrue);
       
   794 	batteryInfoChangeAct->StartNotifier(batNotifierStatusPckg, KErrNone);
       
   795 	canceller->Call();
       
   796 	CActiveScheduler::Start();	
       
   797 	TEST1(batteryInfoChangeAct->iStatus.Int() == KErrCancel, ETrue);	
       
   798 	CleanupStack::PopAndDestroy(batteryInfoChangeAct);
       
   799 
       
   800 //Cancel Notification Test 4: ESignalStrengthChange
       
   801 	SetTestNumber(28);
       
   802 	INFO_PRINTF1(_L("Testing ESignalStrengthChange notification cancel"));
       
   803 	CTelephony::TSignalStrengthV1 sigNotifierStatus;
       
   804 	CTelephony::TSignalStrengthV1Pckg sigNotifierStatusPckg(sigNotifierStatus);	
       
   805 	CTestCancelRegisterNotifierAct* signalStrengthChangeAct = CTestCancelRegisterNotifierAct::NewLC(this, iTelephony, CTelephony::ESignalStrengthChange);
       
   806 	
       
   807 	cancelerr = iTelephony->CancelAsync(CTelephony::ESignalStrengthChangeCancel);
       
   808 	TEST1(cancelerr == KErrNotFound, ETrue);
       
   809 	canceller = signalStrengthChangeAct->RetrieveCanceller();
       
   810 	signalStrengthChangeAct->StartNotifier(sigNotifierStatusPckg, KErrNone);
       
   811 	canceller->Call();
       
   812 	CActiveScheduler::Start();	
       
   813 	TEST1(signalStrengthChangeAct->iStatus.Int() == KErrCancel, ETrue);	
       
   814 	CleanupStack::PopAndDestroy(signalStrengthChangeAct);
       
   815 
       
   816 //Cancel Notification Test 5a: EPin1LockInfoChange
       
   817 	SetTestNumber(29);
       
   818 	INFO_PRINTF1(_L("Testing EPin1LockInfoChange notification cancel"));
       
   819 	CTelephony::TIccLockInfoV1 locNotifierStatus;
       
   820 	CTelephony::TIccLockInfoV1Pckg locNotifierStatusPckg(locNotifierStatus);	
       
   821 	CTestCancelRegisterNotifierAct* pin1lockInfoChangeAct = CTestCancelRegisterNotifierAct::NewLC(this, iTelephony, CTelephony::EPin1LockInfoChange);
       
   822 	
       
   823 	cancelerr = iTelephony->CancelAsync(CTelephony::EPin1LockInfoChangeCancel);
       
   824 	TEST1(cancelerr == KErrNotFound, ETrue);
       
   825 	canceller = pin1lockInfoChangeAct->RetrieveCanceller();
       
   826 	pin1lockInfoChangeAct->StartNotifier(locNotifierStatusPckg, KErrNone);
       
   827 	canceller->Call();
       
   828 	CActiveScheduler::Start();	
       
   829 	TEST1(pin1lockInfoChangeAct->iStatus.Int() == KErrCancel, ETrue);	
       
   830 	CleanupStack::PopAndDestroy(pin1lockInfoChangeAct);
       
   831 	
       
   832 //Cancel Notification Test 5b: EPin2LockInfoChange
       
   833 	SetTestNumber(29);
       
   834 	INFO_PRINTF1(_L("Testing EPin2LockInfoChange notification cancel"));
       
   835 	CTestCancelRegisterNotifierAct* pin2lockInfoChangeAct = CTestCancelRegisterNotifierAct::NewLC(this, iTelephony, CTelephony::EPin2LockInfoChange);
       
   836 	
       
   837 	cancelerr = iTelephony->CancelAsync(CTelephony::EPin2LockInfoChangeCancel);
       
   838 	TEST1(cancelerr == KErrNotFound, ETrue);
       
   839 	canceller = pin2lockInfoChangeAct->RetrieveCanceller();
       
   840 	pin2lockInfoChangeAct->StartNotifier(locNotifierStatusPckg, KErrNone);
       
   841 	canceller->Call();
       
   842 	CActiveScheduler::Start();	
       
   843 	TEST1(pin2lockInfoChangeAct->iStatus.Int() == KErrCancel, ETrue);	
       
   844 	CleanupStack::PopAndDestroy(pin2lockInfoChangeAct);
       
   845 
       
   846 //Cancel Notification Test 6: EVoiceLineStatusChange
       
   847 	SetTestNumber(30);
       
   848 	INFO_PRINTF1(_L("Testing EVoiceLineStatusChange notification cancel"));
       
   849 	CTelephony::TCallStatusV1 linNotifierStatus;
       
   850 	CTelephony::TCallStatusV1Pckg linNotifierStatusPckg(linNotifierStatus);	
       
   851 	CTestCancelRegisterNotifierAct* lineStatusChangeAct = CTestCancelRegisterNotifierAct::NewLC(this, iTelephony, CTelephony::EVoiceLineStatusChange);
       
   852 	
       
   853 	cancelerr = iTelephony->CancelAsync(CTelephony::EVoiceLineStatusChangeCancel);
       
   854 	TEST1(cancelerr == KErrNotFound, ETrue);
       
   855 	canceller = lineStatusChangeAct->RetrieveCanceller();
       
   856 	lineStatusChangeAct->StartNotifier(linNotifierStatusPckg, KErrNone);
       
   857 	canceller->Call();
       
   858 	CActiveScheduler::Start();	
       
   859 	TEST1(lineStatusChangeAct->iStatus.Int() == KErrCancel, ETrue);	
       
   860 	CleanupStack::PopAndDestroy(lineStatusChangeAct);
       
   861 
       
   862 //Cancel Notification Test 6a: EFaxLineStatusChange & EDataLineStatusChange
       
   863 	INFO_PRINTF1(_L("Testing EFaxLineStatusChange & EDataLineStatusChange notification"));
       
   864 	TRequestStatus faxDataNotifierStatus(0);
       
   865 	CTelephony::TCallStatusV1 faxDataLinExpNotifierStatus;
       
   866 	CTelephony::TCallStatusV1Pckg faxDataLinExpNotifierStatusPckg(faxDataLinExpNotifierStatus);
       
   867 
       
   868 	CTelephony::TNotificationEvent telEvent = CTelephony::EFaxLineStatusChange;
       
   869 	iTelephony->NotifyChange(faxDataNotifierStatus, telEvent, faxDataLinExpNotifierStatusPckg);
       
   870 	cancelerr = iTelephony->CancelAsync(CTelephony::EFaxLineStatusChangeCancel);
       
   871 	User::WaitForRequest(faxDataNotifierStatus);
       
   872 	TEST(faxDataNotifierStatus == KErrNotSupported);
       
   873 	TEST(cancelerr == KErrNotSupported);
       
   874 
       
   875 	faxDataNotifierStatus = 0;
       
   876 	cancelerr = 0;
       
   877 	telEvent = CTelephony::EDataLineStatusChange;
       
   878 	iTelephony->NotifyChange(faxDataNotifierStatus, telEvent, faxDataLinExpNotifierStatusPckg);
       
   879 	cancelerr = iTelephony->CancelAsync(CTelephony::EDataLineStatusChangeCancel);
       
   880 	User::WaitForRequest(faxDataNotifierStatus);
       
   881 	TEST(faxDataNotifierStatus == KErrNotSupported);
       
   882 	TEST(cancelerr == KErrNotSupported);
       
   883 
       
   884 //Cancel Notification Test 7a: EOwnedCall1CallStatusChange
       
   885 	SetTestNumber(31); 
       
   886 	INFO_PRINTF1(_L("Testing EOwnedCall1CallStatusChange notification cancel"));
       
   887 	
       
   888 	CTestDialNewCallAct* testDialNewCallAct1 = CTestDialNewCallAct::NewLC(this, iTelephony);
       
   889 	
       
   890 	CTelephony::TCallStatusV1 calNotifierStatus;
       
   891 	CTelephony::TCallStatusV1Pckg calNotifierStatusPckg(calNotifierStatus);	
       
   892 	CTestCancelRegisterNotifierAct* call1StatusChangeAct = CTestCancelRegisterNotifierAct::NewLC(this, iTelephony, CTelephony::EOwnedCall1StatusChange);
       
   893 //make call
       
   894 	//Set the call parameters for call 1
       
   895 	CTelephony::TCallParamsV1 callParams1;
       
   896 	callParams1.iIdRestrict = CTelephony::ESendMyId;
       
   897 	CTelephony::TCallParamsV1Pckg callParamsPckg1(callParams1);	
       
   898 	
       
   899 	TTestCallParams testCallParams1;
       
   900 	testCallParams1.iLine = CTelephony::EVoiceLine;
       
   901 	testCallParams1.iCallParamsV1Pckg = &callParamsPckg1;
       
   902 	testCallParams1.iTelAddress.iTelNumber = _L("1789");
       
   903 	testCallParams1.iExpStat = KErrNone;
       
   904 	
       
   905 	testCallParams1.iCallId = CTelephony::EISVMaxNumOfCalls;
       
   906 	testDialNewCallAct1->TestDialNewCall(testCallParams1);
       
   907 	CActiveScheduler::Start();
       
   908 	
       
   909 	CTelephony::TCallStatusV1 status;
       
   910 	CTelephony::TCallStatusV1Pckg statusPckg(status);		
       
   911 	iTelephony->GetCallStatus(testCallParams1.iCallId,  statusPckg);
       
   912 	TEST1(status.iStatus == CTelephony::EStatusConnected, ETrue);	
       
   913 	
       
   914 	cancelerr = iTelephony->CancelAsync(CTelephony::EOwnedCall1StatusChangeCancel);
       
   915 	TEST1(cancelerr == KErrNotFound, ETrue);
       
   916 	canceller = call1StatusChangeAct->RetrieveCanceller();
       
   917 	call1StatusChangeAct->StartNotifier(calNotifierStatusPckg, KErrNone);
       
   918 	canceller->Call();
       
   919 	CActiveScheduler::Start();	
       
   920 	TEST1(call1StatusChangeAct->iStatus.Int() == KErrCancel, ETrue);	
       
   921 	CleanupStack::PopAndDestroy(call1StatusChangeAct);
       
   922 		
       
   923 //Cancel Notification Test 7b: EOwnedCall2CallStatusChange
       
   924 	//don't need to set test number as previous test is the same
       
   925 	INFO_PRINTF1(_L("Testing EOwnedCall2CallStatusChange notification cancel"));
       
   926 	
       
   927 	CTestCancelRegisterNotifierAct* call2StatusChangeAct = CTestCancelRegisterNotifierAct::NewLC(this, iTelephony, CTelephony::EOwnedCall2StatusChange);
       
   928 	
       
   929 	//put 1st call on hold
       
   930 	//put first call on hold
       
   931 	CTestHoldAct* TestHoldAct = CTestHoldAct::NewLC(this, iTelephony);	
       
   932 	TestHoldAct->TestHold(testCallParams1);
       
   933 	CActiveScheduler::Start();	
       
   934 	CleanupStack::PopAndDestroy(TestHoldAct);
       
   935 	
       
   936 	iTelephony->GetCallStatus(testCallParams1.iCallId,  statusPckg);
       
   937 	TEST1(status.iStatus == CTelephony::EStatusHold, ETrue);
       
   938 	
       
   939 	//make 2nd call
       
   940 	CTestDialNewCallAct* testDialNewCallAct2 = CTestDialNewCallAct::NewLC(this, iTelephony);
       
   941 	
       
   942 	TTestCallParams testCallParams2;
       
   943 	testCallParams2.iLine = CTelephony::EVoiceLine;
       
   944 	testCallParams2.iCallParamsV1Pckg = &callParamsPckg1;
       
   945 	testCallParams2.iTelAddress.iTelNumber = _L("1789");
       
   946 	testCallParams2.iExpStat = KErrNone;
       
   947 	
       
   948 	testCallParams2.iCallId = CTelephony::EISVMaxNumOfCalls;
       
   949 	testDialNewCallAct2->TestDialNewCall(testCallParams2);
       
   950 	CActiveScheduler::Start();
       
   951 	CleanupStack::PopAndDestroy(testDialNewCallAct2);
       
   952 			
       
   953 	iTelephony->GetCallStatus(testCallParams2.iCallId,  statusPckg);
       
   954 	TEST1(status.iStatus == CTelephony::EStatusConnected, ETrue);		
       
   955 	
       
   956 	//At this point Call1 = EStatusHold & Call2 = EStatusConnected
       
   957 	
       
   958 	//cancel the EOwnedCall2StatusChange pending request
       
   959 	cancelerr = iTelephony->CancelAsync(CTelephony::EOwnedCall2StatusChangeCancel);
       
   960 	TEST1(cancelerr == KErrNotFound, ETrue);
       
   961 	canceller = call1StatusChangeAct->RetrieveCanceller();
       
   962 	call2StatusChangeAct->StartNotifier(calNotifierStatusPckg, KErrNone);
       
   963 	canceller->Call();
       
   964 	CActiveScheduler::Start();	
       
   965 	TEST1(call2StatusChangeAct->iStatus.Int() == KErrCancel, ETrue);	
       
   966 	CleanupStack::PopAndDestroy(call2StatusChangeAct);
       
   967 	CleanupStack::PopAndDestroy(testDialNewCallAct1);
       
   968 
       
   969 //Cancel Notification Test 8a: EOwnedCall1RemotePartyInfoChange
       
   970 	INFO_PRINTF1(_L("Testing EOwnedCall1RemotePartyInfoChange notification cancel"));
       
   971 	CTelephony::TRemotePartyInfoV1 remNotifierStatus;
       
   972 	CTelephony::TRemotePartyInfoV1Pckg remNotifierStatusPckg(remNotifierStatus);	
       
   973 	CTestCancelRegisterNotifierAct*call1RemotePartyInfoChangeAct = CTestCancelRegisterNotifierAct::NewLC(this, iTelephony, CTelephony::EOwnedCall1RemotePartyInfoChange);
       
   974 	
       
   975 	cancelerr = iTelephony->CancelAsync(CTelephony::EOwnedCall1RemotePartyInfoChangeCancel);
       
   976 	TEST1(cancelerr == KErrNotFound, ETrue);
       
   977 	canceller = call1RemotePartyInfoChangeAct->RetrieveCanceller();
       
   978 	call1RemotePartyInfoChangeAct->StartNotifier(remNotifierStatusPckg, KErrAccessDenied);
       
   979 	canceller->Call();
       
   980 	CActiveScheduler::Start();	
       
   981 	TEST1(call1RemotePartyInfoChangeAct->iStatus.Int() == KErrCancel, ETrue);	
       
   982 	CleanupStack::PopAndDestroy(call1RemotePartyInfoChangeAct);
       
   983 	
       
   984 //Cancel Notification Test 8b: EOwnedCall2RemotePartyInfoChange
       
   985 
       
   986 //re-use active & held call from previous test.
       
   987 	INFO_PRINTF1(_L("Testing EOwnedCall2RemotePartyInfoChange notification cancel"));
       
   988 	CTestCancelRegisterNotifierAct*call2RemotePartyInfoChangeAct = CTestCancelRegisterNotifierAct::NewLC(this, iTelephony, CTelephony::EOwnedCall2RemotePartyInfoChange);
       
   989 	
       
   990 	cancelerr = iTelephony->CancelAsync(CTelephony::EOwnedCall2RemotePartyInfoChangeCancel);
       
   991 	TEST1(cancelerr == KErrNotFound, ETrue);
       
   992 	canceller = call2RemotePartyInfoChangeAct->RetrieveCanceller();
       
   993 	call2RemotePartyInfoChangeAct->StartNotifier(remNotifierStatusPckg, KErrAccessDenied);
       
   994 	canceller->Call();
       
   995 	CActiveScheduler::Start();	
       
   996 	TEST1(call2RemotePartyInfoChangeAct->iStatus.Int() == KErrCancel, ETrue);	
       
   997 	CleanupStack::PopAndDestroy(call2RemotePartyInfoChangeAct);
       
   998 
       
   999 //Cancel Notification Test 9: ENetworkRegistrationStatusChange
       
  1000 	SetTestNumber(32);
       
  1001 	INFO_PRINTF1(_L("Testing ENetworkRegistrationStatusChange notification cancel"));
       
  1002 	CTelephony::TNetworkRegistrationV1 regNotifierStatus;
       
  1003 	CTelephony::TNetworkRegistrationV1Pckg regNotifierStatusPckg(regNotifierStatus);	
       
  1004 	CTestCancelRegisterNotifierAct*NetworkRegistrationChangeAct = CTestCancelRegisterNotifierAct::NewLC(this, iTelephony, CTelephony::ENetworkRegistrationStatusChange);
       
  1005 	
       
  1006 	cancelerr = iTelephony->CancelAsync(CTelephony::ENetworkRegistrationStatusChangeCancel);
       
  1007 	TEST1(cancelerr == KErrNotFound, ETrue);
       
  1008 	canceller = NetworkRegistrationChangeAct->RetrieveCanceller();
       
  1009 	NetworkRegistrationChangeAct->StartNotifier(regNotifierStatusPckg, KErrNone);
       
  1010 	canceller->Call();
       
  1011 	CActiveScheduler::Start();	
       
  1012 	TEST1(NetworkRegistrationChangeAct->iStatus.Int() == KErrCancel, ETrue);	
       
  1013 	CleanupStack::PopAndDestroy(NetworkRegistrationChangeAct);
       
  1014 
       
  1015 //Cancel Notification Test 10: ENetworkInfoChange
       
  1016 	INFO_PRINTF1(_L("Testing ENetworkInfoChange notification cancel"));
       
  1017 	CTelephony::TNetworkInfoV1 netNotifierStatus;
       
  1018 	CTelephony::TNetworkInfoV1Pckg netNotifierStatusPckg(netNotifierStatus);	
       
  1019 	CTestCancelRegisterNotifierAct*NetworkInfoChangeAct = CTestCancelRegisterNotifierAct::NewLC(this, iTelephony, CTelephony::ECurrentNetworkInfoChange);
       
  1020 	
       
  1021 	cancelerr = iTelephony->CancelAsync(CTelephony::ECurrentNetworkInfoChangeCancel);
       
  1022 	TEST1(cancelerr == KErrNotFound, ETrue);
       
  1023 	canceller = NetworkInfoChangeAct->RetrieveCanceller();
       
  1024 	NetworkInfoChangeAct->StartNotifier(netNotifierStatusPckg, KErrNone);
       
  1025 	canceller->Call();
       
  1026 	CActiveScheduler::Start();	
       
  1027 	TEST1(NetworkRegistrationChangeAct->iStatus.Int() == KErrCancel, ETrue);	
       
  1028 	CleanupStack::PopAndDestroy(NetworkInfoChangeAct);	
       
  1029 	
       
  1030 	return TestStepResult();
       
  1031 	}
       
  1032 
       
  1033 /**
       
  1034 AO handling notifications.  On receiving a notification it is processed by a specific event handler
       
  1035 */
       
  1036 
       
  1037 CTestRegisterNotifierAct* CTestRegisterNotifierAct::NewLC(CEtelIsvTestStep* aTestStep, CTelephony* aTelephony, TInt& aNumberNotifierTestsActive, CTelephony::TNotificationEvent aEvent)
       
  1038 //Factory constructor
       
  1039 	{
       
  1040 	CTestRegisterNotifierAct* obj = new(ELeave) CTestRegisterNotifierAct(aTestStep, aTelephony, aNumberNotifierTestsActive, aEvent);
       
  1041 	CleanupStack::PushL(obj);
       
  1042 	obj->ConstructL();
       
  1043 	return obj;
       
  1044 	}
       
  1045 
       
  1046 CTestRegisterNotifierAct::CTestRegisterNotifierAct(CEtelIsvTestStep* aTestStep, CTelephony* aTelephony, TInt& aNumberNotifierTestsActive, CTelephony::TNotificationEvent aEvent)
       
  1047 	: CEtelIsvActBase(aTestStep, aTelephony)
       
  1048 	, iEvent(aEvent)
       
  1049 	, iNumberNotifierTestsActive(aNumberNotifierTestsActive)
       
  1050 	, iCallParamsPckg(iCallParams)
       
  1051 	, iCallsActive(EFalse)	
       
  1052 	{  
       
  1053 	}
       
  1054 
       
  1055 void CTestRegisterNotifierAct::ConstructL()
       
  1056 	{  
       
  1057 	iCanceller = new(ELeave) CTestCanceller(this);
       
  1058 	CActiveScheduler::Add(this);
       
  1059 	}
       
  1060 
       
  1061 CTestRegisterNotifierAct::~CTestRegisterNotifierAct()
       
  1062 	{  
       
  1063 	Cancel();	// if any Req outstanding, calls DoCancel() to cleanup
       
  1064 	iNumberNotifierTestsActive--;
       
  1065 	delete iCanceller;
       
  1066 	delete iDialNewCallAct;
       
  1067 	delete iHangupAct;
       
  1068 	iExpNotificationCompleteList.Reset();
       
  1069 	}
       
  1070 
       
  1071 void CTestRegisterNotifierAct::DoCancel()
       
  1072 	{
       
  1073 	switch(iEvent)
       
  1074 		{
       
  1075 	case CTelephony::EFlightModeChange:
       
  1076 		iTelephony->CancelAsync(CTelephony::EFlightModeChangeCancel);	
       
  1077 		break;
       
  1078 	case CTelephony::EIndicatorChange:
       
  1079 		iTelephony->CancelAsync(CTelephony::EIndicatorChangeCancel);	
       
  1080 		break;
       
  1081 	case CTelephony::EBatteryInfoChange:
       
  1082 		iTelephony->CancelAsync(CTelephony::EBatteryInfoChangeCancel);	
       
  1083 		break;
       
  1084 	case CTelephony::ESignalStrengthChange:
       
  1085 		iTelephony->CancelAsync(CTelephony::ESignalStrengthChangeCancel);	
       
  1086 		break;
       
  1087 	case CTelephony::EPin1LockInfoChange:
       
  1088 		iTelephony->CancelAsync(CTelephony::EPin1LockInfoChangeCancel);	
       
  1089 		break;
       
  1090 	case CTelephony::EPin2LockInfoChange:
       
  1091 		iTelephony->CancelAsync(CTelephony::EPin2LockInfoChangeCancel);	
       
  1092 		break;
       
  1093 	case CTelephony::EVoiceLineStatusChange:
       
  1094 		iTelephony->CancelAsync(CTelephony::EVoiceLineStatusChangeCancel);	
       
  1095 		break;
       
  1096 	case CTelephony::EOwnedCall1StatusChange:
       
  1097 		iTelephony->CancelAsync(CTelephony::EOwnedCall1StatusChangeCancel);	
       
  1098 		break;
       
  1099 	case CTelephony::EOwnedCall2StatusChange:
       
  1100 		iTelephony->CancelAsync(CTelephony::EOwnedCall2StatusChangeCancel);	
       
  1101 		break;
       
  1102 	case CTelephony::EOwnedCall1RemotePartyInfoChange:
       
  1103 		iTelephony->CancelAsync(CTelephony::EOwnedCall1RemotePartyInfoChangeCancel);	
       
  1104 		break;
       
  1105 	case CTelephony::EOwnedCall2RemotePartyInfoChange:
       
  1106 		iTelephony->CancelAsync(CTelephony::EOwnedCall2RemotePartyInfoChangeCancel);	
       
  1107 		break;
       
  1108 	case CTelephony::ENetworkRegistrationStatusChange:
       
  1109 		iTelephony->CancelAsync(CTelephony::ENetworkRegistrationStatusChangeCancel);	
       
  1110 		break;
       
  1111 	case CTelephony::ECurrentNetworkInfoChange:
       
  1112 		iTelephony->CancelAsync(CTelephony::ECurrentNetworkInfoChangeCancel);	
       
  1113 		break;
       
  1114 	default:
       
  1115 		break;
       
  1116 		}	
       
  1117 	}
       
  1118 	
       
  1119 void CTestRegisterNotifierAct::StartNotifier(TDes8& aNotifierData, TRequestStatus aExpStat, TBool aCheckConcurrency)
       
  1120 	{
       
  1121 	iNotifierData=&aNotifierData;
       
  1122 	iExpStat=aExpStat;
       
  1123 	iNumberNotificationsBeforeFinish = iExpNotificationCompleteList.Count();
       
  1124 	SendNotifyRequest(aCheckConcurrency);
       
  1125 	TRAP_IGNORE(InvokeNotifyConditionL());
       
  1126 	iNotificationCount = 0;
       
  1127 	iNumberNotifierTestsActive++;
       
  1128 	}
       
  1129 	
       
  1130 void CTestRegisterNotifierAct::InvokeNotifyConditionL()
       
  1131 	{
       
  1132 	switch(iEvent)
       
  1133 		{
       
  1134 	case CTelephony::EVoiceLineStatusChange:
       
  1135 		MakeCallL();
       
  1136 		break;
       
  1137 	case CTelephony::EOwnedCall1StatusChange:
       
  1138 	case CTelephony::EOwnedCall2StatusChange:
       
  1139 		HangupCallL();
       
  1140 		break;
       
  1141 	default:
       
  1142 		break;
       
  1143 		}
       
  1144 	}
       
  1145 	
       
  1146 void CTestRegisterNotifierAct::SendNotifyRequest(TBool aCheckConcurrency)
       
  1147 	{
       
  1148 	iTelephony->NotifyChange(iStatus, iEvent, *iNotifierData);
       
  1149 	if(aCheckConcurrency)
       
  1150 		{
       
  1151 		TRequestStatus tmpStatus;
       
  1152 		iTelephony->NotifyChange(tmpStatus, iEvent, *iNotifierData);
       
  1153 		User::WaitForRequest(tmpStatus);
       
  1154 		iTestStep->TEST1(tmpStatus.Int() == KErrInUse, ETrue);
       
  1155 		}	
       
  1156 	SetActive();
       
  1157 	}
       
  1158 
       
  1159 void CTestRegisterNotifierAct::RunL()
       
  1160 	{ 
       
  1161 	// ActiveScheduler will have set status to KRequestComplete, just before
       
  1162 	// calling this RunL().
       
  1163 	iTestStep->TEST1(iStatus.Int() == iExpStat.Int(), ETrue);
       
  1164 	
       
  1165 	if(++iNotificationCount <= iNumberNotificationsBeforeFinish)
       
  1166 		{	//process the notification
       
  1167 		switch(iEvent)
       
  1168 			{
       
  1169 		case CTelephony::EFlightModeChange:
       
  1170 			ProcessFlightModeChangeNotification();
       
  1171 			break;
       
  1172 		case CTelephony::EIndicatorChange:
       
  1173 			ProcessIndicatorNotification();
       
  1174 			break;
       
  1175 		case CTelephony::EBatteryInfoChange:
       
  1176 			ProcessBatteryInfoNotification();
       
  1177 			break;
       
  1178 		case CTelephony::ESignalStrengthChange:
       
  1179 			ProcessSignalStrengthNotification();
       
  1180 			break;
       
  1181 		case CTelephony::EPin1LockInfoChange:
       
  1182 		case CTelephony::EPin2LockInfoChange:
       
  1183 			ProcessLockInfoNotification();
       
  1184 			break;
       
  1185 		case CTelephony::EVoiceLineStatusChange:
       
  1186 			ProcessLineStatusNotification();
       
  1187 			break;
       
  1188 		case CTelephony::EOwnedCall1StatusChange:
       
  1189 		case CTelephony::EOwnedCall2StatusChange:
       
  1190 			ProcessCallStatusNotification();
       
  1191 			break;
       
  1192 		case CTelephony::EOwnedCall1RemotePartyInfoChange:
       
  1193 		case CTelephony::EOwnedCall2RemotePartyInfoChange:
       
  1194 			ProcessRemotePartyInfoNotification();
       
  1195 			break;
       
  1196 		case CTelephony::ENetworkRegistrationStatusChange:
       
  1197 			ProcessNetworkRegistrationStatusNotification();
       
  1198 			break;
       
  1199 		case CTelephony::ECurrentNetworkInfoChange:
       
  1200 			ProcessCurrentNetworkInfoNotification();
       
  1201 			break;
       
  1202 		default:
       
  1203 			break;
       
  1204 			}
       
  1205 		}
       
  1206 	
       
  1207 	// Once we have gone through all our expected status objects then finish the test
       
  1208 	if(iNotificationCount >= iNumberNotificationsBeforeFinish || iStatus.Int() != KErrNone)
       
  1209 		iNumberNotifierTestsActive--;
       
  1210 	else	//post for further notifications
       
  1211 		SendNotifyRequest();
       
  1212 	
       
  1213 	//stop scheduler when all running tests complete
       
  1214 	if(iNumberNotifierTestsActive <= 0 && !iCallsActive)
       
  1215 		CActiveScheduler::Stop();
       
  1216 	}
       
  1217 
       
  1218 void CTestRegisterNotifierAct::ProcessFlightModeChangeNotification()
       
  1219 	{
       
  1220 	if(iStatus.Int() == KErrNone)
       
  1221 		{
       
  1222 		//get expected status for this notification		
       
  1223 		TDes8& expnotifierpckg = iExpNotificationCompleteList[iNotificationCount-1];
       
  1224 		CTelephony::TFlightModeV1Pckg& exppckg = REINTERPRET_CAST(CTelephony::TFlightModeV1Pckg&, expnotifierpckg);
       
  1225 		CTelephony::TFlightModeV1& expparams = (exppckg)();
       
  1226 		//get actual notification status
       
  1227 		CTelephony::TFlightModeV1& params = reinterpret_cast<CTelephony::TFlightModeV1&> 
       
  1228 												( const_cast<TUint8&> ( *iNotifierData->Ptr() ) );
       
  1229 		
       
  1230 		iTestStep->TEST1(params.iFlightModeStatus == expparams.iFlightModeStatus, ETrue);
       
  1231 		iTestStep->INFO_PRINTF2(_L("EFlightModeChange Notification ExpStatus: %d"), expparams.iFlightModeStatus);
       
  1232 		iTestStep->INFO_PRINTF2(_L("EFlightModeChange Notification Status: %d"), params.iFlightModeStatus);
       
  1233 		
       
  1234 		}
       
  1235 	else
       
  1236 		{
       
  1237 		iTestStep->INFO_PRINTF2(_L("Error for EFlightModeChange Notification: %d"), iStatus.Int() );
       
  1238 		}
       
  1239 	}
       
  1240 	
       
  1241 void CTestRegisterNotifierAct::ProcessIndicatorNotification()
       
  1242 	{
       
  1243 	if(iStatus.Int() == KErrNone)
       
  1244 		{
       
  1245 		//get expected status for this notification		
       
  1246 		TDes8& expnotifierpckg = iExpNotificationCompleteList[iNotificationCount-1];
       
  1247 		CTelephony::TIndicatorV1Pckg& exppckg = REINTERPRET_CAST(CTelephony::TIndicatorV1Pckg&, expnotifierpckg);
       
  1248 		CTelephony::TIndicatorV1& expparams = (exppckg)();
       
  1249 		//get actual notification status
       
  1250 		CTelephony::TIndicatorV1& params = reinterpret_cast<CTelephony::TIndicatorV1&> 
       
  1251 												( const_cast<TUint8&> ( *iNotifierData->Ptr() ) );		
       
  1252 		
       
  1253 		iTestStep->TEST1(expparams.iIndicator == params.iIndicator, ETrue);
       
  1254 		iTestStep->TEST1(expparams.iCapabilities == params.iCapabilities, ETrue);
       
  1255 		iTestStep->INFO_PRINTF2(_L("EIndicatorChange Notification ExpIndicator: %d"), expparams.iIndicator);
       
  1256 		iTestStep->INFO_PRINTF2(_L("EIndicatorChange Notification Indicator: %d"),params.iIndicator);
       
  1257 		iTestStep->INFO_PRINTF2(_L("EIndicatorChange Notification ExpCapability: %d"), expparams.iCapabilities);
       
  1258 		iTestStep->INFO_PRINTF2(_L("EIndicatorChange Notification Capability: %d"),params.iCapabilities);				
       
  1259 		}
       
  1260 	else
       
  1261 		{
       
  1262 		iTestStep->INFO_PRINTF2(_L("Error for EIndicatorChange Notification: %d"), iStatus.Int() );
       
  1263 		}
       
  1264 	}
       
  1265 	
       
  1266 void CTestRegisterNotifierAct::ProcessBatteryInfoNotification()
       
  1267 	{
       
  1268 	if(iStatus.Int() == KErrNone)
       
  1269 		{
       
  1270 		//get expected status for this notification		
       
  1271 		TDes8& expnotifierpckg = iExpNotificationCompleteList[iNotificationCount-1];
       
  1272 		CTelephony::TBatteryInfoV1Pckg& exppckg = REINTERPRET_CAST(CTelephony::TBatteryInfoV1Pckg&, expnotifierpckg);
       
  1273 		CTelephony::TBatteryInfoV1& expparams = (exppckg)();
       
  1274 		//get actual notification status
       
  1275 		CTelephony::TBatteryInfoV1& params = reinterpret_cast<CTelephony::TBatteryInfoV1&> 
       
  1276 												( const_cast<TUint8&> ( *iNotifierData->Ptr() ) );
       
  1277 		
       
  1278 		iTestStep->TEST1(expparams.iStatus == params.iStatus, ETrue);
       
  1279 		iTestStep->TEST1(expparams.iChargeLevel == params.iChargeLevel, ETrue);	
       
  1280 		iTestStep->INFO_PRINTF2(_L("EBatteryInfoChange Notification ExpStatus: %d"),expparams.iStatus);	
       
  1281 		iTestStep->INFO_PRINTF2(_L("EBatteryInfoChange Notification Status: %d"),params.iStatus);
       
  1282 		iTestStep->INFO_PRINTF2(_L("EBatteryInfoChange Notification ExpChargeLevel: %d"),expparams.iChargeLevel);	
       
  1283 		iTestStep->INFO_PRINTF2(_L("EBatteryInfoChange Notification ChargeLevel: %d"),params.iChargeLevel);
       
  1284 		}
       
  1285 	else
       
  1286 		{
       
  1287 		iTestStep->INFO_PRINTF2(_L("Error for EBatteryInfoChange Notification: %d"), iStatus.Int() );
       
  1288 		}
       
  1289 	}
       
  1290 	
       
  1291 void CTestRegisterNotifierAct::ProcessSignalStrengthNotification()
       
  1292 	{
       
  1293 	if(iStatus.Int() == KErrNone)
       
  1294 		{
       
  1295 		//get expected status for this notification		
       
  1296 		TDes8& expnotifierpckg = iExpNotificationCompleteList[iNotificationCount-1];
       
  1297 		CTelephony::TSignalStrengthV1Pckg& exppckg = REINTERPRET_CAST(CTelephony::TSignalStrengthV1Pckg&, expnotifierpckg);
       
  1298 		CTelephony::TSignalStrengthV1& expparams = (exppckg)();
       
  1299 		//get actual notification status
       
  1300 		CTelephony::TSignalStrengthV1& params = reinterpret_cast<CTelephony::TSignalStrengthV1&> 
       
  1301 												( const_cast<TUint8&> ( *iNotifierData->Ptr() ) );
       
  1302 		
       
  1303 		iTestStep->TEST1(expparams.iSignalStrength == params.iSignalStrength, ETrue);	
       
  1304 		iTestStep->TEST1(expparams.iBar == params.iBar, ETrue);
       
  1305 		iTestStep->INFO_PRINTF2(_L("ESignalStrengthChange Notification ExpSignalStrength: %d"),expparams.iSignalStrength);	
       
  1306 		iTestStep->INFO_PRINTF2(_L("ESignalStrengthChange Notification SignalStrength: %d"),params.iSignalStrength);	
       
  1307 		iTestStep->INFO_PRINTF2(_L("ESignalStrengthChange Notification ExpBar: %d"),expparams.iBar);	
       
  1308 		iTestStep->INFO_PRINTF2(_L("ESignalStrengthChange Notification Bar: %d"),params.iBar);
       
  1309 		}
       
  1310 	else
       
  1311 		{
       
  1312 		iTestStep->INFO_PRINTF2(_L("Error for ESignalStrengthChange Notification: %d"), iStatus.Int() );
       
  1313 		}
       
  1314 	}
       
  1315 	
       
  1316 void CTestRegisterNotifierAct::ProcessLockInfoNotification()
       
  1317 	{
       
  1318 	if(iStatus.Int() == KErrNone)
       
  1319 		{
       
  1320 		//get expected status for this notification		
       
  1321 		TDes8& expnotifierpckg = iExpNotificationCompleteList[iNotificationCount-1];
       
  1322 		CTelephony::TIccLockInfoV1Pckg& exppckg = REINTERPRET_CAST(CTelephony::TIccLockInfoV1Pckg&, expnotifierpckg);
       
  1323 		CTelephony::TIccLockInfoV1& expparams = (exppckg)();
       
  1324 		//get actual notification status
       
  1325 		CTelephony::TIccLockInfoV1& params = reinterpret_cast<CTelephony::TIccLockInfoV1&> 
       
  1326 												( const_cast<TUint8&> ( *iNotifierData->Ptr() ) );
       
  1327 		
       
  1328 		iTestStep->TEST1(expparams.iStatus == params.iStatus, ETrue);		
       
  1329 		iTestStep->TEST1(expparams.iSetting == params.iSetting, ETrue);
       
  1330 		iTestStep->INFO_PRINTF2(_L("ELockInfoChange Notification ExpStatus: %d"),expparams.iStatus);
       
  1331 		iTestStep->INFO_PRINTF2(_L("ELockInfoChange Notification Status: %d"),params.iStatus);
       
  1332 		iTestStep->INFO_PRINTF2(_L("ELockInfoChange Notification ExpSetting: %d"),expparams.iSetting);
       
  1333 		iTestStep->INFO_PRINTF2(_L("ELockInfoChange Notification Setting: %d"),params.iSetting);
       
  1334 		}
       
  1335 	else
       
  1336 		{
       
  1337 		iTestStep->INFO_PRINTF2(_L("Error for ELockInfoChange Notification: %d"), iStatus.Int() );
       
  1338 		}
       
  1339 	}
       
  1340 	
       
  1341 void CTestRegisterNotifierAct::ProcessLineStatusNotification()
       
  1342 	{
       
  1343 	if(iStatus.Int() == KErrNone)
       
  1344 		{
       
  1345 		//get expected status for this notification		
       
  1346 		TDes8& expnotifierpckg = iExpNotificationCompleteList[iNotificationCount-1];
       
  1347 		CTelephony::TCallStatusV1Pckg& exppckg = REINTERPRET_CAST(CTelephony::TCallStatusV1Pckg&, expnotifierpckg);
       
  1348 		CTelephony::TCallStatusV1& expparams = (exppckg)();
       
  1349 		//get actual notification status
       
  1350 		CTelephony::TCallStatusV1& params = reinterpret_cast<CTelephony::TCallStatusV1&> 
       
  1351 												( const_cast<TUint8&> ( *iNotifierData->Ptr() ) );
       
  1352 		
       
  1353 		iTestStep->TEST1(expparams.iStatus == params.iStatus, ETrue);
       
  1354 		iTestStep->INFO_PRINTF2(_L("ELineStatusChange Notification ExpStatus: %d"),expparams.iStatus);
       
  1355 		iTestStep->INFO_PRINTF2(_L("ELineStatusChange Notification Status: %d"),params.iStatus);			
       
  1356 		}
       
  1357 	else
       
  1358 		{
       
  1359 		iTestStep->INFO_PRINTF2(_L("Error for ELineStatusChange Notification: %d"), iStatus.Int() );
       
  1360 		}
       
  1361 	}
       
  1362 	
       
  1363 void CTestRegisterNotifierAct::ProcessCallStatusNotification()
       
  1364 	{
       
  1365 	if(iStatus.Int() == KErrNone)
       
  1366 		{
       
  1367 		//get expected status for this notification		
       
  1368 		TDes8& expnotifierpckg = iExpNotificationCompleteList[iNotificationCount-1];
       
  1369 		CTelephony::TCallStatusV1Pckg& exppckg = REINTERPRET_CAST(CTelephony::TCallStatusV1Pckg&, expnotifierpckg);
       
  1370 		CTelephony::TCallStatusV1& expparams = (exppckg)();
       
  1371 		//get actual notification status
       
  1372 		CTelephony::TCallStatusV1& params = reinterpret_cast<CTelephony::TCallStatusV1&> 
       
  1373 												( const_cast<TUint8&> ( *iNotifierData->Ptr() ) );		
       
  1374 		
       
  1375 		iTestStep->TEST1(expparams.iStatus == params.iStatus, ETrue);
       
  1376 		iTestStep->INFO_PRINTF2(_L("ECallStatusChange Notification ExpStatus: %d"),expparams.iStatus);
       
  1377 		iTestStep->INFO_PRINTF2(_L("ECallStatusChange Notification Status: %d"),params.iStatus);			
       
  1378 		}
       
  1379 	else
       
  1380 		{
       
  1381 		iTestStep->INFO_PRINTF2(_L("Error for ECallStatusChange Notification: %d"), iStatus.Int() );
       
  1382 		}
       
  1383 	}
       
  1384 	
       
  1385 void CTestRegisterNotifierAct::ProcessRemotePartyInfoNotification()
       
  1386 	{
       
  1387 	if(iStatus.Int() == KErrNone)
       
  1388 		{
       
  1389 		//get expected status for this notification		
       
  1390 		TDes8& expnotifierpckg = iExpNotificationCompleteList[iNotificationCount-1];
       
  1391 		CTelephony::TRemotePartyInfoV1Pckg& exppckg = REINTERPRET_CAST(CTelephony::TRemotePartyInfoV1Pckg&, expnotifierpckg);
       
  1392 		CTelephony::TRemotePartyInfoV1& expparams = (exppckg)();
       
  1393 		//get actual notification status
       
  1394 		CTelephony::TRemotePartyInfoV1& params = reinterpret_cast<CTelephony::TRemotePartyInfoV1&> 
       
  1395 													( const_cast<TUint8&> ( *iNotifierData->Ptr() ) );
       
  1396 		
       
  1397 		iTestStep->TEST1(expparams.iRemoteIdStatus == params.iRemoteIdStatus, ETrue);
       
  1398 		iTestStep->TEST1(expparams.iCallingName == params.iCallingName, ETrue);	
       
  1399 		iTestStep->TEST1(expparams.iRemoteNumber.iTypeOfNumber == params.iRemoteNumber.iTypeOfNumber, ETrue);
       
  1400 		iTestStep->TEST1(expparams.iRemoteNumber.iNumberPlan == params.iRemoteNumber.iNumberPlan, ETrue);
       
  1401 		iTestStep->TEST1(expparams.iRemoteNumber.iTelNumber == params.iRemoteNumber.iTelNumber, ETrue);
       
  1402 		iTestStep->TEST1(expparams.iDirection == params.iDirection, ETrue);
       
  1403 		
       
  1404 		iTestStep->INFO_PRINTF2(_L("ERemotePartyInfoChange Notification ExpRemoteIdStatus: %d"),expparams.iRemoteIdStatus);
       
  1405 		iTestStep->INFO_PRINTF2(_L("ERemotePartyInfoChange Notification RemoteIdStatus: %d"),params.iRemoteIdStatus);	
       
  1406 		iTestStep->INFO_PRINTF2(_L("ERemotePartyInfoChange Notification ExpCallingName: %S"),&expparams.iCallingName);
       
  1407 		iTestStep->INFO_PRINTF2(_L("ERemotePartyInfoChange Notification CallingName: %S"),&params.iCallingName);	
       
  1408 		iTestStep->INFO_PRINTF2(_L("ERemotePartyInfoChange Notification ExpRemoteNumber.TON: %d"),expparams.iRemoteNumber.iTypeOfNumber);
       
  1409 		iTestStep->INFO_PRINTF2(_L("ERemotePartyInfoChange Notification RemoteNumber.TON: %d"),params.iRemoteNumber.iTypeOfNumber);
       
  1410 		iTestStep->INFO_PRINTF2(_L("ERemotePartyInfoChange Notification ExpRemoteNumber.NPI: %d"),expparams.iRemoteNumber.iNumberPlan);
       
  1411 		iTestStep->INFO_PRINTF2(_L("ERemotePartyInfoChange Notification RemoteNumber.NPI: %d"),params.iRemoteNumber.iNumberPlan);	
       
  1412 		iTestStep->INFO_PRINTF2(_L("ERemotePartyInfoChange Notification ExpRemoteNumber.Number: %S"),&expparams.iRemoteNumber.iTelNumber);
       
  1413 		iTestStep->INFO_PRINTF2(_L("ERemotePartyInfoChange Notification RemoteNumber.Number: %S"),&params.iRemoteNumber.iTelNumber);
       
  1414 		iTestStep->INFO_PRINTF2(_L("ERemotePartyInfoChange Notification ExpDirection: %d"),expparams.iDirection);
       
  1415 		iTestStep->INFO_PRINTF2(_L("ERemotePartyInfoChange Notification Direction: %d"),params.iDirection);			
       
  1416 		}
       
  1417 	else
       
  1418 		{
       
  1419 		iTestStep->INFO_PRINTF2(_L("Error for ERemotePartyInfoChange Notification: %d"), iStatus.Int() );
       
  1420 		}
       
  1421 	}
       
  1422 	
       
  1423 void CTestRegisterNotifierAct::ProcessNetworkRegistrationStatusNotification()
       
  1424 	{
       
  1425 	if(iStatus.Int() == KErrNone)
       
  1426 		{
       
  1427 		//get expected status for this notification		
       
  1428 		TDes8& expnotifierpckg = iExpNotificationCompleteList[iNotificationCount-1];
       
  1429 		CTelephony::TNetworkRegistrationV1Pckg& exppckg = REINTERPRET_CAST(CTelephony::TNetworkRegistrationV1Pckg&, expnotifierpckg);
       
  1430 		CTelephony::TNetworkRegistrationV1& expparams = (exppckg)();
       
  1431 		//get actual notification status
       
  1432 		CTelephony::TNetworkRegistrationV1& params = reinterpret_cast<CTelephony::TNetworkRegistrationV1&> 
       
  1433 														( const_cast<TUint8&> ( *iNotifierData->Ptr() ) );
       
  1434 				
       
  1435 		iTestStep->TEST1(expparams.iRegStatus == params.iRegStatus, ETrue);	
       
  1436 		iTestStep->INFO_PRINTF2(_L("ENetworkRegistrationStatusChange Notification ExpRegStatus: %d"),expparams.iRegStatus);
       
  1437 		iTestStep->INFO_PRINTF2(_L("ENetworkRegistrationStatusChange Notification RegStatus: %d"),params.iRegStatus);	
       
  1438 		}
       
  1439 	else
       
  1440 		{
       
  1441 		iTestStep->INFO_PRINTF2(_L("Error for ENetworkRegistrationStatusChange Notification: %d"), iStatus.Int() );
       
  1442 		}
       
  1443 	}
       
  1444 	
       
  1445 void CTestRegisterNotifierAct::ProcessCurrentNetworkInfoNotification()
       
  1446 	{
       
  1447 	switch(iNetworkInfoVersion)
       
  1448 		{
       
  1449 	case 1:
       
  1450 		{
       
  1451 		if(iStatus.Int() == KErrNone)
       
  1452 			{
       
  1453 			//get expected status for this notification		
       
  1454 			TDes8& expnotifierpckg = iExpNotificationCompleteList[iNotificationCount-1];
       
  1455 			CTelephony::TNetworkInfoV1Pckg& exppckg = REINTERPRET_CAST(CTelephony::TNetworkInfoV1Pckg&, expnotifierpckg);
       
  1456 			CTelephony::TNetworkInfoV1& expparams = (exppckg)();
       
  1457 			//get actual notification status
       
  1458 			CTelephony::TNetworkInfoV1& params = reinterpret_cast<CTelephony::TNetworkInfoV1&> 
       
  1459 													( const_cast<TUint8&> ( *iNotifierData->Ptr() ) );	
       
  1460 			
       
  1461 			iTestStep->TEST1(expparams.iMode == params.iMode, ETrue);
       
  1462 			iTestStep->TEST1(expparams.iStatus == params.iStatus, ETrue);
       
  1463 			iTestStep->TEST1(expparams.iCountryCode == params.iCountryCode, ETrue);
       
  1464 			iTestStep->TEST1(expparams.iNetworkId == params.iNetworkId, ETrue);
       
  1465 			iTestStep->TEST1(expparams.iDisplayTag == params.iDisplayTag, ETrue);
       
  1466 			iTestStep->TEST1(expparams.iShortName == params.iShortName, ETrue);
       
  1467 			iTestStep->TEST1(expparams.iBandInfo == params.iBandInfo, ETrue);
       
  1468 			iTestStep->TEST1(expparams.iCdmaSID == params.iCdmaSID, ETrue);
       
  1469 			iTestStep->TEST1(expparams.iLongName == params.iLongName, ETrue);
       
  1470 			iTestStep->TEST1(expparams.iAccess == params.iAccess, ETrue);
       
  1471 			iTestStep->TEST1(expparams.iAreaKnown == params.iAreaKnown, ETrue);
       
  1472 			iTestStep->TEST1(expparams.iLocationAreaCode == params.iLocationAreaCode, ETrue);
       
  1473 			iTestStep->TEST1(expparams.iCellId == params.iCellId, ETrue);
       
  1474 			
       
  1475 			iTestStep->INFO_PRINTF2(_L("ECurrentNetworkInfo Notification ExpMode: %d"),expparams.iMode);
       
  1476 			iTestStep->INFO_PRINTF2(_L("ECurrentNetworkInfo Notification Mode: %d"),params.iMode);
       
  1477 			iTestStep->INFO_PRINTF2(_L("ECurrentNetworkInfo Notification ExpStatus: %d"),expparams.iStatus);
       
  1478 			iTestStep->INFO_PRINTF2(_L("ECurrentNetworkInfo Notification Status: %d"),params.iStatus);
       
  1479 			iTestStep->INFO_PRINTF2(_L("ECurrentNetworkInfo Notification ExpCountryCode: %S"),&expparams.iCountryCode);
       
  1480 			iTestStep->INFO_PRINTF2(_L("ECurrentNetworkInfo Notification CountryCode: %S"),&params.iCountryCode);	
       
  1481 			iTestStep->INFO_PRINTF2(_L("ECurrentNetworkInfo Notification ExpNetworkId: %S"),&expparams.iNetworkId);
       
  1482 			iTestStep->INFO_PRINTF2(_L("ECurrentNetworkInfo Notification NetworkId: %S"),&params.iNetworkId);
       
  1483 			iTestStep->INFO_PRINTF2(_L("ECurrentNetworkInfo Notification ExpDisplayTag: %S"),&expparams.iDisplayTag);
       
  1484 			iTestStep->INFO_PRINTF2(_L("ECurrentNetworkInfo Notification DisplayTag: %S"),&params.iDisplayTag);
       
  1485 			iTestStep->INFO_PRINTF2(_L("ECurrentNetworkInfo Notification ExpShortName: %S"),&expparams.iShortName);
       
  1486 			iTestStep->INFO_PRINTF2(_L("ECurrentNetworkInfo Notification ShortName: %S"),&params.iShortName);
       
  1487 			iTestStep->INFO_PRINTF2(_L("ECurrentNetworkInfo Notification ExpBandInfo: %d"),expparams.iBandInfo);
       
  1488 			iTestStep->INFO_PRINTF2(_L("ECurrentNetworkInfo Notification BandInfo: %d"),params.iBandInfo);
       
  1489 			iTestStep->INFO_PRINTF2(_L("ECurrentNetworkInfo Notification ExpCdmaSID: %S"),&expparams.iCdmaSID);
       
  1490 			iTestStep->INFO_PRINTF2(_L("ECurrentNetworkInfo Notification CdmaSID: %S"),&params.iCdmaSID);
       
  1491 			iTestStep->INFO_PRINTF2(_L("ECurrentNetworkInfo Notification ExpLongName: %S"),&expparams.iLongName);
       
  1492 			iTestStep->INFO_PRINTF2(_L("ECurrentNetworkInfo Notification LongName: %S"),&params.iLongName);	
       
  1493 			iTestStep->INFO_PRINTF2(_L("ECurrentNetworkInfo Notification ExpAccess: %d"),expparams.iAccess);
       
  1494 			iTestStep->INFO_PRINTF2(_L("ECurrentNetworkInfo Notification Access: %d"),params.iAccess);
       
  1495 			iTestStep->INFO_PRINTF2(_L("ECurrentNetworkInfo Notification ExpAreaKnown: %d"),expparams.iAreaKnown);
       
  1496 			iTestStep->INFO_PRINTF2(_L("ECurrentNetworkInfo Notification AreaKnown: %d"),params.iAreaKnown);
       
  1497 			iTestStep->INFO_PRINTF2(_L("ECurrentNetworkInfo Notification ExpLocationAreaCode: %d"),expparams.iLocationAreaCode);
       
  1498 			iTestStep->INFO_PRINTF2(_L("ECurrentNetworkInfo Notification LocationAreaCode: %d"),params.iLocationAreaCode);
       
  1499 			iTestStep->INFO_PRINTF2(_L("ECurrentNetworkInfo Notification ExpCellId: %d"),expparams.iCellId);
       
  1500 			iTestStep->INFO_PRINTF2(_L("ECurrentNetworkInfo Notification CellId: %d"),params.iCellId);					
       
  1501 			}
       
  1502 		else
       
  1503 			{
       
  1504 			iTestStep->INFO_PRINTF2(_L("Error for ECurrentNetworkInfo Notification: %d"), iStatus.Int() );
       
  1505 			}			
       
  1506 		}
       
  1507 		break;
       
  1508 	case 2:
       
  1509 		{
       
  1510 		if(iStatus.Int() == KErrNone)
       
  1511 			{
       
  1512 			//get expected status for this notification		
       
  1513 			TDes8& expnotifierpckg = iExpNotificationCompleteList[iNotificationCount-1];
       
  1514 			CTelephony::TNetworkInfoV2Pckg& exppckg = reinterpret_cast<CTelephony::TNetworkInfoV2Pckg&>(expnotifierpckg);
       
  1515 			CTelephony::TNetworkInfoV2& expparams = (exppckg)();
       
  1516 			//get actual notification status
       
  1517 			CTelephony::TNetworkInfoV2& params = reinterpret_cast<CTelephony::TNetworkInfoV2&> 
       
  1518 													( const_cast<TUint8&> ( *iNotifierData->Ptr() ) );	
       
  1519 			
       
  1520 			iTestStep->TEST1(expparams.iMode == params.iMode, ETrue);
       
  1521 			iTestStep->TEST1(expparams.iStatus == params.iStatus, ETrue);
       
  1522 			iTestStep->TEST1(expparams.iCountryCode == params.iCountryCode, ETrue);
       
  1523 			iTestStep->TEST1(expparams.iNetworkId == params.iNetworkId, ETrue);
       
  1524 			iTestStep->TEST1(expparams.iDisplayTag == params.iDisplayTag, ETrue);
       
  1525 			iTestStep->TEST1(expparams.iShortName == params.iShortName, ETrue);
       
  1526 			iTestStep->TEST1(expparams.iBandInfo == params.iBandInfo, ETrue);
       
  1527 			iTestStep->TEST1(expparams.iCdmaSID == params.iCdmaSID, ETrue);
       
  1528 			iTestStep->TEST1(expparams.iLongName == params.iLongName, ETrue);
       
  1529 			iTestStep->TEST1(expparams.iAccess == params.iAccess, ETrue);
       
  1530 			iTestStep->TEST1(expparams.iAreaKnown == params.iAreaKnown, ETrue);
       
  1531 			iTestStep->TEST1(expparams.iLocationAreaCode == params.iLocationAreaCode, ETrue);
       
  1532 			iTestStep->TEST1(expparams.iCellId == params.iCellId, ETrue);
       
  1533 			
       
  1534 			iTestStep->INFO_PRINTF2(_L("ECurrentNetworkInfo Notification ExpMode: %d"),expparams.iMode);
       
  1535 			iTestStep->INFO_PRINTF2(_L("ECurrentNetworkInfo Notification Mode: %d"),params.iMode);
       
  1536 			iTestStep->INFO_PRINTF2(_L("ECurrentNetworkInfo Notification ExpStatus: %d"),expparams.iStatus);
       
  1537 			iTestStep->INFO_PRINTF2(_L("ECurrentNetworkInfo Notification Status: %d"),params.iStatus);
       
  1538 			iTestStep->INFO_PRINTF2(_L("ECurrentNetworkInfo Notification ExpCountryCode: %S"),&expparams.iCountryCode);
       
  1539 			iTestStep->INFO_PRINTF2(_L("ECurrentNetworkInfo Notification CountryCode: %S"),&params.iCountryCode);	
       
  1540 			iTestStep->INFO_PRINTF2(_L("ECurrentNetworkInfo Notification ExpNetworkId: %S"),&expparams.iNetworkId);
       
  1541 			iTestStep->INFO_PRINTF2(_L("ECurrentNetworkInfo Notification NetworkId: %S"),&params.iNetworkId);
       
  1542 			iTestStep->INFO_PRINTF2(_L("ECurrentNetworkInfo Notification ExpDisplayTag: %S"),&expparams.iDisplayTag);
       
  1543 			iTestStep->INFO_PRINTF2(_L("ECurrentNetworkInfo Notification DisplayTag: %S"),&params.iDisplayTag);
       
  1544 			iTestStep->INFO_PRINTF2(_L("ECurrentNetworkInfo Notification ExpShortName: %S"),&expparams.iShortName);
       
  1545 			iTestStep->INFO_PRINTF2(_L("ECurrentNetworkInfo Notification ShortName: %S"),&params.iShortName);
       
  1546 			iTestStep->INFO_PRINTF2(_L("ECurrentNetworkInfo Notification ExpBandInfo: %d"),expparams.iBandInfo);
       
  1547 			iTestStep->INFO_PRINTF2(_L("ECurrentNetworkInfo Notification BandInfo: %d"),params.iBandInfo);
       
  1548 			iTestStep->INFO_PRINTF2(_L("ECurrentNetworkInfo Notification ExpCdmaSID: %S"),&expparams.iCdmaSID);
       
  1549 			iTestStep->INFO_PRINTF2(_L("ECurrentNetworkInfo Notification CdmaSID: %S"),&params.iCdmaSID);
       
  1550 			iTestStep->INFO_PRINTF2(_L("ECurrentNetworkInfo Notification ExpLongName: %S"),&expparams.iLongName);
       
  1551 			iTestStep->INFO_PRINTF2(_L("ECurrentNetworkInfo Notification LongName: %S"),&params.iLongName);	
       
  1552 			iTestStep->INFO_PRINTF2(_L("ECurrentNetworkInfo Notification ExpAccess: %d"),expparams.iAccess);
       
  1553 			iTestStep->INFO_PRINTF2(_L("ECurrentNetworkInfo Notification Access: %d"),params.iAccess);
       
  1554 			iTestStep->INFO_PRINTF2(_L("ECurrentNetworkInfo Notification ExpAreaKnown: %d"),expparams.iAreaKnown);
       
  1555 			iTestStep->INFO_PRINTF2(_L("ECurrentNetworkInfo Notification AreaKnown: %d"),params.iAreaKnown);
       
  1556 			iTestStep->INFO_PRINTF2(_L("ECurrentNetworkInfo Notification ExpLocationAreaCode: %d"),expparams.iLocationAreaCode);
       
  1557 			iTestStep->INFO_PRINTF2(_L("ECurrentNetworkInfo Notification LocationAreaCode: %d"),params.iLocationAreaCode);
       
  1558 			iTestStep->INFO_PRINTF2(_L("ECurrentNetworkInfo Notification ExpCellId: %d"),expparams.iCellId);
       
  1559 			iTestStep->INFO_PRINTF2(_L("ECurrentNetworkInfo Notification CellId: %d"),params.iCellId);					
       
  1560 			}
       
  1561 		else
       
  1562 			{
       
  1563 			iTestStep->INFO_PRINTF2(_L("Error for ECurrentNetworkInfo Notification: %d"), iStatus.Int() );
       
  1564 			}		
       
  1565 		}
       
  1566 		break;
       
  1567 		}
       
  1568 
       
  1569 	}
       
  1570 	
       
  1571 void CTestRegisterNotifierAct::MakeCallL()
       
  1572 	{
       
  1573 	_LIT(KGoodNumber,"1789");
       
  1574 	iCallParams.iIdRestrict = CTelephony::ESendMyId;
       
  1575 		
       
  1576 	iTestCallParams.iLine = CTelephony::EVoiceLine;
       
  1577 	iTestCallParams.iCallParamsV1Pckg = &iCallParamsPckg;
       
  1578 	iTestCallParams.iTelAddress.iTelNumber = KGoodNumber;
       
  1579 	iTestCallParams.iExpStat = KErrNone;
       
  1580 	
       
  1581 	iDialNewCallAct = CTestDialNewCallAct::NewL(iTestStep, iTelephony, this);	
       
  1582 	
       
  1583 	// Create a call - should succeed
       
  1584 	iTestCallParams.iCallId = CTelephony::EISVMaxNumOfCalls;
       
  1585 	iDialNewCallAct->TestDialNewCall(iTestCallParams);
       
  1586 	iCallsActive = ETrue;
       
  1587 	}
       
  1588 
       
  1589 void CTestRegisterNotifierAct::HangupCallL()
       
  1590 	{
       
  1591 	iHangupAct	= CTestHangupAct::NewL(iTestStep, iTelephony, this);
       
  1592 	iHangupAct->TestHangup(iTestCallParams);	
       
  1593 	}
       
  1594 void  CTestRegisterNotifierAct::ActionParent(const TRequestStatus aCallStatus, const TActionEvent aEvent)
       
  1595 	{
       
  1596 /**
       
  1597 Gets called from a child AO when its RunL has been called.  
       
  1598 */
       
  1599 	//got callback from child AO. Proceed the test.
       
  1600 	if(aCallStatus.Int() == KErrNone)
       
  1601 		{
       
  1602 		if(iEvent == CTelephony::EVoiceLineStatusChange && aEvent == EDialNewCall)	
       
  1603 			{
       
  1604 			TRAP_IGNORE(HangupCallL());
       
  1605 			return;
       
  1606 			}
       
  1607 		else if(iEvent == CTelephony::EVoiceLineStatusChange && aEvent == EHangup)
       
  1608 			{
       
  1609 			iCallsActive = EFalse;	
       
  1610 			CActiveScheduler::Stop();
       
  1611 			}
       
  1612 		else if((iEvent == CTelephony::EOwnedCall1StatusChange || iEvent == CTelephony::EOwnedCall2StatusChange) && aEvent == EDialNewCall)
       
  1613 			{
       
  1614 			CActiveScheduler::Stop();
       
  1615 			}
       
  1616 		else if((iEvent == CTelephony::EOwnedCall1RemotePartyInfoChange || iEvent == CTelephony::EOwnedCall2RemotePartyInfoChange) && aEvent == EDialNewCall)
       
  1617 			{
       
  1618 			CActiveScheduler::Stop();
       
  1619 			iCallsActive = 0;
       
  1620 			}
       
  1621 		else if((iEvent == CTelephony::EOwnedCall1StatusChange || iEvent == CTelephony::EOwnedCall2StatusChange) && aEvent == EHangup)
       
  1622 			{
       
  1623 			iCallsActive = EFalse;	
       
  1624 			CActiveScheduler::Stop();
       
  1625 			}
       
  1626 		}	
       
  1627 	else
       
  1628 		{
       
  1629 		iCallsActive = EFalse;	
       
  1630 		CActiveScheduler::Stop();
       
  1631 		}
       
  1632 		
       
  1633 	}
       
  1634 	
       
  1635 /**
       
  1636 Sets iNetworkInfoVersion to aVersion.
       
  1637 
       
  1638 @param aVersion The version of TNetworkInfo being tested.
       
  1639 */
       
  1640 void CTestRegisterNotifierAct::SetNetworkInfoVersion(TInt aVersion)
       
  1641 	{
       
  1642 	iNetworkInfoVersion = aVersion;
       
  1643 	}
       
  1644 
       
  1645 CTestCancelRegisterNotifierAct* CTestCancelRegisterNotifierAct::NewLC(CEtelIsvTestStep* aTestStep, CTelephony* aTelephony, CTelephony::TNotificationEvent aEvent)
       
  1646 //Factory constructor
       
  1647 	{
       
  1648 	CTestCancelRegisterNotifierAct* obj = new(ELeave) CTestCancelRegisterNotifierAct(aTestStep, aTelephony, aEvent);
       
  1649 	CleanupStack::PushL(obj);
       
  1650 	obj->ConstructL();
       
  1651 	return obj;
       
  1652 	}
       
  1653 CTestCancelRegisterNotifierAct::CTestCancelRegisterNotifierAct(CEtelIsvTestStep* aTestStep, CTelephony* aTelephony, CTelephony::TNotificationEvent aEvent)
       
  1654 	: CEtelIsvActBase(aTestStep, aTelephony)
       
  1655 	, iEvent(aEvent)
       
  1656 	, iCallParamsPckg(iCallParams)
       
  1657 	{  
       
  1658 	}
       
  1659 
       
  1660 void CTestCancelRegisterNotifierAct::ConstructL()
       
  1661 	{
       
  1662 	iCanceller = new(ELeave) CTestCanceller(this);
       
  1663 	CActiveScheduler::Add(this);
       
  1664 	}
       
  1665 
       
  1666 CTestCancelRegisterNotifierAct::~CTestCancelRegisterNotifierAct()
       
  1667 	{  
       
  1668 	Cancel();	// if any Req outstanding, calls DoCancel() to cleanup
       
  1669 	delete iCanceller;
       
  1670 	iExpNotificationCompleteList.Reset();
       
  1671 	}
       
  1672 	
       
  1673 void CTestCancelRegisterNotifierAct::StartNotifier(TDes8& aNotifierPckg, TRequestStatus aExpStat)
       
  1674 	{
       
  1675 	iNotifierPckg=&aNotifierPckg;
       
  1676 	iExpStat=aExpStat;
       
  1677 	
       
  1678 	iTelephony->NotifyChange(iStatus, iEvent, *iNotifierPckg);
       
  1679 	SetActive();
       
  1680 	}
       
  1681 	
       
  1682 void CTestCancelRegisterNotifierAct::RunL()
       
  1683 	{ 
       
  1684 	// ActiveScheduler will have set status to KRequestComplete, just before
       
  1685 	// calling this RunL().
       
  1686 	iTestStep->TEST1(iStatus.Int() == iExpStat.Int(), ETrue);
       
  1687 	CActiveScheduler::Stop();	
       
  1688 	}
       
  1689 
       
  1690 void CTestCancelRegisterNotifierAct::DoCancel()
       
  1691 	{
       
  1692 	switch(iEvent)
       
  1693 		{
       
  1694 	case CTelephony::EFlightModeChange:
       
  1695 		iTelephony->CancelAsync(CTelephony::EFlightModeChangeCancel);	
       
  1696 		break;
       
  1697 	case CTelephony::EIndicatorChange:
       
  1698 		iTelephony->CancelAsync(CTelephony::EIndicatorChangeCancel);	
       
  1699 		break;
       
  1700 	case CTelephony::EBatteryInfoChange:
       
  1701 		iTelephony->CancelAsync(CTelephony::EBatteryInfoChangeCancel);	
       
  1702 		break;
       
  1703 	case CTelephony::ESignalStrengthChange:
       
  1704 		iTelephony->CancelAsync(CTelephony::ESignalStrengthChangeCancel);	
       
  1705 		break;
       
  1706 	case CTelephony::EPin1LockInfoChange:
       
  1707 		iTelephony->CancelAsync(CTelephony::EPin1LockInfoChangeCancel);	
       
  1708 		break;
       
  1709 	case CTelephony::EPin2LockInfoChange:
       
  1710 		iTelephony->CancelAsync(CTelephony::EPin2LockInfoChangeCancel);	
       
  1711 		break;
       
  1712 	case CTelephony::EVoiceLineStatusChange:
       
  1713 		iTelephony->CancelAsync(CTelephony::EVoiceLineStatusChangeCancel);	
       
  1714 		break;
       
  1715 	case CTelephony::EOwnedCall1StatusChange:
       
  1716 		iTelephony->CancelAsync(CTelephony::EOwnedCall1StatusChangeCancel);	
       
  1717 		break;
       
  1718 	case CTelephony::EOwnedCall2StatusChange:
       
  1719 		iTelephony->CancelAsync(CTelephony::EOwnedCall2StatusChangeCancel);	
       
  1720 		break;
       
  1721 	case CTelephony::EOwnedCall1RemotePartyInfoChange:
       
  1722 		iTelephony->CancelAsync(CTelephony::EOwnedCall1RemotePartyInfoChangeCancel);	
       
  1723 		break;
       
  1724 	case CTelephony::EOwnedCall2RemotePartyInfoChange:
       
  1725 		iTelephony->CancelAsync(CTelephony::EOwnedCall2RemotePartyInfoChangeCancel);	
       
  1726 		break;
       
  1727 	case CTelephony::ENetworkRegistrationStatusChange:
       
  1728 		iTelephony->CancelAsync(CTelephony::ENetworkRegistrationStatusChangeCancel);	
       
  1729 		break;
       
  1730 	case CTelephony::ECurrentNetworkInfoChange:
       
  1731 		iTelephony->CancelAsync(CTelephony::ECurrentNetworkInfoChangeCancel);	
       
  1732 		break;
       
  1733 	default:
       
  1734 		break;
       
  1735 		}	
       
  1736 	}
       
  1737 	
       
  1738 CTestCallAndNotify::CTestCallAndNotify()
       
  1739 /** Each test step initialises it's own name
       
  1740 */
       
  1741 {
       
  1742 	// store the name of this test case
       
  1743 	// this is the name that is used by the script file
       
  1744 	SetTestStepName(_L("TestCallAndNotify"));
       
  1745 }
       
  1746 
       
  1747 enum TVerdict CTestCallAndNotify::doTestStepL()
       
  1748 {
       
  1749 	INFO_PRINTF1(_L("CTestCallAndNotify::doTestStepL Start"));
       
  1750 	
       
  1751 	SetTestNumber(15); 
       
  1752 	
       
  1753 	//Notification Test 1: EOwnedCall1CallStatusChange with call closure
       
  1754 	INFO_PRINTF1(_L("Testing EOwnedCall1CallStatusChange notification"));
       
  1755 	CTelephony::TCallStatusV1 calNotifierStatus;
       
  1756 	CTelephony::TCallStatusV1Pckg calNotifierStatusPckg(calNotifierStatus);	
       
  1757 	CTestNotifyCallClosureAct* callStatusChangeAct = CTestNotifyCallClosureAct::NewLC(this, iTelephony, CTelephony::EOwnedCall1StatusChange);
       
  1758 
       
  1759 	CTelephony::TCallStatusV1 calExpNotifierStatus1;
       
  1760 	CTelephony::TCallStatusV1Pckg calExpNotifierStatusPckg1(calExpNotifierStatus1);	
       
  1761 	calExpNotifierStatus1.iStatus = CTelephony::EStatusDisconnecting;
       
  1762 	callStatusChangeAct->iExpNotificationCompleteList.Append(calExpNotifierStatusPckg1);
       
  1763 	
       
  1764 	CTelephony::TCallStatusV1 calExpNotifierStatus2;
       
  1765 	CTelephony::TCallStatusV1Pckg calExpNotifierStatusPckg2(calExpNotifierStatus2);	
       
  1766 	calExpNotifierStatus2.iStatus = CTelephony::EStatusIdle;
       
  1767 	callStatusChangeAct->iExpNotificationCompleteList.Append(calExpNotifierStatusPckg2);	
       
  1768 	
       
  1769 	CTelephony::TCallStatusV1 calExpNotifierStatus3;
       
  1770 	CTelephony::TCallStatusV1Pckg calExpNotifierStatusPckg3(calExpNotifierStatus3);	
       
  1771 	calExpNotifierStatus3.iStatus = CTelephony::EStatusIdle;
       
  1772 	callStatusChangeAct->iExpNotificationCompleteList.Append(calExpNotifierStatusPckg3);	
       
  1773 		
       
  1774 	//make call
       
  1775 	callStatusChangeAct->MakeCallL();
       
  1776 	CActiveScheduler::Start();
       
  1777 	
       
  1778 	callStatusChangeAct->StartNotifier(calNotifierStatusPckg, KErrNone);
       
  1779 	CActiveScheduler::Start();
       
  1780 	CleanupStack::PopAndDestroy(callStatusChangeAct);
       
  1781 	callStatusChangeAct = NULL;
       
  1782 	
       
  1783 	//Notification Test 2: EOwnedCall1RemotePartyInfoChange
       
  1784 	INFO_PRINTF1(_L("Testing EOwnedCall1RemotePartyInfoChange notification"));
       
  1785 	CTelephony::TRemotePartyInfoV1 remNotifierStatus;
       
  1786 	CTelephony::TRemotePartyInfoV1Pckg remNotifierStatusPckg(remNotifierStatus);	
       
  1787 	CTestNotifyCallClosureAct* RemotePartyInfoChangeAct = CTestNotifyCallClosureAct::NewLC(this, iTelephony, CTelephony::EOwnedCall1RemotePartyInfoChange);
       
  1788 
       
  1789 	CTelephony::TRemotePartyInfoV1 remExpNotifierStatus1;
       
  1790 	CTelephony::TRemotePartyInfoV1Pckg remExpNotifierStatusPckg1(remExpNotifierStatus1);	
       
  1791 	remExpNotifierStatus1.iCallingName = _L("call0");
       
  1792 	remExpNotifierStatus1.iDirection = CTelephony::EMobileOriginated;
       
  1793 	remExpNotifierStatus1.iRemoteIdStatus = CTelephony::ERemoteIdentityAvailable;
       
  1794 	remExpNotifierStatus1.iRemoteNumber.iTypeOfNumber = CTelephony::EInternationalNumber;
       
  1795 	remExpNotifierStatus1.iRemoteNumber.iNumberPlan = CTelephony::EIsdnNumberPlan;
       
  1796 	remExpNotifierStatus1.iRemoteNumber.iTelNumber = _L("12345678");
       
  1797 	RemotePartyInfoChangeAct->iExpNotificationCompleteList.Append(remExpNotifierStatusPckg1);
       
  1798 	
       
  1799 	//make call
       
  1800 	RemotePartyInfoChangeAct->MakeCallL();
       
  1801 	CActiveScheduler::Start();	
       
  1802 
       
  1803 	RemotePartyInfoChangeAct->StartNotifier(remNotifierStatusPckg, KErrCancel);
       
  1804 	CActiveScheduler::Start();
       
  1805 	
       
  1806 	CleanupStack::PopAndDestroy(RemotePartyInfoChangeAct);
       
  1807 	RemotePartyInfoChangeAct = NULL;	
       
  1808 	
       
  1809 	//For the next tests we must first set up a call 1 as we want to test call 2 notifiers
       
  1810 	//Set the call parameters for call 1
       
  1811 	CTelephony::TCallParamsV1 callParams1;
       
  1812 	callParams1.iIdRestrict = CTelephony::ESendMyId;
       
  1813 	CTelephony::TCallParamsV1Pckg callParamsPckg1(callParams1);	
       
  1814 	
       
  1815 	TTestCallParams testCallParams1;
       
  1816 	testCallParams1.iLine = CTelephony::EVoiceLine;
       
  1817 	testCallParams1.iCallParamsV1Pckg = &callParamsPckg1;
       
  1818 	testCallParams1.iTelAddress.iTelNumber = _L("1789");
       
  1819 	testCallParams1.iExpStat = KErrNone;
       
  1820 	CTestDialNewCallAct* testDialNewCallAct1 = CTestDialNewCallAct::NewLC(this, iTelephony);
       
  1821 	
       
  1822 	testCallParams1.iCallId = CTelephony::EISVMaxNumOfCalls;
       
  1823 	testDialNewCallAct1->TestDialNewCall(testCallParams1);
       
  1824 	CActiveScheduler::Start();
       
  1825 	
       
  1826 	CTelephony::TCallStatusV1 status;
       
  1827 	CTelephony::TCallStatusV1Pckg statusPckg(status);		
       
  1828 	iTelephony->GetCallStatus(testCallParams1.iCallId,  statusPckg);
       
  1829 	TEST1(status.iStatus == CTelephony::EStatusConnected, ETrue);	
       
  1830 	
       
  1831 	//put first call on hold
       
  1832 	CTestHoldAct* TestHoldAct = CTestHoldAct::NewLC(this, iTelephony);	
       
  1833 	TestHoldAct->TestHold(testCallParams1);
       
  1834 	CActiveScheduler::Start();
       
  1835 	CleanupStack::PopAndDestroy(TestHoldAct);
       
  1836 	CleanupStack::PopAndDestroy(testDialNewCallAct1);
       
  1837 	
       
  1838 	//Notification Test 3: EOwnedCall2CallStatusChange with call closure
       
  1839 	INFO_PRINTF1(_L("Testing EOwnedCall2CallStatusChange notification"));
       
  1840 	callStatusChangeAct = CTestNotifyCallClosureAct::NewLC(this, iTelephony, CTelephony::EOwnedCall2StatusChange);
       
  1841 	
       
  1842 	callStatusChangeAct->iExpNotificationCompleteList.Append(calExpNotifierStatusPckg1);
       
  1843 	callStatusChangeAct->iExpNotificationCompleteList.Append(calExpNotifierStatusPckg2);
       
  1844 	callStatusChangeAct->iExpNotificationCompleteList.Append(calExpNotifierStatusPckg3);
       
  1845 	
       
  1846 	//make 2nd call
       
  1847 	callStatusChangeAct->MakeCallL();
       
  1848 	CActiveScheduler::Start();
       
  1849 	
       
  1850 	callStatusChangeAct->StartNotifier(calNotifierStatusPckg, KErrNone);
       
  1851 	CActiveScheduler::Start();
       
  1852 	CleanupStack::PopAndDestroy(callStatusChangeAct);
       
  1853 	
       
  1854 	//Notification Test 4: EOwnedCall2RemotePartyInfoChange
       
  1855 	INFO_PRINTF1(_L("Testing EOwnedCall2RemotePartyInfoChange notification"));
       
  1856 	RemotePartyInfoChangeAct = CTestNotifyCallClosureAct::NewLC(this, iTelephony, CTelephony::EOwnedCall2RemotePartyInfoChange);
       
  1857 
       
  1858 	RemotePartyInfoChangeAct->iExpNotificationCompleteList.Append(remExpNotifierStatusPckg1);
       
  1859 	
       
  1860 	//make 2nd call
       
  1861 	RemotePartyInfoChangeAct->MakeCallL();
       
  1862 	CActiveScheduler::Start();	
       
  1863 
       
  1864 	RemotePartyInfoChangeAct->StartNotifier(remNotifierStatusPckg, KErrCancel);
       
  1865 	CActiveScheduler::Start();
       
  1866 	
       
  1867 	CleanupStack::PopAndDestroy(RemotePartyInfoChangeAct);
       
  1868 	RemotePartyInfoChangeAct = NULL;
       
  1869 
       
  1870 	return TestStepResult();
       
  1871 }
       
  1872 
       
  1873 
       
  1874 
       
  1875 CTestNotifyCallClosureAct* CTestNotifyCallClosureAct::NewLC(CEtelIsvTestStep* aTestStep, CTelephony* aTelephony, CTelephony::TNotificationEvent aEvent)
       
  1876 //Factory constructor
       
  1877 	{
       
  1878 	CTestNotifyCallClosureAct* obj = new(ELeave) CTestNotifyCallClosureAct(aTestStep, aTelephony, aEvent);
       
  1879 	CleanupStack::PushL(obj);
       
  1880 	obj->ConstructL();
       
  1881 	return obj;
       
  1882 	}
       
  1883 CTestNotifyCallClosureAct::CTestNotifyCallClosureAct(CEtelIsvTestStep* aTestStep, CTelephony* aTelephony, CTelephony::TNotificationEvent aEvent)
       
  1884 	: CEtelIsvActBase(aTestStep, aTelephony)
       
  1885 	, iEvent(aEvent)
       
  1886 	, iCallParamsPckg(iCallParams)
       
  1887 	, iCallsActive(EFalse)
       
  1888 	{  
       
  1889 	}
       
  1890 
       
  1891 void CTestNotifyCallClosureAct::ConstructL()
       
  1892 	{  
       
  1893 	CActiveScheduler::Add(this);
       
  1894 	}
       
  1895 
       
  1896 CTestNotifyCallClosureAct::~CTestNotifyCallClosureAct()
       
  1897 	{ 
       
  1898 	Cancel();	// if any Req outstanding, calls DoCancel() to cleanup
       
  1899 	delete iDialNewCallAct;
       
  1900 	delete iHangupAct;
       
  1901 	iExpNotificationCompleteList.Reset();
       
  1902 	}
       
  1903 
       
  1904 void CTestNotifyCallClosureAct::DoCancel()
       
  1905 	{
       
  1906 	switch(iEvent)
       
  1907 		{
       
  1908 	case CTelephony::EOwnedCall1StatusChange:
       
  1909 		iTelephony->CancelAsync(CTelephony::EOwnedCall1StatusChangeCancel);	
       
  1910 		break;
       
  1911 	case CTelephony::EOwnedCall2StatusChange:
       
  1912 		iTelephony->CancelAsync(CTelephony::EOwnedCall2StatusChangeCancel);	
       
  1913 		break;
       
  1914 	case CTelephony::EOwnedCall1RemotePartyInfoChange:
       
  1915 		iTelephony->CancelAsync(CTelephony::EOwnedCall1RemotePartyInfoChangeCancel);	
       
  1916 		break;
       
  1917 	case CTelephony::EOwnedCall2RemotePartyInfoChange:
       
  1918 		iTelephony->CancelAsync(CTelephony::EOwnedCall2RemotePartyInfoChangeCancel);	
       
  1919 		break;
       
  1920 	default:
       
  1921 		break;
       
  1922 		}	
       
  1923 	}
       
  1924 	
       
  1925 void CTestNotifyCallClosureAct::StartNotifier(TDes8& aNotifierPckg, TRequestStatus aExpStat)
       
  1926 	{
       
  1927 	iNotifierPckg=&aNotifierPckg;
       
  1928 	iExpStat=aExpStat;
       
  1929 	iNumberNotificationsBeforeFinish = iExpNotificationCompleteList.Count();
       
  1930 	SendNotifyRequest();
       
  1931 	InvokeNotifyCondition();
       
  1932 	iNotificationCount = 0;
       
  1933 	}
       
  1934 	
       
  1935 void CTestNotifyCallClosureAct::InvokeNotifyCondition()
       
  1936 	{
       
  1937 	switch(iEvent)
       
  1938 		{
       
  1939 	case CTelephony::EOwnedCall1StatusChange:
       
  1940 	case CTelephony::EOwnedCall1RemotePartyInfoChange:
       
  1941 	case CTelephony::EOwnedCall2StatusChange:
       
  1942 	case CTelephony::EOwnedCall2RemotePartyInfoChange:
       
  1943 		TRAP_IGNORE(HangupCallL());
       
  1944 		break;				
       
  1945 	default:
       
  1946 		break;
       
  1947 		}
       
  1948 	}
       
  1949 	
       
  1950 void CTestNotifyCallClosureAct::SendNotifyRequest()
       
  1951 	{
       
  1952 	iTelephony->NotifyChange(iStatus, iEvent, *iNotifierPckg);
       
  1953 	SetActive();
       
  1954 	}
       
  1955 
       
  1956 void CTestNotifyCallClosureAct::RunL()
       
  1957 	{ 
       
  1958 	// ActiveScheduler will have set status to KRequestComplete, just before
       
  1959 	// calling this RunL().
       
  1960 
       
  1961 	iTestStep->TEST1(iStatus.Int() == KErrNone || iStatus.Int() == KErrCancel 
       
  1962 						|| iStatus.Int() == KErrAccessDenied, ETrue);
       
  1963 	
       
  1964 	if(++iNotificationCount <= iNumberNotificationsBeforeFinish)
       
  1965 		{	//process the notification
       
  1966 		switch(iEvent)
       
  1967 			{
       
  1968 		case CTelephony::EOwnedCall1StatusChange:
       
  1969 		case CTelephony::EOwnedCall2StatusChange:
       
  1970 			if(iStatus.Int() == KErrNone)
       
  1971 				{
       
  1972 				//get expected status for this notification		
       
  1973 				TDes8& expnotifierpckg = iExpNotificationCompleteList[iNotificationCount-1];
       
  1974 				CTelephony::TCallStatusV1Pckg& exppckg = REINTERPRET_CAST(CTelephony::TCallStatusV1Pckg&, expnotifierpckg);
       
  1975 				CTelephony::TCallStatusV1& expparams = (exppckg)();
       
  1976 				//get actual notification status
       
  1977 				CTelephony::TCallStatusV1Pckg& pckg = REINTERPRET_CAST(CTelephony::TCallStatusV1Pckg&, *iNotifierPckg);
       
  1978 				CTelephony::TCallStatusV1& params = (pckg)();
       
  1979 				
       
  1980 				iTestStep->TEST1(expparams.iStatus == params.iStatus, ETrue);
       
  1981 				iTestStep->INFO_PRINTF2(_L("ECallStatusChange Notification ExpStatus: %d"),expparams.iStatus);
       
  1982 				iTestStep->INFO_PRINTF2(_L("ECallStatusChange Notification Status: %d"),params.iStatus);		
       
  1983 				}
       
  1984 			break;
       
  1985 		case CTelephony::EOwnedCall1RemotePartyInfoChange:
       
  1986 		case CTelephony::EOwnedCall2RemotePartyInfoChange:
       
  1987 			if(iStatus.Int() == KErrNone)
       
  1988 				{
       
  1989 			//get expected status for this notification		
       
  1990 			TDes8& expnotifierpckg = iExpNotificationCompleteList[iNotificationCount-1];
       
  1991 			CTelephony::TRemotePartyInfoV1Pckg& exppckg = REINTERPRET_CAST(CTelephony::TRemotePartyInfoV1Pckg&, expnotifierpckg);
       
  1992 			CTelephony::TRemotePartyInfoV1& expparams = (exppckg)();
       
  1993 			//get actual notification status
       
  1994 			CTelephony::TRemotePartyInfoV1Pckg& pckg = REINTERPRET_CAST(CTelephony::TRemotePartyInfoV1Pckg&, *iNotifierPckg);
       
  1995 			CTelephony::TRemotePartyInfoV1& params = (pckg)();		
       
  1996 			
       
  1997 			iTestStep->TEST1(expparams.iRemoteIdStatus == params.iRemoteIdStatus, ETrue);
       
  1998 			iTestStep->TEST1(expparams.iCallingName == params.iCallingName, ETrue);	
       
  1999 			iTestStep->TEST1(expparams.iRemoteNumber.iTypeOfNumber == params.iRemoteNumber.iTypeOfNumber, ETrue);
       
  2000 			iTestStep->TEST1(expparams.iRemoteNumber.iNumberPlan == params.iRemoteNumber.iNumberPlan, ETrue);
       
  2001 			iTestStep->TEST1(expparams.iRemoteNumber.iTelNumber == params.iRemoteNumber.iTelNumber, ETrue);
       
  2002 			iTestStep->TEST1(expparams.iDirection == params.iDirection, ETrue);
       
  2003 			
       
  2004 			iTestStep->INFO_PRINTF2(_L("ERemotePartyInfoChange Notification ExpRemoteIdStatus: %d"),expparams.iRemoteIdStatus);
       
  2005 			iTestStep->INFO_PRINTF2(_L("ERemotePartyInfoChange Notification RemoteIdStatus: %d"),params.iRemoteIdStatus);	
       
  2006 			iTestStep->INFO_PRINTF2(_L("ERemotePartyInfoChange Notification ExpCallingName: %S"),&expparams.iCallingName);
       
  2007 			iTestStep->INFO_PRINTF2(_L("ERemotePartyInfoChange Notification CallingName: %S"),&params.iCallingName);	
       
  2008 			iTestStep->INFO_PRINTF2(_L("ERemotePartyInfoChange Notification ExpRemoteNumber.TON: %d"),expparams.iRemoteNumber.iTypeOfNumber);
       
  2009 			iTestStep->INFO_PRINTF2(_L("ERemotePartyInfoChange Notification RemoteNumber.TON: %d"),params.iRemoteNumber.iTypeOfNumber);
       
  2010 			iTestStep->INFO_PRINTF2(_L("ERemotePartyInfoChange Notification ExpRemoteNumber.NPI: %d"),expparams.iRemoteNumber.iNumberPlan);
       
  2011 			iTestStep->INFO_PRINTF2(_L("ERemotePartyInfoChange Notification RemoteNumber.NPI: %d"),params.iRemoteNumber.iNumberPlan);	
       
  2012 			iTestStep->INFO_PRINTF2(_L("ERemotePartyInfoChange Notification ExpRemoteNumber.Number: %d"),&expparams.iRemoteNumber.iTelNumber);
       
  2013 			iTestStep->INFO_PRINTF2(_L("ERemotePartyInfoChange Notification RemoteNumber.Number: %d"),&params.iRemoteNumber.iTelNumber);
       
  2014 			iTestStep->INFO_PRINTF2(_L("ERemotePartyInfoChange Notification ExpDirection: %d"),expparams.iDirection);
       
  2015 			iTestStep->INFO_PRINTF2(_L("ERemotePartyInfoChange Notification Direction: %d"),params.iDirection);	
       
  2016 				}
       
  2017 			break;
       
  2018 		default:
       
  2019 			break;
       
  2020 			}
       
  2021 		}
       
  2022 	
       
  2023 	if(iStatus.Int() == KErrNone)	//post for further notifications, while cancel not found
       
  2024 		SendNotifyRequest();
       
  2025 	}
       
  2026 	
       
  2027 void CTestNotifyCallClosureAct::MakeCallL()
       
  2028 	{
       
  2029 	_LIT(KGoodNumber,"1789");
       
  2030 	iCallParams.iIdRestrict = CTelephony::ESendMyId;
       
  2031 		
       
  2032 	iTestCallParams.iLine = CTelephony::EVoiceLine;
       
  2033 	iTestCallParams.iCallParamsV1Pckg = &iCallParamsPckg;
       
  2034 	iTestCallParams.iTelAddress.iTelNumber = KGoodNumber;
       
  2035 	iTestCallParams.iExpStat = KErrNone;
       
  2036 	
       
  2037 	iDialNewCallAct = CTestDialNewCallAct::NewL(iTestStep, iTelephony, this);	
       
  2038 	
       
  2039 	// Create a call - should succeed
       
  2040 	iTestCallParams.iCallId = CTelephony::EISVMaxNumOfCalls;
       
  2041 	iDialNewCallAct->TestDialNewCall(iTestCallParams);
       
  2042 	iCallsActive = ETrue;
       
  2043 	}
       
  2044 
       
  2045 void CTestNotifyCallClosureAct::HangupCallL()
       
  2046 	{
       
  2047 	iHangupAct	= CTestHangupAct::NewL(iTestStep, iTelephony, this);
       
  2048 	iHangupAct->TestHangup(iTestCallParams);	
       
  2049 	}
       
  2050 void  CTestNotifyCallClosureAct::ActionParent(const TRequestStatus aCallStatus, const TActionEvent aEvent)
       
  2051 	{
       
  2052 /**
       
  2053 Gets called from a child AO when its RunL has been called.  
       
  2054 */
       
  2055 	//got callback from child AO. Proceed the test.
       
  2056 	if(aCallStatus.Int() == KErrNone)
       
  2057 		{
       
  2058 		if((iEvent == CTelephony::EOwnedCall1StatusChange || iEvent == CTelephony::EOwnedCall2StatusChange) && aEvent == EDialNewCall)
       
  2059 			{
       
  2060 			CActiveScheduler::Stop();
       
  2061 			}
       
  2062 		else if((iEvent == CTelephony::EOwnedCall1RemotePartyInfoChange || iEvent == CTelephony::EOwnedCall2RemotePartyInfoChange) && aEvent == EDialNewCall)
       
  2063 			{
       
  2064 			CActiveScheduler::Stop();			
       
  2065 			}
       
  2066 		else if((iEvent == CTelephony::EOwnedCall1StatusChange || iEvent == CTelephony::EOwnedCall2StatusChange) && aEvent == EHangup)
       
  2067 			{
       
  2068 			iCallsActive = EFalse;	
       
  2069 			CActiveScheduler::Stop();
       
  2070 			}
       
  2071 		else if((iEvent == CTelephony::EOwnedCall1RemotePartyInfoChange || iEvent == CTelephony::EOwnedCall2RemotePartyInfoChange) && aEvent == EHangup)
       
  2072 			{
       
  2073 			iCallsActive = EFalse;	
       
  2074 			CActiveScheduler::Stop();
       
  2075 			}
       
  2076 		}	
       
  2077 	else
       
  2078 		{
       
  2079 		iCallsActive = EFalse;	
       
  2080 		CActiveScheduler::Stop();
       
  2081 		}		
       
  2082 	}