Merge Tizen 2.0 dev to RSA
[framework/system/power-manager.git] / pm_poll.h
1 /*
2  * Copyright 2012  Samsung Electronics Co., Ltd
3  *
4  * Licensed under the Flora License, Version 1.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
7  *
8  *      http://www.tizenopensource.org/license
9  *
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.
15 */
16
17
18 /**
19  * @file        pm_poll.h
20  * @version     0.2
21  * @brief       Power Manager input device poll implementation
22  *
23  * This file includes the input device poll implementation.
24  * Default input devices are /dev/event0 and /dev/event1
25  * User can use "PM_INPUT_DEV" for setting another input device poll in an environment file (/etc/profile). 
26  * (ex: PM_INPUT_DEV=/dev/event0:/dev/event1:/dev/event5 )
27  */
28
29 #ifndef __PM_POLL_H__
30 #define __PM_POLL_H__
31
32 #include<glib.h>
33
34 /**
35  * @addtogroup POWER_MANAGER
36  * @{
37  */
38
39 enum {
40         INPUT_POLL_EVENT = -9,
41         SIDEKEY_POLL_EVENT,
42         PWRKEY_POLL_EVENT,
43         PM_CONTROL_EVENT,
44 };
45
46 #define SOCK_PATH "/tmp/pm_sock"
47
48 typedef struct {
49         pid_t pid;
50         unsigned int cond;
51         unsigned int timeout;
52 } PMMsg;
53
54 typedef struct {
55         char *dev_path;
56         GSource *dev_src;
57         GPollFD *dev_fd;
58 } indev;
59
60 GList *indev_list;
61
62 PMMsg recv_data;
63 int (*g_pm_callback) (int, PMMsg *);
64
65 extern int init_pm_poll(int (*pm_callback) (int, PMMsg *));
66 extern int exit_pm_poll();
67 extern int init_pm_poll_input(int (*pm_callback)(int , PMMsg * ), const char *path);
68
69 /**
70  * @}
71  */
72
73 #endif                          /*__PM_POLL_H__ */