18 |
18 |
19 // INCLUDE FILES |
19 // INCLUDE FILES |
20 #include <cmdestination.h> |
20 #include <cmdestination.h> |
21 #include <cmconnectionmethoddef.h> |
21 #include <cmconnectionmethoddef.h> |
22 #include <cmpluginwlandef.h> |
22 #include <cmpluginwlandef.h> |
|
23 #include <cmpluginvpndef.h> |
23 #include <centralrepository.h> |
24 #include <centralrepository.h> |
24 #include <commsdat.h> |
25 #include <commsdat.h> |
25 |
26 |
26 #include "cchcommdbwatcher.h" |
27 #include "cchcommdbwatcher.h" |
27 #include "cchcommdbwatcherobserver.h" |
28 #include "cchcommdbwatcherobserver.h" |
213 |
214 |
214 return iaps; |
215 return iaps; |
215 } |
216 } |
216 |
217 |
217 // --------------------------------------------------------------------------- |
218 // --------------------------------------------------------------------------- |
|
219 // CCCHCommsDbWatcher::IsVpnApL |
|
220 // |
|
221 // --------------------------------------------------------------------------- |
|
222 // |
|
223 TBool CCCHCommDbWatcher::IsVpnApL( |
|
224 TInt aIapId ) |
|
225 { |
|
226 CCHLOGSTRING( "CCCHCommDbWatcher::IsVpnApL: IN" ); |
|
227 TBool response( KPluginVPNBearerTypeUid == GetBearerL( aIapId ) ); |
|
228 CCHLOGSTRING3( "CCCHCommDbWatcher::IsVpnApL: iap id: %d is vpn ap: %d", |
|
229 aIapId, response ); |
|
230 return response; |
|
231 } |
|
232 |
|
233 // --------------------------------------------------------------------------- |
218 // CCCHCommsDbWatcher::IsWLANAPL |
234 // CCCHCommsDbWatcher::IsWLANAPL |
219 // |
235 // |
220 // --------------------------------------------------------------------------- |
236 // --------------------------------------------------------------------------- |
221 // |
237 // |
222 TBool CCCHCommDbWatcher::IsWlanApL( |
238 TBool CCCHCommDbWatcher::IsWlanApL( |
223 TInt aIapId ) |
239 TInt aIapId ) |
224 { |
240 { |
225 CCHLOGSTRING( "CCCHCommDbWatcher::IsWLANAPL: IN" ); |
241 CCHLOGSTRING( "CCCHCommDbWatcher::IsWLANAPL: IN" ); |
226 TBool ret( EFalse ); |
242 TBool response( KUidWlanBearerType == GetBearerL( aIapId ) ); |
227 TUint32 bearer( KErrNone ); |
243 |
228 |
244 CCHLOGSTRING3( "CCCHCommDbWatcher::IsWLANAPL: iap id: %d is wlan ap: %d", |
229 // Bearer Type |
245 aIapId, response ); |
230 bearer = CmManagerL().ConnectionMethodL( aIapId ).GetIntAttributeL( |
246 return response; |
|
247 } |
|
248 |
|
249 // --------------------------------------------------------------------------- |
|
250 // CCCHCommsDbWatcher::GetBearerL |
|
251 // |
|
252 // --------------------------------------------------------------------------- |
|
253 // |
|
254 TUint32 CCCHCommDbWatcher::GetBearerL( |
|
255 TInt aIapId ) |
|
256 { |
|
257 return CmManagerL().ConnectionMethodL( aIapId ).GetIntAttributeL( |
231 CMManager::ECmBearerType ); |
258 CMManager::ECmBearerType ); |
232 ret = KUidWlanBearerType == bearer; |
259 } |
233 |
260 |
234 CCHLOGSTRING3( "CCCHCommDbWatcher::IsWLANAPL: iap id: %d is wlan ap: %d", |
|
235 aIapId, ret ); |
|
236 return ret; |
|
237 } |
|
238 |
|
239 // --------------------------------------------------------------------------- |
261 // --------------------------------------------------------------------------- |
240 // CCCHCommsDbWatcher::RunL |
262 // CCCHCommsDbWatcher::RunL |
241 // |
263 // |
242 // --------------------------------------------------------------------------- |
264 // --------------------------------------------------------------------------- |
243 // |
265 // |
328 |
350 |
329 CleanupStack::PopAndDestroy( &cmMethods ); // CS:2 |
351 CleanupStack::PopAndDestroy( &cmMethods ); // CS:2 |
330 currentDestinations.Append( destinationlessIaps ); |
352 currentDestinations.Append( destinationlessIaps ); |
331 |
353 |
332 //Get count of iaps per destination |
354 //Get count of iaps per destination |
333 CCHLOGSTRING2( "CCCHCommDbWatcher::CheckIapsL: cmMethods count %d", |
|
334 destIdArray.Count() ) |
|
335 CmManagerL().AllDestinationsL( destIdArray ); |
355 CmManagerL().AllDestinationsL( destIdArray ); |
|
356 CCHLOGSTRING2( "CCCHCommDbWatcher::CheckIapsL: destination count %d", |
|
357 destIdArray.Count() ) |
336 for ( TInt i = 0; i < destIdArray.Count(); i++ ) |
358 for ( TInt i = 0; i < destIdArray.Count(); i++ ) |
337 { |
359 { |
338 RCmDestination destination = CmManagerL().DestinationL( destIdArray[ i ] ); |
360 RCmDestination destination = CmManagerL().DestinationL( destIdArray[ i ] ); |
339 CleanupClosePushL( destination ); // CS:3 |
361 CleanupClosePushL( destination ); // CS:3 |
340 TDestinationData destinationInfo( |
362 TDestinationData destinationInfo( |
510 { |
532 { |
511 iLastError = error; |
533 iLastError = error; |
512 } |
534 } |
513 } |
535 } |
514 |
536 |
|
537 // --------------------------------------------------------------------------- |
|
538 // CCCHCommsDbWatcher::RemoveOtherThanVpnIapsL |
|
539 // |
|
540 // --------------------------------------------------------------------------- |
|
541 // |
|
542 void CCCHCommDbWatcher::RemoveOtherThanVpnIapsL( |
|
543 RArray<TUint>& aIapIds, |
|
544 TUint aIAPId ) |
|
545 { |
|
546 CCHLOGSTRING2( "CCCHCommDbWatcher::RemoveOtherThanVpnIapsL; IAP ID: %d", aIAPId ); |
|
547 CCHLOGSTRING2( "CCCHCommDbWatcher::RemoveOtherThanVpnIapsL; IAPs count before: %d", aIapIds.Count() ); |
|
548 |
|
549 TUint32 iapId( KErrNone ); |
|
550 RArray<TUint> iaps; |
|
551 CleanupClosePushL( iaps ); |
|
552 RCmConnectionMethod cm = CmManagerL().ConnectionMethodL( aIAPId ); |
|
553 CleanupClosePushL( cm ); |
|
554 |
|
555 TUint32 realIap( cm.GetIntAttributeL( CMManager::ECmNextLayerIapId ) ); |
|
556 CCHLOGSTRING2( "CCCHCommDbWatcher::RemoveOtherThanVpnIapsL: real iap %d ", realIap ); |
|
557 TUint32 realSnap( cm.GetIntAttributeL( CMManager::ECmNextLayerSNAPId ) ); |
|
558 CCHLOGSTRING2( "CCCHCommDbWatcher::RemoveOtherThanVpnIapsL: real snap %d", realSnap ); |
|
559 |
|
560 if ( realIap ) |
|
561 { |
|
562 CCHLOGSTRING( "CCCHCommDbWatcher::RemoveOtherThanVpnIapsL: VPN linked to IAP" ); |
|
563 |
|
564 if ( KErrNotFound != aIapIds.Find( realIap ) ) |
|
565 { |
|
566 iaps.Append( realIap ); |
|
567 } |
|
568 } |
|
569 else |
|
570 { |
|
571 CCHLOGSTRING( "CCCHCommDbWatcher::RemoveOtherThanVpnIapsL: VPN linked to SNAP" ); |
|
572 |
|
573 RCmDestination realDestination = CmManagerL().DestinationL( realSnap ); |
|
574 CleanupClosePushL( realDestination ); |
|
575 |
|
576 for ( TInt i = 0; i < realDestination.ConnectionMethodCount(); i++ ) |
|
577 { |
|
578 RCmConnectionMethod realCm = realDestination.ConnectionMethodL( i ); |
|
579 CleanupClosePushL( realCm ); |
|
580 iapId = realCm.GetIntAttributeL( CMManager::ECmIapId ); |
|
581 |
|
582 if ( KErrNotFound != aIapIds.Find( iapId ) ) |
|
583 { |
|
584 iaps.Append( iapId ); |
|
585 } |
|
586 |
|
587 CleanupStack::PopAndDestroy( &realCm ); |
|
588 } |
|
589 |
|
590 CleanupStack::PopAndDestroy( &realDestination ); |
|
591 } |
|
592 |
|
593 aIapIds.Reset(); |
|
594 for ( TInt j( 0 ); j < iaps.Count(); j++ ) |
|
595 { |
|
596 aIapIds.Append( iaps[ j ] ); |
|
597 } |
|
598 |
|
599 CleanupStack::PopAndDestroy( &cm ); |
|
600 CleanupStack::PopAndDestroy( &iaps ); |
|
601 |
|
602 CCHLOGSTRING2( "CCCHCommDbWatcher::RemoveOtherThanVpnIapsL; IAPs count after: %d", aIapIds.Count() ); |
|
603 } |
|
604 |
515 // ========================== OTHER EXPORTED FUNCTIONS ======================= |
605 // ========================== OTHER EXPORTED FUNCTIONS ======================= |
516 |
606 |
517 // End of File |
607 // End of File |