telephonyserverplugins/simtsy/src/CSimPacketQoS.cpp
changeset 0 3553901f7fa8
child 24 6638e7f4bd8f
child 42 3adadc800673
equal deleted inserted replaced
-1:000000000000 0:3553901f7fa8
       
     1 // Copyright (c) 1997-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 "CSimPacketQoS.h"
       
    17 #include "CSimPhone.h"
       
    18 #include <pcktcs.h>
       
    19 #include "CSimPacketContext.h"
       
    20 #include "Simlog.h"
       
    21 #include "utils.h"
       
    22 #include "CSimPubSubChange.h"
       
    23 
       
    24 static const int KNumberofProfiles = 4;	//< Number chosen at random.  
       
    25 
       
    26 CSimPacketQoS* CSimPacketQoS::NewL(CSimPhone* aPhone, CSimPacketContext* aPacketContext)
       
    27 /**
       
    28 * Standard two phase constructor
       
    29 *
       
    30 * @param aPacketContext Pointer to the Packet Context object (CSimPacketContext)
       
    31 * @return CSimPacketQoS pointer to the packet QoS object created.
       
    32 * @leave Leaves if no memory or object is not created for any reason.
       
    33 */
       
    34 	{
       
    35 	CSimPacketQoS* qos=new(ELeave) CSimPacketQoS(aPhone, aPacketContext);
       
    36 	CleanupStack::PushL(qos);
       
    37 	qos->ConstructL();
       
    38 	CleanupStack::Pop();
       
    39 	return qos;
       
    40 	}
       
    41 
       
    42 void CSimPacketQoS::Init()
       
    43 	{}
       
    44 
       
    45 /**
       
    46 * Callback function for when timer expires. Note - this only gets called for Rel 99 profiles
       
    47 */
       
    48 void CSimPacketQoS::TimerCallBack(TInt aId)
       
    49 	{
       
    50 	switch(aId)
       
    51 		{
       
    52 		case ETimerIdPcktQosNetWork:
       
    53 			{
       
    54 			TProfileNegR99 profile = iQosNetworkNotifications->At(iQosNetworkNotificationCount);
       
    55 			CompleteNotifications(profile);
       
    56 			break;
       
    57 			}
       
    58 		case ETimerIdPcktQosR5Network:
       
    59 			{
       
    60 			TProfileNegR5 profile = iQosR5NetworkNotifications->At(iQosR5NetworkNotificationCount);
       
    61 			CompleteNotifications(profile);
       
    62 			break;
       
    63 			}
       
    64 		case ETimerIdPcktQoSSet:
       
    65  			{
       
    66  			SetProfile(iSetQoSData->At(0).iTsyReqHandle, iSetQoSData->At(0).iData);
       
    67  			iSetQoSData->Delete(0);
       
    68  			if (iSetQoSData->Count() != 0)
       
    69  				iSetQoSTimer->Start(iSetQoSDelay,this,ETimerIdPcktQoSSet);
       
    70  			break;	
       
    71  			}
       
    72 		}
       
    73 	}
       
    74 
       
    75 void CSimPacketQoS::PubSubCallback(TInt aProfileIndex)
       
    76 /**
       
    77  * Called by CSimQoSChange when a network QoS change request has been received.
       
    78  *
       
    79  * @param aProfileIndex index of the QoS profile to set
       
    80  */
       
    81 	{
       
    82 	if (iCurrentProfileRel == TPacketDataConfigBase::KConfigRel5)
       
    83 		{
       
    84 		TInt length = iQosR5NetworkNotifications->Count();
       
    85 		if (aProfileIndex < length)
       
    86 			{
       
    87 			TProfileNegR5& profile = iQosR5NetworkNotifications->At(aProfileIndex);
       
    88 			if (profile.iContextName.Compare(iPacketContext->ContextName()) == 0)
       
    89 				{
       
    90 				CompleteNotifications(profile);
       
    91 				}
       
    92 			}
       
    93 		}
       
    94 	else // by default, uses R99/R4 notification setup
       
    95 		{
       
    96 		TInt length = iQosNetworkNotifications->Count();
       
    97 		if (aProfileIndex < length)
       
    98 			{
       
    99 			TProfileNegR99& profile = iQosNetworkNotifications->At(aProfileIndex);
       
   100 			if (profile.iContextName.Compare(iPacketContext->ContextName()) == 0)
       
   101 				{
       
   102 				CompleteNotifications(profile);
       
   103 				}
       
   104 			}
       
   105 		}
       
   106 	}
       
   107 
       
   108 void CSimPacketQoS::CompleteNotifications(TProfileNegR99& aProfile)
       
   109 	{
       
   110 	if (MatchContext(aProfile)==KErrNone)
       
   111 		{
       
   112 		if (iNotifyProfileR99.iNotifyPending)
       
   113 			{
       
   114 			RPacketQoS::TQoSR99_R4Negotiated& qos = *(RPacketQoS::TQoSR99_R4Negotiated*)iNotifyProfileR99.iNotifyData;
       
   115 			qos.iBER = STATIC_CAST(RPacketQoS::TBitErrorRatio, aProfile.iNegTBitErrorRatio);
       
   116 			qos.iDeliverErroneousSDU = STATIC_CAST(RPacketQoS::TErroneousSDUDelivery, aProfile.iNegErroneousSDUDelivery);
       
   117 			qos.iDeliveryOrderReqd = STATIC_CAST(RPacketQoS::TDeliveryOrder, aProfile.iNegDeliveryOrder);
       
   118 	
       
   119 			qos.iGuaranteedRate.iUplinkRate = aProfile.iNegGuaranteedUpLinkBitRate;
       
   120 			qos.iGuaranteedRate.iDownlinkRate = aProfile.iNegGuaranteedDownLinkBitRate;
       
   121 			
       
   122 			qos.iMaxRate.iUplinkRate = aProfile.iNegMaxUpLinkRate;
       
   123 			qos.iMaxRate.iDownlinkRate = aProfile.iNegMaxDownLinkRate;
       
   124 			qos.iMaxSDUSize = aProfile.iNegMaxSDUSize;
       
   125 
       
   126 			qos.iSDUErrorRatio = STATIC_CAST(RPacketQoS::TSDUErrorRatio, aProfile.iNegTSDUErrorRatio);
       
   127 			qos.iTrafficClass = STATIC_CAST(RPacketQoS::TTrafficClass,aProfile.iNegTraffic);
       
   128 			qos.iTrafficHandlingPriority = STATIC_CAST(RPacketQoS::TTrafficHandlingPriority, aProfile.iNegTrafficHandlingPriority);
       
   129 			qos.iTransferDelay = aProfile.iNegTransferDelay;
       
   130 			
       
   131 			iNotifyProfileR99.iNotifyPending=EFalse;
       
   132 			ReqCompleted(iNotifyProfileR99.iNotifyHandle, KErrNone);
       
   133 			}
       
   134 		if (iNotifyProfileR5.iNotifyPending)
       
   135 			{
       
   136 			RPacketQoS::TQoSR5Negotiated& qos = *(RPacketQoS::TQoSR5Negotiated*)iNotifyProfileR5.iNotifyData;
       
   137 			qos.iBER = STATIC_CAST(RPacketQoS::TBitErrorRatio, aProfile.iNegTBitErrorRatio);
       
   138 			qos.iDeliverErroneousSDU = STATIC_CAST(RPacketQoS::TErroneousSDUDelivery, aProfile.iNegErroneousSDUDelivery);
       
   139 			qos.iDeliveryOrderReqd = STATIC_CAST(RPacketQoS::TDeliveryOrder, aProfile.iNegDeliveryOrder);
       
   140 	
       
   141 			qos.iGuaranteedRate.iUplinkRate = aProfile.iNegGuaranteedUpLinkBitRate;
       
   142 			qos.iGuaranteedRate.iDownlinkRate = aProfile.iNegGuaranteedDownLinkBitRate;
       
   143 			
       
   144 			qos.iMaxRate.iUplinkRate = aProfile.iNegMaxUpLinkRate;
       
   145 			qos.iMaxRate.iDownlinkRate = aProfile.iNegMaxDownLinkRate;
       
   146 			qos.iMaxSDUSize = aProfile.iNegMaxSDUSize;
       
   147 
       
   148 			qos.iSDUErrorRatio = STATIC_CAST(RPacketQoS::TSDUErrorRatio, aProfile.iNegTSDUErrorRatio);
       
   149 			qos.iTrafficClass = STATIC_CAST(RPacketQoS::TTrafficClass,aProfile.iNegTraffic);
       
   150 			qos.iTrafficHandlingPriority = STATIC_CAST(RPacketQoS::TTrafficHandlingPriority, aProfile.iNegTrafficHandlingPriority);
       
   151 			qos.iTransferDelay = aProfile.iNegTransferDelay;
       
   152 			qos.iSignallingIndication = EFalse;
       
   153 			qos.iSourceStatisticsDescriptor = RPacketQoS::ESourceStatisticsDescriptorUnknown;
       
   154 			
       
   155 			iNotifyProfileR5.iNotifyPending=EFalse;
       
   156 			ReqCompleted(iNotifyProfileR5.iNotifyHandle, KErrNone);
       
   157 			}
       
   158 		}
       
   159 	}
       
   160 
       
   161 void CSimPacketQoS::CompleteNotifications(TProfileNegR5& aProfile)
       
   162 	{
       
   163 	if (MatchContext(aProfile)==KErrNone)
       
   164 		{
       
   165 		if (iNotifyProfileR99.iNotifyPending)
       
   166 			{
       
   167 			RPacketQoS::TQoSR99_R4Negotiated& qos = *(RPacketQoS::TQoSR99_R4Negotiated*)iNotifyProfileR99.iNotifyData;
       
   168 			qos.iBER = STATIC_CAST(RPacketQoS::TBitErrorRatio, aProfile.iNegTBitErrorRatio);
       
   169 			qos.iDeliverErroneousSDU = STATIC_CAST(RPacketQoS::TErroneousSDUDelivery, aProfile.iNegErroneousSDUDelivery);
       
   170 			qos.iDeliveryOrderReqd = STATIC_CAST(RPacketQoS::TDeliveryOrder, aProfile.iNegDeliveryOrder);
       
   171 	
       
   172 			qos.iGuaranteedRate.iUplinkRate = aProfile.iNegGuaranteedUpLinkBitRate;
       
   173 			qos.iGuaranteedRate.iDownlinkRate = aProfile.iNegGuaranteedDownLinkBitRate;
       
   174 			
       
   175 			qos.iMaxRate.iUplinkRate = aProfile.iNegMaxUpLinkRate;
       
   176 			qos.iMaxRate.iDownlinkRate = aProfile.iNegMaxDownLinkRate;
       
   177 			qos.iMaxSDUSize = aProfile.iNegMaxSDUSize;
       
   178 
       
   179 			qos.iSDUErrorRatio = STATIC_CAST(RPacketQoS::TSDUErrorRatio, aProfile.iNegTSDUErrorRatio);
       
   180 			qos.iTrafficClass = STATIC_CAST(RPacketQoS::TTrafficClass,aProfile.iNegTraffic);
       
   181 			qos.iTrafficHandlingPriority = STATIC_CAST(RPacketQoS::TTrafficHandlingPriority, aProfile.iNegTrafficHandlingPriority);
       
   182 			qos.iTransferDelay = aProfile.iNegTransferDelay;
       
   183 			
       
   184 			iNotifyProfileR99.iNotifyPending=EFalse;
       
   185 			ReqCompleted(iNotifyProfileR99.iNotifyHandle, KErrNone);
       
   186 			}
       
   187 		if (iNotifyProfileR5.iNotifyPending)
       
   188 			{
       
   189 			RPacketQoS::TQoSR5Negotiated& qos = *(RPacketQoS::TQoSR5Negotiated*)iNotifyProfileR5.iNotifyData;
       
   190 			qos.iBER = STATIC_CAST(RPacketQoS::TBitErrorRatio, aProfile.iNegTBitErrorRatio);
       
   191 			qos.iDeliverErroneousSDU = STATIC_CAST(RPacketQoS::TErroneousSDUDelivery, aProfile.iNegErroneousSDUDelivery);
       
   192 			qos.iDeliveryOrderReqd = STATIC_CAST(RPacketQoS::TDeliveryOrder, aProfile.iNegDeliveryOrder);
       
   193 	
       
   194 			qos.iGuaranteedRate.iUplinkRate = aProfile.iNegGuaranteedUpLinkBitRate;
       
   195 			qos.iGuaranteedRate.iDownlinkRate = aProfile.iNegGuaranteedDownLinkBitRate;
       
   196 			
       
   197 			qos.iMaxRate.iUplinkRate = aProfile.iNegMaxUpLinkRate;
       
   198 			qos.iMaxRate.iDownlinkRate = aProfile.iNegMaxDownLinkRate;
       
   199 			qos.iMaxSDUSize = aProfile.iNegMaxSDUSize;
       
   200 
       
   201 			qos.iSDUErrorRatio = STATIC_CAST(RPacketQoS::TSDUErrorRatio, aProfile.iNegTSDUErrorRatio);
       
   202 			qos.iTrafficClass = STATIC_CAST(RPacketQoS::TTrafficClass,aProfile.iNegTraffic);
       
   203 			qos.iTrafficHandlingPriority = STATIC_CAST(RPacketQoS::TTrafficHandlingPriority, aProfile.iNegTrafficHandlingPriority);
       
   204 			qos.iTransferDelay = aProfile.iNegTransferDelay;
       
   205 			qos.iSignallingIndication = aProfile.iSignallingIndication;			
       
   206 			qos.iSourceStatisticsDescriptor = STATIC_CAST(RPacketQoS::TSourceStatisticsDescriptor, aProfile.iNegTSourceStatisticsDescriptor);
       
   207 
       
   208 			iNotifyProfileR5.iNotifyPending=EFalse;
       
   209 
       
   210 			ReqCompleted(iNotifyProfileR5.iNotifyHandle, KErrNone);
       
   211 			}
       
   212 		}
       
   213 
       
   214 	}
       
   215 
       
   216 CSimPacketQoS::CSimPacketQoS(CSimPhone* aPhone, CSimPacketContext* aPacketContext)
       
   217 	:iPhone(aPhone), iPacketContext(aPacketContext),iCurrentNeg(0), iCurrentNeg99(0), iCurrentNegR5(0),
       
   218 	iSetProfilePending(EFalse),	iCurrentProfileRel(TPacketDataConfigBase::KConfigGPRS), iSetProfileCallCount(0), 
       
   219 	iUseNetworkNotificationBool(EFalse), iTimerStartedBool(EFalse), iSetQoSData(NULL)
       
   220 	
       
   221 /**
       
   222 * Trivial Constructor.  Initialises all the data members
       
   223 *
       
   224 * @param aPacketContext Pointer to the Packet QoS object (CSimPacketContext)
       
   225 */
       
   226 	{
       
   227 	iNotifyProfileGPRS.iNotifyPending = EFalse;
       
   228 	iNotifyProfileR99.iNotifyPending = EFalse;
       
   229 	iNotifyProfileR5.iNotifyPending = EFalse;
       
   230 	}
       
   231 
       
   232 void CSimPacketQoS::ConstructL()
       
   233 /**
       
   234 * Second phase of the 2-phase constructor.
       
   235 * Constructs all the member data and retrieves all the data from the config file specific to this class.
       
   236 *
       
   237 * @leave Leaves no memory or any data member does not construct for any reason.
       
   238 */
       
   239 	{
       
   240 	LOGPACKET1("CSimPacketQoS: Entered constructor");
       
   241 	iQosNetworkNotificationCount = 0;
       
   242 	iQosR5NetworkNotificationCount = 0;
       
   243 
       
   244 	iTimer=CSimTimer::NewL(iPhone);
       
   245 	iSetQoSData = new (ELeave) CArrayFixFlat<TSetQoSData>(1);
       
   246  	iSetQoSTimer = CSimTimer::NewL(iPhone);
       
   247 	iSimQoSChange = CSimPubSubChange::NewL(this, CSimPubSub::TPubSubProperty(KUidPSSimTsyCategory, KPSSimTsyNetworkQoSChange, KPSSimTsyNetworkQoSChangeKeyType));
       
   248 	
       
   249 	LOGPACKET1("Starting to Load and Parse Packet Qos Config File");
       
   250 
       
   251 	GetGPRSReqProfilesL();
       
   252 	GetGPRSNegProfilesL();
       
   253 	GetR99ReqProfilesL();
       
   254 	GetR99NegProfilesL();
       
   255 	GetR99NetworkNotificationsL();
       
   256 	GetR5ReqProfilesL();
       
   257 	GetR5NegProfilesL();
       
   258 	GetR5NetworkNotificationsL();
       
   259 	GetGPRSQosProfileCaps();
       
   260 	GetR99QosProfileCaps();
       
   261 	GetR5QosProfileCaps();
       
   262 	GetProfileFailSettings();
       
   263 	GetSetQoSSettings();
       
   264 
       
   265 	LOGPACKET1("...Finished parsing Packet qos config parameters...");
       
   266 	}
       
   267 
       
   268 void CSimPacketQoS::GetGPRSReqProfilesL()
       
   269 	{
       
   270 	TProfileConfig profile;
       
   271 	TUint8 digit = 0;
       
   272 
       
   273 	iProfiles = new(ELeave) CArrayFixFlat<TProfileConfig>(KNumberofProfiles);
       
   274 
       
   275 	TInt count = iPacketContext->CfgFile()->ItemCount(KQosProfileReqGPRS);
       
   276 	
       
   277 	//< Read in all the data for setting GPRS Requested Profile parameters
       
   278 	for(TInt i = 0; i < count; i++)
       
   279 		{
       
   280 		const CTestConfigItem *item = iPacketContext->CfgFile()->Item(KQosProfileReqGPRS,i);
       
   281 		if(!item)
       
   282 			break;
       
   283 
       
   284 		TPtrC8 minPrecedence, reqPrecedence, minDelay, reqDelay, minPeek, reqPeek;
       
   285 		TPtrC8 minReliability, reqReliability, minMean, reqMean;
       
   286 
       
   287 		TInt ret = CTestConfig::GetElement(item->Value(),KStdDelimiter,0,minPrecedence);
       
   288 		if(ret!=KErrNone)
       
   289 			{
       
   290 			LOGPARSERR("QosProfileReqGPRS::minPrecedence",ret,0,&KQosProfileReqGPRS);
       
   291 			continue;
       
   292 			}
       
   293 		else
       
   294 			{
       
   295 			if(AsciiToNum(minPrecedence, digit)==KErrNone)
       
   296 				profile.iMinPrecedence = digit;
       
   297 			}
       
   298 
       
   299 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,1,reqPrecedence);
       
   300 		if(ret!=KErrNone)
       
   301 			{
       
   302 			LOGPARSERR("QosProfileReqGPRS::reqPrecedence",ret,1,&KQosProfileReqGPRS);
       
   303 			continue;
       
   304 			}
       
   305 		else
       
   306 			{
       
   307 			if(AsciiToNum(reqPrecedence, digit)==KErrNone)
       
   308 				profile.iReqPrecedence = digit;
       
   309 			}
       
   310 
       
   311 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,2,minDelay);
       
   312 		if(ret!=KErrNone)
       
   313 			{
       
   314 			LOGPARSERR("QosProfileReqGPRS::minDelay",ret,2,&KQosProfileReqGPRS);
       
   315 			continue;
       
   316 			}
       
   317 		else
       
   318 			{
       
   319 			if(AsciiToNum(minDelay, digit)==KErrNone)
       
   320 				profile.iMinDelay = digit;
       
   321 			}
       
   322 
       
   323 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,3,reqDelay);
       
   324 		if(ret!=KErrNone)
       
   325 			{
       
   326 			LOGPARSERR("QosProfileReqGPRS::reqDelay",ret,3,&KQosProfileReqGPRS);
       
   327 			continue;
       
   328 			}
       
   329 		else
       
   330 			{
       
   331 			if(AsciiToNum(reqDelay, digit)==KErrNone)
       
   332 				profile.iReqDelay = digit;
       
   333 			}
       
   334 
       
   335 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,4,minReliability);
       
   336 		if(ret!=KErrNone)
       
   337 			{
       
   338 			LOGPARSERR("QosProfileReqGPRS::minReliability",ret,4,&KQosProfileReqGPRS);
       
   339 			continue;
       
   340 			}
       
   341 		else
       
   342 			{
       
   343 			if(AsciiToNum(minReliability, digit)==KErrNone)
       
   344 				profile.iMinReliability = digit;
       
   345 			}
       
   346 
       
   347 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,5,reqReliability);
       
   348 		if(ret!=KErrNone)
       
   349 			{
       
   350 			LOGPARSERR("QosProfileReqGPRS::reqReliability",ret,5,&KQosProfileReqGPRS);
       
   351 			continue;
       
   352 			}
       
   353 		else
       
   354 			{
       
   355 			if(AsciiToNum(reqReliability, digit)==KErrNone)
       
   356 				profile.iReqReliability = digit;
       
   357 			}
       
   358 
       
   359 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,6,minPeek);
       
   360 		if(ret!=KErrNone)
       
   361 			{
       
   362 			LOGPARSERR("QosProfileReqGPRS::minPeek",ret,6,&KQosProfileReqGPRS);
       
   363 			continue;
       
   364 			}
       
   365 		else
       
   366 			{
       
   367 			if(AsciiToNum(minPeek, digit)==KErrNone)
       
   368 				profile.iMinPeekThroughput = digit;
       
   369 			}
       
   370 
       
   371 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,7,reqPeek);
       
   372 		if(ret!=KErrNone)
       
   373 			{
       
   374 			LOGPARSERR("QosProfileReqGPRS::reqPeek",ret,7,&KQosProfileReqGPRS);
       
   375 			continue;
       
   376 			}
       
   377 		else
       
   378 			{
       
   379 			if(AsciiToNum(reqPeek, digit)==KErrNone)
       
   380 				profile.iReqPeekThroughput = digit;
       
   381 			}
       
   382 
       
   383 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,8,minMean);
       
   384 		if(ret!=KErrNone)
       
   385 			{
       
   386 			LOGPARSERR("QosProfileReqGPRS::minMean",ret,8,&KQosProfileReqGPRS);
       
   387 			continue;
       
   388 			}
       
   389 		else
       
   390 			{
       
   391 			if(AsciiToNum(minMean, digit)==KErrNone)
       
   392 				profile.iMinMeanThroughput = digit;
       
   393 			}
       
   394 
       
   395 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,9,reqMean);
       
   396 		if(ret!=KErrNone)
       
   397 			{
       
   398 			LOGPARSERR("QosProfileReqGPRS::reqMean",ret,9,&KQosProfileReqGPRS);
       
   399 			continue;
       
   400 			}
       
   401 		else
       
   402 			{
       
   403 			if(AsciiToNum(reqMean, digit)==KErrNone)
       
   404 				profile.iReqMeanThroughput = digit;
       
   405 			}
       
   406 
       
   407 		iProfiles->AppendL(profile);
       
   408 		}
       
   409 	}
       
   410 	
       
   411 void CSimPacketQoS::GetGPRSNegProfilesL()
       
   412 	{
       
   413 	TNegProfileConfig negProfile;
       
   414 	TUint8 digit = 0;
       
   415 
       
   416 	iNegProfiles = new(ELeave) CArrayFixFlat<TNegProfileConfig>(KNumberofProfiles);
       
   417 
       
   418 
       
   419 	TInt count = iPacketContext->CfgFile()->ItemCount(KQosProfileNegGPRS);
       
   420 	//< Read in all the data for setting GPRS Negotiated Profile parameters
       
   421 	for(TInt i = 0; i < count; i++)
       
   422 		{
       
   423 		const CTestConfigItem* item = iPacketContext->CfgFile()->Item(KQosProfileNegGPRS,i);
       
   424 		if(!item)
       
   425 			break;
       
   426 
       
   427 		TPtrC8 negPrecedence, negDelay, negPeek, negReliability, negMean;
       
   428 
       
   429 		TInt ret = CTestConfig::GetElement(item->Value(),KStdDelimiter,0,negPrecedence);
       
   430 		if(ret!=KErrNone)
       
   431 			{
       
   432 			LOGPARSERR("QosProfileReqGPRS::negPrecedence",ret,0,&KQosProfileNegGPRS);
       
   433 			continue;
       
   434 			}
       
   435 		else
       
   436 			if(AsciiToNum(negPrecedence, digit)==KErrNone)
       
   437 				negProfile.iNegPrecedence = digit;
       
   438 
       
   439 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,1,negDelay);
       
   440 		if(ret!=KErrNone)
       
   441 			{
       
   442 			LOGPARSERR("QosProfileReqGPRS::negDelay",ret,1,&KQosProfileNegGPRS);
       
   443 			continue;
       
   444 			}
       
   445 		else
       
   446 			if(AsciiToNum(negDelay, digit)==KErrNone)
       
   447 				negProfile.iNegDelay = digit;
       
   448 
       
   449 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,2,negReliability);
       
   450 		if(ret!=KErrNone)
       
   451 			{
       
   452 			LOGPARSERR("QosProfileReqGPRS::negReliability",ret,2,&KQosProfileNegGPRS);
       
   453 			continue;
       
   454 			}
       
   455 		else
       
   456 			if(AsciiToNum(negReliability, digit)==KErrNone)
       
   457 				negProfile.iNegReliability = digit;
       
   458 
       
   459 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,3,negPeek);
       
   460 		if(ret!=KErrNone)
       
   461 			{
       
   462 			LOGPARSERR("QosProfileReqGPRS::negPeek",ret,3,&KQosProfileNegGPRS);
       
   463 			continue;
       
   464 			}
       
   465 		else
       
   466 			if(AsciiToNum(negPeek, digit)==KErrNone)
       
   467 				negProfile.iNegPeekThroughput = digit;
       
   468 
       
   469 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,4,negMean);
       
   470 		if(ret!=KErrNone)
       
   471 			{
       
   472 			LOGPARSERR("QosProfileReqGPRS::negMean",ret,4,&KQosProfileNegGPRS);
       
   473 			continue;
       
   474 			}
       
   475 		else
       
   476 			if(AsciiToNum(negMean, digit)==KErrNone)
       
   477 				negProfile.iNegMeanThroughput = digit;
       
   478 
       
   479 		iNegProfiles->AppendL(negProfile);
       
   480 		}
       
   481 	}
       
   482 	
       
   483 	
       
   484 void CSimPacketQoS::GetR99ReqProfilesL()
       
   485 	{
       
   486 	TProfileReqR99 profileReq99;
       
   487 	TUint8 digit = 0;
       
   488 
       
   489 	iReqR99Profiles = new(ELeave) CArrayFixFlat<TProfileReqR99>(KNumberofProfiles);
       
   490 
       
   491 	// parse Release Rel99 profile parameters
       
   492 	TInt count = iPacketContext->CfgFile()->ItemCount(KQosProfileReqR99);
       
   493 	
       
   494 	for(TInt i = 0; i < count; i++)
       
   495 		{
       
   496 		const CTestConfigItem* item = iPacketContext->CfgFile()->Item(KQosProfileReqR99,i);
       
   497 		if(!item)
       
   498 			break;
       
   499 
       
   500 		// continue to load item's parameters
       
   501 		TPtrC8 contextName, reqTraffic, minTraffic, reqDeliveryOrder, minDeliveryOrder;
       
   502 		TPtrC8 reqErroneousSDU, minErroneousSDU;
       
   503 		TInt minUpLinkBitRate, minDownLinkBitRate, reqUpLinkBitRate, reqDownLinkBitRate;
       
   504 		TInt maxSDUSize, minSDUSize;
       
   505 		TPtrC8 reqBitErrorRatio, minBitErrorRatio, reqSDUErrorRatio, minSDUErrorRatio;
       
   506 		TPtrC8 reqTrafficHandlingPriority, minTrafficHandlingPriority;
       
   507 		TInt reqTransferDelay, minTransferDelay, reqGuaranteedUpLinkBitRate, reqGuaranteedDownLinkBitRate;
       
   508 		TInt minGuaranteedUpLinkBitRate, minGuaranteedDownLinkBitRate;
       
   509 
       
   510 		TInt ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,0,contextName);
       
   511 		if(ret!=KErrNone)
       
   512 			{
       
   513 			LOGPARSERR("QosProfileReqR99::contextName",ret,0,KQosProfileReqR99);
       
   514 			continue;
       
   515 			}
       
   516 		else 
       
   517 			{
       
   518 			profileReq99.iContextName.Copy(contextName);
       
   519 			if (profileReq99.iContextName.Match(iPacketContext->ContextName())==KErrNotFound)
       
   520 				{
       
   521 				LOGPARSERR("QosProfileReqR99::contextName",KErrArgument,0,&KQosProfileReqR99);
       
   522 				continue;
       
   523 				}
       
   524 			}
       
   525 
       
   526 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,1,reqTraffic);
       
   527 		if(ret!=KErrNone)
       
   528 			{
       
   529 			LOGPARSERR("QosProfileReqR99::reqTraffic",ret,1,&KQosProfileReqR99);
       
   530 			continue;
       
   531 			}
       
   532 		else 
       
   533 			{
       
   534 			if(AsciiToNum(reqTraffic, digit)==KErrNone)
       
   535 				{
       
   536 				profileReq99.iReqTraffic=digit;
       
   537 				}
       
   538 			}
       
   539 
       
   540 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,2,minTraffic);
       
   541 		if(ret!=KErrNone)
       
   542 			{
       
   543 			LOGPARSERR("QosProfileReqR99::minTraffic",ret,2,&KQosProfileReqR99);
       
   544 			continue;
       
   545 			}
       
   546 		else 
       
   547 			{
       
   548 			if(AsciiToNum(minTraffic, digit)==KErrNone)
       
   549 				{
       
   550 				profileReq99.iMinTraffic=digit;
       
   551 				}
       
   552 			}
       
   553 
       
   554 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,3,reqDeliveryOrder);
       
   555 		if(ret!=KErrNone)
       
   556 			{
       
   557 			LOGPARSERR("QosProfileReqR99::reqDeliveryOrder",ret,3,&KQosProfileReqR99);
       
   558 			continue;
       
   559 			}
       
   560 		else 
       
   561 			{
       
   562 			if(AsciiToNum(reqDeliveryOrder, digit)==KErrNone)
       
   563 				{
       
   564 				profileReq99.iReqDeliveryOrder=digit;
       
   565 				}
       
   566 			}
       
   567 
       
   568 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,4,minDeliveryOrder);
       
   569 		if(ret!=KErrNone)
       
   570 			{
       
   571 			LOGPARSERR("QosProfileReqR99::minDeliveryOrder",ret,4,&KQosProfileReqR99);
       
   572 			continue;
       
   573 			}
       
   574 		else 
       
   575 			{
       
   576 			if(AsciiToNum(minDeliveryOrder, digit)==KErrNone)
       
   577 				{
       
   578 				profileReq99.iMinDeliveryOrder=digit;
       
   579 				}
       
   580 			}
       
   581 
       
   582 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,5,reqErroneousSDU);
       
   583 		if(ret!=KErrNone)
       
   584 			{
       
   585 			LOGPARSERR("QosProfileReqR99::reqErroneousSDU",ret,5,&KQosProfileReqR99);
       
   586 			continue;
       
   587 			}
       
   588 		else 
       
   589 			{
       
   590 			if(AsciiToNum(reqErroneousSDU, digit)==KErrNone)
       
   591 				{
       
   592 				profileReq99.iReqErroneousSDU=digit;
       
   593 				}
       
   594 			}
       
   595 
       
   596 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,6,minErroneousSDU);
       
   597 		if(ret!=KErrNone)
       
   598 			{
       
   599 			LOGPARSERR("QosProfileReqR99::minErroneousSDU",ret,6,&KQosProfileReqR99);
       
   600 			continue;
       
   601 			}
       
   602 		else 
       
   603 			{
       
   604 			if(AsciiToNum(minErroneousSDU, digit)==KErrNone)
       
   605 				{
       
   606 				profileReq99.iMinErroneousSDU=digit;
       
   607 				}
       
   608 			}
       
   609 
       
   610 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,7,maxSDUSize);
       
   611 		if(ret!=KErrNone)
       
   612 			{
       
   613 			LOGPARSERR("QosProfileReqR99::maxSDUSize",ret,7,&KQosProfileReqR99);
       
   614 			continue;
       
   615 			}
       
   616 		else 
       
   617 			{
       
   618 			profileReq99.iMaxSDUSize=maxSDUSize;
       
   619 			}
       
   620 
       
   621 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,8,minSDUSize);
       
   622 		if(ret!=KErrNone)
       
   623 			{
       
   624 			LOGPARSERR("QosProfileReqR99::minSDUSize",ret,8,&KQosProfileReqR99);
       
   625 			continue;
       
   626 			}
       
   627 		else 
       
   628 			{
       
   629 			profileReq99.iMinSDUSize=minSDUSize;
       
   630 			}
       
   631 
       
   632 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,9,reqUpLinkBitRate);
       
   633 		if(ret!=KErrNone)
       
   634 			{
       
   635 			LOGPARSERR("QosProfileReqR99::reqUpLinkBitRate",ret,9,&KQosProfileReqR99);
       
   636 			continue;
       
   637 			}
       
   638 		else 
       
   639 			{
       
   640 			profileReq99.iReqUpLinkTBitRate=reqUpLinkBitRate;
       
   641 			}
       
   642 
       
   643 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,10,reqDownLinkBitRate);
       
   644 		if(ret!=KErrNone)
       
   645 			{
       
   646 			LOGPARSERR("QosProfileReqR99::reqDownLinkBitRate",ret,10,&KQosProfileReqR99);
       
   647 			continue;
       
   648 			}
       
   649 		else 
       
   650 			{
       
   651 			profileReq99.iReqDownLinkTBitRate= reqDownLinkBitRate;
       
   652 			}
       
   653 
       
   654 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,11,minUpLinkBitRate);
       
   655 		if(ret!=KErrNone)
       
   656 			{
       
   657 			LOGPARSERR("QosProfileReqR99::minUpLinkBitRate",ret,11,&KQosProfileReqR99);
       
   658 			continue;
       
   659 			}
       
   660 		else 
       
   661 			{
       
   662 			profileReq99.iMinUpLinkTBitRate= minUpLinkBitRate;
       
   663 			}
       
   664 
       
   665 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,12,minDownLinkBitRate);
       
   666 		if(ret!=KErrNone)
       
   667 			{
       
   668 			continue;
       
   669 			}
       
   670 		else 
       
   671 			{
       
   672 			profileReq99.iMinDownLinkTBitRate= minDownLinkBitRate;
       
   673 			}
       
   674 
       
   675 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,13,reqBitErrorRatio);
       
   676 		if(ret!=KErrNone)
       
   677 			{
       
   678 			LOGPARSERR("QosProfileReqR99::reqBitErrorRatio",ret,13,&KQosProfileReqR99);
       
   679 			continue;
       
   680 			}
       
   681 		else 
       
   682 			{
       
   683 			if(AsciiToNum(reqBitErrorRatio, digit)==KErrNone)
       
   684 				{
       
   685 				profileReq99.iReqTBitErrorRatio=digit;
       
   686 				}
       
   687 			}
       
   688 
       
   689 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,14,minBitErrorRatio);
       
   690 		if(ret!=KErrNone)
       
   691 			{
       
   692 			LOGPARSERR("QosProfileReqR99::minBitErrorRatio",ret,14,&KQosProfileReqR99);
       
   693 			continue;
       
   694 			}
       
   695 		else 
       
   696 			{
       
   697 			if(AsciiToNum(minBitErrorRatio, digit)==KErrNone)
       
   698 				{
       
   699 				profileReq99.iMinTBitErrorRatio=digit;
       
   700 				}
       
   701 			}
       
   702 
       
   703 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,15,reqSDUErrorRatio);
       
   704 		if(ret!=KErrNone)
       
   705 			{
       
   706 			LOGPARSERR("- QosProfileReqR99::reqSDUErrorRatio",ret,15,&KQosProfileReqR99);
       
   707 			continue;
       
   708 			}
       
   709 		else 
       
   710 			{
       
   711 			if(AsciiToNum(reqSDUErrorRatio, digit)==KErrNone)
       
   712 				{
       
   713 				profileReq99.iReqTSDUErrorRatio=digit;
       
   714 				}
       
   715 			}
       
   716 
       
   717 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,16,minSDUErrorRatio);
       
   718 		if(ret!=KErrNone)
       
   719 			{
       
   720 			LOGPARSERR("- QosProfileReqR99::minSDUErrorRatio",ret,16,&KQosProfileReqR99);
       
   721 			continue;
       
   722 			}
       
   723 		else 
       
   724 			{
       
   725 			if(AsciiToNum(minSDUErrorRatio, digit)==KErrNone)
       
   726 				{
       
   727  				profileReq99.iMinTSDUErrorRatio=digit;
       
   728 				}
       
   729 			}
       
   730 
       
   731 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,17,reqTrafficHandlingPriority);
       
   732 		if(ret!=KErrNone)
       
   733 			{
       
   734 			LOGPARSERR("QosProfileReqR99::reqTrafficHandlingPriority",ret,17,&KQosProfileReqR99);
       
   735 			continue;
       
   736 			}
       
   737 		else 
       
   738 			{
       
   739 			if(AsciiToNum(reqTrafficHandlingPriority, digit)==KErrNone)
       
   740 				{
       
   741 				profileReq99.iReqTTrafficHandlingPriority=digit;
       
   742 				}
       
   743 			}
       
   744 
       
   745 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,18,minTrafficHandlingPriority);
       
   746 		if(ret!=KErrNone)
       
   747 			{
       
   748 			LOGPARSERR("QosProfileReqR99::minTrafficHandlingPriority",ret,18,&KQosProfileReqR99);
       
   749 			continue;
       
   750 			}
       
   751 		else 
       
   752 			{
       
   753 			if(AsciiToNum(minTrafficHandlingPriority, digit)==KErrNone)
       
   754 				{
       
   755 				profileReq99.iMinTTrafficHandlingPriority=digit;
       
   756 				}
       
   757 			}
       
   758 
       
   759 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,19,reqTransferDelay);
       
   760 		if(ret!=KErrNone)
       
   761 			{
       
   762 			LOGPARSERR("QosProfileReqR99::reqTransferDelay",ret,19,&KQosProfileReqR99);
       
   763 			continue;
       
   764 			}
       
   765 		else 
       
   766 			{
       
   767 			profileReq99.iReqTransferDelay= reqTransferDelay;
       
   768 			}
       
   769 
       
   770 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,20,minTransferDelay);
       
   771 		if(ret!=KErrNone)
       
   772 			{
       
   773 			LOGPARSERR("QosProfileReqR99::minTransferDelay",ret,20,&KQosProfileReqR99);
       
   774 			continue;
       
   775 			}
       
   776 		else 
       
   777 			{
       
   778 			profileReq99.iMinTransferDelay= minTransferDelay;
       
   779 			}
       
   780 
       
   781 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,21,reqGuaranteedUpLinkBitRate);
       
   782 		if(ret!=KErrNone)
       
   783 			{
       
   784 			LOGPARSERR("QosProfileReqR99::reqGuaranteedUpLinkBitRate",ret,21,&KQosProfileReqR99);
       
   785 			continue;
       
   786 			}
       
   787 		else 
       
   788 			{
       
   789 			profileReq99.iReqGuaranteedUpLinkTBitRate= reqGuaranteedUpLinkBitRate;
       
   790 			}
       
   791 
       
   792 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,22,reqGuaranteedDownLinkBitRate);
       
   793 		if(ret!=KErrNone)
       
   794 			{
       
   795 			LOGPARSERR("QosProfileReqR99::reqGuaranteedDownLinkBitRate",ret,22,&KQosProfileReqR99);
       
   796 			continue;
       
   797 			}
       
   798 		else 
       
   799 			{
       
   800 			profileReq99.iReqGuaranteedDownLinkTBitRate= reqGuaranteedDownLinkBitRate;
       
   801 			}
       
   802 
       
   803 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,23,minGuaranteedUpLinkBitRate);
       
   804 		if(ret!=KErrNone)
       
   805 			{
       
   806 			LOGPARSERR("QosProfileReqR99::minGuaranteedUpLinkBitRate",ret,23,&KQosProfileReqR99);
       
   807 			continue;
       
   808 			}
       
   809 		else 
       
   810 			{
       
   811 			profileReq99.iMinGuaranteedUpLinkTBitRate= minGuaranteedUpLinkBitRate;
       
   812 			}
       
   813 
       
   814 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,24,minGuaranteedDownLinkBitRate);
       
   815 		if(ret!=KErrNone)
       
   816 			{
       
   817 			LOGPARSERR("QosProfileReqR99::minGuaranteedDownLinkBitRate",ret,24,&KQosProfileReqR99);
       
   818 			continue;
       
   819 			}
       
   820 		else 
       
   821 			{
       
   822 			profileReq99.iMinGuaranteedDownLinkTBitRate= minGuaranteedDownLinkBitRate;
       
   823 			}
       
   824 
       
   825 		iReqR99Profiles->AppendL(profileReq99);
       
   826 		}
       
   827 	}
       
   828 	
       
   829 void CSimPacketQoS::GetR99NegProfilesL()
       
   830 	{
       
   831 	TProfileNegR99 profileNeg99;
       
   832 	TUint8 digit = 0;
       
   833 
       
   834 	iNegR99Profiles = new(ELeave) CArrayFixFlat<TProfileNegR99>(KNumberofProfiles);
       
   835 
       
   836 	// parse Negotiated Rel99 profile parameters
       
   837 	TInt count = iPacketContext->CfgFile()->ItemCount(KQosProfileNegR99);
       
   838 	for(TInt i = 0; i < count; i++)
       
   839 		{
       
   840 		const CTestConfigItem* item = iPacketContext->CfgFile()->Item(KQosProfileNegR99,i);
       
   841 		if(!item)
       
   842 			break;
       
   843 	
       
   844 		TPtrC8 contextName, duration, negTraffic, negDeliveryOrder, negErroneousSDUDelivery;
       
   845 		TPtrC8 negBitErrorRatio, negSDUErrorRatio, negTrafficHandlingPriority;
       
   846 		TInt negTransferDelay, negGuaranteedUpLinkBitRate, negGuaranteedDownLinkBitRate;
       
   847 		TInt negMaxUpLinkRate, negMaxDownLinkRate, negMaxSDUSize;
       
   848 		 
       
   849 		TInt ret = CTestConfig::GetElement(item->Value(),KStdDelimiter,0,contextName);
       
   850 		if(ret!=KErrNone)
       
   851 			{
       
   852 			LOGPARSERR("QosProfileNegR99::contextName",ret,0,&KQosProfileNegR99);
       
   853 			continue;
       
   854 			}
       
   855 		else
       
   856 			{
       
   857 			profileNeg99.iContextName.Copy(contextName);
       
   858 			if (profileNeg99.iContextName.Match(iPacketContext->ContextName())==KErrNotFound)
       
   859 				{
       
   860 				LOGPARSERR("QosProfileNegR99::contextName",KErrArgument,0,&KQosProfileNegR99);
       
   861 				continue;
       
   862 				}
       
   863 			}
       
   864 
       
   865 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,1,duration);
       
   866 		if(ret!=KErrNone)
       
   867 			{
       
   868 			LOGPARSERR("QosProfileNegR99::duration",ret,1,&KQosProfileNegR99);
       
   869 			continue;
       
   870 			}
       
   871 		else
       
   872 			{
       
   873 			if(AsciiToNum(duration, digit)==KErrNone)
       
   874 				profileNeg99.iDuration = digit;
       
   875 			}
       
   876 
       
   877 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,2,negTraffic);
       
   878 		if(ret!=KErrNone)
       
   879 			{
       
   880 			LOGPARSERR("QosProfileNegR99::negTraffic",ret,2,&KQosProfileNegR99);
       
   881 			continue;
       
   882 			}
       
   883 		else
       
   884 			{
       
   885 			if(AsciiToNum(negTraffic, digit)==KErrNone)
       
   886 				profileNeg99.iNegTraffic = digit;
       
   887 			}
       
   888 
       
   889 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,3,negDeliveryOrder);
       
   890 		if(ret!=KErrNone)
       
   891 			{
       
   892 			LOGPARSERR("QosProfileNegR99::negDeliveryOrder",ret,3,&KQosProfileNegR99);
       
   893 			continue;
       
   894 			}
       
   895 		else
       
   896 			{
       
   897 			if(AsciiToNum(negDeliveryOrder, digit)==KErrNone)
       
   898 				profileNeg99.iNegDeliveryOrder = digit;
       
   899 			}
       
   900 
       
   901 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,4,negErroneousSDUDelivery);
       
   902 		if(ret!=KErrNone)
       
   903 			{
       
   904 			LOGPARSERR("QosProfileNegR99::negErroneousSDUDelivery",ret,4,&KQosProfileNegR99);
       
   905 			continue;
       
   906 			}
       
   907 		else
       
   908 			{
       
   909 			if(AsciiToNum(negErroneousSDUDelivery, digit)==KErrNone)
       
   910 				profileNeg99.iNegErroneousSDUDelivery = digit;
       
   911 			}
       
   912 
       
   913 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,5,negMaxSDUSize);
       
   914 		if(ret!=KErrNone)
       
   915 			{
       
   916 			LOGPARSERR("QosProfileNegR99::negMaxSDUSize",ret,5,&KQosProfileNegR99);
       
   917 			continue;
       
   918 			}
       
   919 		else
       
   920 			{
       
   921 			profileNeg99.iNegMaxSDUSize =  negMaxSDUSize;
       
   922 			}
       
   923 
       
   924 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,6,negBitErrorRatio);
       
   925 		if(ret!=KErrNone)
       
   926 			{
       
   927 			LOGPARSERR("QosProfileNegR99::negBitErrorRatio",ret,6,&KQosProfileNegR99);
       
   928 			continue;
       
   929 			}
       
   930 		else
       
   931 			{
       
   932 			if(AsciiToNum(negBitErrorRatio, digit)==KErrNone)
       
   933 				profileNeg99.iNegTBitErrorRatio = digit;
       
   934 			}
       
   935 
       
   936 		
       
   937 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,7,negSDUErrorRatio);
       
   938 		if(ret!=KErrNone)
       
   939 			{
       
   940 			LOGPARSERR("QosProfileNegR99::negSDUErrorRatio",ret,7,&KQosProfileNegR99);
       
   941 			continue;
       
   942 			}
       
   943 		else
       
   944 			{
       
   945 			if(AsciiToNum(negSDUErrorRatio, digit)==KErrNone)
       
   946 				profileNeg99.iNegTSDUErrorRatio = digit;
       
   947 			}
       
   948 
       
   949 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,8,negTrafficHandlingPriority);
       
   950 		if(ret!=KErrNone)
       
   951 			{
       
   952 			LOGPARSERR("QosProfileNegR99::negTrafficHandlingPriority",ret,8,&KQosProfileNegR99);
       
   953 			continue;
       
   954 			}
       
   955 		else
       
   956 			{
       
   957 			if(AsciiToNum(negTrafficHandlingPriority, digit)==KErrNone)
       
   958 				profileNeg99.iNegTrafficHandlingPriority = digit;
       
   959 			}
       
   960 
       
   961 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,9,negTransferDelay);
       
   962 		if(ret!=KErrNone)
       
   963 			{
       
   964 			LOGPARSERR("QosProfileNegR99::negTransferDelay",ret,9,&KQosProfileNegR99);
       
   965 			continue;
       
   966 			}
       
   967 		else
       
   968 			{
       
   969 			profileNeg99.iNegTransferDelay =  negTransferDelay;
       
   970 			}
       
   971 
       
   972 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,10,negGuaranteedUpLinkBitRate);
       
   973 		if(ret!=KErrNone)
       
   974 			{
       
   975 			LOGPARSERR("QosProfileNegR99::negGuaranteedUpLinkBitRate",ret,10,&KQosProfileNegR99);
       
   976 			continue;
       
   977 			}
       
   978 		else
       
   979 			{
       
   980 			profileNeg99.iNegGuaranteedUpLinkBitRate =  negGuaranteedUpLinkBitRate;
       
   981 			}
       
   982 
       
   983 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,11,negGuaranteedDownLinkBitRate);
       
   984 		if(ret!=KErrNone)
       
   985 			{
       
   986 			LOGPARSERR("QosProfileNegR99::negGuaranteedDownLinkBitRate",ret,11,&KQosProfileNegR99);
       
   987 			continue;
       
   988 			}
       
   989 		else
       
   990 			{
       
   991 			profileNeg99.iNegGuaranteedDownLinkBitRate =  negGuaranteedDownLinkBitRate;
       
   992 			}
       
   993 
       
   994 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,12,negMaxUpLinkRate);
       
   995 		if(ret!=KErrNone)
       
   996 			{
       
   997 			LOGPARSERR("QosProfileNegR99::negMaxUpLinkRate",ret,12,&KQosProfileNegR99);
       
   998 			continue;
       
   999 			}
       
  1000 		else
       
  1001 			{
       
  1002 			profileNeg99.iNegMaxUpLinkRate =  negMaxUpLinkRate;
       
  1003 			}
       
  1004 
       
  1005 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,13,negMaxDownLinkRate);
       
  1006 		if(ret!=KErrNone)
       
  1007 			{
       
  1008 			LOGPARSERR("QosProfileNegR99::negMaxDownLinkRate",ret,13,&KQosProfileNegR99);
       
  1009 			continue;
       
  1010 			}
       
  1011 		else
       
  1012 			{
       
  1013 			profileNeg99.iNegMaxDownLinkRate =  negMaxDownLinkRate;
       
  1014 			}
       
  1015 
       
  1016 		iNegR99Profiles->AppendL(profileNeg99);
       
  1017 		}
       
  1018 	}
       
  1019 	
       
  1020 void CSimPacketQoS::GetR99NetworkNotificationsL()
       
  1021 	{
       
  1022 	TInt ret;
       
  1023 	TUint8 digit = 0;
       
  1024 	
       
  1025 	iQosNetworkNotifications = new(ELeave) CArrayFixFlat<TProfileNegR99>(KNumberofProfiles);
       
  1026 
       
  1027 	// parse the Qos Network Notification parameters
       
  1028 	iNetworkNotificationType = ETimer;
       
  1029 	const CTestConfigItem* item = iPacketContext->CfgFile()->Item(KQosNetworkNotificationType);
       
  1030 	if (item)
       
  1031 		{
       
  1032 		TPtrC8 networkNotificationType;
       
  1033 		ret = CTestConfig::GetElement(item->Value(),KStdDelimiter,0,networkNotificationType);
       
  1034 		if(ret==KErrNone && networkNotificationType.Compare(KNotificationTypePublishSubscribe)==0)
       
  1035 			{
       
  1036 			iNetworkNotificationType = EPublishAndSubscribe;
       
  1037 			}
       
  1038 		}
       
  1039 		
       
  1040 	TInt count=iPacketContext->CfgFile()->ItemCount(KQosNetworkNotification);
       
  1041 	for(TInt i = 0; i < count; i++)
       
  1042 		{
       
  1043 		item=iPacketContext->CfgFile()->Item(KQosNetworkNotification,i);
       
  1044 		if(!item)
       
  1045 			break;
       
  1046 		
       
  1047 		TProfileNegR99 qosNetworkNotification;
       
  1048 		TPtrC8 contextName, duration, negTraffic, negDeliveryOrder, negErroneousSDUDelivery;
       
  1049 		TPtrC8 negBitErrorRatio, negSDUErrorRatio, negTrafficHandlingPriority;
       
  1050 		TInt negTransferDelay, negGuaranteedUpLinkBitRate, negGuaranteedDownLinkBitRate;
       
  1051 		TInt negMaxUpLinkRate, negMaxDownLinkRate, negMaxSDUSize;
       
  1052 
       
  1053 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,0,contextName);
       
  1054 		if(ret!=KErrNone)
       
  1055 			{
       
  1056 			LOGPARSERR("QosNetworkNotification::contextName",ret,0,&KQosNetworkNotificationType);
       
  1057 			continue;
       
  1058 			}
       
  1059 		else
       
  1060 			{
       
  1061 			qosNetworkNotification.iContextName.Copy(contextName);
       
  1062 			}
       
  1063 
       
  1064 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,1,duration);
       
  1065 		if(ret!=KErrNone)
       
  1066 			{
       
  1067 			LOGPARSERR("QosNetworkNotification::duration",ret,1,&KQosNetworkNotificationType);
       
  1068 			continue;
       
  1069 			}
       
  1070 		else
       
  1071 			{
       
  1072 			if(AsciiToNum(duration, digit)==KErrNone)
       
  1073 				qosNetworkNotification.iDuration = digit;
       
  1074 			}
       
  1075 
       
  1076 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,2,negTraffic);
       
  1077 		if(ret!=KErrNone)
       
  1078 			{
       
  1079 			LOGPARSERR("QosNetworkNotification::negTraffic",ret,2,&KQosNetworkNotificationType);
       
  1080 			continue;
       
  1081 			}
       
  1082 		else
       
  1083 			{
       
  1084 			if(AsciiToNum(negTraffic, digit)==KErrNone)
       
  1085 				qosNetworkNotification.iNegTraffic = digit;
       
  1086 			}
       
  1087 
       
  1088 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,3,negDeliveryOrder);
       
  1089 		if(ret!=KErrNone)
       
  1090 			{
       
  1091 			LOGPARSERR("QosNetworkNotification::negDeliveryOrder",ret,3,&KQosNetworkNotificationType);
       
  1092 			continue;
       
  1093 			}
       
  1094 		else
       
  1095 			{
       
  1096 			if(AsciiToNum(negDeliveryOrder, digit)==KErrNone)
       
  1097 				qosNetworkNotification.iNegDeliveryOrder = digit;
       
  1098 			}
       
  1099 
       
  1100 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,4,negErroneousSDUDelivery);
       
  1101 		if(ret!=KErrNone)
       
  1102 			{
       
  1103 			LOGPARSERR("QosNetworkNotification::negErroneousSDUDelivery",ret,4,&KQosNetworkNotificationType);
       
  1104 			continue;
       
  1105 			}
       
  1106 		else
       
  1107 			{
       
  1108 			if(AsciiToNum(negErroneousSDUDelivery, digit)==KErrNone)
       
  1109 				qosNetworkNotification.iNegErroneousSDUDelivery = digit;
       
  1110 			}
       
  1111 
       
  1112 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,5,negMaxSDUSize);
       
  1113 		if(ret!=KErrNone)
       
  1114 			{
       
  1115 			LOGPARSERR("QosNetworkNotification::negMaxSDUSize",ret,5,&KQosNetworkNotificationType);
       
  1116 			continue;
       
  1117 			}
       
  1118 		else
       
  1119 			{
       
  1120 			qosNetworkNotification.iNegMaxSDUSize =  negMaxSDUSize;
       
  1121 			}
       
  1122 
       
  1123 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,6,negBitErrorRatio);
       
  1124 		if(ret!=KErrNone)
       
  1125 			{
       
  1126 			LOGPARSERR("QosNetworkNotification::negBitErrorRatio",ret,6,&KQosNetworkNotificationType);
       
  1127 			continue;
       
  1128 			}
       
  1129 		else
       
  1130 			{
       
  1131 			if(AsciiToNum(negBitErrorRatio, digit)==KErrNone)
       
  1132 				qosNetworkNotification.iNegTBitErrorRatio = digit;
       
  1133 			}
       
  1134 
       
  1135 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,7,negSDUErrorRatio);
       
  1136 		if(ret!=KErrNone)
       
  1137 			{
       
  1138 			LOGPARSERR("QosNetworkNotification::negSDUErrorRatio",ret,7,&KQosNetworkNotificationType);
       
  1139 			continue;
       
  1140 			}
       
  1141 		else
       
  1142 			{
       
  1143 			if(AsciiToNum(negSDUErrorRatio, digit)==KErrNone)
       
  1144 				qosNetworkNotification.iNegTSDUErrorRatio = digit;
       
  1145 			}
       
  1146 
       
  1147 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,8,negTrafficHandlingPriority);
       
  1148 		if(ret!=KErrNone)
       
  1149 			{
       
  1150 			LOGPARSERR("QosNetworkNotification::negTrafficHandlingPriority",ret,8,&KQosNetworkNotificationType);
       
  1151 			continue;
       
  1152 			}
       
  1153 		else
       
  1154 			{
       
  1155 			if(AsciiToNum(negTrafficHandlingPriority, digit)==KErrNone)
       
  1156 				qosNetworkNotification.iNegTrafficHandlingPriority = digit;
       
  1157 			}
       
  1158 
       
  1159 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,9,negTransferDelay);
       
  1160 		if(ret!=KErrNone)
       
  1161 			{
       
  1162 			LOGPARSERR("QosNetworkNotification::negTransferDelay",ret,9,&KQosNetworkNotificationType);
       
  1163 			continue;
       
  1164 			}
       
  1165 		else
       
  1166 			{
       
  1167 			qosNetworkNotification.iNegTransferDelay =  negTransferDelay;
       
  1168 			}
       
  1169 
       
  1170 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,10,negGuaranteedUpLinkBitRate);
       
  1171 		if(ret!=KErrNone)
       
  1172 			{
       
  1173 			LOGPARSERR("QosNetworkNotification::negGuaranteedUpLinkBitRate",ret,10,&KQosNetworkNotificationType);
       
  1174 			continue;
       
  1175 			}
       
  1176 		else
       
  1177 			{
       
  1178 			qosNetworkNotification.iNegGuaranteedUpLinkBitRate =  negGuaranteedUpLinkBitRate;
       
  1179 			}
       
  1180 
       
  1181 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,11,negGuaranteedDownLinkBitRate);
       
  1182 		if(ret!=KErrNone)
       
  1183 			{
       
  1184 			LOGPARSERR("QosNetworkNotification::negGuaranteedDownLinkBitRate",ret,11,&KQosNetworkNotificationType);
       
  1185 			continue;
       
  1186 			}
       
  1187 		else
       
  1188 			{
       
  1189 			qosNetworkNotification.iNegGuaranteedDownLinkBitRate =  negGuaranteedDownLinkBitRate;
       
  1190 			}
       
  1191 
       
  1192 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,12,negMaxUpLinkRate);
       
  1193 		if(ret!=KErrNone)
       
  1194 			{
       
  1195 			LOGPARSERR("QosNetworkNotification::negMaxUpLinkRate",ret,12,&KQosNetworkNotificationType);
       
  1196 			continue;
       
  1197 			}
       
  1198 		else
       
  1199 			{
       
  1200 			qosNetworkNotification.iNegMaxUpLinkRate =  negMaxUpLinkRate;
       
  1201 			}
       
  1202 
       
  1203 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,13,negMaxDownLinkRate);
       
  1204 		if(ret!=KErrNone)
       
  1205 			{
       
  1206 			LOGPARSERR("QosNetworkNotification::negMaxDownLinkRate",ret,13,&KQosNetworkNotificationType);
       
  1207 			continue;
       
  1208 			}
       
  1209 		else
       
  1210 			{
       
  1211 			qosNetworkNotification.iNegMaxDownLinkRate = negMaxDownLinkRate;
       
  1212 			}
       
  1213 
       
  1214 		iQosNetworkNotifications->AppendL(qosNetworkNotification);
       
  1215 		}
       
  1216 		
       
  1217 
       
  1218 
       
  1219 	}
       
  1220 
       
  1221 void CSimPacketQoS::GetR99QosProfileCaps()
       
  1222 	{
       
  1223 	TUint8 digit = 0;
       
  1224 	
       
  1225 	// parse Caps Rel99 profile parameters
       
  1226 	const CTestConfigItem* item = iPacketContext->CfgFile()->Item(KQosProfileCapsR99);
       
  1227 	if(item)
       
  1228 		{
       
  1229 		TPtrC8 trafficCap, deliveryOrderReqCap, deliverErroneousSDUCap;
       
  1230 		TPtrC8 BERCap, SDUErrorRatioCap, trafficHandlingPriorityCap;
       
  1231 
       
  1232 		TInt ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,0,trafficCap);
       
  1233 		if(ret!=KErrNone)
       
  1234 			{
       
  1235 			LOGPARSERR("QosProfileCapsR99::trafficCap",ret,0,&KQosProfileCapsR99);
       
  1236 			}
       
  1237 		else
       
  1238 			if(AsciiToNum(trafficCap, digit)==KErrNone)
       
  1239 				iCapsR99.iTraffic = digit;
       
  1240 
       
  1241 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,1,deliveryOrderReqCap);
       
  1242 		if(ret!=KErrNone)
       
  1243 			{
       
  1244 			LOGPARSERR("QosProfileCapsR99::deliveryOrderReqCap",ret,1,&KQosProfileCapsR99);
       
  1245 			}
       
  1246 		else
       
  1247 			if(AsciiToNum(deliveryOrderReqCap, digit)==KErrNone)
       
  1248 				iCapsR99.iDeliveryOrderReq = digit;
       
  1249 
       
  1250 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,2,deliverErroneousSDUCap);
       
  1251 		if(ret!=KErrNone)
       
  1252 			{
       
  1253 			LOGPARSERR("QosProfileCapsR99::deliverErroneousSDUCap",ret,2,&KQosProfileCapsR99);
       
  1254 			}
       
  1255 		else
       
  1256 			if(AsciiToNum(deliverErroneousSDUCap, digit)==KErrNone)
       
  1257 				iCapsR99.iDeliverErroneousSDU = digit;
       
  1258 
       
  1259 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,3,BERCap);
       
  1260 		if(ret!=KErrNone)
       
  1261 			{
       
  1262 			LOGPARSERR("QosProfileCapsR99::BERCap",ret,3,&KQosProfileCapsR99);
       
  1263 			}
       
  1264 		else
       
  1265 			if(AsciiToNum(BERCap, digit)==KErrNone)
       
  1266 				iCapsR99.iBER = digit;
       
  1267 
       
  1268 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,4,SDUErrorRatioCap);
       
  1269 		if(ret!=KErrNone)
       
  1270 			{
       
  1271 			LOGPARSERR("QosProfileCapsR99::SDUErrorRatioCap",ret,4,&KQosProfileCapsR99);
       
  1272 			}
       
  1273 		else
       
  1274 			if(AsciiToNum(SDUErrorRatioCap, digit)==KErrNone)
       
  1275 				iCapsR99.iSDUErrorRatio = digit;
       
  1276 
       
  1277 
       
  1278 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,5,trafficHandlingPriorityCap);
       
  1279 		if(ret!=KErrNone)
       
  1280 			{
       
  1281 			LOGPARSERR("QosProfileCapsR99::trafficHandlingPriorityCap",ret,5,&KQosProfileCapsR99);
       
  1282 			}
       
  1283 		else
       
  1284 			if(AsciiToNum(trafficHandlingPriorityCap, digit)==KErrNone)
       
  1285 				iCapsR99.iTrafficHandlingPriority = digit;
       
  1286 		}
       
  1287 
       
  1288 	}
       
  1289 
       
  1290 void CSimPacketQoS::GetR5QosProfileCaps()
       
  1291 	{
       
  1292 	TUint8 digit = 0;
       
  1293 	
       
  1294 	// parse Caps Rel5 profile parameters
       
  1295 	const CTestConfigItem* item = iPacketContext->CfgFile()->Item(KQosProfileCapsR5);
       
  1296 	if(item)
       
  1297 		{
       
  1298 		TPtrC8 trafficCap, deliveryOrderReqCap, deliverErroneousSDUCap;
       
  1299 		TPtrC8 BERCap, SDUErrorRatioCap, trafficHandlingPriorityCap;
       
  1300 		TPtrC8 signallingIndication, sourceStatisticsDescriptor;
       
  1301 
       
  1302 		TInt ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,0,trafficCap);
       
  1303 		if(ret!=KErrNone)
       
  1304 			{
       
  1305 			LOGPARSERR("QosProfileCapsR5::trafficCap",ret,0,&KQosProfileCapsR5);
       
  1306 			}
       
  1307 		else
       
  1308 			if(AsciiToNum(trafficCap, digit)==KErrNone)
       
  1309 				iCapsR5.iTraffic = digit;
       
  1310 
       
  1311 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,1,deliveryOrderReqCap);
       
  1312 		if(ret!=KErrNone)
       
  1313 			{
       
  1314 			LOGPARSERR("QosProfileCapsR5::deliveryOrderReqCap",ret,1,&KQosProfileCapsR5);
       
  1315 			}
       
  1316 		else
       
  1317 			if(AsciiToNum(deliveryOrderReqCap, digit)==KErrNone)
       
  1318 				iCapsR5.iDeliveryOrderReq = digit;
       
  1319 
       
  1320 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,2,deliverErroneousSDUCap);
       
  1321 		if(ret!=KErrNone)
       
  1322 			{
       
  1323 			LOGPARSERR("QosProfileCapsR5::deliverErroneousSDUCap",ret,2,&KQosProfileCapsR5);
       
  1324 			}
       
  1325 		else
       
  1326 			if(AsciiToNum(deliverErroneousSDUCap, digit)==KErrNone)
       
  1327 				iCapsR5.iDeliverErroneousSDU = digit;
       
  1328 
       
  1329 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,3,BERCap);
       
  1330 		if(ret!=KErrNone)
       
  1331 			{
       
  1332 			LOGPARSERR("QosProfileCapsR5::BERCap",ret,3,&KQosProfileCapsR5);
       
  1333 			}
       
  1334 		else
       
  1335 			if(AsciiToNum(BERCap, digit)==KErrNone)
       
  1336 				iCapsR5.iBER = digit;
       
  1337 
       
  1338 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,4,SDUErrorRatioCap);
       
  1339 		if(ret!=KErrNone)
       
  1340 			{
       
  1341 			LOGPARSERR("QosProfileCapsR5::SDUErrorRatioCap",ret,4,&KQosProfileCapsR5);
       
  1342 			}
       
  1343 		else
       
  1344 			if(AsciiToNum(SDUErrorRatioCap, digit)==KErrNone)
       
  1345 				iCapsR5.iSDUErrorRatio = digit;
       
  1346 
       
  1347 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,5,trafficHandlingPriorityCap);
       
  1348 		if(ret!=KErrNone)
       
  1349 			{
       
  1350 			LOGPARSERR("QosProfileCapsR5::trafficHandlingPriorityCap",ret,5,&KQosProfileCapsR5);
       
  1351 			}
       
  1352 		else
       
  1353 			if(AsciiToNum(trafficHandlingPriorityCap, digit)==KErrNone)
       
  1354 				iCapsR5.iTrafficHandlingPriority = digit;
       
  1355 		
       
  1356 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,6,signallingIndication);
       
  1357 		if(ret!=KErrNone)
       
  1358 			{
       
  1359 			LOGPARSERR("QosProfileCapsR5::signallingIndication",ret,6,&KQosProfileCapsR5);
       
  1360 			}
       
  1361 		else
       
  1362 			if(AsciiToNum(signallingIndication, digit)==KErrNone)
       
  1363 				iCapsR5.iSignallingIndication = digit;
       
  1364 			
       
  1365 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,7,sourceStatisticsDescriptor);
       
  1366 		if(ret!=KErrNone)
       
  1367 			{
       
  1368 			LOGPARSERR("QosProfileCapsR5::sourceStatisticsDescriptor",ret,7,&KQosProfileCapsR5);
       
  1369 			}
       
  1370 		else
       
  1371 			if(AsciiToNum(sourceStatisticsDescriptor, digit)==KErrNone)
       
  1372 				iCapsR5.iNegTSourceStatisticsDescriptor = digit;
       
  1373 		}
       
  1374 	}
       
  1375 
       
  1376 void CSimPacketQoS::GetProfileFailSettings()
       
  1377 	{
       
  1378 	const CTestConfigItem* item = iPacketContext->CfgFile()->Item(KSetProfileFail);
       
  1379 	if(item)
       
  1380 		{
       
  1381 		TPtrC8 contextName, numberOfTimes, errorCode;
       
  1382 		TInt32 setProfileDigit;
       
  1383 		TInt ret = CTestConfig::GetElement(item->Value(),KStdDelimiter,0,contextName);
       
  1384 
       
  1385 		TName tempContextName;
       
  1386 		tempContextName.Copy(contextName);		
       
  1387 		if (iPacketContext->ContextName().Compare(tempContextName)==0)
       
  1388 			{
       
  1389 			ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,1,numberOfTimes);
       
  1390 			if(ret!=KErrNone)
       
  1391 				{
       
  1392 				LOGPARSERR("SetProfileFail::numberOfTimes",ret,1,&KSetProfileFail);
       
  1393 				}
       
  1394 			else
       
  1395 				{
       
  1396 				if(AsciiToNum(numberOfTimes, setProfileDigit)==KErrNone)
       
  1397 					iSetProfileFail.iNumberOfTimes = setProfileDigit;
       
  1398 				}
       
  1399 		
       
  1400 			ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,2,errorCode);
       
  1401 			if(ret!=KErrNone)
       
  1402 				{
       
  1403 				LOGPARSERR("SetProfileFail::errorCode",ret,2,&KSetProfileFail);
       
  1404 				}
       
  1405 			else
       
  1406 				{
       
  1407 				if(AsciiToNum(errorCode, setProfileDigit)==KErrNone)
       
  1408 					iSetProfileFail.iFailErrorCode = setProfileDigit;
       
  1409 				}
       
  1410 			}
       
  1411 		else
       
  1412 			{
       
  1413 			iSetProfileFail.iNumberOfTimes = 0;
       
  1414 			iSetProfileFail.iFailErrorCode = KErrNone;
       
  1415 			}	
       
  1416 		}
       
  1417 	}
       
  1418 
       
  1419 void CSimPacketQoS::GetGPRSQosProfileCaps()
       
  1420 	{
       
  1421 	TUint8 digit = 0;
       
  1422 
       
  1423 	const CTestConfigItem* item = iPacketContext->CfgFile()->Item(KQosProfileCapsGPRS);
       
  1424 	if(item)
       
  1425 		{
       
  1426 		TPtrC8 negPrecedenceCap, negDelayCap, negPeekCap, negReliabilityCap, negMeanCap;
       
  1427 
       
  1428 		TInt ret = CTestConfig::GetElement(item->Value(),KStdDelimiter,0,negPrecedenceCap);
       
  1429 		if(ret!=KErrNone)
       
  1430 			{
       
  1431 			LOGPARSERR("QosProfileCapsGPRS::negPrecedenceCap",ret,0,&KQosProfileCapsGPRS);
       
  1432 			}
       
  1433 		else
       
  1434 			if(AsciiToNum(negPrecedenceCap, digit)==KErrNone)
       
  1435 				iCapsGPRS.iPrecedence = digit;
       
  1436 
       
  1437 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,1,negDelayCap);
       
  1438 		if(ret!=KErrNone)
       
  1439 			{
       
  1440 			LOGPARSERR("QosProfileCapsGPRS::negDelayCap",ret,1,&KQosProfileCapsGPRS);
       
  1441 			}
       
  1442 		else
       
  1443 			if(AsciiToNum(negDelayCap, digit)==KErrNone)
       
  1444 				iCapsGPRS.iDelay = digit;
       
  1445 
       
  1446 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,2,negReliabilityCap);
       
  1447 		if(ret!=KErrNone)
       
  1448 			{
       
  1449 			LOGPARSERR("QosProfileCapsGPRS::negReliabilityCap",ret,2,&KQosProfileCapsGPRS);
       
  1450 			}
       
  1451 		else
       
  1452 			if(AsciiToNum(negReliabilityCap, digit)==KErrNone)
       
  1453 				iCapsGPRS.iReliability = digit;
       
  1454 
       
  1455 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,3,negPeekCap);
       
  1456 		if(ret!=KErrNone)
       
  1457 			{
       
  1458 			LOGPARSERR("QosProfileCapsGPRS::negPeekCap",ret,3,&KQosProfileCapsGPRS);
       
  1459 			}
       
  1460 		else
       
  1461 			if(AsciiToNum(negPeekCap, digit)==KErrNone)
       
  1462 				iCapsGPRS.iPeak = digit;
       
  1463 
       
  1464 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,4,negMeanCap);
       
  1465 		if(ret!=KErrNone)
       
  1466 			{
       
  1467 			LOGPARSERR("QosProfileCapsGPRS::negMeanCap",ret,4,&KQosProfileCapsGPRS);
       
  1468 			}
       
  1469 		else
       
  1470 			if(AsciiToNum(negMeanCap, digit)==KErrNone)
       
  1471 				iCapsGPRS.iMean = digit;
       
  1472 
       
  1473 		}
       
  1474 	}
       
  1475 
       
  1476 	
       
  1477 void CSimPacketQoS::GetR5ReqProfilesL()
       
  1478 {
       
  1479 	TProfileReqR5 profileReq5;
       
  1480 	TUint8 digit = 0;
       
  1481 
       
  1482 	iReqR5Profiles = new(ELeave) CArrayFixFlat<TProfileReqR5>(KNumberofProfiles);
       
  1483 
       
  1484 	// parse Release Rel99 profile parameters
       
  1485 	TInt count = iPacketContext->CfgFile()->ItemCount(KQosProfileReqR5);
       
  1486 	
       
  1487 	for(TInt i = 0; i < count; i++)
       
  1488 		{
       
  1489 		const CTestConfigItem* item = iPacketContext->CfgFile()->Item(KQosProfileReqR5,i);
       
  1490 		if(!item)
       
  1491 			break;
       
  1492 
       
  1493 		// continue to load item's parameters
       
  1494 		TPtrC8 contextName, reqTraffic, minTraffic, reqDeliveryOrder, minDeliveryOrder;
       
  1495 		TPtrC8 reqErroneousSDU, minErroneousSDU;
       
  1496 		TInt minUpLinkBitRate, minDownLinkBitRate, reqUpLinkBitRate, reqDownLinkBitRate;
       
  1497 		TInt maxSDUSize, minSDUSize;
       
  1498 		TPtrC8 reqBitErrorRatio, minBitErrorRatio, reqSDUErrorRatio, minSDUErrorRatio;
       
  1499 		TPtrC8 reqTrafficHandlingPriority, minTrafficHandlingPriority;
       
  1500 		TInt reqTransferDelay, minTransferDelay, reqGuaranteedUpLinkBitRate, reqGuaranteedDownLinkBitRate;
       
  1501 		TInt minGuaranteedUpLinkBitRate, minGuaranteedDownLinkBitRate;
       
  1502 		TInt signallingIndication;
       
  1503 		TPtrC8 reqTSourceStatisticsDescriptor;
       
  1504 
       
  1505 		TInt ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,0,contextName);
       
  1506 		if(ret!=KErrNone)
       
  1507 			{
       
  1508 			LOGPARSERR("QosProfileReqR5::contextName",ret,0,&KQosProfileReqR5);
       
  1509 			continue;
       
  1510 			}
       
  1511 		else 
       
  1512 			{
       
  1513 			profileReq5.iContextName.Copy(contextName);
       
  1514 			if (profileReq5.iContextName.Match(iPacketContext->ContextName())==KErrNotFound)
       
  1515 				{
       
  1516 				LOGPARSERR("QosProfileReqR5::contextName",KErrArgument,0,&KQosProfileReqR5);
       
  1517 				continue;
       
  1518 				}
       
  1519 			}
       
  1520 
       
  1521 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,1,reqTraffic);
       
  1522 		if(ret!=KErrNone)
       
  1523 			{
       
  1524 			LOGPARSERR("QosProfileReqR5::reqTraffic",ret,1,&KQosProfileReqR5);
       
  1525 			continue;
       
  1526 			}
       
  1527 		else 
       
  1528 			{
       
  1529 			if(AsciiToNum(reqTraffic, digit)==KErrNone)
       
  1530 				{
       
  1531 				profileReq5.iReqTraffic=digit;
       
  1532 				}
       
  1533 			}
       
  1534 
       
  1535 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,2,minTraffic);
       
  1536 		if(ret!=KErrNone)
       
  1537 			{
       
  1538 			LOGPARSERR("QosProfileReqR5::minTraffic",ret,2,&KQosProfileReqR5);
       
  1539 			continue;
       
  1540 			}
       
  1541 		else 
       
  1542 			{
       
  1543 			if(AsciiToNum(minTraffic, digit)==KErrNone)
       
  1544 				{
       
  1545 				profileReq5.iMinTraffic=digit;
       
  1546 				}
       
  1547 			}
       
  1548 
       
  1549 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,3,reqDeliveryOrder);
       
  1550 		if(ret!=KErrNone)
       
  1551 			{
       
  1552 			LOGPARSERR("QosProfileReqR5::reqDeliveryOrder",ret,3,&KQosProfileReqR5);
       
  1553 			continue;
       
  1554 			}
       
  1555 		else 
       
  1556 			{
       
  1557 			if(AsciiToNum(reqDeliveryOrder, digit)==KErrNone)
       
  1558 				{
       
  1559 				profileReq5.iReqDeliveryOrder=digit;
       
  1560 				}
       
  1561 			}
       
  1562 
       
  1563 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,4,minDeliveryOrder);
       
  1564 		if(ret!=KErrNone)
       
  1565 			{
       
  1566 			LOGPARSERR("QosProfileReqR5::minDeliveryOrder",ret,4,&KQosProfileReqR5);
       
  1567 			continue;
       
  1568 			}
       
  1569 		else 
       
  1570 			{
       
  1571 			if(AsciiToNum(minDeliveryOrder, digit)==KErrNone)
       
  1572 				{
       
  1573 				profileReq5.iMinDeliveryOrder=digit;
       
  1574 				}
       
  1575 			}
       
  1576 
       
  1577 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,5,reqErroneousSDU);
       
  1578 		if(ret!=KErrNone)
       
  1579 			{
       
  1580 			LOGPARSERR("QosProfileReqR5::reqErroneousSDU",ret,5,&KQosProfileReqR5);
       
  1581 			continue;
       
  1582 			}
       
  1583 		else 
       
  1584 			{
       
  1585 			if(AsciiToNum(reqErroneousSDU, digit)==KErrNone)
       
  1586 				{
       
  1587 				profileReq5.iReqErroneousSDU=digit;
       
  1588 				}
       
  1589 			}
       
  1590 
       
  1591 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,6,minErroneousSDU);
       
  1592 		if(ret!=KErrNone)
       
  1593 			{
       
  1594 			LOGPARSERR("QosProfileReqR5::minErroneousSDU",ret,6,&KQosProfileReqR5);
       
  1595 			continue;
       
  1596 			}
       
  1597 		else 
       
  1598 			{
       
  1599 			if(AsciiToNum(minErroneousSDU, digit)==KErrNone)
       
  1600 				{
       
  1601 				profileReq5.iMinErroneousSDU=digit;
       
  1602 				}
       
  1603 			}
       
  1604 
       
  1605 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,7,maxSDUSize);
       
  1606 		if(ret!=KErrNone)
       
  1607 			{
       
  1608 			LOGPARSERR("QosProfileReqR5::maxSDUSize",ret,7,&KQosProfileReqR5);
       
  1609 			continue;
       
  1610 			}
       
  1611 		else 
       
  1612 			{
       
  1613 			profileReq5.iMaxSDUSize=maxSDUSize;
       
  1614 			}
       
  1615 
       
  1616 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,8,minSDUSize);
       
  1617 		if(ret!=KErrNone)
       
  1618 			{
       
  1619 			LOGPARSERR("QosProfileReqR5::minSDUSize",ret,8,&KQosProfileReqR5);
       
  1620 			continue;
       
  1621 			}
       
  1622 		else 
       
  1623 			{
       
  1624 			profileReq5.iMinSDUSize=minSDUSize;
       
  1625 			}
       
  1626 
       
  1627 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,9,reqUpLinkBitRate);
       
  1628 		if(ret!=KErrNone)
       
  1629 			{
       
  1630 			LOGPARSERR("QosProfileReqR5::reqUpLinkBitRate",ret,9,&KQosProfileReqR5);
       
  1631 			continue;
       
  1632 			}
       
  1633 		else 
       
  1634 			{
       
  1635 			profileReq5.iReqUpLinkTBitRate=reqUpLinkBitRate;
       
  1636 			}
       
  1637 
       
  1638 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,10,reqDownLinkBitRate);
       
  1639 		if(ret!=KErrNone)
       
  1640 			{
       
  1641 			LOGPARSERR("QosProfileReqR5::reqDownLinkBitRate",ret,10,&KQosProfileReqR5);
       
  1642 			continue;
       
  1643 			}
       
  1644 		else 
       
  1645 			{
       
  1646 			profileReq5.iReqDownLinkTBitRate= reqDownLinkBitRate;
       
  1647 			}
       
  1648 
       
  1649 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,11,minUpLinkBitRate);
       
  1650 		if(ret!=KErrNone)
       
  1651 			{
       
  1652 			LOGPARSERR("QosProfileReqR5::minUpLinkBitRate",ret,11,&KQosProfileReqR5);
       
  1653 			continue;
       
  1654 			}
       
  1655 		else 
       
  1656 			{
       
  1657 			profileReq5.iMinUpLinkTBitRate= minUpLinkBitRate;
       
  1658 			}
       
  1659 
       
  1660 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,12,minDownLinkBitRate);
       
  1661 		if(ret!=KErrNone)
       
  1662 			{
       
  1663 			continue;
       
  1664 			}
       
  1665 		else 
       
  1666 			{
       
  1667 			profileReq5.iMinDownLinkTBitRate= minDownLinkBitRate;
       
  1668 			}
       
  1669 
       
  1670 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,13,reqBitErrorRatio);
       
  1671 		if(ret!=KErrNone)
       
  1672 			{
       
  1673 			LOGPARSERR("QosProfileReqR5::reqBitErrorRatio",ret,13,&KQosProfileReqR5);
       
  1674 			continue;
       
  1675 			}
       
  1676 		else 
       
  1677 			{
       
  1678 			if(AsciiToNum(reqBitErrorRatio, digit)==KErrNone)
       
  1679 				{
       
  1680 				profileReq5.iReqTBitErrorRatio=digit;
       
  1681 				}
       
  1682 			}
       
  1683 
       
  1684 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,14,minBitErrorRatio);
       
  1685 		if(ret!=KErrNone)
       
  1686 			{
       
  1687 			LOGPARSERR("QosProfileReqR5::minBitErrorRatio",ret,14,&KQosProfileReqR5);
       
  1688 			continue;
       
  1689 			}
       
  1690 		else 
       
  1691 			{
       
  1692 			if(AsciiToNum(minBitErrorRatio, digit)==KErrNone)
       
  1693 				{
       
  1694 				profileReq5.iMinTBitErrorRatio=digit;
       
  1695 				}
       
  1696 			}
       
  1697 
       
  1698 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,15,reqSDUErrorRatio);
       
  1699 		if(ret!=KErrNone)
       
  1700 			{
       
  1701 			LOGPARSERR("- QosProfileReqR5::reqSDUErrorRatio",ret,15,&KQosProfileReqR5);
       
  1702 			continue;
       
  1703 			}
       
  1704 		else 
       
  1705 			{
       
  1706 			if(AsciiToNum(reqSDUErrorRatio, digit)==KErrNone)
       
  1707 				{
       
  1708 				profileReq5.iReqTSDUErrorRatio=digit;
       
  1709 				}
       
  1710 			}
       
  1711 
       
  1712 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,16,minSDUErrorRatio);
       
  1713 		if(ret!=KErrNone)
       
  1714 			{
       
  1715 			LOGPARSERR("- QosProfileReqR5::minSDUErrorRatio",ret,16,&KQosProfileReqR5);
       
  1716 			continue;
       
  1717 			}
       
  1718 		else 
       
  1719 			{
       
  1720 			if(AsciiToNum(minSDUErrorRatio, digit)==KErrNone)
       
  1721 				{
       
  1722  				profileReq5.iMinTSDUErrorRatio=digit;
       
  1723 				}
       
  1724 			}
       
  1725 
       
  1726 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,17,reqTrafficHandlingPriority);
       
  1727 		if(ret!=KErrNone)
       
  1728 			{
       
  1729 			LOGPARSERR("QosProfileReqR5::reqTrafficHandlingPriority",ret,17,&KQosProfileReqR5);
       
  1730 			continue;
       
  1731 			}
       
  1732 		else 
       
  1733 			{
       
  1734 			if(AsciiToNum(reqTrafficHandlingPriority, digit)==KErrNone)
       
  1735 				{
       
  1736 				profileReq5.iReqTTrafficHandlingPriority=digit;
       
  1737 				}
       
  1738 			}
       
  1739 
       
  1740 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,18,minTrafficHandlingPriority);
       
  1741 		if(ret!=KErrNone)
       
  1742 			{
       
  1743 			LOGPARSERR("QosProfileReqR5::minTrafficHandlingPriority",ret,18,&KQosProfileReqR5);
       
  1744 			continue;
       
  1745 			}
       
  1746 		else 
       
  1747 			{
       
  1748 			if(AsciiToNum(minTrafficHandlingPriority, digit)==KErrNone)
       
  1749 				{
       
  1750 				profileReq5.iMinTTrafficHandlingPriority=digit;
       
  1751 				}
       
  1752 			}
       
  1753 
       
  1754 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,19,reqTransferDelay);
       
  1755 		if(ret!=KErrNone)
       
  1756 			{
       
  1757 			LOGPARSERR("QosProfileReqR5::reqTransferDelay",ret,19,&KQosProfileReqR5);
       
  1758 			continue;
       
  1759 			}
       
  1760 		else 
       
  1761 			{
       
  1762 			profileReq5.iReqTransferDelay= reqTransferDelay;
       
  1763 			}
       
  1764 
       
  1765 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,20,minTransferDelay);
       
  1766 		if(ret!=KErrNone)
       
  1767 			{
       
  1768 			LOGPARSERR("QosProfileReqR5::minTransferDelay",ret,20,&KQosProfileReqR5);
       
  1769 			continue;
       
  1770 			}
       
  1771 		else 
       
  1772 			{
       
  1773 			profileReq5.iMinTransferDelay= minTransferDelay;
       
  1774 			}
       
  1775 
       
  1776 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,21,reqGuaranteedUpLinkBitRate);
       
  1777 		if(ret!=KErrNone)
       
  1778 			{
       
  1779 			LOGPARSERR("QosProfileReqR5::reqGuaranteedUpLinkBitRate",ret,21,&KQosProfileReqR5);
       
  1780 			continue;
       
  1781 			}
       
  1782 		else 
       
  1783 			{
       
  1784 			profileReq5.iReqGuaranteedUpLinkTBitRate= reqGuaranteedUpLinkBitRate;
       
  1785 			}
       
  1786 
       
  1787 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,22,reqGuaranteedDownLinkBitRate);
       
  1788 		if(ret!=KErrNone)
       
  1789 			{
       
  1790 			LOGPARSERR("QosProfileReqR5::reqGuaranteedDownLinkBitRate",ret,22,&KQosProfileReqR5);
       
  1791 			continue;
       
  1792 			}
       
  1793 		else 
       
  1794 			{
       
  1795 			profileReq5.iReqGuaranteedDownLinkTBitRate= reqGuaranteedDownLinkBitRate;
       
  1796 			}
       
  1797 
       
  1798 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,23,minGuaranteedUpLinkBitRate);
       
  1799 		if(ret!=KErrNone)
       
  1800 			{
       
  1801 			LOGPARSERR("QosProfileReqR5::minGuaranteedUpLinkBitRate",ret,23,&KQosProfileReqR5);
       
  1802 			continue;
       
  1803 			}
       
  1804 		else 
       
  1805 			{
       
  1806 			profileReq5.iMinGuaranteedUpLinkTBitRate= minGuaranteedUpLinkBitRate;
       
  1807 			}
       
  1808 
       
  1809 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,24,minGuaranteedDownLinkBitRate);
       
  1810 		if(ret!=KErrNone)
       
  1811 			{
       
  1812 			LOGPARSERR("QosProfileReqR5::minGuaranteedDownLinkBitRate",ret,24,&KQosProfileReqR5);
       
  1813 			continue;
       
  1814 			}
       
  1815 		else 
       
  1816 			{
       
  1817 			profileReq5.iMinGuaranteedDownLinkTBitRate= minGuaranteedDownLinkBitRate;
       
  1818 			}
       
  1819 		
       
  1820 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,25,signallingIndication);
       
  1821 		if(ret!=KErrNone)
       
  1822 			{
       
  1823 			LOGPARSERR("QosProfileReqR5::signallingIndication",ret,25,&KQosProfileReqR5);
       
  1824 			continue;
       
  1825 			}
       
  1826 		else 
       
  1827 			{
       
  1828 			profileReq5.iSignallingIndication= signallingIndication;
       
  1829 			}
       
  1830 			
       
  1831 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,26,reqTSourceStatisticsDescriptor);
       
  1832 		if(ret!=KErrNone)
       
  1833 			{
       
  1834 			LOGPARSERR("QosProfileReqR5::reqTSourceStatisticsDescriptor",ret,26,&KQosProfileReqR5);
       
  1835 			continue;
       
  1836 			}
       
  1837 		else 
       
  1838 			{
       
  1839 			if(AsciiToNum(reqTSourceStatisticsDescriptor, digit)==KErrNone)
       
  1840 				{
       
  1841 				profileReq5.iReqTSourceStatisticsDescriptor=digit;
       
  1842 				}
       
  1843 			}
       
  1844 		
       
  1845 		iReqR5Profiles->AppendL(profileReq5);
       
  1846 		}
       
  1847 }
       
  1848 
       
  1849 void CSimPacketQoS::GetR5NegProfilesL()
       
  1850 {
       
  1851 	TProfileNegR5 profileNeg5;
       
  1852 	TUint8 digit = 0;
       
  1853 
       
  1854 	iNegR5Profiles = new(ELeave) CArrayFixFlat<TProfileNegR5>(KNumberofProfiles);
       
  1855 
       
  1856 	// parse Negotiated Rel5 profile parameters
       
  1857 	TInt count = iPacketContext->CfgFile()->ItemCount(KQosProfileNegR5);
       
  1858 	for(TInt i = 0; i < count; i++)
       
  1859 		{
       
  1860 		const CTestConfigItem* item = iPacketContext->CfgFile()->Item(KQosProfileNegR5,i);
       
  1861 		if(!item)
       
  1862 			break;
       
  1863 	
       
  1864 		TPtrC8 contextName, duration, negTraffic, negDeliveryOrder, negErroneousSDUDelivery;
       
  1865 		TPtrC8 negBitErrorRatio, negSDUErrorRatio, negTrafficHandlingPriority;
       
  1866 		TInt negTransferDelay, negGuaranteedUpLinkBitRate, negGuaranteedDownLinkBitRate;
       
  1867 		TInt negMaxUpLinkRate, negMaxDownLinkRate, negMaxSDUSize;
       
  1868 		TInt  signallingIndication;
       
  1869  		TPtrC8 reqTSourceStatisticsDescriptor;
       
  1870 		 
       
  1871 		TInt ret = CTestConfig::GetElement(item->Value(),KStdDelimiter,0,contextName);
       
  1872 		if(ret!=KErrNone)
       
  1873 			{
       
  1874 			LOGPARSERR("QosProfileNegR5::contextName",ret,0,&KQosProfileNegR5);
       
  1875 			continue;
       
  1876 			}
       
  1877 		else
       
  1878 			{
       
  1879 			profileNeg5.iContextName.Copy(contextName);
       
  1880 			if (profileNeg5.iContextName.Match(iPacketContext->ContextName())==KErrNotFound)
       
  1881 				{
       
  1882 				LOGPARSERR("QosProfileNegR5::contextName",KErrArgument,0,&KQosProfileNegR5);
       
  1883 				continue;
       
  1884 				}
       
  1885 			}
       
  1886 
       
  1887 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,1,duration);
       
  1888 		if(ret!=KErrNone)
       
  1889 			{
       
  1890 			LOGPARSERR("QosProfileNegR5::duration",ret,1,&KQosProfileNegR5);
       
  1891 			continue;
       
  1892 			}
       
  1893 		else
       
  1894 			{
       
  1895 			if(AsciiToNum(duration, digit)==KErrNone)
       
  1896 				profileNeg5.iDuration = digit;
       
  1897 			}
       
  1898 
       
  1899 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,2,negTraffic);
       
  1900 		if(ret!=KErrNone)
       
  1901 			{
       
  1902 			LOGPARSERR("QosProfileNegR5::negTraffic",ret,2,&KQosProfileNegR5);
       
  1903 			continue;
       
  1904 			}
       
  1905 		else
       
  1906 			{
       
  1907 			if(AsciiToNum(negTraffic, digit)==KErrNone)
       
  1908 				profileNeg5.iNegTraffic = digit;
       
  1909 			}
       
  1910 
       
  1911 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,3,negDeliveryOrder);
       
  1912 		if(ret!=KErrNone)
       
  1913 			{
       
  1914 			LOGPARSERR("QosProfileNegR5::negDeliveryOrder",ret,3,&KQosProfileNegR5);
       
  1915 			continue;
       
  1916 			}
       
  1917 		else
       
  1918 			{
       
  1919 			if(AsciiToNum(negDeliveryOrder, digit)==KErrNone)
       
  1920 				profileNeg5.iNegDeliveryOrder = digit;
       
  1921 			}
       
  1922 
       
  1923 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,4,negErroneousSDUDelivery);
       
  1924 		if(ret!=KErrNone)
       
  1925 			{
       
  1926 			LOGPARSERR("QosProfileNegR5::negErroneousSDUDelivery",ret,4,&KQosProfileNegR5);
       
  1927 			continue;
       
  1928 			}
       
  1929 		else
       
  1930 			{
       
  1931 			if(AsciiToNum(negErroneousSDUDelivery, digit)==KErrNone)
       
  1932 				profileNeg5.iNegErroneousSDUDelivery = digit;
       
  1933 			}
       
  1934 
       
  1935 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,5,negMaxSDUSize);
       
  1936 		if(ret!=KErrNone)
       
  1937 			{
       
  1938 			LOGPARSERR("QosProfileNegR5::negMaxSDUSize",ret,5,&KQosProfileNegR5);
       
  1939 			continue;
       
  1940 			}
       
  1941 		else
       
  1942 			{
       
  1943 			profileNeg5.iNegMaxSDUSize =  negMaxSDUSize;
       
  1944 			}
       
  1945 
       
  1946 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,6,negBitErrorRatio);
       
  1947 		if(ret!=KErrNone)
       
  1948 			{
       
  1949 			LOGPARSERR("QosProfileNegR5::negBitErrorRatio",ret,6,&KQosProfileNegR5);
       
  1950 			continue;
       
  1951 			}
       
  1952 		else
       
  1953 			{
       
  1954 			if(AsciiToNum(negBitErrorRatio, digit)==KErrNone)
       
  1955 				profileNeg5.iNegTBitErrorRatio = digit;
       
  1956 			}
       
  1957 
       
  1958 		
       
  1959 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,7,negSDUErrorRatio);
       
  1960 		if(ret!=KErrNone)
       
  1961 			{
       
  1962 			LOGPARSERR("QosProfileNegR5::negSDUErrorRatio",ret,7,&KQosProfileNegR5);
       
  1963 			continue;
       
  1964 			}
       
  1965 		else
       
  1966 			{
       
  1967 			if(AsciiToNum(negSDUErrorRatio, digit)==KErrNone)
       
  1968 				profileNeg5.iNegTSDUErrorRatio = digit;
       
  1969 			}
       
  1970 
       
  1971 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,8,negTrafficHandlingPriority);
       
  1972 		if(ret!=KErrNone)
       
  1973 			{
       
  1974 			LOGPARSERR("QosProfileNegR5::negTrafficHandlingPriority",ret,8,&KQosProfileNegR5);
       
  1975 			continue;
       
  1976 			}
       
  1977 		else
       
  1978 			{
       
  1979 			if(AsciiToNum(negTrafficHandlingPriority, digit)==KErrNone)
       
  1980 				profileNeg5.iNegTrafficHandlingPriority = digit;
       
  1981 			}
       
  1982 
       
  1983 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,9,negTransferDelay);
       
  1984 		if(ret!=KErrNone)
       
  1985 			{
       
  1986 			LOGPARSERR("QosProfileNegR5::negTransferDelay",ret,9,&KQosProfileNegR5);
       
  1987 			continue;
       
  1988 			}
       
  1989 		else
       
  1990 			{
       
  1991 			profileNeg5.iNegTransferDelay =  negTransferDelay;
       
  1992 			}
       
  1993 
       
  1994 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,10,negGuaranteedUpLinkBitRate);
       
  1995 		if(ret!=KErrNone)
       
  1996 			{
       
  1997 			LOGPARSERR("QosProfileNegR5::negGuaranteedUpLinkBitRate",ret,10,&KQosProfileNegR5);
       
  1998 			continue;
       
  1999 			}
       
  2000 		else
       
  2001 			{
       
  2002 			profileNeg5.iNegGuaranteedUpLinkBitRate =  negGuaranteedUpLinkBitRate;
       
  2003 			}
       
  2004 
       
  2005 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,11,negGuaranteedDownLinkBitRate);
       
  2006 		if(ret!=KErrNone)
       
  2007 			{
       
  2008 			LOGPARSERR("QosProfileNegR5::negGuaranteedDownLinkBitRate",ret,11,&KQosProfileNegR5);
       
  2009 			continue;
       
  2010 			}
       
  2011 		else
       
  2012 			{
       
  2013 			profileNeg5.iNegGuaranteedDownLinkBitRate =  negGuaranteedDownLinkBitRate;
       
  2014 			}
       
  2015 
       
  2016 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,12,negMaxUpLinkRate);
       
  2017 		if(ret!=KErrNone)
       
  2018 			{
       
  2019 			LOGPARSERR("QosProfileNegR5::negMaxUpLinkRate",ret,12,&KQosProfileNegR5);
       
  2020 			continue;
       
  2021 			}
       
  2022 		else
       
  2023 			{
       
  2024 			profileNeg5.iNegMaxUpLinkRate =  negMaxUpLinkRate;
       
  2025 			}
       
  2026 
       
  2027 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,13,negMaxDownLinkRate);
       
  2028 		if(ret!=KErrNone)
       
  2029 			{
       
  2030 			LOGPARSERR("QosProfileNegR5::negMaxDownLinkRate",ret,13,&KQosProfileNegR5);
       
  2031 			continue;
       
  2032 			}
       
  2033 		else
       
  2034 			{
       
  2035 			profileNeg5.iNegMaxDownLinkRate =  negMaxDownLinkRate;
       
  2036 			}
       
  2037 		
       
  2038 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,14,signallingIndication);
       
  2039 		if(ret!=KErrNone)
       
  2040 			{
       
  2041 			LOGPARSERR("QosProfileNegR5::signallingIndication",ret,14,&KQosProfileNegR5);
       
  2042 			continue;
       
  2043 			}
       
  2044 		else
       
  2045 			{
       
  2046 			profileNeg5.iSignallingIndication =  signallingIndication;
       
  2047 			}
       
  2048 			
       
  2049 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,15,reqTSourceStatisticsDescriptor);
       
  2050 		if(ret!=KErrNone)
       
  2051 			{
       
  2052 			LOGPARSERR("QosProfileNegR5::reqTSourceStatisticsDescriptor",ret,15,&KQosProfileNegR5);
       
  2053 			continue;
       
  2054 			}
       
  2055 		else
       
  2056 			{
       
  2057 			if(AsciiToNum(reqTSourceStatisticsDescriptor, digit)==KErrNone)
       
  2058 				profileNeg5.iNegTSourceStatisticsDescriptor = digit;
       
  2059 			}
       
  2060 		
       
  2061 
       
  2062 		iNegR5Profiles->AppendL(profileNeg5);
       
  2063 		}
       
  2064 }
       
  2065 
       
  2066 void CSimPacketQoS::GetR5NetworkNotificationsL()
       
  2067 	{
       
  2068 	TInt ret;
       
  2069 	TUint8 digit = 0;
       
  2070 	
       
  2071 	iQosR5NetworkNotifications = new(ELeave) CArrayFixFlat<TProfileNegR5>(KNumberofProfiles);
       
  2072 
       
  2073 	// parse the Qos Network Notification parameters
       
  2074 	iNetworkNotificationType = ETimer;
       
  2075 	const CTestConfigItem* item = iPacketContext->CfgFile()->Item(KQosNetworkNotificationType);
       
  2076 	if (item)
       
  2077 		{
       
  2078 		TPtrC8 networkNotificationType;
       
  2079 		ret = CTestConfig::GetElement(item->Value(),KStdDelimiter,0,networkNotificationType);
       
  2080 		if(ret==KErrNone && networkNotificationType.Compare(KNotificationTypePublishSubscribe)==0)
       
  2081 			{
       
  2082 			iNetworkNotificationType = EPublishAndSubscribe;
       
  2083 			}
       
  2084 		}
       
  2085 		
       
  2086 	TInt count=iPacketContext->CfgFile()->ItemCount(KQosR5NetworkNotification);
       
  2087 	for(TInt i = 0; i < count; i++)
       
  2088 		{
       
  2089 		item=iPacketContext->CfgFile()->Item(KQosR5NetworkNotification,i);
       
  2090 		if(!item)
       
  2091 			break;
       
  2092 		
       
  2093 		TProfileNegR5 qosR5NetworkNotification;
       
  2094 		TPtrC8 contextName, duration, negTraffic, negDeliveryOrder, negErroneousSDUDelivery;
       
  2095 		TPtrC8 negBitErrorRatio, negSDUErrorRatio, negTrafficHandlingPriority;
       
  2096 		TInt negTransferDelay, negGuaranteedUpLinkBitRate, negGuaranteedDownLinkBitRate;
       
  2097 		TInt negMaxUpLinkRate, negMaxDownLinkRate, negMaxSDUSize;
       
  2098 		TInt  signallingIndication;
       
  2099 		TPtrC8 reqTSourceStatisticsDescriptor;
       
  2100 
       
  2101 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,0,contextName);
       
  2102 		if(ret!=KErrNone)
       
  2103 			{
       
  2104 			LOGPARSERR("qosR5NetworkNotification::contextName",ret,0,&KQosNetworkNotificationType);
       
  2105 			continue;
       
  2106 			}
       
  2107 		else
       
  2108 			{
       
  2109 			qosR5NetworkNotification.iContextName.Copy(contextName);
       
  2110 			}
       
  2111 
       
  2112 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,1,duration);
       
  2113 		if(ret!=KErrNone)
       
  2114 			{
       
  2115 			LOGPARSERR("qosR5NetworkNotification::duration",ret,1,&KQosNetworkNotificationType);
       
  2116 			continue;
       
  2117 			}
       
  2118 		else
       
  2119 			{
       
  2120 			if(AsciiToNum(duration, digit)==KErrNone)
       
  2121 				qosR5NetworkNotification.iDuration = digit;
       
  2122 			}
       
  2123 
       
  2124 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,2,negTraffic);
       
  2125 		if(ret!=KErrNone)
       
  2126 			{
       
  2127 			LOGPARSERR("qosR5NetworkNotification::negTraffic",ret,2,&KQosNetworkNotificationType);
       
  2128 			continue;
       
  2129 			}
       
  2130 		else
       
  2131 			{
       
  2132 			if(AsciiToNum(negTraffic, digit)==KErrNone)
       
  2133 				qosR5NetworkNotification.iNegTraffic = digit;
       
  2134 			}
       
  2135 
       
  2136 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,3,negDeliveryOrder);
       
  2137 		if(ret!=KErrNone)
       
  2138 			{
       
  2139 			LOGPARSERR("qosR5NetworkNotification::negDeliveryOrder",ret,3,&KQosNetworkNotificationType);
       
  2140 			continue;
       
  2141 			}
       
  2142 		else
       
  2143 			{
       
  2144 			if(AsciiToNum(negDeliveryOrder, digit)==KErrNone)
       
  2145 				qosR5NetworkNotification.iNegDeliveryOrder = digit;
       
  2146 			}
       
  2147 
       
  2148 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,4,negErroneousSDUDelivery);
       
  2149 		if(ret!=KErrNone)
       
  2150 			{
       
  2151 			LOGPARSERR("qosR5NetworkNotification::negErroneousSDUDelivery",ret,4,&KQosNetworkNotificationType);
       
  2152 			continue;
       
  2153 			}
       
  2154 		else
       
  2155 			{
       
  2156 			if(AsciiToNum(negErroneousSDUDelivery, digit)==KErrNone)
       
  2157 				qosR5NetworkNotification.iNegErroneousSDUDelivery = digit;
       
  2158 			}
       
  2159 
       
  2160 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,5,negMaxSDUSize);
       
  2161 		if(ret!=KErrNone)
       
  2162 			{
       
  2163 			LOGPARSERR("qosR5NetworkNotification::negMaxSDUSize",ret,5,&KQosNetworkNotificationType);
       
  2164 			continue;
       
  2165 			}
       
  2166 		else
       
  2167 			{
       
  2168 			qosR5NetworkNotification.iNegMaxSDUSize =  negMaxSDUSize;
       
  2169 			}
       
  2170 
       
  2171 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,6,negBitErrorRatio);
       
  2172 		if(ret!=KErrNone)
       
  2173 			{
       
  2174 			LOGPARSERR("qosR5NetworkNotification::negBitErrorRatio",ret,6,&KQosNetworkNotificationType);
       
  2175 			continue;
       
  2176 			}
       
  2177 		else
       
  2178 			{
       
  2179 			if(AsciiToNum(negBitErrorRatio, digit)==KErrNone)
       
  2180 				qosR5NetworkNotification.iNegTBitErrorRatio = digit;
       
  2181 			}
       
  2182 
       
  2183 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,7,negSDUErrorRatio);
       
  2184 		if(ret!=KErrNone)
       
  2185 			{
       
  2186 			LOGPARSERR("qosR5NetworkNotification::negSDUErrorRatio",ret,7,&KQosNetworkNotificationType);
       
  2187 			continue;
       
  2188 			}
       
  2189 		else
       
  2190 			{
       
  2191 			if(AsciiToNum(negSDUErrorRatio, digit)==KErrNone)
       
  2192 				qosR5NetworkNotification.iNegTSDUErrorRatio = digit;
       
  2193 			}
       
  2194 
       
  2195 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,8,negTrafficHandlingPriority);
       
  2196 		if(ret!=KErrNone)
       
  2197 			{
       
  2198 			LOGPARSERR("qosR5NetworkNotification::negTrafficHandlingPriority",ret,8,&KQosNetworkNotificationType);
       
  2199 			continue;
       
  2200 			}
       
  2201 		else
       
  2202 			{
       
  2203 			if(AsciiToNum(negTrafficHandlingPriority, digit)==KErrNone)
       
  2204 				qosR5NetworkNotification.iNegTrafficHandlingPriority = digit;
       
  2205 			}
       
  2206 
       
  2207 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,9,negTransferDelay);
       
  2208 		if(ret!=KErrNone)
       
  2209 			{
       
  2210 			LOGPARSERR("qosR5NetworkNotification::negTransferDelay",ret,9,&KQosNetworkNotificationType);
       
  2211 			continue;
       
  2212 			}
       
  2213 		else
       
  2214 			{
       
  2215 			qosR5NetworkNotification.iNegTransferDelay =  negTransferDelay;
       
  2216 			}
       
  2217 
       
  2218 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,10,negGuaranteedUpLinkBitRate);
       
  2219 		if(ret!=KErrNone)
       
  2220 			{
       
  2221 			LOGPARSERR("qosR5NetworkNotification::negGuaranteedUpLinkBitRate",ret,10,&KQosNetworkNotificationType);
       
  2222 			continue;
       
  2223 			}
       
  2224 		else
       
  2225 			{
       
  2226 			qosR5NetworkNotification.iNegGuaranteedUpLinkBitRate =  negGuaranteedUpLinkBitRate;
       
  2227 			}
       
  2228 
       
  2229 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,11,negGuaranteedDownLinkBitRate);
       
  2230 		if(ret!=KErrNone)
       
  2231 			{
       
  2232 			LOGPARSERR("qosR5NetworkNotification::negGuaranteedDownLinkBitRate",ret,11,&KQosNetworkNotificationType);
       
  2233 			continue;
       
  2234 			}
       
  2235 		else
       
  2236 			{
       
  2237 			qosR5NetworkNotification.iNegGuaranteedDownLinkBitRate =  negGuaranteedDownLinkBitRate;
       
  2238 			}
       
  2239 
       
  2240 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,12,negMaxUpLinkRate);
       
  2241 		if(ret!=KErrNone)
       
  2242 			{
       
  2243 			LOGPARSERR("qosR5NetworkNotification::negMaxUpLinkRate",ret,12,&KQosNetworkNotificationType);
       
  2244 			continue;
       
  2245 			}
       
  2246 		else
       
  2247 			{
       
  2248 			qosR5NetworkNotification.iNegMaxUpLinkRate =  negMaxUpLinkRate;
       
  2249 			}
       
  2250 
       
  2251 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,13,negMaxDownLinkRate);
       
  2252 		if(ret!=KErrNone)
       
  2253 			{
       
  2254 			LOGPARSERR("qosR5NetworkNotification::negMaxDownLinkRate",ret,13,&KQosNetworkNotificationType);
       
  2255 			continue;
       
  2256 			}
       
  2257 		else
       
  2258 			{
       
  2259 			qosR5NetworkNotification.iNegMaxDownLinkRate = negMaxDownLinkRate;
       
  2260 			}
       
  2261 			
       
  2262 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,14,signallingIndication);
       
  2263 		if(ret!=KErrNone)
       
  2264 			{
       
  2265 			LOGPARSERR("qosR5NetworkNotification::signallingIndication",ret,14,&KQosNetworkNotificationType);
       
  2266 			continue;
       
  2267 			}
       
  2268 		else
       
  2269 			{
       
  2270 			qosR5NetworkNotification.iSignallingIndication =  signallingIndication;
       
  2271 			}
       
  2272 			
       
  2273 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,15,reqTSourceStatisticsDescriptor);
       
  2274 		if(ret!=KErrNone)
       
  2275 			{
       
  2276 			LOGPARSERR("qosR5NetworkNotification::reqTSourceStatisticsDescriptor",ret,15,&KQosNetworkNotificationType);
       
  2277 			continue;
       
  2278 			}
       
  2279 		else
       
  2280 			{
       
  2281 			if(AsciiToNum(reqTSourceStatisticsDescriptor, digit)==KErrNone)
       
  2282 				qosR5NetworkNotification.iNegTSourceStatisticsDescriptor = digit;
       
  2283 			}
       
  2284 
       
  2285 		iQosR5NetworkNotifications->AppendL(qosR5NetworkNotification);
       
  2286 		}
       
  2287 	}
       
  2288 
       
  2289 void CSimPacketQoS::GetSetQoSSettings()
       
  2290 /**
       
  2291 * Gets set qos delay settins from config file
       
  2292 *
       
  2293 */
       
  2294  	{
       
  2295  	TInt ret;
       
  2296  	iSetQoSDelay = 0;
       
  2297  	iSetQoSDelayAt=0;
       
  2298  	 	
       
  2299   	const CTestConfigItem* item=iPacketContext->CfgFile()->Item(KSetQoSDelay);
       
  2300  	if(item)
       
  2301  		{
       
  2302  		TInt delay = 0;
       
  2303 		ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,0,delay);
       
  2304 		if(ret!=KErrNone || delay < 0)
       
  2305 			{
       
  2306 			LOGPARSERR("SetQoSDelay::delay",ret,0,&KSetQoSDelay);
       
  2307 			}
       
  2308 		else
       
  2309 			{
       
  2310 			iSetQoSDelay = delay;
       
  2311 			}
       
  2312 			
       
  2313 		TInt at = 0;
       
  2314 		ret = CTestConfig::GetElement(item->Value(),KStdDelimiter,1,at);
       
  2315 		if(ret != KErrNone)
       
  2316 			{
       
  2317 			LOGPARSERR("SetQoSDelay::at",ret,1,&KSetQoSDelay);
       
  2318 			}
       
  2319 		else
       
  2320 			{
       
  2321 			iSetQoSDelayAt = at;
       
  2322 			}
       
  2323  		}
       
  2324  	}
       
  2325  
       
  2326 	
       
  2327 CSimPacketQoS::~CSimPacketQoS()
       
  2328 /**
       
  2329 * Trivial Destructor
       
  2330 * Closes all CObject type objects and destroys all other objects created in the ConstructL()
       
  2331 *
       
  2332 */
       
  2333 	{
       
  2334 	LOGPACKET1("CSimPacketQoS: Entered destructor");
       
  2335 
       
  2336 	if (iProfiles != NULL)
       
  2337 	{
       
  2338 		iProfiles->Delete(0,iProfiles->Count());
       
  2339 		delete iProfiles;
       
  2340 	}
       
  2341 	if (iNegProfiles != NULL)
       
  2342 	{
       
  2343 		iNegProfiles->Delete(0,iNegProfiles->Count());
       
  2344 		delete iNegProfiles;
       
  2345 	}
       
  2346 	if (iReqR99Profiles != NULL)
       
  2347 	{
       
  2348 		iReqR99Profiles->Delete(0, iReqR99Profiles->Count());
       
  2349 		delete iReqR99Profiles;
       
  2350 	}
       
  2351 	if (iNegR99Profiles != NULL)
       
  2352 	{
       
  2353 		iNegR99Profiles->Delete(0,iNegR99Profiles->Count());
       
  2354 		delete iNegR99Profiles;
       
  2355 	}
       
  2356 	if (iReqR5Profiles != NULL)
       
  2357 	{
       
  2358 		iReqR5Profiles->Delete(0, iReqR5Profiles->Count());
       
  2359 		delete iReqR5Profiles;
       
  2360 	}
       
  2361 	if (iNegR5Profiles != NULL)
       
  2362 	{
       
  2363 		iNegR5Profiles->Delete(0,iNegR5Profiles->Count());
       
  2364 		delete iNegR5Profiles;
       
  2365 	}
       
  2366 	if (iCapsR99Profiles != NULL)
       
  2367 	{
       
  2368 		iCapsR99Profiles->Delete(0, iCapsR99Profiles->Count());
       
  2369 		delete iCapsR99Profiles;
       
  2370 	}
       
  2371 	if (iQosNetworkNotifications != NULL)
       
  2372 	{
       
  2373 		iQosNetworkNotifications->Delete(0, iQosNetworkNotifications->Count());
       
  2374 		delete iQosNetworkNotifications;
       
  2375 	}
       
  2376 	if (iQosR5NetworkNotifications != NULL)
       
  2377 	{
       
  2378 		iQosR5NetworkNotifications->Delete(0, iQosR5NetworkNotifications->Count());
       
  2379 		delete iQosR5NetworkNotifications;
       
  2380 	}
       
  2381 	if (iTimer != NULL)
       
  2382 	{
       
  2383 		delete iTimer;
       
  2384 	}
       
  2385 	if (iSetQoSTimer != NULL)
       
  2386  	{
       
  2387  		delete iSetQoSTimer;
       
  2388  	}	
       
  2389 
       
  2390 	delete iSimQoSChange;
       
  2391 	
       
  2392 	delete iSetQoSData;
       
  2393 	}
       
  2394 
       
  2395 CTelObject* CSimPacketQoS::OpenNewObjectByNameL(const TDesC& /*aName*/)
       
  2396 /**
       
  2397 * Opening object(s) from RPacketQoS is not supported
       
  2398 *
       
  2399 * @param aName Name of object to open
       
  2400 * @return CTelObject pointer to the object created.
       
  2401 */
       
  2402 	{
       
  2403 	User::Leave(KErrNotSupported);
       
  2404 	return NULL;
       
  2405 	}
       
  2406 
       
  2407 CTelObject* CSimPacketQoS::OpenNewObjectL(TDes& /*aNewName*/)
       
  2408 /**
       
  2409 * Opening object(s) from RPacketQoS is not supported
       
  2410 *
       
  2411 * @param aNewName Name of object to open
       
  2412 * @return CTelObject pointer to the object created.
       
  2413 */
       
  2414 	{
       
  2415 	User::Leave(KErrNotSupported);
       
  2416 	return NULL;
       
  2417 	}
       
  2418 
       
  2419 CTelObject::TReqMode CSimPacketQoS::ReqModeL(const TInt aIpc)
       
  2420 /**
       
  2421 * ReqModeL is called from the server's CTelObject::ReqAnalyserL
       
  2422 * in order to check the type of request it has.
       
  2423 * 
       
  2424 * 
       
  2425 * @param aIpc the ipc number that identifies the client request
       
  2426 * @return CTelObject::TReqMode The request mode to be used for this request
       
  2427 * @leave Leaves if not supported by this tsy
       
  2428 */
       
  2429 	{	
       
  2430 	CTelObject::TReqMode ret=0;
       
  2431 	switch (aIpc)
       
  2432 		{
       
  2433 		case EPacketQoSSetProfileParams:
       
  2434 		case EPacketQoSGetProfileParams:
       
  2435 		case EPacketQoSGetProfileCaps:	
       
  2436 			break;
       
  2437 
       
  2438 		case EPacketQoSNotifyProfileChanged:
       
  2439 			ret=KReqModeMultipleCompletionEnabled | KReqModeRePostImmediately;
       
  2440 			break;
       
  2441 
       
  2442 		default:
       
  2443 			User::Leave(KErrNotSupported);
       
  2444 			break;
       
  2445 		}
       
  2446 
       
  2447 	return ret;
       
  2448 	}
       
  2449 
       
  2450 TInt CSimPacketQoS::RegisterNotification(const TInt aIpc)
       
  2451 /**
       
  2452 * RegisterNotification is called when the server recognises that this notification
       
  2453 * is being posted for the first time on this sub-session object.
       
  2454 * 
       
  2455 * It enables the TSY to "turn on" any regular notification messages that it may receive 
       
  2456 * from the phone
       
  2457 *
       
  2458 * @param aIpc the ipc number that identifies the client request
       
  2459 * @return err KErrNone if fine
       
  2460 */
       
  2461 	{
       
  2462 	switch (aIpc)
       
  2463 		{
       
  2464 		case EPacketQoSNotifyProfileChanged:
       
  2465 			LOGPACKET1("CSimPacketQoS: RegisterNotification - Profile Changed");
       
  2466 			return KErrNone;
       
  2467 		default:
       
  2468 			// Unknown or invalid IPC
       
  2469 			LOGPACKET1("CSimPacketQoS: Register error, unknown IPC");
       
  2470 			return KErrNotSupported;
       
  2471 		}
       
  2472 	}
       
  2473 
       
  2474 TInt CSimPacketQoS::DeregisterNotification(const TInt aIpc)
       
  2475 /**
       
  2476 * DeregisterNotification is called when the server recognises that this notification
       
  2477 * will not be posted again because the last client to have a handle on this sub-session
       
  2478 * object has just closed the handle.
       
  2479 *
       
  2480 * It enables the TSY to "turn off" any regular notification messages that it may 
       
  2481 * receive from the phone
       
  2482 *
       
  2483 * @param aIpc the ipc number that identifies the client request
       
  2484 * @return err KErrNone if fine
       
  2485 */
       
  2486 	{
       
  2487 	switch (aIpc)
       
  2488 		{
       
  2489 		case EPacketQoSNotifyProfileChanged:
       
  2490 			LOGPACKET1("CSimPacketQoS: DeregisterNotification - Profile Changed");
       
  2491 			return KErrNone;
       
  2492 		default:
       
  2493 			// Unknown or invalid IPC
       
  2494 			LOGPACKET1("CSimPacketQoS: Deregister error, unknown IPC");
       
  2495 			return KErrNotSupported;
       
  2496 		}
       
  2497 	}
       
  2498 
       
  2499 TInt CSimPacketQoS::NumberOfSlotsL(const TInt aIpc)
       
  2500 /**
       
  2501 * NumberOfSlotsL is called by the server when it is registering a new notification
       
  2502 * It enables the TSY to tell the server how many buffer slots to allocate for
       
  2503 * "repost immediately" notifications that may trigger before clients collect them
       
  2504 *
       
  2505 * @param aIpc the ipc number that identifies the client request
       
  2506 * @return err KErrNone if fine
       
  2507 */
       
  2508 	{
       
  2509 	TInt numberOfSlots=1;
       
  2510 	switch (aIpc)
       
  2511 		{
       
  2512 		case EPacketQoSNotifyProfileChanged:
       
  2513 			LOGPACKET1("CGprsDGprsTsy: Registered with 5 slots");
       
  2514 			numberOfSlots=5;
       
  2515 			break;
       
  2516 		default:
       
  2517 			// Unknown or invalid IPC
       
  2518 			LOGPACKET1("CSimPacketQoS: Number of Slots error, unknown IPC");
       
  2519 			User::Leave(KErrNotSupported);
       
  2520 			break;
       
  2521 		}  
       
  2522 	return numberOfSlots;
       
  2523 	}
       
  2524 
       
  2525 
       
  2526 TInt CSimPacketQoS::ExtFunc(const TTsyReqHandle aTsyReqHandle,const TInt aIpc,
       
  2527 							  const TDataPackage& aPackage)
       
  2528 /**
       
  2529 * ExtFunc is called by the server when it has a "extended", i.e. non-core ETel request
       
  2530 * for the TSY to process.
       
  2531 * A request handle, request type and request data are passed to the TSY
       
  2532 * 
       
  2533 * @param aTsyReqHandle  The request handle for completing the request 
       
  2534 * @param aIpc Ipc representing the request
       
  2535 * @param aPackage any data associated with the request
       
  2536 * @return err KErrNone if request completes ok
       
  2537 */
       
  2538 	{
       
  2539 	/**
       
  2540 	* for UMTS on specified number, SetProfileFail occurs
       
  2541 	**/
       
  2542 	switch (aIpc)
       
  2543 		{
       
  2544 		case EPacketQoSSetProfileParams:
       
  2545 		{
       
  2546 			if (iSetProfileCallCount <= iSetProfileFail.iNumberOfTimes	// if the SetProfileFail limit has not been reached
       
  2547 				|| iSetProfileFail.iNumberOfTimes==0)					// call SetProfile()
       
  2548 			{
       
  2549  			
       
  2550  				// only delay setprofile when the user wants to
       
  2551  				if (iSetQoSDelay > 0 && iSetProfileCallCount == iSetQoSDelayAt)
       
  2552  				{
       
  2553  				TSetQoSData setQoSData;
       
  2554  				setQoSData.iTsyReqHandle = aTsyReqHandle;
       
  2555  				setQoSData.iData = aPackage.Des1n();
       
  2556  
       
  2557  				TRAPD(ret, iSetQoSData->AppendL(setQoSData) );
       
  2558  				if (ret != KErrNone)
       
  2559                  	{
       
  2560                  	LOGPACKET1("CSimPacketQoS::ExtFunc AppendL call fail");
       
  2561                  	return ret;
       
  2562                  	}
       
  2563                  	
       
  2564                iSetProfileCallCount++;		
       
  2565  				iSetQoSTimer->Start(iSetQoSDelay,this,ETimerIdPcktQoSSet);				
       
  2566 
       
  2567  				return KErrNone;		
       
  2568  			
       
  2569  				}
       
  2570  				else
       
  2571  				{			
       
  2572 				iSetProfileCallCount++;
       
  2573 				return SetProfile(aTsyReqHandle, aPackage.Des1n());	
       
  2574  				}
       
  2575 				
       
  2576 			}
       
  2577 			else
       
  2578 			{
       
  2579 				iSetProfileCallCount=0;							
       
  2580 				iSetProfileFail.iNumberOfTimes = 0;
       
  2581 				ReqCompleted(aTsyReqHandle,iSetProfileFail.iFailErrorCode);
       
  2582 				return KErrNone;
       
  2583 			}
       
  2584 		}
       
  2585 		case EPacketQoSGetProfileParams:
       
  2586 			return GetProfile(aTsyReqHandle, aPackage.Des1n());
       
  2587 		case EPacketQoSNotifyProfileChanged:
       
  2588 			return NotifyProfileChanged(aTsyReqHandle, aPackage.Des1n());			
       
  2589 		case EPacketQoSGetProfileCaps:
       
  2590 			return GetProfileCaps(aTsyReqHandle, aPackage.Des1n());
       
  2591 		case EPacketQoSNotifyProfileChangedCancel:
       
  2592 			return NotifyProfileChangedCancel(aTsyReqHandle); 
       
  2593 		case EPacketQoSSetProfileParamsCancel:
       
  2594 			return SetProfileCancel(aTsyReqHandle);
       
  2595 		case EPacketQoSGetProfileParamsCancel:
       
  2596 			return GetProfileCancel(aTsyReqHandle);
       
  2597 		case EPacketQoSGetProfileCapsCancel:
       
  2598 			return GetProfileCapsCancel(aTsyReqHandle);
       
  2599 		default:
       
  2600 			return KErrNotSupported;
       
  2601 		}
       
  2602 	}
       
  2603 
       
  2604 TInt CSimPacketQoS::CancelService(const TInt aIpc,const TTsyReqHandle aTsyReqHandle)
       
  2605 /**
       
  2606 * CancelService is called by the server when it is "cleaning-up" any still outstanding
       
  2607 * asynchronous requests before closing a client's sub-session.
       
  2608 * This will happen if a client closes its R-class handle without cancelling outstanding asynchronous requests.
       
  2609 * 
       
  2610 * @param aTsyReqHandle  The request handle for completing the request 
       
  2611 * @param aIpc Ipc representing the request
       
  2612 * @return err KErrNone if request completes ok
       
  2613 */
       
  2614 	{
       
  2615 	LOGPACKET1("CSimPacketQoS: - CancelService called");
       
  2616 	switch (aIpc)
       
  2617 		{
       
  2618 		case EPacketQoSSetProfileParams:
       
  2619 			return SetProfileCancel(aTsyReqHandle);
       
  2620 		case EPacketQoSGetProfileParams:
       
  2621 			return GetProfileCancel(aTsyReqHandle);
       
  2622 		case EPacketQoSGetProfileCaps:
       
  2623 			return GetProfileCapsCancel(aTsyReqHandle);
       
  2624 		case EPacketQoSNotifyProfileChanged:
       
  2625 			return NotifyProfileChangedCancel(aTsyReqHandle);
       
  2626 		default:
       
  2627 			return KErrGeneral; 
       
  2628 		} 
       
  2629 	}
       
  2630 
       
  2631 TInt CSimPacketQoS::SetProfile(const TTsyReqHandle aTsyReqHandle,const TDesC8* aConfig)
       
  2632 /**
       
  2633 * Sets the Quality of Service Requested and Minimum Profile Parameters supported.
       
  2634 *
       
  2635 * In this TSY, we compare the value sent by the client with the data read from the configuration file.
       
  2636 * If they are not the same then the data sent has been corrupted.
       
  2637 *
       
  2638 * @param aTsyReqHandle Tsy Request handle for the client request
       
  2639 * @param aConfig pointer containing the parameters to set to.
       
  2640 * @return KErrNone
       
  2641 */
       
  2642 	{
       
  2643 	LOGPACKET1("CSimPacketQoS::SetProfile called");
       
  2644 	TPckg<TPacketDataConfigBase>* configBase = (TPckg<TPacketDataConfigBase>*)aConfig;
       
  2645 	TPacketDataConfigBase& configBaseV1 = (*configBase)();
       
  2646 
       
  2647 	TInt err = KErrGeneral;
       
  2648 
       
  2649 	// GPRS
       
  2650 	if(configBaseV1.ExtensionId()==TPacketDataConfigBase::KConfigGPRS)
       
  2651 		{
       
  2652 		TPckg<RPacketQoS::TQoSGPRSRequested>* profileConfig = (TPckg<RPacketQoS::TQoSGPRSRequested>*)aConfig;
       
  2653 		RPacketQoS::TQoSGPRSRequested& qosConfigV1 = (*profileConfig)();
       
  2654 
       
  2655 		for(TInt i=0; i<iProfiles->Count(); i++)
       
  2656 			{
       
  2657 			TProfileConfig profile = iProfiles->At(i);
       
  2658 
       
  2659 			if ((qosConfigV1.iMinDelay != profile.iMinDelay)||
       
  2660 			(qosConfigV1.iMinMeanThroughput != profile.iMinMeanThroughput)||
       
  2661 			(qosConfigV1.iMinPeakThroughput != profile.iMinPeekThroughput)||
       
  2662 			(qosConfigV1.iMinPrecedence != profile.iMinPrecedence)||
       
  2663 			(qosConfigV1.iMinReliability != profile.iMinReliability)||
       
  2664 			(qosConfigV1.iReqDelay != profile.iReqDelay)||
       
  2665 			(qosConfigV1.iReqMeanThroughput != profile.iReqMeanThroughput)||
       
  2666 			(qosConfigV1.iReqPeakThroughput != profile.iReqPeekThroughput)||
       
  2667 			(qosConfigV1.iReqPrecedence != profile.iReqPrecedence)||
       
  2668 			(qosConfigV1.iReqReliability != profile.iReqReliability))
       
  2669 				err=KErrCorrupt;
       
  2670 			else
       
  2671 				{
       
  2672 				err=KErrNone;
       
  2673 				iSetProfilePending = ETrue;
       
  2674 				// Check for a pending profile notification.
       
  2675 				if(iNotifyProfileGPRS.iNotifyPending)
       
  2676 					{
       
  2677 					iNotifyProfileGPRS.iNotifyPending=EFalse;					
       
  2678 					RPacketQoS::TQoSGPRSNegotiated notifyProfile;
       
  2679 					//echo the requested values back to the notify message and complete
       
  2680 					notifyProfile.iDelay = qosConfigV1.iReqDelay;
       
  2681 					notifyProfile.iMeanThroughput = qosConfigV1.iReqMeanThroughput;
       
  2682 					notifyProfile.iPeakThroughput = qosConfigV1.iReqPeakThroughput;
       
  2683 					notifyProfile.iPrecedence = qosConfigV1.iReqPrecedence;
       
  2684 					notifyProfile.iReliability = qosConfigV1.iReqReliability;					
       
  2685 					*(RPacketQoS::TQoSGPRSNegotiated*)iNotifyProfileGPRS.iNotifyData = notifyProfile;
       
  2686 					ReqCompleted(iNotifyProfileGPRS.iNotifyHandle,KErrNone);
       
  2687 					}
       
  2688 				iUseNetworkNotificationBool = EFalse;
       
  2689 				break;
       
  2690 				}
       
  2691 			}
       
  2692 		ReqCompleted(aTsyReqHandle,err);
       
  2693 		}
       
  2694 		// UMTS
       
  2695 	else if (configBaseV1.ExtensionId()==TPacketDataConfigBase::KConfigRel99Rel4)
       
  2696 			{
       
  2697 			TPckg<RPacketQoS::TQoSR99_R4Requested>* rel99Config = (TPckg<RPacketQoS::TQoSR99_R4Requested>*)aConfig;
       
  2698 			RPacketQoS::TQoSR99_R4Requested& qosConfigV1 = (*rel99Config)();
       
  2699 			
       
  2700 			for(TInt i=0; i<iReqR99Profiles->Count(); i++)
       
  2701 				{
       
  2702 				TProfileReqR99 profile = iReqR99Profiles->At(i);
       
  2703 
       
  2704 				if (MatchContext(profile)==KErrNone)
       
  2705 					{
       
  2706 					LOGPACKET1("====REQ QOS===");
       
  2707 	
       
  2708 					
       
  2709 					
       
  2710 				//	LOGPACKET3("Req Traffic [%d] [%d]", qosConfigV1.iReqTrafficClass, profile.iReqTraffic);
       
  2711 				//	LOGCOMMON3("Min Traffic [%d] [%d]", qosConfigV1.iMinTrafficClass, profile.iMinTraffic);
       
  2712 					LOGPACKET3("Req Del order [%d] [%d]",qosConfigV1.iReqDeliveryOrderReqd, profile.iReqDeliveryOrder);
       
  2713 					LOGPACKET3("Min Del order [%d] [%d]",qosConfigV1.iMinDeliveryOrderReqd , profile.iMinDeliveryOrder);
       
  2714 					LOGPACKET3("Req Del err SDU [%d] [%d]",qosConfigV1.iReqDeliverErroneousSDU , profile.iReqErroneousSDU);
       
  2715 					LOGPACKET3("Min Del err SDU [%d] [%d]",qosConfigV1.iMinDeliverErroneousSDU , profile.iMinErroneousSDU);
       
  2716  					LOGPACKET3("Max Sdu Size [%d] [%d]",qosConfigV1.iReqMaxSDUSize , profile.iMaxSDUSize);
       
  2717  					LOGPACKET3("Min Sdu Size [%d] [%d]",qosConfigV1.iMinAcceptableMaxSDUSize , profile.iMinSDUSize);
       
  2718   					LOGPACKET3("Req Down [%d] [%d]",qosConfigV1.iReqMaxRate.iDownlinkRate , profile.iReqDownLinkTBitRate);
       
  2719   					LOGPACKET3("Req Up [%d] [%d]", qosConfigV1.iReqMaxRate.iUplinkRate , profile.iReqUpLinkTBitRate);
       
  2720 					LOGPACKET3("Min Guar Down[%d] [%d]",qosConfigV1.iMinGuaranteedRate.iDownlinkRate , profile.iMinGuaranteedDownLinkTBitRate);
       
  2721 					LOGPACKET3("Min Guar Up [%d] [%d]",qosConfigV1.iMinGuaranteedRate.iUplinkRate , profile.iMinGuaranteedUpLinkTBitRate);
       
  2722 					LOGPACKET3("Req BER [%d] [%d]",qosConfigV1.iReqBER , profile.iReqTBitErrorRatio);
       
  2723 					LOGPACKET3("Max BER [%d] [%d]",qosConfigV1.iMaxBER , profile.iMinTBitErrorRatio);
       
  2724 					LOGPACKET3("Req SDU err ratio [%d] [%d]",qosConfigV1.iReqSDUErrorRatio , profile.iReqTSDUErrorRatio);
       
  2725 					LOGPACKET3("Max SDU err ration [%d] [%d]",qosConfigV1.iMaxSDUErrorRatio , profile.iMinTSDUErrorRatio);
       
  2726 					LOGPACKET3("Req Traffic Handling priority [%d] [%d]",qosConfigV1.iReqTrafficHandlingPriority , profile.iReqTTrafficHandlingPriority);
       
  2727 					LOGPACKET3("Min Traffic Handling priority [%d] [%d]",qosConfigV1.iMinTrafficHandlingPriority , profile.iMinTTrafficHandlingPriority);
       
  2728 					LOGPACKET3("Req Transfer Delay [%d] [%d]",qosConfigV1.iReqTransferDelay , profile.iReqTransferDelay);
       
  2729 					LOGPACKET3("Max Transfer Delay [%d] [%d]",qosConfigV1.iMaxTransferDelay , profile.iMinTransferDelay);
       
  2730 					LOGPACKET3("Req Guar downlink bitrate [%d] [%d]",qosConfigV1.iReqGuaranteedRate.iDownlinkRate , profile.iReqGuaranteedDownLinkTBitRate);
       
  2731 					LOGPACKET3("Req Guar uplink bitrate [%d] [%d]",qosConfigV1.iReqGuaranteedRate.iUplinkRate , profile.iReqGuaranteedUpLinkTBitRate);
       
  2732 					LOGPACKET3("Min Guar downlink [%d] [%d]",qosConfigV1.iMinGuaranteedRate.iDownlinkRate , profile.iMinGuaranteedDownLinkTBitRate);
       
  2733 					LOGPACKET3("Min Guar uplink  [%d] [%d]",qosConfigV1.iMinGuaranteedRate.iUplinkRate , profile.iMinGuaranteedUpLinkTBitRate);
       
  2734 						
       
  2735 					
       
  2736 					
       
  2737 					
       
  2738 					
       
  2739 					//-----------------------
       
  2740 					if (
       
  2741 				//		( qosConfigV1.iReqTrafficClass != profile.iReqTraffic)  ||
       
  2742 				//		(qosConfigV1.iMinTrafficClass != profile.iMinTraffic)||
       
  2743 						(qosConfigV1.iReqDeliveryOrderReqd != profile.iReqDeliveryOrder)||
       
  2744 						(qosConfigV1.iMinDeliveryOrderReqd != profile.iMinDeliveryOrder)||
       
  2745 						(qosConfigV1.iReqDeliverErroneousSDU != profile.iReqErroneousSDU)||
       
  2746 						(qosConfigV1.iMinDeliverErroneousSDU != profile.iMinErroneousSDU)||
       
  2747  						( (profile.iMaxSDUSize >= 0) && (qosConfigV1.iReqMaxSDUSize != profile.iMaxSDUSize) )||
       
  2748  						( (profile.iMinSDUSize >= 0) && (qosConfigV1.iMinAcceptableMaxSDUSize != profile.iMinSDUSize) )||
       
  2749   						( (profile.iReqDownLinkTBitRate >= 0) && (qosConfigV1.iReqMaxRate.iDownlinkRate != profile.iReqDownLinkTBitRate) )||
       
  2750   						( (profile.iReqUpLinkTBitRate >= 0) && (qosConfigV1.iReqMaxRate.iUplinkRate != profile.iReqUpLinkTBitRate) )||
       
  2751 						(qosConfigV1.iMinGuaranteedRate.iDownlinkRate != profile.iMinGuaranteedDownLinkTBitRate)||
       
  2752 						(qosConfigV1.iMinGuaranteedRate.iUplinkRate != profile.iMinGuaranteedUpLinkTBitRate)||
       
  2753 						(qosConfigV1.iReqBER != profile.iReqTBitErrorRatio) ||
       
  2754 						(qosConfigV1.iMaxBER != profile.iMinTBitErrorRatio) ||
       
  2755 						(qosConfigV1.iReqSDUErrorRatio != profile.iReqTSDUErrorRatio) ||
       
  2756 						(qosConfigV1.iMaxSDUErrorRatio != profile.iMinTSDUErrorRatio) ||
       
  2757 						(qosConfigV1.iReqTrafficHandlingPriority != profile.iReqTTrafficHandlingPriority) ||
       
  2758 						(qosConfigV1.iMinTrafficHandlingPriority != profile.iMinTTrafficHandlingPriority) ||
       
  2759 						(qosConfigV1.iReqTransferDelay != profile.iReqTransferDelay) ||
       
  2760 						(qosConfigV1.iMaxTransferDelay != profile.iMinTransferDelay) ||
       
  2761 						( (profile.iReqGuaranteedDownLinkTBitRate >= 0) && (qosConfigV1.iReqGuaranteedRate.iDownlinkRate != profile.iReqGuaranteedDownLinkTBitRate) )||
       
  2762 						( (profile.iReqGuaranteedUpLinkTBitRate >= 0) && (qosConfigV1.iReqGuaranteedRate.iUplinkRate != profile.iReqGuaranteedUpLinkTBitRate))||
       
  2763 						(qosConfigV1.iMinGuaranteedRate.iDownlinkRate != profile.iMinGuaranteedDownLinkTBitRate) ||
       
  2764 						(qosConfigV1.iMinGuaranteedRate.iUplinkRate != profile.iMinGuaranteedUpLinkTBitRate)
       
  2765 						)
       
  2766 						{
       
  2767 						err=KErrCorrupt;
       
  2768 						}
       
  2769 					else
       
  2770 						{
       
  2771 						err=KErrNone;
       
  2772 						iSetProfilePending = ETrue;
       
  2773 						iCurrentNeg99=i;
       
  2774 						iCurrentProfileRel = TPacketDataConfigBase::KConfigRel99Rel4;
       
  2775 						if (iNotifyProfileR99.iNotifyPending || iNotifyProfileR5.iNotifyPending)
       
  2776 							{
       
  2777 							CompleteNotifications(iNegR99Profiles->At(iCurrentNeg99));
       
  2778 							}
       
  2779 						
       
  2780 						iUseNetworkNotificationBool = EFalse;
       
  2781 						break;
       
  2782 						}
       
  2783 					}
       
  2784 				else
       
  2785 					{
       
  2786 					err = KErrNotFound;
       
  2787 					}
       
  2788 				}
       
  2789 			ReqCompleted(aTsyReqHandle,err);
       
  2790 			}
       
  2791 	else if (configBaseV1.ExtensionId()==TPacketDataConfigBase::KConfigRel5)
       
  2792 		{			
       
  2793 		TPckg<RPacketQoS::TQoSR5Requested>* rel5Config = (TPckg<RPacketQoS::TQoSR5Requested>*)aConfig;
       
  2794 		RPacketQoS::TQoSR5Requested& qosConfigV1 = (*rel5Config)();
       
  2795 
       
  2796 		for(TInt i=0; i<iReqR5Profiles->Count(); i++)
       
  2797 			{
       
  2798 			TProfileReqR5 profile = iReqR5Profiles->At(i);
       
  2799 
       
  2800 			if (MatchContext(profile)==KErrNone)
       
  2801 				{
       
  2802 				if ((qosConfigV1.iReqTrafficClass != profile.iReqTraffic ||
       
  2803 					(qosConfigV1.iMinTrafficClass != profile.iMinTraffic)||
       
  2804 					(qosConfigV1.iReqDeliveryOrderReqd != profile.iReqDeliveryOrder)||
       
  2805 					(qosConfigV1.iMinDeliveryOrderReqd != profile.iMinDeliveryOrder)||
       
  2806 					(qosConfigV1.iReqDeliverErroneousSDU != profile.iReqErroneousSDU)||
       
  2807 					(qosConfigV1.iMinDeliverErroneousSDU != profile.iMinErroneousSDU)||
       
  2808 					( (profile.iMaxSDUSize >= 0) && (qosConfigV1.iReqMaxSDUSize != profile.iMaxSDUSize) )||
       
  2809 					( (profile.iMinSDUSize >= 0) && (qosConfigV1.iMinAcceptableMaxSDUSize != profile.iMinSDUSize) )||
       
  2810   					( (profile.iReqDownLinkTBitRate >= 0) && (qosConfigV1.iReqMaxRate.iDownlinkRate != profile.iReqDownLinkTBitRate) )||
       
  2811   					( (profile.iReqUpLinkTBitRate >= 0) && qosConfigV1.iReqMaxRate.iUplinkRate != profile.iReqUpLinkTBitRate) )||
       
  2812 					(qosConfigV1.iMinGuaranteedRate.iDownlinkRate != profile.iMinGuaranteedDownLinkTBitRate)||
       
  2813 					(qosConfigV1.iMinGuaranteedRate.iUplinkRate != profile.iMinGuaranteedUpLinkTBitRate)||
       
  2814 					(qosConfigV1.iReqBER != profile.iReqTBitErrorRatio) ||
       
  2815 					(qosConfigV1.iMaxBER != profile.iMinTBitErrorRatio) ||
       
  2816 					(qosConfigV1.iReqSDUErrorRatio != profile.iReqTSDUErrorRatio) ||
       
  2817 					(qosConfigV1.iMaxSDUErrorRatio != profile.iMinTSDUErrorRatio) ||
       
  2818 					(qosConfigV1.iReqTrafficHandlingPriority != profile.iReqTTrafficHandlingPriority) ||
       
  2819 					(qosConfigV1.iMinTrafficHandlingPriority != profile.iMinTTrafficHandlingPriority) ||
       
  2820 					(qosConfigV1.iReqTransferDelay != profile.iReqTransferDelay) ||
       
  2821 					(qosConfigV1.iMaxTransferDelay != profile.iMinTransferDelay) ||
       
  2822 					( (profile.iReqGuaranteedDownLinkTBitRate >= 0) && (qosConfigV1.iReqGuaranteedRate.iDownlinkRate != profile.iReqGuaranteedDownLinkTBitRate) )||
       
  2823 					( (profile.iReqGuaranteedUpLinkTBitRate >= 0) && (qosConfigV1.iReqGuaranteedRate.iUplinkRate != profile.iReqGuaranteedUpLinkTBitRate) )||
       
  2824 					(qosConfigV1.iMinGuaranteedRate.iDownlinkRate != profile.iMinGuaranteedDownLinkTBitRate) ||
       
  2825 					(qosConfigV1.iMinGuaranteedRate.iUplinkRate != profile.iMinGuaranteedUpLinkTBitRate) ||
       
  2826 					(qosConfigV1.iSignallingIndication != profile.iSignallingIndication) ||
       
  2827 					(qosConfigV1.iSourceStatisticsDescriptor != profile.iReqTSourceStatisticsDescriptor))
       
  2828 					{
       
  2829 					err=KErrCorrupt;
       
  2830 					}
       
  2831 				else
       
  2832 					{
       
  2833 					err=KErrNone;
       
  2834 					iSetProfilePending = ETrue;
       
  2835 					iCurrentNegR5=i;
       
  2836 					iCurrentProfileRel = TPacketDataConfigBase::KConfigRel5;
       
  2837 
       
  2838 					if (iNotifyProfileR99.iNotifyPending || iNotifyProfileR5.iNotifyPending)
       
  2839 						{
       
  2840 						CompleteNotifications(iNegR5Profiles->At(iCurrentNegR5));
       
  2841 						}
       
  2842 					iUseNetworkNotificationBool = EFalse;
       
  2843 					break;
       
  2844 					}
       
  2845 				}
       
  2846 			else
       
  2847 				{
       
  2848 				err = KErrNotFound;
       
  2849 				}
       
  2850 			}
       
  2851 		ReqCompleted(aTsyReqHandle,err);
       
  2852 		}
       
  2853 	return KErrNone;
       
  2854 	}
       
  2855 
       
  2856 TInt CSimPacketQoS::SetProfileCancel(const TTsyReqHandle  aTsyReqHandle )
       
  2857 {
       
  2858 /**
       
  2859 * Cancels the Setconfig request.
       
  2860 *
       
  2861 * @param aTsyReqHandle Tsy Request handle for the client request
       
  2862 * @return err KErrNone 
       
  2863 */
       
  2864 	LOGPACKET1("CSimPacketQoS::SetProfileCancel called");
       
  2865 	
       
  2866 	TInt index  = 0;
       
  2867 	if (TSetQoSData::Find(iSetQoSData, aTsyReqHandle, index) == KErrNone)
       
  2868 		{
       
  2869 		iSetQoSData->Delete(index);
       
  2870 		}
       
  2871 	if (iSetQoSData->Count() == 0)
       
  2872 		{
       
  2873 		iSetQoSTimer->Cancel();
       
  2874 		}
       
  2875 	
       
  2876 	ReqCompleted(aTsyReqHandle, KErrCancel);
       
  2877 	
       
  2878   	return KErrNone;
       
  2879   }
       
  2880 
       
  2881 
       
  2882 TInt CSimPacketQoS::GetProfile(const TTsyReqHandle aTsyReqHandle,TDes8* aConfig)
       
  2883 /**
       
  2884 * Returns to the client the Quality of Service Requested and Minimum Profile Parameters supported.
       
  2885 * 
       
  2886 * In this TSY, Return the profile read from the config file and its up to the client to compare it
       
  2887 * with the values its expecting.
       
  2888 *
       
  2889 * @param aTsyReqHandle Tsy Request handle for the client request
       
  2890 * @param aConfig pointer containing the parameters to Get to.
       
  2891 * @return KErrNone
       
  2892 */
       
  2893 	{
       
  2894 	LOGPACKET1("CSimPacketQoS::GetProfile called");
       
  2895 	TPckg<TPacketDataConfigBase>* configBase = (TPckg<TPacketDataConfigBase>*)aConfig;
       
  2896 	TPacketDataConfigBase& configBaseV1 = (*configBase)();
       
  2897 	
       
  2898 	// GPRS
       
  2899 	if(configBaseV1.ExtensionId()==TPacketDataConfigBase::KConfigGPRS)
       
  2900 		{
       
  2901 		TPckg<RPacketQoS::TQoSGPRSNegotiated>* qosConfigGPRSPckg = (TPckg<RPacketQoS::TQoSGPRSNegotiated>*)aConfig;
       
  2902 		RPacketQoS::TQoSGPRSNegotiated& qosConfigV1 = (*qosConfigGPRSPckg)();
       
  2903 		
       
  2904 		TNegProfileConfig negProfile = iNegProfiles->At(iCurrentNeg++);
       
  2905 
       
  2906 		qosConfigV1.iDelay = STATIC_CAST(RPacketQoS::TQoSDelay,negProfile.iNegDelay);
       
  2907 		qosConfigV1.iMeanThroughput = STATIC_CAST(RPacketQoS::TQoSMeanThroughput,negProfile.iNegMeanThroughput);
       
  2908 		qosConfigV1.iPeakThroughput = STATIC_CAST(RPacketQoS::TQoSPeakThroughput,negProfile.iNegPeekThroughput);
       
  2909 		qosConfigV1.iPrecedence = STATIC_CAST(RPacketQoS::TQoSPrecedence, negProfile.iNegPrecedence);
       
  2910 		qosConfigV1.iReliability = STATIC_CAST(RPacketQoS::TQoSReliability, negProfile.iNegReliability);
       
  2911 
       
  2912 		ReqCompleted(aTsyReqHandle,KErrNone);
       
  2913 		}
       
  2914 	
       
  2915 	// UMTS
       
  2916 	else if (configBaseV1.ExtensionId()==TPacketDataConfigBase::KConfigRel99Rel4)
       
  2917 		{
       
  2918 		TPckg<RPacketQoS::TQoSR99_R4Negotiated>* qosConfigR99 = (TPckg<RPacketQoS::TQoSR99_R4Negotiated>*)aConfig;
       
  2919 		RPacketQoS::TQoSR99_R4Negotiated& qosConfigNegR99 = (*qosConfigR99)();
       
  2920 
       
  2921 		// check context names match, if not, find correct one
       
  2922 
       
  2923 		if (!iUseNetworkNotificationBool)
       
  2924 			{
       
  2925 			TProfileNegR99* R99NegProfile;
       
  2926 			TInt matchContextErr;
       
  2927 			// profile was set using R5 params, get negociated profile from R5NegProfile
       
  2928 			if (iCurrentProfileRel == TPacketDataConfigBase::KConfigRel5)
       
  2929 				{
       
  2930 				TProfileNegR5& R5NegProfile = iNegR5Profiles->At(iCurrentNegR5);
       
  2931 				matchContextErr = MatchContext(R5NegProfile);
       
  2932 				R99NegProfile = &R5NegProfile;
       
  2933 				}
       
  2934 			else // default is to use the format of the client request 
       
  2935 				{
       
  2936 				R99NegProfile = &iNegR99Profiles->At(iCurrentNeg99);
       
  2937 				matchContextErr = MatchContext(*R99NegProfile);
       
  2938 				}
       
  2939 
       
  2940 			if (matchContextErr==KErrNone)
       
  2941 				{
       
  2942 				qosConfigNegR99.iMaxSDUSize = R99NegProfile->iNegMaxSDUSize;
       
  2943 				qosConfigNegR99.iTransferDelay = R99NegProfile->iNegTransferDelay;
       
  2944 				qosConfigNegR99.iTrafficClass = STATIC_CAST(RPacketQoS::TTrafficClass, R99NegProfile->iNegTraffic);
       
  2945 				qosConfigNegR99.iDeliveryOrderReqd = STATIC_CAST(RPacketQoS::TDeliveryOrder, R99NegProfile->iNegDeliveryOrder);
       
  2946 				qosConfigNegR99.iDeliverErroneousSDU = STATIC_CAST(RPacketQoS::TErroneousSDUDelivery, R99NegProfile->iNegErroneousSDUDelivery);
       
  2947 				qosConfigNegR99.iTrafficHandlingPriority = STATIC_CAST(RPacketQoS::TTrafficHandlingPriority, R99NegProfile->iNegTrafficHandlingPriority);
       
  2948 				qosConfigNegR99.iSDUErrorRatio = STATIC_CAST(RPacketQoS::TSDUErrorRatio, R99NegProfile->iNegTSDUErrorRatio);
       
  2949 				qosConfigNegR99.iBER = STATIC_CAST(RPacketQoS::TBitErrorRatio, R99NegProfile->iNegTBitErrorRatio);
       
  2950 				qosConfigNegR99.iGuaranteedRate.iDownlinkRate = R99NegProfile->iNegGuaranteedDownLinkBitRate;
       
  2951 				qosConfigNegR99.iGuaranteedRate.iUplinkRate = R99NegProfile->iNegGuaranteedUpLinkBitRate;
       
  2952 				qosConfigNegR99.iMaxRate.iDownlinkRate = R99NegProfile->iNegMaxDownLinkRate;
       
  2953 				qosConfigNegR99.iMaxRate.iUplinkRate = R99NegProfile->iNegMaxUpLinkRate;
       
  2954 
       
  2955 				ReqCompleted(aTsyReqHandle,KErrNone);
       
  2956 				}
       
  2957 			else
       
  2958 				{
       
  2959 				ReqCompleted(aTsyReqHandle,KErrNotFound);
       
  2960 				}
       
  2961 			}
       
  2962 		else
       
  2963 			{
       
  2964 			TProfileNegR99* R99NegProfile;
       
  2965 			TInt matchContextErr;
       
  2966 			if (iCurrentProfileRel == TPacketDataConfigBase::KConfigRel5)
       
  2967 				{
       
  2968 				TProfileNegR5& R5NegProfile = iQosR5NetworkNotifications->At(iQosR5NetworkNotificationCount);
       
  2969 				matchContextErr = MatchContext(R5NegProfile);
       
  2970 				R99NegProfile = &R5NegProfile;
       
  2971 				}
       
  2972 			else // default is to use the format of the client request 
       
  2973 				{
       
  2974 				R99NegProfile = &iQosNetworkNotifications->At(iQosNetworkNotificationCount);
       
  2975 				matchContextErr = MatchContext(*R99NegProfile);
       
  2976 				}
       
  2977 
       
  2978 			if (matchContextErr==KErrNone)
       
  2979 				{
       
  2980 				qosConfigNegR99.iMaxSDUSize = R99NegProfile->iNegMaxSDUSize;
       
  2981 				qosConfigNegR99.iTransferDelay = R99NegProfile->iNegTransferDelay;
       
  2982 				qosConfigNegR99.iTrafficClass = STATIC_CAST(RPacketQoS::TTrafficClass, R99NegProfile->iNegTraffic);
       
  2983 				qosConfigNegR99.iDeliveryOrderReqd = STATIC_CAST(RPacketQoS::TDeliveryOrder, R99NegProfile->iNegDeliveryOrder);
       
  2984 				qosConfigNegR99.iDeliverErroneousSDU = STATIC_CAST(RPacketQoS::TErroneousSDUDelivery, R99NegProfile->iNegErroneousSDUDelivery);
       
  2985 				qosConfigNegR99.iTrafficHandlingPriority = STATIC_CAST(RPacketQoS::TTrafficHandlingPriority, R99NegProfile->iNegTrafficHandlingPriority);
       
  2986 				qosConfigNegR99.iSDUErrorRatio = STATIC_CAST(RPacketQoS::TSDUErrorRatio, R99NegProfile->iNegTSDUErrorRatio);
       
  2987 				qosConfigNegR99.iBER = STATIC_CAST(RPacketQoS::TBitErrorRatio, R99NegProfile->iNegTBitErrorRatio);
       
  2988 				qosConfigNegR99.iGuaranteedRate.iDownlinkRate = R99NegProfile->iNegGuaranteedDownLinkBitRate;
       
  2989 				qosConfigNegR99.iGuaranteedRate.iUplinkRate = R99NegProfile->iNegGuaranteedUpLinkBitRate;
       
  2990 				qosConfigNegR99.iMaxRate.iDownlinkRate = R99NegProfile->iNegMaxDownLinkRate;
       
  2991 				qosConfigNegR99.iMaxRate.iUplinkRate = R99NegProfile->iNegMaxUpLinkRate;
       
  2992 
       
  2993 				ReqCompleted(aTsyReqHandle,KErrNone);
       
  2994 				}
       
  2995 			else
       
  2996 				{
       
  2997 				ReqCompleted(aTsyReqHandle,KErrNotFound);
       
  2998 				}
       
  2999 			}
       
  3000 		}
       
  3001 	else if (configBaseV1.ExtensionId()==TPacketDataConfigBase::KConfigRel5)
       
  3002 		{
       
  3003 		TPckg<RPacketQoS::TQoSR5Negotiated>* qosConfigR5 = (TPckg<RPacketQoS::TQoSR5Negotiated>*)aConfig;
       
  3004 		RPacketQoS::TQoSR5Negotiated& qosConfigNegR5 = (*qosConfigR5)();
       
  3005 
       
  3006 		// check context names match, if not, find correct one
       
  3007 
       
  3008 		if (!iUseNetworkNotificationBool)
       
  3009 			{
       
  3010 			TProfileNegR5* R5NegProfile;
       
  3011 			TProfileNegR99* R99NegProfile;
       
  3012 			TInt matchContextErr;
       
  3013 
       
  3014 			// profile was set using R99/R4 params, get negociated profile from R99NegProfile
       
  3015 			if (iCurrentProfileRel == TPacketDataConfigBase::KConfigRel99Rel4)
       
  3016 				{
       
  3017 				R99NegProfile = &iNegR99Profiles->At(iCurrentNeg99);
       
  3018 				matchContextErr = MatchContext(*R99NegProfile);
       
  3019 				R5NegProfile = NULL;
       
  3020 				}
       
  3021 			else // default is to use the format of the client request 
       
  3022 				{
       
  3023 				R5NegProfile = &iNegR5Profiles->At(iCurrentNegR5);
       
  3024 				matchContextErr = MatchContext(*R5NegProfile);
       
  3025 				// R99 profile is the same as R5
       
  3026 				R99NegProfile = R5NegProfile;
       
  3027 				}
       
  3028 
       
  3029 			if (matchContextErr==KErrNone)
       
  3030 				{
       
  3031 				qosConfigNegR5.iMaxSDUSize = R99NegProfile->iNegMaxSDUSize;
       
  3032 				qosConfigNegR5.iTransferDelay = R99NegProfile->iNegTransferDelay;
       
  3033 				qosConfigNegR5.iTrafficClass = STATIC_CAST(RPacketQoS::TTrafficClass, R99NegProfile->iNegTraffic);
       
  3034 				qosConfigNegR5.iDeliveryOrderReqd = STATIC_CAST(RPacketQoS::TDeliveryOrder, R99NegProfile->iNegDeliveryOrder);
       
  3035 				qosConfigNegR5.iDeliverErroneousSDU = STATIC_CAST(RPacketQoS::TErroneousSDUDelivery, R99NegProfile->iNegErroneousSDUDelivery);
       
  3036 				qosConfigNegR5.iTrafficHandlingPriority = STATIC_CAST(RPacketQoS::TTrafficHandlingPriority, R99NegProfile->iNegTrafficHandlingPriority);
       
  3037 				qosConfigNegR5.iSDUErrorRatio = STATIC_CAST(RPacketQoS::TSDUErrorRatio, R99NegProfile->iNegTSDUErrorRatio);
       
  3038 				qosConfigNegR5.iBER = STATIC_CAST(RPacketQoS::TBitErrorRatio, R99NegProfile->iNegTBitErrorRatio);
       
  3039 				qosConfigNegR5.iGuaranteedRate.iDownlinkRate = R99NegProfile->iNegGuaranteedDownLinkBitRate;
       
  3040 				qosConfigNegR5.iGuaranteedRate.iUplinkRate = R99NegProfile->iNegGuaranteedUpLinkBitRate;
       
  3041 				qosConfigNegR5.iMaxRate.iDownlinkRate = R99NegProfile->iNegMaxDownLinkRate;
       
  3042 				qosConfigNegR5.iMaxRate.iUplinkRate = R99NegProfile->iNegMaxUpLinkRate;
       
  3043 				if (R5NegProfile != NULL)
       
  3044 					{
       
  3045 					qosConfigNegR5.iSignallingIndication = R5NegProfile->iSignallingIndication;
       
  3046 					qosConfigNegR5.iSourceStatisticsDescriptor = STATIC_CAST(RPacketQoS::TSourceStatisticsDescriptor, R5NegProfile->iNegTSourceStatisticsDescriptor);
       
  3047 					}
       
  3048 				else
       
  3049 					{
       
  3050 					qosConfigNegR5.iSignallingIndication = EFalse;
       
  3051 					qosConfigNegR5.iSourceStatisticsDescriptor = RPacketQoS::ESourceStatisticsDescriptorUnknown;
       
  3052 					}
       
  3053 				
       
  3054 				ReqCompleted(aTsyReqHandle,KErrNone);
       
  3055 				}
       
  3056 			else
       
  3057 				{
       
  3058 				ReqCompleted(aTsyReqHandle,KErrNotFound);
       
  3059 				}
       
  3060 			}
       
  3061 		else
       
  3062 			{
       
  3063 			TProfileNegR5* R5NegProfile;
       
  3064 			TProfileNegR99* R99NegProfile;
       
  3065 			TInt matchContextErr;
       
  3066 
       
  3067 			// profile was set using R99/R4 params, get negociated profile from R99NegProfile
       
  3068 			if (iCurrentProfileRel == TPacketDataConfigBase::KConfigRel99Rel4)
       
  3069 				{
       
  3070 				R99NegProfile = &iQosNetworkNotifications->At(iQosNetworkNotificationCount);
       
  3071 				matchContextErr = MatchContext(*R99NegProfile);
       
  3072 				R5NegProfile = NULL;
       
  3073 				}
       
  3074 			else // default is to use the format of the client request 
       
  3075 				{
       
  3076 				R5NegProfile = &iQosR5NetworkNotifications->At(iQosR5NetworkNotificationCount);
       
  3077 				matchContextErr = MatchContext(*R5NegProfile);
       
  3078 				// R99 profile is the same as R5
       
  3079 				R99NegProfile = R5NegProfile;
       
  3080 				}
       
  3081 
       
  3082 			if (matchContextErr==KErrNone)
       
  3083 				{
       
  3084 				qosConfigNegR5.iMaxSDUSize = R99NegProfile->iNegMaxSDUSize;
       
  3085 				qosConfigNegR5.iTransferDelay = R99NegProfile->iNegTransferDelay;
       
  3086 				qosConfigNegR5.iTrafficClass = STATIC_CAST(RPacketQoS::TTrafficClass, R99NegProfile->iNegTraffic);
       
  3087 				qosConfigNegR5.iDeliveryOrderReqd = STATIC_CAST(RPacketQoS::TDeliveryOrder, R99NegProfile->iNegDeliveryOrder);
       
  3088 				qosConfigNegR5.iDeliverErroneousSDU = STATIC_CAST(RPacketQoS::TErroneousSDUDelivery, R99NegProfile->iNegErroneousSDUDelivery);
       
  3089 				qosConfigNegR5.iTrafficHandlingPriority = STATIC_CAST(RPacketQoS::TTrafficHandlingPriority, R99NegProfile->iNegTrafficHandlingPriority);
       
  3090 				qosConfigNegR5.iSDUErrorRatio = STATIC_CAST(RPacketQoS::TSDUErrorRatio, R99NegProfile->iNegTSDUErrorRatio);
       
  3091 				qosConfigNegR5.iBER = STATIC_CAST(RPacketQoS::TBitErrorRatio, R99NegProfile->iNegTBitErrorRatio);
       
  3092 				qosConfigNegR5.iGuaranteedRate.iDownlinkRate = R99NegProfile->iNegGuaranteedDownLinkBitRate;
       
  3093 				qosConfigNegR5.iGuaranteedRate.iUplinkRate = R99NegProfile->iNegGuaranteedUpLinkBitRate;
       
  3094 				qosConfigNegR5.iMaxRate.iDownlinkRate = R99NegProfile->iNegMaxDownLinkRate;
       
  3095 				qosConfigNegR5.iMaxRate.iUplinkRate = R99NegProfile->iNegMaxUpLinkRate;
       
  3096 
       
  3097 				if (R5NegProfile != NULL)
       
  3098 					{
       
  3099 					qosConfigNegR5.iSignallingIndication = R5NegProfile->iSignallingIndication;
       
  3100 					qosConfigNegR5.iSourceStatisticsDescriptor = STATIC_CAST(RPacketQoS::TSourceStatisticsDescriptor, R5NegProfile->iNegTSourceStatisticsDescriptor);
       
  3101 					}
       
  3102 				else
       
  3103 					{
       
  3104 					qosConfigNegR5.iSignallingIndication = EFalse;
       
  3105 					qosConfigNegR5.iSourceStatisticsDescriptor = RPacketQoS::ESourceStatisticsDescriptorUnknown;
       
  3106 					}
       
  3107 
       
  3108 				ReqCompleted(aTsyReqHandle,KErrNone);
       
  3109 				}
       
  3110 			else
       
  3111 				{
       
  3112 				ReqCompleted(aTsyReqHandle,KErrNotFound);
       
  3113 				}
       
  3114 			}
       
  3115 		}
       
  3116 	return KErrNone; 
       
  3117 	}
       
  3118 
       
  3119 TInt CSimPacketQoS::GetProfileCancel(const TTsyReqHandle /*aTsyReqHandle*/)
       
  3120 /**
       
  3121 * Cancels the GetProfile request.  This method is not supported in this version of the TSY.
       
  3122 *
       
  3123 * @param aTsyReqHandle Tsy Request handle for the client cancel request
       
  3124 * @return KErrNone
       
  3125 */
       
  3126 	{
       
  3127 	LOGPACKET1("CSimPacketQoS::GetProfileCancel called");
       
  3128 	return KErrNone;
       
  3129 	}
       
  3130 
       
  3131 TInt CSimPacketQoS::GetProfileCaps(const TTsyReqHandle aTsyReqHandle,TDes8* aConfig)
       
  3132 /**
       
  3133 * Returns to the client the capabilities of the TSY.
       
  3134 * 
       
  3135 * In this TSY, Return the profile read from the config file and its up to the client to compare it
       
  3136 * with the values its expecting.
       
  3137 *
       
  3138 * @param aTsyReqHandle Tsy Request handle for the client request
       
  3139 * @param aConfig pointer containing the parameters to Get to.
       
  3140 * @return KErrNone
       
  3141 */
       
  3142 	{
       
  3143 	LOGPACKET1("CSimPacketQoS::GetProfileCaps called");
       
  3144 	TPckg<TPacketDataConfigBase>* configBase = (TPckg<TPacketDataConfigBase>*)aConfig;
       
  3145 	TPacketDataConfigBase& configBaseV1 = (*configBase)();
       
  3146 
       
  3147 	// GPRS
       
  3148 	if(configBaseV1.ExtensionId()==TPacketDataConfigBase::KConfigGPRS)
       
  3149 		{
       
  3150 		TPckg<RPacketQoS::TQoSCapsGPRS>* qosCapsGPRSPckg = (TPckg<RPacketQoS::TQoSCapsGPRS>*)aConfig;
       
  3151 		RPacketQoS::TQoSCapsGPRS& qosCaps = (*qosCapsGPRSPckg)();
       
  3152 
       
  3153 		qosCaps.iDelay = STATIC_CAST(RPacketQoS::TQoSDelay,iCapsGPRS.iDelay);
       
  3154 		qosCaps.iMean = STATIC_CAST(RPacketQoS::TQoSMeanThroughput,iCapsGPRS.iMean);
       
  3155 		qosCaps.iPeak = STATIC_CAST(RPacketQoS::TQoSPeakThroughput,iCapsGPRS.iPeak);
       
  3156 		qosCaps.iPrecedence = STATIC_CAST(RPacketQoS::TQoSPrecedence, iCapsGPRS.iPrecedence);
       
  3157 		qosCaps.iReliability = STATIC_CAST(RPacketQoS::TQoSReliability, iCapsGPRS.iReliability);
       
  3158 		ReqCompleted(aTsyReqHandle,KErrNone);
       
  3159 		}
       
  3160 	
       
  3161 	// UMTS
       
  3162 	else if (configBaseV1.ExtensionId()==TPacketDataConfigBase::KConfigRel99Rel4)
       
  3163 		{
       
  3164 		TPckg<RPacketQoS::TQoSCapsR99_R4>* qosCapsR99Pckg = (TPckg<RPacketQoS::TQoSCapsR99_R4>*)aConfig;
       
  3165 		RPacketQoS::TQoSCapsR99_R4& r99Caps = (*qosCapsR99Pckg)();
       
  3166 
       
  3167 		r99Caps.iBER = iCapsR99.iBER;
       
  3168 		r99Caps.iDeliverErroneousSDU = iCapsR99.iDeliverErroneousSDU;
       
  3169 		r99Caps.iDeliveryOrderReqd = iCapsR99.iDeliveryOrderReq;
       
  3170 		r99Caps.iSDUErrorRatio = iCapsR99.iSDUErrorRatio;
       
  3171 		r99Caps.iTrafficClass = iCapsR99.iTraffic;
       
  3172 		r99Caps.iTrafficHandlingPriority = iCapsR99.iTrafficHandlingPriority;
       
  3173 		ReqCompleted(aTsyReqHandle,KErrNone);
       
  3174 		}
       
  3175 	else if (configBaseV1.ExtensionId()==TPacketDataConfigBase::KConfigRel5)
       
  3176 		{
       
  3177 		TPckg<RPacketQoS::TQoSCapsR5>* qosCapsR5Pckg = (TPckg<RPacketQoS::TQoSCapsR5>*)aConfig;
       
  3178 		RPacketQoS::TQoSCapsR5& r5Caps = (*qosCapsR5Pckg)();
       
  3179 		r5Caps.iBER = iCapsR5.iBER;
       
  3180 		r5Caps.iDeliverErroneousSDU = iCapsR5.iDeliverErroneousSDU;
       
  3181 		r5Caps.iDeliveryOrderReqd = iCapsR5.iDeliveryOrderReq;
       
  3182 		r5Caps.iSDUErrorRatio = iCapsR5.iSDUErrorRatio;
       
  3183 		r5Caps.iTrafficClass = iCapsR5.iTraffic;
       
  3184 		r5Caps.iTrafficHandlingPriority = iCapsR5.iTrafficHandlingPriority;
       
  3185 		r5Caps.iSignallingIndication = iCapsR5.iSignallingIndication;
       
  3186 		r5Caps.iSourceStatisticsDescriptor = iCapsR5.iNegTSourceStatisticsDescriptor;
       
  3187 		ReqCompleted(aTsyReqHandle,KErrNone);
       
  3188 		}
       
  3189 
       
  3190 
       
  3191 	return KErrNone;
       
  3192 	}
       
  3193 
       
  3194 TInt CSimPacketQoS::GetProfileCapsCancel(const TTsyReqHandle /*aTsyReqHandle*/)
       
  3195 /**
       
  3196 * Cancels the GetProfileCaps request.  This method is not supported in this version of the TSY.
       
  3197 *
       
  3198 * @param aTsyReqHandle Tsy Request handle for the client cancel request
       
  3199 * @return KErrNone
       
  3200 */
       
  3201 	{
       
  3202 	LOGPACKET1("CSimPacketQoS::GetProfileCapsCancel called");
       
  3203 	return KErrNone;
       
  3204 	}
       
  3205 
       
  3206 TInt CSimPacketQoS::NotifyProfileChanged(const TTsyReqHandle aTsyReqHandle, TDes8* aConfig)
       
  3207 /**
       
  3208 * Records a client interest in being notified of a change in the QoS Profile.
       
  3209 *
       
  3210 * @param aTsyReqHandle Tsy Request handle for the client request
       
  3211 * @param aConfig pointer to the profile to store the profile info when the profile changes.
       
  3212 * @return KErrNone
       
  3213 */
       
  3214 {
       
  3215 	TPckg<TPacketDataConfigBase>* configBase = (TPckg<TPacketDataConfigBase>*)aConfig;
       
  3216 	TPacketDataConfigBase& configBaseV1 = (*configBase)();
       
  3217 	
       
  3218 
       
  3219 	if (configBaseV1.ExtensionId() == TPacketDataConfigBase::KConfigGPRS)
       
  3220 		{
       
  3221 		__ASSERT_ALWAYS(!iNotifyProfileGPRS.iNotifyPending,SimPanic(ENotificationAlreadyPending));
       
  3222 		iNotifyProfileGPRS.iNotifyPending = ETrue;
       
  3223 		iNotifyProfileGPRS.iNotifyHandle = aTsyReqHandle;
       
  3224 		iNotifyProfileGPRS.iNotifyData = &configBaseV1;
       
  3225 		}
       
  3226 	
       
  3227 	else if (configBaseV1.ExtensionId() == TPacketDataConfigBase::KConfigRel99Rel4)
       
  3228 		{
       
  3229 		__ASSERT_ALWAYS(!iNotifyProfileR99.iNotifyPending,SimPanic(ENotificationAlreadyPending));
       
  3230 		iNotifyProfileR99.iNotifyPending = ETrue;
       
  3231 		iNotifyProfileR99.iNotifyHandle = aTsyReqHandle;
       
  3232 		iNotifyProfileR99.iNotifyData = &configBaseV1;
       
  3233 		// start network events only if the release format used to set this QoS profile is R99_R4
       
  3234 		if (!iUseNetworkNotificationBool && iNetworkNotificationType == ETimer && iCurrentProfileRel == TPacketDataConfigBase::KConfigRel99Rel4)
       
  3235 			{
       
  3236 			TInt count=iQosNetworkNotifications->Count();
       
  3237 
       
  3238 			for(TInt i = 0; i<count; i++)
       
  3239 				{
       
  3240 				TProfileNegR99 qos = (TProfileNegR99)iQosNetworkNotifications->At(i);
       
  3241 				if(qos.iContextName.Compare(iPacketContext->ContextName()) == 0)
       
  3242 					{	
       
  3243 					if (iTimerStartedBool)
       
  3244 						{
       
  3245 						delete iTimer;
       
  3246 						iTimer = NULL;
       
  3247 						TRAP_IGNORE(iTimer=CSimTimer::NewL(iPhone));	
       
  3248 						}
       
  3249 					iUseNetworkNotificationBool = ETrue;
       
  3250 					iQosNetworkNotificationCount = i;
       
  3251 					iTimerStartedBool=ETrue;
       
  3252 
       
  3253 					if (iTimer != NULL)
       
  3254 						iTimer->Start(qos.iDuration, this, ETimerIdPcktQosNetWork);
       
  3255 					break;
       
  3256 					}
       
  3257 				}
       
  3258 			}			
       
  3259 		}
       
  3260 	else if (configBaseV1.ExtensionId() == TPacketDataConfigBase::KConfigRel5)
       
  3261 		{
       
  3262 		__ASSERT_ALWAYS(!iNotifyProfileR5.iNotifyPending,SimPanic(ENotificationAlreadyPending));
       
  3263 		iNotifyProfileR5.iNotifyPending = ETrue;
       
  3264 		iNotifyProfileR5.iNotifyHandle = aTsyReqHandle;
       
  3265 		iNotifyProfileR5.iNotifyData = &configBaseV1;
       
  3266 		// start network events only if the release format used to set this QoS profile is R5
       
  3267 		if (!iUseNetworkNotificationBool && iNetworkNotificationType == ETimer && iCurrentProfileRel == TPacketDataConfigBase::KConfigRel5)
       
  3268 			{
       
  3269 			TInt count=iQosR5NetworkNotifications->Count();
       
  3270 
       
  3271 			for(TInt i = 0; i<count; i++)
       
  3272 				{
       
  3273 				TProfileNegR5 qos = (TProfileNegR5)iQosR5NetworkNotifications->At(i);
       
  3274 				if(qos.iContextName.Compare(iPacketContext->ContextName()) == 0)
       
  3275 					{
       
  3276 					if (iTimerStartedBool)
       
  3277 						{
       
  3278 						delete iTimer;
       
  3279 						iTimer = NULL;
       
  3280 						TRAP_IGNORE(iTimer=CSimTimer::NewL(iPhone));	
       
  3281 						}
       
  3282 					iUseNetworkNotificationBool = ETrue;
       
  3283 					iQosR5NetworkNotificationCount = i;
       
  3284 					iTimerStartedBool=ETrue;
       
  3285 
       
  3286 					if (iTimer != NULL)
       
  3287 						iTimer->Start(qos.iDuration, this, ETimerIdPcktQosR5Network);
       
  3288 					break;
       
  3289 					}
       
  3290 				}
       
  3291 			}			
       
  3292 		}
       
  3293 	return KErrNone;
       
  3294 }
       
  3295 
       
  3296 TInt CSimPacketQoS::NotifyProfileChangedCancel(const TTsyReqHandle aTsyReqHandle)
       
  3297 /**
       
  3298 * Cancel a client's interest in being notified when the profile configuration changes
       
  3299 * This is acheived simply by resetting the flag that indicates a notification is pending.
       
  3300 * 
       
  3301 * @param aTsyReqHandle Tsy Request handle for the client cancel request
       
  3302 * @return KErrNone
       
  3303 */
       
  3304 {
       
  3305 	LOGPACKET1("CSimPacketQoS::NotifyProfileChangedCancel called");
       
  3306 	if(iNotifyProfileGPRS.iNotifyPending &&	iNotifyProfileGPRS.iNotifyHandle == aTsyReqHandle)
       
  3307 		{
       
  3308 		iNotifyProfileGPRS.iNotifyPending=EFalse;
       
  3309 		ReqCompleted(aTsyReqHandle,KErrCancel);
       
  3310 		}
       
  3311 	
       
  3312 	else if(iNotifyProfileR99.iNotifyPending &&	iNotifyProfileR99.iNotifyHandle == aTsyReqHandle)
       
  3313 		{
       
  3314 		iNotifyProfileR99.iNotifyPending=EFalse;
       
  3315 		if (iTimer != NULL)
       
  3316 			iTimer->Cancel();
       
  3317 		ReqCompleted(aTsyReqHandle,KErrCancel);
       
  3318 		}
       
  3319 	else if(iNotifyProfileR5.iNotifyPending &&	iNotifyProfileR5.iNotifyHandle == aTsyReqHandle)
       
  3320 		{
       
  3321 		iNotifyProfileR5.iNotifyPending=EFalse;
       
  3322 		if (iTimer != NULL)
       
  3323 			iTimer->Cancel();
       
  3324 		ReqCompleted(aTsyReqHandle,KErrCancel);
       
  3325 		}
       
  3326 	return KErrNone;
       
  3327 }
       
  3328 
       
  3329 /**
       
  3330 *	This function matches the Rel99 Release profile to one in the array of Rel99 Release profiles
       
  3331 */
       
  3332 TInt CSimPacketQoS::MatchContext(TProfileReqR99& aR99ReqProfile)
       
  3333 {
       
  3334 	if (iPacketContext->ContextName().Compare(aR99ReqProfile.iContextName)==0)
       
  3335 		{
       
  3336 		return KErrNone;
       
  3337 		}
       
  3338 	else
       
  3339 		{
       
  3340 		TInt count = iReqR99Profiles->Count();
       
  3341 		for (TInt i = 0; i<count; i++)
       
  3342 			{
       
  3343 			TProfileReqR99 profile = iReqR99Profiles->At(i);
       
  3344 			
       
  3345 			if (iPacketContext->ContextName().Compare(profile.iContextName)==0)
       
  3346 				{
       
  3347 				aR99ReqProfile = profile;
       
  3348 				return KErrNone;
       
  3349 				}
       
  3350 			}
       
  3351 		}
       
  3352 	return KErrNotFound;
       
  3353 }
       
  3354 
       
  3355 
       
  3356 /**
       
  3357 *	This function matches the Rel99 Negotiated profile to one in the array of Rel99 Negotiated profiles
       
  3358 */
       
  3359 TInt CSimPacketQoS::MatchContext(TProfileNegR99& aR99NegProfile)
       
  3360 {
       
  3361 	if (iPacketContext->ContextName().Compare(aR99NegProfile.iContextName)==0)
       
  3362 		{
       
  3363 		return KErrNone;
       
  3364 		}
       
  3365 	else
       
  3366 		{
       
  3367 		TInt count = iNegR99Profiles->Count();
       
  3368 		for (TInt i = 0; i<count; i++)
       
  3369 			{
       
  3370 			TProfileNegR99 profile = iNegR99Profiles->At(i);
       
  3371 			
       
  3372 			if (iPacketContext->ContextName().Compare(profile.iContextName)==0)
       
  3373 				{
       
  3374 				aR99NegProfile = profile;
       
  3375 				return KErrNone;
       
  3376 				}
       
  3377 			}
       
  3378 		}
       
  3379 	return KErrNotFound;
       
  3380 }
       
  3381 
       
  3382 /**
       
  3383 *	This function matches the Rel5 Release profile to one in the array of Rel5 Release profiles
       
  3384 */
       
  3385 TInt CSimPacketQoS::MatchContext(TProfileReqR5& aR5ReqProfile)
       
  3386 {
       
  3387 	if (iPacketContext->ContextName().Compare(aR5ReqProfile.iContextName)==0)
       
  3388 		{
       
  3389 		return KErrNone;
       
  3390 		}
       
  3391 	else
       
  3392 		{
       
  3393 		TInt count = iReqR5Profiles->Count();
       
  3394 		for (TInt i = 0; i<count; i++)
       
  3395 			{
       
  3396 			TProfileReqR5 profile = iReqR5Profiles->At(i);
       
  3397 			
       
  3398 			if (iPacketContext->ContextName().Compare(profile.iContextName)==0)
       
  3399 				{
       
  3400 				aR5ReqProfile = profile;
       
  3401 				return KErrNone;
       
  3402 				}
       
  3403 			}
       
  3404 		}
       
  3405 	return KErrNotFound;
       
  3406 }
       
  3407 
       
  3408 
       
  3409 /**
       
  3410 *	This function matches the Rel99 Negotiated profile to one in the array of Rel99 Negotiated profiles
       
  3411 */
       
  3412 TInt CSimPacketQoS::MatchContext(TProfileNegR5& aR5NegProfile)
       
  3413 {
       
  3414 	if (iPacketContext->ContextName().Compare(aR5NegProfile.iContextName)==0)
       
  3415 		{
       
  3416 		return KErrNone;
       
  3417 		}
       
  3418 	else
       
  3419 		{
       
  3420 		TInt count = iNegR5Profiles->Count();
       
  3421 		for (TInt i = 0; i<count; i++)
       
  3422 			{
       
  3423 			TProfileNegR5 profile = iNegR5Profiles->At(i);
       
  3424 			
       
  3425 			if (iPacketContext->ContextName().Compare(profile.iContextName)==0)
       
  3426 				{
       
  3427 				aR5NegProfile = profile;
       
  3428 				return KErrNone;
       
  3429 				}
       
  3430 			}
       
  3431 		}
       
  3432 	return KErrNotFound;
       
  3433 }
       
  3434 
       
  3435 void CSimPacketQoS::ClearChangeQoSPending()
       
  3436 	{
       
  3437 	iSetProfilePending = EFalse;
       
  3438 	}
       
  3439 	
       
  3440 /**
       
  3441 *  Sets the current negotiated profile to the required profile parameters
       
  3442 */
       
  3443 TInt CSimPacketQoS::PerformProfileChange()
       
  3444 	{
       
  3445 	if (iSetProfilePending)
       
  3446 		{
       
  3447 		iSetProfilePending = EFalse;
       
  3448 		return KErrNone;
       
  3449 		}
       
  3450 	return KErrNotReady;
       
  3451 	}
       
  3452 	
       
  3453 TInt CSimPacketQoS::TSetQoSData::Find(CArrayFixFlat<TSetQoSData>* aSetQoSArray, TTsyReqHandle aTsyReqHandle, TInt& aIndex)
       
  3454 /**
       
  3455 * Finds a qos data set from array using the tsy request handle
       
  3456 *
       
  3457 * @param CArrayFixFlat<TSetQoSData>* aSetQoSArray - Array of qos data stored
       
  3458 * @param TTsyReqHandle aTsyReqHandle  - Tsy request handle for the client
       
  3459 * @param TInt& aIndex - Index of current qos data set
       
  3460 * @return KErrNone or KErrNotFound 
       
  3461 */
       
  3462 
       
  3463 	{
       
  3464 	for (TInt i = 0; i < aSetQoSArray->Count(); i++)
       
  3465 		{
       
  3466 		if (aSetQoSArray->At(i).iTsyReqHandle == aTsyReqHandle)
       
  3467 			{
       
  3468 			aIndex = i;
       
  3469 			return KErrNone;
       
  3470 			}
       
  3471 		}
       
  3472 	aIndex = -1;
       
  3473 	return KErrNotFound;
       
  3474 	}