Update the latest source
[framework/system/smartcard-plugin-uicc.git] / include / UICCTerminal.h
1 /*
2 * Copyright (c) 2012 Samsung Electronics Co., Ltd All Rights Reserved
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17
18 #ifndef UICCTERMINAL_H_
19 #define UICCTERMINAL_H_
20
21 /* standard library header */
22 #include <vector>
23 #include <map>
24
25 /* SLP library header */
26 #include "tapi_common.h"
27 #include "ITapiSim.h"
28
29 /* local header */
30 #include "Lock.h"
31 #include "Terminal.h"
32
33 using namespace std;
34
35 namespace smartcard_service_api
36 {
37         class UICCTerminal: public Terminal
38         {
39         private:
40                 PMutex mutex;
41                 struct tapi_handle *handle;
42
43                 /* temporary data for sync function */
44                 ByteArray response;
45                 int error;
46
47                 UICCTerminal();
48                 ~UICCTerminal();
49
50 //              static int uiccResponseCallback(TelTapiEvent_t *event);
51
52                 static void uiccTransmitAPDUCallback(TapiHandle *handle, int result, void *data, void *user_data);
53                 static void uiccGetAtrCallback(TapiHandle *handle, int result, void *data, void *user_data);
54                 static void uiccStatusNotiCallback(TapiHandle *handle, const char *noti_id, void *data, void *user_data);
55
56         public:
57                 static UICCTerminal *getInstance();
58
59                 bool initialize();
60                 void finalize();
61
62                 bool isSecureElementPresence();
63
64                 int transmitSync(ByteArray command, ByteArray &response);
65                 int getATRSync(ByteArray &atr);
66
67                 int transmit(ByteArray command, terminalTransmitCallback callback, void *userParam) { return -1; };
68                 int getATR(terminalGetATRCallback callback, void *userParam) { return -1; }
69
70 //              friend int uiccResponseCallback(TelTapiEvent_t *event);
71                 friend void uiccTransmitAPDUCallback(TapiHandle *handle, int result, void *data, void *user_data);
72                 friend void uiccGetAtrCallback(TapiHandle *handle, int result, void *data, void *user_data);
73                 friend void uiccStatusNotiCallback(TapiHandle *handle, const char *noti_id, void *data, void *user_data);
74         };
75
76 } /* namespace smartcard_service_api */
77 #endif /* UICCTERMINAL_H_ */