telephonyprotocols/umtsgprsscpr/src/UmtsGprs_defaultSubconnProv.cpp
changeset 68 d0d9cc530d21
parent 62 8ef833fbf5aa
child 75 f45cd1ad4667
equal deleted inserted replaced
62:8ef833fbf5aa 68:d0d9cc530d21
     1 // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // Implementation file for the Default Umts/Gprs SubConnection Provider
       
    15 // 
       
    16 //
       
    17 
       
    18 /**
       
    19  @file
       
    20  @internalComponent
       
    21 */
       
    22 
       
    23 
       
    24 #include "UmtsGprs_defaultSubconnProv.h"
       
    25 #include "UmtsGprs_subconnProvFactory.h"
       
    26 #include "PdpFsmRequest.h"
       
    27 
       
    28 #include <commsdattypesv1_1.h>
       
    29 #include <ss_connsettings.h>
       
    30 
       
    31 #ifdef SYMBIAN_NETWORKING_UMTSR5
       
    32 #include <ip_subconparams.h>
       
    33 #endif	
       
    34 
       
    35 CUmtsGprsDefaultSubConnProvd* CUmtsGprsDefaultSubConnProvd::NewL(CSubConnectionProviderFactoryBase& aFactory, 
       
    36 	                          CConnectionProviderBase& aConnProvider)
       
    37     {
       
    38     CUmtsGprsDefaultSubConnProvd* provider = new(ELeave)CUmtsGprsDefaultSubConnProvd(aFactory, aConnProvider);
       
    39 	CleanupStack::PushL(provider);
       
    40     provider->ConstructL();
       
    41     CleanupStack::Pop(provider);
       
    42     return provider;
       
    43     }
       
    44 
       
    45 
       
    46 
       
    47 CUmtsGprsDefaultSubConnProvd::CUmtsGprsDefaultSubConnProvd(
       
    48                               CSubConnectionProviderFactoryBase& aFactory, 
       
    49 	                          CConnectionProviderBase& aConnProvider)
       
    50 :CUmtsGprsSubConnProvd(aFactory, aConnProvider),
       
    51  iPdpFsm(NULL)
       
    52 /** 
       
    53 Constructs a default UMTS SubConnection Provider
       
    54 
       
    55 @param aFactory CSubConnectionProviderFactoryBase that should own the reference to 'this'
       
    56 @param aConnProvider a connection that 'this' subconnection belongs to
       
    57 */
       
    58 	{
       
    59 	iContextId = KPrimaryContextId;
       
    60 	}
       
    61 
       
    62 
       
    63 void CUmtsGprsDefaultSubConnProvd::ConstructL()
       
    64     {
       
    65     iPdpFsm = new(ELeave) CPdpFsmInterface(*this);
       
    66     }
       
    67     
       
    68     
       
    69 CUmtsGprsDefaultSubConnProvd::~CUmtsGprsDefaultSubConnProvd()
       
    70     {
       
    71     delete iPdpFsm;
       
    72     }
       
    73     
       
    74     
       
    75 CUmtsGprsSubConnProvd& CUmtsGprsDefaultSubConnProvd::GetDefaultSubConnection()
       
    76     {
       
    77     return *this;
       
    78     }
       
    79 
       
    80 TBool CUmtsGprsDefaultSubConnProvd::ShouldIDeleteNow()
       
    81     {
       
    82     // Never allow client leaving events to destroy this default scpr
       
    83     // The CPr will call ConnectionGoingDown when it is deleted
       
    84     // and then we will delete this.
       
    85     return EFalse;
       
    86     }
       
    87 
       
    88 
       
    89 #ifdef SYMBIAN_NETWORKING_UMTSR5
       
    90 
       
    91 TInt CUmtsGprsDefaultSubConnProvd::AddIMCNInformationToParameterBundleL(TBool aImCnInfo)
       
    92 
       
    93 /**
       
    94 Will add the information related to the IMCN Signalling Flag into the SubCon Parameter Bundle
       
    95 so that it can be accessible by the IPSCPR while restricting the sockets
       
    96 
       
    97 @param aImCnInfo Grant status of the IMCN signalling flag  
       
    98 */
       
    99 
       
   100 	{
       
   101 	// Check and create the parameter bundle if NULL
       
   102 	if (iParameterBundle == NULL)
       
   103 		{
       
   104 		iParameterBundle = CSubConParameterBundle::NewL();
       
   105 		}
       
   106 		
       
   107 	// Add information Regarding the grant status to the parameter bundle with family
       
   108     CSubConParameterFamily * imcnFamily = CSubConParameterFamily::NewL(*iParameterBundle,KSubConnContextDescrParamsFamily);
       
   109 	CleanupStack::PushL(imcnFamily);
       
   110 	CSubConImsExtParamSet *imcnFlag = CSubConImsExtParamSet::NewL(*imcnFamily,CSubConParameterFamily::EGranted);
       
   111 	CleanupStack::Pop(imcnFamily);
       
   112 	// Set the Signalling Indication
       
   113 	imcnFlag->SetImsSignallingIndicator(aImCnInfo);
       
   114 	
       
   115 	return KErrNone;
       
   116 	}
       
   117 
       
   118 #endif //SYMBIAN_NETWORKING_UMTSR5
       
   119 
       
   120 
       
   121 void CUmtsGprsDefaultSubConnProvd::DoParametersAboutToBeSetL(CSubConParameterBundle& aParameterBundle)
       
   122 /** Should set parameters on the primary/default PDP context represented by 'this'
       
   123 
       
   124 @param 
       
   125 */
       
   126 {
       
   127 	__FLOG_1(_L("CUmtsGprsDefaultSubConnProvd [this=%08x]:\tDoParametersAboutToBeSetL()"), this);
       
   128 
       
   129 	if (iCurrentPdpFsmReq)
       
   130 	{
       
   131 	User::Leave(KErrInUse);
       
   132 	}
       
   133 
       
   134 #ifdef SYMBIAN_NETWORKING_UMTSR5
       
   135 	// For PREQ 635, The information regarding the dedicated signalling indication is used to be stored in the
       
   136 	// iParameterBundle of the Base class. Since after this call and lower layer calls (if any) is completed then 
       
   137 	// iParameterBundle will be replaced by aParameterBundle coming as formal function parameters. 
       
   138 
       
   139 	// To be able to save the information if somebody calls RSubConnection::SetParameters(...), which is there in 
       
   140 	// existing Parameter Bundle we need to copy the information about IMCN Signalling flag which is already there 
       
   141 	// iParameterBundle into aParameterBundle. 
       
   142 	
       
   143 	// The catch here is that The layer above this must call the SetParameters() to get the parameter values, because
       
   144 	// This particular call adds the granted status
       
   145 
       
   146 	// Check for the existance of the appropriate family
       
   147 	CSubConParameterFamily * imCnFamily = iParameterBundle != NULL ? iParameterBundle->FindFamily(KSubConnContextDescrParamsFamily): NULL;
       
   148 	if (imCnFamily)
       
   149 		{
       
   150 		// we have the Family, get the status of IMCN signalling Flag
       
   151 		CSubConImsExtParamSet *imCnSig = static_cast<CSubConImsExtParamSet*>
       
   152     	(imCnFamily->FindExtensionSet(STypeId::CreateSTypeId(KSubConIPParamsUid,KSubConImsExtParamsType), 
       
   153     	CSubConParameterFamily::EGranted));
       
   154 		
       
   155 		// We have the variable, copy the contents
       
   156 		if(imCnSig)
       
   157     		{ 
       
   158     		CSubConParameterFamily * contextFamily = CSubConParameterFamily::NewL(aParameterBundle,KSubConnContextDescrParamsFamily);
       
   159 			CleanupStack::PushL(contextFamily);
       
   160     	  	CSubConImsExtParamSet *imCnFlag = CSubConImsExtParamSet::NewL(*contextFamily,CSubConParameterFamily::EGranted);
       
   161 			CleanupStack::Pop(contextFamily);
       
   162 		    imCnFlag->SetImsSignallingIndicator(imCnSig->GetImsSignallingIndicator());
       
   163     	  	}
       
   164 		}
       
   165 
       
   166 #endif // SYMBIAN_NETWORKING_UMTSR5 
       
   167 
       
   168     ResetQosRelease();
       
   169 	
       
   170 #ifdef SYMBIAN_NETWORKING_UMTSR5
       
   171     
       
   172         RPacketQoS::TQoSR5Requested requestedParams;
       
   173         MapQosParamBundleToEtelL(aParameterBundle, &requestedParams);
       
   174         CModifyR5QoS* modifyR5QoS = CModifyR5QoS::NewL(*this, *this, requestedParams);
       
   175         iCurrentPdpFsmReq = modifyR5QoS;
       
   176         modifyR5QoS->Start();
       
   177         
       
   178 #else
       
   179 		RPacketQoS::TQoSR99_R4Requested requestedParams;
       
   180 		MapQosParamBundleToEtelL(aParameterBundle, &requestedParams);
       
   181 		CModifyR4QoS* modifyR4QoS = CModifyR4QoS::NewL(*this, *this, requestedParams);
       
   182 		iCurrentPdpFsmReq = modifyR4QoS;
       
   183 		modifyR4QoS->Start();
       
   184 		
       
   185 #endif // SYMBIAN_NETWORKING_UMTSR5
       
   186 
       
   187 }
       
   188     
       
   189 
       
   190 void CUmtsGprsDefaultSubConnProvd::GetQoSDefaultsL(RPacketQoS::TQoSR99_R4Requested* aParams)
       
   191 {
       
   192    CConnectionSettings& settingAccess = iConnectionProvider->SettingsAccessL();
       
   193 	TUint32 data;
       
   194 	    
       
   195 	settingAccess.GetIntSettingL(TPtrC(KCDTypeNameGPRSReqTrafficClass),data, NULL);
       
   196 	aParams->iReqTrafficClass = (RPacketQoS::TTrafficClass)data;
       
   197 	
       
   198 	settingAccess.GetIntSettingL(TPtrC(KCDTypeNameGPRSMinTrafficClass),data, NULL);
       
   199 	aParams->iMinTrafficClass = (RPacketQoS::TTrafficClass)data;
       
   200 	
       
   201 	settingAccess.GetIntSettingL(TPtrC(KCDTypeNameGPRSReqDeliveryOrder),data, NULL);
       
   202 	aParams->iReqDeliveryOrderReqd = (RPacketQoS::TDeliveryOrder)data;
       
   203 	
       
   204 	settingAccess.GetIntSettingL(TPtrC(KCDTypeNameGPRSMinDeliveryOrder),data, NULL);
       
   205 	aParams->iMinDeliveryOrderReqd = (RPacketQoS::TDeliveryOrder)data;
       
   206 	
       
   207 	settingAccess.GetIntSettingL(TPtrC(KCDTypeNameGPRSReqDeliverErroneousSDU),data, NULL);
       
   208 	aParams->iReqDeliverErroneousSDU = (RPacketQoS::TErroneousSDUDelivery)data;
       
   209 	
       
   210 	settingAccess.GetIntSettingL(TPtrC(KCDTypeNameGPRSMinDeliverErroneousSDU),data, NULL);
       
   211 	aParams->iMinDeliverErroneousSDU = (RPacketQoS::TErroneousSDUDelivery)data;
       
   212 	
       
   213 	settingAccess.GetIntSettingL(TPtrC(KCDTypeNameGPRSReqMaxSDUSize),data, NULL);
       
   214 	aParams->iReqMaxSDUSize = (TInt)data;
       
   215 	
       
   216 	settingAccess.GetIntSettingL(TPtrC(KCDTypeNameGPRSMinAcceptableMaxSDUSize),data, NULL);
       
   217 	aParams->iMinAcceptableMaxSDUSize = (TInt)data;
       
   218 	
       
   219 	settingAccess.GetIntSettingL(TPtrC(KCDTypeNameGPRSReqMaxUplinkRate),data, NULL);
       
   220 	aParams->iReqMaxRate.iUplinkRate = (TInt)data;
       
   221 	
       
   222 	settingAccess.GetIntSettingL(TPtrC(KCDTypeNameGPRSReqMinUplinkRate),data, NULL);
       
   223 	aParams->iMinAcceptableMaxRate.iUplinkRate = (TInt)data;
       
   224 	
       
   225 	settingAccess.GetIntSettingL(TPtrC(KCDTypeNameGPRSReqMaxDownlinkRate),data, NULL);
       
   226 	aParams->iReqMaxRate.iDownlinkRate = (TInt)data;
       
   227 	
       
   228 	settingAccess.GetIntSettingL(TPtrC(KCDTypeNameGPRSReqMinDownlinkRate),data, NULL);
       
   229 	aParams->iMinAcceptableMaxRate.iDownlinkRate = (TInt)data;
       
   230 		
       
   231 	settingAccess.GetIntSettingL(TPtrC(KCDTypeNameGPRSReqBER),data, NULL);
       
   232 	aParams->iReqBER = (RPacketQoS::TBitErrorRatio)data;
       
   233 	
       
   234 	settingAccess.GetIntSettingL(TPtrC(KCDTypeNameGPRSMaxBER),data, NULL);
       
   235 	aParams->iMaxBER = (RPacketQoS::TBitErrorRatio)data;
       
   236 	
       
   237 	settingAccess.GetIntSettingL(TPtrC(KCDTypeNameGPRSReqSDUErrorRatio),data, NULL);
       
   238 	aParams->iReqSDUErrorRatio = (RPacketQoS::TSDUErrorRatio)data;
       
   239 	
       
   240 	settingAccess.GetIntSettingL(TPtrC(KCDTypeNameGPRSMaxSDUErrorRatio),data, NULL);
       
   241 	aParams->iMaxSDUErrorRatio = (RPacketQoS::TSDUErrorRatio)data;
       
   242 	
       
   243 	settingAccess.GetIntSettingL(TPtrC(KCDTypeNameGPRSReqTrafficHandlingPriority),data, NULL);
       
   244 	aParams->iReqTrafficHandlingPriority = (RPacketQoS::TTrafficHandlingPriority)data;
       
   245 	
       
   246 	settingAccess.GetIntSettingL(TPtrC(KCDTypeNameGPRSMinTrafficHandlingPriority),data, NULL);
       
   247 	aParams->iMinTrafficHandlingPriority = (RPacketQoS::TTrafficHandlingPriority)data;
       
   248 	
       
   249 	settingAccess.GetIntSettingL(TPtrC(KCDTypeNameGPRSReqTransferDelay),data, NULL);
       
   250 	aParams->iReqTransferDelay = (TInt)data;
       
   251 	
       
   252 	settingAccess.GetIntSettingL(TPtrC(KCDTypeNameGPRSMaxTransferDelay),data, NULL);
       
   253 	aParams->iMaxTransferDelay = (TInt)data;
       
   254 	
       
   255 	settingAccess.GetIntSettingL(TPtrC(KCDTypeNameGPRSReqGuaranteedUplinkRate),data, NULL);
       
   256 	aParams->iReqGuaranteedRate.iUplinkRate = (TInt)data;
       
   257 	
       
   258 	settingAccess.GetIntSettingL(TPtrC(KCDTypeNameGPRSMinGuaranteedUplinkRate),data, NULL);			
       
   259 	aParams->iMinGuaranteedRate.iUplinkRate = (TInt)data;
       
   260 	
       
   261 	settingAccess.GetIntSettingL(TPtrC(KCDTypeNameGPRSReqGuaranteedDownlinkRate),data, NULL);
       
   262 	aParams->iMinGuaranteedRate.iDownlinkRate = (TInt)data;
       
   263 		
       
   264 	settingAccess.GetIntSettingL(TPtrC(KCDTypeNameGPRSMinGuaranteedDownlinkRate),data, NULL);
       
   265 	aParams->iMinGuaranteedRate.iDownlinkRate = (TInt)data;
       
   266 }
       
   267 
       
   268 
       
   269 
       
   270 
       
   271 /** 
       
   272 This override of the DoControl() method is used to initialise the RPdpFsmInterface object
       
   273 in the SpudMan with a pointer to the real CPdpFsmInterface object owned by the 
       
   274 subconnection provider.
       
   275 
       
   276 @param aOptionLevel
       
   277 @param aOptionName
       
   278 @param aOption
       
   279 */
       
   280 TInt CUmtsGprsDefaultSubConnProvd::DoControl(TUint aOptionLevel, TUint aOptionName, TDes8& aOption)
       
   281     {
       
   282 	__FLOG_1(_L("CUmtsGprsDefaultSubConnProvd::DoControl [%08x]"), this);
       
   283 	if (aOptionLevel == KSOLInterface && aOptionName == KInitialisePdpFsm)
       
   284     	{
       
   285     	CNifIfBase* nif = *reinterpret_cast<CNifIfBase**>(const_cast<TUint8*>(aOption.Ptr()));
       
   286     	ASSERT(nif != NULL);
       
   287         TPckg<MPdpFsmInterface*> pdpfsm(iPdpFsm);    	
       
   288     	return nif->Control(KSOLInterface, KInitialisePdpFsm, pdpfsm);
       
   289     	}
       
   290 
       
   291     return CUmtsGprsSubConnProvd::Control(aOptionLevel, aOptionName, aOption);
       
   292     }
       
   293     
       
   294     
       
   295 CPdpFsmInterface& CUmtsGprsDefaultSubConnProvd::GetPdpFsmInterface()
       
   296     {
       
   297     return *iPdpFsm;
       
   298     }
       
   299