if (snr_level != rssi_data->last_snr_level) {
default_ifname = netconfig_get_default_ifname();
if (g_strcmp0(default_ifname, interface_name) == 0)
- netconfig_set_vconf_int(VCONFKEY_WIFI_STRENGTH, snr_level);
+ netconfig_set_vconf_int(VCONFKEY_WIFI_STRENGTH, snr_level, FALSE);
if (g_strcmp0(rssi_data->default_path, path) == 0) {
wifi_emit_rssi_changed((Wifi *)get_wifi_object(), interface_name, snr_level);
static void __netconfig_wifi_get_statistics(void)
{
static int last_transfer_state = 0;
- static guint64 netconfig_wifi_tx_bytes = 0;
- static guint64 netconfig_wifi_rx_bytes = 0;
static int booster_tic = 0;
static int old_level = 0;
int booster_level = 0;
- guint64 tx, rx, tx_diff, rx_diff;
+ guint64 tx, rx;
int transfer_state;
- if (netconfig_wifi_get_bytes_statistics(&tx, &rx) == TRUE) {
- tx_diff = tx - netconfig_wifi_tx_bytes;
- rx_diff = rx - netconfig_wifi_rx_bytes;
-
- if (tx_diff > 0) {
- if (rx_diff > 0)
- transfer_state = VCONFKEY_WIFI_TRANSFER_STATE_TXRX;
- else
- transfer_state = VCONFKEY_WIFI_TRANSFER_STATE_TX;
- } else {
- if (rx_diff > 0)
- transfer_state = VCONFKEY_WIFI_TRANSFER_STATE_RX;
- else
- transfer_state = VCONFKEY_WIFI_TRANSFER_STATE_NONE;
- }
+ if (netconfig_wifi_get_bytes_statistics(&tx, &rx, TRUE))
+ netconfig_wifi_set_bytes_pkt_vconf(tx, rx, FALSE);
+
+ netconfig_wifi_get_bytes_default_iface(&tx, &rx);
+
+ if (tx > 0) {
+ if (rx > 0)
+ transfer_state = VCONFKEY_WIFI_TRANSFER_STATE_TXRX;
+ else
+ transfer_state = VCONFKEY_WIFI_TRANSFER_STATE_TX;
+ } else {
+ if (rx > 0)
+ transfer_state = VCONFKEY_WIFI_TRANSFER_STATE_RX;
+ else
+ transfer_state = VCONFKEY_WIFI_TRANSFER_STATE_NONE;
+ }
- if (transfer_state != last_transfer_state) {
- netconfig_set_vconf_int(VCONFKEY_WIFI_TRANSFER_STATE, transfer_state);
- last_transfer_state = transfer_state;
- }
+ if (transfer_state != last_transfer_state) {
+ netconfig_set_vconf_int(VCONFKEY_WIFI_TRANSFER_STATE, transfer_state, FALSE);
+ last_transfer_state = transfer_state;
+ }
- /* NETCONFIG_WIFI_DATA_ACTIVITY_BOOSTER */
- if (tx_diff >= NETCONFIG_WIFI_DATA_ACTIVITY_BOOSTER_LEVEL1 ||
- rx_diff >= NETCONFIG_WIFI_DATA_ACTIVITY_BOOSTER_LEVEL1)
- booster_level = 1;
- else if (tx_diff >= NETCONFIG_WIFI_DATA_ACTIVITY_BOOSTER_LEVEL2 ||
- rx_diff >= NETCONFIG_WIFI_DATA_ACTIVITY_BOOSTER_LEVEL2)
- booster_level = 2;
- else if (tx_diff >= NETCONFIG_WIFI_DATA_ACTIVITY_BOOSTER_LEVEL3 ||
- rx_diff >= NETCONFIG_WIFI_DATA_ACTIVITY_BOOSTER_LEVEL3)
- booster_level = 3;
-
- if (old_level == booster_level) {
- if (--booster_tic <= 0) {
- __netconfig_wifi_data_activity_booster(booster_level);
-
- booster_tic = 2;
- }
- } else {
+ /* NETCONFIG_WIFI_DATA_ACTIVITY_BOOSTER */
+ if (tx >= NETCONFIG_WIFI_DATA_ACTIVITY_BOOSTER_LEVEL1 ||
+ rx >= NETCONFIG_WIFI_DATA_ACTIVITY_BOOSTER_LEVEL1)
+ booster_level = 1;
+ else if (tx >= NETCONFIG_WIFI_DATA_ACTIVITY_BOOSTER_LEVEL2 ||
+ rx >= NETCONFIG_WIFI_DATA_ACTIVITY_BOOSTER_LEVEL2)
+ booster_level = 2;
+ else if (tx >= NETCONFIG_WIFI_DATA_ACTIVITY_BOOSTER_LEVEL3 ||
+ rx >= NETCONFIG_WIFI_DATA_ACTIVITY_BOOSTER_LEVEL3)
+ booster_level = 3;
+
+ if (old_level == booster_level) {
+ if (--booster_tic <= 0) {
__netconfig_wifi_data_activity_booster(booster_level);
- if (booster_level > 0)
- booster_tic = 2;
- else
- booster_tic = 0;
+ booster_tic = 2;
}
+ } else {
+ __netconfig_wifi_data_activity_booster(booster_level);
- old_level = booster_level;
-
- netconfig_wifi_tx_bytes = tx;
- netconfig_wifi_rx_bytes = rx;
+ if (booster_level > 0)
+ booster_tic = 2;
+ else
+ booster_tic = 0;
}
+
+ old_level = booster_level;
}
static gboolean __netconfig_wifi_update_statistics(gpointer data)
default_ifname = netconfig_get_default_ifname();
if (g_strcmp0(default_ifname, interface_name) == 0)
- netconfig_set_vconf_int(VCONFKEY_WIFI_STRENGTH, VCONFKEY_WIFI_STRENGTH_MAX);
+ netconfig_set_vconf_int(VCONFKEY_WIFI_STRENGTH, VCONFKEY_WIFI_STRENGTH_MAX, FALSE);
wifi_emit_rssi_changed((Wifi *)get_wifi_object(),
interface_name, VCONFKEY_WIFI_STRENGTH_MAX);
- netconfig_start_timer_seconds(WIFI_INDICATOR_INTERVAL,
- __netconfig_wifi_update_statistics, g_strdup(interface_name),
- &netconfig_wifi_statistics_timer);
+ if (netconfig_wifi_statistics_timer == 0) {
+ netconfig_wifi_reset_last_bytes();
+ netconfig_start_timer_seconds(WIFI_INDICATOR_INTERVAL,
+ __netconfig_wifi_update_statistics, g_strdup(interface_name),
+ &netconfig_wifi_statistics_timer);
+ }
netconfig_battery_update_wifi_rssi(VCONFKEY_WIFI_STRENGTH_MAX);
}
void netconfig_wifi_indicator_stop(const char *interface_name)
{
+ int wifi_state = 0;
+ guint64 tx, rx;
+
INFO("Stop Wi-Fi indicator");
- netconfig_stop_timer(&netconfig_wifi_statistics_timer);
+ netconfig_vconf_get_int(VCONFKEY_WIFI_STATE, &wifi_state);
+
+ if (wifi_state != VCONFKEY_WIFI_CONNECTED) {
+ if (netconfig_wifi_get_bytes_statistics(&tx, &rx, TRUE))
+ netconfig_wifi_set_bytes_pkt_vconf(tx, rx, FALSE);
+
+ netconfig_stop_timer(&netconfig_wifi_statistics_timer);
+ }
__destroy_rssi_data(interface_name);
}