Merge branch 'master' into service_name
author문철은/Tizen Platform Lab(SR)/Staff Engineer/삼성전자 <chleun.moon@samsung.com>
Wed, 11 Mar 2020 05:34:47 +0000 (14:34 +0900)
committerGitHub Enterprise <noreply-CODE@samsung.com>
Wed, 11 Mar 2020 05:34:47 +0000 (14:34 +0900)
1  2 
src/include/wifi-aware-gdbus.h
src/wifi-aware-data-path.c
src/wifi-aware-gdbus.c

@@@ -78,20 -79,15 +79,18 @@@ int wifi_aware_gdbus_followup(wifi_awar
  
  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,
-               wifi_aware_data_path_role_e role, int port,
-               GAsyncReadyCallback cb);
 +              const char *service_name,
+               wifi_aware_data_path_role_e role, int port);
  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);
+               const char *psk);
  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);
+               const unsigned char *pmk);
  int wifi_aware_gdbus_ndp_close(wifi_aware_data_path_h data_path,
                int client_id, unsigned int ndp_id, uint16_t pub_sub_id, unsigned int peer_id);
  #ifdef __cplusplus
@@@ -290,35 -303,37 +303,40 @@@ int _wifi_aware_data_path_open(wifi_awa
                                _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);
+                               ndp->port);
+               break;
        case WIFI_AWARE_SECURITY_TYPE_PSK:
-               return wifi_aware_gdbus_open_ndp_psk(data_path,
+               ret = wifi_aware_gdbus_open_ndp_psk(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,
-                               __data_path_open_reply);
+                               ndp->psk);
+               break;
        case WIFI_AWARE_SECURITY_TYPE_PMK:
-               return wifi_aware_gdbus_open_ndp_pmk(data_path,
+               ret = wifi_aware_gdbus_open_ndp_pmk(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,
-                               __data_path_open_reply);
+                               ndp->pmk);
+               break;
+       default:
+               ret = WIFI_AWARE_ERROR_INVALID_PARAMETER;
        }
  
-       WIFI_AWARE_LOGE("Invalid security type");
-       __data_path_set_open_cb(data_path, NULL, NULL);
-       return WIFI_AWARE_ERROR_INVALID_PARAMETER;
+       if (ret != WIFI_AWARE_ERROR_NONE) {
+               WIFI_AWARE_LOGE("Invalid security type");
+               __data_path_set_open_cb(data_path, NULL, NULL);
+               __data_path_unset_data_path_confirmed_cb(data_path);
+       }
+       return ret;
  }
  
  int _wifi_aware_data_path_close(wifi_aware_data_path_h data_path)
@@@ -658,18 -661,24 +662,26 @@@ int wifi_aware_gdbus_followup(wifi_awar
        return ret;
  }
  
+ static int __handle_ndp_open_reply(GVariant *reply)
+ {
+       int error;
+       g_variant_get(reply, "(i)", &error);
+       WIFI_AWARE_LOGI("Reply for Open Data Path %d", error);
+       return error;
+ }
  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,
-               wifi_aware_data_path_role_e role, int port,
-               GAsyncReadyCallback cb)
 +              const char *service_name,
+               wifi_aware_data_path_role_e role, int port)
  {
        __WIFI_AWARE_FUNC_ENTER__;
        GVariant *params = NULL;
+       GVariant *reply = 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);
  
  
  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,
-               wifi_aware_data_path_role_e role, int port, const char *psk,
-               GAsyncReadyCallback cb)
 +              const char *service_name,
+               wifi_aware_data_path_role_e role, int port, const char *psk)
  {
        __WIFI_AWARE_FUNC_ENTER__;
        GVariant *params = NULL;
        GVariant *params_psk = NULL;
+       GVariant *reply = 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");
  
  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,
-               wifi_aware_data_path_role_e role, int port, const unsigned char *pmk,
-               GAsyncReadyCallback cb)
 +              const char *service_name,
+               wifi_aware_data_path_role_e role, int port, const unsigned char *pmk)
  {
        __WIFI_AWARE_FUNC_ENTER__;
        GVariant *params = NULL;
        GVariant *params_pmk = NULL;
+       GVariant *reply = 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");