80 TUint32& aIapId, |
80 TUint32& aIapId, |
81 const TDesC& aUid ) |
81 const TDesC& aUid ) |
82 { |
82 { |
83 DEBUG("CHssIapSettingsHandler::CreateClientIapL"); |
83 DEBUG("CHssIapSettingsHandler::CreateClientIapL"); |
84 |
84 |
85 RCmManagerExt cmManager; |
85 RCmManager cmManager; |
86 cmManager.OpenL(); |
86 cmManager.OpenL(); |
87 CleanupClosePushL( cmManager ); |
87 CleanupClosePushL( cmManager ); |
88 |
88 |
89 // Read all destination(SNAP) settings into an array |
89 // Read all destination(SNAP) settings into an array |
90 RArray<TUint32> destinations; |
90 RArray<TUint32> destinations; |
91 CleanupClosePushL( destinations ); |
91 CleanupClosePushL( destinations ); |
92 |
92 |
93 cmManager.AllDestinationsL( destinations ); |
93 cmManager.AllDestinationsL( destinations ); |
94 RCmDestinationExt destination; |
94 RCmDestination destination; |
95 // Loop through each destination |
95 // Loop through each destination |
96 for( TInt i = 0; i < destinations.Count(); i++ ) |
96 for( TInt i = 0; i < destinations.Count(); i++ ) |
97 { |
97 { |
98 destination = cmManager.DestinationL(destinations[i]); |
98 destination = cmManager.DestinationL(destinations[i]); |
99 CleanupClosePushL(destination); |
99 CleanupClosePushL(destination); |
100 // Internet destination will always exist in the system. |
100 // Internet destination will always exist in the system. |
101 // Internet destination will have ESnapPurposeInternet set in its metadata. |
101 // Internet destination will have ESnapPurposeInternet set in its metadata. |
102 if (destination.MetadataL(CMManager::ESnapMetadataPurpose) == CMManager::ESnapPurposeInternet) |
102 if (destination.MetadataL(CMManager::ESnapMetadataPurpose) == CMManager::ESnapPurposeInternet) |
103 { |
103 { |
104 RCmConnectionMethodExt plugin = cmManager.CreateConnectionMethodL( KUidWlanBearerType ); |
104 RCmConnectionMethod plugin = cmManager.CreateConnectionMethodL( KUidWlanBearerType ); |
105 CleanupClosePushL( plugin ); |
105 CleanupClosePushL( plugin ); |
106 |
106 |
107 plugin.SetStringAttributeL( ECmName, aIapName ); |
107 plugin.SetStringAttributeL( ECmName, aIapName ); |
108 plugin.SetStringAttributeL( EWlanSSID, aIapName ); |
108 plugin.SetStringAttributeL( EWlanSSID, aIapName ); |
109 plugin.SetStringAttributeL( EWlanServiceExtensionTableName, aUid ); |
109 plugin.SetStringAttributeL( EWlanServiceExtensionTableName, aUid ); |
123 |
123 |
124 DEBUG("CHssIapSettingsHandler::CreateClientIapL Done"); |
124 DEBUG("CHssIapSettingsHandler::CreateClientIapL Done"); |
125 } |
125 } |
126 |
126 |
127 // ----------------------------------------------------------------------------- |
127 // ----------------------------------------------------------------------------- |
128 // CreateIapL |
128 // DeleteIapL |
129 // ----------------------------------------------------------------------------- |
129 // ----------------------------------------------------------------------------- |
130 // |
130 // |
131 void CHssIapSettingsHandler::CreateIapL() |
131 void CHssIapSettingsHandler::DeleteIapL( const TUint aIapId ) |
132 { |
132 { |
133 DEBUG("CHssIapSettingsHandler::CreateIapL"); |
133 DEBUG1("CHssIapSettingsHandler:::DeleteIapL aIapId=%d ", aIapId); |
134 |
134 |
135 RCmManagerExt cmManager; |
135 RCmManager cmManager; |
136 cmManager.OpenL(); |
136 cmManager.OpenL(); |
137 CleanupClosePushL( cmManager ); |
137 CleanupClosePushL( cmManager ); |
138 |
138 |
139 // Read all destination(SNAP) settings into an array |
139 RCmConnectionMethod plugin = cmManager.ConnectionMethodL( aIapId ); |
140 RArray<TUint32> destinations; |
|
141 CleanupClosePushL( destinations ); |
|
142 |
|
143 cmManager.AllDestinationsL( destinations ); |
|
144 RCmDestinationExt destination; |
|
145 // Loop through each destination |
|
146 for( TInt i = 0; i < destinations.Count(); i++ ) |
|
147 { |
|
148 destination = cmManager.DestinationL( destinations[i] ); |
|
149 CleanupClosePushL( destination ); |
|
150 // Internet destination will always exist in the system. |
|
151 // Internet destination will have ESnapPurposeInternet |
|
152 // set in its metadata. |
|
153 if (destination.MetadataL( CMManager::ESnapMetadataPurpose ) == |
|
154 CMManager::ESnapPurposeInternet ) |
|
155 { |
|
156 CWlanMgmtClient* wlanMgmtClient = CWlanMgmtClient::NewL(); |
|
157 CleanupStack::PushL( wlanMgmtClient ); |
|
158 |
|
159 TWlanConnectionMode connMode; |
|
160 User::LeaveIfError( |
|
161 wlanMgmtClient->GetConnectionMode( connMode ) ); |
|
162 |
|
163 TWlanConnectionSecurityMode secMode; |
|
164 User::LeaveIfError( |
|
165 wlanMgmtClient->GetConnectionSecurityMode( secMode ) ); |
|
166 |
|
167 HBufC* ssid( NULL ); |
|
168 TWlanSsid ssidConn; |
|
169 |
|
170 User::LeaveIfError( |
|
171 wlanMgmtClient->GetConnectionSsid( ssidConn ) ); |
|
172 ssid = HBufC::NewLC( ssidConn.Length() ); |
|
173 ssid->Des().Copy( ssidConn ); |
|
174 |
|
175 TUint32 serviceId(0); |
|
176 TUint32 easyWlanIapId(0); |
|
177 easyWlanIapId = cmManager.EasyWlanIdL(); |
|
178 |
|
179 RCmConnectionMethodExt easyWlanPlugin; |
|
180 easyWlanPlugin = cmManager.ConnectionMethodL( easyWlanIapId ); |
|
181 CleanupClosePushL( easyWlanPlugin ); |
|
182 TBool scanSsid = easyWlanPlugin.GetBoolAttributeL( EWlanScanSSID ); |
|
183 TUint32 easyWlanServiceId = |
|
184 easyWlanPlugin.GetIntAttributeL( EWlanServiceId ); |
|
185 CleanupStack::PopAndDestroy(); // easyWlanPlugin; |
|
186 |
|
187 RCmConnectionMethodExt plugin = |
|
188 cmManager.CreateConnectionMethodL( KUidWlanBearerType ); |
|
189 CleanupClosePushL( plugin ); |
|
190 plugin.SetStringAttributeL( ECmName, *ssid ); |
|
191 plugin.SetStringAttributeL( EWlanSSID, *ssid ); |
|
192 plugin.SetIntAttributeL( CMManager::EWlanSecurityMode, |
|
193 ConvertConnectionSecurityModeToSecModeL( secMode )); |
|
194 plugin.SetIntAttributeL( EWlanConnectionMode, |
|
195 ConvertConnectionModeToNetModeL( connMode ) ); |
|
196 plugin.SetBoolAttributeL( EWlanScanSSID, scanSsid ); |
|
197 destination.AddConnectionMethodL( plugin ); |
|
198 destination.UpdateL(); |
|
199 serviceId = plugin.GetIntAttributeL( EWlanServiceId ); |
|
200 |
|
201 CleanupStack::PopAndDestroy( &plugin ); |
|
202 if ( secMode == EWlanConnectionSecurityWep ) |
|
203 { |
|
204 SaveWEPKeyL( easyWlanServiceId, serviceId ); |
|
205 } |
|
206 |
|
207 if ( secMode == EWlanConnectionSecurityWpaPsk ) |
|
208 { |
|
209 SaveWPAKeyL( easyWlanServiceId, serviceId ); |
|
210 } |
|
211 |
|
212 CleanupStack::PopAndDestroy( ssid ); |
|
213 CleanupStack::PopAndDestroy( wlanMgmtClient ); |
|
214 } |
|
215 CleanupStack::PopAndDestroy( &destination ); |
|
216 } |
|
217 CleanupStack::PopAndDestroy( &destinations ); |
|
218 CleanupStack::PopAndDestroy( &cmManager ); |
|
219 |
|
220 DEBUG("CHssIapSettingsHandler::CreateIapL Done"); |
|
221 } |
|
222 |
|
223 // ----------------------------------------------------------------------------- |
|
224 // DeleteIapL |
|
225 // ----------------------------------------------------------------------------- |
|
226 // |
|
227 void CHssIapSettingsHandler::DeleteIapL( const TUint aIapId ) |
|
228 { |
|
229 DEBUG1("CHssIapSettingsHandler:::DeleteIapL aIapId=%d ", aIapId); |
|
230 |
|
231 RCmManagerExt cmManager; |
|
232 cmManager.OpenL(); |
|
233 CleanupClosePushL( cmManager ); |
|
234 |
|
235 RCmConnectionMethodExt plugin = cmManager.ConnectionMethodL( aIapId ); |
|
236 CleanupClosePushL( plugin ); |
140 CleanupClosePushL( plugin ); |
237 |
141 |
238 cmManager.RemoveAllReferencesL( plugin ); |
142 cmManager.RemoveAllReferencesL( plugin ); |
239 TBool result = plugin.DeleteL(); |
143 TBool result = plugin.DeleteL(); |
240 |
144 |