4 * Copyright (c) 2012 - 2015 Samsung Electronics Co., Ltd.
6 * Licensed under the Apache License, Version 2.0 (the License);
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
21 #include "core/common.h"
22 #include "display/display-ops.h"
24 #include "shared/plugin.h"
26 #define POPUP_METHOD "PopupLaunch"
29 static struct display_plugin *disp_plgn;
31 static const struct app_dbus_match {
38 { APP_DEFAULT , POPUP_BUS_NAME, POPUP_PATH_SYSTEM , POPUP_INTERFACE_SYSTEM , POPUP_METHOD },
39 { APP_POWERKEY, POPUP_BUS_NAME, POPUP_PATH_POWERKEY, POPUP_INTERFACE_POWERKEY, POPUP_METHOD },
40 { APP_OVERHEAT, POPUP_BUS_NAME, POPUP_PATH_OVERHEAT, POPUP_INTERFACE_OVERHEAT, POPUP_METHOD },
41 { APP_ABNORMAL, POPUP_BUS_NAME, POPUP_PATH_SYSTEM , POPUP_INTERFACE_SYSTEM , POPUP_METHOD },
42 { APP_REMOVE , POPUP_BUS_NAME, POPUP_PATH_SYSTEM , POPUP_INTERFACE_SYSTEM , POPUP_METHOD },
45 static void __cb(GVariant *var, void *user_data, GError *err)
50 _E("No message: %s", err->message);
54 if (!dh_get_param_from_var(var, "(i)", &ret)) {
55 _E("No message: %s", g_variant_get_type_string(var));
59 _D("Reply value: %d", ret);
66 int launch_system_app(char *type, int num, ...)
75 app_type = APP_DEFAULT;
78 for (i = 0 ; i < ARRAY_SIZE(app_match) ; i++) {
79 if (strncmp(app_type, app_match[i].type, strlen(app_type)))
85 _E("Failed to find matched app type(%s).", app_type);
91 ret = dbus_handle_method_async_pairs_with_reply(app_match[match].bus,
92 app_match[match].path,
93 app_match[match].iface,
94 app_match[match].method,
103 if (disp_plgn->pm_change_internal)
104 disp_plgn->pm_change_internal(INTERNAL_LOCK_POPUP, LCD_NORMAL);
109 int launch_message_post(char *type)
116 ret = dbus_handle_method_async_with_reply_var(POPUP_BUS_NAME,
118 POPUP_INTERFACE_NOTI,
120 g_variant_new("(s)", type),
123 if (disp_plgn->pm_change_internal)
124 disp_plgn->pm_change_internal(INTERNAL_LOCK_POPUP, LCD_NORMAL);
128 int add_async_notification(char *type, dbus_pending_cb func, char *sig, ...)
134 const char *param[BUFF_MAX] = {NULL};
144 for (count = 0; count < len; count++) {
145 data = va_arg(args, char *);
152 ret = dbus_handle_method_async_with_reply(POPUP_BUS_NAME,
154 POPUP_INTERFACE_NOTI,
165 int remove_notification(char *type, int id)
170 return dbus_handle_method_async_with_reply_var(POPUP_BUS_NAME,
172 POPUP_INTERFACE_NOTI,
173 type, g_variant_new("(i)", id),
177 static void __CONSTRUCTOR__ initialize(void)
179 disp_plgn = get_display_plugin();
181 _E("Failed to get display plugin.");