1 // Copyright (c) 2004-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 // etel driver factory |
|
15 // |
|
16 // |
|
17 |
|
18 /** |
|
19 @file |
|
20 @internalComponent |
|
21 */ |
|
22 |
|
23 #ifndef CETELDRIVERFACTORY_H |
|
24 #define CETELDRIVERFACTORY_H |
|
25 |
|
26 #include <e32base.h> |
|
27 #include <etelmm.h> |
|
28 #include <etelpckt.h> |
|
29 |
|
30 #include "PDPFSM.h" |
|
31 #include "cservicechangenotifier.h" |
|
32 #include "eteldriverstrategies.h" |
|
33 #include "eteldrivernmspace.h" |
|
34 |
|
35 |
|
36 class CSpudContextElem; |
|
37 class CEtelDriverContext; |
|
38 |
|
39 /** factory (and owner) of spud etel driver objects */ |
|
40 class CEtelDriverFactory : public CBase |
|
41 { |
|
42 public: |
|
43 static CEtelDriverFactory* NewL (CPdpFsmInterface& aPdpFsmInterface); |
|
44 |
|
45 virtual ~CEtelDriverFactory(); |
|
46 |
|
47 virtual void InitL(); |
|
48 virtual void CreatePdpL (TContextId aPdpId); |
|
49 virtual void FreePdp(TContextId aPdpId); |
|
50 |
|
51 virtual void StartPdpNotifications (TContextId aPdpId); |
|
52 virtual void CancelPdpNotifications (TContextId aPdpId); |
|
53 virtual void CancelAllPdpNotifications(); |
|
54 |
|
55 void PdpStatusChangeNotifierCancel(TContextId aPdpId); |
|
56 void QoSChangeNotifierCancel(TContextId aPdpId); |
|
57 void PdpConfigChangeNotifierCancel(TContextId aPdpId); |
|
58 |
|
59 void GetLastErrorCause(TContextId aPdpId, TInt& aLastErrorCause); |
|
60 |
|
61 /** accessors */ |
|
62 TBool HasContext(TContextId aId) const; |
|
63 CEtelDriverContext& Context(TContextId aId); |
|
64 inline TInt ContextCount() const; |
|
65 inline RPacketService& PacketService(); |
|
66 inline RPhone& Phone(); |
|
67 inline MEtelDriverStrategy& Strategy(EtelDriver::TEtelDriverStrategy aId) const; |
|
68 inline CPdpFsmInterface& PdpFsmInterface() const; |
|
69 |
|
70 |
|
71 /** map etel input to strategy id */ |
|
72 inline EtelDriver::TEtelDriverStrategy StrategyId(EtelDriver::TEtelInput aInput) const; |
|
73 |
|
74 private: |
|
75 CEtelDriverFactory (CPdpFsmInterface& aPdpFsmInterface); |
|
76 void ConstructL(); |
|
77 |
|
78 private: |
|
79 // data common among all pdp contexts |
|
80 /** reference to clients CPdpFsmInterface */ |
|
81 CPdpFsmInterface& iPdpFsmInterface; |
|
82 /** tel server */ |
|
83 RTelServer iTelServer; |
|
84 /** phone */ |
|
85 RPhone iPhone; |
|
86 /** packet service */ |
|
87 RPacketService iPacketService; |
|
88 /** service change notify */ |
|
89 CServiceChangeNotifier iServiceChangeNotifier; |
|
90 |
|
91 /** global array of Etel Driver Stratergies */ |
|
92 TFixedArray<MEtelDriverStrategy*, EtelDriver::ESentinelStrategy> iStrategies; |
|
93 /** map of input to strategy id */ |
|
94 // Dev. note: we might have more Strategies then Inputs |
|
95 TFixedArray<EtelDriver::TEtelDriverStrategy, EtelDriver::ESentinelInput> iInputToStrategyMap; |
|
96 |
|
97 |
|
98 /** array of pdp contexts and notifiers |
|
99 Dev. note: primary and secondary contexts could be in arbitrary slots |
|
100 */ |
|
101 TFixedArray<CSpudContextElem*, KMaxPdpContexts> iContexts; |
|
102 |
|
103 /** open strategy */ |
|
104 TOpenStrategy iOpenStrategy; |
|
105 /** set QoS strategy */ |
|
106 TSetQoSStrategy iSetQoSStrategy; |
|
107 /** set TFT strategy */ |
|
108 TSetTftStrategy iSetTftStrategy; |
|
109 /** change TFT strategy */ |
|
110 TChangeTftStrategy iChangeTftStrategy; |
|
111 /** create primary pdp context strategy */ |
|
112 TCreate1ryPdpContextStrategy iCreate1ryPdpContextStrategy; |
|
113 /** create secondary pdp context strategy */ |
|
114 TCreate2ryPdpContextStrategy iCreate2ryPdpContextStrategy; |
|
115 /** activate pdp context strategy */ |
|
116 TActivatePdpStrategy iActivatePdpStrategy; |
|
117 /** retrieve negotiated qos strategy */ |
|
118 TGetNegQoSStrategy iGetNegQoSStrategy; |
|
119 /** modify active pdp context strategy */ |
|
120 TModifyActiveStrategy iModifyActivePdpStrategy; |
|
121 /** delete pdp context strategy */ |
|
122 TContextDeleteStrategy iContextDeleteStrategy; |
|
123 }; |
|
124 |
|
125 |
|
126 // inlines |
|
127 /** returns count of pdp contexts |
|
128 |
|
129 @return count of pdp contexts |
|
130 */ |
|
131 inline TInt CEtelDriverFactory::ContextCount() const |
|
132 { |
|
133 return iContexts.Count(); |
|
134 } |
|
135 |
|
136 /** accessor |
|
137 |
|
138 @return reference to etel RPacketService |
|
139 */ |
|
140 inline RPacketService& CEtelDriverFactory::PacketService() |
|
141 { |
|
142 return iPacketService; |
|
143 } |
|
144 |
|
145 /** accessor |
|
146 |
|
147 @return reference to etel RPhone |
|
148 */ |
|
149 inline RPhone& CEtelDriverFactory::Phone() |
|
150 { |
|
151 return iPhone; |
|
152 } |
|
153 |
|
154 /** accessor |
|
155 |
|
156 @return reference to etel driver strategy |
|
157 */ |
|
158 inline MEtelDriverStrategy& CEtelDriverFactory::Strategy(EtelDriver::TEtelDriverStrategy aId) const |
|
159 { |
|
160 return *iStrategies[aId]; |
|
161 } |
|
162 |
|
163 /** accessor |
|
164 |
|
165 @return reference to pdp fsm interface |
|
166 */ |
|
167 inline CPdpFsmInterface& CEtelDriverFactory::PdpFsmInterface() const |
|
168 { |
|
169 return iPdpFsmInterface; |
|
170 } |
|
171 |
|
172 /** map etel input to strategy id |
|
173 |
|
174 @param aInput - etel input id |
|
175 @return id of etel driver strategy |
|
176 */ |
|
177 inline EtelDriver::TEtelDriverStrategy CEtelDriverFactory::StrategyId(EtelDriver::TEtelInput aInput) const |
|
178 { |
|
179 return iInputToStrategyMap[aInput]; |
|
180 } |
|
181 |
|
182 #endif // CETELDRIVERFACTORY_H |
|