|
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 #ifndef JAVAAPDUCONNECTIONIMPL_H |
|
19 #define JAVAAPDUCONNECTIONIMPL_H |
|
20 |
|
21 #include "javaapduconnectionbase.h" |
|
22 #include "cstsconnection.h" |
|
23 #include "cstsresphandler.h" |
|
24 #include "cstsmidletinfo.h" |
|
25 #include "functionserver.h" |
|
26 |
|
27 namespace java |
|
28 { |
|
29 namespace satsa |
|
30 { |
|
31 |
|
32 /** |
|
33 * JavaApduConnectionImpl implements JavaApduConnectionBase. |
|
34 * It offers methods for openning connection, |
|
35 * exchanging apdu commands and manage pins and closing connection |
|
36 */ |
|
37 class JavaApduConnectionImpl: public JavaApduConnectionBase |
|
38 { |
|
39 |
|
40 public: |
|
41 JavaApduConnectionImpl(); |
|
42 ~JavaApduConnectionImpl(); |
|
43 |
|
44 // Method to perform various pin related functions(enable pin, disable pin etc) |
|
45 int DoPinMethod(JNIEnv& aJni, jclass aPeer, int aHandle, |
|
46 int aPinMethodType, int aPinID); |
|
47 |
|
48 //Method to exchange apdu commands. |
|
49 int ExchangeAPDU(JNIEnv& aJni, jclass aPeer, int aHandle, |
|
50 jbyteArray aCommandAPDU); |
|
51 |
|
52 // This function unblocks the blocing Pin. |
|
53 int UnblockPin(JNIEnv& aJni, jclass aPeer, int aHandle, int aBlockedPinID, |
|
54 int aUnblockingPinID); |
|
55 |
|
56 // This function gets the answer to reset operation |
|
57 std::wstring GetATR(); |
|
58 |
|
59 // This function creates the connection object |
|
60 int CreateConn(JNIEnv& aJni, jobject aPeer, |
|
61 jmethodID aHandleEventMethod, jstring aUri, jstring aName, |
|
62 jstring aVendor, jstring aVersion, jstring aDomain, |
|
63 jstring aRootCertHash, jstring aSigningCertHash, |
|
64 TInt* aReturnValueArray); |
|
65 |
|
66 // This function creates the connection object |
|
67 int CreateSlot(JNIEnv& aJni, jobject aPeer); |
|
68 |
|
69 // This function creates the connection object |
|
70 std::wstring GetSlot(); |
|
71 |
|
72 // This function opens a connection to a smart card application |
|
73 int Open(JNIEnv& aJni, jclass aPeer, int aHandle); |
|
74 |
|
75 // This function closes all connection to a smart card |
|
76 int Close(JNIEnv& aJni, jclass aPeer, int aHandle); |
|
77 |
|
78 private: |
|
79 /** |
|
80 * Does ChangePinL, DisablePinL, EnablePinL or EnterPinL operation |
|
81 * to the given connection object depending on the pin method type |
|
82 * parameter. |
|
83 * |
|
84 * @param aConnection Pointer to connection. |
|
85 * @param aPinMethodType Type of the pin method, which will be called |
|
86 * @param aPinID PinID number |
|
87 */ |
|
88 void DoPinMethodL(CSTSConnection* aConnection, TInt aPinMethodType, |
|
89 TInt aPinID); |
|
90 |
|
91 void Create(JNIEnv& aJni, jobject aPeer, jmethodID aHandleEventMethod, |
|
92 jstring aUri, jstring aName, jstring aVendor, jstring aVersion, |
|
93 jstring aDomain, jstring aRootCertHash, jstring aSigningCertHash, |
|
94 TInt* aReturnValueArray); |
|
95 |
|
96 void CreateSlotConn(JNIEnv& aJni, jobject aPeer); |
|
97 |
|
98 private: |
|
99 |
|
100 CSTSConnection* iConnection; |
|
101 CSTSConnection* mSlotConn; |
|
102 |
|
103 }; |
|
104 |
|
105 } // namespace satsa |
|
106 } // namespace java |
|
107 #endif // JAVAAPDUCONNECTIONIMPL_H |
|
108 |