telephonyprotocols/pdplayer/src/PDPCPR.cpp
branchRCL_3
changeset 65 630d2f34d719
parent 60 1ac40e087278
child 66 07a122eea281
equal deleted inserted replaced
61:17af172ffa5f 65:630d2f34d719
    31 #include <etelmm.h>
    31 #include <etelmm.h>
    32 #include <etelpckt.h>
    32 #include <etelpckt.h>
    33 #include <comms-infras/ss_metaconnprov.h>
    33 #include <comms-infras/ss_metaconnprov.h>
    34 #include "PDPProvision.h"
    34 #include "PDPProvision.h"
    35 #include <etel.h>
    35 #include <etel.h>
    36 #include <networking/cfbearers.h>
       
    37 #include "pdpcpravailabilitylistener.h"
    36 #include "pdpcpravailabilitylistener.h"
    38 #include <comms-infras/ss_nodemessages.h>
    37 #include <comms-infras/ss_nodemessages.h>
    39 #include <networking/ipcpr_states.h>
       
    40 #include <comms-infras/linkmessages.h>
    38 #include <comms-infras/linkmessages.h>
    41 #include <elements/nm_interfaces.h>
    39 #include <elements/nm_interfaces.h>
       
    40 
       
    41 
       
    42 
       
    43 #ifdef SYMBIAN_ADAPTIVE_TCP_RECEIVE_WINDOW
       
    44 #include <networking/cfbearers.h>
       
    45 #include <networking/ipcpr_states.h>
    42 #include <cs_genevent.h>
    46 #include <cs_genevent.h>
    43 #include <networking/etelbearers.h>
    47 #include <networking/etelbearers.h>
       
    48 #endif
    44 
    49 
    45 using namespace ESock;
    50 using namespace ESock;
    46 
    51 
    47 //-=========================================================
    52 //-=========================================================
    48 //
    53 //
    49 // CPDPConnectionProvider methods
    54 // CPDPConnectionProvider methods
    50 //
    55 //
    51 //-=========================================================	
    56 //-=========================================================	
    52 
    57 
       
    58 #ifdef SYMBIAN_ADAPTIVE_TCP_RECEIVE_WINDOW
    53 namespace PDPCprLinkCharacteristicActivity
    59 namespace PDPCprLinkCharacteristicActivity
    54 {
    60 {
    55 DECLARE_DEFINE_NODEACTIVITY(ECFActivityParamRequest, PDPCprLinkCharacteristic, TCFScpr::TGetParamsRequest)
    61 DECLARE_DEFINE_NODEACTIVITY(ECFActivityParamRequest, PDPCprLinkCharacteristic, TCFScpr::TGetParamsRequest)
    56     NODEACTIVITY_ENTRY(MeshMachine::KNoTag, PDPCprStates::TUpdateBundleAndRespondWithRetrievedParams, PRStates::TAwaitingParamRequest, MeshMachine::TNoTag)
    62     NODEACTIVITY_ENTRY(MeshMachine::KNoTag, PDPCprStates::TUpdateBundleAndRespondWithRetrievedParams, PRStates::TAwaitingParamRequest, MeshMachine::TNoTag)
    57 NODEACTIVITY_END()
    63 NODEACTIVITY_END()
    65     FIRST_NODEACTIVITY_ENTRY(CoreNetStates::TAwaitingDataClientGoneDown, CoreNetStates::TNoTagOrNonDefault)
    71     FIRST_NODEACTIVITY_ENTRY(CoreNetStates::TAwaitingDataClientGoneDown, CoreNetStates::TNoTagOrNonDefault)
    66     LAST_NODEACTIVITY_ENTRY(MeshMachine::KNoTag, PRStates::TSendGoneDown)
    72     LAST_NODEACTIVITY_ENTRY(MeshMachine::KNoTag, PRStates::TSendGoneDown)
    67     LAST_NODEACTIVITY_ENTRY(CoreNetStates::KNonDefault, MeshMachine::TDoNothing)    
    73     LAST_NODEACTIVITY_ENTRY(CoreNetStates::KNonDefault, MeshMachine::TDoNothing)    
    68 NODEACTIVITY_END()
    74 NODEACTIVITY_END()
    69 }
    75 }
       
    76 #endif
    70 
    77 
    71 namespace PDPCprActivities
    78 namespace PDPCprActivities
    72 {
    79 {
    73 DEFINE_ACTIVITY_MAP(activityMap)
    80 DEFINE_ACTIVITY_MAP(activityMap)
       
    81 #ifdef SYMBIAN_ADAPTIVE_TCP_RECEIVE_WINDOW
    74     ACTIVITY_MAP_ENTRY(PDPDataClientGoneDownActivity, PDPScprGoneDown)
    82     ACTIVITY_MAP_ENTRY(PDPDataClientGoneDownActivity, PDPScprGoneDown)
    75 	ACTIVITY_MAP_ENTRY(PDPCprLinkCharacteristicActivity, PDPCprLinkCharacteristic)
    83 	ACTIVITY_MAP_ENTRY(PDPCprLinkCharacteristicActivity, PDPCprLinkCharacteristic)
       
    84 #endif
    76 ACTIVITY_MAP_END_BASE(CprActivities, coreCprActivities)
    85 ACTIVITY_MAP_END_BASE(CprActivities, coreCprActivities)
    77 }
    86 }
    78 
       
    79 
    87 
    80 CPDPConnectionProvider* CPDPConnectionProvider::NewL(ESock::CConnectionProviderFactoryBase& aFactory)
    88 CPDPConnectionProvider* CPDPConnectionProvider::NewL(ESock::CConnectionProviderFactoryBase& aFactory)
    81     {
    89     {
    82     CPDPConnectionProvider* provider = new (ELeave) CPDPConnectionProvider(aFactory);
    90     CPDPConnectionProvider* provider = new (ELeave) CPDPConnectionProvider(aFactory);
    83     CleanupStack::PushL(provider);
    91     CleanupStack::PushL(provider);
    84     provider->ConstructL();
    92     provider->ConstructL();
    85     CleanupStack::Pop(provider);
    93     CleanupStack::Pop(provider);
    86 	return provider;
    94 	return provider;
    87     }        
    95     }        
    88 
    96 
    89 
       
    90 void CPDPConnectionProvider::StartListener()
       
    91 /**
       
    92  * Start listening for dynamic caps or network mode changes.
       
    93  * @param None
       
    94  * @return void
       
    95  */
       
    96 	{
       
    97 	iDynamicCapsEventListener->NotifyDynamicCapsChange(this);
       
    98 	iNetworkModeEventListener->NotifyNetworkModeChange(this);
       
    99 	}
       
   100 
       
   101 void CPDPConnectionProvider::ConstructL()
    97 void CPDPConnectionProvider::ConstructL()
   102 /**
    98 /**
   103  * PDP Connection Provider Second Phase Constructor
    99  * PDP Connection Provider Second Phase Constructor
   104  * @param None
   100  * @param None
   105  * @return void
   101  * @return void
   106  */
   102  */
   107 	{
   103 	{
   108 	CCoreConnectionProvider::ConstructL();
   104 	CCoreConnectionProvider::ConstructL();
   109 	}
   105 	}
   110 
   106 
   111 void CPDPConnectionProvider::StopListener()
       
   112 /**
       
   113  * Start listening for dynamic caps or network mode changes.
       
   114  */
       
   115 	{
       
   116 	if(iDynamicCapsEventListener)
       
   117 		{
       
   118 		iDynamicCapsEventListener->Cancel();
       
   119 		}
       
   120 	if(iNetworkModeEventListener)
       
   121 		{
       
   122 		iNetworkModeEventListener->Cancel();
       
   123 		}
       
   124 	}
       
   125 
       
   126 CPDPConnectionProvider::CPDPConnectionProvider(ESock::CConnectionProviderFactoryBase& aFactory)
   107 CPDPConnectionProvider::CPDPConnectionProvider(ESock::CConnectionProviderFactoryBase& aFactory)
   127 	: CCoreConnectionProvider(aFactory, PDPCprActivities::activityMap::Self())
   108 	: CCoreConnectionProvider(aFactory, PDPCprActivities::activityMap::Self()),
       
   109 	  iDynamicCapsEventListener(NULL),
       
   110 	  iNetworkModeEventListener(NULL),
       
   111 	  iBearerType(0),
       
   112 	  iBearerSet(EFalse)
       
   113 	  
   128 /**
   114 /**
   129  * Construct PDP connection provider.
   115  * Construct PDP connection provider.
   130  */	
   116  */	
   131     {        
   117     {        
   132     LOG_NODE_CREATE(KESockConnectionTag, CPDPConnectionProvider);
   118     LOG_NODE_CREATE(KESockConnectionTag, CPDPConnectionProvider);
   136 /**
   122 /**
   137  * Destroy PDP connection provider.
   123  * Destroy PDP connection provider.
   138  */
   124  */
   139     {    
   125     {    
   140     LOG_NODE_DESTROY(KESockConnectionTag, CPDPConnectionProvider);
   126     LOG_NODE_DESTROY(KESockConnectionTag, CPDPConnectionProvider);
       
   127 #ifdef SYMBIAN_ADAPTIVE_TCP_RECEIVE_WINDOW
   141     StopListener();
   128     StopListener();
       
   129 #endif
   142 	delete iDynamicCapsEventListener;
   130 	delete iDynamicCapsEventListener;
   143 	delete iNetworkModeEventListener;
   131 	delete iNetworkModeEventListener;
   144     }
   132     }
   145     
   133     
   146 void CPDPConnectionProvider::ReceivedL(const Messages::TRuntimeCtxId& aSender, const Messages::TNodeId& aRecipient, Messages::TSignatureBase& aMessage)
   134 void CPDPConnectionProvider::ReceivedL(const Messages::TRuntimeCtxId& aSender, const Messages::TNodeId& aRecipient, Messages::TSignatureBase& aMessage)
   156 /**
   144 /**
   157  * Update the parmeter set in case of modulation change and send TPlaneNotification message to
   145  * Update the parmeter set in case of modulation change and send TPlaneNotification message to
   158  * all the control client.
   146  * all the control client.
   159  */
   147  */
   160 	{
   148 	{
       
   149 #ifdef SYMBIAN_ADAPTIVE_TCP_RECEIVE_WINDOW
   161 	//Update bearers.
   150 	//Update bearers.
   162 	UpdateBearer();
   151 	UpdateBearer();
   163 	
   152 	
   164 	//Send msg to all control clients
   153 	//Send msg to all control clients
   165 	CEventParamsChanged* eventChanged = CEventParamsChanged::NewL(KBearerInfo);
   154 	CEventParamsChanged* eventChanged = CEventParamsChanged::NewL(KBearerInfo);
   186 	while ((ctl = iter++) != NULL)
   175 	while ((ctl = iter++) != NULL)
   187 		{
   176 		{
   188 		msg.iRefCountOwnedNotification->Open();
   177 		msg.iRefCountOwnedNotification->Open();
   189 		ctl->PostMessage(this->NodeId(), msg);
   178 		ctl->PostMessage(this->NodeId(), msg);
   190 		}
   179 		}
   191 
   180 #endif
   192 	}
   181 	}
   193 
   182 
   194 
   183 #ifdef SYMBIAN_ADAPTIVE_TCP_RECEIVE_WINDOW
       
   184 void CPDPConnectionProvider::StartListener()
       
   185 /**
       
   186  * Start listening for dynamic caps or network mode changes.
       
   187  * @param None
       
   188  * @return void
       
   189  */
       
   190     {
       
   191     iDynamicCapsEventListener->NotifyDynamicCapsChange(this);
       
   192     iNetworkModeEventListener->NotifyNetworkModeChange(this);
       
   193     }
       
   194 
       
   195 void CPDPConnectionProvider::StopListener()
       
   196 /**
       
   197  * Start listening for dynamic caps or network mode changes.
       
   198  */
       
   199     {
       
   200     if(iDynamicCapsEventListener)
       
   201         {
       
   202         iDynamicCapsEventListener->Cancel();
       
   203         }
       
   204     if(iNetworkModeEventListener)
       
   205         {
       
   206         iNetworkModeEventListener->Cancel();
       
   207         }
       
   208     }
   195 void CPDPConnectionProvider::UpdateBearer()
   209 void CPDPConnectionProvider::UpdateBearer()
   196 /**
   210 /**
   197  * Update bearer type based on the change of the dynamic caps or network mode.
   211  * Update bearer type based on the change of the dynamic caps or network mode.
   198  */
   212  */
   199 	{
   213 	{
   204 	
   218 	
   205 	//Resolve the bearer based on both dynamic caps and network mode
   219 	//Resolve the bearer based on both dynamic caps and network mode
   206 	iBearerType = Bearer(dynamicCaps, networkMode);
   220 	iBearerType = Bearer(dynamicCaps, networkMode);
   207 	iBearerSet = ETrue;
   221 	iBearerSet = ETrue;
   208 	}
   222 	}
   209 
       
   210 
   223 
   211 TUint32 CPDPConnectionProvider::Bearer(TUint aDynamicCaps, RMobilePhone::TMobilePhoneNetworkMode& aNetworkMode)
   224 TUint32 CPDPConnectionProvider::Bearer(TUint aDynamicCaps, RMobilePhone::TMobilePhoneNetworkMode& aNetworkMode)
   212 /**
   225 /**
   213  * Determine bearer based on dynamic caps and network mode.
   226  * Determine bearer based on dynamic caps and network mode.
   214  * @param aDynamicCaps a value of dynamic caps
   227  * @param aDynamicCaps a value of dynamic caps
   215  * @param aNetworkMode a value of network mode
   228  * @param aNetworkMode a value of network mode
   216  * @return Type of Bearer
   229  * @return Type of Bearer
   217  *
   230  *
   218  */
   231  */
   219 	{
   232 	{
   220 	
       
   221 	if ((aDynamicCaps & RPacketService::KCapsHSUPA) || (aDynamicCaps & RPacketService::KCapsHSDPA))
   233 	if ((aDynamicCaps & RPacketService::KCapsHSUPA) || (aDynamicCaps & RPacketService::KCapsHSDPA))
   222 		{
   234 		{
   223 		return KHsdpaBearer;
   235 		return KHsdpaBearer;
   224 		}
   236 		}
   225 	else if (aDynamicCaps & RPacketService::KCapsEGPRS)
   237 	else if (aDynamicCaps & RPacketService::KCapsEGPRS)
   241 		   	return KDefaultBearer;
   253 		   	return KDefaultBearer;
   242 			}
   254 			}
   243 		}
   255 		}
   244 	}
   256 	}
   245 
   257 
   246 
       
   247 DEFINE_SMELEMENT(PDPCprStates::TUpdateBundle, NetStateMachine::MStateTransition, PDPCprStates::TContext)
   258 DEFINE_SMELEMENT(PDPCprStates::TUpdateBundle, NetStateMachine::MStateTransition, PDPCprStates::TContext)
   248 void PDPCprStates::TUpdateBundle::DoL()
   259 void PDPCprStates::TUpdateBundle::DoL()
   249 /**
   260 /**
   250  * Process TGetParamsRequest
   261  * Process TGetParamsRequest
   251  */
   262  */
   290 		// if Dynamic Caps supported, start listener, which would Notify of Dynamic Caps change
   301 		// if Dynamic Caps supported, start listener, which would Notify of Dynamic Caps change
   291 		// no check required for network mode, since atleast one network mode is supported.
   302 		// no check required for network mode, since atleast one network mode is supported.
   292 		iContext.Node().StartListener();
   303 		iContext.Node().StartListener();
   293 		}
   304 		}
   294 	}
   305 	}
   295 
   306 #endif
   296 
   307 
       
   308