telephonyserverplugins/simtsy/inc/CSimMbmsPacketContext.h
changeset 0 3553901f7fa8
child 24 6638e7f4bd8f
child 27 4284d6390a82
equal deleted inserted replaced
-1:000000000000 0:3553901f7fa8
       
     1 // Copyright (c) 2008-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 // This file contains the definitions of the Simulator TSY MBMS Packet Context class.
       
    15 // 
       
    16 //
       
    17 
       
    18 /**
       
    19  @file
       
    20  @internalAll
       
    21 */
       
    22 
       
    23 #ifndef CSIMMBMSPACKETCONTEXT_H_
       
    24 #define CSIMMBMSPACKETCONTEXT_H_
       
    25 
       
    26 #include <et_phone.h>
       
    27 #include <etelpckt.h>
       
    28 #include <testconfigfileparser.h>
       
    29 #include "csimtimer.h"
       
    30 #include "utils.h"
       
    31 #include "CSimNtras.h"
       
    32 #include "CSimPubSubChange.h"
       
    33 #include "CSimPhone.h"
       
    34 #include "CSimPacketContext.h"
       
    35 #include "mbmstypes.h"
       
    36 
       
    37 class CSimPacketService;
       
    38 
       
    39 const RPacketContext::TContextStatus KMbmsContextStateTableTerminator=(RPacketContext::TContextStatus)999;
       
    40 
       
    41 struct TMbmsContextStateChangeValidity
       
    42 	{
       
    43 	RPacketContext::TContextStatus iOldState;
       
    44 	RPacketContext::TContextStatus iNewState;
       
    45 	TInt iError;
       
    46 	};
       
    47 
       
    48 //< This table is used to ensure that the TSY state changes are as accurate as possibly
       
    49 //< It makes sure that there is no state irregularities and the TSY does not skip any state.
       
    50 //< Returns KErrNone for a valid change state request (3rd column).
       
    51 const struct TMbmsContextStateChangeValidity	KMbmsContextStateChangeValidity[]= {
       
    52 	{ RPacketContext::EStatusInactive,		RPacketContext::EStatusActivating,	KErrNone },
       
    53 	{ RPacketContext::EStatusInactive,		RPacketContext::EStatusDeleted,	KErrNone },
       
    54 
       
    55 	{ RPacketContext::EStatusActivating,	RPacketContext::EStatusActive,		KErrNone },
       
    56 	{ RPacketContext::EStatusActivating,	RPacketContext::EStatusInactive,	KErrNone },
       
    57 	{ RPacketContext::EStatusActivating,	RPacketContext::EStatusDeleted,	KErrNone },
       
    58 	
       
    59 	{ RPacketContext::EStatusActive,		RPacketContext::EStatusDeactivating, KErrNone },
       
    60 	{ RPacketContext::EStatusActive,		RPacketContext::EStatusSuspended,	KErrNone },
       
    61 	{ RPacketContext::EStatusActive,		RPacketContext::EStatusDeleted,	KErrNone },
       
    62 	{ RPacketContext::EStatusActive,		RPacketContext::EStatusReceiving ,	KErrNone },
       
    63 
       
    64 	{ RPacketContext::EStatusDeactivating,	RPacketContext::EStatusInactive,	KErrNone },
       
    65 	{ RPacketContext::EStatusDeactivating,	RPacketContext::EStatusActive,		KErrNone },
       
    66 	{ RPacketContext::EStatusDeactivating,	RPacketContext::EStatusDeleted,	KErrNone },
       
    67 
       
    68 	{ RPacketContext::EStatusSuspended,		RPacketContext::EStatusDeactivating, KErrNone },
       
    69 	{ RPacketContext::EStatusSuspended,		RPacketContext::EStatusActive,		KErrNone },
       
    70 	{ RPacketContext::EStatusSuspended,		RPacketContext::EStatusDeleted,	KErrNone },
       
    71 	{ RPacketContext::EStatusSuspended,		RPacketContext::EStatusReceiving ,	KErrNone },
       
    72 	
       
    73 	{ RPacketContext::EStatusDeleted,		RPacketContext::EStatusInactive,	KErrNone },
       
    74 
       
    75 
       
    76 	{ KMbmsContextStateTableTerminator,			KMbmsContextStateTableTerminator,		KMbmsContextStateTableTerminator}
       
    77 	};
       
    78 
       
    79 enum TMbmsContextEvent //< Enum for the state machine
       
    80 	{
       
    81 	EMbmsContextEventNone,
       
    82 	EMbmsContextEventActivate,
       
    83 	EMbmsContextEventDeactivate,
       
    84 	EMbmsContextEventDelete
       
    85 	};	
       
    86 
       
    87 struct TMbmsConfigParams
       
    88 	{
       
    89 	TUint16 iMCC;
       
    90 	TUint16 iMNC;
       
    91 	TUint iServiceId;
       
    92 	TMbmsScope iAccessBearer;
       
    93 	TMbmsServiceMode iServiceMode;
       
    94 	TMbmsServicePriority iServicePriority;
       
    95 	TUint  iActivateCode;
       
    96 	};
       
    97 
       
    98 struct TSetConfigValues
       
    99 	{
       
   100 	TInt iErrorValue;  // error value after validation of set config params with configuration params
       
   101 	TUint iIndex;  // index if the validation succeeds.
       
   102 	};
       
   103 
       
   104 class CSimMbmsPacketContext : public CSimPacketContext
       
   105 	{
       
   106 public:
       
   107 	static CSimMbmsPacketContext* NewL(CSimPhone* aPhone, CSimPacketService* aPacketService, const TDesC& aContextName);
       
   108 	CSimMbmsPacketContext(CSimPhone* aPhone, CSimPacketService* aPacketService, const TName& aContextName);
       
   109 	void ConstructL();
       
   110 	~CSimMbmsPacketContext();
       
   111 
       
   112 	virtual TInt ExtFunc(const TTsyReqHandle aTsyReqHandle,const TInt aIpc,const TDataPackage& aPackage);
       
   113 	virtual TReqMode ReqModeL(const TInt aIpc);
       
   114 	virtual CTelObject* OpenNewObjectByNameL(const TDesC& aName);
       
   115 	virtual CTelObject* OpenNewObjectL(TDes& aNewName);
       
   116 	virtual TInt CancelService(const TInt aIpc, const TTsyReqHandle aTsyReqHandle);
       
   117 	virtual TInt RegisterNotification(const TInt aIpc);
       
   118 	virtual TInt DeregisterNotification(const TInt aIpc);
       
   119 	virtual TInt NumberOfSlotsL(const TInt aIpc);
       
   120 	const CTestConfigSection* CfgFile();
       
   121 	void Init();
       
   122 	
       
   123 	TInt ReActivate(CSimPacketService* aPacketService, const TName& aContextName);
       
   124 	
       
   125 public:
       
   126 	TName ContextName() const;
       
   127 	inline TInt ContextType() const {return iContextType;  }
       
   128 	inline RPacketContext::TContextStatus ContextStatus() const {return iState; }
       
   129 	
       
   130 private:
       
   131 	TName iContextName;						//< Current MBMS context name
       
   132 	TInt iContextType;						//< Current MBMS context's type
       
   133 	TBool iIsActive;						//< Boolean that holds whether the context is active or not.
       
   134 	TBool iDeleted;							//< Boolean that holds whether the context is deleted or not.
       
   135 	TMbmsContextEvent iCurrentEvent;		//< holds the current event taking place.
       
   136 	TUint iMbmsContextConfigParamsIndex; 	// Index for the array  iMbmsContextConfigParams
       
   137 	TSetConfigValues iSetConfigValues;		// values after validation of set config params
       
   138 	
       
   139 	CSimPhone* iPhone;
       
   140 	CSimPacketService* iPacketService;		//< Pointer to the parent class
       
   141 	CSimTimer* iMbmsSetConfigTimer;			//< pointer to the timer object for Set Config operation
       
   142 	CSimTimer* iMbmsContextTimer;			//< pointer to the timer object for activation and deactivation of the MBMS context
       
   143 	CSimTimer* iMbmsUpdateSessionTimer;		//< pointer to the timer object for Update Session List
       
   144 	CSimTimer* iMbmsContextInitTimer;		//< pointer to the timer object for MBMS Context Initialisation
       
   145 	CSimTimer* iMbmsGetSessionTimer;		//< pointer to the timer object for MBMS Get Session
       
   146 	
       
   147 	TTsyReqHandle iActivateRequestHandle;	//< Request handle used for activating a context
       
   148 	TTsyReqHandle iDeactivateRequestHandle;	//< Request handle used for deactivating a context
       
   149 	TTsyReqHandle iDeleteRequestHandle;		//< Request handle used to complete a delete request
       
   150 	TTsyReqHandle iSetConfigRequestHandle;  //< Request handle used to complete a SetConfig request
       
   151 	TTsyReqHandle iUpdateSessionHandle;		//< Request handle used to complete a UpdateSession request
       
   152 	TTsyReqHandle iGetMbmsSessionHandle;	//< Request handle used to complete a Get MBMS Session request
       
   153 	TNotifyData	iNotifyConfigMBMS;			//< Holds the MBMS context config changenotification data (a flag, TsyReqHandle and any raw data)
       
   154 	TNotifyData	iNotifyStatusChange;		//< Holds the notification data (a flag, TsyReqHandle and any raw data)
       
   155 	CArrayFixFlat<TUint>* iSessionIdList;   //< List of Session Ids maintained.
       
   156 	CArrayFixFlat<TMbmsConfigParams>* iMbmsContextConfigParams; // List of MBMS Config Parameters
       
   157 	
       
   158 	CArrayPtrFlat<CPcktListReadAllAttempt>* iMbmsSessionList;
       
   159 	RPacketMbmsContext::CMbmsSession* iMbmsSession;
       
   160 	TInt iLastError;
       
   161 	TUint iNumOfSessionId;					//< holds the number of session ids maintained. 
       
   162 			
       
   163 	virtual void TimerCallBack(TInt aId);
       
   164 	
       
   165 	TInt RandTime(); // Utility function that returns a random time.
       
   166 	RPacketService::TStatus ConvertToPacketServiceStatus(RPacketContext::TContextStatus aNewState);
       
   167 	TInt ActionEvent(TMbmsContextEvent aEvent);
       
   168 	TInt ChangeState(RPacketContext::TContextStatus aNewState); //< Changes the state of the packetcontext
       
   169 
       
   170 	TInt GetLastErrorCause(const TTsyReqHandle aTsyReqHandle,TInt* aError);
       
   171 	
       
   172 	TInt SetConfig(const TTsyReqHandle aTsyReqHandle,const TDesC8* aConfig);
       
   173 	TInt SetConfigCancel(const TTsyReqHandle aTsyReqHandle);
       
   174 	
       
   175 	TInt GetConfig(const TTsyReqHandle aTsyReqHandle,TDes8* aConfig);
       
   176 	TInt GetConfigCancel(const TTsyReqHandle aTsyReqHandle);
       
   177 	
       
   178 	TInt Activate(const TTsyReqHandle aTsyReqHandle);
       
   179 	TInt ActivateCancel(const TTsyReqHandle aTsyReqHandle);
       
   180 	
       
   181 	TInt Deactivate(const TTsyReqHandle aTsyReqHandle);
       
   182 	TInt DeactivateCancel(const TTsyReqHandle aTsyReqHandle);
       
   183 	
       
   184 	TInt Delete(const TTsyReqHandle aTsyReqHandle);
       
   185 	TInt DeleteCancel(const TTsyReqHandle aTsyReqHandle);
       
   186 	
       
   187 	TInt NotifyConfigChanged(const TTsyReqHandle aTsyReqHandle, TDes8* aConfig);
       
   188 	TInt NotifyConfigChangedCancel(const TTsyReqHandle aTsyReqHandle);
       
   189 	
       
   190 	TInt GetStatus(const TTsyReqHandle aTsyReqHandle,RPacketContext::TContextStatus* aContextStatus);
       
   191 	TInt NotifyStatusChange(const TTsyReqHandle aTsyReqHandle,RPacketContext::TContextStatus* aContextStatus);
       
   192 	TInt NotifyStatusChangeCancel(const TTsyReqHandle aTsyReqHandle);
       
   193 	
       
   194 	TInt GetMbmsSessionsPhase1(const TTsyReqHandle aTsyReqHandle, TClientId* aClient, TInt* aBufSize);
       
   195 	TInt ProcessGetMbmsSessionsPhase1L(const TTsyReqHandle aTsyReqHandle, TClientId* aClient, TInt* aBufSize);
       
   196 	TInt GetMbmsSessionsPhase2(const TTsyReqHandle aTsyReqHandle, TClientId* aClient, TDes8* aBufSize);
       
   197 	TInt GetMbmsSessionsCancel(const TTsyReqHandle aTsyReqHandle);
       
   198 
       
   199 	TInt UpdateMbmsSessionListL(const TTsyReqHandle aTsyReqHandle,TMbmsAction* aAction, TUint* aSessionId);
       
   200 	TInt UpdateMbmsSessionListCancel(const TTsyReqHandle aTsyReqHandle);
       
   201 	
       
   202 	TInt InitialiseContext(const TTsyReqHandle aTsyReqHandle, TDes8* aDataChannelV2Pckg); // This method supersedes the LoanCommPort() and RecoverCommPort() methods.
       
   203 	TInt InitialiseContextCancel(const TTsyReqHandle aTsyReqHandle); // This method supersedes the LoanCommPort() and RecoverCommPort() methods.
       
   204 	TInt DoInitialiseContext();
       
   205 	
       
   206 	};
       
   207 
       
   208 #endif /*CSIMMBMSPACKETCONTEXT_H_*/