wim/Scard/inc/ScardReaderRegistry.h
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:  Registry of smart card readers.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef CSCARDREADERREGISTRY_H
       
    21 #define CSCARDREADERREGISTRY_H
       
    22 
       
    23 //  INCLUDES
       
    24 #include "ScardDefs.h"
       
    25 #include <f32file.h>    // For RFs
       
    26 
       
    27 //  FORWARD DECLARATIONS
       
    28 class CScardServer;
       
    29 class MScardReader;
       
    30 class MScardReaderLauncher;
       
    31 class CScardAccessControl;
       
    32 
       
    33 // DATA TYPES
       
    34 struct TLauncherStruct
       
    35     {
       
    36     RFs         iSession;
       
    37     RLibrary    iLibrary;
       
    38     TGroupID    iGroupID;
       
    39     TReaderID   iReaderID;
       
    40     MScardReaderLauncher* iLauncher;
       
    41     TLauncherStruct();
       
    42     };
       
    43 
       
    44 // CLASS DECLARATION
       
    45 
       
    46 /**
       
    47 *  Reader registry.
       
    48 *  This class handles all server-side connections to the reader/card database. 
       
    49 *  Creates reader handlers, queries whether a given reader is supported and 
       
    50 *  gives lists of all the currently open or closed readers.
       
    51 *
       
    52 *  @lib Scard.lib
       
    53 *  @since Series60 2.1
       
    54 */
       
    55 class CScardReaderRegistry : public CBase
       
    56     {
       
    57     public:  // Constructors and destructor
       
    58 
       
    59         /**
       
    60         * Two-phased constructor.
       
    61         * @param aServer Pointer to CScardServer object
       
    62         */
       
    63         static CScardReaderRegistry* NewL( CScardServer* aServer ); 
       
    64 
       
    65         /**
       
    66         * Destructor.
       
    67         */
       
    68         virtual ~CScardReaderRegistry();
       
    69 
       
    70     public: // New functions
       
    71 
       
    72         /**
       
    73         * Loads reader handler module with given ID.
       
    74         * @param aReaderID Reader ID
       
    75         * @return pointer to MScardReader object
       
    76         */
       
    77         MScardReader* LoadReaderL( const TReaderID aReaderID );
       
    78 
       
    79         /**
       
    80         * Unload the reader module with given ID.
       
    81         * @param aReaderID Reader ID
       
    82         * @return void
       
    83         */
       
    84         void CloseReader( const TReaderID aReaderID );
       
    85 
       
    86         /**
       
    87         * Get ID for name.
       
    88         * @param aReaderName Reader name
       
    89         * @return TReaderID object
       
    90         */
       
    91         TReaderID ReaderID( const TScardReaderName& aReaderName );
       
    92 
       
    93         /**
       
    94         * Get name for ID.
       
    95         * @param aReaderID Reader ID
       
    96         * @return TScardDBName object
       
    97         */
       
    98         const TScardReaderName FriendlyName( const TReaderID aReaderID );
       
    99 
       
   100         /**
       
   101         * Is reader supported or not?
       
   102         * @param aReaderName Reader name
       
   103         * @return ETrue if supported, else EFalse
       
   104         */
       
   105         TBool IsSupported( const TScardReaderName& aReaderName );
       
   106 
       
   107         /**
       
   108         * Lists open readers.
       
   109         * @param aACList (OUT) List of readers
       
   110         * @return void
       
   111         */
       
   112         void ListOpenReadersL( CArrayFix<CScardAccessControl*>* aACList );
       
   113 
       
   114         /**
       
   115         * List the readers, which have not opened yet.
       
   116         * @param aACList (OUT) List of readers
       
   117         * @return void
       
   118         */
       
   119         void ListClosedReadersL( CArrayFix<TReaderID>* aIDList );
       
   120 
       
   121     private:
       
   122 
       
   123         /**
       
   124         * C++ default constructor.
       
   125         * @param aServer Pointer to CScardServer object
       
   126         */
       
   127         CScardReaderRegistry( CScardServer* aServer );
       
   128         
       
   129         /**
       
   130         * By default Symbian 2nd phase constructor is private.
       
   131         */
       
   132         void ConstructL();
       
   133     
       
   134         /**
       
   135         * Loads the reader handler dll corresponding to given parameters
       
   136         * @param aGroupID Group ID
       
   137         * @param aReaderID Reader ID
       
   138         * @return Pointer to MScardReaderLauncher object
       
   139         */
       
   140         MScardReaderLauncher* LoadFactoryModuleL( const TGroupID aGroupID,
       
   141                                                   const TReaderID aReaderID );
       
   142 
       
   143     private:    // Data
       
   144         // Handle for server. Not owned
       
   145         CScardServer*  iServer; 
       
   146         // Storage to keep track of loaded factories. Owned.
       
   147         CArrayFixFlat<TLauncherStruct>* iLaunchersInUse;
       
   148     };
       
   149 
       
   150 #endif      // CSCARDREADERREGISTRY_H
       
   151 
       
   152 // End of File