eapol/eapol_framework/eapol_symbian/am/type/gsmsim/symbian/plugin/src/EapSimUiConnection.cpp
changeset 0 c8830336c852
child 2 1c7bc153c08e
equal deleted inserted replaced
-1:000000000000 0:c8830336c852
       
     1 /*
       
     2 * Copyright (c) 2001-2006 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of the License "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  EAP and WLAN authentication protocols.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // This is enumeration of EAPOL source code.
       
    20 #if defined(USE_EAP_MINIMUM_RELEASE_TRACES)
       
    21 	#undef EAP_FILE_NUMBER_ENUM
       
    22 	#define EAP_FILE_NUMBER_ENUM 213 
       
    23 	#undef EAP_FILE_NUMBER_DATE 
       
    24 	#define EAP_FILE_NUMBER_DATE 1127594498 
       
    25 #endif //#if defined(USE_EAP_MINIMUM_RELEASE_TRACES)
       
    26 
       
    27 #include "EapSimDbUtils.h"
       
    28 #include <EapSimUiConnection.h>
       
    29 #include <EapSimUiDataConnection.h>
       
    30 
       
    31 CEapSimUiConnection::CEapSimUiConnection(
       
    32     const TIndexType aIndexType,
       
    33     const TInt aIndex,
       
    34     const TInt aTunnelingType)
       
    35     : iIndexType(aIndexType)
       
    36     , iIndex(aIndex)
       
    37     , iTunnelingType(aTunnelingType)
       
    38     , iIsConnected(EFalse)
       
    39     , iDataConn(NULL)
       
    40 {
       
    41 }
       
    42 
       
    43 
       
    44 CEapSimUiConnection::~CEapSimUiConnection()
       
    45 {
       
    46 }
       
    47 
       
    48 
       
    49 TInt CEapSimUiConnection::Connect()
       
    50 {
       
    51 #ifdef USE_EAP_EXPANDED_TYPES
       
    52 
       
    53 	eap_type_value_e tunnelingType(static_cast<eap_type_ietf_values_e>(iTunnelingType));
       
    54 
       
    55 #else
       
    56 
       
    57 	eap_type_value_e tunnelingType = static_cast<eap_type_value_e>(iTunnelingType);
       
    58 
       
    59 #endif //#ifdef USE_EAP_EXPANDED_TYPES
       
    60 
       
    61 	TRAPD(err, EapSimDbUtils::OpenDatabaseL(
       
    62 		iDbNamedDatabase, 
       
    63 		iDbs, 
       
    64 		iIndexType, 
       
    65 		iIndex, 
       
    66 		tunnelingType));
       
    67     if (err == KErrNone)
       
    68     {
       
    69         iIsConnected = ETrue;
       
    70     }
       
    71 
       
    72     return err;
       
    73 }
       
    74 
       
    75 
       
    76 TInt CEapSimUiConnection::Close()
       
    77 {
       
    78     if (iIsConnected)
       
    79     {
       
    80         iDbNamedDatabase.Close();
       
    81         iDbs.Close();
       
    82     }
       
    83     iIsConnected = EFalse;
       
    84 
       
    85     return KErrNone;
       
    86 }
       
    87 
       
    88 
       
    89 CEapSimUiDataConnection * CEapSimUiConnection::GetDataConnection()
       
    90 {
       
    91     if (!iDataConn)
       
    92     {
       
    93         iDataConn = new CEapSimUiDataConnection(this);
       
    94     }
       
    95 
       
    96     return iDataConn;
       
    97 }
       
    98 
       
    99 TInt CEapSimUiConnection::GetDatabase(RDbNamedDatabase & aDatabase)
       
   100 {
       
   101     if (iIsConnected == EFalse)
       
   102     {
       
   103         return KErrSessionClosed;
       
   104     }
       
   105 
       
   106     aDatabase = iDbNamedDatabase;
       
   107     return KErrNone;
       
   108 }
       
   109 
       
   110 
       
   111 TIndexType CEapSimUiConnection::GetIndexType()
       
   112 {
       
   113     return iIndexType;
       
   114 }
       
   115 
       
   116 
       
   117 TInt CEapSimUiConnection::GetIndex()
       
   118 {
       
   119     return iIndex;
       
   120 }
       
   121 
       
   122 
       
   123 TInt CEapSimUiConnection::GetTunnelingType()
       
   124 {
       
   125     return iTunnelingType;
       
   126 }
       
   127 
       
   128 // End of file