telephonyprotocols/umtsgprsscpr/spudtel/inc/ceteldriverfactory.h
author hgs
Tue, 22 Jun 2010 11:02:32 +0100
changeset 44 8b72faa1200f
permissions -rw-r--r--
201024_02
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
44
8b72faa1200f 201024_02
hgs
parents:
diff changeset
     1
// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
8b72faa1200f 201024_02
hgs
parents:
diff changeset
     2
// All rights reserved.
8b72faa1200f 201024_02
hgs
parents:
diff changeset
     3
// This component and the accompanying materials are made available
8b72faa1200f 201024_02
hgs
parents:
diff changeset
     4
// under the terms of "Eclipse Public License v1.0"
8b72faa1200f 201024_02
hgs
parents:
diff changeset
     5
// which accompanies this distribution, and is available
8b72faa1200f 201024_02
hgs
parents:
diff changeset
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
8b72faa1200f 201024_02
hgs
parents:
diff changeset
     7
//
8b72faa1200f 201024_02
hgs
parents:
diff changeset
     8
// Initial Contributors:
8b72faa1200f 201024_02
hgs
parents:
diff changeset
     9
// Nokia Corporation - initial contribution.
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    10
//
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    11
// Contributors:
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    12
//
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    13
// Description:
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    14
// etel driver factory
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    15
// 
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    16
//
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    17
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    18
/**
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    19
 @file 
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    20
 @internalComponent
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    21
*/
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    22
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    23
#ifndef CETELDRIVERFACTORY_H
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    24
#define CETELDRIVERFACTORY_H
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    25
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    26
#include <e32base.h>
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    27
#include <etelmm.h>
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    28
#include <etelpckt.h>
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    29
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    30
#include "PDPFSM.h"
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    31
#include "cservicechangenotifier.h"
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    32
#include "eteldriverstrategies.h"
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    33
#include "eteldrivernmspace.h"
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    34
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    35
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    36
class CSpudContextElem;
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    37
class CEtelDriverContext;
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    38
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    39
/** factory (and owner) of spud etel driver objects */
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    40
class CEtelDriverFactory : public CBase
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    41
	{
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    42
public:
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    43
	static CEtelDriverFactory* NewL (CPdpFsmInterface& aPdpFsmInterface);
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    44
	
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    45
	virtual ~CEtelDriverFactory();
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    46
	
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    47
	virtual void InitL();
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    48
	virtual void CreatePdpL (TContextId aPdpId);
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    49
	virtual void FreePdp(TContextId aPdpId);
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    50
	
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    51
	virtual void StartPdpNotifications (TContextId aPdpId);
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    52
	virtual void CancelPdpNotifications (TContextId aPdpId);
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    53
	virtual void CancelAllPdpNotifications();
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    54
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    55
    void PdpStatusChangeNotifierCancel(TContextId aPdpId);
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    56
    void QoSChangeNotifierCancel(TContextId aPdpId);
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    57
    void PdpConfigChangeNotifierCancel(TContextId aPdpId);
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    58
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    59
    void GetLastErrorCause(TContextId aPdpId, TInt& aLastErrorCause);
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    60
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    61
	/** accessors */
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    62
	TBool HasContext(TContextId aId) const;
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    63
	CEtelDriverContext& Context(TContextId aId);
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    64
	inline TInt ContextCount() const;
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    65
	inline RPacketService& PacketService();
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    66
	inline RPhone& Phone();
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    67
	inline MEtelDriverStrategy& Strategy(EtelDriver::TEtelDriverStrategy aId) const;
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    68
	inline CPdpFsmInterface& PdpFsmInterface() const;
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    69
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    70
		
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    71
	/** map etel input to strategy id */
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    72
	inline EtelDriver::TEtelDriverStrategy StrategyId(EtelDriver::TEtelInput aInput) const;
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    73
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    74
private:
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    75
	CEtelDriverFactory (CPdpFsmInterface& aPdpFsmInterface);
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    76
	void ConstructL();
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    77
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    78
private:
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    79
	// data common among all pdp contexts
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    80
	/** reference to clients CPdpFsmInterface */
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    81
	CPdpFsmInterface& 	iPdpFsmInterface;
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    82
	/** tel server */
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    83
	RTelServer			iTelServer;
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    84
	/** phone */
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    85
	RPhone				iPhone;
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    86
	/** packet service */
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    87
	RPacketService 		iPacketService;
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    88
	/** service change notify */
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    89
	CServiceChangeNotifier iServiceChangeNotifier;
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    90
	
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    91
	/** global array of Etel Driver Stratergies */
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    92
	TFixedArray<MEtelDriverStrategy*, EtelDriver::ESentinelStrategy>	iStrategies;
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    93
	/** map of input to strategy id */
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    94
	// Dev. note: we might have more Strategies then Inputs
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    95
	TFixedArray<EtelDriver::TEtelDriverStrategy, EtelDriver::ESentinelInput> 		iInputToStrategyMap;
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    96
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    97
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    98
	/** array of pdp contexts and notifiers
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    99
		Dev. note: primary and secondary contexts could be in arbitrary slots
8b72faa1200f 201024_02
hgs
parents:
diff changeset
   100
	*/
8b72faa1200f 201024_02
hgs
parents:
diff changeset
   101
	TFixedArray<CSpudContextElem*, KMaxPdpContexts> 		iContexts;
8b72faa1200f 201024_02
hgs
parents:
diff changeset
   102
8b72faa1200f 201024_02
hgs
parents:
diff changeset
   103
	/** open strategy */	
8b72faa1200f 201024_02
hgs
parents:
diff changeset
   104
	TOpenStrategy 					iOpenStrategy;
8b72faa1200f 201024_02
hgs
parents:
diff changeset
   105
	/** set QoS strategy */	
8b72faa1200f 201024_02
hgs
parents:
diff changeset
   106
	TSetQoSStrategy 				iSetQoSStrategy;
8b72faa1200f 201024_02
hgs
parents:
diff changeset
   107
	/** set TFT strategy */
8b72faa1200f 201024_02
hgs
parents:
diff changeset
   108
	TSetTftStrategy					iSetTftStrategy;
8b72faa1200f 201024_02
hgs
parents:
diff changeset
   109
	/** change TFT strategy */
8b72faa1200f 201024_02
hgs
parents:
diff changeset
   110
	TChangeTftStrategy				iChangeTftStrategy;
8b72faa1200f 201024_02
hgs
parents:
diff changeset
   111
	/** create primary pdp context strategy */
8b72faa1200f 201024_02
hgs
parents:
diff changeset
   112
	TCreate1ryPdpContextStrategy	iCreate1ryPdpContextStrategy;
8b72faa1200f 201024_02
hgs
parents:
diff changeset
   113
	/** create secondary pdp context strategy */
8b72faa1200f 201024_02
hgs
parents:
diff changeset
   114
	TCreate2ryPdpContextStrategy 	iCreate2ryPdpContextStrategy;
8b72faa1200f 201024_02
hgs
parents:
diff changeset
   115
	/** activate pdp context strategy */
8b72faa1200f 201024_02
hgs
parents:
diff changeset
   116
	TActivatePdpStrategy			iActivatePdpStrategy;
8b72faa1200f 201024_02
hgs
parents:
diff changeset
   117
	/** retrieve negotiated qos strategy */
8b72faa1200f 201024_02
hgs
parents:
diff changeset
   118
	TGetNegQoSStrategy				iGetNegQoSStrategy;
8b72faa1200f 201024_02
hgs
parents:
diff changeset
   119
	/** modify active pdp context strategy */
8b72faa1200f 201024_02
hgs
parents:
diff changeset
   120
	TModifyActiveStrategy			iModifyActivePdpStrategy;
8b72faa1200f 201024_02
hgs
parents:
diff changeset
   121
	/** delete pdp context strategy */
8b72faa1200f 201024_02
hgs
parents:
diff changeset
   122
	TContextDeleteStrategy			iContextDeleteStrategy;
8b72faa1200f 201024_02
hgs
parents:
diff changeset
   123
	};
8b72faa1200f 201024_02
hgs
parents:
diff changeset
   124
8b72faa1200f 201024_02
hgs
parents:
diff changeset
   125
8b72faa1200f 201024_02
hgs
parents:
diff changeset
   126
// inlines
8b72faa1200f 201024_02
hgs
parents:
diff changeset
   127
/** returns count of pdp contexts
8b72faa1200f 201024_02
hgs
parents:
diff changeset
   128
8b72faa1200f 201024_02
hgs
parents:
diff changeset
   129
@return count of pdp contexts
8b72faa1200f 201024_02
hgs
parents:
diff changeset
   130
*/
8b72faa1200f 201024_02
hgs
parents:
diff changeset
   131
inline TInt CEtelDriverFactory::ContextCount() const
8b72faa1200f 201024_02
hgs
parents:
diff changeset
   132
	{ 
8b72faa1200f 201024_02
hgs
parents:
diff changeset
   133
	return iContexts.Count(); 
8b72faa1200f 201024_02
hgs
parents:
diff changeset
   134
	}
8b72faa1200f 201024_02
hgs
parents:
diff changeset
   135
	
8b72faa1200f 201024_02
hgs
parents:
diff changeset
   136
/** accessor 
8b72faa1200f 201024_02
hgs
parents:
diff changeset
   137
8b72faa1200f 201024_02
hgs
parents:
diff changeset
   138
@return reference to etel RPacketService
8b72faa1200f 201024_02
hgs
parents:
diff changeset
   139
*/
8b72faa1200f 201024_02
hgs
parents:
diff changeset
   140
inline RPacketService& CEtelDriverFactory::PacketService()
8b72faa1200f 201024_02
hgs
parents:
diff changeset
   141
	{ 
8b72faa1200f 201024_02
hgs
parents:
diff changeset
   142
	return iPacketService; 
8b72faa1200f 201024_02
hgs
parents:
diff changeset
   143
	}
8b72faa1200f 201024_02
hgs
parents:
diff changeset
   144
	
8b72faa1200f 201024_02
hgs
parents:
diff changeset
   145
/** accessor 
8b72faa1200f 201024_02
hgs
parents:
diff changeset
   146
8b72faa1200f 201024_02
hgs
parents:
diff changeset
   147
@return reference to etel RPhone
8b72faa1200f 201024_02
hgs
parents:
diff changeset
   148
*/
8b72faa1200f 201024_02
hgs
parents:
diff changeset
   149
inline RPhone& CEtelDriverFactory::Phone()
8b72faa1200f 201024_02
hgs
parents:
diff changeset
   150
	{ 
8b72faa1200f 201024_02
hgs
parents:
diff changeset
   151
	return iPhone; 
8b72faa1200f 201024_02
hgs
parents:
diff changeset
   152
	}
8b72faa1200f 201024_02
hgs
parents:
diff changeset
   153
	
8b72faa1200f 201024_02
hgs
parents:
diff changeset
   154
/** accessor 
8b72faa1200f 201024_02
hgs
parents:
diff changeset
   155
8b72faa1200f 201024_02
hgs
parents:
diff changeset
   156
@return reference to etel driver strategy
8b72faa1200f 201024_02
hgs
parents:
diff changeset
   157
*/
8b72faa1200f 201024_02
hgs
parents:
diff changeset
   158
inline MEtelDriverStrategy& CEtelDriverFactory::Strategy(EtelDriver::TEtelDriverStrategy aId) const
8b72faa1200f 201024_02
hgs
parents:
diff changeset
   159
	{ 
8b72faa1200f 201024_02
hgs
parents:
diff changeset
   160
	return *iStrategies[aId]; 
8b72faa1200f 201024_02
hgs
parents:
diff changeset
   161
	}
8b72faa1200f 201024_02
hgs
parents:
diff changeset
   162
	
8b72faa1200f 201024_02
hgs
parents:
diff changeset
   163
/** accessor 
8b72faa1200f 201024_02
hgs
parents:
diff changeset
   164
8b72faa1200f 201024_02
hgs
parents:
diff changeset
   165
@return reference to pdp fsm interface
8b72faa1200f 201024_02
hgs
parents:
diff changeset
   166
*/
8b72faa1200f 201024_02
hgs
parents:
diff changeset
   167
inline CPdpFsmInterface& CEtelDriverFactory::PdpFsmInterface() const
8b72faa1200f 201024_02
hgs
parents:
diff changeset
   168
	{ 
8b72faa1200f 201024_02
hgs
parents:
diff changeset
   169
	return iPdpFsmInterface;
8b72faa1200f 201024_02
hgs
parents:
diff changeset
   170
	}
8b72faa1200f 201024_02
hgs
parents:
diff changeset
   171
8b72faa1200f 201024_02
hgs
parents:
diff changeset
   172
/** map etel input to strategy id 
8b72faa1200f 201024_02
hgs
parents:
diff changeset
   173
8b72faa1200f 201024_02
hgs
parents:
diff changeset
   174
@param aInput - etel input id
8b72faa1200f 201024_02
hgs
parents:
diff changeset
   175
@return id of etel driver strategy 
8b72faa1200f 201024_02
hgs
parents:
diff changeset
   176
*/
8b72faa1200f 201024_02
hgs
parents:
diff changeset
   177
inline EtelDriver::TEtelDriverStrategy CEtelDriverFactory::StrategyId(EtelDriver::TEtelInput aInput) const
8b72faa1200f 201024_02
hgs
parents:
diff changeset
   178
	{ 
8b72faa1200f 201024_02
hgs
parents:
diff changeset
   179
	return iInputToStrategyMap[aInput]; 
8b72faa1200f 201024_02
hgs
parents:
diff changeset
   180
	}
8b72faa1200f 201024_02
hgs
parents:
diff changeset
   181
8b72faa1200f 201024_02
hgs
parents:
diff changeset
   182
#endif // CETELDRIVERFACTORY_H