javaextensions/satsa/apdu/src/javaapduconnection.cpp
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 #include "logger.h"
       
    20 #include "javaapduconnection.h"
       
    21 
       
    22 namespace java
       
    23 {
       
    24 namespace satsa
       
    25 {
       
    26 
       
    27 JavaApduConnection::JavaApduConnection() :
       
    28         mApduConnBase(0)
       
    29 {
       
    30 
       
    31 }
       
    32 
       
    33 JavaApduConnection* JavaApduConnection::getInstance()
       
    34 {
       
    35     JELOG2(ESATSA);
       
    36     JavaApduConnection* apduConn = new JavaApduConnection();
       
    37     apduConn->Initialize();
       
    38     return apduConn;
       
    39 
       
    40 }
       
    41 
       
    42 void JavaApduConnection::Initialize()
       
    43 {
       
    44     JELOG2(ESATSA);
       
    45     mApduConnBase = JavaApduConnectionBase::getInstance();
       
    46 
       
    47 }
       
    48 
       
    49 JavaApduConnection::~JavaApduConnection()
       
    50 {
       
    51     JELOG2(ESATSA);
       
    52     delete mApduConnBase;
       
    53     mApduConnBase = NULL;
       
    54 
       
    55 }
       
    56 
       
    57 int JavaApduConnection::Create(JNIEnv& aJni, jstring aUri, jstring aName,
       
    58                                jstring aVendor, jstring aVersion, jstring aDomain,
       
    59                                jstring aRootCertHash, jstring aSigningCertHash, int* TypeArray,
       
    60                                jobject aPeer, jmethodID aHandleEventMethod)
       
    61 {
       
    62     JELOG2(ESATSA);
       
    63     return mApduConnBase->CreateConn(aJni, aPeer, aHandleEventMethod, aUri,
       
    64                                      aName, aVendor, aVersion, aDomain, aRootCertHash, aSigningCertHash,
       
    65                                      TypeArray);
       
    66 }
       
    67 
       
    68 int JavaApduConnection::CreateSlot(JNIEnv& aJni, jobject aPeer)
       
    69 {
       
    70     JELOG2(ESATSA);
       
    71     return mApduConnBase->CreateSlot(aJni, aPeer);
       
    72 }
       
    73 
       
    74 int JavaApduConnection::Open(JNIEnv& aJni, jclass aPeer, int aHandle)
       
    75 {
       
    76     JELOG2(ESATSA);
       
    77     return mApduConnBase->Open(aJni, aPeer, aHandle);
       
    78 }
       
    79 
       
    80 int JavaApduConnection::DoPinMethod(JNIEnv& aJni, jclass aPeer, int aHandle,
       
    81                                     int aPinMethodType, int aPinID)
       
    82 {
       
    83     JELOG2(ESATSA);
       
    84     return mApduConnBase->DoPinMethod(aJni, aPeer, aHandle, aPinMethodType,
       
    85                                       aPinID);
       
    86 }
       
    87 
       
    88 int JavaApduConnection::ExchangeAPDU(JNIEnv& aJni, jclass aPeer, int aHandle,
       
    89                                      jbyteArray aCommandAPDU)
       
    90 {
       
    91     JELOG2(ESATSA);
       
    92     return mApduConnBase->ExchangeAPDU(aJni, aPeer, aHandle, aCommandAPDU);
       
    93 }
       
    94 
       
    95 int JavaApduConnection::UnblockPin(JNIEnv& aJni, jclass aPeer, int aHandle,
       
    96                                    int aBlockedPinID, int aUnblockingPinID)
       
    97 {
       
    98     JELOG2(ESATSA);
       
    99     return mApduConnBase->UnblockPin(aJni, aPeer, aHandle, aBlockedPinID,
       
   100                                      aUnblockingPinID);
       
   101 }
       
   102 
       
   103 std::wstring JavaApduConnection::GetATR()
       
   104 {
       
   105     JELOG2(ESATSA);
       
   106     return mApduConnBase->GetATR();
       
   107 }
       
   108 
       
   109 std::wstring JavaApduConnection::GetSlot()
       
   110 {
       
   111     JELOG2(ESATSA);
       
   112     return mApduConnBase->GetSlot();
       
   113 }
       
   114 
       
   115 int JavaApduConnection::Close(JNIEnv& aJni, jclass aPeer, int aHandle)
       
   116 {
       
   117     JELOG2(ESATSA);
       
   118     return mApduConnBase->Close(aJni, aPeer, aHandle);
       
   119 }
       
   120 
       
   121 } // namespace satsa
       
   122 } // namespace java
       
   123 
       
   124