Fix not to use app-status plugin from monitor plugin
[platform/core/connectivity/stc-manager.git] / plugin / monitor / stc-plugin-monitor-rstn.c
index 365207c..ab88ae3 100755 (executable)
@@ -16,6 +16,9 @@
 
 #include <vconf.h>
 #include <vconf-keys.h>
+#include <bundle.h>
+#include <bundle_internal.h>
+#include <syspopup_caller.h>
 
 #include "counter.h"
 #include "stc-plugin-monitor.h"
@@ -26,7 +29,6 @@
 #include "table-restrictions.h"
 #include "table-statistics.h"
 #include "helper-net-cls.h"
-#include "stc-manager-plugin-appstatus.h"
 #include "stc-manager-plugin-tether.h"
 
 static void __print_rstn(stc_rstn_data_s *rstn_data)
@@ -1200,6 +1202,7 @@ void stc_monitor_rstn_update_counter(gpointer data,
                                        gpointer user_data)
 {
        int i;
+       int is_roaming = 0;
        stc_rstn_data_s *rstn_data = (stc_rstn_data_s *)data;
        classid_bytes_context_s *context = (classid_bytes_context_s *)user_data;
        GSList *conn_list = stc_get_connection_list();
@@ -1220,7 +1223,8 @@ void stc_monitor_rstn_update_counter(gpointer data,
                        g_strcmp0(rstn_data->subscriber_id, conn->subscriber_id) != 0)
                        return;
 
-               if (rstn_data->roaming != conn->roaming)
+               is_roaming = (rstn_data->roaming == STC_ROAMING_ENABLE) ? 1 : 0;
+               if (is_roaming != conn->roaming)
                        return;
 
                if (rstn_data->limit_exceeded != 0) {
@@ -1297,6 +1301,35 @@ void stc_monitor_rstn_update_iface_counter(classid_bytes_context_s *context)
        }
 }
 
+static int stc_plugin_monitor_launch_rstn_popup(const char *content,
+               const char *type, const char *app_id,
+               const char *iftype, const char *limit)
+{
+       int ret = 0;
+       bundle *b = bundle_create();
+
+       bundle_add(b, "_SYSPOPUP_CONTENT_", content);
+       bundle_add(b, "_SYSPOPUP_TYPE_", type);
+       bundle_add(b, "_APP_ID_", app_id);
+       bundle_add(b, "_IF_TYPE_", iftype);
+
+       if (g_strcmp0(type, "warning_noti") == 0) {
+               bundle_add(b, "_WARN_LIMIT_", limit);
+               STC_LOGD("Warn message : content[%s] type[%s] app_id[%s] limit[%s]",
+                       content, type, app_id, limit);
+       } else {
+               bundle_add(b, "_RESTRICTION_LIMIT_", limit);
+               STC_LOGD("Restriction message : content[%s] type[%s] app_id[%s] limit[%s]",
+                       content, type, app_id, limit);
+       }
+
+       ret = syspopup_launch("net-popup", b);
+
+       bundle_free(b);
+
+       return ret;
+}
+
 void stc_monitor_rstn_action_when_limit_exceeded(stc_rstn_limit_type_e limit_type,
                                                stc_rstn_data_s *rstn_data,
                                                classid_bytes_context_s *context)
@@ -1383,7 +1416,7 @@ void stc_monitor_rstn_action_when_limit_exceeded(stc_rstn_limit_type_e limit_typ
 
        snprintf(iftype, MAX_INT_LENGTH, "%d", rstn_data->iftype);
        snprintf(byte, MAX_INT_LENGTH, "%lld", rstn_data->limit[limit_type]);
-       stc_plugin_appstatus_send_message(net_popup_content,
+       stc_plugin_monitor_launch_rstn_popup(net_popup_content,
                        net_popup_type, rstn_data->app_id, iftype, byte);
 
        if (STC_DEBUG_LOG && STC_RSTN_LOG)