else
apptype = STC_APP_TYPE_GUI;
- if (STC_DEBUG_LOG) {
- STC_LOGD("\033[1;36mAPP STATUS\033[0;m: Pkg ID [\033[0;34m%s\033[0;m], "
- "App ID [\033[0;32m%s\033[0;m], PID [\033[1;33m%d\033[0;m], Status [%s], Type [%s]",
+ if (STC_STAT_LOG) {
+ STC_LOGD("\033[1;34mAPP STATUS\033[0;m: PkgID[\033[0;34m%s\033[0;m] "
+ "AppID[\033[0;32m%s\033[0;m] PID[\033[1;33m%d\033[0;m] Status[%s] Type[%s]",
pkgid, appid, pid, statstr, pkgtype);
}
static stc_error_e __ground_status_monitor_init(stc_s *stc)
{
guint i = 0;
+ guint size = 0;
ret_value_msg_if(stc == NULL, STC_ERROR_INVALID_PARAMETER, "failed to get stc data");
- for (i = 0; signal_map[i].member != NULL; i++) {
+ size = sizeof(signal_map) / sizeof(signal_map[0]);
+
+ for (i = 0; signal_map[i].member != NULL && i < size; i++) {
signal_map[i].sub_id =
g_dbus_connection_signal_subscribe(stc->connection,
NULL,
static stc_error_e __ground_status_monitor_deinit(stc_s *stc)
{
guint i = 0;
+ guint size = 0;
ret_value_msg_if(stc == NULL, STC_ERROR_INVALID_PARAMETER, "failed to get stc data");
- for (i = 0; signal_map[i].member != NULL; i++) {
+ size = sizeof(signal_map) / sizeof(signal_map[0]);
+
+ for (i = 0; signal_map[i].member != NULL && i < size; i++) {
g_dbus_connection_signal_unsubscribe(stc->connection,
signal_map[i].sub_id);
signal_map[i].sub_id = 0;
return 0;
}
-int stc_plugin_popup_send_warn_message(const char *content,
- const char *type, const char *app_id, const char *iftype, const char *warn)
-{
- int ret = 0;
- bundle *b = bundle_create();
-
- STC_LOGD("Warn message : content[%s] type[%s] app_id[%s] warn[%s]",
- content, type, app_id, warn);
-
- 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);
- bundle_add(b, "_WARN_LIMIT_", warn);
-
- ret = syspopup_launch("net-popup", b);
-
- bundle_free(b);
-
- return ret;
-}
-
-int stc_plugin_popup_send_restriction_message(const char *content,
+int stc_plugin_popup_send_message(const char *content,
const char *type, const char *app_id, const char *iftype, const char *limit)
{
int ret = 0;
bundle *b = bundle_create();
- STC_LOGD("Restriction message : content[%s] type[%s] app_id[%s] limit[%s]",
- content, type, app_id, limit);
-
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);
- bundle_add(b, "_RESTRICTION_LIMIT_", limit);
+
+ 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);
}
API stc_plugin_appstatus_s stc_plugin_appstatus = {
- .send_warn_message_to_net_popup =
- stc_plugin_popup_send_warn_message,
- .send_restriction_message_to_net_popup =
- stc_plugin_popup_send_restriction_message,
+ .send_message_to_net_popup =
+ stc_plugin_popup_send_message,
.register_state_changed_cb =
stc_plugin_appstatus_register_changed_cb,
.deregister_state_changed_cb =