Modify for NFC operation
[platform/core/connectivity/smartcard-plugin-nfc.git] / include / NFCTerminal.h
1 /*
2 * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
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 #ifndef NFCTERMINAL_H_
17 #define NFCTERMINAL_H_
18
19 /* standard library header */
20
21 /* Tizen library header */
22 #include "nfc.h"
23 #include "nfc_internal.h"
24 #include <vconf.h>
25
26 /* local header */
27 #include "Terminal.h"
28 #include "Lock.h"
29
30 namespace smartcard_service_api
31 {
32         class NFCTerminal: public Terminal
33         {
34         private:
35                 PMutex mutex;
36                 nfc_se_h seHandle;
37                 bool present;
38                 int referred;
39
40                 NFCTerminal();
41                 ~NFCTerminal();
42
43                 static void onActivationChanged(bool activated, void *userData);
44
45         public:
46                 static NFCTerminal *getInstance();
47
48                 bool initialize();
49                 void finalize();
50
51                 bool open();
52                 void close();
53
54                 bool isSecureElementPresence() const { return present; }
55
56                 int transmitSync(const ByteArray &command, ByteArray &response);
57                 int getATRSync(ByteArray &atr);
58
59                 int transmit(const ByteArray &command, terminalTransmitCallback callback, void *userParam) { return SCARD_ERROR_NOT_SUPPORTED; };
60                 int getATR(terminalGetATRCallback callback, void *userParam) { return SCARD_ERROR_NOT_SUPPORTED; }
61         };
62 } /* namespace smartcard_service_api */
63 #endif /* NFCTERMINAL_H_ */