From: Cheoleun Moon Date: Fri, 31 Jan 2020 13:47:45 +0000 (+0900) Subject: wifi_aware_discovery_result_cb don't deliver match_filter X-Git-Tag: submit/tizen/20200403.050222~2^2~73^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6641044f6c82b3aeb5b5ed748d4db56725e8b316;p=platform%2Fcore%2Fapi%2Fwifi-aware.git wifi_aware_discovery_result_cb don't deliver match_filter --- diff --git a/include/wifi-aware.h b/include/wifi-aware.h index aa0ee20..e4e0c1c 100644 --- a/include/wifi-aware.h +++ b/include/wifi-aware.h @@ -235,14 +235,12 @@ int wifi_aware_publish_config_set_service_specific_info(wifi_aware_publish_confi * @brief Set the match filter of the service. It is used to decide whether accepting a subscribe request or not. * @since_tizen 6.0 * @param[in] config - * @param[in] match_filter + * @param[in] match_filter An ordered sequence of pairs * @param[in] len * @return 0 on success, otherwise a negative error value * @retval #WIFI_AWARE_ERROR_NONE */ -int wifi_aware_publish_config_add_match_filter(wifi_aware_publish_config_h config, unsigned char *match_filter, size_t len); - -int wifi_aware_publish_config_clear_all_match_filters(wifi_aware_publish_config_h config); +int wifi_aware_publish_config_set_match_filter(wifi_aware_publish_config_h config, unsigned char *match_filter, size_t len); /** * @brief TODO (Need decision to add) Set whether notifying a termination of the service or not. @@ -313,15 +311,13 @@ int wifi_aware_subscribe_config_set_service_specific_info(wifi_aware_subscribe_c * @brief * @since_tizen 6.0 * @param[in] config - * @param[in] match_filter + * @param[in] match_filter An ordered sequence of pairs * @param[in] len * @return 0 on success, otherwise a negative error value * @retval #WIFI_AWARE_ERROR_NONE */ int wifi_aware_subscribe_config_set_match_filter(wifi_aware_subscribe_config_h config, unsigned char *match_filter, size_t len); -int wifi_aware_subscribe_config_clear_all_match_filters(wifi_aware_subscribe_config_h config); - /** * @brief * @since_tizen 6.0 @@ -481,15 +477,13 @@ int wifi_aware_cancel_subscribe(wifi_aware_h wifi_aware, * @param[in] peer * @param[in] service_specific_info * @param[in] service_specific_info_len - * @param[in] match_filter - * @param[in] match_filter_len * @return 0 on success, otherwise a negative error value * @retval #WIFI_AWARE_ERROR_NONE */ typedef void(*wifi_aware_discovery_result_cb)( unsigned int subscribe_id, wifi_aware_peer_h peer, unsigned char *service_specific_info, size_t service_specific_info_len, - unsigned char *match_filter, size_t match_filter_len, void *user_data); + void *user_data); /** * @brief diff --git a/src/wifi-aware-private.c b/src/wifi-aware-private.c index eb4a00a..594b3fd 100644 --- a/src/wifi-aware-private.c +++ b/src/wifi-aware-private.c @@ -371,18 +371,15 @@ void _mac_address_changed(GDBusConnection *connection, static void __parsing_service_discovered_event(GVariant *parameters, unsigned int *sub_id, unsigned int *peer_id, - unsigned char *specific_info, size_t *specific_info_len, - unsigned char *match_filters, size_t *match_filters_len) + unsigned char *specific_info, size_t *specific_info_len) { gchar *info_value = NULL; gchar *filter_value = NULL; - g_variant_get(parameters, "(uusqsq)", sub_id, peer_id, - info_value, specific_info_len, - filter_value, match_filters_len); + g_variant_get(parameters, "(uusq)", sub_id, peer_id, + info_value, specific_info_len); memcpy(specific_info, info_value, *specific_info_len); - memcpy(match_filters, filter_value, *match_filters_len); } void _service_discovered(GDBusConnection *connection, @@ -396,16 +393,13 @@ void _service_discovered(GDBusConnection *connection, unsigned int peer_id = 0; unsigned char *specific_info = NULL; size_t specific_info_len = 0; - unsigned char *match_filters = NULL; - size_t match_filters_len = 0; wifi_aware_h peer = NULL; GList *list; __parsing_service_discovered_event(parameters, &sub_id, &peer_id, - specific_info, &specific_info_len, - match_filters, &match_filters_len); + specific_info, &specific_info_len); if (sub_id == 0) { WIFI_AWARE_LOGE("Invalid subscribe ID"); @@ -424,7 +418,8 @@ void _service_discovered(GDBusConnection *connection, for (list = __wifi_aware_handle_list; list; list = list->next) { wifi_aware_s *aware = (wifi_aware_s *)list; if (aware->discovered_cb) - aware->discovered_cb(sub_id, peer, specific_info, specific_info_len, - match_filters, match_filters_len, aware->discovered_cb_data); + aware->discovered_cb(sub_id, peer, + specific_info, specific_info_len, + aware->discovered_cb_data); } } diff --git a/test/wifi-aware-test.c b/test/wifi-aware-test.c index ee6c87b..3f89af1 100644 --- a/test/wifi-aware-test.c +++ b/test/wifi-aware-test.c @@ -91,6 +91,7 @@ #define MAX_SERVICE_NAME_LEN 255 #define MAX_SPECIFIC_INFO_LEN 1024 +#define MAX_MATCH_FILTER_LEN 255 enum { CMD_QUIT, @@ -344,6 +345,7 @@ static void __set_publish_config(wifi_aware_publish_config_h config) int publish_type = 0; unsigned char service_name[MAX_SERVICE_NAME_LEN + 1] = {0, }; unsigned char specific_info[MAX_SPECIFIC_INFO_LEN + 1] = {0, }; + unsigned char match_filter[MAX_MATCH_FILTER_LEN + 1] = {0, }; size_t len = 0; printf("Choose publish type(0-Solicited, 1-Unsolicited): "); @@ -370,6 +372,13 @@ static void __set_publish_config(wifi_aware_publish_config_h config) specific_info, len); if (ret != WIFI_AWARE_ERROR_NONE) return; + + len = strlen(MATCH_FILTER); + memcpy(match_filter, MATCH_FILTER, len); + ret = wifi_aware_publish_config_set_match_filter(config, + match_filter, len); + if (ret != WIFI_AWARE_ERROR_NONE) + return; } void test_publish() @@ -420,14 +429,12 @@ static void __subscribed_cb(wifi_aware_error_e error, unsigned int subscribe_id, static void __discovery_result_cb(unsigned int subscribe_id, wifi_aware_peer_h peer, unsigned char *service_specific_info, size_t service_specific_info_len, - unsigned char *match_filter, size_t match_filter_len, void *user_data) + void *user_data) { printf("Find A Wi-Fi Aware Peer\n"); printf("Subscribe ID: %u\n", subscribe_id); printf("Service Specific Info\n"); __print_byte_array(service_specific_info, service_specific_info_len); - printf("Match Filter\n"); - __print_byte_array(match_filter, match_filter_len); } static void __set_subscribe_config(wifi_aware_subscribe_config_h config)