summaryrefslogtreecommitdiff
path: root/include/eom.h
blob: 55f3d175a416763490836212265a38f8841199cc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
/**************************************************************************

External Output Manager (EOM)

Copyright 2014 Samsung Electronics co., Ltd. All Rights Reserved.

Contact:
SooChan Lim <sc1.lim@samsung.com>
Boram Park <boram1288.park@samsung.com>
Changyeon Lee <cyeon.lee@samsung.com>
JunKyeong Kim <jk0430.kim@samsung.com>

Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sub license, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice (including the
next paragraph) shall be included in all copies or substantial portions
of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

**************************************************************************/

#ifndef __EOM_H__
#define __EOM_H__

/**
 * @addtogroup CAPI_UI_EOM_MODULE
 * @{
 */

#ifdef __cplusplus
extern "C" {
#endif

#include <stdint.h>
#include <stddef.h>
#include <stdbool.h>
#include <string.h>
#include <tizen.h>
#include <Elementary.h>

/**
 * @file eom.h
 */
#ifndef TIZEN_ERROR_EOM
#define TIZEN_ERROR_EOM			-0x02F20000 | 0x00
#endif
/**
 * @brief Enumeration of External Output Manager (EOM) error type
 * @since_tizen 2.4
 */
typedef enum
{
    EOM_ERROR_NONE = TIZEN_ERROR_NONE,                             /**< Success */
    EOM_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY,           /**< Memory allocation failure */
    EOM_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER,   /**< Invalid input parameter */
    EOM_ERROR_NO_SUCH_DEVICE = TIZEN_ERROR_NO_SUCH_DEVICE,         /**< Invalid external output instance */
    EOM_ERROR_CONNECTION_FAILURE = TIZEN_ERROR_EOM | 0x01,         /**< Connection failure */
    EOM_ERROR_MESSAGE_SENDING_FAILURE = TIZEN_ERROR_EOM | 0x02,    /**< Message sending failure */
    EOM_ERROR_MESSAGE_OPERATION_FAILURE = TIZEN_ERROR_EOM | 0x03,  /**< Message operation failure */
} eom_error_e;

/**
 * @brief Enumeration of external output type
 * @since_tizen 2.4
 */
typedef enum
{
    EOM_OUTPUT_TYPE_UNKNOWN,        /**< Unknown output type */
    EOM_OUTPUT_TYPE_VGA,            /**< VGA output */
    EOM_OUTPUT_TYPE_DVII,           /**< DVII output type */
    EOM_OUTPUT_TYPE_DVID,           /**< DVID output type */
    EOM_OUTPUT_TYPE_DVIA,           /**< DVIA output type */
    EOM_OUTPUT_TYPE_COMPOSITE,      /**< Composite output type */
    EOM_OUTPUT_TYPE_SVIDEO,         /**< SVIDEO output type */
    EOM_OUTPUT_TYPE_LVDS,           /**< LVDS output type */
    EOM_OUTPUT_TYPE_COMPONENT,      /**< Component output type */
    EOM_OUTPUT_TYPE_9PINDIN,        /**< 9PinDIN output type */
    EOM_OUTPUT_TYPE_DISPLAYPORT,    /**< DisplayPort output type */
    EOM_OUTPUT_TYPE_HDMIA,          /**< HDMIA output type */
    EOM_OUTPUT_TYPE_HDMIB,          /**< HDMIB output type */
    EOM_OUTPUT_TYPE_TV,             /**< TV output type */
    EOM_OUTPUT_TYPE_EDP,            /**< EDP output type */
    EOM_OUTPUT_TYPE_VIRTUAL,        /**< VIRTUAL output type */
    EOM_OUTPUT_TYPE_DSI,            /**< DSI output type */
    EOM_OUTPUT_TYPE_MAX,
} eom_output_type_e;

/**
 * @brief Enumeration of external output mode
 * @since_tizen 2.4
 */
typedef enum
{
    EOM_OUTPUT_MODE_NONE,          /**< None */
    EOM_OUTPUT_MODE_MIRROR,        /**< Mirror mode */
    EOM_OUTPUT_MODE_PRESENTATION,  /**< Presentation mode */
    EOM_OUTPUT_MODE_MAX,
} eom_output_mode_e;

/**
 * @brief Enumeration of External Output Manager (EOM) attributes
 * @since_tizen 2.4
 */
typedef enum
{
    EOM_OUTPUT_ATTRIBUTE_NONE,              /**< None */
    EOM_OUTPUT_ATTRIBUTE_NORMAL,            /**< Normal presentation mode window showing on external output */
    EOM_OUTPUT_ATTRIBUTE_EXCLUSIVE_SHARE,   /**< Exclusive share presentation mode window showing on external output */
    EOM_OUTPUT_ATTRIBUTE_EXCLUSIVE,         /**< Exclusive presentation mode window showing on external output */
    EOM_OUTPUT_ATTRIBUTE_MAX,
} eom_output_attribute_e;

/**
 * @brief Enumeration of External Output Manager (EOM) attribute state
 * @since_tizen 2.4
 */
typedef enum
{
    EOM_OUTPUT_ATTRIBUTE_STATE_NONE,        /**< None */
    EOM_OUTPUT_ATTRIBUTE_STATE_ACTIVE,      /**< Output attribute is active */
    EOM_OUTPUT_ATTRIBUTE_STATE_INACTIVE,    /**< Output attribute is inactive */
    EOM_OUTPUT_ATTRIBUTE_STATE_LOST,        /**< Cannot use external output */
    EOM_OUTPUT_ATTRIBUTE_STATE_MAX,
} eom_output_attribute_state_e;

/**
 * @brief Definition for external output ID
 * @since_tizen 2.4
 */
typedef unsigned int eom_output_id;

/**
 * @brief Called when External Output Manager (EOM) module sends output connection notification.
 * @since_tizen 2.4
 * @param[in] output_id  The output id which is connected output
 * @param[in] user_data  The pointer of user data which is passed to eom_output_added_cb function
 * @see eom_set_output_added_cb()
 * @see eom_unset_output_added_cb()
 */
typedef void (*eom_output_added_cb)(eom_output_id output_id, void *user_data);

/**
 * @brief Called when External Output Manager (EOM) module sends output disconnection notification.
 * @since_tizen 2.4
 * @param[in] output_id  The output id which is connected output
 * @param[in] user_data  The pointer of user data which is passed to eom_output_removed_cb function
 * @see eom_set_output_removed_cb()
 * @see eom_unset_output_removed_cb()
 */
typedef void (*eom_output_removed_cb)(eom_output_id output_id, void *user_data);

/**
 * @brief Called when External Output Manager (EOM) module sends output mode changing notification.
 * @since_tizen 2.4
 * @param[in] output_id  The output id which is connected output
 * @param[in] user_data  The pointer of user data which is passed to eom_mode_changed_cb function
 * @see eom_set_mode_changed_cb()
 * @see eom_unset_mode_changed_cb()
 */
typedef void (*eom_mode_changed_cb)(eom_output_id output_id, void *user_data);

/**
 * @brief Called when External Output Manager (EOM) module sends output attribute changing notification.
 * @since_tizen 2.4
 * @param[in] output_id  The output id which is connected output
 * @param[in] user_data  The pointer of user data which is passed to eom_attribute_changed_cb function
 * @see eom_set_attribute_changed_cb()
 * @see eom_unset_attribute_changed_cb()
 */
typedef void (*eom_attribute_changed_cb)(eom_output_id output_id, void *user_data);

/**
 * @brief Initializes External Output Manager (EOM).
 * @details User should call this function previously for using EOM.
 * @since_tizen 2.4
 * @remarks After all using, call eom_deinit() function for resource returning.
 * @return 0 on success, otherwise a negative error value
 * @retval #EOM_ERROR_NONE Successful
 * @retval #EOM_ERROR_CONNECTION_FAILURE The EOM connection failure
 * @see eom_deinit()
 * @see #eom_error_e
 */
int eom_init (void);

/**
 * @brief Finalizes External Output Manager (EOM).
 * @details User should call this function after using EOM to release all resources of EOM.
 * @since_tizen 2.4
 * @see eom_init()
 */
void eom_deinit (void);

/**
 * @brief Registers a callback function to get output connection notification from External Output Manager (EOM) module.
 * @since_tizen 2.4
 * @param[in] callback  The function pointer of eom_output_added_cb callback function
 * @param[in] user_data  The pointer of user data which is passed to eom_output_added_cb function
 * @return 0 on success, otherwise a negative error value
 * @retval #EOM_ERROR_NONE Successful
 * @retval #EOM_ERROR_OUT_OF_MEMORY Memory allocation failure
 * @retval #EOM_ERROR_INVALID_PARAMETER Invalid parameter
 * @pre eom_init()
 * @pre eom_get_eom_output_ids()
 * @see eom_unset_output_added_cb()
 * @see #eom_output_added_cb
 */
int eom_set_output_added_cb (eom_output_added_cb callback, void *user_data);

/**
 * @brief Unregisters the callback function.
 * @since_tizen 2.4
 * @param[in] callback  The function pointer of eom_output_added_cb callback function
 * @return 0 on success, otherwise a negative error value
 * @retval #EOM_ERROR_NONE Successful
 * @retval #EOM_ERROR_INVALID_PARAMETER Invalid parameter
 * @pre eom_init()
 * @pre eom_get_eom_output_ids()
 * @see eom_set_output_added_cb()
 * @see #eom_output_added_cb
 */
int eom_unset_output_added_cb (eom_output_added_cb callback);

/**
 * @brief Registers a callback function to get output disconnection notification from External Output Manager (EOM) module.
 * @since_tizen 2.4
 * @param[in] callback  The function pointer of eom_output_removed_cb callback function
 * @param[in] user_data  The pointer of user data which is passed to eom_output_removed_cb function
 * @return 0 on success, otherwise a negative error value
 * @retval #EOM_ERROR_NONE Successful
 * @retval #EOM_ERROR_OUT_OF_MEMORY Memory allocation failure
 * @retval #EOM_ERROR_INVALID_PARAMETER Invalid parameter
 * @pre eom_init()
 * @pre eom_get_eom_output_ids()
 * @see eom_unset_output_removed_cb()
 * @see #eom_output_removed_cb
 */
int eom_set_output_removed_cb (eom_output_removed_cb callback, void *user_data);

/**
 * @brief Unregisters the callback function.
 * @since_tizen 2.4
 * @param[in] callback  The function pointer of eom_output_removed_cb callback function
 * @return 0 on success, otherwise a negative error value
 * @retval #EOM_ERROR_NONE Successful
 * @retval #EOM_ERROR_INVALID_PARAMETER Invalid parameter
 * @pre eom_init()
 * @pre eom_get_eom_output_ids()
 * @see eom_set_output_removed_cb()
 * @see #eom_output_removed_cb
 */
int eom_unset_output_removed_cb (eom_output_removed_cb callback);

/**
 * @brief Registers a callback function to get output mode changing notification from External Output Manager (EOM) module.
 * @since_tizen 2.4
 * @param[in] callback  The function pointer of eom_mode_changed_cb callback function
 * @param[in] user_data  The pointer of user data which is passed to eom_mode_changed_cb function
 * @return 0 on success, otherwise a negative error value
 * @retval #EOM_ERROR_NONE Successful
 * @retval #EOM_ERROR_OUT_OF_MEMORY Memory allocation failure
 * @retval #EOM_ERROR_INVALID_PARAMETER Invalid parameter
 * @pre eom_init()
 * @pre eom_get_eom_output_ids()
 * @see eom_unset_mode_changed_cb()
 * @see #eom_mode_changed_cb
 */
int eom_set_mode_changed_cb (eom_mode_changed_cb callback, void *user_data);

/**
 * @brief Unregisters the callback function.
 * @since_tizen 2.4
 * @param[in] callback  The function pointer of eom_mode_changed_cb callback function
 * @return 0 on success, otherwise a negative error value
 * @retval #EOM_ERROR_NONE Successful
 * @retval #EOM_ERROR_INVALID_PARAMETER Invalid parameter
 * @pre eom_init()
 * @pre eom_get_eom_output_ids()
 * @see eom_set_mode_changed_cb()
 * @see #eom_mode_changed_cb
 */
int eom_unset_mode_changed_cb (eom_mode_changed_cb callback);

/**
 * @brief Registers a callback function to get output attribute changing notification from External Output Manager (EOM) module.
 * @since_tizen 2.4
 * @param[in] callback  The function pointer of eom_attribute_changed_cb callback function
 * @param[in] user_data  The pointer of user data which is passed to eom_attribute_changed_cb function
 * @return 0 on success, otherwise a negative error value
 * @retval #EOM_ERROR_NONE Successful
 * @retval #EOM_ERROR_OUT_OF_MEMORY Memory allocation failure
 * @retval #EOM_ERROR_INVALID_PARAMETER Invalid parameter
 * @pre eom_init()
 * @pre eom_get_eom_output_ids()
 * @see eom_unset_attribute_changed_cb()
 * @see #eom_attribute_changed_cb
 */
int eom_set_attribute_changed_cb (eom_attribute_changed_cb callback, void *user_data);

/**
 * @brief Unregisters the callback function.
 * @since_tizen 2.4
 * @param[in] callback  The function pointer of eom_attribute_changed_cb callback function
 * @return 0 on success, otherwise a negative error value
 * @retval #EOM_ERROR_NONE Successful
 * @retval #EOM_ERROR_INVALID_PARAMETER Invalid parameter
 * @pre eom_init()
 * @pre eom_get_eom_output_ids()
 * @see eom_set_attribute_changed_cb()
 * @see #eom_attribute_changed_cb
 */
int eom_unset_attribute_changed_cb (eom_attribute_changed_cb callback);

/**
 * @brief Gets the IDs and count of external output.
 * @details This function returns the IDs of external output which are available to connect
 * to target device, and the count of them also. User can get the id of external output
 * which user want to watch.
 * @since_tizen 2.4
 * @remarks User should free return value by using free().\n
 * The specific error code can be obtained using the get_last_result() method.
 * Error codes are described in Exception section.
 * @param[out] count  The count of the eom_output_id supported by system
 * @return The array of the eom_output_id if this function succeeds, otherwise NULL
 * @retval The pointer of #eom_output_id
 * @exception #EOM_ERROR_NONE Successful
 * @exception #EOM_ERROR_INVALID_PARAMETER Invalid parameter
 * @exception #EOM_ERROR_OUT_OF_MEMORY Memory allocation failure
 * @pre eom_init()
 * @see #eom_output_id
 * @see #eom_error_e
 */
eom_output_id* eom_get_eom_output_ids (int *count);

/**
 * @brief Gets type of external output.
 * @since_tizen 2.4
 * @remarks The specific error code can be obtained using the get_last_result()
 * method. Error codes are described in Exception section.
 * @param[in] output_id  The id of external output device
 * @param[out] type  The type of external output instance
 * @return 0 on success, otherwise a negative error value
 * @retval #EOM_ERROR_NONE Successful
 * @retval #EOM_ERROR_INVALID_PARAMETER Invalid parameter
 * @pre eom_init()
 * @pre eom_get_eom_output_ids()
 * @see #eom_output_id
 * @see #eom_error_e
 * @see #eom_output_type_e
 */
int eom_get_output_type (eom_output_id output_id, eom_output_type_e *type);

/**
 * @brief Gets mode of external output.
 * @since_tizen 2.4
 * @remarks The specific error code can be obtained using the get_last_result()
 * method. Error codes are described in Exception section.
 * @param[in] output_id  The id of external output device
 * @param[out] mode  The mode of external output instance
 * @return 0 on success, otherwise a negative error value
 * @retval #EOM_ERROR_NONE Successful
 * @retval #EOM_ERROR_INVALID_PARAMETER Invalid parameter
 * @retval #EOM_ERROR_NO_SUCH_DEVICE Invalid external output instance
 * @pre eom_init()
 * @pre eom_get_eom_output_ids()
 * @see #eom_output_id
 * @see #eom_error_e
 * @see #eom_output_mode_e
 */
int eom_get_output_mode (eom_output_id output_id, eom_output_mode_e *mode);

/**
 * @brief Gets attribute of external output.
 * @since_tizen 2.4
 * @remarks The specific error code can be obtained using the get_last_result()
 * method. Error codes are described in Exception section.
 * @param[in] output_id  The id of external output device
 * @param[out] attribute  The attribute of external output instance
 * @return 0 on success, otherwise a negative error value
 * @retval #EOM_ERROR_NONE Successful
 * @retval #EOM_ERROR_INVALID_PARAMETER Invalid parameter
 * @retval #EOM_ERROR_NO_SUCH_DEVICE Invalid external output instance
 * @pre eom_init()
 * @pre eom_get_eom_output_ids()
 * @see #eom_output_id
 * @see #eom_error_e
 * @see #eom_output_attribute_e
 */
int eom_get_output_attribute (eom_output_id output_id, eom_output_attribute_e *attribute);

/**
 * @brief Gets attribute state of external output.
 * @since_tizen 2.4
 * @remarks The specific error code can be obtained using the get_last_result()
 * method. Error codes are described in Exception section.
 * @param[in] output_id  The id of external output device
 * @param[out] state  The attribute state of external output instance
 * @return 0 on success, otherwise a negative error value
 * @retval #EOM_ERROR_NONE Successful
 * @retval #EOM_ERROR_INVALID_PARAMETER Invalid parameter
 * @retval #EOM_ERROR_NO_SUCH_DEVICE Invalid external output instance
 * @pre eom_init()
 * @pre eom_get_eom_output_ids()
 * @see #eom_output_id
 * @see #eom_error_e
 * @see #eom_output_attribute_state_e
 */
int eom_get_output_attribute_state (eom_output_id output_id, eom_output_attribute_state_e *state);

/**
 * @brief Gets resolution of external output.
 * @since_tizen 2.4
 * @param[in] output_id  The id of external output device
 * @param[out] width  The width of external output instance
 * @param[out] height  The height of external output instance
 * @return 0 on success, otherwise a negative error value
 * @retval #EOM_ERROR_NONE Successful
 * @retval #EOM_ERROR_INVALID_PARAMETER Invalid parameter
 * @retval #EOM_ERROR_NO_SUCH_DEVICE Invalid external output instance
 * @pre eom_init()
 * @pre eom_get_eom_output_ids()
 * @see #eom_output_id
 * @see #eom_error_e
 */
int eom_get_output_resolution (eom_output_id output_id, int *width, int *height);

/**
 * @brief Gets physical width/height (millimeters) of external output.
 * @since_tizen 2.4
 * @param[in] output_id  The id of external output device
 * @param[out] phy_width  The physical mm width of external output instance
 * @param[out] phy_height  The physical mm height of external output instance
 * @return 0 on success, otherwise a negative error value
 * @retval #EOM_ERROR_NONE Successful
 * @retval #EOM_ERROR_INVALID_PARAMETER Invalid parameter
 * @retval #EOM_ERROR_NO_SUCH_DEVICE Invalid external output instance
 * @pre eom_init()
 * @pre eom_get_eom_output_ids()
 * @see #eom_output_id
 * @see #eom_error_e
 */
int eom_get_output_physical_size (eom_output_id output_id, int *phy_width, int *phy_height);

/**
 * @brief Sets the attribute of the external output ID.
 * @details The application can set the External Output Manager (EOM) attribute to the external output ID.
 * The EOM module manages the windows to display on external output and
 * control the policy of external output. The application can recognize
 * the attribute state and manage the resources when the application receives
 * several notification callback from EOM module.
 * @since_tizen 2.4
 * @param[in] output_id  The id of external output device
 * @param[in] attr  The attribute of the external output
 * @return 0 on success, otherwise a negative error value
 * @retval #EOM_ERROR_NONE Successful
 * @retval #EOM_ERROR_INVALID_PARAMETER Invalid parameter
 * @retval #EOM_ERROR_MESSAGE_SENDING_FAILURE Communication failure with EOM module
 * @retval #EOM_ERROR_MESSAGE_OPERATION_FAILURE Operation failure
 * @pre eom_init()
 * @pre eom_get_eom_output_ids()
 * @see #eom_output_id
 * @see #eom_error_e
 */
int eom_set_output_attribute (eom_output_id output_id, eom_output_attribute_e attr);

/**
 * @brief Sets window to the external output best resolution of external output device.
 * @since_tizen 2.4
 * @param[in] output_id  The id of external output device
 * @param[in] win  The pointer of evas object
 * @return 0 on success, otherwise a negative error value
 * @retval #EOM_ERROR_NONE Successful
 * @retval #EOM_ERROR_INVALID_PARAMETER Invalid parameter
 * @retval #EOM_ERROR_MESSAGE_SENDING_FAILURE Communication failure with EOM module
 * @retval #EOM_ERROR_MESSAGE_OPERATION_FAILURE Operation failure
 * @pre eom_init()
 * @pre eom_get_eom_output_ids()
 * @see #eom_output_id
 * @see #eom_error_e
 */
int eom_set_output_window (eom_output_id output_id, Evas_Object *win);

#ifdef __cplusplus
}
#endif

/**
* @}
*/

#endif /* __EOM_H__ */