44
|
1 |
// Copyright (c) 2005-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 |
// The implementation file for the PDP Context control requests.
|
|
15 |
//
|
|
16 |
//
|
|
17 |
|
|
18 |
/**
|
|
19 |
@file
|
|
20 |
@internalComponent
|
|
21 |
*/
|
|
22 |
|
|
23 |
|
|
24 |
#include "PdpFsmRequest.h"
|
|
25 |
|
|
26 |
|
|
27 |
//-=========================================================
|
|
28 |
//
|
|
29 |
//CModifyActivePDPCtx
|
|
30 |
//
|
|
31 |
//-=========================================================
|
|
32 |
CModifyActivePDPCtx::CModifyActivePDPCtx(CUmtsGprsSubConnProvd& aProvider, MPdpFsmRequestOwner& aOwner)
|
|
33 |
:CPdpFsmRequestBase(aProvider, aOwner)
|
|
34 |
{
|
|
35 |
}
|
|
36 |
|
|
37 |
CModifyActivePDPCtx::~CModifyActivePDPCtx()
|
|
38 |
{
|
|
39 |
}
|
|
40 |
|
|
41 |
|
|
42 |
TInt CModifyActivePDPCtx::Start()
|
|
43 |
{
|
|
44 |
// Store the Context Id in order to check replies later
|
|
45 |
iContextId = iProvider.GetContextId();
|
|
46 |
return iProvider.GetPdpFsmInterface().Input(iContextId, SpudMan::EContextModifyActive);
|
|
47 |
}
|
|
48 |
|
|
49 |
/**
|
|
50 |
@param aEvent The event Id
|
|
51 |
@param aParam Data relavent to the event. Usually a system-wide error code
|
|
52 |
@return ETrue if the event was consumed, EFalse if it was of no interest and should
|
|
53 |
be passed on to SpudMan for processing.
|
|
54 |
*/
|
|
55 |
TBool CModifyActivePDPCtx::PdpFsmEvent(TContextId aContextId, TInt aEvent, TInt aParam)
|
|
56 |
{
|
|
57 |
if (aContextId == iContextId && aEvent == KContextModifyActiveEvent)
|
|
58 |
{
|
|
59 |
iOwner.Done(aParam, *this);
|
|
60 |
return ETrue;
|
|
61 |
}
|
|
62 |
|
|
63 |
return EFalse;
|
|
64 |
}
|
|
65 |
|
|
66 |
|
|
67 |
|
|
68 |
#ifdef SYMBIAN_NETWORKING_UMTSR5
|
|
69 |
//-=========================================================
|
|
70 |
//
|
|
71 |
//CModifyR5QoS
|
|
72 |
//
|
|
73 |
//-=========================================================
|
|
74 |
CModifyR5QoS::CModifyR5QoS(CUmtsGprsSubConnProvd& aProvider, MPdpFsmRequestOwner& aOwner, RPacketQoS::TQoSR5Requested& aParams)
|
|
75 |
:CPdpFsmRequestBase(aProvider, aOwner),
|
|
76 |
iModifyActive(NULL),
|
|
77 |
i5(aParams)
|
|
78 |
{
|
|
79 |
}
|
|
80 |
|
|
81 |
CModifyR5QoS::~CModifyR5QoS()
|
|
82 |
{
|
|
83 |
ASSERT(iModifyActive == NULL || iContextId == 0);
|
|
84 |
//If we assert here is is becuase Start has been called (allocated iContextId), but Done has not been called (cleans iModifyActive)
|
|
85 |
delete iModifyActive;
|
|
86 |
}
|
|
87 |
|
|
88 |
void CModifyR5QoS::GrantedSetupL()
|
|
89 |
{
|
|
90 |
CSubConGenEventParamsGranted* event = CSubConGenEventParamsGranted::NewL();
|
|
91 |
CleanupStack::PushL (TCleanupItem(SubconEventCleanupFunction, event));
|
|
92 |
event->SetFamily (KSubConQoSFamily);
|
|
93 |
RPacketQoS::TQoSR5Negotiated negotiatedQoS;
|
|
94 |
iProvider.GetPdpFsmInterface().Get(iProvider.GetContextId(), negotiatedQoS);
|
|
95 |
iProvider.MapQosEtelToGrantedParamsL(&negotiatedQoS, *event);
|
|
96 |
iProvider.NotifyClientEvent (*event);
|
|
97 |
CleanupStack::Pop();
|
|
98 |
delete event;
|
|
99 |
|
|
100 |
}
|
|
101 |
|
|
102 |
void CModifyR5QoS::RejectedSetupL(TInt aResult)
|
|
103 |
{
|
|
104 |
CSubConGenEventParamsRejected* event = CSubConGenEventParamsRejected::NewL();
|
|
105 |
CleanupStack::PushL (TCleanupItem(SubconEventCleanupFunction, event));
|
|
106 |
event->SetFamilyId (KSubConQoSFamily);
|
|
107 |
event->SetError (aResult);
|
|
108 |
iProvider.NotifyClientEvent (*event);
|
|
109 |
CleanupStack::Pop();
|
|
110 |
delete event;
|
|
111 |
}
|
|
112 |
|
|
113 |
void CModifyR5QoS::Done( TInt aResult, CPdpFsmRequestBase& aThis )
|
|
114 |
{
|
|
115 |
__ASSERT_ALWAYS(iModifyActive == &aThis, User::Invariant());
|
|
116 |
|
|
117 |
if ( aResult == KErrNone )
|
|
118 |
{
|
|
119 |
// QoS Modification complete with success.
|
|
120 |
__FLOG_1(_L("CModifyR5QoS [this=%08x]:\tDone(): QoS Params Granted"), this);
|
|
121 |
TRAP_IGNORE(GrantedSetupL());
|
|
122 |
}
|
|
123 |
else
|
|
124 |
{
|
|
125 |
//QoS Modification complete with failure.
|
|
126 |
__FLOG_2(_L("CModifyR5QoS [this=%08x]:\tDone(): QoS Params Rejected [aResult=%d]"), this, aResult);
|
|
127 |
TRAP_IGNORE(RejectedSetupL(aResult));
|
|
128 |
}
|
|
129 |
|
|
130 |
|
|
131 |
delete iModifyActive;
|
|
132 |
iModifyActive = NULL;
|
|
133 |
iOwner.Done(aResult, *this);
|
|
134 |
}
|
|
135 |
|
|
136 |
|
|
137 |
TInt CModifyR5QoS::Start()
|
|
138 |
{
|
|
139 |
// Store the Context Id in order to check replies later
|
|
140 |
iContextId = iProvider.GetContextId();
|
|
141 |
|
|
142 |
TInt result;
|
|
143 |
result = iProvider.GetPdpFsmInterface().Set(iContextId, i5);
|
|
144 |
if (result == KErrNone)
|
|
145 |
{
|
|
146 |
result = iProvider.GetPdpFsmInterface().Input(iContextId, SpudMan::EContextQoSSet);
|
|
147 |
}
|
|
148 |
|
|
149 |
return result;
|
|
150 |
}
|
|
151 |
|
|
152 |
|
|
153 |
TBool CModifyR5QoS::PdpFsmEvent(TContextId aContextId, TInt aEvent, TInt aParam)
|
|
154 |
{
|
|
155 |
if (aContextId != iContextId)
|
|
156 |
{
|
|
157 |
return EFalse;
|
|
158 |
}
|
|
159 |
|
|
160 |
TBool handled(EFalse);
|
|
161 |
if (aEvent == KContextQoSSetEvent)
|
|
162 |
{
|
|
163 |
if (aParam == KErrNone)
|
|
164 |
{
|
|
165 |
iModifyActive->Start();
|
|
166 |
}
|
|
167 |
else
|
|
168 |
{
|
|
169 |
//QoS Modification complete with failure.
|
|
170 |
__FLOG_2(_L("CModifyR5QoS [this=%08x]:\tPdpFsmEvent(): QoS Params Rejected [aParam=%d]"), this, aParam);
|
|
171 |
|
|
172 |
Done(aParam, *iModifyActive);
|
|
173 |
}
|
|
174 |
handled = ETrue;
|
|
175 |
}
|
|
176 |
else
|
|
177 |
{
|
|
178 |
handled = iModifyActive->PdpFsmEvent(aContextId, aEvent, aParam);
|
|
179 |
}
|
|
180 |
|
|
181 |
return handled;
|
|
182 |
}
|
|
183 |
|
|
184 |
|
|
185 |
void CModifyR5QoS::ConstructL()
|
|
186 |
{
|
|
187 |
iModifyActive = new(ELeave)CModifyActivePDPCtx(iProvider, *this);
|
|
188 |
}
|
|
189 |
|
|
190 |
|
|
191 |
CModifyR5QoS* CModifyR5QoS::NewL(CUmtsGprsSubConnProvd& aProvider, MPdpFsmRequestOwner& aOwner, RPacketQoS::TQoSR5Requested& aParams)
|
|
192 |
{
|
|
193 |
CModifyR5QoS* request = new(ELeave) CModifyR5QoS(aProvider, aOwner, aParams);
|
|
194 |
CleanupStack::PushL(request);
|
|
195 |
request->ConstructL();
|
|
196 |
CleanupStack::Pop(request);
|
|
197 |
return request;
|
|
198 |
}
|
|
199 |
|
|
200 |
|
|
201 |
#else
|
|
202 |
// !SYMBIAN_NETWORKING_UMTSR5
|
|
203 |
|
|
204 |
//-=========================================================
|
|
205 |
//
|
|
206 |
//CModifyR4QoS
|
|
207 |
//
|
|
208 |
//-=========================================================
|
|
209 |
CModifyR4QoS::CModifyR4QoS(CUmtsGprsSubConnProvd& aProvider, MPdpFsmRequestOwner& aOwner, RPacketQoS::TQoSR99_R4Requested aParams)
|
|
210 |
:CPdpFsmRequestBase(aProvider, aOwner),
|
|
211 |
iModifyActive(NULL),
|
|
212 |
i99(aParams)
|
|
213 |
{
|
|
214 |
}
|
|
215 |
|
|
216 |
CModifyR4QoS::~CModifyR4QoS()
|
|
217 |
{
|
|
218 |
ASSERT(iModifyActive == NULL || iContextId == 0);
|
|
219 |
//If we assert here is is becuase Start has been called (allocated iContextId), but Done has not been called (cleans iModifyActive)
|
|
220 |
delete iModifyActive;
|
|
221 |
|
|
222 |
}
|
|
223 |
|
|
224 |
void CModifyR4QoS::GrantedSetupL()
|
|
225 |
{
|
|
226 |
CSubConGenEventParamsGranted* event = CSubConGenEventParamsGranted::NewL();
|
|
227 |
CleanupStack::PushL (TCleanupItem(SubconEventCleanupFunction, event));
|
|
228 |
event->SetFamily (KSubConQoSFamily);
|
|
229 |
RPacketQoS::TQoSR99_R4Negotiated negotiatedQoS;
|
|
230 |
iProvider.GetPdpFsmInterface().Get(iProvider.GetContextId(), negotiatedQoS);
|
|
231 |
iProvider.MapQosEtelToGrantedParamsL(&negotiatedQoS, *event);
|
|
232 |
iProvider.NotifyClientEvent (*event);
|
|
233 |
CleanupStack::Pop();
|
|
234 |
delete event;
|
|
235 |
}
|
|
236 |
|
|
237 |
void CModifyR4QoS::RejectedSetupL(TInt aResult)
|
|
238 |
{
|
|
239 |
CSubConGenEventParamsRejected* event = CSubConGenEventParamsRejected::NewL();
|
|
240 |
CleanupStack::PushL (TCleanupItem(SubconEventCleanupFunction, event));
|
|
241 |
event->SetFamilyId (KSubConQoSFamily);
|
|
242 |
event->SetError (aResult);
|
|
243 |
iProvider.NotifyClientEvent (*event);
|
|
244 |
CleanupStack::Pop();
|
|
245 |
delete event;
|
|
246 |
}
|
|
247 |
|
|
248 |
void CModifyR4QoS::Done( TInt aResult, CPdpFsmRequestBase& aThis )
|
|
249 |
{
|
|
250 |
|
|
251 |
__ASSERT_ALWAYS(iModifyActive == &aThis, User::Invariant());
|
|
252 |
if ( aResult == KErrNone )
|
|
253 |
{
|
|
254 |
// QoS Modification complete with success.
|
|
255 |
__FLOG_1(_L("CModifyR4QoS [this=%08x]:\tDone(): QoS Params Granted"), this);
|
|
256 |
TRAP_IGNORE(GrantedSetupL());
|
|
257 |
}
|
|
258 |
else
|
|
259 |
{
|
|
260 |
//QoS Modification complete with failure.
|
|
261 |
__FLOG_2(_L("CModifyR4QoS [this=%08x]:\tDone(): QoS Params Rejected [aResult=%d]"), this, aResult);
|
|
262 |
TRAP_IGNORE(RejectedSetupL(aResult));
|
|
263 |
}
|
|
264 |
delete iModifyActive;
|
|
265 |
iModifyActive = NULL;
|
|
266 |
iOwner.Done(aResult, *this);
|
|
267 |
}
|
|
268 |
|
|
269 |
|
|
270 |
TInt CModifyR4QoS::Start()
|
|
271 |
{
|
|
272 |
// Store the Context Id in order to check replies later
|
|
273 |
iContextId = iProvider.GetContextId();
|
|
274 |
|
|
275 |
TInt result;
|
|
276 |
result = iProvider.GetPdpFsmInterface().Set(iContextId, i99);
|
|
277 |
if (result == KErrNone)
|
|
278 |
{
|
|
279 |
result = iProvider.GetPdpFsmInterface().Input(iContextId, SpudMan::EContextQoSSet);
|
|
280 |
}
|
|
281 |
|
|
282 |
return result;
|
|
283 |
}
|
|
284 |
|
|
285 |
TBool CModifyR4QoS::PdpFsmEvent(TContextId aContextId, TInt aEvent, TInt aParam)
|
|
286 |
{
|
|
287 |
if (aContextId != iContextId)
|
|
288 |
{
|
|
289 |
return EFalse;
|
|
290 |
}
|
|
291 |
|
|
292 |
TBool handled(EFalse);
|
|
293 |
if (aEvent == KContextQoSSetEvent)
|
|
294 |
{
|
|
295 |
if (aParam == KErrNone)
|
|
296 |
{
|
|
297 |
iModifyActive->Start();
|
|
298 |
}
|
|
299 |
else
|
|
300 |
{
|
|
301 |
//QoS Modification complete with failure.
|
|
302 |
__FLOG_2(_L("CModifyR4QoS [this=%08x]:\tPdpFsmEvent(): QoS Params Rejected [aParam=%d]"), this, aParam);
|
|
303 |
Done(aParam, *iModifyActive);
|
|
304 |
}
|
|
305 |
handled = ETrue;
|
|
306 |
}
|
|
307 |
else
|
|
308 |
{
|
|
309 |
handled = iModifyActive->PdpFsmEvent(aContextId, aEvent, aParam);
|
|
310 |
}
|
|
311 |
|
|
312 |
return handled;
|
|
313 |
}
|
|
314 |
|
|
315 |
|
|
316 |
void CModifyR4QoS::ConstructL()
|
|
317 |
{
|
|
318 |
iModifyActive = new(ELeave)CModifyActivePDPCtx(iProvider, *this);
|
|
319 |
}
|
|
320 |
|
|
321 |
CModifyR4QoS* CModifyR4QoS::NewL(CUmtsGprsSubConnProvd& aProvider, MPdpFsmRequestOwner& aOwner, RPacketQoS::TQoSR99_R4Requested aParams)
|
|
322 |
{
|
|
323 |
CModifyR4QoS* request = new(ELeave) CModifyR4QoS(aProvider, aOwner, aParams);
|
|
324 |
CleanupStack::PushL(request);
|
|
325 |
request->ConstructL();
|
|
326 |
CleanupStack::Pop(request);
|
|
327 |
return request;
|
|
328 |
}
|
|
329 |
|
|
330 |
|
|
331 |
|
|
332 |
#endif
|
|
333 |
// SYMBIAN_NETWORKING_UMTSR5
|
|
334 |
|