From: Kim Gibyoung Date: Fri, 23 Nov 2012 15:39:40 +0000 (+0900) Subject: Update from private X-Git-Tag: 2.1b_release^2~12 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=82f9a5f36626979371369ce731342e1aac65d082;p=framework%2Fconnectivity%2Flibwifi-direct.git Update from private Change-Id: Ibff686a862a55c23aaebdca096ce11a8829b3085 --- diff --git a/CMakeLists.txt b/CMakeLists.txt index edb95e4..702526d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,7 +8,3 @@ SET(LIBDIR "\${prefix}/lib") SET(INCLUDEDIR "\${prefix}/include") ADD_SUBDIRECTORY(src) - -IF("${ARCH}" MATCHES "arm") - ADD_SUBDIRECTORY(binary) -ENDIF() diff --git a/binary/CMakeLists.txt b/binary/CMakeLists.txt deleted file mode 100644 index d3220ea..0000000 --- a/binary/CMakeLists.txt +++ /dev/null @@ -1,26 +0,0 @@ -CMAKE_MINIMUM_REQUIRED(VERSION 2.6) -PROJECT(wfd-binary C) - -# Global setting -SET(VERSION 0.0) - -# Build type : Release -IF("${CMAKE_BUILD_TYPE}" STREQUAL "") - SET(CMAKE_BUILD_TYPE "Release") -ENDIF("${CMAKE_BUILD_TYPE}" STREQUAL "") -MESSAGE("Build type: ${CMAKE_BUILD_TYPE}") - -INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/dhcpd.p2p.conf DESTINATION etc/wifi-direct) -INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/dhcpd.eth.conf DESTINATION etc/wifi-direct) -INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/dhcpd.wl0.conf DESTINATION etc/wifi-direct) -INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/dhcpd-notify.sh DESTINATION bin) -INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/udhcp_script.non-autoip DESTINATION etc/wifi-direct) -INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/wifi-direct-server.sh DESTINATION bin) -INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/wifi-direct-dhcp.sh DESTINATION bin) -INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/wfd-manager DESTINATION bin) -INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/wifi-direct-plugin-broadcom.so DESTINATION lib) -INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/libbcmp2p.so DESTINATION lib) -INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/libbcmp2papp.so DESTINATION lib) -INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/libbcmp2psig.so DESTINATION lib) -INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/libwpscli.so DESTINATION lib) - diff --git a/binary/dhcpd-notify.sh b/binary/dhcpd-notify.sh deleted file mode 100755 index 9c2abfe..0000000 --- a/binary/dhcpd-notify.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh -# Dump DHCP lease data: MAC IP Time -dumpleases | awk '$1!="Mac" {print $1, $2, $3}' > /tmp/dhcp-client-table - -#Update vconf value to notify wifi-direct -vconftool set -t int memory/private/wifi_direct_manager/dhcp_ip_lease 1 -f -#cat /tmp/dhcp-client-table diff --git a/binary/dhcpd.eth.conf b/binary/dhcpd.eth.conf deleted file mode 100644 index 5f51a2f..0000000 --- a/binary/dhcpd.eth.conf +++ /dev/null @@ -1,9 +0,0 @@ -start 192.168.49.20 #default: 192.168.0.20 -end 192.168.49.40 #default: 192.168.0.254 -interface wlan0 #default: wlan0 -max_leases 20 #default: 254 -notify_file /usr/bin/dhcpd-notify.sh - -option subnet 255.255.255.0 -option router 192.168.49.1 -option lease 864000 # 10 days of seconds diff --git a/binary/dhcpd.p2p.conf b/binary/dhcpd.p2p.conf deleted file mode 100644 index fd3c04e..0000000 --- a/binary/dhcpd.p2p.conf +++ /dev/null @@ -1,10 +0,0 @@ -start 192.168.49.20 #default: 192.168.0.20 -end 192.168.49.40 #default: 192.168.0.254 -interface p2p-wlan0-0 #default: wlan0 -max_leases 20 #default: 254 -notify_file /usr/bin/dhcpd-notify.sh - - -option subnet 255.255.255.0 -option router 192.168.49.1 -option lease 864000 # 10 days of seconds diff --git a/binary/dhcpd.wl0.conf b/binary/dhcpd.wl0.conf deleted file mode 100644 index 426f001..0000000 --- a/binary/dhcpd.wl0.conf +++ /dev/null @@ -1,10 +0,0 @@ -start 192.168.49.20 #default: 192.168.0.20 -end 192.168.49.40 #default: 192.168.0.254 -interface wl0.1 #default: wlan0 -max_leases 20 #default: 254 -notify_file /usr/bin/dhcpd-notify.sh - - -option subnet 255.255.255.0 -option router 192.168.49.1 -option lease 864000 # 10 days of seconds diff --git a/binary/libbcmp2p.so b/binary/libbcmp2p.so deleted file mode 100755 index cab262f..0000000 Binary files a/binary/libbcmp2p.so and /dev/null differ diff --git a/binary/libbcmp2papp.so b/binary/libbcmp2papp.so deleted file mode 100755 index d70b47a..0000000 Binary files a/binary/libbcmp2papp.so and /dev/null differ diff --git a/binary/libbcmp2psig.so b/binary/libbcmp2psig.so deleted file mode 100755 index 0b569ab..0000000 Binary files a/binary/libbcmp2psig.so and /dev/null differ diff --git a/binary/libwpscli.so b/binary/libwpscli.so deleted file mode 100755 index 0fe79e4..0000000 Binary files a/binary/libwpscli.so and /dev/null differ diff --git a/binary/libwpscore.so b/binary/libwpscore.so deleted file mode 100755 index c6e21a2..0000000 Binary files a/binary/libwpscore.so and /dev/null differ diff --git a/binary/udhcp_script.non-autoip b/binary/udhcp_script.non-autoip deleted file mode 100755 index 487415e..0000000 --- a/binary/udhcp_script.non-autoip +++ /dev/null @@ -1,70 +0,0 @@ -#!/bin/sh - -# udhcpc script edited by Tim Riker - -[ -z "$1" ] && echo "Error: should be called from udhcpc" && exit 1 - -RESOLV_CONF="/etc/resolv.conf" -TEMP_DHCP_FILE="/tmp/udhcpc_dyn.tmp" -UDHCPC_LOG="/tmp/udhcpc_log" - -env > /tmp/test_env - -[ -n "$broadcast" ] && BROADCAST="broadcast $broadcast" -[ -n "$subnet" ] && NETMASK="netmask $subnet" - -case "$1" in - deconfig) - /sbin/ifconfig $interface 0.0.0.0 - ;; - - renew|bound) - /sbin/ifconfig $interface $ip $BROADCAST $NETMASK up - echo "$interface $ip $BROADCAST $NETMASK" >> $UDHCPC_LOG -# if [ -n "$router" ] ; then -# echo "deleting routers" >> $UDHCPC_LOG -# while route del default gw 0.0.0.0 dev $interface 2>/dev/null ; do -# : -# done -# -# for i in $router ; do -# echo "router $i" >> $UDHCPC_LOG -# route add default gw $i dev $interface -# done -# fi - - echo -n > $RESOLV_CONF - [ -n "$domain" ] && echo search $domain >> $RESOLV_CONF - for i in $dns ; do - echo "adding dns $i" >> $UDHCPC_LOG - echo nameserver $i >> $RESOLV_CONF - done - echo serveraddr $serverid >> $TEMP_DHCP_FILE - echo leasetime $lease >> $TEMP_DHCP_FILE - - if [ -n $router ]; then - for i in $router ; do -# Take the first router - echo "route $i" - local_gateway=$i - break - done - fi - if [ -z $subnet ]; then - subnet="255.255.255.0" - fi - if [ -z $local_gateway ]; then - local_gateway="0.0.0.0" - fi - - vconftool set -t string memory/private/wifi_direct_manager/p2p_ifname ${interface} -f - vconftool set -t string memory/private/wifi_direct_manager/p2p_local_ip ${ip} -f - vconftool set -t string memory/private/wifi_direct_manager/p2p_subnet_mask ${subnet} -f - vconftool set -t string memory/private/wifi_direct_manager/p2p_gateway ${local_gateway} -f - vconftool set -t string memory/private/wifi_direct_manager/dhcpc_server_ip ${serverid} -f - - echo $i >> $TEMP_DHCP_FILE - ;; -esac - -exit 0 diff --git a/binary/wfd-manager b/binary/wfd-manager deleted file mode 100755 index 41c0da3..0000000 Binary files a/binary/wfd-manager and /dev/null differ diff --git a/binary/wifi-direct-dhcp.sh b/binary/wifi-direct-dhcp.sh deleted file mode 100755 index 2e1dd24..0000000 --- a/binary/wifi-direct-dhcp.sh +++ /dev/null @@ -1,107 +0,0 @@ -#!/bin/sh -INTERFACE_PREFIX="wl0" -TARGET="U1HD" -DEFAULT_IP="192.168.49.1" - -val=`uname -a | grep PQ | wc -l` -if [ "${val}" -eq "1" ]; then - INTERFACE_PREFIX="p2p" - TARGET="PQ" -fi - -val=`uname -a | grep i686 | wc -l` -if [ "${val}" -eq "1" ]; then - INTERFACE_PREFIX="eth" - TARGET="EMUL" -fi - -interface=`ifconfig|grep ^${INTERFACE_PREFIX}|cut -d" " -f1` -echo "Target is ${TARGET} and interface ${INTERFACE_PREFIX}: ${interface}." - -start_dhcp_server() -{ - if [ "X${interface}" == "X" ]; then - echo "interface(${INTERFACE_PREFIX}) is not up" - return 0 - fi - - ifconfig ${interface} ${DEFAULT_IP} up - udhcpd /usr/etc/wifi-direct/dhcpd.${INTERFACE_PREFIX}.conf -f & - - route=`cat /usr/etc/wifi-direct/dhcpd.${INTERFACE_PREFIX}.conf | grep router | awk '{print $3}'` - if [ -z $route ]; then - route="192.168.49.1" - fi - subnet=`cat /usr/etc/wifi-direct/dhcpd.${INTERFACE_PREFIX}.conf | grep subnet | awk '{print $3}'` - - if [ -z $subnet ]; then - subnet="255.255.255.0" - fi - - vconftool set -t string memory/private/wifi_direct_manager/p2p_ifname ${interface} -f - vconftool set -t string memory/private/wifi_direct_manager/p2p_local_ip ${DEFAULT_IP} -f - vconftool set -t string memory/private/wifi_direct_manager/p2p_subnet_mask ${subnet} -f - vconftool set -t string memory/private/wifi_direct_manager/p2p_gateway ${route} -f -} - -start_dhcp_client() -{ - if [ "X${interface}" == "X" ]; then - echo "interface(${INTERFACE_PREFIX}) is not up" - return 0 - fi - /usr/bin/udhcpc -i $interface -s /usr/etc/wifi-direct/udhcp_script.non-autoip & -} - - -stop_dhcp() -{ - vconftool set -t string memory/private/wifi_direct_manager/p2p_ifname "" -f - vconftool set -t string memory/private/wifi_direct_manager/p2p_local_ip "" -f - vconftool set -t string memory/private/wifi_direct_manager/p2p_subnet_mask "" -f - vconftool set -t string memory/private/wifi_direct_manager/p2p_gateway "" -f - - killall udhcpc - killall udhcpd -# ifconfig ${interface} 0.0.0.0 -} - -is_running() -{ - program=$1 - run=`ps -eo comm|grep ${program}` - if [ "X${run}" == "X" ]; then - echo "${program} is not running" - else - echo "${program} is already running" - fi -} - -status_dhcp() -{ - is_running udhcpc - is_running udhcpd -} - - -case $1 in -"server") -stop_dhcp -start_dhcp_server -;; -"client") -stop_dhcp -start_dhcp_client -;; -"stop") -stop_dhcp -;; -"status") -status_dhcp -;; -*) -/bin/echo wifi-direct-dhcp.sh [server] [client] [stop] [status] -exit 1 -;; -esac - diff --git a/binary/wifi-direct-plugin-broadcom.so b/binary/wifi-direct-plugin-broadcom.so deleted file mode 100755 index 32e7eef..0000000 Binary files a/binary/wifi-direct-plugin-broadcom.so and /dev/null differ diff --git a/binary/wifi-direct-server.sh b/binary/wifi-direct-server.sh deleted file mode 100755 index a993eac..0000000 --- a/binary/wifi-direct-server.sh +++ /dev/null @@ -1,50 +0,0 @@ -#!/bin/sh -program="wfd-manager" -target=`ps -eo comm|grep ${program}` - -start_wifi_direct() -{ - if [ "X${target}" == "X" ]; then - echo "${program} is not running" - echo "Launching ${program}" - /usr/bin/${program}& - sleep 1 - else - echo "${program} is already running" - fi -} - -stop_wifi_direct() -{ - if [ "X${target}" == "X" ]; then - echo "${program} is not running" - else - echo "${program} is running.. Killing it" - killall ${program} - fi -} - -status_wifi_direct() -{ - if [ "X${target}" == "X" ]; then - echo "${program} is not running" - else - echo "${program} is already running" - fi -} - -case $1 in -"start") -start_wifi_direct -;; -"stop") -stop_wifi_direct -;; -"status") -status_wifi_direct -;; -*) -/bin/echo wifi-direct-server.sh [start] [stop] [status] -exit 1 -;; -esac diff --git a/debian/changelog b/debian/changelog index 9cf4cf3..833667a 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,11 @@ +libwifi-direct (0.3.0) unstable; urgency=low + + * Update from private + * Git : rsa/framework/connectivity/libwifi-direct + * Tag : libwifi-direct_0.3.0 + + -- Gibyoung Kim Fri, 23 Nov 2012 22:26:45 +0900 + libwifi-direct (0.2.15) unstable; urgency=low * Install vconf keys with -i option diff --git a/include/wifi-direct-internal.h b/include/wifi-direct-internal.h index a5f0e75..db04472 100644 --- a/include/wifi-direct-internal.h +++ b/include/wifi-direct-internal.h @@ -107,8 +107,15 @@ typedef enum WIFI_DIRECT_CMD_SET_MAX_CLIENT, WIFI_DIRECT_CMD_GET_MAX_CLIENT, WIFI_DIRECT_CMD_SET_AUTOCONNECTION_MODE, + WIFI_DIRECT_CMD_IS_AUTOCONNECTION_MODE, WIFI_DIRECT_CMD_IS_DISCOVERABLE, + WIFI_DIRECT_CMD_IS_LISTENING_ONLY, WIFI_DIRECT_CMD_GET_OWN_GROUP_CHANNEL, + WIFI_DIRECT_CMD_ACTIVATE_PERSISTENT_GROUP, + WIFI_DIRECT_CMD_DEACTIVATE_PERSISTENT_GROUP, + WIFI_DIRECT_CMD_IS_PERSISTENT_GROUP, + WIFI_DIRECT_CMD_GET_PERSISTENT_GROUP_INFO, + WIFI_DIRECT_CMD_REMOVE_PERSISTENT_GROUP, WIFI_DIRECT_CMD_SET_OEM_LOGLEVEL, @@ -158,6 +165,7 @@ typedef struct bool hide_SSID; int group_owner_intent; bool want_persistent_group; + bool listen_only; bool auto_connection; wifi_direct_primary_device_type_e primary_dev_type; wifi_direct_secondary_device_type_e secondary_dev_type; @@ -200,6 +208,11 @@ typedef struct int channel; } wfd_connected_peer_info_s; +typedef struct +{ + char ssid[WIFI_DIRECT_MAX_SSID_LEN + 1]; + unsigned char go_mac_address[6]; +} wfd_persistent_group_info_s; typedef struct { diff --git a/include/wifi-direct.h b/include/wifi-direct.h index ceaae16..90f3514 100644 --- a/include/wifi-direct.h +++ b/include/wifi-direct.h @@ -206,41 +206,6 @@ typedef enum { WIFI_DIRECT_WPS_TYPE_PIN_KEYPAD = 0x04, /**< Provide the keypad to input the PIN */ } wifi_direct_wps_type_e; -/** -* @struct wifi_direct_config_data_s -* Wi-Fi Direct configuration data structure -*/ -typedef struct -{ - /** ssid */ - char *ssid; - - /** Specifies the operating channel. If zero, auto channel selection - * will be used to find a quiet channel. - */ - int channel; - - /** WPS configuration parameters. */ - wifi_direct_wps_type_e wps_config; - - /** Max number of STAs allowed associations */ - int max_clients; - - /** TRUE to hide SSID in beacons and probe responses, FALSE otherwise. */ - bool hide_SSID; - - /** P2P Group owner intent value. */ - int group_owner_intent; - - bool want_persistent_group; - - /** Auto connection mode */ - bool auto_connection; - - wifi_direct_primary_device_type_e primary_dev_type; - wifi_direct_secondary_device_type_e secondary_dev_type; -} wifi_direct_config_data_s; - /** * @struct wifi_direct_discovered_peer_info_s @@ -1934,8 +1899,9 @@ int wifi_direct_get_state(wifi_direct_state_e * state); /** -* @brief Checks whether this device is discoverable or not. -* @param[out] discoverable Indicats whether this device is discoverable or not +* @brief Checks whether this device is discoverable or not by P2P discovery. +* @details If you call wifi_direct_start_discovery(), then your device can be discoverable. +* @param[out] discoverable The status of discoverable: (@c true = discoverable, @c false = non-discoverable) * @return 0 on success, otherwise a negative error value. * @retval #WIFI_DIRECT_ERROR_NONE Successful * @retval #WIFI_DIRECT_ERROR_INVALID_PARAMETER Invalid parameter @@ -1946,9 +1912,30 @@ int wifi_direct_get_state(wifi_direct_state_e * state); * @retval #WIFI_DIRECT_ERROR_RESOURCE_BUSY Device or resource busy * @pre Wi-Fi Direct service must be initialized by wifi_direct_initialize(). * @see wifi_direct_initialize() +* @see wifi_direct_start_discovery() +* @see wifi_direct_cancel_discovery() */ int wifi_direct_is_discoverable(bool* discoverable); +/** +* @brief Checks whether the local device is listening only. +* @details If you call wifi_direct_start_discovery() with @a listen_only as @c true, +* then skip the initial 802.11 Scan and then enter Listen state instead of cycling between Scan andListen. +* @param[out] listen_only The status of listen only: (@c true = listen only, @c false = cycling between Scan and Listen or not in discovery state) +* @return 0 on success, otherwise a negative error value. +* @retval #WIFI_DIRECT_ERROR_NONE Successful +* @retval #WIFI_DIRECT_ERROR_INVALID_PARAMETER Invalid parameter +* @retval #WIFI_DIRECT_ERROR_OPERATION_FAILED Operation failed +* @retval #WIFI_DIRECT_ERROR_COMMUNICATION_FAILED Communication failed +* @retval #WIFI_DIRECT_ERROR_NOT_PERMITTED Operation not permitted +* @retval #WIFI_DIRECT_ERROR_NOT_INITIALIZED Not initialized +* @retval #WIFI_DIRECT_ERROR_RESOURCE_BUSY Device or resource busy +* @pre Wi-Fi Direct service must be activated by wifi_direct_activate(). +* @see wifi_direct_start_discovery() +* @see wifi_direct_cancel_discovery() +* @see wifi_direct_is_discoverable() +*/ +int wifi_direct_is_listening_only(bool* listen_only); /** * @brief Gets the primary device type of local device. @@ -1966,6 +1953,21 @@ int wifi_direct_is_discoverable(bool* discoverable); */ int wifi_direct_get_primary_device_type(wifi_direct_primary_device_type_e* type); + /** +* @brief Gets the secondary device type of local device. +* @param[out] type The secondary device type +* @return 0 on success, otherwise a negative error value. +* @retval #WIFI_DIRECT_ERROR_NONE Successful +* @retval #WIFI_DIRECT_ERROR_INVALID_PARAMETER Invalid parameter +* @retval #WIFI_DIRECT_ERROR_OPERATION_FAILED Operation failed +* @retval #WIFI_DIRECT_ERROR_COMMUNICATION_FAILED Communication failed +* @retval #WIFI_DIRECT_ERROR_NOT_PERMITTED Operation not permitted +* @retval #WIFI_DIRECT_ERROR_NOT_INITIALIZED Not initialized +* @retval #WIFI_DIRECT_ERROR_RESOURCE_BUSY Device or resource busy +* @pre Wi-Fi Direct service must be initialized by wifi_direct_initialize(). +* @see wifi_direct_initialize() +*/ +int wifi_direct_get_secondary_device_type(wifi_direct_secondary_device_type_e* type); /*****************************************************************************************/ @@ -2427,7 +2429,7 @@ int wifi_direct_get_max_clients(int* max); /** -* @brief Gets the channel of own group. +* @brief Gets the channel of own group. - DEPRECATED * @param[out] channel The channel of own group * @return 0 on success, otherwise a negative error value. * @retval #WIFI_DIRECT_ERROR_NONE Successful @@ -2443,124 +2445,21 @@ int wifi_direct_get_max_clients(int* max); int wifi_direct_get_own_group_channel(int* channel); -/*****************************************************************************************/ -/* wifi_direct_get_config_data API function prototype -* int wifi_direct_get_config_data(wifi_direct_config_data_s** config) -*/ /** -* \brief This API shall get Wi-Fi direct configuration data. \n -* @param config Pointer to store configuration information. Application must free this memory. -* -* \see wifi_direct_set_config_data -* -* \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_OPERATION_FAILED for "Unkown error" \n -* - WIFI_DIRECT_ERROR_OUT_OF_MEMORY for "Out of memory" \n -* - WIFI_DIRECT_ERROR_COMMUNICATION_FAILED for "I/O error" \n -* - WIFI_DIRECT_ERROR_NOT_PERMITTED for "Operation not permitted" \n -* - WIFI_DIRECT_ERROR_INVALID_PARAMETER for "Invalid function parameter" \n -* - WIFI_DIRECT_ERROR_RESOURCE_BUSY for "Device or resource busy" \n -* - WIFI_DIRECT_ERROR_STRANGE_CLIENT for "Invalid Client" \n -* -* -* \par Prospective Clients: -* External Apps. -* -* \code -* -* #include -* -* void foo() -* { -* int result; -* wifi_direct_config_data_s* config; -* -* result = wifi_direct_get_config_data(&config); -* -* if(result == WIFI_DIRECT_ERROR_NONE)......... // getting config data is successful -* -*\endcode -* -*\remarks None. -* -******************************************************************************/ -int wifi_direct_get_config_data(wifi_direct_config_data_s ** config); - - -/*****************************************************************************************/ -/* wifi_direct_set_config_data API function prototype -* int wifi_direct_set_config_data(wifi_direct_config_data_s* config); +* @brief Gets the operating channel. +* @param[out] channel The operating channel +* @return 0 on success, otherwise a negative error value. +* @retval #WIFI_DIRECT_ERROR_NONE Successful +* @retval #WIFI_DIRECT_ERROR_INVALID_PARAMETER Invalid parameter +* @retval #WIFI_DIRECT_ERROR_OPERATION_FAILED Operation failed +* @retval #WIFI_DIRECT_ERROR_COMMUNICATION_FAILED Communication failed +* @retval #WIFI_DIRECT_ERROR_NOT_PERMITTED Operation not permitted +* @retval #WIFI_DIRECT_ERROR_NOT_INITIALIZED Not initialized +* @retval #WIFI_DIRECT_ERROR_RESOURCE_BUSY Device or resource busy +* @pre Wi-Fi Direct service must be initialized by wifi_direct_initialize(). +* @see wifi_direct_initialize() */ -/** -* \brief This API shall set or update Wi-Fi direct configuration data. \n -* @param config Wi-Fi configuration data to be set -* -* \see wifi_direct_get_config_data -* -* \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_OPERATION_FAILED for "Unkown error" \n -* - WIFI_DIRECT_ERROR_OUT_OF_MEMORY for "Out of memory" \n -* - WIFI_DIRECT_ERROR_COMMUNICATION_FAILED for "I/O error" \n -* - WIFI_DIRECT_ERROR_NOT_PERMITTED for "Operation not permitted" \n -* - WIFI_DIRECT_ERROR_INVALID_PARAMETER for "Invalid function parameter" \n -* - WIFI_DIRECT_ERROR_RESOURCE_BUSY for "Device or resource busy" \n -* - WIFI_DIRECT_ERROR_STRANGE_CLIENT for "Invalid Client" \n -* -* -* \par Prospective Clients: -* External Apps. -* -* \code -* -* #include -* -* void foo() -* { -* int result; -* wifi_direct_config_data_s* config; -* -* result = wifi_direct_get_config_data(&config); -* -* if(result != WIFI_DIRECT_ERROR_NONE)......... // Getting configuration data is not successful -* { -* return; -* } -* -* // Change params -* config->group_owner_intent = 8; -* config->wps_config = WIFI_DIRECT_WPS_TYPE_PBC; -* config->want_persistent_group = false; -* config->hide_SSID = false; -* strncpy(config->ssid, "My WiFi Direct", WIFI_DIRECT_MAX_SSID_LEN); -* -* result = wifi_direct_set_config_data(config); -* if(result == WIFI_DIRECT_ERROR_NONE)......... // Setting configuration data is successful -* { -* -* -* -*\endcode -* -*\remarks None. -* -******************************************************************************/ -int wifi_direct_set_config_data(wifi_direct_config_data_s * config); - +int wifi_direct_get_operating_channel(int* channel); /** * @brief Sets the Autoconnection mode. @@ -2571,6 +2470,101 @@ int wifi_direct_set_config_data(wifi_direct_config_data_s * config); */ int wifi_direct_set_autoconnection_mode(bool mode); +int wifi_direct_is_autoconnection_mode(bool* mode); + + +/** +* @brief Activates the persistent group. +* @retval #WIFI_DIRECT_ERROR_NONE Successful +* @retval #WIFI_DIRECT_ERROR_OPERATION_FAILED Operation failed +* @retval #WIFI_DIRECT_ERROR_COMMUNICATION_FAILED Communication failed +* @retval #WIFI_DIRECT_ERROR_NOT_PERMITTED Operation not permitted +* @retval #WIFI_DIRECT_ERROR_NOT_INITIALIZED Not initialized +* @retval #WIFI_DIRECT_ERROR_RESOURCE_BUSY Device or resource busy +* @pre Wi-Fi Direct service must be initialized by wifi_direct_initialize(). +* @see wifi_direct_initialize() +* @see wifi_direct_deactivate_persistent_group() +* @see wifi_direct_is_persistent_group_activated() +*/ +int wifi_direct_activate_persistent_group(void); + +/** +* @brief Deactivates the persistent group. +* @retval #WIFI_DIRECT_ERROR_NONE Successful +* @retval #WIFI_DIRECT_ERROR_OPERATION_FAILED Operation failed +* @retval #WIFI_DIRECT_ERROR_COMMUNICATION_FAILED Communication failed +* @retval #WIFI_DIRECT_ERROR_NOT_PERMITTED Operation not permitted +* @retval #WIFI_DIRECT_ERROR_NOT_INITIALIZED Not initialized +* @retval #WIFI_DIRECT_ERROR_RESOURCE_BUSY Device or resource busy +* @pre The persistent group of Wi-Fi Direct service must be initialized by wifi_direct_initialize(). +* @see wifi_direct_initialize() +* @see wifi_direct_activate_persistent_group() +* @see wifi_direct_is_persistent_group_activated() +*/ +int wifi_direct_deactivate_persistent_group(void); + +/** +* @brief Checks whether the persistent group is activated or not. +* @param[in] activated The status of persistent group: (@c true = activated, @c false = deactivated) +* @retval #WIFI_DIRECT_ERROR_NONE Successful +* @retval #WIFI_DIRECT_ERROR_INVALID_PARAMETER Invalid parameter +* @retval #WIFI_DIRECT_ERROR_OPERATION_FAILED Operation failed +* @retval #WIFI_DIRECT_ERROR_COMMUNICATION_FAILED Communication failed +* @retval #WIFI_DIRECT_ERROR_NOT_PERMITTED Operation not permitted +* @retval #WIFI_DIRECT_ERROR_NOT_INITIALIZED Not initialized +* @retval #WIFI_DIRECT_ERROR_RESOURCE_BUSY Device or resource busy +* @pre Wi-Fi Direct service must be initialized by wifi_direct_initialize(). +* @see wifi_direct_initialize() +* @see wifi_direct_activate_persistent_group() +*/ +int wifi_direct_is_persistent_group_activated(bool* activated); + +/** +* @brief Called when you get the persistent groups repeatedly. +* @param[in] mac_address The MAC address of persistent group owner +* @param[in] ssid The SSID(Service Set Identifier) of persistent group owner +* @param[in] user_data The user data passed from the request function +* @return @c true to continue with the next iteration of the loop, \n @c false to break out of theloop +* @pre wifi_direct_foreach_persistent_groups() will invoke this callback. +* @see wifi_direct_foreach_persistent_groups() +*/ +typedef bool(*wifi_direct_persistent_group_cb)(const char* mac_address, const char* ssid, void* user_data); + +/** +* @brief Gets the persistent groups. +* @param[in] callback The callback function to invoke +* @param[in] user_data The user data to be passed to the callback function +* @retval #WIFI_DIRECT_ERROR_NONE Successful +* @retval #WIFI_DIRECT_ERROR_INVALID_PARAMETER Invalid parameter +* @retval #WIFI_DIRECT_ERROR_OPERATION_FAILED Operation failed +* @retval #WIFI_DIRECT_ERROR_COMMUNICATION_FAILED Communication failed +* @retval #WIFI_DIRECT_ERROR_NOT_PERMITTED Operation not permitted +* @retval #WIFI_DIRECT_ERROR_NOT_INITIALIZED Not initialized +* @retval #WIFI_DIRECT_ERROR_RESOURCE_BUSY Device or resource busy +* @pre Wi-Fi Direct service must be initialized by wifi_direct_initialize(). +* @post wifi_direct_persistent_group_cb() will be called. +* @see wifi_direct_initialize() +* @see wifi_direct_persistent_group_cb() +*/ +int wifi_direct_foreach_persistent_groups(wifi_direct_persistent_group_cb callback, void* user_data); + +/** +* @brief Remove a persistent group. +* @param[in] mac_address The MAC address of persistent group owner +* @param[in] ssid The SSID(Service Set Identifier) of persistent group owner +* @retval #WIFI_DIRECT_ERROR_NONE Successful +* @retval #WIFI_DIRECT_ERROR_INVALID_PARAMETER Invalid parameter +* @retval #WIFI_DIRECT_ERROR_OPERATION_FAILED Operation failed +* @retval #WIFI_DIRECT_ERROR_COMMUNICATION_FAILED Communication failed +* @retval #WIFI_DIRECT_ERROR_NOT_PERMITTED Operation not permitted +* @retval #WIFI_DIRECT_ERROR_NOT_INITIALIZED Not initialized +* @retval #WIFI_DIRECT_ERROR_RESOURCE_BUSY Device or resource busy +* @pre Wi-Fi Direct service must be initialized by wifi_direct_initialize(). +* @see wifi_direct_initialize() +* @see wifi_direct_foreach_persistent_groups() +*/ +int wifi_direct_remove_persistent_group(const char* mac_address, const char* ssid); + /** * @} diff --git a/packaging/libwifi-direct.spec b/packaging/libwifi-direct.spec index f62171a..e51118f 100755 --- a/packaging/libwifi-direct.spec +++ b/packaging/libwifi-direct.spec @@ -1,6 +1,6 @@ Name: libwifi-direct Summary: wifi direct library (Shared Library) -Version: 0.2.15 +Version: 0.3.0 Release: 1 Group: TO_BE_FILLED License: Apache-2.0 @@ -17,16 +17,6 @@ BuildRequires: gettext-devel %description wifi direct library (Shared Library) -%ifarch %{arm} -Provides: libbcmp2p.so -Provides: libbcmp2papp.so -Provides: libwpscli.so -Provides: libbcmp2psig.so -Provides: wfd-manager -Provides: wifi-direct-plugin-broadcom.so -%endif - - %package devel Summary: wifi direct library (Shared Library) (Developement) @@ -40,13 +30,13 @@ wifi direct library (Shared Library) (Developement) %setup -q %ifarch %{arm} -%define ARCH arm +export ARCH=arm %else -%define ARCH i586 +export ARCH=i586 %endif %build -cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} -DARCH=%{ARCH} +cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} #make %{?jobs:-j%jobs} %install @@ -54,10 +44,10 @@ rm -rf %{buildroot} %make_install %__strip %{buildroot}%{_libdir}/libwifi-direct.so.0.0 +mkdir -p %{buildroot}/usr/share/license +cp %{_builddir}/%{buildsubdir}/LICENSE %{buildroot}/usr/share/license/%{name} + %post -vconftool set -t int memory/wifi_direct/state 0 -u 5000 -i -vconftool set -t int memory/private/wifi_direct_manager/dhcp_ip_lease 0 -i -vconftool set -t string memory/private/wifi_direct_manager/dhcpc_server_ip 0.0.0.0 -i %postun @@ -68,31 +58,7 @@ vconftool set -t string memory/private/wifi_direct_manager/dhcpc_server_ip 0.0.0 %{_libdir}/libwifi-direct.so %{_libdir}/libwifi-direct.so.0 %{_libdir}/libwifi-direct.so.0.0 - -%ifarch %{arm} -/usr/etc/wifi-direct/dhcpd.p2p.conf -/usr/etc/wifi-direct/dhcpd.wl0.conf -/usr/etc/wifi-direct/dhcpd.eth.conf -/usr/etc/wifi-direct/udhcp_script.non-autoip -%{_bindir}/dhcpd-notify.sh -%{_bindir}/wifi-direct-server.sh -%{_bindir}/wifi-direct-dhcp.sh - -%{_bindir}/wfd-manager -%{_libdir}/wifi-direct-plugin-broadcom.so -%{_libdir}/libbcmp2p.so -%{_libdir}/libbcmp2papp.so -%{_libdir}/libbcmp2psig.so -%{_libdir}/libwpscli.so - -%attr(755,-,-) %{_bindir}/wfd-manager -%attr(755,-,-) %{_bindir}/dhcpd-notify.sh -%attr(755,-,-) %{_bindir}/wifi-direct-server.sh -%attr(755,-,-) %{_bindir}/wifi-direct-dhcp.sh -%attr(755,-,-) /usr/etc/wifi-direct/udhcp_script.non-autoip - -%endif - +/usr/share/license/%{name} %files devel %defattr(-,root,root,-) diff --git a/src/wifi-direct-client-proxy.c b/src/wifi-direct-client-proxy.c index b5d8de0..5d6870b 100644 --- a/src/wifi-direct-client-proxy.c +++ b/src/wifi-direct-client-proxy.c @@ -690,6 +690,24 @@ void __wfd_client_print_connected_peer_info(wfd_connected_peer_info_s * list, in } +void __wfd_client_print_persistent_group_info(wfd_persistent_group_info_s * list, int num) +{ + int i = 0; + + WFD_CLIENT_LOG(WFD_LOG_LOW, "------------------------------------------\n"); + for (i = 0; i < num; i++) + { + WFD_CLIENT_LOG(WFD_LOG_LOW, "== Persistent Group index : %d ==\n", i); + WFD_CLIENT_LOG(WFD_LOG_LOW, "ssid : %s\n", list[i].ssid); + WFD_CLIENT_LOG(WFD_LOG_LOW, "GO MAC : " MACSTR "\n", + MAC2STR(list[i].go_mac_address)); + } + WFD_CLIENT_LOG(WFD_LOG_ERROR, + "------------------------------------------\n"); +} + + + void __wfd_client_print_config_data(wfd_config_data_s * config) { if (config == NULL) @@ -2973,6 +2991,8 @@ int wifi_direct_get_max_clients(int* max) return WIFI_DIRECT_ERROR_NONE; } + +/* Deprecated */ int wifi_direct_get_own_group_channel(int* channel) { wifi_direct_client_info_s *client_info = __wfd_get_control(); @@ -3060,6 +3080,95 @@ int wifi_direct_get_own_group_channel(int* channel) } + +int wifi_direct_get_operating_channel(int* channel) +{ + wifi_direct_client_info_s *client_info = __wfd_get_control(); + + __WFD_CLIENT_FUNC_START__; + + if ((client_info->is_registered == false) + || (client_info->client_id == WFD_INVALID_ID)) + { + WFD_CLIENT_LOG(WFD_LOG_ERROR, "Client is NOT registered.\n"); + __WFD_CLIENT_FUNC_END__; + return WIFI_DIRECT_ERROR_NOT_INITIALIZED; + } + + wifi_direct_client_request_s req; + wifi_direct_client_response_s rsp; + + int ret = WIFI_DIRECT_ERROR_NONE; + + memset(&req, 0, sizeof(wifi_direct_client_request_s)); + memset(&rsp, 0, sizeof(wifi_direct_client_response_s)); + + req.cmd = WIFI_DIRECT_CMD_GET_OWN_GROUP_CHANNEL; + req.client_id = client_info->client_id; + + ret = + __wfd_client_send_request(client_info->sync_sockfd, &req, + sizeof(wifi_direct_client_request_s)); + if (ret != WIFI_DIRECT_ERROR_NONE) + { + WFD_CLIENT_LOG(WFD_LOG_ERROR, + "Error!!! writing to socket, Errno = %s\n", + strerror(errno)); + WFD_CLIENT_LOG(WFD_LOG_ERROR, "Error!!! [%s]\n", + __wfd_print_error(ret)); + client_info->sync_sockfd = -1; + __wfd_reset_control(); + __WFD_CLIENT_FUNC_END__; + return WIFI_DIRECT_ERROR_COMMUNICATION_FAILED; + } + + if ((ret = + __wfd_client_read_socket(client_info->sync_sockfd, (char *) &rsp, + sizeof(wifi_direct_client_response_s))) <= 0) + { + WFD_CLIENT_LOG(WFD_LOG_ERROR, + "Error!!! reading socket, status = %d errno = %s\n", ret, + strerror(errno)); + client_info->sync_sockfd = -1; + __wfd_reset_control(); + __WFD_CLIENT_FUNC_END__; + return WIFI_DIRECT_ERROR_COMMUNICATION_FAILED; + } + else + { + if (rsp.cmd == WIFI_DIRECT_CMD_GET_OWN_GROUP_CHANNEL) + { + if (rsp.result != WIFI_DIRECT_ERROR_NONE) + { + WFD_CLIENT_LOG(WFD_LOG_LOW, "Error!!! Result received = %d \n", + rsp.result); + WFD_CLIENT_LOG(WFD_LOG_LOW, "Error!!! [%s]\n", + __wfd_print_error(rsp.result)); + __WFD_CLIENT_FUNC_END__; + return rsp.result; + } + else + { + WFD_CLIENT_LOG(WFD_LOG_LOW, "channel = [%d]\n", + (int) rsp.param1); + *channel = rsp.param1; + } + } + else + { + WFD_CLIENT_LOG(WFD_LOG_ERROR, "Error!!! Invalid resp cmd = %d\n", + rsp.cmd); + return WIFI_DIRECT_ERROR_OPERATION_FAILED; + } + } + + __WFD_CLIENT_FUNC_END__; + + return WIFI_DIRECT_ERROR_NONE; + +} + + int wifi_direct_set_wpa_passphrase(char *passphrase) { wifi_direct_client_info_s *client_info = __wfd_get_control(); @@ -4761,7 +4870,6 @@ int wifi_direct_get_state(wifi_direct_state_e * state) int wifi_direct_is_discoverable(bool* discoverable) { -{ wifi_direct_client_info_s *client_info = __wfd_get_control(); __WFD_CLIENT_FUNC_START__; @@ -4854,18 +4962,17 @@ int wifi_direct_is_discoverable(bool* discoverable) return WIFI_DIRECT_ERROR_NONE; } -} -int wifi_direct_get_primary_device_type(wifi_direct_primary_device_type_e* type) +int wifi_direct_is_listening_only(bool* listen_only) { wifi_direct_client_info_s *client_info = __wfd_get_control(); __WFD_CLIENT_FUNC_START__; - if (NULL == type) + if (listen_only == NULL) { - WFD_CLIENT_LOG(WFD_LOG_ERROR, "NULL Param [type]!\n"); + WFD_CLIENT_LOG(WFD_LOG_ERROR, "NULL Param [listen_only]!\n"); __WFD_CLIENT_FUNC_END__; return WIFI_DIRECT_ERROR_INVALID_PARAMETER; } @@ -4878,58 +4985,15 @@ int wifi_direct_get_primary_device_type(wifi_direct_primary_device_type_e* type) return WIFI_DIRECT_ERROR_NOT_INITIALIZED; } - - int result; - wifi_direct_config_data_s *config; - result = wifi_direct_get_config_data(&config); - if(result != WIFI_DIRECT_ERROR_NONE) - { - WFD_CLIENT_LOG(WFD_LOG_ERROR, "Failed to get wifi_direct_get_config_data() result=[%d]\n", result); - __WFD_CLIENT_FUNC_END__; - return WIFI_DIRECT_ERROR_OPERATION_FAILED; - } - - WFD_CLIENT_LOG(WFD_LOG_LOW, "Current primary_dev_type [%d]\n", config->primary_dev_type); - - *type = config->primary_dev_type; - - __WFD_CLIENT_FUNC_END__; - - return WIFI_DIRECT_ERROR_NONE; -} - - -int wifi_direct_get_config_data(wifi_direct_config_data_s ** config) -{ - wifi_direct_client_info_s *client_info = __wfd_get_control(); - - __WFD_CLIENT_FUNC_START__; - - if ((client_info->is_registered == false) - || (client_info->client_id == WFD_INVALID_ID)) - { - WFD_CLIENT_LOG(WFD_LOG_ERROR, "Client is NOT registered.\n"); - __WFD_CLIENT_FUNC_END__; - return WIFI_DIRECT_ERROR_NOT_INITIALIZED; - } - - if (config == NULL) - { - WFD_CLIENT_LOG(WFD_LOG_ERROR, "NULL Param [config]!\n"); - __WFD_CLIENT_FUNC_END__; - return WIFI_DIRECT_ERROR_INVALID_PARAMETER; - } - wifi_direct_client_request_s req; wifi_direct_client_response_s rsp; - wfd_config_data_s ls_config; int status = WIFI_DIRECT_ERROR_NONE; memset(&req, 0, sizeof(wifi_direct_client_request_s)); memset(&rsp, 0, sizeof(wifi_direct_client_response_s)); - req.cmd = WIFI_DIRECT_CMD_GET_CONFIG; + req.cmd = WIFI_DIRECT_CMD_IS_LISTENING_ONLY; req.client_id = client_info->client_id; status = @@ -4962,58 +5026,23 @@ int wifi_direct_get_config_data(wifi_direct_config_data_s ** config) } else { - if (rsp.cmd == WIFI_DIRECT_CMD_GET_CONFIG) + if (rsp.cmd == WIFI_DIRECT_CMD_IS_LISTENING_ONLY) { if (rsp.result != WIFI_DIRECT_ERROR_NONE) { - WFD_CLIENT_LOG(WFD_LOG_ERROR, - "Error!!! Result received = %d \n", rsp.result); - WFD_CLIENT_LOG(WFD_LOG_ERROR, "Error!!! [%s]\n", + WFD_CLIENT_LOG(WFD_LOG_LOW, "Error!!! Result received = %d \n", + rsp.result); + WFD_CLIENT_LOG(WFD_LOG_LOW, "Error!!! [%s]\n", __wfd_print_error(rsp.result)); __WFD_CLIENT_FUNC_END__; return rsp.result; } else { - int status = 0; - - WFD_CLIENT_LOG(WFD_LOG_LOW, "Link status = %d \n", - (int) rsp.param1); - - status = - __wfd_client_read_more_data(client_info->sync_sockfd, - &ls_config, - sizeof(wfd_config_data_s)); - if (status != WIFI_DIRECT_ERROR_NONE) - { - WFD_CLIENT_LOG(WFD_LOG_ERROR, "socket read error.\n"); - return WIFI_DIRECT_ERROR_OPERATION_FAILED; - } - - __wfd_client_print_config_data(&ls_config); - - wifi_direct_config_data_s *temp_config; - temp_config = - (wifi_direct_config_data_s *) calloc(1, - sizeof - (wifi_direct_config_data_s)); - - temp_config->ssid = strdup(ls_config.ssid); - temp_config->channel = ls_config.channel; - temp_config->wps_config = ls_config.wps_config; - temp_config->max_clients = ls_config.max_clients; - temp_config->hide_SSID = ls_config.hide_SSID; - temp_config->group_owner_intent = ls_config.group_owner_intent; - temp_config->want_persistent_group = - ls_config.want_persistent_group; - temp_config->auto_connection = ls_config.auto_connection; - temp_config->primary_dev_type = ls_config.primary_dev_type; - temp_config->secondary_dev_type = ls_config.secondary_dev_type; - - *config = temp_config; - WFD_CLIENT_LOG(WFD_LOG_LOW, - "wifi_direct_get_config_data() SUCCESS\n"); + "wifi_direct_is_listening_only() %s SUCCESS \n", + rsp.param2); + *listen_only = (bool) rsp.param1; } } else @@ -5027,16 +5056,23 @@ int wifi_direct_get_config_data(wifi_direct_config_data_s ** config) __WFD_CLIENT_FUNC_END__; return WIFI_DIRECT_ERROR_NONE; -} +} -int wifi_direct_set_config_data(wifi_direct_config_data_s * config) +int wifi_direct_get_primary_device_type(wifi_direct_primary_device_type_e* type) { wifi_direct_client_info_s *client_info = __wfd_get_control(); __WFD_CLIENT_FUNC_START__; + if (NULL == type) + { + WFD_CLIENT_LOG(WFD_LOG_ERROR, "NULL Param [type]!\n"); + __WFD_CLIENT_FUNC_END__; + return WIFI_DIRECT_ERROR_INVALID_PARAMETER; + } + if ((client_info->is_registered == false) || (client_info->client_id == WFD_INVALID_ID)) { @@ -5045,27 +5081,72 @@ int wifi_direct_set_config_data(wifi_direct_config_data_s * config) return WIFI_DIRECT_ERROR_NOT_INITIALIZED; } - if (config == NULL) + WFD_CLIENT_LOG(WFD_LOG_LOW, "Current primary_dev_type [%d]\n", WIFI_DIRECT_PRIMARY_DEVICE_TYPE_TELEPHONE); + + *type = WIFI_DIRECT_PRIMARY_DEVICE_TYPE_TELEPHONE; // Telephone + + __WFD_CLIENT_FUNC_END__; + + return WIFI_DIRECT_ERROR_NONE; +} + +int wifi_direct_get_secondary_device_type(wifi_direct_secondary_device_type_e* type) +{ + wifi_direct_client_info_s *client_info = __wfd_get_control(); + + __WFD_CLIENT_FUNC_START__; + + if (NULL == type) { - WFD_CLIENT_LOG(WFD_LOG_ERROR, "NULL Param [config]!\n"); + WFD_CLIENT_LOG(WFD_LOG_ERROR, "NULL Param [type]!\n"); __WFD_CLIENT_FUNC_END__; return WIFI_DIRECT_ERROR_INVALID_PARAMETER; } + if ((client_info->is_registered == false) + || (client_info->client_id == WFD_INVALID_ID)) + { + WFD_CLIENT_LOG(WFD_LOG_ERROR, "Client is NOT registered.\n"); + __WFD_CLIENT_FUNC_END__; + return WIFI_DIRECT_ERROR_NOT_INITIALIZED; + } + + + WFD_CLIENT_LOG(WFD_LOG_LOW, "Current second_dev_type [%d]\n", WIFI_DIRECT_SECONDARY_DEVICE_TYPE_PHONE_SM_DUAL); + + *type = WIFI_DIRECT_SECONDARY_DEVICE_TYPE_PHONE_SM_DUAL; // smart phone dual mode (wifi and cellular) + + __WFD_CLIENT_FUNC_END__; + + return WIFI_DIRECT_ERROR_NONE; +} + +int wifi_direct_set_autoconnection_mode(bool mode) +{ + wifi_direct_client_info_s *client_info = __wfd_get_control(); + + __WFD_CLIENT_FUNC_START__; + + if ((client_info->is_registered == false) + || (client_info->client_id == WFD_INVALID_ID)) + { + WFD_CLIENT_LOG(WFD_LOG_ERROR, "Client is NOT registered.\n"); + __WFD_CLIENT_FUNC_END__; + return WIFI_DIRECT_ERROR_NOT_INITIALIZED; + } + wifi_direct_client_request_s req; wifi_direct_client_response_s rsp; - wfd_config_data_s ls_config; int status = WIFI_DIRECT_ERROR_NONE; memset(&req, 0, sizeof(wifi_direct_client_request_s)); memset(&rsp, 0, sizeof(wifi_direct_client_response_s)); - req.cmd = WIFI_DIRECT_CMD_SET_CONFIG; + req.cmd = WIFI_DIRECT_CMD_SET_AUTOCONNECTION_MODE; req.client_id = client_info->client_id; - status = - __wfd_client_send_request(client_info->sync_sockfd, &req, + status =__wfd_client_send_request(client_info->sync_sockfd, &req, sizeof(wifi_direct_client_request_s)); if (status != WIFI_DIRECT_ERROR_NONE) { @@ -5082,23 +5163,9 @@ int wifi_direct_set_config_data(wifi_direct_config_data_s * config) WFD_CLIENT_LOG(WFD_LOG_LOW, "writing msg hdr is success!\n"); - - strncpy(ls_config.ssid, config->ssid, strlen(config->ssid)); - ls_config.channel = config->channel; - ls_config.wps_config = config->wps_config; - ls_config.max_clients = config->max_clients; - ls_config.hide_SSID = config->hide_SSID; - ls_config.group_owner_intent = config->group_owner_intent; - ls_config.want_persistent_group = config->want_persistent_group; - ls_config.auto_connection = config->auto_connection; - ls_config.primary_dev_type = config->primary_dev_type; - ls_config.secondary_dev_type = config->secondary_dev_type; - - __wfd_client_print_config_data(&ls_config); - status = - __wfd_client_send_request(client_info->sync_sockfd, &ls_config, - sizeof(wfd_config_data_s)); + __wfd_client_send_request(client_info->sync_sockfd, &mode, + sizeof(bool)); if (status != WIFI_DIRECT_ERROR_NONE) { WFD_CLIENT_LOG(WFD_LOG_ERROR, @@ -5126,7 +5193,7 @@ int wifi_direct_set_config_data(wifi_direct_config_data_s * config) } else { - if (rsp.cmd == WIFI_DIRECT_CMD_SET_CONFIG) + if (rsp.cmd == WIFI_DIRECT_CMD_SET_AUTOCONNECTION_MODE) { if (rsp.result != WIFI_DIRECT_ERROR_NONE) { @@ -5151,13 +5218,19 @@ int wifi_direct_set_config_data(wifi_direct_config_data_s * config) return WIFI_DIRECT_ERROR_NONE; } - -int wifi_direct_set_autoconnection_mode(bool mode) +int wifi_direct_is_autoconnection_mode(bool* mode) { wifi_direct_client_info_s *client_info = __wfd_get_control(); __WFD_CLIENT_FUNC_START__; + if (mode == NULL) + { + WFD_CLIENT_LOG(WFD_LOG_ERROR, "NULL Param [mode]!\n"); + __WFD_CLIENT_FUNC_END__; + return WIFI_DIRECT_ERROR_INVALID_PARAMETER; + } + if ((client_info->is_registered == false) || (client_info->client_id == WFD_INVALID_ID)) { @@ -5174,10 +5247,11 @@ int wifi_direct_set_autoconnection_mode(bool mode) memset(&req, 0, sizeof(wifi_direct_client_request_s)); memset(&rsp, 0, sizeof(wifi_direct_client_response_s)); - req.cmd = WIFI_DIRECT_CMD_SET_AUTOCONNECTION_MODE; + req.cmd = WIFI_DIRECT_CMD_IS_AUTOCONNECTION_MODE; req.client_id = client_info->client_id; - status =__wfd_client_send_request(client_info->sync_sockfd, &req, + status = + __wfd_client_send_request(client_info->sync_sockfd, &req, sizeof(wifi_direct_client_request_s)); if (status != WIFI_DIRECT_ERROR_NONE) { @@ -5192,12 +5266,84 @@ int wifi_direct_set_autoconnection_mode(bool mode) return WIFI_DIRECT_ERROR_COMMUNICATION_FAILED; } - WFD_CLIENT_LOG(WFD_LOG_LOW, "writing msg hdr is success!\n"); - - status = - __wfd_client_send_request(client_info->sync_sockfd, &mode, - sizeof(bool)); - if (status != WIFI_DIRECT_ERROR_NONE) + if ((status = + __wfd_client_read_socket(client_info->sync_sockfd, (char *) &rsp, + sizeof(wifi_direct_client_response_s))) <= 0) + { + WFD_CLIENT_LOG(WFD_LOG_ERROR, + "Error!!! reading socket, status = %d errno = %s\n", + status, strerror(errno)); + client_info->sync_sockfd = -1; + __wfd_reset_control(); + __WFD_CLIENT_FUNC_END__; + return WIFI_DIRECT_ERROR_COMMUNICATION_FAILED; + } + else + { + if (rsp.cmd == WIFI_DIRECT_CMD_IS_AUTOCONNECTION_MODE) + { + if (rsp.result != WIFI_DIRECT_ERROR_NONE) + { + WFD_CLIENT_LOG(WFD_LOG_LOW, "Error!!! Result received = %d \n", + rsp.result); + WFD_CLIENT_LOG(WFD_LOG_LOW, "Error!!! [%s]\n", + __wfd_print_error(rsp.result)); + __WFD_CLIENT_FUNC_END__; + return rsp.result; + } + else + { + WFD_CLIENT_LOG(WFD_LOG_LOW, + "wifi_direct_is_autoconnection_mode() %s SUCCESS \n", + rsp.param2); + *mode = (bool) rsp.param1; + } + } + else + { + WFD_CLIENT_LOG(WFD_LOG_ERROR, "Error!!! Invalid resp cmd = %d\n", + rsp.cmd); + return WIFI_DIRECT_ERROR_OPERATION_FAILED; + } + } + + __WFD_CLIENT_FUNC_END__; + + return WIFI_DIRECT_ERROR_NONE; + +} + + + +int wifi_direct_activate_persistent_group(void) +{ + wifi_direct_client_info_s *client_info = __wfd_get_control(); + + __WFD_CLIENT_FUNC_START__; + + if ((client_info->is_registered == false) + || (client_info->client_id == WFD_INVALID_ID)) + { + WFD_CLIENT_LOG(WFD_LOG_ERROR, "Client is NOT registered.\n"); + __WFD_CLIENT_FUNC_END__; + return WIFI_DIRECT_ERROR_NOT_INITIALIZED; + } + + wifi_direct_client_request_s req; + wifi_direct_client_response_s rsp; + + int status = WIFI_DIRECT_ERROR_NONE; + + memset(&req, 0, sizeof(wifi_direct_client_request_s)); + memset(&rsp, 0, sizeof(wifi_direct_client_response_s)); + + req.cmd = WIFI_DIRECT_CMD_ACTIVATE_PERSISTENT_GROUP; + req.client_id = client_info->client_id; + + status = + __wfd_client_send_request(client_info->sync_sockfd, &req, + sizeof(wifi_direct_client_request_s)); + if (status != WIFI_DIRECT_ERROR_NONE) { WFD_CLIENT_LOG(WFD_LOG_ERROR, "Error!!! writing to socket, Errno = %s\n", @@ -5224,7 +5370,92 @@ int wifi_direct_set_autoconnection_mode(bool mode) } else { - if (rsp.cmd == WIFI_DIRECT_CMD_SET_AUTOCONNECTION_MODE) + if (rsp.cmd == WIFI_DIRECT_CMD_ACTIVATE_PERSISTENT_GROUP) + { + if (rsp.result != WIFI_DIRECT_ERROR_NONE) + { + WFD_CLIENT_LOG(WFD_LOG_LOW, "Error!!! Result received = %d \n", + rsp.result); + WFD_CLIENT_LOG(WFD_LOG_LOW, "Error!!! [%s]\n", + __wfd_print_error(rsp.result)); + __WFD_CLIENT_FUNC_END__; + return rsp.result; + } + else + { + WFD_CLIENT_LOG(WFD_LOG_LOW, + "wifi_direct_activate_persistent_group() SUCCESS \n"); + } + } + else + { + WFD_CLIENT_LOG(WFD_LOG_ERROR, "Error!!! Invalid resp cmd = %d\n", + rsp.cmd); + return WIFI_DIRECT_ERROR_OPERATION_FAILED; + } + } + + __WFD_CLIENT_FUNC_END__; + + return WIFI_DIRECT_ERROR_NONE; +} + +int wifi_direct_deactivate_persistent_group(void) +{ + wifi_direct_client_info_s *client_info = __wfd_get_control(); + + __WFD_CLIENT_FUNC_START__; + + if ((client_info->is_registered == false) + || (client_info->client_id == WFD_INVALID_ID)) + { + WFD_CLIENT_LOG(WFD_LOG_ERROR, "Client is NOT registered.\n"); + __WFD_CLIENT_FUNC_END__; + return WIFI_DIRECT_ERROR_NOT_INITIALIZED; + } + + wifi_direct_client_request_s req; + wifi_direct_client_response_s rsp; + + int status = WIFI_DIRECT_ERROR_NONE; + + memset(&req, 0, sizeof(wifi_direct_client_request_s)); + memset(&rsp, 0, sizeof(wifi_direct_client_response_s)); + + req.cmd = WIFI_DIRECT_CMD_DEACTIVATE_PERSISTENT_GROUP; + req.client_id = client_info->client_id; + + status = + __wfd_client_send_request(client_info->sync_sockfd, &req, + sizeof(wifi_direct_client_request_s)); + if (status != WIFI_DIRECT_ERROR_NONE) + { + WFD_CLIENT_LOG(WFD_LOG_ERROR, + "Error!!! writing to socket, Errno = %s\n", + strerror(errno)); + WFD_CLIENT_LOG(WFD_LOG_ERROR, "Error!!! [%s]\n", + __wfd_print_error(status)); + client_info->sync_sockfd = -1; + __wfd_reset_control(); + __WFD_CLIENT_FUNC_END__; + return WIFI_DIRECT_ERROR_COMMUNICATION_FAILED; + } + + if ((status = + __wfd_client_read_socket(client_info->sync_sockfd, (char *) &rsp, + sizeof(wifi_direct_client_response_s))) <= 0) + { + WFD_CLIENT_LOG(WFD_LOG_ERROR, + "Error!!! reading socket, status = %d errno = %s\n", + status, strerror(errno)); + client_info->sync_sockfd = -1; + __wfd_reset_control(); + __WFD_CLIENT_FUNC_END__; + return WIFI_DIRECT_ERROR_COMMUNICATION_FAILED; + } + else + { + if (rsp.cmd == WIFI_DIRECT_CMD_DEACTIVATE_PERSISTENT_GROUP) { if (rsp.result != WIFI_DIRECT_ERROR_NONE) { @@ -5235,6 +5466,11 @@ int wifi_direct_set_autoconnection_mode(bool mode) __WFD_CLIENT_FUNC_END__; return rsp.result; } + else + { + WFD_CLIENT_LOG(WFD_LOG_LOW, + "wifi_direct_deactivate_persistent_group() SUCCESS \n"); + } } else { @@ -5249,7 +5485,367 @@ int wifi_direct_set_autoconnection_mode(bool mode) return WIFI_DIRECT_ERROR_NONE; } +int wifi_direct_is_persistent_group_activated(bool* activated) +{ + wifi_direct_client_info_s *client_info = __wfd_get_control(); + + __WFD_CLIENT_FUNC_START__; + + if (activated == NULL) + { + WFD_CLIENT_LOG(WFD_LOG_ERROR, "NULL Param [activated]!\n"); + __WFD_CLIENT_FUNC_END__; + return WIFI_DIRECT_ERROR_INVALID_PARAMETER; + } + + if ((client_info->is_registered == false) + || (client_info->client_id == WFD_INVALID_ID)) + { + WFD_CLIENT_LOG(WFD_LOG_ERROR, "Client is NOT registered.\n"); + __WFD_CLIENT_FUNC_END__; + return WIFI_DIRECT_ERROR_NOT_INITIALIZED; + } + + wifi_direct_client_request_s req; + wifi_direct_client_response_s rsp; + + int status = WIFI_DIRECT_ERROR_NONE; + + memset(&req, 0, sizeof(wifi_direct_client_request_s)); + memset(&rsp, 0, sizeof(wifi_direct_client_response_s)); + + req.cmd = WIFI_DIRECT_CMD_IS_PERSISTENT_GROUP; + req.client_id = client_info->client_id; + + status = + __wfd_client_send_request(client_info->sync_sockfd, &req, + sizeof(wifi_direct_client_request_s)); + if (status != WIFI_DIRECT_ERROR_NONE) + { + WFD_CLIENT_LOG(WFD_LOG_ERROR, + "Error!!! writing to socket, Errno = %s\n", + strerror(errno)); + WFD_CLIENT_LOG(WFD_LOG_ERROR, "Error!!! [%s]\n", + __wfd_print_error(status)); + client_info->sync_sockfd = -1; + __wfd_reset_control(); + __WFD_CLIENT_FUNC_END__; + return WIFI_DIRECT_ERROR_COMMUNICATION_FAILED; + } + + if ((status = + __wfd_client_read_socket(client_info->sync_sockfd, (char *) &rsp, + sizeof(wifi_direct_client_response_s))) <= 0) + { + WFD_CLIENT_LOG(WFD_LOG_ERROR, + "Error!!! reading socket, status = %d errno = %s\n", + status, strerror(errno)); + client_info->sync_sockfd = -1; + __wfd_reset_control(); + __WFD_CLIENT_FUNC_END__; + return WIFI_DIRECT_ERROR_COMMUNICATION_FAILED; + } + else + { + if (rsp.cmd == WIFI_DIRECT_CMD_IS_PERSISTENT_GROUP) + { + if (rsp.result != WIFI_DIRECT_ERROR_NONE) + { + WFD_CLIENT_LOG(WFD_LOG_LOW, "Error!!! Result received = %d \n", + rsp.result); + WFD_CLIENT_LOG(WFD_LOG_LOW, "Error!!! [%s]\n", + __wfd_print_error(rsp.result)); + __WFD_CLIENT_FUNC_END__; + return rsp.result; + } + else + { + WFD_CLIENT_LOG(WFD_LOG_LOW, + "wifi_direct_is_persistent_group_activated() %s SUCCESS \n", + rsp.param2); + *activated = (bool) rsp.param1; + } + } + else + { + WFD_CLIENT_LOG(WFD_LOG_ERROR, "Error!!! Invalid resp cmd = %d\n", + rsp.cmd); + return WIFI_DIRECT_ERROR_OPERATION_FAILED; + } + } + + __WFD_CLIENT_FUNC_END__; + return WIFI_DIRECT_ERROR_NONE; +} + + +int wifi_direct_foreach_persistent_groups(wifi_direct_persistent_group_cb callback, void* user_data) +{ + wifi_direct_client_info_s *client_info = __wfd_get_control(); + + __WFD_CLIENT_FUNC_START__; + + if ((client_info->is_registered == false) + || (client_info->client_id == WFD_INVALID_ID)) + { + WFD_CLIENT_LOG(WFD_LOG_ERROR, "Client is NOT registered.\n"); + __WFD_CLIENT_FUNC_END__; + return WIFI_DIRECT_ERROR_NOT_INITIALIZED; + } + + if (callback == NULL) + { + WFD_CLIENT_LOG(WFD_LOG_ERROR, "NULL Param [callback]!\n"); + __WFD_CLIENT_FUNC_END__; + return WIFI_DIRECT_ERROR_INVALID_PARAMETER; + } + + wifi_direct_client_request_s req; + wifi_direct_client_response_s rsp; + int i; + + int status = WIFI_DIRECT_ERROR_NONE; + + memset(&req, 0, sizeof(wifi_direct_client_request_s)); + memset(&rsp, 0, sizeof(wifi_direct_client_response_s)); + + req.cmd = WIFI_DIRECT_CMD_GET_PERSISTENT_GROUP_INFO; + req.client_id = client_info->client_id; + + status = + __wfd_client_send_request(client_info->sync_sockfd, &req, + sizeof(wifi_direct_client_request_s)); + if (status != WIFI_DIRECT_ERROR_NONE) + { + WFD_CLIENT_LOG(WFD_LOG_ERROR, + "Error!!! writing to socket, Errno = %s\n", + strerror(errno)); + WFD_CLIENT_LOG(WFD_LOG_ERROR, "Error!!! [%s]\n", + __wfd_print_error(status)); + client_info->sync_sockfd = -1; + __wfd_reset_control(); + __WFD_CLIENT_FUNC_END__; + return WIFI_DIRECT_ERROR_COMMUNICATION_FAILED; + } + + if ((status = + __wfd_client_read_socket(client_info->sync_sockfd, (char *) &rsp, + sizeof(wifi_direct_client_response_s))) <= 0) + { + WFD_CLIENT_LOG(WFD_LOG_ERROR, + "Error!!! reading socket, status = %d errno = %s\n", + status, strerror(errno)); + client_info->sync_sockfd = -1; + __wfd_reset_control(); + __WFD_CLIENT_FUNC_END__; + return WIFI_DIRECT_ERROR_COMMUNICATION_FAILED; + } + else + { + if (rsp.cmd == WIFI_DIRECT_CMD_GET_PERSISTENT_GROUP_INFO) + { + if (rsp.result != WIFI_DIRECT_ERROR_NONE) + { + WFD_CLIENT_LOG(WFD_LOG_ERROR, + "Error!!! Result received = %d \n", rsp.result); + WFD_CLIENT_LOG(WFD_LOG_ERROR, "Error!!! [%s]\n", + __wfd_print_error(rsp.result)); + __WFD_CLIENT_FUNC_END__; + return rsp.result; + } + else + { + + int num = rsp.param1; + int status = 0; + wfd_persistent_group_info_s *buff = NULL; + + WFD_CLIENT_LOG(WFD_LOG_LOW, "Num of persistent groups = %d \n", (int) rsp.param1); + + if (num > 0) + { + buff = (wfd_persistent_group_info_s *) malloc(num * sizeof(wfd_persistent_group_info_s)); + if (buff == NULL) + { + WFD_CLIENT_LOG(WFD_LOG_ERROR, "malloc() failed!!!.\n"); + return WIFI_DIRECT_ERROR_OPERATION_FAILED; + } + + status = + __wfd_client_read_more_data(client_info->sync_sockfd, + buff, + num * + sizeof + (wfd_persistent_group_info_s)); + if (status != WIFI_DIRECT_ERROR_NONE) + { + if (NULL != buff) + free(buff); + WFD_CLIENT_LOG(WFD_LOG_ERROR, "socket read error.\n"); + return WIFI_DIRECT_ERROR_OPERATION_FAILED; + } + } + + __wfd_client_print_persistent_group_info(buff, num); + + WFD_CLIENT_LOG(WFD_LOG_LOW, "wifi_direct_foreach_persistent_groups() SUCCESS\n"); + + char* ssid; + char* go_mac_address; + + for (i = 0; i < num; i++) + { + ssid = strdup(buff[i].ssid); + go_mac_address = (char *) calloc(1, 18); + snprintf(go_mac_address, 18, MACSTR, MAC2STR(buff[i].go_mac_address)); + + if (!callback(go_mac_address, ssid, user_data)) + break; + } + + if (NULL != buff) + free(buff); + + } + } + else + { + WFD_CLIENT_LOG(WFD_LOG_ERROR, "Error!!! Invalid resp cmd = %d\n", + rsp.cmd); + return WIFI_DIRECT_ERROR_OPERATION_FAILED; + } + } + + __WFD_CLIENT_FUNC_END__; + + return WIFI_DIRECT_ERROR_NONE; +} + +int wifi_direct_remove_persistent_group(const char* mac_address, const char* ssid) +{ + __WFD_CLIENT_FUNC_START__; + + wifi_direct_client_info_s *client_info = __wfd_get_control(); + + if ((client_info->is_registered == false) + || (client_info->client_id == WFD_INVALID_ID)) + { + WFD_CLIENT_LOG(WFD_LOG_ERROR, "Client is NOT registered.\n"); + __WFD_CLIENT_FUNC_END__; + return WIFI_DIRECT_ERROR_NOT_INITIALIZED; + } + + if ( NULL== mac_address ) + { + WFD_CLIENT_LOG(WFD_LOG_ERROR, "NULL Param [mac_address]!\n"); + __WFD_CLIENT_FUNC_END__; + return WIFI_DIRECT_ERROR_INVALID_PARAMETER; + } + + if ( NULL== ssid ) + { + WFD_CLIENT_LOG(WFD_LOG_ERROR, "NULL Param [ssid]!\n"); + __WFD_CLIENT_FUNC_END__; + return WIFI_DIRECT_ERROR_INVALID_PARAMETER; + } + + wifi_direct_client_request_s req; + wifi_direct_client_response_s rsp; + wfd_persistent_group_info_s persistent_group_info; + unsigned char la_mac_addr[6]; + + int status = WIFI_DIRECT_ERROR_NONE; + + memset(&req, 0, sizeof(wifi_direct_client_request_s)); + memset(&rsp, 0, sizeof(wifi_direct_client_response_s)); + + req.cmd = WIFI_DIRECT_CMD_REMOVE_PERSISTENT_GROUP; + req.client_id = client_info->client_id; + + status = + __wfd_client_send_request(client_info->sync_sockfd, &req, + sizeof(wifi_direct_client_request_s)); + if (status != WIFI_DIRECT_ERROR_NONE) + { + WFD_CLIENT_LOG(WFD_LOG_ERROR, + "Error!!! writing to socket, Errno = %s\n", + strerror(errno)); + WFD_CLIENT_LOG(WFD_LOG_ERROR, "Error!!! [%s]\n", + __wfd_print_error(status)); + client_info->sync_sockfd = -1; + __wfd_reset_control(); + __WFD_CLIENT_FUNC_END__; + return WIFI_DIRECT_ERROR_COMMUNICATION_FAILED; + } + + WFD_CLIENT_LOG(WFD_LOG_LOW, "writing msg hdr is success!\n"); + + strncpy(persistent_group_info.ssid, ssid, strlen(ssid)); + + memset(la_mac_addr, 0, sizeof(la_mac_addr)); + macaddr_atoe(mac_address, la_mac_addr); + persistent_group_info.go_mac_address[0] = la_mac_addr[0]; + persistent_group_info.go_mac_address[1] = la_mac_addr[1]; + persistent_group_info.go_mac_address[2] = la_mac_addr[2]; + persistent_group_info.go_mac_address[3] = la_mac_addr[3]; + persistent_group_info.go_mac_address[4] = la_mac_addr[4]; + persistent_group_info.go_mac_address[5] = la_mac_addr[5]; + + status = + __wfd_client_send_request(client_info->sync_sockfd, &persistent_group_info, + sizeof(wfd_persistent_group_info_s)); + if (status != WIFI_DIRECT_ERROR_NONE) + { + WFD_CLIENT_LOG(WFD_LOG_ERROR, + "Error!!! writing to socket, Errno = %s\n", + strerror(errno)); + WFD_CLIENT_LOG(WFD_LOG_ERROR, "Error!!! [%s]\n", + __wfd_print_error(status)); + client_info->sync_sockfd = -1; + __wfd_reset_control(); + __WFD_CLIENT_FUNC_END__; + return WIFI_DIRECT_ERROR_COMMUNICATION_FAILED; + } + + if ((status = + __wfd_client_read_socket(client_info->sync_sockfd, (char *) &rsp, + sizeof(wifi_direct_client_response_s))) <= 0) + { + WFD_CLIENT_LOG(WFD_LOG_ERROR, + "Error!!! reading socket, status = %d errno = %s\n", + status, strerror(errno)); + client_info->sync_sockfd = -1; + __wfd_reset_control(); + __WFD_CLIENT_FUNC_END__; + return WIFI_DIRECT_ERROR_COMMUNICATION_FAILED; + } + else + { + if (rsp.cmd == WIFI_DIRECT_CMD_REMOVE_PERSISTENT_GROUP) + { + if (rsp.result != WIFI_DIRECT_ERROR_NONE) + { + WFD_CLIENT_LOG(WFD_LOG_LOW, "Error!!! Result received = %d \n", + rsp.result); + WFD_CLIENT_LOG(WFD_LOG_LOW, "Error!!! [%s]\n", + __wfd_print_error(rsp.result)); + __WFD_CLIENT_FUNC_END__; + return rsp.result; + } + } + else + { + WFD_CLIENT_LOG(WFD_LOG_ERROR, "Error!!! Invalid resp cmd = %d\n", + rsp.cmd); + return WIFI_DIRECT_ERROR_OPERATION_FAILED; + } + } + + __WFD_CLIENT_FUNC_END__; + + return WIFI_DIRECT_ERROR_NONE; +} int wifi_direct_set_p2poem_loglevel(int increase_log_level) {