eapol/eapol_framework/eapol_symbian/am/type/gsmsim/symbian/EapSimInterface.cpp
branchRCL_3
changeset 45 bad0cc58d154
parent 43 30e048a7b597
child 46 c74b3d9f6b9e
--- a/eapol/eapol_framework/eapol_symbian/am/type/gsmsim/symbian/EapSimInterface.cpp	Thu Aug 19 09:58:27 2010 +0300
+++ b/eapol/eapol_framework/eapol_symbian/am/type/gsmsim/symbian/EapSimInterface.cpp	Tue Aug 31 15:16:37 2010 +0300
@@ -16,7 +16,7 @@
 */
 
 /*
-* %version: 15.1.5 %
+* %version: 16 %
 */
 
 // This is enumeration of EAPOL source code.
@@ -85,11 +85,15 @@
 
 	if(IsActive())
 	{
-		Cancel();
+		Cancel();		
 	}
 	
-	DisconnectMMETel();
-
+	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
+	iCustomAPI.Close();	
+		
 	delete iAuthenticationData;
 	iAuthenticationData = NULL;
 		
@@ -165,18 +169,13 @@
  
 void CEapSimIsaInterface::DoCancel()
 {
-	EAP_TRACE_DEBUG(m_am_tools, TRACE_FLAGS_DEFAULT, (EAPL("CEapSimIsaInterface::DoCancel(): iQueryId=%d\n"),
-		iQueryId) );
+	EAP_TRACE_DEBUG(m_am_tools, TRACE_FLAGS_DEFAULT, (EAPL("CEapSimIsaInterface::DoCancel() - Cancelling MMETEL query.\n") ) );
 	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") ) );
 	}
 }
 
@@ -209,9 +208,7 @@
 				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);
@@ -231,9 +228,7 @@
 						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;
@@ -249,8 +244,6 @@
 						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"),
@@ -260,8 +253,9 @@
 				delete iAuthenticationData;
 				iAuthenticationData = NULL;
 							
-				DisconnectMMETel();
-
+				// Close the custom API since we don't need it any more.
+				iCustomAPI.Close();
+			
 				// Complete
 				TRAP(error, iParent->complete_SIM_kc_and_sres_L(iEAPSim.iKC, iEAPSim.iSRES, completion_status));			
 			
@@ -274,9 +268,9 @@
 		
 		if( EQuerySRESandKC == iQueryId )
 		{
-			iQueryId = EQueryNone;
-
-			DisconnectMMETel();
+			// We have to close the custom API anyway. 
+			// Rest will be taken care in destructor.
+			iCustomAPI.Close();	
 			
 			// Handle duplicate RAND values.
 			// If duplicate RAND values are being used, we get KErrArgument here.
@@ -297,19 +291,13 @@
 		{
 			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);
@@ -374,30 +362,4 @@
     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