Tizen Native API  5.0
Network Monitoring General

The Network Monitoring API provides functions for getting connections.

Required Header

#include <inm.h>

Overview

This set of functions is used to get network state, get connection handles. To use This kind of APIs, You should create a inm handle using inm_initialize(). You should destroy the created inm handle if you do not need it anymore.

Related Features

This API is related with the following features:

Functions

int inm_set_cellular_state_changed_cb (inm_h inm, inm_cellular_state_changed_cb callback, void *user_data)
 Sets a callback called when the cellular state is changed.
int inm_unset_cellular_state_changed_cb (inm_h inm)
 Unsets the callback called when the cellular state is changed.
int inm_get_cellular_state (inm_h inm, inm_cellular_state_e *state)
 Gets the state of the cellular connection.
int inm_set_wifi_state_changed_cb (inm_h inm, inm_wifi_state_changed_cb callback, void *user_data)
 Sets a callback called when the Wi-Fi state is changed.
int inm_unset_wifi_state_changed_cb (inm_h inm)
 Unsets the callback called when the Wi-Fi state is changed.
int inm_get_wifi_state (inm_h inm, inm_wifi_state_e *state)
 Gets the state of the Wi-Fi.
int inm_set_ethernet_state_changed_cb (inm_h inm, inm_ethernet_state_changed_cb callback, void *user_data)
 Sets a callback called when the ethernet state is changed.
int inm_unset_ethernet_state_changed_cb (inm_h inm)
 Unsets the callback called when the ethernet state is changed.
int inm_get_ethernet_state (inm_h inm, inm_ethernet_state_e *state)
 Gets the state of the ethernet.
int inm_get_current_connection (inm_h inm, inm_connection_h *connection)
 Gets the handle of the default connection.
int inm_connection_destroy (inm_connection_h *connection)
 Destroys a connection handle.
int inm_connection_clone (inm_connection_h *cloned, inm_connection_h origin)
 Clones a connection handle.
int inm_get_connection_iterator (inm_h inm, inm_connection_iterator_h *connection_iterator)
 Gets a connections iterator.
int inm_connection_iterator_next (inm_connection_iterator_h connection_iterator, inm_connection_h *connection)
 Moves the connection iterator to the next position and gets a connection handle.
int inm_destroy_connection_iterator (inm_connection_iterator_h connection_iterator)
 Destroys a connections iterator.

Typedefs

typedef void(* inm_cellular_state_changed_cb )(inm_cellular_state_e state, void *user_data)
 Called when the cellular state is changed.
typedef void(* inm_wifi_state_changed_cb )(inm_wifi_state_e state, void *user_data)
 Called when the Wi-Fi state is changed.
typedef void(* inm_ethernet_state_changed_cb )(inm_ethernet_state_e state, void *user_data)
 Called when the ethernet state is changed.

Typedef Documentation

typedef void(* inm_cellular_state_changed_cb)(inm_cellular_state_e state, void *user_data)

Called when the cellular state is changed.

Since :
5.0
Parameters:
[in]stateThe cellular state
[in]user_dataThe user data passed from the callback registration function
See also:
inm_set_cellular_state_changed_cb()
inm_unset_cellular_state_changed_cb()
typedef void(* inm_ethernet_state_changed_cb)(inm_ethernet_state_e state, void *user_data)

Called when the ethernet state is changed.

Since :
5.0
Parameters:
[in]stateThe ethernet state
[in]user_dataThe user data passed from the callback registration function
See also:
inm_set_ethernet_state_changed_cb()
inm_unset_ethernet_state_changed_cb()
typedef void(* inm_wifi_state_changed_cb)(inm_wifi_state_e state, void *user_data)

Called when the Wi-Fi state is changed.

Since :
5.0
Parameters:
[in]stateThe Wi-Fi state
[in]user_dataThe user data passed from the callback registration function
See also:
inm_set_wifi_state_changed_cb()
inm_unset_wifi_state_changed_cb()

Enumeration Type Documentation

Enumeration for cellular network state.

Since :
5.0
Enumerator:
INM_CELLULAR_STATE_DEACTIVATED 

Cellular is deactivated

INM_CELLULAR_STATE_DISCONNECTED 

Disconnected

INM_CELLULAR_STATE_CONNECTED 

Connected

Enumeration for ethernet state.

Since :
5.0
Enumerator:
INM_ETHERNET_STATE_DEACTIVATED 

There is no Ethernet profile to open

INM_ETHERNET_STATE_DISCONNECTED 

Disconnected

INM_ETHERNET_STATE_CONNECTED 

Connected

Enumeration for Wi-Fi state.

Since :
5.0
Enumerator:
INM_WIFI_STATE_DEACTIVATED 

Wi-Fi is deactivated

INM_WIFI_STATE_DISCONNECTED 

Disconnected

INM_WIFI_STATE_CONNECTED 

Connected


Function Documentation

int inm_connection_clone ( inm_connection_h cloned,
inm_connection_h  origin 
)

Clones a connection handle.

Since :
5.0
Remarks:
You must release cloned connection using inm_connection_destroy().
Parameters:
[out]clonedThe handle of the cloned connection
[in]originThe handle of the origin connection
Returns:
0 on success, otherwise a negative error value
Return values:
INM_ERROR_NONESuccessful
INM_ERROR_OUT_OF_MEMORYOut of memory
INM_ERROR_INVALID_PARAMETERInvalid parameter
INM_ERROR_NOT_SUPPORTEDNot supported
INM_ERROR_NOT_INITIALIZEDNot initialized
INM_ERROR_OPERATION_FAILEDOperation failed
See also:
inm_connection_destroy()

Destroys a connection handle.

Since :
5.0
Parameters:
[out]connectionThe connection handle
Returns:
0 on success, otherwise a negative error value
Return values:
INM_ERROR_NONESuccessful
INM_ERROR_INVALID_PARAMETERInvalid parameter
INM_ERROR_NOT_SUPPORTEDNot supported
INM_ERROR_NOT_INITIALIZEDNot initialized
INM_ERROR_OPERATION_FAILEDOperation failed
See also:
inm_get_current_connection()
int inm_connection_iterator_next ( inm_connection_iterator_h  connection_iterator,
inm_connection_h connection 
)

Moves the connection iterator to the next position and gets a connection handle.

Since :
5.0
Remarks:
After the iterator is created, its inner cursor is placed before the first element. The first call to inm_connection_iterator_next() gets the first element. You must release connection using inm_connection_destroy().
Parameters:
[in]connection_iteratorThe connection iterator
[out]connectionThe connection handle
Returns:
0 on success, otherwise a negative error value
Return values:
INM_ERROR_NONESuccessful
INM_ERROR_INVALID_PARAMETERInvalid parameter
INM_ERROR_NOT_SUPPORTEDNot supported
INM_ERROR_NOT_INITIALIZEDNot initialized
INM_ERROR_OPERATION_FAILEDOperation failed

Destroys a connections iterator.

Since :
5.0
Parameters:
[in]connection_iteratorThe connection iterator
Returns:
0 on success, otherwise a negative error value
Return values:
INM_ERROR_NONESuccessful
INM_ERROR_INVALID_PARAMETERInvalid parameter
INM_ERROR_NOT_SUPPORTEDNot supported
INM_ERROR_NOT_INITIALIZEDNot initialized

Gets the state of the cellular connection.

The returned state is for the cellular connection state.

Since :
5.0
Parameters:
[in]inmThe inm handle
[out]stateThe state of the cellular connection
Returns:
0 on success, otherwise a negative error value
Return values:
INM_ERROR_NONESuccessful
INM_ERROR_INVALID_PARAMETERInvalid parameter
INM_ERROR_NOT_SUPPORTEDNot supported
INM_ERROR_NOT_INITIALIZEDNot initialized
INM_ERROR_OPERATION_FAILEDOperation failed
int inm_get_connection_iterator ( inm_h  inm,
inm_connection_iterator_h connection_iterator 
)

Gets a connections iterator.

Since :
5.0
Privilege Level:
public
Privilege:
http://tizen.org/privilege/network.get
Remarks:
You must release connection_iterator using inm_destroy_connection_iterator().
Parameters:
[in]inmThe inm handle
[out]connection_iteratorThe iterator of connection
Returns:
0 on success, otherwise a negative error value
Return values:
INM_ERROR_NONESuccessful
INM_ERROR_OUT_OF_MEMORYOut of memory
INM_ERROR_PERMISSION_DENIEDPermission Denied
INM_ERROR_INVALID_PARAMETERInvalid parameter
INM_ERROR_NOT_SUPPORTEDNot supported
INM_ERROR_NOT_INITIALIZEDNot initialized
INM_ERROR_OPERATION_FAILEDOperation failed
int inm_get_current_connection ( inm_h  inm,
inm_connection_h connection 
)

Gets the handle of the default connection.

Since :
5.0
Privilege Level:
public
Privilege:
http://tizen.org/privilege/network.get
Remarks:
You must release connection using connection_connection_destroy().
Parameters:
[in]inmThe inm handle
[out]connectionThe connection handle
Returns:
0 on success, otherwise a negative error value
Return values:
INM_ERROR_NONESuccessful
INM_ERROR_OUT_OF_MEMORYOut of memory
INM_ERROR_PERMISSION_DENIEDPermission Denied
INM_ERROR_INVALID_PARAMETERInvalid parameter
INM_ERROR_NOT_SUPPORTEDNot supported
INM_ERROR_NOT_INITIALIZEDNot initialized
INM_ERROR_OPERATION_FAILEDOperation failed

Gets the state of the ethernet.

The returned state is for the ethernet connection state.

Since :
5.0
Privilege Level:
public
Privilege:
http://tizen.org/privilege/network.get
Parameters:
[in]inmThe inm handle
[out]stateThe state of ethernet connection
Returns:
0 on success, otherwise a negative error value
Return values:
INM_ERROR_NONESuccessful
INM_ERROR_PERMISSION_DENIEDPermission Denied
INM_ERROR_INVALID_PARAMETERInvalid parameter
INM_ERROR_NOT_SUPPORTEDNot supported
INM_ERROR_NOT_INITIALIZEDNot initialized
INM_ERROR_OPERATION_FAILEDOperation failed
int inm_get_wifi_state ( inm_h  inm,
inm_wifi_state_e state 
)

Gets the state of the Wi-Fi.

The returned state is for the Wi-Fi connection state.

Since :
5.0
Privilege Level:
public
Privilege:
http://tizen.org/privilege/network.get
Parameters:
[in]inmThe inm handle
[out]stateThe state of Wi-Fi connection
Returns:
0 on success, otherwise a negative error value
Return values:
INM_ERROR_NONESuccessful
INM_ERROR_PERMISSION_DENIEDPermission Denied
INM_ERROR_INVALID_PARAMETERInvalid parameter
INM_ERROR_NOT_SUPPORTEDNot supported
INM_ERROR_NOT_INITIALIZEDNot initialized
INM_ERROR_OPERATION_FAILEDOperation failed
int inm_set_cellular_state_changed_cb ( inm_h  inm,
inm_cellular_state_changed_cb  callback,
void *  user_data 
)

Sets a callback called when the cellular state is changed.

Since :
5.0
Parameters:
[in]inmThe monitor 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:
INM_ERROR_NONESuccessful
INM_ERROR_INVALID_PARAMETERInvalid parameter
INM_ERROR_NOT_SUPPORTEDNot supported
INM_ERROR_NOT_INITIALIZEDNot initialized
INM_ERROR_OPERATION_FAILEDOperation failed
See also:
inm_cellular_state_changed_cb()
inm_unset_cellular_state_changed_cb()
int inm_set_ethernet_state_changed_cb ( inm_h  inm,
inm_ethernet_state_changed_cb  callback,
void *  user_data 
)

Sets a callback called when the ethernet state is changed.

Since :
5.0
Parameters:
[in]inmThe monitor 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:
INM_ERROR_NONESuccessful
INM_ERROR_INVALID_PARAMETERInvalid parameter
INM_ERROR_NOT_SUPPORTEDNot supported
INM_ERROR_NOT_INITIALIZEDNot initialized
INM_ERROR_OPERATION_FAILEDOperation failed
See also:
inm_ethernet_state_changed_cb()
inm_unset_ethernet_state_changed_cb()
int inm_set_wifi_state_changed_cb ( inm_h  inm,
inm_wifi_state_changed_cb  callback,
void *  user_data 
)

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

Since :
5.0
Parameters:
[in]inmThe monitor 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:
INM_ERROR_NONESuccessful
INM_ERROR_INVALID_PARAMETERInvalid parameter
INM_ERROR_NOT_SUPPORTEDNot supported
INM_ERROR_NOT_INITIALIZEDNot initialized
INM_ERROR_OPERATION_FAILEDOperation failed
See also:
inm_wifi_state_changed_cb()
inm_unset_wifi_state_changed_cb()

Unsets the callback called when the cellular state is changed.

Since :
5.0
Parameters:
[in]inmThe monitor handle
Returns:
0 on success, otherwise negative error value
Return values:
INM_ERROR_NONESuccessful
INM_ERROR_INVALID_PARAMETERInvalid parameter
INM_ERROR_NOT_SUPPORTEDNot supported
INM_ERROR_NOT_INITIALIZEDNot initialized
INM_ERROR_OPERATION_FAILEDOperation failed
See also:
inm_cellular_state_changed_cb()
inm_set_cellular_state_changed_cb()

Unsets the callback called when the ethernet state is changed.

Since :
5.0
Parameters:
[in]inmThe monitor handle
Returns:
0 on success, otherwise negative error value
Return values:
INM_ERROR_NONESuccessful
INM_ERROR_INVALID_PARAMETERInvalid parameter
INM_ERROR_NOT_SUPPORTEDNot supported
INM_ERROR_NOT_INITIALIZEDNot initialized
INM_ERROR_OPERATION_FAILEDOperation failed
See also:
inm_ethernet_state_changed_cb()
inm_set_ethernet_state_changed_cb()

Unsets the callback called when the Wi-Fi state is changed.

Since :
5.0
Parameters:
[in]inmThe monitor handle
Returns:
0 on success, otherwise negative error value
Return values:
INM_ERROR_NONESuccessful
INM_ERROR_INVALID_PARAMETERInvalid parameter
INM_ERROR_NOT_SUPPORTEDNot supported
INM_ERROR_NOT_INITIALIZEDNot initialized
INM_ERROR_OPERATION_FAILEDOperation failed
See also:
inm_wifi_state_changed_cb()
inm_set_wifi_state_changed_cb()