wim/WimPlugin/inc/WimAuthenticationObjectList.h
changeset 0 164170e6151a
equal deleted inserted replaced
-1:000000000000 0:164170e6151a
       
     1 /*
       
     2 * Copyright (c) 2002 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:  Authentication objects can be listed through this interface
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CWIMAUTHENTICATIONOBJECTLIST_H
       
    20 #define CWIMAUTHENTICATIONOBJECTLIST_H
       
    21 
       
    22 //  INCLUDES
       
    23 
       
    24 #include <mctauthobject.h>
       
    25 
       
    26 // FORWARD DECLARATIONS
       
    27 
       
    28 class CWimToken;
       
    29 class CWimPin;
       
    30 class CWimAuthenticationObject;
       
    31 
       
    32 // CLASS DECLARATION
       
    33 
       
    34 /**
       
    35 *  Represents an interface to authentication objects
       
    36 *
       
    37 *
       
    38 *  @lib   WimPlugin
       
    39 *  @since Series 60 2.1
       
    40 */
       
    41 
       
    42 class CWimAuthenticationObjectList : public CActive, 
       
    43                                      public MCTAuthenticationObjectList
       
    44     {
       
    45     public:
       
    46 
       
    47         /**
       
    48         * Default constructor
       
    49         * @param  aToken  A reference to current token
       
    50         * @return A pointer to this class
       
    51         */
       
    52         static CWimAuthenticationObjectList* NewL( CWimToken& aToken );
       
    53 
       
    54         /**
       
    55         * Destructor
       
    56         */
       
    57         virtual ~CWimAuthenticationObjectList();
       
    58 
       
    59     public: // From base class MCTTokenInterface
       
    60         
       
    61         /**
       
    62         * Returns a reference to current token.
       
    63         * @return A reference to current token.
       
    64         */
       
    65         MCTToken& Token();
       
    66 
       
    67     public: // From base class MCTAuthenticationObjectList
       
    68 
       
    69         /**
       
    70         * Lists authentication objects.
       
    71         * The caller of this function owns all parameters.
       
    72         * Altought asynchronous look and behaviour this call is 
       
    73         * synchronous.
       
    74         * @param  aAuthObjects (OUT) The returned authentication objects 
       
    75         *         will be appended to this array.
       
    76         * @param  aStatus (IN/OUT) This will be completed with the final 
       
    77         *         status code.
       
    78         *         KErrNone, if no errors detected. Note: thought none 
       
    79         *         authentication objects are found, it is also KErrNone
       
    80         *         KErrHardwareNotAvailable, if Wim card suddenly removed
       
    81         *         Any other system wide error code (e.g. KErrNoMemory)
       
    82         * @return void
       
    83         */
       
    84         void List( RMPointerArray<MCTAuthenticationObject>& aAuthObjects,
       
    85                    TRequestStatus& aStatus );
       
    86 
       
    87         /**
       
    88         * Cancels an ongoing List operation. Because List is synchronous, 
       
    89         * there is nothing to do here.
       
    90         * @return void
       
    91         */
       
    92         void CancelList();
       
    93 
       
    94     protected:  // From base class MCTTokenInterface
       
    95         
       
    96         virtual void DoRelease();
       
    97 
       
    98     private: // Constructors
       
    99 
       
   100         /**
       
   101         * Default constructor
       
   102         * @param  aToken  (IN) A reference to current token
       
   103         */
       
   104         CWimAuthenticationObjectList( CWimToken& aToken );
       
   105 
       
   106         // Second phase constructor
       
   107         void ConstructL();
       
   108     
       
   109     private: //from CActive 
       
   110        
       
   111        /**
       
   112         * Different phases are handled here.
       
   113         * @return void
       
   114         */
       
   115         void RunL();
       
   116         
       
   117         /**
       
   118         * Cancellation function
       
   119         * @return void
       
   120         */
       
   121         void DoCancel();
       
   122 
       
   123         /**
       
   124         * The active scheduler calls this function if this active 
       
   125         * object's RunL() function leaves. 
       
   126         * @param aError -Error code which caused this event
       
   127         * @return TInt  -Error code to active scheduler, is always KErrNone.
       
   128         */ 
       
   129         TInt RunError( TInt aError );    
       
   130 
       
   131     private:
       
   132     
       
   133         /**
       
   134         * Leavable authentication objects list function.
       
   135         * @return void
       
   136         */
       
   137         void CreateListL( TRequestStatus& aStatus );
       
   138 
       
   139         /**
       
   140         * Leavable authentication objects creation function.
       
   141         * @param  aToken (IN) Current token
       
   142         * @param  aPinModule (IN) Pin manager module
       
   143         * @param  aLabel (IN) A label for authentication object.
       
   144         * @param  aType (IN) Type of this authenticaion object.
       
   145         * @param  aHandle (IN) A handle of this authentication object.
       
   146         * @param  aStatus (IN) The status of this authentication object.
       
   147         * @return Pointer to CWimAuthenticationObject
       
   148         */
       
   149         CWimAuthenticationObject* MakeAuthObjectL( CWimToken& aToken,
       
   150                                                    CWimPin& aPinModule,
       
   151                                                    const TDesC& aLabel,
       
   152                                                    TUid aType,
       
   153                                                    TUint32 aHandle,
       
   154                                                    TUint32 aStatus );
       
   155         /**
       
   156         * Leavable authentication objects list function.
       
   157         * The caller of this function owns all parameters.
       
   158         * @param  aAuthObjects (OUT) The returned authentication objects 
       
   159         *         will be appended to this array.
       
   160         * @return void
       
   161         */
       
   162         void DoListL( RMPointerArray<MCTAuthenticationObject>& aAuthObjects );
       
   163 
       
   164         /**
       
   165         * Returns true or false indicating if token is removed or not
       
   166         * @return Boolean true or false
       
   167         */
       
   168         TBool TokenRemoved();
       
   169         
       
   170     
       
   171     private:
       
   172     
       
   173     enum TAuthObjPhase
       
   174             {
       
   175             ECreateList,
       
   176             ECreateListDone,
       
   177             EDoList
       
   178             };   
       
   179             
       
   180 
       
   181     private: // Data
       
   182 
       
   183         // A reference to current token.
       
   184         CWimToken& iToken;
       
   185 
       
   186         // Array of pointers to PIN modules. Not owned.
       
   187         const CArrayPtrFlat<CWimPin>* iPinNRs; 
       
   188         
       
   189         // An internal array of listed authentication objects.
       
   190         RPointerArray<CWimAuthenticationObject> iAuthObjects;
       
   191         
       
   192         //Used to handle Authobj interface making
       
   193         TAuthObjPhase                   iPhase;
       
   194         //Client status is stored here 
       
   195         TRequestStatus*                 iClientStatus;
       
   196         
       
   197         //Not Owned
       
   198         RMPointerArray<MCTAuthenticationObject>* iClientAuthObjects;
       
   199     };
       
   200 
       
   201 
       
   202 #endif      // CWIMAUTHENTICATIONOBJECTLIST_H   
       
   203             
       
   204 // End of File