telephonyprotocols/pdplayer/src/pdpmcpr.cpp
branchRCL_3
changeset 6 fc69e1e37771
parent 5 7ef16719d8cb
child 9 2492a6e4aed7
equal deleted inserted replaced
5:7ef16719d8cb 6: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".
    28 #include <comms-infras/ss_log.h>
    28 #include <comms-infras/ss_log.h>
    29 #include "pdpmcpr.h"
    29 #include "pdpmcpr.h"
    30 #include "pdpmcprstates.h"
    30 #include "pdpmcprstates.h"
    31 #include "PDPProvision.h"
    31 #include "PDPProvision.h"
    32 #include "psdavailabilitylistener.h"
    32 #include "psdavailabilitylistener.h"
       
    33 #include "pdp.hrh"
    33 
    34 
    34 using namespace Messages;
    35 using namespace Messages;
    35 using namespace MeshMachine;
    36 using namespace MeshMachine;
    36 using namespace ESock;
    37 using namespace ESock;
    37 using namespace NetStateMachine;
    38 using namespace NetStateMachine;
   104     }
   105     }
   105 
   106 
   106 void CPdpMetaConnectionProvider::ConstructL()
   107 void CPdpMetaConnectionProvider::ConstructL()
   107     {
   108     {
   108     CAgentMetaConnectionProvider::ConstructL();
   109     CAgentMetaConnectionProvider::ConstructL();
   109     SetAccessPointConfigFromDbL();
   110     
       
   111     const TLayerConfig* layerCfg = static_cast<const TLayerConfig*>(AccessPointConfig().FindExtension(
       
   112         STypeId::CreateSTypeId(TLayerConfig::EUid,TLayerConfig::ETypeId)));
       
   113 
       
   114     // defensive programming.  If the layer cfg isn't here
       
   115     // then this is really corrupt.
       
   116     
       
   117     if (layerCfg == NULL)
       
   118         {
       
   119         User::Leave(KErrCorrupt);
       
   120         }
       
   121     
       
   122     // these constants and all of the implementation ids should be in a header file
       
   123     // and included in the .rss / ecom files.
       
   124     
       
   125     // Any layer that uses an outbound PDP.SCPR will have information that is overwritten by
       
   126     // the network (for example, negotiated parameters), this configuration information is 
       
   127     // local to the connection and should not be created here.  So this check is to ensure 
       
   128     // that legacy behaviour is maintained for any layer that uses this MCPR but not a 
       
   129     // PDP.SCPR.  But the PDP.SCPR behaviour has been modified to create the information
       
   130     // that is local to that connection.
       
   131     
       
   132     if (layerCfg->SCprUid().iUid == PDPScprImplUid)
       
   133         {
       
   134         // the PDP layer MCPR is being used in conjunction with a PDP.SCPR
       
   135         // in this case we can rightly assume that the PDP.SCPR will create
       
   136         // the access point config for that connection.
       
   137         // code from the PDP.SCPR will need to be moved into the PDP.CPR when
       
   138         // that component becomes available for use.
       
   139         ConfigurePDPLayerL();
       
   140         }
       
   141     else
       
   142         {
       
   143         // non-PDP.SCPR specific behaviour
       
   144         // this is legacy for any layers that are constructed expecting the previous behaviour
       
   145         SetAccessPointConfigFromDbL();
       
   146         }
   110     }
   147     }
   111 
   148 
   112 CPdpMetaConnectionProvider::CPdpMetaConnectionProvider(CMetaConnectionProviderFactoryBase& aFactory, const TProviderInfo& aProviderInfo)
   149 CPdpMetaConnectionProvider::CPdpMetaConnectionProvider(CMetaConnectionProviderFactoryBase& aFactory, const TProviderInfo& aProviderInfo)
   113 :	CAgentMetaConnectionProvider(aFactory, aProviderInfo, PdpMCprStates::stateMap::Self())
   150 :	CAgentMetaConnectionProvider(aFactory, aProviderInfo, PdpMCprStates::stateMap::Self())
   114 	{
   151 	{
   130 
   167 
   131 	TNodeContext<CPdpMetaConnectionProvider> ctx(*this, aMessage, aSender, aRecipient);
   168 	TNodeContext<CPdpMetaConnectionProvider> ctx(*this, aMessage, aSender, aRecipient);
   132     CCoreMetaConnectionProvider::Received(ctx);
   169     CCoreMetaConnectionProvider::Received(ctx);
   133     User::LeaveIfError(ctx.iReturn);
   170     User::LeaveIfError(ctx.iReturn);
   134 	}
   171 	}
       
   172 
       
   173 
       
   174 void CPdpMetaConnectionProvider::ConfigurePDPLayerL()
       
   175     {
       
   176     RMetaExtensionContainer mec;
       
   177     mec.Open(AccessPointConfig());
       
   178     CleanupClosePushL(mec);
       
   179     
       
   180     CCommsDatIapView* iapView = OpenIapViewLC();
       
   181 
       
   182 
       
   183     mec.AppendExtensionL(CTSYProvision::NewLC(iapView));
       
   184     CleanupStack::Pop();
       
   185 
       
   186     mec.AppendExtensionL(CPppLcpConfig::NewLC(iapView));
       
   187     CleanupStack::Pop();
       
   188     mec.AppendExtensionL(CPppAuthConfig::NewLC(iapView));
       
   189     CleanupStack::Pop();
       
   190 
       
   191     CPppProvisionInfo* agentProvision = new (ELeave) CPppProvisionInfo;
       
   192     CleanupStack::PushL(agentProvision);
       
   193     agentProvision->SetIsDialIn(KErrNotSupported);
       
   194     agentProvision->SetNotificationData(NULL);
       
   195     mec.AppendExtensionL(agentProvision);
       
   196     CleanupStack::Pop(agentProvision);
       
   197 
       
   198     CleanupStack::PopAndDestroy();          // CloseIapView();
       
   199 
       
   200     iAccessPointConfig.Close();
       
   201     iAccessPointConfig.Open(mec);
       
   202     CleanupStack::PopAndDestroy(&mec);
       
   203     }
   135 
   204 
   136 void CPdpMetaConnectionProvider::SetAccessPointConfigFromDbL()
   205 void CPdpMetaConnectionProvider::SetAccessPointConfigFromDbL()
   137     {
   206     {
   138     RMetaExtensionContainer mec;
   207     RMetaExtensionContainer mec;
   139     mec.Open(AccessPointConfig());
   208     mec.Open(AccessPointConfig());