wim/Scard/src/ScardReaderQuery.cpp
changeset 0 164170e6151a
equal deleted inserted replaced
-1:000000000000 0:164170e6151a
       
     1 /*
       
     2 * Copyright (c) 2003 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 "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:  This class returns all supported readers and reader groups.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 // INCLUDE FILES
       
    21 #include    "ScardBase.h"
       
    22 #include    "ScardReaderQuery.h"
       
    23 #include    "WimTrace.h"
       
    24 
       
    25 // ============================ MEMBER FUNCTIONS ===============================
       
    26 
       
    27 // -----------------------------------------------------------------------------
       
    28 // CScardReaderQuery::CScardReaderQuery
       
    29 // C++ default constructor can NOT contain any code, that
       
    30 // might leave.
       
    31 // -----------------------------------------------------------------------------
       
    32 //
       
    33 CScardReaderQuery::CScardReaderQuery()
       
    34     {
       
    35     }
       
    36 
       
    37 // -----------------------------------------------------------------------------
       
    38 // CScardReaderQuery::ConstructL
       
    39 // Symbian 2nd phase constructor can leave.
       
    40 // -----------------------------------------------------------------------------
       
    41 //
       
    42 void CScardReaderQuery::ConstructL( )
       
    43     {
       
    44     _WIMTRACE(_L("WIM|Scard|CScardReaderQuery::ConstructL|Begin"));
       
    45     }
       
    46     
       
    47 // -----------------------------------------------------------------------------
       
    48 // CScardReaderQuery::NewL
       
    49 // Two-phased constructor.
       
    50 // -----------------------------------------------------------------------------
       
    51 //
       
    52 EXPORT_C CScardReaderQuery* CScardReaderQuery::NewL()
       
    53     {
       
    54     _WIMTRACE(_L("WIM|Scard|CScardReaderQuery::NewL|Begin"));
       
    55     CScardReaderQuery* self = new( ELeave ) CScardReaderQuery;
       
    56     
       
    57     CleanupStack::PushL( self );
       
    58     //  ReaderQuery does not need writing access
       
    59     self->ConstructL();
       
    60     CleanupStack::Pop( self );
       
    61 
       
    62     return self;
       
    63     }
       
    64 
       
    65     
       
    66 // Destructor
       
    67 EXPORT_C CScardReaderQuery::~CScardReaderQuery()
       
    68     {
       
    69     _WIMTRACE(_L("WIM|Scard|CScardReaderQuery::~CScardReaderQuery|Begin"));
       
    70     }
       
    71 
       
    72 // -----------------------------------------------------------------------------
       
    73 // CScardReaderQuery::ListReadersL
       
    74 // List card readers belonging to given group
       
    75 // -----------------------------------------------------------------------------
       
    76 //
       
    77 EXPORT_C void CScardReaderQuery::ListReadersL(
       
    78     CArrayFixFlat<TScardReaderName>* aReaderList,
       
    79     const TScardReaderName& aGroupName )
       
    80     {
       
    81     _WIMTRACE(_L("WIM|Scard|CScardReaderQuery::ListReadersL|Begin"));
       
    82     TScardReaderName groupName( KGroupName );
       
    83 
       
    84     if ( !aGroupName.Compare( groupName ) ) //Check if group name is as given
       
    85         {
       
    86         TScardReaderName readerName( KReaderName );
       
    87         aReaderList->AppendL( readerName );
       
    88         }
       
    89     else // Group name is not what we expected 
       
    90         {
       
    91         User::Leave( KScErrNotSupported );
       
    92         }
       
    93     }
       
    94 // -----------------------------------------------------------------------------
       
    95 // CScardReaderQuery::ListGroupsL
       
    96 // List reader groups supported by Scard
       
    97 // -----------------------------------------------------------------------------
       
    98 //
       
    99 EXPORT_C void CScardReaderQuery::ListGroupsL(
       
   100    CArrayFixFlat<TScardReaderName>* aGroupList )
       
   101     {
       
   102     _WIMTRACE(_L("WIM|Scard|CScardReaderQuery::ListGroupsL|Begin"));
       
   103     TScardReaderName groupName( KGroupName );
       
   104     aGroupList->AppendL( groupName );
       
   105     }
       
   106 
       
   107 //  End of File