Fix bug 29/165429/2 accepted/tizen/unified/20180103.151855 submit/tizen/20180102.074639
authorchleun.moon <chleun.moon@samsung.com>
Fri, 29 Dec 2017 02:43:34 +0000 (11:43 +0900)
committertaesub kim <taesub.kim@samsung.com>
Tue, 2 Jan 2018 07:08:07 +0000 (16:08 +0900)
Change-Id: Iecba4c567c0bb8d423281fb80ba10331fbd9b66c
Signed-off-by: Cheoleun Moon <chleun.moon@samsung.com>
include/asp-tech.h
src/tech/asp-tech-infra.c

index 64f79c0..e1dd2d6 100755 (executable)
@@ -19,6 +19,8 @@
 
 #include <glib.h>
 
+#include "asp-session.h"
+
 typedef void (*asp_tech_session_request_cb)(gint32 error_code, const guint8 *session_mac, guint32 session_id, guint32 adv_id, const gchar *device_name, size_t name_length, const guint8 *session_info, size_t info_length, gboolean get_pin, guint32 pin, gpointer user_data);
 typedef void (*asp_tech_session_config_request_cb)(gint32 error_code, const guint8 *session_mac, guint32 session_id, gboolean get_pin, guint32 pin, gpointer user_data);
 typedef void (*asp_tech_connect_status_cb)(gint32 error_code, const guint8 *session_mac, guint32 session_id, asp_session_connect_status_e status, gpointer user_data);
index 0411b72..67c3e90 100644 (file)
@@ -232,8 +232,8 @@ static gint32 __asp_service_infra_convert_error_type(gint32 dnssd_error)
 
 static void __init_hash_tables()
 {
-       g_local_service_hash = g_hash_table_new(g_int_hash, g_int_equal);
-       g_browser_hash = g_hash_table_new(g_int_hash, g_int_equal);
+       g_local_service_hash = g_hash_table_new(g_direct_hash, g_direct_equal);
+       g_browser_hash = g_hash_table_new(g_direct_hash, g_direct_equal);
 }
 
 static void __g_hash_free_handle(gpointer key, gpointer value, gpointer user_data)
@@ -393,7 +393,7 @@ gint32 asp_tech_infra_advertise(asp_service_advertise_s *service, gint32 replace
        ASP_LOGD("Success to register local service %u", service_handle);
 
        g_hash_table_insert(g_local_service_hash,
-                       &service->adv_id, &service_handle);
+                       GUINT_TO_POINTER(service->adv_id), GUINT_TO_POINTER(service_handle));
 
        ASP_LOGD("Insert (%u, %u) to g_local_service_hash (size: %d)",
                        service->adv_id, service_handle,
@@ -448,8 +448,8 @@ gint32 asp_tech_infra_cancel_advertise(asp_service_advertise_s *service)
        gint32 result = 0;
        dnssd_service_h service_handle;
 
-       service_handle = *(dnssd_service_h*)g_hash_table_lookup(g_local_service_hash,
-                                                                                                               &service->adv_id);
+       service_handle = (dnssd_service_h)GPOINTER_TO_UINT(g_hash_table_lookup(g_local_service_hash,
+                                                                                                               GUINT_TO_POINTER(service->adv_id)));
 
        if (!service_handle) {
                /* TODO */
@@ -460,6 +460,7 @@ gint32 asp_tech_infra_cancel_advertise(asp_service_advertise_s *service)
        result = dnssd_deregister_local_service(service_handle);
        if (result != DNSSD_ERROR_NONE) {
                result = __asp_service_infra_convert_error_type(result);
+               ASP_LOGE("Failed to deregister local service %u", service_handle);
                return result;
        }
        ASP_LOGD("Success to deregister local service: %u", service_handle);
@@ -479,7 +480,7 @@ gint32 asp_tech_infra_seek(asp_service_seek_s *service)
 {
        __ASP_LOG_FUNC_ENTER__;
        gint32 result = 0;
-       dnssd_service_h browser_handle;
+       dnssd_browser_h browser_handle;
        gchar *if_name;
        wifi_manager_h wifi_handle = NULL;
 
@@ -515,7 +516,7 @@ gint32 asp_tech_infra_seek(asp_service_seek_s *service)
                        service->service_type, browser_handle);
 
        g_hash_table_insert(g_browser_hash,
-                       &service->search_id, &browser_handle);
+                       GUINT_TO_POINTER(service->search_id), GUINT_TO_POINTER(browser_handle));
 
        ASP_LOGD("Insert (%u, %u) to g_browser_hash (size: %d)",
                        service->search_id, browser_handle,
@@ -530,10 +531,10 @@ gint32 asp_tech_infra_cancel_seek(asp_service_seek_s *service)
 {
        __ASP_LOG_FUNC_ENTER__;
        gint32 result = 0;
-       dnssd_service_h browser_handle;
+       dnssd_browser_h browser_handle;
 
-       browser_handle = *(dnssd_service_h*)g_hash_table_lookup(g_browser_hash,
-                                                                                                               &service->search_id);
+       browser_handle = (dnssd_browser_h)GPOINTER_TO_UINT(g_hash_table_lookup(g_browser_hash,
+                                                                                                               GUINT_TO_POINTER(service->search_id)));
 
        if (!browser_handle) {
                /* TODO */