wim/WimServer/inc/WimSimFileHandler.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:  WIM SIM Certificate handler. Handles WIMI's ReadFile requests
       
    15 *               to card not supporting logical channels
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 
       
    21 #ifndef CWIMSIMFILEHANDLER_H
       
    22 #define CWIMSIMFILEHANDLER_H
       
    23 
       
    24 //  INCLUDES
       
    25 #include <rmmcustomapi.h>
       
    26 
       
    27 // CONSTANTS
       
    28 const TUint KMaxSimFileSize = 10000; // Maximum size allocated for file
       
    29 
       
    30 // CLASS DECLARATION
       
    31 
       
    32 /**
       
    33 *  Class for handling SIM file reading. Calls CustomAPI's function
       
    34 *  to read the file.
       
    35 *  
       
    36 *  @since Series60 2.1
       
    37 */
       
    38 class CWimSimFileHandler : public CActive
       
    39     {
       
    40     public:  // Constructors and destructor
       
    41         
       
    42         /**
       
    43         * Two-phased constructor.
       
    44         */
       
    45         static CWimSimFileHandler* NewL();
       
    46         
       
    47         /**
       
    48         * Destructor.
       
    49         */
       
    50         virtual ~CWimSimFileHandler();
       
    51 
       
    52     public: // New functions
       
    53         
       
    54         /**
       
    55         * Reads SIM file
       
    56         * @param aReader     Reader ID
       
    57         * @param aPath       Path to the file to read
       
    58         * @param aOffset     Offset from the beginning of the file.
       
    59         * If the Elementary File pointed to by FileID is linear fixed or cyclic 
       
    60         * (this is the case for EF DIR), then the least significant byte of 
       
    61         * aOffSet denotes the record number, while the most significant byte in
       
    62         * aOffSet denotes the start byte within that record. The record number 
       
    63         * starts fron 1 and therefore 0x0100 is sent as the offset.
       
    64         * @param aSize       Amount of data to read, aSize = 0 means that whole
       
    65         *                    file must be read
       
    66         * @return void
       
    67         */
       
    68         void ReadSimFileL( TUint8 aReader,
       
    69                            const TDes8& aPath,
       
    70                            TUint16 aOffset,
       
    71                            TUint16 aSize );
       
    72         
       
    73     private:
       
    74 
       
    75         /**
       
    76         * C++ default constructor.
       
    77         */
       
    78         CWimSimFileHandler();
       
    79 
       
    80         /**
       
    81         * By default Symbian 2nd phase constructor is private.
       
    82         */
       
    83         void ConstructL();
       
    84 
       
    85         /**
       
    86         * Open CustomAPI for communication
       
    87         * @return void
       
    88         */
       
    89         void OpenCustomApiL();
       
    90 
       
    91         /**
       
    92         * Handle received file
       
    93         * @return void
       
    94         */
       
    95         void FileReceived();
       
    96 
       
    97         /**
       
    98         * Wait until asynchronous call is completed
       
    99         * @return void
       
   100         */
       
   101         void SetActiveAndWait();
       
   102 
       
   103         /**
       
   104         * From CActive. Handles asynchrounous file reading response
       
   105         * @return void
       
   106         */
       
   107         void RunL();
       
   108 
       
   109         /**
       
   110         * From CActive. Cancellation function
       
   111         * @return void
       
   112         */
       
   113         void DoCancel();
       
   114 
       
   115         
       
   116     private:    // Data
       
   117         // Pointer to CustomAPI instance. Owned.
       
   118         RMmCustomAPI*               iCustomApi;
       
   119         // Pointer to Etel server. Owned.
       
   120         RTelServer*                 iEtelServer;
       
   121         // Pointer to response bytes buffer. Owned.
       
   122         HBufC8*                     iResponseBytesBuf;
       
   123         // Pointer to response bytes pointer. Owned.
       
   124         TPtr8*                      iResponseBytesPtr;
       
   125         // Reader number
       
   126         TUint8                      iReaderNumber;
       
   127         // Synchronous wait for async request
       
   128         CActiveSchedulerWait        iWait;
       
   129         // SIM file info structure
       
   130         RMmCustomAPI::TSimFileInfo  iSimFileInfo;
       
   131 
       
   132     };
       
   133 
       
   134 #endif      // CWIMSIMFILEHANDLER_H
       
   135     
       
   136 //End of File