revise exported headers and cleanup headers
[platform/core/connectivity/smartcard-service.git] / common / include / ReaderHelper.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 READERHELPER_H_
18 #define READERHELPER_H_
19
20 #include <vector>
21 #include <string>
22
23 #include "Synchronous.h"
24 #include "SessionHelper.h"
25
26 using namespace std;
27
28 namespace smartcard_service_api
29 {
30         class SEServiceHelper;
31
32         typedef void (*openSessionCallback)(SessionHelper *session, int error,
33                 void *userData);
34
35         class EXPORT ReaderHelper : public Synchronous
36         {
37         protected:
38                 SEServiceHelper *seService;
39                 string name;
40                 bool present;
41                 vector<SessionHelper *> sessions;
42
43                 ReaderHelper() : seService(NULL), present(false) {}
44                 ReaderHelper(const char *name) : seService(NULL), name(name),
45                         present(false) {}
46                 virtual ~ReaderHelper() {}
47
48         public:
49                 inline const char *getName() const { return name.c_str(); }
50                 inline SEServiceHelper *getSEService() const { return seService; }
51                 inline bool isSecureElementPresent() const { return present; }
52
53                 virtual void closeSessions()
54                         throw(ErrorIO &, ErrorIllegalState &) = 0;
55
56                 virtual int openSession(openSessionCallback callback, void *userData) = 0;
57                 virtual SessionHelper *openSessionSync()
58                         throw(ExceptionBase &, ErrorIO &, ErrorIllegalState &,
59                                 ErrorIllegalParameter &, ErrorSecurity &)= 0;
60         };
61
62 } /* namespace smartcard_service_api */
63 #endif /* READERHELPER_H_ */