telephonyserverplugins/simtsy/test/Te_Sim/Te_SimPacketRel99Rel5QOSPubSubNotifTest.cpp
changeset 0 3553901f7fa8
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 #include "Te_SimPacketRel99Rel5QOSPubSubNotifTest.h"
       
    17 
       
    18 CSimPacketRel99Rel5QOSPubSubNotifTest::CSimPacketRel99Rel5QOSPubSubNotifTest() 
       
    19 	{ 
       
    20 	SetTestStepName(_L("Rel99Rel5QOSPubSubNotifTest"));
       
    21 	}
       
    22 
       
    23 TVerdict CSimPacketRel99Rel5QOSPubSubNotifTest::doTestStepL()
       
    24 	{
       
    25 	INFO_PRINTF1(_L("Begin Rel99Rel5QOSPubSubNotifTest"));
       
    26 
       
    27  	CreateConfigFileL(_L("c:\\config3.txt"));
       
    28  	SetTestNumberL(21);
       
    29 
       
    30 	TInt ret = iPhone.Open(iTelServer,KPhoneName); 
       
    31 	INFO_PRINTF2(_L("Result: %d"),ret);
       
    32 	TESTL(ret == KErrNone); 
       
    33 	INFO_PRINTF1(_L("Opened phone object"));
       
    34 	TESTL(iPacketService.Open(iPhone)==KErrNone);
       
    35 	INFO_PRINTF1(_L("Opened Packet object"));
       
    36 	TName contextName;
       
    37 	TName contextNameCompare;
       
    38 	TESTL(iFirstPrimaryPacketContext.OpenNewContext(iPacketService, contextName)==KErrNone);
       
    39 	contextNameCompare.Append(KSimPrimaryPacketContextName);
       
    40 	contextNameCompare.AppendNum(1);
       
    41 	TESTL(contextName.Compare(contextNameCompare)==KErrNone);
       
    42 	INFO_PRINTF1(_L("Opened Context object"));
       
    43 
       
    44 	TRequestStatus reqStatus, notifyStatus, cancelStatus;
       
    45 
       
    46 	// R99 test
       
    47 	TName r99QosName;
       
    48 	TESTL(iRel99Packetqos.OpenNewQoS(iFirstPrimaryPacketContext, r99QosName)==KErrNone);
       
    49 	RPacketQoS::TQoSR99_R4Requested aR99QoSReqConfig;
       
    50 	TPckg<RPacketQoS::TQoSR99_R4Requested> aR99QoSReqPckg(aR99QoSReqConfig);
       
    51 
       
    52 	RPacketQoS::TQoSR99_R4Negotiated aR99NotifyQoS;
       
    53 	TPckg<RPacketQoS::TQoSR99_R4Negotiated> aR99NotifyQoSPckg(aR99NotifyQoS);
       
    54 
       
    55 	TInt req = 4;
       
    56 	TInt min = 2; 
       
    57 
       
    58 	//Profile data
       
    59 	aR99QoSReqConfig.iReqTrafficClass = RPacketQoS::ETrafficClassStreaming; // 0x04
       
    60 	aR99QoSReqConfig.iMinTrafficClass = RPacketQoS::ETrafficClassConversational; // 0x02
       
    61 	aR99QoSReqConfig.iReqDeliveryOrderReqd = RPacketQoS::EDeliveryOrderNotRequired; // 0x04
       
    62 	aR99QoSReqConfig.iMinDeliveryOrderReqd = RPacketQoS::EDeliveryOrderRequired;	// 0x02
       
    63 	aR99QoSReqConfig.iReqDeliverErroneousSDU = RPacketQoS::EErroneousSDUDeliveryNotRequired; // 0x08
       
    64 	aR99QoSReqConfig.iMinDeliverErroneousSDU = RPacketQoS::EErroneousSDUDeliveryRequired; // 0x04
       
    65 	aR99QoSReqConfig.iReqMaxSDUSize = req; // 4	
       
    66 	aR99QoSReqConfig.iMinAcceptableMaxSDUSize = min; // 2
       
    67 	aR99QoSReqConfig.iReqMaxRate.iUplinkRate = min;	// between 0 - 1840
       
    68 	aR99QoSReqConfig.iReqMaxRate.iDownlinkRate = min;
       
    69 	aR99QoSReqConfig.iMinAcceptableMaxRate.iDownlinkRate = min-1; // between 0 - 1840
       
    70 	aR99QoSReqConfig.iMinAcceptableMaxRate.iUplinkRate = req;
       
    71 	aR99QoSReqConfig.iReqBER = RPacketQoS::EBEROnePerHundred;	// 0x04
       
    72 	aR99QoSReqConfig.iMaxBER = RPacketQoS::EBERFivePerHundred;	// 0x02
       
    73 	aR99QoSReqConfig.iReqSDUErrorRatio = RPacketQoS::ESDUErrorRatioSevenPerThousand; // 0x08
       
    74 	aR99QoSReqConfig.iMaxSDUErrorRatio = RPacketQoS::ESDUErrorRatioOnePerHundred;	// 0x04
       
    75 	aR99QoSReqConfig.iReqTrafficHandlingPriority = RPacketQoS::ETrafficPriority2; // 0x04
       
    76 	aR99QoSReqConfig.iMinTrafficHandlingPriority = RPacketQoS::ETrafficPriority1; // 0x02
       
    77 	aR99QoSReqConfig.iReqTransferDelay = req;
       
    78 	aR99QoSReqConfig.iMaxTransferDelay = min;
       
    79 	aR99QoSReqConfig.iReqGuaranteedRate.iDownlinkRate = min;
       
    80 	aR99QoSReqConfig.iReqGuaranteedRate.iUplinkRate = req;
       
    81 	aR99QoSReqConfig.iMinGuaranteedRate.iDownlinkRate = min;
       
    82 	aR99QoSReqConfig.iMinGuaranteedRate.iUplinkRate = req;
       
    83  
       
    84 	// Set the qos
       
    85 	iRel99Packetqos.SetProfileParameters(reqStatus, aR99QoSReqPckg);
       
    86 	User::WaitForRequest(reqStatus);
       
    87 	TESTL(reqStatus.Int()==KErrNone);
       
    88 	
       
    89 	// post the notification
       
    90 	iRel99Packetqos.NotifyProfileChanged(notifyStatus, aR99NotifyQoSPckg);
       
    91 	
       
    92 	// Trig QoS change
       
    93 	ret = RProperty::Set(KUidPSSimTsyCategory, KPSSimTsyNetworkQoSChange, 0);
       
    94 	TESTL(ret == KErrNone);
       
    95 	
       
    96 	// wait for the notification
       
    97 	User::WaitForRequest(notifyStatus);
       
    98 	TESTL(notifyStatus.Int()==KErrNone);
       
    99 
       
   100 	// validate profile. Expect data from QosR5NetworkNotification tag
       
   101 	TEST(aR99NotifyQoS.ExtensionId()==TPacketDataConfigBase::KConfigRel99Rel4);
       
   102 	TEST(aR99NotifyQoS.iTrafficClass==RPacketQoS::ETrafficClassBackground);
       
   103 	TEST(aR99NotifyQoS.iDeliveryOrderReqd==RPacketQoS::EDeliveryOrderNotRequired);
       
   104 	TEST(aR99NotifyQoS.iDeliverErroneousSDU==RPacketQoS::EErroneousSDUNoDetection);
       
   105 	TEST(aR99NotifyQoS.iMaxSDUSize==req*2);
       
   106 	TEST(aR99NotifyQoS.iMaxRate.iUplinkRate==min*2);
       
   107 	TEST(aR99NotifyQoS.iMaxRate.iDownlinkRate==req*2);
       
   108 	TEST(aR99NotifyQoS.iBER==RPacketQoS::EBERFivePerThousand);
       
   109 	TEST(aR99NotifyQoS.iSDUErrorRatio==RPacketQoS::ESDUErrorRatioOnePerThousand);
       
   110 	TEST(aR99NotifyQoS.iTrafficHandlingPriority==RPacketQoS::ETrafficPriority3);
       
   111 	TEST(aR99NotifyQoS.iTransferDelay==min*2);
       
   112 	TEST(aR99NotifyQoS.iGuaranteedRate.iUplinkRate==min*2);
       
   113 	TEST(aR99NotifyQoS.iGuaranteedRate.iDownlinkRate==req*2);	
       
   114 
       
   115 	// cleanup
       
   116 	iRel99Packetqos.Close();
       
   117 
       
   118 	// R5 test
       
   119 	TName r5QosName;
       
   120 	TESTL(iRel5Packetqos.OpenNewQoS(iFirstPrimaryPacketContext, r5QosName)==KErrNone);
       
   121 	RPacketQoS::TQoSR5Requested aR5QoSReqConfig;
       
   122 	TPckg<RPacketQoS::TQoSR5Requested> aR5QoSReqPckg(aR5QoSReqConfig);
       
   123 
       
   124 	RPacketQoS::TQoSR5Negotiated aR5NotifyQoS;
       
   125 	TPckg<RPacketQoS::TQoSR5Negotiated> aR5NotifyQoSPckg(aR5NotifyQoS);
       
   126 
       
   127 	//Profile data
       
   128 	aR5QoSReqConfig.iReqTrafficClass = RPacketQoS::ETrafficClassInteractive; // 0x08
       
   129 	aR5QoSReqConfig.iMinTrafficClass = RPacketQoS::ETrafficClassBackground; // 0x10
       
   130 	aR5QoSReqConfig.iReqDeliveryOrderReqd = RPacketQoS::EDeliveryOrderRequired;	// 0x02
       
   131 	aR5QoSReqConfig.iMinDeliveryOrderReqd = RPacketQoS::EDeliveryOrderNotRequired; // 0x04
       
   132 	aR5QoSReqConfig.iReqDeliverErroneousSDU = RPacketQoS::EErroneousSDUNoDetection; // 0x02
       
   133 	aR5QoSReqConfig.iMinDeliverErroneousSDU = RPacketQoS::EErroneousSDUDeliveryUnspecified; // 0x01
       
   134 	aR5QoSReqConfig.iReqMaxSDUSize = req*2; // 8	
       
   135 	aR5QoSReqConfig.iMinAcceptableMaxSDUSize = min*2; // 4
       
   136 	aR5QoSReqConfig.iReqMaxRate.iUplinkRate = min*2;	// between 0 - 1840
       
   137 	aR5QoSReqConfig.iReqMaxRate.iDownlinkRate = min*2;
       
   138 	aR5QoSReqConfig.iMinAcceptableMaxRate.iDownlinkRate = (min-1)*2; // between 0 - 1840
       
   139 	aR5QoSReqConfig.iMinAcceptableMaxRate.iUplinkRate = req*2;
       
   140 	aR5QoSReqConfig.iReqBER = RPacketQoS::EBERFourPerThousand; // 0x10
       
   141 	aR5QoSReqConfig.iMaxBER = RPacketQoS::EBERFivePerThousand; // 0x08
       
   142 	aR5QoSReqConfig.iReqSDUErrorRatio = RPacketQoS::ESDUErrorRatioOnePerTenThousand; // 0x20
       
   143 	aR5QoSReqConfig.iMaxSDUErrorRatio = RPacketQoS::ESDUErrorRatioOnePerThousand; // 0x10
       
   144 	aR5QoSReqConfig.iReqTrafficHandlingPriority = RPacketQoS::ETrafficPriority3; // 0x08
       
   145 	aR5QoSReqConfig.iMinTrafficHandlingPriority = RPacketQoS::ETrafficPriority2; // 0x04
       
   146 	aR5QoSReqConfig.iReqTransferDelay = req*2;
       
   147 	aR5QoSReqConfig.iMaxTransferDelay = min*2;
       
   148 	aR5QoSReqConfig.iReqGuaranteedRate.iDownlinkRate = min*2;
       
   149 	aR5QoSReqConfig.iReqGuaranteedRate.iUplinkRate = req*2;
       
   150 	aR5QoSReqConfig.iMinGuaranteedRate.iDownlinkRate = min*2;
       
   151 	aR5QoSReqConfig.iMinGuaranteedRate.iUplinkRate = req*2;
       
   152 	aR5QoSReqConfig.iSignallingIndication = ETrue;			 
       
   153 	aR5QoSReqConfig.iSourceStatisticsDescriptor = RPacketQoS::ESourceStatisticsDescriptorSpeech;
       
   154  
       
   155 	// Set the qos
       
   156 	iRel5Packetqos.SetProfileParameters(reqStatus, aR5QoSReqPckg);
       
   157 	User::WaitForRequest(reqStatus);
       
   158 	TESTL(reqStatus.Int()==KErrNone);
       
   159 	
       
   160 	// post the notification
       
   161 	iRel5Packetqos.NotifyProfileChanged(notifyStatus, aR5NotifyQoSPckg);
       
   162 	
       
   163 	// Trig QoS change
       
   164 	ret = RProperty::Set(KUidPSSimTsyCategory, KPSSimTsyNetworkQoSChange, 0);
       
   165 	TESTL(ret == KErrNone);
       
   166 	
       
   167 	// wait for the notification
       
   168 	User::WaitForRequest(notifyStatus);
       
   169 	TESTL(notifyStatus.Int()==KErrNone);
       
   170 
       
   171 	// validate profile. Expect data from QosR5NetworkNotification tag
       
   172 	TEST(aR5NotifyQoS.ExtensionId()==TPacketDataConfigBase::KConfigRel5);
       
   173 	TEST(aR5NotifyQoS.iTrafficClass==RPacketQoS::ETrafficClassInteractive); //0x08
       
   174 	TEST(aR5NotifyQoS.iDeliveryOrderReqd==RPacketQoS::EDeliveryOrderNotRequired); // 0x04
       
   175 	TEST(aR5NotifyQoS.iDeliverErroneousSDU==RPacketQoS::EErroneousSDUDeliveryNotRequired); //0x08
       
   176 	TEST(aR5NotifyQoS.iMaxSDUSize==req);
       
   177 	TEST(aR5NotifyQoS.iMaxRate.iUplinkRate==min);
       
   178 	TEST(aR5NotifyQoS.iMaxRate.iDownlinkRate==req);
       
   179 	TEST(aR5NotifyQoS.iBER==RPacketQoS::EBERFivePerHundred); // 0x02
       
   180 	TEST(aR5NotifyQoS.iSDUErrorRatio==RPacketQoS::ESDUErrorRatioOnePerHundredThousand); //0x40
       
   181 	TEST(aR5NotifyQoS.iTrafficHandlingPriority==RPacketQoS::ETrafficPriority2); // 0x04
       
   182 	TEST(aR5NotifyQoS.iTransferDelay==min);
       
   183 	TEST(aR5NotifyQoS.iGuaranteedRate.iUplinkRate==min);
       
   184 	TEST(aR5NotifyQoS.iGuaranteedRate.iDownlinkRate==req);	
       
   185 	TEST(aR5NotifyQoS.iSignallingIndication);			 
       
   186 	TEST(aR5NotifyQoS.iSourceStatisticsDescriptor == RPacketQoS::ESourceStatisticsDescriptorSpeech);
       
   187 
       
   188 	// cleanup
       
   189 	iRel5Packetqos.Close();
       
   190 
       
   191 	// End of RPacketQos tests
       
   192 	iFirstPrimaryPacketContext.Close();
       
   193 	iPacketService.Close();
       
   194 	iPhone.Close();
       
   195 	ASSERT(RThread().RequestCount()==0);
       
   196 
       
   197 	return TestStepResult();
       
   198 	}
       
   199