telephonyserver/etelpacketdata/dtsy/pckttsy.cpp
changeset 0 3553901f7fa8
child 24 6638e7f4bd8f
equal deleted inserted replaced
-1:000000000000 0:3553901f7fa8
       
     1 // Copyright (c) 1997-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 //
       
    15 
       
    16 #include "pckttsy.h"
       
    17 #include "testdef.h"
       
    18 #include "etelpckt.h"
       
    19 #include <et_clsvr.h>
       
    20 #include "dpcktlog.h"
       
    21 #include <pcktcs.h>
       
    22 
       
    23 #include "coretsy.h"
       
    24 
       
    25 
       
    26 /**************************************************************************/
       
    27 //
       
    28 //	CGprsDGprsTsy
       
    29 //
       
    30 /**************************************************************************/
       
    31 
       
    32 CGprsDGprsTsy* CGprsDGprsTsy::NewL(CPhoneFactoryDummyBase* aFac)
       
    33 /**
       
    34  * NewL method - Standard 2 phase constructor.
       
    35  */
       
    36 	{
       
    37 	LOGTEXT(_L8("CGprsDGprsTsy: Entered NewL()"));
       
    38 
       
    39 	CGprsDGprsTsy* subsession=new(ELeave) CGprsDGprsTsy(aFac);
       
    40 	CleanupStack::PushL(subsession);
       
    41 	subsession->ConstructL();
       
    42 	CleanupStack::Pop();
       
    43 	return subsession;
       
    44 	}
       
    45 
       
    46 void CGprsDGprsTsy::Init()
       
    47 	{}
       
    48 
       
    49 CGprsDGprsTsy::CGprsDGprsTsy(CPhoneFactoryDummyBase* aFac)
       
    50 	:CSubSessionExtDummyBase(aFac),
       
    51 	iActiveRequestObjects(_FOFF(CGprsDGprsTsy::CActiveListNode,iNext))
       
    52 
       
    53 	{
       
    54 	}
       
    55 
       
    56 void CGprsDGprsTsy::ConstructL()
       
    57 /**
       
    58  * ConstructL method.
       
    59  */
       
    60 	{
       
    61 	LOGTEXT(_L8("CGprsDGprsTsy: Entered constructor"));
       
    62 	iMutex.CreateGlobal(KNullDesC, EOwnerProcess);
       
    63 	iGetMbmsMonitoredServices = new CArrayPtrFlat<CListReadAllAttempt>(1);
       
    64 	iList=CPcktMbmsMonitoredServiceList::NewL();
       
    65 	}
       
    66 
       
    67 CGprsDGprsTsy::~CGprsDGprsTsy()
       
    68 /**
       
    69  * Destructor.
       
    70  */
       
    71 	{
       
    72 	if(iGetMbmsMonitoredServices)
       
    73 		{
       
    74 		iGetMbmsMonitoredServices->ResetAndDestroy();
       
    75 		delete iGetMbmsMonitoredServices;
       
    76 		}
       
    77   	if(iList)
       
    78   		{
       
    79   		delete iList;
       
    80   		}
       
    81   	iMutex.Close();
       
    82 	LOGTEXT(_L8("CGprsDGprsTsy: Entered destructor"));
       
    83 	}
       
    84 
       
    85 CTelObject* CGprsDGprsTsy::OpenNewObjectByNameL(const TDesC& aName)
       
    86 /**
       
    87  * 	Only gprs context objects can be opened from gprs object(s).
       
    88  */
       
    89 	{
       
    90 	LOGTEXT(_L8("CGprsDGprsTsy: OpenNewObjectByNameL()"));
       
    91 
       
    92 	if (aName.Compare(_L("GPRS_CONTEXT"))==KErrNone)
       
    93 		{
       
    94 		return reinterpret_cast<CTelObject*>(CGprsContextDGprsTsy::NewL(FacPtr()));
       
    95 		}
       
    96 	return NULL;
       
    97 	}
       
    98 
       
    99 CTelObject* CGprsDGprsTsy::OpenNewObjectL(TDes& aNewName)
       
   100 /**
       
   101  * A new context opened by a client will have its name allocated by the TSY.
       
   102  */
       
   103 	{
       
   104 	if(aNewName.Compare(KMBMSContextName) == KErrNone)
       
   105 		{
       
   106 		LOGTEXT(_L8("CGprsDGprsTsy: OpenNewObjectL()"));
       
   107 		aNewName.AppendNum(++iMbmsContextObjectCount);
       
   108 		return CMbmsContextDMbmsTsy::NewL(this,FacPtr());
       
   109 		}
       
   110 	else
       
   111 		{
       
   112 		LOGTEXT(_L8("CGprsDGprsTsy: OpenNewObjectL()"));
       
   113 		aNewName.Append(_L("PACKET_CONTEXT"));
       
   114 		aNewName.AppendNum(++iGprsContextObjectCount);
       
   115 		return CGprsContextDGprsTsy::NewL(FacPtr());
       
   116 		}
       
   117 	}
       
   118 
       
   119 CTelObject::TReqMode CGprsDGprsTsy::ReqModeL(const TInt aIpc)
       
   120 /**
       
   121  * ReqModeL is called from the server's CTelObject::ReqAnalyserL in order to check the 
       
   122  * type of request it has.
       
   123  * The following are example request types for this dummy TSY. All TSYs do not need to 
       
   124  * have these request types but they have been given "sensible" values in this dummy TSY code.
       
   125  */
       
   126 	{
       
   127 	LOGTEXT(_L8("CGprsDGprsTsy: ReqModeL() method"));
       
   128 
       
   129 	CTelObject::TReqMode ret=0;
       
   130 	switch (aIpc)
       
   131 		{
       
   132 		case EPacketAttach:
       
   133 		case EPacketDetach:
       
   134 		case EPacketRejectActivationRequest:
       
   135 		case EPacketSetMSClass:
       
   136 		case EPacketSetAttachMode:
       
   137 		case EPacketSetDefaultContextParams:
       
   138 		case EPacketGetStatus:
       
   139 		case EPacketGetContextInfo:
       
   140 		case EPacketGetNtwkRegStatus:
       
   141 		case EPacketGetMSClass:
       
   142 		case EPacketGetStaticCaps:
       
   143 		case EPacketGetDynamicCaps:
       
   144 		case EPacketGetAttachMode:
       
   145 		case EPacketGetDefaultContextParams:
       
   146 		case EPacketEnumerateContexts:
       
   147 		case EPacketSetPrefBearer:
       
   148 		case EPacketGetPrefBearer:
       
   149 		case EPacketGetCurrentReleaseMode:
       
   150 		case EPacketEnumerateNifs:
       
   151 		case EPacketGetNifInfo:
       
   152 		case EPacketEnumerateContextsInNif:
       
   153 		case EPacketGetContextNameInNif:
       
   154 		case EPacketPrepareOpenSecondary:
       
   155 		case EPacketDeactivateNIF:
       
   156 		case EPacketGetMbmsNetworkServiceStatus:
       
   157 		case EPacketUpdateMbmsMonitorServiceList:
       
   158 		case EPacketGetMbmsMonitoredServicesPhase1:
       
   159 		case EPacketGetMbmsMonitoredServicesPhase2:
       
   160 		case EPacketEnumerateMbmsMonitorServiceList:
       
   161 		case EPacketEnumerateMbmsActiveServiceList:
       
   162 			break;
       
   163 
       
   164 		case EPacketNotifyContextAdded:
       
   165 		case EPacketNotifyContextAddedCancel:
       
   166 		case EPacketNotifyStatusChange:
       
   167 		case EPacketNotifyContextActivationRequested:
       
   168 		case EPacketNotifyChangeOfNtwkRegStatus:
       
   169 		case EPacketNotifyMSClassChange:
       
   170 		case EPacketNotifyDynamicCapsChange:
       
   171 		case EPacketNotifyReleaseModeChange:
       
   172 		case EPacketNotifyAttachModeChange:
       
   173 		case EPacketNotifyMbmsNetworkServiceStatusChange:
       
   174 		case EPacketNotifyMbmsServiceAvailabilityChange:
       
   175 			ret=KReqModeMultipleCompletionEnabled | KReqModeRePostImmediately;
       
   176 			break;
       
   177 	
       
   178 		default:
       
   179 			User::Leave(KErrNotSupported);
       
   180 			break;
       
   181 		}
       
   182 	return ret;
       
   183 	}
       
   184 
       
   185 TInt CGprsDGprsTsy::RegisterNotification(const TInt aIpc)
       
   186 /**
       
   187  * RegisterNotification is called when the server recognises that this notification
       
   188  * is being posted for the first time on this sub-session object.
       
   189  * It enables the TSY to "turn on" any regular notification messages that it may 
       
   190  * receive from the phone.
       
   191  */
       
   192 	{
       
   193 	switch (aIpc)
       
   194 		{
       
   195 		case EPacketNotifyContextAdded:
       
   196 			LOGTEXT(_L8("CGprsDGprsTsy: RegisterNotification - Context added"));
       
   197 			return KErrNone;
       
   198 		case EPacketNotifyStatusChange:
       
   199 			LOGTEXT(_L8("CGprsDGprsTsy: RegisterNotification - Gprs status change"));
       
   200 			return KErrNone;
       
   201 		case EPacketNotifyContextActivationRequested:
       
   202 			LOGTEXT(_L8("CGprsDGprsTsy: RegisterNotification - Context activation requested"));
       
   203 			return KErrNone;
       
   204 		case EPacketNotifyChangeOfNtwkRegStatus:
       
   205 			LOGTEXT(_L8("CGprsDGprsTsy: RegisterNotification - Network registration status change"));
       
   206 			return KErrNone;
       
   207 		case EPacketNotifyMSClassChange:
       
   208 			LOGTEXT(_L8("CGprsDGprsTsy: RegisterNotification - MS class change"));
       
   209 			return KErrNone;
       
   210 		case EPacketNotifyDynamicCapsChange:
       
   211 			LOGTEXT(_L8("CGprsDGprsTsy: RegisterNotification - Dynamic capabilities change"));
       
   212 			return KErrNone;
       
   213 		case EPacketNotifyReleaseModeChange:
       
   214 			LOGTEXT(_L8("CGprsDGprsTsy: RegisterNotification - Network Release mode change"));
       
   215 			return KErrNone;
       
   216 		case EPacketNotifyAttachModeChange:
       
   217 			LOGTEXT(_L8("CGprsDGprsTsy: RegisterNotification - Network attach mode change"));
       
   218 			return KErrNone;
       
   219 		case EPacketNotifyMbmsNetworkServiceStatusChange:
       
   220 			LOGTEXT(_L8("CGprsDGprsTsy: RegisterNotification - Network Mbms Service Status change"));
       
   221 			return KErrNone;
       
   222 		case EPacketNotifyMbmsServiceAvailabilityChange:
       
   223 			LOGTEXT(_L8("CGprsDGprsTsy: RegisterNotification - Network Mbms Service change"));
       
   224 			return KErrNone;
       
   225 		default:
       
   226 			// Unknown or invalid IPC
       
   227 			LOGTEXT(_L8("CGprsDGprsTsy: Register error, unknown IPC"));
       
   228 			return KErrNotSupported;
       
   229 		}
       
   230 	}
       
   231 
       
   232 TInt CGprsDGprsTsy::DeregisterNotification(const TInt aIpc)
       
   233 /**
       
   234  * DeregisterNotification is called when the server recognises that this notification
       
   235  * will not be posted again because the last client to have a handle on this sub-session
       
   236  * object has just closed the handle.
       
   237  * It enables the TSY to "turn off" any regular notification messages that it may 
       
   238  * receive from the phone.
       
   239  */
       
   240 	{
       
   241 	switch (aIpc)
       
   242 		{
       
   243 		case EPacketNotifyContextAdded:
       
   244 			LOGTEXT(_L8("CGprsDGprsTsy: DeregisterNotification - Context added"));
       
   245 			return KErrNone;
       
   246 		case EPacketNotifyStatusChange:
       
   247 			LOGTEXT(_L8("CGprsDGprsTsy: DeregisterNotification - Gprs status change"));
       
   248 			return KErrNone;
       
   249 		case EPacketNotifyContextActivationRequested:
       
   250 			LOGTEXT(_L8("CGprsDGprsTsy: DeregisterNotification - Context activation requested"));
       
   251 			return KErrNone;
       
   252 		case EPacketNotifyChangeOfNtwkRegStatus:
       
   253 			LOGTEXT(_L8("CGprsDGprsTsy: DeregisterNotification - Network registration status change"));
       
   254 			return KErrNone;
       
   255 		case EPacketNotifyMSClassChange:
       
   256 			LOGTEXT(_L8("CGprsDGprsTsy: DeregisterNotification - MS class change"));
       
   257 			return KErrNone;
       
   258 		case EPacketNotifyDynamicCapsChange:
       
   259 			LOGTEXT(_L8("CGprsDGprsTsy: DeregisterNotification - Dynamic capabilities change"));
       
   260 			return KErrNone;
       
   261 		case EPacketNotifyReleaseModeChange:
       
   262 			LOGTEXT(_L8("CGprsDGprsTsy: DeregisterNotification - Network release mode change"));
       
   263 			return KErrNone;
       
   264 		case EPacketNotifyAttachModeChange:
       
   265 			LOGTEXT(_L8("CGprsDGprsTsy: DeregisterNotification - Network attach mode change"));
       
   266 			return KErrNone;
       
   267 		case EPacketNotifyMbmsNetworkServiceStatusChange:
       
   268 			LOGTEXT(_L8("CGprsDGprsTsy: DeregisterNotification - Network Mbms Service Status change"));
       
   269 			return KErrNone;
       
   270 		case EPacketNotifyMbmsServiceAvailabilityChange:
       
   271 			LOGTEXT(_L8("CGprsDGprsTsy: DeregisterNotification - Network Mbms Service change"));
       
   272 			return KErrNone;
       
   273 		default:
       
   274 			// Unknown or invalid IPC
       
   275 			LOGTEXT(_L8("CGprsDGprsTsy: Deregister error, unknown IPC"));
       
   276 			return KErrNotSupported;
       
   277 		}
       
   278 	}
       
   279 
       
   280 TInt CGprsDGprsTsy::NumberOfSlotsL(const TInt aIpc)
       
   281 /**
       
   282  * NumberOfSlotsL is called by the server when it is registering a new notification.
       
   283  * It enables the TSY to tell the server how many buffer slots to allocate for
       
   284  * "repost immediately" notifications that may trigger before clients collect them.
       
   285  */
       
   286 	{
       
   287 	TInt numberOfSlots=1;
       
   288 	switch (aIpc)
       
   289 		{
       
   290 		case EPacketNotifyStatusChange:
       
   291 		case EPacketNotifyDynamicCapsChange:
       
   292 		case EPacketNotifyMbmsNetworkServiceStatusChange:
       
   293 			LOGTEXT(_L8("CGprsDGprsTsy: Registered with 10 slots"));
       
   294 			numberOfSlots=10;
       
   295 			break;
       
   296 		case EPacketNotifyContextAdded:
       
   297 		case EPacketNotifyContextActivationRequested:
       
   298 		case EPacketNotifyChangeOfNtwkRegStatus:
       
   299 		case EPacketNotifyMSClassChange:
       
   300 		case EPacketNotifyReleaseModeChange:
       
   301 		case EPacketNotifyAttachModeChange:
       
   302 		case EPacketNotifyMbmsServiceAvailabilityChange:
       
   303 			LOGTEXT(_L8("CGprsDGprsTsy: Registered with 2 slots"));
       
   304 			numberOfSlots=2;
       
   305 			break;
       
   306 		default:
       
   307 			// Unknown or invalid IPC
       
   308 			LOGTEXT(_L8("CGprsDGprsTsy: Number of Slots error, unknown IPC"));
       
   309 			User::Leave(KErrNotSupported);
       
   310 			break;
       
   311 		}  
       
   312 	return numberOfSlots;
       
   313 	}
       
   314 
       
   315 
       
   316 TInt CGprsDGprsTsy::ExtFunc(const TTsyReqHandle aTsyReqHandle,const TInt aIpc,
       
   317 							  const TDataPackage& aPackage)
       
   318 /**
       
   319  * ExtFunc is called by the server when it has a "extended", i.e. non-core ETel request 
       
   320  * for the TSY to process.
       
   321  * A request handle, request type and request data are passed to the TSY.
       
   322  */
       
   323 	{
       
   324 	LOGTEXT(_L8("CGprsDGprsTsy: ExtFunc() method"));
       
   325 
       
   326 	TAny* dataPtr=aPackage.Ptr1();
       
   327 	TAny* dataPtr2=aPackage.Ptr2();
       
   328 
       
   329 	switch (aIpc)
       
   330 		{
       
   331 		case EPacketNotifyContextAdded:
       
   332 			return NotifyContextAdded(aTsyReqHandle, aPackage.Des1u());
       
   333 		case EPacketGetStatus:
       
   334 			return GetStatus(aTsyReqHandle,
       
   335 			REINTERPRET_CAST(RPacketService::TStatus*, dataPtr));
       
   336 		case EPacketNotifyStatusChange:
       
   337 			return NotifyStatusChange(aTsyReqHandle,
       
   338 			REINTERPRET_CAST(RPacketService::TStatus*, dataPtr));
       
   339 		case EPacketNotifyContextActivationRequested:
       
   340 			return NotifyContextActivationRequested(aTsyReqHandle,
       
   341 				REINTERPRET_CAST(TPacketDataConfigBase*, dataPtr));
       
   342 		case EPacketEnumerateContexts:
       
   343 			return EnumerateContexts(aTsyReqHandle,
       
   344 			REINTERPRET_CAST(TInt*, dataPtr),
       
   345 			REINTERPRET_CAST(TInt*, dataPtr2));
       
   346 		case EPacketGetContextInfo:
       
   347 			return GetContextInfo(aTsyReqHandle,
       
   348 			REINTERPRET_CAST(TInt*, dataPtr),
       
   349 			REINTERPRET_CAST(RPacketService::TContextInfo*, dataPtr2));
       
   350 		case EPacketGetNtwkRegStatus:
       
   351 			return GetNtwkRegStatus(aTsyReqHandle,
       
   352 			REINTERPRET_CAST(RPacketService::TRegistrationStatus*, dataPtr));
       
   353 		case EPacketNotifyChangeOfNtwkRegStatus:
       
   354 			return NotifyChangeOfNtwkRegStatus(aTsyReqHandle,
       
   355 			REINTERPRET_CAST(RPacketService::TRegistrationStatus*, dataPtr));
       
   356 		case EPacketGetMSClass:
       
   357 			return GetMSClass(aTsyReqHandle,
       
   358 			REINTERPRET_CAST(RPacketService::TMSClass*, dataPtr),
       
   359 			REINTERPRET_CAST(RPacketService::TMSClass*, dataPtr2));
       
   360 		case EPacketSetMSClass:
       
   361 			return SetMSClass(aTsyReqHandle,
       
   362 			REINTERPRET_CAST(RPacketService::TMSClass*, dataPtr));
       
   363 		case EPacketNotifyMSClassChange:
       
   364 			return NotifyMSClassChange(aTsyReqHandle,
       
   365 			REINTERPRET_CAST(RPacketService::TMSClass*, dataPtr));
       
   366 		case EPacketGetStaticCaps:
       
   367 			return GetStaticCaps(aTsyReqHandle, 
       
   368 				REINTERPRET_CAST(TUint*, dataPtr),
       
   369 				REINTERPRET_CAST(RPacketContext::TProtocolType*, dataPtr2));
       
   370 		case EPacketGetDynamicCaps:
       
   371 			return GetDynamicCaps(aTsyReqHandle,
       
   372 			REINTERPRET_CAST(RPacketService::TDynamicCapsFlags*, dataPtr));
       
   373 		case EPacketNotifyDynamicCapsChange:
       
   374 			return NotifyDynamicCapsChange(aTsyReqHandle,
       
   375 			REINTERPRET_CAST(RPacketService::TDynamicCapsFlags*, dataPtr));
       
   376 		case EPacketSetAttachMode:
       
   377 			return SetAttachMode(aTsyReqHandle,
       
   378 			REINTERPRET_CAST(RPacketService::TAttachMode*, dataPtr));
       
   379 		case EPacketGetAttachMode:
       
   380 			return GetAttachMode(aTsyReqHandle,
       
   381 			REINTERPRET_CAST(RPacketService::TAttachMode*, dataPtr));
       
   382 		case EPacketNotifyAttachModeChange:
       
   383 			return NotifyAttachModeChange(aTsyReqHandle,
       
   384 			REINTERPRET_CAST(RPacketService::TAttachMode*, dataPtr));
       
   385 		case EPacketNotifyContextAddedCancel:
       
   386 			return NotifyContextAddedCancel(aTsyReqHandle);
       
   387 		case EPacketAttach:
       
   388 			return Attach(aTsyReqHandle);
       
   389 		case EPacketAttachCancel:
       
   390 			return AttachCancel(aTsyReqHandle);
       
   391 		case EPacketDetach:
       
   392 			return Detach(aTsyReqHandle);
       
   393 		case EPacketDetachCancel:
       
   394 			return DetachCancel(aTsyReqHandle);
       
   395 		case EPacketNotifyStatusChangeCancel:
       
   396 			return NotifyStatusChangeCancel(aTsyReqHandle);
       
   397 		case EPacketNotifyContextActivationRequestedCancel:
       
   398 			return NotifyContextActivationRequestedCancel(aTsyReqHandle);
       
   399 		case EPacketRejectActivationRequest:
       
   400 			return RejectActivationRequest(aTsyReqHandle);
       
   401 		case EPacketRejectActivationRequestCancel:
       
   402 			return RejectActivationRequestCancel(aTsyReqHandle);
       
   403 		case EPacketGetContextInfoCancel:
       
   404 			return GetContextInfoCancel(aTsyReqHandle);
       
   405 		case EPacketNotifyChangeOfNtwkRegStatusCancel:
       
   406 			return NotifyChangeOfNtwkRegStatusCancel(aTsyReqHandle);
       
   407 		case EPacketGetMSClassCancel:
       
   408 			return GetMSClassCancel(aTsyReqHandle);
       
   409 		case EPacketSetMSClassCancel:
       
   410 			return SetMSClassCancel(aTsyReqHandle);
       
   411 		case EPacketNotifyMSClassChangeCancel:
       
   412 			return NotifyMSClassChangeCancel(aTsyReqHandle);
       
   413 		case EPacketSetPrefBearer:
       
   414 			return SetPreferredBearer(aTsyReqHandle, 
       
   415 				REINTERPRET_CAST(RPacketService::TPreferredBearer*, dataPtr));
       
   416 		case EPacketGetPrefBearer:
       
   417 			return GetPreferredBearer(aTsyReqHandle,
       
   418 				REINTERPRET_CAST(RPacketService::TPreferredBearer*, dataPtr));
       
   419 		case EPacketNotifyDynamicCapsChangeCancel:
       
   420 			return NotifyDynamicCapsChangeCancel(aTsyReqHandle);
       
   421 		case EPacketSetDefaultContextParams:
       
   422 			return SetDefaultContextParams(aTsyReqHandle, aPackage.Des1n());
       
   423 		case EPacketGetDefaultContextParams:
       
   424 			return GetDefaultContextParams(aTsyReqHandle, aPackage.Des1n());
       
   425 		case EPacketGetCurrentReleaseMode:
       
   426 			return GetCurrentReleaseMode(aTsyReqHandle,
       
   427 				REINTERPRET_CAST(RPacketService::TPacketReleaseMode*, dataPtr));
       
   428 		case EPacketNotifyReleaseModeChange:
       
   429 			return NotifyReleaseModeChange(aTsyReqHandle,
       
   430 			REINTERPRET_CAST(RPacketService::TPacketReleaseMode*, dataPtr));
       
   431 		case EPacketEnumerateNifs:
       
   432 			return EnumerateNifs(aTsyReqHandle,
       
   433 				REINTERPRET_CAST(TInt*, dataPtr));
       
   434 		case EPacketEnumerateNifsCancel:
       
   435 			return EnumerateNifsCancel(aTsyReqHandle);
       
   436 		case EPacketGetNifInfo:
       
   437 			return GetNifInfo(aTsyReqHandle,
       
   438 				REINTERPRET_CAST(TInt*, dataPtr),
       
   439 				aPackage.Des2n());
       
   440 		case EPacketGetNifInfoCancel:
       
   441 			return GetNifInfoCancel(aTsyReqHandle);	
       
   442 		case EPacketEnumerateContextsInNif:
       
   443 			return EnumerateContextsInNif(aTsyReqHandle,
       
   444 				aPackage.Des2u(),
       
   445 				REINTERPRET_CAST(TInt*, dataPtr));
       
   446 		case EPacketEnumerateContextsInNifCancel:
       
   447 			return EnumerateContextsInNifCancel(aTsyReqHandle);
       
   448 		case EPacketGetContextNameInNif:
       
   449 			return GetContextNameInNif(aTsyReqHandle,
       
   450 				REINTERPRET_CAST(RPacketService::TContextNameInNif*, dataPtr),
       
   451 				aPackage.Des2u());
       
   452 		case EPacketGetContextNameInNifCancel:
       
   453 			return GetContextNameInNifCancel(aTsyReqHandle);
       
   454 		case EPacketPrepareOpenSecondary:
       
   455 			return PrepareOpenSecondary(aTsyReqHandle, aPackage.Des1u());
       
   456 		case EPacketDeactivateNIF:
       
   457 			return DeactivateNIF(aTsyReqHandle, REINTERPRET_CAST(TDesC*,dataPtr));
       
   458 		case EPacketNotifyMbmsNetworkServiceStatusChange:
       
   459 			return NotifyMbmsNetworkServiceStatusChange(aTsyReqHandle,
       
   460 			reinterpret_cast<TMbmsNetworkServiceStatus*>(dataPtr));
       
   461 		case EPacketGetMbmsNetworkServiceStatus:
       
   462 			return GetMbmsNetworkServiceStatus(aTsyReqHandle,
       
   463 			reinterpret_cast<TBool*>(dataPtr),
       
   464 			reinterpret_cast<TMbmsNetworkServiceStatus*>(dataPtr2));
       
   465 		case EPacketNotifyMbmsServiceAvailabilityChange:
       
   466 			return NotifyMbmsServiceAvailabilityChange(aTsyReqHandle);
       
   467 		case EPacketUpdateMbmsMonitorServiceList:
       
   468 			if(dataPtr2)
       
   469 				{
       
   470 				return UpdateMbmsMonitorServiceListL(aTsyReqHandle,
       
   471 				reinterpret_cast<TMbmsAction*>(dataPtr),aPackage.Des2n());	
       
   472 				}
       
   473 			else
       
   474 				{
       
   475 				return UpdateMbmsMonitorServiceListL(aTsyReqHandle,
       
   476 				reinterpret_cast<TMbmsAction*>(dataPtr));
       
   477 				}
       
   478 		case EPacketGetMbmsMonitoredServicesPhase1:
       
   479 			return GetMbmsMonitoredServicesPhase1(aTsyReqHandle, 
       
   480 			reinterpret_cast<TClientId*>(dataPtr), 
       
   481 			reinterpret_cast<TUint*>(dataPtr2));
       
   482 		case EPacketGetMbmsMonitoredServicesPhase2:
       
   483 			return GetMbmsMonitoredServicesPhase2(aTsyReqHandle, 
       
   484 			reinterpret_cast<TClientId*>(dataPtr),aPackage.Des2n());
       
   485 		case EPacketEnumerateMbmsMonitorServiceList:
       
   486 			return EnumerateMbmsMonitorServiceList(aTsyReqHandle, 
       
   487 			reinterpret_cast<TInt*>(dataPtr),
       
   488 			reinterpret_cast<TInt*>(dataPtr2));
       
   489 		case EPacketEnumerateMbmsActiveServiceList:
       
   490 			return EnumerateMbmsActiveServiceList(aTsyReqHandle, 
       
   491 			reinterpret_cast<TInt*>(dataPtr),
       
   492 			reinterpret_cast<TInt*>(dataPtr2));
       
   493 		default:
       
   494 			return KErrNotSupported;
       
   495 		}
       
   496 	}
       
   497 
       
   498 TInt CGprsDGprsTsy::CancelService(const TInt aIpc,const TTsyReqHandle aTsyReqHandle)
       
   499 /**
       
   500  * CancelService is called by the server when it is "cleaning-up" any still outstanding
       
   501  * asynchronous requests before closing a client's sub-session.
       
   502  * This will happen if a client closes its R-class handle without cancelling outstanding
       
   503  * asynchronous requests.
       
   504  */
       
   505 	{
       
   506 	LOGTEXT(_L8("CGprsDGprsTsy: - CancelService called"));
       
   507 	switch (aIpc)
       
   508 		{
       
   509 		case EPacketNotifyContextAdded:
       
   510 			return NotifyContextAddedCancel(aTsyReqHandle);
       
   511 		case EPacketAttach:
       
   512 			return AttachCancel(aTsyReqHandle);
       
   513 		case EPacketDetach:
       
   514 			return DetachCancel(aTsyReqHandle);
       
   515 		case EPacketNotifyStatusChange:
       
   516 			return NotifyStatusChangeCancel(aTsyReqHandle);
       
   517 		case EPacketNotifyContextActivationRequested:
       
   518 			return NotifyContextActivationRequestedCancel(aTsyReqHandle);
       
   519 		case EPacketRejectActivationRequest:
       
   520 			return RejectActivationRequestCancel(aTsyReqHandle);
       
   521 		case EPacketGetContextInfo:
       
   522 			return GetContextInfoCancel(aTsyReqHandle);
       
   523 		case EPacketNotifyChangeOfNtwkRegStatus:
       
   524 			return NotifyChangeOfNtwkRegStatusCancel(aTsyReqHandle);
       
   525 		case EPacketGetMSClass:
       
   526 			return GetMSClassCancel(aTsyReqHandle);
       
   527 		case EPacketSetMSClass:
       
   528 			return SetMSClassCancel(aTsyReqHandle);
       
   529 		case EPacketNotifyMSClassChange:
       
   530 			return NotifyMSClassChangeCancel(aTsyReqHandle);
       
   531 		case EPacketNotifyDynamicCapsChange:
       
   532 			return NotifyDynamicCapsChangeCancel(aTsyReqHandle);
       
   533 		case EPacketSetPrefBearer:
       
   534 			return SetPreferredBearerCancel(aTsyReqHandle);
       
   535 		case EPacketGetPrefBearer:
       
   536 			return GetPreferredBearerCancel(aTsyReqHandle);
       
   537 		case EPacketSetAttachMode:
       
   538 			return SetAttachModeCancel(aTsyReqHandle);
       
   539 		case EPacketGetAttachMode:
       
   540 			return GetAttachModeCancel(aTsyReqHandle);
       
   541 		case EPacketNotifyAttachModeChange:
       
   542 			return NotifyAttachModeChangeCancel(aTsyReqHandle);
       
   543 		case EPacketSetDefaultContextParams:
       
   544 			return SetDefaultContextParamsCancel(aTsyReqHandle);
       
   545 		case EPacketGetDefaultContextParams:
       
   546 			return GetDefaultContextParamsCancel(aTsyReqHandle);
       
   547 		case EPacketGetCurrentReleaseMode:
       
   548 			return GetCurrentReleaseModeCancel(aTsyReqHandle);
       
   549 		case EPacketNotifyReleaseModeChange:
       
   550 			return NotifyReleaseModeChangeCancel(aTsyReqHandle);
       
   551 		case EPacketEnumerateNifs:
       
   552 			return EnumerateNifsCancel(aTsyReqHandle);
       
   553 		case EPacketGetNifInfo:
       
   554 			return GetNifInfoCancel(aTsyReqHandle);
       
   555 		case EPacketEnumerateContextsInNif:
       
   556 			return EnumerateContextsInNifCancel(aTsyReqHandle);
       
   557 		case EPacketGetContextNameInNif:
       
   558 			return GetContextNameInNifCancel(aTsyReqHandle);
       
   559 		case EPacketDeactivateNIF:
       
   560 			return DeactivateNIFCancel(aTsyReqHandle);
       
   561 		case EPacketNotifyMbmsNetworkServiceStatusChange:
       
   562 			return NotifyMbmsNetworkServiceStatusChangeCancel(aTsyReqHandle);
       
   563 		case EPacketGetMbmsNetworkServiceStatus:
       
   564 			return GetMbmsNetworkServiceStatusCancel(aTsyReqHandle);
       
   565 		case EPacketNotifyMbmsServiceAvailabilityChange:
       
   566 			return NotifyMbmsServiceAvailabilityChangeCancel(aTsyReqHandle);
       
   567 		case EPacketUpdateMbmsMonitorServiceList:
       
   568 			return UpdateMbmsMonitorServiceListCancel(aTsyReqHandle);
       
   569 		case EPacketGetMbmsMonitoredServicesPhase1:
       
   570 		case EPacketGetMbmsMonitoredServicesPhase2:
       
   571 			return GetMbmsMonitoredServicesCancel(aTsyReqHandle);
       
   572 		case EPacketEnumerateMbmsMonitorServiceList:
       
   573 			return EnumerateMbmsMonitorServiceListCancel(aTsyReqHandle);
       
   574 		case EPacketEnumerateMbmsActiveServiceList:
       
   575 			return EnumerateMbmsActiveServiceListCancel(aTsyReqHandle);
       
   576 		default:
       
   577 			return KErrGeneral; 
       
   578 		} 
       
   579 	}
       
   580 
       
   581 
       
   582 /***********************************************************************************/
       
   583 //
       
   584 // The following methods are called from ExtFunc and/or CancelService.
       
   585 // Each of these will process a TSY request or cancel a TSY request
       
   586 // Here, example values are returned or checked within this dummy TSY in order to ensure
       
   587 // that the integrity of the data passed to/from client is maintained
       
   588 //
       
   589 /***********************************************************************************/
       
   590 TInt CGprsDGprsTsy::NotifyContextAdded(const TTsyReqHandle aTsyReqHandle, TDes* aContextId)
       
   591 	{
       
   592 	User::After(300000); // wait to have KRequestPending
       
   593 	if (!iNotifyContextAdded++)
       
   594 		{
       
   595 		LOGTEXT(_L8("CGprsDGprsTsy::NotifyContextAdded called"));
       
   596 		*aContextId = DPCKTTSY_CONTEXT_ID;
       
   597 		ReqCompleted(aTsyReqHandle,KErrNone);
       
   598 		}
       
   599 	iTsyAsyncReqHandle = aTsyReqHandle;
       
   600 	return KErrNone;
       
   601 	}
       
   602 
       
   603 TInt CGprsDGprsTsy::NotifyContextAddedCancel(const TTsyReqHandle aTsyReqHandle)
       
   604 	{
       
   605 	LOGTEXT(_L8("CGprsDGprsTsy::NotifyContextAddedCancel called"));
       
   606 	User::After(300000); // wait to have KRequestPending
       
   607 	if(aTsyReqHandle == iTsyAsyncReqHandle)
       
   608 		ReqCompleted(aTsyReqHandle,KErrCancel);
       
   609 	else
       
   610 		ReqCompleted(aTsyReqHandle,KErrCorrupt);
       
   611 	return KErrNone;
       
   612 	}
       
   613 
       
   614 TInt CGprsDGprsTsy::Attach(const TTsyReqHandle aTsyReqHandle)
       
   615 	{
       
   616 	LOGTEXT(_L8("CGprsDGprsTsy::Attach called"));
       
   617 	User::After(300000); // wait to have KRequestPending
       
   618 	if(!iAttach++)
       
   619 		ReqCompleted(aTsyReqHandle,KErrNone);
       
   620 	iTsyAsyncReqHandle = aTsyReqHandle;
       
   621 	return KErrNone;
       
   622 	}
       
   623 
       
   624 TInt CGprsDGprsTsy::AttachCancel(const TTsyReqHandle aTsyReqHandle)
       
   625 	{
       
   626 	LOGTEXT(_L8("CGprsDGprsTsy::AttachCancel called"));
       
   627 	User::After(300000); // wait to have KRequestPending
       
   628 	if(aTsyReqHandle == iTsyAsyncReqHandle)
       
   629 		ReqCompleted(aTsyReqHandle,KErrCancel);
       
   630 	else
       
   631 		ReqCompleted(aTsyReqHandle,KErrCorrupt);
       
   632 	return KErrNone;
       
   633 	}
       
   634 
       
   635 TInt CGprsDGprsTsy::Detach(const TTsyReqHandle aTsyReqHandle)
       
   636 	{
       
   637 	LOGTEXT(_L8("CGprsDGprsTsy::Detach called"));
       
   638 	User::After(300000); // wait to have KRequestPending
       
   639 	if(!iDetach++)
       
   640 		ReqCompleted(aTsyReqHandle,KErrNone);
       
   641 	iTsyAsyncReqHandle = aTsyReqHandle;
       
   642 	return KErrNone;
       
   643 	}
       
   644 
       
   645 TInt CGprsDGprsTsy::DetachCancel(const TTsyReqHandle aTsyReqHandle)
       
   646 	{
       
   647 	LOGTEXT(_L8("CGprsDGprsTsy:: called"));
       
   648 	User::After(300000); // wait to have KRequestPending
       
   649 	if(aTsyReqHandle == iTsyAsyncReqHandle)
       
   650 		ReqCompleted(aTsyReqHandle,KErrCancel);
       
   651 	else
       
   652 		ReqCompleted(aTsyReqHandle,KErrCorrupt);
       
   653 	return KErrNone;
       
   654 	}
       
   655 
       
   656 TInt CGprsDGprsTsy::GetStatus(const TTsyReqHandle aTsyReqHandle, RPacketService::TStatus* aGprsStatus)
       
   657 	{
       
   658 	LOGTEXT(_L8("CGprsDGprsTsy::DetachCancel called"));
       
   659 	User::After(300000); // wait to have KRequestPending
       
   660 	*aGprsStatus = DPCKTTSY_PACKET_STATUS1;
       
   661 	ReqCompleted(aTsyReqHandle,KErrNone);
       
   662 	return KErrNone;
       
   663 	}
       
   664 
       
   665 TInt CGprsDGprsTsy::NotifyStatusChange(const TTsyReqHandle aTsyReqHandle, RPacketService::TStatus* aGprsStatus)
       
   666 	{
       
   667 	User::After(300000); // wait to have KRequestPending
       
   668 	if (!iNotifyStatusChange++)
       
   669 		{
       
   670 		LOGTEXT(_L8("CGprsDGprsTsy::NotifyStatusChange called"));
       
   671 		*aGprsStatus = DPCKTTSY_PACKET_STATUS2;
       
   672 		ReqCompleted(aTsyReqHandle,KErrNone);
       
   673 		}
       
   674 	iTsyAsyncReqHandle = aTsyReqHandle;
       
   675 	return KErrNone;
       
   676 	}
       
   677 
       
   678 TInt CGprsDGprsTsy::NotifyStatusChangeCancel(const TTsyReqHandle aTsyReqHandle)
       
   679 	{
       
   680 	LOGTEXT(_L8("CGprsDGprsTsy::NotifyStatusChangeCancel called"));
       
   681 	User::After(300000); // wait to have KRequestPending
       
   682 	if(aTsyReqHandle == iTsyAsyncReqHandle)
       
   683 		ReqCompleted(aTsyReqHandle,KErrCancel);
       
   684 	else
       
   685 		ReqCompleted(aTsyReqHandle,KErrCorrupt);
       
   686 	return KErrNone;
       
   687 	}
       
   688 
       
   689 TInt CGprsDGprsTsy::NotifyContextActivationRequested(const TTsyReqHandle aTsyReqHandle, TPacketDataConfigBase* aConfig)
       
   690 	{
       
   691 	User::After(300000); // wait to have KRequestPending
       
   692 	if (!iNotifyContextActivationRequested++)
       
   693 		{
       
   694 		LOGTEXT(_L8("CGprsDGprsTsy::NotifyContextActivationRequested called"));
       
   695 		
       
   696 		if (aConfig->ExtensionId() == TPacketDataConfigBase::KConfigGPRS)
       
   697 			{
       
   698 			RPacketContext::TContextConfigGPRS* aGprsConfig = (RPacketContext::TContextConfigGPRS*) aConfig;
       
   699 			aGprsConfig->iPdpType = DPCKTTSY_PDP_TYPE1;
       
   700 			aGprsConfig->iPdpAddress = DPCKTTSY_PDP_ADDRESS1;
       
   701 			aGprsConfig->iAccessPointName = DPCKTTSY_ACCESS_POINT1;
       
   702 			aGprsConfig->iUseEdge = DPCKTTSY_EGPRS_REQUIRED;
       
   703 			aGprsConfig->iProtocolConfigOption.iAuthInfo.iUsername = DPCKTTSY_USER_NAME1;
       
   704 			aGprsConfig->iProtocolConfigOption.iAuthInfo.iPassword = DPCKTTSY_PASSWORD1;
       
   705 			aGprsConfig->iProtocolConfigOption.iAuthInfo.iProtocol = DPCKTTSY_PROTOCOL_TYPE1_0;
       
   706 			aGprsConfig->iNWIContext = DPCKTTSY_NWICONTEXT_TRUE;
       
   707 			ReqCompleted(aTsyReqHandle,KErrNone);
       
   708 			}
       
   709 		else if (aConfig->ExtensionId()==TPacketDataConfigBase::KConfigRel99Rel4)
       
   710 			{
       
   711 			RPacketContext::TContextConfigR99_R4* aR99Config = (RPacketContext::TContextConfigR99_R4*) aConfig;
       
   712 			aR99Config->iPdpType = DPCKTTSY_PDP_TYPE1;
       
   713 			aR99Config->iPdpAddress = DPCKTTSY_PDP_ADDRESS1;
       
   714 			aR99Config->iAccessPointName = DPCKTTSY_ACCESS_POINT1;
       
   715 			aR99Config->iUseEdge = DPCKTTSY_EGPRS_REQUIRED;
       
   716 			aR99Config->iProtocolConfigOption.iAuthInfo.iUsername = DPCKTTSY_USER_NAME1;
       
   717 			aR99Config->iProtocolConfigOption.iAuthInfo.iPassword = DPCKTTSY_PASSWORD1;
       
   718 			aR99Config->iProtocolConfigOption.iAuthInfo.iProtocol = DPCKTTSY_PROTOCOL_TYPE1_0;
       
   719 			aR99Config->iNWIContext = DPCKTTSY_NWICONTEXT_TRUE;
       
   720 			aR99Config->iPFI = DPCKTTSY_PFICONTEXT_SIG;
       
   721 			ReqCompleted(aTsyReqHandle,KErrNone);
       
   722 			}
       
   723 		else if (aConfig->ExtensionId()==TPacketDataConfigBase::KConfigRel5)
       
   724 			{
       
   725 			RPacketContext::TContextConfig_R5* aR5Config = (RPacketContext::TContextConfig_R5*) aConfig;
       
   726 			aR5Config->iPdpType = DPCKTTSY_PDP_TYPE1;
       
   727 			aR5Config->iPdpAddress = DPCKTTSY_PDP_ADDRESS1;
       
   728 			aR5Config->iAccessPointName = DPCKTTSY_ACCESS_POINT1;
       
   729 			aR5Config->iUseEdge = DPCKTTSY_EGPRS_REQUIRED;
       
   730 			aR5Config->iProtocolConfigOption.iAuthInfo.iUsername = DPCKTTSY_USER_NAME1;
       
   731 			aR5Config->iProtocolConfigOption.iAuthInfo.iPassword = DPCKTTSY_PASSWORD1;
       
   732 			aR5Config->iProtocolConfigOption.iAuthInfo.iProtocol = DPCKTTSY_PROTOCOL_TYPE1_0;
       
   733 			aR5Config->iNWIContext = DPCKTTSY_NWICONTEXT_TRUE;
       
   734 			aR5Config->iPFI = DPCKTTSY_PFICONTEXT_SIG;
       
   735 			aR5Config->iPdpDataCompression = DPCKTTSY_DATACOMPRESSION_EV42;
       
   736 			aR5Config->iPdpHeaderCompression = DPCKTTSY_HEADERCOMPRESSION_ERFC1144;
       
   737 			ReqCompleted(aTsyReqHandle,KErrNone);
       
   738 			}
       
   739 		else
       
   740 			ReqCompleted(aTsyReqHandle, KErrNotSupported);
       
   741 		}
       
   742 	iTsyAsyncReqHandle = aTsyReqHandle;
       
   743 	return KErrNone;
       
   744 	}
       
   745 
       
   746 TInt CGprsDGprsTsy::NotifyContextActivationRequestedCancel(const TTsyReqHandle aTsyReqHandle)
       
   747 	{
       
   748 	LOGTEXT(_L8("CGprsDGprsTsy::NotifyContextActivationRequestedCancel called"));
       
   749 	User::After(300000); // wait to have KRequestPending
       
   750 	if(aTsyReqHandle == iTsyAsyncReqHandle)
       
   751 		ReqCompleted(aTsyReqHandle,KErrCancel);
       
   752 	else
       
   753 		ReqCompleted(aTsyReqHandle,KErrCorrupt);
       
   754 	return KErrNone;
       
   755 	}
       
   756 
       
   757 TInt CGprsDGprsTsy::RejectActivationRequest(const TTsyReqHandle aTsyReqHandle)
       
   758 	{
       
   759 	LOGTEXT(_L8("CGprsDGprsTsy::RejectActivationRequest called"));
       
   760 	User::After(300000); // wait to have KRequestPending
       
   761 	if(!iRejectActivationRequest++)
       
   762 		ReqCompleted(aTsyReqHandle,KErrNone);
       
   763 	iTsyAsyncReqHandle = aTsyReqHandle;
       
   764 	return KErrNone;
       
   765 	}
       
   766 
       
   767 TInt CGprsDGprsTsy::RejectActivationRequestCancel(const TTsyReqHandle aTsyReqHandle)
       
   768 	{
       
   769 	LOGTEXT(_L8("CGprsDGprsTsy::RejectActivationRequestCancel called"));
       
   770 	User::After(300000); // wait to have KRequestPending
       
   771 	if(aTsyReqHandle == iTsyAsyncReqHandle)
       
   772 		ReqCompleted(aTsyReqHandle,KErrCancel);
       
   773 	else
       
   774 		ReqCompleted(aTsyReqHandle,KErrCorrupt);
       
   775 	return KErrNone;
       
   776 	}
       
   777 
       
   778 TInt CGprsDGprsTsy::EnumerateContexts(const TTsyReqHandle aTsyReqHandle, TInt* aCount, TInt* aMaxAllowed)
       
   779 	{
       
   780 	LOGTEXT(_L8("CGprsDGprsTsy::EnumerateContexts called"));
       
   781 	User::After(300000); // wait to have KRequestPending
       
   782 	*aCount = DPCKTTSY_NUMBER_OF_CONTEXTS;
       
   783 	*aMaxAllowed = DPCKTTSY_MAX_NUMBER_OF_CONTEXTS;
       
   784 	ReqCompleted(aTsyReqHandle,KErrNone);
       
   785 	return KErrNone;
       
   786 	}
       
   787 
       
   788 TInt CGprsDGprsTsy::GetContextInfo(const TTsyReqHandle aTsyReqHandle, TInt* aIndex,RPacketService::TContextInfo* aInfo)
       
   789 	{
       
   790 	LOGTEXT(_L8("CGprsDGprsTsy::GetContextInfo called"));
       
   791 
       
   792 	User::After(300000); // wait to have KRequestPending
       
   793 	switch (*aIndex)
       
   794 		{
       
   795 		case 0:
       
   796 			if(!iGetContextInfo++)
       
   797 				{
       
   798 				aInfo->iName=DPCKTTSY_CONTEXT_INFO_NAME0;
       
   799 				aInfo->iStatus=DPCKTTSY_CONTEXT_INFO_STATUS0;
       
   800 				ReqCompleted(aTsyReqHandle,KErrNone);
       
   801 				}
       
   802 			break;
       
   803 		case 1:
       
   804 			aInfo->iName=DPCKTTSY_CONTEXT_INFO_NAME1;
       
   805 			aInfo->iStatus=DPCKTTSY_CONTEXT_INFO_STATUS1;
       
   806 			ReqCompleted(aTsyReqHandle,KErrNone);
       
   807 			break;
       
   808 		default:
       
   809 			ReqCompleted(aTsyReqHandle,KErrCorrupt);
       
   810 			break;
       
   811 		}
       
   812 	iTsyAsyncReqHandle = aTsyReqHandle;
       
   813 	return KErrNone;
       
   814 	}
       
   815 
       
   816 TInt CGprsDGprsTsy::GetContextInfoCancel(const TTsyReqHandle aTsyReqHandle) 
       
   817 	{
       
   818 	LOGTEXT(_L8("CGprsDGprsTsy::GetContextInfoCancel called"));
       
   819 	User::After(300000); // wait to have KRequestPending
       
   820 	if(aTsyReqHandle == iTsyAsyncReqHandle)
       
   821 		ReqCompleted(aTsyReqHandle,KErrCancel);
       
   822 	else
       
   823 		ReqCompleted(aTsyReqHandle,KErrCorrupt);
       
   824 	return KErrNone;
       
   825 	}
       
   826 
       
   827 TInt CGprsDGprsTsy::GetNtwkRegStatus(const TTsyReqHandle aTsyReqHandle, RPacketService::TRegistrationStatus* aRegistrationStatus)
       
   828 	{
       
   829 	LOGTEXT(_L8("CGprsDGprsTsy::GetNtwkRegStatus called"));
       
   830 	User::After(300000); // wait to have KRequestPending
       
   831 	*aRegistrationStatus = DPCKTTSY_REGISTRATION_STATUS1;
       
   832 	ReqCompleted(aTsyReqHandle,KErrNone);
       
   833 	return KErrNone;
       
   834 	}
       
   835 
       
   836 TInt CGprsDGprsTsy::NotifyChangeOfNtwkRegStatus(const TTsyReqHandle aTsyReqHandle, RPacketService::TRegistrationStatus* aRegistrationStatus)
       
   837 	{
       
   838 	User::After(300000); // wait to have KRequestPending
       
   839 	if (!iNotifyChangeOfNtwkRegStatus++)
       
   840 		{
       
   841 		LOGTEXT(_L8("CGprsDGprsTsy::NotifyChangeOfNtwkRegStatus called"));
       
   842 		*aRegistrationStatus = DPCKTTSY_REGISTRATION_STATUS2;
       
   843 		ReqCompleted(aTsyReqHandle,KErrNone);
       
   844 		}
       
   845 	iTsyAsyncReqHandle = aTsyReqHandle;
       
   846 	return KErrNone;
       
   847 	}
       
   848 
       
   849 TInt CGprsDGprsTsy::NotifyChangeOfNtwkRegStatusCancel(const TTsyReqHandle aTsyReqHandle)
       
   850 	{
       
   851 	LOGTEXT(_L8("CGprsDGprsTsy::NotifyChangeOfNtwkRegStatusCancel called"));
       
   852 	User::After(300000); // wait to have KRequestPending
       
   853 	if(aTsyReqHandle == iTsyAsyncReqHandle)
       
   854 		ReqCompleted(aTsyReqHandle,KErrCancel);
       
   855 	else
       
   856 		ReqCompleted(aTsyReqHandle,KErrCorrupt);
       
   857 	return KErrNone;
       
   858 	}
       
   859 
       
   860 TInt CGprsDGprsTsy::GetMSClass(const TTsyReqHandle aTsyReqHandle, RPacketService::TMSClass* aCurrentClass, RPacketService::TMSClass* aMaxClass)
       
   861 	{
       
   862 	LOGTEXT(_L8("CGprsDGprsTsy:: GetMSClass called"));
       
   863 	User::After(300000); // wait to have KRequestPending
       
   864 	if(!iGetMSClass++)
       
   865 		{
       
   866 		*aCurrentClass=DPCKTTSY_CURRENT_MS_CLASS;
       
   867 		*aMaxClass=DPCKTTSY_MAX_MS_CLASS;
       
   868 		ReqCompleted(aTsyReqHandle,KErrNone);
       
   869 		}
       
   870 	iTsyAsyncReqHandle = aTsyReqHandle;
       
   871 	return KErrNone;
       
   872 	}
       
   873 
       
   874 TInt CGprsDGprsTsy::GetMSClassCancel(const TTsyReqHandle aTsyReqHandle)
       
   875 	{
       
   876 	LOGTEXT(_L8("CGprsDGprsTsy::GetMSClass called"));
       
   877 	User::After(300000); // wait to have KRequestPending
       
   878 	if(aTsyReqHandle == iTsyAsyncReqHandle)
       
   879 		ReqCompleted(aTsyReqHandle,KErrCancel);
       
   880 	else
       
   881 		ReqCompleted(aTsyReqHandle,KErrCorrupt);
       
   882 	return KErrNone;
       
   883 	}
       
   884 
       
   885 TInt CGprsDGprsTsy::SetMSClass(const TTsyReqHandle aTsyReqHandle, RPacketService::TMSClass* aClass)
       
   886 	{
       
   887 	LOGTEXT(_L8("CGprsDGprsTsy::SetMSClass called"));
       
   888 	User::After(300000); // wait to have KRequestPending
       
   889 	if (*aClass!=DPCKTTSY_SET_MS_CLASS) 
       
   890 		ReqCompleted(aTsyReqHandle,KErrCorrupt);
       
   891 	else
       
   892 		{
       
   893 		if(!iSetMSClass++)
       
   894 			ReqCompleted(aTsyReqHandle,KErrNone);
       
   895 		iTsyAsyncReqHandle = aTsyReqHandle;
       
   896 		}
       
   897 	return KErrNone;
       
   898 	}
       
   899 
       
   900 TInt CGprsDGprsTsy::SetMSClassCancel(const TTsyReqHandle aTsyReqHandle)
       
   901 	{
       
   902 	LOGTEXT(_L8("CGprsDGprsTsy::SetMSClassCancel called"));
       
   903 	User::After(300000); // wait to have KRequestPending
       
   904 	if(aTsyReqHandle == iTsyAsyncReqHandle)
       
   905 		ReqCompleted(aTsyReqHandle,KErrCancel);
       
   906 	else
       
   907 		ReqCompleted(aTsyReqHandle,KErrCorrupt);
       
   908 	return KErrNone;
       
   909 	}
       
   910 
       
   911 TInt CGprsDGprsTsy::NotifyMSClassChange(const TTsyReqHandle aTsyReqHandle, RPacketService::TMSClass* aNewClass)
       
   912 	{
       
   913 	User::After(300000); // wait to have KRequestPending
       
   914 	if (!iNotifyMSClassChange++)
       
   915 		{
       
   916 		LOGTEXT(_L8("CGprsDGprsTsy::NotifyMSClassChange called"));
       
   917 		*aNewClass = DPCKTTSY_NEW_MS_CLASS;
       
   918 		ReqCompleted(aTsyReqHandle,KErrNone);
       
   919 		}
       
   920 	iTsyAsyncReqHandle = aTsyReqHandle;
       
   921 	return KErrNone;
       
   922 	}
       
   923 
       
   924 TInt CGprsDGprsTsy::NotifyMSClassChangeCancel(const TTsyReqHandle aTsyReqHandle)
       
   925 	{
       
   926 	LOGTEXT(_L8("CGprsDGprsTsy::NotifyMSClassChangeCancel called"));
       
   927 	User::After(300000); // wait to have KRequestPending
       
   928 	if(aTsyReqHandle == iTsyAsyncReqHandle)
       
   929 		ReqCompleted(aTsyReqHandle,KErrCancel);
       
   930 	else
       
   931 		ReqCompleted(aTsyReqHandle,KErrCorrupt);
       
   932 	return KErrNone;
       
   933 	}
       
   934 
       
   935 TInt CGprsDGprsTsy::GetStaticCaps(const TTsyReqHandle aTsyReqHandle, TUint* aCaps,RPacketContext::TProtocolType* aPdpType)
       
   936 	{
       
   937 	LOGTEXT(_L8("CGprsDGprsTsy::GetStaticCaps called"));
       
   938 
       
   939 	User::After(300000); // wait to have KRequestPending
       
   940 	if (*aPdpType!=DPCKTTSY_PDP_TYPE1) 
       
   941 		{
       
   942 		ReqCompleted(aTsyReqHandle,KErrCorrupt);
       
   943 		}
       
   944 	else
       
   945 		{
       
   946 		*aCaps = DPCKTTSY_MISC_CAPS;
       
   947 		ReqCompleted(aTsyReqHandle,KErrNone);
       
   948 		}
       
   949 	return KErrNone;
       
   950 	}
       
   951 
       
   952 TInt CGprsDGprsTsy::GetDynamicCaps(const TTsyReqHandle aTsyReqHandle, RPacketService::TDynamicCapsFlags* aCaps)
       
   953 	{
       
   954 	LOGTEXT(_L8("CGprsDGprsTsy::GetDynamicCaps called"));
       
   955 	User::After(300000); // wait to have KRequestPending
       
   956 	*aCaps = DPCKTTSY_DYNAMIC_CAPS1;
       
   957 	ReqCompleted(aTsyReqHandle,KErrNone);
       
   958 	return KErrNone;
       
   959 	}
       
   960 
       
   961 TInt CGprsDGprsTsy::NotifyDynamicCapsChange(const TTsyReqHandle aTsyReqHandle, RPacketService::TDynamicCapsFlags* aCaps)
       
   962 	{
       
   963 	User::After(300000); // wait to have KRequestPending
       
   964 	if (!iNotifyDynamicCapsChange++)
       
   965 		{
       
   966 		LOGTEXT(_L8("CGprsDGprsTsy::NotifyDynamicCapsChange called"));
       
   967 		*aCaps = DPCKTTSY_DYNAMIC_CAPS2;
       
   968 		ReqCompleted(aTsyReqHandle,KErrNone);
       
   969 		}
       
   970 	iTsyAsyncReqHandle = aTsyReqHandle;
       
   971 	return KErrNone;
       
   972 	}
       
   973 
       
   974 TInt CGprsDGprsTsy::NotifyDynamicCapsChangeCancel(const TTsyReqHandle aTsyReqHandle)
       
   975 	{
       
   976 	LOGTEXT(_L8("CGprsDGprsTsy::NotifyDynamicCapsChangeCancel called"));
       
   977 	User::After(300000); // wait to have KRequestPending
       
   978 	if(aTsyReqHandle == iTsyAsyncReqHandle)
       
   979 		ReqCompleted(aTsyReqHandle,KErrCancel);
       
   980 	else
       
   981 		ReqCompleted(aTsyReqHandle,KErrCorrupt);
       
   982 	return KErrNone;
       
   983 	}
       
   984 
       
   985 TInt CGprsDGprsTsy::SetAttachMode(const TTsyReqHandle aTsyReqHandle, RPacketService::TAttachMode* aMode)
       
   986 /** 
       
   987  * SetAttachMode method - Sets the Attach mode for the context.
       
   988  * A synchronous and asynchronous variant of this method is now supported - Change 
       
   989  * Request: NDOE-58VF4Q. In the test code, the synchronous method is called first.
       
   990  * Note that the synchronous variant is deprecated.
       
   991  * In the switch statement, cases 0 and 1 implement the synchronous call, while cases 2 and 
       
   992  * 3 implement the asynchronous call.
       
   993  */
       
   994 	{
       
   995 	LOGTEXT(_L8("CGprsDGprsTsy::SetAttachMode called"));
       
   996 
       
   997 	User::After(300000); // wait to have KRequestPending
       
   998 	switch (iSetAttachMode++)
       
   999 		{
       
  1000 		case 0:
       
  1001 		case 1:
       
  1002 			if (*aMode!=DPCKTTSY_ATTACH_MODE1)
       
  1003 				ReqCompleted(aTsyReqHandle,KErrCorrupt);
       
  1004 			else
       
  1005 				ReqCompleted(aTsyReqHandle,KErrNone);
       
  1006 			break;
       
  1007 		case 2:
       
  1008 			if (*aMode!=DPCKTTSY_ATTACH_MODE2)
       
  1009 				ReqCompleted(aTsyReqHandle,KErrCorrupt);
       
  1010 			else
       
  1011 				ReqCompleted(aTsyReqHandle,KErrNone);
       
  1012 			iTsyAsyncReqHandle = aTsyReqHandle;
       
  1013 			break;
       
  1014 		case 3:
       
  1015 			if (*aMode!=DPCKTTSY_ATTACH_MODE2)
       
  1016 				ReqCompleted(aTsyReqHandle,KErrCorrupt);
       
  1017 			iTsyAsyncReqHandle = aTsyReqHandle;
       
  1018 			break;
       
  1019 		default:
       
  1020 			LOGTEXT(_L8("CGprsDGprsTsy::SetAttachMode - Error in switch statement"));
       
  1021 			break;
       
  1022 		} // switch
       
  1023 		
       
  1024 	return KErrNone;
       
  1025 	}
       
  1026 
       
  1027 TInt CGprsDGprsTsy::SetAttachModeCancel(const TTsyReqHandle aTsyReqHandle)
       
  1028 	{
       
  1029 	LOGTEXT(_L8("CGprsDGprsTsy::SetAttachModeCancel called"));
       
  1030 	User::After(300000); // wait to have KRequestPending
       
  1031 	if(aTsyReqHandle == iTsyAsyncReqHandle)
       
  1032 		ReqCompleted(aTsyReqHandle,KErrCancel);
       
  1033 	else
       
  1034 		ReqCompleted(aTsyReqHandle,KErrCorrupt);
       
  1035 	return KErrNone;
       
  1036 	}
       
  1037 
       
  1038 TInt CGprsDGprsTsy::GetAttachMode(const TTsyReqHandle aTsyReqHandle, RPacketService::TAttachMode* aMode)
       
  1039 /** 
       
  1040  * GetAttachMode method - Gets the Attach mode for the context.
       
  1041  * A synchronous and asynchronous variant of this method is now supported - Change 
       
  1042  * Request: NDOE-58VF4Q. In the test code, the synchronous method is called first.
       
  1043  * Note that the synchronous variant is deprecated.
       
  1044  * In the switch statement, cases 0 and 1 implement the synchronous call, while cases 2 and 
       
  1045  * 3 implement the asynchronous call.
       
  1046  */
       
  1047 	{
       
  1048 	LOGTEXT(_L8("CGprsDGprsTsy::GetAttachMode called"));
       
  1049 
       
  1050 	User::After(300000); // wait to have KRequestPending
       
  1051 	switch (iGetAttachMode++)
       
  1052 		{
       
  1053 		case 0:
       
  1054 		case 1:
       
  1055 			*aMode = DPCKTTSY_ATTACH_MODE2;
       
  1056 			ReqCompleted(aTsyReqHandle,KErrNone);
       
  1057 			break;
       
  1058 		case 2:
       
  1059 			*aMode = DPCKTTSY_ATTACH_MODE1;
       
  1060 			ReqCompleted(aTsyReqHandle,KErrNone);
       
  1061 		case 3:
       
  1062 			iTsyAsyncReqHandle = aTsyReqHandle;
       
  1063 			break;
       
  1064 		default:
       
  1065 			LOGTEXT(_L8("CGprsDGprsTsy::GetAttachMode - Error in switch statement"));
       
  1066 			break;
       
  1067 		} // switch
       
  1068 		
       
  1069 	return KErrNone;
       
  1070 	}
       
  1071 
       
  1072 TInt CGprsDGprsTsy::GetAttachModeCancel(const TTsyReqHandle aTsyReqHandle)
       
  1073 	{
       
  1074 	LOGTEXT(_L8("CGprsDGprsTsy::GetAttachModeCancel called"));
       
  1075 	User::After(300000); // wait to have KRequestPending
       
  1076 	if(aTsyReqHandle == iTsyAsyncReqHandle)
       
  1077 		ReqCompleted(aTsyReqHandle,KErrCancel);
       
  1078 	else
       
  1079 		ReqCompleted(aTsyReqHandle,KErrCorrupt);
       
  1080 	return KErrNone;
       
  1081 	}
       
  1082 	
       
  1083 TInt CGprsDGprsTsy::NotifyAttachModeChange(const TTsyReqHandle aTsyReqHandle, RPacketService::TAttachMode* aMode)
       
  1084 	{
       
  1085 	User::After(300000); // wait to have KRequestPending
       
  1086 	if (!iNotifyAttachModeChange++)
       
  1087 		{
       
  1088 		LOGTEXT(_L8("CGprsDGprsTsy::NotifyAttachModeChange called"));
       
  1089 		*aMode = DPCKTTSY_ATTACH_MODE2;
       
  1090 		ReqCompleted(aTsyReqHandle,KErrNone);
       
  1091 		}
       
  1092 	iTsyAsyncReqHandle = aTsyReqHandle;
       
  1093 	return KErrNone;
       
  1094 	}
       
  1095 
       
  1096 TInt CGprsDGprsTsy::NotifyAttachModeChangeCancel(const TTsyReqHandle aTsyReqHandle)
       
  1097 	{
       
  1098 	LOGTEXT(_L8("CGprsDGprsTsy::NotifyAttachModeChange called"));
       
  1099 	User::After(300000); // wait to have KRequestPending
       
  1100 	if(aTsyReqHandle == iTsyAsyncReqHandle)
       
  1101 		ReqCompleted(aTsyReqHandle,KErrCancel);
       
  1102 	else
       
  1103 		ReqCompleted(aTsyReqHandle,KErrCorrupt);
       
  1104 	return KErrNone;
       
  1105 	}
       
  1106 
       
  1107 TInt CGprsDGprsTsy::SetDefaultContextParams(const TTsyReqHandle aTsyReqHandle, const TDesC8* aPckg)
       
  1108 /** 
       
  1109  * SetDefaultContextParams method - Sets the Default context parameters.
       
  1110  * A synchronous and asynchronous variant of this method is now supported - Change 
       
  1111  * Request: NDOE-58VF4Q. In the test code, the synchronous method is called first.
       
  1112  * Note that the synchronous variant is deprecated.
       
  1113  * In the switch statement, cases 0 and 1 implement the synchronous call, while cases 2 and 
       
  1114  * 3 implement the asynchronous call.
       
  1115  */
       
  1116 	{
       
  1117 	LOGTEXT(_L8("CGprsDGprsTsy::SetDefaultContextParams called"));
       
  1118 
       
  1119 	User::After(300000); // wait to have KRequestPending
       
  1120 	TPckg<TPacketDataConfigBase>* configBase = (TPckg<TPacketDataConfigBase>*)aPckg;
       
  1121 	TPacketDataConfigBase& configBaseV1 = (*configBase)();
       
  1122 
       
  1123 	switch (iSetDefaultContextParams++)
       
  1124 		{
       
  1125 		case 0:
       
  1126 		case 1:
       
  1127 			if (configBaseV1.ExtensionId()==TPacketDataConfigBase::KConfigGPRS)
       
  1128 			{
       
  1129 			TPckg<RPacketContext::TContextConfigGPRS>* defaultContextGPRSPckg = (TPckg<RPacketContext::TContextConfigGPRS>*)aPckg;
       
  1130 			RPacketContext::TContextConfigGPRS& defaultContextV1 = (*defaultContextGPRSPckg)();
       
  1131 
       
  1132 			if ((defaultContextV1.iAccessPointName != DPCKTTSY_ACCESS_POINT1)||
       
  1133 			(defaultContextV1.iAnonymousAccessReqd != DPCKTTSY_ANONYMOUS_ACCESS1)||
       
  1134 			(defaultContextV1.iPdpAddress != DPCKTTSY_PDP_ADDRESS1)||
       
  1135 			(defaultContextV1.iPdpCompression != DPCKTTSY_COMPRESSION1)||
       
  1136 			(defaultContextV1.iPdpType != DPCKTTSY_PDP_TYPE1) ||
       
  1137 			(defaultContextV1.iUseEdge != DPCKTTSY_EGPRS_REQUIRED) ||
       
  1138 			(defaultContextV1.iProtocolConfigOption.iAuthInfo.iUsername != DPCKTTSY_USER_NAME1) ||
       
  1139 			(defaultContextV1.iProtocolConfigOption.iAuthInfo.iPassword != DPCKTTSY_PASSWORD1) ||
       
  1140 			(defaultContextV1.iProtocolConfigOption.iAuthInfo.iProtocol != DPCKTTSY_PROTOCOL_TYPE1_0) ||
       
  1141 			(defaultContextV1.iNWIContext != DPCKTTSY_NWICONTEXT_TRUE))
       
  1142 				ReqCompleted(aTsyReqHandle,KErrCorrupt);
       
  1143 			else
       
  1144 				ReqCompleted(aTsyReqHandle,KErrNone);
       
  1145 			break;
       
  1146 			}
       
  1147 		else if (configBaseV1.ExtensionId()==TPacketDataConfigBase::KConfigRel99Rel4)
       
  1148 			{
       
  1149 			TPckg<RPacketContext::TContextConfigR99_R4>* contextConfigR99Pckg = (TPckg<RPacketContext::TContextConfigR99_R4>*)aPckg;
       
  1150 			RPacketContext::TContextConfigR99_R4& defaultContextV1 = (*contextConfigR99Pckg)();
       
  1151 			
       
  1152 			if ((defaultContextV1.iAccessPointName != DPCKTTSY_ACCESS_POINT1)||
       
  1153 			(defaultContextV1.iPdpAddress != DPCKTTSY_PDP_ADDRESS1)||
       
  1154 			(defaultContextV1.iPdpType != DPCKTTSY_PDP_TYPE1) ||
       
  1155 			(defaultContextV1.iUseEdge != DPCKTTSY_EGPRS_REQUIRED) ||
       
  1156 			(defaultContextV1.iProtocolConfigOption.iAuthInfo.iUsername != DPCKTTSY_USER_NAME1) ||
       
  1157 			(defaultContextV1.iProtocolConfigOption.iAuthInfo.iPassword != DPCKTTSY_PASSWORD1) ||
       
  1158 			(defaultContextV1.iProtocolConfigOption.iAuthInfo.iProtocol != DPCKTTSY_PROTOCOL_TYPE1_0) ||
       
  1159 			(defaultContextV1.iNWIContext != DPCKTTSY_NWICONTEXT_TRUE) ||
       
  1160 			(defaultContextV1.iPFI != DPCKTTSY_PFICONTEXT_SMS))
       
  1161 				ReqCompleted(aTsyReqHandle,KErrCorrupt);
       
  1162 			else
       
  1163 				ReqCompleted(aTsyReqHandle,KErrNone);
       
  1164 			break;
       
  1165 			}
       
  1166 		else if (configBaseV1.ExtensionId()==TPacketDataConfigBase::KConfigRel5)
       
  1167 			{
       
  1168 			TPckg<RPacketContext::TContextConfig_R5>* contextConfigR5Pckg = (TPckg<RPacketContext::TContextConfig_R5>*)aPckg;
       
  1169 			RPacketContext::TContextConfig_R5& defaultContextV1 = (*contextConfigR5Pckg)();
       
  1170 			
       
  1171 			if ((defaultContextV1.iAccessPointName != DPCKTTSY_ACCESS_POINT1)||
       
  1172 			(defaultContextV1.iPdpAddress != DPCKTTSY_PDP_ADDRESS1)||
       
  1173 			(defaultContextV1.iPdpType != DPCKTTSY_PDP_TYPE1) ||
       
  1174 			(defaultContextV1.iUseEdge != DPCKTTSY_EGPRS_REQUIRED) ||
       
  1175 			(defaultContextV1.iProtocolConfigOption.iAuthInfo.iUsername != DPCKTTSY_USER_NAME1) ||
       
  1176 			(defaultContextV1.iProtocolConfigOption.iAuthInfo.iPassword != DPCKTTSY_PASSWORD1) ||
       
  1177 			(defaultContextV1.iProtocolConfigOption.iAuthInfo.iProtocol != DPCKTTSY_PROTOCOL_TYPE1_0) ||
       
  1178 			(defaultContextV1.iNWIContext != DPCKTTSY_NWICONTEXT_TRUE) ||
       
  1179 			(defaultContextV1.iPFI != DPCKTTSY_PFICONTEXT_SMS) ||
       
  1180 			(defaultContextV1.iPdpDataCompression != DPCKTTSY_DATACOMPRESSION_EV42) ||
       
  1181 			(defaultContextV1.iPdpHeaderCompression != DPCKTTSY_HEADERCOMPRESSION_ERFC1144))
       
  1182 				ReqCompleted(aTsyReqHandle,KErrCorrupt);
       
  1183 			else
       
  1184 				ReqCompleted(aTsyReqHandle,KErrNone);
       
  1185 			break;
       
  1186 			}
       
  1187 		case 2:
       
  1188 		case 4:
       
  1189 			if (configBaseV1.ExtensionId()==TPacketDataConfigBase::KConfigGPRS)
       
  1190 				{
       
  1191 				TPckg<RPacketContext::TContextConfigGPRS>* defaultContextGPRSPckg = (TPckg<RPacketContext::TContextConfigGPRS>*)aPckg;
       
  1192 				RPacketContext::TContextConfigGPRS& defaultContextV1 = (*defaultContextGPRSPckg)();
       
  1193 				
       
  1194 				if ((defaultContextV1.iAccessPointName != DPCKTTSY_ACCESS_POINT2)||
       
  1195 				(defaultContextV1.iAnonymousAccessReqd != DPCKTTSY_ANONYMOUS_ACCESS2)||
       
  1196 				(defaultContextV1.iPdpAddress != DPCKTTSY_PDP_ADDRESS2)||
       
  1197 				(defaultContextV1.iPdpCompression != DPCKTTSY_COMPRESSION2)||
       
  1198 				(defaultContextV1.iPdpType != DPCKTTSY_PDP_TYPE2) ||
       
  1199 				(defaultContextV1.iUseEdge != DPCKTTSY_EGPRS_NOTREQUIRED) ||
       
  1200 				(defaultContextV1.iProtocolConfigOption.iAuthInfo.iUsername != DPCKTTSY_USER_NAME2) ||
       
  1201 				(defaultContextV1.iProtocolConfigOption.iAuthInfo.iPassword != DPCKTTSY_PASSWORD2) ||
       
  1202 				(defaultContextV1.iProtocolConfigOption.iAuthInfo.iProtocol != DPCKTTSY_PROTOCOL_TYPE2_0) ||
       
  1203 				(defaultContextV1.iNWIContext != DPCKTTSY_NWICONTEXT_TRUE))
       
  1204 					ReqCompleted(aTsyReqHandle,KErrCorrupt);
       
  1205 				else
       
  1206 					ReqCompleted(aTsyReqHandle,KErrNone);
       
  1207 				
       
  1208 				iTsyAsyncReqHandle = aTsyReqHandle;
       
  1209 				break;
       
  1210 				}
       
  1211 			else if (configBaseV1.ExtensionId()==TPacketDataConfigBase::KConfigRel99Rel4)
       
  1212 				{
       
  1213 				TPckg<RPacketContext::TContextConfigR99_R4>* contextConfigR99Pckg = (TPckg<RPacketContext::TContextConfigR99_R4>*)aPckg;
       
  1214 				RPacketContext::TContextConfigR99_R4& defaultContextV1 = (*contextConfigR99Pckg)();
       
  1215 				
       
  1216 				if ((defaultContextV1.iAccessPointName != DPCKTTSY_ACCESS_POINT2)||
       
  1217 				(defaultContextV1.iPdpAddress != DPCKTTSY_PDP_ADDRESS2)||
       
  1218 				(defaultContextV1.iPdpType != DPCKTTSY_PDP_TYPE2) ||
       
  1219 				(defaultContextV1.iUseEdge != DPCKTTSY_EGPRS_NOTREQUIRED) ||
       
  1220 				(defaultContextV1.iProtocolConfigOption.iAuthInfo.iUsername != DPCKTTSY_USER_NAME1) ||
       
  1221 				(defaultContextV1.iProtocolConfigOption.iAuthInfo.iPassword != DPCKTTSY_PASSWORD1) ||
       
  1222 				(defaultContextV1.iProtocolConfigOption.iAuthInfo.iProtocol != DPCKTTSY_PROTOCOL_TYPE1_0) ||
       
  1223 				(defaultContextV1.iNWIContext != DPCKTTSY_NWICONTEXT_TRUE) ||
       
  1224 				(defaultContextV1.iPFI != DPCKTTSY_PFICONTEXT_SIG))
       
  1225 					ReqCompleted(aTsyReqHandle,KErrCorrupt);
       
  1226 				else
       
  1227 					ReqCompleted(aTsyReqHandle,KErrNone);
       
  1228 				
       
  1229 				iTsyAsyncReqHandle = aTsyReqHandle;
       
  1230 				break;
       
  1231 				}
       
  1232 			else if (configBaseV1.ExtensionId()==TPacketDataConfigBase::KConfigRel5)
       
  1233 				{
       
  1234 				TPckg<RPacketContext::TContextConfig_R5>* contextConfigR5Pckg = (TPckg<RPacketContext::TContextConfig_R5>*)aPckg;
       
  1235 				RPacketContext::TContextConfig_R5& defaultContextV1 = (*contextConfigR5Pckg)();
       
  1236 				
       
  1237 				if ((defaultContextV1.iAccessPointName != DPCKTTSY_ACCESS_POINT2)||
       
  1238 				(defaultContextV1.iPdpAddress != DPCKTTSY_PDP_ADDRESS2)||
       
  1239 				(defaultContextV1.iPdpType != DPCKTTSY_PDP_TYPE2) ||
       
  1240 				(defaultContextV1.iUseEdge != DPCKTTSY_EGPRS_NOTREQUIRED) ||
       
  1241 				(defaultContextV1.iProtocolConfigOption.iAuthInfo.iUsername != DPCKTTSY_USER_NAME1) ||
       
  1242 				(defaultContextV1.iProtocolConfigOption.iAuthInfo.iPassword != DPCKTTSY_PASSWORD1) ||
       
  1243 				(defaultContextV1.iProtocolConfigOption.iAuthInfo.iProtocol != DPCKTTSY_PROTOCOL_TYPE1_0) ||
       
  1244 				(defaultContextV1.iNWIContext != DPCKTTSY_NWICONTEXT_TRUE) ||
       
  1245 				(defaultContextV1.iPFI != DPCKTTSY_PFICONTEXT_SIG) ||
       
  1246 				(defaultContextV1.iPdpDataCompression != DPCKTTSY_DATACOMPRESSION_EV44) ||
       
  1247 				(defaultContextV1.iPdpHeaderCompression != DPCKTTSY_HEADERCOMPRESSION_ERFC2507))
       
  1248 					ReqCompleted(aTsyReqHandle,KErrCorrupt);
       
  1249 				else
       
  1250 					ReqCompleted(aTsyReqHandle,KErrNone);
       
  1251 				
       
  1252 				iTsyAsyncReqHandle = aTsyReqHandle;
       
  1253 				break;
       
  1254 				}	
       
  1255 		case 3:
       
  1256 			if (configBaseV1.ExtensionId()==TPacketDataConfigBase::KConfigGPRS)
       
  1257 				{
       
  1258 				TPckg<RPacketContext::TContextConfigGPRS>* defaultContextGPRSPckg = (TPckg<RPacketContext::TContextConfigGPRS>*)aPckg;
       
  1259 				RPacketContext::TContextConfigGPRS& defaultContextV1 = (*defaultContextGPRSPckg)();
       
  1260 
       
  1261 				if ((defaultContextV1.iAccessPointName != DPCKTTSY_ACCESS_POINT2)||
       
  1262 				(defaultContextV1.iAnonymousAccessReqd != DPCKTTSY_ANONYMOUS_ACCESS2)||
       
  1263 				(defaultContextV1.iPdpAddress != DPCKTTSY_PDP_ADDRESS2)||
       
  1264 				(defaultContextV1.iPdpCompression != DPCKTTSY_COMPRESSION2)||
       
  1265 				(defaultContextV1.iPdpType != DPCKTTSY_PDP_TYPE2) ||
       
  1266 				(defaultContextV1.iUseEdge != DPCKTTSY_EGPRS_NOTREQUIRED) ||
       
  1267 				(defaultContextV1.iProtocolConfigOption.iAuthInfo.iUsername != DPCKTTSY_USER_NAME2) ||
       
  1268 				(defaultContextV1.iProtocolConfigOption.iAuthInfo.iPassword != DPCKTTSY_PASSWORD2) ||
       
  1269 				(defaultContextV1.iProtocolConfigOption.iAuthInfo.iProtocol != DPCKTTSY_PROTOCOL_TYPE2_0) ||
       
  1270 				(defaultContextV1.iNWIContext != DPCKTTSY_NWICONTEXT_TRUE))
       
  1271 					ReqCompleted(aTsyReqHandle,KErrCorrupt);
       
  1272 
       
  1273 				iTsyAsyncReqHandle = aTsyReqHandle;
       
  1274 				break;
       
  1275 				}
       
  1276 			else if (configBaseV1.ExtensionId()==TPacketDataConfigBase::KConfigRel99Rel4)
       
  1277 				{
       
  1278 				TPckg<RPacketContext::TContextConfigR99_R4>* contextConfigR99Pckg = (TPckg<RPacketContext::TContextConfigR99_R4>*)aPckg;
       
  1279 				RPacketContext::TContextConfigR99_R4& defaultContextV1 = (*contextConfigR99Pckg)();
       
  1280 			
       
  1281 				if ((defaultContextV1.iAccessPointName != DPCKTTSY_ACCESS_POINT2)||
       
  1282 				(defaultContextV1.iPdpAddress != DPCKTTSY_PDP_ADDRESS2)||
       
  1283 				(defaultContextV1.iPdpType != DPCKTTSY_PDP_TYPE2) ||
       
  1284 				(defaultContextV1.iUseEdge != DPCKTTSY_EGPRS_NOTREQUIRED) ||
       
  1285 				(defaultContextV1.iProtocolConfigOption.iAuthInfo.iUsername != DPCKTTSY_USER_NAME1) ||
       
  1286 				(defaultContextV1.iProtocolConfigOption.iAuthInfo.iPassword != DPCKTTSY_PASSWORD1) ||
       
  1287 				(defaultContextV1.iProtocolConfigOption.iAuthInfo.iProtocol != DPCKTTSY_PROTOCOL_TYPE1_0) ||
       
  1288 				(defaultContextV1.iNWIContext != DPCKTTSY_NWICONTEXT_TRUE) ||
       
  1289 				(defaultContextV1.iPFI != DPCKTTSY_PFICONTEXT_SIG))
       
  1290 					ReqCompleted(aTsyReqHandle,KErrCorrupt);
       
  1291 
       
  1292 				iTsyAsyncReqHandle = aTsyReqHandle;
       
  1293 				break;
       
  1294 				}
       
  1295 			else if (configBaseV1.ExtensionId()==TPacketDataConfigBase::KConfigRel5)
       
  1296 				{
       
  1297 				TPckg<RPacketContext::TContextConfig_R5>* contextConfigR5Pckg = (TPckg<RPacketContext::TContextConfig_R5>*)aPckg;
       
  1298 				RPacketContext::TContextConfig_R5& defaultContextV1 = (*contextConfigR5Pckg)();
       
  1299 			
       
  1300 				if ((defaultContextV1.iAccessPointName != DPCKTTSY_ACCESS_POINT2)||
       
  1301 				(defaultContextV1.iPdpAddress != DPCKTTSY_PDP_ADDRESS2)||
       
  1302 				(defaultContextV1.iPdpType != DPCKTTSY_PDP_TYPE2) ||
       
  1303 				(defaultContextV1.iUseEdge != DPCKTTSY_EGPRS_NOTREQUIRED) ||
       
  1304 				(defaultContextV1.iProtocolConfigOption.iAuthInfo.iUsername != DPCKTTSY_USER_NAME1) ||
       
  1305 				(defaultContextV1.iProtocolConfigOption.iAuthInfo.iPassword != DPCKTTSY_PASSWORD1) ||
       
  1306 				(defaultContextV1.iProtocolConfigOption.iAuthInfo.iProtocol != DPCKTTSY_PROTOCOL_TYPE1_0) ||
       
  1307 				(defaultContextV1.iNWIContext != DPCKTTSY_NWICONTEXT_TRUE) ||
       
  1308 				(defaultContextV1.iPFI != DPCKTTSY_PFICONTEXT_SIG) ||
       
  1309 				(defaultContextV1.iPdpDataCompression != DPCKTTSY_DATACOMPRESSION_EV44) ||
       
  1310 				(defaultContextV1.iPdpHeaderCompression != DPCKTTSY_HEADERCOMPRESSION_ERFC2507))
       
  1311 					ReqCompleted(aTsyReqHandle,KErrCorrupt);
       
  1312 
       
  1313 				iTsyAsyncReqHandle = aTsyReqHandle;
       
  1314 				break;
       
  1315 				}
       
  1316 		default:
       
  1317 			LOGTEXT(_L8("CGprsDGprsTsy::SetDefaultContextParams - Error in switch statement"));
       
  1318 			break;
       
  1319 		} // switch
       
  1320 		
       
  1321 	return KErrNone;
       
  1322 	}
       
  1323 
       
  1324 TInt CGprsDGprsTsy::SetDefaultContextParamsCancel(const TTsyReqHandle aTsyReqHandle)
       
  1325 	{
       
  1326 	LOGTEXT(_L8("CGprsDGprsTsy::SetDefaultContextParamsCancel called"));
       
  1327 	User::After(300000); // wait to have KRequestPending
       
  1328 	if(aTsyReqHandle == iTsyAsyncReqHandle)
       
  1329 		ReqCompleted(aTsyReqHandle,KErrCancel);
       
  1330 	else
       
  1331 		ReqCompleted(aTsyReqHandle,KErrCorrupt);
       
  1332 	return KErrNone;
       
  1333 	}
       
  1334 
       
  1335 TInt CGprsDGprsTsy::GetDefaultContextParams(const TTsyReqHandle aTsyReqHandle, TDes8* aPckg)
       
  1336 /** 
       
  1337  * GetDefaultContextParams method - Gets the default context parameters.
       
  1338  * A synchronous and asynchronous variant of this method is now supported - Change 
       
  1339  * Request: NDOE-58VF4Q. In the test code, the synchronous method is called first.
       
  1340  * Note that the synchronous variant is deprecated.
       
  1341  * In the switch statement, cases 0 and 1 implement the synchronous call, while cases 2 and 
       
  1342  * 3 implement the asynchronous call.
       
  1343  */
       
  1344 	{
       
  1345 	LOGTEXT(_L8("CGprsDGprsTsy::GetDefaultContextParams called"));
       
  1346 
       
  1347 	User::After(300000); // wait to have KRequestPending
       
  1348 	TPckg<TPacketDataConfigBase>* configBase = (TPckg<TPacketDataConfigBase>*)aPckg;
       
  1349 	TPacketDataConfigBase& configBaseV1 = (*configBase)();
       
  1350 
       
  1351 	switch (iGetDefaultContextParams++)
       
  1352 		{
       
  1353 		case 0:
       
  1354 		case 1:
       
  1355 			if (configBaseV1.ExtensionId()==TPacketDataConfigBase::KConfigGPRS)
       
  1356 				{
       
  1357 				TPckg<RPacketContext::TContextConfigGPRS>* defaultContextGPRSPckg = (TPckg<RPacketContext::TContextConfigGPRS>*)aPckg;
       
  1358 				RPacketContext::TContextConfigGPRS& defaultContextV1 = (*defaultContextGPRSPckg)();
       
  1359 
       
  1360 				defaultContextV1.iAccessPointName = DPCKTTSY_ACCESS_POINT2;
       
  1361 				defaultContextV1.iAnonymousAccessReqd = DPCKTTSY_ANONYMOUS_ACCESS2;
       
  1362 				defaultContextV1.iPdpAddress = DPCKTTSY_PDP_ADDRESS2;
       
  1363 				defaultContextV1.iPdpCompression = DPCKTTSY_COMPRESSION2;
       
  1364 				defaultContextV1.iPdpType = DPCKTTSY_PDP_TYPE2;
       
  1365 				defaultContextV1.iUseEdge = DPCKTTSY_EGPRS_NOTREQUIRED;
       
  1366 				defaultContextV1.iProtocolConfigOption.iAuthInfo.iUsername = DPCKTTSY_USER_NAME1;
       
  1367 				defaultContextV1.iProtocolConfigOption.iAuthInfo.iPassword = DPCKTTSY_PASSWORD1;
       
  1368 				defaultContextV1.iProtocolConfigOption.iAuthInfo.iProtocol = DPCKTTSY_PROTOCOL_TYPE1_0;				
       
  1369 				ReqCompleted(aTsyReqHandle,KErrNone);
       
  1370 				break;
       
  1371 				}
       
  1372 			else if (configBaseV1.ExtensionId()==TPacketDataConfigBase::KConfigRel99Rel4)
       
  1373 				{
       
  1374 				TPckg<RPacketContext::TContextConfigR99_R4>* contextConfigR99Pckg = (TPckg<RPacketContext::TContextConfigR99_R4>*)aPckg;
       
  1375 				RPacketContext::TContextConfigR99_R4& defaultContextV1 = (*contextConfigR99Pckg)();
       
  1376 		
       
  1377 				defaultContextV1.iAccessPointName = DPCKTTSY_ACCESS_POINT2;
       
  1378 				defaultContextV1.iPdpAddress = DPCKTTSY_PDP_ADDRESS2;
       
  1379 				defaultContextV1.iPdpType = DPCKTTSY_PDP_TYPE2;
       
  1380 				defaultContextV1.iUseEdge = DPCKTTSY_EGPRS_NOTREQUIRED;
       
  1381 				defaultContextV1.iProtocolConfigOption.iAuthInfo.iUsername = DPCKTTSY_USER_NAME1;
       
  1382 				defaultContextV1.iProtocolConfigOption.iAuthInfo.iPassword = DPCKTTSY_PASSWORD1;
       
  1383 				defaultContextV1.iProtocolConfigOption.iAuthInfo.iProtocol = DPCKTTSY_PROTOCOL_TYPE1_0;
       
  1384 				defaultContextV1.iNWIContext = DPCKTTSY_NWICONTEXT_TRUE;
       
  1385 				defaultContextV1.iPFI = DPCKTTSY_PFICONTEXT_SMS;
       
  1386 				ReqCompleted(aTsyReqHandle,KErrNone);
       
  1387 				break;
       
  1388 				}
       
  1389 			else if (configBaseV1.ExtensionId()==TPacketDataConfigBase::KConfigRel5)
       
  1390 				{
       
  1391 				TPckg<RPacketContext::TContextConfig_R5>* contextConfigR5Pckg = (TPckg<RPacketContext::TContextConfig_R5>*)aPckg;
       
  1392 				RPacketContext::TContextConfig_R5& defaultContextV1 = (*contextConfigR5Pckg)();
       
  1393 		
       
  1394 				defaultContextV1.iAccessPointName = DPCKTTSY_ACCESS_POINT2;
       
  1395 				defaultContextV1.iPdpAddress = DPCKTTSY_PDP_ADDRESS2;
       
  1396 				defaultContextV1.iPdpType = DPCKTTSY_PDP_TYPE2;
       
  1397 				defaultContextV1.iUseEdge = DPCKTTSY_EGPRS_NOTREQUIRED;
       
  1398 				defaultContextV1.iProtocolConfigOption.iAuthInfo.iUsername = DPCKTTSY_USER_NAME1;
       
  1399 				defaultContextV1.iProtocolConfigOption.iAuthInfo.iPassword = DPCKTTSY_PASSWORD1;
       
  1400 				defaultContextV1.iProtocolConfigOption.iAuthInfo.iProtocol = DPCKTTSY_PROTOCOL_TYPE1_0;
       
  1401 				defaultContextV1.iNWIContext = DPCKTTSY_NWICONTEXT_TRUE;
       
  1402 				defaultContextV1.iPFI = DPCKTTSY_PFICONTEXT_SMS;
       
  1403 				defaultContextV1.iPdpDataCompression = DPCKTTSY_DATACOMPRESSION_EV44;
       
  1404 				defaultContextV1.iPdpHeaderCompression = DPCKTTSY_HEADERCOMPRESSION_ERFC2507;
       
  1405 				ReqCompleted(aTsyReqHandle,KErrNone);
       
  1406 				break;
       
  1407 				}
       
  1408 		case 2:
       
  1409 		case 4:
       
  1410 			if (configBaseV1.ExtensionId()==TPacketDataConfigBase::KConfigGPRS)
       
  1411 				{
       
  1412 				TPckg<RPacketContext::TContextConfigGPRS>* defaultContextGPRSPckg = (TPckg<RPacketContext::TContextConfigGPRS>*)aPckg;
       
  1413 				RPacketContext::TContextConfigGPRS& defaultContextV1 = (*defaultContextGPRSPckg)();
       
  1414 
       
  1415 				defaultContextV1.iAccessPointName = DPCKTTSY_ACCESS_POINT1;
       
  1416 				defaultContextV1.iAnonymousAccessReqd = DPCKTTSY_ANONYMOUS_ACCESS1;
       
  1417 				defaultContextV1.iPdpAddress = DPCKTTSY_PDP_ADDRESS1;
       
  1418 				defaultContextV1.iPdpCompression = DPCKTTSY_COMPRESSION1;
       
  1419 				defaultContextV1.iPdpType = DPCKTTSY_PDP_TYPE1;
       
  1420 				defaultContextV1.iUseEdge = DPCKTTSY_EGPRS_REQUIRED;
       
  1421 				defaultContextV1.iProtocolConfigOption.iAuthInfo.iUsername = DPCKTTSY_USER_NAME1;
       
  1422 				defaultContextV1.iProtocolConfigOption.iAuthInfo.iPassword = DPCKTTSY_PASSWORD1;
       
  1423 				defaultContextV1.iProtocolConfigOption.iAuthInfo.iProtocol = DPCKTTSY_PROTOCOL_TYPE1_0;
       
  1424 				defaultContextV1.iNWIContext = DPCKTTSY_NWICONTEXT_TRUE;
       
  1425 				ReqCompleted(aTsyReqHandle,KErrNone);
       
  1426 				}
       
  1427 			else if (configBaseV1.ExtensionId()==TPacketDataConfigBase::KConfigRel99Rel4)
       
  1428 				{
       
  1429 				TPckg<RPacketContext::TContextConfigR99_R4>* contextConfigR99Pckg = (TPckg<RPacketContext::TContextConfigR99_R4>*)aPckg;
       
  1430 				RPacketContext::TContextConfigR99_R4& defaultContextV1 = (*contextConfigR99Pckg)();
       
  1431 				
       
  1432 				defaultContextV1.iAccessPointName = DPCKTTSY_ACCESS_POINT1;
       
  1433 				defaultContextV1.iPdpAddress = DPCKTTSY_PDP_ADDRESS1;
       
  1434 				defaultContextV1.iPdpType = DPCKTTSY_PDP_TYPE1;
       
  1435 				defaultContextV1.iUseEdge = DPCKTTSY_EGPRS_REQUIRED;
       
  1436 				defaultContextV1.iProtocolConfigOption.iAuthInfo.iUsername = DPCKTTSY_USER_NAME1;
       
  1437 				defaultContextV1.iProtocolConfigOption.iAuthInfo.iPassword = DPCKTTSY_PASSWORD1;
       
  1438 				defaultContextV1.iProtocolConfigOption.iAuthInfo.iProtocol = DPCKTTSY_PROTOCOL_TYPE1_0;
       
  1439 				ReqCompleted(aTsyReqHandle,KErrNone);
       
  1440 				}
       
  1441 			else if (configBaseV1.ExtensionId()==TPacketDataConfigBase::KConfigRel5)
       
  1442 				{
       
  1443 				TPckg<RPacketContext::TContextConfig_R5>* contextConfigR5Pckg = (TPckg<RPacketContext::TContextConfig_R5>*)aPckg;
       
  1444 				RPacketContext::TContextConfig_R5& defaultContextV1 = (*contextConfigR5Pckg)();
       
  1445 				
       
  1446 				defaultContextV1.iAccessPointName = DPCKTTSY_ACCESS_POINT1;
       
  1447 				defaultContextV1.iPdpAddress = DPCKTTSY_PDP_ADDRESS1;
       
  1448 				defaultContextV1.iPdpType = DPCKTTSY_PDP_TYPE1;
       
  1449 				defaultContextV1.iUseEdge = DPCKTTSY_EGPRS_REQUIRED;
       
  1450 				defaultContextV1.iProtocolConfigOption.iAuthInfo.iUsername = DPCKTTSY_USER_NAME1;
       
  1451 				defaultContextV1.iProtocolConfigOption.iAuthInfo.iPassword = DPCKTTSY_PASSWORD1;
       
  1452 				defaultContextV1.iProtocolConfigOption.iAuthInfo.iProtocol = DPCKTTSY_PROTOCOL_TYPE1_0;
       
  1453 				defaultContextV1.iPdpDataCompression = DPCKTTSY_DATACOMPRESSION_EV42;
       
  1454 				defaultContextV1.iPdpHeaderCompression = DPCKTTSY_HEADERCOMPRESSION_ERFC1144;
       
  1455 				ReqCompleted(aTsyReqHandle,KErrNone);
       
  1456 				}
       
  1457 		case 3:
       
  1458 			iTsyAsyncReqHandle = aTsyReqHandle;
       
  1459 			break;
       
  1460 		default:
       
  1461 			LOGTEXT(_L8("CGprsDGprsTsy::GetDefaultContextParams - Error in switch statement"));
       
  1462 			break;
       
  1463 		} // switch
       
  1464 		
       
  1465 	return KErrNone;
       
  1466 	}
       
  1467 
       
  1468 TInt CGprsDGprsTsy::GetDefaultContextParamsCancel(const TTsyReqHandle aTsyReqHandle)
       
  1469 	{
       
  1470 	LOGTEXT(_L8("CGprsDGprsTsy::GetDefaultContextParamsCancel called"));
       
  1471 	User::After(300000); // wait to have KRequestPending
       
  1472 	if(aTsyReqHandle == iTsyAsyncReqHandle)
       
  1473 		ReqCompleted(aTsyReqHandle,KErrCancel);
       
  1474 	else
       
  1475 		ReqCompleted(aTsyReqHandle,KErrCorrupt);
       
  1476 	return KErrNone;
       
  1477 	}
       
  1478 
       
  1479 TInt CGprsDGprsTsy::GetPreferredBearer(const TTsyReqHandle aTsyReqHandle, RPacketService::TPreferredBearer* aBearer)
       
  1480 	{
       
  1481 	LOGTEXT(_L8("CGprsDGprsTsy::GetPreferredBearer called"));
       
  1482 	User::After(300000); // wait to have KRequestPending
       
  1483 	switch(iGetPrefBearer++)
       
  1484 		{
       
  1485 		case 0:
       
  1486 			*aBearer = RPacketService::EBearerPacketSwitched;
       
  1487 			ReqCompleted(aTsyReqHandle, KErrNone);
       
  1488 			break;
       
  1489 		case 1:
       
  1490 			*aBearer = RPacketService::EBearerCircuitSwitched;
       
  1491 			ReqCompleted(aTsyReqHandle, KErrNone);
       
  1492 			break;
       
  1493 		default:
       
  1494 			break;
       
  1495 		}
       
  1496 	iTsyAsyncReqHandle=aTsyReqHandle;
       
  1497 	return KErrNone;
       
  1498 	}
       
  1499 	
       
  1500 TInt CGprsDGprsTsy::GetPreferredBearerCancel(const TTsyReqHandle aTsyReqHandle)
       
  1501 	{
       
  1502 	LOGTEXT(_L8("CGprsDGprsTsy::GetPreferredBearerCancel called"));
       
  1503 	User::After(300000); // wait to have KRequestPending
       
  1504 	if(aTsyReqHandle == iTsyAsyncReqHandle)
       
  1505 		ReqCompleted(aTsyReqHandle,KErrCancel);
       
  1506 	else
       
  1507 		ReqCompleted(aTsyReqHandle,KErrCorrupt);
       
  1508 	return KErrNone;
       
  1509 	}
       
  1510 
       
  1511 TInt CGprsDGprsTsy::SetPreferredBearer(const TTsyReqHandle aTsyReqHandle, RPacketService::TPreferredBearer* aBearer)
       
  1512 	{
       
  1513 	LOGTEXT(_L8("CGprsDGprsTsy::SetPreferredBearer called"));
       
  1514 	User::After(300000); // wait to have KRequestPending
       
  1515 	if(!iSetPrefBearer++)
       
  1516 		{
       
  1517 		if (*aBearer == RPacketService::EBearerPacketSwitched)
       
  1518 			ReqCompleted(aTsyReqHandle, KErrNone);
       
  1519 		else
       
  1520 			ReqCompleted(aTsyReqHandle, KErrCorrupt);
       
  1521 		}
       
  1522 	iTsyAsyncReqHandle=aTsyReqHandle;
       
  1523 	return KErrNone;
       
  1524 	}
       
  1525 
       
  1526 TInt CGprsDGprsTsy::SetPreferredBearerCancel(const TTsyReqHandle aTsyReqHandle)
       
  1527 	{
       
  1528 	LOGTEXT(_L8("CGprsDGprsTsy::SetPreferredBearerCancel called"));
       
  1529 	User::After(300000); // wait to have KRequestPending
       
  1530 	if(aTsyReqHandle == iTsyAsyncReqHandle)
       
  1531 		ReqCompleted(aTsyReqHandle,KErrCancel);
       
  1532 	else
       
  1533 		ReqCompleted(aTsyReqHandle,KErrCorrupt);
       
  1534 	return KErrNone;
       
  1535 	}
       
  1536 
       
  1537 TInt CGprsDGprsTsy::GetCurrentReleaseMode(const TTsyReqHandle aTsyReqHandle, RPacketService::TPacketReleaseMode* aMode)
       
  1538 	{
       
  1539 	LOGTEXT(_L8("CGprsDGprsTsy::GetCurrentReleaseMode called"));
       
  1540 	User::After(300000); // wait to have KRequestPending
       
  1541 	if(!iGetCurrentReleaseMode++)
       
  1542 		{
       
  1543 		*aMode = DPCKTTSY_NETWORK_MODE1;
       
  1544 		ReqCompleted(aTsyReqHandle,KErrNone);
       
  1545 		}
       
  1546 	iTsyAsyncReqHandle = aTsyReqHandle;
       
  1547 	return KErrNone;
       
  1548 	}
       
  1549 
       
  1550 TInt CGprsDGprsTsy::GetCurrentReleaseModeCancel(const TTsyReqHandle aTsyReqHandle)
       
  1551 	{
       
  1552 	LOGTEXT(_L8("CGprsDGprsTsy::GetCurrentReleaseModeCancel called"));
       
  1553 	User::After(300000); // wait to have KRequestPending
       
  1554 	if(aTsyReqHandle == iTsyAsyncReqHandle)
       
  1555 		ReqCompleted(aTsyReqHandle,KErrCancel);
       
  1556 	else
       
  1557 		ReqCompleted(aTsyReqHandle,KErrCorrupt);
       
  1558 	return KErrNone;
       
  1559 	}
       
  1560 
       
  1561 TInt CGprsDGprsTsy::NotifyReleaseModeChange(const TTsyReqHandle aTsyReqHandle, RPacketService::TPacketReleaseMode* aMode)
       
  1562 	{
       
  1563 	User::After(300000); // wait to have KRequestPending
       
  1564 	if (!iNotifyReleaseModeChange++)
       
  1565 		{
       
  1566 		LOGTEXT(_L8("CGprsDGprsTsy::NotifyReleaseModeChange called"));
       
  1567 		*aMode = DPCKTTSY_NETWORK_MODE2;
       
  1568 		ReqCompleted(aTsyReqHandle,KErrNone);
       
  1569 		}
       
  1570 	iTsyAsyncReqHandle = aTsyReqHandle;
       
  1571 	return KErrNone;
       
  1572 	}
       
  1573 
       
  1574 TInt CGprsDGprsTsy::NotifyReleaseModeChangeCancel(const TTsyReqHandle aTsyReqHandle)
       
  1575 	{
       
  1576 	LOGTEXT(_L8("CGprsDGprsTsy::NotifyReleaseModeChangeCancel called"));
       
  1577 	User::After(300000); // wait to have KRequestPending
       
  1578 	if(aTsyReqHandle == iTsyAsyncReqHandle)
       
  1579 		ReqCompleted(aTsyReqHandle,KErrCancel);
       
  1580 	else
       
  1581 		ReqCompleted(aTsyReqHandle,KErrCorrupt);
       
  1582 	return KErrNone;
       
  1583 	}
       
  1584 
       
  1585 TInt CGprsDGprsTsy::EnumerateNifs(const TTsyReqHandle aTsyReqHandle, TInt* aCount)
       
  1586 /**
       
  1587  * EnumerateNifs method - Set the number of NIFs.
       
  1588  */
       
  1589 	{
       
  1590 	LOGTEXT(_L8("CGprsDGprsTsy::EnumerateNifs called"));
       
  1591 
       
  1592 	User::After(300000); // wait to have KRequestPending
       
  1593 	if (!iEnumerateNifs++)
       
  1594 		{
       
  1595 		*aCount = DPCKTTSY_NUMBER_OF_NIFS;
       
  1596 		ReqCompleted(aTsyReqHandle,KErrNone);
       
  1597 		}
       
  1598 	
       
  1599 	iTsyAsyncReqHandle = aTsyReqHandle;
       
  1600 
       
  1601 	return KErrNone;
       
  1602 	}
       
  1603 
       
  1604 TInt CGprsDGprsTsy::EnumerateNifsCancel(const TTsyReqHandle aTsyReqHandle)
       
  1605 /**
       
  1606  * EnumerateNifsCancel - Cancels an asynchronous EnumerateNifs request
       
  1607  */
       
  1608 	{
       
  1609 	LOGTEXT(_L8("CGprsDGprsTsy::EnumerateNifsCancel called"));
       
  1610 
       
  1611 	User::After(300000); // wait to have KRequestPending
       
  1612 	if(aTsyReqHandle == iTsyAsyncReqHandle)
       
  1613 		ReqCompleted(aTsyReqHandle,KErrCancel);
       
  1614 	else
       
  1615 		ReqCompleted(aTsyReqHandle,KErrCorrupt);
       
  1616 	return KErrNone;
       
  1617 	}
       
  1618 
       
  1619 
       
  1620 TInt CGprsDGprsTsy::GetNifInfo(const TTsyReqHandle aTsyReqHandle,TInt* aIndex, TDes8* aNifInfoV2)
       
  1621 /**
       
  1622  * GetNifInfo method - sets Nif information depending on the index argument passed in.
       
  1623  */
       
  1624 	{
       
  1625 	LOGTEXT(_L8("CGprsDGprsTsy::GetNifInfo called"));
       
  1626 
       
  1627 	User::After(300000); // wait to have KRequestPending
       
  1628 	RPacketService::TNifInfoV2Pckg* nifInfoV2Pckg = (RPacketService::TNifInfoV2Pckg*)aNifInfoV2;
       
  1629 	RPacketService::TNifInfoV2& nifInfoV2 = (*nifInfoV2Pckg)();
       
  1630 
       
  1631 	if(!iGetNifInfo++)
       
  1632 		{
       
  1633 		switch (*aIndex)
       
  1634 			{
       
  1635 			case 1:
       
  1636 				nifInfoV2.iContextName=DPCKTTSY_NIF_CONTEXT1;
       
  1637 				nifInfoV2.iNumberOfContexts=DPCKTTSY_NUMBER_OF_CONTEXTS_IN_NIF1;
       
  1638 				nifInfoV2.iNifStatus=DPCKTTSY_CONTEXT_INFO_STATUS0;
       
  1639 				nifInfoV2.iPdpAddress=DPCKTTSY_PDP_ADDRESS1;
       
  1640 				nifInfoV2.iContextType=DPCKTTSY_INTERNAL_CONTEXT;
       
  1641 				ReqCompleted(aTsyReqHandle,KErrNone);
       
  1642 				break;
       
  1643 			case 2:
       
  1644 				nifInfoV2.iContextName=DPCKTTSY_NIF_CONTEXT2;
       
  1645 				nifInfoV2.iNumberOfContexts=DPCKTTSY_NUMBER_OF_CONTEXTS_IN_NIF2;
       
  1646 				nifInfoV2.iNifStatus=DPCKTTSY_CONTEXT_INFO_STATUS1;
       
  1647 				nifInfoV2.iPdpAddress=DPCKTTSY_PDP_ADDRESS2;
       
  1648 				nifInfoV2.iContextType=DPCKTTSY_EXTERNAL_CONTEXT;
       
  1649 				ReqCompleted(aTsyReqHandle,KErrNone);
       
  1650 				break;
       
  1651 			default:
       
  1652 				ReqCompleted(aTsyReqHandle,KErrArgument);
       
  1653 				break;
       
  1654 			} // switch
       
  1655 		} // if
       
  1656 
       
  1657 	iTsyAsyncReqHandle = aTsyReqHandle;
       
  1658 
       
  1659 	return KErrNone;
       
  1660 	}
       
  1661 
       
  1662 TInt CGprsDGprsTsy::GetNifInfoCancel(const TTsyReqHandle aTsyReqHandle) 
       
  1663 /** 
       
  1664  * GetNifInfoCancel - Cancels an asynchronous GetNifInfo request
       
  1665  */
       
  1666 	{
       
  1667 	LOGTEXT(_L8("CGprsDGprsTsy::GetNifInfoCancel called"));
       
  1668 
       
  1669 	User::After(300000); // wait to have KRequestPending
       
  1670 	if(aTsyReqHandle == iTsyAsyncReqHandle)
       
  1671 		ReqCompleted(aTsyReqHandle,KErrCancel);
       
  1672 	else
       
  1673 		ReqCompleted(aTsyReqHandle,KErrCorrupt);
       
  1674 	return KErrNone;
       
  1675 	}
       
  1676 
       
  1677 TInt CGprsDGprsTsy::EnumerateContextsInNif(const TTsyReqHandle aTsyReqHandle, const TDesC* aExistingContextName, TInt* aCount)
       
  1678 /**
       
  1679  * EnumerateContextsInNif - sets the number of NIFs in a context.
       
  1680  */
       
  1681 	{
       
  1682 	LOGTEXT(_L8("CGprsDGprsTsy::EnumerateContextsInNif called"));
       
  1683 
       
  1684 	User::After(300000); // wait to have KRequestPending
       
  1685 	if (!iEnumerateContextsInNif++)
       
  1686 		{
       
  1687 		TInt ret = (*aExistingContextName).Compare(DPCKTTSY_NIF_CONTEXT2);
       
  1688 		if (ret == KErrNone)
       
  1689 			{
       
  1690 			*aCount = DPCKTTSY_NUMBER_OF_CONTEXTS_IN_NIF2;
       
  1691 			ReqCompleted(aTsyReqHandle,KErrNone);
       
  1692 			}
       
  1693 		else
       
  1694 			ReqCompleted(aTsyReqHandle,KErrCorrupt);
       
  1695 		}
       
  1696 
       
  1697 	iTsyAsyncReqHandle = aTsyReqHandle;
       
  1698 
       
  1699 	return KErrNone;
       
  1700 	}
       
  1701 
       
  1702 TInt CGprsDGprsTsy::EnumerateContextsInNifCancel(const TTsyReqHandle aTsyReqHandle) 
       
  1703 /**
       
  1704  * EnumerateContextsInNifCancel - Cancels an asynchronous EnumerateContextsInNif request.
       
  1705  */
       
  1706 	{
       
  1707 	LOGTEXT(_L8("CGprsDGprsTsy::EnumerateContextsInNifCancel called"));
       
  1708 
       
  1709 	User::After(300000); // wait to have KRequestPending
       
  1710 	if(aTsyReqHandle == iTsyAsyncReqHandle)
       
  1711 		ReqCompleted(aTsyReqHandle,KErrCancel);
       
  1712 	else
       
  1713 		ReqCompleted(aTsyReqHandle,KErrCorrupt);
       
  1714 	return KErrNone;
       
  1715 	}
       
  1716 
       
  1717 TInt CGprsDGprsTsy::GetContextNameInNif(const TTsyReqHandle aTsyReqHandle, RPacketService::TContextNameInNif* aContextNameInNif, TDes* aContextName)
       
  1718 /**
       
  1719  * GetContextNameInNif - gets a context name within a Nif.
       
  1720  */
       
  1721 	{
       
  1722 	LOGTEXT(_L8("CGprsDGprsTsy::GetContextNameInNif called"));
       
  1723 
       
  1724 	User::After(300000); // wait to have KRequestPending
       
  1725 	if (!iGetContextNameInNif++)
       
  1726 		{
       
  1727 		if (!(aContextNameInNif->iExistingContextName).Compare(DPCKTTSY_NIF_CONTEXT1))
       
  1728 			{
       
  1729 			switch (aContextNameInNif->iIndex)
       
  1730 				{
       
  1731 				case 0:
       
  1732 					{
       
  1733 					*aContextName=DPCKTTSY_CONTEXT1_IN_NIF1;
       
  1734 					ReqCompleted(aTsyReqHandle,KErrNone);
       
  1735 					}
       
  1736 					break;
       
  1737 				default:
       
  1738 					ReqCompleted(aTsyReqHandle,KErrArgument);
       
  1739 					break;
       
  1740 				} // switch
       
  1741 			} // if, 'inner block'
       
  1742 		else if (!(aContextNameInNif->iExistingContextName).Compare(DPCKTTSY_NIF_CONTEXT2))
       
  1743 			{
       
  1744 			switch (aContextNameInNif->iIndex)
       
  1745 				{
       
  1746 				case 0:
       
  1747 					{
       
  1748 					*aContextName=DPCKTTSY_CONTEXT1_IN_NIF2;
       
  1749 					ReqCompleted(aTsyReqHandle,KErrNone);
       
  1750 					}
       
  1751 					break;
       
  1752 				case 1:
       
  1753 					{
       
  1754 					*aContextName=DPCKTTSY_CONTEXT2_IN_NIF2;
       
  1755 					ReqCompleted(aTsyReqHandle,KErrNone);
       
  1756 					}
       
  1757 					break;
       
  1758 				default:
       
  1759 					ReqCompleted(aTsyReqHandle,KErrArgument);
       
  1760 					break;
       
  1761 				} // switch
       
  1762 			} // else if
       
  1763 		else
       
  1764 			ReqCompleted(aTsyReqHandle, KErrCorrupt);
       
  1765 		} // if, 'outer block'
       
  1766 
       
  1767 	iTsyAsyncReqHandle = aTsyReqHandle;
       
  1768 	return KErrNone;
       
  1769 	}
       
  1770 
       
  1771 TInt CGprsDGprsTsy::GetContextNameInNifCancel(const TTsyReqHandle aTsyReqHandle) 
       
  1772 /**
       
  1773  * GetContextNameInNifCancel - Cancels an asynchronous GetContextNameInNif request
       
  1774  */
       
  1775 	{
       
  1776 	LOGTEXT(_L8("CGprsDGprsTsy::GetContextNameInNifCancel called"));
       
  1777 	User::After(300000); // wait to have KRequestPending
       
  1778 	if(aTsyReqHandle == iTsyAsyncReqHandle)
       
  1779 		ReqCompleted(aTsyReqHandle,KErrCancel);
       
  1780 	else
       
  1781 		ReqCompleted(aTsyReqHandle,KErrCorrupt);
       
  1782 	return KErrNone;
       
  1783 	}
       
  1784 
       
  1785 TInt CGprsDGprsTsy::PrepareOpenSecondary(const TTsyReqHandle aTsyReqHandle, const TDesC* /*aOriginalContextName*/)
       
  1786 	{
       
  1787 	LOGTEXT(_L8("CGprsDGprsTsy::PrepareOpenSecondary called"));
       
  1788 
       
  1789 	User::After(300000); // wait to have KRequestPending
       
  1790 	ReqCompleted(aTsyReqHandle,KErrNone);
       
  1791 	return KErrNone;
       
  1792 	}
       
  1793 	
       
  1794 TInt CGprsDGprsTsy::DeactivateNIF(const TTsyReqHandle aTsyReqHandle, const TDesC* dataPtr)
       
  1795 /**
       
  1796  * DeactivateNIF - deactivates a NIF
       
  1797  */	
       
  1798 	{
       
  1799 	LOGTEXT(_L8("CGprsDGprsTsy::DeactivateNIF called"));
       
  1800 	User::After(300000); // wait to have KRequestPending
       
  1801 	if (!iDeactivateNIF++)
       
  1802 		{
       
  1803 		if(!dataPtr->Compare(DPCKTTSY_NIF_CONTEXT1))
       
  1804 			ReqCompleted(aTsyReqHandle,KErrCorrupt);
       
  1805 		else
       
  1806 			ReqCompleted(aTsyReqHandle,KErrNone);
       
  1807 		}	
       
  1808 	iTsyAsyncReqHandle = aTsyReqHandle;
       
  1809 	return KErrNone;
       
  1810 	}
       
  1811 	
       
  1812 TInt CGprsDGprsTsy::DeactivateNIFCancel(const TTsyReqHandle aTsyReqHandle)
       
  1813 /**
       
  1814  * DeactivateNIFCancel - cancels an asynchronous DeactivateNIF request
       
  1815  */	
       
  1816 	{
       
  1817 	LOGTEXT(_L8("CGprsDGprsTsy::DeactivateNIFCancel called"));
       
  1818 	User::After(300000); // wait to have KRequestPending
       
  1819 	if(aTsyReqHandle == iTsyAsyncReqHandle)
       
  1820 		ReqCompleted(aTsyReqHandle,KErrCancel);
       
  1821 	else
       
  1822 		ReqCompleted(aTsyReqHandle,KErrCorrupt);
       
  1823 	return KErrNone;
       
  1824 	}
       
  1825 	
       
  1826 RHandleBase* CGprsDGprsTsy::GlobalKernelObjectHandle()
       
  1827 /**
       
  1828 * Implements CSubSessionExtBase virtual method, which provides
       
  1829 * handle of the mutex object to etel server that passes it up to clients.
       
  1830 * @return pointer to synchronisation mutex object
       
  1831 */
       
  1832 	{
       
  1833 		return &iMutex;
       
  1834 	}
       
  1835 //
       
  1836 //	Multimedia Broadcast Multicast Service (MBMS)
       
  1837 //
       
  1838 TInt CGprsDGprsTsy::NotifyMbmsNetworkServiceStatusChange(const TTsyReqHandle aTsyReqHandle, TMbmsNetworkServiceStatus* aStatus)
       
  1839 	{
       
  1840 	LOGTEXT(_L8("CGprsDGprsTsy::NotifyMbmsNetworkServiceStatusChange called"));
       
  1841 	iTsyAsyncReqHandle = aTsyReqHandle;
       
  1842 	if (!iNotifyMbmsNetworkServiceStatusChange++)
       
  1843 		{
       
  1844 		*aStatus = DPCKTTSY_MBMS_NETWORKSERVICE_SUPPORTED;
       
  1845 		AddDelayedReq(aTsyReqHandle,this);
       
  1846 		}
       
  1847 	return KErrNone;
       
  1848 	}
       
  1849 
       
  1850 TInt CGprsDGprsTsy::NotifyMbmsNetworkServiceStatusChangeCancel(const TTsyReqHandle aTsyReqHandle)
       
  1851 	{
       
  1852 	LOGTEXT(_L8("CGprsDGprsTsy::NotifyMbmsNetworkServiceStatusChangeCancel called"));
       
  1853 	RemoveDelayedReq(aTsyReqHandle);
       
  1854 	if(aTsyReqHandle == iTsyAsyncReqHandle)
       
  1855 		{
       
  1856 		ReqCompleted(aTsyReqHandle,KErrCancel);
       
  1857 		}
       
  1858 	else
       
  1859 		{
       
  1860 		ReqCompleted(aTsyReqHandle,KErrCorrupt);
       
  1861 		}
       
  1862 	return KErrNone;
       
  1863 	}
       
  1864 
       
  1865 TInt CGprsDGprsTsy::GetMbmsNetworkServiceStatus(const TTsyReqHandle aTsyReqHandle, TBool* aAttemptAttach,TMbmsNetworkServiceStatus* aStatus)
       
  1866 	{
       
  1867 	LOGTEXT(_L8("CGprsDGprsTsy::GetMbmsNetworkServiceStatus called"));
       
  1868 	iTsyAsyncReqHandle = aTsyReqHandle;
       
  1869 	switch(iGetMbmsNetworkServiceStatus)
       
  1870 		{
       
  1871 	case 0:
       
  1872 		if(!(*aAttemptAttach == DPCKTTSY_MBMS_ATTEMPT_GSMATTACH_TRUE))
       
  1873 			{
       
  1874 			ReqCompleted(aTsyReqHandle,KErrCorrupt);
       
  1875 			}
       
  1876 		else
       
  1877 			{
       
  1878 			*aStatus = DPCKTTSY_MBMS_NETWORKSERVICE_SUPPORTED;
       
  1879 			AddDelayedReq(aTsyReqHandle, this);
       
  1880 			}
       
  1881 		iGetMbmsNetworkServiceStatus++;
       
  1882 		break;
       
  1883 	case 1:
       
  1884 		if(!(*aAttemptAttach == DPCKTTSY_MBMS_ATTEMPT_GSMATTACH_FALSE))
       
  1885 			{
       
  1886 			ReqCompleted(aTsyReqHandle,KErrCorrupt);
       
  1887 			}
       
  1888 		else
       
  1889 			{
       
  1890 			*aStatus = DPCKTTSY_MBMS_NETWORKSERVICE_UNKNOWN;
       
  1891 			AddDelayedReq(aTsyReqHandle, this);
       
  1892 			}
       
  1893 		iGetMbmsNetworkServiceStatus = 0; //Reset to 0
       
  1894 		break;
       
  1895 	default:
       
  1896 		ReqCompleted(aTsyReqHandle,KErrCorrupt);
       
  1897 		}
       
  1898 	return KErrNone;
       
  1899 	}
       
  1900 
       
  1901 TInt CGprsDGprsTsy::GetMbmsNetworkServiceStatusCancel(const TTsyReqHandle aTsyReqHandle)
       
  1902 	{
       
  1903 	LOGTEXT(_L8("CGprsDGprsTsy::GetMbmsNetworkServiceStatusCancel called"));
       
  1904 	RemoveDelayedReq(aTsyReqHandle);
       
  1905 	if(aTsyReqHandle == iTsyAsyncReqHandle)
       
  1906 		{	
       
  1907 		ReqCompleted(aTsyReqHandle,KErrCancel);
       
  1908 		}
       
  1909 	else
       
  1910 		{
       
  1911 		ReqCompleted(aTsyReqHandle,KErrCorrupt);
       
  1912 		}
       
  1913 	return KErrNone;
       
  1914 	}
       
  1915 		
       
  1916 TInt CGprsDGprsTsy::NotifyMbmsServiceAvailabilityChange(const TTsyReqHandle aTsyReqHandle)
       
  1917 	{
       
  1918 	LOGTEXT(_L8("CGprsDGprsTsy::NotifyMbmsServiceAvailabilityChange called"));
       
  1919 	iTsyAsyncReqHandle = aTsyReqHandle;
       
  1920 	if(!iServiceAvailability++)
       
  1921 		{
       
  1922 		AddDelayedReq(aTsyReqHandle,this);
       
  1923 		}
       
  1924 	return KErrNone;
       
  1925 	}
       
  1926 	
       
  1927 TInt CGprsDGprsTsy::NotifyMbmsServiceAvailabilityChangeCancel(const TTsyReqHandle aTsyReqHandle)
       
  1928 	{
       
  1929 	LOGTEXT(_L8("CGprsDGprsTsy::NotifyMbmsServiceAvailabilityChangeCancel called"));
       
  1930 	RemoveDelayedReq(aTsyReqHandle);
       
  1931 	if(aTsyReqHandle == iTsyAsyncReqHandle)
       
  1932 		{
       
  1933 		ReqCompleted(aTsyReqHandle,KErrCancel);
       
  1934 		}
       
  1935 	else
       
  1936 		{
       
  1937 		ReqCompleted(aTsyReqHandle,KErrCorrupt) ;
       
  1938 		}
       
  1939 	return KErrNone;
       
  1940 	}
       
  1941 	
       
  1942 TInt CGprsDGprsTsy::UpdateMbmsMonitorServiceListL(const TTsyReqHandle aTsyReqHandle,TMbmsAction* aAction, TDes8* aBuffer)
       
  1943 	{
       
  1944 	LOGTEXT(_L8("CGprsDGprsTsy::UpdateMbmsMonitorServiceListL called"));
       
  1945 	iTsyAsyncReqHandle = aTsyReqHandle;
       
  1946 	TInt error = KErrNone;
       
  1947 	switch(*aAction)
       
  1948 		{
       
  1949 	case DPCKTTSY_MBMS_ACTION_ADD:
       
  1950 		iList->RestoreL(*aBuffer);
       
  1951 		iServiceCount=iList->Enumerate();
       
  1952 		if ( iServiceCount != DPCKTTSY_MBMS_SERVICELIST_COUNT_ADD )
       
  1953 			{
       
  1954 			ReqCompleted(aTsyReqHandle,KErrCorrupt);
       
  1955 			return KErrNone;
       
  1956 			}
       
  1957 		error=AddMbmsServicesToMonitorList(aTsyReqHandle);
       
  1958 		if(error == KErrNone)
       
  1959 			{
       
  1960 			AddDelayedReq(aTsyReqHandle,this);
       
  1961 			}
       
  1962 		break;
       
  1963 	case DPCKTTSY_MBMS_ACTION_REMOVE:
       
  1964 		//If the client requests to remove invalid service entries, one or more, TSY 
       
  1965 		//shall delete valid entries and if invalid entries are found then the request 
       
  1966 		// shall complete with KErrMbmsImpreciseServiceEntries.
       
  1967 		iList->RestoreL(*aBuffer);
       
  1968 		iServiceCount=iList->Enumerate();	
       
  1969 		error=RemoveMbmsServicesFromMonitorList(aTsyReqHandle);
       
  1970 		if(error == KErrNone)
       
  1971 			{
       
  1972 			AddDelayedReq(aTsyReqHandle,this);
       
  1973 			}
       
  1974 		break;
       
  1975 	case DPCKTTSY_MBMS_ACTION_REMOVEALL:
       
  1976 		//No need to check the list object. TSY should just delete all the objects present
       
  1977 		// in the monitor list irrespective of the contents present in aBuffer parameter.
       
  1978 		error = KErrNone;
       
  1979 		AddDelayedReq(aTsyReqHandle,this);
       
  1980 		break;
       
  1981 	default:
       
  1982 		error = KErrCorrupt;
       
  1983 		}
       
  1984 	if(error == KErrCorrupt)
       
  1985 		{
       
  1986 		ReqCompleted(aTsyReqHandle,KErrCorrupt);
       
  1987 		}
       
  1988 	else if (error == KErrNotFound)
       
  1989 		{
       
  1990 		ReqCompleted(aTsyReqHandle,KErrNotFound);
       
  1991 		}
       
  1992 	else if (error == KErrMbmsImpreciseServiceEntries)
       
  1993 		{
       
  1994 		ReqCompleted(aTsyReqHandle,KErrMbmsImpreciseServiceEntries);
       
  1995 		}
       
  1996 	return KErrNone;
       
  1997 	};
       
  1998 	
       
  1999 TInt CGprsDGprsTsy::UpdateMbmsMonitorServiceListCancel(const TTsyReqHandle aTsyReqHandle)
       
  2000 	{
       
  2001 	LOGTEXT(_L8("CGprsDGprsTsy::UpdateMbmsMonitorServiceListCancel called"));
       
  2002 	RemoveDelayedReq(aTsyReqHandle);
       
  2003 	if(aTsyReqHandle == iTsyAsyncReqHandle)
       
  2004 		{
       
  2005 		ReqCompleted(aTsyReqHandle,KErrCancel);
       
  2006 		}
       
  2007 	else
       
  2008 		{
       
  2009 		ReqCompleted(aTsyReqHandle,KErrCorrupt);
       
  2010 		}
       
  2011 	return KErrNone;
       
  2012 	}
       
  2013 	
       
  2014 TInt CGprsDGprsTsy::GetMbmsMonitoredServicesPhase1(const TTsyReqHandle aTsyReqHandle, TClientId* aClient, TUint* aBufSize)
       
  2015 	{
       
  2016 	LOGTEXT(_L8("CGprsDGprsTsy::GetMbmsMonitoredServicesPhase1 called"));
       
  2017 	iTsyAsyncReqHandle = aTsyReqHandle;
       
  2018 	TInt ret=KErrNone;
       
  2019 	TInt leaveCode=KErrNone;
       
  2020 	TRAP(leaveCode, ret=ProcessGetMbmsMonitoredServicesPhase1L(aTsyReqHandle, aClient, aBufSize););
       
  2021 	if (leaveCode != KErrNone)
       
  2022 		{
       
  2023 		ReqCompleted(aTsyReqHandle,leaveCode);
       
  2024 		}
       
  2025 	return ret;
       
  2026 	}	
       
  2027 	
       
  2028 TInt CGprsDGprsTsy::ProcessGetMbmsMonitoredServicesPhase1L(const TTsyReqHandle aTsyReqHandle, 
       
  2029 													 TClientId* aClient, 
       
  2030 													 TUint* aBufSize)
       
  2031 	{
       
  2032 	// retrieve MBMS service list,
       
  2033 	// store each entry.
       
  2034 	// stream the list and then return size of this buffer to client
       
  2035 	CPcktMbmsMonitoredServiceList* list=CPcktMbmsMonitoredServiceList::NewL();
       
  2036 	CleanupStack::PushL(list);
       
  2037 	RPacketService::TMbmsServiceAvailabilityV1 entry;
       
  2038 
       
  2039 	// fill up an example list
       
  2040 	for (TInt index=0; index < DPCKTTSY_MBMS_SERVICELIST_COUNT_ADD; index++)
       
  2041 		{
       
  2042 		switch (index)
       
  2043 			{
       
  2044 		case 0:
       
  2045 			entry.iMbmsServiceMode = DPCKTTSY_MBMS_SERVICEMODE_ONE;
       
  2046 			entry.iMbmsAccessBearer = DPCKTTSY_MBMS_ACCESSBEARER_ONE;
       
  2047 			entry.iMbmsAvailabilityStatus = DPCKTTSY_MBMS_AVAILABILITYSTATUS_ONE;
       
  2048 			entry.iTmgi.SetMCC(DPCKTTSY_MBMS_MCC_ONE);
       
  2049 			entry.iTmgi.SetMNC(DPCKTTSY_MBMS_MNC_ONE);
       
  2050 			entry.iTmgi.SetServiceId(DPCKTTSY_MBMS_SERVICEID_ONE);
       
  2051 			break;
       
  2052 			
       
  2053 		case 1:
       
  2054 			entry.iMbmsServiceMode = DPCKTTSY_MBMS_SERVICEMODE_TWO;
       
  2055 			entry.iMbmsAccessBearer = DPCKTTSY_MBMS_ACCESSBEARER_TWO;
       
  2056 			entry.iMbmsAvailabilityStatus = DPCKTTSY_MBMS_AVAILABILITYSTATUS_TWO;
       
  2057 			entry.iTmgi.SetMCC(DPCKTTSY_MBMS_MCC_TWO);
       
  2058 			entry.iTmgi.SetMNC(DPCKTTSY_MBMS_MNC_TWO);
       
  2059 			entry.iTmgi.SetServiceId(DPCKTTSY_MBMS_SERVICEID_TWO);
       
  2060 			break;
       
  2061 		
       
  2062 		case 2:
       
  2063 		default:
       
  2064 			entry.iMbmsServiceMode = DPCKTTSY_MBMS_SERVICEMODE_THREE;
       
  2065 			entry.iMbmsAccessBearer = DPCKTTSY_MBMS_ACCESSBEARER_THREE;
       
  2066 			entry.iMbmsAvailabilityStatus = DPCKTTSY_MBMS_AVAILABILITYSTATUS_THREE;
       
  2067 			entry.iTmgi.SetMCC(DPCKTTSY_MBMS_MCC_THREE);
       
  2068 			entry.iTmgi.SetMNC(DPCKTTSY_MBMS_MNC_THREE);
       
  2069 			entry.iTmgi.SetServiceId(DPCKTTSY_MBMS_SERVICEID_THREE);
       
  2070 			break;
       
  2071 			}
       
  2072 		// Add the entry into the list, at the next empty location
       
  2073 		list->AddEntryL(entry);
       
  2074 		}
       
  2075 	// Store the streamed list and the client ID
       
  2076 	CListReadAllAttempt* read=CListReadAllAttempt::NewL(aClient,aTsyReqHandle);
       
  2077 	CleanupStack::PushL(read);
       
  2078 	
       
  2079 	read->iListBuf = list->StoreLC();
       
  2080 	CleanupStack::Pop(); // pop the CBufBase allocated by StoreLC
       
  2081 	
       
  2082 	iGetMbmsMonitoredServices->AppendL(read);
       
  2083 	CleanupStack::Pop(); // pop the CListReadAllAttempt
       
  2084 	
       
  2085 	// return the CBufBase’s size to client
       
  2086 	*aBufSize=(read->iListBuf)->Size();
       
  2087    	// Complete first phase of list retrieval
       
  2088 	AddDelayedReq(aTsyReqHandle,this);
       
  2089 	CleanupStack::PopAndDestroy(); // pop&destroy list
       
  2090 	return KErrNone;
       
  2091 	}
       
  2092 
       
  2093 TInt CGprsDGprsTsy::GetMbmsMonitoredServicesPhase2(const TTsyReqHandle aTsyReqHandle,TClientId* aClient, TDes8* aBuf)
       
  2094 	{
       
  2095 	LOGTEXT(_L8("CGprsDGprsTsy::GetMbmsMonitoredServicesPhase2 called"));
       
  2096 	CListReadAllAttempt* read=NULL;
       
  2097 	// Find the get Mbms monitored services from this client
       
  2098 	for (TInt i=0; i<iGetMbmsMonitoredServices->Count(); ++i)
       
  2099 		{
       
  2100 		read = iGetMbmsMonitoredServices->At(i);
       
  2101 		if ((read->iClient.iSessionHandle==aClient->iSessionHandle) &&
       
  2102 		    (read->iClient.iSubSessionHandle==aClient->iSubSessionHandle))
       
  2103 			{
       
  2104 			TPtr8 bufPtr((read->iListBuf)->Ptr(0));
       
  2105 			// Copy the streamed list to the client
       
  2106 			aBuf->Copy(bufPtr);
       
  2107 			delete read;
       
  2108 			iGetMbmsMonitoredServices->Delete(i);
       
  2109 			ReqCompleted(aTsyReqHandle,KErrNone);
       
  2110 			return KErrNone;
       
  2111 			}
       
  2112 		}
       
  2113 	// Should handle error case of not finding the matching client from read all phase 1
       
  2114 	return KErrNotFound;
       
  2115 	}
       
  2116 	
       
  2117 TInt CGprsDGprsTsy::GetMbmsMonitoredServicesCancel(const TTsyReqHandle aTsyReqHandle)
       
  2118 	{
       
  2119 	LOGTEXT(_L8("CGprsDGprsTsy::GetPreferredWlanSIDsCancel called"));
       
  2120 	// Remove the read all attempt from iGetMbmsMonitoredServices
       
  2121 	RemoveDelayedReq(aTsyReqHandle);
       
  2122 	CListReadAllAttempt* read=NULL;
       
  2123 	for (TInt i=0; i<iGetMbmsMonitoredServices->Count(); ++i)
       
  2124 		{
       
  2125 		read = iGetMbmsMonitoredServices->At(i);
       
  2126 		if (read->iReqHandle == aTsyReqHandle)
       
  2127 			{
       
  2128 			delete read;
       
  2129 			iGetMbmsMonitoredServices->Delete(i);
       
  2130 			break;
       
  2131 			}
       
  2132 		}
       
  2133 	ReqCompleted(aTsyReqHandle,KErrCancel);
       
  2134 	return KErrNone;
       
  2135 	}
       
  2136 
       
  2137 TInt CGprsDGprsTsy::AddMbmsServicesToMonitorList(const TTsyReqHandle aTsyReqHandle)
       
  2138 	{
       
  2139 	LOGTEXT(_L8("CGprsDGprsTsy::AddMbmsServicesToMonitorList is called"));
       
  2140 	TInt error = KErrNone;
       
  2141 	iTsyAsyncReqHandle = aTsyReqHandle;
       
  2142 	RPacketService::TMbmsServiceAvailabilityV1 entry;
       
  2143 	for (TInt i=0; i<iServiceCount; ++i)
       
  2144 		{
       
  2145 		TRAPD(ret,entry=iList->GetEntryL(i));
       
  2146 		if (ret != KErrNone)
       
  2147 			break;
       
  2148 		switch(i)
       
  2149 			{
       
  2150 		case 0:
       
  2151 			if(entry.iMbmsServiceMode != DPCKTTSY_MBMS_SERVICEMODE_ONE ||
       
  2152 			   entry.iMbmsAccessBearer != DPCKTTSY_MBMS_ACCESSBEARER_ONE ||
       
  2153 			   entry.iTmgi.GetMCC() != DPCKTTSY_MBMS_MCC_ONE ||
       
  2154 			   entry.iTmgi.GetMNC() != DPCKTTSY_MBMS_MNC_ONE ||
       
  2155 			   entry.iTmgi.GetServiceId() != DPCKTTSY_MBMS_SERVICEID_ONE)		
       
  2156 				{
       
  2157 				error  = KErrCorrupt;
       
  2158 				}
       
  2159 			break;
       
  2160 		case 1:
       
  2161 			if(entry.iMbmsServiceMode != DPCKTTSY_MBMS_SERVICEMODE_TWO ||
       
  2162 			   entry.iMbmsAccessBearer != DPCKTTSY_MBMS_ACCESSBEARER_TWO ||
       
  2163 			   entry.iTmgi.GetMCC() != DPCKTTSY_MBMS_MCC_TWO ||
       
  2164 			   entry.iTmgi.GetMNC() != DPCKTTSY_MBMS_MNC_TWO ||
       
  2165 			   entry.iTmgi.GetServiceId() != DPCKTTSY_MBMS_SERVICEID_TWO)	
       
  2166 				{
       
  2167 				error  = KErrCorrupt;
       
  2168 				}
       
  2169 			break;
       
  2170 		case 2:
       
  2171 		default:
       
  2172 			if(entry.iMbmsServiceMode != DPCKTTSY_MBMS_SERVICEMODE_THREE ||
       
  2173 			   entry.iMbmsAccessBearer != DPCKTTSY_MBMS_ACCESSBEARER_THREE ||
       
  2174 			   entry.iTmgi.GetMCC() != DPCKTTSY_MBMS_MCC_THREE ||
       
  2175 			   entry.iTmgi.GetMNC() != DPCKTTSY_MBMS_MNC_THREE ||
       
  2176 			   entry.iTmgi.GetServiceId() != DPCKTTSY_MBMS_SERVICEID_THREE)
       
  2177 				{
       
  2178 				error  = KErrCorrupt;
       
  2179 				}
       
  2180 			break;
       
  2181 			}//END OF SWITCH
       
  2182 		}//end of for loop
       
  2183 	return error;
       
  2184 	}
       
  2185 	
       
  2186 TInt CGprsDGprsTsy::RemoveMbmsServicesFromMonitorList(const TTsyReqHandle aTsyReqHandle)
       
  2187 	{
       
  2188 	LOGTEXT(_L8("CGprsDGprsTsy::RemoveMbmsServicesFromMonitorList is called"));
       
  2189 	TInt error = KErrNone;
       
  2190 	RPacketService::TMbmsServiceAvailabilityV1 entry;
       
  2191 	
       
  2192 	switch(iRemoveMbmsServices)
       
  2193 		{
       
  2194 	case 0:	
       
  2195 		for(TInt i=0;i<iServiceCount;i++)
       
  2196 			{
       
  2197 			TRAPD(ret,entry=iList->GetEntryL(i));
       
  2198 			if (ret != KErrNone)
       
  2199 				break;
       
  2200 			if(entry.iMbmsServiceMode != DPCKTTSY_MBMS_SERVICEMODE_TWO ||
       
  2201 		  		entry.iMbmsAccessBearer != DPCKTTSY_MBMS_ACCESSBEARER_TWO ||
       
  2202 		   		entry.iTmgi.GetMCC() != DPCKTTSY_MBMS_MCC_TWO ||
       
  2203 		   		entry.iTmgi.GetMNC() != DPCKTTSY_MBMS_MNC_TWO ||
       
  2204 		   		entry.iTmgi.GetServiceId() != DPCKTTSY_MBMS_SERVICEID_TWO)	
       
  2205 				{
       
  2206 				error=KErrCorrupt;
       
  2207 				}
       
  2208 			}
       
  2209 	 	iRemoveMbmsServices++;
       
  2210 		break;
       
  2211 		
       
  2212 	case 1:	
       
  2213 		for(TInt i=0;i<iServiceCount;i++)
       
  2214 			{
       
  2215 			TRAPD(ret,entry=iList->GetEntryL(i));
       
  2216 			if (ret != KErrNone)
       
  2217 				break;
       
  2218 			if(entry.iMbmsServiceMode != DPCKTTSY_MBMS_SERVICEMODE_INVALID ||
       
  2219 			   entry.iMbmsAccessBearer != DPCKTTSY_MBMS_ACCESSBEARER_INVALID ||
       
  2220 			   entry.iTmgi.GetMCC() != DPCKTTSY_MBMS_MCC_INVALID ||
       
  2221 			   entry.iTmgi.GetMNC() != DPCKTTSY_MBMS_MNC_INVALID ||
       
  2222 			   entry.iTmgi.GetServiceId() != DPCKTTSY_MBMS_SERVICEID_INVALID)	
       
  2223 				{
       
  2224 				error=KErrCorrupt;
       
  2225 				}
       
  2226 			}
       
  2227 		if(error != KErrCorrupt)
       
  2228 			{
       
  2229 			error=KErrNotFound;
       
  2230 			}
       
  2231 		iRemoveMbmsServices++;
       
  2232 		break;
       
  2233 		
       
  2234 	case 2:	
       
  2235 		for(TInt i=0;i<iServiceCount;i++)
       
  2236 			{
       
  2237 			TRAPD(ret,entry=iList->GetEntryL(i));
       
  2238 			if (ret != KErrNone)
       
  2239 				break;
       
  2240 			switch(i)
       
  2241 				{
       
  2242 				case 0:
       
  2243 					if(entry.iMbmsServiceMode != DPCKTTSY_MBMS_SERVICEMODE_ONE ||
       
  2244 			   		   entry.iMbmsAccessBearer != DPCKTTSY_MBMS_ACCESSBEARER_ONE  ||
       
  2245 			  		   entry.iTmgi.GetMCC() != DPCKTTSY_MBMS_MCC_ONE  ||
       
  2246 			   		   entry.iTmgi.GetMNC() != DPCKTTSY_MBMS_MNC_ONE  ||
       
  2247 			   		   entry.iTmgi.GetServiceId() != DPCKTTSY_MBMS_SERVICEID_ONE )	
       
  2248 						{
       
  2249 						error=KErrCorrupt;
       
  2250 						}
       
  2251 					break;	
       
  2252 				
       
  2253 				case 1:
       
  2254 					if(entry.iMbmsServiceMode != DPCKTTSY_MBMS_SERVICEMODE_INVALID ||
       
  2255 			   		   entry.iMbmsAccessBearer != DPCKTTSY_MBMS_ACCESSBEARER_INVALID ||
       
  2256 			  		   entry.iTmgi.GetMCC() != DPCKTTSY_MBMS_MCC_INVALID ||
       
  2257 			   		   entry.iTmgi.GetMNC() != DPCKTTSY_MBMS_MNC_INVALID ||
       
  2258 			   		   entry.iTmgi.GetServiceId() != DPCKTTSY_MBMS_SERVICEID_INVALID)	
       
  2259 						{
       
  2260 						error=KErrCorrupt;
       
  2261 						}
       
  2262 					break;
       
  2263 						
       
  2264 				case 2:
       
  2265 				default:
       
  2266 					if(entry.iMbmsServiceMode != DPCKTTSY_MBMS_SERVICEMODE_THREE ||
       
  2267 			   		   entry.iMbmsAccessBearer != DPCKTTSY_MBMS_ACCESSBEARER_THREE ||
       
  2268 			  		   entry.iTmgi.GetMCC() != DPCKTTSY_MBMS_MCC_THREE ||
       
  2269 			   		   entry.iTmgi.GetMNC() != DPCKTTSY_MBMS_MNC_THREE ||
       
  2270 			   		   entry.iTmgi.GetServiceId() != DPCKTTSY_MBMS_SERVICEID_THREE)	
       
  2271 						{
       
  2272 						error=KErrCorrupt;
       
  2273 						}
       
  2274 					break;				
       
  2275 				}
       
  2276 			}
       
  2277 		if(error != KErrCorrupt)
       
  2278 			{
       
  2279 			error=KErrMbmsImpreciseServiceEntries;
       
  2280 			}
       
  2281 		iRemoveMbmsServices=0;
       
  2282 		break;	
       
  2283 					
       
  2284 	default:
       
  2285 		ReqCompleted(aTsyReqHandle,KErrCorrupt);
       
  2286 		break;	
       
  2287 		}
       
  2288 	return error;
       
  2289 	}
       
  2290 
       
  2291 TInt CGprsDGprsTsy::EnumerateMbmsMonitorServiceList(const TTsyReqHandle aTsyReqHandle, TInt* aCount, TInt* aMaxAllowed)
       
  2292 	{
       
  2293 	LOGTEXT(_L8("CGprsDGprsTsy::EnumerateMbmsMonitorServiceList called"));
       
  2294 	iTsyAsyncReqHandle = aTsyReqHandle;
       
  2295 	*aCount = DPCKTTSY_MBMS_MONITORSERVICE_NUMBER_OF_CONTEXTS;
       
  2296 	*aMaxAllowed = DPCKTTSY_MBMS_MONITORSERVICE_MAX_NUMBER_OF_CONTEXTS;
       
  2297 	AddDelayedReq(aTsyReqHandle,this, DPCKTTSY_MBMS_DELAY);
       
  2298 	return KErrNone;
       
  2299 	}
       
  2300 
       
  2301 TInt CGprsDGprsTsy::EnumerateMbmsMonitorServiceListCancel(const TTsyReqHandle aTsyReqHandle)
       
  2302 	{
       
  2303 	LOGTEXT(_L8("CGprsDGprsTsy::EnumerateMbmsMonitorServiceListCancel called"));
       
  2304 	RemoveDelayedReq(aTsyReqHandle);
       
  2305 	if(aTsyReqHandle == iTsyAsyncReqHandle)
       
  2306 		{
       
  2307 		ReqCompleted(aTsyReqHandle,KErrCancel);
       
  2308 		}
       
  2309 	else
       
  2310 		{
       
  2311 		ReqCompleted(aTsyReqHandle,KErrCorrupt);
       
  2312 		}
       
  2313 	return KErrNone;
       
  2314 	}
       
  2315 	
       
  2316 TInt CGprsDGprsTsy::EnumerateMbmsActiveServiceList(const TTsyReqHandle aTsyReqHandle, TInt* aCount, TInt* aMaxAllowed)
       
  2317 	{
       
  2318 	LOGTEXT(_L8("CGprsDGprsTsy::EnumerateMbmsActiveServiceList called"));
       
  2319 	iTsyAsyncReqHandle = aTsyReqHandle;
       
  2320 	*aCount = DPCKTTSY_MBMS_ACTIVESERVICE_NUMBER_OF_CONTEXTS;
       
  2321 	*aMaxAllowed = DPCKTTSY_MBMS_ACTIVESERVICE_MAX_NUMBER_OF_CONTEXTS;
       
  2322 	AddDelayedReq(aTsyReqHandle,this, DPCKTTSY_MBMS_DELAY);
       
  2323 	return KErrNone;
       
  2324 	}
       
  2325 
       
  2326 TInt CGprsDGprsTsy::EnumerateMbmsActiveServiceListCancel(const TTsyReqHandle aTsyReqHandle)
       
  2327 	{
       
  2328 	LOGTEXT(_L8("CGprsDGprsTsy::EnumerateMbmsActiveServiceListCancel called"));
       
  2329 	RemoveDelayedReq(aTsyReqHandle);
       
  2330 	if(aTsyReqHandle == iTsyAsyncReqHandle)
       
  2331 		{
       
  2332 		ReqCompleted(aTsyReqHandle,KErrCancel);
       
  2333 		}
       
  2334 	else
       
  2335 		{
       
  2336 		ReqCompleted(aTsyReqHandle,KErrCorrupt);
       
  2337 		}
       
  2338 	return KErrNone;
       
  2339 	}	
       
  2340 
       
  2341 //
       
  2342 CListReadAllAttempt* CListReadAllAttempt::NewL(TClientId* aId, TTsyReqHandle aReqHandle)
       
  2343 	{
       
  2344 	CListReadAllAttempt* read=new(ELeave) CListReadAllAttempt(aId, aReqHandle);
       
  2345 	CleanupStack::PushL(read);
       
  2346 	read->ConstructL();
       
  2347 	CleanupStack::Pop();
       
  2348 	return read;
       
  2349 	}
       
  2350 
       
  2351 CListReadAllAttempt::CListReadAllAttempt(TClientId* aId, TTsyReqHandle aReqHandle)
       
  2352 	:CBase()
       
  2353 	{
       
  2354 	iClient.iSessionHandle=aId->iSessionHandle;
       
  2355 	iClient.iSubSessionHandle=aId->iSubSessionHandle;
       
  2356 	iReqHandle=aReqHandle;
       
  2357 	iListBuf = NULL;
       
  2358 	}
       
  2359 
       
  2360 void CListReadAllAttempt::ConstructL()
       
  2361 	{
       
  2362 	}
       
  2363 
       
  2364 CListReadAllAttempt::~CListReadAllAttempt()
       
  2365 	{
       
  2366 	delete iListBuf;
       
  2367 	}
       
  2368 
       
  2369 //
       
  2370 // methods for CActiveListNode
       
  2371 //
       
  2372 
       
  2373 CGprsDGprsTsy::CActiveListNode::CActiveListNode(CActive *aActive, const TTsyReqHandle aTsyReqHandle) :
       
  2374 	iActive(aActive), iTsyReqHandle(aTsyReqHandle)
       
  2375 	{
       
  2376 	}
       
  2377 
       
  2378 CGprsDGprsTsy::CActiveListNode::~CActiveListNode()
       
  2379 	{
       
  2380 	delete iActive;
       
  2381 	}
       
  2382 
       
  2383 //
       
  2384 // methods for the list of aos which corresspond to the outstanding delayed asyncrhonous reqs
       
  2385 //
       
  2386 
       
  2387 TInt CGprsDGprsTsy::FindDelayedReq(const TTsyReqHandle aTsyReqHandle, CActiveListNode *& aNode)
       
  2388 	{
       
  2389 	TInt err = KErrNotFound;
       
  2390 	TSglQueIter<CActiveListNode> iter(iActiveRequestObjects);
       
  2391 	iter.SetToFirst();
       
  2392 
       
  2393 	CActiveListNode *node = aNode = NULL;
       
  2394 	while ((node = iter++) != NULL)
       
  2395 		{
       
  2396 		if (node->iTsyReqHandle == aTsyReqHandle)
       
  2397 			{
       
  2398 			break;
       
  2399 			}
       
  2400 		}
       
  2401 	if (node != NULL)
       
  2402 		{
       
  2403 		aNode = node;
       
  2404 		err = KErrNone;
       
  2405 		}
       
  2406 	return err;
       
  2407 	}
       
  2408 	
       
  2409 TInt CGprsDGprsTsy::RemoveDelayedReq(const TTsyReqHandle aTsyReqHandle)
       
  2410 	{
       
  2411 	CActiveListNode *aNode = NULL;
       
  2412 	TInt err = FindDelayedReq(aTsyReqHandle,aNode);
       
  2413 	if (err == KErrNone)
       
  2414 		{
       
  2415 		iActiveRequestObjects.Remove(*aNode);
       
  2416 		delete aNode;
       
  2417 		}
       
  2418 	return err;
       
  2419 	}
       
  2420 
       
  2421 void CGprsDGprsTsy::RegisterDelayedReqL(const TTsyReqHandle aTsyReqHandle, CTelObject *aTelObject)
       
  2422 	{
       
  2423 	CDelayedCompleter *delayed = CDelayedCompleter::NewL(aTsyReqHandle,this,aTelObject);
       
  2424 	CleanupStack::PushL(delayed);
       
  2425 	CActiveListNode *newNode = new (ELeave) CActiveListNode(delayed,aTsyReqHandle);
       
  2426 	iActiveRequestObjects.AddLast(*newNode);
       
  2427 	delayed->After(DPCKTTSY_STANDARD_DELAY);
       
  2428 	CleanupStack::Pop(); // delayed
       
  2429 	}
       
  2430 	
       
  2431 void CGprsDGprsTsy::RegisterDelayedReqL(const TTsyReqHandle aTsyReqHandle, CTelObject *aTelObject,TInt aPriority)
       
  2432 	{
       
  2433 	CDelayedCompleter *delayed = CDelayedCompleter::NewL(aTsyReqHandle,this,aTelObject);
       
  2434 	CleanupStack::PushL(delayed);
       
  2435 	CActiveListNode *newNode = new (ELeave) CActiveListNode(delayed,aTsyReqHandle);
       
  2436 	iActiveRequestObjects.AddLast(*newNode);
       
  2437 	delayed->After(aPriority);
       
  2438 	CleanupStack::Pop(); // delayed
       
  2439 	}
       
  2440 	
       
  2441 void CGprsDGprsTsy::AddDelayedReq(const TTsyReqHandle aTsyReqHandle, CTelObject *aTelObject)
       
  2442 	{
       
  2443 	TRAPD(err, RegisterDelayedReqL(aTsyReqHandle, aTelObject));
       
  2444 	if (err != KErrNone)
       
  2445 		{
       
  2446 		ReqCompleted(aTsyReqHandle, err);
       
  2447 		}
       
  2448 	}
       
  2449 	
       
  2450 void CGprsDGprsTsy::AddDelayedReq(const TTsyReqHandle aTsyReqHandle, CTelObject *aTelObject,TInt aPriority)
       
  2451 	{
       
  2452 	TRAPD(err, RegisterDelayedReqL(aTsyReqHandle, aTelObject, aPriority));
       
  2453 	if (err != KErrNone)
       
  2454 		{
       
  2455 		ReqCompleted(aTsyReqHandle, err);
       
  2456 		}
       
  2457 	}
       
  2458 	
       
  2459 //
       
  2460 //
       
  2461 // CDelayedCompleter
       
  2462 //
       
  2463 //
       
  2464 
       
  2465 CDelayedCompleter::CDelayedCompleter(const TTsyReqHandle aTsyReqHandle, CGprsDGprsTsy *aGprsObject,
       
  2466 									CTelObject *aTelObject) :
       
  2467 		CTimer(EPriorityStandard),iTsyReqHandle(aTsyReqHandle), iGprsObject(aGprsObject),
       
  2468 			iTelObject(aTelObject)
       
  2469 	{
       
  2470 	}
       
  2471 
       
  2472 CDelayedCompleter* CDelayedCompleter::NewL(const TTsyReqHandle aTsyReqHandle, CGprsDGprsTsy *aGprsObject,
       
  2473 									CTelObject *aTelObject)
       
  2474 	{
       
  2475 	CDelayedCompleter* self = new (ELeave) CDelayedCompleter(aTsyReqHandle,aGprsObject,aTelObject);
       
  2476 	CleanupStack::PushL(self);
       
  2477 	self->ConstructL();
       
  2478 	CleanupStack::Pop();
       
  2479 	return self;
       
  2480 	}
       
  2481 
       
  2482 void CDelayedCompleter::ConstructL()
       
  2483 	{
       
  2484 	CTimer::ConstructL();
       
  2485 	CActiveScheduler::Add(this);
       
  2486 	}
       
  2487 
       
  2488 void CDelayedCompleter::RunL()
       
  2489 	{
       
  2490 	iTelObject->ReqCompleted(iTsyReqHandle,KErrNone);
       
  2491 	(void) iGprsObject->RemoveDelayedReq(iTsyReqHandle); 
       
  2492 	}