Revert implementation and add new function for fix side effect 07/80007/2 accepted/tizen/common/20160714.153504 accepted/tizen/ivi/20160714.064435 accepted/tizen/mobile/20160714.064428 accepted/tizen/tv/20160714.064431 accepted/tizen/wearable/20160714.064440 submit/tizen/20160714.062746
authorJihoon Jung <jh8801.jung@samsung.com>
Thu, 14 Jul 2016 05:33:22 +0000 (14:33 +0900)
committerJihoon Jung <jh8801.jung@samsung.com>
Thu, 14 Jul 2016 05:38:50 +0000 (14:38 +0900)
Signed-off-by: Jihoon Jung <jh8801.jung@samsung.com>
Change-Id: I089cbfb6fd736a0f15d9611fb68635c8331d2b84

client/SEService.cpp
client/include/SEService.h
packaging/smartcard-service.spec

index 95248f4..5a21e23 100755 (executable)
@@ -303,7 +303,7 @@ namespace smartcard_service_api
                return result;
        }
 
-       int SEService::_initialize_sync() throw(ErrorIO &, ExceptionBase &)
+       int SEService::_initialize_sync_do_not_throw_exception()
        {
                gint result;
                guint handle;
@@ -345,16 +345,9 @@ namespace smartcard_service_api
                        }
                        else
                        {
-                               throw ExceptionBase(result);
+                               _ERR("Initialize error : %d", result);
                        }
                }
-               else
-               {
-                       _ERR("smartcard_service_se_service_call_se_service failed, [%s]", error->message);
-                       g_error_free(error);
-
-                       result = SCARD_ERROR_IPC_FAILED;
-               }
 
                if (service->handler != NULL) {
                        service->handler(service, service->context);
@@ -371,6 +364,64 @@ namespace smartcard_service_api
                return result;
        }
 
+       int SEService::_initialize_sync() throw(ErrorIO &, ExceptionBase &)
+       {
+               gint result;
+               guint handle;
+               GError *error = NULL;
+               GVariant *readers = NULL;
+               SEService *service = (SEService *)this;
+
+               _BEGIN();
+
+               /* init default context */
+
+               proxy = smartcard_service_se_service_proxy_new_for_bus_sync(
+                       G_BUS_TYPE_SYSTEM, G_DBUS_PROXY_FLAGS_NONE,
+                       "org.tizen.SmartcardService",
+                       "/org/tizen/SmartcardService/SeService",
+                       NULL, &error);
+               if (proxy == NULL)
+               {
+                       _ERR("Can not create proxy : %s", error->message);
+                       g_error_free(error);
+                       return false;
+               }
+
+               g_signal_connect(proxy, "reader-inserted",
+                               G_CALLBACK(&SEService::reader_inserted), this);
+
+               g_signal_connect(proxy, "reader-removed",
+                               G_CALLBACK(&SEService::reader_removed), this);
+
+               /* request reader */
+               if(smartcard_service_se_service_call_se_service_sync(
+                       (SmartcardServiceSeService *)proxy, &result, &handle, &readers, NULL, &error) == true)
+               {
+                       if (result == SCARD_ERROR_OK)
+                       {
+                               service->connected = true;
+                               service->handle = handle;
+                               service->parseReaderInformation(readers);
+                       }
+                       else
+                       {
+                               throw ExceptionBase(result);
+                       }
+               }
+               else
+               {
+                       _ERR("smartcard_service_se_service_call_se_service failed, [%s]", error->message);
+                       g_error_free(error);
+
+                       result = SCARD_ERROR_IPC_FAILED;
+               }
+
+               _END();
+
+               return result;
+       }
+
        bool SEService::initialize(void *context, serviceConnected handler)
                throw(ErrorIO &, ErrorIllegalParameter &)
        {
@@ -396,8 +447,7 @@ namespace smartcard_service_api
                this->context = context;
                this->listener = listener;
 
-               _initialize_sync();
-               return true;
+               return _initialize_sync_do_not_throw_exception();
        }
 
        bool SEService::initializeSync(void *context)
index cb7672d..8fbffe8 100644 (file)
@@ -61,6 +61,7 @@ namespace smartcard_service_api
                        throw(ErrorIO &, ErrorIllegalParameter &);
                int _initialize_sync()
                        throw(ErrorIO &, ExceptionBase &);
+               int _initialize_sync_do_not_throw_exception();
                bool initializeSync(void *context)
                        throw(ErrorIO &, ErrorIllegalParameter &, ExceptionBase &);
 
index 182016b..f040a92 100755 (executable)
@@ -7,7 +7,7 @@
 ################################################################################
 Name:       smartcard-service
 Summary:    Smartcard Service FW
-Version:    0.1.48
+Version:    0.1.49
 Release:    0
 Group:      libs
 License:    Apache-2.0