telephonyserverplugins/simtsy/test/Te_Sim/Te_SimPacketGPRSRel99NotifyProfileChangeTest.cpp
changeset 0 3553901f7fa8
child 24 6638e7f4bd8f
equal deleted inserted replaced
-1:000000000000 0:3553901f7fa8
       
     1 // Copyright (c) 2005-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_SimPacketGPRSRel99NotifyProfileChangeTest.h"
       
    17 
       
    18 CSimPacketGPRSRel99NotifyProfileChangeTest::CSimPacketGPRSRel99NotifyProfileChangeTest() 
       
    19 	{ 
       
    20 	SetTestStepName(_L("GPRSRel99NotifyProfileChangeTest"));
       
    21 	}
       
    22 
       
    23 TVerdict CSimPacketGPRSRel99NotifyProfileChangeTest::doTestStepL()
       
    24 	{
       
    25 	INFO_PRINTF1(_L("BeginPacketGPRSRel99NotifyProfileChangeTest"));
       
    26 
       
    27  	CreateConfigFileL(_L("c:\\config3.txt"));
       
    28  	SetTestNumberL(6);
       
    29 
       
    30 	TRequestStatus gprsReqStatus, rel99ReqStatus;
       
    31 	TRequestStatus gprsNotifyStatus, rel99NotifyStatus;
       
    32 
       
    33 	// Open phone
       
    34 	TInt ret = iPhone.Open(iTelServer,KPhoneName); 
       
    35 	INFO_PRINTF2(_L("Result: %d"),ret);
       
    36 	TESTL(ret == KErrNone); 
       
    37 	INFO_PRINTF1(_L("Opened phone object"));
       
    38 
       
    39 	// Open GPRS packet service
       
    40 	TESTL(iGPRSPacketService.Open(iPhone)==KErrNone);
       
    41 	INFO_PRINTF1(_L("Opened Packet object"));
       
    42 
       
    43 	// Open GPRS context
       
    44 	TName contextName;
       
    45 	TName contextNameCompare;
       
    46 	TESTL(iGPRSPacketContext.OpenNewContext(iGPRSPacketService, contextName)==KErrNone);
       
    47 	contextNameCompare.Append(KSimPrimaryPacketContextName);
       
    48 	contextNameCompare.AppendNum(1);
       
    49 	TESTL(contextName.Compare(contextNameCompare)==KErrNone);
       
    50 	INFO_PRINTF1(_L("Opened Context object"));
       
    51 
       
    52 	// Open GPRS PacketQoS
       
    53 	TName gprsQosName;
       
    54 	TESTL(iGPRSPacketqos.OpenNewQoS(iGPRSPacketContext, gprsQosName)==KErrNone);
       
    55 
       
    56 	TName gprsQosNameCompare;
       
    57 	gprsQosNameCompare.Append(KSimPacketQosName);
       
    58 	gprsQosNameCompare.AppendNum(1);
       
    59 	TESTL(gprsQosName.Compare(gprsQosNameCompare)==KErrNone);
       
    60 	INFO_PRINTF1(_L("Opened GPRS QoS object"));
       
    61 	
       
    62 	// Open UMTS Rel99 packet service - opened from same session RTelServer object as GPRS packet service
       
    63 	TESTL(iRel99PacketService.Open(iPhone)==KErrNone);
       
    64 	INFO_PRINTF1(_L("Opened Rel99 Packet object"));
       
    65 
       
    66 	// Open UMTS Rel99 context
       
    67 	TESTL(iRel99PacketContext.OpenExistingContext(iRel99PacketService, contextName) == KErrNone);
       
    68 
       
    69 	// Open Rel99 PacketQoS
       
    70 	TESTL(iRel99Packetqos.OpenExistingQoS(iRel99PacketContext, gprsQosName)==KErrNone);
       
    71 	INFO_PRINTF1(_L("Opened Rel99 QoS object"));
       
    72 
       
    73 	//Configure GPRS parameters
       
    74 	//
       
    75 	//
       
    76 	// Set GPRS QoS Profile Params
       
    77 	RPacketQoS::TQoSGPRSRequested aGPRSQoSReqConfig;
       
    78 	TPckg<RPacketQoS::TQoSGPRSRequested> aGPRSQoSReqPckg(aGPRSQoSReqConfig);
       
    79 
       
    80 	// post a GPRS notification
       
    81  	RPacketQoS::TQoSGPRSNegotiated aGPRSNotifyQoS;
       
    82 	TPckg<RPacketQoS::TQoSGPRSNegotiated> aGPRSNotifyQoSPckg(aGPRSNotifyQoS);
       
    83 
       
    84 	//GPRS Profile data
       
    85 	aGPRSQoSReqConfig.iMinDelay = RPacketQoS::EDelayClass1;
       
    86 	aGPRSQoSReqConfig.iMinMeanThroughput = RPacketQoS::EMeanThroughput200;
       
    87 	aGPRSQoSReqConfig.iMinPeakThroughput = RPacketQoS::EPeakThroughput16000;
       
    88 	aGPRSQoSReqConfig.iMinPrecedence = RPacketQoS::EPriorityLowPrecedence;
       
    89 	aGPRSQoSReqConfig.iMinReliability = RPacketQoS::EReliabilityClass1;
       
    90 	aGPRSQoSReqConfig.iReqDelay = RPacketQoS::EDelayClass2;
       
    91 	aGPRSQoSReqConfig.iReqMeanThroughput = RPacketQoS::EMeanThroughput2000;
       
    92 	aGPRSQoSReqConfig.iReqPeakThroughput = RPacketQoS::EPeakThroughput64000;
       
    93 	aGPRSQoSReqConfig.iReqPrecedence = RPacketQoS::EPriorityMediumPrecedence;
       
    94 	aGPRSQoSReqConfig.iReqReliability = RPacketQoS::EReliabilityClass2;
       
    95 	//
       
    96 	//
       
    97 
       
    98 
       
    99 	//Configure Rel99 QoS Profile Params
       
   100 	//
       
   101 	//
       
   102 	RPacketQoS::TQoSR99_R4Requested aR99QoSReqConfig;
       
   103 	TESTL(aR99QoSReqConfig.ExtensionId()==TPacketDataConfigBase::KConfigRel99Rel4);
       
   104 	TPckg<RPacketQoS::TQoSR99_R4Requested> aR99QoSReqPckg(aR99QoSReqConfig);
       
   105 
       
   106 	RPacketQoS::TQoSR99_R4Negotiated aR99NotifyQoS;
       
   107 	TPckg<RPacketQoS::TQoSR99_R4Negotiated> aR99NotifyQoSPckg(aR99NotifyQoS);
       
   108 
       
   109 	TInt req = 4;
       
   110 	TInt min = 2; 
       
   111 
       
   112 	//Profile data
       
   113 	aR99QoSReqConfig.iReqTrafficClass = RPacketQoS::ETrafficClassStreaming; // 0x04
       
   114 	aR99QoSReqConfig.iMinTrafficClass = RPacketQoS::ETrafficClassConversational; // 0x02
       
   115 	aR99QoSReqConfig.iReqDeliveryOrderReqd = RPacketQoS::EDeliveryOrderNotRequired; // 0x04
       
   116 	aR99QoSReqConfig.iMinDeliveryOrderReqd = RPacketQoS::EDeliveryOrderRequired;	// 0x02
       
   117 	aR99QoSReqConfig.iReqDeliverErroneousSDU = RPacketQoS::EErroneousSDUDeliveryNotRequired; // 0x08
       
   118 	aR99QoSReqConfig.iMinDeliverErroneousSDU = RPacketQoS::EErroneousSDUDeliveryRequired; // 0x04
       
   119 	aR99QoSReqConfig.iReqMaxSDUSize = req; // 4	
       
   120 	aR99QoSReqConfig.iMinAcceptableMaxSDUSize = min; // 2
       
   121 	aR99QoSReqConfig.iReqMaxRate.iUplinkRate = min;	// between 0 - 1840
       
   122 	aR99QoSReqConfig.iReqMaxRate.iDownlinkRate = min;
       
   123 	aR99QoSReqConfig.iMinAcceptableMaxRate.iDownlinkRate = min-1; // between 0 - 1840
       
   124 	aR99QoSReqConfig.iMinAcceptableMaxRate.iUplinkRate = req;
       
   125 	aR99QoSReqConfig.iReqBER = RPacketQoS::EBEROnePerHundred;	// 0x04
       
   126 	aR99QoSReqConfig.iMaxBER = RPacketQoS::EBERFivePerHundred;	// 0x02
       
   127 	aR99QoSReqConfig.iReqSDUErrorRatio = RPacketQoS::ESDUErrorRatioSevenPerThousand; // 0x08
       
   128 	aR99QoSReqConfig.iMaxSDUErrorRatio = RPacketQoS::ESDUErrorRatioOnePerHundred;	// 0x04
       
   129 	aR99QoSReqConfig.iReqTrafficHandlingPriority = RPacketQoS::ETrafficPriority2; // 0x04
       
   130 	aR99QoSReqConfig.iMinTrafficHandlingPriority = RPacketQoS::ETrafficPriority1; // 0x02
       
   131 	aR99QoSReqConfig.iReqTransferDelay = req;
       
   132 	aR99QoSReqConfig.iMaxTransferDelay = min;
       
   133 	aR99QoSReqConfig.iReqGuaranteedRate.iDownlinkRate = min;
       
   134 	aR99QoSReqConfig.iReqGuaranteedRate.iUplinkRate = req;
       
   135 	aR99QoSReqConfig.iMinGuaranteedRate.iDownlinkRate = min;
       
   136 	aR99QoSReqConfig.iMinGuaranteedRate.iUplinkRate = req;
       
   137 	//
       
   138 	//
       
   139 
       
   140 	//post the notifications
       
   141 	iRel99Packetqos.NotifyProfileChanged(rel99NotifyStatus, aR99NotifyQoSPckg);
       
   142 	iGPRSPacketqos.NotifyProfileChanged(gprsNotifyStatus, aGPRSNotifyQoSPckg);
       
   143 	
       
   144 	//Set the profile
       
   145 	iRel99Packetqos.SetProfileParameters(rel99ReqStatus, aR99QoSReqPckg);
       
   146 	iGPRSPacketqos.SetProfileParameters(gprsReqStatus, aGPRSQoSReqPckg);	
       
   147 
       
   148 	User::WaitForRequest(rel99NotifyStatus);
       
   149 	User::WaitForRequest(gprsNotifyStatus);
       
   150 	
       
   151 
       
   152 	//User::WaitForRequest(rel99ReqStatus);
       
   153 	User::WaitForRequest(rel99ReqStatus);
       
   154 	User::WaitForRequest(gprsReqStatus);
       
   155 	
       
   156 	//Test the notification packages are correct
       
   157 
       
   158 	//Rel99
       
   159 	TESTL(aR99NotifyQoS.ExtensionId()==TPacketDataConfigBase::KConfigRel99Rel4);
       
   160 	TESTL(aR99NotifyQoS.iTrafficClass==RPacketQoS::ETrafficClassConversational);
       
   161 	TESTL(aR99NotifyQoS.iDeliveryOrderReqd==RPacketQoS::EDeliveryOrderNotRequired);
       
   162 	TESTL(aR99NotifyQoS.iDeliverErroneousSDU==RPacketQoS::EErroneousSDUNoDetection);
       
   163 	TESTL(aR99NotifyQoS.iMaxSDUSize==min);
       
   164 	TESTL(aR99NotifyQoS.iMaxRate.iUplinkRate==min);
       
   165 	TESTL(aR99NotifyQoS.iMaxRate.iDownlinkRate==req);
       
   166 	TESTL(aR99NotifyQoS.iBER==RPacketQoS::EBEROnePerHundred);
       
   167 	TESTL(aR99NotifyQoS.iSDUErrorRatio==RPacketQoS::ESDUErrorRatioOnePerTen);
       
   168 	TESTL(aR99NotifyQoS.iTrafficHandlingPriority==RPacketQoS::ETrafficPriority2);
       
   169 	TESTL(aR99NotifyQoS.iTransferDelay==min);
       
   170 	TESTL(aR99NotifyQoS.iGuaranteedRate.iUplinkRate==min);
       
   171 	TESTL(aR99NotifyQoS.iGuaranteedRate.iDownlinkRate==req);
       
   172 
       
   173 	//Gprs
       
   174 	TESTL(aGPRSNotifyQoS.ExtensionId()==TPacketDataConfigBase::KConfigGPRS);
       
   175 	TESTL(aGPRSNotifyQoS.iDelay == RPacketQoS::EDelayClass2);
       
   176 	TESTL(aGPRSNotifyQoS.iDelay == RPacketQoS::EDelayClass2);
       
   177 	TESTL(aGPRSNotifyQoS.iMeanThroughput == RPacketQoS::EMeanThroughput2000);
       
   178 	TESTL(aGPRSNotifyQoS.iPeakThroughput == RPacketQoS::EPeakThroughput64000);
       
   179 	TESTL(aGPRSNotifyQoS.iPrecedence == RPacketQoS::EPriorityMediumPrecedence);
       
   180 	TESTL(aGPRSNotifyQoS.iReliability == RPacketQoS::EReliabilityClass2);
       
   181 	
       
   182 	// Close
       
   183 	iGPRSPacketqos.Close();
       
   184 	iGPRSPacketContext.Close();
       
   185 	iGPRSPacketService.Close();
       
   186 	iRel99Packetqos.Close();
       
   187 	iRel99PacketContext.Close();
       
   188 	iRel99PacketService.Close();
       
   189 	iPhone.Close();
       
   190 	
       
   191 	ASSERT(RThread().RequestCount()==0);
       
   192 
       
   193 	return TestStepResult();
       
   194 	}
       
   195