smsprotocols/smsstack/smsprot/Test/TE_Smsprt/Te_StatusReportSchemeSteps.cpp
changeset 0 3553901f7fa8
child 14 7ef16719d8cb
equal deleted inserted replaced
-1:000000000000 0:3553901f7fa8
       
     1 // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 /**
       
    17  @file
       
    18 */
       
    19 
       
    20 #include "Te_StatusReportSchemeSteps.h"
       
    21 
       
    22 
       
    23 /**
       
    24 Setup the SMS for TP-SRR operations on the SMS 
       
    25 */
       
    26 TVerdict CTestSendingTPSRRSchemeInAllPDUs::doTestStepPreambleL()
       
    27 	{	
       
    28 	//Call the base class preamble
       
    29 	CTestSendingTPSRRScheme::doTestStepPreambleL();
       
    30 		
       
    31 	SetAllTPSRRsL();
       
    32 	
       
    33 	return TestStepResult();
       
    34 	}
       
    35 
       
    36 
       
    37 /**
       
    38 Setup the SMS for TP-SRR operations on the SMS 
       
    39 */
       
    40 TVerdict CTestSendingTPSRRSchemeInLastPDU::doTestStepPreambleL()
       
    41 	{	
       
    42 	//Call the base class preamble
       
    43 	CTestSendingTPSRRScheme::doTestStepPreambleL();
       
    44 		
       
    45 	CSmsTPSRROperations& TPSRROperations = static_cast<CSmsTPSRROperations&>(iSmsMessage->GetOperationsForNonIEL(ESmsTPSRRParameter));
       
    46 	TPSRROperations.SetSchemeL();
       
    47 	
       
    48 	//For a seven bit coding, use the last segment method provided
       
    49 	if(iDataCodingScheme == ESevenBit)
       
    50 		{
       
    51 		TPSRROperations.SetLastSegmentStatusReportL(ETrue);	
       
    52 		}		//for an eight bit coding, use the specified index
       
    53 	else
       
    54 		{
       
    55 		TPSRROperations.SetSegmentStatusReportL(iNumberOfPDUs-1,ETrue);	
       
    56 		}
       
    57 		
       
    58 	//both methods should result in the same formated PDU
       
    59 	return TestStepResult();
       
    60 	}
       
    61 
       
    62 
       
    63 /**
       
    64 Setup the SMS for TP-SRR operations on the SMS 
       
    65 */
       
    66 TVerdict CTestReceivingLastTPSRR::doTestStepPreambleL()
       
    67 	{	
       
    68 	//Call the base class preamble
       
    69 	CTestReceivingStatusReports::doTestStepPreambleL();
       
    70 		
       
    71 	SetLastTPSRRL();
       
    72 	
       
    73 	//both methods should result in the same formated PDU
       
    74 	return TestStepResult();
       
    75 	}
       
    76 
       
    77 
       
    78 /**
       
    79 Setup the SMS for TP-SRR operations on the SMS 
       
    80 */
       
    81 TVerdict CTestReceivingTPSRRAllPDU::doTestStepPreambleL()
       
    82 	{	
       
    83 	//Call the base class preamble
       
    84 	CTestReceivingStatusReports::doTestStepPreambleL();
       
    85 	
       
    86 	SetAllTPSRRsL();
       
    87 	
       
    88 	//both methods should result in the same formated PDU
       
    89 	return TestStepResult();
       
    90 	}
       
    91 
       
    92 
       
    93 /**
       
    94 Setup the SMS for TP-SRR operations on the SMS 
       
    95 */
       
    96 TVerdict CTestReceivingTPSRRSomePDU::doTestStepPreambleL()
       
    97 	{	
       
    98 	//Call the base class preamble
       
    99 	CTestReceivingStatusReports::doTestStepPreambleL();
       
   100 	
       
   101 	TInt firstIndex,secondIndex,thirdIndex;
       
   102 	GetIntFromConfig(ConfigSection(), _L("firstIndex"), firstIndex);
       
   103 	GetIntFromConfig(ConfigSection(), _L("secondIndex"), secondIndex);
       
   104 	GetIntFromConfig(ConfigSection(), _L("thirdIndex"), thirdIndex);
       
   105 	
       
   106 	SetSomeTPSRRL(firstIndex,secondIndex,thirdIndex);
       
   107 	
       
   108 	//both methods should result in the same formated PDU
       
   109 	return TestStepResult();
       
   110 	}
       
   111 
       
   112 
       
   113 /**
       
   114 Setup the SMS for TP-SRR operations on the SMS 
       
   115 */
       
   116 TVerdict CTestSendingSMSCSchemeSinglePDUNoBitSet::doTestStepPreambleL()
       
   117 	{	
       
   118 	//Call the base class preamble
       
   119 	CTestSendingSMSCScheme::doTestStepPreambleL();
       
   120 		
       
   121 	CSmsSMSCCtrlParameterOperations& smscOperations = static_cast<CSmsSMSCCtrlParameterOperations&>(iSmsMessage->GetOperationsForIEL(CSmsInformationElement::ESmsIEISMSCControlParameters));
       
   122 	smscOperations.SetSchemeL();
       
   123 	smscOperations.SetStatusReportL(0, 0x00);	
       
   124 	
       
   125 	return TestStepResult();
       
   126 	}
       
   127 
       
   128 
       
   129 /**
       
   130 Setup the SMS for TP-SRR operations on the SMS 
       
   131 */
       
   132 TVerdict CTestSendingSMSCSchemeSinglePDUSomeBitsSet::doTestStepPreambleL()
       
   133 	{	
       
   134 	//Call the base class preamble
       
   135 	CTestSendingSMSCScheme::doTestStepPreambleL();
       
   136 	
       
   137 	CSmsSMSCCtrlParameterOperations& smscOperations = static_cast<CSmsSMSCCtrlParameterOperations&>(iSmsMessage->GetOperationsForIEL(CSmsInformationElement::ESmsIEISMSCControlParameters));
       
   138 	smscOperations.SetSchemeL();
       
   139 		
       
   140 	for(TInt ii=1; ii<16; ii++)
       
   141 		{
       
   142 		smscOperations.SetStatusReportL(0, ii);
       
   143 		}
       
   144 		
       
   145 	for(TInt ii=16; ii<32; ii++)
       
   146 		{
       
   147 		TRAPD(err,smscOperations.SetStatusReportL(0, ii));
       
   148 		TEST(err == KErrNotSupported);	
       
   149 		}
       
   150 	
       
   151 	smscOperations.SetStatusReportL(0, ESmsSMSCControlParametersMask);
       
   152 	return TestStepResult();
       
   153 	}
       
   154 
       
   155 
       
   156 /**
       
   157 Setup the SMS for TP-SRR operations on the SMS 
       
   158 */
       
   159 TVerdict CTestSendingSMSCSchemeMultiplePDUsSomeBitsSet::doTestStepPreambleL()
       
   160 	{	
       
   161 	//Call the base class preamble
       
   162 	CTestSendingSMSCScheme::doTestStepPreambleL();
       
   163 	
       
   164 	CSmsSMSCCtrlParameterOperations& smscOperations = static_cast<CSmsSMSCCtrlParameterOperations&>(iSmsMessage->GetOperationsForIEL(CSmsInformationElement::ESmsIEISMSCControlParameters));
       
   165 	smscOperations.SetSchemeL();
       
   166 		
       
   167 	if(iDataCodingScheme == ESevenBit)
       
   168 		{
       
   169 		smscOperations.SetStatusReportL(0, ESmsStatusReportPermanentError);
       
   170 		smscOperations.SetStatusReportL(iNumberOfPDUs-1, ESmsStatusReportTemporaryError);
       
   171 		
       
   172 		}	//for an eight bit coding, use the specified index
       
   173 	else
       
   174 		{
       
   175 		for (TInt ii=0; ii<iNumberOfPDUs; ii++)
       
   176 			{
       
   177 			smscOperations.SetStatusReportL(ii, 0x00);	
       
   178 			}
       
   179 		}
       
   180 	
       
   181  	return TestStepResult();
       
   182 	}
       
   183 
       
   184 
       
   185 /**
       
   186 Setup the SMS for SMSC operations on the SMS 
       
   187 */
       
   188 TVerdict CTestReceivingLastSMSC::doTestStepPreambleL()
       
   189 	{	
       
   190 	//Call the base class preamble
       
   191 	CTestReceivingStatusReports::doTestStepPreambleL();
       
   192 		
       
   193 	SetLastSMSCL();
       
   194 	
       
   195 	//both methods should result in the same formated PDU
       
   196 	return TestStepResult();
       
   197 	}
       
   198 
       
   199 
       
   200 /**
       
   201 Setup the SMS for TP-SRR operations on the SMS 
       
   202 */
       
   203 TVerdict CTestReceivingSMSCAllPDU::doTestStepPreambleL()
       
   204 {	
       
   205 	//Call the base class preamble
       
   206 	CTestReceivingStatusReports::doTestStepPreambleL();
       
   207 		
       
   208 	SetAllSMSCL();
       
   209 	
       
   210 	//both methods should result in the same formated PDU
       
   211 	return TestStepResult();
       
   212 }
       
   213 
       
   214 
       
   215 /**
       
   216 Setup the SMS for TP-SRR operations on the SMS 
       
   217 */
       
   218 TVerdict CTestReceivingSMSCSomePDU::doTestStepPreambleL()
       
   219 {	
       
   220 	//Call the base class preamble
       
   221 	CTestReceivingStatusReports::doTestStepPreambleL();
       
   222 	
       
   223 	TInt firstIndex,secondIndex,thirdIndex;
       
   224 	GetIntFromConfig(ConfigSection(), _L("firstIndex"), firstIndex);
       
   225 	GetIntFromConfig(ConfigSection(), _L("secondIndex"), secondIndex);
       
   226 	GetIntFromConfig(ConfigSection(), _L("thirdIndex"), thirdIndex);
       
   227 	
       
   228 	SetSomeSMSCL(firstIndex,secondIndex,thirdIndex);
       
   229 	
       
   230 	//both methods should result in the same formated PDU
       
   231 	return TestStepResult();
       
   232 }
       
   233 
       
   234 
       
   235 /**
       
   236 Setup the SMS for SMSC operations on the SMS 
       
   237 */
       
   238 TVerdict CTestReceivingSMSCMultiplePDU::doTestStepPreambleL()
       
   239 	{	
       
   240 	//Call the base class preamble
       
   241 	CTestReceivingMessages::doTestStepPreambleL();
       
   242 		
       
   243 	//both methods should result in the same formated PDU
       
   244 	return TestStepResult();
       
   245 	}
       
   246 
       
   247 /**
       
   248 Setup the SMS for SMSC operations on the SMS 
       
   249 */
       
   250 TVerdict CTestReceivingSMSCMultiplePDU::doTestStepL()
       
   251 	{	
       
   252 	//Get the expected selective status from the config file
       
   253 	TInt expectedStatus1, expectedStatus2, expectedStatus3;
       
   254 	GetHexFromConfig(ConfigSection(), _L("expectedStatus1"), expectedStatus1);
       
   255 	GetHexFromConfig(ConfigSection(), _L("expectedStatus2"), expectedStatus2);
       
   256 	GetHexFromConfig(ConfigSection(), _L("expectedStatus3"), expectedStatus3);
       
   257 	
       
   258 	//Check the scheme is SMSC
       
   259 	TSmsStatusReportScheme scheme;
       
   260 	scheme = iSmsMessage->Scheme();
       
   261 	TESTL(scheme == EControlParametersScheme);
       
   262 	
       
   263 	//Check the selective status is as expected
       
   264 	TUint8 selectiveStatus;
       
   265 	TInt  ret;
       
   266 
       
   267 	CSmsSMSCCtrlParameterOperations& smscOperations = static_cast<CSmsSMSCCtrlParameterOperations&>(iSmsMessage->GetOperationsForIEL(CSmsInformationElement::ESmsIEISMSCControlParameters));
       
   268 		
       
   269 	ret = smscOperations.GetStatusReport(0, selectiveStatus);
       
   270 	TEST(ret == KErrNone);	
       
   271 	TEST(selectiveStatus == expectedStatus1);	
       
   272 			
       
   273 	ret = smscOperations.GetStatusReport(1, selectiveStatus);	
       
   274 	TEST(ret == KErrNone);	
       
   275 	TEST(selectiveStatus == expectedStatus2);	
       
   276 	
       
   277 	ret = smscOperations.GetStatusReport(2, selectiveStatus);	
       
   278 	TEST(ret == KErrNone);	
       
   279 	TEST(selectiveStatus == expectedStatus3);
       
   280 			
       
   281 	//both methods should result in the same formated PDU
       
   282 	return TestStepResult();
       
   283 	}
       
   284 	
       
   285 
       
   286 /**
       
   287 Setup the SMS for SMSC operations on the SMS 
       
   288 */
       
   289 TVerdict CTestReceivingSMSCSinglePDU::doTestStepPreambleL()
       
   290 	{	
       
   291 	//Call the base class preamble
       
   292 	CTestReceivingMessages::doTestStepPreambleL();
       
   293 		
       
   294 	//both methods should result in the same formated PDU
       
   295 	return TestStepResult();
       
   296 	}
       
   297 
       
   298 /**
       
   299 Setup the SMS for SMSC operations on the SMS 
       
   300 */
       
   301 TVerdict CTestReceivingSMSCSinglePDU::doTestStepL()
       
   302 	{	
       
   303 	//Get the expected selective status from the config file
       
   304 	TInt expectedStatus;
       
   305 	GetHexFromConfig(ConfigSection(), _L("expectedStatus"), expectedStatus);
       
   306 			
       
   307 	//Check the scheme is SMSC
       
   308 	TSmsStatusReportScheme scheme;
       
   309 	scheme = iSmsMessage->Scheme();
       
   310 	TESTL(scheme == EControlParametersScheme);
       
   311 	
       
   312 	//Check the selective status is as expected
       
   313 	TUint8 selectiveStatus;
       
   314 	TInt  ret;
       
   315 
       
   316 	CSmsSMSCCtrlParameterOperations& smscOperations = static_cast<CSmsSMSCCtrlParameterOperations&>(iSmsMessage->GetOperationsForIEL(CSmsInformationElement::ESmsIEISMSCControlParameters));
       
   317 	
       
   318 	ret = smscOperations.GetStatusReport(0, selectiveStatus);	
       
   319 	TEST(ret == KErrNone);
       
   320 	TEST(selectiveStatus == expectedStatus);	
       
   321 	
       
   322 	//both methods should result in the same formated PDU
       
   323 	return TestStepResult();
       
   324 	}
       
   325 
       
   326 
       
   327 TVerdict CTestReceivingDeliversWithTPSRR::doTestStepPreambleL()
       
   328 {
       
   329 	//Call the base class preamble
       
   330 	CTestReceivingMessages::doTestStepPreambleL();
       
   331 		
       
   332 	//Get the expected selective status from the config file
       
   333 	TPtrC expectedSchemeStr;
       
   334 	GetStringFromConfig(ConfigSection(), _L("expectedScheme"), expectedSchemeStr);
       
   335 
       
   336 	if(expectedSchemeStr.Compare(_L("TPSRR"))==0)
       
   337 		iExpectedScheme = ETPSRRScheme;
       
   338 	else
       
   339 		iExpectedScheme = EDefaultScheme;
       
   340 	
       
   341 	return TestStepResult();
       
   342 }
       
   343 
       
   344 /**
       
   345 Test the scheme of the deliver message
       
   346 */
       
   347 TVerdict CTestReceivingDeliversWithTPSRR::doTestStepL()
       
   348 {	
       
   349 	TSmsStatusReportScheme scheme = iSmsMessage->Scheme();
       
   350 	TESTL(scheme==iExpectedScheme);
       
   351 
       
   352 	return TestStepResult();
       
   353 }
       
   354 
       
   355 
       
   356 /**
       
   357 Test the scheme of the deliver message
       
   358 */
       
   359 TVerdict CTestDeliversWithTPSRRScheme::doTestStepL()
       
   360 {
       
   361 	CSmsTPSRROperations& TPSRROperations = static_cast<CSmsTPSRROperations&>(iSmsMessage->GetOperationsForNonIEL(ESmsTPSRRParameter));	
       
   362 	TSmsStatusReportScheme scheme = TPSRROperations.GetScheme();
       
   363 	TESTL(scheme==iExpectedScheme);
       
   364 
       
   365 	//Get the expected selective status from the config file
       
   366 	TInt expectedStatus;
       
   367 	GetIntFromConfig(ConfigSection(), _L("expectedStatus"), expectedStatus);
       
   368 
       
   369 	TInt TPSRRIndex=0;
       
   370 	TInt InvalidIndex=0;
       
   371 	TInt NoTPSRRIndex=0;
       
   372 	GetIntFromConfig(ConfigSection(), _L("TPSRRIndex"), TPSRRIndex);
       
   373 	GetIntFromConfig(ConfigSection(), _L("InvalidIndex"), InvalidIndex);
       
   374 	GetIntFromConfig(ConfigSection(), _L("NoTPSRRIndex"), NoTPSRRIndex);
       
   375 		
       
   376 	//Get the status
       
   377 	TInt status=TPSRROperations.GetStatusReport(TPSRRIndex);
       
   378 	TESTL(status==expectedStatus);
       
   379 	
       
   380 	//Get status for an invalid segment
       
   381 	status=TPSRROperations.GetStatusReport(InvalidIndex);
       
   382 	TESTL(status==KErrNotFound);
       
   383 
       
   384 	//Get status for a segment not set
       
   385 	status=TPSRROperations.GetStatusReport(NoTPSRRIndex);
       
   386 	TESTL(status==KErrNone);
       
   387 
       
   388 	return TestStepResult();
       
   389 	
       
   390 }
       
   391 
       
   392 //-----------------------------------------------------------------------------
       
   393 
       
   394 
       
   395 
       
   396 
       
   397 
       
   398