35 #include "eap_type_aka.h" |
35 #include "eap_type_aka.h" |
36 #include "EapAkaGlobal.h" |
36 #include "EapAkaGlobal.h" |
37 #include <EapTypeInfo.h> |
37 #include <EapTypeInfo.h> |
38 #include "eap_am_type_aka_symbian.h" |
38 #include "eap_am_type_aka_symbian.h" |
39 #include "EapAkaDbUtils.h" |
39 #include "EapAkaDbUtils.h" |
40 |
40 #include "EapConversion.h" |
41 #include <EapAkaUiConnection.h> |
|
42 #include "EapAkaUi.h" |
|
43 |
|
44 |
41 |
45 #include "eap_am_tools_symbian.h" |
42 #include "eap_am_tools_symbian.h" |
|
43 #include "EapTraceSymbian.h" |
|
44 |
46 |
45 |
47 // LOCAL CONSTANTS |
46 // LOCAL CONSTANTS |
48 |
47 |
49 // The version number of this interface. |
48 // The version number of this interface. |
50 const TUint KInterfaceVersion = 1; |
49 const TUint KInterfaceVersion = 1; |
136 } |
135 } |
137 return type; |
136 return type; |
138 } |
137 } |
139 |
138 |
140 // ---------------------------------------------------------- |
139 // ---------------------------------------------------------- |
141 TInt CEapAka::InvokeUiL() |
140 |
142 { |
141 CEapTypeInfo* CEapAka::GetInfoL() |
143 TInt buttonId(0); |
|
144 |
|
145 #ifdef USE_EAP_EXPANDED_TYPES |
|
146 |
|
147 CEapAkaUiConnection uiConn(iIndexType, iIndex, iTunnelingType.get_vendor_type()); |
|
148 |
|
149 #else |
|
150 |
|
151 CEapAkaUiConnection uiConn(iIndexType, iIndex, iTunnelingType); |
|
152 |
|
153 #endif //#ifdef USE_EAP_EXPANDED_TYPES |
|
154 |
|
155 CEapAkaUi* ui = CEapAkaUi::NewL(&uiConn); |
|
156 CleanupStack::PushL(ui); |
|
157 buttonId = ui->InvokeUiL(); |
|
158 CleanupStack::PopAndDestroy(ui); |
|
159 return buttonId; |
|
160 } |
|
161 |
|
162 // ---------------------------------------------------------- |
|
163 CEapTypeInfo* CEapAka::GetInfoLC() |
|
164 { |
142 { |
165 CEapTypeInfo* info = new(ELeave) CEapTypeInfo( |
143 CEapTypeInfo* info = new(ELeave) CEapTypeInfo( |
166 (TDesC&)KReleaseDate, |
144 (TDesC&)KReleaseDate, |
167 (TDesC&)KEapTypeVersion, |
145 (TDesC&)KEapTypeVersion, |
168 (TDesC&)KManufacturer); |
146 (TDesC&)KManufacturer); |
169 |
147 |
170 CleanupStack::PushL(info); |
|
171 return info; |
148 return info; |
172 } |
149 } |
173 |
150 |
174 // ---------------------------------------------------------- |
151 // ---------------------------------------------------------- |
|
152 |
175 void CEapAka::DeleteConfigurationL() |
153 void CEapAka::DeleteConfigurationL() |
176 { |
154 { |
177 EapAkaDbUtils::DeleteConfigurationL(iIndexType, iIndex, iTunnelingType); |
155 EapAkaDbUtils::DeleteConfigurationL(iIndexType, iIndex, iTunnelingType); |
178 } |
156 } |
179 |
157 |
184 return KInterfaceVersion; |
162 return KInterfaceVersion; |
185 } |
163 } |
186 |
164 |
187 // ---------------------------------------------------------- |
165 // ---------------------------------------------------------- |
188 |
166 |
189 void CEapAka::SetTunnelingType(const TInt aTunnelingType) |
167 void CEapAka::SetTunnelingType(const TEapExpandedType aTunnelingType) |
190 { |
168 { |
191 #ifdef USE_EAP_EXPANDED_TYPES |
169 EAP_TRACE_DATA_DEBUG_SYMBIAN( |
192 |
170 (EAPL("CEapAka::SetTunnelingType - tunneling type"), |
193 // Vendor id is eap_type_vendor_id_ietf always in this plugin. |
171 aTunnelingType.GetValue().Ptr(), aTunnelingType.GetValue().Length())); |
194 iTunnelingType.set_eap_type_values(eap_type_vendor_id_ietf, aTunnelingType); |
172 |
195 |
173 eap_type_value_e aInternalType; |
196 #else |
174 |
197 |
175 TInt err = CEapConversion::ConvertExpandedEAPTypeToInternalType( |
198 iTunnelingType = static_cast<eap_type_value_e>(aTunnelingType); |
176 &aTunnelingType, |
199 |
177 &aInternalType); |
200 #endif //#ifdef USE_EAP_EXPANDED_TYPES |
178 |
201 } |
179 iTunnelingType = aInternalType; |
|
180 |
|
181 |
|
182 } |
202 |
183 |
203 |
184 |
204 // ---------------------------------------------------------- |
185 // ---------------------------------------------------------- |
205 void CEapAka::SetIndexL( |
186 void CEapAka::SetIndexL( |
206 const TIndexType aIndexType, |
187 const TIndexType aIndexType, |
221 iIndexType = tmpIndexType; |
202 iIndexType = tmpIndexType; |
222 iIndex = tmpIndex; |
203 iIndex = tmpIndex; |
223 |
204 |
224 RDbNamedDatabase db; |
205 RDbNamedDatabase db; |
225 |
206 |
226 RDbs session; |
207 RFs session; |
227 |
|
228 EapAkaDbUtils::OpenDatabaseL(db, session, iIndexType, iIndex, iTunnelingType); |
|
229 |
208 |
230 CleanupClosePushL(session); |
209 CleanupClosePushL(session); |
231 CleanupClosePushL(db); |
210 CleanupClosePushL(db); |
232 |
211 TInt error = session.Connect(); |
|
212 EAP_TRACE_DEBUG_SYMBIAN((_L("CEapAka::SetIndexL(): - session.Connect(), error=%d\n"), error)); |
|
213 User::LeaveIfError(error); |
|
214 |
|
215 EapAkaDbUtils::OpenDatabaseL(db, session, iIndexType, iIndex, iTunnelingType); |
|
216 |
233 EapAkaDbUtils::SetIndexL( |
217 EapAkaDbUtils::SetIndexL( |
234 db, |
218 db, |
235 iIndexType, |
219 iIndexType, |
236 iIndex, |
220 iIndex, |
237 iTunnelingType, |
221 iTunnelingType, |
240 iTunnelingType); |
224 iTunnelingType); |
241 |
225 |
242 iIndexType = aIndexType; |
226 iIndexType = aIndexType; |
243 iIndex = aIndex; |
227 iIndex = aIndex; |
244 |
228 |
245 CleanupStack::PopAndDestroy(2); // db |
229 db.Close(); |
|
230 session.Close(); |
|
231 |
|
232 CleanupStack::PopAndDestroy(&db); |
|
233 CleanupStack::PopAndDestroy(&session); |
246 } |
234 } |
247 |
235 |
248 // ---------------------------------------------------------- |
236 // ---------------------------------------------------------- |
249 |
237 |
250 void CEapAka::SetConfigurationL(const EAPSettings& aSettings) |
238 void CEapAka::SetConfigurationL(const EAPSettings& aSettings) |
251 { |
239 { |
252 RDbNamedDatabase db; |
240 RDbNamedDatabase db; |
253 |
241 |
254 RDbs session; |
242 RFs session; |
255 |
243 |
|
244 CleanupClosePushL(session); |
|
245 CleanupClosePushL(db); |
|
246 TInt error = session.Connect(); |
|
247 EAP_TRACE_DEBUG_SYMBIAN((_L("CEapAka::SetConfigurationL(): - session.Connect(), error=%d\n"), error)); |
|
248 User::LeaveIfError(error); |
|
249 |
256 // This also creates the IAP entry if it doesn't exist |
250 // This also creates the IAP entry if it doesn't exist |
257 EapAkaDbUtils::OpenDatabaseL(db, session, iIndexType, iIndex, iTunnelingType); |
251 EapAkaDbUtils::OpenDatabaseL(db, session, iIndexType, iIndex, iTunnelingType); |
258 |
252 |
259 CleanupClosePushL(session); |
|
260 CleanupClosePushL(db); |
|
261 |
|
262 EapAkaDbUtils::SetConfigurationL( |
253 EapAkaDbUtils::SetConfigurationL( |
263 db, |
254 db, |
264 aSettings, |
255 aSettings, |
265 iIndexType, |
256 iIndexType, |
266 iIndex, |
257 iIndex, |
267 iTunnelingType); |
258 iTunnelingType); |
268 |
259 |
269 CleanupStack::PopAndDestroy(2); // db, session |
260 db.Close(); |
|
261 session.Close(); |
|
262 |
|
263 CleanupStack::PopAndDestroy(&db); |
|
264 CleanupStack::PopAndDestroy(&session); |
270 } |
265 } |
271 |
266 |
272 // ---------------------------------------------------------- |
267 // ---------------------------------------------------------- |
273 |
268 |
274 void CEapAka::GetConfigurationL(EAPSettings& aSettings) |
269 void CEapAka::GetConfigurationL(EAPSettings& aSettings) |
275 { |
270 { |
276 RDbNamedDatabase db; |
271 RDbNamedDatabase db; |
277 |
272 |
278 RDbs session; |
273 RFs session; |
279 |
274 |
|
275 CleanupClosePushL(session); |
|
276 CleanupClosePushL(db); |
|
277 TInt error = session.Connect(); |
|
278 EAP_TRACE_DEBUG_SYMBIAN((_L("CEapAka::SetConfigurationL(): - session.Connect(), error=%d\n"), error)); |
|
279 User::LeaveIfError(error); |
|
280 |
280 // This also creates the IAP entry if it doesn't exist |
281 // This also creates the IAP entry if it doesn't exist |
281 EapAkaDbUtils::OpenDatabaseL(db, session, iIndexType, iIndex, iTunnelingType); |
282 EapAkaDbUtils::OpenDatabaseL(db, session, iIndexType, iIndex, iTunnelingType); |
282 |
|
283 CleanupClosePushL(session); |
|
284 CleanupClosePushL(db); |
|
285 |
283 |
286 EapAkaDbUtils::GetConfigurationL( |
284 EapAkaDbUtils::GetConfigurationL( |
287 db, |
285 db, |
288 aSettings, |
286 aSettings, |
289 iIndexType, |
287 iIndexType, |
290 iIndex, |
288 iIndex, |
291 iTunnelingType); |
289 iTunnelingType); |
292 |
290 |
293 CleanupStack::PopAndDestroy(2); // db, session |
291 db.Close(); |
|
292 session.Close(); |
|
293 |
|
294 CleanupStack::PopAndDestroy(&db); |
|
295 CleanupStack::PopAndDestroy(&session); |
294 } |
296 } |
295 |
297 |
296 // ---------------------------------------------------------- |
298 // ---------------------------------------------------------- |
297 |
299 |
298 void CEapAka::CopySettingsL( |
300 void CEapAka::CopySettingsL( |
314 iIndexType = tmpIndexType; |
316 iIndexType = tmpIndexType; |
315 iIndex = tmpIndex; |
317 iIndex = tmpIndex; |
316 |
318 |
317 RDbNamedDatabase db; |
319 RDbNamedDatabase db; |
318 |
320 |
319 RDbs session; |
321 RFs session; |
320 |
322 |
321 EapAkaDbUtils::OpenDatabaseL(db, session, iIndexType, iIndex, iTunnelingType); |
|
322 |
|
323 CleanupClosePushL(session); |
323 CleanupClosePushL(session); |
324 CleanupClosePushL(db); |
324 CleanupClosePushL(db); |
325 |
325 TInt error = session.Connect(); |
|
326 EAP_TRACE_DEBUG_SYMBIAN((_L("CEapAka::CopySettingsL(): - session.Connect(), error=%d\n"), error)); |
|
327 User::LeaveIfError(error); |
|
328 |
|
329 EapAkaDbUtils::OpenDatabaseL(db, session, iIndexType, iIndex, iTunnelingType); |
|
330 |
326 EapAkaDbUtils::CopySettingsL( |
331 EapAkaDbUtils::CopySettingsL( |
327 db, |
332 db, |
328 iIndexType, |
333 iIndexType, |
329 iIndex, |
334 iIndex, |
330 iTunnelingType, |
335 iTunnelingType, |
331 aDestinationIndexType, |
336 aDestinationIndexType, |
332 aDestinationIndex, |
337 aDestinationIndex, |
333 iTunnelingType); |
338 iTunnelingType); |
334 |
339 |
335 CleanupStack::PopAndDestroy(2); // db |
340 db.Close(); |
336 |
341 session.Close(); |
337 } |
342 |
|
343 CleanupStack::PopAndDestroy(&db); |
|
344 CleanupStack::PopAndDestroy(&session); |
|
345 } |
|
346 |
338 // End of file |
347 // End of file |