- Fix the prevent problems.
[platform/core/connectivity/smartcard-service.git] / client / include / Reader.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 READER_H_
19 #define READER_H_
20
21 /* standard library header */
22
23 /* SLP library header */
24
25 /* local header */
26 #include "smartcard-types.h"
27 #ifdef __cplusplus
28 #include "ReaderHelper.h"
29 #include "Session.h"
30 #endif /* __cplusplus */
31
32 #ifdef __cplusplus
33 namespace smartcard_service_api
34 {
35         class Reader: public ReaderHelper
36         {
37         private:
38                 void *context;
39                 void *handle;
40                 ByteArray packageCert;
41                 /* temporary data for sync function */
42                 int error;
43                 Session *openedSession;
44
45                 Reader(void *context, const char *name, void *handle);
46
47                 void unavailable();
48
49                 static bool dispatcherCallback(void *message);
50                 void getPackageCert();
51
52         public:
53                 ~Reader();
54
55                 void closeSessions();
56
57                 int openSession(openSessionCallback callback, void *userData);
58                 SessionHelper *openSessionSync();
59
60                 friend class SEService;
61                 friend class ClientDispatcher;
62         };
63
64 } /* namespace smartcard_service_api */
65 #endif /* __cplusplus */
66
67 /* export C API */
68 #ifdef __cplusplus
69 extern "C"
70 {
71 #endif /* __cplusplus */
72
73 const char *reader_get_name(reader_h handle);
74 se_service_h reader_get_se_service(reader_h handle);
75 bool reader_is_secure_element_present(reader_h handle);
76 int reader_open_session(reader_h handle, reader_open_session_cb callback, void *userData);
77 session_h reader_open_session_sync(reader_h handle);
78 void reader_close_sessions(reader_h handle);
79 void reader_destroy_instance(reader_h handle);
80
81 #ifdef __cplusplus
82 }
83 #endif /* __cplusplus */
84
85 #endif /* READER_H_ */