int wifi_config_set_eap_subject_match(wifi_config_h config, const char* subject_match);
/**
-* @}
-*/
+ * @}
+ */
+
+/**
+ * @addtogroup CAPI_NETWORK_WIFI_TDLS
+ * @{
+ */
+
+/**
+ * @brief Enumeration for the state of the Wi-Fi TDLS.
+ * @since_tizen 3.0
+ */
+typedef enum
+{
+ WIFI_TDLS_STATE_DISCONNECTED = 0, /**< Wi-Fi TDLS is Disconnected */
+ WIFI_TDLS_STATE_CONNECTED = 1, /**< Wi-Fi TDLS is Connected */
+} wifi_tdls_state_e;
+
+/**
+ * @brief Called when the WiFi TDLS state is changed.
+ * @since_tizen 3.0
+ *
+ * @param[in] state The TDLS state
+ * @param[in] peer_mac_addr MAC address of the TDLS peer
+ * @param[in] user_data The user data passed from the callback registration function
+ * @see wifi_tdls_set_state_changed_cb()
+ * @see wifi_tdls_unset_state_changed_cb()
+ */
+typedef void(*wifi_tdls_state_changed_cb)(wifi_tdls_state_e state, char* peer_mac_addr, void* user_data);
+
+/**
+ * @brief Disconnects the connected peer.
+ * @since_tizen 3.0
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/network.set
+ *
+ * @param[in] ap The MAC address of the connected peer
+ *
+ * @return @c 0 on success, otherwise negative error value
+ * @retval #WIFI_ERROR_NONE Successful
+ * @retval #WIFI_ERROR_INVALID_OPERATION Invalid operation
+ * @retval #WIFI_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #WIFI_ERROR_OPERATION_FAILED Operation failed
+ * @retval #WIFI_ERROR_NOT_SUPPORTED Not supported
+ */
+int wifi_tdls_disconnect(const char* peer_mac_addr);
+
+/**
+ * @brief Gets Peer Mac address of Connected peer.
+ * @since_tizen 3.0
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/network.get
+ *
+ * @remarks The @a peer_mac_addr should be freed using free().
+ * @param[out] peer_mac_addr The MAC address of the connected peer
+ *
+ * @return @c 0 on success, otherwise negative error value
+ * @retval #WIFI_ERROR_NONE Successful
+ * @retval #WIFI_ERROR_INVALID_OPERATION Invalid operation
+ * @retval #WIFI_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #WIFI_ERROR_OPERATION_FAILED Operation failed
+ * @retval #WIFI_ERROR_NO_CONNECTION No active TDLS Connection
+ * @retval #WIFI_ERROR_NOT_SUPPORTED Not supported
+ */
+int wifi_tdls_get_connected_peer(char** peer_mac_addr);
+
+/**
+ * @brief Registers the callback called when TDLS state is changed.
+ * @since_tizen 3.0
+ *
+ * @param[in] callback The callback function to be called
+ * @param[in] user_data The user data passed to the callback function
+ *
+ * @return @c 0 on success, otherwise negative error value
+ * @retval #WIFI_ERROR_NONE Successful
+ * @retval #WIFI_ERROR_INVALID_OPERATION Invalid operation
+ * @retval #WIFI_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #WIFI_ERROR_NOT_SUPPORTED Not supported
+ */
+int wifi_tdls_set_state_changed_cb(wifi_tdls_state_changed_cb callback, void* user_data);
+
+/**
+ * @brief Unregisters the callback called when TDLS state is changed.
+ * @since_tizen 3.0
+ *
+ * @return @c 0 on success, otherwise negative error value
+ * @retval #WIFI_ERROR_NONE Successful
+ * @retval #WIFI_ERROR_INVALID_OPERATION Invalid operation
+ * @retval #WIFI_ERROR_NOT_SUPPORTED Not supported
+ */
+int wifi_tdls_unset_state_changed_cb(void);
+
+/**
+ * @}
+ */
#ifdef __cplusplus
}
Name: capi-network-wifi
Summary: Network Wi-Fi library in TIZEN C API
-Version: 1.0.62
+Version: 1.0.63
Release: 1
Group: System/Network
License: Apache-2.0
return WIFI_ERROR_NONE;
}
+
+EXPORT_API int wifi_tdls_disconnect(const char* peer_mac_addr)
+{
+ CHECK_FEATURE_SUPPORTED(WIFI_FEATURE);
+
+ if (_wifi_is_init() == false) {
+ WIFI_LOG(WIFI_ERROR, "Not initialized");
+ return WIFI_ERROR_INVALID_OPERATION;
+ }
+
+ if (peer_mac_addr == NULL) {
+ WIFI_LOG(WIFI_ERROR, "Invalid parameter");
+ return WIFI_ERROR_INVALID_PARAMETER;
+ }
+
+ int rv = 0;
+ rv = net_wifi_tdls_disconnect(peer_mac_addr);
+
+ if (rv != NET_ERR_NONE) {
+ WIFI_LOG(WIFI_ERROR, "Failed to disconnect tdls");
+ return WIFI_ERROR_OPERATION_FAILED;
+ }
+
+ return WIFI_ERROR_NONE;
+}
+
+EXPORT_API int wifi_tdls_get_connected_peer(char** peer_mac_addr)
+{
+ CHECK_FEATURE_SUPPORTED(WIFI_FEATURE);
+
+ if (_wifi_is_init() == false) {
+ WIFI_LOG(WIFI_ERROR, "Not initialized");
+ return WIFI_ERROR_INVALID_OPERATION;
+ }
+
+ if (peer_mac_addr == NULL) {
+ WIFI_LOG(WIFI_ERROR, "Invalid parameter");
+ return WIFI_ERROR_INVALID_PARAMETER;
+ }
+
+ int rv = 0;
+ rv = net_wifi_tdls_connected_peer(peer_mac_addr);
+
+ if (rv != NET_ERR_NONE) {
+ WIFI_LOG(WIFI_ERROR, "Failed to get connected peer");
+ return WIFI_ERROR_OPERATION_FAILED;
+ }
+
+ if (g_strcmp0(*peer_mac_addr, "00.00.00.00.00.00") == 0) {
+ g_free(*peer_mac_addr);
+ return WIFI_ERROR_NO_CONNECTION;
+ }
+
+ return WIFI_ERROR_NONE;
+}
+
+EXPORT_API int wifi_tdls_set_state_changed_cb(wifi_tdls_state_changed_cb callback, void* user_data)
+{
+ CHECK_FEATURE_SUPPORTED(WIFI_FEATURE);
+ return WIFI_ERROR_NONE;
+}
+
+EXPORT_API int wifi_tdls_unset_state_changed_cb(void)
+{
+ CHECK_FEATURE_SUPPORTED(WIFI_FEATURE);
+ return WIFI_ERROR_NONE;
+}
return 1;
}
+int test_wifi_tdls_disconnect(void)
+{
+ int rv = 0;
+
+ char * peer_mac = NULL;
+ printf("Enter Mac_address: ");
+ if(scanf(" %ms", &peer_mac) < 1)
+ return -1;
+
+ if (strlen(peer_mac) > 17)
+ {
+ printf("Wrong Mac_address\n");
+ return -1;
+ }
+
+ rv = wifi_tdls_disconnect(peer_mac);
+ if (rv != WIFI_ERROR_NONE) {
+ printf("test_wifi_tdls_disconnect() is failed [%s]\n", __test_convert_error_to_string(rv));
+ g_free(peer_mac);
+ return -1;
+ }
+ g_free(peer_mac);
+ return 1;
+}
+
+int test_wifi_tdls_get_connected_peer(void)
+{
+ int rv = 0;
+ char *mac_addr = NULL;
+
+ rv = wifi_tdls_get_connected_peer(&mac_addr);
+ if (rv != WIFI_ERROR_NONE) {
+ printf("wifi_tdls_get_connected_peer() is failed [%s]\n", __test_convert_error_to_string(rv));
+ return -1;
+ }
+ printf("Peer Mac address is [%s]\n",mac_addr);
+ g_free(mac_addr);
+ return 1;
+}
+
int main(int argc, char **argv)
{
GMainLoop *mainloop;
printf("m - Save configuration\n");
printf("n - Set configuration proxy and hidden\n");
printf("o - Set EAP configuration\n");
+ printf("p - TDLS TearDown\n");
+ printf("q - TDLS Set Connected Callback\n");
+ printf("r - TDLS Set Disconnected Callback\n");
+ printf("s - TDLS Get Connected Peer\n");
printf("0 - Exit \n");
printf("ENTER - Show options menu.......\n");
case 'o':
rv = test_set_eap_configuration();
break;
+ case 'p':
+ rv = test_wifi_tdls_disconnect();
+ break;
+ case 'r':
+ rv = test_wifi_tdls_get_connected_peer();
+ break;
default:
break;