summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaehyun Kim <jeik01.kim@samsung.com>2024-09-19 07:19:37 +0000
committerGerrit Code Review <gerrit@review>2024-09-19 07:19:37 +0000
commitec6d9ab9161c7b9d3201fd0c9a5b02cd85928456 (patch)
treed3d1026c91cb7e2e1850a69d9e74a961515d1c34
parent717e71314c62a8a4b916d7987cb8c13a312100e4 (diff)
parent4e358f4d3c7ada2f53358916478c7fc6064e7014 (diff)
downloadwifi-aware-ec6d9ab9161c7b9d3201fd0c9a5b02cd85928456.tar.gz
wifi-aware-ec6d9ab9161c7b9d3201fd0c9a5b02cd85928456.tar.bz2
wifi-aware-ec6d9ab9161c7b9d3201fd0c9a5b02cd85928456.zip
-rw-r--r--doc/wifi_aware_doc.h35
-rw-r--r--include/wifi-aware.h1198
-rw-r--r--src/wifi-aware.c6
3 files changed, 745 insertions, 494 deletions
diff --git a/doc/wifi_aware_doc.h b/doc/wifi_aware_doc.h
index 8685189..195f789 100644
--- a/doc/wifi_aware_doc.h
+++ b/doc/wifi_aware_doc.h
@@ -25,27 +25,29 @@
* \#include <wifi-aware.h>
*
* @section CAPI_NETWORK_WIFI_AWARE_MODULE_OVERVIEW Overview
- * This set of functions is used to manage the settings of Wi-Fi Aware framework.
- * In addition, This set provides functions to using Wi-Fi Aware discoverying, ranging and data services.
+ * The Wi-Fi Aware API provides functions for initializing, enabling, and disabling Wi-Fi Aware functionalities.
+ * It allows users to create and destroy Wi-Fi Aware sessions, set callbacks for session termination notifications, stop sessions, and more.
+ * Additionally, there are functions available for publishing and subscribing to Wi-Fi Aware services, updating existing subscriptions, sending messages to peers, setting up data paths between peers, and managing security aspects of the data path.
+ * Overall, the Wi-Fi Aware API offers comprehensive control over Wi-Fi Aware operations and interactions.
*/
/**
* @ingroup CAPI_NETWORK_WIFI_AWARE_MODULE
* @defgroup CAPI_NETWORK_WIFI_AWARE_PUBLISH_MODULE Wi-Fi Aware Publish
- * @brief The Network Monitoring Specific API provides functions for provide Wi-Fi Aware publish.
+ * @brief Wifi Aware Publish API provides functions for configuring a Publish session.
* @section CAPI_NETWORK_WIFI_AWARE_PUBLISH_MODULE_HEADER Required Header
* \#include <wifi-aware.h>
*
* @section CAPI_NETWORK_WIFI_AWARE_PUBLISH_MODULE_OVERVIEW Overview
- * This set of functions is used to TODO.
- * To use This kind of APIs, You should create a Wi-Fi Aware publish handle using TODO. After that, TODO.
- * You should destroy the created inm handle if you do not need it anymore.
- * You can TODO.
- *
+ * This set of functions is used to configure a Wi-Fi Aware session for publication
+ * To use This kind of APIs, You should create a Wi-Fi Aware publish handle using wifi_aware_publish_create().
+ * After that, configure the publication using functions like wifi_aware_publish_set_type(), wifi_aware_publish_set_service_name(), etc.
+ * You should destroy the created publish handle if you do not need it anymore using wifi_aware_publish_destroy().
+ * Once all configurations have been completed, You can initiate the publication of a Wi-Fi Aware session using wifi_aware_session_publish().
*
* @section CAPI_NETWORK_WIFI_AWARE_PUBLISH_MODULE_FEATURE Related Features
* This API is related with the following features:\n
- * - http://tizen.org/feature/network.wifi\n
+ * - http://tizen.org/feature/network.wifi.aware\n
* It is recommended to design feature related codes in your application for reliability.\n
* You can check if a device supports the related features for this API by using @ref CAPI_SYSTEM_SYSTEM_INFO_MODULE, thereby controlling the procedure of your application.\n
* To ensure your application is only running on the device with specific features, please define the features in your manifest file using the manifest editor in the SDK.\n
@@ -55,19 +57,20 @@
/**
* @ingroup CAPI_NETWORK_WIFI_AWARE_MODULE
* @defgroup CAPI_NETWORK_WIFI_AWARE_SUBSCRIBE_MODULE Wi-Fi Aware Subscribe
- * @brief The Network Monitoring API provides functions for provide Wi-Fi Aware subscribe.
+ * @brief Wifi Aware Subscribe API provides functions for configuring a Subscribe session.
* @section CAPI_NETWORK_WIFI_AWARE_SUBSCRIBE_MODULE_HEADER Required Header
* \#include <wifi-aware.h>
*
* @section CAPI_NETWORK_WIFI_AWARE_SUBSCRIBE_MODULE_OVERVIEW Overview
- * This set of functions is used to TODO.
- * To use This kind of APIs, You should create a Wi-Fi Aware publish handle using TODO. After that, TODO.
- * You should destroy the created inm handle if you do not need it anymore.
- * You can TODO.
- *
+ * This set of functions is used to configure a Wi-Fi Aware session for subscription.
+ * To use This kind of APIs, You should create a Wi-Fi Aware subscribe handle using wifi_aware_subscribe_create().
+ * After that, configure the subscription using functions like wifi_aware_subscribe_set_type(), wifi_aware_subscribe_set_service_name(), etc.
+ * You should destroy the created subscribe handle if you do not need it anymore using wifi_aware_subscribe_destroy().
+ * Once all configurations have been completed, You can initiate the subscription of a Wi-Fi Aware session using wifi_aware_session_subscribe().
+ *
* @section CAPI_NETWORK_WIFI_AWARE_SUBSCRIBE_MODULE_FEATURE Related Features
* This API is related with the following features:\n
- * - http://tizen.org/feature/network.wifi\n
+ * - http://tizen.org/feature/network.wifi.aware\n
* It is recommended to design feature related codes in your application for reliability.\n
* You can check if a device supports the related features for this API by using @ref CAPI_SYSTEM_SYSTEM_INFO_MODULE, thereby controlling the procedure of your application.\n
* To ensure your application is only running on the device with specific features, please define the features in your manifest file using the manifest editor in the SDK.\n
diff --git a/include/wifi-aware.h b/include/wifi-aware.h
index 192e51f..0e889af 100644
--- a/include/wifi-aware.h
+++ b/include/wifi-aware.h
@@ -39,7 +39,7 @@ extern "C" {
/**
* @brief Enumeration for Wi-Fi Aware error code.
- * @since_tizen 6.0
+ * @since_tizen 9.0
*/
typedef enum {
/**
@@ -83,7 +83,7 @@ typedef enum {
*/
WIFI_AWARE_ERROR_NOT_SUPPORTED = TIZEN_ERROR_NOT_SUPPORTED,
/**
- * No initialized
+ * Not initialized
*/
WIFI_AWARE_ERROR_NOT_INITIALIZED = TIZEN_ERROR_WIFI_AWARE|0x01,
/**
@@ -110,328 +110,128 @@ typedef enum {
/**
* @brief Enumeration for Wi-Fi Aware termination reason.
- * @since_tizen 6.0
+ * @since_tizen 9.0
*/
typedef enum {
- WIFI_AWARE_TERMINATION_REASON_UNKNOWN = 0,
+ WIFI_AWARE_TERMINATION_REASON_UNKNOWN = 0, /**< Unknown reason */
} wifi_aware_termination_reason_e;
/**
* @brief Enumeration for Wi-Fi Aware session type.
- * @since_tizen 6.0
+ * @since_tizen 9.0
*/
typedef enum {
- WIFI_AWARE_SESSION_PUBLISH = 0,
- WIFI_AWARE_SESSION_SUBSCRIBE,
+ WIFI_AWARE_SESSION_PUBLISH = 0, /**< Publish type */
+ WIFI_AWARE_SESSION_SUBSCRIBE, /**< Subscribe type */
} wifi_aware_session_type_e;
/**
+ * @}
+ */
+
+/**
+ * @addtogroup CAPI_NETWORK_WIFI_AWARE_PUBLISH_MODULE
+ * @{
+ */
+
+/**
* @brief Enumeration for Wi-Fi Aware publish type.
- * @since_tizen 6.0
+ * @since_tizen 9.0
*/
typedef enum {
- WIFI_AWARE_PUBLISH_TYPE_UNSOLICITED = 0,/**< Unsolicited type */
- WIFI_AWARE_PUBLISH_TYPE_SOLICITED, /**< Solicited type */
+ WIFI_AWARE_PUBLISH_TYPE_UNSOLICITED = 0, /**< Unsolicited type */
+ WIFI_AWARE_PUBLISH_TYPE_SOLICITED, /**< Solicited type */
} wifi_aware_publish_type_e;
/**
- * @brief Enumeration for Wi-Fi Aware subscrbie type.
- * @since_tizen 6.0
+ * @}
+ */
+
+/**
+ * @addtogroup CAPI_NETWORK_WIFI_AWARE_SUBSCRIBE_MODULE
+ * @{
+ */
+
+/**
+ * @brief Enumeration for Wi-Fi Aware subscribe type.
+ * @since_tizen 9.0
*/
typedef enum {
WIFI_AWARE_SUBSCRIBE_TYPE_PASSIVE = 0, /**< Passive type */
WIFI_AWARE_SUBSCRIBE_TYPE_ACTIVE, /**< Active type */
} wifi_aware_subscribe_type_e;
+/**
+ * @}
+ */
+
+/**
+ * @addtogroup CAPI_NETWORK_WIFI_AWARE_MODULE
+ * @{
+ */
/**
- * @brief Wi-Fi Aware Session
- * @since_tizen 6.0
+ * @brief Wi-Fi Aware Session.
+ * @since_tizen 9.0
*/
typedef void *wifi_aware_session_h;
/**
* @brief Handle for Wi-Fi Aware Publish configuration.
- * @since_tizen 6.0
+ * @since_tizen 9.0
*/
typedef void *wifi_aware_publish_h;
/**
* @brief Handle for Wi-Fi Aware Subscribe configuration.
- * @since_tizen 6.0
+ * @since_tizen 9.0
*/
typedef void *wifi_aware_subscribe_h;
/**
* @brief Handle for Wi-Fi Aware peer.
- * @since_tizen 6.0
+ * @since_tizen 9.0
*/
typedef void *wifi_aware_peer_h;
/**
* @brief Handle for Wi-Fi Aware Data Path.
- * @since_tizen 6.0
+ * @since_tizen 9.0
*/
typedef void *wifi_aware_data_path_h;
/**
- * @brief Initializes Wi-Fi Aware
- * @since_tizen 6.0
+ * @brief Initializes Wi-Fi Aware.
+ * @since_tizen 9.0
* @return 0 on success, otherwise a negative error value
- * @retval #WIFI_AWARE_ERROR_NONE
- * @retval #WIFI_AWARE_ERROR_ALREADY_INITIALIZED
- * @retval #WIFI_AWARE_ERROR_OPERATION_FAILED
+ * @retval #WIFI_AWARE_ERROR_NONE Successful
+ * @retval #WIFI_AWARE_ERROR_ALREADY_INITIALIZED Already initialized
+ * @retval #WIFI_AWARE_ERROR_OPERATION_FAILED Operation failed
* @see wifi_aware_deinitialize()
*/
-int wifi_aware_initialize();
+int wifi_aware_initialize(void);
/**
- * @brief Deinitializes Wi-Fi Aware
- * @since_tizen 6.0
+ * @brief Deinitializes Wi-Fi Aware.
+ * @since_tizen 9.0
* @return 0 on success, otherwise a negative error value
- * @retval #WIFI_AWARE_ERROR_NONE
- * @retval #WIFI_AWARE_ERROR_NOT_INITIALIZED
+ * @retval #WIFI_AWARE_ERROR_NONE Successful
+ * @retval #WIFI_AWARE_ERROR_NOT_INITIALIZED Not initialized
* @see wifi_aware_initialize()
*/
-int wifi_aware_deinitialize();
-
-/**
- * @brief Creates a Publish request.
- * @since_tizen 6.0
- * @param[out] publish The Wi-Fi Aware Publish handle.
- * @return 0 on success, otherwise a negative error value
- * @retval #WIFI_AWARE_ERROR_NONE
- * @retval #WIFI_AWARE_ERROR_INVALID_PARAMETER
- * @retval #WIFI_AWARE_ERROR_OUT_OF_MEMORY
- * @retval #WIFI_AWARE_ERROR_NOT_INITIALIZED
- * @see wifi_aware_publish_destroy()
- */
-int wifi_aware_publish_create(wifi_aware_publish_h *publish);
-
-/**
- * @brief Destroys a Publish request.
- * @since_tizen 6.0
- * @param[in] publish The Wi-Fi Aware Publish handle.
- * @return 0 on success, otherwise a negative error value
- * @retval #WIFI_AWARE_ERROR_NONE
- * @retval #WIFI_AWARE_ERROR_INVALID_PARAMETER
- * @retval #WIFI_AWARE_ERROR_NOT_INITIALIZED
- * @see wifi_aware_publish_create()
- */
-int wifi_aware_publish_destroy(wifi_aware_publish_h publish);
-
-/**
- * @brief Creates a Subscribe request.
- * @since_tizen 6.0
- * @param[out] subscribe The Wi-Fi Aware Subscribe handle.
- * @return 0 on success, otherwise a negative error value
- * @retval #WIFI_AWARE_ERROR_NONE
- * @retval #WIFI_AWARE_ERROR_INVALID_PARAMETER
- * @retval #WIFI_AWARE_ERROR_OUT_OF_MEMORY
- * @retval #WIFI_AWARE_ERROR_NOT_INITIALIZED
- * @see wifi_aware_subscribe_destroy()
- */
-int wifi_aware_subscribe_create(wifi_aware_subscribe_h *subscribe);
-
-/**
- * @brief Destroys a Subscribe request.
- * @since_tizen 6.0
- * @param[in] subscribe The Wi-Fi Aware Subscribe handle.
- * @return 0 on success, otherwise a negative error value
- * @retval #WIFI_AWARE_ERROR_NONE
- * @retval #WIFI_AWARE_ERROR_INVALID_PARAMETER
- * @retval #WIFI_AWARE_ERROR_NOT_INITIALIZED
- * @see wifi_aware_subscribe_create()
- */
-int wifi_aware_subscribe_destroy(wifi_aware_subscribe_h subscribe);
-
-/**
- * @brief Sets TTL(Time To Live) for Publish session.
- * @since_tizen 6.0
- * @param[in] publish The Wi-Fi Aware Publish handle.
- * @param[in] ttl The lifetime(seconds) of publish session. 0 means forever until canceled.
- * @return 0 on success, otherwise a negative error value
- * @retval #WIFI_AWARE_ERROR_NONE
- * @retval #WIFI_AWARE_ERROR_INVALID_PARAMETER
- * @retval #WIFI_AWARE_ERROR_NOT_INITIALIZED
- * @see wifi_aware_publish_create()
- */
-int wifi_aware_publish_set_ttl(wifi_aware_publish_h publish, unsigned short ttl);
-
-/**
- * @brief Sets the type of the service as solicited or unsolicited.
- * @since_tizen 6.0
- * @param[in] publish The Wi-Fi Aware Publish handle
- * @param[in] publish_type The Publish type
- * @return 0 on success, otherwise a negative error value
- * @retval #WIFI_AWARE_ERROR_NONE
- * @retval #WIFI_AWARE_ERROR_INVALID_PARAMETER
- * @retval #WIFI_AWARE_ERROR_NOT_INITIALIZED
- * @see wifi_aware_publish_create()
- */
-int wifi_aware_publish_set_type(wifi_aware_publish_h publish, wifi_aware_publish_type_e publish_type);
-
-/**
- * @brief Sets the name of the service.
- * @since_tizen 6.0
- * @remark The length should be less than or equal to 255.
- * @param[in] publish The Wi-Fi Aware Publish handle
- * @param[in] service_name UTF-8 name which identifies the service
- * @return 0 on success, otherwise a negative error value
- * @retval #WIFI_AWARE_ERROR_NONE
- * @retval #WIFI_AWARE_ERROR_INVALID_PARAMETER
- * @retval #WIFI_AWARE_ERROR_NOT_INITIALIZED
- * @see wifi_aware_publish_create()
- */
-int wifi_aware_publish_set_service_name(wifi_aware_publish_h publish, const char *service_name);
-
-/**
- * @brief Sets the specific information for the service.
- * @since_tizen 6.0
- * @param[in] publish The Wi-Fi Aware Publish handle
- * @param[in] service_specific_info The Sequence of values that are conveyed in the Publish message
- * @param[in] len The length of service specific information
- * @return 0 on success, otherwise a negative error value
- * @retval #WIFI_AWARE_ERROR_NONE
- * @retval #WIFI_AWARE_ERROR_NOT_INITIALIZED
- * @see wifi_aware_publish_create()
- */
-int wifi_aware_publish_set_service_specific_info(wifi_aware_publish_h publish, const unsigned char *service_specific_info, size_t len);
-
-/**
- * @brief Sets the match filter of the service.
- * @since_tizen 6.0
- * @param[in] publish The Wi-Fi Aware Publish handle
- * @param[in] match_filter An ordered sequence of <length, value> pairs
- * @param[in] len The whole length of match_filter
- * @remark The match filter is used to decide whether accepting a subscribe request or not.
- * @return 0 on success, otherwise a negative error value
- * @retval #WIFI_AWARE_ERROR_NONE
- * @retval #WIFI_AWARE_ERROR_NOT_INITIALIZED
- * @see wifi_aware_publish_create()
- */
-int wifi_aware_publish_set_match_filter(wifi_aware_publish_h publish, const unsigned char *match_filter, size_t len);
-
-/**
- * @brief Sets whether the ranging function is supported or not.
- * @since_tizen 6.0
- * @param[in] publish The Wi-Fi Aware Publish handle
- * @param[in] enable @c ture if ranging is enabled,
- * otherwise @c false if ranging is disabled.
- * @return 0 on success, otherwise a negative error value
- * @retval #WIFI_AWARE_ERROR_NONE
- * @retval #WIFI_AWARE_ERROR_NOT_INITIALIZED
- * @see wifi_aware_publish_create()
- */
-int wifi_aware_publish_enable_ranging(wifi_aware_publish_h publish, bool enable);
-
-
-
-// subscribe_config
-
-/**
- * @brief Sets TTL(Time To Live) for Subscribe session.
- * @since_tizen 6.0
- * @param[in] subscribe The Wi-Fi Aware Subscribe handle
- * @param[in] ttl The lifetime(seconds) of subscribe session.\n
- * 0 means forever until wifi_aware_service_discovered_cb.
- * @return 0 on success, otherwise a negative error value
- * @retval #WIFI_AWARE_ERROR_NONE
- * @retval #WIFI_AWARE_ERROR_INVALID_PARAMETER
- * @retval #WIFI_AWARE_ERROR_NOT_INITIALIZED
- * @see wifi_aware_subscrbie_create()
- */
-int wifi_aware_subscribe_set_ttl(wifi_aware_subscribe_h subscribe, unsigned short ttl);
-
-/**
- * @brief Sets the type of the service as passive or active.
- * @since_tizen 6.0
- * @param[in] subscribe The Wi-Fi Aware Subscribe handle
- * @param[in] subscribe_type The Subscribe type
- * @return 0 on success, otherwise a negative error value
- * @retval #WIFI_AWARE_ERROR_NONE
- * @retval #WIFI_AWARE_ERROR_INVALID_PARAMETER
- * @retval #WIFI_AWARE_ERROR_NOT_INITIALIZED
- * @see wifi_aware_subscrbie_create()
- */
-int wifi_aware_subscribe_set_type(wifi_aware_subscribe_h subscribe, wifi_aware_subscribe_type_e subscribe_type);
-
-/**
- * @brief Sets the name of the service.
- * @since_tizen 6.0
- * @param[in] subscribe The Wi-Fi Aware Subscribe handle
- * @param[in] service_name UTF-8 name which identifies the service
- * @remark The length should be less than or equal to 255
- * @return 0 on success, otherwise a negative error value
- * @retval #WIFI_AWARE_ERROR_NONE
- * @retval #WIFI_AWARE_ERROR_INVALID_PARAMETER
- * @retval #WIFI_AWARE_ERROR_NOT_INITIALIZED
- * @see wifi_aware_subscrbie_create()
- */
-int wifi_aware_subscribe_set_service_name(wifi_aware_subscribe_h subscribe, const char *service_name);
-
-/**
- * @brief Sets the specific information for the service.
- * @since_tizen 6.0
- * @param[in] subscribe The Wi-Fi Aware Subscribe handle
- * @param[in] service_specific_info The Sequence of values that are conveyed in the Subscribe message
- * @param[in] len The length of service specific information
- * @return 0 on success, otherwise a negative error value
- * @retval #WIFI_AWARE_ERROR_NONE
- * @retval #WIFI_AWARE_ERROR_INVALID_PARAMETER
- * @retval #WIFI_AWARE_ERROR_NOT_INITIALIZED
- * @see wifi_aware_subscrbie_create()
- */
-int wifi_aware_subscribe_set_service_specific_info(wifi_aware_subscribe_h subscribe, const unsigned char *service_specific_info, size_t len);
-
-/**
- * @brief Sets the match filter of the service.
- * @since_tizen 6.0
- * @param[in] subscribe The Wi-Fi Aware Subscribe handle
- * @param[in] match_filter An ordered sequence of <length, value> pairs
- * @param[in] len The whole length of match_filter
- * @remark The match filter is used to decide whether accepting a subscribe request or not.
- * @return 0 on success, otherwise a negative error value
- * @retval #WIFI_AWARE_ERROR_NONE
- * @retval #WIFI_AWARE_ERROR_INVALID_PARAMETER
- * @retval #WIFI_AWARE_ERROR_NOT_INITIALIZED
- * @see wifi_aware_subscrbie_create()
- */
-int wifi_aware_subscribe_set_match_filter(wifi_aware_subscribe_h subscribe, const unsigned char *match_filter, size_t len);
-
-/**
- * @brief Sets the maximum distance.
- * @since_tizen 6.0
- * @remark Only for the services within the @a distance are searched.
- * @param[in] subscribe The Wi-Fi Aware Subscribe handle
- * @param[in] distance The maximum distance
- * @return 0 on success, otherwise a negative error value
- * @retval #WIFI_AWARE_ERROR_NONE
- * @retval #WIFI_AWARE_ERROR_INVALID_PARAMETER
- * @retval #WIFI_AWARE_ERROR_NOT_INITIALIZED
- * @see wifi_aware_subscrbie_create()
- */
-int wifi_aware_subscribe_set_max_distance(wifi_aware_subscribe_h subscribe, int distance);
-
-/**
- * @brief Sets the minimum distance.
- * @since_tizen 6.0
- * @remark Only for the services at least at the @ a distance are searched.
- * @param[in] subscribe The Wi-Fi Aware Subscribe handle
- * @param[in] distance The minimum distance
- * @return 0 on success, otherwise a negative error value
- * @retval #WIFI_AWARE_ERROR_NONE
- * @retval #WIFI_AWARE_ERROR_INVALID_PARAMETER
- * @retval #WIFI_AWARE_ERROR_NOT_INITIALIZED
- * @see wifi_aware_subscrbie_create()
- */
-int wifi_aware_subscribe_set_min_distance(wifi_aware_subscribe_h subscribe, int distance);
-
+int wifi_aware_deinitialize(void);
/**
* @brief Called when Wi-Fi Aware is enabled.
- * @since_tizen 6.0
+ * @details The following error codes can be received: \n
+ * #WIFI_AWARE_ERROR_NONE Successful \n
+ * #WIFI_AWARE_ERROR_INVALID_PARAMETER Invalid function parameter \n
+ * #WIFI_AWARE_ERROR_INVALID_OPERATION Invalid operation \n
+ * #WIFI_AWARE_ERROR_OPERATION_FAILED Operation failed \n
+ * #WIFI_AWARE_ERROR_PERMISSION_DENIED Permission denied \n
+ * #WIFI_AWARE_ERROR_NOT_SUPPORTED Not supported
+ * @since_tizen 9.0
* @param[in] error The error code
* @param[in] user_data The user data passed from the request function
* @see wifi_aware_enable()
@@ -440,67 +240,87 @@ typedef void(*wifi_aware_enabled_cb)(wifi_aware_error_e error, void *user_data);
/**
* @brief Enables Wi-Fi Aware functions.
- * @remarks If the enable request is sucessfully done, the application can get the MAC address.
- * @since_tizen 6.0
+ * @since_tizen 9.0
* @privlevel public
* @privilege %http://tizen.org/privilege/network.set
- * @param[in] callback The result of enable request is asynchrously delivered
+ * @remarks If the enable request is successfully done, the application can get the MAC address.
+ * @param[in] callback The result of enable request is asynchronously delivered
* @param[in] user_data The user data passed to the callback function
* @return 0 on success, otherwise a negative error value
- * @retval #WIFI_AWARE_ERROR_NONE
- * @retval #WIFI_AWARE_ERROR_ALREADY_ENABLED
- * @retval #WIFI_AWARE_ERROR_OUT_OF_MEMORY
- * @retval #WIFI_AWARE_ERROR_OPERATION_FAILED
- * @retval #WIFI_AWARE_ERROR_PERMISSION_DENIED
- * @retval #WIFI_AWARE_ERROR_NOT_INITIALIZED
+ * @retval #WIFI_AWARE_ERROR_NONE Successful
+ * @retval #WIFI_AWARE_ERROR_ALREADY_ENABLED Already enabled
+ * @retval #WIFI_AWARE_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #WIFI_AWARE_ERROR_OPERATION_FAILED Operation failed
+ * @retval #WIFI_AWARE_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #WIFI_AWARE_ERROR_NOT_INITIALIZED Not initialized
* @see wifi_aware_disable()
*/
int wifi_aware_enable(wifi_aware_enabled_cb callback, void *user_data);
/**
* @brief Disables Wi-Fi Aware functions.
- * @since_tizen 6.0
+ * @since_tizen 9.0
* @privlevel public
* @privilege %http://tizen.org/privilege/network.set
* @return 0 on success, otherwise a negative error value
- * @retval #WIFI_AWARE_ERROR_NONE
- * @retval #WIFI_AWARE_ERROR_INVALID_OPERATION
- * @retval #WIFI_AWARE_ERROR_OPERATION_FAILED
- * @retval #WIFI_AWARE_ERROR_PERMISSION_DENIED
- * @retval #WIFI_AWARE_ERROR_NOT_INITIALIZED
+ * @retval #WIFI_AWARE_ERROR_NONE Successful
+ * @retval #WIFI_AWARE_ERROR_INVALID_OPERATION Invalid operation
+ * @retval #WIFI_AWARE_ERROR_OPERATION_FAILED Operation failed
+ * @retval #WIFI_AWARE_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #WIFI_AWARE_ERROR_NOT_INITIALIZED Not initialized
* @see wifi_aware_enable()
*/
-int wifi_aware_disable();
+int wifi_aware_disable(void);
/**
* @brief Creates the Wi-Fi Aware Session.
- * @since_tizen 6.0
+ * @since_tizen 9.0
+ * @remarks The @a session should be released using wifi_aware_session_destroy().
* @param[in] session_type The type of session
* @param[out] session The Wi-Fi Aware Session handle that is newly created on success
* @return 0 on success, otherwise a negative error value
- * @retval #WIFI_AWARE_ERROR_NONE
- * @retval #WIFI_AWARE_ERROR_OUT_OF_MEMORY
- * @retval #WIFI_AWARE_ERROR_INVALID_PARAMETER
- * @retval #WIFI_AWARE_ERROR_NOT_INITIALIZED
+ * @retval #WIFI_AWARE_ERROR_NONE Successful
+ * @retval #WIFI_AWARE_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #WIFI_AWARE_ERROR_INVALID_PARAMETER Invalid function parameter
+ * @retval #WIFI_AWARE_ERROR_NOT_INITIALIZED Not initialized
+ *
+ * @par Here is an example of the usage:
+ * @code
+ *
+ * int ret = 0;
+ * wifi_aware_session_h wifi_aware_session = NULL;
+ *
+ * ret = wifi_aware_session_create(WIFI_AWARE_SESSION_PUBLISH, &wifi_aware_session);
+ * if (ret != WIFI_AWARE_ERROR_NONE) {
+ * printf("Failed to create session\n");
+ * return;
+ * }
+ *
+ * // Do stuff here for created session
+ *
+ * wifi_aware_session_destroy(wifi_aware_session);
+ *
+ * @endcode
* @see wifi_aware_session_destroy()
*/
int wifi_aware_session_create(wifi_aware_session_type_e session_type, wifi_aware_session_h *session);
/**
- * @brief Destroies the Wi-Fi Aware Session.
- * @since_tizen 6.0
+ * @brief Destroys the Wi-Fi Aware Session.
+ * @since_tizen 9.0
* @param[in] session The Wi-Fi Aware Session handle
* @return 0 on success, otherwise a negative error value
- * @retval #WIFI_AWARE_ERROR_NONE
- * @retval #WIFI_AWARE_ERROR_INVALID_PARAMETER
- * @retval #WIFI_AWARE_ERROR_NOT_INITIALIZED
+ * @retval #WIFI_AWARE_ERROR_NONE Successful
+ * @retval #WIFI_AWARE_ERROR_INVALID_PARAMETER Invalid function parameter
+ * @retval #WIFI_AWARE_ERROR_NOT_INITIALIZED Not initialized
* @see wifi_aware_session_create()
*/
int wifi_aware_session_destroy(wifi_aware_session_h session);
/**
* @brief Called when the Wi-Fi Aware Session has been lost.
- * @since_tizen 6.0
+ * @since_tizen 9.0
+ * @remarks The @a session should not be released.
* @param[in] session The Wi-Fi Aware Session handle
* @param[in] reason The reason of termination
* @param[in] user_data The user data passed from request function
@@ -511,46 +331,46 @@ typedef void(*wifi_aware_session_terminated_cb)(wifi_aware_session_h session,
wifi_aware_termination_reason_e reason, void *user_data);
/**
- * @brief Registers a callback function to notify session is terminated.
- * @since_tizen 6.0
+ * @brief Sets a callback function to notify session is terminated.
+ * @since_tizen 9.0
* @param[in] session The Wi-Fi Aware Session
* @param[in] callback The callback function to register
* @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_AWARE_ERROR_NONE
- * @retval #WIFI_AWARE_ERROR_INVALID_PARAMETER
- * @retval #WIFI_AWARE_ERROR_NOT_INITIALIZED
+ * @retval #WIFI_AWARE_ERROR_NONE Successful
+ * @retval #WIFI_AWARE_ERROR_INVALID_PARAMETER Invalid function parameter
+ * @retval #WIFI_AWARE_ERROR_NOT_INITIALIZED Not initialized
* @see wifi_aware_session_unset_terminated_cb()
*/
int wifi_aware_session_set_terminated_cb(wifi_aware_session_h session,
wifi_aware_session_terminated_cb callback, void *user_data);
/**
- * @brief Unregisters the session terminated callback function.
- * @since_tizen 6.0
+ * @brief Unsets the session terminated callback function.
+ * @since_tizen 9.0
* @param[in] session The Wi-Fi Aware Session
* @return 0 on success, otherwise a negative error value
- * @retval #WIFI_AWARE_ERROR_NONE
- * @retval #WIFI_AWARE_ERROR_INVALID_PARAMETER
- * @retval #WIFI_AWARE_ERROR_NOT_INITIALIZED
+ * @retval #WIFI_AWARE_ERROR_NONE Successful
+ * @retval #WIFI_AWARE_ERROR_INVALID_PARAMETER Invalid function parameter
+ * @retval #WIFI_AWARE_ERROR_NOT_INITIALIZED Not initialized
* @see wifi_aware_session_set_terminated_cb()
*/
int wifi_aware_session_unset_terminated_cb(wifi_aware_session_h session);
/**
* @brief Stops a Wi-Fi Aware session.
- * @since_tizen 6.0
+ * @since_tizen 9.0
* @privlevel public
* @privilege %http://tizen.org/privilege/network.set
+ * @remarks The function of the session, Publish or Subscribe, will be cancelled.
* @param[in] session The Wi-Fi Aware Session handle
- * @remark The function of the session, Publish or Subscribe, will be cancelled.
* @return 0 on success, otherwise a negative error value
- * @retval #WIFI_AWARE_ERROR_NONE
- * @retval #WIFI_AWARE_ERROR_INVALID_PARAMETER
- * @retval #WIFI_AWARE_ERROR_INVALID_OPERATION
- * @retval #WIFI_AWARE_ERROR_OPERATION_FAILED
- * @retval #WIFI_AWARE_ERROR_PERMISSION_DENIED
- * @retval #WIFI_AWARE_ERROR_NOT_INITIALIZED
+ * @retval #WIFI_AWARE_ERROR_NONE Successful
+ * @retval #WIFI_AWARE_ERROR_INVALID_PARAMETER Invalid function parameter
+ * @retval #WIFI_AWARE_ERROR_INVALID_OPERATION Invalid operation
+ * @retval #WIFI_AWARE_ERROR_OPERATION_FAILED Operation failed
+ * @retval #WIFI_AWARE_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #WIFI_AWARE_ERROR_NOT_INITIALIZED Not initialized
* @see wifi_aware_session_publish()
* @see wifi_aware_session_subscribe()
*/
@@ -558,7 +378,15 @@ int wifi_aware_session_stop(wifi_aware_session_h session);
/**
* @brief Called when publish request is finished.
- * @since_tizen 6.0
+ * @details The following error codes can be received: \n
+ * #WIFI_AWARE_ERROR_NONE Successful \n
+ * #WIFI_AWARE_ERROR_INVALID_PARAMETER Invalid function parameter \n
+ * #WIFI_AWARE_ERROR_INVALID_OPERATION Invalid operation \n
+ * #WIFI_AWARE_ERROR_OPERATION_FAILED Operation failed \n
+ * #WIFI_AWARE_ERROR_PERMISSION_DENIED Permission denied \n
+ * #WIFI_AWARE_ERROR_NOT_SUPPORTED Not supported
+ * @since_tizen 9.0
+ * @remarks The @a session should not be released.
* @param[in] session The Wi-Fi Aware Session handle
* @param[in] error The error code
* @param[in] user_data The user data passed from request function
@@ -570,20 +398,20 @@ typedef void(*wifi_aware_published_cb)(wifi_aware_session_h session,
/**
* @brief Publishes a Wi-Fi Aware service so that neighboring devices can find it.
- * @since_tizen 6.0
+ * @since_tizen 9.0
* @privlevel public
* @privilege %http://tizen.org/privilege/network.set
- * @param[in] sesssion The Wi-Fi Aware Session handle
+ * @param[in] session The Wi-Fi Aware Session handle
* @param[in] publish The Wi-Fi Aware Publish handle
* @param[in] callback The callback which gets called when a service is published
* @param[in] user_data The user data passed to the callback function
* @return 0 on success, otherwise a negative error value
- * @retval #WIFI_AWARE_ERROR_NONE
- * @retval #WIFI_AWARE_ERROR_INVALID_PARAMETER
- * @retval #WIFI_AWARE_ERROR_INVALID_OPERATION
- * @retval #WIFI_AWARE_ERROR_OPERATION_FAILED
- * @retval #WIFI_AWARE_ERROR_PERMISSION_DENIED
- * @retval #WIFI_AWARE_ERROR_NOT_INITIALIZED
+ * @retval #WIFI_AWARE_ERROR_NONE Successful
+ * @retval #WIFI_AWARE_ERROR_INVALID_PARAMETER Invalid function parameter
+ * @retval #WIFI_AWARE_ERROR_INVALID_OPERATION Invalid operation
+ * @retval #WIFI_AWARE_ERROR_OPERATION_FAILED Operation failed
+ * @retval #WIFI_AWARE_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #WIFI_AWARE_ERROR_NOT_INITIALIZED Not initialized
* @see wifi_aware_session_stop()
*/
int wifi_aware_session_publish(wifi_aware_session_h session,
@@ -593,20 +421,20 @@ int wifi_aware_session_publish(wifi_aware_session_h session,
/**
* @brief Updates the configuration for a Wi-Fi Aware service that has already been published.
- * @since_tizen 6.0
+ * @since_tizen 9.0
* @privlevel public
* @privilege %http://tizen.org/privilege/network.set
- * @param[in] sesssion The Wi-Fi Aware Session handle
+ * @param[in] session The Wi-Fi Aware Session handle
* @param[in] publish The Wi-Fi Aware Publish handle
* @param[in] callback The callback which gets called when a service is updated
* @param[in] user_data The user data passed to the callback function
* @return 0 on success, otherwise a negative error value
- * @retval #WIFI_AWARE_ERROR_NONE
- * @retval #WIFI_AWARE_ERROR_INVALID_PARAMETER
- * @retval #WIFI_AWARE_ERROR_INVALID_OPERATION
- * @retval #WIFI_AWARE_ERROR_OPERATION_FAILED
- * @retval #WIFI_AWARE_ERROR_PERMISSION_DENIED
- * @retval #WIFI_AWARE_ERROR_NOT_INITIALIZED
+ * @retval #WIFI_AWARE_ERROR_NONE Successful
+ * @retval #WIFI_AWARE_ERROR_INVALID_PARAMETER Invalid function parameter
+ * @retval #WIFI_AWARE_ERROR_INVALID_OPERATION Invalid operation
+ * @retval #WIFI_AWARE_ERROR_OPERATION_FAILED Operation failed
+ * @retval #WIFI_AWARE_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #WIFI_AWARE_ERROR_NOT_INITIALIZED Not initialized
* @see wifi_aware_session_publish()
*/
int wifi_aware_session_update_publish(wifi_aware_session_h session,
@@ -615,7 +443,15 @@ int wifi_aware_session_update_publish(wifi_aware_session_h session,
/**
* @brief Called when Subscribe request is finished.
- * @since_tizen 6.0
+ * @details The following error codes can be received: \n
+ * #WIFI_AWARE_ERROR_NONE Successful \n
+ * #WIFI_AWARE_ERROR_INVALID_PARAMETER Invalid function parameter \n
+ * #WIFI_AWARE_ERROR_INVALID_OPERATION Invalid operation \n
+ * #WIFI_AWARE_ERROR_OPERATION_FAILED Operation failed \n
+ * #WIFI_AWARE_ERROR_PERMISSION_DENIED Permission denied \n
+ * #WIFI_AWARE_ERROR_NOT_SUPPORTED Not supported
+ * @since_tizen 9.0
+ * @remarks The @a session should not be released.
* @param[in] session The Wi-Fi Aware Session handle
* @param[in] error The error code
* @param[in] user_data The user data passed from request function
@@ -626,7 +462,7 @@ typedef void(*wifi_aware_subscribed_cb)(wifi_aware_session_h session,
/**
* @brief Starts to find Wi-Fi Aware services.
- * @since_tizen 6.0
+ * @since_tizen 9.0
* @privlevel public
* @privilege %http://tizen.org/privilege/network.set
* @param[in] session The Wi-Fi Aware Session handle
@@ -634,21 +470,21 @@ typedef void(*wifi_aware_subscribed_cb)(wifi_aware_session_h session,
* @param[in] callback The callback which get called when request is finished
* @param[in] user_data The user data passed to the callback function
* @return 0 on success, otherwise a negative error value
- * @retval #WIFI_AWARE_ERROR_NONE
- * @retval #WIFI_AWARE_ERROR_INVALID_PARAMETER
- * @retval #WIFI_AWARE_ERROR_INVALID_OPERATION
- * @retval #WIFI_AWARE_ERROR_OPERATION_FAILED
- * @retval #WIFI_AWARE_ERROR_PERMISSION_DENIED
- * @retval #WIFI_AWARE_ERROR_NOT_INITIALIZED
+ * @retval #WIFI_AWARE_ERROR_NONE Successful
+ * @retval #WIFI_AWARE_ERROR_INVALID_PARAMETER Invalid function parameter
+ * @retval #WIFI_AWARE_ERROR_INVALID_OPERATION Invalid operation
+ * @retval #WIFI_AWARE_ERROR_OPERATION_FAILED Operation failed
+ * @retval #WIFI_AWARE_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #WIFI_AWARE_ERROR_NOT_INITIALIZED Not initialized
* @see wifi_aware_session_stop()
*/
-int wifi_aware_session_subscribe(wifi_aware_session_h,
+int wifi_aware_session_subscribe(wifi_aware_session_h session,
wifi_aware_subscribe_h subscribe,
wifi_aware_subscribed_cb callback, void *user_data);
/**
* @brief Updates the configuration for a Wi-Fi Aware service that has already been subscribed.
- * @since_tizen 6.0
+ * @since_tizen 9.0
* @privlevel public
* @privilege %http://tizen.org/privilege/network.set
* @param[in] session The Wi-Fi Aware Session handle
@@ -656,12 +492,12 @@ int wifi_aware_session_subscribe(wifi_aware_session_h,
* @param[in] callback The callback which gets called when service is updated
* @param[in] user_data The user data passed to the callback function
* @return 0 on success, otherwise a negative error value
- * @retval #WIFI_AWARE_ERROR_NONE
- * @retval #WIFI_AWARE_ERROR_INVALID_PARAMETER
- * @retval #WIFI_AWARE_ERROR_INVALID_OPERATION
- * @retval #WIFI_AWARE_ERROR_OPERATION_FAILED
- * @retval #WIFI_AWARE_ERROR_PERMISSION_DENIED
- * @retval #WIFI_AWARE_ERROR_NOT_INITIALIZED
+ * @retval #WIFI_AWARE_ERROR_NONE Successful
+ * @retval #WIFI_AWARE_ERROR_INVALID_PARAMETER Invalid function parameter
+ * @retval #WIFI_AWARE_ERROR_INVALID_OPERATION Invalid operation
+ * @retval #WIFI_AWARE_ERROR_OPERATION_FAILED Operation failed
+ * @retval #WIFI_AWARE_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #WIFI_AWARE_ERROR_NOT_INITIALIZED Not initialized
* @see wifi_aware_session_subscribe()
*/
int wifi_aware_session_update_subscribe(wifi_aware_session_h session,
@@ -670,14 +506,16 @@ int wifi_aware_session_update_subscribe(wifi_aware_session_h session,
/**
* @brief Called whenever a matched service for the subscribe configurations is found.
- * @since_tizen 6.0
- * @remark If the publisher doesn't enabled ranging or the subscriber doesn't set both max and min distance,\n
- * @a distance would be negative value.
+ * @since_tizen 9.0
+ * @remarks If the publisher doesn't enabled ranging or the subscriber doesn't set both max and min distance,\n
+ * @a distance would be negative value.\n
+ * The @a session and @a peer should not be released.
* @param[in] session The Wi-Fi Aware Session handle
* @param[in] peer The found Peer information
* @param[in] service_specific_info Sequence of octets which were received from published service
* @param[in] service_specific_info_len The length of @a service_specific_info
* @param[in] distance The distance to the peer
+ * @param[in] user_data The user data passed to the callback function
* @see wifi_aware_session_set_service_discovered_cb()
* @see wifi_aware_session_unset_service_discovered_cb()
*/
@@ -688,35 +526,43 @@ typedef void(*wifi_aware_service_discovered_cb)(wifi_aware_session_h session,
void *user_data);
/**
- * @brief Registers a callback function to notify a service is discovered.
- * @since_tizen 6.0
+ * @brief Sets a callback function to notify a service is discovered.
+ * @since_tizen 9.0
* @param[in] session The Wi-Fi Aware Session handle
* @param[in] callback The callback function to register
* @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_AWARE_ERROR_NONE
- * @retval #WIFI_AWARE_ERROR_INVALID_PARAMETER
- * @retval #WIFI_AWARE_ERROR_NOT_INITIALIZED
+ * @retval #WIFI_AWARE_ERROR_NONE Successful
+ * @retval #WIFI_AWARE_ERROR_INVALID_PARAMETER Invalid function parameter
+ * @retval #WIFI_AWARE_ERROR_NOT_INITIALIZED Not initialized
* @see wifi_aware_session_unset_service_discovered_cb()
*/
int wifi_aware_session_set_service_discovered_cb(wifi_aware_session_h session,
wifi_aware_service_discovered_cb callback, void *user_data);
/**
- * @brief Unregisters the service discovered callback function.
- * @since_tizen 6.0
+ * @brief Unsets the service discovered callback function.
+ * @since_tizen 9.0
* @param[in] session The Wi-Fi Aware Session handle
* @return 0 on success, otherwise a negative error value
- * @retval #WIFI_AWARE_ERROR_NONE
- * @retval #WIFI_AWARE_ERROR_INVALID_PARAMETER
- * @retval #WIFI_AWARE_ERROR_NOT_INITIALIZED
+ * @retval #WIFI_AWARE_ERROR_NONE Successful
+ * @retval #WIFI_AWARE_ERROR_INVALID_PARAMETER Invalid function parameter
+ * @retval #WIFI_AWARE_ERROR_NOT_INITIALIZED Not initialized
* @see wifi_aware_session_set_service_discovered_cb()
*/
int wifi_aware_session_unset_service_discovered_cb(wifi_aware_session_h session);
/**
* @brief Called when a message is sent to a peer.
- * @since_tizen 6.0
+ * @details The following error codes can be received: \n
+ * #WIFI_AWARE_ERROR_NONE Successful \n
+ * #WIFI_AWARE_ERROR_INVALID_PARAMETER Invalid function parameter \n
+ * #WIFI_AWARE_ERROR_INVALID_OPERATION Invalid operation \n
+ * #WIFI_AWARE_ERROR_OPERATION_FAILED Operation failed \n
+ * #WIFI_AWARE_ERROR_PERMISSION_DENIED Permission denied \n
+ * #WIFI_AWARE_ERROR_NOT_SUPPORTED Not supported
+ * @since_tizen 9.0
+ * @remarks The @a session should not be released.
* @param[in] session The Wi-Fi Aware Session handle
* @param[in] error The error code
* @param[in] user_data The user data passed from request function
@@ -725,8 +571,8 @@ typedef void(*wifi_aware_send_message_result_cb)(wifi_aware_session_h session,
wifi_aware_error_e error, void *user_data);
/**
- * @brief Sends the message to a peer
- * @since_tizen 6.0
+ * @brief Sends the message to a peer.
+ * @since_tizen 9.0
* @privlevel public
* @privilege %http://tizen.org/privilege/network.set
* @param[in] session The Wi-Fi Aware Session handle
@@ -736,13 +582,13 @@ typedef void(*wifi_aware_send_message_result_cb)(wifi_aware_session_h session,
* @param[in] callback The callback function
* @param[in] user_data The user data passed to the callback function
* @return 0 on success, otherwise a negative error value
- * @retval #WIFI_AWARE_ERROR_NONE
- * @retval #WIFI_AWARE_ERROR_INVALID_OPERATION
- * @retval #WIFI_AWARE_ERROR_INVALID_PARAMETER
- * @retval #WIFI_AWARE_ERROR_OUT_OF_MEMORY
- * @retval #WIFI_AWARE_ERROR_OPERATION_FAILED
- * @retval #WIFI_AWARE_ERROR_PERMISSION_DENIED
- * @retval #WIFI_AWARE_ERROR_NOT_INITIALIZED
+ * @retval #WIFI_AWARE_ERROR_NONE Successful
+ * @retval #WIFI_AWARE_ERROR_INVALID_OPERATION Invalid operation
+ * @retval #WIFI_AWARE_ERROR_INVALID_PARAMETER Invalid function parameter
+ * @retval #WIFI_AWARE_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #WIFI_AWARE_ERROR_OPERATION_FAILED Operation failed
+ * @retval #WIFI_AWARE_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #WIFI_AWARE_ERROR_NOT_INITIALIZED Not initialized
*/
int wifi_aware_session_send_message(
wifi_aware_session_h session,
@@ -752,11 +598,13 @@ int wifi_aware_session_send_message(
/**
* @brief Called whenever receiving a message from a peer.
- * @since_tizen 6.0
+ * @since_tizen 9.0
+ * @remarks The @a session and @a peer should not be released.
* @param[in] session The Wi-Fi Aware Session handle
* @param[in] peer The peer who sent the message
* @param[in] message The message which is sent
* @param[in] len The length of the message
+ * @param[in] user_data The user data passed to the callback function
* @see wifi_aware_session_set_message_received_cb()
* @see wifi_aware_session_unset_message_received_cb()
*/
@@ -766,94 +614,150 @@ typedef void(*wifi_aware_message_received_cb)(
const unsigned char *message, size_t len, void *user_data);
/**
- * @brief Registers a callback function to deliver received message from a peer.
- * @since_tizen 6.0
+ * @brief Sets a callback function to deliver received message from a peer.
+ * @since_tizen 9.0
* @param[in] session The Wi-Fi Aware Session handle
* @param[in] callback The callback function which gets called
- * @param[in] user_data The user data paseed to @a callback
+ * @param[in] user_data The user data passed to @a callback
* @return 0 on success, otherwise a negative error value
- * @retval #WIFI_AWARE_ERROR_NONE
- * @retval #WIFI_AWARE_ERROR_INVALID_PARAMETER
- * @retval #WIFI_AWARE_ERROR_NOT_INITIALIZED
+ * @retval #WIFI_AWARE_ERROR_NONE Successful
+ * @retval #WIFI_AWARE_ERROR_INVALID_PARAMETER Invalid function parameter
+ * @retval #WIFI_AWARE_ERROR_NOT_INITIALIZED Not initialized
* @see wifi_aware_session_unset_message_received_cb()
*/
int wifi_aware_session_set_message_received_cb(wifi_aware_session_h session,
wifi_aware_message_received_cb callback, void *user_data);
/**
- * @brief Unregisters a callback function for received message.
- * @since_tizen 6.0
+ * @brief Unsets a callback function for received message.
+ * @since_tizen 9.0
* @param[in] session The Wi-Fi Aware Session handle
* @return 0 on success, otherwise a negative error value
- * @retval #WIFI_AWARE_ERROR_NONE
- * @retval #WIFI_AWARE_ERROR_INVALID_PARAMETER
- * @retval #WIFI_AWARE_ERROR_NOT_INITIALIZED
+ * @retval #WIFI_AWARE_ERROR_NONE Successful
+ * @retval #WIFI_AWARE_ERROR_INVALID_PARAMETER Invalid function parameter
+ * @retval #WIFI_AWARE_ERROR_NOT_INITIALIZED Not initialized
* @see wifi_aware_session_set_message_received_cb()
*/
int wifi_aware_session_unset_message_received_cb(wifi_aware_session_h session);
/**
* @brief Copies a Peer handle.
- * @since_tizen 6.0
+ * @since_tizen 9.0
+ * @remarks The @a cloned should be released using wifi_aware_peer_destroy().
* @param[out] cloned The Peer handle copied from @a origin
* @param[in] origin The origin Peer handle
- * @remark The cloned Peer handle has to be freed by wifi_aware_peer_destroy()
* @return 0 on success, otherwise a negative error value
- * @retval #WIFI_AWARE_ERROR_NONE
- * @retval #WIFI_AWARE_ERROR_INVALID_PARAMETER
- * @retval #WIFI_AWARE_ERROR_OUT_OF_MEMORY
- * @retval #WIFI_AWARE_ERROR_NOT_INITIALIZED
+ * @retval #WIFI_AWARE_ERROR_NONE Successful
+ * @retval #WIFI_AWARE_ERROR_INVALID_PARAMETER Invalid function parameter
+ * @retval #WIFI_AWARE_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #WIFI_AWARE_ERROR_NOT_INITIALIZED Not initialized
+ *
+ * @par Here is an example of the usage:
+ * @code
+ *
+ * wifi_aware_peer_h cloned_peer;
+ * int ret = 0;
+ *
+ * ret = wifi_aware_peer_clone(&cloned_peer, src_peer);
+ * if (ret != WIFI_AWARE_ERROR_NONE) {
+ * printf("Failed to clone the peer\n");
+ * return;
+ * }
+ *
+ * // Do stuff here for cloned peer
+ *
+ * wifi_aware_peer_destroy(cloned_peer);
+ *
+ * @endcode
* @see wifi_aware_peer_destroy()
*/
int wifi_aware_peer_clone(wifi_aware_peer_h *cloned, wifi_aware_peer_h origin);
/**
- * @brief Destroys a Peer handle
- * @since_tizen 6.0
+ * @brief Destroys a Peer handle.
+ * @since_tizen 9.0
* @param[in] peer The Peer handle
* @return 0 on success, otherwise a negative error value
- * @retval #WIFI_AWARE_ERROR_NONE
- * @retval #WIFI_AWARE_ERROR_INVALID_PARAMETER
- * @retval #WIFI_AWARE_ERROR_NOT_INITIALIZED
+ * @retval #WIFI_AWARE_ERROR_NONE Successful
+ * @retval #WIFI_AWARE_ERROR_INVALID_PARAMETER Invalid function parameter
+ * @retval #WIFI_AWARE_ERROR_NOT_INITIALIZED Not initialized
* @see wifi_aware_peer_clone()
*/
int wifi_aware_peer_destroy(wifi_aware_peer_h peer);
/**
* @brief Gets the MAC address (NAN Management Interface) of Wi-Fi Aware peer.
- * @remarks @a mac should be freed using free().
- * @since_tizen 6.0
+ * @since_tizen 9.0
+ * @remarks The @a mac should be freed using free().
* @param[in] peer The Peer handle
* @param[out] mac The MAC address of the peer
* @return 0 on success, otherwise a negative error value
- * @retval #WIFI_AWARE_ERROR_NONE
- * @retval #WIFI_AWARE_ERROR_INVALID_PARAMETER
- * @retval #WIFI_AWARE_ERROR_OUT_OF_MEMORY
- * @retval #WIFI_AWARE_ERROR_NOT_INITIALIZED
+ * @retval #WIFI_AWARE_ERROR_NONE Successful
+ * @retval #WIFI_AWARE_ERROR_INVALID_PARAMETER Invalid function parameter
+ * @retval #WIFI_AWARE_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #WIFI_AWARE_ERROR_NOT_INITIALIZED Not initialized
+ *
+ * @par Here is an example of the usage:
+ * @code
+ *
+ * peer_info *info = (peer_info *)data;
+ * unsigned char *mac = NULL;
+ * int ret = 0;
+ *
+ * ret = wifi_aware_peer_get_mac(info->peer, &mac);
+ * if (ret != WIFI_AWARE_ERROR_NONE) {
+ * printf("Failed to get mac of the peer\n");
+ * return;
+ * }
+ *
+ * // Do stuff here for the mac
+ *
+ * free(mac);
+ *
+ * @endcode
*/
int wifi_aware_peer_get_mac(wifi_aware_peer_h peer, unsigned char **mac);
/**
* @brief Enumeration for Wi-Fi Aware security type.
- * @since_tizen 6.0
+ * @since_tizen 9.0
*/
typedef enum {
- WIFI_AWARE_SECURITY_TYPE_OPEN,
- WIFI_AWARE_SECURITY_TYPE_PSK,
- WIFI_AWARE_SECURITY_TYPE_PMK,
+ WIFI_AWARE_SECURITY_TYPE_OPEN, /**< Wi-Fi Aware security type: Open */
+ WIFI_AWARE_SECURITY_TYPE_PSK, /**< Wi-Fi Aware security type: PSK */
+ WIFI_AWARE_SECURITY_TYPE_PMK, /**< Wi-Fi Aware security type: PMK */
} wifi_aware_security_type_e;
/**
* @brief Creates a handle to be used for Wi-Fi Aware Data Path.
- * @since_tizen 6.0
+ * @since_tizen 9.0
+ * @remarks The @a data_path should be released using wifi_aware_data_path_destroy().
* @param[in] session The Wi-Fi Aware Session handle
* @param[in] peer The Peer handle
* @param[out] data_path The Data Path handle
* @return 0 on success, otherwise a negative error value
- * @retval #WIFI_AWARE_ERROR_NONE
- * @retval #WIFI_AWARE_ERROR_INVALID_PARAMETER
- * @retval #WIFI_AWARE_ERROR_OUT_OF_MEMORY
- * @retval #WIFI_AWARE_ERROR_NOT_INITIALIZED
+ * @retval #WIFI_AWARE_ERROR_NONE Successful
+ * @retval #WIFI_AWARE_ERROR_INVALID_PARAMETER Invalid function parameter
+ * @retval #WIFI_AWARE_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #WIFI_AWARE_ERROR_NOT_INITIALIZED Not initialized
+ *
+ * @par Here is an example of the usage:
+ * @code
+ *
+ * wifi_aware_data_path_h data_path;
+ * int ret = 0;
+ *
+ * ret = wifi_aware_data_path_create(g_session, g_peer, &data_path);
+ * if (ret != WIFI_AWARE_ERROR_NONE) {
+ * printf("Failed to create data path\n");
+ * return;
+ * }
+ *
+ * // Do stuff here for the data path
+ *
+ * wifi_aware_data_path_destroy(data_path);
+ *
+ * @endcode
* @see wifi_aware_data_path_destroy()
*/
int wifi_aware_data_path_create(wifi_aware_session_h session, wifi_aware_peer_h peer,
@@ -861,79 +765,86 @@ int wifi_aware_data_path_create(wifi_aware_session_h session, wifi_aware_peer_h
/**
* @brief Sets a security type for Wi-Fi Aware Data Path.
- * @since_tizen 6.0
+ * @since_tizen 9.0
* @param[in] data_path The Data Path handle
* @param[in] security_type The security type
* @return 0 on success, otherwise a negative error value
- * @retval #WIFI_AWARE_ERROR_NONE
- * @retval #WIFI_AWARE_ERROR_INVALID_PARAMETER
- * @retval #WIFI_AWARE_ERROR_NOT_INITIALIZED
+ * @retval #WIFI_AWARE_ERROR_NONE Successful
+ * @retval #WIFI_AWARE_ERROR_INVALID_PARAMETER Invalid function parameter
+ * @retval #WIFI_AWARE_ERROR_NOT_INITIALIZED Not initialized
* @see wifi_aware_data_path_create()
*/
int wifi_aware_data_path_set_security(wifi_aware_data_path_h data_path, wifi_aware_security_type_e security_type);
/**
* @brief Sets a passphrase for Wi-Fi Aware Data Path.
- * @since_tizen 6.0
+ * @since_tizen 9.0
+ * @remarks The @a key can be used only when secure type is #WIFI_AWARE_SECURITY_TYPE_PSK.
* @param[in] data_path The Data Path handle
* @param[in] key The passphrase
- * @remark @a key can be used only when secury type is WIFI_AWARE_SECURITY_TYPE_PSK.
* @return 0 on success, otherwise a negative error value
- * @retval #WIFI_AWARE_ERROR_NONE
- * @retval #WIFI_AWARE_ERROR_INVALID_PARAMETER
- * @retval #WIFI_AWARE_ERROR_INVALID_OPERATION
- * @retval #WIFI_AWARE_ERROR_NOT_INITIALIZED
+ * @retval #WIFI_AWARE_ERROR_NONE Successful
+ * @retval #WIFI_AWARE_ERROR_INVALID_PARAMETER Invalid function parameter
+ * @retval #WIFI_AWARE_ERROR_INVALID_OPERATION Invalid operation
+ * @retval #WIFI_AWARE_ERROR_NOT_INITIALIZED Not initialized
* @see wifi_aware_data_path_create()
*/
int wifi_aware_data_path_set_psk(wifi_aware_data_path_h data_path, const char *key);
/**
* @brief Sets a PMK for Wi-Fi Aware Data Path.
- * @since_tizen 6.0
- * @remark @key can be used only when security type is WIFI_AWARE_SECURITY_TYPE_PMK.
+ * @since_tizen 9.0
+ * @remarks The @a key can be used only when security type is #WIFI_AWARE_SECURITY_TYPE_PMK.
* @param[in] data_path The Data Path handle
* @param[in] key Pairwise Master Key. Its length shall be of length 32.
* @return 0 on success, otherwise a negative error value
- * @retval #WIFI_AWARE_ERROR_NONE
- * @retval #WIFI_AWARE_ERROR_INVALID_PARAMETER
- * @retval #WIFI_AWARE_ERROR_INVALID_OPERATION
- * @retval #WIFI_AWARE_ERROR_NOT_INITIALIZED
+ * @retval #WIFI_AWARE_ERROR_NONE Successful
+ * @retval #WIFI_AWARE_ERROR_INVALID_PARAMETER Invalid function parameter
+ * @retval #WIFI_AWARE_ERROR_INVALID_OPERATION Invalid operation
+ * @retval #WIFI_AWARE_ERROR_NOT_INITIALIZED Not initialized
* @see wifi_aware_data_path_create()
*/
int wifi_aware_data_path_set_pmk(wifi_aware_data_path_h data_path, const unsigned char *key);
/**
* @brief Sets a port for Wi-Fi Aware Data Path.
- * @since_tizen 6.0
+ * @since_tizen 9.0
+ * @remarks The @a port cannot be exceed 65535.
* @param[in] data_path The Data Path handle
* @param[in] port The port
- * @remarks @a port cannot be exceed 65535.
* @return 0 on success, otherwise a negative error value
- * @retval #WIFI_AWARE_ERROR_NONE
- * @retval #WIFI_AWARE_ERROR_INVALID_PARAMETER
- * @retval #WIFI_AWARE_ERROR_NOT_INITIALIZED
+ * @retval #WIFI_AWARE_ERROR_NONE Successful
+ * @retval #WIFI_AWARE_ERROR_INVALID_PARAMETER Invalid function parameter
+ * @retval #WIFI_AWARE_ERROR_NOT_INITIALIZED Not initialized
* @see wifi_aware_data_path_create()
*/
int wifi_aware_data_path_set_port(wifi_aware_data_path_h data_path, int port);
/**
* @brief Destroys a handle for Wi-Fi Aware Data Path.
- * @since_tizen 6.0
+ * @since_tizen 9.0
* @param[in] data_path The Data Path handle
* @return 0 on success, otherwise a negative error value
- * @retval #WIFI_AWARE_ERROR_NONE
- * @retval #WIFI_AWARE_ERROR_INVALID_PARAMETER
- * @retval #WIFI_AWARE_ERROR_NOT_INITIALIZED
+ * @retval #WIFI_AWARE_ERROR_NONE Successful
+ * @retval #WIFI_AWARE_ERROR_INVALID_PARAMETER Invalid function parameter
+ * @retval #WIFI_AWARE_ERROR_NOT_INITIALIZED Not initialized
* @see wifi_aware_data_path_create()
*/
int wifi_aware_data_path_destroy(wifi_aware_data_path_h data_path);
/**
* @brief Called when Data Path open request is done.
- * @since_tizen 6.0
+ * @details The following error codes can be received: \n
+ * #WIFI_AWARE_ERROR_NONE Successful \n
+ * #WIFI_AWARE_ERROR_INVALID_PARAMETER Invalid function parameter \n
+ * #WIFI_AWARE_ERROR_INVALID_OPERATION Invalid operation \n
+ * #WIFI_AWARE_ERROR_OPERATION_FAILED Operation failed \n
+ * #WIFI_AWARE_ERROR_PERMISSION_DENIED Permission denied \n
+ * #WIFI_AWARE_ERROR_NOT_SUPPORTED Not supported
+ * @since_tizen 9.0
+ * @remarks The @a data_path should not be released.
* @param[in] data_path The Data Path handle
* @param[in] error The result of the open request
- * @param[in] mac The peer's NDI (NAN Data Interface)
* @param[in] user_data The user data passed from request function
* @see wifi_aware_data_path_open()
*/
@@ -942,20 +853,20 @@ typedef void(*wifi_aware_data_path_open_cb)(wifi_aware_data_path_h data_path, wi
/**
* @brief Requests to open a Wi-Fi Aware Data Path.
- * @remarks The @a callback will be always invoked whether the open request succeeds or fails.
- * @since_tizen 6.0
+ * @since_tizen 9.0
* @privlevel public
* @privilege %http://tizen.org/privilege/network.set
+ * @remarks The @a callback will be always invoked whether the open request succeeds or fails.
* @param[in] data_path The Data Path handle
* @param[in] callback The callback function
* @param[in] user_data The user data passed to the callback function
* @return 0 on success, otherwise a negative error value
- * @retval #WIFI_AWARE_ERROR_NONE
- * @retval #WIFI_AWARE_ERROR_INVALID_OPERATION
- * @retval #WIFI_AWARE_ERROR_INVALID_PARAMETER
- * @retval #WIFI_AWARE_ERROR_OPERATION_FAILED
- * @retval #WIFI_AWARE_ERROR_PERMISSION_DENIED
- * @retval #WIFI_AWARE_ERROR_NOT_INITIALIZED
+ * @retval #WIFI_AWARE_ERROR_NONE Successful
+ * @retval #WIFI_AWARE_ERROR_INVALID_OPERATION Invalid operation
+ * @retval #WIFI_AWARE_ERROR_INVALID_PARAMETER Invalid function parameter
+ * @retval #WIFI_AWARE_ERROR_OPERATION_FAILED Operation failed
+ * @retval #WIFI_AWARE_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #WIFI_AWARE_ERROR_NOT_INITIALIZED Not initialized
* @see wifi_aware_data_path_close()
*/
int wifi_aware_data_path_open(wifi_aware_data_path_h data_path,
@@ -963,64 +874,102 @@ int wifi_aware_data_path_open(wifi_aware_data_path_h data_path,
/**
* @brief Closes a Wi-Fi Aware Data Path.
- * @since_tizen 6.0
+ * @since_tizen 9.0
* @privlevel public
* @privilege %http://tizen.org/privilege/network.set
* @param[in] data_path The Data Path handle
- * @retval #WIFI_AWARE_ERROR_NONE
- * @retval #WIFI_AWARE_ERROR_INVALID_OPERATION
- * @retval #WIFI_AWARE_ERROR_INVALID_PARAMETER
- * @retval #WIFI_AWARE_ERROR_OPERATION_FAILED
- * @retval #WIFI_AWARE_ERROR_PERMISSION_DENIED
- * @retval #WIFI_AWARE_ERROR_NOT_INITIALIZED
+ * @return 0 on success, otherwise a negative error value
+ * @retval #WIFI_AWARE_ERROR_NONE Successful
+ * @retval #WIFI_AWARE_ERROR_INVALID_OPERATION Invalid operation
+ * @retval #WIFI_AWARE_ERROR_INVALID_PARAMETER Invalid function parameter
+ * @retval #WIFI_AWARE_ERROR_OPERATION_FAILED Operation failed
+ * @retval #WIFI_AWARE_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #WIFI_AWARE_ERROR_NOT_INITIALIZED Not initialized
* @see wifi_aware_data_path_open()
*/
int wifi_aware_data_path_close(wifi_aware_data_path_h data_path);
/**
* @brief Gets a port of a peer.
- * @since_tizen 6.0
+ * @since_tizen 9.0
* @param[in] data_path The Data Path handle
* @param[out] port The port
* @return 0 on success, otherwise a negative error value
- * @retval #WIFI_AWARE_ERROR_NONE
- * @retval #WIFI_AWARE_ERROR_INVALID_PARAMETER
- * @retval #WIFI_AWARE_ERROR_INVALID_OPERATION
- * @retval #WIFI_AWARE_ERROR_NOT_INITIALIZED
+ * @retval #WIFI_AWARE_ERROR_NONE Successful
+ * @retval #WIFI_AWARE_ERROR_INVALID_PARAMETER Invalid function parameter
+ * @retval #WIFI_AWARE_ERROR_INVALID_OPERATION Invalid operation
+ * @retval #WIFI_AWARE_ERROR_NOT_INITIALIZED Not initialized
*/
int wifi_aware_data_path_get_peer_port(wifi_aware_data_path_h data_path, int* port);
/**
- * @brief Gets an IPv6 address of a peer
- * @remarks @a ipv6_address should be freed by using free().
- * @since_tizen 6.0
+ * @brief Gets an IPv6 address of a peer.
+ * @since_tizen 9.0
+ * @remarks The @a ipv6_address should be freed by using free().
* @param[in] data_path The Data Path handle
* @param[out] ipv6_address The IPv6 address of a peer
* @return 0 on success, otherwise a negative error value
- * @retval #WIFI_AWARE_ERROR_NONE
- * @retval #WIFI_AWARE_ERROR_INVALID_PARAMETER
- * @retval #WIFI_AWARE_ERROR_INVALID_OPERATION
- * @retval #WIFI_AWARE_ERROR_NOT_INITIALIZED
+ * @retval #WIFI_AWARE_ERROR_NONE Successful
+ * @retval #WIFI_AWARE_ERROR_INVALID_PARAMETER Invalid function parameter
+ * @retval #WIFI_AWARE_ERROR_INVALID_OPERATION Invalid operation
+ * @retval #WIFI_AWARE_ERROR_NOT_INITIALIZED Not initialized
+ *
+ * @par Here is an example of the usage:
+ * @code
+ *
+ * int ret = 0;
+ * char *ipv6 = NULL;
+ *
+ * ret = wifi_aware_data_path_get_peer_ipv6_address(g_data_path, &ipv6);
+ * if (ret != WIFI_AWARE_ERROR_NONE) {
+ * printf("Failed to get IPv6 address of the peer\n");
+ * return;
+ * }
+ *
+ * // Do stuff here for the IPv6 address of the peer
+ *
+ * free(ipv6);
+ *
+ * @endcode
*/
int wifi_aware_data_path_get_peer_ipv6_address(wifi_aware_data_path_h data_path, char **ipv6_address);
/**
- * @brief Gets Interface name for Wi-Fi Aware Data Path
- * @remarks @a interface should be freed by using free().
- * @since_tizen 6.0
+ * @brief Gets Interface name for Wi-Fi Aware Data Path.
+ * @since_tizen 9.0
+ * @remarks The @a interface should be freed by using free().
* @param[in] data_path The Data Path handle
* @param[out] interface The interface name
* @return 0 on success, otherwise a negative error value
- * @retval #WIFI_AWARE_ERROR_NONE
- * @retval #WIFI_AWARE_ERROR_INVALID_PARAMETER
- * @retval #WIFI_AWARE_ERROR_INVALID_OPERATION
- * @retval #WIFI_AWARE_ERROR_NOT_INITIALIZED
+ * @retval #WIFI_AWARE_ERROR_NONE Successful
+ * @retval #WIFI_AWARE_ERROR_INVALID_PARAMETER Invalid function parameter
+ * @retval #WIFI_AWARE_ERROR_INVALID_OPERATION Invalid operation
+ * @retval #WIFI_AWARE_ERROR_NOT_INITIALIZED Not initialized
+ *
+ * @par Here is an example of the usage:
+ * @code
+ *
+ * int ret = 0;
+ * char *interface = NULL;
+ *
+ * ret = wifi_aware_data_path_get_interface(g_data_path, &interface);
+ * if (ret != WIFI_AWARE_ERROR_NONE) {
+ * printf("Failed to get interface name\n");
+ * return;
+ * }
+ *
+ * // Do stuff here for the interface name
+ *
+ * free(interface);
+ *
+ * @endcode
*/
int wifi_aware_data_path_get_interface(wifi_aware_data_path_h data_path, char **interface);
/**
* @brief Called when the Wi-Fi Aware Data Path has been lost.
- * @since_tizen 6.0
+ * @since_tizen 9.0
+ * @remarks The @a data_path should not be released.
* @param[in] data_path The terminated Data Path handle
* @param[in] reason The reason of termination
* @param[in] user_data The user data passed from request function
@@ -1030,27 +979,27 @@ int wifi_aware_data_path_get_interface(wifi_aware_data_path_h data_path, char **
typedef void(*wifi_aware_data_path_terminated_cb)(wifi_aware_data_path_h data_path, wifi_aware_termination_reason_e reason, void *user_data);
/**
- * @brief Registers a callback function to notify a Data Path termination.
- * @since_tizen 6.0
+ * @brief Sets a callback function to notify a Data Path termination.
+ * @since_tizen 9.0
* @param[in] data_path The Data Path handle
* @param[in] callback The callback function
- * @param[in] user_data The user data paseed to the callback function
+ * @param[in] user_data The user data passed to the callback function
* @return 0 on success, otherwise a negative error value
- * @retval #WIFI_AWARE_ERROR_NONE
- * @retval #WIFI_AWARE_ERROR_INVALID_PARAMETER
- * @retval #WIFI_AWARE_ERROR_NOT_INITIALIZED
+ * @retval #WIFI_AWARE_ERROR_NONE Successful
+ * @retval #WIFI_AWARE_ERROR_INVALID_PARAMETER Invalid function parameter
+ * @retval #WIFI_AWARE_ERROR_NOT_INITIALIZED Not initialized
* @see wifi_aware_data_path_unset_terminated_cb()
*/
int wifi_aware_data_path_set_terminated_cb(wifi_aware_data_path_h data_path, wifi_aware_data_path_terminated_cb callback, void *user_data);
/**
- * @brief Unregisters the Data Path terminated callback function.
- * @since_tizen 6.0
+ * @brief Unsets the Data Path terminated callback function.
+ * @since_tizen 9.0
* @param[in] data_path The Data Path handle
* @return 0 on success, otherwise a negative error value
- * @retval #WIFI_AWARE_ERROR_NONE
- * @retval #WIFI_AWARE_ERROR_INVALID_PARAMETER
- * @retval #WIFI_AWARE_ERROR_NOT_INITIALIZED
+ * @retval #WIFI_AWARE_ERROR_NONE Successful
+ * @retval #WIFI_AWARE_ERROR_INVALID_PARAMETER Invalid function parameter
+ * @retval #WIFI_AWARE_ERROR_NOT_INITIALIZED Not initialized
* @see wifi_aware_data_path_set_terminated_cb()
*/
int wifi_aware_data_path_unset_terminated_cb(wifi_aware_data_path_h data_path);
@@ -1059,6 +1008,305 @@ int wifi_aware_data_path_unset_terminated_cb(wifi_aware_data_path_h data_path);
* @}
*/
+/**
+ * @addtogroup CAPI_NETWORK_WIFI_AWARE_PUBLISH_MODULE
+ * @{
+ */
+
+/**
+ * @brief Creates a Publish request.
+ * @since_tizen 9.0
+ * @remarks The @a publish should be released using wifi_aware_publish_destroy().
+ * @param[out] publish The Wi-Fi Aware Publish handle.
+ * @return 0 on success, otherwise a negative error value
+ * @retval #WIFI_AWARE_ERROR_NONE Successful
+ * @retval #WIFI_AWARE_ERROR_INVALID_PARAMETER Invalid function parameter
+ * @retval #WIFI_AWARE_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #WIFI_AWARE_ERROR_NOT_INITIALIZED Not initialized
+ *
+ * @par Here is an example of the usage:
+ * @code
+ *
+ * int ret = 0;
+ * wifi_aware_session_h wifi_aware_session = NULL;
+ * static wifi_aware_publish_h publish_handle = NULL;
+ *
+ * ret = wifi_aware_session_create(WIFI_AWARE_SESSION_PUBLISH, &wifi_aware_session);
+ * if (ret != WIFI_AWARE_ERROR_NONE) {
+ * printf("Failed to create session\n");
+ * return;
+ * }
+ *
+ * ret = wifi_aware_publish_create(&publish_handle);
+ * if (ret != WIFI_AWARE_ERROR_NONE) {
+ * printf("Failed to create publish request\n");
+ * return;
+ * }
+ *
+ * printf("Publish request is created Successfully\n");
+ *
+ * wifi_aware_publish_destroy(publish_handle);
+ * wifi_aware_session_destroy(wifi_aware_session);
+ *
+ * @endcode
+ * @see wifi_aware_publish_destroy()
+ */
+int wifi_aware_publish_create(wifi_aware_publish_h *publish);
+
+/**
+ * @brief Destroys a Publish request.
+ * @since_tizen 9.0
+ * @param[in] publish The Wi-Fi Aware Publish handle.
+ * @return 0 on success, otherwise a negative error value
+ * @retval #WIFI_AWARE_ERROR_NONE Successful
+ * @retval #WIFI_AWARE_ERROR_INVALID_PARAMETER Invalid function parameter
+ * @retval #WIFI_AWARE_ERROR_NOT_INITIALIZED Not initialized
+ * @see wifi_aware_publish_create()
+ */
+int wifi_aware_publish_destroy(wifi_aware_publish_h publish);
+
+/**
+ * @brief Sets TTL (Time To Live) for Publish session.
+ * @since_tizen 9.0
+ * @param[in] publish The Wi-Fi Aware Publish handle.
+ * @param[in] ttl The lifetime(seconds) of publish session. 0 means forever until canceled.
+ * @return 0 on success, otherwise a negative error value
+ * @retval #WIFI_AWARE_ERROR_NONE Successful
+ * @retval #WIFI_AWARE_ERROR_INVALID_PARAMETER Invalid function parameter
+ * @retval #WIFI_AWARE_ERROR_NOT_INITIALIZED Not initialized
+ * @see wifi_aware_publish_create()
+ */
+int wifi_aware_publish_set_ttl(wifi_aware_publish_h publish, unsigned short ttl);
+
+/**
+ * @brief Sets the type of the service as solicited or unsolicited.
+ * @since_tizen 9.0
+ * @param[in] publish The Wi-Fi Aware Publish handle
+ * @param[in] publish_type The Publish type
+ * @return 0 on success, otherwise a negative error value
+ * @retval #WIFI_AWARE_ERROR_NONE Successful
+ * @retval #WIFI_AWARE_ERROR_INVALID_PARAMETER Invalid function parameter
+ * @retval #WIFI_AWARE_ERROR_NOT_INITIALIZED Not initialized
+ * @see wifi_aware_publish_create()
+ */
+int wifi_aware_publish_set_type(wifi_aware_publish_h publish, wifi_aware_publish_type_e publish_type);
+
+/**
+ * @brief Sets the name of the service to publish.
+ * @since_tizen 9.0
+ * @remarks The length should be less than or equal to 255.
+ * @param[in] publish The Wi-Fi Aware Publish handle
+ * @param[in] service_name UTF-8 name which identifies the service
+ * @return 0 on success, otherwise a negative error value
+ * @retval #WIFI_AWARE_ERROR_NONE Successful
+ * @retval #WIFI_AWARE_ERROR_INVALID_PARAMETER Invalid function parameter
+ * @retval #WIFI_AWARE_ERROR_NOT_INITIALIZED Not initialized
+ * @see wifi_aware_publish_create()
+ */
+int wifi_aware_publish_set_service_name(wifi_aware_publish_h publish, const char *service_name);
+
+/**
+ * @brief Sets the specific information for the service to publish.
+ * @since_tizen 9.0
+ * @param[in] publish The Wi-Fi Aware Publish handle
+ * @param[in] service_specific_info The Sequence of values that are conveyed in the Publish message
+ * @param[in] len The length of service specific information
+ * @return 0 on success, otherwise a negative error value
+ * @retval #WIFI_AWARE_ERROR_NONE Successful
+ * @retval #WIFI_AWARE_ERROR_NOT_INITIALIZED Not initialized
+ * @see wifi_aware_publish_create()
+ */
+int wifi_aware_publish_set_service_specific_info(wifi_aware_publish_h publish, const unsigned char *service_specific_info, size_t len);
+
+/**
+ * @brief Sets the match filter of the service to publish.
+ * @since_tizen 9.0
+ * @remarks The match filter is used to decide whether accepting a subscribe request or not.
+ * @param[in] publish The Wi-Fi Aware Publish handle
+ * @param[in] match_filter An ordered sequence of <length, value> pairs
+ * @param[in] len The whole length of match_filter
+ * @return 0 on success, otherwise a negative error value
+ * @retval #WIFI_AWARE_ERROR_NONE Successful
+ * @retval #WIFI_AWARE_ERROR_NOT_INITIALIZED Not initialized
+ * @see wifi_aware_publish_create()
+ */
+int wifi_aware_publish_set_match_filter(wifi_aware_publish_h publish, const unsigned char *match_filter, size_t len);
+
+/**
+ * @brief Sets whether the ranging function is supported or not.
+ * @since_tizen 9.0
+ * @param[in] publish The Wi-Fi Aware Publish handle
+ * @param[in] enable @c true if ranging is enabled,
+ * otherwise @c false if ranging is disabled.
+ * @return 0 on success, otherwise a negative error value
+ * @retval #WIFI_AWARE_ERROR_NONE Successful
+ * @retval #WIFI_AWARE_ERROR_NOT_INITIALIZED Not initialized
+ * @see wifi_aware_publish_create()
+ */
+int wifi_aware_publish_enable_ranging(wifi_aware_publish_h publish, bool enable);
+
+/**
+ * @}
+ */
+
+/**
+ * @addtogroup CAPI_NETWORK_WIFI_AWARE_SUBSCRIBE_MODULE
+ * @{
+ */
+
+/**
+ * @brief Creates a Subscribe request.
+ * @since_tizen 9.0
+ * @remarks The @a subscribe should be released using wifi_aware_subscribe_destroy().
+ * @param[out] subscribe The Wi-Fi Aware Subscribe handle.
+ * @return 0 on success, otherwise a negative error value
+ * @retval #WIFI_AWARE_ERROR_NONE Successful
+ * @retval #WIFI_AWARE_ERROR_INVALID_PARAMETER Invalid function parameter
+ * @retval #WIFI_AWARE_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #WIFI_AWARE_ERROR_NOT_INITIALIZED Not initialized
+ *
+ * @par Here is an example of the usage:
+ * @code
+ *
+ * int ret = 0;
+ * wifi_aware_session_h wifi_aware_session = NULL;
+ * wifi_aware_subscribe_h subscribe_handle = NULL;
+ *
+ * ret = wifi_aware_session_create(WIFI_AWARE_SESSION_SUBSCRIBE, &wifi_aware_session);
+ * if (ret != WIFI_AWARE_ERROR_NONE) {
+ * printf("Failed to create session\n");
+ * return;
+ * }
+ *
+ * ret = wifi_aware_subscribe_create(&subscribe_handle);
+ * if (ret != WIFI_AWARE_ERROR_NONE) {
+ * printf("Failed to create subscribe handle\n");
+ * return;
+ * }
+ *
+ * // Setup and use the subscribe handle
+ *
+ * wifi_aware_subscribe_destroy(subscribe_handle);
+ * wifi_aware_session_destroy(wifi_aware_session);
+ *
+ * @endcode
+ * @see wifi_aware_subscribe_destroy()
+ */
+int wifi_aware_subscribe_create(wifi_aware_subscribe_h *subscribe);
+
+/**
+ * @brief Destroys a Subscribe request.
+ * @since_tizen 9.0
+ * @param[in] subscribe The Wi-Fi Aware Subscribe handle.
+ * @return 0 on success, otherwise a negative error value
+ * @retval #WIFI_AWARE_ERROR_NONE Successful
+ * @retval #WIFI_AWARE_ERROR_INVALID_PARAMETER Invalid function parameter
+ * @retval #WIFI_AWARE_ERROR_NOT_INITIALIZED Not initialized
+ * @see wifi_aware_subscribe_create()
+ */
+int wifi_aware_subscribe_destroy(wifi_aware_subscribe_h subscribe);
+
+/**
+ * @brief Sets TTL (Time To Live) for Subscribe session.
+ * @since_tizen 9.0
+ * @param[in] subscribe The Wi-Fi Aware Subscribe handle
+ * @param[in] ttl The lifetime(seconds) of subscribe session.\n
+ * 0 means forever until wifi_aware_service_discovered_cb().
+ * @return 0 on success, otherwise a negative error value
+ * @retval #WIFI_AWARE_ERROR_NONE Successful
+ * @retval #WIFI_AWARE_ERROR_INVALID_PARAMETER Invalid function parameter
+ * @retval #WIFI_AWARE_ERROR_NOT_INITIALIZED Not initialized
+ * @see wifi_aware_subscribe_create()
+ */
+int wifi_aware_subscribe_set_ttl(wifi_aware_subscribe_h subscribe, unsigned short ttl);
+
+/**
+ * @brief Sets the type of the service as passive or active.
+ * @since_tizen 9.0
+ * @param[in] subscribe The Wi-Fi Aware Subscribe handle
+ * @param[in] subscribe_type The Subscribe type
+ * @return 0 on success, otherwise a negative error value
+ * @retval #WIFI_AWARE_ERROR_NONE Successful
+ * @retval #WIFI_AWARE_ERROR_INVALID_PARAMETER Invalid function parameter
+ * @retval #WIFI_AWARE_ERROR_NOT_INITIALIZED Not initialized
+ * @see wifi_aware_subscribe_create()
+ */
+int wifi_aware_subscribe_set_type(wifi_aware_subscribe_h subscribe, wifi_aware_subscribe_type_e subscribe_type);
+
+/**
+ * @brief Sets the name of the service to subscribe.
+ * @since_tizen 9.0
+ * @remarks The length should be less than or equal to 255
+ * @param[in] subscribe The Wi-Fi Aware Subscribe handle
+ * @param[in] service_name UTF-8 name which identifies the service
+ * @return 0 on success, otherwise a negative error value
+ * @retval #WIFI_AWARE_ERROR_NONE Successful
+ * @retval #WIFI_AWARE_ERROR_INVALID_PARAMETER Invalid function parameter
+ * @retval #WIFI_AWARE_ERROR_NOT_INITIALIZED Not initialized
+ * @see wifi_aware_subscribe_create()
+ */
+int wifi_aware_subscribe_set_service_name(wifi_aware_subscribe_h subscribe, const char *service_name);
+
+/**
+ * @brief Sets the specific information for the service to subscribe.
+ * @since_tizen 9.0
+ * @param[in] subscribe The Wi-Fi Aware Subscribe handle
+ * @param[in] service_specific_info The Sequence of values that are conveyed in the Subscribe message
+ * @param[in] len The length of service specific information
+ * @return 0 on success, otherwise a negative error value
+ * @retval #WIFI_AWARE_ERROR_NONE Successful
+ * @retval #WIFI_AWARE_ERROR_INVALID_PARAMETER Invalid function parameter
+ * @retval #WIFI_AWARE_ERROR_NOT_INITIALIZED Not initialized
+ * @see wifi_aware_subscribe_create()
+ */
+int wifi_aware_subscribe_set_service_specific_info(wifi_aware_subscribe_h subscribe, const unsigned char *service_specific_info, size_t len);
+
+/**
+ * @brief Sets the match filter of the service to subscribe.
+ * @since_tizen 9.0
+ * @remarks The match filter is used to decide whether accepting a subscribe request or not.
+ * @param[in] subscribe The Wi-Fi Aware Subscribe handle
+ * @param[in] match_filter An ordered sequence of <length, value> pairs
+ * @param[in] len The whole length of match_filter
+ * @return 0 on success, otherwise a negative error value
+ * @retval #WIFI_AWARE_ERROR_NONE Successful
+ * @retval #WIFI_AWARE_ERROR_INVALID_PARAMETER Invalid function parameter
+ * @retval #WIFI_AWARE_ERROR_NOT_INITIALIZED Not initialized
+ * @see wifi_aware_subscribe_create()
+ */
+int wifi_aware_subscribe_set_match_filter(wifi_aware_subscribe_h subscribe, const unsigned char *match_filter, size_t len);
+
+/**
+ * @brief Sets the maximum distance.
+ * @since_tizen 9.0
+ * @remarks Only for the services within the @a distance are searched.
+ * @param[in] subscribe The Wi-Fi Aware Subscribe handle
+ * @param[in] distance The maximum distance
+ * @return 0 on success, otherwise a negative error value
+ * @retval #WIFI_AWARE_ERROR_NONE Successful
+ * @retval #WIFI_AWARE_ERROR_INVALID_PARAMETER Invalid function parameter
+ * @retval #WIFI_AWARE_ERROR_NOT_INITIALIZED Not initialized
+ * @see wifi_aware_subscribe_create()
+ */
+int wifi_aware_subscribe_set_max_distance(wifi_aware_subscribe_h subscribe, int distance);
+
+/**
+ * @brief Sets the minimum distance.
+ * @since_tizen 9.0
+ * @remarks Only for the services at least at the @a distance are searched.
+ * @param[in] subscribe The Wi-Fi Aware Subscribe handle
+ * @param[in] distance The minimum distance
+ * @return 0 on success, otherwise a negative error value
+ * @retval #WIFI_AWARE_ERROR_NONE Successful
+ * @retval #WIFI_AWARE_ERROR_INVALID_PARAMETER Invalid function parameter
+ * @retval #WIFI_AWARE_ERROR_NOT_INITIALIZED Not initialized
+ * @see wifi_aware_subscribe_create()
+ */
+int wifi_aware_subscribe_set_min_distance(wifi_aware_subscribe_h subscribe, int distance);
+
+/**
+ * @}
+ */
#ifdef __cplusplus
}
diff --git a/src/wifi-aware.c b/src/wifi-aware.c
index 8c26d61..af5758b 100644
--- a/src/wifi-aware.c
+++ b/src/wifi-aware.c
@@ -28,7 +28,7 @@
#include "wifi-aware-utils.h"
-API int wifi_aware_initialize()
+API int wifi_aware_initialize(void)
{
int ret = WIFI_AWARE_ERROR_NONE;
@@ -43,7 +43,7 @@ API int wifi_aware_initialize()
return WIFI_AWARE_ERROR_NONE;
}
-API int wifi_aware_deinitialize()
+API int wifi_aware_deinitialize(void)
{
int ret = WIFI_AWARE_ERROR_NONE;
@@ -76,7 +76,7 @@ API int wifi_aware_enable(wifi_aware_enabled_cb callback, void *user_data)
return WIFI_AWARE_ERROR_NONE;
}
-API int wifi_aware_disable()
+API int wifi_aware_disable(void)
{
int ret = WIFI_AWARE_ERROR_NONE;