Remove service_type from search_result 59/79859/4
authorchleun.moon <chleun.moon@samsung.com>
Wed, 13 Jul 2016 08:16:00 +0000 (17:16 +0900)
committerchleun.moon <chleun.moon@samsung.com>
Thu, 14 Jul 2016 02:10:44 +0000 (11:10 +0900)
Change-Id: Id2275f243e7b790e14e073e71733f9b80fc9b06b
Signed-off-by: cheoleun <chleun.moon@samsung.com>
include/asp-manager-gdbus.h
include/asp-service.h
src/asp-manager-event.c
src/asp-manager-gdbus.c
src/service/asp-service.c
src/tech/asp-tech-infra.c
src/tech/asp-tech-infra.h
src/tech/asp-tech-p2p.c

index 0d3e53d..8274a9f 100755 (executable)
@@ -42,7 +42,6 @@ void asp_manager_gdbus_notify_search_result(unsigned int search_id,
                                                                                const gchar *service_mac,
                                                                                const gchar *service_device_name,
                                                                                unsigned int adv_id,
-                                                                               const gchar *service_type,
                                                                                const gchar *instance_name,
                                                                                GHashTable *service_info_map,
                                                                                unsigned char service_status);
index 3b825f4..714a726 100755 (executable)
@@ -101,7 +101,6 @@ int asp_service_notify_search_result(unsigned int search_id,
                                                                        const gchar *service_mac,
                                                                        const gchar *service_device_name,
                                                                        unsigned int adv_id,
-                                                                       const gchar *service_type,
                                                                        const gchar *instance_name,
                                                                        GHashTable *service_info,
                                                                        asp_service_status_e service_status);
index cbe5bad..40260a9 100755 (executable)
@@ -66,7 +66,6 @@ void __asp_process_search_result(void *ctx, asp_event_data *data)
                        data->search_result.service_mac,
                        data->search_result.device_name,
                        data->search_result.advertisement_id,
-                       data->search_result.service_type,
                        data->search_result.instance_name,
                        data->search_result.service_info,
                        data->search_result.service_status);
index e7506c5..ac83e3f 100755 (executable)
@@ -904,7 +904,6 @@ void asp_manager_gdbus_notify_search_result(unsigned int search_id,
                                                                                const gchar *service_mac,
                                                                                const gchar *service_device_name,
                                                                                unsigned int adv_id,
-                                                                               const gchar *service_type,
                                                                                const gchar *instance_name,
                                                                                GHashTable *service_info_map,
                                                                                unsigned char service_status)
@@ -928,7 +927,6 @@ void asp_manager_gdbus_notify_search_result(unsigned int search_id,
                g_variant_builder_add(builder, "{sv}", "service_device_name", g_variant_new("s", service_device_name));
        g_variant_builder_add(builder, "{sv}", "adv_id", g_variant_new("u", adv_id));
 
-       g_variant_builder_add(builder, "{sv}", "service_type", g_variant_new("s", service_type));
        if (instance_name)
                g_variant_builder_add(builder, "{sv}", "instance_name", g_variant_new("s", instance_name));
        if (service_info_map != NULL) {
index 2f1bdd7..50367f9 100755 (executable)
@@ -171,7 +171,6 @@ int asp_service_notify_search_result(unsigned int search_id,
                                                                        const gchar *service_mac,
                                                                        const gchar *service_device_name,
                                                                        unsigned int adv_id,
-                                                                       const gchar *service_type,
                                                                        const gchar *instance_name,
                                                                        GHashTable *service_info_map,
                                                                        asp_service_status_e service_status)
@@ -183,7 +182,6 @@ int asp_service_notify_search_result(unsigned int search_id,
                                                                                        service_mac,
                                                                                        service_device_name,
                                                                                        adv_id,
-                                                                                       service_type,
                                                                                        instance_name,
                                                                                        service_info_map,
                                                                                        (unsigned char)service_status);
index 3ee8a5d..fcd1cd7 100755 (executable)
@@ -244,12 +244,12 @@ static int __add_txt_record(dnssd_service_h handle, const char* key, const char*
        unsigned short txt_length;
        void *txt_data;
 
-       result = dnssd_service_add_txt_record(handle, key, len, value);
+       result = dnssd_service_add_txt_record(handle, key, (unsigned short)len, value);
        if (result != DNSSD_ERROR_NONE) {
                result = __asp_service_infra_convert_error_type(result);
                return result;
        }
-       ASP_LOGD("Add (%s:%s) TXT record. length: %d", key, value, len);
+       ASP_LOGD("Add (%s=%s) TXT record. length: %d", key, value, len);
 
        result = dnssd_service_get_all_txt_record(handle, &txt_length, &txt_data);
        if (result != DNSSD_ERROR_NONE) {
@@ -258,7 +258,8 @@ static int __add_txt_record(dnssd_service_h handle, const char* key, const char*
        }
        ASP_LOGD("Get all TXT records");
 
-       result = dnssd_service_set_record(handle, 16, txt_length, txt_data);
+       result = dnssd_service_set_record(handle, 
+                       ASP_INFRA_DNSSD_TXT_RECORD_TYPE, txt_length, txt_data);
        if (result != DNSSD_ERROR_NONE) {
                ASP_LOGE("Failed to add record");
                result = __asp_service_infra_convert_error_type(result);
index d15a2dc..99492bf 100755 (executable)
@@ -21,4 +21,6 @@
 #define ASP_INFRA_MAC_ADDR_KEY "wfa_asp_mac_addr"
 #define ASP_INFRA_DEV_NAME "wfa_asp_dev_name"
 
+#define ASP_INFRA_DNSSD_TXT_RECORD_TYPE 16
+
 #endif /* __ASP_TECH_INFRA_H__ */
index 979bc35..a41d0a1 100755 (executable)
@@ -293,14 +293,13 @@ void asp_tech_p2p_process_search_result(GDBusConnection *connection,
        GVariantIter *iter = NULL;
        GVariant *var = NULL;
        asp_event_data event;
-       unsigned char service_mac[MAC_LEN] = {0,};
+       const char *service_mac = NULL;
        const char *key = NULL;
        const char *str = NULL;
        long long unsigned search_id = 0;
        char *device_name = NULL;
        unsigned int advertisement_id = 0;
        unsigned int config_method = 0;
-       char *service_type = NULL;
        char *instance_name = NULL;
        char *service_info = NULL;
        unsigned char status = 0;
@@ -315,8 +314,7 @@ void asp_tech_p2p_process_search_result(GDBusConnection *connection,
                if (!g_strcmp0(key, "search_id")) {
                        g_variant_get(var, "t", &search_id);
                } else if (!g_strcmp0(key, "service_mac")) {
-                       if (asp_dbus_unpack_ay(service_mac, var, MAC_LEN) < 0)
-                               return;
+                       g_variant_get(var, "&s", &service_mac);
                } else if (!g_strcmp0(key, "device_name")) {
                        g_variant_get(var, "&s", &str);
                        device_name = g_strndup(str, ASP_SERVICE_DEVICE_NAME_LEN);
@@ -324,12 +322,6 @@ void asp_tech_p2p_process_search_result(GDBusConnection *connection,
                        g_variant_get(var, "u", &advertisement_id);
                } else if (!g_strcmp0(key, "config_method")) {
                        g_variant_get(var, "u", &config_method);
-               } else if (!g_strcmp0(key, "service_type")) {
-                       g_variant_get(var, "&s", &str);
-                       service_type = g_strdup(str);
-               } else if (!g_strcmp0(key, "service_type")) {
-                       g_variant_get(var, "&s", &str);
-                       service_type = g_strdup(str);
                }  else if (!g_strcmp0(key, "instance_name")) {
                        g_variant_get(var, "&s", &str);
                        instance_name = g_strdup(str);
@@ -345,16 +337,13 @@ void asp_tech_p2p_process_search_result(GDBusConnection *connection,
        event.search_result.search_id = search_id;
        event.search_result.advertisement_id = advertisement_id;
        event.search_result.service_status = status;
-       g_snprintf(event.search_result.service_mac, MACSTR_LEN,
-                       MACSTR, MAC2STR(service_mac));
+       memcpy(event.search_result.service_mac, service_mac, MACSTR_LEN);
        event.search_result.device_name = device_name;
-       event.search_result.service_type = service_type;
        event.search_result.instance_name = instance_name;
        event.search_result.service_info = NULL;
        asp_manager_event(NULL, ASP_EVENT_SEARCH_RESULT, &event);
 
        g_free(device_name);
-       g_free(service_type);
        g_free(instance_name);
        g_free(service_info);