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 // PDP FSM implementation |
|
15 // @internalTechnology |
|
16 // |
|
17 // |
|
18 |
|
19 |
|
20 #include "tpdpstates.h" |
|
21 #include "cpdpfsm.h" |
|
22 #include "cpdpfsmfactory.h" |
|
23 #include "spudfsmdebuglogger.h" |
|
24 #include "eteldrivernmspace.h" |
|
25 |
|
26 void CPdpFsm::ConstructL() |
|
27 { |
|
28 // Create EtelDriver for this ID - does nothing on ETel |
|
29 iEtelDriverInput->CreatePdpL(iPdpId); |
|
30 |
|
31 // we need a state |
|
32 iState = &iPdpFsmFactory->iStateInitialised; |
|
33 } |
|
34 |
|
35 CPdpFsm* CPdpFsm::NewL(TContextId aPdpId, CPdpFsmFactory * aPdpFsmFactory, REtelDriverInput * aEtelDriverInput) |
|
36 { |
|
37 SPUDFSMVERBOSE_FNLOG("CPdpFsm::NewL()"); |
|
38 CPdpFsm* self = new (ELeave)CPdpFsm(aPdpId, aPdpFsmFactory, aEtelDriverInput); |
|
39 CleanupStack::PushL(self); |
|
40 self->ConstructL(); |
|
41 CleanupStack::Pop(self); |
|
42 return self; |
|
43 } |
|
44 |
|
45 CPdpFsm::CPdpFsm(TContextId aPdpId, CPdpFsmFactory * aPdpFsmFactory, REtelDriverInput * aEtelDriverInput) : |
|
46 iPdpFsmFactory(aPdpFsmFactory), |
|
47 iEtelDriverInput(aEtelDriverInput), |
|
48 iPdpId(aPdpId) |
|
49 // NOTE: Both pointers are valid when called - see CPdpFsmFactory and CPdpFsmInterface. |
|
50 // No other caller is expected. |
|
51 { |
|
52 SPUDFSMVERBOSE_LOG1(_L("Pdp ID %d"),iPdpId); |
|
53 } |
|
54 |
|
55 CPdpFsm::~CPdpFsm() |
|
56 { |
|
57 SPUDFSMVERBOSE_FNLOG("CPdpFsm::~CPdpFsm()"); |
|
58 SPUDFSMVERBOSE_LOG1(_L("Pdp ID %d"),iPdpId); |
|
59 } |
|
60 |
|
61 |
|
62 TInt CPdpFsm::Input (const TInt aOperation, const TInt aParam) |
|
63 { |
|
64 SPUDFSMVERBOSE_FNLOG("CPdpFsm::Input()"); |
|
65 SPUDFSMVERBOSE_LOG1(_L("Pdp ID %d"),iPdpId); |
|
66 |
|
67 #ifdef _DEBUG // NOT DEBUGRELEASE |
|
68 SPUDFSMVERBOSE_LOG1(_L("State : %S"), &iState->iName); |
|
69 #endif |
|
70 |
|
71 SPUDFSM_LOG3(_L("Pdp ID %d, State '%S', Operation '%S'"),iPdpId, &iState->iName, iState->LogOperation(*this, aOperation)); |
|
72 |
|
73 return iState->Input (*this, aOperation, aParam); |
|
74 } |
|
75 |
|
76 |
|
77 #ifdef SYMBIAN_NETWORKING_UMTSR5 |
|
78 void CPdpFsm::Get(RPacketQoS::TQoSR5Requested& aParam) |
|
79 { |
|
80 SPUDFSMVERBOSE_FNLOG("CPdpFsm::Get(QoSR5Req)"); |
|
81 SPUDFSMVERBOSE_LOG1(_L("Pdp ID %d"),iPdpId); |
|
82 |
|
83 ASSERT(iQosRequested.ExtensionId() == TPacketDataConfigBase::KConfigRel5); |
|
84 aParam = iQosRequested.RequestedQoSR5(); |
|
85 } |
|
86 |
|
87 void CPdpFsm::Get(RPacketQoS::TQoSR5Negotiated& aParam) |
|
88 { |
|
89 SPUDFSMVERBOSE_FNLOG("CPdpFsm::Get(QoSR5Neg)"); |
|
90 SPUDFSMVERBOSE_LOG1(_L("Pdp ID %d"),iPdpId); |
|
91 |
|
92 ASSERT(iQosNegotiated.ExtensionId() == TPacketDataConfigBase::KConfigRel5); |
|
93 aParam = iQosNegotiated.NegotiatedQoSR5(); |
|
94 } |
|
95 |
|
96 #else |
|
97 // !SYMBIAN_NETWORKING_UMTSR5 |
|
98 |
|
99 void CPdpFsm::Get(RPacketQoS::TQoSR99_R4Requested& aParam) |
|
100 { |
|
101 SPUDFSMVERBOSE_FNLOG("CPdpFsm::Get(QosReq)"); |
|
102 SPUDFSMVERBOSE_LOG1(_L("Pdp ID %d"),iPdpId); |
|
103 |
|
104 aParam = iQosRequested.RequestedQoSR99_R4(); |
|
105 } |
|
106 |
|
107 void CPdpFsm::Get(RPacketQoS::TQoSR99_R4Negotiated& aParam) |
|
108 { |
|
109 SPUDFSMVERBOSE_FNLOG("CPdpFsm::Get(QoSNeg)"); |
|
110 SPUDFSMVERBOSE_LOG1(_L("Pdp ID %d"),iPdpId); |
|
111 |
|
112 aParam = iQosNegotiated.NegotiatedQoSR99_R4(); |
|
113 } |
|
114 |
|
115 #endif |
|
116 // SYMBIAN_NETWORKING_UMTSR5 |
|
117 |
|
118 |
|
119 void CPdpFsm::Get(TTFTInfo& aParam) |
|
120 { |
|
121 SPUDFSMVERBOSE_FNLOG("CPdpFsm::Get(TFTInfo)"); |
|
122 SPUDFSMVERBOSE_LOG1(_L("Pdp ID %d"),iPdpId); |
|
123 |
|
124 aParam = iTFT; |
|
125 } |
|
126 |
|
127 void CPdpFsm::Get(TTFTOperationCode& aParam) |
|
128 { |
|
129 SPUDFSMVERBOSE_FNLOG("CPdpFsm::Get(TFTOperationCode)"); |
|
130 SPUDFSMVERBOSE_LOG1(_L("Pdp ID %d"),iPdpId); |
|
131 |
|
132 aParam = iTFTOperationCode; |
|
133 } |
|
134 |
|
135 void CPdpFsm::Get(RPacketContext::TDataChannelV2& aParam) |
|
136 { |
|
137 SPUDFSMVERBOSE_FNLOG("CPdpFsm::Get(RPacketContext::TDataChannelV2)"); |
|
138 SPUDFSMVERBOSE_LOG1(_L("Pdp ID %d"),iPdpId); |
|
139 |
|
140 aParam = iDataChannelV2; |
|
141 } |
|
142 |
|
143 void CPdpFsm::Get(RPacketContext::TContextConfigGPRS& aParam) |
|
144 { |
|
145 SPUDFSMVERBOSE_FNLOG("CPdpFsm::Get(RPacketContext::TContextConfigGPRS)"); |
|
146 SPUDFSMVERBOSE_LOG1(_L("Pdp ID %d"),iPdpId); |
|
147 |
|
148 aParam = iGPRS; |
|
149 } |
|
150 |
|
151 void CPdpFsm::Get(RPacketContext::TContextStatus& aParam) |
|
152 { |
|
153 SPUDFSMVERBOSE_FNLOG("CPdpFsm::Get(RPacketContext::TContextStatus)"); |
|
154 SPUDFSMVERBOSE_LOG1(_L("Pdp ID %d"),iPdpId); |
|
155 |
|
156 aParam = iContextStatus; |
|
157 } |
|
158 |
|
159 |
|
160 #ifdef SYMBIAN_NETWORKING_UMTSR5 |
|
161 void CPdpFsm::Set(const RPacketQoS::TQoSR5Requested& aParam) |
|
162 { |
|
163 SPUDFSMVERBOSE_FNLOG("CPdpFsm::Set(QoSR5Req)"); |
|
164 SPUDFSMVERBOSE_LOG1(_L("Pdp ID %d"),iPdpId); |
|
165 |
|
166 iQosRequested = aParam; |
|
167 } |
|
168 |
|
169 void CPdpFsm::Set(const RPacketQoS::TQoSR5Negotiated& aParam) |
|
170 { |
|
171 SPUDFSMVERBOSE_FNLOG("CPdpFsm::Set(QoSR5Neg)"); |
|
172 SPUDFSMVERBOSE_LOG1(_L("Pdp ID %d"),iPdpId); |
|
173 |
|
174 iQosNegotiated = aParam; |
|
175 } |
|
176 |
|
177 #else |
|
178 // !SYMBIAN_NETWORKING_UMTSR5 |
|
179 |
|
180 |
|
181 void CPdpFsm::Set(const RPacketQoS::TQoSR99_R4Requested& aParam) |
|
182 { |
|
183 SPUDFSMVERBOSE_FNLOG("CPdpFsm::Set(QoSReq)"); |
|
184 SPUDFSMVERBOSE_LOG1(_L("Pdp ID %d"),iPdpId); |
|
185 |
|
186 iQosRequested = aParam; |
|
187 |
|
188 } |
|
189 |
|
190 |
|
191 void CPdpFsm::Set(const RPacketQoS::TQoSR99_R4Negotiated& aParam) |
|
192 { |
|
193 SPUDFSMVERBOSE_FNLOG("CPdpFsm::Set(QoSNeg)"); |
|
194 SPUDFSMVERBOSE_LOG1(_L("Pdp ID %d"),iPdpId); |
|
195 |
|
196 iQosNegotiated = aParam; |
|
197 } |
|
198 |
|
199 |
|
200 #endif |
|
201 // SYMBIAN_NETWORKING_UMTSR5 |
|
202 |
|
203 |
|
204 void CPdpFsm::Set(const TTFTInfo& aParam) |
|
205 { |
|
206 SPUDFSMVERBOSE_FNLOG("CPdpFsm::Set(TFT)"); |
|
207 SPUDFSMVERBOSE_LOG1(_L("Pdp ID %d"),iPdpId); |
|
208 |
|
209 iTFT = aParam; |
|
210 } |
|
211 |
|
212 void CPdpFsm::Set(const TTFTOperationCode& aParam) |
|
213 { |
|
214 SPUDFSMVERBOSE_FNLOG("CPdpFsm::Set(TFTOperationCode)"); |
|
215 SPUDFSMVERBOSE_LOG1(_L("Pdp ID %d"),iPdpId); |
|
216 |
|
217 iTFTOperationCode = aParam; |
|
218 } |
|
219 |
|
220 void CPdpFsm::Set(const RPacketContext::TDataChannelV2& aParam) |
|
221 { |
|
222 SPUDFSMVERBOSE_FNLOG("CPdpFsm::Set(RPacketContext::TDataChannelV2)"); |
|
223 SPUDFSMVERBOSE_LOG1(_L("Pdp ID %d"),iPdpId); |
|
224 |
|
225 iDataChannelV2 = aParam; |
|
226 } |
|
227 |
|
228 void CPdpFsm::Set(const RPacketContext::TContextStatus& aParam) |
|
229 { |
|
230 SPUDFSMVERBOSE_FNLOG("CPdpFsm::Set(RPacketContext::TContextStatus)"); |
|
231 SPUDFSMVERBOSE_LOG1(_L("Pdp ID %d"),iPdpId); |
|
232 |
|
233 iContextStatus = aParam; |
|
234 } |
|
235 |
|
236 void CPdpFsm::Set(const RPacketContext::TContextConfigGPRS& aParam) |
|
237 { |
|
238 SPUDFSMVERBOSE_FNLOG("CPdpFsm::Set(RPacketContext::TContextConfigGPRS)"); |
|
239 SPUDFSMVERBOSE_LOG1(_L("Pdp ID %d"),iPdpId); |
|
240 |
|
241 iGPRS = aParam; |
|
242 } |
|
243 |
|
244 void CPdpFsm::EtelInput (EtelDriver::TEtelInput aOperation) |
|
245 { |
|
246 SPUDFSMVERBOSE_FNLOG("CPdpFsm::EtelInput"); |
|
247 SPUDFSMVERBOSE_LOG1(_L("Pdp ID %d"),iPdpId); |
|
248 |
|
249 iEtelDriverInput->Input (iPdpId, aOperation); |
|
250 } |
|
251 |
|
252 void CPdpFsm::EtelCancel (void) |
|
253 { |
|
254 SPUDFSMVERBOSE_FNLOG("CPdpFsm::EtelCancel"); |
|
255 SPUDFSMVERBOSE_LOG1(_L("Pdp ID %d"),iPdpId); |
|
256 |
|
257 iEtelDriverInput->CancelPdp (iPdpId); |
|
258 } |
|
259 |
|
260 void CPdpFsm::GetLastErrorCause (TInt& aLastErrorCause) |
|
261 { |
|
262 SPUDFSMVERBOSE_FNLOG("CPdpFsm::GetLastErrorCause"); |
|
263 SPUDFSMVERBOSE_LOG1(_L("Pdp ID %d"),iPdpId); |
|
264 |
|
265 iEtelDriverInput->GetLastErrorCause (iPdpId, aLastErrorCause); |
|
266 } |
|
267 |
|
268 void CPdpFsm::SpudInput (TInt aNotification, TInt aParam) |
|
269 { |
|
270 SPUDFSMVERBOSE_FNLOG("CPdpFsm::SpudInput"); |
|
271 SPUDFSMVERBOSE_LOG1(_L("Pdp ID %d"),iPdpId); |
|
272 |
|
273 iPdpFsmFactory->SpudInput (iPdpId, aNotification, aParam); |
|
274 } |
|
275 |
|
276 // state change members |
|
277 |
|
278 void CPdpFsm::ChangeStateToInitialised(void) |
|
279 { |
|
280 SPUDFSMVERBOSE_FNLOG("CPdpFsm::ChangeStateToInitialised"); |
|
281 SPUDFSMVERBOSE_LOG1(_L("Pdp ID %d"),iPdpId); |
|
282 SPUDFSM_LOG(_L("New State : Initialised")); |
|
283 |
|
284 iState = &iPdpFsmFactory->iStateInitialised; |
|
285 } |
|
286 |
|
287 void CPdpFsm::ChangeStateToOpeningPhone(void) |
|
288 { |
|
289 SPUDFSMVERBOSE_FNLOG("CPdpFsm::ChangeStateToOpeningPhone"); |
|
290 SPUDFSMVERBOSE_LOG1(_L("Pdp ID %d"),iPdpId); |
|
291 SPUDFSM_LOG(_L("New State : OpeningPhone")); |
|
292 |
|
293 iState = &iPdpFsmFactory->iStateOpeningPhone; |
|
294 } |
|
295 |
|
296 void CPdpFsm::ChangeStateToCreatingPrimary(void) |
|
297 { |
|
298 SPUDFSMVERBOSE_FNLOG("CPdpFsm::ChangeStateToCreatingPrimary"); |
|
299 SPUDFSMVERBOSE_LOG1(_L("Pdp ID %d"),iPdpId); |
|
300 SPUDFSM_LOG(_L("New State : CreatingPrimary")); |
|
301 |
|
302 iState = &iPdpFsmFactory->iStateCreatingPrimary; |
|
303 } |
|
304 |
|
305 void CPdpFsm::ChangeStateToActivatingPrimary(void) |
|
306 { |
|
307 SPUDFSMVERBOSE_FNLOG("CPdpFsm::ChangeStateToActivatingPrimary"); |
|
308 SPUDFSMVERBOSE_LOG1(_L("Pdp ID %d"),iPdpId); |
|
309 SPUDFSM_LOG(_L("New State : ActivatingPrimary")); |
|
310 |
|
311 iState = &iPdpFsmFactory->iStateActivatingPrimary; |
|
312 } |
|
313 |
|
314 void CPdpFsm::ChangeStateToCreatingSecondary(void) |
|
315 { |
|
316 SPUDFSMVERBOSE_FNLOG("CPdpFsm::ChangeStateToCreatingSecondary"); |
|
317 SPUDFSMVERBOSE_LOG1(_L("Pdp ID %d"),iPdpId); |
|
318 SPUDFSM_LOG(_L("New State : CreatingSecondary")); |
|
319 |
|
320 iState = &iPdpFsmFactory->iStateCreatingSecondary; |
|
321 } |
|
322 |
|
323 void CPdpFsm::ChangeStateToCreatedSecondary(void) |
|
324 { |
|
325 SPUDFSMVERBOSE_FNLOG("CPdpFsm::ChangeStateToCreatedSecondary"); |
|
326 SPUDFSMVERBOSE_LOG1(_L("Pdp ID %d"),iPdpId); |
|
327 SPUDFSM_LOG(_L("New State : CreatedSecondary")); |
|
328 |
|
329 iState = &iPdpFsmFactory->iStateCreatedSecondary; |
|
330 } |
|
331 |
|
332 void CPdpFsm::ChangeStateToSettingTFT(void) |
|
333 { |
|
334 SPUDFSMVERBOSE_FNLOG("CPdpFsm::ChangeStateToSettingTFT"); |
|
335 SPUDFSMVERBOSE_LOG1(_L("Pdp ID %d"),iPdpId); |
|
336 SPUDFSM_LOG(_L("New State : SettingTFT")); |
|
337 |
|
338 iState = &iPdpFsmFactory->iStateSettingTFT; |
|
339 } |
|
340 |
|
341 void CPdpFsm::ChangeStateToSettingQoS(void) |
|
342 { |
|
343 SPUDFSMVERBOSE_FNLOG("CPdpFsm::ChangeStateToSettingQoS"); |
|
344 SPUDFSMVERBOSE_LOG1(_L("Pdp ID %d"),iPdpId); |
|
345 SPUDFSM_LOG(_L("New State : SettingQoS")); |
|
346 |
|
347 iState = &iPdpFsmFactory->iStateSettingQoS; |
|
348 } |
|
349 |
|
350 void CPdpFsm::ChangeStateToActivatingSecondary(void) |
|
351 { |
|
352 SPUDFSMVERBOSE_FNLOG("CPdpFsm::ChangeStateToActivatingSecondary"); |
|
353 SPUDFSMVERBOSE_LOG1(_L("Pdp ID %d"),iPdpId); |
|
354 SPUDFSM_LOG(_L("New State : ActivatingSecondary")); |
|
355 |
|
356 iState = &iPdpFsmFactory->iStateActivatingSecondary; |
|
357 } |
|
358 |
|
359 void CPdpFsm::ChangeStateToOpen(void) |
|
360 { |
|
361 SPUDFSMVERBOSE_FNLOG("CPdpFsm::ChangeStateToOpen"); |
|
362 SPUDFSMVERBOSE_LOG1(_L("Pdp ID %d"),iPdpId); |
|
363 SPUDFSM_LOG(_L("New State : Open")); |
|
364 |
|
365 iState = &iPdpFsmFactory->iStateOpen; |
|
366 } |
|
367 |
|
368 void CPdpFsm::ChangeStateToChangingQoS(void) |
|
369 { |
|
370 SPUDFSMVERBOSE_FNLOG("CPdpFsm::ChangeStateToChangingQoS"); |
|
371 SPUDFSMVERBOSE_LOG1(_L("Pdp ID %d"),iPdpId); |
|
372 SPUDFSM_LOG(_L("New State : ChangingQoS")); |
|
373 |
|
374 iState = &iPdpFsmFactory->iStateChangingQoS; |
|
375 } |
|
376 |
|
377 void CPdpFsm::ChangeStateToChangingTFT(void) |
|
378 { |
|
379 SPUDFSMVERBOSE_FNLOG("CPdpFsm::ChangeStateToChangingTFT"); |
|
380 SPUDFSMVERBOSE_LOG1(_L("Pdp ID %d"),iPdpId); |
|
381 SPUDFSM_LOG(_L("New State : ChangingTFT")); |
|
382 |
|
383 iState = &iPdpFsmFactory->iStateChangingTFT; |
|
384 } |
|
385 |
|
386 void CPdpFsm::ChangeStateToGettingNegQoS(void) |
|
387 { |
|
388 SPUDFSMVERBOSE_FNLOG("CPdpFsm::ChangeStateToGettingNegQoS"); |
|
389 SPUDFSMVERBOSE_LOG1(_L("Pdp ID %d"),iPdpId); |
|
390 SPUDFSM_LOG(_L("New State : GettingNegQoS")); |
|
391 |
|
392 iState = &iPdpFsmFactory->iStateGettingNegQoS; |
|
393 } |
|
394 |
|
395 |
|
396 |
|
397 void CPdpFsm::ChangeStateToModifingActive(void) |
|
398 { |
|
399 SPUDFSMVERBOSE_FNLOG("CPdpFsm::ChangeStateToModifingActive"); |
|
400 SPUDFSMVERBOSE_LOG1(_L("Pdp ID %d"),iPdpId); |
|
401 SPUDFSM_LOG(_L("New State : ModifingActive")); |
|
402 |
|
403 iState = &iPdpFsmFactory->iStateModifyingActive; |
|
404 } |
|
405 |
|
406 void CPdpFsm::ChangeStateToSuspended(void) |
|
407 { |
|
408 SPUDFSMVERBOSE_FNLOG("CPdpFsm::ChangeStateToSuspended"); |
|
409 SPUDFSMVERBOSE_LOG1(_L("Pdp ID %d"),iPdpId); |
|
410 SPUDFSM_LOG(_L("New State : Suspended")); |
|
411 |
|
412 iState = &iPdpFsmFactory->iStateSuspended; |
|
413 } |
|
414 |
|
415 void CPdpFsm::ChangeStateToClosing(void) |
|
416 { |
|
417 SPUDFSMVERBOSE_FNLOG("CPdpFsm::ChangeStateToClosing"); |
|
418 SPUDFSMVERBOSE_LOG1(_L("Pdp ID %d"),iPdpId); |
|
419 SPUDFSM_LOG(_L("New State : Closing")); |
|
420 |
|
421 iState = &iPdpFsmFactory->iStateClosing; |
|
422 } |
|
423 |
|
424 void CPdpFsm::ChangeStateToStopping(void) |
|
425 { |
|
426 SPUDFSMVERBOSE_FNLOG("CPdpFsm::ChangeStateToStopping"); |
|
427 SPUDFSMVERBOSE_LOG1(_L("Pdp ID %d"),iPdpId); |
|
428 SPUDFSM_LOG(_L("New State : Stopping")); |
|
429 |
|
430 iState = &iPdpFsmFactory->iStateStopping; |
|
431 } |
|