Modified to send message to net popup
[platform/core/connectivity/stc-manager.git] / src / monitor / stc-monitor.c
index 4210441..5885fc9 100755 (executable)
@@ -894,6 +894,8 @@ static void __action_when_rstn_limit_exceeded(stc_rstn_limit_type_e limit_type,
        char iftype[MAX_INT_LENGTH];
        char byte[MAX_INT_LENGTH];
        const char *signal_name;
+       const char *net_popup_content;
+       const char *net_popup_type;
        stc_s *stc = (stc_s *)stc_get_manager();
 
        if (stc == NULL) {
@@ -905,13 +907,8 @@ static void __action_when_rstn_limit_exceeded(stc_rstn_limit_type_e limit_type,
        case STC_RSTN_LIMIT_TYPE_DATA_WARN:
        {
                signal_name = "WarnThresholdCrossed";
-
-               snprintf(iftype, MAX_INT_LENGTH, "%d", rstn_key->iftype);
-               snprintf(byte, MAX_INT_LENGTH, "%lld", rstn_value->limit[limit_type]);
-               stc_plugin_appstatus_send_warn_message("warn threshold crossed",
-                                                                               "warning_noti",
-                                                                               rstn_key->app_id,
-                                                                               iftype, byte);
+               net_popup_content = "warn threshold crossed";
+               net_popup_type = "warning_noti";
        }
        break;
        case STC_RSTN_LIMIT_TYPE_DATA:
@@ -920,6 +917,8 @@ static void __action_when_rstn_limit_exceeded(stc_rstn_limit_type_e limit_type,
        case STC_RSTN_LIMIT_TYPE_DAILY:
        {
                signal_name = "RestrictionThresholdCrossed";
+               net_popup_content = "restriction threshold crossed";
+               net_popup_type = "restriction_noti";
 
                /* block immediately */
                context->counter->intend = NFACCT_BLOCK;
@@ -935,13 +934,6 @@ static void __action_when_rstn_limit_exceeded(stc_rstn_limit_type_e limit_type,
                context->counter->intend = NFACCT_COUNTER;
 
                rstn_value->limit_exceeded |= (1 << limit_type);
-
-               snprintf(iftype, MAX_INT_LENGTH, "%d", rstn_key->iftype);
-               snprintf(byte, MAX_INT_LENGTH, "%lld", rstn_value->limit[limit_type]);
-               stc_plugin_appstatus_send_restriction_message("restriction threshold crossed",
-                                                                               "restriction_noti",
-                                                                               rstn_key->app_id,
-                                                                               iftype, byte);
        }
        break;
        default:
@@ -959,6 +951,11 @@ static void __action_when_rstn_limit_exceeded(stc_rstn_limit_type_e limit_type,
 
        if (rv == TRUE)
                rstn_value->limit_notified |= (1 << limit_type);
+
+       snprintf(iftype, MAX_INT_LENGTH, "%d", rstn_key->iftype);
+       snprintf(byte, MAX_INT_LENGTH, "%lld", rstn_value->limit[limit_type]);
+       stc_plugin_appstatus_send_message(net_popup_content,
+                       net_popup_type, rstn_key->app_id, iftype, byte);
 }
 
 static gboolean __rstn_counter_update(stc_rstn_key_s *rstn_key,