diff -r 75a6055b8ce3 -r 30e048a7b597 eapol/eapol_framework/eapol_symbian/am/type/gsmsim/symbian/EapSimInterface.cpp --- a/eapol/eapol_framework/eapol_symbian/am/type/gsmsim/symbian/EapSimInterface.cpp Mon Jun 21 15:44:11 2010 +0300 +++ b/eapol/eapol_framework/eapol_symbian/am/type/gsmsim/symbian/EapSimInterface.cpp Thu Aug 19 09:58:27 2010 +0300 @@ -16,7 +16,7 @@ */ /* -* %version: 15 % +* %version: 15.1.5 % */ // This is enumeration of EAPOL source code. @@ -30,6 +30,7 @@ // INCLUDE FILES #include "EapSimInterface.h" +#include "eap_automatic_variable.h" #include #include "eap_sim_triplets.h" // For SIM_SRES_LENGTH. @@ -46,6 +47,8 @@ , iMMETELConnectionStatus(EFalse) { EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); + EAP_TRACE_DEBUG(m_am_tools, TRACE_FLAGS_DEFAULT, (EAPL("CEapSimIsaInterface::CEapSimIsaInterface()\n"))); + EAP_TRACE_RETURN_STRING(m_am_tools, "returns: CEapSimIsaInterface::CEapSimIsaInterface()"); EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); } @@ -77,17 +80,16 @@ CEapSimIsaInterface::~CEapSimIsaInterface() { EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); + EAP_TRACE_DEBUG(m_am_tools, TRACE_FLAGS_DEFAULT, (EAPL("CEapSimIsaInterface::~CEapSimIsaInterface()\n"))); + EAP_TRACE_RETURN_STRING(m_am_tools, "returns: CEapSimIsaInterface::~CEapSimIsaInterface()"); if(IsActive()) { - Cancel(); + Cancel(); } - EAP_TRACE_DEBUG(m_am_tools, TRACE_FLAGS_DEFAULT, (EAPL("Closing RMobilePhone and MMETEL.\n"))); - - iPhone.Close(); - iServer.Close(); // Phone module is unloaded automatically when RTelServer session is closed - + DisconnectMMETel(); + delete iAuthenticationData; iAuthenticationData = NULL; @@ -99,8 +101,9 @@ void CEapSimIsaInterface::QueryIMSIL() { EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); - EAP_TRACE_DEBUG(m_am_tools, TRACE_FLAGS_DEFAULT, (EAPL("ISA interface: Querying IMSI.\n"))); - + EAP_TRACE_DEBUG(m_am_tools, TRACE_FLAGS_DEFAULT, (EAPL("CEapSimIsaInterface::QueryIMSIL()\n"))); + EAP_TRACE_RETURN_STRING(m_am_tools, "returns: CEapSimIsaInterface::QueryIMSIL()"); + iQueryId = EQueryIMSI; // Create MMETEl connection. @@ -121,7 +124,8 @@ void CEapSimIsaInterface::QueryKcAndSRESL(const TDesC8& aRand) { EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); - EAP_TRACE_DEBUG(m_am_tools, TRACE_FLAGS_DEFAULT, (EAPL("ISA interface: Querying Kc and SRES.\n"))); + EAP_TRACE_DEBUG(m_am_tools, TRACE_FLAGS_DEFAULT, (EAPL("CEapSimIsaInterface::QueryKcAndSRESL()\n"))); + EAP_TRACE_RETURN_STRING(m_am_tools, "returns: CEapSimIsaInterface::QueryKcAndSRESL()"); iQueryId = EQuerySRESandKC; @@ -161,10 +165,19 @@ void CEapSimIsaInterface::DoCancel() { - EAP_TRACE_DEBUG(m_am_tools, TRACE_FLAGS_DEFAULT, (EAPL("CEapSimIsaInterface::DoCancel() - Cancelling MMETEL query.\n") ) ); - - // Cancel the request. - iCustomAPI.CancelAsyncRequest( ECustomGetSimAuthenticationDataIPC ); + EAP_TRACE_DEBUG(m_am_tools, TRACE_FLAGS_DEFAULT, (EAPL("CEapSimIsaInterface::DoCancel(): iQueryId=%d\n"), + iQueryId) ); + EAP_TRACE_RETURN_STRING(m_am_tools, "returns: CEapSimIsaInterface::DoCancel()"); + + if (iQueryId == EQuerySRESandKC) + { + iQueryId = EQueryNone; + + // Cancel the request. + iCustomAPI.CancelAsyncRequest( ECustomGetSimAuthenticationDataIPC ); + + EAP_TRACE_DEBUG(m_am_tools, TRACE_FLAGS_DEFAULT, (EAPL("CEapSimIsaInterface::DoCancel(): CANCELLED CUSTOM API REQUEST\n") ) ); + } } //-------------------------------------------------- @@ -172,8 +185,11 @@ void CEapSimIsaInterface::RunL() { EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); - EAP_TRACE_DEBUG(m_am_tools, TRACE_FLAGS_DEFAULT, (EAPL("CEapSimIsaInterface::RunL(). iStatus.Int() =%d \n"), iStatus.Int() )); - + EAP_TRACE_DEBUG(m_am_tools, TRACE_FLAGS_DEFAULT, (EAPL("CEapSimIsaInterface::RunL(). iStatus.Int()=%d, iQueryId=%d\n"), + iStatus.Int(), + iQueryId)); + EAP_TRACE_RETURN_STRING(m_am_tools, "returns: CEapSimIsaInterface::RunL()"); + TInt error = KErrNone; eap_variable_data_c imsi(m_am_tools); // Keeping it here to avoid "error" in ARMV5 build. @@ -193,7 +209,9 @@ EAP_TRACE_DATA_DEBUG(m_am_tools, TRACE_FLAGS_DEFAULT, (EAPL("IMSI"), iSubscriberId.Ptr(), iSubscriberId.Size())); - + + iQueryId = EQueryNone; + // Convert the IMSI from unicode to UTF8 characters. completion_status = imsiInUnicode.set_buffer(iSubscriberId.Ptr(), iSubscriberId.Size(), false, false); @@ -213,7 +231,9 @@ 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"))); } } - + + DisconnectMMETel(); + TRAP(error, iParent->complete_SIM_imsi_L(&imsi, completion_status)); break; @@ -229,6 +249,8 @@ iEAPSim.iKC.Ptr(), iEAPSim.iKC.Size())); + iQueryId = EQueryNone; + // Trim the length of SRES - Remove once the correct length is set for SRES, may be by the API or some where else. iEAPSim.iSRES.SetLength(SIM_SRES_LENGTH); EAP_TRACE_DATA_DEBUG(m_am_tools, TRACE_FLAGS_DEFAULT, (EAPL("SRES after Trimming"), @@ -238,9 +260,8 @@ delete iAuthenticationData; iAuthenticationData = NULL; - // Close the custom API since we don't need it any more. - iCustomAPI.Close(); - + DisconnectMMETel(); + // Complete TRAP(error, iParent->complete_SIM_kc_and_sres_L(iEAPSim.iKC, iEAPSim.iSRES, completion_status)); @@ -253,9 +274,9 @@ if( EQuerySRESandKC == iQueryId ) { - // We have to close the custom API anyway. - // Rest will be taken care in destructor. - iCustomAPI.Close(); + iQueryId = EQueryNone; + + DisconnectMMETel(); // Handle duplicate RAND values. // If duplicate RAND values are being used, we get KErrArgument here. @@ -276,17 +297,24 @@ { completion_status = m_am_tools->convert_am_error_to_eapol_error(iStatus.Int()); + iQueryId = EQueryNone; + + DisconnectMMETel(); + TRAP(error, iParent->complete_SIM_imsi_L(&imsi, completion_status)); } } - + EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); } +//-------------------------------------------------- + TInt CEapSimIsaInterface::CreateMMETelConnectionL() { EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); - EAP_TRACE_DEBUG(m_am_tools, TRACE_FLAGS_DEFAULT, (EAPL("Creating MMETel connection.\n"))); + EAP_TRACE_DEBUG(m_am_tools, TRACE_FLAGS_DEFAULT, (EAPL("CEapSimIsaInterface::CreateMMETelConnectionL()\n"))); + EAP_TRACE_RETURN_STRING(m_am_tools, "returns: CEapSimIsaInterface::CreateMMETelConnectionL()"); TInt errorCode = KErrNone; @@ -346,4 +374,30 @@ return errorCode; } +void CEapSimIsaInterface::DisconnectMMETel() +{ + EAP_TRACE_DEBUG(m_am_tools, TRACE_FLAGS_DEFAULT, (EAPL("CEapSimIsaInterface::DisconnectMMETel()\n"))); + EAP_TRACE_RETURN_STRING(m_am_tools, "returns: CEapSimIsaInterface::DisconnectMMETel()"); + + iQueryId = EQueryNone; + + // Close the custom API since we don't need it any more. + iCustomAPI.Close(); + + if( iMMETELConnectionStatus ) + { + EAP_TRACE_DEBUG(m_am_tools, TRACE_FLAGS_DEFAULT, (EAPL("Closing RMobilePhone and MMETEL.\n"))); + + iPhone.Close(); + iServer.Close(); // Phone module is unloaded automatically when RTelServer session is closed + + iMMETELConnectionStatus = EFalse; + } + else + { + EAP_TRACE_DEBUG(m_am_tools, TRACE_FLAGS_DEFAULT, (EAPL("RMobilePhone and MMETEL already closed.\n"))); + } +} + + // End of file