Tizen Native API  10.0

The Wi-Fi API provides functions for monitoring the state of Wi-Fi.

Required Header

#include <wifi-manager.h>

Overview

The Wi-Fi Monitor enables tracking of Wi-Fi state changes.

Related Features

This API is related with the following features:

  • http://tizen.org/feature/network.wifi

It is recommended to design applications with regard to features, for reliability.

You can check if a device supports the related features for this API by using System Information, and control your application's actions accordingly.

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.

More details on featuring your application can be found from Feature Element.

Functions

int wifi_manager_get_connection_state (wifi_manager_h wifi, wifi_manager_connection_state_e *connection_state)
 Gets the connection state.
int wifi_manager_set_device_state_changed_cb (wifi_manager_h wifi, wifi_manager_device_state_changed_cb callback, void *user_data)
 Registers the callback called when the device state is changed.
int wifi_manager_unset_device_state_changed_cb (wifi_manager_h wifi)
 Unregisters the callback called when the device state is changed.
int wifi_manager_set_background_scan_cb (wifi_manager_h wifi, wifi_manager_scan_finished_cb callback, void *user_data)
 Registers the callback called when the background scan is finished.
int wifi_manager_unset_background_scan_cb (wifi_manager_h wifi)
 Unregisters the callback called when the scan is finished.
int wifi_manager_set_scan_state_changed_cb (wifi_manager_h wifi, wifi_manager_scan_state_changed_cb callback, void *user_data)
 Registers the callback called when the scanning state is changed.
int wifi_manager_unset_scan_state_changed_cb (wifi_manager_h wifi)
 Unregisters the callback called when the scanning state is changed.
int wifi_manager_set_connection_state_changed_cb (wifi_manager_h wifi, wifi_manager_connection_state_changed_cb callback, void *user_data)
 Registers the callback called when the connection state is changed.
int wifi_manager_unset_connection_state_changed_cb (wifi_manager_h wifi)
 Unregisters the callback called when the connection state is changed.
int wifi_manager_set_rssi_level_changed_cb (wifi_manager_h wifi, wifi_manager_rssi_level_changed_cb callback, void *user_data)
 Registers callback called when the RSSI of connected Wi-Fi is changed.
int wifi_manager_unset_rssi_level_changed_cb (wifi_manager_h wifi)
 Unregisters callback called when the RSSI of connected Wi-Fi is changed.
int wifi_manager_set_module_state_changed_cb (wifi_manager_h wifi, wifi_manager_module_state_changed_cb callback, void *user_data)
 Registers a callback called when the Wi-Fi Module state is changed.
int wifi_manager_unset_module_state_changed_cb (wifi_manager_h wifi)
 Unregisters the callback called when the Wi-Fi Module state is changed.
int wifi_manager_get_module_state (wifi_manager_h wifi, wifi_manager_module_state_e *state)
 Gets the Wi-Fi Module state.
int wifi_manager_bssid_scan (wifi_manager_h wifi, wifi_manager_bssid_scan_finished_cb callback, void *user_data)
 Starts BSSID scan asynchronously.

Typedefs

typedef void(* wifi_manager_device_state_changed_cb )(wifi_manager_device_state_e state, void *user_data)
 Called when the device state is changed.
typedef void(* wifi_manager_connection_state_changed_cb )(wifi_manager_connection_state_e state, wifi_manager_ap_h ap, void *user_data)
 Called when the connection state is changed.
typedef void(* wifi_manager_ip_conflict_cb )(char *mac, wifi_manager_ip_conflict_state_e state, void *user_data)
 Called when the IP conflict state is changed.
typedef void(* wifi_manager_rssi_level_changed_cb )(wifi_manager_rssi_level_e rssi_level, void *user_data)
 Called when the RSSI of connected Wi-Fi is changed.
typedef void(* wifi_manager_module_state_changed_cb )(wifi_manager_module_state_e wifi_module_state, void *user_data)
 Called when the Wi-Fi Module state is changed.

Typedef Documentation

Called when the connection state is changed.

This callback function is registered using `wifi_manager_set_connection_state_changed_cb()` and will be called whenever the connection state of a Wi-Fi access point changes.

Since :
3.0
Parameters:
[in]stateThe connection state
[in]apThe access point
[in]user_dataThe user data passed from the callback registration function
See also:
wifi_manager_set_connection_state_changed_cb()
wifi_manager_unset_connection_state_changed_cb()
typedef void(* wifi_manager_device_state_changed_cb)(wifi_manager_device_state_e state, void *user_data)

Called when the device state is changed.

This callback function is registered using `wifi_manager_set_device_state_changed_cb()` and will be called whenever the state of the Wi-Fi device changes.

Since :
3.0
Parameters:
[in]stateThe device state
[in]user_dataThe user data passed from the callback registration function
See also:
wifi_manager_set_device_state_changed_cb()
wifi_manager_unset_device_state_changed_cb()
typedef void(* wifi_manager_ip_conflict_cb)(char *mac, wifi_manager_ip_conflict_state_e state, void *user_data)

Called when the IP conflict state is changed.

This callback function is registered using `wifi_manager_set_ip_conflict_cb()` and will be called whenever the IP conflict state changes.

Since :
5.0
Remarks:
mac should not be freed. mac is available only in the callback. To use outside the callback, make a copy.
Parameters:
[in]macThe destination MAC address causing conflict
[in]stateThe current state
[in]user_dataThe user data passed from the callback registration function
See also:
wifi_manager_set_ip_conflict_cb()
wifi_manager_unset_ip_conflict_cb()
typedef void(* wifi_manager_module_state_changed_cb)(wifi_manager_module_state_e wifi_module_state, void *user_data)

Called when the Wi-Fi Module state is changed.

This callback function is registered using `wifi_manager_set_module_state_changed_cb()` and will be called whenever the state of the Wi-Fi module changes.

Since :
4.0
Parameters:
[in]wifi_module_stateThe Wi-Fi Module state
[in]user_dataThe user data passed from the callback registration function
See also:
wifi_manager_set_module_state_changed_cb()
wifi_manager_unset_module_state_changed_cb()
typedef void(* wifi_manager_rssi_level_changed_cb)(wifi_manager_rssi_level_e rssi_level, void *user_data)

Called when the RSSI of connected Wi-Fi is changed.

This callback function is registered using `wifi_manager_set_rssi_level_changed_cb()` and will be called whenever the RSSI level of the connected Wi-Fi network changes.

Since :
3.0
Parameters:
[in]rssi_levelThe level of RSSI
[in]user_dataThe user data passed from the callback registration function
See also:
wifi_manager_set_rssi_level_changed_cb()
wifi_manager_unset_rssi_level_changed_cb()

Enumeration Type Documentation

Enumeration for the state of the Wi-Fi connection.

Since :
3.0
Enumerator:
WIFI_MANAGER_CONNECTION_STATE_FAILURE 

Connection failed state

WIFI_MANAGER_CONNECTION_STATE_DISCONNECTED 

Disconnected state

WIFI_MANAGER_CONNECTION_STATE_ASSOCIATION 

Association state

WIFI_MANAGER_CONNECTION_STATE_CONFIGURATION 

Configuration state

WIFI_MANAGER_CONNECTION_STATE_CONNECTED 

Connected state

Enumeration for the state of the Wi-Fi device.

Since :
3.0
Enumerator:
WIFI_MANAGER_DEVICE_STATE_DEACTIVATED 

Wi-Fi is Deactivated

WIFI_MANAGER_DEVICE_STATE_ACTIVATED 

Wi-Fi is activated

Enumeration for the state of the static IP conflict.

Since :
5.0
Enumerator:
WIFI_MANAGER_IP_CONFLICT_STATE_UNKNOWN 

Unknown state

WIFI_MANAGER_IP_CONFLICT_STATE_CONFLICT_NOT_DETECTED 

Resolved state

WIFI_MANAGER_IP_CONFLICT_STATE_CONFLICT_DETECTED 

Conflict state

Enumeration for the Wi-Fi Module state.

Since :
4.0
Enumerator:
WIFI_MANAGER_MODULE_STATE_DETACHED 

Wi-Fi Module is detached

WIFI_MANAGER_MODULE_STATE_ATTACHED 

Wi-Fi Module is attached

Enumeration for the RSSI level.

Since :
3.0
Enumerator:
WIFI_MANAGER_RSSI_LEVEL_0 

No signal

WIFI_MANAGER_RSSI_LEVEL_1 

Very weak signal ~ -83dBm

WIFI_MANAGER_RSSI_LEVEL_2 

Weak signal -82 ~ -75dBm

WIFI_MANAGER_RSSI_LEVEL_3 

Strong signal -74 ~ -64dBm

WIFI_MANAGER_RSSI_LEVEL_4 

Very strong signal -63dBm ~

Enumeration for the wifi scanning state.

Since :
4.0
Enumerator:
WIFI_MANAGER_SCAN_STATE_NOT_SCANNING 

Scan is not running

WIFI_MANAGER_SCAN_STATE_SCANNING 

Scan is in progress

Enumeration for the TDLS Discovery State.

Since :
4.0
Enumerator:
WIFI_MANAGER_TDLS_DISCOVERY_STATE_ONGOING 

Discovery is in progress

WIFI_MANAGER_TDLS_DISCOVERY_STATE_FINISHED 

Discovery is finished


Function Documentation

int wifi_manager_bssid_scan ( wifi_manager_h  wifi,
wifi_manager_bssid_scan_finished_cb  callback,
void *  user_data 
)

Starts BSSID scan asynchronously.

This function starts a BSSID (Basic Service Set Identifier) scan to discover wireless access points. A BSSID scan focuses on finding specific access points based on their MAC addresses rather than scanning for all available networks. The scan is performed asynchronously, and the result is reported through the provided callback function.

Since :
4.0
Privilege Level:
public
Privilege:
http://tizen.org/privilege/network.set
http://tizen.org/privilege/network.get
Remarks:
This function needs both privileges.
Parameters:
[in]wifiThe Wi-Fi handle
[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_MANAGER_ERROR_NONESuccessful
WIFI_MANAGER_ERROR_NOT_INITIALIZEDNot initialized
WIFI_MANAGER_ERROR_INVALID_PARAMETERInvalid parameter
WIFI_MANAGER_ERROR_INVALID_OPERATIONInvalid operation
WIFI_MANAGER_ERROR_OPERATION_FAILEDOperation failed
WIFI_MANAGER_ERROR_PERMISSION_DENIEDPermission Denied
WIFI_MANAGER_ERROR_NOT_SUPPORTEDNot supported
Postcondition:
This function invokes wifi_manager_bssid_scan_finished_cb().

Gets the connection state.

This function queries the Wi-Fi manager to obtain the current connection state of the Wi-Fi network associated with the given Wi-Fi handle. The retrieved connection state can be one of the following: DISCONNECTED, CONNECTED, or CONNECTING.

Since :
3.0
Privilege Level:
public
Privilege:
http://tizen.org/privilege/network.get
Parameters:
[in]wifiThe Wi-Fi handle
[out]connection_stateThe connection state
Returns:
0 on success, otherwise negative error value
Return values:
WIFI_MANAGER_ERROR_NONESuccessful
WIFI_MANAGER_ERROR_INVALID_PARAMETERInvalid parameter
WIFI_MANAGER_ERROR_OPERATION_FAILEDOperation failed
WIFI_MANAGER_ERROR_PERMISSION_DENIEDPermission Denied
WIFI_MANAGER_ERROR_NOT_SUPPORTEDNot supported

Gets the Wi-Fi Module state.

This function retrieves the current state of the Wi-Fi module. The Wi-Fi module state indicates whether the Wi-Fi hardware is enabled or disabled. This information is useful for determining if the device is capable of connecting to wireless networks.

Since :
4.0
Parameters:
[in]wifiThe Wi-Fi handle
[out]stateThe Wi-Fi Module state
Returns:
0 on success, otherwise negative error value
Return values:
WIFI_MANAGER_ERROR_NONESuccessful
WIFI_MANAGER_ERROR_NOT_INITIALIZEDNot initialized
WIFI_MANAGER_ERROR_INVALID_OPERATIONInvalid operation
WIFI_MANAGER_ERROR_INVALID_PARAMETERInvalid parameter
WIFI_MANAGER_ERROR_OPERATION_FAILEDOperation failed
WIFI_MANAGER_ERROR_NOT_SUPPORTEDNot supported
int wifi_manager_set_background_scan_cb ( wifi_manager_h  wifi,
wifi_manager_scan_finished_cb  callback,
void *  user_data 
)

Registers the callback called when the background scan is finished.

This function registers a callback function to monitor the completion of background scans initiated by the Wi-Fi manager. When a background scan finishes, the registered callback function will be invoked with the scan results and the provided user data.

Since :
3.0
Parameters:
[in]wifiThe Wi-Fi handle
[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_MANAGER_ERROR_NONESuccessful
WIFI_MANAGER_ERROR_NOT_INITIALIZEDNot initialized
WIFI_MANAGER_ERROR_INVALID_OPERATIONInvalid operation
WIFI_MANAGER_ERROR_INVALID_PARAMETERInvalid parameter
WIFI_MANAGER_ERROR_NOT_SUPPORTEDNot supported

Registers the callback called when the connection state is changed.

This function registers a callback function to monitor changes in the connection state of the Wi-Fi network. When the connection state changes (e.g., connected, disconnected, or connection failure), the registered callback function will be invoked with the updated connection state and the provided user data.

Since :
3.0
Parameters:
[in]wifiThe Wi-Fi handle
[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_MANAGER_ERROR_NONESuccessful
WIFI_MANAGER_ERROR_NOT_INITIALIZEDNot initialized
WIFI_MANAGER_ERROR_INVALID_OPERATIONInvalid operation
WIFI_MANAGER_ERROR_INVALID_PARAMETERInvalid parameter
WIFI_MANAGER_ERROR_NOT_SUPPORTEDNot supported

Registers the callback called when the device state is changed.

This function registers a callback function to monitor changes in the Wi-Fi device state. When the Wi-Fi device state changes (e.g., enabled, disabled, or enabling/disabling in progress), the registered callback function will be invoked with the updated device state and the provided user data.

Since :
3.0
Parameters:
[in]wifiThe Wi-Fi handle
[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_MANAGER_ERROR_NONESuccessful
WIFI_MANAGER_ERROR_NOT_INITIALIZEDNot initialized
WIFI_MANAGER_ERROR_INVALID_OPERATIONInvalid operation
WIFI_MANAGER_ERROR_INVALID_PARAMETERInvalid parameter
WIFI_MANAGER_ERROR_NOT_SUPPORTEDNot supported

Registers a callback called when the Wi-Fi Module state is changed.

This function registers a callback function to monitor changes in the Wi-Fi module state. When the state of the Wi-Fi module changes (e.g., enabled or disabled), the registered callback function will be invoked with the updated state and the provided user data.

Since :
4.0
Parameters:
[in]wifiThe Wi-Fi handle
[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_MANAGER_ERROR_NONESuccessful
WIFI_MANAGER_ERROR_NOT_INITIALIZEDNot initialized
WIFI_MANAGER_ERROR_INVALID_OPERATIONInvalid operation
WIFI_MANAGER_ERROR_INVALID_PARAMETERInvalid parameter
WIFI_MANAGER_ERROR_OPERATION_FAILEDOperation failed
WIFI_MANAGER_ERROR_NOT_SUPPORTEDNot supported
See also:
wifi_manager_module_state_changed_cb()
wifi_manager_unset_module_state_changed_cb()

Registers callback called when the RSSI of connected Wi-Fi is changed.

This function registers a callback function to monitor changes in the Received Signal Strength Indication (RSSI) level of the currently connected Wi-Fi network. When the RSSI level changes, the registered callback function will be invoked with the updated RSSI level and the provided user data.

Since :
3.0
Parameters:
[in]wifiThe Wi-Fi handle
[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_MANAGER_ERROR_NONESuccessful
WIFI_MANAGER_ERROR_NOT_INITIALIZEDNot initialized
WIFI_MANAGER_ERROR_INVALID_OPERATIONInvalid operation
WIFI_MANAGER_ERROR_INVALID_PARAMETERInvalid parameter
WIFI_MANAGER_ERROR_NOT_SUPPORTEDNot supported

Registers the callback called when the scanning state is changed.

This function registers a callback function to monitor changes in the scanning state of the Wi-Fi network. When the scanning state changes (e.g., scan started or scan finished), the registered callback function will be invoked with the updated scanning state and the provided user data.

Since :
4.0
Parameters:
[in]wifiThe Wi-Fi handle
[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_MANAGER_ERROR_NONESuccessful
WIFI_MANAGER_ERROR_NOT_INITIALIZEDNot initialized
WIFI_MANAGER_ERROR_INVALID_OPERATIONInvalid operation
WIFI_MANAGER_ERROR_INVALID_PARAMETERInvalid parameter
WIFI_MANAGER_ERROR_NOT_SUPPORTEDNot supported

Unregisters the callback called when the scan is finished.

This function removes the previously registered callback for monitoring the completion of background scans initiated by the Wi-Fi manager. The callback will no longer be invoked when a background scan finishes after this function is called.

Since :
3.0
Parameters:
[in]wifiThe Wi-Fi handle
Returns:
0 on success, otherwise negative error value
Return values:
WIFI_MANAGER_ERROR_NONESuccessful
WIFI_MANAGER_ERROR_NOT_INITIALIZEDNot initialized
WIFI_MANAGER_ERROR_INVALID_PARAMETERInvalid parameter
WIFI_MANAGER_ERROR_INVALID_OPERATIONInvalid operation
WIFI_MANAGER_ERROR_NOT_SUPPORTEDNot supported

Unregisters the callback called when the connection state is changed.

This function removes the previously registered callback for monitoring changes in the connection state of the Wi-Fi network. The callback will no longer be invoked when the connection state changes after this function is called.

Since :
3.0
Parameters:
[in]wifiThe Wi-Fi handle
Returns:
0 on success, otherwise negative error value
Return values:
WIFI_MANAGER_ERROR_NONESuccessful
WIFI_MANAGER_ERROR_NOT_INITIALIZEDNot initialized
WIFI_MANAGER_ERROR_INVALID_PARAMETERInvalid parameter
WIFI_MANAGER_ERROR_INVALID_OPERATIONInvalid operation
WIFI_MANAGER_ERROR_NOT_SUPPORTEDNot supported

Unregisters the callback called when the device state is changed.

This function removes the previously registered callback for monitoring changes in the Wi-Fi device state. The callback will no longer be invoked when the device state changes after this function is called.

Since :
3.0
Parameters:
[in]wifiThe Wi-Fi handle
Returns:
0 on success, otherwise negative error value
Return values:
WIFI_MANAGER_ERROR_NONESuccessful
WIFI_MANAGER_ERROR_NOT_INITIALIZEDNot initialized
WIFI_MANAGER_ERROR_INVALID_PARAMETERInvalid parameter
WIFI_MANAGER_ERROR_INVALID_OPERATIONInvalid operation
WIFI_MANAGER_ERROR_NOT_SUPPORTEDNot supported

Unregisters the callback called when the Wi-Fi Module state is changed.

This function removes the previously registered callback for monitoring changes in the Wi-Fi module state. The callback will no longer be invoked when the Wi-Fi module state changes after this function is called.

Since :
4.0
Parameters:
[in]wifiThe Wi-Fi handle
Returns:
0 on success, otherwise negative error value
Return values:
WIFI_MANAGER_ERROR_NONESuccessful
WIFI_MANAGER_ERROR_NOT_INITIALIZEDNot initialized
WIFI_MANAGER_ERROR_INVALID_OPERATIONInvalid operation
WIFI_MANAGER_ERROR_INVALID_PARAMETERInvalid parameter
WIFI_MANAGER_ERROR_OPERATION_FAILEDOperation failed
WIFI_MANAGER_ERROR_NOT_SUPPORTEDNot supported
See also:
wifi_manager_module_state_changed_cb()
wifi_manager_set_module_state_changed_cb()

Unregisters callback called when the RSSI of connected Wi-Fi is changed.

This function removes the previously registered callback for monitoring changes in the Received Signal Strength Indication (RSSI) level of the currently connected Wi-Fi network. The callback will no longer be invoked when the RSSI level changes after this function is called.

Since :
3.0
Parameters:
[in]wifiThe Wi-Fi handle
Returns:
0 on success, otherwise negative error value
Return values:
WIFI_MANAGER_ERROR_NONESuccessful
WIFI_MANAGER_ERROR_INVALID_PARAMETERInvalid parameter
WIFI_MANAGER_ERROR_INVALID_OPERATIONInvalid operation
WIFI_MANAGER_ERROR_NOT_SUPPORTEDNot supported

Unregisters the callback called when the scanning state is changed.

This function removes the previously registered callback for monitoring changes in the scanning state of the Wi-Fi network. The callback will no longer be invoked when the scanning state changes after this function is called.

Since :
4.0
Parameters:
[in]wifiThe Wi-Fi handle
Returns:
0 on success, otherwise negative error value
Return values:
WIFI_MANAGER_ERROR_NONESuccessful
WIFI_MANAGER_ERROR_NOT_INITIALIZEDNot initialized
WIFI_MANAGER_ERROR_INVALID_PARAMETERInvalid parameter
WIFI_MANAGER_ERROR_INVALID_OPERATIONInvalid operation
WIFI_MANAGER_ERROR_NOT_SUPPORTEDNot supported