Initialize Tizen 2.3
[framework/system/deviced.git] / src / display / poll.h
1 /*
2  * deviced
3  *
4  * Copyright (c) 2011 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
5  *
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
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
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.
17  */
18
19
20 /**
21  * @file        poll.h
22  * @brief       Power Manager input device poll implementation
23  *
24  * This file includes the input device poll implementation.
25  * Default input devices are /dev/event0 and /dev/event1
26  * User can use "PM_INPUT_DEV" for setting another input device poll in an environment file (/etc/profile).
27  * (ex: PM_INPUT_DEV=/dev/event0:/dev/event1:/dev/event5 )
28  */
29
30 #ifndef __PM_POLL_H__
31 #define __PM_POLL_H__
32
33 #include <Ecore.h>
34 #include "core/edbus-handler.h"
35 /**
36  * @addtogroup POWER_MANAGER
37  * @{
38  */
39
40 enum {
41         INPUT_POLL_EVENT = -9,
42         SIDEKEY_POLL_EVENT,
43         PWRKEY_POLL_EVENT,
44         PM_CONTROL_EVENT,
45 };
46
47 enum {
48         INTERNAL_LOCK_BASE = 100000,
49         INTERNAL_LOCK_BATTERY,
50         INTERNAL_LOCK_BOOTING,
51         INTERNAL_LOCK_DUMPMODE,
52         INTERNAL_LOCK_HDMI,
53         INTERNAL_LOCK_ODE,
54         INTERNAL_LOCK_POPUP,
55         INTERNAL_LOCK_SOUNDDOCK,
56         INTERNAL_LOCK_TA,
57         INTERNAL_LOCK_TIME,
58         INTERNAL_LOCK_USB,
59 };
60
61 #define SIGNAL_NAME_LCD_CONTROL         "lcdcontol"
62
63 #define LCD_NORMAL      0x1             /**< NORMAL state */
64 #define LCD_DIM         0x2             /**< LCD dimming state */
65 #define LCD_OFF         0x4             /**< LCD off state */
66 #define SUSPEND         0x8             /**< Suspend state */
67 #define POWER_OFF       0x16    /**< Sleep state */
68
69 #define STAY_CUR_STATE  0x1
70 #define GOTO_STATE_NOW  0x2
71 #define HOLD_KEY_BLOCK  0x4
72 #define STANDBY_MODE    0x8
73
74 #define PM_SLEEP_MARGIN 0x0     /**< keep guard time for unlock */
75 #define PM_RESET_TIMER  0x1     /**< reset timer for unlock */
76 #define PM_KEEP_TIMER           0x2     /**< keep timer for unlock */
77
78 #define PM_LOCK_STR     "lock"
79 #define PM_UNLOCK_STR   "unlock"
80 #define PM_CHANGE_STR   "change"
81
82 #define PM_LCDOFF_STR   "lcdoff"
83 #define PM_LCDDIM_STR   "lcddim"
84 #define PM_LCDON_STR    "lcdon"
85 #define PM_SUSPEND_STR  "suspend"
86
87 #define STAYCURSTATE_STR "staycurstate"
88 #define GOTOSTATENOW_STR "gotostatenow"
89
90 #define HOLDKEYBLOCK_STR "holdkeyblock"
91 #define STANDBYMODE_STR  "standbymode"
92
93 #define SLEEP_MARGIN_STR "sleepmargin"
94 #define RESET_TIMER_STR  "resettimer"
95 #define KEEP_TIMER_STR   "keeptimer"
96
97 typedef struct {
98         pid_t pid;
99         unsigned int cond;
100         unsigned int timeout;
101         unsigned int timeout2;
102 } PMMsg;
103
104 typedef struct {
105         char *dev_path;
106         int fd;
107         Ecore_Fd_Handler *dev_fd;
108         int pre_install;
109 } indev;
110
111 Eina_List *indev_list;
112
113 PMMsg recv_data;
114 int (*g_pm_callback) (int, PMMsg *);
115
116 extern int init_pm_poll(int (*pm_callback) (int, PMMsg *));
117 extern int exit_pm_poll();
118 extern int init_pm_poll_input(int (*pm_callback)(int , PMMsg * ), const char *path);
119
120 extern int pm_lock_internal(pid_t pid, int s_bits, int flag, int timeout);
121 extern int pm_unlock_internal(pid_t pid, int s_bits, int flag);
122 extern int pm_change_internal(pid_t pid, int s_bits);
123
124 /**
125  * @}
126  */
127
128 #endif                          /*__PM_POLL_H__ */