2 * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
20 /* standard library header */
26 /* SLP library header */
29 #include "smartcard-types.h"
31 #include "ReaderHelper.h"
33 #endif /* __cplusplus */
36 namespace smartcard_service_api
38 class Reader: public ReaderHelper
46 /* temporary data for sync function */
48 Session *openedSession;
51 Reader(void *context, const char *name, void *handle);
54 inline void unavailable() { present = false; }
56 static void reader_open_session_cb(GObject *source_object,
57 GAsyncResult *res, gpointer user_data);
59 static bool dispatcherCallback(void *message);
64 throw(ErrorIO &, ErrorIllegalState &);
66 int openSession(openSessionCallback callback, void *userData);
67 SessionHelper *openSessionSync()
68 throw(ExceptionBase &, ErrorIO &, ErrorIllegalState &,
69 ErrorIllegalParameter &, ErrorSecurity &);
71 friend class SEService;
73 friend class ClientDispatcher;
76 } /* namespace smartcard_service_api */
77 #endif /* __cplusplus */
83 #endif /* __cplusplus */
85 const char *reader_get_name(reader_h handle);
86 se_service_h reader_get_se_service(reader_h handle);
87 bool reader_is_secure_element_present(reader_h handle);
88 int reader_open_session(reader_h handle, reader_open_session_cb callback,
90 session_h reader_open_session_sync(reader_h handle);
91 void reader_close_sessions(reader_h handle);
92 __attribute__((deprecated)) void reader_destroy_instance(reader_h handle);
96 #endif /* __cplusplus */
98 #endif /* READER_H_ */