Tizen Native API  3.0
Connection Statistics

The Connection Statistics API provides functions for getting the statistical information.

Required Header

#include <net_connection.h>

Overview

The Connection allows you to track the data transfer information. Use the Connection statistics to gather and reset statistics on network usage, such as the size of the sent or received data, in bytes. It also provides methods for getting the cumulative size of packets sent or received.

Related Features

This API is related with the following features:

  • http://tizen.org/feature/network.wifi
  • http://tizen.org/feature/network.telephony
    It is recommended to design feature related codes 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 List.

Functions

int connection_get_statistics (connection_h connection, connection_type_e connection_type, connection_statistics_type_e statistics_type, long long *size)
 Gets the statistics information.
int connection_reset_statistics (connection_h connection, connection_type_e connection_type, connection_statistics_type_e statistics_type)
 Resets the statistics information.

Enumeration Type Documentation

Enumeration for statistics type.

Since :
2.3
Enumerator:
CONNECTION_STATISTICS_TYPE_LAST_RECEIVED_DATA 

Last received data

CONNECTION_STATISTICS_TYPE_LAST_SENT_DATA 

Last sent data

CONNECTION_STATISTICS_TYPE_TOTAL_RECEIVED_DATA 

Total received data

CONNECTION_STATISTICS_TYPE_TOTAL_SENT_DATA 

Total sent data


Function Documentation

int connection_get_statistics ( connection_h  connection,
connection_type_e  connection_type,
connection_statistics_type_e  statistics_type,
long long *  size 
)

Gets the statistics information.

Since :
2.3
Privilege Level:
public
Privilege:
http://tizen.org/privilege/network.get
Parameters:
[in]connectionThe connection handle
[in]connection_typeThe type of connection (only CONNECTION_TYPE_WIFI and CONNECTION_TYPE_CELLULAR are supported)
[in]statistics_typeThe type of statistics
[out]sizeThe received data size of the last cellular packet data connection (bytes)
Returns:
0 on success, otherwise a negative error value
Return values:
CONNECTION_ERROR_NONESuccessful
CONNECTION_ERROR_INVALID_PARAMETERInvalid parameter
CONNECTION_ERROR_OPERATION_FAILEDOperation failed
CONNECTION_ERROR_NOT_SUPPORTEDNot Supported
int connection_reset_statistics ( connection_h  connection,
connection_type_e  connection_type,
connection_statistics_type_e  statistics_type 
)

Resets the statistics information.

Since :
2.3
Privilege Level:
public
Privilege:
http://tizen.org/privilege/network.set
Remarks:
This API needs both privileges.
Parameters:
[in]connectionThe connection handle
[in]connection_typeThe type of connection (only CONNECTION_TYPE_WIFI and CONNECTION_TYPE_CELLULAR are supported)
[in]statistics_typeThe type of statistics
Returns:
0 on success, otherwise a negative error value
Return values:
CONNECTION_ERROR_NONESuccessful
CONNECTION_ERROR_INVALID_PARAMETERInvalid parameter
CONNECTION_ERROR_OPERATION_FAILEDOperation failed
CONNECTION_ERROR_PERMISSION_DENIEDPermission Denied
CONNECTION_ERROR_NOT_SUPPORTEDNot Supported