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