eapol/eapol_framework/eapol_symbian/am/type/gsmsim/symbian/plugin/src/EapSimUiConnection.cpp
branchGCC_SURGE
changeset 40 60f08993dad0
parent 29 77618ad58aba
parent 39 fe6b6762fccd
equal deleted inserted replaced
29:77618ad58aba 40:60f08993dad0
     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: 11.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 213 
       
    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 "EapSimDbUtils.h"
       
    31 #include <EapSimUiConnection.h>
       
    32 #include <EapSimUiDataConnection.h>
       
    33 
       
    34 CEapSimUiConnection::CEapSimUiConnection(
       
    35     const TIndexType aIndexType,
       
    36     const TInt aIndex,
       
    37     const TInt aTunnelingType)
       
    38     : iIndexType(aIndexType)
       
    39     , iIndex(aIndex)
       
    40     , iTunnelingType(aTunnelingType)
       
    41     , iIsConnected(EFalse)
       
    42     , iDataConn(NULL)
       
    43 {
       
    44 }
       
    45 
       
    46 
       
    47 CEapSimUiConnection::~CEapSimUiConnection()
       
    48 {
       
    49 }
       
    50 
       
    51 
       
    52 TInt CEapSimUiConnection::Connect()
       
    53 {
       
    54 #ifdef USE_EAP_EXPANDED_TYPES
       
    55 
       
    56 	eap_type_value_e tunnelingType(static_cast<eap_type_ietf_values_e>(iTunnelingType));
       
    57 
       
    58 #else
       
    59 
       
    60 	eap_type_value_e tunnelingType = static_cast<eap_type_value_e>(iTunnelingType);
       
    61 
       
    62 #endif //#ifdef USE_EAP_EXPANDED_TYPES
       
    63 
       
    64 	TRAPD(err, EapSimDbUtils::OpenDatabaseL(
       
    65 		iDbNamedDatabase, 
       
    66 		iDbs, 
       
    67 		iIndexType, 
       
    68 		iIndex, 
       
    69 		tunnelingType));
       
    70     if (err == KErrNone)
       
    71     {
       
    72         iIsConnected = ETrue;
       
    73     }
       
    74 
       
    75     return err;
       
    76 }
       
    77 
       
    78 
       
    79 TInt CEapSimUiConnection::Close()
       
    80 {
       
    81     if (iIsConnected)
       
    82     {
       
    83         iDbNamedDatabase.Close();
       
    84         iDbs.Close();
       
    85     }
       
    86     iIsConnected = EFalse;
       
    87 
       
    88     return KErrNone;
       
    89 }
       
    90 
       
    91 
       
    92 CEapSimUiDataConnection * CEapSimUiConnection::GetDataConnection()
       
    93 {
       
    94     if (!iDataConn)
       
    95     {
       
    96         iDataConn = new CEapSimUiDataConnection(this);
       
    97     }
       
    98 
       
    99     return iDataConn;
       
   100 }
       
   101 
       
   102 TInt CEapSimUiConnection::GetDatabase(RDbNamedDatabase & aDatabase)
       
   103 {
       
   104     if (iIsConnected == EFalse)
       
   105     {
       
   106         return KErrSessionClosed;
       
   107     }
       
   108 
       
   109     aDatabase = iDbNamedDatabase;
       
   110     return KErrNone;
       
   111 }
       
   112 
       
   113 
       
   114 TIndexType CEapSimUiConnection::GetIndexType()
       
   115 {
       
   116     return iIndexType;
       
   117 }
       
   118 
       
   119 
       
   120 TInt CEapSimUiConnection::GetIndex()
       
   121 {
       
   122     return iIndex;
       
   123 }
       
   124 
       
   125 
       
   126 TInt CEapSimUiConnection::GetTunnelingType()
       
   127 {
       
   128     return iTunnelingType;
       
   129 }
       
   130 
       
   131 // End of file