telephonyutils/etel3rdpartyapi/Test/te_etelIsv/TE_EtelIsvSuppServices.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_EtelIsvSuppServices.h"
       
    18 
       
    19  
       
    20 
       
    21 /**
       
    22 @SYMTestCaseID Etel3rdParty 22.1, TestGetSupplementaryServiceStatus
       
    23 @SYMTestCaseDesc Test GetCallForwardingStatus, GetCallBarringStatus and
       
    24 * GetCallWaitingStatus  3rd party APIs
       
    25 @SYMFssID SGL.GT0166.054 v1.3 A2_Telephony_Functional_Specification.doc, REQ 2116.4.11
       
    26 */
       
    27  //
       
    28 // RETRIEVE SUPPLEMENTARY SERVICE INFORMATION //
       
    29 //
       
    30 CTestGetSupplementaryServiceStatus::CTestGetSupplementaryServiceStatus()
       
    31 /** Each test step initialises it's own name
       
    32 */
       
    33 {
       
    34 	// store the name of this test case
       
    35 	// this is the name that is used by the script file
       
    36 	SetTestStepName(_L("TestGetSupplementaryService"));
       
    37 }
       
    38 
       
    39 enum TVerdict CTestGetSupplementaryServiceStatus::doTestStepL()
       
    40 {
       
    41 	INFO_PRINTF1(_L("Test retrieval of supplementary service information"));
       
    42 	 
       
    43 	// Set the config.txt test number mapping
       
    44 	SetTestNumber(13);
       
    45 
       
    46 	// Set the expected request status
       
    47 	TRequestStatus ExpStat=KErrNone;
       
    48 	CTelephony::TCallBarringSupplServicesV1 ExpectedCallBarringStatus; 
       
    49 	CTelephony::TCallForwardingSupplServicesV1 ExpectedCallForwardingStatus;
       
    50 	CTelephony::TCallWaitingSupplServicesV1 ExpectedCallWaitingStatus;  
       
    51 
       
    52 	// Create an active object and push it onto the clean up stack
       
    53 	CTestGetSupplementaryServiceStatusAct* GetSupplementaryServiceStatusAct = CTestGetSupplementaryServiceStatusAct::NewLC(this, iTelephony);
       
    54 	
       
    55 	//
       
    56 	// Test call barring //
       
    57 	//
       
    58 	INFO_PRINTF1(_L("Test retrieval of call barring information"));
       
    59 	
       
    60 	// Set up the expected value to be the same as that provisioned in 
       
    61 	// the SIM TSY config.txt file.
       
    62 	
       
    63 	//go through each condition, status and service group. 
       
    64 	
       
    65 	//Test retrieving condition which is out of range
       
    66 	ExpStat=KErrNotSupported;
       
    67 	ExpectedCallBarringStatus.iCallBarring=CTelephony::EStatusActive;
       
    68 	GetSupplementaryServiceStatusAct->TestGetCBSupplementaryServiceStatus(ExpectedCallBarringStatus,(CTelephony::TCallBarringCondition)7, CTelephony::EVoiceService, ExpStat);
       
    69 	CActiveScheduler::Start();
       
    70 	
       
    71 	//Test OOM
       
    72 	#if defined(_DEBUG)
       
    73 		ExpStat=KErrNoMemory;
       
    74 		__UHEAP_FAILNEXT(1);
       
    75 		ExpectedCallBarringStatus.iCallBarring=CTelephony::EStatusActive;
       
    76 		GetSupplementaryServiceStatusAct->TestGetCBSupplementaryServiceStatus(ExpectedCallBarringStatus,CTelephony::EBarAllIncoming, CTelephony::EVoiceService, ExpStat);
       
    77 		CActiveScheduler::Start();
       
    78 	__UHEAP_RESET;
       
    79 	#endif
       
    80    
       
    81     ExpStat=KErrNone;
       
    82 	ExpectedCallBarringStatus.iCallBarring=CTelephony::EStatusActive;
       
    83 	GetSupplementaryServiceStatusAct->TestGetCBSupplementaryServiceStatus(ExpectedCallBarringStatus,CTelephony::EBarAllIncoming, CTelephony::EVoiceService, ExpStat, ETrue);
       
    84 	CActiveScheduler::Start();
       
    85 	
       
    86 	// INC085718: SimTSY is configured to have EBarIncomingRoaming for EVoiceService. A query of the status for an other service must return ENotActive
       
    87 	ExpectedCallBarringStatus.iCallBarring=CTelephony::ENotActive;
       
    88 	GetSupplementaryServiceStatusAct->TestGetCBSupplementaryServiceStatus(ExpectedCallBarringStatus,CTelephony::EBarIncomingRoaming, CTelephony::EDataService, ExpStat);
       
    89 	CActiveScheduler::Start();
       
    90 	
       
    91 	ExpectedCallBarringStatus.iCallBarring=CTelephony::ENotProvisioned;
       
    92 	GetSupplementaryServiceStatusAct->TestGetCBSupplementaryServiceStatus(ExpectedCallBarringStatus,CTelephony::EBarAllOutgoing, CTelephony::EFaxService, ExpStat);
       
    93 	CActiveScheduler::Start();
       
    94 	
       
    95 	ExpectedCallBarringStatus.iCallBarring=CTelephony::ENotAvailable;
       
    96 	GetSupplementaryServiceStatusAct->TestGetCBSupplementaryServiceStatus(ExpectedCallBarringStatus,CTelephony::EBarOutgoingInternational, CTelephony::EVoiceService, ExpStat);
       
    97 	CActiveScheduler::Start();
       
    98 	
       
    99 	ExpectedCallBarringStatus.iCallBarring=CTelephony::EUnknown;
       
   100 	GetSupplementaryServiceStatusAct->TestGetCBSupplementaryServiceStatus(ExpectedCallBarringStatus,CTelephony::EBarOutgoingInternationalExHC, CTelephony::EDataService, ExpStat);
       
   101 	CActiveScheduler::Start();
       
   102 	
       
   103 	//Test cancel
       
   104 	INFO_PRINTF1(_L("Test cancel of call barring information"));
       
   105 	TInt cancelerr = iTelephony->CancelAsync(CTelephony::EGetCallBarringStatusCancel);
       
   106 	TEST1(cancelerr == KErrNotFound, ETrue);
       
   107 	GetSupplementaryServiceStatusAct->TestGetCBSupplementaryServiceStatus(ExpectedCallBarringStatus,CTelephony::EBarAllIncoming, CTelephony::EDataService, ExpStat);
       
   108 	CTestCanceller* canceller = GetSupplementaryServiceStatusAct->RetrieveCanceller();
       
   109 	canceller->Call();
       
   110 	CActiveScheduler::Start();	
       
   111 	TEST1(GetSupplementaryServiceStatusAct->iStatus.Int() == KErrCancel, ETrue);
       
   112 	
       
   113 	//
       
   114 	// Test call forwarding //
       
   115 	//
       
   116 	INFO_PRINTF1(_L("Test retrieval of call forwarding information"));
       
   117 	
       
   118 	// Set up the expected value to be the same as that provisioned in 
       
   119 	// the SIM TSY config.txt file.
       
   120 	 
       
   121 	//Test retrieving condition which is out of range
       
   122 	ExpStat=KErrNotSupported;
       
   123 	ExpectedCallForwardingStatus.iCallForwarding=CTelephony::EStatusActive;
       
   124 	GetSupplementaryServiceStatusAct->TestGetCFSupplementaryServiceStatus(ExpectedCallForwardingStatus, (CTelephony::TCallForwardingCondition)7, CTelephony::EVoiceService, ExpStat);
       
   125 	CActiveScheduler::Start();
       
   126 	
       
   127 	ExpStat=KErrNone;
       
   128 	ExpectedCallForwardingStatus.iCallForwarding=CTelephony::EStatusActive;
       
   129 	GetSupplementaryServiceStatusAct->TestGetCFSupplementaryServiceStatus(ExpectedCallForwardingStatus, CTelephony::ECallForwardingUnconditional, CTelephony::EVoiceService, ExpStat, ETrue);
       
   130 	CActiveScheduler::Start();
       
   131 	
       
   132 	ExpectedCallForwardingStatus.iCallForwarding=CTelephony::ENotActive;
       
   133 	GetSupplementaryServiceStatusAct->TestGetCFSupplementaryServiceStatus(ExpectedCallForwardingStatus, CTelephony::ECallForwardingBusy, CTelephony::EDataService, ExpStat);
       
   134 	CActiveScheduler::Start();
       
   135 	
       
   136 	ExpectedCallForwardingStatus.iCallForwarding=CTelephony::EUnknown;
       
   137 	GetSupplementaryServiceStatusAct->TestGetCFSupplementaryServiceStatus(ExpectedCallForwardingStatus, CTelephony::ECallForwardingNoReply, CTelephony::EDataService, ExpStat);
       
   138 	CActiveScheduler::Start();
       
   139 	
       
   140 	ExpectedCallForwardingStatus.iCallForwarding=CTelephony::ENotProvisioned;
       
   141 	GetSupplementaryServiceStatusAct->TestGetCFSupplementaryServiceStatus(ExpectedCallForwardingStatus, CTelephony::ECallForwardingNotReachable, CTelephony::EDataService, ExpStat);
       
   142 	CActiveScheduler::Start();
       
   143 	
       
   144 	ExpectedCallForwardingStatus.iCallForwarding=CTelephony::ENotAvailable;
       
   145 	GetSupplementaryServiceStatusAct->TestGetCFSupplementaryServiceStatus(ExpectedCallForwardingStatus, CTelephony::ECallForwardingBusy, CTelephony::EFaxService, ExpStat);
       
   146 	CActiveScheduler::Start();
       
   147 	
       
   148 	ExpectedCallForwardingStatus.iCallForwarding=CTelephony::EUnknown;
       
   149 	GetSupplementaryServiceStatusAct->TestGetCFSupplementaryServiceStatus(ExpectedCallForwardingStatus, CTelephony::ECallForwardingNoReply, CTelephony::EFaxService, ExpStat);
       
   150 	CActiveScheduler::Start();
       
   151 	
       
   152 	ExpectedCallForwardingStatus.iCallForwarding=CTelephony::EUnknown;
       
   153 	GetSupplementaryServiceStatusAct->TestGetCFSupplementaryServiceStatus(ExpectedCallForwardingStatus, CTelephony::ECallForwardingNotReachable, CTelephony::EFaxService, ExpStat);
       
   154 	CActiveScheduler::Start();
       
   155 	
       
   156 	//Test cancel
       
   157 	INFO_PRINTF1(_L("Test cancel of call forwarding information"));
       
   158 	cancelerr = iTelephony->CancelAsync(CTelephony::EGetCallForwardingStatusCancel);
       
   159 	TEST1(cancelerr == KErrNotFound, ETrue);
       
   160 	GetSupplementaryServiceStatusAct->TestGetCFSupplementaryServiceStatus(ExpectedCallForwardingStatus, CTelephony::ECallForwardingNoReply, CTelephony::EVoiceService, ExpStat);
       
   161 	canceller = GetSupplementaryServiceStatusAct->RetrieveCanceller();
       
   162 	canceller->Call();
       
   163 	CActiveScheduler::Start();	
       
   164 	TEST1(GetSupplementaryServiceStatusAct->iStatus.Int() == KErrCancel, ETrue);
       
   165 	
       
   166 	//
       
   167 	// Test call waiting //
       
   168 	//
       
   169 	INFO_PRINTF1(_L("Test retrieval of call waiting information"));
       
   170 	
       
   171 	// Set up the expected value to be the same as that provisioned in 
       
   172 	// the SIM TSY config.txt file.
       
   173 	 	
       
   174 	ExpStat=KErrNone;
       
   175 	ExpectedCallWaitingStatus.iCallWaiting=CTelephony::EStatusActive;
       
   176 	GetSupplementaryServiceStatusAct->TestGetCWSupplementaryServiceStatus(ExpectedCallWaitingStatus, CTelephony::EVoiceService, ExpStat, ETrue);
       
   177 	CActiveScheduler::Start();
       
   178 	
       
   179 	ExpectedCallWaitingStatus.iCallWaiting=CTelephony::ENotActive;
       
   180 	GetSupplementaryServiceStatusAct->TestGetCWSupplementaryServiceStatus(ExpectedCallWaitingStatus, CTelephony::EDataService, ExpStat);
       
   181 	CActiveScheduler::Start();
       
   182 	
       
   183 	ExpectedCallWaitingStatus.iCallWaiting=CTelephony::ENotProvisioned;
       
   184 	GetSupplementaryServiceStatusAct->TestGetCWSupplementaryServiceStatus(ExpectedCallWaitingStatus, CTelephony::EFaxService, ExpStat);
       
   185 	CActiveScheduler::Start();
       
   186 	
       
   187 	//Test cancel
       
   188 	INFO_PRINTF1(_L("Test cancel of call waiting information"));
       
   189 	cancelerr = iTelephony->CancelAsync(CTelephony::EGetCallWaitingStatusCancel);
       
   190 	TEST1(cancelerr == KErrNotFound, ETrue);
       
   191 	GetSupplementaryServiceStatusAct->TestGetCWSupplementaryServiceStatus(ExpectedCallWaitingStatus,CTelephony::EVoiceService, ExpStat);
       
   192 	canceller = GetSupplementaryServiceStatusAct->RetrieveCanceller();
       
   193 	canceller->Call();
       
   194 	CActiveScheduler::Start();	
       
   195 	TEST1(GetSupplementaryServiceStatusAct->iStatus.Int() == KErrCancel, ETrue);
       
   196     // Clean up
       
   197 	CleanupStack::PopAndDestroy(); //GetSupplementaryServiceStatusAct
       
   198 	
       
   199 	//Part 2 - Open a new test which tests EAllServices responses 
       
   200 	
       
   201 	// Set the config.txt test number mapping
       
   202 	SetTestNumber(33);	
       
   203 	
       
   204 	GetSupplementaryServiceStatusAct = CTestGetSupplementaryServiceStatusAct::NewLC(this, iTelephony);
       
   205 	
       
   206 	//Call barring
       
   207 	ExpStat=KErrNone;
       
   208 	ExpectedCallBarringStatus.iCallBarring=CTelephony::EStatusActive;
       
   209 	GetSupplementaryServiceStatusAct->TestGetCBSupplementaryServiceStatus(ExpectedCallBarringStatus,CTelephony::EBarAllIncoming, CTelephony::EVoiceService, ExpStat);
       
   210 	CActiveScheduler::Start();
       
   211 	
       
   212 	//Call forwarding
       
   213 	ExpStat=KErrNone;
       
   214 	ExpectedCallForwardingStatus.iCallForwarding=CTelephony::EUnknown;
       
   215 	GetSupplementaryServiceStatusAct->TestGetCFSupplementaryServiceStatus(ExpectedCallForwardingStatus, CTelephony::ECallForwardingUnconditional, CTelephony::EVoiceService, ExpStat);
       
   216 	CActiveScheduler::Start();
       
   217 	
       
   218 	ExpectedCallWaitingStatus.iCallWaiting=CTelephony::EStatusActive;
       
   219 	GetSupplementaryServiceStatusAct->TestGetCWSupplementaryServiceStatus(ExpectedCallWaitingStatus, CTelephony::EVoiceService, ExpStat);
       
   220 	CActiveScheduler::Start();
       
   221 	
       
   222 	// Clean up
       
   223 	CleanupStack::PopAndDestroy(); //GetSupplementaryServiceStatusAct
       
   224 	return TestStepResult();
       
   225 }
       
   226 
       
   227 CTestGetSupplementaryServiceStatusAct* CTestGetSupplementaryServiceStatusAct::NewLC(CEtelIsvTestStep* aTestStep, CTelephony* aTelephony)
       
   228 //Factory constructor
       
   229 	{
       
   230 	CTestGetSupplementaryServiceStatusAct* obj = new(ELeave) CTestGetSupplementaryServiceStatusAct(aTestStep, aTelephony);
       
   231 	CleanupStack::PushL(obj);
       
   232 	obj->ConstructL();
       
   233 	return obj;
       
   234 	}
       
   235 
       
   236 CTestGetSupplementaryServiceStatusAct::CTestGetSupplementaryServiceStatusAct(CEtelIsvTestStep* aTestStep, CTelephony* aTelephony)
       
   237 	: CEtelIsvActBase(aTestStep, aTelephony),
       
   238 	  iCallBarringStatusPckg(iCallBarringStatus),
       
   239 	  iCallBarringStatusBuff(iCallBarringStatus),
       
   240 	  iCallWaitingStatusPckg(iCallWaitingStatus),
       
   241 	  iCallWaitingStatusBuff(iCallWaitingStatus),
       
   242 	  iCallForwardingStatusPckg(iCallForwardingStatus),
       
   243 	  iCallForwardingStatusBuff(iCallForwardingStatus)
       
   244 	{  
       
   245 	}
       
   246 
       
   247 void CTestGetSupplementaryServiceStatusAct::ConstructL()
       
   248 	{  
       
   249 	iCanceller = new(ELeave) CTestCanceller(this);
       
   250 	CActiveScheduler::Add(this);
       
   251 	}
       
   252 
       
   253 CTestGetSupplementaryServiceStatusAct::~CTestGetSupplementaryServiceStatusAct()
       
   254 	{  
       
   255 	Cancel();	// if any Req outstanding, calls DoCancel() to cleanup.
       
   256 	delete iCanceller;
       
   257 	}
       
   258 
       
   259 void CTestGetSupplementaryServiceStatusAct::DoCancel()
       
   260 	{
       
   261 	if(iSupplServiceType == ETestSupplServiceCB)
       
   262 		{
       
   263 		iTelephony->CancelAsync(CTelephony::EGetCallBarringStatusCancel);
       
   264 		}
       
   265 	else if(iSupplServiceType == ETestSupplServiceCF)
       
   266 		{
       
   267 		iTelephony->CancelAsync(CTelephony::EGetCallForwardingStatusCancel);
       
   268 		}
       
   269 	else if(iSupplServiceType == ETestSupplServiceCW)
       
   270 		{
       
   271 		iTelephony->CancelAsync(CTelephony::EGetCallWaitingStatusCancel);
       
   272 		}
       
   273 	}
       
   274 
       
   275 void CTestGetSupplementaryServiceStatusAct::TestGetCFSupplementaryServiceStatus(CTelephony::TCallForwardingSupplServicesV1& aExpSupplementaryServiceStatus, CTelephony::TCallForwardingCondition aSSCondition, CTelephony::TServiceGroup aServiceGroup, TRequestStatus aExpStat, TBool aCheckConcurrency)
       
   276 	{	
       
   277 	// Set the service type requested
       
   278 	iSupplServiceType=ETestSupplServiceCF;	
       
   279 	// Set the expected return value
       
   280 	iExpStat=aExpStat;	
       
   281 	iExpectedCallForwardingStatus.iCallForwardingCondition = aSSCondition;
       
   282 	iServiceGroup = aServiceGroup;
       
   283  	// Set the expected return values for call forwarding
       
   284 	iExpectedCallForwardingStatus.iCallForwarding= aExpSupplementaryServiceStatus.iCallForwarding;		
       
   285 	// Make a call to the 3rd party API
       
   286 	
       
   287 	TDes8* data;
       
   288 	if (iTestStep->iBufferMode)
       
   289 		{
       
   290 		data = &iCallForwardingStatusBuff;
       
   291 		}
       
   292 	else
       
   293 		{
       
   294 		data = &iCallForwardingStatusPckg;
       
   295 		}
       
   296 	    
       
   297 	iTelephony->GetCallForwardingStatus(iStatus, aSSCondition, *data, aServiceGroup );
       
   298 	if(aCheckConcurrency)
       
   299 		{
       
   300 		TRequestStatus tmpStatus;
       
   301 		iTelephony->GetCallForwardingStatus(tmpStatus, aSSCondition, *data, aServiceGroup );
       
   302 		User::WaitForRequest(tmpStatus);
       
   303 		iTestStep->TEST1(tmpStatus.Int() == KErrInUse, ETrue);
       
   304 		}
       
   305 	SetActive();			
       
   306 	}
       
   307 	
       
   308 void CTestGetSupplementaryServiceStatusAct::TestGetCBSupplementaryServiceStatus(CTelephony::TCallBarringSupplServicesV1& aExpSupplementaryServiceStatus, CTelephony::TCallBarringCondition aSSCondition, CTelephony::TServiceGroup aServiceGroup, TRequestStatus aExpStat, TBool aCheckConcurrency)
       
   309 	{	
       
   310 	// Set the service type requested
       
   311 	iSupplServiceType=ETestSupplServiceCB;	
       
   312 	// Set the expected return value
       
   313 	iExpStat=aExpStat;	
       
   314 	iExpectedCallBarringStatus.iCallBarringCondition = aSSCondition;
       
   315 	iServiceGroup = aServiceGroup;
       
   316  	// Set the expected return values for call forwarding
       
   317 	iExpectedCallBarringStatus.iCallBarring= aExpSupplementaryServiceStatus.iCallBarring;		
       
   318 	// Make a call to the 3rd party API
       
   319 	TDes8* data;
       
   320 	if (iTestStep->iBufferMode)
       
   321 		{
       
   322 		data = &iCallBarringStatusBuff;
       
   323 		}
       
   324 	else
       
   325 		{
       
   326 		data = &iCallBarringStatusPckg;
       
   327 		}
       
   328 	    
       
   329 	iTelephony->GetCallBarringStatus(iStatus, aSSCondition, *data, aServiceGroup );
       
   330 	if(aCheckConcurrency)
       
   331 		{
       
   332 		TRequestStatus tmpStatus;
       
   333 		iTelephony->GetCallBarringStatus(tmpStatus, aSSCondition, *data, aServiceGroup );
       
   334 		User::WaitForRequest(tmpStatus);
       
   335 		iTestStep->TEST1(tmpStatus.Int() == KErrInUse, ETrue);
       
   336 		}
       
   337 	SetActive();			
       
   338 	}
       
   339 	
       
   340 void CTestGetSupplementaryServiceStatusAct::TestGetCWSupplementaryServiceStatus(CTelephony::TCallWaitingSupplServicesV1& aExpSupplementaryServiceStatus, CTelephony::TServiceGroup aServiceGroup, TRequestStatus aExpStat, TBool aCheckConcurrency)
       
   341 	{	
       
   342 	// Set the service type requested
       
   343 	iSupplServiceType=ETestSupplServiceCW;	
       
   344 	// Set the expected return value
       
   345 	iExpStat=aExpStat;	
       
   346 	iServiceGroup = aServiceGroup;
       
   347  	// Set the expected return values for call forwarding
       
   348 	iExpectedCallWaitingStatus.iCallWaiting= aExpSupplementaryServiceStatus.iCallWaiting;		
       
   349 	// Make a call to the 3rd party API
       
   350 	TDes8* data;
       
   351 	if (iTestStep->iBufferMode)
       
   352 		{
       
   353 		data = &iCallWaitingStatusBuff;
       
   354 		}
       
   355 	else
       
   356 		{
       
   357 		data = &iCallWaitingStatusPckg;
       
   358 		}
       
   359 	    
       
   360 	iTelephony->GetCallWaitingStatus(iStatus, *data, aServiceGroup );
       
   361 	if(aCheckConcurrency)
       
   362 		{
       
   363 		TRequestStatus tmpStatus;
       
   364 		iTelephony->GetCallWaitingStatus(tmpStatus, *data, aServiceGroup );
       
   365 		User::WaitForRequest(tmpStatus);
       
   366 		iTestStep->TEST1(tmpStatus.Int() == KErrInUse, ETrue);
       
   367 		}
       
   368 	SetActive();			
       
   369 	}
       
   370 
       
   371 void CTestGetSupplementaryServiceStatusAct::RunL()
       
   372 	{ 
       
   373 	iTestStep->INFO_PRINTF2(_L("Request status set =  %d"), iStatus.Int() ); 
       
   374 	iTestStep->TEST1(iStatus.Int() == iExpStat.Int(), ETrue);
       
   375 	
       
   376 	if(iStatus.Int() == KErrNone)
       
   377 	{
       
   378 		iTestStep->INFO_PRINTF2(_L("Service Group = : %d"),iServiceGroup );		
       
   379 		if (iSupplServiceType == ETestSupplServiceCB)
       
   380 		{		
       
   381 			CTelephony::TCallBarringSupplServicesV1* cbData;
       
   382 			if (iTestStep->iBufferMode)
       
   383 				{
       
   384 				cbData = reinterpret_cast<CTelephony::TCallBarringSupplServicesV1*> ( &iCallBarringStatusBuff() );
       
   385 				}
       
   386 			else
       
   387 				{
       
   388 				cbData = reinterpret_cast<CTelephony::TCallBarringSupplServicesV1*> ( &iCallBarringStatusPckg() );
       
   389 				}
       
   390 		        
       
   391 			// Print off the call barring values retrieved and those expected
       
   392 			iTestStep->INFO_PRINTF2(_L("Call barring condition expected: %d"),iExpectedCallBarringStatus.iCallBarringCondition );
       
   393 			iTestStep->INFO_PRINTF2(_L("Call barring condition: %d"),cbData->iCallBarringCondition );
       
   394 			iTestStep->INFO_PRINTF2(_L("Call Barring status  expected: %d"), iExpectedCallBarringStatus.iCallBarring );
       
   395 			iTestStep->INFO_PRINTF2(_L("Call barring status retrieved: %d"), cbData->iCallBarring );
       
   396 				
       
   397 			// Check that the retrieved values match those expected.
       
   398 			iTestStep->TEST1( cbData->iCallBarringCondition ==  iExpectedCallBarringStatus.iCallBarringCondition, ETrue );
       
   399 			iTestStep->TEST1( cbData->iCallBarring ==  iExpectedCallBarringStatus.iCallBarring, ETrue );
       
   400 	 	}
       
   401 	 	else 
       
   402 	 	if (iSupplServiceType == ETestSupplServiceCF)
       
   403 		{
       
   404 			CTelephony::TCallForwardingSupplServicesV1* cfData;
       
   405 			if (iTestStep->iBufferMode)
       
   406 				{
       
   407 				cfData = reinterpret_cast<CTelephony::TCallForwardingSupplServicesV1*> ( &iCallForwardingStatusBuff() );
       
   408 				}
       
   409 			else
       
   410 				{
       
   411 				cfData = reinterpret_cast<CTelephony::TCallForwardingSupplServicesV1*> ( &iCallForwardingStatusPckg() );
       
   412 				}
       
   413 		        
       
   414 			// Print off the call forwarding values retrieved and those expected
       
   415 			iTestStep->INFO_PRINTF2(_L("Call forwarding expected condition: %d"), iExpectedCallForwardingStatus.iCallForwardingCondition );
       
   416 			iTestStep->INFO_PRINTF2(_L("Call forwarding condition: %d"), cfData->iCallForwardingCondition );
       
   417 			iTestStep->INFO_PRINTF2(_L("Call Forwarding status  expected: %d"), iExpectedCallForwardingStatus.iCallForwarding );
       
   418 			iTestStep->INFO_PRINTF2(_L("Call forwarding status retrieved: %d"), cfData->iCallForwarding );
       
   419 					
       
   420 			// Check that the retrieved values match those expected.
       
   421 			iTestStep->TEST1( cfData->iCallForwardingCondition ==  iExpectedCallForwardingStatus.iCallForwardingCondition, ETrue );
       
   422 			iTestStep->TEST1( cfData->iCallForwarding ==  iExpectedCallForwardingStatus.iCallForwarding, ETrue );
       
   423 		}
       
   424 		else 
       
   425 	 	if (iSupplServiceType == ETestSupplServiceCW)
       
   426 		{
       
   427 			CTelephony::TCallWaitingSupplServicesV1* cwData;
       
   428 			if (iTestStep->iBufferMode)
       
   429 				{
       
   430 				cwData = reinterpret_cast<CTelephony::TCallWaitingSupplServicesV1*> ( &iCallWaitingStatusBuff() );
       
   431 				}
       
   432 			else
       
   433 				{
       
   434 				cwData = reinterpret_cast<CTelephony::TCallWaitingSupplServicesV1*> ( &iCallWaitingStatusPckg() );
       
   435 				}
       
   436 			// Print off the call waiting values retrieved and those expected
       
   437 			iTestStep->INFO_PRINTF2(_L("Call Waiting status  expected: %d"), iExpectedCallWaitingStatus.iCallWaiting );
       
   438 			iTestStep->INFO_PRINTF2(_L("Call Waiting status retrieved: %d"), cwData->iCallWaiting );
       
   439 			 
       
   440 			// Check that the retrieved values match those expected.
       
   441 			iTestStep->TEST1( cwData->iCallWaiting ==  iExpectedCallWaitingStatus.iCallWaiting , ETrue);
       
   442 		}
       
   443 	}
       
   444 	else
       
   445 		{
       
   446 		iTestStep->INFO_PRINTF2(_L("Unexpected request status received:: %d"), iStatus.Int() );
       
   447 		}
       
   448 
       
   449 	CActiveScheduler::Stop();
       
   450 	}
       
   451 
       
   452 /**
       
   453 @SYMTestCaseID Etel3rdParty 23.1, TestGetIdentityServiceStatus
       
   454 @SYMTestCaseDesc Test GetIdentityServiceStatus  3rd party API
       
   455 @SYMFssID SGL.GT0166.054 v1.3 A2_Telephony_Functional_Specification.doc, REQ 2116.4.12
       
   456 */
       
   457 //
       
   458 // RETRIEVE IDENTITY SERVICE INFORMATION //
       
   459 //
       
   460 CTestGetIdentityServiceStatus::CTestGetIdentityServiceStatus()
       
   461 /** Each test step initialises it's own name
       
   462 */
       
   463 {
       
   464 	// store the name of this test case
       
   465 	// this is the name that is used by the script file
       
   466 	SetTestStepName(_L("TestGetIdentityService"));
       
   467 }
       
   468 
       
   469 enum TVerdict CTestGetIdentityServiceStatus::doTestStepL()
       
   470 {
       
   471 	INFO_PRINTF1(_L("Test retrieval of identity service information"));
       
   472 
       
   473 	 
       
   474 	// Set the config.txt test number mapping
       
   475 	SetTestNumber(14);
       
   476 	
       
   477 	// Set the expected request status
       
   478 	TRequestStatus ExpStat=KErrNone;
       
   479 
       
   480 	// Create an active object and push it onto the clean up stack
       
   481 	CTestGetIdentityServiceStatusAct* GetIdentityServiceStatusAct = CTestGetIdentityServiceStatusAct::NewLC(this, iTelephony);
       
   482 
       
   483 	CTelephony::TIdentityServiceV1 ExpectedIdentityStatus;
       
   484 	CTelephony::TIdentityService IdentityServiceTypeRequired; 
       
   485 	
       
   486 	//Test OOM
       
   487 	#if defined(_DEBUG)
       
   488 		INFO_PRINTF1(_L("Test GetIdentityServiceStatus OOM"));
       
   489 		ExpStat=KErrNoMemory;
       
   490 		IdentityServiceTypeRequired=CTelephony::EIdServiceCallerPresentation;
       
   491 		ExpectedIdentityStatus.iIdentityStatus=CTelephony::EIdServiceActiveDefaultRestricted;
       
   492 		__UHEAP_FAILNEXT(1);
       
   493 		GetIdentityServiceStatusAct->TestGetIdentityServiceStatus(ExpectedIdentityStatus,IdentityServiceTypeRequired, ExpStat);
       
   494 		CActiveScheduler::Start();
       
   495 		__UHEAP_RESET;
       
   496 	#endif
       
   497 	
       
   498 	ExpStat=KErrNone;
       
   499 	// Test EIdServiceCallerPresentation
       
   500 	INFO_PRINTF1(_L("Test retrieval of EIdServiceCallerPresentation status"));
       
   501 	// Set the type of supplementary service info required
       
   502 	IdentityServiceTypeRequired=CTelephony::EIdServiceCallerPresentation;
       
   503 	// Set up the expected value to be the same as that provisioned in 
       
   504 	// the SIM TSY config.txt file.	
       
   505 	ExpectedIdentityStatus.iIdentityStatus=CTelephony::EIdServiceActiveDefaultRestricted;
       
   506 	// Attempt to retrieve the service information. Pass the expected values. 
       
   507 	GetIdentityServiceStatusAct->TestGetIdentityServiceStatus(ExpectedIdentityStatus,IdentityServiceTypeRequired, ExpStat, ETrue);
       
   508 	// Start the active scheduler
       
   509 	CActiveScheduler::Start();
       
   510 	
       
   511 	// Test EIdServiceCallerRestriction
       
   512 	INFO_PRINTF1(_L("Test retrieval of EIdServiceCallerRestriction status"));
       
   513 	// Set the type of supplementary service info required
       
   514 	IdentityServiceTypeRequired=CTelephony::EIdServiceCallerRestriction;
       
   515 	// Set up the expected value to be the same as that provisioned in 
       
   516 	// the SIM TSY config.txt file.	
       
   517 	ExpectedIdentityStatus.iIdentityStatus=CTelephony::EIdServiceNotProvisioned;
       
   518 	// Attempt to retrieve the service information. Pass the expected values. 
       
   519 	GetIdentityServiceStatusAct->TestGetIdentityServiceStatus(ExpectedIdentityStatus,IdentityServiceTypeRequired, ExpStat);
       
   520 	// Start the active scheduler
       
   521 	CActiveScheduler::Start();
       
   522 	
       
   523 	//Test cancel
       
   524 	TInt cancelerr = iTelephony->CancelAsync(CTelephony::EGetIdentityServiceStatusCancel);
       
   525 	TEST1(cancelerr == KErrNotFound, ETrue);
       
   526 	GetIdentityServiceStatusAct->TestGetIdentityServiceStatus(ExpectedIdentityStatus,IdentityServiceTypeRequired, ExpStat);
       
   527 	CTestCanceller* canceller = GetIdentityServiceStatusAct->RetrieveCanceller();
       
   528 	canceller->Call();
       
   529 	CActiveScheduler::Start();	
       
   530 	TEST1(GetIdentityServiceStatusAct->iStatus.Int() == KErrCancel || GetIdentityServiceStatusAct->iStatus.Int() == KErrNone, ETrue);	 
       
   531 	
       
   532     // Clean up
       
   533 	CleanupStack::PopAndDestroy(); //GetIdentityServiceStatusAct
       
   534 	return TestStepResult();
       
   535 }
       
   536 
       
   537 CTestGetIdentityServiceStatusAct* CTestGetIdentityServiceStatusAct::NewLC(CEtelIsvTestStep* aTestStep, CTelephony* aTelephony)
       
   538 //Factory constructor
       
   539 	{
       
   540 	CTestGetIdentityServiceStatusAct* obj = new(ELeave) CTestGetIdentityServiceStatusAct(aTestStep, aTelephony);
       
   541 	CleanupStack::PushL(obj);
       
   542 	obj->ConstructL();
       
   543 	return obj;
       
   544 	}
       
   545 
       
   546 CTestGetIdentityServiceStatusAct::CTestGetIdentityServiceStatusAct(CEtelIsvTestStep* aTestStep, CTelephony* aTelephony)
       
   547 	: CEtelIsvActBase(aTestStep, aTelephony),
       
   548 	iIdentityServiceStatusPckg(iIdentityServiceStatus),
       
   549 	iIdentityServiceStatusBuff(iIdentityServiceStatus)
       
   550 	{  
       
   551 	}
       
   552 
       
   553 void CTestGetIdentityServiceStatusAct::ConstructL()
       
   554 	{  
       
   555 	iCanceller = new(ELeave) CTestCanceller(this);
       
   556 	CActiveScheduler::Add(this);
       
   557 	}
       
   558 
       
   559 CTestGetIdentityServiceStatusAct::~CTestGetIdentityServiceStatusAct()
       
   560 	{  
       
   561 	Cancel();	// if any Req outstanding, calls DoCancel() to cleanup.
       
   562 	delete iCanceller;
       
   563 	}
       
   564 
       
   565 void CTestGetIdentityServiceStatusAct::DoCancel()
       
   566 	{
       
   567 	iTelephony->CancelAsync(CTelephony::EGetIdentityServiceStatusCancel);
       
   568 	}
       
   569 
       
   570 void CTestGetIdentityServiceStatusAct::TestGetIdentityServiceStatus(CTelephony::TIdentityServiceV1& aIdentityServiceStatus, CTelephony::TIdentityService aIdentityServiceType, TRequestStatus aExpStat, TBool aCheckConcurrency)
       
   571 	{
       
   572 	
       
   573 	// Set the service type requested
       
   574 	iIdentityServiceType=aIdentityServiceType;
       
   575 	
       
   576 	// Set the expected return value
       
   577 	iExpStat=aExpStat; 
       
   578 	CTelephony::TIdentityServiceV1* IdentityServiceStatus = &aIdentityServiceStatus;
       
   579 	iExpectedIdentityServiceStatus.iIdentityStatus= IdentityServiceStatus->iIdentityStatus;
       
   580 
       
   581 	TDes8* data;
       
   582 	if (iTestStep->iBufferMode)
       
   583 		{
       
   584 		data = &iIdentityServiceStatusBuff;
       
   585 		}
       
   586 	else
       
   587 		{
       
   588 		data = &iIdentityServiceStatusPckg;
       
   589 		}
       
   590 		
       
   591 	// Make a call to the 3rd party API
       
   592 	iTelephony->GetIdentityServiceStatus(iStatus, aIdentityServiceType, *data);
       
   593 	if(aCheckConcurrency)
       
   594 		{
       
   595 		TRequestStatus tmpStatus;
       
   596 		iTelephony->GetIdentityServiceStatus(tmpStatus, aIdentityServiceType, *data);
       
   597 		User::WaitForRequest(tmpStatus);
       
   598 		iTestStep->TEST1(tmpStatus.Int() == KErrInUse, ETrue);
       
   599 		}
       
   600 	SetActive();
       
   601 	}
       
   602 
       
   603 void CTestGetIdentityServiceStatusAct::RunL()
       
   604 	{ 
       
   605 	iTestStep->INFO_PRINTF2(_L("Request status set =  %d"), iStatus.Int() ); 
       
   606 	
       
   607 	if(iStatus.Int() == KErrNone)
       
   608 	{
       
   609 		CTelephony::TIdentityServiceV1* data;
       
   610 		if (iTestStep->iBufferMode)	
       
   611 			{
       
   612 			data = reinterpret_cast<CTelephony::TIdentityServiceV1*> ( const_cast<TUint8*> (iIdentityServiceStatusBuff.Ptr()) );
       
   613 			}
       
   614 		else	
       
   615 			{
       
   616 			data = reinterpret_cast<CTelephony::TIdentityServiceV1*> ( const_cast<TUint8*> (iIdentityServiceStatusPckg.Ptr()) );
       
   617 			}
       
   618 				
       
   619 		// Print of the service type requested
       
   620 		iTestStep->INFO_PRINTF2(_L("Service type requested was: %d"), iIdentityServiceType );
       
   621 		 
       
   622 		// Print off the service values retrieved and those expected
       
   623 		iTestStep->INFO_PRINTF2(_L("Status  expected: %d"), iExpectedIdentityServiceStatus.iIdentityStatus  );
       
   624 		iTestStep->INFO_PRINTF2(_L("Status retrieved: %d"), data->iIdentityStatus );
       
   625 		  
       
   626 		// Check that the retrieved values match those expected.
       
   627 		iTestStep->TEST1(iStatus.Int() == iExpStat.Int(), ETrue);
       
   628 		iTestStep->TEST1( data->iIdentityStatus  == iExpectedIdentityServiceStatus.iIdentityStatus, ETrue   );
       
   629 	 }
       
   630 	else
       
   631 		{
       
   632 		iTestStep->INFO_PRINTF2(_L("Unexpected request status received:: %d"), iStatus.Int() );
       
   633 		iTestStep->TEST1(iStatus.Int() == iExpStat.Int(), ETrue);
       
   634 		}
       
   635 
       
   636 	CActiveScheduler::Stop();
       
   637 	}
       
   638 	
       
   639 CTestSuppServFuncFlightModeOnWithPublishSubscribe::CTestSuppServFuncFlightModeOnWithPublishSubscribe()
       
   640 /** Each test step initialises it's own name
       
   641 */
       
   642 {
       
   643 	// store the name of this test case
       
   644 	// this is the name that is used by the script file
       
   645 	SetTestStepName(_L("TestSuppServFuncFlightModeOnWithPublishSubscribe"));
       
   646 }
       
   647 
       
   648 /**
       
   649 @SYMTestCaseID Etel3rdParty 24.1, TestSuppServiveFuncFlightModeOn
       
   650 @SYMTestCaseDesc Test GetCallForwardingStatus, GetCallBarringStatus 
       
   651 * GetCallWaitingStatus and GetIdentityServiceStatus 3rd party APIs
       
   652 @SYMFssID SGL.GT0166.054 v1.3 A2_Telephony_Functional_Specification.doc,
       
   653 *  REQ 2116.4.11/12
       
   654 */
       
   655 
       
   656 enum TVerdict CTestSuppServFuncFlightModeOnWithPublishSubscribe::doTestStepL()
       
   657 {
       
   658 	INFO_PRINTF1(_L("START TEST 24.1"));	
       
   659 	 
       
   660 	INFO_PRINTF1(_L(" TEST: Supp service retrieval with flight mode on with publish and subscribe"));
       
   661 
       
   662 	// Set the config.txt test number mapping
       
   663 	SetTestNumber(13);
       
   664 	
       
   665 	// Set up phonePowerProperty variable so that flight mode can be manipulated.	
       
   666 	RProperty phonePowerProperty;
       
   667 	User::LeaveIfError(phonePowerProperty.Attach(KUidSystemCategory, KUidPhonePwr.iUid));
       
   668 	CleanupClosePushL(phonePowerProperty);
       
   669 
       
   670 	//Switch flight mode on (ie radio mode off)
       
   671 	TRequestStatus status;
       
   672 	phonePowerProperty.Subscribe(status);
       
   673 	User::LeaveIfError(phonePowerProperty.Set(KUidSystemCategory,KUidPhonePwr.iUid,ESAPhoneOff));
       
   674 	User::WaitForRequest(status);
       
   675 	TEST(status.Int() == KErrNone);
       
   676 
       
   677 	// Set the expected request status
       
   678 	TRequestStatus ExpStat=KErrNone;
       
   679 	CTelephony::TCallBarringSupplServicesV1 ExpectedCallBarringStatus; 
       
   680 	CTelephony::TCallForwardingSupplServicesV1 ExpectedCallForwardingStatus;
       
   681 	CTelephony::TCallWaitingSupplServicesV1 ExpectedCallWaitingStatus;  
       
   682 
       
   683 	// Create an active object and push it onto the clean up stack
       
   684 	CTestGetSupplementaryServiceStatusAct* getSupplementaryServiceStatusAct = CTestGetSupplementaryServiceStatusAct::NewLC(this, iTelephony);
       
   685 	
       
   686 	//
       
   687 	// Test call barring //
       
   688 	//
       
   689 	INFO_PRINTF1(_L("Test retrieval of call barring information"));
       
   690 	
       
   691 	ExpStat=KErrAccessDenied;
       
   692 	ExpectedCallBarringStatus.iCallBarring=CTelephony::EStatusActive;
       
   693 	getSupplementaryServiceStatusAct->TestGetCBSupplementaryServiceStatus(ExpectedCallBarringStatus,CTelephony::EBarAllIncoming, CTelephony::EVoiceService, ExpStat);
       
   694 	CActiveScheduler::Start();
       
   695 	
       
   696 	INFO_PRINTF1(_L("Test retrieval of call forwarding information"));
       
   697 	
       
   698 	ExpStat=KErrAccessDenied;
       
   699 	ExpectedCallForwardingStatus.iCallForwarding=CTelephony::EStatusActive;
       
   700 	getSupplementaryServiceStatusAct->TestGetCFSupplementaryServiceStatus(ExpectedCallForwardingStatus, CTelephony::ECallForwardingUnconditional, CTelephony::EVoiceService, ExpStat);
       
   701 	CActiveScheduler::Start();
       
   702 	
       
   703 	INFO_PRINTF1(_L("Test retrieval of call waiting information"));
       
   704 	
       
   705 	ExpStat=KErrAccessDenied;
       
   706 	ExpectedCallWaitingStatus.iCallWaiting=CTelephony::EStatusActive;
       
   707 	getSupplementaryServiceStatusAct->TestGetCWSupplementaryServiceStatus(ExpectedCallWaitingStatus, CTelephony::EVoiceService, ExpStat);
       
   708 	CActiveScheduler::Start();
       
   709 	
       
   710 	
       
   711 	//
       
   712 	// Test identity service
       
   713 	//
       
   714 	
       
   715 	// Set the config.txt test number mapping
       
   716 	SetTestNumber(14);
       
   717 	
       
   718 	INFO_PRINTF1(_L(" TEST: Identity service retrieval with flight mode on "));
       
   719 	
       
   720 	// Create an active object and push it onto the clean up stack
       
   721 	CTestGetIdentityServiceStatusAct* getIdentityServiceStatusAct = CTestGetIdentityServiceStatusAct::NewLC(this, iTelephony);
       
   722 
       
   723 	CTelephony::TIdentityServiceV1 ExpectedIdentityStatus;
       
   724 	CTelephony::TIdentityService IdentityServiceTypeRequired; 
       
   725 	
       
   726 	//Switch flight mode on (ie radio mode off)
       
   727 	phonePowerProperty.Subscribe(status);
       
   728 	User::LeaveIfError(phonePowerProperty.Set(KUidSystemCategory,KUidPhonePwr.iUid,ESAPhoneOff));
       
   729 	User::WaitForRequest(status);
       
   730 	TEST(status.Int() == KErrNone);
       
   731 	
       
   732 	// Set expected status to access denied as flight mode is on.
       
   733 	ExpStat=KErrAccessDenied;
       
   734 	// Test EIdServiceCallerPresentation
       
   735 	INFO_PRINTF1(_L("Test retrieval of EIdServiceCallerPresentation status"));
       
   736 	// Set the type of supplementary service info required
       
   737 	IdentityServiceTypeRequired=CTelephony::EIdServiceCallerPresentation;
       
   738 	// Set up the expected value to be the same as that provisioned in 
       
   739 	// the SIM TSY config.txt file.	
       
   740 	ExpectedIdentityStatus.iIdentityStatus=CTelephony::EIdServiceActiveDefaultRestricted;
       
   741 	// Attempt to retrieve the service information. Pass the expected values. 
       
   742 	getIdentityServiceStatusAct->TestGetIdentityServiceStatus(ExpectedIdentityStatus,IdentityServiceTypeRequired, ExpStat);
       
   743 	// Start the active scheduler
       
   744 	CActiveScheduler::Start();
       
   745 	
       
   746 	INFO_PRINTF1(_L("END TEST 24.1"));
       
   747 	
       
   748 	CleanupStack::PopAndDestroy(getIdentityServiceStatusAct);	 
       
   749 	CleanupStack::PopAndDestroy(getSupplementaryServiceStatusAct);   
       
   750 	CleanupStack::PopAndDestroy(&phonePowerProperty);	 
       
   751 	 
       
   752 	return TestStepResult() ;	  
       
   753 	 
       
   754 }
       
   755