Replace duplicated code with macro, fix wrong returns 45/238345/1
authorYu <jiung.yu@samsung.com>
Mon, 13 Jul 2020 04:26:04 +0000 (13:26 +0900)
committerYu <jiung.yu@samsung.com>
Mon, 13 Jul 2020 04:26:15 +0000 (13:26 +0900)
Change-Id: I57204985063733061045d3e8a539848e8be4f099
Signed-off-by: Yu jiung <jiung.yu@samsung.com>
packaging/capi-network-wifi-direct.spec
src/include/wifi-direct-client-proxy.h
src/wifi-direct-client-proxy.c

index 10fc342..3c710dd 100755 (executable)
@@ -3,7 +3,7 @@
 
 Name:       capi-network-wifi-direct
 Summary:    Network WiFi-Direct Library
-Version:    1.2.103
+Version:    1.2.104
 Release:    1
 Group:      Network & Connectivity/API
 License:    Apache-2.0
index db83a09..b83e2c9 100644 (file)
                } \
        } while (0)
 
+#define CHECK_INITIALIZED()\
+       do {\
+               if (g_client_info.is_registered == false) {\
+                       WDC_LOGE("Client is not initialized.");\
+                       __WDC_LOG_FUNC_END__;\
+                       return WIFI_DIRECT_ERROR_NOT_INITIALIZED;\
+               } \
+       } while (0)
+
 typedef struct {
        bool is_registered;
        bool is_display_supported;
index 4bf1dac..08c699b 100755 (executable)
@@ -248,7 +248,6 @@ void wifi_direct_process_manage_deactivation(GDBusConnection *connection,
        __WDC_LOG_FUNC_END__;
 }
 
-//LCOV_EXCL_START
 void wifi_direct_process_manage_connection(GDBusConnection *connection,
                                           const gchar *sender,
                                           const gchar *object_path,
@@ -321,6 +320,7 @@ void wifi_direct_process_manage_disconnection(GDBusConnection *connection,
        __WDC_LOG_FUNC_END__;
 }
 
+//LCOV_EXCL_START
 void wifi_direct_process_manage_disconnection_ind(GDBusConnection *connection,
                                              const gchar *sender,
                                              const gchar *object_path,
@@ -366,6 +366,7 @@ void wifi_direct_process_manage_disconnection_ind(GDBusConnection *connection,
 
        __WDC_LOG_FUNC_END__;
 }
+//LCOV_EXCL_STOP
 
 void wifi_direct_process_manage_peer_ip_assigned(GDBusConnection *connection,
                                                 const gchar *sender,
@@ -627,6 +628,7 @@ void wifi_direct_process_group_destroyed(GDBusConnection *connection,
        __WDC_LOG_FUNC_END__;
 }
 
+//LCOV_EXCL_START
 /* Service */
 void wifi_direct_process_service_discovery_started(GDBusConnection *connection,
                                                   const gchar *sender,
@@ -737,6 +739,7 @@ void wifi_direct_process_service_discovery_finished(GDBusConnection *connection,
 
        __WDC_LOG_FUNC_END__;
 }
+//LCOV_EXCL_STOP
 
 #if 0
 void __wfd_client_print_entry_list(wfd_discovery_entry_s *list, int num)
@@ -843,7 +846,6 @@ static void __wfd_client_extract_discovered_peer_info(GVariantIter *iter,
 
        __WDC_LOG_FUNC_END__;
 }
-//LCOV_EXCL_STOP
 
 EXPORT_API int wifi_direct_initialize(void)
 {
@@ -853,7 +855,6 @@ EXPORT_API int wifi_direct_initialize(void)
 
        GError* error = NULL;
        GVariant *reply = NULL;
-       bool wifi_direct_enable;
        int res = 0;
 
        if (g_client_info.is_registered == TRUE) {
@@ -862,17 +863,7 @@ EXPORT_API int wifi_direct_initialize(void)
                return WIFI_DIRECT_ERROR_ALREADY_INITIALIZED;
        }
 
-       res = system_info_get_platform_bool("tizen.org/feature/network.wifi.direct", &wifi_direct_enable);
-       if (res < 0) {
-               WDC_LOGE("Failed to get sys info");
-               __WDC_LOG_FUNC_END__;
-               return res; //LCOV_EXCL_LINE
-       }
-
-       if (!wifi_direct_enable) {
-               WDC_LOGE("Wi-Fi Direct not supported");
-               return WIFI_DIRECT_ERROR_NOT_SUPPORTED; //LCOV_EXCL_LINE
-       }
+       CHECK_FEATURE_SUPPORTED(WIFIDIRECT_FEATURE);
 
        if (wifi_direct_dbus_init() == FALSE) {
                WDC_LOGW("Failed to initialize dbus");
@@ -932,11 +923,7 @@ EXPORT_API int wifi_direct_deinitialize(void)
 
        CHECK_FEATURE_SUPPORTED(WIFIDIRECT_FEATURE);
 
-       if (g_client_info.is_registered == false) {
-               WDC_LOGE("Client is already deregistered");
-               __WDC_LOG_FUNC_END__;
-               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
-       }
+       CHECK_INITIALIZED();
 
        wifi_direct_dbus_deinit();
 
@@ -978,11 +965,7 @@ EXPORT_API int wifi_direct_set_device_state_changed_cb(wifi_direct_device_state_
                return WIFI_DIRECT_ERROR_INVALID_PARAMETER;
        }
 
-       if (g_client_info.is_registered == false) {
-               WDC_LOGE("Client is not initialized.");
-               __WDC_LOG_FUNC_END__;
-               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
-       }
+       CHECK_INITIALIZED();
 
        g_client_info.activation_cb = cb;
        g_client_info.user_data_for_cb_activation = user_data;
@@ -998,11 +981,7 @@ EXPORT_API int wifi_direct_unset_device_state_changed_cb(void)
 
        CHECK_FEATURE_SUPPORTED(WIFIDIRECT_FEATURE);
 
-       if (g_client_info.is_registered == false) {
-               WDC_LOGE("Client is not initialized.\n");
-               __WDC_LOG_FUNC_END__;
-               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
-       }
+       CHECK_INITIALIZED();
 
        g_client_info.activation_cb = NULL;
        g_client_info.user_data_for_cb_activation = NULL;
@@ -1025,11 +1004,7 @@ EXPORT_API int wifi_direct_set_discovery_state_changed_cb(wifi_direct_discovery_
                return WIFI_DIRECT_ERROR_INVALID_PARAMETER;
        }
 
-       if (g_client_info.is_registered == false) {
-               WDC_LOGE("Client is not initialized.\n");
-               __WDC_LOG_FUNC_END__;
-               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
-       }
+       CHECK_INITIALIZED();
 
        g_client_info.discover_cb = cb;
        g_client_info.user_data_for_cb_discover = user_data;
@@ -1045,11 +1020,7 @@ EXPORT_API int wifi_direct_unset_discovery_state_changed_cb(void)
 
        CHECK_FEATURE_SUPPORTED(WIFIDIRECT_FEATURE);
 
-       if (g_client_info.is_registered == false) {
-               WDC_LOGE("Client is not initialized.\n");
-               __WDC_LOG_FUNC_END__;
-               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
-       }
+       CHECK_INITIALIZED();
 
        g_client_info.discover_cb = NULL;
        g_client_info.user_data_for_cb_discover = NULL;
@@ -1071,11 +1042,7 @@ EXPORT_API int wifi_direct_set_peer_found_cb(wifi_direct_peer_found_cb cb,
                return WIFI_DIRECT_ERROR_INVALID_PARAMETER;
        }
 
-       if (g_client_info.is_registered == false) {
-               WDC_LOGE("Client is not initialized.\n");
-               __WDC_LOG_FUNC_END__;
-               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
-       }
+       CHECK_INITIALIZED();
 
        g_client_info.peer_found_cb = cb;
        g_client_info.user_data_for_cb_peer_found = user_data;
@@ -1091,11 +1058,7 @@ EXPORT_API int wifi_direct_unset_peer_found_cb(void)
 
        CHECK_FEATURE_SUPPORTED(WIFIDIRECT_FEATURE);
 
-       if (g_client_info.is_registered == false) {
-               WDC_LOGE("Client is not initialized.\n");
-               __WDC_LOG_FUNC_END__;
-               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
-       }
+       CHECK_INITIALIZED();
 
        g_client_info.peer_found_cb = NULL;
        g_client_info.user_data_for_cb_peer_found = NULL;
@@ -1111,24 +1074,19 @@ EXPORT_API int wifi_direct_set_service_state_changed_cb(wifi_direct_service_stat
 
        CHECK_FEATURE_SUPPORTED(WIFIDIRECT_SERVICE_DISCOVERY_FEATURE);
 
-//LCOV_EXCL_START
        if (!cb) {
                WDC_LOGE("Callback is NULL.");
                __WDC_LOG_FUNC_END__;
                return WIFI_DIRECT_ERROR_INVALID_PARAMETER;
        }
 
-       if (g_client_info.is_registered == false) {
-               WDC_LOGE("Client is not initialized.");
-               __WDC_LOG_FUNC_END__;
-               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
-       }
+       CHECK_INITIALIZED();
 
        g_client_info.service_cb = cb;
        g_client_info.user_data_for_cb_service = user_data;
 
        __WDC_LOG_FUNC_END__;
-//LCOV_EXCL_STOP
+
        return WIFI_DIRECT_ERROR_NONE;
 }
 
@@ -1139,18 +1097,13 @@ EXPORT_API int wifi_direct_unset_service_state_changed_cb(void)
 
        CHECK_FEATURE_SUPPORTED(WIFIDIRECT_SERVICE_DISCOVERY_FEATURE);
 
-//LCOV_EXCL_START
-       if (g_client_info.is_registered == false) {
-               WDC_LOGE("Client is not initialized.");
-               __WDC_LOG_FUNC_END__;
-               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
-       }
+       CHECK_INITIALIZED();
 
        g_client_info.service_cb = NULL;
        g_client_info.user_data_for_cb_service = NULL;
 
        __WDC_LOG_FUNC_END__;
-//LCOV_EXCL_STOP
+
        return WIFI_DIRECT_ERROR_NONE;
 }
 
@@ -1167,11 +1120,7 @@ EXPORT_API int wifi_direct_set_connection_state_changed_cb(wifi_direct_connectio
                return WIFI_DIRECT_ERROR_INVALID_PARAMETER;
        }
 
-       if (g_client_info.is_registered == false) {
-               WDC_LOGE("Client is not initialized.\n");
-               __WDC_LOG_FUNC_END__;
-               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
-       }
+       CHECK_INITIALIZED();
 
        g_client_info.connection_cb = cb;
        g_client_info.user_data_for_cb_connection = user_data;
@@ -1187,11 +1136,7 @@ EXPORT_API int wifi_direct_unset_connection_state_changed_cb(void)
 
        CHECK_FEATURE_SUPPORTED(WIFIDIRECT_FEATURE);
 
-       if (g_client_info.is_registered == false) {
-               WDC_LOGE("Client is not initialized");
-               __WDC_LOG_FUNC_END__;
-               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
-       }
+       CHECK_INITIALIZED();
 
        g_client_info.connection_cb = NULL;
        g_client_info.user_data_for_cb_connection = NULL;
@@ -1212,11 +1157,7 @@ EXPORT_API int wifi_direct_set_peer_info_connection_state_changed_cb(wifi_direct
                return WIFI_DIRECT_ERROR_INVALID_PARAMETER;
        }
 
-       if (g_client_info.is_registered == false) {
-               WDC_LOGE("Client is not initialized");
-               __WDC_LOG_FUNC_END__;
-               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
-       }
+       CHECK_INITIALIZED();
 
        g_client_info.peer_data_connection_cb = cb;
        g_client_info.user_data_for_cb_peer_data_connection = user_data;
@@ -1231,11 +1172,7 @@ EXPORT_API int wifi_direct_unset_peer_info_connection_state_changed_cb(void)
 
        CHECK_FEATURE_SUPPORTED(WIFIDIRECT_DISPLAY_FEATURE);
 
-       if (g_client_info.is_registered == false) {
-               WDC_LOGE("Client is not initialized");
-               __WDC_LOG_FUNC_END__;
-               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
-       }
+       CHECK_INITIALIZED();
 
        g_client_info.peer_data_connection_cb = NULL;
        g_client_info.user_data_for_cb_peer_data_connection = NULL;
@@ -1257,11 +1194,7 @@ EXPORT_API int wifi_direct_set_client_ip_address_assigned_cb(wifi_direct_client_
                return WIFI_DIRECT_ERROR_INVALID_PARAMETER;
        }
 
-       if (g_client_info.is_registered == false) {
-               WDC_LOGE("Client is not initialized");
-               __WDC_LOG_FUNC_END__;
-               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
-       }
+       CHECK_INITIALIZED();
 
        g_client_info.ip_assigned_cb = cb;
        g_client_info.user_data_for_cb_ip_assigned = user_data;
@@ -1276,11 +1209,7 @@ EXPORT_API int wifi_direct_unset_client_ip_address_assigned_cb(void)
 
        CHECK_FEATURE_SUPPORTED(WIFIDIRECT_FEATURE);
 
-       if (g_client_info.is_registered == false) {
-               WDC_LOGE("Client is not initialized");
-               __WDC_LOG_FUNC_END__;
-               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
-       }
+       CHECK_INITIALIZED();
 
        g_client_info.ip_assigned_cb = NULL;
        g_client_info.user_data_for_cb_ip_assigned = NULL;
@@ -1348,11 +1277,7 @@ EXPORT_API int wifi_direct_activate(void)
 
        CHECK_FEATURE_SUPPORTED(WIFIDIRECT_FEATURE);
 
-       if (g_client_info.is_registered == false) {
-               WDC_LOGE("Client is NOT registered");
-               __WDC_LOG_FUNC_END__;
-               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
-       }
+       CHECK_INITIALIZED();
 
        reply = wifi_direct_dbus_method_call_sync(WFD_MANAGER_MANAGE_INTERFACE,
                                                    "Activate", NULL, &error);
@@ -1377,11 +1302,7 @@ EXPORT_API int wifi_direct_deactivate(void)
 
        CHECK_FEATURE_SUPPORTED(WIFIDIRECT_FEATURE);
 
-       if (g_client_info.is_registered == false) {
-               WDC_LOGE("Client is NOT registered");
-               __WDC_LOG_FUNC_END__;
-               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
-       }
+       CHECK_INITIALIZED();
 
        reply = wifi_direct_dbus_method_call_sync(WFD_MANAGER_MANAGE_INTERFACE,
                                                  "Deactivate", NULL, &error);
@@ -1408,11 +1329,7 @@ EXPORT_API int wifi_direct_start_discovery(bool listen_only, int timeout)
 
        CHECK_FEATURE_SUPPORTED(WIFIDIRECT_FEATURE);
 
-       if (g_client_info.is_registered == false) {
-               WDC_LOGE("Client is NOT registered");
-               __WDC_LOG_FUNC_END__;
-               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
-       }
+       CHECK_INITIALIZED();
 
        if (timeout < 0) {
                WDC_LOGE("Negative value. Param [timeout]!");
@@ -1454,11 +1371,7 @@ EXPORT_API int wifi_direct_start_discovery_specific_channel(bool listen_only,
 
        CHECK_FEATURE_SUPPORTED(WIFIDIRECT_FEATURE);
 
-       if (g_client_info.is_registered == false) {
-               WDC_LOGE("Client is NOT registered");
-               __WDC_LOG_FUNC_END__;
-               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
-       }
+       CHECK_INITIALIZED();
 
        if (timeout < 0) {
                WDC_LOGE("Negative value. Param [timeout]!");
@@ -1500,11 +1413,7 @@ EXPORT_API int wifi_direct_start_discovery_specific_freq(bool listen_only,
 
        CHECK_FEATURE_SUPPORTED(WIFIDIRECT_FEATURE);
 
-       if (g_client_info.is_registered == false) {
-               WDC_LOGE("Client is NOT registered");
-               __WDC_LOG_FUNC_END__;
-               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
-       }
+       CHECK_INITIALIZED();
 
        if (timeout < 0 || frequency <= 0) {
                WDC_LOGE("Invalid parameter");
@@ -1549,11 +1458,7 @@ EXPORT_API int wifi_direct_cancel_discovery(void)
 
        CHECK_FEATURE_SUPPORTED(WIFIDIRECT_FEATURE);
 
-       if (g_client_info.is_registered == false) {
-               WDC_LOGE("Client is NOT registered");
-               __WDC_LOG_FUNC_END__;
-               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
-       }
+       CHECK_INITIALIZED();
 
        reply = wifi_direct_dbus_method_call_sync(WFD_MANAGER_MANAGE_INTERFACE,
                                                  "StopDiscovery", NULL, &error);
@@ -1647,11 +1552,7 @@ EXPORT_API int wifi_direct_foreach_discovered_peers(wifi_direct_discovered_peer_
        GVariantIter *iter_peer = NULL;
        int ret = WIFI_DIRECT_ERROR_NONE;
 
-       if (g_client_info.is_registered == false) {
-               WDC_LOGE("Client is NOT registered");
-               __WDC_LOG_FUNC_END__;
-               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
-       }
+       CHECK_INITIALIZED();
 
        if (!cb) {
                WDC_LOGE("NULL Param [callback]!");
@@ -1673,7 +1574,7 @@ EXPORT_API int wifi_direct_foreach_discovered_peers(wifi_direct_discovered_peer_
        }
 
        WDC_LOGD("wifi_direct_foreach_discovered_peers() SUCCESS");
-//LCOV_EXCL_START
+
        while (g_variant_iter_loop(iter_peers, "a{sv}", &iter_peer)) {
                wifi_direct_discovered_peer_info_s *peer_info = NULL;
 
@@ -1692,7 +1593,7 @@ EXPORT_API int wifi_direct_foreach_discovered_peers(wifi_direct_discovered_peer_
                        break;
                }
        }
-//LCOV_EXCL_STOP
+
        g_variant_iter_free(iter_peers);
        g_variant_unref(reply);
        __WDC_LOG_FUNC_END__;
@@ -1710,11 +1611,7 @@ EXPORT_API int wifi_direct_connect(char *mac_address)
        GVariant *reply = NULL;
        int ret = WIFI_DIRECT_ERROR_NONE;
 
-       if (g_client_info.is_registered == false) {
-               WDC_LOGE("Client is NOT registered");
-               __WDC_LOG_FUNC_END__;
-               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
-       }
+       CHECK_INITIALIZED();
 
        if (!mac_address) {
                WDC_LOGE("mac_addr is NULL");
@@ -1737,7 +1634,6 @@ EXPORT_API int wifi_direct_connect(char *mac_address)
        return ret;
 }
 
-//LCOV_EXCL_START
 EXPORT_API int wifi_direct_cancel_connection(char *mac_address)
 {
        __WDC_LOG_FUNC_START__;
@@ -1749,11 +1645,7 @@ EXPORT_API int wifi_direct_cancel_connection(char *mac_address)
        GVariant *reply = NULL;
        int ret = WIFI_DIRECT_ERROR_NONE;
 
-       if (g_client_info.is_registered == false) {
-               WDC_LOGE("Client is NOT registered");
-               __WDC_LOG_FUNC_END__;
-               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
-       }
+       CHECK_INITIALIZED();
 
        if (!mac_address) {
                WDC_LOGE("mac_addr is NULL");
@@ -1776,7 +1668,6 @@ EXPORT_API int wifi_direct_cancel_connection(char *mac_address)
        return ret;
 }
 
-
 EXPORT_API int wifi_direct_reject_connection(char *mac_address)
 {
        __WDC_LOG_FUNC_START__;
@@ -1788,11 +1679,7 @@ EXPORT_API int wifi_direct_reject_connection(char *mac_address)
        GVariant *reply = NULL;
        int ret = WIFI_DIRECT_ERROR_NONE;
 
-       if (g_client_info.is_registered == false) {
-               WDC_LOGE("Client is NOT registered");
-               __WDC_LOG_FUNC_END__;
-               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
-       }
+       CHECK_INITIALIZED();
 
        if (!mac_address) {
                WDC_LOGE("mac_addr is NULL");
@@ -1814,7 +1701,6 @@ EXPORT_API int wifi_direct_reject_connection(char *mac_address)
        __WDC_LOG_FUNC_END__;
        return ret;
 }
-//LCOV_EXCL_STOP
 
 EXPORT_API int wifi_direct_disconnect_all(void)
 {
@@ -1826,11 +1712,7 @@ EXPORT_API int wifi_direct_disconnect_all(void)
        GVariant *reply = NULL;
        int ret = WIFI_DIRECT_ERROR_NONE;
 
-       if (g_client_info.is_registered == false) {
-               WDC_LOGE("Client is NOT registered");
-               __WDC_LOG_FUNC_END__;
-               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
-       }
+       CHECK_INITIALIZED();
 
        reply = wifi_direct_dbus_method_call_sync(WFD_MANAGER_MANAGE_INTERFACE,
                                                  "DisconnectAll", NULL, &error);
@@ -1846,7 +1728,6 @@ EXPORT_API int wifi_direct_disconnect_all(void)
        return ret;
 }
 
-//LCOV_EXCL_START
 EXPORT_API int wifi_direct_disconnect(char *mac_address)
 {
        __WDC_LOG_FUNC_START__;
@@ -1858,11 +1739,7 @@ EXPORT_API int wifi_direct_disconnect(char *mac_address)
        GVariant *reply = NULL;
        int ret = WIFI_DIRECT_ERROR_NONE;
 
-       if (g_client_info.is_registered == false) {
-               WDC_LOGE("Client is NOT registered");
-               __WDC_LOG_FUNC_END__;
-               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
-       }
+       CHECK_INITIALIZED();
 
        if (!mac_address) {
                WDC_LOGE("mac_addr is NULL");
@@ -1896,11 +1773,7 @@ EXPORT_API int wifi_direct_accept_connection(char *mac_address)
        GVariant *reply = NULL;
        int ret = WIFI_DIRECT_ERROR_NONE;
 
-       if (g_client_info.is_registered == false) {
-               WDC_LOGE("Client is NOT registered");
-               __WDC_LOG_FUNC_END__;
-               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
-       }
+       CHECK_INITIALIZED();
 
        if (!mac_address) {
                WDC_LOGE("mac_addr is NULL");
@@ -1922,7 +1795,6 @@ EXPORT_API int wifi_direct_accept_connection(char *mac_address)
        __WDC_LOG_FUNC_END__;
        return ret;
 }
-//LCOV_EXCL_STOP
 
 EXPORT_API int wifi_direct_foreach_connected_peers(wifi_direct_connected_peer_cb cb,
                                        void *user_data)
@@ -1940,11 +1812,7 @@ EXPORT_API int wifi_direct_foreach_connected_peers(wifi_direct_connected_peer_cb
        gchar *key = NULL;
        int ret = WIFI_DIRECT_ERROR_NONE;
 
-       if (g_client_info.is_registered == false) {
-               WDC_LOGE("Client is NOT registered");
-               __WDC_LOG_FUNC_END__;
-               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
-       }
+       CHECK_INITIALIZED();
 
        if (!cb) {
                WDC_LOGE("NULL Param [callback]!");
@@ -1952,7 +1820,6 @@ EXPORT_API int wifi_direct_foreach_connected_peers(wifi_direct_connected_peer_cb
                return WIFI_DIRECT_ERROR_INVALID_PARAMETER;
        }
 
-//LCOV_EXCL_START
        reply = wifi_direct_dbus_method_call_sync(WFD_MANAGER_MANAGE_INTERFACE,
                                                  "GetConnectedPeers", params, &error);
 
@@ -2038,7 +1905,7 @@ EXPORT_API int wifi_direct_foreach_connected_peers(wifi_direct_connected_peer_cb
 
        g_variant_iter_free(iter_peers);
        g_variant_unref(reply);
-//LCOV_EXCL_STOP
+
        __WDC_LOG_FUNC_END__;
        return WIFI_DIRECT_ERROR_NONE;
 }
@@ -2056,11 +1923,7 @@ EXPORT_API int wifi_direct_create_group(void)
        GVariant *reply = NULL;
        int ret = WIFI_DIRECT_ERROR_NONE;
 
-       if (g_client_info.is_registered == false) {
-               WDC_LOGE("Client is NOT registered");
-               __WDC_LOG_FUNC_END__;
-               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
-       }
+       CHECK_INITIALIZED();
 
        builder = g_variant_builder_new(G_VARIANT_TYPE("a{sv}"));
        params = g_variant_new("(a{sv})", builder);
@@ -2092,11 +1955,7 @@ EXPORT_API int wifi_direct_create_group_with_ssid(const char *ssid)
        GVariant *reply = NULL;
        int ret = WIFI_DIRECT_ERROR_NONE;
 
-       if (g_client_info.is_registered == false) {
-               WDC_LOGE("Client is NOT registered");
-               __WDC_LOG_FUNC_END__;
-               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
-       }
+       CHECK_INITIALIZED();
 
        if (!ssid) {
                WDC_LOGE("NULL Param");
@@ -2133,11 +1992,7 @@ EXPORT_API int wifi_direct_destroy_group(void)
        GVariant *reply = NULL;
        int ret = WIFI_DIRECT_ERROR_NONE;
 
-       if (g_client_info.is_registered == false) {
-               WDC_LOGE("Client is NOT registered");
-               __WDC_LOG_FUNC_END__;
-               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
-       }
+       CHECK_INITIALIZED();
 
        reply = wifi_direct_dbus_method_call_sync(WFD_MANAGER_GROUP_INTERFACE,
                                                  "DestroyGroup", NULL, &error);
@@ -2165,11 +2020,7 @@ EXPORT_API int wifi_direct_is_group_owner(bool *owner)
        int ret = WIFI_DIRECT_ERROR_NONE;
        gboolean val;
 
-       if (g_client_info.is_registered == false) {
-               WDC_LOGE("Client is NOT registered");
-               __WDC_LOG_FUNC_END__;
-               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
-       }
+       CHECK_INITIALIZED();
 
        if (!owner) {
                WDC_LOGE("NULL Param [owner]!");
@@ -2206,11 +2057,7 @@ EXPORT_API int wifi_direct_is_autonomous_group(bool *autonomous_group)
        int ret = WIFI_DIRECT_ERROR_NONE;
        gboolean val;
 
-       if (g_client_info.is_registered == false) {
-               WDC_LOGE("Client is NOT registered");
-               __WDC_LOG_FUNC_END__;
-               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
-       }
+       CHECK_INITIALIZED();
 
        if (!autonomous_group) {
                WDC_LOGE("NULL Param [autonomous_group]!\n");
@@ -2248,11 +2095,7 @@ EXPORT_API int wifi_direct_set_group_owner_intent(int intent)
        GVariant *params = NULL;
        int ret = WIFI_DIRECT_ERROR_NONE;
 
-       if (g_client_info.is_registered == false) {
-               WDC_LOGE("Client is NOT registered");
-               __WDC_LOG_FUNC_END__;
-               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
-       }
+       CHECK_INITIALIZED();
 
        if (intent < 0 || intent > 15) {
                WDC_LOGE("Invalid Param : intent[%d]", intent);
@@ -2288,11 +2131,7 @@ EXPORT_API int wifi_direct_get_group_owner_intent(int *intent)
        int val = 0;
        int ret = WIFI_DIRECT_ERROR_NONE;
 
-       if (g_client_info.is_registered == false) {
-               WDC_LOGE("Client is NOT registered");
-               __WDC_LOG_FUNC_END__;
-               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
-       }
+       CHECK_INITIALIZED();
 
        if (!intent) {
                WDC_LOGE("Invalid Parameter");
@@ -2330,11 +2169,7 @@ EXPORT_API int wifi_direct_set_go_intent_per_type(int type, int intent)
        GVariant *params = NULL;
        int ret = WIFI_DIRECT_ERROR_NONE;
 
-       if (g_client_info.is_registered == false) {
-               WDC_LOGE("Client is NOT registered");
-               __WDC_LOG_FUNC_END__;
-               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
-       }
+       CHECK_INITIALIZED();
 
        if (type < 0 || type >= WIFI_DIRECT_MAX_TYPE) {
                WDC_LOGE("Invalid Param : type[%d]", type);
@@ -2377,11 +2212,7 @@ EXPORT_API int wifi_direct_get_go_intent_per_type(int type, int *intent)
        int val = 0;
        int ret = WIFI_DIRECT_ERROR_NONE;
 
-       if (g_client_info.is_registered == false) {
-               WDC_LOGE("Client is NOT registered");
-               __WDC_LOG_FUNC_END__;
-               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
-       }
+       CHECK_INITIALIZED();
 
        if (type < 0 || type >= WIFI_DIRECT_MAX_TYPE) {
                WDC_LOGE("Invalid Param : type[%d]", type);
@@ -2427,11 +2258,8 @@ EXPORT_API int wifi_direct_set_max_clients(int max)
        GVariant *params = NULL;
        int ret = WIFI_DIRECT_ERROR_NONE;
 
-       if (g_client_info.is_registered == false) {
-               WDC_LOGE("Client is NOT registered");
-               __WDC_LOG_FUNC_END__;
-               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
-       }
+       CHECK_INITIALIZED();
+
        WDC_LOGD("max client [%d]\n", max);
 
        params = g_variant_new("(i)", max);
@@ -2462,11 +2290,7 @@ EXPORT_API int wifi_direct_get_max_clients(int *max)
        int val = 0;
        int ret = WIFI_DIRECT_ERROR_NONE;
 
-       if (g_client_info.is_registered == false) {
-               WDC_LOGE("Client is NOT registered");
-               __WDC_LOG_FUNC_END__;
-               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
-       }
+       CHECK_INITIALIZED();
 
        if (!max) {
                WDC_LOGE("Invalid Parameter");
@@ -2504,11 +2328,7 @@ EXPORT_API int wifi_direct_get_operating_channel(int *channel)
        int val = 0;
        int ret = WIFI_DIRECT_ERROR_NONE;
 
-       if (g_client_info.is_registered == false) {
-               WDC_LOGE("Client is NOT registered");
-               __WDC_LOG_FUNC_END__;
-               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
-       }
+       CHECK_INITIALIZED();
 
        if (!channel) {
                WDC_LOGE("NULL Param [channel]!\n");
@@ -2545,11 +2365,7 @@ EXPORT_API int wifi_direct_activate_pushbutton(void)
        GVariant *reply = NULL;
        int ret = WIFI_DIRECT_ERROR_NONE;
 
-       if (g_client_info.is_registered == false) {
-               WDC_LOGE("Client is NOT registered");
-               __WDC_LOG_FUNC_END__;
-               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
-       }
+       CHECK_INITIALIZED();
 
        reply = wifi_direct_dbus_method_call_sync(WFD_MANAGER_GROUP_INTERFACE,
                                          "ActivatePushButton",
@@ -2578,11 +2394,7 @@ EXPORT_API int wifi_direct_set_wps_pin(char *pin)
        GVariant *params = NULL;
        int ret = WIFI_DIRECT_ERROR_NONE;
 
-       if (g_client_info.is_registered == false) {
-               WDC_LOGE("Client is NOT registered");
-               __WDC_LOG_FUNC_END__;
-               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
-       }
+       CHECK_INITIALIZED();
 
        if (!pin) {
                WDC_LOGE("NULL Param [pin]!");
@@ -2620,11 +2432,7 @@ EXPORT_API int wifi_direct_get_wps_pin(char **pin)
        const char *str = NULL;
        int ret = WIFI_DIRECT_ERROR_NONE;
 
-       if (g_client_info.is_registered == false) {
-               WDC_LOGE("Client is NOT registered");
-               __WDC_LOG_FUNC_END__;
-               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
-       }
+       CHECK_INITIALIZED();
 
        if (!pin) {
                WDC_LOGE("NULL Param [pin]!");
@@ -2662,11 +2470,7 @@ EXPORT_API int wifi_direct_get_supported_wps_mode(int *wps_mode)
        int mode = 0;
        int ret = WIFI_DIRECT_ERROR_NONE;
 
-       if (g_client_info.is_registered == false) {
-               WDC_LOGE("Client is NOT registered");
-               __WDC_LOG_FUNC_END__;
-               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
-       }
+       CHECK_INITIALIZED();
 
        if (!wps_mode) {
                WDC_LOGE("NULL Param [wps_mode]!");
@@ -2704,11 +2508,7 @@ EXPORT_API int wifi_direct_foreach_supported_wps_types(wifi_direct_supported_wps
        int ret = WIFI_DIRECT_ERROR_NONE;
        gboolean result = FALSE;
 
-       if (g_client_info.is_registered == false) {
-               WDC_LOGE("Client is NOT registered");
-               __WDC_LOG_FUNC_END__;
-               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
-       }
+       CHECK_INITIALIZED();
 
        if (!cb) {
                WDC_LOGE("NULL Param [callback]!");
@@ -2751,11 +2551,7 @@ EXPORT_API int wifi_direct_get_local_wps_type(wifi_direct_wps_type_e *type)
        int mode = 0;
        int ret = WIFI_DIRECT_ERROR_NONE;
 
-       if (g_client_info.is_registered == false) {
-               WDC_LOGE("Client is NOT registered");
-               __WDC_LOG_FUNC_END__;
-               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
-       }
+       CHECK_INITIALIZED();
 
        if (type == NULL) {
                WDC_LOGE("NULL Param [type]!\n");
@@ -2792,11 +2588,7 @@ EXPORT_API int wifi_direct_set_req_wps_type(wifi_direct_wps_type_e type)
        GVariant *params = NULL;
        int ret = WIFI_DIRECT_ERROR_NONE;
 
-       if (g_client_info.is_registered == false) {
-               WDC_LOGE("Client is NOT registered");
-               __WDC_LOG_FUNC_END__;
-               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
-       }
+       CHECK_INITIALIZED();
 
        if (type == WIFI_DIRECT_WPS_TYPE_PBC ||
                        type == WIFI_DIRECT_WPS_TYPE_PIN_DISPLAY ||
@@ -2836,11 +2628,7 @@ EXPORT_API int wifi_direct_get_req_wps_type(wifi_direct_wps_type_e *type)
        int mode = 0;
        int ret = 0;
 
-       if (g_client_info.is_registered == false) {
-               WDC_LOGE("Client is NOT registered");
-               __WDC_LOG_FUNC_END__;
-               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
-       }
+       CHECK_INITIALIZED();
 
        if (!type) {
                WDC_LOGE("NULL Param [type]!\n");
@@ -2877,11 +2665,7 @@ EXPORT_API int wifi_direct_get_ssid(char **ssid)
        const char *str = NULL;
        int ret = WIFI_DIRECT_ERROR_NONE;
 
-       if (g_client_info.is_registered == false) {
-               WDC_LOGE("Client is NOT registered");
-               __WDC_LOG_FUNC_END__;
-               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
-       }
+       CHECK_INITIALIZED();
 
        if (!ssid) {
                WDC_LOGE("Invalid Parameter");
@@ -2919,11 +2703,7 @@ EXPORT_API int wifi_direct_get_device_name(char **device_name)
        const char *str = NULL;
        int ret = WIFI_DIRECT_ERROR_NONE;
 
-       if (g_client_info.is_registered == false) {
-               WDC_LOGE("Client is NOT registered");
-               __WDC_LOG_FUNC_END__;
-               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
-       }
+       CHECK_INITIALIZED();
 
        if (!device_name) {
                WDC_LOGE("Invalid Parameter");
@@ -2961,11 +2741,7 @@ EXPORT_API int wifi_direct_set_device_name(const char *device_name)
        GVariant *params = NULL;
        int ret = WIFI_DIRECT_ERROR_NONE;
 
-       if (g_client_info.is_registered == false) {
-               WDC_LOGE("Client is NOT registered");
-               __WDC_LOG_FUNC_END__;
-               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
-       }
+       CHECK_INITIALIZED();
 
        if (!device_name) {
                WDC_LOGE("NULL Param [device_name]!");
@@ -2991,24 +2767,18 @@ EXPORT_API int wifi_direct_set_device_name(const char *device_name)
        return ret;
 }
 
-//LCOV_EXCL_START
 EXPORT_API int wifi_direct_get_network_interface_name(char **name)
 {
        __WDC_LOG_FUNC_START__;
 
        CHECK_FEATURE_SUPPORTED(WIFIDIRECT_FEATURE);
 
-       wifi_direct_state_e status = 0;
        const char *get_str = NULL;
        GError* error = NULL;
        GVariant *reply = NULL;
        int ret = WIFI_DIRECT_ERROR_NONE;
 
-       if (g_client_info.is_registered == false) {
-               WDC_LOGE("Client is NOT registered");
-               __WDC_LOG_FUNC_END__;
-               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
-       }
+       CHECK_INITIALIZED();
 
        if (!name) {
                WDC_LOGE("NULL Param [name]!\n");
@@ -3016,15 +2786,6 @@ EXPORT_API int wifi_direct_get_network_interface_name(char **name)
                return WIFI_DIRECT_ERROR_INVALID_PARAMETER;
        }
 
-       ret = wifi_direct_get_state(&status);
-       WDC_LOGD("wifi_direct_get_state() state=[%d], ret=[%d]\n", status, ret);
-
-       if (status < WIFI_DIRECT_STATE_CONNECTED) {
-               WDC_LOGE("Device is not connected!\n");
-               __WDC_LOG_FUNC_END__;
-               return WIFI_DIRECT_ERROR_NOT_PERMITTED;
-       }
-
        reply = wifi_direct_dbus_method_call_sync(WFD_MANAGER_CONFIG_INTERFACE,
                                                  "GetInterfaceName",
                                                  NULL,
@@ -3057,11 +2818,7 @@ EXPORT_API int wifi_direct_get_ip_address(char **ip_address)
        const char *str = NULL;
        int ret = WIFI_DIRECT_ERROR_NONE;
 
-       if (g_client_info.is_registered == false) {
-               WDC_LOGE("Client is NOT registered");
-               __WDC_LOG_FUNC_END__;
-               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
-       }
+       CHECK_INITIALIZED();
 
        if (!ip_address) {
                WDC_LOGE("NULL Param [ip_address]!\n");
@@ -3095,17 +2852,12 @@ EXPORT_API int wifi_direct_get_subnet_mask(char **subnet_mask)
 
        CHECK_FEATURE_SUPPORTED(WIFIDIRECT_FEATURE);
 
-       wifi_direct_state_e status = 0;
        GError* error = NULL;
        GVariant *reply = NULL;
        char *get_str = NULL;
        int ret = WIFI_DIRECT_ERROR_NONE;
 
-       if (g_client_info.is_registered == false) {
-               WDC_LOGE("Client is NOT registered");
-               __WDC_LOG_FUNC_END__;
-               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
-       }
+       CHECK_INITIALIZED();
 
        if (!subnet_mask) {
                WDC_LOGE("NULL Param [subnet_mask]!");
@@ -3113,14 +2865,6 @@ EXPORT_API int wifi_direct_get_subnet_mask(char **subnet_mask)
                return WIFI_DIRECT_ERROR_INVALID_PARAMETER;
        }
 
-       ret = wifi_direct_get_state(&status);
-       WDC_LOGD("wifi_direct_get_state() state=[%d], ret=[%d]", status, ret);
-       if (status < WIFI_DIRECT_STATE_CONNECTED) {
-               WDC_LOGE("Device is not connected!");
-               __WDC_LOG_FUNC_END__;
-               return WIFI_DIRECT_ERROR_NOT_PERMITTED;
-       }
-
        reply = wifi_direct_dbus_method_call_sync(WFD_MANAGER_CONFIG_INTERFACE,
                                                  "GetSubnetMask",
                                                  NULL,
@@ -3148,17 +2892,12 @@ EXPORT_API int wifi_direct_get_gateway_address(char **gateway_address)
 
        CHECK_FEATURE_SUPPORTED(WIFIDIRECT_FEATURE);
 
-       wifi_direct_state_e status = 0;
        GError* error = NULL;
        GVariant *reply = NULL;
        const char *get_str = NULL;
        int ret = WIFI_DIRECT_ERROR_NONE;
 
-       if (g_client_info.is_registered == false) {
-               WDC_LOGE("Client is NOT registered");
-               __WDC_LOG_FUNC_END__;
-               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
-       }
+       CHECK_INITIALIZED();
 
        if (!gateway_address) {
                WDC_LOGE("NULL Param [gateway_address]!");
@@ -3166,14 +2905,6 @@ EXPORT_API int wifi_direct_get_gateway_address(char **gateway_address)
                return WIFI_DIRECT_ERROR_INVALID_PARAMETER;
        }
 
-       ret = wifi_direct_get_state(&status);
-       WDC_LOGD("wifi_direct_get_state() state=[%d], ret=[%d]", status, ret);
-       if (status < WIFI_DIRECT_STATE_CONNECTED) {
-               WDC_LOGE("Device is not connected!");
-               __WDC_LOG_FUNC_END__;
-               return WIFI_DIRECT_ERROR_NOT_PERMITTED;
-       }
-
        reply = wifi_direct_dbus_method_call_sync(WFD_MANAGER_CONFIG_INTERFACE,
                                                  "GetGateway",
                                                  NULL,
@@ -3194,7 +2925,6 @@ EXPORT_API int wifi_direct_get_gateway_address(char **gateway_address)
        __WDC_LOG_FUNC_END__;
        return WIFI_DIRECT_ERROR_NONE;
 }
-//LCOV_EXCL_STOP
 
 EXPORT_API int wifi_direct_get_mac_address(char **mac_address)
 {
@@ -3207,11 +2937,7 @@ EXPORT_API int wifi_direct_get_mac_address(char **mac_address)
        const char *str = NULL;
        int ret = WIFI_DIRECT_ERROR_NONE;
 
-       if (g_client_info.is_registered == false) {
-               WDC_LOGE("Client is NOT registered");
-               __WDC_LOG_FUNC_END__;
-               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
-       }
+       CHECK_INITIALIZED();
 
        if (!mac_address) {
                WDC_LOGE("NULL Param [mac_address]!");
@@ -3301,11 +3027,7 @@ EXPORT_API int wifi_direct_is_discoverable(bool* discoverable)
        gboolean val;
        int ret = WIFI_DIRECT_ERROR_NONE;
 
-       if (g_client_info.is_registered == false) {
-               WDC_LOGE("Client is NOT registered");
-               __WDC_LOG_FUNC_END__;
-               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
-       }
+       CHECK_INITIALIZED();
 
        if (!discoverable) {
                WDC_LOGE("Invalid Parameter");
@@ -3342,11 +3064,7 @@ EXPORT_API int wifi_direct_is_listening_only(bool* listen_only)
        int ret = WIFI_DIRECT_ERROR_NONE;
        gboolean val;
 
-       if (g_client_info.is_registered == false) {
-               WDC_LOGE("Client is NOT registered");
-               __WDC_LOG_FUNC_END__;
-               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
-       }
+       CHECK_INITIALIZED();
 
        if (!listen_only) {
                WDC_LOGE("Invalid Parameter");
@@ -3384,11 +3102,7 @@ EXPORT_API int wifi_direct_get_primary_device_type(wifi_direct_primary_device_ty
        int ret = WIFI_DIRECT_ERROR_NONE;
        int primary_device_type = 0;
 
-       if (g_client_info.is_registered == false) {
-               WDC_LOGE("Client is NOT registered");
-               __WDC_LOG_FUNC_END__;
-               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
-       }
+       CHECK_INITIALIZED();
 
        if (type == NULL) {
                WDC_LOGE("NULL Param [type]!");
@@ -3424,11 +3138,7 @@ EXPORT_API int wifi_direct_get_secondary_device_type(wifi_direct_secondary_devic
        int ret = WIFI_DIRECT_ERROR_NONE;
        int secondary_device_type = 0;
 
-       if (g_client_info.is_registered == false) {
-               WDC_LOGE("Client is NOT registered");
-               __WDC_LOG_FUNC_END__;
-               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
-       }
+       CHECK_INITIALIZED();
 
        if (type == NULL) {
                WDC_LOGE("NULL Param [type]!");
@@ -3464,11 +3174,7 @@ EXPORT_API int wifi_direct_set_autoconnection_mode(bool mode)
        GVariant *params = NULL;
        int ret = WIFI_DIRECT_ERROR_NONE;
 
-       if (g_client_info.is_registered == false) {
-               WDC_LOGE("Client is NOT registered");
-               __WDC_LOG_FUNC_END__;
-               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
-       }
+       CHECK_INITIALIZED();
 
        params = g_variant_new("(b)", mode);
        reply = wifi_direct_dbus_method_call_sync(WFD_MANAGER_CONFIG_INTERFACE,
@@ -3498,11 +3204,7 @@ EXPORT_API int wifi_direct_is_autoconnection_mode(bool *mode)
        gboolean val = FALSE;
        int ret = WIFI_DIRECT_ERROR_NONE;
 
-       if (g_client_info.is_registered == false) {
-               WDC_LOGE("Client is NOT registered");
-               __WDC_LOG_FUNC_END__;
-               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
-       }
+       CHECK_INITIALIZED();
 
        if (!mode) {
                WDC_LOGE("NULL Param [mode]!");
@@ -3540,11 +3242,7 @@ EXPORT_API int wifi_direct_set_persistent_group_enabled(bool enabled)
        GVariant *params = NULL;
        int ret = WIFI_DIRECT_ERROR_NONE;
 
-       if (g_client_info.is_registered == false) {
-               WDC_LOGE("Client is NOT registered");
-               __WDC_LOG_FUNC_END__;
-               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
-       }
+       CHECK_INITIALIZED();
 
        params = g_variant_new("(b)", enabled);
        reply = wifi_direct_dbus_method_call_sync(WFD_MANAGER_GROUP_INTERFACE,
@@ -3561,7 +3259,7 @@ EXPORT_API int wifi_direct_set_persistent_group_enabled(bool enabled)
        WDC_LOGD("%s() return : [%d]", __func__, ret);
 
        __WDC_LOG_FUNC_END__;
-       return WIFI_DIRECT_ERROR_NONE;
+       return ret;
 }
 
 
@@ -3576,11 +3274,7 @@ EXPORT_API int wifi_direct_is_persistent_group_enabled(bool *enabled)
        int ret = WIFI_DIRECT_ERROR_NONE;
        gboolean val;
 
-       if (g_client_info.is_registered == false) {
-               WDC_LOGE("Client is NOT registered");
-               __WDC_LOG_FUNC_END__;
-               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
-       }
+       CHECK_INITIALIZED();
 
        if (!enabled) {
                WDC_LOGE("NULL Param [enabled]!");
@@ -3622,11 +3316,7 @@ EXPORT_API int wifi_direct_foreach_persistent_groups(wifi_direct_persistent_grou
        gchar *key = NULL;
        int ret = WIFI_DIRECT_ERROR_NONE;
 
-       if (g_client_info.is_registered == false) {
-               WDC_LOGE("Client is NOT registered");
-               __WDC_LOG_FUNC_END__;
-               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
-       }
+       CHECK_INITIALIZED();
 
        if (!cb) {
                WDC_LOGE("NULL Param [callback]!");
@@ -3648,7 +3338,7 @@ EXPORT_API int wifi_direct_foreach_persistent_groups(wifi_direct_persistent_grou
        }
 
        WDC_LOGD("wifi_direct_foreach_persistent_groups() SUCCESS");
-//LCOV_EXCL_START
+
        while (g_variant_iter_loop(iter_groups, "a{sv}", &iter_group)) {
                const char *ssid = NULL;
                char *go_mac_address = NULL;
@@ -3679,13 +3369,12 @@ EXPORT_API int wifi_direct_foreach_persistent_groups(wifi_direct_persistent_grou
                        break;
                }
        }
-//LCOV_EXCL_STOP
+
        g_variant_iter_free(iter_groups);
        __WDC_LOG_FUNC_END__;
        return WIFI_DIRECT_ERROR_NONE;
 }
 
-//LCOV_EXCL_START
 EXPORT_API int wifi_direct_remove_persistent_group(char *mac_address, const char *ssid)
 {
        __WDC_LOG_FUNC_START__;
@@ -3697,11 +3386,7 @@ EXPORT_API int wifi_direct_remove_persistent_group(char *mac_address, const char
        GVariant *params = NULL;
        int ret = WIFI_DIRECT_ERROR_NONE;
 
-       if (g_client_info.is_registered == false) {
-               WDC_LOGE("Client is NOT registered");
-               __WDC_LOG_FUNC_END__;
-               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
-       }
+       CHECK_INITIALIZED();
 
        if (!mac_address || !ssid) {
                WDC_LOGE("NULL Param");
@@ -3724,9 +3409,8 @@ EXPORT_API int wifi_direct_remove_persistent_group(char *mac_address, const char
        WDC_LOGD("%s() return : [%d]", __func__, ret);
 
        __WDC_LOG_FUNC_END__;
-       return WIFI_DIRECT_ERROR_NONE;
+       return ret;
 }
-//LCOV_EXCL_STOP
 
 EXPORT_API int wifi_direct_start_service_discovery(char *mac_address,
                wifi_direct_service_type_e type)
@@ -3735,18 +3419,13 @@ EXPORT_API int wifi_direct_start_service_discovery(char *mac_address,
 
        CHECK_FEATURE_SUPPORTED(WIFIDIRECT_SERVICE_DISCOVERY_FEATURE);
 
-//LCOV_EXCL_START
-
        GError* error = NULL;
        GVariant *reply = NULL;
        GVariant *params = NULL;
        int ret = WIFI_DIRECT_ERROR_NONE;
 
-       if (g_client_info.is_registered == false) {
-               WDC_LOGE("Client is NOT registered.");
-               __WDC_LOG_FUNC_END__;
-               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
-       }
+       CHECK_INITIALIZED();
+
        WDC_LOGD("Param service_type [%d]", type);
 
        if (mac_address)
@@ -3767,7 +3446,6 @@ EXPORT_API int wifi_direct_start_service_discovery(char *mac_address,
 
        WDC_LOGD("%s() return : [%d]", __func__, ret);
        __WDC_LOG_FUNC_END__;
-//LCOV_EXCL_STOP
        return ret;
 }
 
@@ -3778,17 +3456,13 @@ EXPORT_API int wifi_direct_cancel_service_discovery(char *mac_address,
        __WDC_LOG_FUNC_START__;
 
        CHECK_FEATURE_SUPPORTED(WIFIDIRECT_SERVICE_DISCOVERY_FEATURE);
-//LCOV_EXCL_START
        GError* error = NULL;
        GVariant *reply = NULL;
        GVariant *params = NULL;
        int ret = WIFI_DIRECT_ERROR_NONE;
 
-       if (g_client_info.is_registered == false) {
-               WDC_LOGE("Client is NOT registered.");
-               __WDC_LOG_FUNC_END__;
-               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
-       }
+       CHECK_INITIALIZED();
+
        WDC_LOGD("Param service_type [%d]", type);
 
        if (mac_address)
@@ -3809,7 +3483,6 @@ EXPORT_API int wifi_direct_cancel_service_discovery(char *mac_address,
 
        WDC_LOGD("%s() return : [%d]", __func__, ret);
        __WDC_LOG_FUNC_END__;
-//LCOV_EXCL_STOP
        return ret;
 }
 
@@ -3818,7 +3491,7 @@ EXPORT_API int wifi_direct_register_service(wifi_direct_service_type_e type, cha
        __WDC_LOG_FUNC_START__;
 
        CHECK_FEATURE_SUPPORTED(WIFIDIRECT_SERVICE_DISCOVERY_FEATURE);
-//LCOV_EXCL_START
+
        GError* error = NULL;
        GVariant *reply = NULL;
        GVariant *params = NULL;
@@ -3826,20 +3499,10 @@ EXPORT_API int wifi_direct_register_service(wifi_direct_service_type_e type, cha
        int ret = WIFI_DIRECT_ERROR_NONE;
        int len = 0;
 
-       if (g_client_info.is_registered == false) {
-               WDC_LOGE("Client is NOT registered.");
-               __WDC_LOG_FUNC_END__;
-               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
-       }
+       CHECK_INITIALIZED();
 
-       if (!info1 || !info2) {
-               WDC_LOGE("info1 or info2 is NULL");
-               __WDC_LOG_FUNC_END__;
-               return WIFI_DIRECT_ERROR_INVALID_PARAMETER;
-       }
-
-       if (!service_id) {
-               WDC_LOGE("Invalid Param [service_id]!");
+       if ((!info1 || !info2) || !service_id) {
+               WDC_LOGE("Invalid Param!");
                __WDC_LOG_FUNC_END__;
                return WIFI_DIRECT_ERROR_INVALID_PARAMETER;
        }
@@ -3875,7 +3538,6 @@ EXPORT_API int wifi_direct_register_service(wifi_direct_service_type_e type, cha
 
        WDC_LOGD("%s() return : [%d]", __func__, ret);
        __WDC_LOG_FUNC_END__;
-//LCOV_EXCL_STOP
        return ret;
 }
 
@@ -3884,17 +3546,13 @@ EXPORT_API int wifi_direct_deregister_service(unsigned int service_id)
        __WDC_LOG_FUNC_START__;
 
        CHECK_FEATURE_SUPPORTED(WIFIDIRECT_SERVICE_DISCOVERY_FEATURE);
-//LCOV_EXCL_START
+
        GError* error = NULL;
        GVariant *reply = NULL;
        GVariant *params = NULL;
        int ret = WIFI_DIRECT_ERROR_NONE;
 
-       if (g_client_info.is_registered == false) {
-               WDC_LOGE("Client is NOT registered.");
-               __WDC_LOG_FUNC_END__;
-               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
-       }
+       CHECK_INITIALIZED();
 
        params = g_variant_new("(i)", service_id);
        reply = wifi_direct_dbus_method_call_sync(WFD_MANAGER_SERVICE_INTERFACE,
@@ -3910,7 +3568,6 @@ EXPORT_API int wifi_direct_deregister_service(unsigned int service_id)
 
        WDC_LOGD("%s() return : [%d]", __func__, ret);
        __WDC_LOG_FUNC_END__;
-//LCOV_EXCL_STOP
        return ret;
 }
 
@@ -3942,24 +3599,13 @@ EXPORT_API int wifi_direct_get_peer_info(char* mac_address, wifi_direct_discover
        gchar *key = NULL;
        int ret = WIFI_DIRECT_ERROR_NONE;
 
-       if (g_client_info.is_registered == false) {
-               WDC_LOGE("Client is NOT registered");
-               __WDC_LOG_FUNC_END__;
-               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
-       }
+       CHECK_INITIALIZED();
 
-       if (!mac_address) {
-               WDC_LOGE("mac_addr is NULL");
+       if (!mac_address || !peer_info) {
                __WDC_LOG_FUNC_END__;
                return WIFI_DIRECT_ERROR_INVALID_PARAMETER;
        }
 
-       if (!peer_info) {
-               WDC_LOGE("peer_info is NULL");
-               __WDC_LOG_FUNC_END__;
-               return WIFI_DIRECT_ERROR_INVALID_PARAMETER;
-       }
-//LCOV_EXCL_START
        params = g_variant_new("(s)", mac_address);
        reply = wifi_direct_dbus_method_call_sync(WFD_MANAGER_MANAGE_INTERFACE,
                                                  "GetPeerInfo", params, &error);
@@ -4037,7 +3683,6 @@ EXPORT_API int wifi_direct_get_peer_info(char* mac_address, wifi_direct_discover
        *peer_info = peer;
 
        g_variant_unref(reply);
-//LCOV_EXCL_STOP
        __WDC_LOG_FUNC_END__;
        return WIFI_DIRECT_ERROR_NONE;
 }
@@ -4053,11 +3698,7 @@ EXPORT_API int wifi_direct_set_passphrase(const char *passphrase)
        GVariant *params = NULL;
        int ret = WIFI_DIRECT_ERROR_NONE;
 
-       if (g_client_info.is_registered == false) {
-               WDC_LOGE("Client is NOT registered.");
-               __WDC_LOG_FUNC_END__;
-               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
-       }
+       CHECK_INITIALIZED();
 
        if (!passphrase) {
                WDC_LOGE("NULL Param [passphrase]!");
@@ -4081,7 +3722,7 @@ EXPORT_API int wifi_direct_set_passphrase(const char *passphrase)
        WDC_LOGD("%s() SUCCESS", __func__);
 
        __WDC_LOG_FUNC_END__;
-       return WIFI_DIRECT_ERROR_NONE;
+       return ret;
 }
 
 EXPORT_API int wifi_direct_get_passphrase(char** passphrase)
@@ -4095,11 +3736,7 @@ EXPORT_API int wifi_direct_get_passphrase(char** passphrase)
        const char *val = NULL;
        int ret = WIFI_DIRECT_ERROR_NONE;
 
-       if (g_client_info.is_registered == false) {
-               WDC_LOGE("Client is NOT registered.");
-               __WDC_LOG_FUNC_END__;
-               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
-       }
+       CHECK_INITIALIZED();
 
        if (!passphrase) {
                WDC_LOGE("NULL Param [passphrase]!");
@@ -4138,11 +3775,7 @@ EXPORT_API int wifi_direct_set_autoconnection_peer(char *mac_address)
        GVariant *params = NULL;
        int ret = WIFI_DIRECT_ERROR_NONE;
 
-       if (g_client_info.is_registered == false) {
-               WDC_LOGE("Client is NOT registered.");
-               __WDC_LOG_FUNC_END__;
-               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
-       }
+       CHECK_INITIALIZED();
 
        if (!mac_address) {
                WDC_LOGE("NULL Param!");
@@ -4177,11 +3810,7 @@ EXPORT_API int wifi_direct_init_display(void)
        GVariant *reply = NULL;
        int ret = WIFI_DIRECT_ERROR_NONE;
 
-       if (g_client_info.is_registered == false) {
-               WDC_LOGE("Client is NOT registered.");
-               __WDC_LOG_FUNC_END__;
-               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
-       }
+       CHECK_INITIALIZED();
 
        reply = wifi_direct_dbus_method_call_sync(WFD_MANAGER_DISPLAY_INTERFACE,
                                          "Init",
@@ -4210,11 +3839,7 @@ EXPORT_API int wifi_direct_deinit_display(void)
        GVariant *reply = NULL;
        int ret = WIFI_DIRECT_ERROR_NONE;
 
-       if (g_client_info.is_registered == false) {
-               WDC_LOGE("Client is NOT registered");
-               __WDC_LOG_FUNC_END__;
-               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
-       }
+       CHECK_INITIALIZED();
 
        reply = wifi_direct_dbus_method_call_sync(WFD_MANAGER_DISPLAY_INTERFACE,
                                          "Deinit",
@@ -4244,11 +3869,7 @@ EXPORT_API int wifi_direct_set_display(wifi_direct_display_type_e type, int port
        GVariant *params = NULL;
        int ret = WIFI_DIRECT_ERROR_NONE;
 
-       if (g_client_info.is_registered == false) {
-               WDC_LOGE("Client is NOT registered");
-               __WDC_LOG_FUNC_END__;
-               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
-       }
+       CHECK_INITIALIZED();
 
        if (port < 0 || hdcp < 0) {
                WDC_LOGE("Invalid paramaeters passed type[%d], port[%d], hdcp[%d]!", type, port, hdcp);
@@ -4285,12 +3906,7 @@ EXPORT_API int wifi_direct_set_display_availability(bool availability)
        GVariant *params = NULL;
        int ret = WIFI_DIRECT_ERROR_NONE;
 
-       if (g_client_info.is_registered == false) {
-               WDC_LOGE("Client is NOT registered.");
-               __WDC_LOG_FUNC_END__;
-               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
-       }
-
+       CHECK_INITIALIZED();
 
        params = g_variant_new("(i)", availability);
        reply = wifi_direct_dbus_method_call_sync(WFD_MANAGER_DISPLAY_INTERFACE,
@@ -4321,11 +3937,7 @@ EXPORT_API int wifi_direct_get_display(wifi_direct_display_type_e *type, int *po
        int ret = WIFI_DIRECT_ERROR_NONE;
        int val = 0;
 
-       if (g_client_info.is_registered == false) {
-               WDC_LOGE("Client is NOT registered");
-               __WDC_LOG_FUNC_END__;
-               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
-       }
+       CHECK_INITIALIZED();
 
        if (!type || !port || !hdcp) {
                WDC_LOGE("Invalid paramaeters passed!");
@@ -4363,11 +3975,7 @@ EXPORT_API int wifi_direct_get_display_availability(bool *availability)
        int ret = WIFI_DIRECT_ERROR_NONE;
        int val = 0;
 
-       if (g_client_info.is_registered == false) {
-               WDC_LOGE("Client is NOT registered.");
-               __WDC_LOG_FUNC_END__;
-               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
-       }
+       CHECK_INITIALIZED();
 
        if (!availability) {
                WDC_LOGE("Invalid paramaeters passed!");
@@ -4394,7 +4002,6 @@ EXPORT_API int wifi_direct_get_display_availability(bool *availability)
        return ret;
 }
 
-//LCOV_EXCL_START
 EXPORT_API int wifi_direct_get_peer_display_type(char *mac_address, wifi_direct_display_type_e *type)
 {
        __WDC_LOG_FUNC_START__;
@@ -4407,11 +4014,7 @@ EXPORT_API int wifi_direct_get_peer_display_type(char *mac_address, wifi_direct_
        int val = 0;
        int ret = WIFI_DIRECT_ERROR_NONE;
 
-       if (g_client_info.is_registered == false) {
-               WDC_LOGE("Client is NOT registered");
-               __WDC_LOG_FUNC_END__;
-               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
-       }
+       CHECK_INITIALIZED();
 
        if (!mac_address || !type) {
                WDC_LOGE("NULL Param!");
@@ -4451,11 +4054,7 @@ EXPORT_API int wifi_direct_get_peer_display_availability(char *mac_address, bool
        int val = 0;
        int ret = WIFI_DIRECT_ERROR_NONE;
 
-       if (g_client_info.is_registered == false) {
-               WDC_LOGE("Client is NOT registered");
-               __WDC_LOG_FUNC_END__;
-               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
-       }
+       CHECK_INITIALIZED();
 
        if (!mac_address || !availability) {
                WDC_LOGE("NULL Param!");
@@ -4495,11 +4094,7 @@ EXPORT_API int wifi_direct_get_peer_display_hdcp(char *mac_address, int *hdcp)
        int val = 0;
        int ret = WIFI_DIRECT_ERROR_NONE;
 
-       if (g_client_info.is_registered == false) {
-               WDC_LOGE("Client is NOT registered");
-               __WDC_LOG_FUNC_END__;
-               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
-       }
+       CHECK_INITIALIZED();
 
        if (!mac_address || !hdcp) {
                WDC_LOGE("NULL Param!");
@@ -4539,11 +4134,7 @@ EXPORT_API int wifi_direct_get_peer_display_port(char *mac_address, int *port)
        int val = 0;
        int ret = WIFI_DIRECT_ERROR_NONE;
 
-       if (g_client_info.is_registered == false) {
-               WDC_LOGE("Client is NOT registered");
-               __WDC_LOG_FUNC_END__;
-               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
-       }
+       CHECK_INITIALIZED();
 
        if (!mac_address || !port) {
                WDC_LOGE("NULL Param!");
@@ -4583,11 +4174,7 @@ EXPORT_API int wifi_direct_get_peer_display_throughput(char *mac_address, int *t
        int val = 0;
        int ret = WIFI_DIRECT_ERROR_NONE;
 
-       if (g_client_info.is_registered == false) {
-               WDC_LOGE("Client is NOT registered");
-               __WDC_LOG_FUNC_END__;
-               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
-       }
+       CHECK_INITIALIZED();
 
        if (!mac_address || !throughput) {
                WDC_LOGE("NULL Param!");
@@ -4626,11 +4213,8 @@ EXPORT_API int wifi_direct_set_session_timer(int seconds)
        GVariant *params = NULL;
        int ret = WIFI_DIRECT_ERROR_NONE;
 
-       if (g_client_info.is_registered == false) {
-               WDC_LOGE("Client is NOT registered.");
-               __WDC_LOG_FUNC_END__;
-               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
-       }
+       CHECK_INITIALIZED();
+
        if (seconds < 0) {
                WDC_LOGE("Negative Timer Value");
                __WDC_LOG_FUNC_END__;
@@ -4651,10 +4235,8 @@ EXPORT_API int wifi_direct_set_session_timer(int seconds)
                g_variant_unref(reply);
        }
 
-       WDC_LOGD("%s() SUCCESS", __func__);
-
        __WDC_LOG_FUNC_END__;
-       return WIFI_DIRECT_ERROR_NONE;
+       return ret;
 
 }
 
@@ -4669,11 +4251,7 @@ EXPORT_API int wifi_direct_get_session_timer(int *seconds)
        int val = 0;
        int ret = WIFI_DIRECT_ERROR_NONE;
 
-       if (g_client_info.is_registered == false) {
-               WDC_LOGE("Client is NOT registered");
-               __WDC_LOG_FUNC_END__;
-               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
-       }
+       CHECK_INITIALIZED();
 
        if (!seconds) {
                WDC_LOGE("Invalid Parameter");
@@ -4712,11 +4290,7 @@ EXPORT_API int wifi_direct_set_auto_group_removal(bool enable)
        GVariant *params = NULL;
        int ret = WIFI_DIRECT_ERROR_NONE;
 
-       if (g_client_info.is_registered == false) {
-               WDC_LOGE("Client is NOT registered");
-               __WDC_LOG_FUNC_END__;
-               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
-       }
+       CHECK_INITIALIZED();
 
        params = g_variant_new("(b)", enable);
        reply = wifi_direct_dbus_method_call_sync(WFD_MANAGER_CONFIG_INTERFACE,
@@ -4747,11 +4321,7 @@ EXPORT_API int wifi_direct_get_peer_rssi(char *mac_address, int *rssi)
        int val = 0;
        int ret = WIFI_DIRECT_ERROR_NONE;
 
-       if (g_client_info.is_registered == false) {
-               WDC_LOGE("Client is NOT registered");
-               __WDC_LOG_FUNC_END__;
-               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
-       }
+       CHECK_INITIALIZED();
 
        if (!mac_address || !rssi) {
                WDC_LOGE("NULL Param!");
@@ -4792,11 +4362,7 @@ EXPORT_API int wifi_direct_add_vsie(wifi_direct_vsie_frames_e frame_id,
        GVariant *params = NULL;
        int ret = WIFI_DIRECT_ERROR_NONE;
 
-       if (g_client_info.is_registered == false) {
-               WDC_LOGE("Client is NOT registered.");
-               __WDC_LOG_FUNC_END__;
-               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
-       }
+       CHECK_INITIALIZED();
 
        if (!vsie_str) {
                WDC_LOGE("NULL Param [vsie_str]!");
@@ -4832,11 +4398,7 @@ EXPORT_API int wifi_direct_get_vsie(wifi_direct_vsie_frames_e frame_id, char **v
        const char *val = NULL;
        int ret = WIFI_DIRECT_ERROR_NONE;
 
-       if (g_client_info.is_registered == false) {
-               WDC_LOGE("Client is NOT registered.");
-               __WDC_LOG_FUNC_END__;
-               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
-       }
+       CHECK_INITIALIZED();
 
        if (!vsie_str) {
                WDC_LOGE("NULL Param [vsie_str]!");
@@ -4874,11 +4436,7 @@ EXPORT_API int wifi_direct_remove_vsie(wifi_direct_vsie_frames_e frame_id,
        GVariant *params = NULL;
        int ret = WIFI_DIRECT_ERROR_NONE;
 
-       if (g_client_info.is_registered == false) {
-               WDC_LOGE("Client is NOT registered.");
-               __WDC_LOG_FUNC_END__;
-               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
-       }
+       CHECK_INITIALIZED();
 
        if (!vsie_str) {
                WDC_LOGE("NULL Param [vsie_str]!");
@@ -4915,11 +4473,7 @@ EXPORT_API int wifi_direct_get_connecting_peer_info(
        wifi_direct_discovered_peer_info_s *peer = NULL;
        int ret = WIFI_DIRECT_ERROR_NONE;
 
-       if (g_client_info.is_registered == false) {
-               WDC_LOGE("Client is NOT registered");
-               __WDC_LOG_FUNC_END__;
-               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
-       }
+       CHECK_INITIALIZED();
 
        if (!peer_info) {
                WDC_LOGE("peer_info is NULL");
@@ -4977,11 +4531,7 @@ EXPORT_API int wifi_direct_get_peer_vsie(char *mac_address, char **vsie)
        const gchar *val = 0;
        int ret = WIFI_DIRECT_ERROR_NONE;
 
-       if (g_client_info.is_registered == false) {
-               WDC_LOGE("Client is NOT registered");
-               __WDC_LOG_FUNC_END__;
-               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
-       }
+       CHECK_INITIALIZED();
 
        if (!mac_address || !vsie) {
                WDC_LOGE("NULL Param!");
@@ -5009,7 +4559,6 @@ EXPORT_API int wifi_direct_get_peer_vsie(char *mac_address, char **vsie)
        __WDC_LOG_FUNC_END__;
        return ret;
 }
-//LCOV_EXCL_STOP
 
 EXPORT_API int wifi_direct_set_wps_config_method(int type)
 {
@@ -5022,11 +4571,7 @@ EXPORT_API int wifi_direct_set_wps_config_method(int type)
        GVariant *params = NULL;
        int ret = WIFI_DIRECT_ERROR_NONE;
 
-       if (g_client_info.is_registered == false) {
-               WDC_LOGE("Client is NOT registered");
-               __WDC_LOG_FUNC_END__;
-               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
-       }
+       CHECK_INITIALIZED();
 
        if ((type < WIFI_DIRECT_CONFIG_METHOD_DEFAULT) ||
                (type > WIFI_DIRECT_CONFIG_METHOD_PIN_KEYPAD)) {
@@ -5065,11 +4610,7 @@ EXPORT_API int wifi_direct_get_wps_config_method(int *type)
        int mode = 0;
        int ret = 0;
 
-       if (g_client_info.is_registered == false) {
-               WDC_LOGE("Client is NOT registered");
-               __WDC_LOG_FUNC_END__;
-               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
-       }
+       CHECK_INITIALIZED();
 
        if (!type) {
                WDC_LOGE("NULL Param type");
@@ -5107,11 +4648,7 @@ EXPORT_API int wifi_direct_remove_persistent_device(char *mac_address)
        GVariant *params = NULL;
        int ret = WIFI_DIRECT_ERROR_NONE;
 
-       if (g_client_info.is_registered == false) {
-               WDC_LOGE("Client is NOT registered");
-               __WDC_LOG_FUNC_END__;
-               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
-       }
+       CHECK_INITIALIZED();
 
        if (!mac_address) {
                WDC_LOGE("NULL Param");
@@ -5147,11 +4684,7 @@ EXPORT_API int wifi_direct_remove_all_persistent_devices(void)
        GVariant *reply = NULL;
        int ret = WIFI_DIRECT_ERROR_NONE;
 
-       if (g_client_info.is_registered == false) {
-               WDC_LOGE("Client is NOT registered");
-               __WDC_LOG_FUNC_END__;
-               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
-       }
+       CHECK_INITIALIZED();
 
        reply = wifi_direct_dbus_method_call_sync(WFD_MANAGER_GROUP_INTERFACE,
                        "RemoveAllPersistentDevice",