Remove initscripts and add PIDFile to service file
[platform/core/system/power-manager.git] / pm_poll.h
1 /*
2  * power-manager
3  * Copyright (c) 2012 Samsung Electronics Co., Ltd.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16 */
17
18
19 /**
20  * @file        pm_poll.h
21  * @version     0.2
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<glib.h>
34
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 #define SOCK_PATH "/tmp/pm_sock"
48
49 typedef struct {
50         pid_t pid;
51         unsigned int cond;
52         unsigned int timeout;
53 } PMMsg;
54
55 typedef struct {
56         char *dev_path;
57         GSource *dev_src;
58         GPollFD *dev_fd;
59 } indev;
60
61 GList *indev_list;
62
63 PMMsg recv_data;
64 int (*g_pm_callback) (int, PMMsg *);
65
66 extern int init_pm_poll(int (*pm_callback) (int, PMMsg *));
67 extern int exit_pm_poll();
68 extern int init_pm_poll_input(int (*pm_callback)(int , PMMsg * ), const char *path);
69
70 /**
71  * @}
72  */
73
74 #endif                          /*__PM_POLL_H__ */