javaextensions/satsa/apdu/src.s60/cstsfiledatamanager.h
branchRCL_3
changeset 14 04becd199f91
equal deleted inserted replaced
13:f5050f1da672 14:04becd199f91
       
     1 /*
       
     2 * Copyright (c) 2008 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:
       
    15  *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CSTSFILEDATAMANAGER_H
       
    20 #define CSTSFILEDATAMANAGER_H
       
    21 
       
    22 //  INCLUDES
       
    23 #include <e32base.h>
       
    24 #include <JavaUtils.h>
       
    25 
       
    26 // FORWARD DECLARATIONS
       
    27 
       
    28 // CONSTANTS
       
    29 const TInt KSTSPINLabelMaxLength = 64;
       
    30 
       
    31 namespace java
       
    32 {
       
    33 namespace satsa
       
    34 {
       
    35 
       
    36 // CLASS DECLARATION
       
    37 class CSTSAuthType;
       
    38 
       
    39 /**
       
    40  *  Facade type of class for getting card file data
       
    41  *
       
    42  *  @since 3.0
       
    43  */
       
    44 NONSHARABLE_CLASS(CSTSFileDataManager): public CActive
       
    45 {
       
    46 
       
    47 private: // type definitions
       
    48     enum TSTSState
       
    49     {
       
    50         ENotReady,
       
    51         EReady,
       
    52         EInitializing,
       
    53         EGettingACIFSize,
       
    54         ERetrievingACIF,
       
    55         EGettingACFSize,
       
    56         ERetrievingACF,
       
    57         EGettingAuthObjsInfo,
       
    58         EGettingWimLabelAndPath
       
    59     };
       
    60 
       
    61 public: // Constructors and destructor
       
    62     /**
       
    63      * Two-phased constructor.
       
    64      */
       
    65     static CSTSFileDataManager* NewL();
       
    66 
       
    67     /**
       
    68      * Destructor.
       
    69      */
       
    70     virtual ~CSTSFileDataManager();
       
    71 
       
    72 public: // New functions
       
    73 
       
    74     /**
       
    75      * Makes initialization procedure
       
    76      * @since 3.0
       
    77      */
       
    78     void InitializeL();
       
    79 
       
    80     /**
       
    81      * Gets Access Control Index File content. InitializeL must be called
       
    82      * before this method is used.
       
    83      * @since 3.0
       
    84      * @return Reference to content of ACIF
       
    85      */
       
    86     const TDesC8& RetrieveACIFContentL();
       
    87 
       
    88     /**
       
    89      * Gets Access Control File content. InitializeL must be called
       
    90      * before this method is used.
       
    91      * @since 3.0
       
    92      * @param aFileIdOrPath File id or Path of ACF
       
    93      * @return Reference to content of ACF
       
    94      */
       
    95     const TDesC8& RetrieveACFContentL(const TDesC8& aFileIdOrPath);
       
    96 
       
    97     /**
       
    98      * Gets Authentication objects information from AODF file. InitializeL
       
    99      * must be called before this method is used.
       
   100      * @since 3.0
       
   101      * @param aAuthTypes Array where proper authTypes are put
       
   102      * @param aAuthIdList Reference to a list of auhtIds which
       
   103      *       information will be got
       
   104      */
       
   105     void GetAuthObjectsL(CArrayPtr< CSTSAuthType>* aAuthTypes,
       
   106                          const RArray<TInt>& aAuthIdList);
       
   107 
       
   108     /**
       
   109      * Gets WIM application label. InitializeL must be called
       
   110      * before this method is used.
       
   111      * @since 3.0
       
   112      * @return Reference to WIM label
       
   113      */
       
   114     const TDesC& RetrieveWIMLabelL();
       
   115 
       
   116     /**
       
   117      * Gets path to WIM/PKCS#15 application. InitializeL must be called
       
   118      * before this method is used.
       
   119      * @since 3.0
       
   120      * @return Reference to WIM path
       
   121      */
       
   122     const TDesC8& RetrieveWIMPathL();
       
   123 
       
   124 protected: // New functions
       
   125 
       
   126     /**
       
   127      * Protected construction to allow derivation
       
   128      */
       
   129     void ConstructL();
       
   130 
       
   131     /**
       
   132      * C++ default constructor.
       
   133      */
       
   134     CSTSFileDataManager();
       
   135 
       
   136     /**
       
   137      * Waits for request and leaves if error
       
   138      * @since 3.0
       
   139      */
       
   140     void WaitAndCheckL();
       
   141 
       
   142     /**
       
   143      * Retrieves WIM label and WIM path and saves values to
       
   144      * member buffer. Saves information that retrieve is done and
       
   145      * does not do it again if it has been already done.
       
   146      * @since 3.0
       
   147      */
       
   148     void doRetrieveWIMLabelAndPathL();
       
   149 
       
   150 protected: // Functions from base classes
       
   151 
       
   152     /**
       
   153      * From CActive RunL
       
   154      * @return void
       
   155      */
       
   156     void RunL();
       
   157 
       
   158     /**
       
   159      * From CActive Cancel request
       
   160      * @return void
       
   161      */
       
   162     void DoCancel();
       
   163 
       
   164     /**
       
   165      * From CActive RunError
       
   166      * @return The leave code
       
   167      */
       
   168     TInt RunError(TInt aError);
       
   169 
       
   170 private:
       
   171 
       
   172 protected: // Data
       
   173 
       
   174     // Access Control File data, owned
       
   175     HBufC8* iACFData;
       
   176     // Access Control Index file data, owned
       
   177     HBufC8* iACIFData;
       
   178     // WIM path buffer, owned
       
   179     HBufC8* iWimPath;
       
   180     // WIM label buffer, owned
       
   181     HBufC16* iWimLabel16;
       
   182 
       
   183     TBool iWimLabelAndPathDone;
       
   184 
       
   185     //interface of card file data retrieving methods
       
   186     CWimJavaUtils* iMidpProv; //owned
       
   187 
       
   188     //state of this object
       
   189     TSTSState iState;
       
   190 
       
   191     //error code
       
   192     TInt iError;
       
   193 
       
   194     // Waits until operation is complete, owned
       
   195     CActiveSchedulerWait* iWait;
       
   196 
       
   197 };
       
   198 
       
   199 } // namespace satsa
       
   200 } // namespace java
       
   201 #endif // CSTSFILEDATAMANAGER_H
       
   202 // End of File