From 16b11f8741a559e5e798c0ebf027f95f909764fb Mon Sep 17 00:00:00 2001 From: HyungKyu Song Date: Thu, 14 Feb 2013 21:43:48 +0900 Subject: [PATCH] Tizen 2.0 Release --- CMakeLists.txt | 70 ++ capi-network-wifi-direct.manifest | 5 + capi-network-wifi-direct.pc.in | 14 + debian/README | 0 debian/capi-network-wifi-direct-dev.install | 4 + debian/capi-network-wifi-direct-dev.postinst | 1 + debian/capi-network-wifi-direct.postinst | 1 + debian/changelog | 88 ++ debian/compat | 1 + debian/control | 21 + debian/rules | 64 ++ include/wifi-direct.h | 1120 ++++++++++++++++++++++++++ packaging/capi-network-wifi-direct.spec | 50 ++ 13 files changed, 1439 insertions(+) create mode 100755 CMakeLists.txt create mode 100644 capi-network-wifi-direct.manifest create mode 100755 capi-network-wifi-direct.pc.in create mode 100644 debian/README create mode 100644 debian/capi-network-wifi-direct-dev.install create mode 100644 debian/capi-network-wifi-direct-dev.postinst create mode 100644 debian/capi-network-wifi-direct.postinst create mode 100644 debian/changelog create mode 100644 debian/compat create mode 100755 debian/control create mode 100755 debian/rules create mode 100644 include/wifi-direct.h create mode 100755 packaging/capi-network-wifi-direct.spec diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100755 index 0000000..7e39e81 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,70 @@ +CMAKE_MINIMUM_REQUIRED(VERSION 2.6) +SET(fw_name "capi-network-wifi-direct") + +PROJECT(${fw_name}) + +SET(CMAKE_INSTALL_PREFIX /usr) +SET(PREFIX ${CMAKE_INSTALL_PREFIX}) + +SET(INC_DIR include) +INCLUDE_DIRECTORIES(${INC_DIR}) + +SET(dependents "capi-base-common") +SET(pc_dependents "capi-base-common") + +INCLUDE(FindPkgConfig) +pkg_check_modules(${fw_name} REQUIRED ${dependents}) + +IF("${ARCH}" STREQUAL "arm") + ADD_DEFINITIONS("-DTARGET") +ENDIF("${ARCH}" STREQUAL "arm") + +INSTALL( + DIRECTORY ${INC_DIR}/ DESTINATION include/network + FILES_MATCHING + PATTERN "*_private.h" EXCLUDE + PATTERN "${INC_DIR}/*.h" + ) + +SET(PC_NAME ${fw_name}) +SET(PC_REQUIRED ${pc_dependents}) +SET(PC_LDFLAGS -lwifi-direct) + +CONFIGURE_FILE( + ${fw_name}.pc.in + ${CMAKE_CURRENT_SOURCE_DIR}/${fw_name}.pc + @ONLY +) +INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${fw_name}.pc DESTINATION lib/pkgconfig) + +IF(UNIX) + +ADD_CUSTOM_TARGET (distclean @echo cleaning for source distribution) +ADD_CUSTOM_COMMAND( + DEPENDS clean + COMMENT "distribution clean" + COMMAND find + ARGS . + -not -name config.cmake -and \( + -name tester.c -or + -name Testing -or + -name CMakeFiles -or + -name cmake.depends -or + -name cmake.check_depends -or + -name CMakeCache.txt -or + -name cmake.check_cache -or + -name *.cmake -or + -name Makefile -or + -name core -or + -name core.* -or + -name gmon.out -or + -name install_manifest.txt -or + -name *.pc -or + -name *~ \) + | grep -v TC | xargs rm -rf + TARGET distclean + VERBATIM +) + +ENDIF(UNIX) + diff --git a/capi-network-wifi-direct.manifest b/capi-network-wifi-direct.manifest new file mode 100644 index 0000000..97e8c31 --- /dev/null +++ b/capi-network-wifi-direct.manifest @@ -0,0 +1,5 @@ + + + + + diff --git a/capi-network-wifi-direct.pc.in b/capi-network-wifi-direct.pc.in new file mode 100755 index 0000000..097a2d1 --- /dev/null +++ b/capi-network-wifi-direct.pc.in @@ -0,0 +1,14 @@ +# Package Information for pkg-config + +prefix=@PREFIX@ +exec_prefix=/usr +libdir=/usr/lib +includedir=/usr/include/network + +Name: @PC_NAME@ +Description: @PACKAGE_DESCRIPTION@ +Version: @VERSION@ +Requires: @PC_REQUIRED@ +Libs: -L${libdir} @PC_LDFLAGS@ +Cflags: -I${includedir} + diff --git a/debian/README b/debian/README new file mode 100644 index 0000000..e69de29 diff --git a/debian/capi-network-wifi-direct-dev.install b/debian/capi-network-wifi-direct-dev.install new file mode 100644 index 0000000..761a28b --- /dev/null +++ b/debian/capi-network-wifi-direct-dev.install @@ -0,0 +1,4 @@ +/usr/include/* +/usr/include/*/* +/usr/lib/pkgconfig/*.pc + diff --git a/debian/capi-network-wifi-direct-dev.postinst b/debian/capi-network-wifi-direct-dev.postinst new file mode 100644 index 0000000..1a24852 --- /dev/null +++ b/debian/capi-network-wifi-direct-dev.postinst @@ -0,0 +1 @@ +#!/bin/sh diff --git a/debian/capi-network-wifi-direct.postinst b/debian/capi-network-wifi-direct.postinst new file mode 100644 index 0000000..1a24852 --- /dev/null +++ b/debian/capi-network-wifi-direct.postinst @@ -0,0 +1 @@ +#!/bin/sh diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000..bdc8b3a --- /dev/null +++ b/debian/changelog @@ -0,0 +1,88 @@ +capi-network-wifi-direct (0.0.4-3) unstable; urgency=low + + * Implementation of wifi_direct_get_device_name / wifi_direct_set_device_name + * Implementation of persistent mode + * Git: framework/api/wifi-direct + * Tag: capi-network-wifi-direct_0.0.4-3 + + -- Gibyoung Kim Tue, 11 Dec 2012 17:56:12 +0900 + +capi-network-wifi-direct (0.0.4-2) unstable; urgency=low + + * Update from private + * Git: framework/api/wifi-direct + * Tag: capi-network-wifi-direct_0.0.4-2 + + -- Gibyoung Kim Fri, 23 Nov 2012 17:32:45 +0900 + +capi-network-wifi-direct (0.0.4-1) unstable; urgency=low + + * Applied SMACK manifest + * Git: framework/api/wifi-direct + * Tag: capi-network-wifi-direct_0.0.4-1 + + -- Sungsik Jang Fri, 21 Sep 2012 13:26:57 +0900 + +capi-network-wifi-direct (0.0.3-1) unstable; urgency=low + + * tagging "tizen_build" + * Git: slp-source.sec.samsung.net:slp/framework/api/wifi-direct + * Tag: tizen_build + + -- Sungsik Jang Mon, 13 Aug 2012 15:49:40 +0900 + +capi-network-wifi-direct (0.0.3-1) unstable; urgency=low + + * added new CAPIs for OSP + * Git: slp-source.sec.samsung.net:slp/api/wifi-direct + * Tag: capi-network-wifi-direct_0.0.3-1 + + -- Sungsik Jang Fri, 01 Jun 2012 16:58:40 +0900 + +capi-network-wifi-direct (0.0.2-1) unstable; urgency=low + + * added new CAPI for bada + * Git: slp-source.sec.samsung.net:slp/api/wifi-direct + * Tag: capi-network-wifi-direct_0.0.2-1 + + -- Sungsik Jang Wed, 09 May 2012 13:55:22 +0900 + +capi-network-wifi-direct (0.0.1-5) unstable; urgency=low + + * Remove dependent package of pc + * Git: slp-source.sec.samsung.net:slp/api/wifi-direct + * Tag: capi-network-wifi-direct_0.0.1-5 + + -- ByungWoo Lee Thu, 03 May 2012 19:17:00 +0900 + +capi-network-wifi-direct (0.0.1-4) unstable; urgency=low + + * Add dependent package of dev package + * Git: slp-source.sec.samsung.net:slp/api/wifi-direct + * Tag: capi-network-wifi-direct_0.0.1-4 + + -- ByungWoo Lee Fri, 30 Mar 2012 11:31:10 +0900 + +capi-network-wifi-direct (0.0.1-3) unstable; urgency=low + + * Modified build script for dependent package + * Git: slp-source.sec.samsung.net:slp/api/wifi-direct + * Tag: capi-network-wifi-direct_0.0.1-3 + + -- Sungsik Jang Wed, 21 Mar 2012 17:09:14 +0900 + +capi-network-wifi-direct (0.0.1-2) unstable; urgency=low + + * Modified build script for dependent package + * Git: slp-source.sec.samsung.net:slp/api/wifi-direct + * Tag: capi-network-wifi-direct_0.0.1-2 + + -- Sungsik Jang Tue, 20 Mar 2012 14:36:49 +0900 + +capi-network-wifi-direct (0.0.1-1) unstable; urgency=low + + * Initial upload : WiFi-Direct API + * Git: slp-source.sec.samsung.net:slp/api/wifi-direct + * Tag: capi-network-wifi-direct_0.0.1-1 + + -- Sungsik Jang Fri, 17 Feb 2012 16:33:16 +0900 diff --git a/debian/compat b/debian/compat new file mode 100644 index 0000000..7ed6ff8 --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +5 diff --git a/debian/control b/debian/control new file mode 100755 index 0000000..ad4ce47 --- /dev/null +++ b/debian/control @@ -0,0 +1,21 @@ +Source: capi-network-wifi-direct +Section: libs +Priority: extra +Maintainer: Dongwook Lee , Sungsik Jang +Build-Depends: debhelper (>= 5), capi-base-common-dev + +Package: capi-network-wifi-direct +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends}, libwifi-direct +Description: A Network WiFi-Direct Library in Tizen C API + +Package: capi-network-wifi-direct-dev +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends}, capi-network-wifi-direct (= ${Source-Version}), capi-base-common-dev +Description: A Network WiFi-Direct Library in Tizen C API (DEV) + +Package: capi-network-wifi-direct-dbg +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends}, capi-network-wifi-direct (= ${Source-Version}) +Description: A Network WiFi-Direct Library in Tizen C API (DBG) + diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..af6171e --- /dev/null +++ b/debian/rules @@ -0,0 +1,64 @@ +#!/usr/bin/make -f + +CFLAGS = -Wall -g + +ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) + CFLAGS += -O0 +else + CFLAGS += -O2 +endif +CMAKE_ROOT_DIR ?= $(CURDIR) +CMAKE_BUILD_DIR ?= $(CURDIR)/cmake_build_tmp + +configure: configure-stamp +configure-stamp: + dh_testdir + mkdir -p $(CMAKE_BUILD_DIR) && cd $(CMAKE_BUILD_DIR) && cmake .. + touch configure-stamp + + +build: build-stamp +build-stamp: configure-stamp + dh_testdir + cd $(CMAKE_BUILD_DIR) && $(MAKE) + touch $@ + +clean: + cd $(CMAKE_ROOT_DIR) + dh_testdir + dh_testroot + rm -f build-stamp configure-stamp + rm -f `find . -name *.pc` + rm -rf $(CMAKE_BUILD_DIR) + dh_clean + +install: build + dh_testdir + dh_testroot + dh_clean -k + dh_installdirs + + cd $(CMAKE_BUILD_DIR) && $(MAKE) DESTDIR=$(CURDIR)/debian/tmp install + +binary-indep: build install + +binary-arch: build install + dh_testdir + dh_testroot + dh_installchangelogs + dh_installdocs + dh_installexamples + dh_install --sourcedir=debian/tmp + dh_installman + dh_link + dh_fixperms + dh_makeshlibs + dh_installdeb + dh_shlibdeps + dh_gencontrol + dh_md5sums + dh_builddeb + +binary: binary-indep binary-arch +.PHONY: build clean binary-indep binary-arch binary install configure + diff --git a/include/wifi-direct.h b/include/wifi-direct.h new file mode 100644 index 0000000..ca578f4 --- /dev/null +++ b/include/wifi-direct.h @@ -0,0 +1,1120 @@ +/* +* Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +#ifndef __TIZEN_NET_WIFI_DIRECT_H__ +#define __TIZEN_NET_WIFI_DIRECT_H__ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + + +/** + * @addtogroup CAPI_NET_WIFI_DIRECT_MODULE + * @{ + */ + +/** + * @brief Enumeration for Wi-Fi Direct error code + */ +typedef enum +{ + WIFI_DIRECT_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */ + WIFI_DIRECT_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of memory */ + WIFI_DIRECT_ERROR_NOT_PERMITTED = TIZEN_ERROR_NOT_PERMITTED, /**< Operation not permitted */ + WIFI_DIRECT_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid function parameter */ + WIFI_DIRECT_ERROR_RESOURCE_BUSY = TIZEN_ERROR_RESOURCE_BUSY, /**< Device or resource busy */ + WIFI_DIRECT_ERROR_CONNECTION_TIME_OUT = TIZEN_ERROR_CONNECTION_TIME_OUT, /**< Connection timed out */ + WIFI_DIRECT_ERROR_NOT_INITIALIZED = TIZEN_ERROR_NETWORK_CLASS|0x0201, /**< Not initialized */ + WIFI_DIRECT_ERROR_COMMUNICATION_FAILED = TIZEN_ERROR_NETWORK_CLASS|0x0202, /**< I/O error */ + WIFI_DIRECT_ERROR_WIFI_USED = TIZEN_ERROR_NETWORK_CLASS|0x0203, /**< WiFi is being used */ + WIFI_DIRECT_ERROR_MOBILE_AP_USED = TIZEN_ERROR_NETWORK_CLASS|0x0204, /**< Mobile AP is being used */ + WIFI_DIRECT_ERROR_CONNECTION_FAILED = TIZEN_ERROR_NETWORK_CLASS|0x0205, /**< Connection failed */ + WIFI_DIRECT_ERROR_AUTH_FAILED = TIZEN_ERROR_NETWORK_CLASS|0x0206, /**< Authentication failed */ + WIFI_DIRECT_ERROR_OPERATION_FAILED = TIZEN_ERROR_NETWORK_CLASS|0x0207, /**< Operation failed */ + WIFI_DIRECT_ERROR_TOO_MANY_CLIENT = TIZEN_ERROR_NETWORK_CLASS|0x0208, /**< Too many client */ +} wifi_direct_error_e; + +/** + * @brief Enumeration for Wi-Fi Direct link status + */ +typedef enum { + WIFI_DIRECT_STATE_DEACTIVATED = 0, /**< Deactivated */ + WIFI_DIRECT_STATE_DEACTIVATING, /**< Deactivating */ + WIFI_DIRECT_STATE_ACTIVATING, /**< Activating */ + WIFI_DIRECT_STATE_ACTIVATED, /**< Activated */ + WIFI_DIRECT_STATE_DISCOVERING, /**< Discovering */ + WIFI_DIRECT_STATE_CONNECTING, /**< Connecting */ + WIFI_DIRECT_STATE_DISCONNECTING, /**< Disconnecting */ + WIFI_DIRECT_STATE_CONNECTED, /**< Connected */ +} wifi_direct_state_e; + +/** + * @brief Enumeration for Wi-Fi Direct device state + */ +typedef enum { + WIFI_DIRECT_DEVICE_STATE_ACTIVATED, /**< Activated */ + WIFI_DIRECT_DEVICE_STATE_DEACTIVATED, /**< Deactivated */ +} wifi_direct_device_state_e; + +/** + * @brief Enumeration for Wi-Fi Direct discovery state + */ +typedef enum { + WIFI_DIRECT_ONLY_LISTEN_STARTED, /**< Only listen started */ + WIFI_DIRECT_DISCOVERY_STARTED, /**< Discovery started */ + WIFI_DIRECT_DISCOVERY_FOUND, /**< A remote peer is found */ + WIFI_DIRECT_DISCOVERY_FINISHED, /**< Discovery finished */ +} wifi_direct_discovery_state_e; + +/** + * @brief Enumeration for Wi-Fi Direct connection state + */ +typedef enum { + WIFI_DIRECT_CONNECTION_REQ, /**< Connection is requested */ + WIFI_DIRECT_CONNECTION_WPS_REQ, /**< WPS is requested */ + WIFI_DIRECT_CONNECTION_IN_PROGRESS, /**< Connection in progress */ + WIFI_DIRECT_CONNECTION_RSP, /**< Connected */ + WIFI_DIRECT_DISASSOCIATION_IND, /**< Disconnected by remote Group Client */ + WIFI_DIRECT_DISCONNECTION_RSP, /**< Disconnected by local device */ + WIFI_DIRECT_DISCONNECTION_IND, /**< Disconnected by remote Group Owner */ + WIFI_DIRECT_GROUP_CREATED, /**< Group is created */ + WIFI_DIRECT_GROUP_DESTROYED, /**< Group is destroyed */ +} wifi_direct_connection_state_e; + +/** + * @brief Enumeration for Wi-Fi Direct secondary device type + */ +typedef enum { + WIFI_DIRECT_SECONDARY_DEVICE_TYPE_COMPUTER_PC = 1, /**< PC */ + WIFI_DIRECT_SECONDARY_DEVICE_TYPE_COMPUTER_SERVER = 2, /**< Server */ + WIFI_DIRECT_SECONDARY_DEVICE_TYPE_COMPUTER_MEDIA_CENTER = 3, /**< Media Center */ + WIFI_DIRECT_SECONDARY_DEVICE_TYPE_COMPUTER_UMPC = 4, /**< UMPC */ + WIFI_DIRECT_SECONDARY_DEVICE_TYPE_COMPUTER_NOTEBOOK = 5, /**< Notebook */ + WIFI_DIRECT_SECONDARY_DEVICE_TYPE_COMPUTER_DESKTOP = 6, /**< Desktop */ + WIFI_DIRECT_SECONDARY_DEVICE_TYPE_COMPUTER_MID = 7, /**< MID */ + WIFI_DIRECT_SECONDARY_DEVICE_TYPE_COMPUTER_NETBOOK = 8, /**< Netbook */ + WIFI_DIRECT_SECONDARY_DEVICE_TYPE_INPUT_KEYBOARD = 1, /**< Keyboard */ + WIFI_DIRECT_SECONDARY_DEVICE_TYPE_INPUT_MOUSE = 2, /**< Mouse */ + WIFI_DIRECT_SECONDARY_DEVICE_TYPE_INPUT_JOYSTICK = 3, /**< Joystick */ + WIFI_DIRECT_SECONDARY_DEVICE_TYPE_INPUT_TRACKBALL = 4, /**< Trackball */ + WIFI_DIRECT_SECONDARY_DEVICE_TYPE_INPUT_CONTROLLER = 5, /**< Controller */ + WIFI_DIRECT_SECONDARY_DEVICE_TYPE_INPUT_REMOTE = 6, /**< Remote */ + WIFI_DIRECT_SECONDARY_DEVICE_TYPE_INPUT_TOUCHSCREEN = 7, /**< Touchscreen */ + WIFI_DIRECT_SECONDARY_DEVICE_TYPE_INPUT_BIOMETRIC_READER = 8, /**< Biometric reader */ + WIFI_DIRECT_SECONDARY_DEVICE_TYPE_INPUT_BARCODE_READER = 9, /**< Barcode reader */ + WIFI_DIRECT_SECONDARY_DEVICE_TYPE_PRINTER_PRINTER = 1, /**< Printer */ + WIFI_DIRECT_SECONDARY_DEVICE_TYPE_PRINTER_SCANNER = 2, /**< Scanner */ + WIFI_DIRECT_SECONDARY_DEVICE_TYPE_PRINTER_FAX = 3, /**< Fax */ + WIFI_DIRECT_SECONDARY_DEVICE_TYPE_PRINTER_COPIER = 4, /**< Copier */ + WIFI_DIRECT_SECONDARY_DEVICE_TYPE_PRINTER_ALL_IN_ONE = 5, /**< All-in-one */ + WIFI_DIRECT_SECONDARY_DEVICE_TYPE_CAMERA_DIGITAL_STILL = 1, /**< Digital still camera */ + WIFI_DIRECT_SECONDARY_DEVICE_TYPE_CAMERA_VIDEO = 2, /**< Video camera */ + WIFI_DIRECT_SECONDARY_DEVICE_TYPE_CAMERA_WEBCAM = 3, /**< Webcam */ + WIFI_DIRECT_SECONDARY_DEVICE_TYPE_CAMERA_SECURITY = 4, /**< Security camera */ + WIFI_DIRECT_SECONDARY_DEVICE_TYPE_STORAGE_NAS = 1, /**< NAS */ + WIFI_DIRECT_SECONDARY_DEVICE_TYPE_NETWORK_INFRA_AP = 1, /**< AP */ + WIFI_DIRECT_SECONDARY_DEVICE_TYPE_NETWORK_INFRA_ROUTER = 2, /**< Router */ + WIFI_DIRECT_SECONDARY_DEVICE_TYPE_NETWORK_INFRA_SWITCH = 3, /**< Switch */ + WIFI_DIRECT_SECONDARY_DEVICE_TYPE_NETWORK_INFRA_GATEWAY = 4, /**< Gateway */ + WIFI_DIRECT_SECONDARY_DEVICE_TYPE_DISPLAY_TV = 1, /**< TV */ + WIFI_DIRECT_SECONDARY_DEVICE_TYPE_DISPLAY_PIC_FRAME = 2, /**< Picture frame */ + WIFI_DIRECT_SECONDARY_DEVICE_TYPE_DISPLAY_PROJECTOR = 3, /**< Projector */ + WIFI_DIRECT_SECONDARY_DEVICE_TYPE_DISPLAY_MONITOR = 4, /**< Monitor */ + WIFI_DIRECT_SECONDARY_DEVICE_TYPE_MULTIMEDIA_DAR = 1, /**< DAR */ + WIFI_DIRECT_SECONDARY_DEVICE_TYPE_MULTIMEDIA_PVR = 2, /**< PVR */ + WIFI_DIRECT_SECONDARY_DEVICE_TYPE_MULTIMEDIA_MCX = 3, /**< MCX */ + WIFI_DIRECT_SECONDARY_DEVICE_TYPE_MULTIMEDIA_STB = 4, /**< Set-top box */ + WIFI_DIRECT_SECONDARY_DEVICE_TYPE_MULTIMEDIA_MS_MA_ME = 5, /**< Media Server / Media Adapter / Media Extender */ + WIFI_DIRECT_SECONDARY_DEVICE_TYPE_MULTIMEDIA_PVP = 6, /**< Portable video player */ + WIFI_DIRECT_SECONDARY_DEVICE_TYPE_GAME_XBOX = 1, /**< Xbox */ + WIFI_DIRECT_SECONDARY_DEVICE_TYPE_GAME_XBOX_360 = 2, /**< Xbox 360 */ + WIFI_DIRECT_SECONDARY_DEVICE_TYPE_GAME_PS = 3, /**< Playstation */ + WIFI_DIRECT_SECONDARY_DEVICE_TYPE_GAME_CONSOLE = 4, /**< Console */ + WIFI_DIRECT_SECONDARY_DEVICE_TYPE_GAME_PORTABLE = 5, /**< Portable */ + WIFI_DIRECT_SECONDARY_DEVICE_TYPE_TELEPHONE_WINDOWS_MOBILE = 1, /**< Windows Mobile */ + WIFI_DIRECT_SECONDARY_DEVICE_TYPE_TELEPHONE_PHONE_SINGLE = 2, /**< Phone - single mode */ + WIFI_DIRECT_SECONDARY_DEVICE_TYPE_TELEPHONE_PHONE_DUAL = 3, /**< Phone - dual mode */ + WIFI_DIRECT_SECONDARY_DEVICE_TYPE_TELEPHONE_SMARTPHONE_SINGLE = 4, /**< Smart Phone - single mode */ + WIFI_DIRECT_SECONDARY_DEVICE_TYPE_TELEPHONE_SMARTPHONE_DUAL = 5, /**< Smart Phone - dual mode */ + WIFI_DIRECT_SECONDARY_DEVICE_TYPE_AUDIO_TUNER = 1, /**< Tuner */ + WIFI_DIRECT_SECONDARY_DEVICE_TYPE_AUDIO_SPEAKER = 2, /**< Speaker */ + WIFI_DIRECT_SECONDARY_DEVICE_TYPE_AUDIO_PMP = 3, /**< Portable Music Player */ + WIFI_DIRECT_SECONDARY_DEVICE_TYPE_AUDIO_HEADSET = 4, /**< Headset */ + WIFI_DIRECT_SECONDARY_DEVICE_TYPE_AUDIO_HEADPHONE = 5, /**< Headphone */ + WIFI_DIRECT_SECONDARY_DEVICE_TYPE_AUDIO_MIC = 6, /**< Microphone */ +} wifi_direct_secondary_device_type_e; + +/** + * @brief Enumeration for Wi-Fi Direct primary device type + */ +typedef enum { + WIFI_DIRECT_PRIMARY_DEVICE_TYPE_COMPUTER = 1, /**< Computer */ + WIFI_DIRECT_PRIMARY_DEVICE_TYPE_INPUT_DEVICE = 2, /**< Input device */ + WIFI_DIRECT_PRIMARY_DEVICE_TYPE_PRINTER = 3, /**< Printer */ + WIFI_DIRECT_PRIMARY_DEVICE_TYPE_CAMERA = 4, /**< Camera */ + WIFI_DIRECT_PRIMARY_DEVICE_TYPE_STORAGE = 5, /**< Storage */ + WIFI_DIRECT_PRIMARY_DEVICE_TYPE_NETWORK_INFRA = 6, /**< Network Infrastructure */ + WIFI_DIRECT_PRIMARY_DEVICE_TYPE_DISPLAY = 7, /**< Display */ + WIFI_DIRECT_PRIMARY_DEVICE_TYPE_MULTIMEDIA_DEVICE = 8, /**< Multimedia device */ + WIFI_DIRECT_PRIMARY_DEVICE_TYPE_GAME_DEVICE = 9, /**< Game device */ + WIFI_DIRECT_PRIMARY_DEVICE_TYPE_TELEPHONE = 10, /**< Telephone */ + WIFI_DIRECT_PRIMARY_DEVICE_TYPE_AUDIO = 11, /**< Audio */ + WIFI_DIRECT_PRIMARY_DEVICE_TYPE_OTHER = 255 /**< Others */ +} wifi_direct_primary_device_type_e; + +/** + * @brief Enumeration for Wi-Fi WPS type + */ +typedef enum { + WIFI_DIRECT_WPS_TYPE_NONE = 0x00, /**< No WPS type */ + WIFI_DIRECT_WPS_TYPE_PBC = 0x01, /**< Push Button Configuration */ + WIFI_DIRECT_WPS_TYPE_PIN_DISPLAY = 0x02, /**< Display PIN code */ + WIFI_DIRECT_WPS_TYPE_PIN_KEYPAD = 0x04, /**< Provide the keypad to input the PIN */ +} wifi_direct_wps_type_e; + +/** + * @brief Wi-Fi Direct buffer structure to store result of peer discovery + */ +typedef struct +{ + char* device_name; /**< Device friendly name */ + char *mac_address; /**< Device's P2P Device Address */ + char* interface_address; /**< Device's P2P Interface Address, Valid only if device is a P2P GO */ + int channel; /**< Channel the device is listening on */ + bool is_connected; /**< Is peer connected*/ + bool is_group_owner; /**< Is an active P2P Group Owner */ + bool is_persistent_group_owner; /**< Is a stored Persistent GO */ + wifi_direct_primary_device_type_e primary_device_type; /**< Primary category of device */ + wifi_direct_secondary_device_type_e secondary_device_type; /**< Sub category of device */ + int supported_wps_types; /**< The list of supported WPS type.\n The OR operation on #wifi_direct_wps_type_e can be used like #WIFI_DIRECT_WPS_TYPE_PBC | #WIFI_DIRECT_WPS_TYPE_PIN_DISPLAY */ + bool is_p2p_invitation_procedure_supported; /**< Is capable of processing P2P Invitation Procedure signaling */ + char* ssid; /**< Service set identifier - DEPRECATED */ +} wifi_direct_discovered_peer_info_s; + + +/** + * @brief Wi-Fi Direct buffer structure to store information of connected peer + */ +typedef struct +{ + char* device_name; /**< Device friendly name */ + char* ip_address; /**< The IP address */ + char* mac_address; /**< Device's P2P Device Address */ + char* interface_address; /** Device's P2P Interface Address */ + bool p2p_supported; /* whether peer is a P2P device */ + wifi_direct_primary_device_type_e primary_device_type; /* primary category of device */ + int channel; /* Operating channel */ + char* ssid; /**< Service set identifier - DEPRECATED */ +} wifi_direct_connected_peer_info_s; + +/** + * @brief Called when the state of discovery is changed. + * @param[in] error_code The error code + * @param[in] discovery_state The discovery state + * @param[in] user_data The user data passed from the callback registration function + * @pre Either wifi_direct_start_discovery() or wifi_direct_cancel_discovery() will invoke this callback + * if you register this callback using wifi_direct_set_discovery_state_changed_cb(). + * @see wifi_direct_start_discovery() + * @see wifi_direct_cancel_discovery() + * @see wifi_direct_set_discovery_state_changed_cb() + * @see wifi_direct_unset_discovery_state_changed_cb() + */ +typedef void (*wifi_direct_discovery_state_chagned_cb) (wifi_direct_error_e error_code, wifi_direct_discovery_state_e discovery_state, void *user_data); + +/** + * @brief Called when the state of device is changed. + * @param[in] error_code The error code + * @param[in] device_state The device state + * @param[in] user_data The user data passed from the callback registration function + * @pre Either wifi_direct_activate() or wifi_direct_deactivate() will invoke this callback + * if you register this callback using wifi_direct_set_device_state_changed_cb(). + * @see wifi_direct_activate() + * @see wifi_direct_deactivate() + * @see wifi_direct_set_device_state_changed_cb() + * @see wifi_direct_unset_device_state_changed_cb() + */ +typedef void (*wifi_direct_device_state_changed_cb) (wifi_direct_error_e error_code, wifi_direct_device_state_e device_state, void *user_data); + +/** + * @brief Called when the state of connection is changed. + * @param[in] error_code The error code + * @param[in] connection_state The connection state + * @param[in] mac_address The MAC address of connection peer + * @param[in] user_data The user data passed from the callback registration function + * @pre wifi_direct_create_group(), wifi_direct_destroy_group(), wifi_direct_connect(), wifi_direct_disconnect() or wifi_direct_disconnect_all() will invoke this callback + * if you register this callback using wifi_direct_set_connection_state_changed_cb(). + * @see wifi_direct_connect() + * @see wifi_direct_disconnect() + * @see wifi_direct_disconnect_all() + * @see wifi_direct_set_connection_state_changed_cb() + * @see wifi_direct_unset_connection_state_changed_cb() + */ +typedef void (*wifi_direct_connection_state_changed_cb) (wifi_direct_error_e error_code, wifi_direct_connection_state_e connection_state, const char* mac_address, void *user_data); + +/** + * @brief Called when IP address of client is assigned when your device is group owner. + * @param[in] mac_address The MAC address of connection peer + * @param[in] ip_address The IP address of connection peer + * @param[in] interface_address The interface address of connection peer + * @param[in] user_data The user data passed from the callback registration function + * @see wifi_direct_set_client_ip_address_assigned_cb() + * @see wifi_direct_unset_client_ip_address_assigned_cb() + */ +typedef void (*wifi_direct_client_ip_address_assigned_cb) (const char* mac_address, const char* ip_address, const char* interface_address, void *user_data); + +/** + * @brief Initialize Wi-Fi Direct service. + * @return 0 on success, otherwise a negative error value. + * @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_RESOURCE_BUSY Device or resource busy + * @retval #WIFI_DIRECT_ERROR_NOT_INITIALIZED Not initialized + * @see wifi_direct_deinitialize() + */ +int wifi_direct_initialize(void); + +/** + * @brief Deinitialize Wi-Fi Direct service. + * @return 0 on success, otherwise a negative error value. + * @retval #WIFI_DIRECT_ERROR_NONE Successful + * @retval #WIFI_DIRECT_ERROR_NOT_PERMITTED Operation not permitted + * @retval #WIFI_DIRECT_ERROR_OPERATION_FAILED Operation failed + * @retval #WIFI_DIRECT_ERROR_COMMUNICATION_FAILED Communication failed + * @pre Wi-Fi Direct service must be initialized by wifi_direct_initialize(). + * @see wifi_direct_initialize() + */ +int wifi_direct_deinitialize(void); + +/** + * @brief Registers the callback called when the state of device is changed. + * @param[in] cb The callback function to invoke + * @param[in] user_data The user data to be passed to the callback function + * @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_NOT_INITIALIZED Not initialized + * @pre Wi-Fi Direct service must be initialized by wifi_direct_initialize(). + * @see wifi_direct_initialize() + * @see wifi_direct_unset_device_state_changed_cb() + * @see wifi_direct_device_state_changed_cb() + */ +int wifi_direct_set_device_state_changed_cb(wifi_direct_device_state_changed_cb cb, void* user_data); + +/** + * @brief Unregisters the callback called when the state of device is changed. + * @return 0 on success, otherwise a negative error value. + * @retval #WIFI_DIRECT_ERROR_NONE Successful + * @retval #WIFI_DIRECT_ERROR_NOT_INITIALIZED Not initialized + * @pre Wi-Fi Direct service must be initialized by wifi_direct_initialize(). + * @see wifi_direct_initialize() + * @see wifi_direct_set_device_state_changed_cb() + */ +int wifi_direct_unset_device_state_changed_cb(void); + +/** + * @brief Registers the callback called when the state of discovery is changed. + * @param[in] cb The callback function to invoke + * @param[in] user_data The user data to be passed to the callback function + * @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_NOT_INITIALIZED Not initialized + * @pre Wi-Fi Direct service must be initialized by wifi_direct_initialize(). + * @see wifi_direct_initialize() + * @see wifi_direct_unset_discovery_state_changed_cb() + * @see wifi_direct_discovery_state_chagned_cb() + */ +int wifi_direct_set_discovery_state_changed_cb(wifi_direct_discovery_state_chagned_cb cb, void* user_data); + +/** + * @brief Unregisters the callback called when the state of discovery is changed. + * @return 0 on success, otherwise a negative error value. + * @retval #WIFI_DIRECT_ERROR_NONE Successful + * @retval #WIFI_DIRECT_ERROR_NOT_INITIALIZED Not initialized + * @pre Wi-Fi Direct service must be initialized by wifi_direct_initialize(). + * @see wifi_direct_initialize() + * @see wifi_direct_set_discovery_state_changed_cb() + */ +int wifi_direct_unset_discovery_state_changed_cb(void); + +/** + * @brief Registers the callback called when the state of connection is changed. + * @param[in] cb The callback function to invoke + * @param[in] user_data The user data to be passed to the callback function + * @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_NOT_INITIALIZED Not initialized + * @pre Wi-Fi Direct service must be initialized by wifi_direct_initialize(). + * @see wifi_direct_initialize() + * @see wifi_direct_unset_connection_state_changed_cb() + * @see wifi_direct_connection_state_changed_cb() + */ +int wifi_direct_set_connection_state_changed_cb(wifi_direct_connection_state_changed_cb cb, void* user_data); + +/** + * @brief Unregisters the callback called when the state of connection is changed. + * @return 0 on success, otherwise a negative error value. + * @retval #WIFI_DIRECT_ERROR_NONE Successful + * @retval #WIFI_DIRECT_ERROR_NOT_INITIALIZED Not initialized + * @pre Wi-Fi Direct service must be initialized by wifi_direct_initialize(). + * @see wifi_direct_initialize() + * @see wifi_direct_set_connection_state_changed_cb() + */ +int wifi_direct_unset_connection_state_changed_cb(void); + +/** + * @brief Registers the callback called when IP address of client is assigned when your device is group owner. + * @param[in] cb The callback function to invoke + * @param[in] user_data The user data to be passed to the callback function + * @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_NOT_INITIALIZED Not initialized + * @pre Wi-Fi Direct service must be initialized by wifi_direct_initialize(). + * @see wifi_direct_initialize() + * @see wifi_direct_unset_client_ip_address_assigned_cb() + * @see wifi_direct_client_ip_address_assigned_cb() + */ +int wifi_direct_set_client_ip_address_assigned_cb(wifi_direct_client_ip_address_assigned_cb cb, void* user_data); + +/** + * @brief Unregisters the callback called when IP address of client is assigned when your device is group owner. + * @return 0 on success, otherwise a negative error value. + * @retval #WIFI_DIRECT_ERROR_NONE Successful + * @retval #WIFI_DIRECT_ERROR_NOT_INITIALIZED Not initialized + * @pre Wi-Fi Direct service must be initialized by wifi_direct_initialize(). + * @see wifi_direct_initialize() + * @see wifi_direct_set_connection_state_changed_cb() + */ +int wifi_direct_unset_client_ip_address_assigned_cb(void); + +/** + * @brief Activates the Wi-Fi Direct service, asynchronous. + * @return 0 on success, otherwise a negative error value. + * @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 + * @retval #WIFI_DIRECT_ERROR_WIFI_USED Wi-Fi is being used + * @retval #WIFI_DIRECT_ERROR_MOBILE_AP_USED Mobile AP is being used + * @pre Wi-Fi Direct service must be initialized by wifi_direct_initialize(). + * @post wifi_direct_device_state_changed_cb() will be invoked. + * @see wifi_direct_initialize() + * @see wifi_direct_deactivate() + * @see wifi_direct_device_state_changed_cb() + */ +int wifi_direct_activate(void); + +/** + * @brief Deactivates the Wi-Fi Direct service, asynchronous. + * @return 0 on success, otherwise a negative error value. + * @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 activated by wifi_direct_activate(). + * @post wifi_direct_device_state_changed_cb() will be invoked. + * @see wifi_direct_activate() + * @see wifi_direct_device_state_changed_cb() + */ +int wifi_direct_deactivate(void); + +/** + * @brief Starts discovery to find all P2P capable devices, asynchronous. + * @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 and Listen. + * @param[in] listen_only The status of listen only: (@c true = listen only, @c false = cycling between Scan and Listen) + * @param[in] timeout Specifies the duration of discovery period, in seconds. If 0, a default value will be used. + * @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(). + * @post wifi_direct_discovery_state_chagned_cb() will be invoked. + * @see wifi_direct_activate() + * @see wifi_direct_cancel_discovery() + * @see wifi_direct_discovery_state_chagned_cb() + */ +int wifi_direct_start_discovery(bool listen_only, int timeout); + +/** + * @brief Cancels discovery process, asynchronous. + * @return 0 on success, otherwise a negative error value. + * @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 Discovery must be started by wifi_direct_start_discovery(). + * @post wifi_direct_discovery_state_chagned_cb() will be invoked. + * @see wifi_direct_start_discovery() + * @see wifi_direct_discovery_state_chagned_cb() + */ +int wifi_direct_cancel_discovery(void); + + /** + * @brief Called repeatedly when you get the information of discovered peers. + * @remarks @a peer is valid only in this function. + * @param[in] peer The information of discovered peer + * @param[in] user_data The user data passed from foreach function + * @return @c true to continue with the next iteration of the loop, \n @c false to break out of the loop + * @see wifi_direct_foreach_discovered_peers() + */ + typedef bool(*wifi_direct_discovered_peer_cb)(wifi_direct_discovered_peer_info_s* peer, void* user_data); + +/** + * @brief Gets the information of discovered peers. + * @param[in] callback The callback function to invoke + * @param[in] user_data The user data to be passed to the callback function + * @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_activate() + * @see wifi_direct_discovered_peer_cb() + */ +int wifi_direct_foreach_discovered_peers(wifi_direct_discovered_peer_cb callback, void* user_data); + +/** + * @brief Connects to a specified peer, asynchronous. + * @details This API connects to specified peer by automatically determining whether to perform group formation, + * join an existing group, invite, re-invoke a group. + * The decision is based on the current state of the peers (i.e. GO, STA, not connected) and the availability of persistent data. + * @param[in] mac_address The MAC address of remote device + * @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_TOO_MANY_CLIENT Too many client + * @retval #WIFI_DIRECT_ERROR_CONNECTION_TIME_OUT Connection timed out + * @retval #WIFI_DIRECT_ERROR_CONNECTION_FAILED Connection failed + * @retval #WIFI_DIRECT_ERROR_AUTH_FAILED Authentication failed + * @pre Wi-Fi Direct service must be activated by wifi_direct_activate(). + * @post wifi_direct_connection_state_changed_cb() will be invoked. + * @see wifi_direct_activate() + * @see wifi_direct_disconnect() + * @see wifi_direct_disconnect_all() + * @see wifi_direct_connection_state_changed_cb() + */ +int wifi_direct_connect(const char* mac_address); + +/** + * @brief Disconnects all connected links to peers, asynchronous. + * @return 0 on success, otherwise a negative error value. + * @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 activated by wifi_direct_activate(). + * @post wifi_direct_connection_state_changed_cb() will be invoked. + * @see wifi_direct_activate() + * @see wifi_direct_disconnect() + * @see wifi_direct_connection_state_changed_cb() + */ +int wifi_direct_disconnect_all(void); + +/** + * @brief Disconnects the specified peer, asynchronous. + * @param[in] mac_address The MAC address of remote device + * @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(). + * @post wifi_direct_connection_state_changed_cb() will be invoked. + * @see wifi_direct_activate() + * @see wifi_direct_disconnect() + * @see wifi_direct_connection_state_changed_cb() + */ +int wifi_direct_disconnect(const char* mac_address); + +/** + * @brief Called repeatedly when you get the information of connected peers. + * @remarks @a peer is valid only in this function. + * @param[in] peer The information of discovered peer + * @param[in] user_data The user data passed from foreach function + * @return @c true to continue with the next iteration of the loop, \n @c false to break out of the loop + * @see wifi_direct_foreach_connected_peers() + */ +typedef bool(*wifi_direct_connected_peer_cb)(wifi_direct_connected_peer_info_s* peer, void* user_data); + +/** + * @brief Gets the information of connected peers. + * @param[in] callback The callback function to invoke + * @param[in] user_data The user data to be passed to the callback function + * @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_activate() + * @see wifi_direct_discovered_peer_cb() + */ +int wifi_direct_foreach_connected_peers(wifi_direct_connected_peer_cb callback, void* user_data); + +/** + * @brief Creates a Wi-Fi Direct Group, asynchronous. + * @details This API sets up device as a Group Owner and wait for clients to connect. + * In addition, a soft AP will be created, the WPS registrar and the DHCP server will be started. + * @return 0 on success, otherwise a negative error value. + * @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 + * @retval #WIFI_DIRECT_ERROR_AUTH_FAILED Authentication failed + * @pre Wi-Fi Direct service must be activated by wifi_direct_activate(). + * @post wifi_direct_connection_state_changed_cb() will be invoked with WIFI_DIRECT_GROUP_CREATED. + * @see wifi_direct_activate() + * @see wifi_direct_destroy_group() + * @see wifi_direct_connection_state_changed_cb() + */ +int wifi_direct_create_group(void); + +/** + * @brief Destorys the Wi-Fi Direct Group, asynchronous. + * @details This API destroys the Wi-Fi Direct Group owned by local device. + * If creating a Group is in progress, this API cancels that creating. + * @return 0 on success, otherwise a negative error value. + * @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 + * @retval #WIFI_DIRECT_ERROR_AUTH_FAILED Authentication failed + * @pre Wi-Fi Direct service must be activated by wifi_direct_activate(). + * @post wifi_direct_connection_state_changed_cb() will be invoked with WIFI_DIRECT_GROUP_DESTROYED. + * @see wifi_direct_activate() + * @see wifi_direct_create_group() + * @see wifi_direct_connection_state_changed_cb() + */ +int wifi_direct_destroy_group(void); + +/** + * @brief Checks whether this device is group owner or not. + * @param[out] is_group_owner Indicats whether this device is group owner or not + * @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_activate() + */ +int wifi_direct_is_group_owner(bool* is_group_owner); + +/** + * @brief Checks whether the currunt group is autonomous group or not. + * @details If you create a group by wifi_direct_create_group(), then the current group is autonomous group. + * @param[out] is_autonomous_group Indicats whether the currunt group is autonomous group or not + * @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_activate() + * @see wifi_direct_create_group() + * @see wifi_direct_destroy_group() + */ +int wifi_direct_is_autonomous_group(bool* is_autonomous_group); + +/** + * @brief Sets the friendly name of local device. + * @details This device name is shown to other devices during device discovery. + * @remarks The name set by you is only valid during activated state. + * After Wi-Fi Direct is deactivated, this name will be as the phone name. + * @param[in] device_name The name to local device + * @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 permitteds + * @retval #WIFI_DIRECT_ERROR_NOT_INITIALIZED Not initialized + * @retval #WIFI_DIRECT_ERROR_RESOURCE_BUSY Device or resource busy + * @pre Wi-Fi Direct must be activated by wifi_direct_activate(). + * @see wifi_direct_activate() + * @see wifi_direct_get_device_name() + */ +int wifi_direct_set_device_name(const char* device_name); + +/** + * @brief Gets the name of local device. + * @remarks @a device_name must be released with free() by you. + * @param[out] device_name The name to local device + * @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_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_set_device_name() + */ +int wifi_direct_get_device_name(char** device_name); + +/** + * @brief Sets SSID(Service Set Identifier) of local device - DEPRECATED. + * @param[in] ssid The SSID + * @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_set_ssid(const char* ssid); + +/** + * @brief Gets SSID(Service Set Identifier) of local device. + * @remarks @a ssid must be released with free() by you. + * @param[out] ssid The SSID + * @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_OUT_OF_MEMORY Out of memory + * @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_ssid(char** ssid); + +/** + * @brief Gets the name of network interface. For example, eth0 and pdp0. + * @remarks @a name must be released with free() by you. + * @param[out] name The name of network interface + * @return 0 on success, otherwise 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_OUT_OF_MEMORY Out of memory + * @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_activate() + */ +int wifi_direct_get_network_interface_name(char** name); + +/** + * @brief Gets IP address of local device. + * @remarks @a ip_address must be released with free() by you. + * @param[out] ip_address The IP address + * @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_OUT_OF_MEMORY Out of memory + * @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_activate() + */ +int wifi_direct_get_ip_address(char** ip_address); + +/** + * @brief Gets the Subnet Mask. + * @remarks @a subnet_mask must be released with free() by you. + * @param[out] subnet_mask The subnet mask + * @return 0 on success, otherwise 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_OUT_OF_MEMORY Out of memory + * @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_activate() + */ +int wifi_direct_get_subnet_mask(char** subnet_mask); + +/** + * @brief Gets the Gateway address. + * @remarks @a gateway_address must be released with free() by you. + * @param[out] gateway_address The gateway address + * @return 0 on success, otherwise 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_OUT_OF_MEMORY Out of memory + * @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_activate() + */ +int wifi_direct_get_gateway_address(char** gateway_address); + +/** + * @brief Gets MAC address of local device. + * @remarks @a mac_address must be released with free() by you. + * @param[out] mac_address The MAC address + * @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_OUT_OF_MEMORY Out of memory + * @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_mac_address(char** mac_address); + +/** + * @brief Gets the state of Wi-Fi Direct service. + * @param[out] state The state of Wi-Fi Direct service + * @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_state(wifi_direct_state_e* state); + +/** + * @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 + * @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_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 and Listen. + * @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. + * @param[out] type The primary 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_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); + +/** + * @brief Called when you get the supported WPS(Wi-Fi Protected Setup) type repeatedly. + * @param[in] type The type of WPS + * @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 the loop + * @pre wifi_direct_foreach_supported_wps_types() will invoke this callback. + * @see wifi_direct_foreach_supported_wps_types() + */ +typedef bool(*wifi_direct_supported_wps_type_cb)(wifi_direct_wps_type_e type, void* user_data); + +/** + * @brief Gets the supported WPS(Wi-Fi Protected Setup) types. + * @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(). + * @see wifi_direct_initialize() + * @see wifi_direct_supported_wps_type_cb() + */ +int wifi_direct_foreach_supported_wps_types(wifi_direct_supported_wps_type_cb callback, void* user_data); + +/** + * @brief Sets the WPS(Wi-Fi Protected Setup) type. + * @param[in] type The type of WPS + * @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_supported_wps_types() + */ +int wifi_direct_set_wps_type(wifi_direct_wps_type_e type); + +/** + * @brief Gets the WPS(Wi-Fi Protected Setup) type. + * @param[out] type The type of WPS + * @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_supported_wps_types() + */ +int wifi_direct_get_wps_type(wifi_direct_wps_type_e* type); + +/** + * @brief Sets the intent of a group owner. + * @remarks The range of intent is 0 ~ 15. The higher the @a intent is, the higher the probability to be group owner is. + * @param[in] intent The intent of a 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_get_group_owner_intent() + */ +int wifi_direct_set_group_owner_intent(int intent); + +/** + * @brief Gets the intent of a group owner. + * @param[out] intent The intent of a 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_set_group_owner_intent() + */ +int wifi_direct_get_group_owner_intent(int* intent); + +/** + * @brief Sets the max number of clients. + * @param[in] max The max number of clients + * @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_get_max_clients() + */ +int wifi_direct_set_max_clients(int max); + +/** + * @brief Gets the max number of clients. + * @param[in] max The max number of clients + * @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_set_max_clients() + */ +int wifi_direct_get_max_clients(int* max); + +/** + * @brief Gets the channel of own group. - DEPRECATED + * @remarks This API will be removed. + * @param[out] channel The channel of own group + * @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_own_group_channel(int* channel); + +/** + * @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() + */ +int wifi_direct_get_operating_channel(int* channel); + +/** + * @brief Enables the persistent group. + * @details If @a enabled is true, then P2P persisten group will be used when creating a group and establishing a connection. + * @param[in] enabled The status of persistent group: (@c true = enabled, @c false = disabled) + * @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_is_persistent_group_enabled() + */ +int wifi_direct_set_persistent_group_enabled(bool enabled); + +/** + * @brief Checks whether the persistent group is enabled or disabled. + * @param[out] enabled The status of persistent group: (@c true = enabled, @c false = disabled) + * @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_set_persistent_group_enabled() + */ +int wifi_direct_is_persistent_group_enabled(bool* enabled); +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif /* __TIZEN_NET_WIFI_DIRECT_H__ */ + diff --git a/packaging/capi-network-wifi-direct.spec b/packaging/capi-network-wifi-direct.spec new file mode 100755 index 0000000..327d6d6 --- /dev/null +++ b/packaging/capi-network-wifi-direct.spec @@ -0,0 +1,50 @@ +Name: capi-network-wifi-direct +Summary: Network WiFi-Direct library in Tizen CAPI +Version: 0.0.4 +Release: 3 +Group: TO_BE_FILLED +License: TO_BE_FILLED +Source0: %{name}-%{version}.tar.gz +Requires(post): /sbin/ldconfig +Requires(postun): /sbin/ldconfig +BuildRequires: pkgconfig(dbus-glib-1) +BuildRequires: pkgconfig(dlog) +BuildRequires: pkgconfig(vconf) +BuildRequires: pkgconfig(capi-base-common) +BuildRequires: cmake + +%description + +%define debug_package %{nil} + +%package devel +Summary: WiFi-Direct library (Shared Library) (Developement) +Group: TO_BE_FILLED +Requires: capi-base-common-devel +BuildRequires: pkgconfig(wifi-direct) +%description devel +WiFi-Direct library (Shared Library) (Developement) + +%prep +%setup -q + +%build +cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} +make %{?jobs:-j%jobs} + +%install +rm -rf %{buildroot} +%make_install + +%post + +%postun + +%files +%manifest capi-network-wifi-direct.manifest + +%files devel +%defattr(-,root,root,-) +%{_libdir}/pkgconfig/*.pc +%{_includedir}/*/*.h + -- 2.7.4