2 * Copyright (c) 2000 - 2015 Samsung Electronics Co., Ltd. All rights reserved.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #include <Elementary.h>
20 #include <sys/types.h>
28 #include <dd-deviced.h>
29 #include <Ecore_Wayland.h>
34 #include "hourly_alert.h"
35 #include "dbus_util.h"
36 #include "clock_mgr.h"
39 #include "process_mgr.h"
53 static void _signal_handler(int signum, siginfo_t *info, void *unused)
55 _D("_signal_handler : Terminated...");
61 static int _power_off_cb(status_active_key_e key, void *data)
63 int val = status_active_get()->sysman_power_off_status;
65 if (val > VCONFKEY_SYSMAN_POWER_OFF_POPUP) {
66 _E("power off status : %d", val);
75 static int _change_language_cb(status_active_key_e key, void *data)
77 _D("%s, %d", __func__, __LINE__);
79 if (status_active_get()->langset) {
80 elm_language_set(status_active_get()->langset);
88 static int _change_sequence_cb(status_active_key_e key, void *data)
90 int seq = status_active_get()->starter_sequence;
93 home_mgr_launch_home_first();
101 static void _on_lcd_changed_receive(void *data, DBusMessage *msg)
106 _D("LCD signal is received");
108 lcd_on = dbus_message_is_signal(msg, DEVICED_INTERFACE_DISPLAY, MEMBER_LCD_ON);
109 lcd_off = dbus_message_is_signal(msg, DEVICED_INTERFACE_DISPLAY, MEMBER_LCD_OFF);
113 s_starter.lcd_status = 1;
116 s_starter.lcd_status = 0;
118 _E("%s dbus_message_is_signal error", DEVICED_INTERFACE_DISPLAY);
124 static void _init(void)
126 struct sigaction act;
127 char err_buf[128] = {0,};
129 memset(&act,0x00,sizeof(struct sigaction));
130 act.sa_sigaction = _signal_handler;
131 act.sa_flags = SA_SIGINFO;
133 int ret = sigemptyset(&act.sa_mask);
135 if (strerror_r(errno, err_buf, sizeof(err_buf)) == 0) {
136 _E("Failed to sigemptyset[%d / %s]", errno, err_buf);
139 ret = sigaddset(&act.sa_mask, SIGTERM);
141 if (strerror_r(errno, err_buf, sizeof(err_buf)) == 0) {
142 _E("Failed to sigaddset[%d / %s]", errno, err_buf);
145 ret = sigaction(SIGTERM, &act, NULL);
147 if (strerror_r(errno, err_buf, sizeof(err_buf)) == 0) {
148 _E("Failed to sigaction[%d / %s]", errno, err_buf);
153 status_active_register_cb(STATUS_ACTIVE_KEY_SYSMAN_POWER_OFF_STATUS, _power_off_cb, NULL);
154 status_active_register_cb(STATUS_ACTIVE_KEY_LANGSET, _change_language_cb, NULL);
156 home_mgr_launch_home();
158 dbus_util_receive_lcd_status(_on_lcd_changed_receive, NULL);
163 hw_key_create_window();
168 static void _fini(void)
170 hw_key_destroy_window();
175 status_active_unregister_cb(STATUS_ACTIVE_KEY_SYSMAN_POWER_OFF_STATUS, _power_off_cb);
176 status_active_unregister_cb(STATUS_ACTIVE_KEY_LANGSET, _change_language_cb);
177 status_active_unregister_cb(STATUS_ACTIVE_KEY_STARTER_SEQUENCE, _change_sequence_cb);
183 int main(int argc, char *argv[])
187 _D("starter is launched..!!");
189 ret = elm_init(argc, argv);
191 _E("elm_init() failed : %d", ret);
195 ret = ecore_wl_init(NULL);
197 _E("ecore_wl_init() failed : %d", ret);
205 * Release free memory from top of the heap