Apply tizen 2.4 smartcard-service
[platform/core/connectivity/smartcard-service.git] / common / include / ReaderHelper.h
index 4e49116..259044a 100644 (file)
@@ -1,25 +1,25 @@
 /*
-* Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
+ * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 
 #ifndef READERHELPER_H_
 #define READERHELPER_H_
 
 /* standard library header */
 #include <vector>
+#include <string>
 
 /* SLP library header */
 
@@ -33,30 +33,34 @@ namespace smartcard_service_api
 {
        class SEServiceHelper;
 
-       typedef void (*openSessionCallback)(SessionHelper *session, int error, void *userData);
+       typedef void (*openSessionCallback)(SessionHelper *session, int error,
+               void *userData);
 
        class ReaderHelper : public Synchronous
        {
        protected:
-               char name[30];
-               vector<SessionHelper *> sessions;
                SEServiceHelper *seService;
+               string name;
                bool present;
+               vector<SessionHelper *> sessions;
 
-               ReaderHelper();
+               ReaderHelper() : seService(NULL), present(false) {}
+               ReaderHelper(const char *name) : seService(NULL), name(name),
+                       present(false) {}
                virtual ~ReaderHelper() {}
 
        public:
-               inline const char *getName() { return name; }
-               inline SEServiceHelper *getSEService() { return seService; }
-               inline bool isSecureElementPresent() { return present; }
+               inline const char *getName() const { return name.c_str(); }
+               inline SEServiceHelper *getSEService() const { return seService; }
+               inline bool isSecureElementPresent() const { return present; }
 
                virtual void closeSessions()
                        throw(ErrorIO &, ErrorIllegalState &) = 0;
 
                virtual int openSession(openSessionCallback callback, void *userData) = 0;
                virtual SessionHelper *openSessionSync()
-                       throw(ErrorIO &, ErrorIllegalState &, ErrorIllegalParameter &, ErrorSecurity &)= 0;
+                       throw(ExceptionBase &, ErrorIO &, ErrorIllegalState &,
+                               ErrorIllegalParameter &, ErrorSecurity &)= 0;
        };
 
 } /* namespace smartcard_service_api */