telephonyserverplugins/simtsy/inc/CSimIncomingContextManager.h
changeset 0 3553901f7fa8
equal deleted inserted replaced
-1:000000000000 0:3553901f7fa8
       
     1 // Copyright (c) 2007-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 // CSimIncomingContextManager.cpp
       
    15 // Implements code to manage incoming PDP contexts.
       
    16 // 
       
    17 //
       
    18 
       
    19 /**
       
    20  @file
       
    21 */
       
    22  
       
    23  
       
    24 #ifndef __CSIMINCOMINGCONTEXTMANAGER_H__
       
    25 #define __CSIMINCOMINGCONTEXTMANAGER_H__
       
    26 
       
    27 
       
    28 #include <e32def.h>
       
    29 #include <e32base.h>
       
    30 
       
    31 #include "csimtimer.h"
       
    32 #include "CSimPacketContext.h"
       
    33 #include "CSimPubSubChange.h"
       
    34 
       
    35 
       
    36 
       
    37 /**
       
    38 Drives the incoming PDP contexts.
       
    39 */
       
    40 struct TDelayIncomingContext
       
    41 {
       
    42 public:
       
    43 	TInt	iExtensionId;
       
    44 		// can be 
       
    45 		// TPacketDataConfigBase::KConfigGPRS= 0x01  
       
    46 		// TPacketDataConfigBase::KConfigRel99Rel4= 0x03
       
    47 		// TPacketDataConfigBase::KConfigRel5= 0x04  
       
    48 		
       
    49 	TInt	iIndex;
       
    50 		// the ExtensionId, Index and index are used to indicate which 
       
    51 		// PDP context is incoming.
       
    52 	
       
    53 	TInt 	iDelay; // After this amount of time an incoming PDP context will be faked.
       
    54 };
       
    55 
       
    56 class CSimPhone;
       
    57 
       
    58 class CTestConfigSection;
       
    59 class CTestConfigItem;
       
    60 
       
    61 
       
    62 //Note Initialy only supports GPRS	
       
    63 NONSHARABLE_CLASS(CSimIncomingContextManager) : CBase
       
    64 {
       
    65 	
       
    66 public :
       
    67 	CSimIncomingContextManager(CSimPhone* aPhone);
       
    68 	~CSimIncomingContextManager();
       
    69 
       
    70 public:
       
    71 	static CSimIncomingContextManager* NewL(CSimPhone* aPhone, CSimPacketService* aSimPacketService);
       
    72 	void ConstructL(CSimPacketService* aSimPacketService);
       
    73 	
       
    74 	void LoadIncomingContextsL( TPtrC8 aTag );
       
    75 	void StartFirstIncomingEvent( );
       
    76 	void NextIncomingEvent( TDes8* aPckg );
       
    77 		// Call when we want the next timer event, if any to be run.
       
    78 	void Cancel( );
       
    79 
       
    80 	void ForcedIncoming(TInt aIndex, TDes8* aPckg);
       
    81 	TBool IsForcedIncoming(const CSimPubSub::TPubSubProperty aProperty );
       
    82 		
       
    83 public:
       
    84 	TBool IsUseTimerOn() { return iUseTimerOn; }
       
    85 	void SetUseTimerOn() { iUseTimerOn = ETrue; }
       
    86 	void SetUseTimerOff() { iUseTimerOn = EFalse; };
       
    87 		
       
    88 private:
       
    89 	static void GetConfigType( const CTestConfigItem& aItem, 
       
    90 		TInt aIndex, TInt& aType, TInt& aError );
       
    91 	static void GetContextIndex( const CTestConfigItem& aItem, 
       
    92 		TInt aIndex, TInt& aContextIndex, TInt& aError );
       
    93 	static void GetDelay( const CTestConfigItem& aItem, 
       
    94 		TInt aIndex, TInt& aDelay, TInt& aError );
       
    95 	
       
    96 	
       
    97 	const TContextConfigParam* FindContext( const CArrayFixFlat<TContextConfigParam>* aIncomingContextConfigParams, 
       
    98 		const TInt aExtensionId, const TInt aIndex );
       
    99 		
       
   100 	TBool GetContextInCorrectFormatForEtel(const TContextConfigParam* aContextConfig,
       
   101 				TDes8* aData);
       
   102 
       
   103 	const CTestConfigSection* CfgFile();
       
   104 	
       
   105 private:
       
   106 	CSimPacketService* iSimPacketService;
       
   107 		// Back link to parent class.
       
   108 		
       
   109 	CArrayFixFlat<TDelayIncomingContext>* iDelayIncomingContext;
       
   110 		// Used to drive the timing of the Incoming PDP contexts.
       
   111 	int iCurrentDelayIndex;
       
   112 		// Index to the delay/instuction we are currenly executing.
       
   113 
       
   114 
       
   115 	CSimPhone* iPhone;		//< Pointer to the phone object (The parent of this class)
       
   116 	CSimTimer* iTimer;		// < Pointer to the owned timer class.
       
   117 
       
   118 	CSimPubSub::TPubSubProperty iForceIncomingContextChangeProperty;
       
   119 	CSimPubSub* iForceIncomingContextChange;
       
   120 		// Used when CSimPubSub::TPubSubProperty(KUidPSSimTsyCategory, KPSSimTsyForceIncomingContextActivation, KPSSimTsyForceIncomingContextActivationType)
       
   121 		// is changed to force an incoming PDP in C++ code.
       
   122 
       
   123 	CArrayFixFlat<TContextConfigParam>* iIncomingContextConfigParams;	//< Pointer to a list of valid Context (GPRS/R99/R5) config parameters
       
   124 		// Note this is a duplicate of the config params in contexts. 
       
   125 		// It should be noted that potential configs are only avaliable after a PDP has been 
       
   126 		// created. This will not do as we need it when we get an incoming PDP i.e. 
       
   127 		// before we even have created a PDP. 
       
   128 		// Technically there should be only one copy of the TContextConfigParam's and that 
       
   129 		// should be at this level. But it would take a while to reorganise and test the code.		
       
   130 		
       
   131 		// At the moment only GPRS contexts are supported.
       
   132 
       
   133 
       
   134 private:
       
   135 	TBool iUseTimerOn;
       
   136 	
       
   137 };
       
   138 
       
   139 
       
   140 #endif	//__CSIMINCOMINGCONTEXT_H__
       
   141