From: Cheoleun Moon Date: Tue, 10 Mar 2020 10:04:52 +0000 (+0900) Subject: Add service_name as a parameter of open data path X-Git-Tag: submit/tizen/20200403.050222~2^2~38^2~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4acfcd86a87c9f7233a37f86b6e301bbb3b3f264;p=platform%2Fcore%2Fapi%2Fwifi-aware.git Add service_name as a parameter of open data path --- diff --git a/src/include/wifi-aware-gdbus.h b/src/include/wifi-aware-gdbus.h index 811824a..60ad94d 100644 --- a/src/include/wifi-aware-gdbus.h +++ b/src/include/wifi-aware-gdbus.h @@ -78,14 +78,17 @@ int wifi_aware_gdbus_followup(wifi_aware_session_h session, int wifi_aware_gdbus_open_ndp(wifi_aware_data_path_h data_path, int client_id, uint16_t pub_sub_id, unsigned int peer_id, + const char *service_name, wifi_aware_data_path_role_e role, int port, GAsyncReadyCallback cb); int wifi_aware_gdbus_open_ndp_psk(wifi_aware_data_path_h data_path, int client_id, uint16_t pub_sub_id, unsigned int peer_id, + const char *service_name, wifi_aware_data_path_role_e role, int port, const char *psk, GAsyncReadyCallback cb); int wifi_aware_gdbus_open_ndp_pmk(wifi_aware_data_path_h data_path, int client_id, uint16_t pub_sub_id, unsigned int peer_id, + const char *service_name, wifi_aware_data_path_role_e role, int port, const unsigned char *pmk, GAsyncReadyCallback cb); diff --git a/src/include/wifi-aware-private.h b/src/include/wifi-aware-private.h index 38f8173..00346f6 100644 --- a/src/include/wifi-aware-private.h +++ b/src/include/wifi-aware-private.h @@ -42,6 +42,7 @@ int _wifi_aware_disable_request(); int _wifi_aware_session_handle_create(wifi_aware_session_type_e session_type, wifi_aware_session_h *session_handle); void _wifi_aware_session_handle_destroy(wifi_aware_session_h session_handle); uint16_t _wifi_aware_session_get_pub_sub_id(wifi_aware_session_h session); +const char *_wifi_aware_session_get_service_name(wifi_aware_session_h session); bool _wifi_aware_session_is_publish_type(wifi_aware_session_h session_handle); bool _wifi_aware_session_is_subscribe_type(wifi_aware_session_h session_handle); int _wifi_aware_get_client_id(); diff --git a/src/wifi-aware-data-path.c b/src/wifi-aware-data-path.c index 88998d8..29cf58a 100644 --- a/src/wifi-aware-data-path.c +++ b/src/wifi-aware-data-path.c @@ -290,6 +290,7 @@ int _wifi_aware_data_path_open(wifi_aware_data_path_h data_path, _wifi_aware_get_client_id(), _wifi_aware_session_get_pub_sub_id(ndp->session), _wifi_aware_peer_get_id(ndp->peer), + _wifi_aware_session_get_service_name(ndp->session), ndp->role, ndp->port, __data_path_open_reply); @@ -298,6 +299,7 @@ int _wifi_aware_data_path_open(wifi_aware_data_path_h data_path, _wifi_aware_get_client_id(), _wifi_aware_session_get_pub_sub_id(ndp->session), _wifi_aware_peer_get_id(ndp->peer), + _wifi_aware_session_get_service_name(ndp->session), ndp->role, ndp->port, ndp->psk, @@ -307,6 +309,7 @@ int _wifi_aware_data_path_open(wifi_aware_data_path_h data_path, _wifi_aware_get_client_id(), _wifi_aware_session_get_pub_sub_id(ndp->session), _wifi_aware_peer_get_id(ndp->peer), + _wifi_aware_session_get_service_name(ndp->session), ndp->role, ndp->port, ndp->pmk, diff --git a/src/wifi-aware-gdbus.c b/src/wifi-aware-gdbus.c index 470c82a..1e54bff 100644 --- a/src/wifi-aware-gdbus.c +++ b/src/wifi-aware-gdbus.c @@ -367,9 +367,10 @@ static GVariant *__create_followup_request_param(int client_id, uint16_t pub_sub } static GVariant *__create_ndp_open_request_param(int client_id, uint16_t pub_sub_id, - unsigned int peer_id, wifi_aware_data_path_role_e role, int port) + unsigned int peer_id, const char *service_name, + wifi_aware_data_path_role_e role, int port) { - return g_variant_new("(iquii)", client_id, pub_sub_id, peer_id, role, port); + return g_variant_new("(iqusii)", client_id, pub_sub_id, peer_id, service_name, role, port); } static GVariant *__append_param_psk(GVariant *params, const char *psk) @@ -659,6 +660,7 @@ int wifi_aware_gdbus_followup(wifi_aware_session_h session, int wifi_aware_gdbus_open_ndp(wifi_aware_data_path_h data_path, int client_id, uint16_t pub_sub_id, unsigned int peer_id, + const char *service_name, wifi_aware_data_path_role_e role, int port, GAsyncReadyCallback cb) { @@ -666,7 +668,8 @@ int wifi_aware_gdbus_open_ndp(wifi_aware_data_path_h data_path, GVariant *params = NULL; int ret = WIFI_AWARE_ERROR_NONE; - params = __create_ndp_open_request_param(client_id, pub_sub_id, peer_id, role, port); + params = __create_ndp_open_request_param(client_id, pub_sub_id, peer_id, + service_name, role, port); WIFI_AWARE_LOGD("created parameters"); DBUS_DEBUG_VARIANT(params); @@ -681,6 +684,7 @@ int wifi_aware_gdbus_open_ndp(wifi_aware_data_path_h data_path, int wifi_aware_gdbus_open_ndp_psk(wifi_aware_data_path_h data_path, int client_id, uint16_t pub_sub_id, unsigned int peer_id, + const char *service_name, wifi_aware_data_path_role_e role, int port, const char *psk, GAsyncReadyCallback cb) { @@ -689,7 +693,8 @@ int wifi_aware_gdbus_open_ndp_psk(wifi_aware_data_path_h data_path, GVariant *params_psk = NULL; int ret = WIFI_AWARE_ERROR_NONE; - params = __create_ndp_open_request_param(client_id, pub_sub_id, peer_id, role, port); + params = __create_ndp_open_request_param(client_id, pub_sub_id, peer_id, + service_name, role, port); params_psk = __append_param_psk(params, psk); g_variant_unref(params); WIFI_AWARE_LOGD("created parameters"); @@ -706,6 +711,7 @@ int wifi_aware_gdbus_open_ndp_psk(wifi_aware_data_path_h data_path, int wifi_aware_gdbus_open_ndp_pmk(wifi_aware_data_path_h data_path, int client_id, uint16_t pub_sub_id, unsigned int peer_id, + const char *service_name, wifi_aware_data_path_role_e role, int port, const unsigned char *pmk, GAsyncReadyCallback cb) { @@ -714,7 +720,8 @@ int wifi_aware_gdbus_open_ndp_pmk(wifi_aware_data_path_h data_path, GVariant *params_pmk = NULL; int ret = WIFI_AWARE_ERROR_NONE; - params = __create_ndp_open_request_param(client_id, pub_sub_id, peer_id, role, port); + params = __create_ndp_open_request_param(client_id, pub_sub_id, peer_id, + service_name, role, port); params_pmk = __append_param_pmk(params, pmk); g_variant_unref(params); WIFI_AWARE_LOGD("created parameters"); diff --git a/src/wifi-aware-private.c b/src/wifi-aware-private.c index 49ae1f0..11f2160 100644 --- a/src/wifi-aware-private.c +++ b/src/wifi-aware-private.c @@ -380,6 +380,21 @@ uint16_t _wifi_aware_session_get_pub_sub_id(wifi_aware_session_h session) return handle->pub_sub_id; } +const char *_wifi_aware_session_get_service_name(wifi_aware_session_h session) +{ + wifi_aware_session_s *handle = (wifi_aware_session_s *)session; + if (handle->session_type == WIFI_AWARE_SESSION_PUBLISH) { + wifi_aware_publish_request_s *req = + (wifi_aware_publish_request_s *)handle->publish_config; + return req->service_name; + } + else { + wifi_aware_subscribe_request_s *req = + (wifi_aware_subscribe_request_s *)handle->subscribe_config; + return req->service_name; + } +} + bool _wifi_aware_session_is_publish_type(wifi_aware_session_h session_handle) { wifi_aware_session_s *session = (wifi_aware_session_s *)session_handle;