Tizen Native API
Wi-Fi Management

The Wi-Fi API provides functions for managing Wi-Fi.

Required Header

#include <wifi.h>

Overview

The Wi-Fi Manager provides functions for managing Wi-Fi. Using the Wi-Fi Manager, you can implement features that allow the users of your application to:

Related Features

This API is related with the following features:

Functions

int wifi_activate (wifi_activated_cb callback, void *user_data) TIZEN_DEPRECATED_API
 Activates Wi-Fi asynchronously.
int wifi_activate_with_wifi_picker_tested (wifi_activated_cb callback, void *user_data) TIZEN_DEPRECATED_API
 Activates Wi-Fi asynchronously and displays Wi-Fi picker (popup) when Wi-Fi is not automatically connected.
int wifi_deactivate (wifi_deactivated_cb callback, void *user_data) TIZEN_DEPRECATED_API
 Deactivates Wi-Fi asynchronously.
int wifi_is_activated (bool *activated) TIZEN_DEPRECATED_API
 Checks whether Wi-Fi is activated.
int wifi_get_mac_address (char **mac_address) TIZEN_DEPRECATED_API
 Gets the local MAC address.
int wifi_get_network_interface_name (char **name) TIZEN_DEPRECATED_API
 Gets the name of the network interface.
int wifi_scan (wifi_scan_finished_cb callback, void *user_data) TIZEN_DEPRECATED_API
 Starts scan asynchronously.
int wifi_scan_specific_ap (const char *essid, wifi_scan_finished_cb callback, void *user_data) TIZEN_DEPRECATED_API
 Starts specific ap scan, asynchronously.
int wifi_get_connected_ap (wifi_ap_h *ap) TIZEN_DEPRECATED_API
 Gets the handle of the connected access point.
int wifi_foreach_found_aps (wifi_found_ap_cb callback, void *user_data) TIZEN_DEPRECATED_API
 Gets the result of the scan.
int wifi_foreach_found_specific_aps (wifi_found_ap_cb callback, void *user_data) TIZEN_DEPRECATED_API
 Gets the result of specific ap scan.
int wifi_connect (wifi_ap_h ap, wifi_connected_cb callback, void *user_data) TIZEN_DEPRECATED_API
 Connects the access point asynchronously.
int wifi_disconnect (wifi_ap_h ap, wifi_disconnected_cb callback, void *user_data) TIZEN_DEPRECATED_API
 Disconnects the access point asynchronously.
int wifi_connect_by_wps_pbc (wifi_ap_h ap, wifi_connected_cb callback, void *user_data) TIZEN_DEPRECATED_API
 Connects the access point with WPS PBC asynchronously.
int wifi_connect_by_wps_pin (wifi_ap_h ap, const char *pin, wifi_connected_cb callback, void *user_data) TIZEN_DEPRECATED_API
 Connects the access point with WPS PIN asynchronously.
int wifi_forget_ap (wifi_ap_h ap) TIZEN_DEPRECATED_API
 Deletes the information of stored access point and disconnects it when it connected.

Typedefs

typedef bool(* wifi_found_ap_cb )(wifi_ap_h ap, void *user_data)
 Called when you get the found access point repeatedly.
typedef void(* wifi_scan_finished_cb )(wifi_error_e error_code, void *user_data)
 Called when the scan is finished.
typedef void(* wifi_activated_cb )(wifi_error_e result, void *user_data)
 Called after wifi_activate() or wifi_activate_with_wifi_picker_tested() is completed.
typedef void(* wifi_deactivated_cb )(wifi_error_e result, void *user_data)
 Called after wifi_deactivate() is completed.
typedef void(* wifi_connected_cb )(wifi_error_e result, void *user_data)
 Called after either wifi_connect() or wifi_connect_by_wps_pbc() or wifi_connect_by_wps_pin() are completed.
typedef void(* wifi_disconnected_cb )(wifi_error_e result, void *user_data)
 Called after wifi_disconnect() is completed.

Typedef Documentation

typedef void(* wifi_activated_cb)(wifi_error_e result, void *user_data)

Called after wifi_activate() or wifi_activate_with_wifi_picker_tested() is completed.

Deprecated:
Deprecated since 3.0. Use wifi_manager_activated_cb instead.
Since :
2.3
Parameters:
[in]resultThe result
[in]user_dataThe user data passed from wifi_activate() and wifi_activate_with_wifi_picker_tested()
Precondition:
wifi_activate() or wifi_activate_with_wifi_picker_tested() will invoke this callback function.
See also:
wifi_activate()
wifi_activate_with_wifi_picker_tested()
typedef void(* wifi_connected_cb)(wifi_error_e result, void *user_data)

Called after either wifi_connect() or wifi_connect_by_wps_pbc() or wifi_connect_by_wps_pin() are completed.

Deprecated:
Deprecated since 3.0. Use wifi_manager_connected_cb instead.
Since :
2.3
Parameters:
[in]resultThe result
[in]user_dataThe user data passed from either wifi_connect() or wifi_connect_by_wps_pbc() or wifi_connect_by_wps_pin()
Precondition:
Either wifi_connect() or wifi_connect_by_wps_pbc() or wifi_connect_by_wps_pin() will invoke this callback function.
See also:
wifi_connect()
wifi_connect_by_wps_pbc()
wifi_connect_by_wps_pin()
typedef void(* wifi_deactivated_cb)(wifi_error_e result, void *user_data)

Called after wifi_deactivate() is completed.

Deprecated:
Deprecated since 3.0. Use wifi_manager_deactivated_cb instead.
Since :
2.3
Parameters:
[in]resultThe result
[in]user_dataThe user data passed from wifi_deactivate()
Precondition:
wifi_deactivate() will invoke this callback function.
See also:
wifi_deactivate()
typedef void(* wifi_disconnected_cb)(wifi_error_e result, void *user_data)

Called after wifi_disconnect() is completed.

Deprecated:
Deprecated since 3.0. Use wifi_manager_disconnected_cb instead.
Since :
2.3
Parameters:
[in]resultThe result
[in]user_dataThe user data passed from wifi_disconnect()
Precondition:
wifi_disconnect() will invoke this callback function.
See also:
wifi_disconnect()
typedef bool(* wifi_found_ap_cb)(wifi_ap_h ap, void *user_data)

Called when you get the found access point repeatedly.

Deprecated:
Deprecated since 3.0. Use wifi_manager_found_ap_cb instead.
Since :
2.3
Remarks:
ap is valid only in this function. In order to use ap outside this function, you must copy the ap with wifi_ap_clone().
Parameters:
[in]apThe access point
[in]user_dataThe user data passed from the request function
Returns:
true to continue with the next iteration of the loop,
otherwise false to break out of the loop
Precondition:
wifi_foreach_found_aps() will invoke this callback.
wifi_foreach_found_specific_aps() will invoke this callback.
See also:
wifi_foreach_found_aps()
wifi_foreach_found_specific_aps()
typedef void(* wifi_scan_finished_cb)(wifi_error_e error_code, void *user_data)

Called when the scan is finished.

Deprecated:
Deprecated since 3.0. Use wifi_manager_scan_finished_cb instead.
Since :
2.3
Parameters:
[in]error_codeThe error code
[in]user_dataThe user data passed from the callback registration function
See also:
wifi_scan()
wifi_set_background_scan_cb()
wifi_unset_background_scan_cb()

Enumeration Type Documentation

Enumeration for the Wi-Fi error type.

Deprecated:
Deprecated since 3.0. Use wifi_manager_error_e instead.
Since :
2.3
Enumerator:
WIFI_ERROR_NONE 

Successful

WIFI_ERROR_INVALID_PARAMETER 

Invalid parameter

WIFI_ERROR_OUT_OF_MEMORY 

Out of memory error

WIFI_ERROR_INVALID_OPERATION 

Function not implemented or Invalid operation (e.g., already initialized)

WIFI_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED 

Address family not supported

WIFI_ERROR_OPERATION_FAILED 

Operation failed

WIFI_ERROR_NO_CONNECTION 

There is no connected AP

WIFI_ERROR_NOW_IN_PROGRESS 

Now in progress

WIFI_ERROR_ALREADY_EXISTS 

Already exists

WIFI_ERROR_OPERATION_ABORTED 

Operation is aborted

WIFI_ERROR_DHCP_FAILED 

DHCP failed

WIFI_ERROR_INVALID_KEY 

Invalid key

WIFI_ERROR_NO_REPLY 

No reply

WIFI_ERROR_SECURITY_RESTRICTED 

Restricted by security system policy

WIFI_ERROR_PERMISSION_DENIED 

Permission Denied

WIFI_ERROR_NOT_SUPPORTED 

Not Supported


Function Documentation

int wifi_activate ( wifi_activated_cb  callback,
void *  user_data 
)

Activates Wi-Fi asynchronously.

Deprecated:
Deprecated since 3.0. Use wifi_manager_activate() instead.
Since :
2.3
Privilege Level:
public
Privilege:
http://tizen.org/privilege/network.set
http://tizen.org/privilege/network.get
Remarks:
This API needs both privileges.
Parameters:
[in]callbackThe callback function to be called
This can be NULL if you don't want to get the notification.
[in]user_dataThe user data passed to the callback function
Returns:
0 on success, otherwise negative error value
Return values:
WIFI_ERROR_NONESuccessful
WIFI_ERROR_INVALID_OPERATIONInvalid operation
WIFI_ERROR_OPERATION_FAILEDOperation failed
WIFI_ERROR_SECURITY_RESTRICTEDRestricted by security system policy
WIFI_ERROR_PERMISSION_DENIEDPermission Denied
WIFI_ERROR_NOT_SUPPORTEDNot supported
Postcondition:
wifi_activated_cb() will be invoked.
See also:
wifi_activated_cb()
wifi_deactivate()
int wifi_activate_with_wifi_picker_tested ( wifi_activated_cb  callback,
void *  user_data 
)

Activates Wi-Fi asynchronously and displays Wi-Fi picker (popup) when Wi-Fi is not automatically connected.

Deprecated:
Deprecated since 3.0. Use wifi_manager_activate_with_wifi_picker_tested() instead.
Since :
2.3
Privilege Level:
public
Privilege:
http://tizen.org/privilege/network.set
http://tizen.org/privilege/network.get
Remarks:
This API needs both privileges.
Parameters:
[in]callbackThe callback function to be called
This can be NULL if you don't want to get the notification.
[in]user_dataThe user data passed to the callback function
Returns:
0 on success, otherwise negative error value
Return values:
WIFI_ERROR_NONESuccessful
WIFI_ERROR_INVALID_OPERATIONInvalid operation
WIFI_ERROR_OPERATION_FAILEDOperation failed
WIFI_ERROR_SECURITY_RESTRICTEDRestricted by security system policy
WIFI_ERROR_PERMISSION_DENIEDPermission Denied
WIFI_ERROR_NOT_SUPPORTEDNot supported
Postcondition:
wifi_activated_cb() will be invoked.
See also:
wifi_activated_cb()
wifi_deactivate()
int wifi_connect ( wifi_ap_h  ap,
wifi_connected_cb  callback,
void *  user_data 
)

Connects the access point asynchronously.

Deprecated:
Deprecated since 3.0. Use wifi_manager_connect() instead.
Since :
2.3
Privilege Level:
public
Privilege:
http://tizen.org/privilege/network.set
http://tizen.org/privilege/network.get
Remarks:
This API needs both privileges.
Parameters:
[in]apThe access point handle
[in]callbackThe callback function to be called
This can be NULL if you don't want to get the notification.
[in]user_dataThe user data passed to the callback function
Returns:
0 on success, otherwise negative error value
Return values:
WIFI_ERROR_NONESuccessful
WIFI_ERROR_INVALID_OPERATIONInvalid operation
WIFI_ERROR_INVALID_PARAMETERInvalid parameter
WIFI_ERROR_OPERATION_FAILEDOperation failed
WIFI_ERROR_PERMISSION_DENIEDPermission Denied
WIFI_ERROR_NOT_SUPPORTEDNot supported
Postcondition:
This function invokes wifi_connected_cb().
See also:
wifi_connected_cb()
wifi_connect_by_wps_pbc()
wifi_connect_by_wps_pin()
wifi_disconnect()
int wifi_connect_by_wps_pbc ( wifi_ap_h  ap,
wifi_connected_cb  callback,
void *  user_data 
)

Connects the access point with WPS PBC asynchronously.

Deprecated:
Deprecated since 3.0. Use wifi_manager_connect_by_wps_pbc() instead.
Since :
2.3
Privilege Level:
public
Privilege:
http://tizen.org/privilege/network.profile
http://tizen.org/privilege/network.get
Remarks:
This API needs both privileges.
Parameters:
[in]apThe access point handle
[in]callbackThe callback function to be called
This can be NULL if you don't want to get the notification.
[in]user_dataThe user data passed to the callback function
Returns:
0 on success, otherwise negative error value
Return values:
WIFI_ERROR_NONESuccessful
WIFI_ERROR_INVALID_OPERATIONInvalid operation
WIFI_ERROR_INVALID_PARAMETERInvalid parameter
WIFI_ERROR_OPERATION_FAILEDOperation failed
WIFI_ERROR_PERMISSION_DENIEDPermission Denied
WIFI_ERROR_NOT_SUPPORTEDNot supported
Postcondition:
This function invokes wifi_connected_cb().
See also:
wifi_connected_cb()
wifi_connect()
wifi_disconnect()
wifi_ap_is_wps_supported()
int wifi_connect_by_wps_pin ( wifi_ap_h  ap,
const char *  pin,
wifi_connected_cb  callback,
void *  user_data 
)

Connects the access point with WPS PIN asynchronously.

Deprecated:
Deprecated since 3.0. Use wifi_manager_connect_by_wps_pin() instead.
Since :
2.3
Privilege Level:
public
Privilege:
http://tizen.org/privilege/network.profile
http://tizen.org/privilege/network.get
Remarks:
This API needs both privileges.
Parameters:
[in]apThe access point handle
[in]pinThe WPS PIN is a non-NULL string with length greater than 0 and less than or equal to 8
[in]callbackThe callback function to be called (this can be NULL if you don't want to get the notification)
[in]user_dataThe user data passed to the callback function
Returns:
0 on success, otherwise negative error value
Return values:
WIFI_ERROR_NONESuccessful
WIFI_ERROR_INVALID_OPERATIONInvalid operation
WIFI_ERROR_INVALID_PARAMETERInvalid parameter
WIFI_ERROR_OPERATION_FAILEDOperation failed
WIFI_ERROR_PERMISSION_DENIEDPermission Denied
WIFI_ERROR_NOT_SUPPORTEDNot supported
Postcondition:
This function invokes wifi_connected_cb().
See also:
wifi_connected_cb()
wifi_connect()
wifi_disconnect()
wifi_ap_is_wps_supported()
int wifi_deactivate ( wifi_deactivated_cb  callback,
void *  user_data 
)

Deactivates Wi-Fi asynchronously.

Deprecated:
Deprecated since 3.0. Use wifi_manager_deactivate() instead.
Since :
2.3
Privilege Level:
public
Privilege:
http://tizen.org/privilege/network.set
http://tizen.org/privilege/network.get
Remarks:
This API needs both privileges.
Parameters:
[in]callbackThe callback function to be called
This can be NULL if you don't want to get the notification.
[in]user_dataThe user data passed to the callback function
Returns:
0 on success, otherwise negative error value
Return values:
WIFI_ERROR_NONESuccessful
WIFI_ERROR_INVALID_OPERATIONInvalid operation
WIFI_ERROR_OPERATION_FAILEDOperation failed
WIFI_ERROR_PERMISSION_DENIEDPermission Denied
WIFI_ERROR_NOT_SUPPORTEDNot supported
Postcondition:
wifi_deactivated_cb() will be invoked.
See also:
wifi_deactivated_cb()
wifi_activate()
int wifi_disconnect ( wifi_ap_h  ap,
wifi_disconnected_cb  callback,
void *  user_data 
)

Disconnects the access point asynchronously.

Deprecated:
Deprecated since 3.0. Use wifi_manager_disconnect() instead.
Since :
2.3
Privilege Level:
public
Privilege:
http://tizen.org/privilege/network.set
http://tizen.org/privilege/network.get
Remarks:
This API needs both privileges.
Parameters:
[in]apThe access point handle
[in]callbackThe callback function to be called
This can be NULL if you don't want to get the notification.
[in]user_dataThe user data passed to the callback function
Returns:
0 on success, otherwise negative error value
Return values:
WIFI_ERROR_NONESuccessful
WIFI_ERROR_INVALID_OPERATIONInvalid operation
WIFI_ERROR_INVALID_PARAMETERInvalid parameter
WIFI_ERROR_OPERATION_FAILEDOperation failed
WIFI_ERROR_PERMISSION_DENIEDPermission Denied
WIFI_ERROR_NOT_SUPPORTEDNot supported
Postcondition:
This function invokes wifi_disconnected_cb().
See also:
wifi_disconnected_cb()
wifi_connect_by_wps_pbc()
wifi_connect_by_wps_pin()
wifi_connect()
int wifi_foreach_found_aps ( wifi_found_ap_cb  callback,
void *  user_data 
)

Gets the result of the scan.

Deprecated:
Deprecated since 3.0. Use wifi_manager_foreach_found_ap() instead.
Since :
2.3
Privilege Level:
public
Privilege:
http://tizen.org/privilege/network.get
Parameters:
[in]callbackThe callback to be called
[in]user_dataThe user data passed to the callback function
Returns:
0 on success, otherwise negative error value
Return values:
WIFI_ERROR_NONESuccessful
WIFI_ERROR_INVALID_PARAMETERInvalid parameter
WIFI_ERROR_OPERATION_FAILEDOperation failed
WIFI_ERROR_PERMISSION_DENIEDPermission Denied
WIFI_ERROR_NOT_SUPPORTEDNot supported
Postcondition:
This function invokes wifi_found_ap_cb().
int wifi_foreach_found_specific_aps ( wifi_found_ap_cb  callback,
void *  user_data 
)

Gets the result of specific ap scan.

Deprecated:
Deprecated since 3.0. Use wifi_manager_foreach_found_specific_ap() instead.
Since :
2.4
Privilege Level:
public
Privilege:
http://tizen.org/privilege/network.get
Parameters:
[in]callbackThe callback to be called
[in]user_dataThe user data passed to the callback function
Returns:
0 on success, otherwise negative error value.
Return values:
WIFI_ERROR_NONESuccessful
WIFI_ERROR_INVALID_PARAMETERInvalid parameter
WIFI_ERROR_OPERATION_FAILEDOperation failed
WIFI_ERROR_PERMISSION_DENIEDPermission Denied
WIFI_ERROR_NOT_SUPPORTEDNot supported
Postcondition:
This function invokes wifi_found_ap_cb().
See also:
wifi_scan_specific_ap()

Deletes the information of stored access point and disconnects it when it connected.

Deprecated:
Deprecated since 3.0. Use wifi_manager_forget_ap() instead.

If an AP is connected, then connection information will be stored. This information is used when a connection to that AP is established automatically.

Since :
2.3
Privilege Level:
public
Privilege:
http://tizen.org/privilege/network.profile
http://tizen.org/privilege/network.get
Remarks:
This API needs both privileges.
Parameters:
[in]apThe access point handle
Returns:
0 on success, otherwise negative error value
Return values:
WIFI_ERROR_NONESuccessful
WIFI_ERROR_INVALID_OPERATIONInvalid operation
WIFI_ERROR_INVALID_PARAMETERInvalid parameter
WIFI_ERROR_OPERATION_FAILEDOperation failed
WIFI_ERROR_PERMISSION_DENIEDPermission Denied
WIFI_ERROR_NOT_SUPPORTEDNot supported

Gets the handle of the connected access point.

Deprecated:
Deprecated since 3.0. Use wifi_manager_get_connected_ap() instead.
Since :
2.3
Privilege Level:
public
Privilege:
http://tizen.org/privilege/network.get
Remarks:
You must release handle using wifi_ap_destroy().
Parameters:
[out]apThe access point handle
Returns:
0 on success, otherwise negative error value
Return values:
WIFI_ERROR_NONESuccessful
WIFI_ERROR_INVALID_PARAMETERInvalid parameter
WIFI_ERROR_OUT_OF_MEMORYOut of memory
WIFI_ERROR_NO_CONNECTIONThere is no connected AP
WIFI_ERROR_PERMISSION_DENIEDPermission Denied
WIFI_ERROR_NOT_SUPPORTEDNot supported
int wifi_get_mac_address ( char **  mac_address)

Gets the local MAC address.

Deprecated:
Deprecated since 3.0. Use wifi_manager_get_mac_address() instead.
Since :
2.3
Remarks:
You must release mac_address using free().
Parameters:
[out]mac_addressThe MAC address
Returns:
0 on success, otherwise negative error value
Return values:
WIFI_ERROR_NONESuccessful
WIFI_ERROR_INVALID_PARAMETERInvalid parameter
WIFI_ERROR_OPERATION_FAILEDOperation failed
WIFI_ERROR_NOT_SUPPORTEDNot supported
int wifi_get_network_interface_name ( char **  name)

Gets the name of the network interface.

Deprecated:
Deprecated since 3.0. Use wifi_manager_get_network_interface_name() instead.
Since :
2.3
Privilege Level:
public
Privilege:
http://tizen.org/privilege/network.get
Remarks:
You must release name using free().
Parameters:
[out]nameThe name of network interface
Returns:
0 on success, otherwise negative error value
Return values:
WIFI_ERROR_NONESuccessful
WIFI_ERROR_INVALID_PARAMETERInvalid parameter
WIFI_ERROR_OUT_OF_MEMORYOut of memory
WIFI_ERROR_OPERATION_FAILEDOperation failed
WIFI_ERROR_PERMISSION_DENIEDPermission Denied
WIFI_ERROR_NOT_SUPPORTEDNot supported
int wifi_is_activated ( bool *  activated)

Checks whether Wi-Fi is activated.

Deprecated:
Deprecated since 3.0. Use wifi_manager_is_activated() instead.
Since :
2.3
Privilege Level:
public
Privilege:
http://tizen.org/privilege/network.get
Parameters:
[out]activatedture if Wi-Fi is activated, otherwise false if Wi-Fi is not activated.
Returns:
0 on success, otherwise negative error value
Return values:
WIFI_ERROR_NONESuccessful
WIFI_ERROR_INVALID_PARAMETERInvalid parameter
WIFI_ERROR_OPERATION_FAILEDOperation failed
WIFI_ERROR_PERMISSION_DENIEDPermission Denied
WIFI_ERROR_NOT_SUPPORTEDNot supported
int wifi_scan ( wifi_scan_finished_cb  callback,
void *  user_data 
)

Starts scan asynchronously.

Deprecated:
Deprecated since 3.0. Use wifi_manager_scan() instead.
Since :
2.3
Privilege Level:
public
Privilege:
http://tizen.org/privilege/network.set
http://tizen.org/privilege/network.get
Remarks:
This API needs both privileges.
Parameters:
[in]callbackThe callback function to be called
[in]user_dataThe user data passed to the callback function
Returns:
0 on success, otherwise negative error value
Return values:
WIFI_ERROR_NONESuccessful
WIFI_ERROR_INVALID_PARAMETERInvalid parameter
WIFI_ERROR_INVALID_OPERATIONInvalid operation
WIFI_ERROR_OPERATION_FAILEDOperation failed
WIFI_ERROR_PERMISSION_DENIEDPermission Denied
WIFI_ERROR_NOT_SUPPORTEDNot supported
Postcondition:
This function invokes wifi_scan_finished_cb().
int wifi_scan_specific_ap ( const char *  essid,
wifi_scan_finished_cb  callback,
void *  user_data 
)

Starts specific ap scan, asynchronously.

Deprecated:
Deprecated since 3.0. Use wifi_manager_scan_specific_ap() instead.
Since :
2.4
Privilege Level:
public
Privilege:
http://tizen.org/privilege/network.set
http://tizen.org/privilege/network.get
Remarks:
This API needs both privileges.
Parameters:
[in]essidThe essid of hidden ap
[in]callbackThe callback function to be called
[in]user_dataThe user data passed to the callback function
Returns:
0 on success, otherwise negative error value.
Return values:
WIFI_ERROR_NONESuccessful
WIFI_ERROR_INVALID_PARAMETERInvalid parameter
WIFI_ERROR_INVALID_OPERATIONInvalid operation
WIFI_ERROR_OPERATION_FAILEDOperation failed
WIFI_ERROR_PERMISSION_DENIEDPermission Denied
WIFI_ERROR_NOT_SUPPORTEDNot supported
Postcondition:
This function invokes wifi_scan_finished_cb().