83 EAP_TRACE_DEBUG(m_am_tools, TRACE_FLAGS_DEFAULT, (EAPL("CEapSimIsaInterface::~CEapSimIsaInterface()\n"))); |
83 EAP_TRACE_DEBUG(m_am_tools, TRACE_FLAGS_DEFAULT, (EAPL("CEapSimIsaInterface::~CEapSimIsaInterface()\n"))); |
84 EAP_TRACE_RETURN_STRING(m_am_tools, "returns: CEapSimIsaInterface::~CEapSimIsaInterface()"); |
84 EAP_TRACE_RETURN_STRING(m_am_tools, "returns: CEapSimIsaInterface::~CEapSimIsaInterface()"); |
85 |
85 |
86 if(IsActive()) |
86 if(IsActive()) |
87 { |
87 { |
88 Cancel(); |
88 Cancel(); |
89 } |
89 } |
90 |
90 |
91 DisconnectMMETel(); |
91 EAP_TRACE_DEBUG(m_am_tools, TRACE_FLAGS_DEFAULT, (EAPL("Closing RMobilePhone and MMETEL.\n"))); |
92 |
92 |
|
93 iPhone.Close(); |
|
94 iServer.Close(); // Phone module is unloaded automatically when RTelServer session is closed |
|
95 iCustomAPI.Close(); |
|
96 |
93 delete iAuthenticationData; |
97 delete iAuthenticationData; |
94 iAuthenticationData = NULL; |
98 iAuthenticationData = NULL; |
95 |
99 |
96 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
100 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
97 } |
101 } |
163 |
167 |
164 //-------------------------------------------------- |
168 //-------------------------------------------------- |
165 |
169 |
166 void CEapSimIsaInterface::DoCancel() |
170 void CEapSimIsaInterface::DoCancel() |
167 { |
171 { |
168 EAP_TRACE_DEBUG(m_am_tools, TRACE_FLAGS_DEFAULT, (EAPL("CEapSimIsaInterface::DoCancel(): iQueryId=%d\n"), |
172 EAP_TRACE_DEBUG(m_am_tools, TRACE_FLAGS_DEFAULT, (EAPL("CEapSimIsaInterface::DoCancel() - Cancelling MMETEL query.\n") ) ); |
169 iQueryId) ); |
|
170 EAP_TRACE_RETURN_STRING(m_am_tools, "returns: CEapSimIsaInterface::DoCancel()"); |
173 EAP_TRACE_RETURN_STRING(m_am_tools, "returns: CEapSimIsaInterface::DoCancel()"); |
171 |
174 |
172 if (iQueryId == EQuerySRESandKC) |
175 if (iQueryId == EQuerySRESandKC) |
173 { |
176 { |
174 iQueryId = EQueryNone; |
|
175 |
|
176 // Cancel the request. |
177 // Cancel the request. |
177 iCustomAPI.CancelAsyncRequest( ECustomGetSimAuthenticationDataIPC ); |
178 iCustomAPI.CancelAsyncRequest( ECustomGetSimAuthenticationDataIPC ); |
178 |
|
179 EAP_TRACE_DEBUG(m_am_tools, TRACE_FLAGS_DEFAULT, (EAPL("CEapSimIsaInterface::DoCancel(): CANCELLED CUSTOM API REQUEST\n") ) ); |
|
180 } |
179 } |
181 } |
180 } |
182 |
181 |
183 //-------------------------------------------------- |
182 //-------------------------------------------------- |
184 |
183 |
207 EAP_TRACE_DEBUG(m_am_tools, TRACE_FLAGS_DEFAULT, (EAPL("ISA interface: Got IMSI reply.\n"))); |
206 EAP_TRACE_DEBUG(m_am_tools, TRACE_FLAGS_DEFAULT, (EAPL("ISA interface: Got IMSI reply.\n"))); |
208 |
207 |
209 EAP_TRACE_DATA_DEBUG(m_am_tools, TRACE_FLAGS_DEFAULT, (EAPL("IMSI"), |
208 EAP_TRACE_DATA_DEBUG(m_am_tools, TRACE_FLAGS_DEFAULT, (EAPL("IMSI"), |
210 iSubscriberId.Ptr(), |
209 iSubscriberId.Ptr(), |
211 iSubscriberId.Size())); |
210 iSubscriberId.Size())); |
212 |
211 |
213 iQueryId = EQueryNone; |
|
214 |
|
215 // Convert the IMSI from unicode to UTF8 characters. |
212 // Convert the IMSI from unicode to UTF8 characters. |
216 |
213 |
217 completion_status = imsiInUnicode.set_buffer(iSubscriberId.Ptr(), iSubscriberId.Size(), false, false); |
214 completion_status = imsiInUnicode.set_buffer(iSubscriberId.Ptr(), iSubscriberId.Size(), false, false); |
218 |
215 |
219 if (completion_status != eap_status_ok) |
216 if (completion_status != eap_status_ok) |
229 { |
226 { |
230 imsi.reset(); |
227 imsi.reset(); |
231 EAP_TRACE_DEBUG(m_am_tools, TRACE_FLAGS_DEFAULT, (EAPL("ISA interface: Could not convert IMSI from UNICODE to UTF8. Not proceeding further here.\n"))); |
228 EAP_TRACE_DEBUG(m_am_tools, TRACE_FLAGS_DEFAULT, (EAPL("ISA interface: Could not convert IMSI from UNICODE to UTF8. Not proceeding further here.\n"))); |
232 } |
229 } |
233 } |
230 } |
234 |
231 |
235 DisconnectMMETel(); |
|
236 |
|
237 TRAP(error, iParent->complete_SIM_imsi_L(&imsi, completion_status)); |
232 TRAP(error, iParent->complete_SIM_imsi_L(&imsi, completion_status)); |
238 |
233 |
239 break; |
234 break; |
240 |
235 |
241 case EQuerySRESandKC: |
236 case EQuerySRESandKC: |
247 |
242 |
248 EAP_TRACE_DATA_DEBUG(m_am_tools, TRACE_FLAGS_DEFAULT, (EAPL("KC"), |
243 EAP_TRACE_DATA_DEBUG(m_am_tools, TRACE_FLAGS_DEFAULT, (EAPL("KC"), |
249 iEAPSim.iKC.Ptr(), |
244 iEAPSim.iKC.Ptr(), |
250 iEAPSim.iKC.Size())); |
245 iEAPSim.iKC.Size())); |
251 |
246 |
252 iQueryId = EQueryNone; |
|
253 |
|
254 // Trim the length of SRES - Remove once the correct length is set for SRES, may be by the API or some where else. |
247 // Trim the length of SRES - Remove once the correct length is set for SRES, may be by the API or some where else. |
255 iEAPSim.iSRES.SetLength(SIM_SRES_LENGTH); |
248 iEAPSim.iSRES.SetLength(SIM_SRES_LENGTH); |
256 EAP_TRACE_DATA_DEBUG(m_am_tools, TRACE_FLAGS_DEFAULT, (EAPL("SRES after Trimming"), |
249 EAP_TRACE_DATA_DEBUG(m_am_tools, TRACE_FLAGS_DEFAULT, (EAPL("SRES after Trimming"), |
257 iEAPSim.iSRES.Ptr(), |
250 iEAPSim.iSRES.Ptr(), |
258 iEAPSim.iSRES.Size())); |
251 iEAPSim.iSRES.Size())); |
259 |
252 |
260 delete iAuthenticationData; |
253 delete iAuthenticationData; |
261 iAuthenticationData = NULL; |
254 iAuthenticationData = NULL; |
262 |
255 |
263 DisconnectMMETel(); |
256 // Close the custom API since we don't need it any more. |
264 |
257 iCustomAPI.Close(); |
|
258 |
265 // Complete |
259 // Complete |
266 TRAP(error, iParent->complete_SIM_kc_and_sres_L(iEAPSim.iKC, iEAPSim.iSRES, completion_status)); |
260 TRAP(error, iParent->complete_SIM_kc_and_sres_L(iEAPSim.iKC, iEAPSim.iSRES, completion_status)); |
267 |
261 |
268 break; |
262 break; |
269 } |
263 } |
272 { |
266 { |
273 EAP_TRACE_DEBUG(m_am_tools, TRACE_FLAGS_DEFAULT, (EAPL("ISA interface: Got error reply.\n"))); |
267 EAP_TRACE_DEBUG(m_am_tools, TRACE_FLAGS_DEFAULT, (EAPL("ISA interface: Got error reply.\n"))); |
274 |
268 |
275 if( EQuerySRESandKC == iQueryId ) |
269 if( EQuerySRESandKC == iQueryId ) |
276 { |
270 { |
277 iQueryId = EQueryNone; |
271 // We have to close the custom API anyway. |
278 |
272 // Rest will be taken care in destructor. |
279 DisconnectMMETel(); |
273 iCustomAPI.Close(); |
280 |
274 |
281 // Handle duplicate RAND values. |
275 // Handle duplicate RAND values. |
282 // If duplicate RAND values are being used, we get KErrArgument here. |
276 // If duplicate RAND values are being used, we get KErrArgument here. |
283 if(iStatus.Int() == KErrArgument) |
277 if(iStatus.Int() == KErrArgument) |
284 { |
278 { |
295 } |
289 } |
296 else if(EQueryIMSI == iQueryId) |
290 else if(EQueryIMSI == iQueryId) |
297 { |
291 { |
298 completion_status = m_am_tools->convert_am_error_to_eapol_error(iStatus.Int()); |
292 completion_status = m_am_tools->convert_am_error_to_eapol_error(iStatus.Int()); |
299 |
293 |
300 iQueryId = EQueryNone; |
|
301 |
|
302 DisconnectMMETel(); |
|
303 |
|
304 TRAP(error, iParent->complete_SIM_imsi_L(&imsi, completion_status)); |
294 TRAP(error, iParent->complete_SIM_imsi_L(&imsi, completion_status)); |
305 } |
295 } |
306 } |
296 } |
307 |
297 |
308 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
298 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
309 } |
299 } |
310 |
|
311 //-------------------------------------------------- |
|
312 |
300 |
313 TInt CEapSimIsaInterface::CreateMMETelConnectionL() |
301 TInt CEapSimIsaInterface::CreateMMETelConnectionL() |
314 { |
302 { |
315 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
303 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
316 EAP_TRACE_DEBUG(m_am_tools, TRACE_FLAGS_DEFAULT, (EAPL("CEapSimIsaInterface::CreateMMETelConnectionL()\n"))); |
304 EAP_TRACE_DEBUG(m_am_tools, TRACE_FLAGS_DEFAULT, (EAPL("CEapSimIsaInterface::CreateMMETelConnectionL()\n"))); |
372 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
360 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
373 |
361 |
374 return errorCode; |
362 return errorCode; |
375 } |
363 } |
376 |
364 |
377 void CEapSimIsaInterface::DisconnectMMETel() |
|
378 { |
|
379 EAP_TRACE_DEBUG(m_am_tools, TRACE_FLAGS_DEFAULT, (EAPL("CEapSimIsaInterface::DisconnectMMETel()\n"))); |
|
380 EAP_TRACE_RETURN_STRING(m_am_tools, "returns: CEapSimIsaInterface::DisconnectMMETel()"); |
|
381 |
|
382 iQueryId = EQueryNone; |
|
383 |
|
384 // Close the custom API since we don't need it any more. |
|
385 iCustomAPI.Close(); |
|
386 |
|
387 if( iMMETELConnectionStatus ) |
|
388 { |
|
389 EAP_TRACE_DEBUG(m_am_tools, TRACE_FLAGS_DEFAULT, (EAPL("Closing RMobilePhone and MMETEL.\n"))); |
|
390 |
|
391 iPhone.Close(); |
|
392 iServer.Close(); // Phone module is unloaded automatically when RTelServer session is closed |
|
393 |
|
394 iMMETELConnectionStatus = EFalse; |
|
395 } |
|
396 else |
|
397 { |
|
398 EAP_TRACE_DEBUG(m_am_tools, TRACE_FLAGS_DEFAULT, (EAPL("RMobilePhone and MMETEL already closed.\n"))); |
|
399 } |
|
400 } |
|
401 |
|
402 |
|
403 // End of file |
365 // End of file |