eapol/eapol_framework/eapol_symbian/am/type/securid/symbian/plugin/src/EapSecurID.cpp
branchRCL_3
changeset 18 bad0cc58d154
parent 2 1c7bc153c08e
child 19 c74b3d9f6b9e
--- a/eapol/eapol_framework/eapol_symbian/am/type/securid/symbian/plugin/src/EapSecurID.cpp	Thu Aug 19 09:58:27 2010 +0300
+++ b/eapol/eapol_framework/eapol_symbian/am/type/securid/symbian/plugin/src/EapSecurID.cpp	Tue Aug 31 15:16:37 2010 +0300
@@ -16,7 +16,7 @@
 */
 
 /*
-* %version: 15.1.2 %
+* %version: 25 %
 */
 
 // This is enumeration of EAPOL source code.
@@ -37,10 +37,9 @@
 #include <EapTypeInfo.h>
 #include "EapGtcDbUtils.h"
 
-#include <EapGtcUiConnection.h>
-#include "EapGtcUi.h"
-
 #include "eap_am_tools_symbian.h"
+#include "EapConversion.h"
+#include "EapTraceSymbian.h"
 
 // LOCAL CONSTANTS
 
@@ -152,36 +151,13 @@
 
 // ----------------------------------------------------------
 
-TInt CEapSecurID::InvokeUiL()
-{
-	TInt buttonId(0);
-
-#ifdef USE_EAP_EXPANDED_TYPES
-
-    CEapGtcUiConnection uiConn(iIndexType, iIndex, iTunnelingType.get_vendor_type());
-	
-#else
-
-    CEapGtcUiConnection uiConn(iIndexType, iIndex, iTunnelingType);
-
-#endif //#ifdef USE_EAP_EXPANDED_TYPES
-	
-	CEapGtcUi* ui = CEapGtcUi::NewL(&uiConn);
-	CleanupStack::PushL(ui);
-	buttonId = ui->InvokeUiL();
-	CleanupStack::PopAndDestroy(ui);
-	return buttonId;
-}
-
-// ----------------------------------------------------------
-
-CEapTypeInfo* CEapSecurID::GetInfoLC()
+CEapTypeInfo* CEapSecurID::GetInfoL()
 {
 	CEapTypeInfo* info = new(ELeave) CEapTypeInfo(
 		(TDesC&) KReleaseDate,
 		(TDesC&) KEapTypeVersion,
 		(TDesC&) KManufacturer);
-	CleanupStack::PushL(info);
+
 	return info;
 }
 
@@ -194,19 +170,20 @@
 
 // ----------------------------------------------------------
 
-void CEapSecurID::SetTunnelingType(const TInt aTunnelingType)
-{
-#ifdef USE_EAP_EXPANDED_TYPES
-
-	// Vendor id is eap_type_vendor_id_ietf always in this plugin.
-	iTunnelingType.set_eap_type_values(eap_type_vendor_id_ietf, aTunnelingType);
-
-#else
-
-	iTunnelingType = static_cast<eap_type_value_e>(aTunnelingType);
-
-#endif //#ifdef USE_EAP_EXPANDED_TYPES
-}
+void CEapSecurID::SetTunnelingType(const TEapExpandedType aTunnelingType)
+    {
+    EAP_TRACE_DATA_DEBUG_SYMBIAN(
+        (EAPL("CEapSecurID::SetTunnelingType - tunneling type"),
+        aTunnelingType.GetValue().Ptr(), aTunnelingType.GetValue().Length()));
+    
+    eap_type_value_e aInternalType;
+    
+    TInt err = CEapConversion::ConvertExpandedEAPTypeToInternalType(
+            &aTunnelingType,
+            &aInternalType);
+    
+    iTunnelingType = aInternalType;
+    }
 
 // ----------------------------------------------------------
 void CEapSecurID::SetIndexL(
@@ -230,13 +207,16 @@
 
 	RDbNamedDatabase db;
 
-	RDbs session;
-	
-	EapGtcDbUtils::OpenDatabaseL(db, session, iIndexType, iIndex, iTunnelingType);
+	RFs session;
 	
 	CleanupClosePushL(session);
 	CleanupClosePushL(db);
-		
+	TInt error = session.Connect();
+	EAP_TRACE_DEBUG_SYMBIAN((_L("CEapSecurID::SetIndexL(): - session.Connect(), error=%d\n"), error));
+	User::LeaveIfError(error);
+
+	EapGtcDbUtils::OpenDatabaseL(db, session, iIndexType, iIndex, iTunnelingType);
+
 	EapGtcDbUtils::SetIndexL(
 		db, 
 		iIndexType, 
@@ -249,22 +229,27 @@
 	iIndexType = aIndexType;
 	iIndex = aIndex;
 
-	CleanupStack::PopAndDestroy(2); // db
-	
-		
+	db.Close();
+	session.Close();
+
+	CleanupStack::PopAndDestroy(&db);
+	CleanupStack::PopAndDestroy(&session);
 }
 
 void CEapSecurID::SetConfigurationL(const EAPSettings& aSettings)
 {
 	RDbNamedDatabase db;
 
-	RDbs session;	
-	
-	// This also creates the IAP entry if it doesn't exist
-	EapGtcDbUtils::OpenDatabaseL(db, session, iIndexType, iIndex, iTunnelingType);
+	RFs session;
 	
 	CleanupClosePushL(session);
 	CleanupClosePushL(db);
+	TInt error = session.Connect();
+	EAP_TRACE_DEBUG_SYMBIAN((_L("CEapSecurID::SetConfigurationL(): - session.Connect(), error=%d\n"), error));
+	User::LeaveIfError(error);
+
+	// This also creates the IAP entry if it doesn't exist
+	EapGtcDbUtils::OpenDatabaseL(db, session, iIndexType, iIndex, iTunnelingType);
 
 	EapGtcDbUtils::SetConfigurationL(
 		db,
@@ -272,21 +257,28 @@
 		iIndexType,
 		iIndex,
 		iTunnelingType);		
-		
-	CleanupStack::PopAndDestroy(2); // db, session
+
+	db.Close();
+	session.Close();
+
+	CleanupStack::PopAndDestroy(&db);
+	CleanupStack::PopAndDestroy(&session);
 }
 
 void CEapSecurID::GetConfigurationL(EAPSettings& aSettings)
 {
 	RDbNamedDatabase db;
 
-	RDbs session;
-	
-	// This also creates the IAP entry if it doesn't exist
-	EapGtcDbUtils::OpenDatabaseL(db, session, iIndexType, iIndex, iTunnelingType);
+	RFs session;
 	
 	CleanupClosePushL(session);
 	CleanupClosePushL(db);
+	TInt error = session.Connect();
+	EAP_TRACE_DEBUG_SYMBIAN((_L("CEapSecurID::GetConfigurationL(): - session.Connect(), error=%d\n"), error));
+	User::LeaveIfError(error);
+
+	// This also creates the IAP entry if it doesn't exist
+	EapGtcDbUtils::OpenDatabaseL(db, session, iIndexType, iIndex, iTunnelingType);
 
 	EapGtcDbUtils::GetConfigurationL(
 		db,
@@ -294,8 +286,12 @@
 		iIndexType,
 		iIndex,
 		iTunnelingType);
-		
-	CleanupStack::PopAndDestroy(2); // db, session
+
+	db.Close();
+	session.Close();
+
+	CleanupStack::PopAndDestroy(&db);
+	CleanupStack::PopAndDestroy(&session);
 }
 
 void CEapSecurID::CopySettingsL(
@@ -319,13 +315,16 @@
 
 	RDbNamedDatabase db;
 
-	RDbs session;
-	
-	EapGtcDbUtils::OpenDatabaseL(db, session, iIndexType, iIndex, iTunnelingType);
+	RFs session;
 	
 	CleanupClosePushL(session);
 	CleanupClosePushL(db);
-		
+	TInt error = session.Connect();
+	EAP_TRACE_DEBUG_SYMBIAN((_L("CEapSecurID::CopySettingsL(): - session.Connect(), error=%d\n"), error));
+	User::LeaveIfError(error);
+
+	EapGtcDbUtils::OpenDatabaseL(db, session, iIndexType, iIndex, iTunnelingType);
+
 	EapGtcDbUtils::CopySettingsL(
 		db,
 		iIndexType,
@@ -334,9 +333,12 @@
 		aDestinationIndexType, 
 		aDestinationIndex, 
 		iTunnelingType);
-		
-	CleanupStack::PopAndDestroy(2); // db
-	
+
+	db.Close();
+	session.Close();
+
+	CleanupStack::PopAndDestroy(&db);
+	CleanupStack::PopAndDestroy(&session);
 }