eapol/eapol_framework/eapol_symbian/am/type/gsmsim/symbian/plugin/src/EapSim.cpp
branchRCL_3
changeset 18 bad0cc58d154
parent 2 1c7bc153c08e
child 19 c74b3d9f6b9e
--- a/eapol/eapol_framework/eapol_symbian/am/type/gsmsim/symbian/plugin/src/EapSim.cpp	Thu Aug 19 09:58:27 2010 +0300
+++ b/eapol/eapol_framework/eapol_symbian/am/type/gsmsim/symbian/plugin/src/EapSim.cpp	Tue Aug 31 15:16:37 2010 +0300
@@ -16,7 +16,7 @@
 */
 
 /*
-* %version: 16.1.2 %
+* %version: 26 %
 */
 
 // This is enumeration of EAPOL source code.
@@ -38,10 +38,9 @@
 #include <EapTypeInfo.h>
 #include "EapSimDbUtils.h"
 
-#include <EapSimUiConnection.h>
-#include "EapSimUi.h"
-
+#include "EapConversion.h"
 #include "eap_am_tools_symbian.h"
+#include "EapTraceSymbian.h"
 
 // LOCAL CONSTANTS
 
@@ -137,35 +136,14 @@
 }
 
 // ----------------------------------------------------------
-TInt CEapSim::InvokeUiL()
-{
-	TInt buttonId(0);
-	
-#ifdef USE_EAP_EXPANDED_TYPES
 
-    CEapSimUiConnection uiConn(iIndexType, iIndex, iTunnelingType.get_vendor_type());
-	
-#else
-
-    CEapSimUiConnection uiConn(iIndexType, iIndex, iTunnelingType);
-
-#endif //#ifdef USE_EAP_EXPANDED_TYPES
-	
-	CEapSimUi* ui = CEapSimUi::NewL(&uiConn);
-	CleanupStack::PushL(ui);
-	buttonId = ui->InvokeUiL();
-	CleanupStack::PopAndDestroy(ui);
-	return buttonId;
-}
-// ----------------------------------------------------------
-CEapTypeInfo* CEapSim::GetInfoLC()
+CEapTypeInfo* CEapSim::GetInfoL()
 {
 	CEapTypeInfo* info = new(ELeave) CEapTypeInfo(
 		(TDesC&)KReleaseDate, 
 		(TDesC&)KEapTypeVersion,
 		(TDesC&)KManufacturer);
 
-	CleanupStack::PushL(info);
 	return info;
 }
 
@@ -185,18 +163,21 @@
 
 // ----------------------------------------------------------
 
-void CEapSim::SetTunnelingType(const TInt aTunnelingType)
+void CEapSim::SetTunnelingType(const TEapExpandedType aTunnelingType)
 {
-#ifdef USE_EAP_EXPANDED_TYPES
+
+EAP_TRACE_DATA_DEBUG_SYMBIAN(
+    (EAPL("CEapSim::SetTunnelingType - tunneling type"),
+    aTunnelingType.GetValue().Ptr(), aTunnelingType.GetValue().Length()));
 
-	// Vendor id is eap_type_vendor_id_ietf always in this plugin.
-	iTunnelingType.set_eap_type_values(eap_type_vendor_id_ietf, aTunnelingType);
+eap_type_value_e aInternalType;
 
-#else
+TInt err = CEapConversion::ConvertExpandedEAPTypeToInternalType(
+        &aTunnelingType,
+        &aInternalType);
 
-	iTunnelingType = static_cast<eap_type_value_e>(aTunnelingType);
+iTunnelingType = aInternalType;
 
-#endif //#ifdef USE_EAP_EXPANDED_TYPES
 }
 
 
@@ -222,13 +203,16 @@
 
 	RDbNamedDatabase db;
 
-	RDbs session;
-	
-	EapSimDbUtils::OpenDatabaseL(db, session, iIndexType, iIndex, iTunnelingType);
+	RFs session;
 	
 	CleanupClosePushL(session);
 	CleanupClosePushL(db);
-		
+	TInt error = session.Connect();
+	EAP_TRACE_DEBUG_SYMBIAN((_L("CEapSim::SetIndexL(): - session.Connect(), error=%d\n"), error));
+	User::LeaveIfError(error);
+
+	EapSimDbUtils::OpenDatabaseL(db, session, iIndexType, iIndex, iTunnelingType);
+
 	EapSimDbUtils::SetIndexL(
 		db, 
 		iIndexType, 
@@ -241,20 +225,27 @@
 	iIndexType = aIndexType;
 	iIndex = aIndex;
 	
-	CleanupStack::PopAndDestroy(2); // db
+	db.Close();
+	session.Close();
+
+	CleanupStack::PopAndDestroy(&db);
+	CleanupStack::PopAndDestroy(&session);
 }
 
 void CEapSim::SetConfigurationL(const EAPSettings& aSettings)
 {
 	RDbNamedDatabase db;
 
-	RDbs session;	
-	
-	// This also creates the IAP entry if it doesn't exist
-	EapSimDbUtils::OpenDatabaseL(db, session, iIndexType, iIndex, iTunnelingType);
+	RFs session;
 	
 	CleanupClosePushL(session);
 	CleanupClosePushL(db);
+	TInt error = session.Connect();
+	EAP_TRACE_DEBUG_SYMBIAN((_L("CEapSim::SetConfigurationL(): - session.Connect(), error=%d\n"), error));
+	User::LeaveIfError(error);
+
+	// This also creates the IAP entry if it doesn't exist
+	EapSimDbUtils::OpenDatabaseL(db, session, iIndexType, iIndex, iTunnelingType);
 
 	EapSimDbUtils::SetConfigurationL(
 		db,
@@ -263,20 +254,27 @@
 		iIndex,
 		iTunnelingType);		
 		
-	CleanupStack::PopAndDestroy(2); // db, session
+	db.Close();
+	session.Close();
+
+	CleanupStack::PopAndDestroy(&db);
+	CleanupStack::PopAndDestroy(&session);
 }
 
 void CEapSim::GetConfigurationL(EAPSettings& aSettings)
 {
 	RDbNamedDatabase db;
 
-	RDbs session;
-	
-	// This also creates the IAP entry if it doesn't exist
-	EapSimDbUtils::OpenDatabaseL(db, session, iIndexType, iIndex, iTunnelingType);
+	RFs session;
 	
 	CleanupClosePushL(session);
 	CleanupClosePushL(db);
+	TInt error = session.Connect();
+	EAP_TRACE_DEBUG_SYMBIAN((_L("CEapSim::SetConfigurationL(): - session.Connect(), error=%d\n"), error));
+	User::LeaveIfError(error);
+
+	// This also creates the IAP entry if it doesn't exist
+	EapSimDbUtils::OpenDatabaseL(db, session, iIndexType, iIndex, iTunnelingType);
 
 	EapSimDbUtils::GetConfigurationL(
 		db,
@@ -285,7 +283,11 @@
 		iIndex,
 		iTunnelingType);
 		
-	CleanupStack::PopAndDestroy(2); // db, session
+	db.Close();
+	session.Close();
+
+	CleanupStack::PopAndDestroy(&db);
+	CleanupStack::PopAndDestroy(&session);
 }
 
 void CEapSim::CopySettingsL(
@@ -309,13 +311,16 @@
 
 	RDbNamedDatabase db;
 
-	RDbs session;
-	
-	EapSimDbUtils::OpenDatabaseL(db, session, iIndexType, iIndex, iTunnelingType);
+	RFs session;
 	
 	CleanupClosePushL(session);
 	CleanupClosePushL(db);
-		
+	TInt error = session.Connect();
+	EAP_TRACE_DEBUG_SYMBIAN((_L("CEapSim::CopySettingsL(): - session.Connect(), error=%d\n"), error));
+	User::LeaveIfError(error);
+
+	EapSimDbUtils::OpenDatabaseL(db, session, iIndexType, iIndex, iTunnelingType);
+
 	EapSimDbUtils::CopySettingsL(
 		db,
 		iIndexType,
@@ -325,7 +330,11 @@
 		aDestinationIndex, 
 		iTunnelingType);
 		
-	CleanupStack::PopAndDestroy(2); // db
+	db.Close();
+	session.Close();
+
+	CleanupStack::PopAndDestroy(&db);
+	CleanupStack::PopAndDestroy(&session);
 	
 }