24
|
1 |
// Copyright (c) 2003-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 |
//
|
|
15 |
|
|
16 |
/**
|
|
17 |
@file PSDAgt.cpp
|
|
18 |
*/
|
|
19 |
|
|
20 |
#include <cdbcols.h>
|
|
21 |
|
|
22 |
#include "psdagt.h"
|
|
23 |
#include "psdstates.h"
|
|
24 |
#include "psdlogger.h"
|
|
25 |
|
|
26 |
CPsdOutSM* CPsdOutSM::NewL(MAgentNotify& aObserver, CDialogProcessor* aDlgPrc, CCommsDbAccess& aDbAccess)
|
|
27 |
/**
|
|
28 |
Function creates an outbound connection state machine
|
|
29 |
|
|
30 |
@param MAgentObserver& aObserver an observer which will be called back to notify changes in the connection
|
|
31 |
@param CDialogProcessor* aDlgPrc a pointer to a dialog processor object for use by the state machine
|
|
32 |
@param CCommsDbAccess& aDbAccess a reference to the comm Db access object to allow the state machine to obtain details from CommDb
|
|
33 |
@return CPsdOutSM* the newly created object (ownership of the object is passed to the function caller)
|
|
34 |
*/
|
|
35 |
{
|
|
36 |
__ASSERT_DEBUG(aDlgPrc,User::Invariant());
|
|
37 |
CPsdOutSM* sm = new (ELeave) CPsdOutSM(aObserver,aDlgPrc,aDbAccess);
|
|
38 |
CleanupStack::PushL(sm);
|
|
39 |
sm->ConstructL();
|
|
40 |
CleanupStack::Pop();
|
|
41 |
return sm;
|
|
42 |
}
|
|
43 |
|
|
44 |
CPsdOutSM::CPsdOutSM(MAgentNotify& aObserver, CDialogProcessor* aDlgPrc, CCommsDbAccess& aDbAccess)
|
|
45 |
: CPsdAgentSMBase(aObserver,aDlgPrc,aDbAccess)
|
|
46 |
/**
|
|
47 |
Constructor
|
|
48 |
|
|
49 |
@param MAgentObserver& aObserver an observer which will be called back to notify changes in the connection
|
|
50 |
@param CDialogProcessor* aDlgPrc a pointer to a dialog processor object for use by the state machine
|
|
51 |
@param CCommsDbAccess& aDbAccess a reference to the comm Db access object to allow the state machine to obtain details from CommDb
|
|
52 |
*/
|
|
53 |
{}
|
|
54 |
|
|
55 |
CPsdOutSM::~CPsdOutSM()
|
|
56 |
/**
|
|
57 |
Destructor
|
|
58 |
*/
|
|
59 |
{}
|
|
60 |
|
|
61 |
void CPsdOutSM::ConstructL()
|
|
62 |
/**
|
|
63 |
2nd phase construction of the outgoing state machine
|
|
64 |
creates the initial state of the state machine
|
|
65 |
*/
|
|
66 |
{
|
|
67 |
CPsdAgentSMBase::ConstructL();
|
|
68 |
iState = new (ELeave) CPsdOutInit(this,this,this);
|
|
69 |
}
|
|
70 |
|
|
71 |
TCommDbConnectionDirection CPsdOutSM::Direction()
|
|
72 |
/**
|
|
73 |
Function indicates the direction of the connection which is in progress
|
|
74 |
|
|
75 |
@return TCommDbConnectionDirection the connection direction
|
|
76 |
*/
|
|
77 |
{ return ECommDbConnectionDirectionOutgoing;}
|
|
78 |
|
|
79 |
#ifndef INCOMING_NOT_SUPORTED
|
|
80 |
|
|
81 |
CPsdInSM* CPsdInSM::NewL(MAgentObserver& aObserver, CDialogProcessor* aDlgPrc, CCommsDbAccess& aDbAccess)
|
|
82 |
/**
|
|
83 |
Function creates an inbound connection state machine
|
|
84 |
|
|
85 |
@param MAgentObserver& aObserver an observer which will be called back to notify changes in the connection
|
|
86 |
@param CDialogProcessor* aDlgPrc a pointer to a dialog processor object for use by the state machine
|
|
87 |
@param CCommsDbAccess& aDbAccess a reference to the comm Db access object to allow the state machine to obtain details from CommDb
|
|
88 |
@return CPsdInSM* the newly created object (ownership of the object is passed to the function caller)
|
|
89 |
*/
|
|
90 |
{
|
|
91 |
__ASSERT_DEBUG(aDlgPrc,User::Invariant());
|
|
92 |
CPsdInSM* sm = new (ELeave) CPsdInSM(aObserver,aDlgPrc,aDbAccess);
|
|
93 |
CleanupStack::PushL(sm);
|
|
94 |
sm->ConstructL();
|
|
95 |
CleanupStack::Pop();
|
|
96 |
return sm;
|
|
97 |
}
|
|
98 |
|
|
99 |
CPsdInSM::CPsdInSM(MAgentObserver& aObserver, CDialogProcessor* aDlgPrc, CCommsDbAccess& aDbAccess)
|
|
100 |
: CPsdAgentSMBase(aObserver,aDlgPrc,aDbAccess)
|
|
101 |
/**
|
|
102 |
Constructor
|
|
103 |
|
|
104 |
@param MAgentObserver& aObserver an observer which will be called back to notify changes in the connection
|
|
105 |
@param CDialogProcessor* aDlgPrc a pointer to a dialog processor object for use by the state machine
|
|
106 |
@param CCommsDbAccess& aDbAccess a reference to the comm Db access object to allow the state machine to obtain details from CommDb
|
|
107 |
*/
|
|
108 |
{}
|
|
109 |
|
|
110 |
CPsdInSM::~CPsdInSM()
|
|
111 |
/**
|
|
112 |
Destructor
|
|
113 |
*/
|
|
114 |
{}
|
|
115 |
|
|
116 |
void CPsdInSM::ConstructL()
|
|
117 |
/**
|
|
118 |
2nd phase construction of the incoming state machine
|
|
119 |
creates the initial state of the state machine
|
|
120 |
*/
|
|
121 |
{
|
|
122 |
CPsdAgentSMBase::ConstructL();
|
|
123 |
iState = new (ELeave) CPsdInInit(this,this,this);
|
|
124 |
}
|
|
125 |
|
|
126 |
TCommDbConnectionDirection CPsdInSM::Direction()
|
|
127 |
/**
|
|
128 |
Function indicates the direction of the connection which is in progress
|
|
129 |
|
|
130 |
@return TCommDbConnectionDirection the connection direction
|
|
131 |
*/
|
|
132 |
{ return ECommDbConnectionDirectionIncoming;}
|
|
133 |
#endif // #ifndef INCOMING_NOT_SUPORTED
|
|
134 |
|
|
135 |
CPsdAgentSMBase::CPsdAgentSMBase(MAgentNotify& aObserver, CDialogProcessor* aDlgPrc, CCommsDbAccess& aDbAccess)
|
|
136 |
: CAgentSMBase(aObserver,aDlgPrc,aDbAccess),
|
|
137 |
iIsQoSSupported(ETrue)//let's be optimists
|
|
138 |
/**
|
|
139 |
Constructor
|
|
140 |
*/
|
|
141 |
{}
|
|
142 |
|
|
143 |
void CPsdAgentSMBase::ConstructL()
|
|
144 |
/**
|
|
145 |
2nd phase construction of the state machine base class
|
|
146 |
to be called in the ConstuctL of derived classes.
|
|
147 |
The function creates the logging objects and the objects
|
|
148 |
that contain the parameters for the Context and the QoS
|
|
149 |
*/
|
|
150 |
{
|
|
151 |
iEventLogger=CEventLogger::NewL();
|
|
152 |
iDataLogger=CDataLogger::NewL(this,this);
|
|
153 |
InquireModeL();
|
|
154 |
iConfig=CPsdContextConfig::NewL(*iDb,iNetworkMode);
|
|
155 |
iQoSConfig=CPsdContextQoSConfig::NewL(*iDb,iNetworkMode);
|
|
156 |
}
|
|
157 |
|
|
158 |
CPsdAgentSMBase::~CPsdAgentSMBase()
|
|
159 |
/**
|
|
160 |
Destructor
|
|
161 |
*/
|
|
162 |
{
|
|
163 |
iPacketNetwork.Close();
|
|
164 |
iContext.Close();
|
|
165 |
iQoS.Close();
|
|
166 |
iPhone.Close();
|
|
167 |
iTelServer.Close();
|
|
168 |
delete iQoSConfig;
|
|
169 |
delete iConfig;
|
|
170 |
delete iDataLogger;
|
|
171 |
delete iEventLogger;
|
|
172 |
iEventLogger=0;
|
|
173 |
}
|
|
174 |
|
|
175 |
|
|
176 |
TInt CPsdAgentSMBase::GetExcessData(TDes8& /*aBuffer*/)
|
|
177 |
/**
|
|
178 |
This is only valid for CSD
|
|
179 |
To retrieve data for the SM, and accessor functions for the state objects to use.
|
|
180 |
|
|
181 |
@param contains data retrieved from the agent for SM.
|
|
182 |
@return KErrNotSupported if data is not retrieved.
|
|
183 |
*/
|
|
184 |
{
|
|
185 |
return KErrNotSupported;
|
|
186 |
}
|
|
187 |
|
|
188 |
TInt CPsdAgentSMBase::Notification(TNifToAgentEventType /*aEvent*/, TAny* /*aInfo*/)
|
|
189 |
/**
|
|
190 |
No NIF to AGENT notifications supported by PSDAGX
|
|
191 |
Act on / reply to NifMan's notification requests
|
|
192 |
|
|
193 |
@param Type of event from Nifman to Agent.
|
|
194 |
@param Information about the Agent
|
|
195 |
@return KErrNotSupported if Event type does not exist.
|
|
196 |
*/
|
|
197 |
{
|
|
198 |
return KErrNotSupported;
|
|
199 |
}
|
|
200 |
|
|
201 |
void CPsdAgentSMBase::GetLastError(TInt& aError)
|
|
202 |
/**
|
|
203 |
If the context is still open, request last error, otherwise the last error will
|
|
204 |
have been obtained on closure.
|
|
205 |
|
|
206 |
@param error code if the context is not open.
|
|
207 |
*/
|
|
208 |
{
|
|
209 |
if (iContext.SubSessionHandle())
|
|
210 |
iContext.GetLastErrorCause(aError);
|
|
211 |
else
|
|
212 |
aError=iErrorCause;
|
|
213 |
}
|
|
214 |
|
|
215 |
TBool CPsdAgentSMBase::IsIncomingAllowedL() const
|
|
216 |
/**
|
|
217 |
Function to allow clients to inquire if incomming connections are allowed
|
|
218 |
|
|
219 |
@return ETrue if incomming connections allowed else EFalse
|
|
220 |
*/
|
|
221 |
{
|
|
222 |
// Hurricane does not support Incoming connections so hard code this response to False
|
|
223 |
#ifdef INCOMING_NOT_SUPORTED
|
|
224 |
return EFalse;
|
|
225 |
#else
|
|
226 |
// Note - the code below should be used when incoming connections are supported
|
|
227 |
TUint32 allowed;
|
|
228 |
iDb->GetGlobalL(TPtrC(ACCEPT_INCOMING_GPRS),allowed);
|
|
229 |
return (TBool)allowed;
|
|
230 |
#endif
|
|
231 |
}
|
|
232 |
|
|
233 |
void CPsdAgentSMBase::GetRemotePartyL(TDes& aRemoteParty) const
|
|
234 |
/**
|
|
235 |
Function to allow clients to inquire the name of the remote party in the connection
|
|
236 |
|
|
237 |
@param TDes& aRemoteParty reference to a descriptor into which the remote party name will be written.
|
|
238 |
*/
|
|
239 |
{
|
|
240 |
iDb->GetDesL(TPtrC(KGeneralServiceTable),TPtrC(COMMDB_NAME),aRemoteParty);
|
|
241 |
}
|
|
242 |
|
|
243 |
void CPsdAgentSMBase::InquireModeL()
|
|
244 |
/**
|
|
245 |
Internal function to figure out the current mode and set the iNetworkMode
|
|
246 |
member appropriately
|
|
247 |
*/
|
|
248 |
{
|
|
249 |
TBuf<KCommsDbSvrMaxColumnNameLength> serviceType;
|
|
250 |
iDb->GetServiceTypeL(serviceType);
|
|
251 |
if(serviceType == TPtrC(OUTGOING_GPRS))
|
|
252 |
{
|
|
253 |
iNetworkMode = EModeWCDMA;
|
|
254 |
}
|
|
255 |
#ifndef INCOMING_NOT_SUPORTED
|
|
256 |
else if(serviceType == TPtrC(INCOMING_GPRS))
|
|
257 |
{
|
|
258 |
iNetworkMode = EModeWCDMA;
|
|
259 |
}
|
|
260 |
#endif // #ifndef INCOMING_NOT_SUPORTED
|
|
261 |
else
|
|
262 |
{
|
|
263 |
// The service type is not supported by this AGX so leave
|
|
264 |
User::Leave(KErrNotSupported);
|
|
265 |
}
|
|
266 |
}
|
|
267 |
|
|
268 |
MAgentStateMachineEnv& CPsdAgentSMBase::BaseEnv()
|
|
269 |
{ return *this;}
|
|
270 |
|
|
271 |
RTelServer& CPsdAgentSMBase::TelServer()
|
|
272 |
{ return iTelServer;}
|
|
273 |
|
|
274 |
RPhone& CPsdAgentSMBase::Phone()
|
|
275 |
{ return iPhone;}
|
|
276 |
|
|
277 |
RPacketService& CPsdAgentSMBase::PacketNetwork()
|
|
278 |
{ return iPacketNetwork;}
|
|
279 |
|
|
280 |
RPacketContext& CPsdAgentSMBase::Context()
|
|
281 |
{ return iContext;}
|
|
282 |
|
|
283 |
TBool CPsdAgentSMBase::IsQoSSupported()const
|
|
284 |
{return iIsQoSSupported;}
|
|
285 |
|
|
286 |
void CPsdAgentSMBase::SetQoSSupported(TBool isSupported)
|
|
287 |
{iIsQoSSupported=isSupported;}
|
|
288 |
|
|
289 |
RPacketQoS& CPsdAgentSMBase::QoS()
|
|
290 |
{ return iQoS;}
|
|
291 |
|
|
292 |
const CPsdContextConfig& CPsdAgentSMBase::Config() const
|
|
293 |
{ return *iConfig;}
|
|
294 |
|
|
295 |
const CPsdContextQoSConfig& CPsdAgentSMBase::QoSConfig() const
|
|
296 |
{return *iQoSConfig;}
|
|
297 |
|
|
298 |
TInt& CPsdAgentSMBase::ErrorCause()
|
|
299 |
{ return iErrorCause;}
|
|
300 |
|
|
301 |
CEventLogger* CPsdAgentSMBase::Logger()
|
|
302 |
{ return iEventLogger;}
|
|
303 |
|
|
304 |
CDataLogger* CPsdAgentSMBase::DataLogger()
|
|
305 |
{ return iDataLogger;}
|
|
306 |
|
|
307 |
TBool& CPsdAgentSMBase::AmLogging()
|
|
308 |
/**
|
|
309 |
@deprecated since logging requests are stored in a queue now
|
|
310 |
*/
|
|
311 |
{ return iAmLogging;}
|
|
312 |
|
|
313 |
TBool CPsdAgentSMBase::TsyLoaded() const
|
|
314 |
{ return iTsyLoaded;}
|
|
315 |
|
|
316 |
void CPsdAgentSMBase::SetTsyLoaded(TBool aStatus)
|
|
317 |
{ iTsyLoaded=aStatus;}
|
|
318 |
|
|
319 |
MPsdEnv::TNetworkMode CPsdAgentSMBase::Mode() const
|
|
320 |
{return iNetworkMode;}
|
|
321 |
|
|
322 |
CPsdContextConfig* CPsdContextConfig::NewL(CCommsDbAccess& aDbAccess, MPsdEnv::TNetworkMode aMode)
|
|
323 |
/**
|
|
324 |
Function creates a CPsdContextConfig object
|
|
325 |
|
|
326 |
@param CCommsDbAccess& aDbAccess a reference to the comm Db access object to allow the class to obtain details from CommDb
|
|
327 |
@param TNetworkMode aMode the mode of the context config parameters to be created.
|
|
328 |
@return CPsdContextConfig* the newly created object (ownership of the object is passed to the function caller)
|
|
329 |
*/
|
|
330 |
{
|
|
331 |
CPsdContextConfig* self = new(ELeave)CPsdContextConfig(aDbAccess,aMode);
|
|
332 |
CleanupStack::PushL(self);
|
|
333 |
self->ConstructL();
|
|
334 |
CleanupStack::Pop(); //self
|
|
335 |
return self;
|
|
336 |
}
|
|
337 |
|
|
338 |
CPsdContextConfig::CPsdContextConfig(CCommsDbAccess& aDbAccess, MPsdEnv::TNetworkMode aMode)
|
|
339 |
: iDbAccess(aDbAccess), iMode(aMode)
|
|
340 |
{
|
|
341 |
}
|
|
342 |
|
|
343 |
void CPsdContextConfig::ConstructL()
|
|
344 |
/**
|
|
345 |
2nd phase construction of CPsdContextConfig calls the appropriate internal construction
|
|
346 |
function for the current mode
|
|
347 |
*/
|
|
348 |
{
|
|
349 |
if(iMode == MPsdEnv::EModeWCDMA)
|
|
350 |
{
|
|
351 |
GprsConfigConstructL();
|
|
352 |
}
|
|
353 |
}
|
|
354 |
|
|
355 |
CPsdContextConfig::~CPsdContextConfig()
|
|
356 |
/**
|
|
357 |
Destructor
|
|
358 |
*/
|
|
359 |
{
|
|
360 |
delete iConfig;
|
|
361 |
delete iPackedConfig;
|
|
362 |
}
|
|
363 |
|
|
364 |
const TPacketDataConfigBase& CPsdContextConfig::Config() const
|
|
365 |
/**
|
|
366 |
Function that returns the current context config parameters as a TPacketDataConfigBase
|
|
367 |
|
|
368 |
@return TPacketDataConfigBase& reference to the config parameters. (reurned as the mode agnostic base class)
|
|
369 |
*/
|
|
370 |
{
|
|
371 |
return *iConfig;
|
|
372 |
}
|
|
373 |
|
|
374 |
TDesC8& CPsdContextConfig::PackedConfig() const
|
|
375 |
/**
|
|
376 |
Function that returns the current context config parameters packed in a descriptor
|
|
377 |
|
|
378 |
@return TDesC8& reference to the config parameters packed in a descriptor.
|
|
379 |
*/
|
|
380 |
{
|
|
381 |
return *iPackedConfig;
|
|
382 |
}
|
|
383 |
|
|
384 |
TBool CPsdContextConfig::IsConfigSupportedL(const RPacketService& aPacketData, TCommDbConnectionDirection aDirection) const
|
|
385 |
/**
|
|
386 |
Inquiry function to enquire if the TSY is able to support the current context parameters
|
|
387 |
|
|
388 |
@param RPacketService& aPacketData handle to a previously initialised RPacketService object
|
|
389 |
@param TCommDbConnectionDirection aDirection the direction of the current connection
|
|
390 |
@return TBool returns ETrue if config supported, EFalse otherwise.
|
|
391 |
*/
|
|
392 |
{
|
|
393 |
if(!iStaticCaps)
|
|
394 |
{
|
|
395 |
// Only get the caps if they havn't been retrieved before
|
|
396 |
User::LeaveIfError(aPacketData.GetStaticCaps(iStaticCaps,iProtocolType));
|
|
397 |
}
|
|
398 |
TBool result=ETrue;
|
|
399 |
if(iMode == MPsdEnv::EModeWCDMA)
|
|
400 |
{
|
|
401 |
RPacketContext::TContextConfigGPRS& config = *(STATIC_CAST(RPacketContext::TContextConfigGPRS*, iConfig));
|
|
402 |
|
|
403 |
if ( (config.iAnonymousAccessReqd==RPacketContext::ERequired)
|
|
404 |
&&(aDirection == ECommDbConnectionDirectionIncoming) )
|
|
405 |
{
|
|
406 |
result=EFalse;
|
|
407 |
}
|
|
408 |
else if (!(iStaticCaps & RPacketService::KCapsAASupported)
|
|
409 |
&& (config.iAnonymousAccessReqd==RPacketContext::ERequired))
|
|
410 |
{
|
|
411 |
result=EFalse;
|
|
412 |
}
|
|
413 |
else if (!(iStaticCaps & RPacketService::KCapsPdpDataCompSupported)
|
|
414 |
&& (config.iPdpCompression & RPacketContext::KPdpDataCompression))
|
|
415 |
{
|
|
416 |
result=EFalse;
|
|
417 |
}
|
|
418 |
else if (!(iStaticCaps & RPacketService::KCapsPdpHeaderCompSupported)
|
|
419 |
&& (config.iPdpCompression & RPacketContext::KPdpHeaderCompression))
|
|
420 |
{
|
|
421 |
result=EFalse;
|
|
422 |
}
|
|
423 |
}
|
|
424 |
return result;
|
|
425 |
}
|
|
426 |
|
|
427 |
|
|
428 |
TBool CPsdContextConfig::TsySupportsDataTransferInfoL(const RPacketService& aPacketData) const
|
|
429 |
/**
|
|
430 |
Inquiry function to enquire if the TSY is able to support data transfer inquiries
|
|
431 |
|
|
432 |
@param RPacketService& aPacketData handle to a previously initialised RPacketService object
|
|
433 |
@return TBool returns ETrue if data transfer inquiry supported, EFalse otherwise.
|
|
434 |
*/
|
|
435 |
{
|
|
436 |
if(!iStaticCaps)
|
|
437 |
{
|
|
438 |
// Only get the caps if they havn't been retrieved before
|
|
439 |
User::LeaveIfError(aPacketData.GetStaticCaps(iStaticCaps,iProtocolType));
|
|
440 |
}
|
|
441 |
return(iStaticCaps & RPacketService::KCapsGetDataTransferredSupported);
|
|
442 |
}
|
|
443 |
|
|
444 |
void CPsdContextConfig::GprsConfigConstructL()
|
|
445 |
|
|
446 |
/**
|
|
447 |
Internal function that constructs the object if the mode is GPRS
|
|
448 |
interogates CommDb and reads the appropriate parameters from there
|
|
449 |
|
|
450 |
Relies on SetCurrentSettingsL() having already been called by the controller
|
|
451 |
Also expects the service setting to be opened on the correct GPRS Table (outgoing/incoming)
|
|
452 |
*/
|
|
453 |
{
|
|
454 |
iConfig=new(ELeave)RPacketContext::TContextConfigGPRS();
|
|
455 |
|
|
456 |
RPacketContext::TContextConfigGPRS& config = *(STATIC_CAST(RPacketContext::TContextConfigGPRS*, iConfig));
|
|
457 |
TUint32 pdptype;
|
|
458 |
iDbAccess.GetIntL(TPtrC(KGeneralServiceTable),TPtrC(GPRS_PDP_TYPE),pdptype);
|
|
459 |
config.iPdpType = (RPacketContext::TProtocolType)pdptype;
|
|
460 |
|
|
461 |
// Save the protocol type seperately for easy access when retreiving static caps
|
|
462 |
iProtocolType = config.iPdpType;
|
|
463 |
|
|
464 |
iDbAccess.GetDesL(TPtrC(KGeneralServiceTable),TPtrC(GPRS_APN),config.iAccessPointName);
|
|
465 |
iDbAccess.GetDesL(TPtrC(KGeneralServiceTable),TPtrC(GPRS_PDP_ADDRESS),config.iPdpAddress);
|
|
466 |
|
|
467 |
GetGprsCompressionL(config.iPdpCompression);
|
|
468 |
GetGprsAAL(config.iAnonymousAccessReqd);
|
|
469 |
|
|
470 |
iPackedConfig = new(ELeave)TPckg<RPacketContext::TContextConfigGPRS>(config);
|
|
471 |
}
|
|
472 |
|
|
473 |
void CPsdContextConfig::GetGprsCompressionL(TUint& aCompression) const
|
|
474 |
{
|
|
475 |
aCompression = 0;
|
|
476 |
TBool isCompression;
|
|
477 |
iDbAccess.GetBoolL(TPtrC(KGeneralServiceTable),TPtrC(GPRS_DATA_COMPRESSION),isCompression);
|
|
478 |
if (isCompression)
|
|
479 |
{
|
|
480 |
aCompression |= RPacketContext::KPdpDataCompression;
|
|
481 |
}
|
|
482 |
|
|
483 |
iDbAccess.GetBoolL(TPtrC(KGeneralServiceTable),TPtrC(GPRS_HEADER_COMPRESSION),isCompression);
|
|
484 |
if (isCompression)
|
|
485 |
{
|
|
486 |
aCompression |= RPacketContext::KPdpHeaderCompression;
|
|
487 |
}
|
|
488 |
}
|
|
489 |
|
|
490 |
void CPsdContextConfig::GetGprsAAL(RPacketContext::TAnonymousAccess& aAnonymous) const
|
|
491 |
{
|
|
492 |
TBool isAnonymous;
|
|
493 |
iDbAccess.GetBoolL(TPtrC(KGeneralServiceTable),TPtrC(GPRS_ANONYMOUS_ACCESS),isAnonymous);
|
|
494 |
if (isAnonymous)
|
|
495 |
aAnonymous=RPacketContext::ERequired;
|
|
496 |
else
|
|
497 |
aAnonymous=RPacketContext::ENotRequired;
|
|
498 |
}
|
|
499 |
|
|
500 |
void CPsdContextConfig::GetGprsEdgeL(TBool& aUseEdge) const
|
|
501 |
{
|
|
502 |
TBool isUseEdge;
|
|
503 |
iDbAccess.GetBoolL(TPtrC(KGeneralServiceTable),TPtrC(GPRS_USE_EDGE),isUseEdge);
|
|
504 |
aUseEdge=isUseEdge;
|
|
505 |
}
|
|
506 |
|
|
507 |
TBool CPsdContextConfig::QueryIfConfigAcceptable(TDesC8& aNewConfig) const
|
|
508 |
/**
|
|
509 |
Function to check if the config passed in the parameter meets the minimum requiremnts
|
|
510 |
set in CommDb
|
|
511 |
|
|
512 |
@param TDesC8& aNewConfig the config to be checked packed in a descriptor
|
|
513 |
@return TBool ETrue if the config passed in is above or equal to the minimum values, EFalse otherwise.
|
|
514 |
*/
|
|
515 |
{
|
|
516 |
TBool ret = ETrue;
|
|
517 |
if(iMode == MPsdEnv::EModeWCDMA)
|
|
518 |
{
|
|
519 |
TPckg<RPacketContext::TContextConfigGPRS> configPckg = *((TPckg<RPacketContext::TContextConfigGPRS>*)&aNewConfig);
|
|
520 |
RPacketContext::TContextConfigGPRS& newConfig = configPckg();
|
|
521 |
ret = QueryIfGprsConfigAcceptable(newConfig);
|
|
522 |
}
|
|
523 |
return ret;
|
|
524 |
}
|
|
525 |
|
|
526 |
TBool CPsdContextConfig::QueryIfGprsConfigAcceptable(const RPacketContext::TContextConfigGPRS& /*aNewConfig*/) const
|
|
527 |
/**
|
|
528 |
Internal function to check if the config passed in the parameter meets the minimum required for GPRS
|
|
529 |
|
|
530 |
@param RPacketContext::TContextConfigGPRS& aNewConfig the config to be checked against the minimum values
|
|
531 |
@return TBool ETrue if the config passed in is above or equal to the minimum values, EFalse otherwise.
|
|
532 |
*/
|
|
533 |
{
|
|
534 |
// Apparently the GPRS network has to give you what you asked for otherwise
|
|
535 |
// it will not complete the connection, so just return ETrue
|
|
536 |
return ETrue;
|
|
537 |
}
|
|
538 |
|
|
539 |
TBool CPsdContextConfig::QueryIfIncommingConnectionAcceptable(const RPacketContext::TProtocolType& aProtocolType, const RPacketContext::TProtocolAddress& aProtocolAddress) const
|
|
540 |
/**
|
|
541 |
Inquiry function to enquire if incoming connection is valid
|
|
542 |
|
|
543 |
@param RPacketContext::TProtocolType& aProtocolType the protocol type of the incomming connection
|
|
544 |
@param RPacketContext::TProtocolAddress& aProtocolAddress the address of the incomming connection
|
|
545 |
@return TBool returns ETrue if connection OK, EFalse otherwise.
|
|
546 |
*/
|
|
547 |
{
|
|
548 |
if(iMode == MPsdEnv::EModeWCDMA)
|
|
549 |
{
|
|
550 |
RPacketContext::TContextConfigGPRS& config = *(STATIC_CAST(RPacketContext::TContextConfigGPRS*, iConfig));
|
|
551 |
// For GPRS incoming connection the connection must be IP based and the IP address must be static.
|
|
552 |
// The IP address should be the one stored in CommDb
|
|
553 |
if( ((aProtocolType==RPacketContext::EPdpTypeIPv4)||(aProtocolType==RPacketContext::EPdpTypeIPv6))
|
|
554 |
&& config.iPdpAddress==aProtocolAddress)
|
|
555 |
{
|
|
556 |
return ETrue;
|
|
557 |
}
|
|
558 |
else
|
|
559 |
{
|
|
560 |
return EFalse;
|
|
561 |
}
|
|
562 |
}
|
|
563 |
return EFalse;
|
|
564 |
}
|
|
565 |
|
|
566 |
//======================================================
|
|
567 |
//
|
|
568 |
// CPsdContextQoSConfig
|
|
569 |
//
|
|
570 |
//======================================================
|
|
571 |
|
|
572 |
CPsdContextQoSConfig* CPsdContextQoSConfig::NewL(CCommsDbAccess& aDbAccess, MPsdEnv::TNetworkMode aMode)
|
|
573 |
/**
|
|
574 |
Function creates a CPsdContextQoSConfig object
|
|
575 |
|
|
576 |
@param CCommsDbAccess& aDbAccess a reference to the comm Db access object to allow the class to obtain details from CommDb
|
|
577 |
@param TNetworkMode aMode the mode of the context config parameters to be created.
|
|
578 |
@return CPsdContextQoSConfig* the newly created object (ownership of the object is passed to the function caller)
|
|
579 |
*/
|
|
580 |
{
|
|
581 |
CPsdContextQoSConfig* self = new(ELeave)CPsdContextQoSConfig(aDbAccess,aMode);
|
|
582 |
CleanupStack::PushL(self);
|
|
583 |
self->ConstructL();
|
|
584 |
CleanupStack::Pop(); //self
|
|
585 |
return self;
|
|
586 |
}
|
|
587 |
|
|
588 |
CPsdContextQoSConfig::CPsdContextQoSConfig(CCommsDbAccess& aDbAccess, MPsdEnv::TNetworkMode aMode)
|
|
589 |
: iDbAccess(aDbAccess), iMode(aMode)
|
|
590 |
{
|
|
591 |
}
|
|
592 |
|
|
593 |
void CPsdContextQoSConfig::ConstructL()
|
|
594 |
/**
|
|
595 |
2nd phase construction of CPsdContextQoSConfig calls the appropriate internal construction
|
|
596 |
function for the current mode
|
|
597 |
*/
|
|
598 |
{
|
|
599 |
if(iMode == MPsdEnv::EModeWCDMA)
|
|
600 |
{
|
|
601 |
GprsQoSConfigConstructL();
|
|
602 |
}
|
|
603 |
}
|
|
604 |
|
|
605 |
CPsdContextQoSConfig::~CPsdContextQoSConfig()
|
|
606 |
/**
|
|
607 |
Destructor
|
|
608 |
*/
|
|
609 |
{
|
|
610 |
delete iPackedQoSConfig;
|
|
611 |
delete iQoSConfig;
|
|
612 |
}
|
|
613 |
|
|
614 |
const TPacketDataConfigBase& CPsdContextQoSConfig::QoSConfig() const
|
|
615 |
/**
|
|
616 |
Function that returns the current QoS config parameters as a TPacketDataConfigBase
|
|
617 |
|
|
618 |
@return TPacketDataConfigBase& reference to the QoS config parameters. (reurned as the mode agnostic base class)
|
|
619 |
*/
|
|
620 |
{
|
|
621 |
return *iQoSConfig;
|
|
622 |
}
|
|
623 |
|
|
624 |
TDes8& CPsdContextQoSConfig::PackedQoSConfig() const
|
|
625 |
/**
|
|
626 |
Function that returns the current QoS config parameters packed in a descriptor
|
|
627 |
|
|
628 |
@return TDesC8& reference to the QoS config parameters packed in a descriptor.
|
|
629 |
*/
|
|
630 |
{
|
|
631 |
return *iPackedQoSConfig;
|
|
632 |
}
|
|
633 |
|
|
634 |
void CPsdContextQoSConfig::GprsQoSConfigConstructL()
|
|
635 |
/**
|
|
636 |
Internal function that constructs the object if the mode is GPRS
|
|
637 |
interogates CommDb and reads the appropriate parameters from there
|
|
638 |
*/
|
|
639 |
{
|
|
640 |
iQoSConfig=new(ELeave)RPacketQoS::TQoSGPRSRequested();
|
|
641 |
RPacketQoS::TQoSGPRSRequested& qoSConfig = *(STATIC_CAST(RPacketQoS::TQoSGPRSRequested*, iQoSConfig));
|
|
642 |
|
|
643 |
|
|
644 |
TUint32 data;
|
|
645 |
iDbAccess.GetIntL(TPtrC(KGeneralServiceTable),TPtrC(GPRS_REQ_PRECEDENCE),data);
|
|
646 |
qoSConfig.iReqPrecedence = (RPacketQoS::TQoSPrecedence)data;
|
|
647 |
|
|
648 |
iDbAccess.GetIntL(TPtrC(KGeneralServiceTable),TPtrC(GPRS_REQ_DELAY),data);
|
|
649 |
qoSConfig.iReqDelay = (RPacketQoS::TQoSDelay)data;
|
|
650 |
|
|
651 |
iDbAccess.GetIntL(TPtrC(KGeneralServiceTable),TPtrC(GPRS_REQ_RELIABILITY),data);
|
|
652 |
qoSConfig.iReqReliability = (RPacketQoS::TQoSReliability)data;
|
|
653 |
|
|
654 |
iDbAccess.GetIntL(TPtrC(KGeneralServiceTable),TPtrC(GPRS_REQ_PEAK_THROUGHPUT),data);
|
|
655 |
qoSConfig.iReqPeakThroughput = (RPacketQoS::TQoSPeakThroughput)data;
|
|
656 |
|
|
657 |
iDbAccess.GetIntL(TPtrC(KGeneralServiceTable),TPtrC(GPRS_REQ_MEAN_THROUGHPUT),data);
|
|
658 |
qoSConfig.iReqMeanThroughput = (RPacketQoS::TQoSMeanThroughput)data;
|
|
659 |
|
|
660 |
iDbAccess.GetIntL(TPtrC(KGeneralServiceTable),TPtrC(GPRS_MIN_PRECEDENCE),data);
|
|
661 |
qoSConfig.iMinPrecedence = (RPacketQoS::TQoSPrecedence)data;
|
|
662 |
|
|
663 |
iDbAccess.GetIntL(TPtrC(KGeneralServiceTable),TPtrC(GPRS_MIN_DELAY),data);
|
|
664 |
qoSConfig.iMinDelay = (RPacketQoS::TQoSDelay)data;
|
|
665 |
|
|
666 |
iDbAccess.GetIntL(TPtrC(KGeneralServiceTable),TPtrC(GPRS_MIN_RELIABILITY),data);
|
|
667 |
qoSConfig.iMinReliability = (RPacketQoS::TQoSReliability)data;
|
|
668 |
|
|
669 |
iDbAccess.GetIntL(TPtrC(KGeneralServiceTable),TPtrC(GPRS_MIN_PEAK_THROUGHPUT),data);
|
|
670 |
qoSConfig.iMinPeakThroughput = (RPacketQoS::TQoSPeakThroughput)data;
|
|
671 |
|
|
672 |
iDbAccess.GetIntL(TPtrC(KGeneralServiceTable),TPtrC(GPRS_MIN_MEAN_THROUGHPUT),data);
|
|
673 |
qoSConfig.iMinMeanThroughput = (RPacketQoS::TQoSMeanThroughput)data;
|
|
674 |
|
|
675 |
iPackedQoSConfig = new(ELeave)TPckg<RPacketQoS::TQoSGPRSRequested>(qoSConfig);
|
|
676 |
}
|
|
677 |
|
|
678 |
TBool CPsdContextQoSConfig::QueryIfQoSAcceptable(TDesC8& aNewQoS) const
|
|
679 |
/**
|
|
680 |
Function to check if the QoS config passed in the parameter meets the minimum requiremnts
|
|
681 |
set in CommDb
|
|
682 |
|
|
683 |
@param TDesC8& aNewQoS the QoS config to be checked packed in a descriptor
|
|
684 |
@return TBool ETrue if the QoS config passed in is above or equal to the minimum values, EFalse otherwise.
|
|
685 |
*/
|
|
686 |
{
|
|
687 |
TBool ret = ETrue;
|
|
688 |
if(iMode == MPsdEnv::EModeWCDMA)
|
|
689 |
{
|
|
690 |
TPckg<RPacketQoS::TQoSGPRSNegotiated> qoSPckg = *((TPckg<RPacketQoS::TQoSGPRSNegotiated>*)&aNewQoS);
|
|
691 |
RPacketQoS::TQoSGPRSNegotiated& newQoS = qoSPckg();
|
|
692 |
ret = QueryIfGprsQoSAcceptable(newQoS);
|
|
693 |
}
|
|
694 |
return ret;
|
|
695 |
}
|
|
696 |
|
|
697 |
TBool CPsdContextQoSConfig::QueryIfGprsQoSAcceptable(const RPacketQoS::TQoSGPRSNegotiated& /*aNewQoS*/) const
|
|
698 |
/**
|
|
699 |
Internal function to check if the QoS config passed in the parameter meets the minimum required for GPRS
|
|
700 |
|
|
701 |
@param RPacketQoS::TQoSGPRSNegotiated& aNewQoS the QoS config to be checked against the minimum values
|
|
702 |
@return TBool ETrue if the config passed in is above or equal to the minimum values, EFalse otherwise.
|
|
703 |
*/
|
|
704 |
{
|
|
705 |
// Apparently the GPRS network has to give you what you asked for otherwise
|
|
706 |
// it will not complete the connection, so just return ETrue
|
|
707 |
return ETrue;
|
|
708 |
}
|
|
709 |
|
|
710 |
//
|
|
711 |
//
|
|
712 |
// CPsdContextChangeMonitor
|
|
713 |
//
|
|
714 |
|
|
715 |
CPsdContextChangeMonitor* CPsdContextChangeMonitor::NewL(MPsdEnv* aEnv, MPsdContextChangeObserver* aObserver)
|
|
716 |
|
|
717 |
/**
|
|
718 |
Function creates a CPsdContextChangeMonitor object
|
|
719 |
|
|
720 |
@param MPsdEnv* aEnv a pointer to a object that provides the MPsdEnv interface
|
|
721 |
@param MPsdContextChangeObserver* aObserver a pointer to the observing object that should be called back when the quality drops below the minimum value
|
|
722 |
@return CPsdContextChangeMonitor* the newly created object (ownership of the object is passed to the function caller)
|
|
723 |
*/
|
|
724 |
{
|
|
725 |
__ASSERT_DEBUG(aEnv && aObserver,User::Invariant());
|
|
726 |
CPsdContextChangeMonitor* self = new(ELeave)CPsdContextChangeMonitor(aEnv,aObserver);
|
|
727 |
CleanupStack::PushL(self);
|
|
728 |
self->ConstructL();
|
|
729 |
CleanupStack::Pop(); //self
|
|
730 |
return self;
|
|
731 |
}
|
|
732 |
|
|
733 |
CPsdContextChangeMonitor::~CPsdContextChangeMonitor()
|
|
734 |
/**
|
|
735 |
Destructor
|
|
736 |
*/
|
|
737 |
{
|
|
738 |
Cancel();
|
|
739 |
iDebounceTimer.Close();
|
|
740 |
delete iQoSWatcher;
|
|
741 |
delete iConfigWatcher;
|
|
742 |
|
|
743 |
delete iPackedActualQoSConfig;
|
|
744 |
delete iActualQoSConfig;
|
|
745 |
delete iPackedActualConfig;
|
|
746 |
delete iActualConfig;
|
|
747 |
}
|
|
748 |
|
|
749 |
CPsdContextChangeMonitor::CPsdContextChangeMonitor(MPsdEnv* aEnv, MPsdContextChangeObserver* aObserver)
|
|
750 |
: CActive(EPriorityStandard), iSM(aEnv), iObserver(aObserver), iContextState(CPsdContextChangeMonitor::EContextQualityAcceptable)
|
|
751 |
{
|
|
752 |
CActiveScheduler::Add(this);
|
|
753 |
}
|
|
754 |
|
|
755 |
void CPsdContextChangeMonitor::ConstructL()
|
|
756 |
/**
|
|
757 |
2nd phase constructor. Initialises the member variables as appropriate for the current mode.
|
|
758 |
Constructs a CPsdContextConfigChangeWatcher and a CPsdQoSConfigChangeWatcher object to watch for
|
|
759 |
cahnges in context config and qos config.
|
|
760 |
*/
|
|
761 |
{
|
|
762 |
TInt r=iDebounceTimer.CreateLocal();
|
|
763 |
if (r!=KErrNone)
|
|
764 |
User::Leave(r);
|
|
765 |
TUint32 timeOut = 0; // keeps compiler happy; we know it's always set below
|
|
766 |
if(iSM->Mode() == MPsdEnv::EModeWCDMA)
|
|
767 |
{
|
|
768 |
iActualConfig=new(ELeave)RPacketContext::TContextConfigGPRS();
|
|
769 |
RPacketContext::TContextConfigGPRS& config = *(STATIC_CAST(RPacketContext::TContextConfigGPRS*, iActualConfig));
|
|
770 |
iPackedActualConfig = new(ELeave)TPckg<RPacketContext::TContextConfigGPRS>(config);
|
|
771 |
|
|
772 |
iActualQoSConfig=new(ELeave)RPacketQoS::TQoSGPRSNegotiated();
|
|
773 |
RPacketQoS::TQoSGPRSNegotiated& qoSConfig = *(STATIC_CAST(RPacketQoS::TQoSGPRSNegotiated*, iActualQoSConfig));
|
|
774 |
iPackedActualQoSConfig = new(ELeave)TPckg<RPacketQoS::TQoSGPRSNegotiated>(qoSConfig);
|
|
775 |
// Get timeOut from the Db; default to 0 on error (eg. Db value is NULL)
|
|
776 |
TRAPD(rOk,iSM->BaseEnv().Db()->GetIntL(TPtrC(KGeneralServiceTable),TPtrC(GPRS_QOS_WARNING_TIMEOUT),timeOut));
|
|
777 |
if (rOk != KErrNone)
|
|
778 |
timeOut = 0;
|
|
779 |
}
|
|
780 |
iConfigWatcher = new(ELeave)CPsdContextConfigChangeWatcher(iSM->Context(), *this, *iPackedActualConfig);
|
|
781 |
|
|
782 |
if (iSM->IsQoSSupported())//the tsy might not support QoS
|
|
783 |
iQoSWatcher = new(ELeave)CPsdQoSConfigChangeWatcher(iSM->QoS(), *this, *iPackedActualQoSConfig);
|
|
784 |
else
|
|
785 |
iQoSWatcher=0;
|
|
786 |
|
|
787 |
iDebounceTimeout = timeOut;
|
|
788 |
if(iDebounceTimeout.Int()>0)
|
|
789 |
{
|
|
790 |
// The timeout will be greater than zero if the service loss dialogs are enabled
|
|
791 |
iConfigWatcher->StartL();
|
|
792 |
if (iQoSWatcher)//the tsy might not support QoS
|
|
793 |
iQoSWatcher->StartL();
|
|
794 |
}
|
|
795 |
}
|
|
796 |
|
|
797 |
void CPsdContextChangeMonitor::ReportConfigChange()
|
|
798 |
/**
|
|
799 |
Callback function, called when the CPsdContextConfigChangeWatcher object reports
|
|
800 |
a change in context config parameters
|
|
801 |
Checks to see if the changed parameters are below the minimum and if so
|
|
802 |
starts the timeout which will cause the observer to be informed of the
|
|
803 |
connection going below quality.
|
|
804 |
If the context config returns to acceptable values before the timeout completes
|
|
805 |
the timeout is cancelled and the observer will not be notified of the change
|
|
806 |
*/
|
|
807 |
{
|
|
808 |
// The config has changed check if it is acceptable
|
|
809 |
TBool acceptable = iSM->Config().QueryIfConfigAcceptable(*iPackedActualConfig);
|
|
810 |
// Only report if the context was previously of acceptable quality and now it is not
|
|
811 |
if(!acceptable && (iContextState == EContextQualityAcceptable))
|
|
812 |
{
|
|
813 |
// the context config has just gone below quality - don't report again until it becomes acceptable
|
|
814 |
iContextState |= EConfigQualityUnAcceptable;
|
|
815 |
StartTimeout();
|
|
816 |
}
|
|
817 |
else if(acceptable && (iContextState & EConfigQualityUnAcceptable))
|
|
818 |
{
|
|
819 |
// the context config has become of acceptable quality again
|
|
820 |
iContextState &= ~EConfigQualityUnAcceptable;
|
|
821 |
CancelTimeout();
|
|
822 |
}
|
|
823 |
}
|
|
824 |
|
|
825 |
void CPsdContextChangeMonitor::ReportQoSChange()
|
|
826 |
/**
|
|
827 |
Callback function, called when the CPsdQoSConfigChangeWatcher object reports
|
|
828 |
a change in QoS config parameters
|
|
829 |
Checks to see if the changed parameters are below the minimum and if so
|
|
830 |
starts the timeout which will cause the observer to be informed of the
|
|
831 |
connection going below quality.
|
|
832 |
If the QoS config returns to acceptable values before the timeout completes
|
|
833 |
the timeout is cancelled and the observer will not be notified of the change
|
|
834 |
*/
|
|
835 |
{
|
|
836 |
// The QoS config has changed check if it is acceptable
|
|
837 |
TBool acceptable = iSM->QoSConfig().QueryIfQoSAcceptable(*iPackedActualQoSConfig);
|
|
838 |
// Only report if the context was previously of acceptable quality and now it is not
|
|
839 |
if(!acceptable && (iContextState == EContextQualityAcceptable))
|
|
840 |
{
|
|
841 |
// the QoS config has just gone below quality - don't report again until it becomes acceptable
|
|
842 |
iContextState |= EQoSQualityUnAcceptable;
|
|
843 |
StartTimeout();
|
|
844 |
}
|
|
845 |
else if(acceptable && (iContextState & EQoSQualityUnAcceptable))
|
|
846 |
{
|
|
847 |
// the context config has become of acceptable quality again
|
|
848 |
iContextState &= ~EQoSQualityUnAcceptable;
|
|
849 |
CancelTimeout();
|
|
850 |
}
|
|
851 |
}
|
|
852 |
|
|
853 |
void CPsdContextChangeMonitor::RunL()
|
|
854 |
/**
|
|
855 |
The RunL will be called when the timeout completes following a drop below acceptable
|
|
856 |
QoS or context quality. It informs the observer of the quality drop.
|
|
857 |
*/
|
|
858 |
{
|
|
859 |
// The timeout has completed this means the context quality has been below acceptable
|
|
860 |
// for the duration of the timeout, so report it
|
|
861 |
iObserver->ReportContextBelowAcceptableQuality();
|
|
862 |
}
|
|
863 |
|
|
864 |
void CPsdContextChangeMonitor::ReportConfigWatcherError(TInt aError)
|
|
865 |
/**
|
|
866 |
Callback function called when an error occurs in the CPsdContextConfigChangeWatcher object
|
|
867 |
|
|
868 |
@param error code for error occurs in the CPsdContextConfigChangeWatcher object
|
|
869 |
*/
|
|
870 |
{
|
|
871 |
iObserver->ReportError(aError);
|
|
872 |
}
|
|
873 |
|
|
874 |
void CPsdContextChangeMonitor::ReportQoSWatcherError(TInt aError)
|
|
875 |
/**
|
|
876 |
Callback function called when an error occurs in the CPsdQoSConfigChangeWatcher object
|
|
877 |
|
|
878 |
@param error code for error occurs in the CPsdQoSConfigChangeWatcher object
|
|
879 |
*/
|
|
880 |
{
|
|
881 |
iObserver->ReportError(aError);
|
|
882 |
}
|
|
883 |
|
|
884 |
void CPsdContextChangeMonitor::StartTimeout()
|
|
885 |
{
|
|
886 |
if(!IsActive())
|
|
887 |
{
|
|
888 |
iDebounceTimer.After(iStatus, iDebounceTimeout);
|
|
889 |
SetActive();
|
|
890 |
}
|
|
891 |
}
|
|
892 |
|
|
893 |
void CPsdContextChangeMonitor::CancelTimeout()
|
|
894 |
{
|
|
895 |
if(iContextState == EContextQualityAcceptable)
|
|
896 |
{
|
|
897 |
Cancel();
|
|
898 |
}
|
|
899 |
}
|
|
900 |
|
|
901 |
void CPsdContextChangeMonitor::DoCancel()
|
|
902 |
{
|
|
903 |
iDebounceTimer.Cancel();
|
|
904 |
}
|
|
905 |
//
|
|
906 |
//
|
|
907 |
// CPsdContextConfigChangeWatcher
|
|
908 |
//
|
|
909 |
|
|
910 |
CPsdContextConfigChangeWatcher::CPsdContextConfigChangeWatcher(const RPacketContext& aContext, MObserver& aObserver, TPtr8& aContextParams)
|
|
911 |
: CActive(EPriorityStandard), iObserver(aObserver), iContext(aContext), iContextParams(aContextParams)
|
|
912 |
/**
|
|
913 |
Overloaded Constructor adding itself to the active scheduler
|
|
914 |
*/
|
|
915 |
{
|
|
916 |
CActiveScheduler::Add(this);
|
|
917 |
}
|
|
918 |
|
|
919 |
void CPsdContextConfigChangeWatcher::StartL()
|
|
920 |
/**
|
|
921 |
Start notifying observer of changes in context config parameters
|
|
922 |
*/
|
|
923 |
{
|
|
924 |
iContext.NotifyConfigChanged(iStatus, iContextParams);
|
|
925 |
SetActive();
|
|
926 |
}
|
|
927 |
|
|
928 |
CPsdContextConfigChangeWatcher::~CPsdContextConfigChangeWatcher()
|
|
929 |
/**
|
|
930 |
Destructor
|
|
931 |
*/
|
|
932 |
{
|
|
933 |
Cancel();
|
|
934 |
}
|
|
935 |
|
|
936 |
void CPsdContextConfigChangeWatcher::RunL()
|
|
937 |
/**
|
|
938 |
RunL completes when the context config parameters have changed - call back
|
|
939 |
the observer to inform them of the event
|
|
940 |
*/
|
|
941 |
{
|
|
942 |
if(iStatus != KErrNone)
|
|
943 |
{
|
|
944 |
iObserver.ReportConfigWatcherError(iStatus.Int());
|
|
945 |
}
|
|
946 |
else
|
|
947 |
{
|
|
948 |
iObserver.ReportConfigChange();
|
|
949 |
}
|
|
950 |
// Renew Request
|
|
951 |
iContext.NotifyConfigChanged(iStatus, iContextParams);
|
|
952 |
SetActive();
|
|
953 |
}
|
|
954 |
|
|
955 |
void CPsdContextConfigChangeWatcher::DoCancel()
|
|
956 |
/**
|
|
957 |
Cancell the changes in the context configuration parameters and notifying its observer when such a change occurs.
|
|
958 |
*/
|
|
959 |
{
|
|
960 |
iContext.CancelAsyncRequest(EPacketContextNotifyConfigChanged);
|
|
961 |
}
|
|
962 |
|
|
963 |
//
|
|
964 |
//
|
|
965 |
// CPsdQoSConfigChangeWatcher
|
|
966 |
//
|
|
967 |
|
|
968 |
CPsdQoSConfigChangeWatcher::CPsdQoSConfigChangeWatcher(const RPacketQoS& aQoS, MObserver& aObserver, TPtr8& aQoSParams)
|
|
969 |
: CActive(EPriorityStandard), iObserver(aObserver), iQoS(aQoS), iQoSParams(aQoSParams)
|
|
970 |
/**
|
|
971 |
Overloaded Constructor adding itself to the active scheduler
|
|
972 |
*/
|
|
973 |
{
|
|
974 |
CActiveScheduler::Add(this);
|
|
975 |
}
|
|
976 |
|
|
977 |
void CPsdQoSConfigChangeWatcher::StartL()
|
|
978 |
/**
|
|
979 |
Start notifying observer of changes in QoS config parameters
|
|
980 |
*/
|
|
981 |
{
|
|
982 |
iQoS.NotifyProfileChanged(iStatus, iQoSParams);
|
|
983 |
SetActive();
|
|
984 |
}
|
|
985 |
|
|
986 |
CPsdQoSConfigChangeWatcher::~CPsdQoSConfigChangeWatcher()
|
|
987 |
/**
|
|
988 |
Destructor
|
|
989 |
*/
|
|
990 |
{
|
|
991 |
Cancel();
|
|
992 |
}
|
|
993 |
|
|
994 |
void CPsdQoSConfigChangeWatcher::RunL()
|
|
995 |
/**
|
|
996 |
RunL completes when the QoS config parameters have changed - call back
|
|
997 |
the observer to inform them of the event
|
|
998 |
*/
|
|
999 |
{
|
|
1000 |
if(iStatus != KErrNone)
|
|
1001 |
{
|
|
1002 |
iObserver.ReportQoSWatcherError(iStatus.Int());
|
|
1003 |
}
|
|
1004 |
else
|
|
1005 |
{
|
|
1006 |
iObserver.ReportQoSChange();
|
|
1007 |
}
|
|
1008 |
// Renew Request
|
|
1009 |
iQoS.NotifyProfileChanged(iStatus, iQoSParams);
|
|
1010 |
SetActive();
|
|
1011 |
}
|
|
1012 |
|
|
1013 |
void CPsdQoSConfigChangeWatcher::DoCancel()
|
|
1014 |
{
|
|
1015 |
iQoS.CancelAsyncRequest(EPacketQoSNotifyProfileChanged);
|
|
1016 |
}
|
|
1017 |
|