javaextensions/satsa/apdu/src/javaapduconnection.h
branchRCL_3
changeset 19 04becd199f91
equal deleted inserted replaced
16:f5050f1da672 19: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 JAVAAPDUCONNECTION_H
       
    20 #define JAVAAPDUCONNECTION_H
       
    21 
       
    22 #include <jni.h>
       
    23 #include <errno.h>
       
    24 #include "com_nokia_mj_impl_satsa_APDUConnectionImpl.h"
       
    25 #include "com_nokia_mj_impl_properties_satsa_SmartCardSlots.h"
       
    26 #include "javaapduconnectionbase.h"  // Abstract interface class to bifurcate the implementation
       
    27 namespace java
       
    28 {
       
    29 namespace satsa
       
    30 {
       
    31 
       
    32 /**
       
    33  *  JavaApduConnection offers methods for openning connection,
       
    34  *  exchanging apdu commands and manage pins and closing connection
       
    35  */
       
    36 
       
    37 class JavaApduConnection
       
    38 {
       
    39 
       
    40 public:
       
    41     void Initialize();
       
    42     /**
       
    43      * Method to perform various pin related functions(enable pin, disable pin etc)
       
    44      *
       
    45      * @param[in]
       
    46      * @param[out]
       
    47      * @return int The success or Failure value.
       
    48      * @exception ?
       
    49      */
       
    50 
       
    51     int DoPinMethod(JNIEnv& aJni, jclass aPeer, int aHandle,
       
    52                     int aPinMethodType, int aPinID);
       
    53     /**
       
    54      * Method to exchange apdu commands.
       
    55      *
       
    56      *
       
    57      * @param[in]
       
    58      * @param[out]
       
    59      * @return
       
    60      * @exception ?
       
    61      */
       
    62     int ExchangeAPDU(JNIEnv& aJni, jclass aPeer, int aHandle,
       
    63                      jbyteArray aCommandAPDU);
       
    64 
       
    65     /**
       
    66      * This function unblocks the blocing Pin.
       
    67      * @param[in]
       
    68      * @param[out]
       
    69      * @return
       
    70      * @exception ?
       
    71      */
       
    72     int UnblockPin(JNIEnv& aJni, jclass aPeer, int aHandle, int aBlockedPinID,
       
    73                    int aUnblockingPinID);
       
    74 
       
    75     /**
       
    76      * This function gets the answer to reset operation
       
    77      * @param[in]
       
    78      * @param[out]
       
    79      * @return
       
    80      * @exception ?
       
    81      */
       
    82     std::wstring GetATR();
       
    83 
       
    84     /**
       
    85      * This function creates the connection object
       
    86      * @param[in]
       
    87      * @param[out]
       
    88      * @return
       
    89      * @exception ?
       
    90      */
       
    91     int Create(JNIEnv& aJni, jstring aUri, jstring aName, jstring aVendor,
       
    92                jstring aVersion, jstring aDomain, jstring aRootCertHash,
       
    93                jstring aSigningCertHash, int* TypeArray, jobject aPeer,
       
    94                jmethodID aHandleEventMethod);
       
    95 
       
    96     /**
       
    97      * This function creates the slot connection
       
    98      * @param[in]
       
    99      * @param[out]
       
   100      * @return
       
   101      * @exception ?
       
   102      */
       
   103     int CreateSlot(JNIEnv& aJni, jobject aPeer);
       
   104 
       
   105     /**
       
   106      * This function fetches the slot information
       
   107      * @param[in]
       
   108      * @param[out]
       
   109      * @return
       
   110      * @exception ?
       
   111      */
       
   112     std::wstring GetSlot();
       
   113 
       
   114     /**
       
   115      * This function opens a connection to a smart card application
       
   116      * @param[in]
       
   117      * @param[out]
       
   118      * @return
       
   119      * @exception ?
       
   120      */
       
   121     int Open(JNIEnv& aJni, jclass aPeer, int aHandle);
       
   122 
       
   123     /**
       
   124      * This function closes all connections to a smart card
       
   125      * @param[in]
       
   126      * @param[out]
       
   127      * @return
       
   128      * @exception ?
       
   129      */
       
   130     int Close(JNIEnv& aJni, jclass aPeer, int aHandle);
       
   131 
       
   132     // Destructor
       
   133     ~JavaApduConnection();
       
   134 
       
   135     static JavaApduConnection* getInstance();
       
   136 
       
   137 private:
       
   138     // Constructor
       
   139     JavaApduConnection();
       
   140 
       
   141 private:
       
   142 
       
   143     JavaApduConnectionBase* mApduConnBase; // the abstract interface
       
   144 
       
   145 };
       
   146 
       
   147 } // namespace satsa
       
   148 } // namespace java
       
   149 
       
   150 #endif // JAVAAPDUCONNECTION_H
       
   151