4 * Copyright (c) 2012 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"
23 #include "core/edbus-handler.h"
24 #include "core/launch.h"
26 #define COOL_DOWN_POPUP_BUS_NAME POPUP_BUS_NAME
27 #define COOL_DOWN_POPUP_METHOD_LAUNCH "CooldownPopupLaunch"
29 #define COOL_DOWN_POWER_OFF "cooldown_poweroff"
30 #define COOL_DOWN_POWER_WARNING "cooldown_warning"
31 #define COOL_DOWN_POWER_ON "cooldown_poweron"
33 #define SIGNAL_COOL_DOWN_SHUT_DOWN "ShutDown"
34 #define SIGNAL_COOL_DOWN_SHUT_DOWN_LEN 8
35 #define SIGNAL_COOL_DOWN_LIMIT_ACTION "LimitAction"
36 #define SIGNAL_COOL_DOWN_LIMIT_ACTION_LEN 11
37 #define SIGNAL_COOL_DOWN_RELEASE "Release"
38 #define SIGNAL_COOL_DOWN_RELEASE_LEN 7
45 static int cool_down_launch(void *data)
48 struct popup_data * key_data = (struct popup_data *)data;
51 if (!key_data || !key_data->key)
54 _I("%s", key_data->key);
56 if (strncmp(key_data->key, SIGNAL_COOL_DOWN_SHUT_DOWN,
57 SIGNAL_COOL_DOWN_SHUT_DOWN_LEN) == 0)
58 param[1] = COOL_DOWN_POWER_OFF;
59 else if (strncmp(key_data->key, SIGNAL_COOL_DOWN_LIMIT_ACTION,
60 SIGNAL_COOL_DOWN_LIMIT_ACTION_LEN) == 0)
61 param[1] = COOL_DOWN_POWER_WARNING;
62 else if (strncmp(key_data->key, SIGNAL_COOL_DOWN_RELEASE,
63 SIGNAL_COOL_DOWN_RELEASE_LEN) == 0)
64 param[1] = COOL_DOWN_POWER_ON;
68 param[0] = POPUP_KEY_CONTENT;
70 return dbus_method_async(COOL_DOWN_POPUP_BUS_NAME,
71 POPUP_PATH_SYSTEM, POPUP_INTERFACE_SYSTEM,
72 COOL_DOWN_POPUP_METHOD_LAUNCH, "ss", param);
78 static const struct apps_ops cooldown_ops = {
79 .name = "cooldown-syspopup",
80 .launch = cool_down_launch,
83 APPS_OPS_REGISTER(&cooldown_ops)