telephonyprotocols/pdplayer/src/PDPSCPRStates.cpp
branchRCL_3
changeset 15 fc69e1e37771
parent 14 7ef16719d8cb
child 21 2492a6e4aed7
equal deleted inserted replaced
14:7ef16719d8cb 15:fc69e1e37771
     1 // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
     1 // Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     3 // This component and the accompanying materials are made available
     4 // under the terms of "Eclipse Public License v1.0"
     4 // under the terms of "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
   173 
   173 
   174 //-=========================================================
   174 //-=========================================================
   175 //Provisioning
   175 //Provisioning
   176 //-=========================================================
   176 //-=========================================================
   177 DEFINE_SMELEMENT(TSelfInit, NetStateMachine::MStateTransition, PDPSCprStates::TContext)
   177 DEFINE_SMELEMENT(TSelfInit, NetStateMachine::MStateTransition, PDPSCprStates::TContext)
       
   178 // This is should be revisited in future releases, basic idea is that information
       
   179 // that can be modified should have a visibility that is to that node's
       
   180 // level and not further (i.e. changes here will affect this connection
       
   181 // only, not every connection that uses this MCPR)
       
   182 //      MCPR - AccessPointConfig() contains information that is used by
       
   183 //             all connections under that MCPR and is unchanging
       
   184 //       CPR - Again for all connections under that CPR and is unchanging
       
   185 //      SCPR - Connection specific information (i.e. can change and does change)
       
   186 //        DC - No point - just reads information.
       
   187 // Here we've moved basically all of the configuration information that was in
       
   188 // the MCPR [that could be moved] this is because some of it changes / is overwritten
       
   189 // with information that comes out of etel/modem.  This also has the added benefit of
       
   190 // freeing up memory in cases where the connection is torn down but the MCPR lies 
       
   191 // around for availability purposes.  In the future, this code (or something like it)
       
   192 // should be moved into the PDP.CPR when it exists.
       
   193 
       
   194 void TSelfInit::SetupProvisionCfgL()
       
   195     {
       
   196     CPDPSubConnectionProvider &tNode = static_cast<CPDPSubConnectionProvider&>(iContext.Node());
       
   197     
       
   198     const TProviderInfoExt* providerInfoExt = static_cast<const TProviderInfoExt*>(tNode.AccessPointConfig().FindExtension(
       
   199             STypeId::CreateSTypeId(TProviderInfoExt::EUid, TProviderInfoExt::ETypeId)));
       
   200     
       
   201     // this should always be here, however, a bit of defensive programming
       
   202     // never hurt..
       
   203     if (providerInfoExt == NULL)
       
   204         {
       
   205         User::Leave(KErrCorrupt);
       
   206         }
       
   207     
       
   208     RMetaExtensionContainer mec;
       
   209     mec.Open(tNode.AccessPointConfig());
       
   210     CleanupClosePushL(mec);
       
   211 
       
   212     CCommsDatIapView* iapView = CCommsDatIapView::NewLC(providerInfoExt->iProviderInfo.APId());
       
   213   
       
   214     mec.AppendExtensionL(CIPConfig::NewFromGPRSOutLC(iapView));
       
   215     CleanupStack::Pop();
       
   216 
       
   217     mec.AppendExtensionL(CBCAProvision::NewLC(iapView));
       
   218     CleanupStack::Pop();
       
   219 
       
   220     mec.AppendExtensionL(CImsExtProvision::NewLC(iapView));
       
   221     CleanupStack::Pop();
       
   222     
       
   223     CGPRSProvision* gprsProvision = CGPRSProvision::NewLC(iapView);
       
   224     mec.AppendExtensionL(gprsProvision);
       
   225     CleanupStack::Pop(gprsProvision);
       
   226     
       
   227     //It's not legal for the qos defaults to be absent.
       
   228     CDefaultPacketQoSProvision* defaultQoS = NULL;
       
   229     TRAPD(ret, defaultQoS = CDefaultPacketQoSProvision::NewL(iapView));   
       
   230     if ((KErrNone == ret) && defaultQoS)           
       
   231         {
       
   232         CleanupStack::PushL(defaultQoS);
       
   233         mec.AppendExtensionL(defaultQoS);
       
   234         CleanupStack::Pop(defaultQoS);
       
   235         }
       
   236     else
       
   237         {
       
   238         if (KErrNoMemory == ret)
       
   239             {
       
   240             User::Leave(KErrNoMemory);
       
   241             }
       
   242         else
       
   243             {
       
   244             User::Leave(KErrCorrupt);
       
   245             }          
       
   246         }    
       
   247     
       
   248     CRawIpAgentConfig* rawIpAgentConfig = CRawIpAgentConfig::NewLC(iapView, &gprsProvision->GetScratchContextAs<TPacketDataConfigBase>());
       
   249     mec.AppendExtensionL(rawIpAgentConfig);
       
   250     CleanupStack::Pop();
       
   251     
       
   252     CleanupStack::PopAndDestroy();          // CloseIapView();  
       
   253     tNode.AccessPointConfig().Close();
       
   254     tNode.AccessPointConfig().Open(mec);
       
   255     CleanupStack::PopAndDestroy(&mec); 
       
   256     }
       
   257 
   178 void TSelfInit::DoL()
   258 void TSelfInit::DoL()
   179     {
   259     {
   180     CPDPSubConnectionProvider &tNode = static_cast<CPDPSubConnectionProvider&>(iContext.Node());
   260     CPDPSubConnectionProvider &tNode = static_cast<CPDPSubConnectionProvider&>(iContext.Node());
       
   261 
       
   262     TRAP(tNode.iProvisionFailure,SetupProvisionCfgL());
       
   263 
       
   264     // Don't want any failure here to be masked by successful configuration later on.
       
   265     // A leave here will not cause a roll back of the connection but it will show an
       
   266     // Error -> message in the SVG diagram.  The provision failure error code will 
       
   267     // cause the connection rollback.
       
   268     User::LeaveIfError(tNode.iProvisionFailure);
   181     
   269     
   182     // if the FSM interface is null, this means that we're initializing a secondary context
   270     // if the FSM interface is null, this means that we're initializing a secondary context
   183     // as this code is common for both
   271     // as this code is common for both
   184     
   272     
   185     if (tNode.iPdpFsmInterface == NULL)
   273     if (tNode.iPdpFsmInterface == NULL)