Add support for Wifi Direct Display API and data structure 23/16323/2
authorJiung Yu <jiung.yu@samsung.com>
Thu, 13 Feb 2014 06:22:20 +0000 (15:22 +0900)
committerJiung Yu <jiung.yu@samsung.com>
Thu, 13 Feb 2014 11:37:52 +0000 (20:37 +0900)
Change-Id: I0d6b1684547702e70e369a74cf00668c933ea912
Signed-off-by: Yu jiung <jiung.yu@samsung.com>
include/wifi-direct-internal.h
include/wifi-direct.h
packaging/libwifi-direct.changes
packaging/libwifi-direct.spec
src/wifi-direct-client-proxy.c

index 6669102..8f8cdc7 100644 (file)
@@ -141,6 +141,11 @@ typedef enum
        WIFI_DIRECT_CMD_SERV_DISC_REQ,
        WIFI_DIRECT_CMD_SERV_DISC_CANCEL,
 
+       WIFI_DIRECT_CMD_INIT_WIFI_DISPLAY,
+       WIFI_DIRECT_CMD_DEINIT_WIFI_DISPLAY,
+       WIFI_DIRECT_CMD_GET_DISPLAY_PORT,
+       WIFI_DIRECT_CMD_GET_DISPLAY_TYPE,
+
        WIFI_DIRECT_CMD_MAX
 } wifi_direct_cmd_e;
 
index 7f4f4b6..d455d03 100644 (file)
@@ -219,9 +219,17 @@ typedef enum
        WIFI_DIRECT_SERVICE_UPNP,
        WIFI_DIRECT_SERVICE_WSDISCOVERY,
        WIFI_DIRECT_SERVICE_WIFIDISPLAY,
-       WIFI_DIRECT_SERVICE_VENDORSPEC,
+       WIFI_DIRECT_SERVICE_VENDORSPEC = 0xff,
 } wifi_direct_service_type_e;
 
+typedef enum
+{
+       WIFI_DIRECT_DISPLAY_SOURCE,
+       WIFI_DIRECT_DISPLAY_PRIMARY_SINK,
+       WIFI_DIRECT_DISPLAY_SECONDARY_SINK,
+       WIFI_DIRECT_DISPLAY_DUAL_ROLE,
+}wifi_direct_display_type_e;
+
 /**
  * @struct wifi_direct_discovered_peer_info_s
  * Wi-Fi Direct buffer structure to store result of peer discovery
@@ -242,7 +250,7 @@ typedef struct
        char *ssid;  /**< Service set identifier - DEPRECATED */
        unsigned int service_count;
        char **service_list;
-       bool is_miracast_device;
+       bool is_wfd_device;
 } wifi_direct_discovered_peer_info_s;
 
 
@@ -262,7 +270,7 @@ typedef struct
        char* ssid;  /**< Service set identifier - DEPRECATED */
        unsigned int service_count;
        char **service_list;
-       bool is_miracast_device;
+       bool is_wfd_device;
 } wifi_direct_connected_peer_info_s;
 
 /**
@@ -2893,6 +2901,191 @@ int wifi_direct_serv_disc_req(char* MAC, wifi_direct_service_type_e type, char *
  ******************************************************************************/
 int wifi_direct_serv_disc_cancel(int handle);
 
+/*****************************************************************************************/
+/* wifi_direct_init_wifi_display API function prototype
+ * int wifi_direct_init_wifi_display(wifi_direct_display_type type, int port, int hdcp)
+ */
+/**
+ * \brief This API shall initialize the wifi display. \n
+ * @param type              wifi direct display device type.
+ * @param port              port number that is used by wifi direct display.
+ * @param hdcp              indicate that hdcp is support capability.
+ *
+ * \see wifi_direct_deinit_wifi_display.
+ * \see wifi_direct_get_display_port
+ * \see wifi_direct_get_display_type.
+ *
+ * \par Sync (or) Async:
+ * This is a Synchronous API.
+ *
+ * \warning
+ *  None
+ *
+ *
+ * \return Return Type (int) \n
+ *     WIFI_DIRECT_ERROR_NONE on Success \n
+ *     WIFI_DIRECT_ERROR_NOT_PERMITTED  for Operation not permitted \n
+ *     WIFI_DIRECT_ERROR_OUT_OF_MEMORY  for Out of memory \n
+ *     WIFI_DIRECT_ERROR_RESOURCE_BUSY  for Device or resource busy \n
+ *     WIFI_DIRECT_ERROR_INVALID_PARAMETER for Invalid function parameter \n
+ *     WIFI_DIRECT_ERROR_CONNECTION_TIME_OUT for Connection timed out \n
+ *     WIFI_DIRECT_ERROR_NOT_INITIALIZED Not for initialized \n
+ *     WIFI_DIRECT_ERROR_COMMUNICATION_FAILED for I/O error \n
+ *     WIFI_DIRECT_ERROR_WIFI_USED for WiFi is being used \n
+ *     WIFI_DIRECT_ERROR_MOBILE_AP_USED for Mobile AP is being used \n
+ *     WIFI_DIRECT_ERROR_CONNECTION_FAILED for Connection failed \n
+ *     WIFI_DIRECT_ERROR_AUTH_FAILED for Authentication failed \n
+ *     WIFI_DIRECT_ERROR_OPERATION_FAILED for Operation failed \n
+ *     WIFI_DIRECT_ERROR_TOO_MANY_CLIENT for Too many client \n
+ *     WIFI_DIRECT_ERROR_ALREADY_INITIALIZED for Already initialized client \n
+ *     WIFI_DIRECT_ERROR_CONNECTION_CANCELED \n
+ *
+ *
+ *
+ *\endcode
+ *
+ *\remarks None.
+ *
+ ******************************************************************************/
+int wifi_direct_init_wifi_display(wifi_direct_display_type_e type, int port, int hdcp);
+
+/*****************************************************************************************/
+/* wifi_direct_deinit_wifi_display API function prototype
+ * int wifi_direct_deinit_wifi_display(void)
+ */
+/**
+ * \brief This API shall deinitialize the wifi direct display. \n
+ *
+ * \see wifi_direct_init_wifi_display.
+ * \see wifi_direct_get_display_port
+ * \see wifi_direct_get_display_type.
+ *
+ * \par Sync (or) Async:
+ * This is a Synchronous API.
+ *
+ * \warning
+ *  None
+ *
+ *
+ * \return Return Type (int) \n
+ *     WIFI_DIRECT_ERROR_NONE on Success \n
+ *     WIFI_DIRECT_ERROR_NOT_PERMITTED  for Operation not permitted \n
+ *     WIFI_DIRECT_ERROR_OUT_OF_MEMORY  for Out of memory \n
+ *     WIFI_DIRECT_ERROR_RESOURCE_BUSY  for Device or resource busy \n
+ *     WIFI_DIRECT_ERROR_INVALID_PARAMETER for Invalid function parameter \n
+ *     WIFI_DIRECT_ERROR_CONNECTION_TIME_OUT for Connection timed out \n
+ *     WIFI_DIRECT_ERROR_NOT_INITIALIZED Not for initialized \n
+ *     WIFI_DIRECT_ERROR_COMMUNICATION_FAILED for I/O error \n
+ *     WIFI_DIRECT_ERROR_WIFI_USED for WiFi is being used \n
+ *     WIFI_DIRECT_ERROR_MOBILE_AP_USED for Mobile AP is being used \n
+ *     WIFI_DIRECT_ERROR_CONNECTION_FAILED for Connection failed \n
+ *     WIFI_DIRECT_ERROR_AUTH_FAILED for Authentication failed \n
+ *     WIFI_DIRECT_ERROR_OPERATION_FAILED for Operation failed \n
+ *     WIFI_DIRECT_ERROR_TOO_MANY_CLIENT for Too many client \n
+ *     WIFI_DIRECT_ERROR_ALREADY_INITIALIZED for Already initialized client \n
+ *     WIFI_DIRECT_ERROR_CONNECTION_CANCELED \n
+ *
+ *
+ *
+ *\endcode
+ *
+ *\remarks None.
+ *
+ ******************************************************************************/
+int wifi_direct_deinit_wifi_display(void);
+
+/*****************************************************************************************/
+/* wifi_direct_service_del API function prototype
+ * int wifi_direct_get_display_port(int *port)
+ */
+/**
+ * \brief This API shall delete the service user expects. \n
+ * @param port              TCP control port of this wifi direct diplay device. Application had enabled the wifi direct display before use this function.
+ *
+ * \see wifi_direct_init_wifi_display.
+ * \see wifi_direct_deinit_wifi_display.
+ * \see wifi_direct_get_display_type.
+ *
+ * \par Sync (or) Async:
+ * This is a Synchronous API.
+ *
+ * \warning
+ *  None
+ *
+ *
+ * \return Return Type (int) \n
+ *     WIFI_DIRECT_ERROR_NONE on Success \n
+ *     WIFI_DIRECT_ERROR_NOT_PERMITTED  for Operation not permitted \n
+ *     WIFI_DIRECT_ERROR_OUT_OF_MEMORY  for Out of memory \n
+ *     WIFI_DIRECT_ERROR_RESOURCE_BUSY  for Device or resource busy \n
+ *     WIFI_DIRECT_ERROR_INVALID_PARAMETER for Invalid function parameter \n
+ *     WIFI_DIRECT_ERROR_CONNECTION_TIME_OUT for Connection timed out \n
+ *     WIFI_DIRECT_ERROR_NOT_INITIALIZED Not for initialized \n
+ *     WIFI_DIRECT_ERROR_COMMUNICATION_FAILED for I/O error \n
+ *     WIFI_DIRECT_ERROR_WIFI_USED for WiFi is being used \n
+ *     WIFI_DIRECT_ERROR_MOBILE_AP_USED for Mobile AP is being used \n
+ *     WIFI_DIRECT_ERROR_CONNECTION_FAILED for Connection failed \n
+ *     WIFI_DIRECT_ERROR_AUTH_FAILED for Authentication failed \n
+ *     WIFI_DIRECT_ERROR_OPERATION_FAILED for Operation failed \n
+ *     WIFI_DIRECT_ERROR_TOO_MANY_CLIENT for Too many client \n
+ *     WIFI_DIRECT_ERROR_ALREADY_INITIALIZED for Already initialized client \n
+ *     WIFI_DIRECT_ERROR_CONNECTION_CANCELED \n
+ *
+ *
+ *
+ *\endcode
+ *
+ *\remarks None.
+ *
+ ******************************************************************************/
+int wifi_direct_get_display_port(int *port);
+
+/*****************************************************************************************/
+/* wifi_direct_service_del API function prototype
+ * int wifi_direct_get_display_type(wifi_direct_display_type *type)
+ */
+/**
+ * \brief This API shall delete the service user expects. \n
+ * @param handle              wifi direct display type of this device. Application had enabled the wifi direct display before use this function.
+ *
+ * \see wifi_direct_init_wifi_display.
+ * \see wifi_direct_deinit_wifi_display.
+ * \see wifi_direct_get_display_port.
+ *
+ * \par Sync (or) Async:
+ * This is a Synchronous API.
+ *
+ * \warning
+ *  None
+ *
+ *
+ * \return Return Type (int) \n
+ *     WIFI_DIRECT_ERROR_NONE on Success \n
+ *     WIFI_DIRECT_ERROR_NOT_PERMITTED  for Operation not permitted \n
+ *     WIFI_DIRECT_ERROR_OUT_OF_MEMORY  for Out of memory \n
+ *     WIFI_DIRECT_ERROR_RESOURCE_BUSY  for Device or resource busy \n
+ *     WIFI_DIRECT_ERROR_INVALID_PARAMETER for Invalid function parameter \n
+ *     WIFI_DIRECT_ERROR_CONNECTION_TIME_OUT for Connection timed out \n
+ *     WIFI_DIRECT_ERROR_NOT_INITIALIZED Not for initialized \n
+ *     WIFI_DIRECT_ERROR_COMMUNICATION_FAILED for I/O error \n
+ *     WIFI_DIRECT_ERROR_WIFI_USED for WiFi is being used \n
+ *     WIFI_DIRECT_ERROR_MOBILE_AP_USED for Mobile AP is being used \n
+ *     WIFI_DIRECT_ERROR_CONNECTION_FAILED for Connection failed \n
+ *     WIFI_DIRECT_ERROR_AUTH_FAILED for Authentication failed \n
+ *     WIFI_DIRECT_ERROR_OPERATION_FAILED for Operation failed \n
+ *     WIFI_DIRECT_ERROR_TOO_MANY_CLIENT for Too many client \n
+ *     WIFI_DIRECT_ERROR_ALREADY_INITIALIZED for Already initialized client \n
+ *     WIFI_DIRECT_ERROR_CONNECTION_CANCELED \n
+ *
+ *
+ *
+ *\endcode
+ *
+ *\remarks None.
+ *
+ ******************************************************************************/
+int wifi_direct_get_display_type(wifi_direct_display_type_e *type);
+
 /**
  * @}
  */
index 7e62ba8..09631a2 100644 (file)
@@ -1,3 +1,6 @@
+* Thu, 13 Feb 2014 Jiung Yu <jiung.yu@samsung.com> (1.0.8)
+  - Add support for Wifi Direct Display API and data structure
+
 * Mon, 27 Jan 2014 Jiung Yu <jiung.yu@samsung.com> (1.0.7)
   - Add Wifi Direct Service Discovery API and data structure
 
index e4dd21c..4e3e397 100644 (file)
@@ -1,6 +1,6 @@
 Name:       libwifi-direct
 Summary:    Wifi Direct Library
-Version:    1.0.7
+Version:    1.0.8
 Release:    1
 Group:      Network & Connectivity/Wireless 
 License:    Apache-2.0
index 1b90bb4..675adcc 100644 (file)
@@ -423,6 +423,14 @@ char *__wfd_client_print_cmd(wifi_direct_cmd_e cmd)
                return "WIFI_DIRECT_CMD_SERV_DISC_REQ";
        case WIFI_DIRECT_CMD_SERV_DISC_CANCEL:
                return "WIFI_DIRECT_CMD_SERV_DISC_CANCEL";
+       case WIFI_DIRECT_CMD_INIT_WIFI_DISPLAY:
+               return "WIFI_DIRECT_CMD_INIT_WIFI_DISPLAY";
+       case WIFI_DIRECT_CMD_DEINIT_WIFI_DISPLAY:
+               return "WIFI_DIRECT_CMD_DEINIT_WIFI_DISPLAY";
+       case WIFI_DIRECT_CMD_GET_DISPLAY_PORT:
+               return "WIFI_DIRECT_CMD_GET_DISPLAY_PORT";
+       case WIFI_DIRECT_CMD_GET_DISPLAY_TYPE:
+               return "WIFI_DIRECT_CMD_GET_DISPLAY_TYPE";
        default:
                return "WIFI_DIRECT_CMD_INVALID";
 
@@ -868,7 +876,7 @@ int wifi_direct_initialize(void)
        if (client_info->is_registered == TRUE) {
                WDC_LOGW("Warning!!! Already registered\nUpdate user data and callback!");
                __WDC_LOG_FUNC_END__;
-               return WIFI_DIRECT_ERROR_ALREADY_INITIALIZED;
+               return WIFI_DIRECT_ERROR_NONE;
        }
 
        errno = 0;
@@ -1320,58 +1328,60 @@ int wifi_direct_cancel_discovery(void)
        return WIFI_DIRECT_ERROR_NONE;
 }
 
-static int get_service_list(char *services, char** result)
+static char **get_service_list(char *services, unsigned int *count)
 {
-       __WDC_LOG_FUNC_START__;
-       result = NULL;
-       char *pos1 = services;
-       char *pos2 = strdup(services);
-       unsigned int cnt = 0;
-       unsigned int i = 0;
-       unsigned int j = 0;
-
-       if (!services ||        (strlen(services) <= 0)) {
-               WDC_LOGE("Invalid parameters.");
-               __WDC_LOG_FUNC_END__;
-               return 0;
-       }
-
-       pos1 = strtok (pos1,",\n");
-       while (pos1) {
-               cnt++;
-               pos1 = strtok (NULL, ",\n");
-       }
-       WDC_LOGD("Total Service Count = %d", cnt);
-
-       if (cnt > 0) {
-               result = (char**) calloc(cnt, sizeof(char *));
-               if (!result) {
-                       WDC_LOGE("Failed to allocate memory for result");
-                       return 0;
-               }
-               pos1 = pos2;
-               pos2 = strtok (pos2,",\n");
-               while (pos2 != NULL) {
-                       char *s = strchr(pos2, ' ');
-                       if (s) {
-                               *s = '\0';
-                               result[i++] = strdup(pos2);
-                               pos2 = strtok (NULL, ",\n");
-                       }
-               }
-       }
-
-       free(pos1);
-       if (cnt == i) {
-               return cnt;
-       } else {
-               if (result) {
-                       for (j=0; j<i && result[j] != NULL; j++)
-                               free(result[j]);
-                       free(result);
-               }
-               return 0;
-       }
+        __WDC_LOG_FUNC_START__;
+        char **result = NULL;
+        char *pos1 = services;
+        char *pos2 = strdup(services);
+        unsigned int cnt = 0;
+        unsigned int i = 0;
+        unsigned int j = 0;
+
+        if (!count || !services ||      (services && strlen(services) <= 0)) {
+                WDC_LOGE("Invalid parameters.");
+                __WDC_LOG_FUNC_END__;
+                return NULL;
+        }
+
+        pos1 = strtok (pos1,",\n");
+        while (pos1) {
+                cnt++;
+                pos1 = strtok (NULL, ",\n");
+        }
+        WDC_LOGD("Total Service Count = %d", cnt);
+
+        if (cnt > 0) {
+                result = (char**) calloc(cnt, sizeof(char *));
+                if (!result) {
+                        WDC_LOGE("Failed to allocate memory for result");
+                        return NULL;
+                }
+                pos1 = pos2;
+                pos2 = strtok (pos2,",\n");
+                while (pos2 != NULL) {
+                        char *s = strchr(pos2, ' ');
+                        if (s) {
+                                *s = '\0';
+                                result[i++] = strdup(pos2);
+                                pos2 = strtok (NULL, ",\n");
+                        }
+                }
+        }
+
+        free(pos1);
+        if (cnt == i) {
+                *count = cnt;
+                return result;
+        } else {
+                *count = 0;
+                if (result) {
+                        for (j=0; j<i && result[j] != NULL; j++)
+                                free(result[j]);
+                        free(result);
+                }
+                return NULL;
+        }
 }
 
 int wifi_direct_foreach_discovered_peers(wifi_direct_discovered_peer_cb cb,
@@ -1477,8 +1487,9 @@ int wifi_direct_foreach_discovered_peers(wifi_direct_discovered_peer_cb cb,
                        peer_list->interface_address = (char*) calloc(1, MACSTR_LEN);
                        snprintf(peer_list->interface_address, MACSTR_LEN, MACSTR, MAC2STR(buff[i].intf_address));
                        peer_list->supported_wps_types= buff[i].wps_cfg_methods;
-                       peer_list->service_count = get_service_list(buff[i].services, peer_list->service_list);
+                       peer_list->service_list = get_service_list(buff[i].services, &peer_list->service_count);
                        peer_list->primary_device_type = buff[i].category;
+                       peer_list->is_wfd_device = buff[i].is_wfd_device;
 
                        if (!cb(peer_list, user_data))
                                break;
@@ -1830,7 +1841,7 @@ int wifi_direct_foreach_connected_peers(wifi_direct_connected_peer_cb cb,
                        peer_list->p2p_supported = buff[i].is_p2p;
                        peer_list->primary_device_type = buff[i].category;
                        peer_list->channel = buff[i].channel;
-                       peer_list->service_count = get_service_list(buff[i].services, peer_list->service_list);
+                       peer_list->service_list = get_service_list(buff[i].services, &peer_list->service_count);
 
                        if (!cb(peer_list, user_data))
                                break;
@@ -3949,7 +3960,7 @@ int wifi_direct_serv_disc_req(char* mac_address, wifi_direct_service_type_e type
                return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
        }
 
-       if (type >= WIFI_DIRECT_SERVICE_BONJOUR &&
+       if (type >= WIFI_DIRECT_SERVICE_ALL &&
                        type <= WIFI_DIRECT_SERVICE_VENDORSPEC) {
                WDC_LOGD("Param service_type [%d]", type);
        } else {
@@ -4060,3 +4071,190 @@ int wifi_direct_serv_disc_cancel(int handle)
        __WDC_LOG_FUNC_END__;
        return WIFI_DIRECT_ERROR_NONE;
 }
+
+int wifi_direct_init_wifi_display(wifi_direct_display_type_e type, int port, int hdcp)
+{
+       __WDC_LOG_FUNC_START__;
+       wifi_direct_client_info_s *client_info = __wfd_get_control();
+       wifi_direct_client_request_s req;
+       wifi_direct_client_response_s rsp;
+       char *buf = NULL;
+       char *ptr = NULL;
+       int status = WIFI_DIRECT_ERROR_NONE;
+               if ((client_info->is_registered == false) ||
+                       (client_info->client_id == WFD_INVALID_ID)) {
+               WDC_LOGE("Client is NOT registered.");
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
+       }
+
+       memset(&req, 0, sizeof(wifi_direct_client_request_s));
+       memset(&rsp, 0, sizeof(wifi_direct_client_response_s));
+
+       WDC_LOGD("type [%d], port [%d], hdcp [%d]", type, port, hdcp);
+       buf= calloc(sizeof(wifi_direct_client_request_s) + sizeof(int), sizeof(char));
+       if (NULL == buf) {
+               WDC_LOGE("Memory can't be allocated for Buf\n");
+               return WIFI_DIRECT_ERROR_OUT_OF_MEMORY;
+       }
+
+       req.cmd = WIFI_DIRECT_CMD_INIT_WIFI_DISPLAY;
+       req.client_id = client_info->client_id;
+       req.data.int1 = type;
+       req.data.int2 = port;
+       req.cmd_data_len = sizeof(int);
+
+       memcpy(buf, &req, sizeof(wifi_direct_client_request_s));
+       ptr = buf;
+       ptr += sizeof(wifi_direct_client_request_s);
+       memcpy(ptr, &hdcp, sizeof(int));
+
+       pthread_mutex_lock(&g_client_info.mutex);
+       status = __wfd_client_write_socket(client_info->sync_sockfd, buf,
+                                                                       sizeof(wifi_direct_client_request_s) + sizeof(int));
+       free(buf);
+       if (status != WIFI_DIRECT_ERROR_NONE) {
+               WDC_LOGE("Error!!! writing to socket, Errno = %s", strerror(errno));
+               __wfd_reset_control();
+               pthread_mutex_unlock(&g_client_info.mutex);
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_COMMUNICATION_FAILED;
+       }
+       WDC_LOGD("Success writing data to the socket!");
+
+       status = __wfd_client_read_socket(client_info->sync_sockfd, (char*) &rsp,
+                                                                                               sizeof(wifi_direct_client_response_s));
+       pthread_mutex_unlock(&g_client_info.mutex);
+       if (status <= 0) {
+               WDC_LOGE("Error!!! reading socket, status = %d", status);
+               __wfd_reset_control();
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_COMMUNICATION_FAILED;
+       } else {
+               if (rsp.cmd == WIFI_DIRECT_CMD_INIT_WIFI_DISPLAY) {
+                       if (rsp.result != WIFI_DIRECT_ERROR_NONE) {
+                               WDC_LOGD("Error!!! Result received = %d", rsp.result);
+                               WDC_LOGD("Error!!! [%spin]", __wfd_print_error(rsp.result));
+                               __WDC_LOG_FUNC_END__;
+                               return rsp.result;
+                       }
+               } else {
+                       WDC_LOGE("Error!!! Invalid resp cmd = %d", rsp.cmd);
+                       __WDC_LOG_FUNC_END__;
+                       return WIFI_DIRECT_ERROR_OPERATION_FAILED;
+               }
+       }
+       __WDC_LOG_FUNC_END__;
+       return WIFI_DIRECT_ERROR_NONE;
+}
+
+int wifi_direct_deinit_wifi_display(void)
+{
+       __WDC_LOG_FUNC_START__;
+       wifi_direct_client_info_s *client_info = __wfd_get_control();
+       wifi_direct_client_request_s req;
+       wifi_direct_client_response_s rsp;
+       int res = WIFI_DIRECT_ERROR_NONE;
+
+       if ((client_info->is_registered == false) ||
+                       (client_info->client_id == WFD_INVALID_ID)) {
+               WDC_LOGE("Client is NOT registered");
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
+       }
+
+       memset(&req, 0, sizeof(wifi_direct_client_request_s));
+       memset(&rsp, 0, sizeof(wifi_direct_client_response_s));
+
+       req.cmd = WIFI_DIRECT_CMD_DEINIT_WIFI_DISPLAY;
+       req.client_id = client_info->client_id;
+
+       res = __wfd_client_send_request(client_info->sync_sockfd, &req, &rsp);
+       if (res != WIFI_DIRECT_ERROR_NONE) {
+               __WDC_LOG_FUNC_END__;
+               return res;
+       }
+       WDC_LOGD("wifi_direct_deinit_wifi_display() SUCCESS");
+
+       __WDC_LOG_FUNC_END__;
+       return WIFI_DIRECT_ERROR_NONE;
+}
+
+int wifi_direct_get_display_port(int *port)
+{
+       __WDC_LOG_FUNC_START__;
+       wifi_direct_client_info_s *client_info = __wfd_get_control();
+       wifi_direct_client_request_s req;
+       wifi_direct_client_response_s rsp;
+       int res = WIFI_DIRECT_ERROR_NONE;
+
+       if ((client_info->is_registered == false) ||
+                       (client_info->client_id == WFD_INVALID_ID)) {
+               WDC_LOGE("Client is NOT registered");
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
+       }
+
+       if (!port) {
+               WDC_LOGE("NULL Param [port]!");
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_INVALID_PARAMETER;
+       }
+
+       memset(&req, 0, sizeof(wifi_direct_client_request_s));
+       memset(&rsp, 0, sizeof(wifi_direct_client_response_s));
+
+       req.cmd = WIFI_DIRECT_CMD_GET_DISPLAY_PORT;
+       req.client_id = client_info->client_id;
+
+       res = __wfd_client_send_request(client_info->sync_sockfd, &req, &rsp);
+       if (res != WIFI_DIRECT_ERROR_NONE) {
+               __WDC_LOG_FUNC_END__;
+               return res;
+       }
+       WDC_LOGD("wifi_direct_is_autoconnection_mode() SUCCESS");
+       *port = (int) rsp.param1;
+
+       __WDC_LOG_FUNC_END__;
+       return WIFI_DIRECT_ERROR_NONE;
+}
+
+int wifi_direct_get_display_type(wifi_direct_display_type_e *type)
+{
+       __WDC_LOG_FUNC_START__;
+       wifi_direct_client_info_s *client_info = __wfd_get_control();
+       wifi_direct_client_request_s req;
+       wifi_direct_client_response_s rsp;
+       int res = WIFI_DIRECT_ERROR_NONE;
+
+       if ((client_info->is_registered == false) ||
+                       (client_info->client_id == WFD_INVALID_ID)) {
+               WDC_LOGE("Client is NOT registered");
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
+       }
+
+       if (!type) {
+               WDC_LOGE("NULL Param [type]!");
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_INVALID_PARAMETER;
+       }
+
+       memset(&req, 0, sizeof(wifi_direct_client_request_s));
+       memset(&rsp, 0, sizeof(wifi_direct_client_response_s));
+
+       req.cmd = WIFI_DIRECT_CMD_GET_DISPLAY_TYPE;
+       req.client_id = client_info->client_id;
+
+       res = __wfd_client_send_request(client_info->sync_sockfd, &req, &rsp);
+       if (res != WIFI_DIRECT_ERROR_NONE) {
+               __WDC_LOG_FUNC_END__;
+               return res;
+       }
+       WDC_LOGD("wifi_direct_is_autoconnection_mode() SUCCESS");
+       *type = (wifi_direct_display_type_e) rsp.param1;
+
+       __WDC_LOG_FUNC_END__;
+       return WIFI_DIRECT_ERROR_NONE;
+}
+