make external outputs list when server init
[platform/core/uifw/e-mod-tizen-eom.git] / protocol / eom-server-protocol.h
1 #ifndef WL_EOM_SERVER_PROTOCOL_H
2 #define WL_EOM_SERVER_PROTOCOL_H
3
4 #ifdef  __cplusplus
5 extern "C" {
6 #endif
7
8 #include <stdint.h>
9 #include <stddef.h>
10 #include "wayland-server.h"
11
12 struct wl_client;
13 struct wl_resource;
14
15 struct wl_eom;
16
17 extern const struct wl_interface wl_eom_interface;
18
19 #ifndef WL_EOM_ERROR_ENUM
20 #define WL_EOM_ERROR_ENUM
21 enum wl_eom_error {
22         WL_EOM_ERROR_NONE = 0,
23         WL_EOM_ERROR_NO_OUTPUT = 1,
24         WL_EOM_ERROR_NO_ATTRIBUTE = 2,
25         WL_EOM_ERROR_OUTPUT_OCCUPIED = 3,
26 };
27 #endif /* WL_EOM_ERROR_ENUM */
28
29 #ifndef WL_EOM_TYPE_ENUM
30 #define WL_EOM_TYPE_ENUM
31 /**
32  * wl_eom_type - connector type of the external output
33  * @WL_EOM_TYPE_NONE: none
34  * @WL_EOM_TYPE_VGA: VGA output connector type
35  * @WL_EOM_TYPE_DIVI: VGA output connector type
36  * @WL_EOM_TYPE_DIVD: VGA output connector type
37  * @WL_EOM_TYPE_DIVA: VGA output connector type
38  * @WL_EOM_TYPE_COMPOSITE: VGA output connector type
39  * @WL_EOM_TYPE_SVIDEO: VGA output connector type
40  * @WL_EOM_TYPE_LVDS: VGA output connector type
41  * @WL_EOM_TYPE_COMPONENT: VGA output connector type
42  * @WL_EOM_TYPE_9PINDIN: VGA output connector type
43  * @WL_EOM_TYPE_DISPLAYPORT: VGA output connector type
44  * @WL_EOM_TYPE_HDMIA: VGA output connector type
45  * @WL_EOM_TYPE_HDMIB: VGA output connector type
46  * @WL_EOM_TYPE_TV: VGA output connector type
47  * @WL_EOM_TYPE_EDP: VGA output connector type
48  * @WL_EOM_TYPE_VIRTUAL: VGA output connector type
49  * @WL_EOM_TYPE_DSI: VGA output connector type
50  *
51  * ***** TODO ******
52  */
53 enum wl_eom_type {
54         WL_EOM_TYPE_NONE = 0,
55         WL_EOM_TYPE_VGA = 1,
56         WL_EOM_TYPE_DIVI = 2,
57         WL_EOM_TYPE_DIVD = 3,
58         WL_EOM_TYPE_DIVA = 4,
59         WL_EOM_TYPE_COMPOSITE = 5,
60         WL_EOM_TYPE_SVIDEO = 6,
61         WL_EOM_TYPE_LVDS = 7,
62         WL_EOM_TYPE_COMPONENT = 8,
63         WL_EOM_TYPE_9PINDIN = 9,
64         WL_EOM_TYPE_DISPLAYPORT = 10,
65         WL_EOM_TYPE_HDMIA = 11,
66         WL_EOM_TYPE_HDMIB = 12,
67         WL_EOM_TYPE_TV = 13,
68         WL_EOM_TYPE_EDP = 14,
69         WL_EOM_TYPE_VIRTUAL = 15,
70         WL_EOM_TYPE_DSI = 16,
71 };
72 #endif /* WL_EOM_TYPE_ENUM */
73
74 #ifndef WL_EOM_STATUS_ENUM
75 #define WL_EOM_STATUS_ENUM
76 /**
77  * wl_eom_status - connection status of the external output
78  * @WL_EOM_STATUS_NONE: none
79  * @WL_EOM_STATUS_CONNECTION: output connected
80  * @WL_EOM_STATUS_DISCONNECTION: output disconnected
81  *
82  * ***** TODO ******
83  */
84 enum wl_eom_status {
85         WL_EOM_STATUS_NONE = 0,
86         WL_EOM_STATUS_CONNECTION = 1,
87         WL_EOM_STATUS_DISCONNECTION = 2,
88 };
89 #endif /* WL_EOM_STATUS_ENUM */
90
91 #ifndef WL_EOM_MODE_ENUM
92 #define WL_EOM_MODE_ENUM
93 /**
94  * wl_eom_mode - mode of the external output
95  * @WL_EOM_MODE_NONE: none
96  * @WL_EOM_MODE_MIRROR: mirror mode
97  * @WL_EOM_MODE_PRESENTATION: presentation mode
98  *
99  * ***** TODO ******
100  */
101 enum wl_eom_mode {
102         WL_EOM_MODE_NONE = 0,
103         WL_EOM_MODE_MIRROR = 1,
104         WL_EOM_MODE_PRESENTATION = 2,
105 };
106 #endif /* WL_EOM_MODE_ENUM */
107
108 #ifndef WL_EOM_ATTRIBUTE_ENUM
109 #define WL_EOM_ATTRIBUTE_ENUM
110 /**
111  * wl_eom_attribute - attribute of the external output
112  * @WL_EOM_ATTRIBUTE_NONE: none
113  * @WL_EOM_ATTRIBUTE_NORMAL: nomal attribute
114  * @WL_EOM_ATTRIBUTE_EXCLUSIVE_SHARED: exclusive shared attribute
115  * @WL_EOM_ATTRIBUTE_EXCLUSIVE: exclusive attribute
116  *
117  * ***** TODO ******
118  */
119 enum wl_eom_attribute {
120         WL_EOM_ATTRIBUTE_NONE = 0,
121         WL_EOM_ATTRIBUTE_NORMAL = 1,
122         WL_EOM_ATTRIBUTE_EXCLUSIVE_SHARED = 2,
123         WL_EOM_ATTRIBUTE_EXCLUSIVE = 3,
124 };
125 #endif /* WL_EOM_ATTRIBUTE_ENUM */
126
127 #ifndef WL_EOM_ATTRIBUTE_STATE_ENUM
128 #define WL_EOM_ATTRIBUTE_STATE_ENUM
129 /**
130  * wl_eom_attribute_state - state of the external output attribute
131  * @WL_EOM_ATTRIBUTE_STATE_NONE: none
132  * @WL_EOM_ATTRIBUTE_STATE_ACTIVE: attribute is active on the output
133  * @WL_EOM_ATTRIBUTE_STATE_INACTIVE: attribute is inactive on the output
134  * @WL_EOM_ATTRIBUTE_STATE_LOST: the connection of output is lost
135  *
136  * ***** TODO ******
137  */
138 enum wl_eom_attribute_state {
139         WL_EOM_ATTRIBUTE_STATE_NONE = 0,
140         WL_EOM_ATTRIBUTE_STATE_ACTIVE = 1,
141         WL_EOM_ATTRIBUTE_STATE_INACTIVE = 2,
142         WL_EOM_ATTRIBUTE_STATE_LOST = 3,
143 };
144 #endif /* WL_EOM_ATTRIBUTE_STATE_ENUM */
145
146 /**
147  * wl_eom - an interface to get the information of the external outputs
148  * @set_attribute: (none)
149  *
150  * ***** TODO ******
151  */
152 struct wl_eom_interface {
153         /**
154          * set_attribute - (none)
155          * @output_id: (none)
156          * @attribute: (none)
157          */
158         void (*set_attribute)(struct wl_client *client,
159                               struct wl_resource *resource,
160                               uint32_t output_id,
161                               uint32_t attribute);
162         /**
163          * get_output_info - (none)
164          * @output_id: (none)
165          */
166         void (*get_output_info)(struct wl_client *client,
167                               struct wl_resource *resource,
168                               uint32_t output_id);
169 };
170
171 #define WL_EOM_OUTPUT_COUNT     0
172 #define WL_EOM_OUTPUT_INFO      1
173 #define WL_EOM_OUTPUT_TYPE      2
174 #define WL_EOM_OUTPUT_MODE      3
175 #define WL_EOM_OUTPUT_ATTRIBUTE 4
176
177 #define WL_EOM_OUTPUT_TYPE_SINCE_VERSION        1
178 #define WL_EOM_OUTPUT_MODE_SINCE_VERSION        1
179 #define WL_EOM_OUTPUT_ATTRIBUTE_SINCE_VERSION   1
180
181 static inline void
182 wl_eom_send_output_count(struct wl_resource *resource_, uint32_t output_id, uint32_t count)
183 {
184         wl_resource_post_event(resource_, WL_EOM_OUTPUT_COUNT, output_id, count);
185 }
186
187 static inline void
188 wl_eom_send_output_info(struct wl_resource *resource_, uint32_t output_id, uint32_t type, uint32_t mode,
189                                                                 uint32_t w, uint32_t h, uint32_t w_mm, uint32_t h_mm, uint32_t connection)
190 {
191         wl_resource_post_event(resource_, WL_EOM_OUTPUT_INFO, output_id, type, mode, w, h, w_mm, h_mm, connection);
192 }
193
194 static inline void
195 wl_eom_send_output_type(struct wl_resource *resource_, uint32_t output_id, uint32_t type, uint32_t status)
196 {
197         wl_resource_post_event(resource_, WL_EOM_OUTPUT_TYPE, output_id, type, status);
198 }
199
200 static inline void
201 wl_eom_send_output_mode(struct wl_resource *resource_, uint32_t output_id, uint32_t mode)
202 {
203         wl_resource_post_event(resource_, WL_EOM_OUTPUT_MODE, output_id, mode);
204 }
205
206 static inline void
207 wl_eom_send_output_attribute(struct wl_resource *resource_, uint32_t output_id, uint32_t attribute, uint32_t attribute_state, uint32_t error)
208 {
209         wl_resource_post_event(resource_, WL_EOM_OUTPUT_ATTRIBUTE, output_id, attribute, attribute_state, error);
210 }
211
212 #ifdef  __cplusplus
213 }
214 #endif
215
216 #endif