telephonyserverplugins/common_tsy/commontsy/inc/mmpacket/cmmmbmscontexttsy.h
changeset 0 3553901f7fa8
child 24 6638e7f4bd8f
equal deleted inserted replaced
-1:000000000000 0:3553901f7fa8
       
     1 /*
       
     2 * Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef CMmMBMSContextTsy_H
       
    21 #define CMmMBMSContextTsy_H
       
    22 
       
    23 //  INCLUDES
       
    24 #include "Cmmpacketcontexttsy.h"
       
    25 #include "mbmstypes.h"
       
    26 
       
    27 
       
    28 // FORWARD DECLARATIONS
       
    29 class CMmTsyReqHandleStore;
       
    30 class CMmPacketServiceTsy;
       
    31 
       
    32 // CLASS DECLARATION
       
    33 
       
    34 /**
       
    35 *  CMmMBMSContextTsy contains MBMS context related functionality. 
       
    36 */
       
    37 NONSHARABLE_CLASS( CMmMBMSContextTsy ) : public CMmPacketContextTsy
       
    38     {
       
    39     public: // Constructor and destructor    
       
    40     
       
    41   
       
    42         /**
       
    43          * NewL method is used to create a new instance of CMmMBMSContextTsy
       
    44          * class.
       
    45          * 
       
    46          *                  
       
    47          * @param aMmPacketService Pointer to the Packet Service object
       
    48          * @param aName Context name
       
    49          * @param aProxyId Proxy id
       
    50          */
       
    51         static CMmMBMSContextTsy* NewL
       
    52                 ( CMmPacketServiceTsy* aMmPacketService,                
       
    53                   const TDes& aName,  
       
    54                   const TUint8 aProxyId );
       
    55 
       
    56         /**
       
    57          * Destructor
       
    58          */
       
    59         ~CMmMBMSContextTsy();
       
    60 
       
    61         /**
       
    62          * TRAP's all CMmMBMSContextTsy related MM API requests in case that
       
    63          * they fail. This method functions only as a centralized TRAP for the
       
    64          * DoExtFuncL method that does the actual mapping of IPC number to
       
    65          * TSY method call.
       
    66          *         
       
    67          *
       
    68          * @param aTsyReqHandle TSY request handle from ETel server
       
    69          * @param aIpc IPC number of the request
       
    70          * @param aPackage Reference to the input parameters.
       
    71          * @return KErrNone/KErrNotSupported
       
    72          */
       
    73         virtual TInt ExtFunc( TTsyReqHandle aTsyReqHandle, 
       
    74             TInt aIpc, const TDataPackage& aPackage );    
       
    75 
       
    76         /**
       
    77          * Returns request mode for given IPC number
       
    78          *          
       
    79          *                 
       
    80          * @param aIpc IPC number of the request
       
    81          * @return CTelObject::TReqMode Request mode
       
    82          */
       
    83         virtual CTelObject::TReqMode ReqModeL( TInt aIpc );
       
    84 
       
    85         /**
       
    86          * Returns number of slots to be used for a given IPC
       
    87          *          
       
    88          *                  
       
    89          * @param aIpc IPC number of the request
       
    90          * @return TInt Number of slots for this request
       
    91          */
       
    92         virtual TInt NumberOfSlotsL( TInt aIpc );
       
    93 
       
    94         /**
       
    95          * Cancels request that's IPC number and request handle are given as
       
    96          * parameters
       
    97          *         
       
    98          *   
       
    99          * @param aIpc: IPC number of the request
       
   100          * @param aTsyReqHandle Request handle from ETel server
       
   101          * @return KErrNone/KErrNotSupported
       
   102          */
       
   103         virtual TInt CancelService( TInt aIpc, 
       
   104             TTsyReqHandle aTsyReqHandle );
       
   105 
       
   106         /**
       
   107          * Register given notification
       
   108          *         
       
   109          *
       
   110          * @param aIpc IPC number of the request
       
   111          * @return TInt Result of the request
       
   112          */
       
   113         virtual TInt RegisterNotification( TInt aIpc );
       
   114 
       
   115         /**
       
   116          * Deregister given notification
       
   117          *         
       
   118          *
       
   119          * @param aIpc IPC number of the request
       
   120          * @return TInt Result of the request
       
   121          */
       
   122         virtual TInt DeregisterNotification( TInt aIpc );
       
   123 
       
   124         /**
       
   125          * Complete the context initialisation
       
   126          *         
       
   127          *
       
   128          * @param aResult Result of the request
       
   129          * @param aDataChannel the data channel to return to the client
       
   130          */
       
   131         void CompleteInitialiseContext( TInt aResult ,RPacketContext::TDataChannelV2* aDataChannel );
       
   132 
       
   133         /**
       
   134          * Complete the context activation.
       
   135          *         
       
   136          *
       
   137          * @param aResult Result of the request
       
   138          */
       
   139         void CompleteActivate(TInt aResult );
       
   140         
       
   141         /**
       
   142          * Complete activate phase2
       
   143          *         
       
   144          *
       
   145          * @param aTsyReqHandle The ETEL request handle
       
   146          * @param aClient The client id
       
   147          * @param aBuffer A descriptor to put the active services into
       
   148          * @return error code
       
   149          */
       
   150         TInt GetMbmsActiveServicesPhase2L(
       
   151         	TTsyReqHandle aTsyReqHandle,
       
   152         	RMobilePhone::TClientId* aClient,
       
   153 	        TDes8* aBuffer );
       
   154 	        
       
   155 	    /**
       
   156 	     * Cancel get service list request
       
   157 	     */
       
   158         TInt CancelGetMbmsActiveServicesPhase1();
       
   159 
       
   160         /**
       
   161          * Complete the context deactivation
       
   162          *         
       
   163          *
       
   164          * @param aResult Result of the request
       
   165          * @param aDataPackage NULL or a list of failed entries in case there are failed entries 
       
   166          */
       
   167         void CompleteDeactivate( CMmDataPackage* aDataPackage, TInt aResult );
       
   168  
       
   169         /**
       
   170          * Complete the context delete
       
   171          *         
       
   172          *
       
   173          * @param aResult Result of the request
       
   174          */
       
   175         void CompleteDelete( TInt aResult );
       
   176 
       
   177         /**
       
   178          * Complete the config changed notification
       
   179          *         
       
   180          * @param aDataPackage The data that was send from the LTSY
       
   181          * @param aResult The result of the status change 
       
   182          */
       
   183         void CompleteNotifyConfigChanged( 
       
   184         		const CMmDataPackage* aDataPackage = NULL,
       
   185                 TInt aResult= 0);
       
   186         
       
   187         /**
       
   188          * Complete the status change notification
       
   189          *         
       
   190          * @param aDataPackage The data that was send from the LTSY
       
   191          * @param aResult The result of the status change 
       
   192          */
       
   193         void CompleteNotifyStatusChange(
       
   194             const CMmDataPackage* aDataPackage,
       
   195             TInt aResult  );      
       
   196             
       
   197         /**
       
   198          * Complete the status change notification
       
   199          *         
       
   200          *
       
   201          * @param aContextStatus Contains status of the context
       
   202          */
       
   203         void CompleteNotifyStatusChange(
       
   204             RPacketContext::TContextStatus aContextStatus  );                 
       
   205         
       
   206         /**
       
   207          * Complete the context configuration
       
   208          *         
       
   209          *
       
   210          * @param aResult Result of the request
       
   211          */
       
   212         void CompleteSetConfig( TInt aResult );
       
   213 
       
   214         /**
       
   215          * Set the last error cause.
       
   216          *         
       
   217          *
       
   218          * @param aErrorCause Contains the last error cause
       
   219          */
       
   220         void SetLastErrorCause( TInt aErrorCause );
       
   221 
       
   222         /**
       
   223          * Get the context status.
       
   224          *         
       
   225          *
       
   226          * return RPacketContext::TContextStatus
       
   227          */
       
   228         RPacketContext::TContextStatus ContextStatus() const;
       
   229 
       
   230         /**
       
   231          * Tells if context activation is allowed
       
   232          *         
       
   233          *
       
   234          * @return TBool ETrue/EFalse
       
   235          */ 
       
   236         TBool IsContextActivationAllowed() const;
       
   237 
       
   238         /**
       
   239          * Return the contextName
       
   240          *         
       
   241          *
       
   242          * @return The context name
       
   243          */
       
   244         const TInfoName &ContextName() const;
       
   245         
       
   246         /**
       
   247          * Completets sessions list change request back to client
       
   248          *
       
   249          * @param aResult Actual result of complete
       
   250          */
       
   251         void CompleteUpdateMbmsSessionList( 
       
   252             const TInt aResult );          
       
   253 
       
   254         /**
       
   255          * Return the context index
       
   256          *         
       
   257          *
       
   258          * @return The context index
       
   259          */
       
   260         TInt ContextIndex() const;        
       
   261         
       
   262         /**
       
   263          * First phase to retrieve active services
       
   264          *
       
   265          * @param aTsyReqHandle the ETEL request handle
       
   266          * @param aClient Etel's client ID
       
   267          * @param aBufSize Buffer size to client
       
   268          * @return error code
       
   269          */
       
   270         TInt GetMbmsActiveServicesPhase1L(
       
   271 	        TTsyReqHandle aTsyReqHandle,
       
   272 	        RMobilePhone::TClientId* aClient,
       
   273 	        TInt* aBufSize );
       
   274             
       
   275         
       
   276         /**
       
   277          * Sets dynamic capability flags to this context
       
   278          * 
       
   279          * @param aFlag Flags to set
       
   280          * @param aIsActionPossible Is action possible
       
   281          */
       
   282         void SetDynamicCapsFlag(
       
   283             const RPacketService::TDynamicCapsFlags aFlag,  
       
   284             const TBool aIsActionPossible );   
       
   285             
       
   286         /**
       
   287          * Returns number of session in this context
       
   288          *
       
   289          * @return TInt Number of session in this context
       
   290          */            
       
   291         TInt SessionCount();
       
   292         
       
   293 
       
   294         /**
       
   295          * Returns type of context based on context name
       
   296          *
       
   297          * @param aInfoName Name of the context
       
   298          * @return TInt Type of context
       
   299          */
       
   300         virtual TPacketContextType ContextType() const;
       
   301 
       
   302 #ifdef REQHANDLE_TIMER
       
   303         /**
       
   304          * Call the needed complete method due the timer expiration.
       
   305          *         
       
   306          *
       
   307          * @param aReqHandleType  
       
   308          * @param aError                      
       
   309          */
       
   310         void Complete
       
   311                 (
       
   312                 const TInt aReqHandleType,
       
   313                 const TInt aError 
       
   314                 );
       
   315 #endif //REQHANDLE_TIMER
       
   316 
       
   317     private: // functions
       
   318       
       
   319         /** 
       
   320          * C++ default constructor.
       
   321          */
       
   322         CMmMBMSContextTsy();     
       
   323         
       
   324 
       
   325    
       
   326         /**
       
   327          * Class attributes are created in ConstructL.
       
   328          * 
       
   329          * 
       
   330          * @param aMmPacketService Pointer to the Packet Service object
       
   331          * @param aMessageManager Pointer to the Message Manager object
       
   332          * @param aName Context name
       
   333          * @param aProxyId Proxy id
       
   334          */
       
   335         void ConstructL(CMmPacketServiceTsy* const aMmPacketService,                
       
   336                 const TDes& aName,  
       
   337                 TUint8 aProxyId);
       
   338 
       
   339 
       
   340         /**
       
   341          * Initialise miscellaneous internal attributes.
       
   342          * 
       
   343          *                
       
   344          */
       
   345         void InitInternalAttributes();
       
   346         
       
   347         /**
       
   348          * TRAP's all CMmMBMSContextTsy related MM Packet API requests in 
       
   349          * case that they fail. This method functions only as a centralized
       
   350          * TRAP for the DoExtFuncL method that does the actual mapping of IPC 
       
   351          * number to TSY method call.
       
   352          *         
       
   353          *
       
   354          * @param aTsyReqHandle TSY request handle from ETel server
       
   355          * @param aIpc IPC number of the request
       
   356          * @param aPackage Reference to the input parameters.
       
   357          * @return KErrNone/KErrNotSupported
       
   358          */
       
   359         TInt DoExtFuncL( TTsyReqHandle aTsyReqHandle,
       
   360             TInt aIpc, const TDataPackage& aPackage );
       
   361 
       
   362         /**
       
   363          * Initialise a context
       
   364          *         
       
   365          * @param aDataChannel A pointer to a client object to return the data channel
       
   366          * @return TInt Success/failure value
       
   367          */
       
   368         TInt InitialiseContextL(RPacketContext::TDataChannelV2* aDataChannel );
       
   369         
       
   370         
       
   371         /**
       
   372          * Activate a context
       
   373          *         
       
   374          *
       
   375          * @return TInt Success/failure value
       
   376          */
       
   377         TInt ActivateL();
       
   378 
       
   379         /**
       
   380          * Deactivate a context
       
   381          *         
       
   382          *
       
   383          * @return TInt Success/failure value
       
   384          */
       
   385         TInt DeactivateL();
       
   386 
       
   387         /**
       
   388          * Deletes a context
       
   389          *         
       
   390          *
       
   391          * @return TInt Success/failure value
       
   392          */
       
   393         TInt DeleteL();
       
   394         
       
   395         /**
       
   396          * Updates session list of this context. Possible actions are;
       
   397          * add, remove or remove all items
       
   398          *
       
   399          * @param aAction Update action; add, remove or remove all
       
   400          * @param aSession The id of the session  
       
   401          * @return TInt Possible error value
       
   402          */
       
   403         TInt UpdateMbmsSessionList( TMbmsAction* aAction,
       
   404             TMbmsSessionId* aSession );
       
   405             
       
   406           
       
   407     
       
   408         /**
       
   409          * Get the context configuration info
       
   410          *         
       
   411          *
       
   412          * @param aTsyReqHandle TSY request handle
       
   413          * @return aConfig Contains Context configuration info on return
       
   414          * @return TInt Success/failure value
       
   415          */
       
   416         TInt GetConfig(TTsyReqHandle aTsyReqHandle,
       
   417             TPacketDataConfigBase* aConfig );
       
   418 
       
   419         /**
       
   420          * Get the last error cause occurred
       
   421          *         
       
   422          *
       
   423          * @param aTsyReqHandle TSY request handle
       
   424          * @return aError Contains last error value on return
       
   425          * @return TInt Success/failure value
       
   426          */
       
   427         TInt GetLastErrorCause( TTsyReqHandle aTsyReqHandle,
       
   428             TInt* aError );
       
   429 
       
   430         /**
       
   431          * Get the current status of the context
       
   432          *         
       
   433          *
       
   434          * @param aTsyReqHandle TSY request handle
       
   435          * @return aContextStatus Contains current status of the context
       
   436          * @return TInt KErrNone
       
   437          */
       
   438         TInt GetStatus( TTsyReqHandle aTsyReqHandle,
       
   439             RPacketContext::TContextStatus* aContextStatus );
       
   440 
       
   441         /**
       
   442          * Allows clients to be notified of any change in context 
       
   443          * configuration. Allows a client to be notified whenever a change in 
       
   444          * the configuration of the current context is detected and passes 
       
   445          * back the updated  configuration. Note that once the notification 
       
   446          * completes, the clients must then re-post the notification if they 
       
   447          * wish to continue receiving the notification.
       
   448          *         
       
   449          *
       
   450          * @return aConfig Contains context configuration info on return
       
   451          * @return TInt Success/failure value
       
   452          */
       
   453         TInt NotifyConfigChanged( TPacketDataConfigBase* aConfig );
       
   454 
       
   455         /**
       
   456          * Allows clients to be notified of any change in the context status
       
   457          *
       
   458          *         
       
   459          * @return aContextStatus Contains the status of the context on return
       
   460          * @return TInt Success/failure value
       
   461          */
       
   462         TInt NotifyStatusChange( RPacketContext::TContextStatus* aContextStatus );
       
   463 
       
   464         
       
   465         /**
       
   466          * Set context configuration
       
   467          *
       
   468          *         
       
   469          * @param aConfig Contains context configuration
       
   470          * @return TInt Success/failure value.
       
   471          */
       
   472         TInt SetConfigL( TPacketDataConfigBase* aConfig );
       
   473 
       
   474         /**
       
   475          * Overloads original ReqCompleted for logging purposes
       
   476          *
       
   477          *         
       
   478          * @param aTsyReqHandle TSY request handle
       
   479          * @param aError error value
       
   480          */
       
   481         virtual void ReqCompleted( TTsyReqHandle aTsyReqHandle,
       
   482             TInt aError );
       
   483 
       
   484         /**
       
   485          * Method invokes MS-initiated modification of an active context in the 
       
   486          * network
       
   487          *         
       
   488          *
       
   489          * @return TInt Success/failure value.
       
   490          */
       
   491         TInt ModifyActiveContextL();
       
   492 
       
   493 #ifdef REQHANDLE_TIMER
       
   494 
       
   495         /**
       
   496          * Choose the type of response, automatic or common.
       
   497          * 
       
   498          *  
       
   499          * @param aReqHandleType
       
   500          * @param aTsyReqHandle                         
       
   501          */
       
   502         void SetTypeOfResponse( TInt aReqHandleType, 
       
   503                 TTsyReqHandle aTsyReqHandle );
       
   504 
       
   505 #endif //REQHANDLE_TIMER
       
   506 
       
   507     public: //Data
       
   508     
       
   509         // TPacketContextRequestTypes enumerates indexes to Packet's request
       
   510         // handle table. Request handles are stored there while waiting for 
       
   511         // completion of the request.
       
   512         enum TPacketContextRequestTypes
       
   513             {
       
   514             EMultimodePacketMbmsReqHandleUnknown,
       
   515             EMultimodePacketMbmsInitialiseContext,
       
   516             EMultimodeMbmsContextActivate,
       
   517             EMultimodeMbmsContextDeactivate,
       
   518             EMultimodeMbmsContextDelete,
       
   519             EMultimodeMbmsContextNotifyConfigChanged,
       
   520             EMultimodePacketContextNotifyConnectionSpeedChange,
       
   521             EMultimodeMbmsContextNotifyStatusChange,
       
   522             EMultimodePacketMbmsContextSetConfig,
       
   523             EMultimodePacketContextGetDataVolumeTransferred,
       
   524             EMultimodePacketContextGetPacketFilterInfo,
       
   525             EMultimodePacketContextEnumeratePacketFilters,
       
   526             EMultimodePacketContextAddPacketFilter,
       
   527             EMultimodePacketContextRemovePacketFilter,
       
   528             EMultimodePacketContextModifyActiveContext,
       
   529             EMultimodePacketContextNotifyConfigChanged99,
       
   530             EMultimodeGetMbmsSessionListPhase1,
       
   531             EMultimodeGetMbmsSessionListPhase2,
       
   532             EMultimodeMbmsContextUpdateMbmsSessionList,
       
   533             
       
   534 
       
   535             // Max number of requests
       
   536             // ADD NEW REQUESTS BEFORE THIS!
       
   537             EMaxNumOfMBMSContextRequests
       
   538 
       
   539             };
       
   540 
       
   541     private: // Data
       
   542 
       
   543    		/**
       
   544          * Context configuration data GPRS
       
   545          * Own.         
       
   546          */
       
   547         RPacketMbmsContext::TContextConfigMbmsV1* iConfig;
       
   548 
       
   549         /**
       
   550          * Req handle type
       
   551          */        
       
   552         TPacketContextRequestTypes iReqHandleType;
       
   553         
       
   554         /**
       
   555          *  TSY request handle
       
   556          */
       
   557         TTsyReqHandle iTsyReqHandle;           
       
   558 
       
   559         /**
       
   560          *  Pointer to the Req handle store
       
   561          *  Own.        
       
   562          */        
       
   563         CMmTsyReqHandleStore* iTsyReqHandleStore;
       
   564         
       
   565         /**
       
   566          *  Table for packet context request handles
       
   567          */        
       
   568         TTsyReqHandle iPacketContextReqHandles[EMaxNumOfMBMSContextRequests];
       
   569         
       
   570         /**
       
   571          *  Pointer to the Packet Service TSY
       
   572          *  Not own.        
       
   573          */
       
   574         CMmPacketServiceTsy* iMmPacketService;                                                
       
   575                                              
       
   576         /**
       
   577          *  Notify Config Changed
       
   578          *  Not own.        
       
   579          */
       
   580         TPacketDataConfigBase* iRetNotifyConfig;
       
   581         
       
   582         /**
       
   583          *  Notify Config Changed
       
   584          *  Not own.        
       
   585          */        
       
   586         TPacketDataConfigBase* iRetNotifyConfig2;
       
   587 
       
   588                                             
       
   589         /**
       
   590          *  Notify Context Status Change
       
   591          *  Not own.        
       
   592          */
       
   593         RPacketContext::TContextStatus* iRetNotifyStatus;                                               
       
   594 
       
   595         /**
       
   596          * Context status   
       
   597          */
       
   598         RPacketContext::TContextStatus iContextStatus;
       
   599                                                
       
   600         /**
       
   601          *  Context name      
       
   602          */
       
   603         TInfoName iContextName;    
       
   604 
       
   605         /**
       
   606          *  Initialisation state flag    
       
   607          */        
       
   608         TBool iIsInitialiseAllowed;                                            
       
   609         
       
   610         /**
       
   611          *  Activation state flag    
       
   612          */        
       
   613         TBool iIsActivateAllowed; 
       
   614         
       
   615         /**
       
   616          * Context status before deactivation
       
   617          */
       
   618         RPacketContext::TContextStatus iContextStatusBeforeDeactivation;
       
   619         
       
   620         /**
       
   621          * Unique object Id       
       
   622          */
       
   623         TUint8 iObjectId;                                                                
       
   624 
       
   625         /**
       
   626          * Context status before suspending       
       
   627          */
       
   628         RPacketContext::TContextStatus iContextStatusBeforeSuspending;        
       
   629 
       
   630         /**
       
   631          *  Last error cause      
       
   632          */
       
   633         TInt iLastErrorCause;       
       
   634         
       
   635         /**
       
   636          *  Array containing all services
       
   637          */
       
   638         RPacketMbmsContext::CMbmsSession* iServicesArray; 
       
   639 	    
       
   640         
       
   641         /**
       
   642          * Temporary configuration structure
       
   643          */
       
   644         RPacketMbmsContext::TContextConfigMbmsV1* iTempConfig;
       
   645         
       
   646         
       
   647    		/**
       
   648          * Session list action to complete
       
   649          */      
       
   650         TMbmsAction iAction;
       
   651         
       
   652         /**
       
   653          * Item to add or remove to/from session list
       
   654          */
       
   655         TMbmsSessionId iSession;
       
   656         
       
   657         
       
   658         /**
       
   659          * Buffer to store active session info
       
   660          */
       
   661         HBufC8* iActiveSessionInfoBuffer;
       
   662         
       
   663         /**
       
   664          * The client id for GetMbmsActiveServices 
       
   665          */ 
       
   666         RMobilePhone::TClientId iClientId;
       
   667         
       
   668         /**
       
   669          * A pointer to the client object, to return the data channel after init
       
   670          */
       
   671         RPacketContext::TDataChannelV2 *iDataChannelV2;
       
   672 
       
   673     };
       
   674 
       
   675 #endif // CMmMBMSContextTsy_H
       
   676    
       
   677 // End of File