javaextensions/satsa/apdu/src.s60/cstscardoperationsfacade.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 CSTSCARDOPERATIONSFACADE_H
       
    20 #define CSTSCARDOPERATIONSFACADE_H
       
    21 
       
    22 //  INCLUDES
       
    23 #include <e32base.h>
       
    24 #include <rmmcustomapi.h>
       
    25 
       
    26 namespace java
       
    27 {
       
    28 namespace satsa
       
    29 {
       
    30 
       
    31 // CLASS DECLARATION
       
    32 /**
       
    33  *  Facade type of class for handling card related operations.
       
    34  *
       
    35  *
       
    36  *  @since 3.0
       
    37  */
       
    38 
       
    39 NONSHARABLE_CLASS(CSTSCardOperationsFacade): public CBase
       
    40 {
       
    41 public: // Constructors and destructor
       
    42 
       
    43     /**
       
    44      * Two-phased constructor.
       
    45      */
       
    46     static CSTSCardOperationsFacade* NewL();
       
    47 
       
    48     /**
       
    49      * Destructor.
       
    50      */
       
    51     virtual ~CSTSCardOperationsFacade();
       
    52 
       
    53 public: // New functions
       
    54 
       
    55     /**
       
    56      * Send gived APDU to card asynchronously
       
    57      * @since 3.0
       
    58      * @param aStatus Status
       
    59      * @param aCardReaderId Used reader(=slot)
       
    60      * @param aCmdData Standard type of APDU message
       
    61      */
       
    62     void SendAPDUReq(TRequestStatus& aStatus,
       
    63                      TUint8 aCardReaderId,
       
    64                      TDes8* aCmdData);
       
    65 
       
    66     /**
       
    67      * Gets response bytes. Asychronous SendAPDUReq must be called and it
       
    68      * must be returned before this method is called.
       
    69      * @since 3.0
       
    70      * @param aRspData Descriptor where data will be saved
       
    71      */
       
    72     void GetResponseBytes(TDes8* aRspData);
       
    73 
       
    74     /**
       
    75      * Cancels asynchronous APDU sending.
       
    76      * @since 3.0
       
    77      */
       
    78     void CancelAPDUReq();
       
    79 
       
    80     /**
       
    81      * Gets Answer To Reset bytes from the card.
       
    82      * @since 3.0
       
    83      * @param aATR Returned ATR bytes
       
    84      * @param aReader Used reader.
       
    85      */
       
    86     void GetATR(TDes8& aATR, TUint8 aReader);
       
    87 
       
    88     /**
       
    89      * Checks is phone running in GSM network or not
       
    90      * @since 3.0
       
    91      */
       
    92     TBool IsGSMNetwork() const;
       
    93 
       
    94 private:
       
    95 
       
    96     /**
       
    97      * C++ default constructor.
       
    98      */
       
    99     CSTSCardOperationsFacade();
       
   100 
       
   101     /**
       
   102      * By default Symbian 2nd phase constructor is private.
       
   103      */
       
   104     void ConstructL();
       
   105 
       
   106     /**
       
   107      * Generates info part and does apduReq
       
   108      */
       
   109     void DoSend(TRequestStatus& aStatus,
       
   110                 TUint8 aServiceType,
       
   111                 TUint8 aReader,
       
   112                 TDes8* aCmdData);
       
   113 
       
   114 private: // Data
       
   115     RMmCustomAPI iCustomAPI;
       
   116 
       
   117     RTelServer iSession;
       
   118     RMobilePhone iPhone;
       
   119 
       
   120     //buffer for TApdu info field, owned
       
   121     HBufC8* iInfoBuf;
       
   122     //points to info buffer
       
   123     TPtr8 iInfoPtr;
       
   124 
       
   125     RMmCustomAPI::TApdu* iApduReq; //owned
       
   126 
       
   127     //buffer for command and response data, owned
       
   128     HBufC8* iDataBuf;
       
   129     //points to data buffer
       
   130     TPtr8 iDataPtr;
       
   131 
       
   132     TBool iGSMNetwork;
       
   133 
       
   134 };
       
   135 
       
   136 } // namespace satsa
       
   137 } // namespace java
       
   138 #endif // CSTSCARDOPERATIONSFACADE_H
       
   139 // End of File
       
   140