Add 'result' parameter to all methods
authorWonkyu Kwon <wonkyu.kwon@samsung.com>
Tue, 8 Oct 2013 01:40:18 +0000 (10:40 +0900)
committerYoungjae Shin <yj99.shin@samsung.com>
Tue, 8 Oct 2013 01:40:18 +0000 (10:40 +0900)
Change-Id: Ieeac441ad071426a98fbcfb4f27d5af18d6660c3

client/net_nfc_client_tag.c
common/net_nfc.xml
daemon/net_nfc_server_tag.c

index b1433a0..e958abf 100644 (file)
@@ -227,6 +227,7 @@ static void tag_is_tag_connected(GObject *source_object,
 
        if (net_nfc_gdbus_tag_call_is_tag_connected_finish(
                                NET_NFC_GDBUS_TAG(source_object),
+                               &out_result,
                                &out_is_connected,
                                (gint32 *)&out_dev_type,
                                res,
@@ -277,6 +278,7 @@ static void tag_get_current_tag_info(GObject *source_object,
 
        if (net_nfc_gdbus_tag_call_get_current_tag_info_finish (
                                NET_NFC_GDBUS_TAG(source_object),
+                               &out_result,
                                &out_is_connected,
                                &out_handle,
                                (gint *)&out_dev_type,
@@ -348,6 +350,7 @@ static void tag_get_current_target_handle(GObject *source_object,
 
        if (net_nfc_gdbus_tag_call_get_current_target_handle_finish(
                                NET_NFC_GDBUS_TAG(source_object),
+                               &out_result,
                                &out_is_connected,
                                (guint *)&out_handle,
                                (gint *)&out_dev_type,
@@ -514,6 +517,7 @@ API net_nfc_error_e net_nfc_client_tag_is_tag_connected_sync(
                /* try to request target information from server */
                if (net_nfc_gdbus_tag_call_is_tag_connected_sync(tag_proxy,
                                        net_nfc_client_gdbus_get_privilege(),
+                                       &result,
                                        &out_is_connected,
                                        (gint *)&out_dev_type,
                                        NULL,
@@ -607,6 +611,7 @@ API net_nfc_error_e net_nfc_client_tag_get_current_tag_info_sync(
                /* try to request target information from server */
                if (net_nfc_gdbus_tag_call_get_current_tag_info_sync(tag_proxy,
                                        net_nfc_client_gdbus_get_privilege(),
+                                       &result,
                                        &out_is_connected,
                                        &out_handle,
                                        (gint *)&out_dev_type,
@@ -716,6 +721,7 @@ API net_nfc_error_e net_nfc_client_tag_get_current_target_handle_sync(
                if (net_nfc_gdbus_tag_call_get_current_target_handle_sync(
                                        tag_proxy,
                                        net_nfc_client_gdbus_get_privilege(),
+                                       &result,
                                        &out_is_connected,
                                        &out_handle,
                                        (gint *)&out_dev_type,
@@ -726,7 +732,7 @@ API net_nfc_error_e net_nfc_client_tag_get_current_target_handle_sync(
                                        error->message);
                        g_error_free(error);
 
-                       return NET_NFC_IPC_FAIL;
+                       return result;
                }
 
                if (out_is_connected == true) {
index 9d3d027..ca6f1ab 100644 (file)
@@ -37,6 +37,7 @@
     -->
     <method name="IsTagConnected">
       <arg type="a(y)" name="privilege" direction="in" />
+      <arg type="i" name="result" direction="out" />
       <arg type="b" name="is_connected" direction="out" />
       <arg type="i" name="dev_type" direction="out" />
     </method>
@@ -46,6 +47,7 @@
     -->
     <method name="GetCurrentTagInfo">
       <arg type="a(y)" name="privilege" direction="in" />
+      <arg type="i" name="result" direction="out" />
       <arg type="b" name="is_connected" direction="out" />
       <arg type="u" name="handle" direction="out" />
       <arg type="i" name="dev_type" direction="out" />
@@ -63,6 +65,7 @@
     -->
     <method name="GetCurrentTargetHandle">
       <arg type="a(y)" name="privilege" direction="in" />
+      <arg type="i" name="result" direction="out" />
       <arg type="b" name="is_connected" direction="out" />
       <arg type="u" name="handle" direction="out" />
       <arg type="i" name="dev_type" direction="out" />
     <signal name="Received">
       <arg type="a(y)" name="data" />
     </signal>
-
   </interface>
+
   <interface name="org.tizen.NetNfcService.Popup">
     <!--
       Set
index 1c6e931..a849a25 100644 (file)
@@ -221,7 +221,7 @@ static void tag_watchdog_thread_func(gpointer user_data)
 
 
        /* IMPORTANT, TEMPORARY : switching context to another thread
-               for give CPU time */
+          for give CPU time */
        g_usleep(10000);
 
        handle = watch_dog->handle;
@@ -270,7 +270,7 @@ static void tag_get_current_tag_info_thread_func(gpointer user_data)
 
        /* FIXME : net_nfc_current_target_info_s should be removed */
        net_nfc_current_target_info_s *target_info;
-       net_nfc_error_e result;
+       net_nfc_error_e result = NET_NFC_OPERATION_FAIL;
        net_nfc_target_handle_s *handle = NULL;
        net_nfc_target_type_e dev_type = NET_NFC_UNKNOWN_TARGET;
        gboolean is_ndef_supported = FALSE;
@@ -319,6 +319,7 @@ static void tag_get_current_tag_info_thread_func(gpointer user_data)
 
        net_nfc_gdbus_tag_complete_get_current_tag_info(info_data->tag,
                        info_data->invocation,
+                       result,
                        (dev_type != NET_NFC_UNKNOWN_TARGET),
                        GPOINTER_TO_UINT(handle),
                        dev_type,
@@ -512,6 +513,7 @@ static gboolean tag_handle_is_tag_connected(NetNfcGDbusTag *tag,
        net_nfc_current_target_info_s *target_info;
        net_nfc_target_type_e dev_type = NET_NFC_UNKNOWN_TARGET;
        gboolean is_connected = FALSE;
+       gint result;
 
        NFC_INFO(">>> REQUEST from [%s]",
                        g_dbus_method_invocation_get_sender(invocation));
@@ -522,8 +524,9 @@ static gboolean tag_handle_is_tag_connected(NetNfcGDbusTag *tag,
                                "nfc-manager::tag",
                                "r") == false) {
                NFC_ERR("permission denied, and finished request");
+               result = NET_NFC_SECURITY_FAIL;
 
-               return FALSE;
+               goto END;
        }
 
        target_info = net_nfc_server_get_target_info();
@@ -533,8 +536,12 @@ static gboolean tag_handle_is_tag_connected(NetNfcGDbusTag *tag,
                is_connected = TRUE;
        }
 
+       result = NET_NFC_OK;
+
+END :
        net_nfc_gdbus_tag_complete_is_tag_connected(tag,
                        invocation,
+                       result,
                        is_connected,
                        (gint32)dev_type);
 
@@ -603,6 +610,7 @@ static gboolean tag_handle_get_current_target_handle(NetNfcGDbusTag *tag,
        net_nfc_current_target_info_s *target_info;
        net_nfc_target_handle_s *handle = NULL;
        uint32_t devType = NET_NFC_UNKNOWN_TARGET;
+       gint result;
 
        NFC_INFO(">>> REQUEST from [%s]",
                        g_dbus_method_invocation_get_sender(invocation));
@@ -613,8 +621,9 @@ static gboolean tag_handle_get_current_target_handle(NetNfcGDbusTag *tag,
                                "nfc-manager::p2p",
                                "r") == false) {
                NFC_ERR("permission denied, and finished request");
+               result = NET_NFC_SECURITY_FAIL;
 
-               return FALSE;
+               goto END;
        }
 
        target_info = net_nfc_server_get_target_info();
@@ -624,8 +633,12 @@ static gboolean tag_handle_get_current_target_handle(NetNfcGDbusTag *tag,
                devType = target_info->devType;
        }
 
+       result = NET_NFC_OK;
+
+END :
        net_nfc_gdbus_tag_complete_get_current_target_handle(tag,
                        invocation,
+                       result,
                        (handle != NULL),
                        GPOINTER_TO_UINT(handle),
                        devType);