Change some indent for Tizen 3.0 Coding rule
[platform/core/api/smartcard.git] / include / Reader.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
17 #ifndef READER_H_
18 #define READER_H_
19
20 /* standard library header */
21 #include <glib.h>
22 #include <gio/gio.h>
23
24 /* SLP library header */
25
26 /* local header */
27 #include "smartcard-types.h"
28 #ifdef __cplusplus
29 #include "ReaderHelper.h"
30 #include "Session.h"
31 #endif /* __cplusplus */
32
33 #ifdef __cplusplus
34 namespace smartcard_service_api
35 {
36         class Reader : public ReaderHelper
37         {
38 private:
39                 void *context;
40                 void *handle;
41                 void *proxy;
42
43                 Reader(void *context, const char *name, void *handle);
44                 ~Reader();
45
46                 inline void unavailable() { present = false; }
47                 static void reader_open_session_cb(GObject *source_object,
48                         GAsyncResult *res, gpointer user_data);
49
50 public:
51                 void closeSessions()
52                         throw(ErrorIO &, ErrorIllegalState &);
53
54                 int openSession(openSessionCallback callback, void *userData);
55                 SessionHelper *openSessionSync()
56                         throw(ExceptionBase &, ErrorIO &, ErrorIllegalState &,
57                                 ErrorIllegalParameter &, ErrorSecurity &);
58
59                 void *getHandle() { return handle; }
60
61                 friend class SEService;
62         };
63 } /* namespace smartcard_service_api */
64 #endif /* __cplusplus */
65
66 /* export C API */
67 #ifdef __cplusplus
68 extern "C"
69 {
70 #endif /* __cplusplus */
71
72 int reader_get_name(reader_h handle, char** reader_name);
73 int reader_is_secure_element_present(reader_h handle, bool* is_present);
74 int reader_open_session_sync(reader_h handle, int *session_handle);
75 int reader_close_sessions(reader_h handle);
76 ///
77
78 int reader_open_session(reader_h handle, reader_open_session_cb callback,
79         void *userData);
80 se_service_h reader_get_se_service(reader_h handle);
81 __attribute__((deprecated)) void reader_destroy_instance(reader_h handle);
82
83 #ifdef __cplusplus
84 }
85 #endif /* __cplusplus */
86
87 #endif /* READER_H_ */