101 |
103 |
102 // Destructor |
104 // Destructor |
103 CCCHConnMonHandler::~CCCHConnMonHandler() |
105 CCCHConnMonHandler::~CCCHConnMonHandler() |
104 { |
106 { |
105 CCHLOGSTRING( "CCCHConnMonHandler::~CCCHConnMonHandler" ); |
107 CCHLOGSTRING( "CCCHConnMonHandler::~CCCHConnMonHandler" ); |
106 |
108 iConnChangeListenerTimer->Cancel(); |
|
109 delete iConnChangeListenerTimer; |
107 StopNotify(); |
110 StopNotify(); |
108 Cancel(); |
111 Cancel(); |
|
112 iPendingRequests.Close(); |
|
113 iUnsolvedConnIds.Close(); |
|
114 iConnIapIds.Close(); |
109 iAvailableSNAPs.Close(); |
115 iAvailableSNAPs.Close(); |
110 iAvailableIAPs.Close(); |
116 iAvailableIAPs.Close(); |
111 iConnMon.Close(); |
117 iConnMon.Close(); |
112 } |
118 } |
113 |
119 |
114 // --------------------------------------------------------------------------- |
120 // --------------------------------------------------------------------------- |
115 // CCCHConnMonHandler::ScanNetworks |
121 // CCCHConnMonHandler::ScanNetworks |
116 // (other items were commented in a header). |
122 // (other items were commented in a header). |
117 // --------------------------------------------------------------------------- |
123 // --------------------------------------------------------------------------- |
118 // |
124 // |
119 void CCCHConnMonHandler::ScanNetworks( TBool aWlanScan ) |
125 void CCCHConnMonHandler::ScanNetworks( |
|
126 TBool aWlanScan, MCCHConnMonHandlerNotifier* aObserver ) |
120 { |
127 { |
121 CCHLOGSTRING( "CCCHConnMonHandler::ScanNetworks: IN" ); |
128 CCHLOGSTRING( "CCCHConnMonHandler::ScanNetworks: IN" ); |
122 |
129 |
123 if ( aWlanScan ) |
130 if ( aWlanScan ) |
124 { |
131 { |
|
132 iNetworkScanningObserver = aObserver; |
125 GetIaps( EBearerIdAll ); |
133 GetIaps( EBearerIdAll ); |
126 } |
134 } |
127 |
135 |
128 CCHLOGSTRING( "CCCHConnMonHandler::ScanNetworks: OUT" ); |
136 CCHLOGSTRING( "CCCHConnMonHandler::ScanNetworks: OUT" ); |
129 } |
137 } |
156 // |
164 // |
157 TBool CCCHConnMonHandler::IsIapAvailable( TUint aIapId ) const |
165 TBool CCCHConnMonHandler::IsIapAvailable( TUint aIapId ) const |
158 { |
166 { |
159 return ( KErrNotFound == iAvailableIAPs.Find( aIapId ) ) |
167 return ( KErrNotFound == iAvailableIAPs.Find( aIapId ) ) |
160 ? EFalse : ETrue; |
168 ? EFalse : ETrue; |
|
169 } |
|
170 |
|
171 // --------------------------------------------------------------------------- |
|
172 // CCCHConnMonHandler::SetSNAPsAvailabilityChangeListener |
|
173 // (other items were commented in a header). |
|
174 // --------------------------------------------------------------------------- |
|
175 // |
|
176 void CCCHConnMonHandler::SetSNAPsAvailabilityChangeListener( |
|
177 MCCHConnMonHandlerNotifier* aObserver ) |
|
178 { |
|
179 CCHLOGSTRING( "CCCHConnMonHandler::SetSNAPsAvailabilityChangeListener" ); |
|
180 iSNAPsAvailabilityObserver = aObserver; |
|
181 if ( iSNAPsAvailabilityObserver ) |
|
182 { |
|
183 iConnChangeListenerTimer->Start( |
|
184 KPeriodicTimerInterval, |
|
185 KPeriodicTimerInterval, |
|
186 TCallBack( PeriodicTimerCallBack, this ) ); |
|
187 } |
161 } |
188 } |
162 |
189 |
163 // --------------------------------------------------------------------------- |
190 // --------------------------------------------------------------------------- |
164 // CCCHConnMonHandler::GetIaps |
191 // CCCHConnMonHandler::GetIaps |
165 // (other items were commented in a header). |
192 // (other items were commented in a header). |
276 void CCCHConnMonHandler::StopNotify() |
303 void CCCHConnMonHandler::StopNotify() |
277 { |
304 { |
278 iConnMon.CancelNotifications(); |
305 iConnMon.CancelNotifications(); |
279 } |
306 } |
280 |
307 |
|
308 // ---------------------------------------------------------------------------- |
|
309 // CCCHConnMonHandler::PeriodicTimerCallBack |
|
310 // The call back function. |
|
311 // ---------------------------------------------------------------------------- |
|
312 // |
|
313 TInt CCCHConnMonHandler::PeriodicTimerCallBack( TAny* aAny ) |
|
314 { |
|
315 CCHLOGSTRING( "CCCHConnMonHandler::PeriodicTimerCallBack" ); |
|
316 |
|
317 CCCHConnMonHandler* self = static_cast<CCCHConnMonHandler*>( aAny ); |
|
318 self->iConnChangeListenerTimer->Cancel(); |
|
319 |
|
320 if ( self->iSNAPsAvailabilityObserver ) |
|
321 { |
|
322 self->iSNAPsAvailabilityObserver-> |
|
323 SNAPsAvailabilityChanged( KErrTimedOut ); |
|
324 } |
|
325 |
|
326 return KErrNone; |
|
327 } |
|
328 |
281 // --------------------------------------------------------------------------- |
329 // --------------------------------------------------------------------------- |
282 // CCCHConnMonHandler::RunL |
330 // CCCHConnMonHandler::RunL |
283 // (other items were commented in a header). |
331 // (other items were commented in a header). |
284 // --------------------------------------------------------------------------- |
332 // --------------------------------------------------------------------------- |
285 // |
333 // |
294 case EGetIAPS: |
342 case EGetIAPS: |
295 { |
343 { |
296 UpdateIapArray( iIapsBuf() ); |
344 UpdateIapArray( iIapsBuf() ); |
297 GetSNAPs(); |
345 GetSNAPs(); |
298 } |
346 } |
299 break; |
347 break; |
|
348 |
300 case EGetSNAPs: |
349 case EGetSNAPs: |
301 { |
350 { |
302 UpdateSnapArray( iSNAPbuf() ); |
351 UpdateSnapArray( iSNAPbuf() ); |
303 } |
352 if ( iNetworkScanningObserver ) |
304 break; |
353 { |
|
354 iNetworkScanningObserver->NetworkScanningCompletedL( |
|
355 iSNAPbuf(), KErrNone ); |
|
356 iNetworkScanningObserver = NULL; |
|
357 } |
|
358 } |
|
359 break; |
|
360 |
|
361 case EGetIAP: |
|
362 { |
|
363 CCHLOGSTRING2( "CCCHConnMonHandler::RunL: iap: %d", iConnIapId ); |
|
364 TCCHConnectionInfo info; |
|
365 info.iIapId = iConnIapId; |
|
366 info.iConnId = iConnId; |
|
367 |
|
368 if ( KErrNotFound == iConnIapIds.Find( info ) ) |
|
369 { |
|
370 iConnIapIds.Append( info ); |
|
371 } |
|
372 iConnId = 0; |
|
373 iConnIapId = 0; |
|
374 |
|
375 CCHLOGSTRING2( "CCCHConnMonHandler::RunL: unsolved conn count: %d", iUnsolvedConnIds.Count() ); |
|
376 if ( iUnsolvedConnIds.Count() ) |
|
377 { |
|
378 GetIapId(); |
|
379 } |
|
380 } |
|
381 break; |
|
382 |
|
383 case EGetConnectionCount: |
|
384 { |
|
385 CCHLOGSTRING2( "CCCHConnMonHandler::RunL: conn count: %d", iConnCount ); |
|
386 TBool familiar( EFalse ); |
|
387 TUint connId( KErrNone ); |
|
388 TUint subConnCount( KErrNone ); |
|
389 for ( TInt i( 1 ); i <= iConnCount; i++ ) |
|
390 { |
|
391 if ( !iConnMon.GetConnectionInfo( i, connId, subConnCount ) ) |
|
392 { |
|
393 familiar = EFalse; |
|
394 for ( TInt j( 0 ); j < iConnIapIds.Count(); j++ ) |
|
395 { |
|
396 if ( connId == iConnIapIds[ j ].iConnId ) |
|
397 { |
|
398 CCHLOGSTRING2( "CCCHConnMonHandler::RunL: iap %d is familiar connection", iConnIapIds[ j ].iIapId ); |
|
399 familiar = ETrue; |
|
400 break; |
|
401 } |
|
402 } |
|
403 |
|
404 if ( !familiar && KErrNotFound == iUnsolvedConnIds.Find( connId ) ) |
|
405 { |
|
406 iUnsolvedConnIds.Append( connId ); |
|
407 } |
|
408 } |
|
409 } |
|
410 iConnCount = 0; |
|
411 |
|
412 CCHLOGSTRING2( "CCCHConnMonHandler::RunL: unsolved conn count: %d", iUnsolvedConnIds.Count() ); |
|
413 if ( iUnsolvedConnIds.Count() ) |
|
414 { |
|
415 GetIapId(); |
|
416 } |
|
417 } |
|
418 break; |
|
419 |
305 default: |
420 default: |
306 break; |
421 break; |
307 } |
422 } |
|
423 |
|
424 |
|
425 if ( iPendingRequests.Count() && !IsActive() ) |
|
426 { |
|
427 CCHLOGSTRING2( "CCCHConnMonHandler::RunL: request pending : %d", |
|
428 iPendingRequests[ 0 ] ); |
|
429 switch ( iPendingRequests[ 0 ] ) |
|
430 { |
|
431 case EGetIAP: |
|
432 { |
|
433 GetIapId(); |
|
434 } |
|
435 break; |
|
436 |
|
437 case EGetConnectionCount: |
|
438 { |
|
439 GetConnectionCount(); |
|
440 } |
|
441 break; |
|
442 |
|
443 default: |
|
444 break; |
|
445 } |
|
446 |
|
447 iPendingRequests.Remove( 0 ); |
|
448 iPendingRequests.Compress(); |
|
449 } |
|
450 } |
|
451 else |
|
452 { |
|
453 if ( iNetworkScanningObserver ) |
|
454 { |
|
455 iNetworkScanningObserver->NetworkScanningCompletedL( |
|
456 iSNAPbuf(), iStatus.Int() ); |
|
457 iNetworkScanningObserver = NULL; |
|
458 } |
308 } |
459 } |
309 |
460 |
310 CCHLOGSTRING( "CCCHConnMonHandler::RunL: OUT" ); |
461 CCHLOGSTRING( "CCCHConnMonHandler::RunL: OUT" ); |
311 } |
462 } |
312 |
463 |
313 // --------------------------------------------------------------------------- |
464 // --------------------------------------------------------------------------- |
|
465 // CCCHConnMonHandler::StartMonitoringConnectionChanges |
|
466 // (other items were commented in a header). |
|
467 // --------------------------------------------------------------------------- |
|
468 // |
|
469 void CCCHConnMonHandler::StartMonitoringConnectionChanges() |
|
470 { |
|
471 iConnIapIds.Reset(); |
|
472 |
|
473 if ( !IsActive() ) |
|
474 { |
|
475 GetConnectionCount(); |
|
476 } |
|
477 else |
|
478 { |
|
479 iPendingRequests.Append( EGetConnectionCount ); |
|
480 } |
|
481 } |
|
482 |
|
483 // --------------------------------------------------------------------------- |
|
484 // CCCHConnMonHandler::StopMonitoringConnectionChanges |
|
485 // (other items were commented in a header). |
|
486 // --------------------------------------------------------------------------- |
|
487 // |
|
488 void CCCHConnMonHandler::StopMonitoringConnectionChanges( |
|
489 RArray<TUint>& aIapIds ) |
|
490 { |
|
491 aIapIds.Reset(); |
|
492 for ( TInt i( 0 ); i < iConnIapIds.Count(); i++ ) |
|
493 { |
|
494 if ( KErrNotFound == aIapIds.Find( iConnIapIds[ i ].iIapId ) ) |
|
495 { |
|
496 aIapIds.Append( iConnIapIds[ i ].iIapId ); |
|
497 } |
|
498 } |
|
499 } |
|
500 |
|
501 // --------------------------------------------------------------------------- |
|
502 // CCCHConnMonHandler::GetConnectionCount |
|
503 // (other items were commented in a header). |
|
504 // --------------------------------------------------------------------------- |
|
505 // |
|
506 void CCCHConnMonHandler::GetConnectionCount() |
|
507 { |
|
508 iState = EGetConnectionCount; |
|
509 iConnMon.GetConnectionCount( iConnCount, iStatus ); |
|
510 SetActive(); |
|
511 } |
|
512 |
|
513 // --------------------------------------------------------------------------- |
|
514 // CCCHConnMonHandler::GetIapId |
|
515 // (other items were commented in a header). |
|
516 // --------------------------------------------------------------------------- |
|
517 // |
|
518 void CCCHConnMonHandler::GetIapId() |
|
519 { |
|
520 if ( iUnsolvedConnIds.Count() ) |
|
521 { |
|
522 iConnId = iUnsolvedConnIds[ 0 ]; |
|
523 iUnsolvedConnIds.Remove( 0 ); |
|
524 iUnsolvedConnIds.Compress(); |
|
525 |
|
526 iState = EGetIAP; |
|
527 iConnMon.GetUintAttribute( iConnId, 0, KIAPId, iConnIapId, iStatus ); |
|
528 SetActive(); |
|
529 } |
|
530 } |
|
531 |
|
532 // --------------------------------------------------------------------------- |
|
533 // CCCHConnMonHandler::RemoveIapId |
|
534 // (other items were commented in a header). |
|
535 // --------------------------------------------------------------------------- |
|
536 // |
|
537 void CCCHConnMonHandler::RemoveIapId( |
|
538 TUint aConnId ) |
|
539 { |
|
540 for ( TInt i( 0 ); i < iConnIapIds.Count(); i++ ) |
|
541 { |
|
542 if ( aConnId == iConnIapIds[ i ].iConnId ) |
|
543 { |
|
544 iConnIapIds.Remove( i ); |
|
545 iConnIapIds.Compress(); |
|
546 break; |
|
547 } |
|
548 } |
|
549 } |
|
550 |
|
551 // --------------------------------------------------------------------------- |
314 // CCCHConnMonHandler::DoCancel |
552 // CCCHConnMonHandler::DoCancel |
315 // (other items were commented in a header). |
553 // (other items were commented in a header). |
316 // --------------------------------------------------------------------------- |
554 // --------------------------------------------------------------------------- |
317 // |
555 // |
318 void CCCHConnMonHandler::DoCancel() |
556 void CCCHConnMonHandler::DoCancel() |
319 { |
557 { |
320 iConnMon.CancelAsyncRequest( EConnMonGetPckgAttribute ); |
558 iConnMon.CancelAsyncRequest( EConnMonGetPckgAttribute ); |
|
559 if ( iNetworkScanningObserver ) |
|
560 { |
|
561 iNetworkScanningObserver->NetworkScanningCompletedL( |
|
562 iSNAPbuf(), KErrCancel ); |
|
563 iNetworkScanningObserver = NULL; |
|
564 } |
|
565 if ( iSNAPsAvailabilityObserver ) |
|
566 { |
|
567 iSNAPsAvailabilityObserver->SNAPsAvailabilityChanged( KErrCancel ); |
|
568 iSNAPsAvailabilityObserver = NULL; |
|
569 } |
321 } |
570 } |
322 |
571 |
323 // --------------------------------------------------------------------------- |
572 // --------------------------------------------------------------------------- |
324 // CCCHConnMonHandler::EventL |
573 // CCCHConnMonHandler::EventL |
325 // (other items were commented in a header). |
574 // (other items were commented in a header). |