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 // Base class to the various states required in Spud FSM. Each real state is derived from |
|
15 // this base class. The bass class is never instanciated but it's base functionality is |
|
16 // used for default handling in the most part. |
|
17 // |
|
18 // |
|
19 |
|
20 /** |
|
21 @file |
|
22 @internalComponent |
|
23 */ |
|
24 |
|
25 #include <networking/umtsnifcontrolif.h> |
|
26 #include "cpdpfsmfactory.h" |
|
27 #include "tpdpstate.h" |
|
28 #include "spudfsmdebuglogger.h" |
|
29 #include "pdpfsmnmspace.h" |
|
30 #include "reteldriverinput.h" |
|
31 #include "PDPFSM.h" |
|
32 |
|
33 // Literals for TPdpState::LogOperation |
|
34 |
|
35 _LIT(KPdpFsm_EPhoneOpened, "PdpFsm::EPhoneOpened"); |
|
36 _LIT(KPdpFsm_EPhoneOpenedFailed, "PdpFsm::EPhoneOpenedFailed"); |
|
37 _LIT(KPdpFsm_EQoSSet, "PdpFsm::EQoSSet"); |
|
38 _LIT(KPdpFsm_EQoSSetFailed, "PdpFsm::EQoSSetFailed"); |
|
39 _LIT(KPdpFsm_ETftSet, "PdpFsm::ETftSet"); |
|
40 _LIT(KPdpFsm_ETftSetFailed, "PdpFsm::ETftSetFailed"); |
|
41 _LIT(KPdpFsm_ETftChanged, "PdpFsm::ETftChanged"); |
|
42 _LIT(KPdpFsm_ETftChangedFailed, "PdpFsm::ETftChangedFailed"); |
|
43 _LIT(KPdpFsm_E1ryPdpContextCreated, "PdpFsm::E1ryPdpContextCreated"); |
|
44 _LIT(KPdpFsm_E1ryPdpContextCreatedFailed, "PdpFsm::E1ryPdpContextCreatedFailed"); |
|
45 _LIT(KPdpFsm_E2ryPdpContextCreated, "PdpFsm::E2ryPdpContextCreated"); |
|
46 _LIT(KPdpFsm_E2ryPdpContextCreatedFailed, "PdpFsm::E2ryPdpContextCreatedFailed"); |
|
47 _LIT(KPdpFsm_EPdpActivated, "PdpFsm::EPdpActivated"); |
|
48 _LIT(KPdpFsm_EPdpActivatedFailed, "PdpFsm::EPdpActivatedFailed"); |
|
49 _LIT(KPdpFsm_EContextDeleted, "PdpFsm::EContextDeleted"); |
|
50 _LIT(KPdpFsm_EContextDeletedFailed, "PdpFsm::EContextDeletedFailed"); |
|
51 _LIT(KPdpFsm_EQoSProfileChangeNetwork, "PdpFsm::EQoSProfileChangeNetwork"); |
|
52 _LIT(KPdpFsm_EConfigGPRSChangeNetwork, "PdpFsm::EConfigGPRSChangeNetwork"); |
|
53 _LIT(KPdpFsm_EPacketStatusChangeNetwork, "PdpFsm::EPacketStatusChangeNetwork"); |
|
54 _LIT(KPdpFsm_EPdpContextModified, "PdpFsm::EPdpContextModified"); |
|
55 _LIT(KPdpFsm_EPdpContextModifiedFailed, "PdpFsm::EPdpContextModifiedFailed"); |
|
56 _LIT(KRPacketContext_EStatusUnknown, "RPacketContext::EStatusUnknown"); |
|
57 _LIT(KRPacketContext_EStatusInactive, "RPacketContext::EStatusInactive"); |
|
58 _LIT(KRPacketContext_EStatusActivating, "RPacketContext::EStatusActivating"); |
|
59 _LIT(KRPacketContext_EStatusActive, "RPacketContext::EStatusActive"); |
|
60 _LIT(KRPacketContext_EStatusDeactivating, "RPacketContext::EStatusDeactivating"); |
|
61 _LIT(KRPacketContext_EStatusSuspended, "RPacketContext::EStatusSuspended"); |
|
62 _LIT(KRPacketContext_EStatusDeleted, "RPacketContext::EStatusDeleted"); |
|
63 _LIT(KEContextStatusChangeNetwork_Unknown, "EContextStatusChangeNetwork_Unknown"); |
|
64 _LIT(KRPacketService_EStatusUnattached, "RPacketService::EStatusUnattached"); |
|
65 _LIT(KRPacketService_EStatusAttached, "RPacketService::EStatusAttached"); |
|
66 _LIT(KRPacketService_EStatusActive, "RPacketService::EStatusActive"); |
|
67 _LIT(KRPacketService_EStatusSuspended, "RPacketService::EStatusSuspended"); |
|
68 _LIT(KEServiceStatusChangeNetwork_Unknown, "EServiceStatusChangeNetwork_Unknown"); |
|
69 _LIT(KSpudMan_EContextCreate, "SpudMan::EContextCreate"); |
|
70 _LIT(KSpudMan_EContextDelete, "SpudMan::EContextDelete"); |
|
71 _LIT(KSpudMan_EContextActivate, "SpudMan::EContextActivate"); |
|
72 _LIT(KSpudMan_ERegisterEventHandler, "SpudMan::ERegisterEventHandler"); |
|
73 _LIT(KSpudMan_EContextSetEvents, "SpudMan::EContextSetEvents"); |
|
74 _LIT(KSpudMan_EContextQoSSet, "SpudMan::EContextQoSSet"); |
|
75 _LIT(KSpudMan_EContextModifyActive, "SpudMan::EContextModifyActive"); |
|
76 _LIT(KSpudMan_EContextTFTModify, "SpudMan::EContextTFTModify"); |
|
77 _LIT(KSpudMan_ENifSetDefaultQoS, "SpudMan::ENifSetDefaultQoS"); |
|
78 _LIT(KSpudMan_EStartupPrimaryContextCreation, "SpudMan::EStartupPrimaryContextCreation"); |
|
79 _LIT(KSpudMan_ESetDefaultQoS, "SpudMan::ESetDefaultQoS"); |
|
80 _LIT(KSpudMan_ECreatePrimaryPDPContext, "SpudMan::ECreatePrimaryPDPContext"); |
|
81 _LIT(KSpudMan_ECreateSecondaryPDPContext, "SpudMan::ECreateSecondaryPDPContext"); |
|
82 _LIT(KSpudMan_ESuspend, "SpudMan::ESuspend"); |
|
83 _LIT(KSpudMan_EResume, "SpudMan::EResume"); |
|
84 _LIT(KSpudMan_E1ryPdpActivate, "SpudMan::E1ryPdpActivate"); |
|
85 _LIT(KSpudMan_ECancelContextCreate, "SpudMan::ECancelContextCreate"); |
|
86 _LIT(KSpudMan_EGetNegQoS, "SpudMan::EGetNegQoS"); |
|
87 _LIT(KUnknown, "Unknown"); |
|
88 |
|
89 |
|
90 TPdpState::TPdpState() |
|
91 #ifdef _DEBUG |
|
92 : iName() |
|
93 #endif |
|
94 { |
|
95 SPUDFSMVERBOSE_FNLOG("TPdpState::TPdpState()"); |
|
96 } |
|
97 |
|
98 TInt TPdpState::Input (CPdpFsm& aFsm, const TInt aOperation, const TInt /*aErrorCode*/) |
|
99 { |
|
100 SPUDFSMVERBOSE_FNLOG("TPdpState::Input()"); |
|
101 SPUDFSMVERBOSE_LOG1(_L("aOperation : %d"), aOperation); |
|
102 |
|
103 if (aOperation == PdpFsm::EContextDeleted || aOperation == SpudMan::EContextDelete || |
|
104 (aOperation == PdpFsm::EContextStatusChangeNetwork && aFsm.iContextStatus == RPacketContext::EStatusDeleted)) |
|
105 { |
|
106 aFsm.ChangeStateToClosing(); |
|
107 EtelDriverCancel (aFsm); |
|
108 EtelDriverInput(aFsm, EtelDriver::EContextDelete); |
|
109 return KErrNone; |
|
110 } |
|
111 |
|
112 SPUDFSMVERBOSE_LOG1(_L("!!! Unhandled Operation (%S)!!!"), LogOperation (aFsm, aOperation)); |
|
113 return KErrGeneral; |
|
114 } |
|
115 |
|
116 void TPdpState::EtelDriverInput (CPdpFsm& aFsm, EtelDriver::TEtelInput aOperation) |
|
117 { |
|
118 SPUDFSMVERBOSE_LOG1(_L("EtelDriverInput : %d"), aOperation); |
|
119 aFsm.EtelInput (aOperation); |
|
120 } |
|
121 |
|
122 void TPdpState::EtelDriverCancel (CPdpFsm& aFsm) |
|
123 { |
|
124 SPUDFSMVERBOSE_LOG(_L("EtelDriverCancel")); |
|
125 aFsm.EtelCancel(); |
|
126 } |
|
127 |
|
128 void TPdpState::SpudManNotify (CPdpFsm& aFsm, TInt aNotification, TInt aParam) |
|
129 { |
|
130 SPUDFSMVERBOSE_LOG1(_L("SpudManNotify : %d"), aNotification); |
|
131 aFsm.SpudInput (aNotification, aParam); |
|
132 } |
|
133 |
|
134 const TDesC * TPdpState::LogOperation (CPdpFsm& aFsm, TInt aOperation) |
|
135 { |
|
136 switch (aOperation) |
|
137 { |
|
138 // ETel notifications |
|
139 case PdpFsm::EPhoneOpened: |
|
140 return &KPdpFsm_EPhoneOpened; |
|
141 case PdpFsm::EPhoneOpenedFailed: |
|
142 return &KPdpFsm_EPhoneOpenedFailed; |
|
143 case PdpFsm::EQoSSet: |
|
144 return &KPdpFsm_EQoSSet; |
|
145 case SpudMan::EGetNegQoS: |
|
146 return &KSpudMan_EGetNegQoS; |
|
147 case PdpFsm::EQoSSetFailed: |
|
148 return &KPdpFsm_EQoSSetFailed; |
|
149 case PdpFsm::ETftSet: |
|
150 return &KPdpFsm_ETftSet; |
|
151 case PdpFsm::ETftSetFailed: |
|
152 return &KPdpFsm_ETftSetFailed; |
|
153 case PdpFsm::ETftChanged: |
|
154 return &KPdpFsm_ETftChanged; |
|
155 case PdpFsm::ETftChangedFailed: |
|
156 return &KPdpFsm_ETftChangedFailed; |
|
157 case PdpFsm::E1ryPdpContextCreated: |
|
158 return &KPdpFsm_E1ryPdpContextCreated; |
|
159 case PdpFsm::E1ryPdpContextCreatedFailed: |
|
160 return &KPdpFsm_E1ryPdpContextCreatedFailed; |
|
161 case PdpFsm::E2ryPdpContextCreated: |
|
162 return &KPdpFsm_E2ryPdpContextCreated; |
|
163 case PdpFsm::E2ryPdpContextCreatedFailed: |
|
164 return &KPdpFsm_E2ryPdpContextCreatedFailed; |
|
165 case PdpFsm::EPdpActivated: |
|
166 return &KPdpFsm_EPdpActivated; |
|
167 case PdpFsm::EPdpActivatedFailed: |
|
168 return &KPdpFsm_EPdpActivatedFailed; |
|
169 case PdpFsm::EContextDeleted: |
|
170 return &KPdpFsm_EContextDeleted; |
|
171 case PdpFsm::EContextDeletedFailed: |
|
172 return &KPdpFsm_EContextDeletedFailed; |
|
173 case PdpFsm::EPdpContextModified: |
|
174 return &KPdpFsm_EPdpContextModified; |
|
175 case PdpFsm::EPdpContextModifiedFailed: |
|
176 return &KPdpFsm_EPdpContextModifiedFailed; |
|
177 |
|
178 // |
|
179 // // network signals |
|
180 case PdpFsm::EQoSProfileChangeNetwork: |
|
181 //RPacketQoS::TQoSR99_R4Negotiated |
|
182 return &KPdpFsm_EQoSProfileChangeNetwork; |
|
183 case PdpFsm::EConfigGPRSChangeNetwork: |
|
184 //RPacketContext::TContextConfigGPRS |
|
185 return &KPdpFsm_EConfigGPRSChangeNetwork; |
|
186 case PdpFsm::EContextStatusChangeNetwork: |
|
187 switch (aFsm.iContextStatus) |
|
188 { |
|
189 case RPacketContext::EStatusUnknown: |
|
190 return &KRPacketContext_EStatusUnknown; |
|
191 case RPacketContext::EStatusInactive: |
|
192 return &KRPacketContext_EStatusInactive; |
|
193 case RPacketContext::EStatusActivating: |
|
194 return &KRPacketContext_EStatusActivating; |
|
195 case RPacketContext::EStatusActive: |
|
196 return &KRPacketContext_EStatusActive; |
|
197 case RPacketContext::EStatusDeactivating: |
|
198 return &KRPacketContext_EStatusDeactivating; |
|
199 case RPacketContext::EStatusSuspended: |
|
200 return &KRPacketContext_EStatusSuspended; |
|
201 case RPacketContext::EStatusDeleted: |
|
202 return &KRPacketContext_EStatusDeleted; |
|
203 } |
|
204 return &KEContextStatusChangeNetwork_Unknown; |
|
205 case PdpFsm::EServiceStatusChangeNetwork: |
|
206 { |
|
207 RPacketService::TStatus ns; |
|
208 |
|
209 aFsm.iPdpFsmFactory->iPdpFsmInterface->Get(ns); |
|
210 |
|
211 switch (ns) |
|
212 { |
|
213 case RPacketService::EStatusUnattached: |
|
214 return &KRPacketService_EStatusUnattached; |
|
215 case RPacketService::EStatusAttached: |
|
216 return &KRPacketService_EStatusAttached; |
|
217 case RPacketService::EStatusActive: |
|
218 return &KRPacketService_EStatusActive; |
|
219 case RPacketService::EStatusSuspended: |
|
220 return &KRPacketService_EStatusSuspended; |
|
221 } |
|
222 } |
|
223 return &KEServiceStatusChangeNetwork_Unknown; |
|
224 case PdpFsm::EPacketStatusChangeNetwork: // not used in eteldriver |
|
225 return &KPdpFsm_EPacketStatusChangeNetwork; |
|
226 |
|
227 // spudman signals |
|
228 case SpudMan::EContextCreate: |
|
229 return &KSpudMan_EContextCreate; |
|
230 case SpudMan::EContextDelete: |
|
231 return &KSpudMan_EContextDelete; |
|
232 case SpudMan::EContextActivate: |
|
233 return &KSpudMan_EContextActivate; |
|
234 case SpudMan::ERegisterEventHandler: |
|
235 return &KSpudMan_ERegisterEventHandler; |
|
236 case SpudMan::EContextSetEvents: |
|
237 return &KSpudMan_EContextSetEvents; |
|
238 case SpudMan::EContextQoSSet: |
|
239 return &KSpudMan_EContextQoSSet; |
|
240 case SpudMan::EContextModifyActive: |
|
241 return &KSpudMan_EContextModifyActive; |
|
242 case SpudMan::EContextTFTModify: |
|
243 return &KSpudMan_EContextTFTModify; |
|
244 case SpudMan::ENifSetDefaultQoS: |
|
245 return &KSpudMan_ENifSetDefaultQoS; |
|
246 case SpudMan::EStartupPrimaryContextCreation: |
|
247 return &KSpudMan_EStartupPrimaryContextCreation; |
|
248 |
|
249 case SpudMan::ESetDefaultQoS: |
|
250 return &KSpudMan_ESetDefaultQoS; |
|
251 case SpudMan::ECreatePrimaryPDPContext: |
|
252 return &KSpudMan_ECreatePrimaryPDPContext; |
|
253 case SpudMan::ECreateSecondaryPDPContext: |
|
254 return &KSpudMan_ECreateSecondaryPDPContext; |
|
255 case SpudMan::ESuspend: |
|
256 return &KSpudMan_ESuspend; |
|
257 case SpudMan::EResume: |
|
258 return &KSpudMan_EResume; |
|
259 case SpudMan::E1ryPdpActivate: |
|
260 return &KSpudMan_E1ryPdpActivate; |
|
261 case SpudMan::ECancelContextCreate: |
|
262 return &KSpudMan_ECancelContextCreate; |
|
263 |
|
264 default: |
|
265 return &KUnknown; |
|
266 } |
|
267 |
|
268 |
|
269 } |
|