telephonyserverplugins/common_tsy/commontsy/src/mmpacket/cmmmbmscontexttsy.cpp
changeset 0 3553901f7fa8
child 24 6638e7f4bd8f
child 42 3adadc800673
equal deleted inserted replaced
-1:000000000000 0:3553901f7fa8
       
     1 // Copyright (c) 2006-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 
       
    17 
       
    18 // INCLUDE FILES
       
    19 #include "cmmmbmscontexttsy.h"
       
    20 #include "cmmmbmscontextlist.h"
       
    21 #include "CMmPacketTsy.h"
       
    22 #include <ctsy/tflogger.h>
       
    23 #include "mbmstypes.h"
       
    24 #include "MmTsy_timeoutdefs.h"
       
    25 #include "MmTsy_numberOfSlots.h"
       
    26 
       
    27 // ============================ MEMBER FUNCTIONS ===============================
       
    28 
       
    29 CMmMBMSContextTsy::CMmMBMSContextTsy()
       
    30     {        
       
    31     }
       
    32 
       
    33 CMmMBMSContextTsy* CMmMBMSContextTsy::NewL(
       
    34         CMmPacketServiceTsy* aMmPacketService,                
       
    35         const TDes& aName,  
       
    36         const TUint8 aProxyId  ) 
       
    37     {
       
    38 TFLOGSTRING( "TSY: CMmMBMSContextTsy::NewL" );
       
    39 
       
    40     CMmMBMSContextTsy* packetContext = new ( ELeave ) CMmMBMSContextTsy();
       
    41     CleanupClosePushL( *packetContext );    
       
    42     packetContext->ConstructL( aMmPacketService, aName, aProxyId );
       
    43     CleanupStack::Pop();
       
    44     
       
    45     return packetContext;
       
    46     }
       
    47 
       
    48 void CMmMBMSContextTsy::ConstructL(CMmPacketServiceTsy* const aMmPacketService,                
       
    49 							        const TDes& aName,  
       
    50 							        TUint8 aProxyId)
       
    51 	{
       
    52     iMmPacketService = aMmPacketService;
       
    53     iContextName = aName;
       
    54     iObjectId = aProxyId;
       
    55 	
       
    56     iConfig = new ( ELeave ) RPacketMbmsContext::TContextConfigMbmsV1();
       
    57 
       
    58 #ifdef REQHANDLE_TIMER   
       
    59     // Create req handle store
       
    60     iTsyReqHandleStore = CMmTsyReqHandleStore::NewL(  this,
       
    61         iMmPacketService->PhoneTsy(), EMaxNumOfMBMSContextRequests,
       
    62         iPacketContextReqHandles );
       
    63 
       
    64 #else
       
    65         // Create req handle store
       
    66     iTsyReqHandleStore = CMmTsyReqHandleStore::NewL( 
       
    67         EMaxNumOfMBMSContextRequests, iPacketContextReqHandles );
       
    68 
       
    69 #endif // REQHANDLE_TIMER
       
    70     iIsInitialiseAllowed = ETrue;
       
    71     iServicesArray = RPacketMbmsContext::CMbmsSession::NewL(); 
       
    72     iContextStatus = RPacketContext::EStatusUnknown;  
       
    73     }
       
    74     
       
    75 CMmMBMSContextTsy::~CMmMBMSContextTsy()
       
    76     {
       
    77 TFLOGSTRING2( "TSY: CMmMBMSContextTsy::~CMmMBMSContextTsy Context name: %S", &iContextName );
       
    78 	
       
    79 	if( iMmPacketService )
       
    80 		{			
       
    81 		iMmPacketService->MBMSContextList()->RemoveObject( this );
       
    82 
       
    83 	    // Set Dynamic Caps
       
    84 	    iMmPacketService->ActivePacketServiceExtension()->SetDynamicCapsFlag(
       
    85 	        RPacketService::KCapsActivate, EFalse );
       
    86 		}
       
    87 
       
    88     delete iServicesArray;
       
    89     iServicesArray = NULL;
       
    90 
       
    91     delete iTsyReqHandleStore;
       
    92     iTsyReqHandleStore = NULL;
       
    93     
       
    94     delete iConfig;
       
    95     iConfig = NULL;             
       
    96 
       
    97     delete iTempConfig;
       
    98     iTempConfig = NULL;
       
    99     
       
   100     }
       
   101 
       
   102 
       
   103 // ---------------------------------------------------------------------------
       
   104 // CMmMBMSContextTsy::ExtFunc
       
   105 // TRAP's all CMmMBMSContextTsy related MM Packet API requests in case that
       
   106 // they fail. This method functions only as a centralized TRAP for the
       
   107 // DoExtFuncL method that does the actual mapping of IPC number to TSY method
       
   108 // call.
       
   109 // (other items were commented in a header).
       
   110 // ---------------------------------------------------------------------------
       
   111 //
       
   112 
       
   113 TInt CMmMBMSContextTsy::ExtFunc( 
       
   114         TTsyReqHandle aTsyReqHandle, 
       
   115         TInt aIpc, 
       
   116         const TDataPackage& aPackage )  
       
   117     {
       
   118 TFLOGSTRING3( "TSY: CMmMBMSContextTsy::ExtFunc. IPC: %d Context name:%S", aIpc, &iContextName );
       
   119 
       
   120     TInt ret( KErrNone );
       
   121     TInt trapError( KErrNone );
       
   122 
       
   123     // Reset last tsy request type
       
   124     iReqHandleType = EMultimodePacketMbmsReqHandleUnknown;
       
   125     
       
   126     // Set tsy request handle
       
   127     iTsyReqHandle = aTsyReqHandle;    
       
   128 
       
   129     // Trap the call of DoExtFuncL
       
   130     TRAP( trapError, ret = DoExtFuncL( aTsyReqHandle, aIpc, aPackage ) );
       
   131 
       
   132     if ( KErrNone != trapError )
       
   133         {
       
   134         ReqCompleted( aTsyReqHandle, trapError );
       
   135         }
       
   136 
       
   137     else if ( KErrNone != ret )
       
   138         {
       
   139         ReqCompleted( aTsyReqHandle, ret );
       
   140         }
       
   141 
       
   142     if ( EMultimodePacketMbmsReqHandleUnknown != iReqHandleType )
       
   143         {
       
   144 #ifdef REQHANDLE_TIMER
       
   145         SetTypeOfResponse( iReqHandleType, aTsyReqHandle );
       
   146 #else
       
   147         iTsyReqHandleStore->SetTsyReqHandle( iReqHandleType, aTsyReqHandle );
       
   148 #endif // REQHANDLE_TIMER
       
   149         }
       
   150 
       
   151     return KErrNone;
       
   152     }
       
   153 
       
   154 // ---------------------------------------------------------------------------
       
   155 // CMmMBMSContextTsy::DoExtFuncL
       
   156 // Packet Data specific functionality of CMmMBMSContextTsy::ExtFunc
       
   157 // ---------------------------------------------------------------------------
       
   158 //
       
   159 TInt CMmMBMSContextTsy::DoExtFuncL( 
       
   160         TTsyReqHandle aTsyReqHandle,      
       
   161         TInt aIpc,      
       
   162         const TDataPackage& aPackage )   
       
   163     {
       
   164 TFLOGSTRING3( "TSY: CMmMBMSContextTsy::DoExtFuncL. IPC: %d Handle:%d",
       
   165                 aIpc, aTsyReqHandle );
       
   166 
       
   167     TInt ret( KErrNotSupported );
       
   168 
       
   169     TAny* dataPtr = aPackage.Ptr1();
       
   170     TAny* dataPtr2 = aPackage.Ptr2();
       
   171 
       
   172     switch ( aIpc )
       
   173         {
       
   174         case EPacketContextNotifyStatusChange:
       
   175             ret = NotifyStatusChange( 
       
   176                 reinterpret_cast< RPacketContext::TContextStatus*>( dataPtr ) );
       
   177             break;
       
   178         case EPacketContextNotifyConfigChanged:
       
   179             ret = NotifyConfigChanged( 
       
   180                 reinterpret_cast< TPacketDataConfigBase*>( dataPtr ) );
       
   181             break;
       
   182         case EPacketContextInitialiseContext:
       
   183             ret = InitialiseContextL( reinterpret_cast< RPacketContext::TDataChannelV2*>( dataPtr ));
       
   184             break;
       
   185         case EPacketContextSetConfig:
       
   186             ret = SetConfigL( 
       
   187                 reinterpret_cast< TPacketDataConfigBase*>( dataPtr ) );
       
   188             break;
       
   189         case EPacketContextActivate:
       
   190             ret = ActivateL();
       
   191             break;
       
   192         case EPacketContextDeactivate:
       
   193             ret = DeactivateL();
       
   194             break;
       
   195         case EPacketContextDelete:
       
   196             ret = DeleteL();
       
   197             break;
       
   198         case EPacketContextGetStatus:
       
   199             ret = GetStatus( aTsyReqHandle, 
       
   200                 reinterpret_cast< RPacketContext::TContextStatus*>( dataPtr ) );
       
   201             break;
       
   202         case EPacketContextGetConfig:
       
   203             ret = GetConfig( aTsyReqHandle, 
       
   204                 reinterpret_cast< TPacketDataConfigBase*>( dataPtr ) );
       
   205             break;
       
   206         case EPacketContextGetLastErrorCause:
       
   207             ret = GetLastErrorCause( aTsyReqHandle, 
       
   208                 reinterpret_cast< TInt*>( dataPtr ) );
       
   209             break;
       
   210 		case EPacketContextUpdateMbmsSessionList:
       
   211             ret = UpdateMbmsSessionList( 
       
   212              reinterpret_cast< TMbmsAction*>( dataPtr ),        
       
   213              reinterpret_cast< TMbmsSessionId*>( dataPtr2 ) );
       
   214             break;
       
   215         case EPacketGetMbmsSessionListPhase1:
       
   216             ret = GetMbmsActiveServicesPhase1L( aTsyReqHandle,
       
   217                 reinterpret_cast< RMobilePhone::TClientId*>( dataPtr ),
       
   218                 reinterpret_cast< TInt*>( dataPtr2 ) );
       
   219             break;
       
   220             
       
   221         case EPacketGetMbmsSessionListPhase2:
       
   222             ret = GetMbmsActiveServicesPhase2L( aTsyReqHandle,
       
   223                 reinterpret_cast< RMobilePhone::TClientId*>( dataPtr ),
       
   224                 aPackage.Des2n()  );
       
   225             break;            
       
   226         // These requests currently not supported
       
   227         case EPacketContextLoanCommPort:
       
   228         case EPacketContextRecoverCommPort:
       
   229         case EPacketContextNotifyDataTransferred:
       
   230         case EPacketContextGetProfileName:
       
   231         case EPacketContextGetConnectionSpeed:
       
   232         case EPacketContextGetDataVolumeTransferred:
       
   233         case EPacketContextEnumeratePacketFilters:
       
   234         case EPacketContextGetPacketFilterInfo:
       
   235         case EPacketContextAddPacketFilter:
       
   236         case EPacketContextRemovePacketFilter:
       
   237         case EPacketContextModifyActiveContext:
       
   238         case EPacketContextGetDNSInfo:
       
   239         case EPacketAddMediaAuthorization:
       
   240         case EPacketRemoveMediaAuthorization:
       
   241         default:
       
   242             break;
       
   243         }
       
   244 
       
   245     return ret;
       
   246     }
       
   247 
       
   248 
       
   249 
       
   250 // ---------------------------------------------------------------------------
       
   251 // CMmMBMSContextTsy::ReqModeL
       
   252 // Returns request mode for given IPC.
       
   253 // ---------------------------------------------------------------------------
       
   254 //
       
   255 CTelObject::TReqMode CMmMBMSContextTsy::ReqModeL( 
       
   256         TInt aIpc ) 
       
   257     {
       
   258 TFLOGSTRING2( "TSY: CMmMBMSContextTsy::ReqModeL. IPC: %d", aIpc );
       
   259 
       
   260     CTelObject::TReqMode reqMode( 0 );
       
   261     TBool doLeave( EFalse );
       
   262 
       
   263     switch ( aIpc )
       
   264         {
       
   265         // All disabled
       
   266         // TSYs wishing to implement their own buffering algorithm will place 
       
   267         // all requests in this category.  
       
   268 
       
   269         // Get methods that do not use DOS and return immediately. 
       
   270         // Flow control not required.
       
   271         case EPacketContextGetLastErrorCause:
       
   272 
       
   273         // Other methods that do not use DOS and return immediately. 
       
   274         // Flow control not required.
       
   275     
       
   276         // Methods that can propably take a long time and cannot therefore be
       
   277         // flow controlled. Solution: All these methods must check req handle
       
   278         // table before handling the request. In case that the request table 
       
   279         // indicates that same method has been called and has not been 
       
   280         // completed, the method should return KErrServerBusy.
       
   281 
       
   282         case EPacketContextGetStatus:
       
   283         case EPacketContextGetConfig:
       
   284             break;
       
   285 
       
   286         // KReqModeFlowControlObeyed
       
   287         // Commands that change the state of the phone, e.g. clearing the AoC 
       
   288         // counter, are commands that the TSY should only deal with one at 
       
   289         // a time.
       
   290         case EPacketContextUpdateMbmsSessionList:
       
   291         case EPacketContextInitialiseContext:
       
   292         case EPacketContextActivate:
       
   293         case EPacketContextDelete:
       
   294         case EPacketContextSetConfig:
       
   295         case EPacketContextAddPacketFilter:
       
   296         case EPacketContextRemovePacketFilter:
       
   297         
       
   298         case EPacketContextDeactivate:
       
   299             {
       
   300             reqMode = KReqModeFlowControlObeyed;
       
   301             break;
       
   302             }
       
   303 
       
   304         // KReqModeMultipleCompletionEnabled | ReqModePostImmediately
       
   305         // Requests that notify a client about a change of state.
       
   306         // Since these requests do not require the issuing of any modem 
       
   307         // commands, they do not have to obey flow control.
       
   308         // The TSY never gets more than one of these outstanding.
       
   309         case EPacketContextNotifyConfigChanged:
       
   310 
       
   311         case EPacketContextNotifyStatusChange:
       
   312             reqMode = KReqModeMultipleCompletionEnabled |
       
   313                 KReqModeRePostImmediately;
       
   314             break;
       
   315 
       
   316         case EPacketGetMbmsSessionListPhase1:
       
   317         case EPacketGetMbmsSessionListPhase2:
       
   318             reqMode = 0;
       
   319             break;
       
   320         // Cancel Requests
       
   321         // It's not necessary to include the Cancel methods in ReqModeL at all.
       
   322         // The ETel server never calls ReqModeL with a Cancel IPC.
       
   323 
       
   324         // Other variations of return values are unusable.
       
   325         // Following requests are not supported
       
   326         //case EPacketContextNotifyDataTransferred:
       
   327         //case EPacketContextLoanCommPort:
       
   328         //case EPacketContextRecoverCommPort:
       
   329         //case EPacketContextModifyActiveContext:
       
   330         // Default
       
   331         default:
       
   332             doLeave = ETrue;
       
   333             break;
       
   334         }
       
   335 
       
   336     if ( doLeave )
       
   337         {
       
   338         User::Leave( KErrNotSupported );
       
   339         }
       
   340 
       
   341     return reqMode;
       
   342     }
       
   343 
       
   344 // ---------------------------------------------------------------------------
       
   345 // CMmMBMSContextTsy::NumberOfSlotsL
       
   346 // Returns number of slots to be used for given IPC.
       
   347 // (other items were commented in a header).
       
   348 // ---------------------------------------------------------------------------
       
   349 //
       
   350 TInt CMmMBMSContextTsy::NumberOfSlotsL(    
       
   351         TInt aIpc )                            
       
   352     {
       
   353     TInt numberOfSlots( 0 );
       
   354 
       
   355     switch ( aIpc )
       
   356         {
       
   357         case EPacketContextNotifyStatusChange:
       
   358             numberOfSlots = KMmPacketContextNotifyStatusChangeSlots;
       
   359             break;
       
   360         case EPacketContextNotifyConfigChanged:
       
   361             numberOfSlots = KMmPacketContextNotifyConfigChangedSlots;
       
   362             break;
       
   363 
       
   364         default:
       
   365             // Unknown or invalid IPC
       
   366             User::Leave( KErrNotSupported );
       
   367             break;
       
   368 
       
   369         }  
       
   370 TFLOGSTRING3( "TSY: CMmMBMSContextTsy::NumberOfSlotsL. IPC: %d Number of slots: %d", aIpc, numberOfSlots );
       
   371 
       
   372     return numberOfSlots;
       
   373 
       
   374     }
       
   375 
       
   376 // ---------------------------------------------------------------------------
       
   377 // CMmMBMSContextTsy::CancelService
       
   378 // Cancel the outstanding request.ETel Server when it is "cleaning-up" any
       
   379 //  outstanding asynchronous requests before closing a client's sub-session.
       
   380 //  This will happen if a client closes its R-class handle without cancelling
       
   381 //  outstanding asynchronous requests. Only Packet API requests are handled 
       
   382 //  here. Client can also cancel a request by calling CancelAsyncRequest 
       
   383 //  (defined in etel.h). The ETel server passes this kind of cancel requests
       
   384 //  to CancelService.
       
   385 // (other items were commented in a header).
       
   386 // ---------------------------------------------------------------------------
       
   387 //
       
   388 TInt CMmMBMSContextTsy::CancelService(    
       
   389         TInt aIpc,                            
       
   390         TTsyReqHandle aTsyReqHandle )         
       
   391     {
       
   392 TFLOGSTRING3( "TSY: CMmMBMSContextTsy::CancelService. IPC: %d Handle:%d", aIpc, aTsyReqHandle );
       
   393 
       
   394     TInt ret( KErrNone );
       
   395 	//TTsyReqHandle reqHandle( NULL );
       
   396     // Reset last tsy request type
       
   397     iReqHandleType = EMultimodePacketMbmsReqHandleUnknown;
       
   398 
       
   399     switch ( aIpc )
       
   400         {
       
   401         // TSY has started a request and it is not possible to then cancel 
       
   402         // this request. The best thing for the TSY to do in this case is to
       
   403         // proceed as though the Cancel never happened. The server's call to
       
   404         // the TSY cancel function will return synchronously. The TSY then
       
   405         // continues to wait for the original acknowledgement and when it
       
   406         // receives it, the TSY will complete the original request.
       
   407         case EPacketContextUpdateMbmsSessionList:
       
   408         case EPacketContextInitialiseContext:
       
   409         case EPacketContextActivate:
       
   410         case EPacketContextDeactivate:
       
   411         case EPacketContextDelete:
       
   412         case EPacketContextSetConfig:
       
   413         case EPacketContextGetConfig:
       
   414             break;
       
   415         case EPacketGetMbmsSessionListPhase1:
       
   416             ret = CancelGetMbmsActiveServicesPhase1();
       
   417             break;
       
   418         // Notification Cancels, no special requirements.
       
   419         case EPacketContextNotifyStatusChange:
       
   420             iRetNotifyStatus = NULL;
       
   421             iReqHandleType = EMultimodeMbmsContextNotifyStatusChange;
       
   422             break;
       
   423         case EPacketContextNotifyConfigChanged:
       
   424             iRetNotifyConfig = NULL;
       
   425             iReqHandleType = EMultimodeMbmsContextNotifyConfigChanged;
       
   426             break;
       
   427 
       
   428         // IPCs that are not supported
       
   429         //case EPacketContextLoanCommPort:
       
   430         //case EPacketContextRecoverCommPort:
       
   431         //case EPacketContextNotifyDataTransferred:
       
   432         //case EPacketContextModifyActiveContext:
       
   433         // Default
       
   434         default:
       
   435             ret = KErrNotSupported;
       
   436             break;
       
   437         }
       
   438 
       
   439     if ( EMultimodePacketMbmsReqHandleUnknown != iReqHandleType )
       
   440         {
       
   441         // Reset tsy request handle
       
   442         iTsyReqHandleStore->ResetTsyReqHandle( iReqHandleType );
       
   443 
       
   444         // Complete request
       
   445         CMmMBMSContextTsy::ReqCompleted( aTsyReqHandle, KErrCancel );
       
   446         }
       
   447 
       
   448     return ret;
       
   449     }
       
   450 
       
   451 // ---------------------------------------------------------------------------
       
   452 // CMmMBMSContextTsy::RegisterNotification
       
   453 // Register notification. RegisterNotification is called when the ETel Server
       
   454 // recognises that this notification is being posted for the first time on
       
   455 // this subsession object.It enables the TSY to "turn on" any regular 
       
   456 // notification messages that it may receive from DOS. If this object is
       
   457 // Dial-Up context only supported notification is 
       
   458 // EPacketContextNotifyStatusChange.
       
   459 // (other items were commented in a header).
       
   460 // ---------------------------------------------------------------------------
       
   461 //
       
   462 TInt CMmMBMSContextTsy::RegisterNotification( 
       
   463         TInt aIpc )              
       
   464     {
       
   465 TFLOGSTRING2( "TSY: CMmMBMSContextTsy::RegisterNotification. IPC: %d", aIpc );
       
   466 
       
   467     TInt ret( KErrNone );
       
   468 
       
   469     switch ( aIpc )
       
   470         {
       
   471         case EPacketContextNotifyConfigChanged:
       
   472         case EPacketContextNotifyStatusChange:
       
   473             break;
       
   474         //case EPacketContextNotifyDataTransferred:
       
   475         default:
       
   476             // Not supported
       
   477             ret = KErrNotSupported;
       
   478             break;
       
   479         }
       
   480 
       
   481     return ret;
       
   482     }
       
   483 
       
   484 // ---------------------------------------------------------------------------
       
   485 // CMmMBMSContextTsy::DeregisterNotification
       
   486 // Deregister notification. DeregisterNotification is called when the ETel
       
   487 // Server recognises that this notification will not be posted again because 
       
   488 // the last client to have a handle on this sub-session object has just closed 
       
   489 // the handle. It enables the TSY to "turn off" any regular notification
       
   490 // messages that it may receive from DOS. If this object is Dial-Up context
       
   491 // only supported notification is EPacketContextNotifyStatusChange.
       
   492 // (other items were commented in a header).
       
   493 // ---------------------------------------------------------------------------
       
   494 //
       
   495 TInt CMmMBMSContextTsy::DeregisterNotification(
       
   496         TInt aIpc )                          
       
   497     {
       
   498 TFLOGSTRING2( "TSY: CMmMBMSContextTsy::DeregisterNotification. IPC: %d", aIpc );
       
   499 
       
   500     TInt ret( KErrNone );
       
   501 
       
   502     switch ( aIpc )
       
   503         {
       
   504         case EPacketContextNotifyConfigChanged:
       
   505         case EPacketContextNotifyStatusChange:
       
   506             break;
       
   507         //case EPacketContextNotifyDataTransferred:
       
   508         default:
       
   509             // Not supported
       
   510             ret = KErrNotSupported;
       
   511             break;
       
   512         }
       
   513 
       
   514     return ret;
       
   515     }
       
   516 
       
   517 // ---------------------------------------------------------------------------
       
   518 // CMmMBMSContextTsy::InitialiseContextL
       
   519 // This function initialises the context created previously.
       
   520 // (other items were commented in a header).
       
   521 // ---------------------------------------------------------------------------
       
   522 //
       
   523 TInt CMmMBMSContextTsy::InitialiseContextL( RPacketContext::TDataChannelV2* aDataChannel )
       
   524     {
       
   525 TFLOGSTRING2( "TSY: CMmMBMSContextTsy::InitialiseContextL. %S", &iContextName );
       
   526 
       
   527     TInt ret( KErrArgument ); 
       
   528    
       
   529     if ( iIsInitialiseAllowed )
       
   530        {
       
   531            CMmDataPackage dataPackage;
       
   532            dataPackage.PackData( &iContextName);
       
   533            iDataChannelV2 = aDataChannel;
       
   534         
       
   535            ret = iMmPacketService->MessageManager()->HandleRequestL(
       
   536         		  ECtsyPacketMbmsInitialiseContextReq, &dataPackage );
       
   537                     
       
   538            if( KErrNone == ret )
       
   539         	  {
       
   540         	  iIsInitialiseAllowed = EFalse;
       
   541         	  }	        
       
   542          }
       
   543 
       
   544         if ( KErrNone == ret )
       
   545           {
       
   546           // Store the request handle
       
   547           iReqHandleType = EMultimodePacketMbmsInitialiseContext;
       
   548           }
       
   549        
       
   550      
       
   551  
       
   552     return ret;
       
   553     }
       
   554 
       
   555 // ---------------------------------------------------------------------------
       
   556 // CMmMBMSContextTsy::CompleteInitialiseContext
       
   557 // Complete the asynchronous InitialiseContext request.
       
   558 // (other items were commented in a header).
       
   559 // ---------------------------------------------------------------------------
       
   560 //
       
   561 
       
   562 void CMmMBMSContextTsy::CompleteInitialiseContext(TInt aResult, RPacketContext::TDataChannelV2* aDataChannel )     
       
   563     {
       
   564 TFLOGSTRING2( "TSY: CMmMBMSContextTsy::CompleteInitialiseContext. Error: %d", aResult );
       
   565 
       
   566     iIsActivateAllowed = ETrue;
       
   567     if (KErrNone == aResult )
       
   568         {
       
   569         CompleteNotifyStatusChange( RPacketContext::EStatusInactive );
       
   570         if((aDataChannel != NULL) && (iDataChannelV2 != NULL))
       
   571         	{
       
   572         	*iDataChannelV2 = *aDataChannel;
       
   573         	iDataChannelV2 = NULL;
       
   574         	}
       
   575         // Set Dynamic Caps
       
   576         iMmPacketService->ActivePacketServiceExtension()->SetDynamicCapsFlag(
       
   577         		RPacketService::KCapsActivate, iIsActivateAllowed );
       
   578         }
       
   579     else
       
   580         {
       
   581         iIsInitialiseAllowed = ETrue;
       
   582         }        
       
   583 
       
   584     // Reset the req handle. Returns the deleted req handle
       
   585     TTsyReqHandle reqHandle = iTsyReqHandleStore->ResetTsyReqHandle(
       
   586         EMultimodePacketContextInitialiseContext );
       
   587 
       
   588     if ( EMultimodePacketContextReqHandleUnknown != reqHandle )
       
   589         {
       
   590         // Complete the client request
       
   591         ReqCompleted( reqHandle, aResult );
       
   592         }
       
   593     }
       
   594        
       
   595 // ---------------------------------------------------------------------------
       
   596 // CMmMBMSContextTsy::ActivateL
       
   597 // Activate a context. This function activates a context that has been
       
   598 // previously configured using the SetConfig() method from RPacketMbmsContext.
       
   599 // (other items were commented in a header).
       
   600 // ---------------------------------------------------------------------------
       
   601 //
       
   602 TInt CMmMBMSContextTsy::ActivateL()
       
   603     {
       
   604 TFLOGSTRING2( "TSY: CMmMBMSContextTsy::ActivateL. Context name:%S", &iContextName );
       
   605 	
       
   606     TInt ret( KErrNotReady );
       
   607 
       
   608     if ( iIsActivateAllowed )
       
   609         {        
       
   610         // verify that max activate context is not exceed
       
   611         if( iMmPacketService->MaximumActiveServices() >
       
   612             iMmPacketService->EnumerateMbmsActiveServices() )
       
   613             {            
       
   614             // mbmscontext activation        
       
   615             CMmDataPackage data;
       
   616             data.PackData( &iContextName );
       
   617             
       
   618             ret = iMmPacketService->MessageManager()->HandleRequestL(
       
   619                     EPacketContextActivate, &data );            
       
   620             } 
       
   621         else
       
   622             {
       
   623             // max number of possible active context exceed
       
   624             ret = KErrUmtsMaxNumOfContextExceededByPhone;
       
   625             }   
       
   626         if ( KErrNone == ret )
       
   627             {
       
   628             iIsActivateAllowed = EFalse;
       
   629             CompleteNotifyStatusChange( RPacketContext::EStatusActivating ); 
       
   630             }                    
       
   631         }
       
   632 
       
   633     if ( KErrNone == ret )
       
   634         {
       
   635         // Store the request handle
       
   636         iReqHandleType = EMultimodeMbmsContextActivate;
       
   637         }
       
   638 
       
   639     return ret;        
       
   640     }
       
   641 
       
   642 // ---------------------------------------------------------------------------
       
   643 // CMmMBMSContextTsy::CompleteActivate
       
   644 // Complete the asynchronous Activate request.
       
   645 // (other items were commented in a header).
       
   646 // ---------------------------------------------------------------------------
       
   647 //
       
   648 void CMmMBMSContextTsy::CompleteActivate(TInt aResult)
       
   649     {
       
   650 TFLOGSTRING2( "TSY: CMmMBMSContextTsy::CompleteActivate. Error: %d", aResult ); 
       
   651    
       
   652     // Reset the req handle. Returns the deleted req handle
       
   653     TTsyReqHandle reqHandle = iTsyReqHandleStore->ResetTsyReqHandle(
       
   654         EMultimodeMbmsContextActivate );
       
   655         
       
   656     if ( KErrNone == aResult )
       
   657         {
       
   658         
       
   659         CompleteNotifyConfigChanged();
       
   660 
       
   661         // Notify status change
       
   662         CompleteNotifyStatusChange( RPacketContext::EStatusActive );
       
   663         }        
       
   664     else
       
   665         {
       
   666 TFLOGSTRING2( "TSY: CMmMBMSContextTsy::CompleteActivate. ErrorCause: %d",
       
   667              aResult );
       
   668         // Re-activation is allowed because activation has not succeeded
       
   669         iIsActivateAllowed = ETrue;
       
   670         }
       
   671 
       
   672              
       
   673     if ( EMultimodePacketMbmsReqHandleUnknown != reqHandle )
       
   674         {
       
   675       
       
   676         // Complete the client request
       
   677         CMmMBMSContextTsy::ReqCompleted( reqHandle, aResult );
       
   678         }
       
   679     }
       
   680     
       
   681     
       
   682 // ---------------------------------------------------------------------------
       
   683 // CMmMBMSContextTsy::Deactivate
       
   684 // Deactivate a context previously configured on the phone.
       
   685 // (other items were commented in a header).
       
   686 // ---------------------------------------------------------------------------
       
   687 //
       
   688 TInt CMmMBMSContextTsy::DeactivateL()
       
   689     {
       
   690 TFLOGSTRING2( "TSY: CMmMBMSContextTsy::DeactivateL. Context name:%S", &iContextName );
       
   691 
       
   692     TInt ret( KErrArgument );
       
   693 
       
   694     CMmDataPackage data;
       
   695     data.PackData( &iContextName, &iServicesArray );
       
   696     ret = iMmPacketService->MessageManager()->HandleRequestL(
       
   697         EPacketContextDeactivate, &data );
       
   698 
       
   699     if ( KErrNone == ret )
       
   700         {
       
   701         iContextStatusBeforeDeactivation = ContextStatus();
       
   702         // Notify status change
       
   703         CompleteNotifyStatusChange( RPacketContext::EStatusDeactivating );        
       
   704 
       
   705         // Store the request handle
       
   706         iReqHandleType = EMultimodeMbmsContextDeactivate;
       
   707         }
       
   708 
       
   709     return ret;  
       
   710     }
       
   711 
       
   712 // ---------------------------------------------------------------------------
       
   713 // CMmMBMSContextTsy::CompleteDeactivate
       
   714 // Complete the asynchronous Deactivate request.
       
   715 // (other items were commented in a header).
       
   716 // ---------------------------------------------------------------------------
       
   717 //
       
   718 
       
   719 void CMmMBMSContextTsy::CompleteDeactivate( 
       
   720         CMmDataPackage* aDataPackage,
       
   721         TInt aResult )    
       
   722     {
       
   723 TFLOGSTRING2( "TSY: CMmMBMSContextTsy::CompleteDeactivate. Error: %d", aResult );
       
   724     // Reset the req handle. Returns the deleted req handle
       
   725     TTsyReqHandle reqHandle = iTsyReqHandleStore->ResetTsyReqHandle(
       
   726         EMultimodeMbmsContextDeactivate );
       
   727 
       
   728     // Notify status change
       
   729     if ( KErrNone == aResult )
       
   730         {                
       
   731         CompleteNotifyStatusChange( RPacketContext::EStatusInactive );
       
   732         // and reset possible session list
       
   733         if( iServicesArray )
       
   734             {                        
       
   735             iServicesArray->iSessionIdList.Reset();
       
   736             iServicesArray->iSessionIdList.Compress();
       
   737             }
       
   738         }
       
   739     else
       
   740         {
       
   741         CompleteNotifyStatusChange( iContextStatusBeforeDeactivation );
       
   742         
       
   743         // remove only entries which were succesfully removed
       
   744         if( (aDataPackage) && (aResult == KErrMbmsImpreciseServiceEntries) )
       
   745 	        {
       
   746 	        TInfoName* contextName = NULL;
       
   747 	        RPacketMbmsContext::CMbmsSession* listOfFailedEntries = NULL;
       
   748 	        aDataPackage->UnPackData( &contextName, &listOfFailedEntries);
       
   749 	        if( listOfFailedEntries )
       
   750 		        {
       
   751 		        for( TInt i = 0; i < listOfFailedEntries->iSessionIdList.Count(); i++ )
       
   752 		    	    {
       
   753 		        	for( TInt ii = 0; ii < iServicesArray->iSessionIdList.Count(); ii++ )
       
   754 			        	{
       
   755 			        	if( listOfFailedEntries->iSessionIdList[i] == iServicesArray->iSessionIdList[ii] )	
       
   756 					    	{
       
   757 					        iServicesArray->iSessionIdList.Remove(ii);	
       
   758 							iServicesArray->iSessionIdList.Compress();
       
   759 							ii = iServicesArray->iSessionIdList.Count();
       
   760 					        }	
       
   761 				        }
       
   762 			        }
       
   763 		        }
       
   764 	        }
       
   765         }
       
   766 
       
   767     // Complete the client request
       
   768     if ( EMultimodePacketMbmsReqHandleUnknown != reqHandle )
       
   769         {                
       
   770         CMmMBMSContextTsy::ReqCompleted( reqHandle, aResult );
       
   771         }
       
   772     }
       
   773 
       
   774 // ---------------------------------------------------------------------------
       
   775 // CMmMBMSContextTsy::DeleteL
       
   776 // Delete a context id previously created on the phone.
       
   777 // Note that although the context is considered as 'deleted', the 
       
   778 // client's RPacketMbmsContext subsession remains. To remove this, a client must
       
   779 // call Close() from RPacketMbmsContext.
       
   780 // (other items were commented in a header).
       
   781 // ---------------------------------------------------------------------------
       
   782 //
       
   783 TInt CMmMBMSContextTsy::DeleteL()
       
   784     {
       
   785 TFLOGSTRING2( "TSY: CMmMBMSContextTsy::DeleteL. Context name:%S", &iContextName );
       
   786 
       
   787     TInt ret( KErrNotReady );
       
   788     if( RPacketContext::EStatusUnknown != ContextStatus() )
       
   789         {
       
   790         CMmDataPackage data;
       
   791         data.PackData( &iContextName );
       
   792 
       
   793         ret = iMmPacketService->MessageManager()->HandleRequestL(
       
   794             EPacketContextDelete, &data );
       
   795 
       
   796         }
       
   797 
       
   798     if ( KErrNone == ret )
       
   799         {
       
   800         // Store the request handle
       
   801         iReqHandleType = EMultimodeMbmsContextDelete;
       
   802         }
       
   803 
       
   804     return ret;
       
   805     }
       
   806 
       
   807 // ---------------------------------------------------------------------------
       
   808 // CMmMBMSContextTsy::CompleteDelete
       
   809 // Complete the asynchronous Delete request.
       
   810 // (other items were commented in a header).
       
   811 // ---------------------------------------------------------------------------
       
   812 //
       
   813 
       
   814 void CMmMBMSContextTsy::CompleteDelete( 
       
   815         TInt aResult )        
       
   816     {
       
   817 TFLOGSTRING2( "TSY: CMmMBMSContextTsy::CompleteDelete. Error: %d", aResult );
       
   818 
       
   819     if( KErrNone == aResult )
       
   820         {
       
   821         iContextStatusBeforeDeactivation = RPacketContext::EStatusDeleted;
       
   822 
       
   823         // Notify status change
       
   824         CompleteNotifyStatusChange( RPacketContext::EStatusDeleted );
       
   825 
       
   826         delete iConfig;
       
   827         iConfig = NULL;            
       
   828         }
       
   829 
       
   830     // Reset the req handle. Returns the deleted req handle
       
   831     TTsyReqHandle reqHandle = iTsyReqHandleStore->ResetTsyReqHandle(
       
   832         EMultimodeMbmsContextDelete );
       
   833 
       
   834     if ( EMultimodePacketMbmsReqHandleUnknown != reqHandle )
       
   835         {
       
   836         // Complete the client request
       
   837         CMmMBMSContextTsy::ReqCompleted( reqHandle, aResult );
       
   838         }
       
   839     }
       
   840 
       
   841 // ---------------------------------------------------------------------------
       
   842 // CMmMBMSContextTsy::GetConfig
       
   843 // Requests the current configuration of the context.
       
   844 // (other items were commented in a header).
       
   845 // ---------------------------------------------------------------------------
       
   846 //
       
   847 TInt CMmMBMSContextTsy::GetConfig(
       
   848         TTsyReqHandle aTsyReqHandle,    
       
   849         TPacketDataConfigBase* aConfig )  
       
   850     {
       
   851 TFLOGSTRING2( "TSY: CMmMBMSContextTsy::GetConfig. Context name:%S", &iContextName );
       
   852     TInt ret( KErrNone );
       
   853     
       
   854     // Check that the mode given in aConfig is KConfigMBMS
       
   855     if ( TPacketDataConfigBase::KConfigMBMS == aConfig->ExtensionId() )
       
   856         {
       
   857         // Set configuration data to ETel side memory
       
   858         *( RPacketMbmsContext::TContextConfigMbmsV1* )aConfig =
       
   859         	*iConfig;
       
   860         }
       
   861     else
       
   862         {
       
   863         // Given mode is not supported
       
   864         ret = KErrArgument;
       
   865         }    
       
   866 
       
   867     // Complete Request
       
   868     CMmMBMSContextTsy::ReqCompleted( aTsyReqHandle, ret );
       
   869 
       
   870     return KErrNone;
       
   871     }
       
   872 
       
   873 // ---------------------------------------------------------------------------
       
   874 // CMmMBMSContextTsy::GetLastErrorCause
       
   875 // This function retrieves the last error cause to have occurred.
       
   876 // (other items were commented in a header).
       
   877 // ---------------------------------------------------------------------------
       
   878 //
       
   879 TInt CMmMBMSContextTsy::GetLastErrorCause(
       
   880         TTsyReqHandle aTsyReqHandle,  
       
   881         TInt* aError )    
       
   882     {
       
   883 TFLOGSTRING3( "TSY: CMmMBMSContextTsy::GetLastErrorCause. Context name:%S Last error cause: %d", &iContextName, iLastErrorCause );
       
   884 
       
   885     *aError = iLastErrorCause;
       
   886     CMmMBMSContextTsy::ReqCompleted( aTsyReqHandle, KErrNone );
       
   887 
       
   888     return KErrNone;
       
   889     }
       
   890 
       
   891 // ---------------------------------------------------------------------------
       
   892 // CMmMBMSContextTsy::SetLastErrorCause
       
   893 // Set the last error cause.
       
   894 // (other items were commented in a header).
       
   895 // ---------------------------------------------------------------------------
       
   896 //
       
   897 void CMmMBMSContextTsy::SetLastErrorCause(
       
   898         TInt aErrorCause ) 
       
   899     {
       
   900     
       
   901      iLastErrorCause =  aErrorCause;           
       
   902     
       
   903 TFLOGSTRING3( "TSY: CMmMBMSContextTsy::SetLastErrorCause.  aErrorCause: %d iLastErrorCause:%d", 
       
   904              aErrorCause, iLastErrorCause );
       
   905 
       
   906     }
       
   907 
       
   908 // ---------------------------------------------------------------------------
       
   909 // CMmMBMSContextTsy::GetStatus
       
   910 // Allows a client to get the current status of the context.
       
   911 // (other items were commented in a header).
       
   912 // ---------------------------------------------------------------------------
       
   913 //
       
   914 TInt CMmMBMSContextTsy::GetStatus(
       
   915         TTsyReqHandle aTsyReqHandle,   
       
   916         RPacketContext::TContextStatus* aContextStatus )
       
   917     {
       
   918 TFLOGSTRING3( "TSY: CMmMBMSContextTsy::GetStatus. Context name: %S Context Status:%d", &iContextName, iContextStatus );
       
   919     *aContextStatus = iContextStatus;
       
   920     CMmMBMSContextTsy::ReqCompleted( aTsyReqHandle, KErrNone );
       
   921 
       
   922     return KErrNone;
       
   923     }
       
   924 
       
   925 // ---------------------------------------------------------------------------
       
   926 // CMmMBMSContextTsy::NotifyConfigChanged
       
   927 // Requests notification when configuration of context changes.
       
   928 // (other items were commented in a header).
       
   929 // ---------------------------------------------------------------------------
       
   930 //
       
   931 TInt CMmMBMSContextTsy::NotifyConfigChanged(
       
   932         TPacketDataConfigBase* aConfig )  
       
   933     {
       
   934 TFLOGSTRING( "TSY: CMmMBMSContextTsy::NotifyConfigChanged." );
       
   935 
       
   936     // Check that used mode is MBMS
       
   937     if (  TPacketDataConfigBase::KConfigMBMS != aConfig->ExtensionId() ) 
       
   938         {
       
   939         return KErrArgument;
       
   940         }
       
   941 
       
   942     // Store pointer
       
   943     iRetNotifyConfig = aConfig;
       
   944     // Store req handle type
       
   945     iReqHandleType = EMultimodeMbmsContextNotifyConfigChanged;        
       
   946 
       
   947     return KErrNone;
       
   948     }
       
   949 
       
   950 // ---------------------------------------------------------------------------
       
   951 // CMmMBMSContextTsy::CompleteNotifyConfigChanged
       
   952 // Complete notification when the context configuration changes.
       
   953 // (other items were commented in a header).
       
   954 // ---------------------------------------------------------------------------
       
   955 //
       
   956 void CMmMBMSContextTsy::CompleteNotifyConfigChanged(const CMmDataPackage* aDataPackage,
       
   957         TInt aResult)
       
   958     {
       
   959 TFLOGSTRING2( "TSY: CMmMBMSContextTsy::CompleteNotifyConfigChanged.  Context name:%S",
       
   960                 &iContextName );
       
   961 	if(aDataPackage != NULL)
       
   962 		{
       
   963 		if ( KErrNone == aResult )
       
   964 		    {
       
   965 		    RPacketMbmsContext::TContextConfigMbmsV1* aConfig = NULL;
       
   966 		    TInfoName* name = NULL;
       
   967 		    aDataPackage->UnPackData( &name, &aConfig );
       
   968 		
       
   969 		    if( NULL != aConfig )
       
   970 		        {
       
   971 		        iConfig->iTmgi = aConfig->iTmgi;
       
   972 		        iConfig->iMbmsAccessBearer = aConfig->iMbmsAccessBearer;
       
   973 		        iConfig->iMbmsServicePriority = aConfig->iMbmsServicePriority;
       
   974 		        iConfig->iMbmsServiceMode = aConfig->iMbmsServiceMode;
       
   975 		        iConfig->iMbmsSessionFlag = aConfig->iMbmsSessionFlag;
       
   976 		       
       
   977 		        }
       
   978 		    }
       
   979 		}
       
   980 
       
   981     // Get and reset req handle 
       
   982     TTsyReqHandle reqHandle = iTsyReqHandleStore->ResetTsyReqHandle(
       
   983         EMultimodeMbmsContextNotifyConfigChanged );
       
   984 
       
   985     if ( EMultimodePacketContextReqHandleUnknown != reqHandle )
       
   986         {
       
   987 #ifdef USING_CTSY_DISPATCHER
       
   988     	//CTSY defect, request is completed with KErrNone, aResult ignored.
       
   989     	if( (iConfig) && (aResult == KErrNone) )
       
   990 #else
       
   991         if( NULL != iConfig )
       
   992 #endif //USING_CTSY_DISPATCHER
       
   993 	        {
       
   994 	        	        
       
   995 	        *( RPacketMbmsContext::TContextConfigMbmsV1* )iRetNotifyConfig = *iConfig;
       
   996 	        // Null ret pointer
       
   997 	        iRetNotifyConfig = NULL;	
       
   998 	        }
       
   999         
       
  1000         // Complete the client request
       
  1001 #ifdef USING_CTSY_DISPATCHER    	
       
  1002         CMmMBMSContextTsy::ReqCompleted( reqHandle, aResult );
       
  1003 #else
       
  1004         CMmMBMSContextTsy::ReqCompleted( reqHandle, KErrNone );
       
  1005 #endif //USING_CTSY_DISPATCHER
       
  1006         }
       
  1007     }
       
  1008 
       
  1009 // ---------------------------------------------------------------------------
       
  1010 // CMmMBMSContextTsy::NotifyStatusChange
       
  1011 // Requests notification when the status of the context changes.
       
  1012 // (other items were commented in a header).
       
  1013 // ---------------------------------------------------------------------------
       
  1014 //
       
  1015 TInt CMmMBMSContextTsy::NotifyStatusChange(
       
  1016         RPacketContext::TContextStatus* aContextStatus )
       
  1017     {
       
  1018 TFLOGSTRING2( "TSY: CMmMBMSContextTsy::NotifyStatusChange. Context name:%S", &iContextName );
       
  1019     iRetNotifyStatus = aContextStatus;
       
  1020     iReqHandleType = EMultimodeMbmsContextNotifyStatusChange;
       
  1021 
       
  1022     return KErrNone;
       
  1023     }
       
  1024 
       
  1025 // ---------------------------------------------------------------------------
       
  1026 // CMmMBMSContextTsy::CompleteNotifyStatusChange
       
  1027 // Complete the notification when the context status changes.
       
  1028 // (other items were commented in a header).
       
  1029 // ---------------------------------------------------------------------------
       
  1030 //
       
  1031 void CMmMBMSContextTsy::CompleteNotifyStatusChange(
       
  1032             RPacketContext::TContextStatus aContextStatus  )
       
  1033     {
       
  1034     if ( aContextStatus != iContextStatus )
       
  1035         {
       
  1036         iContextStatus = aContextStatus;
       
  1037 TFLOGSTRING3( "TSY: CMmMBMSContextTsy::CompleteNotifyStatusChange. Context name: %S  Context status:%d",
       
  1038                     &iContextName, iContextStatus );   
       
  1039                     
       
  1040         if ( RPacketContext::EStatusActive == iContextStatus ||
       
  1041              RPacketContext::EStatusInactive == iContextStatus ||
       
  1042              RPacketContext::EStatusDeleted == iContextStatus )
       
  1043             {
       
  1044             iMmPacketService->ContextStatusChanged( iContextStatus );
       
  1045             if( RPacketContext::EStatusDeleted == iContextStatus )
       
  1046                 {
       
  1047                 iContextStatusBeforeDeactivation = RPacketContext::EStatusDeleted;
       
  1048                 }
       
  1049             }
       
  1050 
       
  1051 		// if context status is receiving, update dynamic caps
       
  1052         if ( RPacketContext::EStatusReceiving == iContextStatus)
       
  1053             {
       
  1054             iMmPacketService->ActivePacketServiceExtension()->SetDynamicCapsFlag( RPacketService::KCapsMBMS, ETrue );
       
  1055             }
       
  1056         // context status is changing from receiving to something else
       
  1057         else
       
  1058 	        {
       
  1059 	        iMmPacketService->ActivePacketServiceExtension()->SetDynamicCapsFlag( RPacketService::KCapsMBMS, EFalse );
       
  1060 	        }
       
  1061 		
       
  1062         // Reset req handle. Returns the deleted req handle
       
  1063         TTsyReqHandle reqHandle = iTsyReqHandleStore->ResetTsyReqHandle( 
       
  1064             EMultimodeMbmsContextNotifyStatusChange );
       
  1065 
       
  1066         if (( EMultimodePacketMbmsReqHandleUnknown != reqHandle ) && (iRetNotifyStatus != NULL)) 
       
  1067             {
       
  1068             // Get current status
       
  1069             *iRetNotifyStatus = aContextStatus;
       
  1070             // Null ret pointer
       
  1071             iRetNotifyStatus = NULL;
       
  1072             // Complete the client request
       
  1073             CMmMBMSContextTsy::ReqCompleted( reqHandle, KErrNone );
       
  1074             }
       
  1075         }    
       
  1076     }
       
  1077 
       
  1078 // ---------------------------------------------------------------------------
       
  1079 // CMmMBMSContextTsy::CompleteNotifyStatusChange
       
  1080 // Complete the notification when the context status changes.
       
  1081 // (other items were commented in a header).
       
  1082 // ---------------------------------------------------------------------------
       
  1083 //
       
  1084 void CMmMBMSContextTsy::CompleteNotifyStatusChange(
       
  1085         const CMmDataPackage* aDataPackage,
       
  1086         TInt aResult ) 
       
  1087     {
       
  1088     if( KErrNone != aResult )
       
  1089         {
       
  1090         SetLastErrorCause( aResult );
       
  1091         }
       
  1092     else
       
  1093     	{
       
  1094     	TInfoName* null= NULL;
       
  1095     	RPacketContext::TContextStatus contextStatus;
       
  1096     
       
  1097     	//initialise struct for completion params   
       
  1098     	TContextMisc misc;
       
  1099     
       
  1100     	aDataPackage->UnPackData( null, misc );
       
  1101     	contextStatus = misc.iStatus;
       
  1102 
       
  1103     	CMmMBMSContextTsy::CompleteNotifyStatusChange(contextStatus);
       
  1104     	}
       
  1105                          
       
  1106     }
       
  1107 
       
  1108 // ---------------------------------------------------------------------------
       
  1109 // CMmMBMSContextTsy::SetConfigL
       
  1110 // Configure a context to the phone.
       
  1111 // (other items were commented in a header).
       
  1112 // ---------------------------------------------------------------------------
       
  1113 //
       
  1114 TInt CMmMBMSContextTsy::SetConfigL(
       
  1115         TPacketDataConfigBase* aConfig ) 
       
  1116     {
       
  1117 TFLOGSTRING2( "TSY: CMmMBMSContextTsy::SetConfigL. Context name:%S", &iContextName );
       
  1118 
       
  1119     TInt ret( KErrArgument );
       
  1120            
       
  1121     if ( TPacketDataConfigBase::KConfigMBMS == aConfig->ExtensionId() )
       
  1122         {
       
  1123         if( !iIsInitialiseAllowed )
       
  1124             {
       
  1125             
       
  1126             RPacketMbmsContext::TContextConfigMbmsV1* configMbms = 
       
  1127                 ( RPacketMbmsContext::TContextConfigMbmsV1* )aConfig;  
       
  1128 
       
  1129             if ( NULL == iTempConfig )
       
  1130                 {
       
  1131                 // Allocate memory for iTempConfig
       
  1132                 iTempConfig = 
       
  1133                     new ( ELeave ) RPacketMbmsContext::TContextConfigMbmsV1();
       
  1134                 }
       
  1135 
       
  1136              // Temporary store the configMBMS
       
  1137             *iTempConfig = *configMbms;
       
  1138 
       
  1139             CMmDataPackage data;
       
  1140             data.PackData( &( *aConfig ), &iContextName );
       
  1141 
       
  1142 TFLOGSTRING2("TSY: CMmMBMSContextTsy::SetConfigL. Context: %S", &iContextName);
       
  1143 
       
  1144             ret = iMmPacketService->MessageManager()->HandleRequestL(
       
  1145                 EPacketContextSetConfig, &data ); 
       
  1146     
       
  1147             if ( KErrNone != ret )
       
  1148                 {
       
  1149                 // Release the memory allocated for iTempConfig
       
  1150                 delete iTempConfig;
       
  1151                 iTempConfig = NULL;
       
  1152                 }
       
  1153             }
       
  1154         else
       
  1155             {
       
  1156             ret = KErrNotReady;
       
  1157             }
       
  1158         }
       
  1159                  
       
  1160     if ( KErrNone == ret )
       
  1161         {
       
  1162         // Store the request handle type
       
  1163         iReqHandleType = EMultimodePacketMbmsContextSetConfig;
       
  1164         }             
       
  1165 
       
  1166     return ret;
       
  1167     }
       
  1168 
       
  1169 // ---------------------------------------------------------------------------
       
  1170 // CMmMBMSContextTsy::CompleteSetConfig
       
  1171 // Complete the asynchronous SetConfig request.
       
  1172 // (other items were commented in a header).
       
  1173 // ---------------------------------------------------------------------------
       
  1174 //
       
  1175 void CMmMBMSContextTsy::CompleteSetConfig( 
       
  1176         TInt aError )
       
  1177     {
       
  1178 TFLOGSTRING2( "TSY: CMmMBMSContextTsy::CompleteSetConfig. Error: %d", aError );
       
  1179     
       
  1180     if( (KErrNone == aError) && (iConfig) && (iTempConfig) )
       
  1181 	    {
       
  1182 	    *iConfig = *iTempConfig;  
       
  1183 	    // Release the memory allocated for iTempConfig
       
  1184 	    delete iTempConfig;
       
  1185 	    iTempConfig = NULL;
       
  1186 	    CompleteNotifyConfigChanged();    
       
  1187 	    }
       
  1188 
       
  1189     TTsyReqHandle reqHandle( EMultimodePacketMbmsReqHandleUnknown );
       
  1190     reqHandle = iTsyReqHandleStore->ResetTsyReqHandle(EMultimodePacketMbmsContextSetConfig );
       
  1191 
       
  1192     if ( EMultimodePacketMbmsReqHandleUnknown != reqHandle )
       
  1193     	{
       
  1194     	// Complete the client request
       
  1195     	CMmMBMSContextTsy::ReqCompleted( reqHandle, aError );
       
  1196     	}
       
  1197 	    	
       
  1198     }
       
  1199 
       
  1200 
       
  1201 // ---------------------------------------------------------------------------
       
  1202 // CMmMBMSContextTsy::ContextStatus
       
  1203 // Return current context status.
       
  1204 // (other items were commented in a header).
       
  1205 // ---------------------------------------------------------------------------
       
  1206 //
       
  1207 RPacketContext::TContextStatus CMmMBMSContextTsy::ContextStatus() const
       
  1208     {
       
  1209     return iContextStatus;
       
  1210     }
       
  1211 
       
  1212 // ---------------------------------------------------------------------------
       
  1213 // CMmMBMSContextTsy::ReqCompleted
       
  1214 // Overloads CTelObject::ReqCompleted.
       
  1215 // (other items were commented in a header).
       
  1216 // ---------------------------------------------------------------------------
       
  1217 //
       
  1218 
       
  1219 void CMmMBMSContextTsy::ReqCompleted(
       
  1220         TTsyReqHandle aTsyReqHandle, 
       
  1221         TInt aError )   
       
  1222     {
       
  1223 TFLOGSTRING3( "TSY: CMmMBMSContextTsy::ReqCompleted. Handle:%d Error:%d",  aTsyReqHandle, aError );
       
  1224 
       
  1225     // Set last error cause
       
  1226     if ( KErrNone != aError )
       
  1227         {
       
  1228         iLastErrorCause = aError;
       
  1229         }
       
  1230 
       
  1231     CTelObject::ReqCompleted( aTsyReqHandle, aError );
       
  1232 
       
  1233     }
       
  1234 
       
  1235 #ifdef REQHANDLE_TIMER
       
  1236 
       
  1237     
       
  1238 // ---------------------------------------------------------------------------
       
  1239 // CMmMBMSContextTsy::SetTypeOfResponse
       
  1240 // Sets the type of response for a given request handle. Automatic mode 
       
  1241 // includes an automatic response in case of non response from the DOS in a
       
  1242 // specified time. This method is used only if REQHANDLE_TIMER is in use.
       
  1243 // ---------------------------------------------------------------------------
       
  1244 //
       
  1245 void CMmMBMSContextTsy::SetTypeOfResponse(
       
  1246         TInt aReqHandleType,               
       
  1247         TTsyReqHandle aTsyReqHandle )       
       
  1248     {
       
  1249     TInt timeOut( 0 );
       
  1250 
       
  1251     // Set timeout by req handle type
       
  1252     switch ( aReqHandleType )
       
  1253         {
       
  1254     	case EMultimodePacketMbmsInitialiseContext:
       
  1255             timeOut = KMmPacketContextInitialiseContextTimeOut;
       
  1256             break;
       
  1257         case EMultimodePacketMbmsContextSetConfig:
       
  1258             timeOut = KMmPacketContextSetConfigTimeOut;
       
  1259             break;
       
  1260         case EMultimodeMbmsContextActivate:
       
  1261             timeOut = KMmPacketContextActivateTimeOut;
       
  1262             break;
       
  1263         case EMultimodeMbmsContextDeactivate:
       
  1264             timeOut = KMmPacketContextDeactivateTimeOut;
       
  1265             break;
       
  1266         case EMultimodeMbmsContextDelete:
       
  1267             timeOut = KMmPacketContextDeleteTimeOut;
       
  1268             break;
       
  1269         case EMultimodeMbmsContextUpdateMbmsSessionList:
       
  1270             timeOut = KMmPacketContextModifyActiveContext;
       
  1271             break;        
       
  1272         // Can't use timer:
       
  1273         // - all notifications
       
  1274         //case EMultimodePacketContextNotifyConfigChanged:
       
  1275         //case EMultimodePacketContextNotifyConnectionSpeedChange:
       
  1276         //case EMultimodePacketContextNotifyStatusChange:
       
  1277         default:
       
  1278             // Do not use timer
       
  1279             iTsyReqHandleStore->SetTsyReqHandle( aReqHandleType, 
       
  1280                 aTsyReqHandle );
       
  1281             break;
       
  1282         }
       
  1283 
       
  1284     if ( 0 < timeOut )
       
  1285         {
       
  1286         // The timeout parameter is given in seconds.
       
  1287         iTsyReqHandleStore->SetTsyReqHandle( aReqHandleType, aTsyReqHandle, 
       
  1288             timeOut );
       
  1289         }
       
  1290 
       
  1291     }
       
  1292 
       
  1293 // ---------------------------------------------------------------------------
       
  1294 // CMmMBMSContextTsy::Complete
       
  1295 // Completes the request due the timer expiration. This method is used only if
       
  1296 // REQHANDLE_TIMER is in use. 
       
  1297 // ---------------------------------------------------------------------------
       
  1298 // 
       
  1299 void CMmMBMSContextTsy::Complete(
       
  1300         const TInt aReqHandleType,    
       
  1301         const TInt aError )        
       
  1302     {
       
  1303 TFLOGSTRING2( "TSY: CMmMBMSContextTsy::Complete. Req type %d", aReqHandleType );
       
  1304     
       
  1305     
       
  1306     // All possible TSY req handle types are listed in the
       
  1307     // switch case below.
       
  1308     switch ( aReqHandleType )
       
  1309         {
       
  1310         case EMultimodePacketMbmsInitialiseContext:
       
  1311             CMmMBMSContextTsy::CompleteInitialiseContext( aError, NULL );
       
  1312             break;
       
  1313         case EMultimodePacketMbmsContextSetConfig:
       
  1314             CMmMBMSContextTsy::CompleteSetConfig( aError );
       
  1315             break;
       
  1316         case EMultimodeMbmsContextActivate:
       
  1317             CMmMBMSContextTsy::CompleteActivate( aError );
       
  1318             break;
       
  1319         case EMultimodeMbmsContextDeactivate:
       
  1320             CMmMBMSContextTsy::CompleteDeactivate( NULL, aError );
       
  1321             break;
       
  1322         case EMultimodeMbmsContextDelete:
       
  1323             CMmMBMSContextTsy::CompleteDelete( aError );
       
  1324             break;
       
  1325         case EMultimodeMbmsContextUpdateMbmsSessionList:
       
  1326             CMmMBMSContextTsy::CompleteUpdateMbmsSessionList( aError );
       
  1327             break;
       
  1328         // Can't use timer:
       
  1329         // - all notifications
       
  1330         //case EMultimodePacketContextNotifyConfigChanged:
       
  1331         //case EMultimodePacketContextNotifyConnectionSpeedChange:
       
  1332         //case EMultimodePacketContextNotifyStatusChange:
       
  1333         default:
       
  1334             CMmMBMSContextTsy::ReqCompleted( iTsyReqHandleStore->
       
  1335 				ResetTsyReqHandle( aReqHandleType ), aError );
       
  1336             break;
       
  1337         }
       
  1338 
       
  1339     }
       
  1340 
       
  1341 #endif // REQHANDLE_TIMER
       
  1342 
       
  1343 // ---------------------------------------------------------------------------
       
  1344 // CMmMBMSContextTsy::IsContextActivationAllowed
       
  1345 // Tells if context activation is allowed.
       
  1346 // (other items were commented in a header).
       
  1347 // ---------------------------------------------------------------------------
       
  1348 //    
       
  1349 TBool CMmMBMSContextTsy::IsContextActivationAllowed() const
       
  1350     {
       
  1351         return iIsActivateAllowed;
       
  1352     }
       
  1353 
       
  1354 // ---------------------------------------------------------------------------
       
  1355 // CMmMBMSContextTsy::ContextName
       
  1356 // This method returns name of this context
       
  1357 // (other items were commented in a header).
       
  1358 // ---------------------------------------------------------------------------
       
  1359 //
       
  1360 const TInfoName &CMmMBMSContextTsy::ContextName() const
       
  1361     {
       
  1362     return iContextName;
       
  1363     }
       
  1364 
       
  1365 
       
  1366 // ---------------------------------------------------------------------------
       
  1367 // CMmMBMSContextTsy::ContextIndex
       
  1368 // This method returns name of this context
       
  1369 // (other items were commented in a header).
       
  1370 // ---------------------------------------------------------------------------
       
  1371 // 
       
  1372 TInt CMmMBMSContextTsy::ContextIndex() const
       
  1373     {
       
  1374     return iObjectId;
       
  1375     }
       
  1376      
       
  1377 // ---------------------------------------------------------------------------
       
  1378 // CMmMBMSContextTsy::UpdateMbmsSessionList
       
  1379 // Method to change content of session list
       
  1380 // (other items were commented in a header).
       
  1381 // ---------------------------------------------------------------------------
       
  1382 //         
       
  1383 TInt CMmMBMSContextTsy::UpdateMbmsSessionList( 
       
  1384     TMbmsAction* aAction,
       
  1385     TMbmsSessionId* aSession ) 
       
  1386     {
       
  1387 TFLOGSTRING3("TSY: CMmMBMSContextTsy::UpdateMbmsSessionList. Context: %S, action: %d", &iContextName, aAction);    
       
  1388     TInt ret( KErrNone );
       
  1389     
       
  1390     if( iConfig->iMbmsSessionFlag )
       
  1391         {
       
  1392         iAction = *aAction;
       
  1393         iSession = *aSession;
       
  1394         
       
  1395         // changes send to LTSY
       
  1396         TMmMbmsActiveServiceListParams activeServiceList;
       
  1397         activeServiceList.iActionType = iAction;
       
  1398         activeServiceList.iServiceList = iServicesArray;
       
  1399         activeServiceList.iChangedItem = iSession;
       
  1400          
       
  1401         CMmDataPackage data;
       
  1402         data.PackData( &iContextName, &activeServiceList );
       
  1403 
       
  1404         TRAPD(err, ret = iMmPacketService->MessageManager()->HandleRequestL(
       
  1405                     EPacketContextUpdateMbmsSessionList, &data ));
       
  1406 		if(err !=KErrNone)
       
  1407 			{
       
  1408 			ret = err;
       
  1409 			}
       
  1410         }
       
  1411     else
       
  1412         // this context does not support sessions
       
  1413         {
       
  1414         ret = KErrNotSupported;
       
  1415         }
       
  1416                 
       
  1417     if ( KErrNone == ret )
       
  1418         {
       
  1419         // Store the request handle type
       
  1420         iReqHandleType = EMultimodeMbmsContextUpdateMbmsSessionList;
       
  1421         }                   
       
  1422     
       
  1423     return ret;
       
  1424     }
       
  1425 
       
  1426 // ---------------------------------------------------------------------------
       
  1427 // CMmMBMSContextTsy::CompleteUpdateMbmsSessionList
       
  1428 // Complete change in content of session list to client
       
  1429 // (other items were commented in a header).
       
  1430 // ---------------------------------------------------------------------------
       
  1431 //         
       
  1432 void CMmMBMSContextTsy::CompleteUpdateMbmsSessionList( 
       
  1433         const TInt aResult )
       
  1434     {
       
  1435 TFLOGSTRING3("TSY: CMmMBMSContextTsy::CompleteUpdateMbmsSessionList. Context: %S, result: %d", &iContextName, aResult);    
       
  1436     
       
  1437     TInt ret( aResult );
       
  1438    
       
  1439     if( iMmPacketService->MaximumActiveServices() > iMmPacketService->EnumerateMbmsActiveServices() )  
       
  1440         {        
       
  1441         if( KErrNone == ret  )
       
  1442             {
       
  1443             switch( iAction )
       
  1444                 {
       
  1445                 case EAddEntries:
       
  1446                     {
       
  1447                     // verify that item id does not exists
       
  1448                     for( TInt i=0; i<iServicesArray->iSessionIdList.Count(); i++ )
       
  1449                         {
       
  1450                         if( iServicesArray->iSessionIdList[i] == iSession )
       
  1451                             {
       
  1452                             // item already exists
       
  1453                             ret = KErrAlreadyExists;
       
  1454                             i = iServicesArray->iSessionIdList.Count();
       
  1455                             }
       
  1456                         }
       
  1457                     // if ID is a new one; add it to array
       
  1458                     if( KErrNone == ret )
       
  1459                         {
       
  1460                         iServicesArray->iSessionIdList.Append(iSession);
       
  1461                         iServicesArray->iSessionIdList.Compress();
       
  1462                         }
       
  1463                     break;
       
  1464                     }                	
       
  1465                 case ERemoveEntries:
       
  1466             	    {
       
  1467             	    TInt idx( -1 );
       
  1468             	    // find index of item to remove
       
  1469                     for( TInt i=0; i<iServicesArray->iSessionIdList.Count(); i++ )
       
  1470                         {
       
  1471                         if( iServicesArray->iSessionIdList[i] == iSession )
       
  1472                             {
       
  1473                             idx = i;
       
  1474                             i = iServicesArray->iSessionIdList.Count();
       
  1475                             }
       
  1476                         }
       
  1477                     // item is in array, remove it
       
  1478                     if( 0 <= idx )
       
  1479                         {
       
  1480                         iServicesArray->iSessionIdList.Remove(idx);
       
  1481                         iServicesArray->iSessionIdList.Compress();
       
  1482                         }        	    
       
  1483                     else
       
  1484                         {                    
       
  1485                         ret = KErrNotFound;
       
  1486                         }
       
  1487                     break;
       
  1488             	    
       
  1489             	    }
       
  1490                 case ERemoveAllEntries:
       
  1491                     {
       
  1492                     // just empty array
       
  1493                     iServicesArray->iSessionIdList.Reset();
       
  1494                     iServicesArray->iSessionIdList.Compress();
       
  1495                     break;
       
  1496                     }
       
  1497                 default:
       
  1498                     break;                
       
  1499                 }        
       
  1500             }
       
  1501         }
       
  1502     else
       
  1503         {
       
  1504         ret = KErrOverflow;
       
  1505         }
       
  1506         
       
  1507     TTsyReqHandle reqHandle = iTsyReqHandleStore->ResetTsyReqHandle(
       
  1508             EMultimodeMbmsContextUpdateMbmsSessionList );        
       
  1509         
       
  1510     if ( EMultimodePacketMbmsReqHandleUnknown != reqHandle )
       
  1511         {                            
       
  1512         // Complete the client request
       
  1513         CMmMBMSContextTsy::ReqCompleted( reqHandle, ret );
       
  1514         }
       
  1515     }
       
  1516 
       
  1517 // ---------------------------------------------------------------------------
       
  1518 // CMmMBMSContextTsy::GetMbmsActiveServicesPhase1L
       
  1519 // First phase of MBMS session retrieval
       
  1520 // (other items were commented in a header).
       
  1521 // ---------------------------------------------------------------------------
       
  1522 //     
       
  1523 TInt CMmMBMSContextTsy::GetMbmsActiveServicesPhase1L(
       
  1524 	        TTsyReqHandle aTsyReqHandle,
       
  1525 	        RMobilePhone::TClientId* aClient,
       
  1526 	        TInt* aBufSize )
       
  1527     {
       
  1528     TInt ret( KErrNone );
       
  1529 TFLOGSTRING("TSY: CMmMBMSContextTsy::GetMbmsActiveServicesPhase1L");
       
  1530   
       
  1531   	if (iServicesArray->iSessionIdList.Count() > 0)
       
  1532   		{
       
  1533   		// Presently internal attribute, used only by this method.
       
  1534     	iClientId = *aClient;
       
  1535    
       
  1536 	    // Serialize data (RPacketMbmsContext::CMbmsSession)
       
  1537 	    // into iActiveSessionInfoBuffer
       
  1538 	    iServicesArray->ExternalizeL( iActiveSessionInfoBuffer );
       
  1539 				
       
  1540 	    *aBufSize = iActiveSessionInfoBuffer->Length();                    
       
  1541 	                                       
       
  1542 	    ReqCompleted( aTsyReqHandle, KErrNone );
       
  1543   		}
       
  1544   	else
       
  1545 	  	{
       
  1546 	  	ret = KErrNotFound;
       
  1547 	  	}
       
  1548     
       
  1549     return ret;
       
  1550     }
       
  1551 
       
  1552 // ---------------------------------------------------------------------------
       
  1553 // CMmMBMSContextTsy::GetMbmsActiveServicesPhase2L
       
  1554 // Second phase of MBMS session retrieval
       
  1555 // (other items were commented in a header).
       
  1556 // ---------------------------------------------------------------------------
       
  1557 //      
       
  1558 TInt CMmMBMSContextTsy::GetMbmsActiveServicesPhase2L(
       
  1559         	TTsyReqHandle aTsyReqHandle,
       
  1560         	RMobilePhone::TClientId* aClient,
       
  1561 	        TDes8* aBuffer )   
       
  1562     {
       
  1563 TFLOGSTRING("TSY: CMmMBMSContextTsy::GetMbmsActiveServicesPhase2L");
       
  1564 	
       
  1565 	TInt error = KErrNone;
       
  1566 	
       
  1567 	// Check client id
       
  1568 	if (( aClient->iSessionHandle != iClientId.iSessionHandle 
       
  1569 		|| aClient->iSubSessionHandle != 
       
  1570                               iClientId.iSubSessionHandle  ) || (iActiveSessionInfoBuffer == NULL))
       
  1571 		{
       
  1572 		error = KErrBadHandle;
       
  1573 		}
       
  1574 	else
       
  1575 		{
       
  1576 		// Copy data to client buffer	
       
  1577 	  	TPtr8 bufPtr = iActiveSessionInfoBuffer->Des();
       
  1578 	  	if ( bufPtr.Length() <= aBuffer->Length() )
       
  1579 	  		{
       
  1580 			aBuffer->Copy( bufPtr );
       
  1581 			}
       
  1582 		else
       
  1583 			{
       
  1584 			error = KErrArgument;
       
  1585 			}
       
  1586 		
       
  1587 		// delete the buffer
       
  1588 		if ( iActiveSessionInfoBuffer )
       
  1589 			{
       
  1590 			delete iActiveSessionInfoBuffer;
       
  1591 			iActiveSessionInfoBuffer = NULL;
       
  1592 			}
       
  1593 		}
       
  1594 	ReqCompleted( aTsyReqHandle, error );
       
  1595     return KErrNone;
       
  1596     }
       
  1597 
       
  1598 
       
  1599 
       
  1600 // ---------------------------------------------------------------------------
       
  1601 // CMmMBMSContextTsy::CancelGetMbmsActiveServicesPhase1
       
  1602 // Cancelling MBMS session retrieval
       
  1603 // (other items were commented in a header).
       
  1604 // ---------------------------------------------------------------------------
       
  1605 //       
       
  1606 TInt CMmMBMSContextTsy::CancelGetMbmsActiveServicesPhase1()   
       
  1607     {
       
  1608 	// delete the buffer
       
  1609 	if ( iActiveSessionInfoBuffer )
       
  1610 		{
       
  1611 		delete iActiveSessionInfoBuffer;
       
  1612 		iActiveSessionInfoBuffer = NULL;
       
  1613 		}    
       
  1614 
       
  1615     ReqCompleted( iTsyReqHandle, KErrCancel );
       
  1616     return KErrNone;	    
       
  1617     }
       
  1618 
       
  1619 // ---------------------------------------------------------------------------
       
  1620 // CMmMBMSContextTsy::SessionCount
       
  1621 // Returns the session count to a MBMS context
       
  1622 // (other items were commented in a header).
       
  1623 // ---------------------------------------------------------------------------
       
  1624 //       
       
  1625 TInt CMmMBMSContextTsy::SessionCount()
       
  1626     {
       
  1627     
       
  1628     return iServicesArray->iSessionIdList.Count();
       
  1629     
       
  1630     }
       
  1631 
       
  1632 // ---------------------------------------------------------------------------
       
  1633 // CMmMBMSContextTsy::ContextType
       
  1634 // return the context type
       
  1635 // (other items were commented in a header).
       
  1636 // ---------------------------------------------------------------------------
       
  1637 //
       
  1638 CMmPacketContextTsy::TPacketContextType CMmMBMSContextTsy::ContextType() const
       
  1639 {
       
  1640 	return EContextTypeMBMS;
       
  1641 }
       
  1642 
       
  1643 //  End of File