telephonyprotocols/umtsgprsscpr/spudtel/src/eteldriverstrategies.cpp
changeset 69 b982c3e940f3
parent 59 ac20d6a0a19d
child 73 70d75957b98f
equal deleted inserted replaced
59:ac20d6a0a19d 69:b982c3e940f3
     1 // Copyright (c) 2004-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 // A collection of etel driver strategies
       
    15 // 
       
    16 //
       
    17 
       
    18 /**
       
    19  @file 
       
    20  @internalComponent
       
    21 */
       
    22 
       
    23 #include <e32def.h>
       
    24 
       
    25 #include "ceteldrivercontext.h"
       
    26 #include "eteldriverstrategies.h"
       
    27 #include "spudteldebuglogger.h"
       
    28 #include "pdpfsmnmspace.h"
       
    29 
       
    30 #include <pcktcs.h>
       
    31 
       
    32 
       
    33 //
       
    34 //	TOpenStrategy
       
    35 //
       
    36 /** Executes next asynchronous step in a strategy. 
       
    37 
       
    38 @param aContext - pdp context
       
    39 @param aStatus - request status of this step
       
    40 */
       
    41 void TOpenStrategy::Next(CEtelDriverContext& aContext, TRequestStatus* aStatus)
       
    42 	{
       
    43 	SPUDTEL_FNLOG("TOpenStrategy::Next()");
       
    44 	
       
    45 	TInt err = KErrNone;
       
    46 	
       
    47 	switch(aContext.StrategyStep())
       
    48 		{
       
    49 		case EStartStep:
       
    50 			{
       
    51 			aContext.Phone().Initialise (*aStatus);
       
    52 			aContext.SetStrategyStep(EInitPhoneStep);
       
    53 			break;
       
    54 			}
       
    55 			
       
    56 		case EInitPhoneStep:
       
    57 			{
       
    58 			aContext.SetStrategyStep(EFinishStep);
       
    59 			break;
       
    60 			}
       
    61 			
       
    62 		default:
       
    63 			// incorrect step
       
    64 			SPUDTEL_ERROR_LOG0(_L("Incorrect step"));
       
    65 			ASSERT(EFalse);
       
    66 			err = KErrNotSupported;
       
    67 			break;
       
    68 				
       
    69 		} // switch
       
    70 
       
    71 	if(err || (EFinishStep == aContext.StrategyStep()))
       
    72 		{
       
    73 		User::RequestComplete( aStatus, err);
       
    74 		}
       
    75 	}
       
    76 	
       
    77 
       
    78 /** 
       
    79 Notifies SPUD FSM about execution results.
       
    80 
       
    81 @param aContext - pdp context
       
    82 @param aCompletionStatus - completion request status
       
    83 */	
       
    84 void TOpenStrategy::NotifyFsm(CEtelDriverContext& aContext, TRequestStatus& aCompletionStatus)
       
    85 	{
       
    86 	if(aCompletionStatus == KErrNone)
       
    87 		{
       
    88 		SPUDTEL_INFO_LOG(_L("Notifying FSM: EPhoneOpened"));
       
    89 		aContext.PdpFsmInterface().Input(aContext.Id(), PdpFsm::EPhoneOpened);
       
    90 		}
       
    91 	else
       
    92 		{
       
    93 		SPUDTEL_INFO_LOG(_L("Notifying FSM: EPhoneOpenedFailed"));
       
    94 		aContext.PdpFsmInterface().Input(aContext.Id(), PdpFsm::EPhoneOpenedFailed, aCompletionStatus.Int());
       
    95 		}
       
    96 	}
       
    97 
       
    98 /** Cancels last asynchronous request to eTel
       
    99 
       
   100 @param  aContext - pdp context
       
   101 */
       
   102 void TOpenStrategy::CancelAsyncRequest(CEtelDriverContext& aContext)
       
   103 	{
       
   104 	switch(aContext.StrategyStep())
       
   105 		{
       
   106 		case EInitPhoneStep:
       
   107 			{
       
   108 			SPUDTEL_INFO_LOG(_L("Cancel Phone::InitialiseCancel"));
       
   109 			aContext.Phone().InitialiseCancel();
       
   110 			break;
       
   111 			}
       
   112 			
       
   113 		default:
       
   114 			// there're NO outstanding async requests
       
   115 			SPUDTEL_ERROR_LOG0(_L("ERROR: Incorrect case in TOpenStrategy::CancelAsyncRequest"));
       
   116 			ASSERT(EFalse);
       
   117 			break;
       
   118 		}
       
   119 	}
       
   120 
       
   121 
       
   122 //
       
   123 //	TContextDeleteStrategy
       
   124 //
       
   125 /** Executes next asynchronous step in a strategy. 
       
   126 
       
   127 @param aContext - pdp context
       
   128 @param aStatus - request status of this step
       
   129 */
       
   130 void TContextDeleteStrategy::Next(CEtelDriverContext& aContext, TRequestStatus* aStatus)
       
   131 	{
       
   132 	SPUDTEL_FNLOG("TContextDeleteStrategy::Next(CEtelDriverContext& aContext, TRequestStatus* aStatus)");
       
   133 	
       
   134 	TInt err = KErrNone;
       
   135 	
       
   136 	// steps:
       
   137 	//	-- cancel notifications
       
   138 	//	-- deactivate context
       
   139 	//	-- close QoS
       
   140 	//	-- close context
       
   141 	// 	-- delete context
       
   142 	switch(aContext.StrategyStep())
       
   143 		{
       
   144 		case EStartStep:
       
   145 			{
       
   146 			// cancel associated notifications
       
   147 			// -- 	StatusChangeNotifier
       
   148 			// --	QoSChangeNotifier
       
   149 			// --	ConfigChangeNotifier
       
   150 			
       
   151 			if (aContext.PacketContext().SubSessionHandle())
       
   152 				{
       
   153 				aContext.PacketContext().Deactivate(*aStatus);
       
   154 				aContext.SetStrategyStep (EDeactivateStep);
       
   155 				}
       
   156 			else
       
   157 				{
       
   158 				aContext.SetStrategyStep(EDeactivateStep);
       
   159 				User::RequestComplete(aStatus, err);
       
   160 				}
       
   161 			break;
       
   162 			}
       
   163 			
       
   164 		case EDeactivateStep:
       
   165 			{
       
   166 			if (aContext.PacketQoS().SubSessionHandle())
       
   167 				{
       
   168                 aContext.QoSChangeNotifierCancel();
       
   169 				aContext.PacketQoS().Close();
       
   170 				}
       
   171 				
       
   172 			if (aContext.PacketContext().SubSessionHandle())
       
   173 				{
       
   174                 aContext.PdpConfigChangeNotifierCancel();
       
   175                 aContext.PdpStatusChangeNotifierCancel();
       
   176 				aContext.PacketContext().Delete(*aStatus);
       
   177 				aContext.SetStrategyStep(EDeleteContextStep);
       
   178 				}
       
   179 			else
       
   180 				{
       
   181 				// jump to next step
       
   182 				aContext.SetStrategyStep(EDeleteContextStep);
       
   183 				User::RequestComplete( aStatus, err);
       
   184 				}
       
   185 			break;
       
   186 			}
       
   187 			
       
   188 			
       
   189 		case EDeleteContextStep:
       
   190 			{
       
   191 			aContext.PacketContext().Close();
       
   192 			// clear the name
       
   193 			aContext.Name().Zero();
       
   194 			aContext.SetStrategyStep (EFinishStep);
       
   195 			break;
       
   196 			}
       
   197 			
       
   198 		default:
       
   199 			// incorrect step
       
   200 			SPUDTEL_ERROR_LOG0(_L("ERROR: Incorrect case"));
       
   201 			ASSERT(EFalse);
       
   202 			err = KErrNotSupported;
       
   203 			break;
       
   204 				
       
   205 		} // switch
       
   206 
       
   207 	if(err || (EFinishStep == aContext.StrategyStep()))
       
   208 		{
       
   209 		User::RequestComplete( aStatus, err);
       
   210 		}
       
   211 	
       
   212 	}
       
   213 
       
   214 
       
   215 /** 
       
   216 Notifies SPUD FSM about execution results.
       
   217 
       
   218 @param aContext - pdp context
       
   219 @param aCompletionStatus - completion request status
       
   220 */	
       
   221 void TContextDeleteStrategy::NotifyFsm(CEtelDriverContext& aContext, TRequestStatus& aCompletionStatus)
       
   222 	{
       
   223 	aContext.PdpFsmInterface().Set(aContext.Id(), RPacketContext::EStatusDeleted);
       
   224 	
       
   225 	if(aCompletionStatus == KErrNone)
       
   226 		{
       
   227 		SPUDTEL_INFO_LOG(_L("Notifying FSM: EContextDeleted"));
       
   228 		aContext.PdpFsmInterface().Input(aContext.Id(), PdpFsm::EContextDeleted);
       
   229 		}
       
   230 	else
       
   231 		{
       
   232 		SPUDTEL_INFO_LOG(_L("Notifying FSM: EContextDeletedFailed"));
       
   233 		aContext.PdpFsmInterface().Input(aContext.Id(), PdpFsm::EContextDeletedFailed, aCompletionStatus.Int());
       
   234 		}
       
   235 	}
       
   236 
       
   237 /** Cancels last asynchronous request to eTel
       
   238 
       
   239 @param  aContext - pdp context
       
   240 */
       
   241 void TContextDeleteStrategy::CancelAsyncRequest(CEtelDriverContext& aContext)
       
   242 	{
       
   243 	SPUDTEL_FNLOG("TContextDeleteStrategy::CancelAsyncRequest()");
       
   244 	
       
   245 	// When there is no sub-session, the strategy will not call DeactivateContext, but will be in the EDeactivateStep state
       
   246 	// In this case we don't want to cancel the deactivate request
       
   247 	if (aContext.iStatus != KRequestPending)
       
   248 		{
       
   249 		return;
       
   250 		}
       
   251 		
       
   252 	switch(aContext.StrategyStep())
       
   253 		{
       
   254 		case EDeactivateStep:
       
   255 			{
       
   256 			SPUDTEL_INFO_LOG(_L("Cancel PacketContext::EPacketContextDeactivate"));
       
   257 			aContext.PacketContext().CancelAsyncRequest(EPacketContextDeactivate);
       
   258 			break;
       
   259 			}
       
   260 			
       
   261 		case EDeleteContextStep:
       
   262 			{
       
   263 			SPUDTEL_INFO_LOG(_L("Cancel PacketContext::EPacketContextDelete"));
       
   264 			aContext.PacketContext().CancelAsyncRequest(EPacketContextDelete);
       
   265 			break;
       
   266 			}
       
   267 			
       
   268 		default:
       
   269 			// there're NO outstanding async requests
       
   270 			SPUDTEL_ERROR_LOG0(_L("ERROR: Incorrect case"));
       
   271 			ASSERT(EFalse);
       
   272 			break;
       
   273 		}
       
   274 	}
       
   275 
       
   276 
       
   277 // 
       
   278 //	TCreate1ryPdpContextStrategy 
       
   279 //
       
   280 /** Executes next asynchronous step in a strategy. 
       
   281 
       
   282 @param aContext - pdp context
       
   283 @param aStatus - request status of this step
       
   284 */
       
   285 void TCreate1ryPdpContextStrategy::Next(CEtelDriverContext& aContext, TRequestStatus* aStatus)
       
   286 	{
       
   287 	SPUDTEL_FNLOG("TCreate1ryPdpContextStrategy::Next()");
       
   288 	
       
   289 	TInt err = KErrNone;
       
   290 	
       
   291 	// possible steps:
       
   292 	// 	-- open new context
       
   293 	//	-- open new QoS
       
   294 	// 	-- initialise context
       
   295 	switch(aContext.StrategyStep())
       
   296 		{
       
   297 		case EStartStep:
       
   298 			{
       
   299 			err = aContext.PacketContext().OpenNewContext (aContext.PacketService(), aContext.Name());
       
   300 			if (err)
       
   301 				{
       
   302 				SPUDTEL_ERROR_LOG(_L("PacketContextOpenNewContext returned %d"), err);
       
   303 				break;
       
   304 				}
       
   305 				
       
   306 			// get packet config from fsm
       
   307 			aContext.PdpFsmInterface().Get (aContext.Id(), aContext.ContextConfigGPRS());
       
   308 			// async set config
       
   309 			aContext.PacketContext().SetConfig (*aStatus, aContext.ContextConfigGPRSPckg());
       
   310 			// set next step
       
   311 			aContext.SetStrategyStep (ESetConfigStep);
       
   312 			break;
       
   313 			}
       
   314 			
       
   315 		case ESetConfigStep:
       
   316 			{
       
   317 			// QoS name is not used anywhere
       
   318 			TName newName;
       
   319 			err = aContext.PacketQoS().OpenNewQoS (aContext.PacketContext(), newName);
       
   320 			if (err)
       
   321 				{ 
       
   322 				SPUDTEL_ERROR_LOG(_L("PacketQoS OpenNewQoS returned %d"), err);
       
   323 				break; 
       
   324 				}
       
   325 				
       
   326 #ifdef SYMBIAN_NETWORKING_UMTSR5
       
   327             RPacketQoS::TQoSR5Requested r5;
       
   328             aContext.PdpFsmInterface().Get (aContext.Id(), r5);
       
   329 			aContext.QosRequested() = r5;
       
   330 #else
       
   331             RPacketQoS::TQoSR99_R4Requested r4;
       
   332 			aContext.PdpFsmInterface().Get (aContext.Id(), r4);
       
   333 			aContext.QosRequested() = r4;
       
   334 #endif 
       
   335 // SYMBIAN_NETWORKING_UMTSR5
       
   336 
       
   337 
       
   338 #ifdef _DEBUG
       
   339             aContext.DumpReqProfileParameters ();
       
   340 #endif			
       
   341 			aContext.PacketQoS().SetProfileParameters (*aStatus, aContext.QosRequestedPckg());
       
   342 			aContext.SetStrategyStep (ESetProfileParamsStep);
       
   343 			break;
       
   344 			}
       
   345 			
       
   346 		case ESetProfileParamsStep:
       
   347 			{
       
   348 			aContext.SetStrategyStep (EFinishStep);
       
   349 			break;
       
   350 			}
       
   351 			
       
   352 		default:
       
   353 			SPUDTEL_ERROR_LOG0(_L("ERROR: Incorrect case"));
       
   354 			ASSERT(EFalse);
       
   355 			err = KErrNotSupported;
       
   356 			break;
       
   357 		}
       
   358 		
       
   359 	if(err || (EFinishStep == aContext.StrategyStep()))
       
   360 		{
       
   361 		User::RequestComplete( aStatus, err);
       
   362 		}
       
   363 	
       
   364 	}
       
   365 
       
   366 
       
   367 /** 
       
   368 Notifies SPUD FSM about execution results.
       
   369 
       
   370 @param aContext - pdp context
       
   371 @param aCompletionStatus - completion request status
       
   372 */	
       
   373 void TCreate1ryPdpContextStrategy::NotifyFsm(CEtelDriverContext& aContext, TRequestStatus& aCompletionStatus)
       
   374 {
       
   375 	if(aCompletionStatus == KErrNone)
       
   376 		{
       
   377 		// start notifications in case of normal creation of a context
       
   378 		// -- 	StatusChangeNotifier
       
   379 		// --	QoSChangeNotifier
       
   380 		// --	ConfigChangeNotifier
       
   381 		aContext.StartNotifications();
       
   382 		
       
   383 		SPUDTEL_INFO_LOG(_L("Notifying FSM: E1ryPdpContextCreated"));
       
   384 		aContext.PdpFsmInterface().Input(aContext.Id(), PdpFsm::E1ryPdpContextCreated);
       
   385 		}
       
   386 	else
       
   387 		{
       
   388 		SPUDTEL_INFO_LOG(_L("Notifying FSM: E1ryPdpContextCreatedFailed"));
       
   389 		aContext.PdpFsmInterface().Input(aContext.Id(), PdpFsm::E1ryPdpContextCreatedFailed, aCompletionStatus.Int());
       
   390 		}
       
   391 }
       
   392 
       
   393 /** Cancels last asynchronous request to eTel
       
   394 
       
   395 @param  aContext - pdp context
       
   396 */
       
   397 void TCreate1ryPdpContextStrategy::CancelAsyncRequest(CEtelDriverContext& aContext)
       
   398 	{
       
   399 	SPUDTEL_FNLOG("TCreate1ryPdpContextStrategy::CancelAsyncRequest()");
       
   400 	
       
   401 	switch(aContext.StrategyStep())
       
   402 		{
       
   403 		case ESetConfigStep:
       
   404 			{
       
   405 			SPUDTEL_INFO_LOG(_L("Cancel PacketContext::EPacketContextSetConfig"));
       
   406 			aContext.PacketContext().CancelAsyncRequest(EPacketContextSetConfig);
       
   407 			break;
       
   408 			}
       
   409 			
       
   410 		case ESetProfileParamsStep:
       
   411 			{
       
   412 			SPUDTEL_INFO_LOG(_L("Cancel PacketContext::EPacketQoSSetProfileParams"));
       
   413 			aContext.PacketQoS().CancelAsyncRequest(EPacketQoSSetProfileParams);
       
   414 			break;
       
   415 			}
       
   416 			
       
   417 		default:
       
   418 			// there're NO outstanding async requests
       
   419 			SPUDTEL_ERROR_LOG0(_L("ERROR: Incorrect case"));
       
   420 			ASSERT(EFalse);
       
   421 			break;
       
   422 		}
       
   423 	}
       
   424 
       
   425 
       
   426 // 
       
   427 //	TCreate2ryPdpContextStrategy 
       
   428 //
       
   429 /** Executes next asynchronous step in a strategy. 
       
   430 
       
   431 @param aContext - pdp context
       
   432 @param aStatus - request status of this step
       
   433 */
       
   434 void TCreate2ryPdpContextStrategy::Next(CEtelDriverContext& aContext, TRequestStatus* aStatus)
       
   435 	{
       
   436 	SPUDTEL_FNLOG("TCreate2ryPdpContextStrategy::Next()");
       
   437 	
       
   438 	TInt err = KErrNone;
       
   439 	
       
   440 	// possible steps:
       
   441 	//	-- open new secondary context
       
   442 	//	-- open new QoS
       
   443 	//	-- initialise context
       
   444 	switch(aContext.StrategyStep())
       
   445 		{
       
   446 		case EStartStep:
       
   447 			{
       
   448 			const TName& existingContextName = aContext.ExistingContextName();
       
   449 			aContext.PacketContext().OpenNewSecondaryContext(aContext.PacketService(), existingContextName, aContext.Name());
       
   450 			
       
   451 			// QoS name is not used anywhere
       
   452 			TName newName;
       
   453 			err = aContext.PacketQoS().OpenNewQoS (aContext.PacketContext(), newName);
       
   454 			if (err)
       
   455 				{ 
       
   456 				SPUDTEL_ERROR_LOG(_L("PacketQoS OpenNewQoS returned %d"), err);
       
   457 				break; 
       
   458 				}
       
   459 			
       
   460 			aContext.SetStrategyStep (EFinishStep);
       
   461 			break;
       
   462 			}
       
   463 			
       
   464 		default:
       
   465 			SPUDTEL_ERROR_LOG0(_L("ERROR: Incorrect case"));
       
   466 			ASSERT(EFalse);
       
   467 			err = KErrNotSupported;
       
   468 			break;
       
   469 		}
       
   470 		
       
   471 	if(err || (EFinishStep == aContext.StrategyStep()))
       
   472 		{
       
   473 		User::RequestComplete( aStatus, err);
       
   474 		}
       
   475 	
       
   476 	}
       
   477 
       
   478 
       
   479 /** 
       
   480 Notifies SPUD FSM about execution results.
       
   481 
       
   482 @param aContext - pdp context
       
   483 @param aCompletionStatus - completion request status
       
   484 */	
       
   485 void TCreate2ryPdpContextStrategy::NotifyFsm(CEtelDriverContext& aContext, TRequestStatus& aCompletionStatus )
       
   486 {
       
   487 	if(aCompletionStatus == KErrNone)
       
   488 		{
       
   489 		// start notifications in case of normal creation of a context
       
   490 		// -- 	StatusChangeNotifier
       
   491 		// --	QoSChangeNotifier
       
   492 		// --	ConfigChangeNotifier
       
   493 		aContext.StartNotifications();
       
   494 		
       
   495 		SPUDTEL_INFO_LOG(_L("Notifying FSM: E2ryPdpContextCreated"));
       
   496 		aContext.PdpFsmInterface().Input(aContext.Id(), PdpFsm::E2ryPdpContextCreated);
       
   497 		}
       
   498 	else
       
   499 		{
       
   500 		SPUDTEL_INFO_LOG(_L("Notifying FSM: E2ryPdpContextCreatedFailed"));
       
   501 		aContext.PdpFsmInterface().Input(aContext.Id(), PdpFsm::E2ryPdpContextCreatedFailed, aCompletionStatus.Int());
       
   502 		}
       
   503 }
       
   504 
       
   505 /** Cancels last asynchronous request to eTel
       
   506 
       
   507 @param  aContext - pdp context
       
   508 */
       
   509 void TCreate2ryPdpContextStrategy::CancelAsyncRequest(CEtelDriverContext& /*aContext*/)
       
   510 	{
       
   511 	SPUDTEL_FNLOG("TCreate2ryPdpContextStrategy::CancelAsyncRequest()");
       
   512 	SPUDTEL_ERROR_LOG0(_L("ERROR: No outstanding requests"));
       
   513 	}
       
   514 
       
   515 
       
   516 //
       
   517 // TSetQoSStrategy
       
   518 //
       
   519 /** Executes next asynchronous step in a strategy. 
       
   520 
       
   521 @param aContext - pdp context
       
   522 @param aStatus - request status of this step
       
   523 */
       
   524 void TSetQoSStrategy::Next(CEtelDriverContext& aContext, TRequestStatus* aStatus)
       
   525 	{
       
   526 	SPUDTEL_FNLOG("TSetQoSStrategy::Next()");
       
   527 	
       
   528 	TInt err = KErrNone;
       
   529 	
       
   530 	// possible steps:
       
   531 	//	-- set QoS profile parameters
       
   532 	switch(aContext.StrategyStep())
       
   533 		{
       
   534 		case EStartStep:
       
   535 			{
       
   536 #ifdef SYMBIAN_NETWORKING_UMTSR5
       
   537             RPacketQoS::TQoSR5Requested req;
       
   538 #else
       
   539             RPacketQoS::TQoSR99_R4Requested req;
       
   540 #endif 
       
   541 // SYMBIAN_NETWORKING_UMTSR5
       
   542 
       
   543 			aContext.PdpFsmInterface().Get (aContext.Id(), req);
       
   544 			aContext.QosRequested() = req;	
       
   545 
       
   546 
       
   547 #ifdef _DEBUG
       
   548             aContext.DumpReqProfileParameters ();
       
   549 #endif			
       
   550             aContext.PacketQoS().SetProfileParameters (*aStatus, aContext.QosRequestedPckg());
       
   551 			aContext.SetStrategyStep (ESetProfileParamsStep);
       
   552 			break;
       
   553 			}
       
   554 			
       
   555 		case ESetProfileParamsStep:
       
   556 			{
       
   557 			aContext.SetStrategyStep (EFinishStep);
       
   558 			break;
       
   559 			}
       
   560 			
       
   561 		default:
       
   562 			{
       
   563 			// unexpected
       
   564 			SPUDTEL_ERROR_LOG0(_L("ERROR: Incorrect case"));
       
   565 			ASSERT(EFalse);
       
   566 			err = KErrNotSupported;
       
   567 			break;
       
   568 			}
       
   569 		}
       
   570 		
       
   571 	if(err || (EFinishStep == aContext.StrategyStep()))
       
   572 		{
       
   573 		User::RequestComplete( aStatus, err);
       
   574 		}
       
   575 	
       
   576 	}
       
   577 	
       
   578 
       
   579 /** 
       
   580 FSM completion notification 
       
   581 and setting QoSR99_R4Negotiated in spud FSM
       
   582 */	
       
   583 void TSetQoSStrategy::NotifyFsm(CEtelDriverContext& aContext, TRequestStatus& aCompletionStatus )
       
   584 	{
       
   585 	if(aCompletionStatus == KErrNone)
       
   586 		{
       
   587 		SPUDTEL_INFO_LOG(_L("Notifying FSM: EQoSSet"));
       
   588 		aContext.PdpFsmInterface().Input(aContext.Id(), PdpFsm::EQoSSet);
       
   589 		}
       
   590 	else
       
   591 		{
       
   592 		SPUDTEL_INFO_LOG(_L("Notifying FSM: EQoSSetFailed"));
       
   593 		aContext.PdpFsmInterface().Input(aContext.Id(), PdpFsm::EQoSSetFailed, aCompletionStatus.Int());
       
   594 		}
       
   595 	}
       
   596 	
       
   597 /** Cancels last asynchronous request to eTel
       
   598 
       
   599 @param  aContext - pdp context
       
   600 */
       
   601 void TSetQoSStrategy::CancelAsyncRequest(CEtelDriverContext& aContext)
       
   602 	{
       
   603 	switch(aContext.StrategyStep())
       
   604 		{
       
   605 		case ESetProfileParamsStep:
       
   606 			{
       
   607 			aContext.PacketQoS().CancelAsyncRequest(EPacketQoSSetProfileParams);
       
   608 			SPUDTEL_INFO_LOG(_L("Cancel PacketQoS::EPacketQoSSetProfileParams"));
       
   609 			break;
       
   610 			}
       
   611 			
       
   612 		default:
       
   613 			// there're NO outstanding async requests
       
   614 			SPUDTEL_ERROR_LOG0(_L("ERROR: Incorrect case in TSetQoSStrategy::CancelAsyncRequest"));
       
   615 			ASSERT(EFalse);
       
   616 			break;
       
   617 		}
       
   618 	}
       
   619 
       
   620 
       
   621 //
       
   622 // TSetTftStrategy
       
   623 //
       
   624 /** Executes next asynchronous step in a strategy. 
       
   625 
       
   626 @param aContext - pdp context
       
   627 @param aStatus - request status of this step
       
   628 */
       
   629 void TSetTftStrategy::Next(CEtelDriverContext& aContext, TRequestStatus* aStatus)
       
   630 	{
       
   631 	SPUDTEL_FNLOG("TSetTftStrategy::Next()");
       
   632 	
       
   633 	TInt err = KErrNone;
       
   634 
       
   635 	// possible steps:
       
   636 	// 	-- add filters
       
   637 	switch(aContext.StrategyStep())
       
   638 		{
       
   639 		case EStartStep:
       
   640 			{
       
   641 			aContext.PdpFsmInterface().Get (aContext.Id(), aContext.TftOperationCode());
       
   642 			switch(aContext.TftOperationCode())
       
   643 				{
       
   644 				case KAddFilters:
       
   645 					aContext.PdpFsmInterface().Get (aContext.Id(), aContext.TftInfo());
       
   646 					SPUDTELVERBOSE_INFO_LOG1(_L("TftOperationCode - Add Filters"), aContext.TftInfo().FilterCount());
       
   647 					// Set strategy assumes that TFT has to be created on a first place
       
   648 					SPUDTELVERBOSE_INFO_LOG(_L("Creating TFT..."));
       
   649 					aContext.PacketContext().CreateNewTFT(*aStatus, aContext.TftInfo().FilterCount());
       
   650 					aContext.SetStrategyStep (ECreateNewTFTStep);
       
   651 					break;
       
   652 
       
   653 				case KRemoveFilters:
       
   654 					err = KErrNotSupported;
       
   655 					SPUDTEL_ERROR_LOG(_L("TftOperationCode - Remove is not supported in a Set strategy, return %d"), err);
       
   656 					break;
       
   657 
       
   658 				case KDeleteTFT:
       
   659 					err = KErrNotSupported;
       
   660 					SPUDTEL_ERROR_LOG(_L("TftOperationCode - Delete is not supported in a Set strategy, return %d"), err);
       
   661 					break;
       
   662 
       
   663 				default:
       
   664 					// wrong case
       
   665 					SPUDTEL_ERROR_LOG0(_L("ERROR: Incorrect case"));
       
   666 					ASSERT(EFalse);
       
   667 					err = KErrNotSupported;
       
   668 					break;
       
   669 				}
       
   670 			break;
       
   671 			}
       
   672 	
       
   673 		case ECreateNewTFTStep:
       
   674 			{
       
   675 			TInt err1st = aContext.FirstFilterV2();
       
   676 			if(err1st == KErrNone)
       
   677 				{
       
   678 				aContext.PacketContext().AddPacketFilter( *aStatus, aContext.FilterV2Pckg());
       
   679 				aContext.SetStrategyStep (EAddTftStep);
       
   680 				}
       
   681 			else	// done
       
   682 				{ 
       
   683 				// internal check
       
   684 				ASSERT((aContext.TftRequested() <= aContext.TftInfo().FilterCount()));
       
   685 				aContext.SetStrategyStep (EFinishStep); 
       
   686 				}
       
   687 				
       
   688 			break;
       
   689 			}
       
   690 
       
   691 		case EAddTftStep:
       
   692 			{
       
   693 			TInt errV2 = aContext.NextFilterV2();
       
   694 			if(errV2 == KErrNone)
       
   695 				{
       
   696 				aContext.PacketContext().AddPacketFilter( *aStatus, aContext.FilterV2Pckg());
       
   697 				aContext.SetStrategyStep (EAddTftStep);
       
   698 				}
       
   699 			else	// done
       
   700 				{ 
       
   701 				// internal check
       
   702 				ASSERT((aContext.TftRequested() <= aContext.TftInfo().FilterCount()));
       
   703 				aContext.SetStrategyStep (EFinishStep); 
       
   704 				}
       
   705 				
       
   706 			break;
       
   707 			}
       
   708 
       
   709 		default:
       
   710 			// unexpected
       
   711 			SPUDTEL_ERROR_LOG0(_L("ERROR: Incorrect case"));
       
   712 			ASSERT(EFalse);
       
   713 			err = KErrNotSupported;
       
   714 			break;
       
   715 		}
       
   716 		
       
   717 	if(err || (EFinishStep == aContext.StrategyStep()))
       
   718 		{
       
   719 		User::RequestComplete( aStatus, err);
       
   720 		}
       
   721 	
       
   722 	}
       
   723 	
       
   724 /** 
       
   725 Notifies SPUD FSM about execution results.
       
   726 
       
   727 @param aContext - pdp context
       
   728 @param aCompletionStatus - completion request status
       
   729 */	
       
   730 void TSetTftStrategy::NotifyFsm(CEtelDriverContext& aContext, TRequestStatus& aCompletionStatus )
       
   731 	{
       
   732 	if(aCompletionStatus == KErrNone)
       
   733 		{
       
   734 		SPUDTEL_INFO_LOG(_L("Notifying FSM: ETftSet"));
       
   735 		aContext.PdpFsmInterface().Input(aContext.Id(), PdpFsm::ETftSet);
       
   736 		}
       
   737 	else
       
   738 		{
       
   739 		SPUDTEL_INFO_LOG(_L("Notifying FSM: ETftSetFailed"));
       
   740 		aContext.PdpFsmInterface().Input(aContext.Id(), PdpFsm::ETftSetFailed, aCompletionStatus.Int());
       
   741 		}
       
   742 	}
       
   743 	
       
   744 /** Cancels last asynchronous request to eTel
       
   745 
       
   746 @param  aContext - pdp context
       
   747 */
       
   748 void TSetTftStrategy::CancelAsyncRequest(CEtelDriverContext& aContext)
       
   749 	{
       
   750 	switch(aContext.StrategyStep())
       
   751 		{
       
   752 		case ECreateNewTFTStep:
       
   753 			{
       
   754 			aContext.PacketQoS().CancelAsyncRequest(EPacketContextCreateNewTFT);
       
   755 			SPUDTEL_INFO_LOG(_L("Cancel PacketQoS::EPacketContextCreateNewTFT"));
       
   756 			break;
       
   757 			}
       
   758 			
       
   759 		case EAddTftStep:
       
   760 			{
       
   761 			aContext.PacketQoS().CancelAsyncRequest(EPacketContextAddPacketFilter);
       
   762 			SPUDTEL_INFO_LOG(_L("Cancel PacketQoS::EPacketContextAddPacketFilter"));
       
   763 			break;
       
   764 			}
       
   765 
       
   766 		default:
       
   767 			// unexpected
       
   768 			SPUDTEL_ERROR_LOG0(_L("ERROR: Incorrect case in TSetTftStrategy::CancelAsyncRequest"));
       
   769 			ASSERT(EFalse);
       
   770 			break;
       
   771 		}
       
   772 	}
       
   773 
       
   774 
       
   775 //
       
   776 // TChangeTftStrategy
       
   777 //
       
   778 /** Executes next asynchronous step in a strategy. 
       
   779 
       
   780 @param aContext - pdp context
       
   781 @param aStatus - request status of this step
       
   782 */
       
   783 void TChangeTftStrategy::Next(CEtelDriverContext& aContext, TRequestStatus* aStatus)
       
   784 	{
       
   785 	SPUDTEL_FNLOG("TChangeTftStrategy::Next()");
       
   786 	
       
   787 	TInt err = KErrNone;
       
   788 
       
   789 	// special case. 
       
   790 	if(EStartStep == aContext.StrategyStep())
       
   791 		{
       
   792 		aContext.PdpFsmInterface().Get (aContext.Id(), aContext.TftOperationCode());
       
   793 		switch(aContext.TftOperationCode())
       
   794 			{
       
   795 			case KAddFilters:
       
   796 				aContext.PdpFsmInterface().Get (aContext.Id(), aContext.TftInfo());
       
   797 				SPUDTELVERBOSE_INFO_LOG1(_L("TftOperationCode - Add Filters"), aContext.TftInfo().FilterCount());
       
   798 				aContext.SetStrategyStep (EAddFirstTftStep);
       
   799 				break;
       
   800 
       
   801 			case KRemoveFilters:
       
   802 				aContext.PdpFsmInterface().Get (aContext.Id(), aContext.TftInfo());
       
   803 				SPUDTELVERBOSE_INFO_LOG1(_L("TftOperationCode - Remove %d Filters"), aContext.TftInfo().FilterCount());
       
   804 				aContext.SetStrategyStep (ERemoveFirstTftStep);
       
   805 				break;
       
   806 
       
   807 			case KDeleteTFT:
       
   808 				SPUDTELVERBOSE_INFO_LOG(_L("TftOperationCode - Delete TFT"));
       
   809 				// delete old TFT
       
   810 				aContext.PacketContext().DeleteTFT(*aStatus);
       
   811 				aContext.SetStrategyStep (EDeleteTftStep);
       
   812 				// DeleteTFT() ia an async operation => return 
       
   813 				return;
       
   814 
       
   815 			default:
       
   816 				// wrong case
       
   817 				SPUDTEL_ERROR_LOG0(_L("ERROR: Incorrect case"));
       
   818 				ASSERT(EFalse);
       
   819 				err = KErrNotSupported;
       
   820 				break;
       
   821 			}
       
   822 		}
       
   823 	
       
   824 	// possible steps:
       
   825 	//	-- delete TFT 
       
   826 	// 	-- add filters
       
   827 	// 	-- remove filters
       
   828 	if(!err)
       
   829 		{
       
   830 		switch(aContext.StrategyStep())
       
   831 			{
       
   832 			case EDeleteTftStep:
       
   833 				{
       
   834 				aContext.SetStrategyStep (EChangeTftFinished);
       
   835 				User::RequestComplete( aStatus, KErrNone);
       
   836 				break;
       
   837 				}
       
   838 				
       
   839 			case EAddFirstTftStep:
       
   840 				{
       
   841 				TInt errV2 = aContext.FirstFilterV2();
       
   842 				if(errV2 == KErrNone)
       
   843 					{
       
   844 					aContext.PacketContext().AddPacketFilter( *aStatus, aContext.FilterV2Pckg());
       
   845 					aContext.SetStrategyStep (EAddTftStep);
       
   846 					}
       
   847 				else	// done
       
   848 					{ 
       
   849 					aContext.SetStrategyStep (EChangeTftFinished);
       
   850 					User::RequestComplete( aStatus, KErrNone);
       
   851 					}
       
   852 					
       
   853 				break;
       
   854 				}
       
   855 
       
   856 			case EAddTftStep:
       
   857 				{
       
   858 				TInt errV2 = aContext.NextFilterV2();
       
   859 				if(errV2 == KErrNone)
       
   860 					{
       
   861 					aContext.PacketContext().AddPacketFilter( *aStatus, aContext.FilterV2Pckg());
       
   862 					aContext.SetStrategyStep (EAddTftStep);
       
   863 					}
       
   864 				else	// done
       
   865 					{ 
       
   866 					aContext.SetStrategyStep (EChangeTftFinished);
       
   867 					User::RequestComplete( aStatus, KErrNone);
       
   868 					}
       
   869 					
       
   870 				break;
       
   871 				}
       
   872 
       
   873 			case ERemoveFirstTftStep:
       
   874 				{
       
   875 				TInt errV2 = aContext.FirstFilterV2();
       
   876 				if(errV2 == KErrNone)
       
   877 					{
       
   878 					aContext.PacketContext().RemovePacketFilter( *aStatus, aContext.FilterV2().iId);
       
   879 					aContext.SetStrategyStep (ERemoveTftStep);
       
   880 					}
       
   881 				else	// done
       
   882 					{
       
   883 					aContext.SetStrategyStep (EChangeTftFinished);
       
   884 					User::RequestComplete( aStatus, KErrNone);
       
   885 					}
       
   886 					
       
   887 				break;
       
   888 				}
       
   889 				
       
   890 			case ERemoveTftStep:
       
   891 				{
       
   892 				TInt errV2 = aContext.NextFilterV2();
       
   893 				if(errV2 == KErrNone)
       
   894 					{
       
   895 					aContext.PacketContext().RemovePacketFilter( *aStatus, aContext.FilterV2().iId);
       
   896 					aContext.SetStrategyStep (ERemoveTftStep);
       
   897 					}
       
   898 				else	// done
       
   899 					{
       
   900 					aContext.SetStrategyStep (EChangeTftFinished);
       
   901 					User::RequestComplete( aStatus, KErrNone);
       
   902 					}
       
   903 					
       
   904 				break;
       
   905 				}
       
   906 
       
   907 			case EChangeTftFinished:
       
   908 				{
       
   909 				aContext.SetStrategyStep (EFinishStep);
       
   910 				}
       
   911 				break;
       
   912 
       
   913 				
       
   914 			default:
       
   915 				// unexpected
       
   916 				SPUDTEL_ERROR_LOG0(_L("ERROR: Incorrect case"));
       
   917 				ASSERT(EFalse);
       
   918 				err = KErrNotSupported;
       
   919 				break;
       
   920 			}
       
   921 		}
       
   922 		
       
   923 	if(err || (EFinishStep == aContext.StrategyStep()))
       
   924 		{
       
   925 		User::RequestComplete( aStatus, err);
       
   926 		}
       
   927 	
       
   928 	}
       
   929 	
       
   930 
       
   931 /** 
       
   932 Notifies SPUD FSM about execution results.
       
   933 
       
   934 @param aContext - pdp context
       
   935 @param aCompletionStatus - completion request status
       
   936 */	
       
   937 void TChangeTftStrategy::NotifyFsm(CEtelDriverContext& aContext, TRequestStatus& aCompletionStatus )
       
   938 	{
       
   939 	if(aCompletionStatus == KErrNone)
       
   940 		{
       
   941 		SPUDTEL_INFO_LOG(_L("Notifying FSM: ETftChanged"));
       
   942 		aContext.PdpFsmInterface().Input(aContext.Id(), PdpFsm::ETftChanged);
       
   943 		}
       
   944 	else
       
   945 		{
       
   946 		SPUDTEL_INFO_LOG(_L("Notifying FSM: ETftChangedFailed"));
       
   947 		aContext.PdpFsmInterface().Input(aContext.Id(), PdpFsm::ETftChangedFailed, aCompletionStatus.Int());
       
   948 		}
       
   949 	}
       
   950 	
       
   951 /** Cancels last asynchronous request to eTel
       
   952 
       
   953 @param  aContext - pdp context
       
   954 */
       
   955 void TChangeTftStrategy::CancelAsyncRequest(CEtelDriverContext& aContext)
       
   956 	{
       
   957 	switch(aContext.StrategyStep())
       
   958 		{
       
   959 		case EDeleteTftStep:
       
   960 			{
       
   961 			SPUDTEL_INFO_LOG(_L("Cancel PacketQoS::EPacketContextDeleteTFTCancel"));
       
   962 			aContext.PacketQoS().CancelAsyncRequest(EPacketContextDeleteTFTCancel);
       
   963 			break;
       
   964 			}
       
   965 		
       
   966 		case ERemoveTftStep:
       
   967 			{
       
   968 			SPUDTEL_INFO_LOG(_L("Cancel PacketQoS::EPacketContextRemovePacketFilterCancel"));
       
   969 			aContext.PacketQoS().CancelAsyncRequest(EPacketContextRemovePacketFilterCancel);
       
   970 			break;
       
   971 			}
       
   972 			
       
   973 		case EAddTftStep:
       
   974 			{
       
   975 			SPUDTEL_INFO_LOG(_L("Cancel PacketQoS::EPacketContextAddPacketFilter"));
       
   976 			aContext.PacketQoS().CancelAsyncRequest(EPacketContextAddPacketFilterCancel);
       
   977 			break;
       
   978 			}
       
   979 
       
   980 		default:
       
   981 			// unexpected
       
   982 			SPUDTEL_ERROR_LOG0(_L("ERROR: Incorrect case in TChangeTftStrategy::CancelAsyncRequest"));
       
   983 			ASSERT(EFalse);
       
   984 			break;
       
   985 		}
       
   986 	}
       
   987 
       
   988 
       
   989 //
       
   990 // TActivatePdpStrategy
       
   991 //
       
   992 /** Executes next asynchronous step in a strategy. 
       
   993 
       
   994 @param aContext - pdp context
       
   995 @param aStatus - request status of this step
       
   996 */
       
   997 void TActivatePdpStrategy::Next(CEtelDriverContext& aContext, TRequestStatus* aStatus)
       
   998 	{
       
   999 	SPUDTEL_FNLOG("TActivatePdpStrategy::Next()");
       
  1000 	
       
  1001 	TInt err = KErrNone;
       
  1002 	
       
  1003 	switch(aContext.StrategyStep())
       
  1004 		{
       
  1005 		case EStartStep:
       
  1006 			{
       
  1007 			aContext.PacketContext().Activate(*aStatus);
       
  1008 			aContext.SetStrategyStep (EActivateStep);
       
  1009 			break;
       
  1010 			}
       
  1011 		
       
  1012 		case EActivateStep:
       
  1013 			{
       
  1014 			aContext.PdpFsmInterface().Get (aContext.Id(), aContext.ContextConfigGPRS());
       
  1015 			aContext.PacketContext().GetConfig (*aStatus, aContext.ContextConfigGPRSPckg());
       
  1016 			aContext.SetStrategyStep (EGetConfigStep);
       
  1017 			break;
       
  1018 			}
       
  1019 			
       
  1020 		case EGetConfigStep:
       
  1021 			{
       
  1022 			aContext.PdpFsmInterface().Set (aContext.Id(), aContext.ContextConfigGPRS());
       
  1023 			aContext.PacketContext().InitialiseContext(*aStatus, aContext.DataChannelV2Pckg());
       
  1024 			aContext.SetStrategyStep (EInitialiseContextStep);
       
  1025 			break;
       
  1026 			}
       
  1027 
       
  1028 		case EInitialiseContextStep:
       
  1029 			{
       
  1030 			if (KPrimaryContextId == aContext.Id())
       
  1031 				{
       
  1032                 aContext.PacketQoS().GetProfileParameters (*aStatus, aContext.QosNegotiatedPckg());	
       
  1033 #ifdef _DEBUG
       
  1034                 aContext.DumpNegProfileParameters ();
       
  1035 #endif
       
  1036                 aContext.SetStrategyStep (EGetProfileParamsStep);
       
  1037                 }
       
  1038 			else
       
  1039                 {
       
  1040                 aContext.SetStrategyStep (EFinishStep);
       
  1041                 }
       
  1042             break;
       
  1043 			}
       
  1044 			
       
  1045 		case EGetProfileParamsStep:
       
  1046 			{
       
  1047 			aContext.SetStrategyStep (EFinishStep);
       
  1048 			break;
       
  1049 			}
       
  1050 			
       
  1051 		default:
       
  1052 			// unexpected
       
  1053 			SPUDTEL_ERROR_LOG0(_L("ERROR: Incorrect case"));
       
  1054 			ASSERT(EFalse);
       
  1055 			err = KErrNotSupported;
       
  1056 			break;
       
  1057 		}
       
  1058 		
       
  1059 	if(err || (EFinishStep == aContext.StrategyStep()))
       
  1060 		{
       
  1061 		User::RequestComplete( aStatus, err);
       
  1062 		}
       
  1063 	
       
  1064 	}
       
  1065 	
       
  1066 
       
  1067 /** 
       
  1068 Notifies SPUD FSM about execution results.
       
  1069 
       
  1070 @param aContext - pdp context
       
  1071 @param aCompletionStatus - completion request status
       
  1072 */	
       
  1073 void TActivatePdpStrategy::NotifyFsm(CEtelDriverContext& aContext, TRequestStatus& aCompletionStatus )
       
  1074 	{
       
  1075 	if(aCompletionStatus == KErrNone)
       
  1076 		{
       
  1077 		SPUDTELVERBOSE_INFO_LOG(_L("FSM set: DataChannelV2"));
       
  1078 		aContext.PdpFsmInterface().Set(aContext.Id(), aContext.DataChannelV2());
       
  1079 
       
  1080 #ifdef SYMBIAN_NETWORKING_UMTSR5
       
  1081 		SPUDTELVERBOSE_INFO_LOG(_L("FSM set: QoSR5Negotiated"));
       
  1082 		aContext.PdpFsmInterface().Set(aContext.Id(), aContext.QosNegotiated().NegotiatedQoSR5());
       
  1083 
       
  1084 #else
       
  1085 		SPUDTELVERBOSE_INFO_LOG(_L("FSM set: QoSR99_R4Negotiated"));
       
  1086 		aContext.PdpFsmInterface().Set(aContext.Id(), aContext.QosNegotiated().NegotiatedQoSR99_R4());
       
  1087 #endif 
       
  1088 // SYMBIAN_NETWORKING_UMTSR5
       
  1089 
       
  1090 		SPUDTEL_INFO_LOG(_L("Notifying FSM: EPdpActivated"));
       
  1091 		aContext.PdpFsmInterface().Input(aContext.Id(), PdpFsm::EPdpActivated);
       
  1092 		}
       
  1093 	else
       
  1094 		{
       
  1095 		SPUDTEL_INFO_LOG(_L("Notifying FSM: EPdpActivatedFailed"));
       
  1096 		aContext.PdpFsmInterface().Input(aContext.Id(), PdpFsm::EPdpActivatedFailed, aCompletionStatus.Int());
       
  1097 		}
       
  1098 	}
       
  1099 	
       
  1100 /** Cancels last asynchronous request to eTel
       
  1101 
       
  1102 @param  aContext - pdp context
       
  1103 */
       
  1104 void TActivatePdpStrategy::CancelAsyncRequest(CEtelDriverContext& aContext)
       
  1105 	{
       
  1106 	switch(aContext.StrategyStep())
       
  1107 		{
       
  1108 		case EActivateStep:
       
  1109 			{
       
  1110 			aContext.PacketContext().CancelAsyncRequest(EPacketContextActivate);
       
  1111 			SPUDTEL_INFO_LOG(_L("Cancel PacketContext::EPacketContextActivate"));
       
  1112 			break;
       
  1113 			}
       
  1114 			
       
  1115 		case EGetConfigStep:
       
  1116 			{
       
  1117 			aContext.PacketContext().CancelAsyncRequest(EGetConfigStep);
       
  1118 			SPUDTEL_INFO_LOG(_L("Cancel PacketContext::EGetConfigStep"));
       
  1119 			break;
       
  1120 			}
       
  1121 		
       
  1122 		case EInitialiseContextStep:
       
  1123 			{
       
  1124 			aContext.PacketContext().CancelAsyncRequest(EPacketContextInitialiseContext);	
       
  1125 			SPUDTEL_INFO_LOG(_L("Cancel PacketContext::EPacketContextInitialiseContext"));
       
  1126 			break;
       
  1127 			}
       
  1128 			
       
  1129 		case EGetProfileParamsStep:
       
  1130 			{
       
  1131 			if(KPrimaryContextId == aContext.Id())
       
  1132 				{
       
  1133 				aContext.PacketContext().CancelAsyncRequest(EPacketQoSGetProfileParams);	
       
  1134 				SPUDTEL_INFO_LOG(_L("Cancel PacketContext::EPacketQoSGetProfileParams"));
       
  1135 				break;
       
  1136 				}
       
  1137 			}
       
  1138 			
       
  1139 		default:
       
  1140 			// unexpected
       
  1141 			SPUDTEL_ERROR_LOG0(_L("ERROR: Incorrect case in TActivatePdpStrategy::CancelAsyncRequest"));
       
  1142 			ASSERT(EFalse);
       
  1143 			break;
       
  1144 		}
       
  1145 	}
       
  1146 
       
  1147 //
       
  1148 // TGetNegQoSStrategy
       
  1149 //
       
  1150 /** Executes next asynchronous step in a strategy. 
       
  1151 
       
  1152 @param aContext - pdp context
       
  1153 @param aStatus - request status of this step
       
  1154 */
       
  1155 void TGetNegQoSStrategy::Next(CEtelDriverContext& aContext, TRequestStatus* aStatus)
       
  1156 	{
       
  1157 	SPUDTEL_FNLOG("TGetNegQoSStrategy::Next()");
       
  1158 	
       
  1159 	TInt err = KErrNone;
       
  1160 	
       
  1161 	switch(aContext.StrategyStep())
       
  1162 		{
       
  1163 		case EStartStep:
       
  1164 			{
       
  1165 			aContext.PacketQoS().GetProfileParameters (*aStatus, aContext.QosNegotiatedPckg());
       
  1166 #ifdef _DEBUG
       
  1167             aContext.DumpNegProfileParameters ();
       
  1168 #endif
       
  1169 			aContext.SetStrategyStep (EGetProfileParamsStep);
       
  1170 			break;
       
  1171 			}
       
  1172 
       
  1173 		case EGetProfileParamsStep:
       
  1174 			{
       
  1175 			aContext.SetStrategyStep (EFinishStep);
       
  1176 			break;
       
  1177 			}
       
  1178 			
       
  1179 		default:
       
  1180 			// unexpected
       
  1181 			SPUDTEL_ERROR_LOG0(_L("ERROR: Incorrect case"));
       
  1182 			ASSERT(EFalse);
       
  1183 			err = KErrNotSupported;
       
  1184 			break;
       
  1185 		}
       
  1186 		
       
  1187 	if(err || (EFinishStep == aContext.StrategyStep()))
       
  1188 		{
       
  1189 		User::RequestComplete( aStatus, err);
       
  1190 		}
       
  1191 	
       
  1192 	}
       
  1193 	
       
  1194 
       
  1195 /** 
       
  1196 Notifies SPUD FSM about execution results.
       
  1197 
       
  1198 @param aContext - pdp context
       
  1199 @param aCompletionStatus - completion request status
       
  1200 */	
       
  1201 void TGetNegQoSStrategy::NotifyFsm(CEtelDriverContext& aContext, TRequestStatus& aCompletionStatus )
       
  1202 	{
       
  1203 	if(aCompletionStatus == KErrNone)
       
  1204 		{
       
  1205 #ifdef SYMBIAN_NETWORKING_UMTSR5
       
  1206 		SPUDTELVERBOSE_INFO_LOG(_L("FSM set: QoSR5Negotiated"));
       
  1207 		aContext.PdpFsmInterface().Set(aContext.Id(), aContext.QosNegotiated().NegotiatedQoSR5());
       
  1208 
       
  1209 #else
       
  1210 // !SYMBIAN_NETWORKING_UMTSR5
       
  1211 
       
  1212 		SPUDTELVERBOSE_INFO_LOG(_L("FSM set: QoSR99_R4Negotiated"));
       
  1213 		aContext.PdpFsmInterface().Set(aContext.Id(), aContext.QosNegotiated().NegotiatedQoSR99_R4());
       
  1214 #endif
       
  1215 // SYMBIAN_NETWORKING_UMTSR5
       
  1216 		
       
  1217 		SPUDTEL_INFO_LOG(_L("Notifying FSM: EPdpNegQoSRetrieved"));
       
  1218 		aContext.PdpFsmInterface().Input(aContext.Id(), PdpFsm::EPdpNegQoSRetrieved);
       
  1219 		}
       
  1220 	else
       
  1221 		{
       
  1222 		SPUDTEL_INFO_LOG(_L("Notifying FSM: EPdpNegQoSRetrievedFailed"));
       
  1223 		aContext.PdpFsmInterface().Input(aContext.Id(), PdpFsm::EPdpNegQoSRetrievedFailed, aCompletionStatus.Int());
       
  1224 		}
       
  1225 	}
       
  1226 	
       
  1227 /** Cancels last asynchronous request to eTel
       
  1228 
       
  1229 @param  aContext - pdp context
       
  1230 */
       
  1231 void TGetNegQoSStrategy::CancelAsyncRequest(CEtelDriverContext& aContext)
       
  1232 	{
       
  1233 	switch(aContext.StrategyStep())
       
  1234 		{	
       
  1235 		case EGetProfileParamsStep:
       
  1236 			{
       
  1237 			aContext.PacketContext().CancelAsyncRequest(EPacketQoSGetProfileParams);	
       
  1238 			SPUDTEL_INFO_LOG(_L("Cancel PacketContext::EPacketQoSGetProfileParams"));
       
  1239 			break;
       
  1240 			}
       
  1241 			
       
  1242 		default:
       
  1243 			// unexpected
       
  1244 			SPUDTEL_ERROR_LOG0(_L("ERROR: Incorrect case in TGetNegQoSStrategy::CancelAsyncRequest"));
       
  1245 			ASSERT(EFalse);
       
  1246 			break;
       
  1247 		}
       
  1248 	}
       
  1249 
       
  1250 
       
  1251 //
       
  1252 // TModifyActiveStrategy
       
  1253 //
       
  1254 /** Executes next asynchronous step in a strategy. 
       
  1255 
       
  1256 @param aContext - pdp context
       
  1257 @param aStatus - request status of this step
       
  1258 */
       
  1259 void TModifyActiveStrategy::Next(CEtelDriverContext& aContext, TRequestStatus* aStatus)
       
  1260 	{
       
  1261 	SPUDTEL_FNLOG("TModifyActiveStrategy::Next()");
       
  1262 	
       
  1263 	TInt err = KErrNone;
       
  1264 	
       
  1265 	switch(aContext.StrategyStep())
       
  1266 		{
       
  1267 		case EStartStep:
       
  1268 			{
       
  1269 			aContext.PacketContext().ModifyActiveContext(*aStatus);
       
  1270 			aContext.SetStrategyStep (EModifyActiveStep);
       
  1271 			break;
       
  1272 			}
       
  1273 		
       
  1274 		case EModifyActiveStep:
       
  1275 			{
       
  1276 			aContext.PacketQoS().GetProfileParameters (*aStatus, aContext.QosNegotiatedPckg());
       
  1277 #ifdef _DEBUG
       
  1278             aContext.DumpNegProfileParameters ();
       
  1279 #endif
       
  1280 			aContext.SetStrategyStep (EGetProfileParamsStep);
       
  1281 			break;
       
  1282 			}
       
  1283 			
       
  1284 		case EGetProfileParamsStep:
       
  1285 			{
       
  1286 			aContext.SetStrategyStep (EFinishStep);
       
  1287 			break;
       
  1288 			}
       
  1289 			
       
  1290 		default:
       
  1291 			// unexpected
       
  1292 			SPUDTEL_ERROR_LOG0(_L("ERROR: Incorrect case"));
       
  1293 			ASSERT(EFalse);
       
  1294 			err = KErrNotSupported;
       
  1295 			break;
       
  1296 		}
       
  1297 		
       
  1298 	if(err || (EFinishStep == aContext.StrategyStep()))
       
  1299 		{
       
  1300 		User::RequestComplete( aStatus, err);
       
  1301 		}
       
  1302 	
       
  1303 	}
       
  1304 	
       
  1305 
       
  1306 /** 
       
  1307 Notifies SPUD FSM about execution results.
       
  1308 
       
  1309 @param aContext - pdp context
       
  1310 @param aCompletionStatus - completion request status
       
  1311 */	
       
  1312 void TModifyActiveStrategy::NotifyFsm(CEtelDriverContext& aContext, TRequestStatus& aCompletionStatus )
       
  1313 	{
       
  1314 	if(aCompletionStatus == KErrNone)
       
  1315 		{
       
  1316 #ifdef SYMBIAN_NETWORKING_UMTSR5
       
  1317 		SPUDTELVERBOSE_INFO_LOG(_L("FSM set: QoSR5Negotiated"));
       
  1318 		aContext.PdpFsmInterface().Set(aContext.Id(), aContext.QosNegotiated().NegotiatedQoSR5());
       
  1319 
       
  1320 #else
       
  1321 		SPUDTELVERBOSE_INFO_LOG(_L("FSM set: QoSR99_R4Negotiated"));
       
  1322 		aContext.PdpFsmInterface().Set(aContext.Id(), aContext.QosNegotiated().NegotiatedQoSR99_R4());
       
  1323 #endif 
       
  1324 // SYMBIAN_NETWORKING_UMTSR5
       
  1325 
       
  1326 		SPUDTEL_INFO_LOG(_L("Notifying FSM: EPdpContextModified"));
       
  1327 		aContext.PdpFsmInterface().Input(aContext.Id(), PdpFsm::EPdpContextModified);
       
  1328 		}
       
  1329 	else
       
  1330 		{
       
  1331 		SPUDTEL_INFO_LOG(_L("Notifying FSM: EPdpContextModifiedFailed"));
       
  1332 		aContext.PdpFsmInterface().Input(aContext.Id(), PdpFsm::EPdpContextModifiedFailed, aCompletionStatus.Int());
       
  1333 		}
       
  1334 	}
       
  1335 	
       
  1336 /** Cancels last asynchronous request to eTel
       
  1337 
       
  1338 @param  aContext - pdp context
       
  1339 */
       
  1340 void TModifyActiveStrategy::CancelAsyncRequest(CEtelDriverContext& aContext)
       
  1341 	{
       
  1342 	switch(aContext.StrategyStep())
       
  1343 		{
       
  1344 		case EModifyActiveStep:
       
  1345 			{
       
  1346 			aContext.PacketContext().CancelAsyncRequest(EPacketContextModifyActiveContext);
       
  1347 			SPUDTEL_INFO_LOG(_L("Cancel PacketContext::EPacketContextModifyActiveContext"));
       
  1348 			break;
       
  1349 			}
       
  1350 			
       
  1351 		case EGetProfileParamsStep:
       
  1352 			{
       
  1353 			aContext.PacketContext().CancelAsyncRequest(EPacketQoSGetProfileParams);
       
  1354 			SPUDTEL_INFO_LOG(_L("Cancel PacketContext::EPacketQoSGetProfileParams"));
       
  1355 			break;
       
  1356 			}
       
  1357 			
       
  1358 		default:
       
  1359 			// unexpected
       
  1360 			SPUDTEL_ERROR_LOG0(_L("ERROR: Incorrect case in TModifyActiveStrategy::CancelAsyncRequest"));
       
  1361 			ASSERT(EFalse);
       
  1362 			break;
       
  1363 		}
       
  1364 	}