eapol/eapol_framework/eapol_symbian/am/type/aka/symbian/plugin/src/EapAkaUiConnection.cpp
branchRCL_3
changeset 46 c74b3d9f6b9e
equal deleted inserted replaced
45:bad0cc58d154 46:c74b3d9f6b9e
       
     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 * %version: 10.1.2 %
       
    20 */
       
    21 
       
    22 // This is enumeration of EAPOL source code.
       
    23 #if defined(USE_EAP_MINIMUM_RELEASE_TRACES)
       
    24 	#undef EAP_FILE_NUMBER_ENUM
       
    25 	#define EAP_FILE_NUMBER_ENUM 182 
       
    26 	#undef EAP_FILE_NUMBER_DATE 
       
    27 	#define EAP_FILE_NUMBER_DATE 1127594498 
       
    28 #endif //#if defined(USE_EAP_MINIMUM_RELEASE_TRACES)
       
    29 
       
    30 #include "EapAkaDbUtils.h"
       
    31 #include <EapAkaUiConnection.h>
       
    32 #include <EapAkaUiDataConnection.h>
       
    33 #include "eap_header.h"
       
    34 
       
    35 CEapAkaUiConnection::CEapAkaUiConnection(
       
    36     const TIndexType aIndexType,
       
    37     const TInt aIndex,
       
    38     const TInt aTunnelingType)
       
    39     : iIndexType(aIndexType)
       
    40     , iIndex(aIndex)
       
    41     , iTunnelingType(aTunnelingType)
       
    42     , iIsConnected(EFalse)
       
    43     , iDataConn(NULL)
       
    44 {
       
    45 }
       
    46 
       
    47 
       
    48 CEapAkaUiConnection::~CEapAkaUiConnection()
       
    49 {
       
    50 }
       
    51 
       
    52 
       
    53 TInt CEapAkaUiConnection::Connect()
       
    54 {
       
    55 #ifdef USE_EAP_EXPANDED_TYPES
       
    56 
       
    57 	eap_type_value_e tunnelingType(static_cast<eap_type_ietf_values_e>(iTunnelingType));
       
    58 
       
    59 #else
       
    60 
       
    61 	eap_type_value_e tunnelingType = static_cast<eap_type_value_e>(iTunnelingType);
       
    62 
       
    63 #endif //#ifdef USE_EAP_EXPANDED_TYPES
       
    64 
       
    65 	TRAPD(err, EapAkaDbUtils::OpenDatabaseL(
       
    66 		iDbNamedDatabase, 
       
    67 		iDbs, 
       
    68 		iIndexType, 
       
    69 		iIndex, 
       
    70 		tunnelingType));
       
    71     if (err == KErrNone)
       
    72     {
       
    73         iIsConnected = ETrue;
       
    74     }
       
    75 
       
    76     return err;
       
    77 }
       
    78 
       
    79 
       
    80 TInt CEapAkaUiConnection::Close()
       
    81 {
       
    82     if (iIsConnected)
       
    83     {
       
    84         iDbNamedDatabase.Close();
       
    85         iDbs.Close();
       
    86     }
       
    87     iIsConnected = EFalse;
       
    88 
       
    89     return KErrNone;
       
    90 }
       
    91 
       
    92 
       
    93 CEapAkaUiDataConnection * CEapAkaUiConnection::GetDataConnection()
       
    94 {
       
    95     if (!iDataConn)
       
    96     {
       
    97         iDataConn = new CEapAkaUiDataConnection(this);
       
    98     }
       
    99 
       
   100     return iDataConn;
       
   101 }
       
   102 
       
   103 TInt CEapAkaUiConnection::GetDatabase(RDbNamedDatabase & aDatabase)
       
   104 {
       
   105     if (iIsConnected == EFalse)
       
   106     {
       
   107         return KErrSessionClosed;
       
   108     }
       
   109 
       
   110     aDatabase = iDbNamedDatabase;
       
   111     return KErrNone;
       
   112 }
       
   113 
       
   114 
       
   115 TIndexType CEapAkaUiConnection::GetIndexType()
       
   116 {
       
   117     return iIndexType;
       
   118 }
       
   119 
       
   120 
       
   121 TInt CEapAkaUiConnection::GetIndex()
       
   122 {
       
   123     return iIndex;
       
   124 }
       
   125 
       
   126 
       
   127 TInt CEapAkaUiConnection::GetTunnelingType()
       
   128 {
       
   129     return iTunnelingType;
       
   130 }