Upgrading signal subscription logic.
[platform/core/api/wifi-direct.git] / src / wifi-direct-client-proxy.c
index 3f35ce5..5cefcec 100644 (file)
@@ -164,7 +164,12 @@ void __wfd_vconf_state_changed_cb(keynode_t *key, void *data)
 
 /* Manage */
 void wifi_direct_process_manage_activation(GDBusConnection *connection,
-               const gchar *object_path, GVariant *parameters)
+                                          const gchar *sender,
+                                          const gchar *object_path,
+                                          const gchar *interface,
+                                          const gchar *signal,
+                                          GVariant *parameters,
+                                          gpointer user_data)
 {
        __WDC_LOG_FUNC_START__;
        int error_code;
@@ -190,7 +195,12 @@ void wifi_direct_process_manage_activation(GDBusConnection *connection,
 }
 
 void wifi_direct_process_manage_deactivation(GDBusConnection *connection,
-               const gchar *object_path, GVariant *parameters)
+                                            const gchar *sender,
+                                            const gchar *object_path,
+                                            const gchar *interface,
+                                            const gchar *signal,
+                                            GVariant *parameters,
+                                            gpointer user_data)
 {
        __WDC_LOG_FUNC_START__;
        int error_code;
@@ -218,7 +228,12 @@ void wifi_direct_process_manage_deactivation(GDBusConnection *connection,
 
 //LCOV_EXCL_START
 void wifi_direct_process_manage_connection(GDBusConnection *connection,
-               const gchar *object_path, GVariant *parameters)
+                                          const gchar *sender,
+                                          const gchar *object_path,
+                                          const gchar *interface,
+                                          const gchar *signal,
+                                          GVariant *parameters,
+                                          gpointer user_data)
 {
        __WDC_LOG_FUNC_START__;
        int error_code;
@@ -249,7 +264,12 @@ void wifi_direct_process_manage_connection(GDBusConnection *connection,
 }
 
 void wifi_direct_process_manage_disconnection(GDBusConnection *connection,
-               const gchar *object_path, GVariant *parameters)
+                                             const gchar *sender,
+                                             const gchar *object_path,
+                                             const gchar *interface,
+                                             const gchar *signal,
+                                             GVariant *parameters,
+                                             gpointer user_data)
 {
        __WDC_LOG_FUNC_START__;
        int error_code;
@@ -280,7 +300,12 @@ void wifi_direct_process_manage_disconnection(GDBusConnection *connection,
 }
 
 void wifi_direct_process_manage_peer_ip_assigned(GDBusConnection *connection,
-               const gchar *object_path, GVariant *parameters)
+                                                const gchar *sender,
+                                                const gchar *object_path,
+                                                const gchar *interface,
+                                                const gchar *signal,
+                                                GVariant *parameters,
+                                                gpointer user_data)
 {
        __WDC_LOG_FUNC_START__;
        char *get_str = NULL;
@@ -330,7 +355,12 @@ void wifi_direct_process_manage_peer_ip_assigned(GDBusConnection *connection,
 }
 
 void wifi_direct_process_manage_listen_started(GDBusConnection *connection,
-               const gchar *object_path, GVariant *parameters)
+                                              const gchar *sender,
+                                              const gchar *object_path,
+                                              const gchar *interface,
+                                              const gchar *signal,
+                                              GVariant *parameters,
+                                              gpointer user_data)
 {
        __WDC_LOG_FUNC_START__;
        wifi_direct_client_info_s *client = __wfd_get_control();
@@ -349,7 +379,12 @@ void wifi_direct_process_manage_listen_started(GDBusConnection *connection,
 }
 
 void wifi_direct_process_manage_discovery_started(GDBusConnection *connection,
-               const gchar *object_path, GVariant *parameters)
+                                                 const gchar *sender,
+                                                 const gchar *object_path,
+                                                 const gchar *interface,
+                                                 const gchar *signal,
+                                                 GVariant *parameters,
+                                                 gpointer user_data)
 {
        __WDC_LOG_FUNC_START__;
        wifi_direct_client_info_s *client = __wfd_get_control();
@@ -368,7 +403,12 @@ void wifi_direct_process_manage_discovery_started(GDBusConnection *connection,
 }
 
 void wifi_direct_process_manage_discovery_finished(GDBusConnection *connection,
-               const gchar *object_path, GVariant *parameters)
+                                                  const gchar *sender,
+                                                  const gchar *object_path,
+                                                  const gchar *interface,
+                                                  const gchar *signal,
+                                                  GVariant *parameters,
+                                                  gpointer user_data)
 {
        __WDC_LOG_FUNC_START__;
        wifi_direct_client_info_s *client = __wfd_get_control();
@@ -387,7 +427,12 @@ void wifi_direct_process_manage_discovery_finished(GDBusConnection *connection,
 }
 
 void wifi_direct_process_manage_peer_found(GDBusConnection *connection,
-               const gchar *object_path, GVariant *parameters)
+                                          const gchar *sender,
+                                          const gchar *object_path,
+                                          const gchar *interface,
+                                          const gchar *signal,
+                                          GVariant *parameters,
+                                          gpointer user_data)
 {
        __WDC_LOG_FUNC_START__;
        const gchar *peer_mac_address = NULL;
@@ -423,7 +468,12 @@ void wifi_direct_process_manage_peer_found(GDBusConnection *connection,
 }
 
 void wifi_direct_process_manage_peer_lost(GDBusConnection *connection,
-               const gchar *object_path, GVariant *parameters)
+                                         const gchar *sender,
+                                         const gchar *object_path,
+                                         const gchar *interface,
+                                         const gchar *signal,
+                                         GVariant *parameters,
+                                         gpointer user_data)
 {
        __WDC_LOG_FUNC_START__;
        const gchar *peer_mac_address = NULL;
@@ -460,7 +510,12 @@ void wifi_direct_process_manage_peer_lost(GDBusConnection *connection,
 
 /* Group */
 void wifi_direct_process_group_created(GDBusConnection *connection,
-               const gchar *object_path, GVariant *parameters)
+                                      const gchar *sender,
+                                      const gchar *object_path,
+                                      const gchar *interface,
+                                      const gchar *signal,
+                                      GVariant *parameters,
+                                      gpointer user_data)
 {
        __WDC_LOG_FUNC_START__;
        wifi_direct_client_info_s *client = __wfd_get_control();
@@ -480,7 +535,12 @@ void wifi_direct_process_group_created(GDBusConnection *connection,
 }
 
 void wifi_direct_process_group_destroyed(GDBusConnection *connection,
-               const gchar *object_path, GVariant *parameters)
+                                        const gchar *sender,
+                                        const gchar *object_path,
+                                        const gchar *interface,
+                                        const gchar *signal,
+                                        GVariant *parameters,
+                                        gpointer user_data)
 {
        __WDC_LOG_FUNC_START__;
        wifi_direct_client_info_s *client = __wfd_get_control();
@@ -502,7 +562,12 @@ void wifi_direct_process_group_destroyed(GDBusConnection *connection,
 #ifdef TIZEN_FEATURE_SERVICE_DISCOVERY
 /* Service */
 void wifi_direct_process_service_discovery_started(GDBusConnection *connection,
-               const gchar *object_path, GVariant *parameters)
+                                                  const gchar *sender,
+                                                  const gchar *object_path,
+                                                  const gchar *interface,
+                                                  const gchar *signal,
+                                                  GVariant *parameters,
+                                                  gpointer user_data)
 {
        __WDC_LOG_FUNC_START__;
        wifi_direct_client_info_s *client = __wfd_get_control();
@@ -524,7 +589,12 @@ void wifi_direct_process_service_discovery_started(GDBusConnection *connection,
 }
 
 void wifi_direct_process_service_discovery_found(GDBusConnection *connection,
-               const gchar *object_path, GVariant *parameters)
+                                                const gchar *sender,
+                                                const gchar *object_path,
+                                                const gchar *interface,
+                                                const gchar *signal,
+                                                GVariant *parameters,
+                                                gpointer user_data)
 {
        __WDC_LOG_FUNC_START__;
        wifi_direct_service_type_e service_type;
@@ -557,7 +627,12 @@ void wifi_direct_process_service_discovery_found(GDBusConnection *connection,
 }
 
 void wifi_direct_process_service_discovery_finished(GDBusConnection *connection,
-               const gchar *object_path, GVariant *parameters)
+                                                   const gchar *sender,
+                                                   const gchar *object_path,
+                                                   const gchar *interface,
+                                                   const gchar *signal,
+                                                   GVariant *parameters,
+                                                   gpointer user_data)
 {
        __WDC_LOG_FUNC_START__;
        wifi_direct_client_info_s *client = __wfd_get_control();
@@ -2953,11 +3028,10 @@ int wifi_direct_get_primary_device_type(wifi_direct_primary_device_type_e* type)
 
        CHECK_FEATURE_SUPPORTED(WIFIDIRECT_FEATURE);
 
-       if (!type) {
-               WDC_LOGE("NULL Param [type]!");
-               __WDC_LOG_FUNC_END__;
-               return WIFI_DIRECT_ERROR_INVALID_PARAMETER;
-       }
+       GError* error = NULL;
+       GVariant *reply = NULL;
+       int ret = WIFI_DIRECT_ERROR_NONE;
+       int primary_device_type = 0;
 
        if (g_client_info.is_registered == false) {
                WDC_LOGE("Client is NOT registered");
@@ -2965,16 +3039,27 @@ int wifi_direct_get_primary_device_type(wifi_direct_primary_device_type_e* type)
                return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
        }
 
-#ifdef TIZEN_TV
-       WDC_LOGD("Current primary_dev_type [%d]", WIFI_DIRECT_PRIMARY_DEVICE_TYPE_DISPLAY);
-       *type = WIFI_DIRECT_PRIMARY_DEVICE_TYPE_DISPLAY;
-#else /* TIZEN_TV */
-       WDC_LOGD("Current primary_dev_type [%d]", WIFI_DIRECT_PRIMARY_DEVICE_TYPE_TELEPHONE);
-       *type = WIFI_DIRECT_PRIMARY_DEVICE_TYPE_TELEPHONE;
-#endif /* TIZEN_TV */
+       if (type == NULL) {
+               WDC_LOGE("NULL Param [type]!");
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_INVALID_PARAMETER;
+       }
+
+       reply = wifi_direct_dbus_method_call_sync(WFD_MANAGER_CONFIG_INTERFACE,
+                                                 "GetPrimaryDevType",
+                                                 NULL, &error);
+
+       ret = __net_wifidirect_gerror_to_enum(error);
+       if (ret != WIFI_DIRECT_ERROR_NONE)
+               return ret;
+
+       WDC_LOGD("%s() SUCCESS", __func__);
+       g_variant_get(reply, "(ii)", &ret, &primary_device_type);
+       g_variant_unref(reply);
+       *type = primary_device_type;
 
        __WDC_LOG_FUNC_END__;
-       return WIFI_DIRECT_ERROR_NONE;
+       return ret;
 }
 
 int wifi_direct_get_secondary_device_type(wifi_direct_secondary_device_type_e* type)
@@ -2983,28 +3068,38 @@ int wifi_direct_get_secondary_device_type(wifi_direct_secondary_device_type_e* t
 
        CHECK_FEATURE_SUPPORTED(WIFIDIRECT_FEATURE);
 
+       GError* error = NULL;
+       GVariant *reply = NULL;
+       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;
        }
 
-       if (NULL == type) {
+       if (type == NULL) {
                WDC_LOGE("NULL Param [type]!");
                __WDC_LOG_FUNC_END__;
                return WIFI_DIRECT_ERROR_INVALID_PARAMETER;
        }
 
-#ifdef TIZEN_TV
-       WDC_LOGD("Current second_dev_type [%d]", WIFI_DIRECT_SECONDARY_DEVICE_TYPE_DISPLAY_TV);
-       *type = WIFI_DIRECT_SECONDARY_DEVICE_TYPE_DISPLAY_TV;
-#else /* TIZEN_TV */
-       WDC_LOGD("Current second_dev_type [%d]", WIFI_DIRECT_SECONDARY_DEVICE_TYPE_TELEPHONE_SMARTPHONE_DUAL);
-       *type = WIFI_DIRECT_SECONDARY_DEVICE_TYPE_TELEPHONE_SMARTPHONE_DUAL;    /* smart phone dual mode (wifi and cellular) */
-#endif /* TIZEN_TV */
+       reply = wifi_direct_dbus_method_call_sync(WFD_MANAGER_CONFIG_INTERFACE,
+                                                 "GetSecondaryDevType",
+                                                 NULL, &error);
+
+       ret = __net_wifidirect_gerror_to_enum(error);
+       if (ret != WIFI_DIRECT_ERROR_NONE)
+               return ret;
+
+       WDC_LOGD("%s() SUCCESS", __func__);
+       g_variant_get(reply, "(ii)", &ret, &secondary_device_type);
+       g_variant_unref(reply);
+       *type = secondary_device_type;
 
        __WDC_LOG_FUNC_END__;
-       return WIFI_DIRECT_ERROR_NONE;
+       return ret;
 }
 
 int wifi_direct_set_autoconnection_mode(bool mode)