28
|
1 |
/*
|
|
2 |
* Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies).
|
|
3 |
* All rights reserved.
|
|
4 |
* This component and the accompanying materials are made available
|
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
|
6 |
* which accompanies this distribution, and is available
|
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
8 |
*
|
|
9 |
* Initial Contributors:
|
|
10 |
* Nokia Corporation - initial contribution.
|
|
11 |
*
|
|
12 |
* Contributors:
|
|
13 |
*
|
|
14 |
* Description: CCCHConnMonHandler implementation
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
// INCLUDE FILES
|
|
20 |
#include "cchconnmonhandler.h"
|
|
21 |
#include "cchserverbase.h"
|
|
22 |
#include "cchlogger.h"
|
|
23 |
#include "cchservicehandler.h"
|
|
24 |
#include "cchconnmonhandlernotifier.h"
|
|
25 |
|
|
26 |
// EXTERNAL DATA STRUCTURES
|
|
27 |
// None
|
|
28 |
|
|
29 |
// EXTERNAL FUNCTION PROTOTYPES
|
|
30 |
// None
|
|
31 |
|
|
32 |
// CONSTANTS
|
|
33 |
// None
|
|
34 |
|
|
35 |
// MACROS
|
|
36 |
// None
|
|
37 |
|
|
38 |
// LOCAL CONSTANTS AND MACROS
|
|
39 |
const TInt KPeriodicTimerInterval( 5000000 ); // 5sec.
|
|
40 |
|
|
41 |
// MODULE DATA STRUCTURES
|
|
42 |
// None
|
|
43 |
|
|
44 |
// LOCAL FUNCTION PROTOTYPES
|
|
45 |
// None
|
|
46 |
|
|
47 |
// FORWARD DECLARATIONS
|
|
48 |
// None
|
|
49 |
|
|
50 |
// ============================= LOCAL FUNCTIONS =============================
|
|
51 |
|
|
52 |
// ============================ MEMBER FUNCTIONS =============================
|
|
53 |
|
|
54 |
// ---------------------------------------------------------------------------
|
|
55 |
// CCCHConnMonHandler::CCCHConnMonHandler
|
|
56 |
// C++ default constructor can NOT contain any code, that might leave.
|
|
57 |
// ---------------------------------------------------------------------------
|
|
58 |
//
|
|
59 |
CCCHConnMonHandler::CCCHConnMonHandler( CCCHServerBase& aServer ) :
|
|
60 |
CActive( CActive::EPriorityStandard ),
|
|
61 |
iState( EUninitialized ),
|
|
62 |
iServer( aServer )
|
|
63 |
{
|
|
64 |
CActiveScheduler::Add( this );
|
|
65 |
}
|
|
66 |
|
|
67 |
// ---------------------------------------------------------------------------
|
|
68 |
// CCCHConnMonHandler::ConstructL
|
|
69 |
// Symbian 2nd phase constructor can leave.
|
|
70 |
// ---------------------------------------------------------------------------
|
|
71 |
//
|
|
72 |
void CCCHConnMonHandler::ConstructL()
|
|
73 |
{
|
|
74 |
User::LeaveIfError( iConnMon.ConnectL() );
|
|
75 |
NotifyL();
|
|
76 |
iConnChangeListenerTimer = CPeriodic::NewL( CActive::EPriorityIdle );
|
|
77 |
}
|
|
78 |
|
|
79 |
// ---------------------------------------------------------------------------
|
|
80 |
// CCCHConnMonHandler::NewL
|
|
81 |
// Two-phased constructor.
|
|
82 |
// ---------------------------------------------------------------------------
|
|
83 |
//
|
|
84 |
CCCHConnMonHandler* CCCHConnMonHandler::NewL( CCCHServerBase& aServer )
|
|
85 |
{
|
|
86 |
CCCHConnMonHandler* self = CCCHConnMonHandler::NewLC( aServer );
|
|
87 |
CleanupStack::Pop( self );
|
|
88 |
return self;
|
|
89 |
}
|
|
90 |
|
|
91 |
// ---------------------------------------------------------------------------
|
|
92 |
// CCCHConnMonHandler::NewLC
|
|
93 |
// Two-phased constructor.
|
|
94 |
// ---------------------------------------------------------------------------
|
|
95 |
//
|
|
96 |
CCCHConnMonHandler* CCCHConnMonHandler::NewLC( CCCHServerBase& aServer )
|
|
97 |
{
|
|
98 |
CCCHConnMonHandler* self = new (ELeave) CCCHConnMonHandler( aServer );
|
|
99 |
CleanupStack::PushL( self );
|
|
100 |
self->ConstructL();
|
|
101 |
return self;
|
|
102 |
}
|
|
103 |
|
|
104 |
// Destructor
|
|
105 |
CCCHConnMonHandler::~CCCHConnMonHandler()
|
|
106 |
{
|
|
107 |
CCHLOGSTRING( "CCCHConnMonHandler::~CCCHConnMonHandler" );
|
|
108 |
if ( iConnChangeListenerTimer )
|
|
109 |
{
|
|
110 |
iConnChangeListenerTimer->Cancel();
|
|
111 |
}
|
|
112 |
delete iConnChangeListenerTimer;
|
|
113 |
StopNotify();
|
|
114 |
Cancel();
|
|
115 |
iPendingRequests.Close();
|
|
116 |
iUnsolvedConnIds.Close();
|
|
117 |
iConnIapIds.Close();
|
|
118 |
iAvailableSNAPs.Close();
|
|
119 |
iAvailableIAPs.Close();
|
|
120 |
iConnMon.Close();
|
|
121 |
}
|
|
122 |
|
|
123 |
// ---------------------------------------------------------------------------
|
|
124 |
// CCCHConnMonHandler::ScanNetworks
|
|
125 |
// (other items were commented in a header).
|
|
126 |
// ---------------------------------------------------------------------------
|
|
127 |
//
|
|
128 |
void CCCHConnMonHandler::ScanNetworks(
|
|
129 |
TBool aWlanScan, MCCHConnMonHandlerNotifier* aObserver )
|
|
130 |
{
|
|
131 |
CCHLOGSTRING( "CCCHConnMonHandler::ScanNetworks: IN" );
|
|
132 |
|
|
133 |
if ( aWlanScan )
|
|
134 |
{
|
|
135 |
iNetworkScanningObserver = aObserver;
|
|
136 |
GetIaps( EBearerIdAll );
|
|
137 |
}
|
|
138 |
|
|
139 |
CCHLOGSTRING( "CCCHConnMonHandler::ScanNetworks: OUT" );
|
|
140 |
}
|
|
141 |
|
|
142 |
// ---------------------------------------------------------------------------
|
|
143 |
// CCCHConnMonHandler::ScanNetworksCancel
|
|
144 |
// (other items were commented in a header).
|
|
145 |
// ---------------------------------------------------------------------------
|
|
146 |
//
|
|
147 |
void CCCHConnMonHandler::ScanNetworksCancel()
|
|
148 |
{
|
|
149 |
Cancel();
|
|
150 |
}
|
|
151 |
|
|
152 |
// ---------------------------------------------------------------------------
|
|
153 |
// CCCHConnMonHandler::IsSNAPAvailable
|
|
154 |
// (other items were commented in a header).
|
|
155 |
// ---------------------------------------------------------------------------
|
|
156 |
//
|
|
157 |
TBool CCCHConnMonHandler::IsSNAPAvailable( TUint aSNAPId ) const
|
|
158 |
{
|
|
159 |
return ( KErrNotFound == iAvailableSNAPs.Find( aSNAPId ) )
|
|
160 |
? EFalse : ETrue;
|
|
161 |
}
|
|
162 |
|
|
163 |
// ---------------------------------------------------------------------------
|
|
164 |
// CCCHConnMonHandler::IsIapAvailable
|
|
165 |
// (other items were commented in a header).
|
|
166 |
// ---------------------------------------------------------------------------
|
|
167 |
//
|
|
168 |
TBool CCCHConnMonHandler::IsIapAvailable( TUint aIapId ) const
|
|
169 |
{
|
|
170 |
return ( KErrNotFound == iAvailableIAPs.Find( aIapId ) )
|
|
171 |
? EFalse : ETrue;
|
|
172 |
}
|
|
173 |
|
|
174 |
// ---------------------------------------------------------------------------
|
|
175 |
// CCCHConnMonHandler::SetSNAPsAvailabilityChangeListener
|
|
176 |
// (other items were commented in a header).
|
|
177 |
// ---------------------------------------------------------------------------
|
|
178 |
//
|
|
179 |
void CCCHConnMonHandler::SetSNAPsAvailabilityChangeListener(
|
|
180 |
MCCHConnMonHandlerNotifier* aObserver )
|
|
181 |
{
|
|
182 |
CCHLOGSTRING( "CCCHConnMonHandler::SetSNAPsAvailabilityChangeListener" );
|
|
183 |
iConnChangeListenerTimer->Cancel();
|
|
184 |
iSNAPsAvailabilityObserver = aObserver;
|
|
185 |
if ( iSNAPsAvailabilityObserver )
|
|
186 |
{
|
|
187 |
iConnChangeListenerTimer->Start(
|
|
188 |
KPeriodicTimerInterval,
|
|
189 |
KPeriodicTimerInterval,
|
|
190 |
TCallBack( PeriodicTimerCallBack, this ) );
|
|
191 |
}
|
|
192 |
}
|
|
193 |
|
|
194 |
// ---------------------------------------------------------------------------
|
|
195 |
// CCCHConnMonHandler::GetIaps
|
|
196 |
// (other items were commented in a header).
|
|
197 |
// ---------------------------------------------------------------------------
|
|
198 |
//
|
|
199 |
void CCCHConnMonHandler::GetIaps( TConnMonBearerId aBearerId )
|
|
200 |
{
|
|
201 |
if ( !IsActive() )
|
|
202 |
{
|
|
203 |
iConnMon.GetPckgAttribute( aBearerId,
|
|
204 |
0,
|
|
205 |
KIapAvailability,
|
|
206 |
iIapsBuf,
|
|
207 |
iStatus );
|
|
208 |
iState = EGetIAPS;
|
|
209 |
SetActive();
|
|
210 |
}
|
|
211 |
}
|
|
212 |
|
|
213 |
// ---------------------------------------------------------------------------
|
|
214 |
// CCCHConnMonHandler::UpdateIapArray
|
|
215 |
// (other items were commented in a header).
|
|
216 |
// ---------------------------------------------------------------------------
|
|
217 |
//
|
|
218 |
void CCCHConnMonHandler::UpdateIapArray( TConnMonIapInfo aIaps )
|
|
219 |
{
|
|
220 |
CCHLOGSTRING2( "CCCHConnMonHandler::UpdateIapArray: IN count %d",
|
|
221 |
iAvailableIAPs.Count() );
|
|
222 |
|
|
223 |
iAvailableIAPs.Reset();
|
|
224 |
TUint count( 0 );
|
|
225 |
|
|
226 |
// Copy TConnMonIapInfo to RArray so we can use RArray::Find method
|
|
227 |
while ( count < aIaps.iCount )
|
|
228 |
{
|
|
229 |
iAvailableIAPs.Append( aIaps.iIap[ count ].iIapId );
|
|
230 |
count++;
|
|
231 |
}
|
|
232 |
CCHLOGSTRING2( "CCCHConnMonHandler::UpdateIapArray: OUT count %d",
|
|
233 |
iAvailableIAPs.Count() );
|
|
234 |
}
|
|
235 |
|
|
236 |
// ---------------------------------------------------------------------------
|
|
237 |
// CCCHConnMonHandler::GetSNAPs
|
|
238 |
// (other items were commented in a header).
|
|
239 |
// ---------------------------------------------------------------------------
|
|
240 |
//
|
|
241 |
void CCCHConnMonHandler::GetSNAPs()
|
|
242 |
{
|
|
243 |
CCHLOGSTRING( "CCCHConnMonHandler::GetSNAPs: IN" );
|
|
244 |
|
|
245 |
if ( !IsActive() )
|
|
246 |
{
|
|
247 |
iConnMon.GetPckgAttribute( EBearerIdAll, // some parameter
|
|
248 |
0, // pass the size of buffer
|
|
249 |
KSNAPsAvailability, // specify the request
|
|
250 |
iSNAPbuf, // buffer for writing data
|
|
251 |
iStatus );
|
|
252 |
iState = EGetSNAPs;
|
|
253 |
SetActive();
|
|
254 |
}
|
|
255 |
|
|
256 |
CCHLOGSTRING( "CCCHConnMonHandler::GetSNAPs: OUT" );
|
|
257 |
}
|
|
258 |
|
|
259 |
// ---------------------------------------------------------------------------
|
|
260 |
// CCCHConnMonHandler::UpdateSnapArray
|
|
261 |
// (other items were commented in a header).
|
|
262 |
// ---------------------------------------------------------------------------
|
|
263 |
//
|
|
264 |
void CCCHConnMonHandler::UpdateSnapArray( TConnMonSNAPInfo aSNAPs )
|
|
265 |
{
|
|
266 |
CCHLOGSTRING2( "CCCHConnMonHandler::UpdateSnapArray: IN count %d",
|
|
267 |
iAvailableSNAPs.Count() );
|
|
268 |
|
|
269 |
iAvailableSNAPs.Reset();
|
|
270 |
TUint count( 0 );
|
|
271 |
// Copy TConnMonSNAPInfo to RArray so we can use RArray::Find method
|
|
272 |
while ( count < aSNAPs.iCount )
|
|
273 |
{
|
|
274 |
iAvailableSNAPs.Append( aSNAPs.iSNAP[ count ].iSNAPId );
|
|
275 |
count++;
|
|
276 |
}
|
|
277 |
CCHLOGSTRING2( "CCCHConnMonHandler::UpdateSnapArray: OUT count %d",
|
|
278 |
iAvailableSNAPs.Count() );
|
|
279 |
|
|
280 |
}
|
|
281 |
|
|
282 |
// ---------------------------------------------------------------------------
|
|
283 |
// CCCHConnMonHandler::NotifyL
|
|
284 |
// (other items were commented in a header).
|
|
285 |
// ---------------------------------------------------------------------------
|
|
286 |
//
|
|
287 |
void CCCHConnMonHandler::NotifyL()
|
|
288 |
{
|
|
289 |
CCHLOGSTRING( "CCCHConnMonHandler::NotifyL: IN" );
|
|
290 |
|
|
291 |
iConnMon.NotifyEventL( *this );
|
|
292 |
|
|
293 |
// Thresholds
|
|
294 |
TInt err = iConnMon.SetUintAttribute( EBearerIdAll,
|
|
295 |
0,
|
|
296 |
KBearerAvailabilityThreshold,
|
|
297 |
1 );
|
|
298 |
|
|
299 |
CCHLOGSTRING2( "CCCHConnMonHandler::NotifyL: OUT", err );
|
|
300 |
}
|
|
301 |
|
|
302 |
// ---------------------------------------------------------------------------
|
|
303 |
// CCCHConnMonHandler::StopNotify
|
|
304 |
// (other items were commented in a header).
|
|
305 |
// ---------------------------------------------------------------------------
|
|
306 |
//
|
|
307 |
void CCCHConnMonHandler::StopNotify()
|
|
308 |
{
|
|
309 |
iConnMon.CancelNotifications();
|
|
310 |
}
|
|
311 |
|
|
312 |
// ----------------------------------------------------------------------------
|
|
313 |
// CCCHConnMonHandler::PeriodicTimerCallBack
|
|
314 |
// The call back function.
|
|
315 |
// ----------------------------------------------------------------------------
|
|
316 |
//
|
|
317 |
TInt CCCHConnMonHandler::PeriodicTimerCallBack( TAny* aAny )
|
|
318 |
{
|
|
319 |
CCHLOGSTRING( "CCCHConnMonHandler::PeriodicTimerCallBack" );
|
|
320 |
|
|
321 |
CCCHConnMonHandler* self = static_cast<CCCHConnMonHandler*>( aAny );
|
|
322 |
self->iConnChangeListenerTimer->Cancel();
|
|
323 |
|
|
324 |
if ( self->iSNAPsAvailabilityObserver )
|
|
325 |
{
|
|
326 |
self->iSNAPsAvailabilityObserver->
|
|
327 |
SNAPsAvailabilityChanged( KErrTimedOut );
|
|
328 |
}
|
|
329 |
|
|
330 |
return KErrNone;
|
|
331 |
}
|
|
332 |
|
|
333 |
// ---------------------------------------------------------------------------
|
|
334 |
// CCCHConnMonHandler::RunL
|
|
335 |
// (other items were commented in a header).
|
|
336 |
// ---------------------------------------------------------------------------
|
|
337 |
//
|
|
338 |
void CCCHConnMonHandler::RunL()
|
|
339 |
{
|
|
340 |
CCHLOGSTRING2( "CCCHConnMonHandler::RunL: IN error: %d", iStatus.Int() );
|
|
341 |
|
|
342 |
if ( KErrNone == iStatus.Int() )
|
|
343 |
{
|
|
344 |
switch ( iState )
|
|
345 |
{
|
|
346 |
case EGetIAPS:
|
|
347 |
{
|
|
348 |
UpdateIapArray( iIapsBuf() );
|
|
349 |
GetSNAPs();
|
|
350 |
}
|
|
351 |
break;
|
|
352 |
|
|
353 |
case EGetSNAPs:
|
|
354 |
{
|
|
355 |
UpdateSnapArray( iSNAPbuf() );
|
|
356 |
if ( iNetworkScanningObserver )
|
|
357 |
{
|
|
358 |
iNetworkScanningObserver->NetworkScanningCompletedL(
|
|
359 |
iSNAPbuf(), KErrNone );
|
|
360 |
iNetworkScanningObserver = NULL;
|
|
361 |
}
|
|
362 |
}
|
|
363 |
break;
|
|
364 |
|
|
365 |
case EGetIAP:
|
|
366 |
{
|
|
367 |
CCHLOGSTRING2( "CCCHConnMonHandler::RunL: iap: %d", iConnIapId );
|
|
368 |
TCCHConnectionInfo info;
|
|
369 |
info.iIapId = iConnIapId;
|
|
370 |
info.iConnId = iConnId;
|
|
371 |
|
|
372 |
if ( KErrNotFound == iConnIapIds.Find( info ) )
|
|
373 |
{
|
|
374 |
iConnIapIds.Append( info );
|
|
375 |
}
|
|
376 |
iConnId = 0;
|
|
377 |
iConnIapId = 0;
|
|
378 |
|
|
379 |
CCHLOGSTRING2( "CCCHConnMonHandler::RunL: unsolved conn count: %d", iUnsolvedConnIds.Count() );
|
|
380 |
if ( iUnsolvedConnIds.Count() )
|
|
381 |
{
|
|
382 |
GetIapId();
|
|
383 |
}
|
|
384 |
}
|
|
385 |
break;
|
|
386 |
|
|
387 |
case EGetConnectionCount:
|
|
388 |
{
|
|
389 |
CCHLOGSTRING2( "CCCHConnMonHandler::RunL: conn count: %d", iConnCount );
|
|
390 |
TBool familiar( EFalse );
|
|
391 |
TUint connId( KErrNone );
|
|
392 |
TUint subConnCount( KErrNone );
|
|
393 |
for ( TInt i( 1 ); i <= iConnCount; i++ )
|
|
394 |
{
|
|
395 |
if ( !iConnMon.GetConnectionInfo( i, connId, subConnCount ) )
|
|
396 |
{
|
|
397 |
familiar = EFalse;
|
|
398 |
for ( TInt j( 0 ); j < iConnIapIds.Count(); j++ )
|
|
399 |
{
|
|
400 |
if ( connId == iConnIapIds[ j ].iConnId )
|
|
401 |
{
|
|
402 |
CCHLOGSTRING2( "CCCHConnMonHandler::RunL: iap %d is familiar connection", iConnIapIds[ j ].iIapId );
|
|
403 |
familiar = ETrue;
|
|
404 |
break;
|
|
405 |
}
|
|
406 |
}
|
|
407 |
|
|
408 |
if ( !familiar && KErrNotFound == iUnsolvedConnIds.Find( connId ) )
|
|
409 |
{
|
|
410 |
iUnsolvedConnIds.Append( connId );
|
|
411 |
}
|
|
412 |
}
|
|
413 |
}
|
|
414 |
iConnCount = 0;
|
|
415 |
|
|
416 |
CCHLOGSTRING2( "CCCHConnMonHandler::RunL: unsolved conn count: %d", iUnsolvedConnIds.Count() );
|
|
417 |
if ( iUnsolvedConnIds.Count() )
|
|
418 |
{
|
|
419 |
GetIapId();
|
|
420 |
}
|
|
421 |
}
|
|
422 |
break;
|
|
423 |
|
|
424 |
default:
|
|
425 |
break;
|
|
426 |
}
|
|
427 |
|
|
428 |
|
|
429 |
if ( iPendingRequests.Count() && !IsActive() )
|
|
430 |
{
|
|
431 |
CCHLOGSTRING2( "CCCHConnMonHandler::RunL: request pending : %d",
|
|
432 |
iPendingRequests[ 0 ] );
|
|
433 |
switch ( iPendingRequests[ 0 ] )
|
|
434 |
{
|
|
435 |
case EGetIAP:
|
|
436 |
{
|
|
437 |
GetIapId();
|
|
438 |
}
|
|
439 |
break;
|
|
440 |
|
|
441 |
case EGetConnectionCount:
|
|
442 |
{
|
|
443 |
GetConnectionCount();
|
|
444 |
}
|
|
445 |
break;
|
|
446 |
|
|
447 |
default:
|
|
448 |
break;
|
|
449 |
}
|
|
450 |
|
|
451 |
iPendingRequests.Remove( 0 );
|
|
452 |
iPendingRequests.Compress();
|
|
453 |
}
|
|
454 |
}
|
|
455 |
else
|
|
456 |
{
|
|
457 |
if ( iNetworkScanningObserver )
|
|
458 |
{
|
|
459 |
iNetworkScanningObserver->NetworkScanningCompletedL(
|
|
460 |
iSNAPbuf(), iStatus.Int() );
|
|
461 |
iNetworkScanningObserver = NULL;
|
|
462 |
}
|
|
463 |
}
|
|
464 |
|
|
465 |
CCHLOGSTRING( "CCCHConnMonHandler::RunL: OUT" );
|
|
466 |
}
|
|
467 |
|
|
468 |
// ---------------------------------------------------------------------------
|
|
469 |
// CCCHConnMonHandler::StartMonitoringConnectionChanges
|
|
470 |
// (other items were commented in a header).
|
|
471 |
// ---------------------------------------------------------------------------
|
|
472 |
//
|
|
473 |
void CCCHConnMonHandler::StartMonitoringConnectionChanges()
|
|
474 |
{
|
|
475 |
iConnIapIds.Reset();
|
|
476 |
|
|
477 |
if ( !IsActive() )
|
|
478 |
{
|
|
479 |
GetConnectionCount();
|
|
480 |
}
|
|
481 |
else
|
|
482 |
{
|
|
483 |
iPendingRequests.Append( EGetConnectionCount );
|
|
484 |
}
|
|
485 |
}
|
|
486 |
|
|
487 |
// ---------------------------------------------------------------------------
|
|
488 |
// CCCHConnMonHandler::StopMonitoringConnectionChanges
|
|
489 |
// (other items were commented in a header).
|
|
490 |
// ---------------------------------------------------------------------------
|
|
491 |
//
|
|
492 |
void CCCHConnMonHandler::StopMonitoringConnectionChanges(
|
|
493 |
RArray<TUint>& aIapIds )
|
|
494 |
{
|
|
495 |
aIapIds.Reset();
|
|
496 |
for ( TInt i( 0 ); i < iConnIapIds.Count(); i++ )
|
|
497 |
{
|
|
498 |
if ( KErrNotFound == aIapIds.Find( iConnIapIds[ i ].iIapId ) )
|
|
499 |
{
|
|
500 |
aIapIds.Append( iConnIapIds[ i ].iIapId );
|
|
501 |
}
|
|
502 |
}
|
|
503 |
}
|
|
504 |
|
|
505 |
// ---------------------------------------------------------------------------
|
|
506 |
// CCCHConnMonHandler::GetConnectionCount
|
|
507 |
// (other items were commented in a header).
|
|
508 |
// ---------------------------------------------------------------------------
|
|
509 |
//
|
|
510 |
void CCCHConnMonHandler::GetConnectionCount()
|
|
511 |
{
|
|
512 |
iState = EGetConnectionCount;
|
|
513 |
iConnMon.GetConnectionCount( iConnCount, iStatus );
|
|
514 |
SetActive();
|
|
515 |
}
|
|
516 |
|
|
517 |
// ---------------------------------------------------------------------------
|
|
518 |
// CCCHConnMonHandler::GetIapId
|
|
519 |
// (other items were commented in a header).
|
|
520 |
// ---------------------------------------------------------------------------
|
|
521 |
//
|
|
522 |
void CCCHConnMonHandler::GetIapId()
|
|
523 |
{
|
|
524 |
if ( iUnsolvedConnIds.Count() )
|
|
525 |
{
|
|
526 |
iConnId = iUnsolvedConnIds[ 0 ];
|
|
527 |
iUnsolvedConnIds.Remove( 0 );
|
|
528 |
iUnsolvedConnIds.Compress();
|
|
529 |
|
|
530 |
iState = EGetIAP;
|
|
531 |
iConnMon.GetUintAttribute( iConnId, 0, KIAPId, iConnIapId, iStatus );
|
|
532 |
SetActive();
|
|
533 |
}
|
|
534 |
}
|
|
535 |
|
|
536 |
// ---------------------------------------------------------------------------
|
|
537 |
// CCCHConnMonHandler::RemoveIapId
|
|
538 |
// (other items were commented in a header).
|
|
539 |
// ---------------------------------------------------------------------------
|
|
540 |
//
|
|
541 |
void CCCHConnMonHandler::RemoveIapId(
|
|
542 |
TUint aConnId )
|
|
543 |
{
|
|
544 |
for ( TInt i( 0 ); i < iConnIapIds.Count(); i++ )
|
|
545 |
{
|
|
546 |
if ( aConnId == iConnIapIds[ i ].iConnId )
|
|
547 |
{
|
|
548 |
iConnIapIds.Remove( i );
|
|
549 |
iConnIapIds.Compress();
|
|
550 |
break;
|
|
551 |
}
|
|
552 |
}
|
|
553 |
}
|
|
554 |
|
|
555 |
// ---------------------------------------------------------------------------
|
|
556 |
// CCCHConnMonHandler::DoCancel
|
|
557 |
// (other items were commented in a header).
|
|
558 |
// ---------------------------------------------------------------------------
|
|
559 |
//
|
|
560 |
void CCCHConnMonHandler::DoCancel()
|
|
561 |
{
|
|
562 |
iConnMon.CancelAsyncRequest( EConnMonGetPckgAttribute );
|
|
563 |
if ( iNetworkScanningObserver )
|
|
564 |
{
|
|
565 |
iNetworkScanningObserver->NetworkScanningCompletedL(
|
|
566 |
iSNAPbuf(), KErrCancel );
|
|
567 |
iNetworkScanningObserver = NULL;
|
|
568 |
}
|
|
569 |
if ( iSNAPsAvailabilityObserver )
|
|
570 |
{
|
|
571 |
iConnChangeListenerTimer->Cancel();
|
|
572 |
iSNAPsAvailabilityObserver->SNAPsAvailabilityChanged( KErrCancel );
|
|
573 |
iSNAPsAvailabilityObserver = NULL;
|
|
574 |
}
|
|
575 |
}
|
|
576 |
|
|
577 |
// ---------------------------------------------------------------------------
|
|
578 |
// CCCHConnMonHandler::EventL
|
|
579 |
// (other items were commented in a header).
|
|
580 |
// ---------------------------------------------------------------------------
|
|
581 |
//
|
|
582 |
void CCCHConnMonHandler::EventL( const CConnMonEventBase &aConnMonEvent )
|
|
583 |
{
|
|
584 |
CCHLOGSTRING3
|
|
585 |
( "CCCHConnMonHandler::EventL: IN EventType = %d, ConnectionId = %d",
|
|
586 |
aConnMonEvent.EventType(), aConnMonEvent.ConnectionId() );
|
|
587 |
|
|
588 |
switch ( aConnMonEvent.EventType() )
|
|
589 |
{
|
|
590 |
case EConnMonIapAvailabilityChange:
|
|
591 |
{
|
|
592 |
const CConnMonIapAvailabilityChange* eventIap = NULL;
|
|
593 |
eventIap = static_cast< const CConnMonIapAvailabilityChange* >(
|
|
594 |
&aConnMonEvent );
|
|
595 |
|
|
596 |
TConnMonIapInfo iaps = eventIap->IapAvailability();
|
|
597 |
UpdateIapArray( iaps );
|
|
598 |
}
|
|
599 |
break;
|
|
600 |
|
|
601 |
case EConnMonSNAPsAvailabilityChange:
|
|
602 |
{
|
|
603 |
const CConnMonSNAPsAvailabilityChange* eventSNAP = NULL;
|
|
604 |
eventSNAP = static_cast< const CConnMonSNAPsAvailabilityChange* >(
|
|
605 |
&aConnMonEvent );
|
|
606 |
|
|
607 |
TConnMonSNAPInfo snaps = eventSNAP->SNAPAvailability();
|
|
608 |
UpdateSnapArray( snaps );
|
|
609 |
|
|
610 |
if ( iSNAPsAvailabilityObserver )
|
|
611 |
{
|
|
612 |
iConnChangeListenerTimer->Cancel();
|
|
613 |
iSNAPsAvailabilityObserver->SNAPsAvailabilityChanged( KErrNone );
|
|
614 |
}
|
|
615 |
}
|
|
616 |
break;
|
|
617 |
|
|
618 |
case EConnMonCreateConnection:
|
|
619 |
{
|
|
620 |
const CConnMonCreateConnection* eventCreate = NULL;
|
|
621 |
eventCreate = static_cast< const CConnMonCreateConnection* >(
|
|
622 |
&aConnMonEvent );
|
|
623 |
iUnsolvedConnIds.Append( eventCreate->ConnectionId() );
|
|
624 |
|
|
625 |
if ( !IsActive() )
|
|
626 |
{
|
|
627 |
GetIapId();
|
|
628 |
}
|
|
629 |
else
|
|
630 |
{
|
|
631 |
iPendingRequests.Append( EGetIAP );
|
|
632 |
}
|
|
633 |
}
|
|
634 |
break;
|
|
635 |
|
|
636 |
case EConnMonDeleteConnection:
|
|
637 |
{
|
|
638 |
const CConnMonDeleteConnection* eventDelete = NULL;
|
|
639 |
eventDelete = static_cast< const CConnMonDeleteConnection* >(
|
|
640 |
&aConnMonEvent );
|
|
641 |
TUint connId = eventDelete->ConnectionId();
|
|
642 |
|
|
643 |
RemoveIapId( connId );
|
|
644 |
}
|
|
645 |
break;
|
|
646 |
|
|
647 |
default:
|
|
648 |
break;
|
|
649 |
}
|
|
650 |
CCHLOGSTRING( "CCCHConnMonHandler::EventL: OUT" );
|
|
651 |
}
|
|
652 |
|
|
653 |
// ========================== OTHER EXPORTED FUNCTIONS =======================
|
|
654 |
|
|
655 |
// End of File
|