Tizen Native API  9.0

The STC Manager API provides functions for managing STC.

Required Header

#include <stc.h>

Overview

To use STC manager API, first create the STC handle using stc_initialize(). After that, you can obtain STC information. You should destroy the created STC handle if you do not need it anymore. The STC manager API provides functions for managing STC. Using the STC manager, you can implement features that allow the users of your application to:

  • Reset / Get / Update the statistics information
  • Set / Get / Remove / Exclude the restriction rule

Related Features

This API is related with the following features:

It is recommended to use features in your application for reliability.

You can check if a device supports the related features for this API by using System Information, thereby controlling the procedure of your application.

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 stc_get_stats (stc_h stc, stc_stats_rule_h rule, stc_stats_info_cb info_cb, void *user_data) TIZEN_DEPRECATED_API
 Gets the statistics information an application matched rule asynchronously.
int stc_foreach_stats (stc_h stc, stc_stats_rule_h rule, stc_stats_info_cb info_cb, void *user_data) TIZEN_DEPRECATED_API
 Gets the statistics information of each application asynchronously.
int stc_get_all_stats (stc_h stc, stc_stats_rule_h rule, stc_get_all_stats_finished_cb finished_cb, void *user_data)
 Starts to get statistical information based on the rules asynchronously.
int stc_foreach_all_stats (stc_all_stats_info_h info, stc_stats_info_cb info_cb, void *user_data)
 Gets all statistical information.
int stc_get_total_stats (stc_h stc, stc_stats_rule_h rule, stc_stats_info_cb info_cb, void *user_data) TIZEN_DEPRECATED_API
 Gets the total statistics information by interface type asynchronously.

Typedefs

typedef stc_callback_ret_e(* stc_stats_info_cb )(stc_error_e result, stc_stats_info_h info, void *user_data)
 Called whenever there is available statistical information.
typedef void(* stc_get_all_stats_finished_cb )(stc_error_e result, stc_all_stats_info_h info, void *user_data)
 Called when getting all statistical information is finished.

Typedef Documentation

typedef void(* stc_get_all_stats_finished_cb)(stc_error_e result, stc_all_stats_info_h info, void *user_data)

Called when getting all statistical information is finished.

One of the following errors is delivered as a result. STC_ERROR_NONE Successful
STC_ERROR_INVALID_OPERATION No reply
STC_ERROR_OPERATION_FAILED Operation failed
STC_ERROR_PERMISSION_DENIED Access or permission denied

Since :
5.5
Remarks:
info will be released by the platform after the callback exits.
Parameters:
[in]resultThe result of statistics gathering completion
[in]infoThe handle of all statistical information
[in]user_dataThe user data passed from the statistics provider function
Precondition:
stc_get_all_stats() will invoke this callback.
See also:
stc_get_all_stats()
typedef stc_callback_ret_e(* stc_stats_info_cb)(stc_error_e result, stc_stats_info_h info, void *user_data)

Called whenever there is available statistical information.

One of the following errors is delivered as a result. STC_ERROR_NONE Successful
STC_ERROR_INVALID_OPERATION No reply
STC_ERROR_OPERATION_FAILED Operation failed
STC_ERROR_PERMISSION_DENIED Access or permission denied

Since :
4.0
Parameters:
[in]resultThe result of statistics information getting
[in]infoThe statistics information handle
[in]user_dataThe user data passed from the statistics provider function
Returns:
STC_CALLBACK_CONTINUE to continue with the next iteration of the loop, otherwise STC_CALLBACK_CANCEL to break out of the loop
Precondition:
stc_foreach_stats() will invoke this callback.
See also:
stc_stats_info_get_app_id()
stc_stats_info_get_iface_name()
stc_stats_info_get_time_interval()
stc_stats_info_get_iface_type()
stc_stats_info_get_counter()
stc_stats_info_get_roaming_type()
stc_stats_info_get_protocol_type()
stc_stats_info_get_process_state()

Enumeration Type Documentation

Enumeration for return type of the callback.

Since :
4.0
Enumerator:
STC_CALLBACK_CANCEL 

Cancel

STC_CALLBACK_CONTINUE 

Continue

Enumeration for network connection period type.

Last received/sent mean counting data from the first connection of each interface.

Since :
4.0
Enumerator:
STC_CONN_PERIOD_UNKNOWN 

Unknown period

STC_CONN_PERIOD_LAST_RECEIVED_DATA 

Last received data

STC_CONN_PERIOD_LAST_SENT_DATA 

Last sent data

STC_CONN_PERIOD_TOTAL_RECEIVED_DATA 

Total received data

STC_CONN_PERIOD_TOTAL_SENT_DATA 

Total sent data

Enumeration for network interface type.

Since :
4.0
Enumerator:
STC_IFACE_UNKNOWN 

Unknown interface

STC_IFACE_DATACALL 

Mobile data

STC_IFACE_WIFI 

Wifi data

STC_IFACE_WIRED 

Wired interface

STC_IFACE_BLUETOOTH 

Bluetooth interface

STC_IFACE_ALL 

Enumerate all network interface types

Enumeration for monitored process state.

Since :
4.0
Enumerator:
STC_PROCESS_STATE_UNKNOWN 

Unknown state

STC_PROCESS_STATE_FOREGROUND 

Foreground state

STC_PROCESS_STATE_BACKGROUND 

Background state

Enumeration for hardware network protocol type.

Since :
4.0
Enumerator:
STC_PROTOCOL_UNKNOWN 

Network unknown

STC_PROTOCOL_DATACALL_NOSVC 

Network no service

STC_PROTOCOL_DATACALL_EMERGENCY 

Network emergency

STC_PROTOCOL_DATACALL_SEARCH 

Network search 1900

STC_PROTOCOL_DATACALL_2G 

Network 2G

STC_PROTOCOL_DATACALL_2_5G 

Network 2.5G

STC_PROTOCOL_DATACALL_2_5G_EDGE 

Network EDGE

STC_PROTOCOL_DATACALL_3G 

Network UMTS

STC_PROTOCOL_DATACALL_HSDPA 

Network HSDPA

STC_PROTOCOL_DATACALL_LTE 

Network LTE

Enumeration for network roaming type.

Since :
4.0
Enumerator:
STC_ROAMING_UNKNOWN 

Roaming unknown

STC_ROAMING_ENABLED 

In roaming

STC_ROAMING_DISABLED 

Not in roaming

Enumeration for time period.

Since :
4.0
Enumerator:
STC_TIME_PERIOD_UNKNOWN 

Unknown

STC_TIME_PERIOD_HOUR 

Hour

STC_TIME_PERIOD_DAY 

Day

STC_TIME_PERIOD_WEEK 

Week

STC_TIME_PERIOD_MONTH 

Month


Function Documentation

int stc_foreach_all_stats ( stc_all_stats_info_h  info,
stc_stats_info_cb  info_cb,
void *  user_data 
)

Gets all statistical information.

This function retrieves all statistical information stored in the given handle and iterates over each entry, invoking the provided callback function for each item. The callback function can then process the individual statistics as needed.

Since :
5.5
Parameters:
[in]infoAll statistics information handle
[in]info_cbThe callback is called for each application
[in]user_dataThe user data passed to the callback function
Returns:
0 on success, otherwise a negative error value
Return values:
STC_ERROR_NONESuccessful
STC_ERROR_OPERATION_FAILEDGeneral error
STC_ERROR_INVALID_PARAMETERInvalid parameter
STC_ERROR_NOT_INITIALIZEDNot initialized
STC_ERROR_NOT_SUPPORTEDNot supported
Precondition:
stc_get_all_stats() needs to be called and data needs to be received in stc_get_stats_finished_cb() before calling this function.
Postcondition:
This function invokes stc_stats_info_cb().
See also:
stc_get_all_stats()
stc_stats_info_cb()
int stc_foreach_stats ( stc_h  stc,
stc_stats_rule_h  rule,
stc_stats_info_cb  info_cb,
void *  user_data 
)

Gets the statistics information of each application asynchronously.

Deprecated:
Deprecated since 5.5. Use stc_get_all_stats() and stc_foreach_all_stats() instead.

The callback is called for each application that used network in between timestamps specified. If interface name is not specified, each application will only appear once with the total traffic used over all interfaces.

Since :
4.0
Privilege Level:
public
Privilege:
http://tizen.org/privilege/network.get
Parameters:
[in]stcThe STC handle
[in]ruleThe statistics rule handle
[in]info_cbThe callback is called for each application that used network in between timestamps specified
[in]user_dataThe user data passed to the callback function
Returns:
0 on success, otherwise a negative error value
Return values:
STC_ERROR_NONESuccessful
STC_ERROR_OPERATION_FAILEDGeneral error
STC_ERROR_OUT_OF_MEMORYOut of memory
STC_ERROR_INVALID_PARAMETERInvalid parameter
STC_ERROR_INVALID_OPERATIONInvalid operation
STC_ERROR_NOT_INITIALIZEDNot initialized
STC_ERROR_NOT_SUPPORTEDNot supported
STC_ERROR_PERMISSION_DENIEDPermission denied
See also:
stc_h
stc_stats_rule_h
stc_initialize()
stc_stats_rule_create()
stc_stats_rule_destroy()
stc_stats_rule_set_app_id()
stc_stats_rule_set_time_interval()
stc_stats_rule_set_iface_type()
stc_stats_rule_set_time_period()
stc_stats_rule_get_app_id()
stc_stats_rule_get_time_interval()
stc_stats_rule_get_iface_type()
stc_stats_rule_get_time_period()
stc_stats_info_cb()
int stc_get_all_stats ( stc_h  stc,
stc_stats_rule_h  rule,
stc_get_all_stats_finished_cb  finished_cb,
void *  user_data 
)

Starts to get statistical information based on the rules asynchronously.

This function initiates the process of gathering statistical information based on the specified rules. It runs in an asynchronous manner, meaning that the function returns immediately and the results are provided later via the callback function.

Since :
5.5
Privilege Level:
public
Privilege:
http://tizen.org/privilege/network.get
Parameters:
[in]stcThe STC handle
[in]ruleThe statistics rule handle
[in]finished_cbThe callback is called when information gathering is completed
[in]user_dataThe user data passed to the callback function
Returns:
0 on success, otherwise a negative error value
Return values:
STC_ERROR_NONESuccessful
STC_ERROR_OPERATION_FAILEDGeneral error
STC_ERROR_INVALID_PARAMETERInvalid parameter
STC_ERROR_INVALID_OPERATIONInvalid operation
STC_ERROR_NOT_INITIALIZEDNot initialized
STC_ERROR_NOT_SUPPORTEDNot supported
STC_ERROR_PERMISSION_DENIEDPermission denied
Postcondition:
This function invokes stc_get_all_stats_finished_cb().
See also:
stc_h
stc_stats_rule_h
stc_initialize()
stc_stats_rule_create()
stc_stats_rule_destroy()
stc_stats_rule_set_app_id()
stc_stats_rule_set_time_interval()
stc_stats_rule_set_iface_type()
stc_stats_rule_set_time_period()
stc_stats_rule_get_app_id()
stc_stats_rule_get_time_interval()
stc_stats_rule_get_iface_type()
stc_stats_rule_get_time_period()
stc_get_all_stats_finished_cb()
int stc_get_stats ( stc_h  stc,
stc_stats_rule_h  rule,
stc_stats_info_cb  info_cb,
void *  user_data 
)

Gets the statistics information an application matched rule asynchronously.

Deprecated:
Deprecated since 5.5. Use stc_get_all_stats() and stc_foreach_all_stats() instead.
Since :
4.0
Privilege Level:
public
Privilege:
http://tizen.org/privilege/network.get
Parameters:
[in]stcThe STC handle
[in]ruleThe statistics rule handle
[in]info_cbThe callback is called for each application that used network in between timestamps specified
[in]user_dataThe user data passed to the callback function
Returns:
0 on success, otherwise a negative error value
Return values:
STC_ERROR_NONESuccessful
STC_ERROR_OPERATION_FAILEDGeneral error
STC_ERROR_OUT_OF_MEMORYOut of memory
STC_ERROR_INVALID_PARAMETERInvalid parameter
STC_ERROR_INVALID_OPERATIONInvalid operation
STC_ERROR_NOT_INITIALIZEDNot initialized
STC_ERROR_NOT_SUPPORTEDNot supported
STC_ERROR_PERMISSION_DENIEDPermission denied
See also:
stc_h
stc_stats_rule_h
stc_initialize()
stc_stats_rule_create()
stc_stats_rule_destroy()
stc_stats_rule_set_app_id()
stc_stats_rule_set_time_interval()
stc_stats_rule_set_iface_type()
stc_stats_rule_set_time_period()
stc_stats_rule_get_app_id()
stc_stats_rule_get_time_interval()
stc_stats_rule_get_iface_type()
stc_stats_rule_get_time_period()
stc_stats_info_cb()
int stc_get_total_stats ( stc_h  stc,
stc_stats_rule_h  rule,
stc_stats_info_cb  info_cb,
void *  user_data 
)

Gets the total statistics information by interface type asynchronously.

Deprecated:
Deprecated since 5.5. Use stc_get_all_stats() and stc_foreach_all_stats() instead.
Since :
4.0
Privilege Level:
public
Privilege:
http://tizen.org/privilege/network.get
Parameters:
[in]stcThe STC handle
[in]ruleThe statistics rule handle
[in]info_cbThe callback is called for each application that used network in between timestamps specified
[in]user_dataThe user data passed to the callback function
Returns:
0 on success, otherwise a negative error value
Return values:
STC_ERROR_NONESuccessful
STC_ERROR_OPERATION_FAILEDGeneral error
STC_ERROR_OUT_OF_MEMORYOut of memory
STC_ERROR_INVALID_PARAMETERInvalid parameter
STC_ERROR_INVALID_OPERATIONInvalid operation
STC_ERROR_NOT_INITIALIZEDNot initialized
STC_ERROR_NOT_SUPPORTEDNot supported
STC_ERROR_PERMISSION_DENIEDPermission denied
See also:
stc_h
stc_stats_rule_h
stc_initialize()
stc_stats_rule_create()
stc_stats_rule_destroy()
stc_stats_rule_set_app_id()
stc_stats_rule_set_time_interval()
stc_stats_rule_set_iface_type()
stc_stats_rule_set_time_period()
stc_stats_rule_get_app_id()
stc_stats_rule_get_time_interval()
stc_stats_rule_get_iface_type()
stc_stats_rule_get_time_period()
stc_stats_info_cb()