|
1 /* |
|
2 * Copyright (c) 2005-2009 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: Implementation for bearer WLAN. |
|
15 * |
|
16 */ |
|
17 |
|
18 #include "ConnMonBearerWLAN.h" |
|
19 #include "connmoncommsdatcache.h" |
|
20 #include "ConnMonIAP.h" |
|
21 #include "log.h" |
|
22 |
|
23 // --------------------------------------------------------------------------- |
|
24 // Construction |
|
25 // --------------------------------------------------------------------------- |
|
26 // |
|
27 TConnMonBearerWLAN::TConnMonBearerWLAN( |
|
28 CConnMonIAP* aConnMonIAP, |
|
29 CConnMonCommsDatCache* aCommsDatCache ) |
|
30 : |
|
31 TConnMonBearer( aConnMonIAP, aCommsDatCache ) |
|
32 { |
|
33 } |
|
34 |
|
35 // --------------------------------------------------------------------------- |
|
36 // Is bearer available |
|
37 // --------------------------------------------------------------------------- |
|
38 // |
|
39 TInt TConnMonBearerWLAN::GetAvailability( TBool& /*aAvailable*/ ) const |
|
40 { |
|
41 // Not defined or not needed |
|
42 return KErrNotSupported; |
|
43 } |
|
44 |
|
45 // --------------------------------------------------------------------------- |
|
46 // Bearer ID getter |
|
47 // --------------------------------------------------------------------------- |
|
48 // |
|
49 TUint TConnMonBearerWLAN::BearerId() const |
|
50 { |
|
51 return EBearerIdWLAN; |
|
52 } |
|
53 |
|
54 // --------------------------------------------------------------------------- |
|
55 // ETrue if bearer is valid (internal state is correct) |
|
56 // --------------------------------------------------------------------------- |
|
57 // |
|
58 TBool TConnMonBearerWLAN::Valid() const |
|
59 { |
|
60 return ETrue; |
|
61 } |
|
62 |
|
63 // --------------------------------------------------------------------------- |
|
64 // Sets available IAPs of this type as available in CommsDat cache |
|
65 // --------------------------------------------------------------------------- |
|
66 // |
|
67 void TConnMonBearerWLAN::FlagAvailableIaps() const |
|
68 { |
|
69 LOGENTRFN("TConnMonBearerWLAN::FlagAvailableIaps()") |
|
70 |
|
71 RArray<TUint> availableIdArray; |
|
72 RArray<TUint> activeIdArray; |
|
73 |
|
74 iConnMonIAP->GetActiveConnectionsIds( EBearerIdWLAN, activeIdArray ); |
|
75 |
|
76 if ( activeIdArray.Count() == 0 ) |
|
77 { |
|
78 iConnMonIAP->AppendAvailableWLANIaps( availableIdArray ); |
|
79 } |
|
80 else |
|
81 { |
|
82 LOGIT1("Found %d active WLAN IAPs", activeIdArray.Count()) |
|
83 |
|
84 // Policy based roaming. If current WLAN connection RSS (received |
|
85 // signal strength) is not strong enough, don't give any WLAN IAPs in |
|
86 // available state. |
|
87 if ( iConnMonIAP->WlanRssGoodEnough() ) |
|
88 { |
|
89 // KErrDisconnected will be returned if request for used SSID from WLAN engine fails. |
|
90 TInt err = iConnMonIAP->AppendAvailableWLANIapsBySsid( availableIdArray ); |
|
91 if ( err != KErrNone ) |
|
92 { |
|
93 availableIdArray.Reset(); |
|
94 if ( err == KErrDisconnected ) |
|
95 { |
|
96 activeIdArray.Reset(); // No longer connected. |
|
97 iConnMonIAP->AppendAvailableWLANIaps( availableIdArray ); |
|
98 } |
|
99 } |
|
100 } |
|
101 else |
|
102 { |
|
103 // Current WLAN RSS is too weak, don't report any WLAN IAPs available. |
|
104 availableIdArray.Reset(); |
|
105 activeIdArray.Reset(); |
|
106 } |
|
107 } |
|
108 |
|
109 for ( TInt i = 0; i < availableIdArray.Count(); i++ ) |
|
110 { |
|
111 iCommsDatCache->SetAvailableIapWithId( availableIdArray[i] ); |
|
112 } |
|
113 for ( TInt i = 0; i < activeIdArray.Count(); i++ ) |
|
114 { |
|
115 // This will only add EasyWLAN IAP ID as available in those cases when |
|
116 // the connection was started with it. This is done so there can't be a |
|
117 // situation when a connection is up but ConnMon reports that |
|
118 // connections IAP as unavailable. (EasyWLAN IAP has empty SSID field in |
|
119 // CommsDat, so AppendAvailableWLANIapsBySsid-method will not find it). |
|
120 iCommsDatCache->SetAvailableIapWithId( activeIdArray[i] ); |
|
121 } |
|
122 |
|
123 availableIdArray.Close(); |
|
124 activeIdArray.Close(); |
|
125 LOGEXITFN("TConnMonBearerWLAN::FlagAvailableIaps()") |
|
126 } |
|
127 |
|
128 // End-of-file |