Initialize Tizen 2.3
[apps/livebox/livebox-viewer.git] / include / livebox.h
1 /*
2  * Copyright 2013  Samsung Electronics Co., Ltd
3  *
4  * Licensed under the Flora License, Version 1.1 (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://floralicense.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 #ifndef __LIVEBOX_H
18 #define __LIVEBOX_H
19
20 #ifdef __cplusplus
21 extern "C" {
22 #endif
23
24 /*!
25  * \addtogroup CAPI_LIVEBOX_VIEWER_MODULE
26  * \{
27  */
28
29 /*!
30  * \brief
31  * Structure for a Livebox instance
32  */
33 struct livebox;
34
35 /*!
36  * \brief
37  * Use the default update period which is defined in the package manifest file of a livebox.
38  */
39 #define DEFAULT_PERIOD -1.0f
40
41 /*!
42  * \brief
43  * Mouse & Key event for buffer type Livebox or PD
44  * Viewer should send these events to livebox.
45  */
46 enum content_event_type {
47         CONTENT_EVENT_MOUSE_DOWN        = 0x00000001, /*!< LB mouse down event for livebox */
48         CONTENT_EVENT_MOUSE_UP          = 0x00000002, /*!< LB mouse up event for livebox */
49         CONTENT_EVENT_MOUSE_MOVE        = 0x00000004, /*!< LB mouse move event for livebox */
50         CONTENT_EVENT_MOUSE_ENTER       = 0x00000008, /*!< LB mouse enter event for livebox */
51         CONTENT_EVENT_MOUSE_LEAVE       = 0x00000010, /*!< LB mouse leave event for livebox */
52         CONTENT_EVENT_MOUSE_SET         = 0x00000020, /*!< LB mouse set auto event for livebox */
53         CONTENT_EVENT_MOUSE_UNSET       = 0x00000040, /*!< LB mouse unset auto event for livebox */
54
55         CONTENT_EVENT_KEY_DOWN          = 0x00000001, /*!< LB key press */
56         CONTENT_EVENT_KEY_UP            = 0x00000002, /*!< LB key release */
57         CONTENT_EVENT_KEY_FOCUS_IN      = 0x00000008, /*!< LB key focused in */
58         CONTENT_EVENT_KEY_FOCUS_OUT     = 0x00000010, /*!< LB key focused out */
59         CONTENT_EVENT_KEY_SET           = 0x00000020, /*!< LB Key, start feeding event by master */
60         CONTENT_EVENT_KEY_UNSET         = 0x00000040, /*!< LB key, stop feeding event by master */
61
62         CONTENT_EVENT_ON_SCROLL         = 0x00000080, /*!< LB On scrolling */
63         CONTENT_EVENT_ON_HOLD           = 0x00000100, /*!< LB On holding */
64         CONTENT_EVENT_OFF_SCROLL        = 0x00000200, /*!< LB Stop scrolling */
65         CONTENT_EVENT_OFF_HOLD          = 0x00000400, /*!< LB Stop holding */
66
67         CONTENT_EVENT_KEY_MASK          = 0x80000000,
68         CONTENT_EVENT_MOUSE_MASK        = 0x20000000,
69         CONTENT_EVENT_PD_MASK           = 0x10000000,
70         CONTENT_EVENT_LB_MASK           = 0x40000000,
71
72         LB_MOUSE_ON_SCROLL              = CONTENT_EVENT_LB_MASK | CONTENT_EVENT_MOUSE_MASK | CONTENT_EVENT_ON_SCROLL, /*!< Mouse event occurs while scrolling */
73         LB_MOUSE_ON_HOLD                = CONTENT_EVENT_LB_MASK | CONTENT_EVENT_MOUSE_MASK | CONTENT_EVENT_ON_HOLD, /*!< Mouse event occurs on holding */
74         LB_MOUSE_OFF_SCROLL             = CONTENT_EVENT_LB_MASK | CONTENT_EVENT_MOUSE_MASK | CONTENT_EVENT_OFF_SCROLL, /*!< Scrolling stopped */
75         LB_MOUSE_OFF_HOLD               = CONTENT_EVENT_LB_MASK | CONTENT_EVENT_MOUSE_MASK | CONTENT_EVENT_OFF_HOLD, /*!< Holding stopped */
76
77         LB_MOUSE_DOWN                   = CONTENT_EVENT_LB_MASK | CONTENT_EVENT_MOUSE_MASK | CONTENT_EVENT_MOUSE_DOWN, /*!< Mouse down on the livebox */
78         LB_MOUSE_UP                     = CONTENT_EVENT_LB_MASK | CONTENT_EVENT_MOUSE_MASK | CONTENT_EVENT_MOUSE_UP, /*!< Mouse up on the livebox */
79         LB_MOUSE_MOVE                   = CONTENT_EVENT_LB_MASK | CONTENT_EVENT_MOUSE_MASK | CONTENT_EVENT_MOUSE_MOVE, /*!< Move move on the livebox */
80         LB_MOUSE_ENTER                  = CONTENT_EVENT_LB_MASK | CONTENT_EVENT_MOUSE_MASK | CONTENT_EVENT_MOUSE_ENTER, /*!< Mouse enter to the livebox */
81         LB_MOUSE_LEAVE                  = CONTENT_EVENT_LB_MASK | CONTENT_EVENT_MOUSE_MASK | CONTENT_EVENT_MOUSE_LEAVE, /*!< Mouse leave from the livebox */
82         LB_MOUSE_SET                    = CONTENT_EVENT_LB_MASK | CONTENT_EVENT_MOUSE_MASK | CONTENT_EVENT_MOUSE_SET, /*!< Mouse event, start feeding event by master */
83         LB_MOUSE_UNSET                  = CONTENT_EVENT_LB_MASK | CONTENT_EVENT_MOUSE_MASK | CONTENT_EVENT_MOUSE_UNSET, /*!< Mouse event, stop feeding event by master */
84
85         PD_MOUSE_ON_SCROLL              = CONTENT_EVENT_PD_MASK | CONTENT_EVENT_MOUSE_MASK | CONTENT_EVENT_ON_SCROLL, /*!< Mouse event occurs while scrolling */
86         PD_MOUSE_ON_HOLD                = CONTENT_EVENT_PD_MASK | CONTENT_EVENT_MOUSE_MASK | CONTENT_EVENT_ON_HOLD, /*!< Mouse event occurs on holding */
87         PD_MOUSE_OFF_SCROLL             = CONTENT_EVENT_PD_MASK | CONTENT_EVENT_MOUSE_MASK | CONTENT_EVENT_OFF_SCROLL, /*!< Scrolling stopped */
88         PD_MOUSE_OFF_HOLD               = CONTENT_EVENT_PD_MASK | CONTENT_EVENT_MOUSE_MASK | CONTENT_EVENT_OFF_HOLD, /*!< Holding stopped */
89
90         PD_MOUSE_DOWN                   = CONTENT_EVENT_PD_MASK | CONTENT_EVENT_MOUSE_MASK | CONTENT_EVENT_MOUSE_DOWN, /*!< Mouse down on the PD */
91         PD_MOUSE_UP                     = CONTENT_EVENT_PD_MASK | CONTENT_EVENT_MOUSE_MASK | CONTENT_EVENT_MOUSE_UP, /*!< Mouse up on the PD */
92         PD_MOUSE_MOVE                   = CONTENT_EVENT_PD_MASK | CONTENT_EVENT_MOUSE_MASK | CONTENT_EVENT_MOUSE_MOVE, /*!< Mouse move on the PD */
93         PD_MOUSE_ENTER                  = CONTENT_EVENT_PD_MASK | CONTENT_EVENT_MOUSE_MASK | CONTENT_EVENT_MOUSE_ENTER, /*!< Mouse enter to the PD */
94         PD_MOUSE_LEAVE                  = CONTENT_EVENT_PD_MASK | CONTENT_EVENT_MOUSE_MASK | CONTENT_EVENT_MOUSE_LEAVE, /*!< Mouse leave from the PD */
95         PD_MOUSE_SET                    = CONTENT_EVENT_PD_MASK | CONTENT_EVENT_MOUSE_MASK | CONTENT_EVENT_MOUSE_SET, /*!< Mouse event, start feeding event by master */
96         PD_MOUSE_UNSET                  = CONTENT_EVENT_PD_MASK | CONTENT_EVENT_MOUSE_MASK | CONTENT_EVENT_MOUSE_UNSET, /*!< Mouse event, stop feeding event by master */
97
98         LB_KEY_DOWN                     = CONTENT_EVENT_LB_MASK | CONTENT_EVENT_KEY_MASK | CONTENT_EVENT_KEY_DOWN, /*!< Key down on the livebox */
99         LB_KEY_UP                       = CONTENT_EVENT_LB_MASK | CONTENT_EVENT_KEY_MASK | CONTENT_EVENT_KEY_UP, /*!< Key up on the livebox */
100         LB_KEY_SET                      = CONTENT_EVENT_LB_MASK | CONTENT_EVENT_KEY_MASK | CONTENT_EVENT_KEY_SET, /*!< Key event, start feeding event by master */
101         LB_KEY_UNSET                    = CONTENT_EVENT_LB_MASK | CONTENT_EVENT_KEY_MASK | CONTENT_EVENT_KEY_UNSET, /*!< Key event, stop feeding event by master */
102         LB_KEY_FOCUS_IN                 = CONTENT_EVENT_LB_MASK | CONTENT_EVENT_KEY_MASK | CONTENT_EVENT_KEY_FOCUS_IN, /*!< Key event, focus in */
103         LB_KEY_FOCUS_OUT                = CONTENT_EVENT_LB_MASK | CONTENT_EVENT_KEY_MASK | CONTENT_EVENT_KEY_FOCUS_OUT, /*!< Key event, foucs out */
104
105         PD_KEY_DOWN                     = CONTENT_EVENT_PD_MASK | CONTENT_EVENT_KEY_MASK | CONTENT_EVENT_KEY_DOWN, /*!< Key down on the livebox */
106         PD_KEY_UP                       = CONTENT_EVENT_PD_MASK | CONTENT_EVENT_KEY_MASK | CONTENT_EVENT_KEY_UP, /*!< Key up on the livebox */
107         PD_KEY_SET                      = CONTENT_EVENT_PD_MASK | CONTENT_EVENT_KEY_MASK | CONTENT_EVENT_KEY_SET, /*!< Key event, start feeding event by master */
108         PD_KEY_UNSET                    = CONTENT_EVENT_PD_MASK | CONTENT_EVENT_KEY_MASK | CONTENT_EVENT_KEY_UNSET, /*!< Key event, stop feeding event by master */
109         PD_KEY_FOCUS_IN                 = CONTENT_EVENT_PD_MASK | CONTENT_EVENT_KEY_MASK | CONTENT_EVENT_KEY_FOCUS_IN, /*!< Key event, focus in */
110         PD_KEY_FOCUS_OUT                = CONTENT_EVENT_PD_MASK | CONTENT_EVENT_KEY_MASK | CONTENT_EVENT_KEY_FOCUS_OUT, /*!< Key event, focus out */
111
112         CONTENT_EVENT_MAX               = 0xFFFFFFFF
113 };
114
115 /*!
116  * \brief
117  * Accessibility event for buffer type Livebox or PD.
118  * These event set are sync'd with Tizen accessibility event set.
119  */
120 enum access_event_type {
121         ACCESS_EVENT_PD_MASK            = 0x10000000,
122         ACCESS_EVENT_LB_MASK            = 0x20000000,
123
124         ACCESS_EVENT_HIGHLIGHT          = 0x00000100, /*!< LB accessibility: Hightlight a object */
125         ACCESS_EVENT_HIGHLIGHT_NEXT     = 0x00000200, /*!< LB accessibility: Set highlight to next object */
126         ACCESS_EVENT_HIGHLIGHT_PREV     = 0x00000400, /*!< LB accessibility: Set highlight to prev object */
127         ACCESS_EVENT_UNHIGHLIGHT        = 0x00000800, /*!< LB accessibility unhighlight */
128         ACCESS_EVENT_ACTIVATE           = 0x00001000, /*!< LB accessibility activate */
129         ACCESS_EVENT_ACTION_DOWN        = 0x00010000, /*!< LB accessibility value changed */
130         ACCESS_EVENT_ACTION_UP          = 0x00020000, /*!< LB accessibility value changed */
131         ACCESS_EVENT_SCROLL_DOWN        = 0x00100000, /*!< LB accessibility scroll down */
132         ACCESS_EVENT_SCROLL_MOVE        = 0x00200000, /*!< LB accessibility scroll move */
133         ACCESS_EVENT_SCROLL_UP          = 0x00400000, /*!< LB accessibility scroll up */
134
135         LB_ACCESS_HIGHLIGHT             = ACCESS_EVENT_LB_MASK | ACCESS_EVENT_HIGHLIGHT,        /*!< Access event - Highlight an object in the livebox */
136         LB_ACCESS_HIGHLIGHT_NEXT        = ACCESS_EVENT_LB_MASK | ACCESS_EVENT_HIGHLIGHT_NEXT,   /*!< Access event - Move highlight to the next object in a livebox */
137         LB_ACCESS_HIGHLIGHT_PREV        = ACCESS_EVENT_LB_MASK | ACCESS_EVENT_HIGHLIGHT_PREV,   /*!< Access event - Move highlight to the prev object in a livebox */
138         LB_ACCESS_UNHIGHLIGHT           = ACCESS_EVENT_LB_MASK | ACCESS_EVENT_UNHIGHLIGHT,      /*!< Access event - Delete highlight from the livebox */
139         LB_ACCESS_ACTIVATE              = ACCESS_EVENT_LB_MASK | ACCESS_EVENT_ACTIVATE,         /*!< Access event - Launch or activate the highlighted object */
140         LB_ACCESS_ACTION_DOWN           = ACCESS_EVENT_LB_MASK | ACCESS_EVENT_ACTION_DOWN,      /*!< Access event - down */
141         LB_ACCESS_ACTION_UP             = ACCESS_EVENT_LB_MASK | ACCESS_EVENT_ACTION_UP,        /*!< Access event - up */
142         LB_ACCESS_SCROLL_DOWN           = ACCESS_EVENT_LB_MASK | ACCESS_EVENT_SCROLL_DOWN,      /*!< Access event - scroll down */
143         LB_ACCESS_SCROLL_MOVE           = ACCESS_EVENT_LB_MASK | ACCESS_EVENT_SCROLL_MOVE,      /*!< Access event - scroll move */
144         LB_ACCESS_SCROLL_UP             = ACCESS_EVENT_LB_MASK | ACCESS_EVENT_SCROLL_UP,        /*!< Access event - scroll up */
145
146         PD_ACCESS_HIGHLIGHT             = ACCESS_EVENT_PD_MASK | ACCESS_EVENT_HIGHLIGHT,        /*!< Access event - Highlight an object in the PD */
147         PD_ACCESS_HIGHLIGHT_NEXT        = ACCESS_EVENT_PD_MASK | ACCESS_EVENT_HIGHLIGHT_NEXT,   /*!< Access event - Move highlight to the next object in a PD */
148         PD_ACCESS_HIGHLIGHT_PREV        = ACCESS_EVENT_PD_MASK | ACCESS_EVENT_HIGHLIGHT_PREV,   /*!< Access event - Move highlight to the prev object in a PD */
149         PD_ACCESS_UNHIGHLIGHT           = ACCESS_EVENT_PD_MASK | ACCESS_EVENT_UNHIGHLIGHT,      /*!< Access event - Delet highlight from the PD */
150         PD_ACCESS_ACTIVATE              = ACCESS_EVENT_PD_MASK | ACCESS_EVENT_ACTIVATE,         /*!< Access event - Launch or activate the highlighted object */
151         PD_ACCESS_ACTION_DOWN           = ACCESS_EVENT_PD_MASK | ACCESS_EVENT_ACTION_DOWN,      /*!< Access event - down */
152         PD_ACCESS_ACTION_UP             = ACCESS_EVENT_PD_MASK | ACCESS_EVENT_ACTION_UP,        /*!< Access event - up */
153         PD_ACCESS_SCROLL_DOWN           = ACCESS_EVENT_PD_MASK | ACCESS_EVENT_SCROLL_DOWN,      /*!< Access event - scroll down */
154         PD_ACCESS_SCROLL_MOVE           = ACCESS_EVENT_PD_MASK | ACCESS_EVENT_SCROLL_MOVE,      /*!< Access event - scroll move */
155         PD_ACCESS_SCROLL_UP             = ACCESS_EVENT_PD_MASK | ACCESS_EVENT_SCROLL_UP         /*!< Access event - scroll up */
156 };
157
158 /*!
159  * \brief
160  * Livebox LB content type
161  */
162 enum livebox_lb_type {
163         LB_TYPE_IMAGE = 0x01, /*!< Contents of a livebox is based on the image file */
164         LB_TYPE_BUFFER = 0x02, /*!< Contents of a livebox is based on canvas buffer(shared) */
165         LB_TYPE_TEXT = 0x04, /*!< Contents of a livebox is based on formatted text file */
166         LB_TYPE_PIXMAP = 0x08, /*!< Contens of a livebox is shared by the pixmap(depends on X) */
167
168         LB_TYPE_INVALID = 0xFF
169 };
170
171 /*!
172  * \brief
173  * Livebox PD content type
174  */
175 enum livebox_pd_type {
176         PD_TYPE_BUFFER = 0x01, /*!< Contents of a PD is based on canvas buffer(shared) */
177         PD_TYPE_TEXT = 0x02, /*!< Contents of a PD is based on formatted text file */
178         PD_TYPE_PIXMAP = 0x04, /*!< Contents of a livebox is shared by the pixmap(depends on X) */
179
180         PD_TYPE_INVALID = 0xFF
181 };
182
183 /*!
184  * \brief
185  * Livebox event type.
186  * These event will be sent from the provider.
187  */
188 enum livebox_event_type { /*!< livebox_event_handler_set Event list */
189         LB_EVENT_LB_UPDATED, /*!< Contents of the given livebox is updated */
190         LB_EVENT_PD_UPDATED, /*!< Contents of the given pd is updated */
191
192         LB_EVENT_CREATED, /*!< A new livebox is created */
193         LB_EVENT_DELETED, /*!< A livebox is deleted */
194
195         LB_EVENT_GROUP_CHANGED, /*!< Group (Cluster/Sub-cluster) information is changed */
196         LB_EVENT_PINUP_CHANGED, /*!< PINUP status is changed */
197         LB_EVENT_PERIOD_CHANGED, /*!< Update period is changed */
198
199         LB_EVENT_LB_SIZE_CHANGED, /*!< Livebox size is changed */
200         LB_EVENT_PD_SIZE_CHANGED, /*!< PD size is changed */
201
202         LB_EVENT_PD_CREATED, /*!< If a PD is created even if you didn't call the livebox_create_pd API */
203         LB_EVENT_PD_DESTROYED, /*!< If a PD is destroyed even if you didn't call the livebox_destroy_pd API */
204
205         LB_EVENT_HOLD_SCROLL, /*!< If the screen should be freezed */
206         LB_EVENT_RELEASE_SCROLL, /*!< If the screen can be scrolled */
207
208         LB_EVENT_LB_UPDATE_BEGIN, /*!< Livebox LB content update is started */
209         LB_EVENT_LB_UPDATE_END, /*!< Livebox LB content update is finished */
210
211         LB_EVENT_PD_UPDATE_BEGIN, /*!< Livebox PD content update is started */
212         LB_EVENT_PD_UPDATE_END, /*!< Livebox PD content update is finished */
213
214         LB_EVENT_UPDATE_MODE_CHANGED, /*!< Livebox Update mode is changed */
215
216         LB_EVENT_REQUEST_CLOSE_PD, /*!< Livebox requests to close the PD */
217
218         LB_EVENT_IGNORED /*!< Request is ignored */
219 };
220
221 enum livebox_option_type {
222         LB_OPTION_MANUAL_SYNC,                  /*!< Sync manually */
223         LB_OPTION_FRAME_DROP_FOR_RESIZE,        /*!< Drop frames while resizing */
224         LB_OPTION_SHARED_CONTENT,               /*!< Use only one real instance for multiple fake instances if user creates it using same content */
225
226         LB_OPTION_ERROR = 0xFFFFFFFF            /*!< To specify the size of this enumeration type */
227 };
228
229 enum livebox_fault_type {
230         LB_FAULT_DEACTIVATED, /*!< Livebox is deactivated by its fault operation */
231         LB_FAULT_PROVIDER_DISCONNECTED /*!< Provider is disconnected */
232 };
233
234 /*!
235  * \brief
236  * Must be sync'd with the provider
237  */
238 enum livebox_visible_state {
239         LB_SHOW = 0x00, /*!< Livebox is shown. Default state */
240         LB_HIDE = 0x01, /*!< Livebox is hidden, Update timer will not be freezed. but you cannot receive any updates events. */
241
242         LB_HIDE_WITH_PAUSE = 0x02, /*!< Livebix is hidden, it will pause the update timer, but if a livebox updates its contents, update event will be triggered */
243
244         LB_VISIBLE_ERROR = 0xFFFFFFFF /*!< To specify the size of this enumeration type */
245 };
246
247 /*!
248  * \brief
249  * TEXT type livebox contents handling opertators.
250  */
251 struct livebox_script_operators {
252         int (*update_begin)(struct livebox *handle); /*!< Content parser is started */
253         int (*update_end)(struct livebox *handle); /*!< Content parser is finished */
254
255         /*!
256          * \brief
257          * Listed functions will be called when parser meets each typed content
258          */
259         int (*update_text)(struct livebox *handle, const char *id, const char *part, const char *data); /*!< Update text content */
260         int (*update_image)(struct livebox *handle, const char *id, const char *part, const char *data, const char *option); /*!< Update image content */
261         int (*update_script)(struct livebox *handle, const char *id, const char *new_id, const char *part, const char *file, const char *group); /*!< Update script content */
262         int (*update_signal)(struct livebox *handle, const char *id, const char *emission, const char *signal); /*!< Update signal */
263         int (*update_drag)(struct livebox *handle, const char *id, const char *part, double dx, double dy); /*!< Update drag info */
264         int (*update_info_size)(struct livebox *handle, const char *id, int w, int h); /*!< Update content size */
265         int (*update_info_category)(struct livebox *handle, const char *id, const char *category); /*!< Update content category info */
266         int (*update_access)(struct livebox *handle, const char *id, const char *part, const char *text, const char *option); /*!< Update access information */
267         int (*operate_access)(struct livebox *handle, const char *id, const char *part, const char *operation, const char *option); /*!< Update access operation */
268         int (*update_color)(struct livebox *handle, const char *id, const char *part, const char *data); /*!< Update color */
269 };
270
271 /*!
272  * \brief Prototype of the return callback of every async functions
273  * \details N/A
274  * \remarks N/A
275  * \param[in] handle Handle of the livebox instance
276  * \param[in] ret Result status of operation. LB_STATUS_XXX defined from liblivebox-service
277  * \param[in] data data for result callback
278  * \return void
279  * \pre N/A
280  * \post N/A
281  * \see livebox_add
282  * \see livebox_add_with_size
283  * \see livebox_del
284  * \see livebox_activate
285  * \see livebox_resize
286  * \see livebox_set_group
287  * \see livebox_set_period
288  * \see livebox_access_event
289  * \see livebox_set_pinup
290  * \see livebox_create_pd
291  * \see livebox_create_pd_with_position
292  * \see livebox_destroy_pd
293  * \see livebox_emit_text_signal
294  * \see livebox_acquire_pd_pixmap
295  * \see livebox_acquire_lb_pixmap
296  * \see livebox_set_update_mode
297  */
298 typedef void (*ret_cb_t)(struct livebox *handle, int ret, void *data);
299
300 /*!
301  * \brief Initialize the livebox system
302  * \details N/A
303  * \remarks
304  *   This API uses get/setenv APIs.
305  *   Those APIs are not thread-safe.
306  *   So you have to consider to use the livebox_init_with_options instead of this if you are developing multi-threaded viewer.
307  * \param[in] disp If you have X Display connection object already, you can re-use it. but you should care its life cycle.
308  *                 It must be alive before call the livebox_fini
309  * \return int
310  * \retval LB_STATUS_SUCCESS if success
311  * \pre N/A
312  * \post N/A
313  * \see livebox_fini
314  * \see livebox_init_with_options
315  */
316 extern int livebox_init(void *disp);
317
318 /*!
319  * \brief Initialize the livebox system with some options
320  * \details livebox_init function uses environment value to initiate some configurable values
321  *          But some application doesn't want to use the env value.
322  *          For them, this API will give a chance to set default options using given arguments
323  * \remarks N/A
324  * \param[in] disp if this display is NULL, the library will try to acquire a new connection with X
325  * \param[in] prevent_overwrite If the content of image type livebox is updated, don't overwrite it(1) or overwrite old file(0)
326  * \param[in] event_filter If the next event comes in this period, ignore it. It is too fast to processing it in time.
327  * \param[in] use_thread Use the receive thread.
328  * \return int Integer, Livebox status code
329  * \retval LB_STATUS_SUCCESS if success
330  * \pre N/A
331  * \post N/A
332  * \see livebox_init
333  * \see livebox_fini
334  */
335 extern int livebox_init_with_options(void *disp, int prevent_overwrite, double event_filter, int use_thread);
336
337 /*!
338  * \brief Finalize the livebox system
339  * \details N/A
340  * \remarks N/A
341  * \return int
342  * \retval LB_STATUS_SUCCES if success
343  * \retval LB_STATUS_ERROR_INVALID if livebox_init is not called.
344  * \pre N/A
345  * \post N/A
346  * \see livebox_init
347  * \see livebox_init_with_options
348  */
349 extern int livebox_fini(void);
350
351 /*!
352  * \brief Notify the status of client to the provider. "it is paused".
353  * \details N/A
354  * \remarks N/A
355  * \return int
356  * \retval LB_STATUS_SUCCESS if success
357  * \retval LB_STATUS_ERROR_FAULT if it failed to send state(paused) info
358  * \pre N/A
359  * \post N/A
360  * \see livebox_client_resumed
361  */
362 extern int livebox_client_paused(void);
363
364 /*!
365  * \brief Notify the status of client to the provider. "it is resumed".
366  * \details N/A
367  * \remarks N/A
368  * \return int
369  * \retval LB_STATUS_SUCCESS if success
370  * \retval LB_STATUS_ERROR_FAULT if it failed to send state(resumed) info
371  * \pre N/A
372  * \post N/A
373  * \see livebox_client_paused
374  */
375 extern int livebox_client_resumed(void);
376
377 /*!
378  * \brief Add a new livebox
379  * \details N/A
380  * \remarks
381  *    Even though you get the livebox handle from return value of this function,
382  *    it is not matured before return callback called.
383  *    You have to use the handle after get the return callback with "ret == LB_STATUS_SUCCESS"
384  * \param[in] pkgname Livebox Id
385  * \param[in] content Will be passed to the livebox instance.
386  * \param[in] cluster Main group
387  * \param[in] category Sub group
388  * \param[in] period Update period. if you set DEFAULT_PERIOD, the provider will use the default period which is described in the manifest.
389  * \param[in] cb After send the request to the provider, its result will be passed
390  * \param[in] data
391  * \return handle
392  * \retval NULL if it fails to add a new instance
393  * \retval handle livebox handle
394  * \pre N/A
395  * \post
396  * \see ret_cb_t
397  * \see livebox_add_with_size
398  */
399 extern struct livebox *livebox_add(const char *pkgname, const char *content, const char *cluster, const char *category, double period, ret_cb_t cb, void *data);
400
401 /*!
402  * \brief Add a new livebox
403  * \details
404  * If the screen size if "1280x720"
405  * Below size lists are used for default.
406  * Or you can find the default sizes in pixel from /usr/share/data-provider-master/resolution.ini
407  * Size types are defined from the liblivebox-service package. (livebox-service.h)
408  *
409  * Normal mode livebox
410  * 1x1=175x175, LB_SIZE_TYPE_1x1
411  * 2x1=354x175, LB_SIZE_TYPE_2x1
412  * 2x2=354x354, LB_SIZE_TYPE_2x2
413  * 4x1=712x175, LB_SIZE_TYPE_4x1
414  * 4x2=712x354, LB_SIZE_TYPE_4x2
415  * 4x4=712x712, LB_SIZE_TYPE_4x4
416  *
417  * Extended sizes
418  * 4x3=712x533, LB_SIZE_TYPE_4x3
419  * 4x5=712x891, LB_SIZE_TYPE_4x5
420  * 4x6=712x1070, LB_SIZE_TYPE_4x6
421  *
422  * Easy mode livebox
423  * 21x21=224x215, LB_SIZE_TYPE_EASY_1x1
424  * 23x21=680x215, LB_SIZE_TYPE_EASY_3x1
425  * 23x23=680x653, LB_SIZE_TYPE_EASY_3x3
426  *
427  * Special livebox
428  * 0x0=720x1280, LB_SIZE_TYPE_0x0
429  *
430  * \remarks
431  *    Even if you get the handle by return value of this function, it is not created instance.
432  *    So you have to deal it as not initialized handle.
433  *    Only it can be initialized after get the return callback with "ret == LB_STATUS_SUCCESS".
434  * \param[in] pkgname Livebox Id
435  * \param[in] content Will be passed to the livebox instance.
436  * \param[in] cluster Main group
437  * \param[in] category Sub group
438  * \param[in] period DEFAULT_PERIOD can be used for this. this argument will be used to specify the period of update content of livebox.
439  * \param[in] type Size type - which are defined from liblivebox-service package.
440  * \param[in] cb After the request is sent to the master provider, this callback will be called.
441  * \param[in] data This data will be passed to the callback.
442  * \return handle
443  * \retval handle Livebox handle but not yet initialized
444  * \retval NULL if it fails to create a handle
445  * \see ret_cb_t
446  * \see livebox_add
447  */
448 extern struct livebox *livebox_add_with_size(const char *pkgname, const char *content, const char *cluster, const char *category, double period, int type, ret_cb_t cb, void *data);
449
450 /*!
451  * \brief Delete a livebox (deprecated)
452  * \details N/A
453  * \remarks
454  *    If you call this with uninitialized handle, the return callback will be called synchronously.
455  *    So before return from this function, the return callback will be called first.
456  * \param[in] handler Handler of a livebox instance
457  * \param[in] cb return callback
458  * \param[in] data user data for return callback
459  * \return int
460  * \retval LB_STATUS_ERROR_INVALID Invalid argument
461  * \retval LB_STATUS_ERROR_BUSY already in process
462  * \retval LB_STATUS_ERROR_FAULT failed to create a request packet
463  * \retval LB_STATUS_SUCCESS successfully sent, return callack will be called
464  * \pre N/A
465  * \post N/A
466  * \see ret_cb_t
467  */
468 extern int livebox_del(struct livebox *handler, ret_cb_t cb, void *data);
469
470 /*!
471  * \brief Delete a livebox (will be replaced with livebox_del)
472  * \details N/A
473  * \remarks
474  *    If you call this with uninitialized handle, the return callback will be called synchronously.
475  *    So before return from this function, the return callback will be called first.
476  * \param[in] handler Handler of a livebox instance
477  * \param[in] type Deletion type, LB_DELETE_PERMANENTLY or LB_DELETE_TEMPORARY
478  * \param[in] cb return callback
479  * \param[in] data user data for return callback
480  * \return int
481  * \retval LB_STATUS_ERROR_INVALID Invalid argument
482  * \retval LB_STATUS_ERROR_BUSY already in process
483  * \retval LB_STATUS_ERROR_FAULT failed to create a request packet
484  * \retval LB_STATUS_SUCCESS successfully sent, return callack will be called
485  * \pre N/A
486  * \post N/A
487  * \see ret_cb_t
488  */
489 extern int livebox_del_NEW(struct livebox *handler, int type, ret_cb_t cb, void *data);
490
491 /*!
492  * \brief Set a livebox events callback
493  * \details
494  *    To get the events push from the provider, register the event callback using this function
495  *    The callback will be called if there is any events from the provider.
496  * \remarks N/A
497  * \param[in] cb Event handler
498  * \param[in] data User data for the event handler
499  * \return int
500  * \retval LB_STATUS_SUCCESS if succeed to set event handler
501  * \retval LB_STATUS_ERROR_INVALID Invalid argument
502  * \retval LB_STATUS_ERROR_MEMORY Not enough memory
503  * \pre NULL
504  * \post NULL
505  * \see livebox_unset_event_handler
506  */
507 extern int livebox_set_event_handler(int (*cb)(struct livebox *handler, enum livebox_event_type event, void *data), void *data);
508
509 /*!
510  * \brief Unset the livebox event handler
511  * \details N/A
512  * \remarks N/A
513  * \param[in] cb Event handler
514  * \return void * Event handler data
515  * \retval pointer of 'data' which is used with the livebox_set_event_handler
516  * \pre N/A
517  * \post N/A
518  * \see livebox_set_event_handler
519  */
520 extern void *livebox_unset_event_handler(int (*cb)(struct livebox *handler, enum livebox_event_type event, void *data));
521
522 /*!
523  * \brief Live box fault event handler registeration function
524  *   argument list
525  *      event, pkgname, filename, funcname
526  * \details N/A
527  * \remarks N/A
528  * \param[in] cb Event handler
529  * \param[in] data Event handler data
530  * \return int
531  * \retval LB_STATUS_SUCCESS if succeed to set fault event handler
532  * \retval LB_STATUS_ERROR_INVALID Invalid argument
533  * \retval LB_STATUS_ERROR_MEMORY Not enough memory
534  * \pre N/A
535  * \post N/A
536  * \see livebox_unset_fault_handler
537  */
538 extern int livebox_set_fault_handler(int (*cb)(enum livebox_fault_type, const char *, const char *, const char *, void *), void *data);
539
540 /*!
541  * \brief Unset the live box fault event handler
542  * \details N/A
543  * \remarks N/A
544  * \param[in] cb Event handler
545  * \return void * Callback data which is set via livebox_set_fault_handler
546  * \retval pointer of 'data' which is used with the livebox_set_fault_handler
547  * \pre N/A
548  * \post N/A
549  * \see livebox_set_fault_handler
550  */
551 extern void *livebox_unset_fault_handler(int (*cb)(enum livebox_fault_type, const char *, const char *, const char *, void *));
552
553 /*!
554  * \brief Activate the faulted livebox.
555  * \details
556  *    Request result will be back via return callback.
557  * \remarks
558  *    Even though this function returns SUCCESS, it means just successfully sent a request to provider.
559  *    So you have to check the return callback. and its "ret" argument.
560  * \param[in] pkgname Package name which should be activated
561  * \param[in] cb Result callback
562  * \param[in] data Callback data
563  * \return int
564  * \retval LB_STATUS_SUCCESS Successfully sent a request
565  * \retval LB_STATUS_ERROR_INVALID Invalid argument
566  * \retval LB_STATUS_ERROR_FAULT Failed to make a request
567  * \pre N/A
568  * \post N/A
569  * \see ret_cb_t
570  */
571 extern int livebox_activate(const char *pkgname, ret_cb_t cb, void *data);
572
573 /*!
574  * \brief Resize the livebox
575  * \details
576  * Normal mode livebox size
577  * 1x1=175x175, LB_SIZE_TYPE_1x1
578  * 2x1=354x175, LB_SIZE_TYPE_2x1
579  * 2x2=354x354, LB_SIZE_TYPE_2x2
580  * 4x1=712x175, LB_SIZE_TYPE_4x1
581  * 4x2=712x354, LB_SIZE_TYPE_4x2
582  * 4x4=712x712, LB_SIZE_TYPE_4x4
583  *
584  * Extended livebox size
585  * 4x3=712x533, LB_SIZE_TYPE_4x3
586  * 4x5=712x891, LB_SIZE_TYPE_4x5
587  * 4x6=712x1070, LB_SIZE_TYPE_4x6
588  *
589  * Easy mode livebox size
590  * 21x21=224x215, LB_SIZE_TYPE_EASY_1x1
591  * 23x21=680x215, LB_SIZE_TYPE_EASY_3x1
592  * 23x23=680x653, LB_SIZE_TYPE_EASY_3x3
593  *
594  * Special mode livebox size
595  * 0x0=720x1280, LB_SIZE_TYPE_0x0
596  * \remarks
597  *    You have to check the return callback.
598  * \param[in] handler Handler of a livebox instance
599  * \param[in] type Type of a livebox size, LB_SIZE_TYPE_1x1, ...
600  * \param[in] cb Result callback of the resize operation.
601  * \param[in] data User data for return callback
602  * \return int
603  * \retval LB_STATUS_ERROR_INVALID Invalid argument
604  * \retval LB_STATUS_ERROR_BUSY Previous request of resize is in progress.
605  * \retval LB_STATUS_ERROR_ALREADY Already resized, there is no differences between current size and requested size.
606  * \retval LB_STATUS_ERROR_PERMISSION Permission denied, you only have view the content of this box.
607  * \retval LB_STATUS_ERROR_FAULT Failed to make a request
608  * \pre N/A
609  * \post N/A
610  * \see ret_cb_t
611  */
612 extern int livebox_resize(struct livebox *handler, int type, ret_cb_t cb, void *data);
613
614 /*!
615  * \brief Send the click event for a livebox.
616  * \details N/A
617  * \remarks N/A
618  * \param[in] handler Handler of a livebox instance
619  * \param[in] x Rational X of the content width.
620  * \param[in] y Rational Y of the content height.
621  * \return int
622  * \retval LB_STATUS_ERROR_INVALID Invalid argument
623  * \retval LB_STATUS_ERROR_FAULT Unrecoverable error occurred
624  * \retval LB_STATUS_SUCCESS Successfully done
625  * \pre N/A
626  * \post N/A
627  * \see N/A
628  */
629 extern int livebox_click(struct livebox *handler, double x, double y);
630
631 /*!
632  * \brief Change the cluster/sub-cluster name of given livebox handler
633  * \details N/A
634  * \remarks N/A
635  * \param[in] handler Handler of a livebox instance
636  * \param[in] cluster New cluster of a livebox
637  * \param[in] category New category of a livebox
638  * \param[in] cb Result callback for changing the cluster/category of a livebox
639  * \param[in] data User data for the result callback
640  * \return int
641  * \retval LB_STATUS_SUCCESS Request is successfully sent. the return callback will be called.
642  * \retval LB_STATUS_ERROR_BUSY previous request is not finished yet.
643  * \retval LB_STATUS_ERROR_ALREADY group name is same with current one.
644  * \retval LB_STATUS_ERROR_PERMISSION you have no permission to change property of this livebox instance.
645  * \retval LB_STATUS_ERROR_FAULT Failed to make a request.
646  * \pre N/A
647  * \post N/A
648  * \see ret_cb_t
649  */
650 extern int livebox_set_group(struct livebox *handler, const char *cluster, const char *category, ret_cb_t cb, void *data);
651
652 /*!
653  * \brief Get the cluster and category(sub-cluster) name of given livebox (It is not I18N format, only english)
654  * \details N/A
655  * \remarks
656  *    You have to do not release the cluster & category.
657  *    It is allocated inside of given livebox instance, so you can only read it.
658  * \param[in] handler Handler of a livebox instance
659  * \param[out] cluster Storage(memory) for containing the cluster name
660  * \param[out] category Storage(memory) for containing the category name
661  * \return int
662  * \retval LB_STATUS_ERROR_INVALID Invalid argument
663  * \retval LB_STATUS_SUCCESS Successfully done
664  * \pre N/A
665  * \post N/A
666  * \see N/A
667  */
668 extern int livebox_get_group(struct livebox *handler, const char **cluster, const char **category);
669
670 /*!
671  * \brief Get the period of this livebox handler
672  * \details N/A
673  * \remarks
674  *    if this function returns 0.0f, it means the livebox has no update period.
675  *    or the handle is not valid.
676  *    This function only can be works after the return callback of livebox_create fucntion is called.
677  * \param[in] handler Handler of a livebox instance
678  * \return double
679  * \retval Current update period of a livebox
680  * \retval 0.0f it means the box has no update period, or it can returns 0.0 if the handles is not valid.
681  * \pre N/A
682  * \post N/A
683  * \see N/A
684  */
685 extern double livebox_period(struct livebox *handler);
686
687 /*!
688  * \brief Change the update period
689  * \details N/A
690  * \remarks N/A
691  * \param[in] handler Handler of a livebox instance
692  * \param[in] period New update period of a livebox
693  * \param[in] cb Result callback of changing the update period of this livebox
694  * \param[in] data User data for the result callback
695  * \return int
696  * \retval LB_STATUS_SUCCESS Successfully done
697  * \retval LB_STATUS_ERROR_INVALID Invalid argument
698  * \retval LB_STATUS_ERROR_BUSY
699  * \retval LB_STATUS_ERROR_ALREADY
700  * \retval LB_STATUS_ERROR_FAULT Unrecoverable error occurred
701  * \pre N/A
702  * \post N/A
703  * \see ret_cb_t
704  */
705 extern int livebox_set_period(struct livebox *handler, double period, ret_cb_t cb, void *data);
706
707 /*!
708  * \brief Is this an text type livebox?
709  * \details N/A
710  * \remarks N/A
711  * \param[in] handler Handler of a livebox instance
712  * \return livebox_lb_type
713  * \retval LB_TYPE_IMAGE Contents of a livebox is based on the image file
714  * \retval LB_TYPE_BUFFER Contents of a livebox is based on canvas buffer(shared)
715  * \retval LB_TYPE_TEXT Contents of a livebox is based on formatted text file
716  * \retval LB_TYPE_PIXMAP Contens of a livebox is shared by the pixmap(depends on X)
717  * \retval LB_TYPE_INVALID
718  * \pre N/A
719  * \post N/A
720  * \see livebox_lb_type
721  */
722 extern enum livebox_lb_type livebox_lb_type(struct livebox *handler);
723
724 /*!
725  * \brief Is this livebox is created by a user?
726  * \details
727  *    If the livebox instance is created by system this will returns 0.
728  * \remarks N/A
729  * \param[in] handler Handler of a livebox instance
730  * \return int
731  * \retval LB_STATUS_ERROR_INVALID Invalid argument
732  * \retval 0 automatically created livebox by the provider
733  * \retval 1 created by user via livebox_add or livebox_add_with_size
734  * \pre N/A
735  * \post N/A
736  * \see livebox_add
737  * \see livebox_add_with_size
738  * \see livebox_set_event_handler
739  */
740 extern int livebox_is_user(struct livebox *handler);
741
742 /*!
743  * \brief Get the content information string of given livebox
744  * \details N/A
745  * \remarks N/A
746  * \param[in] handler Handler of a livebox instance
747  * \return const char *
748  * \retval content_info Livebox content info that can be used again via content_info argument of livebox_add or livebox_add_with_size.
749  * \pre N/A
750  * \post N/A
751  * \see livebox_add
752  * \see livebox_add_with_size
753  */
754 extern const char *livebox_content(struct livebox *handler);
755
756 /*!
757  * \brief Get the sub cluster title string of given livebox
758  * \details
759  *  This API is now used for accessibility.
760  *  Each box should set their content as a string to read by TTS.
761  *  So if the box has focus on the homescreen, the homescreen will read a text using this API.
762  * \remarks
763  *  The title which is returned by this, the TTS should read it.
764  *  But it is just recomended to a homescreen.
765  *  So read it or not is depends on implementation of the homescreen.
766  * \param[in] handler Handler of a livebox instance
767  * \return const char *
768  * \retval sub cluster name
769  * \retval NULL
770  * \pre N/A
771  * \post N/A
772  * \see N/A
773  */
774 extern const char *livebox_category_title(struct livebox *handler);
775
776 /*!
777  * \brief Get the filename of given livebox, if it is an IMAGE type livebox
778  * \details
779  *   If the box is developed as image format to represent its contents,
780  *   The homescreen should know its image file name.
781  * \remarks N/A
782  * \param[in] handler Handler of a livebox instance
783  * \return const char *
784  * \retval filename if the livebox type is image this function will give you a abspath of an image file (content is rendered)
785  * \retval NULL if this has no image file or type is not image file.
786  * \pre N/A
787  * \post N/A
788  * \see N/A
789  */
790 extern const char *livebox_filename(struct livebox *handler);
791
792 /*!
793  * \brief Get the package name of given livebox handler
794  * \details N/A
795  * \remarks N/A
796  * \param[in] handler Handler of a livebox instance
797  * \return const char *
798  * \retval pkgname package name
799  * \retval NULL if the handler is not valid
800  * \pre N/A
801  * \post N/A
802  * \see N/A
803  */
804 extern const char *livebox_pkgname(struct livebox *handler);
805
806 /*!
807  * \brief Get the priority of a current content.
808  * \details N/A
809  * \remarks N/A
810  * \param[in] handler Handler of a livebox instance
811  * \return double
812  * \retval 0.0f handler is NULL
813  * \retval -1.0f Handler is not valid (not yet initialized)
814  * \retval real number between 0.0 and 1.0
815  * \pre N/A
816  * \post N/A
817  * \see N/A
818  */
819 extern double livebox_priority(struct livebox *handler);
820
821 /*!
822  * \brief Acquire the buffer of given livebox (Only for the buffer type)
823  * \details N/A
824  * \remarks N/A
825  * \param[in] handler Handler of a livebox instance
826  * \return void *
827  * \retval address of a FB
828  * \retval NULL if it fails to get fb address
829  * \pre N/A
830  * \post N/A
831  * \see N/A
832  */
833 extern void *livebox_acquire_fb(struct livebox *handler);
834
835 /*!
836  * \brief Release the buffer of a livebox (Only for the buffer type)
837  * \details N/A
838  * \remarks N/A
839  * \param[in] buffer
840  * \return int
841  * \retval LB_STATUS_ERROR_INVALID Invalid argument
842  * \retval LB_STATUS_SUCCESS Successfully done
843  * \pre N/A
844  * \post N/A
845  * \see livebox_acquire_fb
846  */
847 extern int livebox_release_fb(void *buffer);
848
849 /*!
850  * \brief Get the reference count of Livebox buffer (Only for the buffer type)
851  * \details N/A
852  * \remarks N/A
853  * \param[in] buffer
854  * \return int
855  * \retval LB_STATUS_ERROR_INVALID Invalid argument
856  * \retval LB_STATUS_ERROR_FAULT Unrecoverable error occurred
857  * \retval refcnt positive integer including ZERO
858  * \pre N/A
859  * \post N/A
860  * \see livebox_pdfb_refcnt
861  */
862 extern int livebox_fb_refcnt(void *buffer);
863
864 /*!
865  * \brief Acquire the buffer of a PD frame (Only for the buffer type)
866  * \details N/A
867  * \remarks N/A
868  * \param[in] handler Handler of a livebox instance
869  * \return int
870  * \retval NULL
871  * \retval adress of buffer of PD
872  * \pre N/A
873  * \post N/A
874  * \see livebox_release_pdfb
875  */
876 extern void *livebox_acquire_pdfb(struct livebox *handler);
877
878 /*!
879  * \brief Release the acquired buffer of the PD Frame (Only for the buffer type)
880  * \details N/A
881  * \remarks N/A
882  * \param[in] buffer
883  * \return int
884  * \retval LB_STATUS_ERROR_INVALID Invalid argument
885  * \retval LB_STATUS_SUCCESS Successfully done
886  * \pre N/A
887  * \post N/A
888  * \see livebox_acquire_pdfb
889  */
890 extern int livebox_release_pdfb(void *buffer);
891
892 /*!
893  * \brief Reference count of given PD buffer (Only for the buffer type)
894  * \details N/A
895  * \remarks N/A
896  * \param[in] buffer
897  * \return int
898  * \retval LB_STATUS_ERROR_INVALID Invalid argument
899  * \retval LB_STATUS_ERROR_FAULT Unrecoverable error occurred
900  * \retval reference count
901  * \pre N/A
902  * \post N/A
903  * \see livebox_fb_refcnt
904  */
905 extern int livebox_pdfb_refcnt(void *buffer);
906
907 /*!
908  * \brief Get the size of the Livebox
909  * \details N/A
910  * \remarks N/A
911  * \param[in] handler Handler of a livebox instance
912  * \return int
913  * \retval LB_SIZE_TYPE_NxM
914  * \retval LB_SIZE_TYPE_INVALID
915  * \pre N/A
916  * \post N/A
917  * \see N/A
918  */
919 extern int livebox_size(struct livebox *handler);
920
921 /*!
922  * \brief Get the size of the Progressive Disclosure
923  * \details N/A
924  * \remarks N/A
925  * \param[in] handler Handler of a livebox instance
926  * \param[out] w
927  * \param[out] h
928  * \return int
929  * \retval LB_STATUS_ERROR_INVALID Invalid argument
930  * \retval LB_STATUS_SUCCESS Successfully done
931  * \pre N/A
932  * \post N/A
933  * \see N/A
934  */
935 extern int livebox_get_pdsize(struct livebox *handler, int *w, int *h);
936
937 /*!
938  * \brief List of supported sizes of given handler
939  * \details N/A
940  * \remarks N/A
941  * \param[in] handler Handler of a livebox instance
942  * \param[out] cnt
943  * \param[out] size_list
944  * \return int
945  * \retval LB_STATUS_ERROR_INVALID Invalid argument
946  * \retval LB_STATUS_SUCCESS Successfully done
947  * \pre N/A
948  * \post N/A
949  * \see N/A
950  */
951 extern int livebox_get_supported_sizes(struct livebox *handler, int *cnt, int *size_list);
952
953 /*!
954  * \brief BUFFER SIZE of the livebox if it is a buffer type
955  * \details N/A
956  * \remarks N/A
957  * \param[in] handler Handler of a livebox instance
958  * \return int
959  * \retval LB_STATUS_ERROR_INVALID Invalid argument
960  * \retval size of livebox buffer
961  * \pre N/A
962  * \post N/A
963  * \see N/A
964  */
965 extern int livebox_lbfb_bufsz(struct livebox *handler);
966
967 /*!
968  * \brief BUFFER SIZE of the progiressive disclosure if it is a buffer type
969  * \details N/A
970  * \remarks N/A
971  * \param[in] handler Handler of a livebox instance
972  * \return int
973  * \retval LB_STATUS_ERROR_INVALID Invalid argument
974  * \retval size of PD buffer
975  * \pre N/A
976  * \post N/A
977  * \see N/A
978  */
979 extern int livebox_pdfb_bufsz(struct livebox *handler);
980
981 /*!
982  * \brief Send the content event (for buffer type) to provider(livebox)
983  * \details N/A
984  * \remarks DEPRECATED
985  *  Use the livebox_mouse_event function instead of this.
986  * \param[in] handler Handler of a livebox instance
987  * \param[in] type Event type
988  * \param[in] x coordinates of X axis
989  * \param[in] y coordinates of Y axis
990  * \return int
991  * \retval LB_STATUS_ERROR_INVALID Invalid argument
992  * \retval LB_STATUS_ERROR_BUSY Previous operaion is not finished yet
993  * \retval LB_STATUS_ERROR_FAULT Unrecoverable error occurred
994  * \retval LB_STATUS_SUCCESS Successfully sent
995  * \pre N/A
996  * \post N/A
997  * \see livebox_mouse_event
998  * \see livebox_access_event
999  * \see livebox_key_event
1000  */
1001 extern int livebox_content_event(struct livebox *handler, enum content_event_type type, double x, double y);
1002
1003 /*!
1004  * \brief Send the content event (for buffer type) to provider(livebox)
1005  * \details N/A
1006  * \remarks N/A
1007  * \param[in] handler Handler of a livebox instance
1008  * \param[in] type Event type
1009  * \param[in] x coordinates of X axis
1010  * \param[in] y coordinates of Y axis
1011  * \return int
1012  * \retval LB_STATUS_ERROR_INVALID Invalid argument
1013  * \retval LB_STATUS_ERROR_BUSY Previous operation is not finished yet
1014  * \retval LB_STATUS_ERROR_FAULT Unrecoverable error occurred
1015  * \retval LB_STATUS_SUCCESS Successfully sent
1016  * \pre N/A
1017  * \post N/A
1018  * \see livebox_content_event
1019  * \see livebox_access_event
1020  * \see livebox_key_event
1021  */
1022 extern int livebox_mouse_event(struct livebox *handler, enum content_event_type type, double x, double y);
1023
1024 /*!
1025  * \brief Send the access event(for buffer type) to provider(livebox).
1026  * \details N/A
1027  * \remarks N/A
1028  * \param[in] handler Handler of a livebox instance
1029  * \param[in] type Event type
1030  * \param[in] x coordinates of X axsis
1031  * \param[in] y coordinates of Y axsis
1032  * \param[in] cb Result callback function
1033  * \param[in] data Callback data
1034  * \return int
1035  * \retval LB_STATUS_ERROR_INVALID Invalid argument
1036  * \retval LB_STATUS_ERROR_BUSY Previous operation is not finished yet
1037  * \retval LB_STATUS_ERROR_FAULT Unrecoverable error occurred
1038  * \retval LB_STATUS_SUCCESS Successfully sent
1039  * \pre N/A
1040  * \post N/A
1041  * \see livebox_mouse_event
1042  * \see livebox_key_event
1043  */
1044 extern int livebox_access_event(struct livebox *handler, enum access_event_type type, double x, double y, ret_cb_t cb, void *data);
1045
1046 /*!
1047  * \brief Send the key event(for buffer type) to provider(livebox).
1048  * \details N/A
1049  * \remarks N/A
1050  * \param[in] handler Handler of a livebox instance
1051  * \param[in] type Key event type
1052  * \param[in] keycode Code of key
1053  * \param[in] cb Result callback
1054  * \param[in] data Callback data
1055  * \return int
1056  * \retval LB_STATUS_ERROR_INVALID Invalid argument
1057  * \retval LB_STATUS_ERROR_BUSY Previous operation is not finished yet
1058  * \retval LB_STATUS_ERROR_FAULT Unrecoverable error occurred
1059  * \retval LB_STATUS_SUCCESS Successfully sent
1060  * \pre N/A
1061  * \post N/A
1062  * \see livebox_mouse_event
1063  * \see livebox_access_event
1064  */
1065 extern int livebox_key_event(struct livebox *handler, enum content_event_type type, unsigned int keycode, ret_cb_t cb, void *data);
1066
1067 /*!
1068  * \brief Do pin up or not.
1069  * \details
1070  *   If the livebox supports the pinup feature,
1071  *   you can freeze the update of given livebox.
1072  *   But it is different with pause.
1073  *   The box will be updated and it will decide wheter update its content or not when the pinup is on.
1074  * \remarks N/A
1075  * \param[in] handler Handler of a livebox instance
1076  * \param[in] flag Pinup value
1077  * \param[in] cb Result callback
1078  * \param[in] data Callback data
1079  * \return int
1080  * \retval LB_STATUS_ERROR_INVALID Invalid parameters
1081  * \see ret_cb_t
1082  * \see livebox_set_visibility
1083  * \see livebox_is_pinned_up
1084  */
1085 extern int livebox_set_pinup(struct livebox *handler, int flag, ret_cb_t cb, void *data);
1086
1087 /*!
1088  * \brief Check the PIN-UP status of given handler
1089  * \details N/A
1090  * \remarks N/A
1091  * \param[in] handler Handler of a livebox instance
1092  * \return int
1093  * \retval LB_STATUS_ERROR_INVALID Invalid parameters
1094  * \retval 1 box is pinned up
1095  * \retval 0 box is not pinned up
1096  * \see livebox_set_pinup
1097  */
1098 extern int livebox_is_pinned_up(struct livebox *handler);
1099
1100 /*!
1101  * \brief Check the PINUP feature availability of the given handler
1102  * \details N/A
1103  * \remarks N/A
1104  * \param[in] handler Handler of a livebox instance
1105  * \return int
1106  * \retval LB_STATUS_ERROR_INVALID Invalid argument
1107  * \retval 1 if the box support Pinup feature
1108  * \retval 0 if the box does not support the Pinup feature
1109  * \pre N/A
1110  * \post N/A
1111  * \see livebox_is_pinned_up
1112  * \see livebox_set_pinup
1113  */
1114 extern int livebox_has_pinup(struct livebox *handler);
1115
1116 /*!
1117  * \brief Check the PD existence of given handler
1118  * \details N/A
1119  * \remarks N/A
1120  * \param[in] handler Handler of a livebox instance
1121  * \return int
1122  * \retval LB_STATUS_ERROR_INVALID Invalid argument
1123  * \retval 1 if the box support the PD
1124  * \retval 0 if the box has no PD
1125  * \pre N/A
1126  * \post N/A
1127  * \see N/A
1128  */
1129 extern int livebox_has_pd(struct livebox *handler);
1130
1131 /*!
1132  * \brief Create the PD of given handler
1133  * \details N/A
1134  * \remarks N/A
1135  * \param[in] handler Handler of a livebox instance
1136  * \param[in] cb Result callback
1137  * \param[in] data Callback data
1138  * \return int
1139  * \retval LB_STATUS_SUCCESS Successfully done
1140  * \retval LB_STATUS_ERROR_INVALID Invalid argument
1141  * \retval LB_STATUS_ERROR_BUSY Previous operation is not finished yet
1142  * \retval LB_STATUS_ERROR_FAULT Unrecoverable error occurred
1143  * \pre N/A
1144  * \post N/A
1145  * \see ret_cb_t
1146  * \see livebox_create_pd_with_position
1147  * \see livebox_move_pd
1148  * \see livebox_destroy_pd
1149  */
1150 extern int livebox_create_pd(struct livebox *handler, ret_cb_t cb, void *data);
1151
1152 /*!
1153  * \brief Create the PD of given handler with the relative position from livebox
1154  * \details N/A
1155  * \remarks N/A
1156  * \param[in] handler Handler of a livebox instance
1157  * \param[in] x 0.0 ~ 1.0
1158  * \param[in] y 0.0 ~ 1.0
1159  * \param[in] cb Result callback
1160  * \param[in] data Callback data
1161  * \return int
1162  * \retval LB_STATUS_SUCCESS Successfully done
1163  * \retval LB_STATUS_ERROR_INVALID Invalid argument
1164  * \retval LB_STATUS_ERROR_BUSY Previous operation is not finished yet
1165  * \retval LB_STATUS_ERROR_FAULT Unrecoverable error occurred
1166  * \pre N/A
1167  * \post N/A
1168  * \see livebox_create_pd
1169  * \see livebox_destroy_pd
1170  * \see livebox_move_pd
1171  */
1172 extern int livebox_create_pd_with_position(struct livebox *handler, double x, double y, ret_cb_t cb, void *data);
1173
1174 /*!
1175  * \brief PD position is updated.
1176  * \details N/A
1177  * \remarks N/A
1178  * \param[in] handler Handler of a livebox instance
1179  * \param[in] x 0.0 ~ 1.0
1180  * \param[in] y 0.0 ~ 1.0
1181  * \return int
1182  * \retval LB_STATUS_SUCCESS if succeed to send request for updating position of the PD.
1183  * \retval LB_STATUS_ERROR_FAULT Unrecoverable error occurred
1184  * \retval LB_STATUS_ERROR_INVALID Invalid argument
1185  * \pre N/A
1186  * \post N/A
1187  * \see N/A
1188  */
1189 extern int livebox_move_pd(struct livebox *handler, double x, double y);
1190
1191 /*!
1192  * \brief Destroy the PD of given handler if it is created.
1193  * \details N/A
1194  * \remarks N/A
1195  * \param[in] handler Handler of a livebox instance
1196  * \param[in] cb
1197  * \param[in] data
1198  * \return int
1199  * \retval LB_STATUS_ERROR_INVALID Invalid argument
1200  * \retval LB_STATUS_ERROR_FAULT Unrecoverable error occurred
1201  * \retval LB_STATUS_SUCCESS Successfully done
1202  * \pre N/A
1203  * \post N/A
1204  * \see ret_cb_t
1205  */
1206 extern int livebox_destroy_pd(struct livebox *handler, ret_cb_t cb, void *data);
1207
1208 /*!
1209  * \brief Check the create status of given livebox handler
1210  * \details N/A
1211  * \remarks N/A
1212  * \param[in] handler Handler of a livebox instance
1213  * \return int
1214  * \retval LB_STATUS_ERROR_INVALID Invalid argument
1215  * \retval 0 PD is not created
1216  * \retval 1 PD is created
1217  */
1218 extern int livebox_pd_is_created(struct livebox *handler);
1219
1220 /*!
1221  * \brief Check the content type of the progressive disclosure of given handler
1222  * \details N/A
1223  * \remarks N/A
1224  * \param[in] handler Handler of a livebox instance
1225  * \return int
1226  * \retval PD_TYPE_BUFFER Contents of a PD is based on canvas buffer(shared)
1227  * \retval PD_TYPE_TEXT Contents of a PD is based on formatted text file
1228  * \retval PD_TYPE_PIXMAP Contents of a livebox is shared by the pixmap(depends on X)
1229  * \retval PD_TYPE_INVALID
1230  * \pre N/A
1231  * \post N/A
1232  * \see livebox_pd_type
1233  */
1234 extern enum livebox_pd_type livebox_pd_type(struct livebox *handler);
1235
1236 /*!
1237  * \brief Check the existence of a livebox about given package name
1238  * \details N/A
1239  * \remarks N/A
1240  * \param[in] pkgname
1241  * \return int
1242  * \retval 1 if the box is exists
1243  * \retval 0 if the box is not exists
1244  * \pre N/A
1245  * \post N/A
1246  * \see N/A
1247  */
1248 extern int livebox_is_exists(const char *pkgname);
1249
1250 /*!
1251  * \brief Set function table for parsing the text content of a livebox
1252  * \details N/A
1253  * \remarks N/A
1254  * \param[in] handler Handler of a livebox instance
1255  * \param[in] ops
1256  * \return int
1257  * \retval LB_STATUS_SUCCESS Successfully done
1258  * \retval LB_STATUS_ERROR_INVALID Invalid argument
1259  * \see livebox_set_pd_text_handler
1260  */
1261 extern int livebox_set_text_handler(struct livebox *handler, struct livebox_script_operators *ops);
1262
1263 /*!
1264  * \brief Set function table for parsing the text content of a Progressive Disclosure
1265  * \details N/A
1266  * \remarks N/A
1267  * \param[in] handler Handler of a livebox instance
1268  * \param[in] ops
1269  * \return int
1270  * \retval LB_STATUS_SUCCESS Successfully done
1271  * \retval LB_STATUS_ERROR_INVALID Invalid argument
1272  * \see livebox_set_text_handler
1273  */
1274 extern int livebox_set_pd_text_handler(struct livebox *handler, struct livebox_script_operators *ops);
1275
1276 /*!
1277  * \brief Emit a text signal to given livebox only if it is a text type.
1278  * \details N/A
1279  * \remarks N/A
1280  * \param[in] handler Handler of a livebox instance
1281  * \param[in] emission Emission string
1282  * \param[in] source Source string
1283  * \param[in] sx start X
1284  * \param[in] sy start Y
1285  * \param[in] ex end X
1286  * \param[in] ey end Y
1287  * \param[in] cb Result callback
1288  * \param[in] data Callback data
1289  * \return int
1290  * \retval LB_STATUS_ERROR_INVALID Invalid parameters
1291  * \retval LB_STATUS_ERROR_FAULT Unrecoverable error occurred
1292  * \retval LB_STATUS_SUCCESS Successfully emitted
1293  * \see ret_cb_t
1294  */
1295 extern int livebox_emit_text_signal(struct livebox *handler, const char *emission, const char *source, double sx, double sy, double ex, double ey, ret_cb_t cb, void *data);
1296
1297 /*!
1298  * \brief Set a private data pointer to carry it using given handler
1299  * \details N/A
1300  * \remarks N/A
1301  * \param[in] handler Handler of a livebox instance
1302  * \param[in] data data pointer
1303  * \return int
1304  * \retval LB_STATUS_SUCCESS Successfully registered
1305  * \retval LB_STATUS_ERROR_INVALID Invalid argument
1306  * \pre N/A
1307  * \post N/A
1308  * \see livebox_get_data
1309  */
1310 extern int livebox_set_data(struct livebox *handler, void *data);
1311
1312 /*!
1313  * \brief Get private data pointer which is carried by given handler
1314  * \details N/A
1315  * \remarks N/A
1316  * \param[in] handler Handler of a livebox instance
1317  * \return void *
1318  * \retval data pointer
1319  * \retval NULL if there is not data
1320  * \pre N/A
1321  * \post N/A
1322  * \see livebox_set_data
1323  */
1324 extern void *livebox_get_data(struct livebox *handler);
1325
1326 /*!
1327  * \brief Subscribe the event for liveboxes only in given cluster and sub-cluster
1328  * \details
1329  *   If you wrote a view-only client.
1330  *   you can receive the event of specific liveboxes which are grouped in given cluster/category
1331  *   But you cannot modify their attributes (such as size, ...).
1332  * \remarks N/A
1333  * \param[in] cluster   "*" can be used for subscribe all cluster's liveboxes event.
1334  *                      If you use the "*", value in the category will be ignored.
1335  * \param[in] category  "*" can be used for subscribe liveboxes events of all category(sub-cluster) in given "cluster"
1336  * \return int
1337  * \retval LB_STATUS_ERROR_FAULT Unrecoverable error occurred
1338  * \retval LB_STATUS_SUCCESS Successfully requested
1339  * \pre N/A
1340  * \post N/A
1341  * \see livebox_unsubscribe_group
1342  */
1343 extern int livebox_subscribe_group(const char *cluster, const char *category);
1344
1345 /*!
1346  * \brief Unsubscribe the event for the liveboxes, but you will receive already added liveboxes event.
1347  * \details N/A
1348  * \remarks N/A
1349  * \param[in] cluster   "*" can be used for subscribe all cluster's liveboxes event.
1350  *                      If you use the "*", value in the category will be ignored.
1351  * \param[in] category  "*" can be used for subscribe all sub-cluster's liveboxes event in given "cluster"
1352  * \return int
1353  * \retval LB_STATUS_ERROR_FAULT Unrecoverable error occurred
1354  * \retval LB_STATUS_SUCCESS Successfully requested
1355  * \pre N/A
1356  * \post N/A
1357  * \see livebox_subscribe_group
1358  */
1359 extern int livebox_unsubscribe_group(const char *cluster, const char *category);
1360
1361 /*!
1362  * \brief Refresh the group(cluster/sub-cluser(aka. category))
1363  * \details
1364  *    This function will trigger the update of all liveboxes in given cluster/category group
1365  * \remarks
1366  *    Basically default livebox system doesn't use the cluster/category concept.
1367  *    But you can use it. so if you decide to use it then you can trigger the update of all liveboxes in given group.
1368  * \param[in] cluster Cluster ID
1369  * \param[in] category Sub-cluster ID
1370  * \param[in] force 1 if the boxes should be updated even if they are paused
1371  * \return int
1372  * \retval LB_STATUS_ERROR_INVALID Invalid argument
1373  * \retval LB_STATUS_ERROR_FAULT Unrecoverable error occurred
1374  * \retval LB_STATUS_SUCCESS Successfully requested
1375  * \pre N/A
1376  * \post N/A
1377  * \see livebox_refresh
1378  */
1379 extern int livebox_refresh_group(const char *cluster, const char *category, int force);
1380
1381 /*!
1382  * \brief Refresh a livebox
1383  * \details N/A
1384  * \remarks N/A
1385  * \param[in] handler Handler of a livebox instance
1386  * \param[in] force 1 if the box should be updated even if it is paused
1387  * \return int
1388  * \retval LB_STATUS_ERROR_INVALID Invalid argument
1389  * \retval LB_STATUS_ERROR_FAULT Unrecoverable error occurred
1390  * \retval LB_STATUS_SUCCESS Successfully requested
1391  * \pre N/A
1392  * \post N/A
1393  * \see livebox_refresh_group
1394  */
1395 extern int livebox_refresh(struct livebox *handler, int force);
1396
1397 /*!
1398  * \brief Pixmap Id of a livebox content
1399  * \details
1400  *   This function doesn't guarantees the life-cycle of the pixmap.
1401  *   If the service provider destroy the pixmap, you will not know about it.
1402  *   So you should validate it before access it.
1403  * \remarks N/A
1404  * \param[in] handler Handler of a livebox instance
1405  * \return int
1406  * \retval 0 if the pixmap is not created
1407  * \retval pixmap Pixmap Id need to be casted to (unsigned int) type
1408  * \pre N/A
1409  * \post N/A
1410  * \see livebox_pd_pixmap
1411  */
1412 extern int livebox_lb_pixmap(const struct livebox *handler);
1413
1414 /*!
1415  * \brief Pixmap Id of a PD content
1416  * \details
1417  *   This function doesn't guarantees the life-cycle of the pixmap.
1418  *   If the service provider destroy the pixmap, you will not know about it.
1419  *   So you should validate it before access it.
1420  * \remarks N/A
1421  * \param[in] handler Handler of a livebox instance
1422  * \return int
1423  * \retval 0 if the pixmap is not created
1424  * \retval pixmap Pixmap Id need to be casted to (unsigned int) type
1425  * \pre N/A
1426  * \post N/A
1427  * \see livebox_lb_pixmap
1428  */
1429 extern int livebox_pd_pixmap(const struct livebox *handler);
1430
1431 /*!
1432  * \brief Acquire the pixmap of PD
1433  * \details
1434  *   After acquire the pixmap of PD, it will not be destroyed
1435  *   So if the new update is comming with new pixmap Id, you should release old pixmap manually
1436  * \remarks N/A
1437  * \param[in] handler Handler of a livebox instance.
1438  * \param[in] cb Result callback for acquiring request
1439  * \param[in] data Callback Data
1440  * \return int
1441  * \retval LB_STATUS_ERROR_INVALID Invalid argument
1442  * \retval LB_STATUS_ERROR_FAULT Failed to send a request to the service provider or there is critical error that is unrecoverable
1443  * \retval LB_STATUS_SUCCESS Successfully requested to acquire the pixmap of PD
1444  * \pre N/A
1445  * \post N/A
1446  * \see livebox_release_pd_pixmap
1447  * \see livebox_acquire_lb_pixmap
1448  * \see ret_cb_t
1449  */
1450 extern int livebox_acquire_pd_pixmap(struct livebox *handler, ret_cb_t cb, void *data);
1451
1452 /*!
1453  * \brief Release the acquired pixmap ID
1454  * \details N/A
1455  * \remarks N/A
1456  * \param[in] handler Handler of a livebox instance, This can be NULL, only if the handler is deleted.
1457  * \param[in] pixmap Pixmap Id to release it
1458  * \return int
1459  * \retval LB_STATUS_ERROR_INVALID Invalid argument
1460  * \retval LB_STATUS_ERROR_FAULT Unrecoverable error occurred
1461  * \retval LB_STATUS_SUCCESS Successfully released (request is sent)
1462  * \pre N/A
1463  * \post N/A
1464  * \see livebox_acquire_pd_pixmap
1465  * \see livebox_release_lb_pixmap
1466  */
1467 extern int livebox_release_pd_pixmap(struct livebox *handler, int pixmap);
1468
1469 /*!
1470  * \brief Getting the PIXMAP of a livebox
1471  * \details
1472  *   Even if the render process release the pixmap, the pixmap will be kept before released by livebox_release_lb_pixmap
1473  *   You should release the pixmap manually.
1474  * \remarks N/A
1475  * \param[in] handler Handler of a livebox instance
1476  * \param[in] cb Callback function which will be called with result of acquiring lb pixmap
1477  * \param[in] data Callback data
1478  * \return int
1479  * \retval LB_STATUS_ERROR_INVALID Invalid argument
1480  * \retval LB_STATUS_ERROR_FAULT Unrecoverable error occurred
1481  * \retval LB_STATUS_SUCCESS Successfully requested
1482  * \pre
1483  *   Livebox service system should support the PIXMAP type buffer.
1484  *   The livebox should be designed to use the buffer (script type)
1485  * \post N/A
1486  * \see livebox_release_lb_pixmap
1487  * \see livebox_acquire_pd_pixmap
1488  * \see ret_cb_t
1489  */
1490 extern int livebox_acquire_lb_pixmap(struct livebox *handler, ret_cb_t cb, void *data);
1491
1492 /*!
1493  * \brief Release the pixmap of a livebox
1494  * \details
1495  *   After the client gets new pixmap or no more need to keep current pixmap, use this to release it.
1496  *   If there is no user for given pixmap, the pixmap will be destroyed.
1497  * \remarks N/A
1498  * \param[in] handler Handler of a livebox instance, This can be NULL, only if the handler is deleted.
1499  * \param[in] pixmap Pixmap Id of given livebox handler
1500  * \return int
1501  * \retval LB_STATUS_ERROR_INVALID Invalid argument
1502  * \retval LB_STATUS_ERROR_FAULT Unrecoverable error occurred
1503  * \retval LB_STATUS_SUCCESS Successfully done
1504  * \pre
1505  *   The pixmap should be acquired by livebox_acquire_lb_pixmap
1506  * \post N/A
1507  * \see livebox_acquire_lb_pixmap
1508  * \see livebox_release_pd_pixmap
1509  */
1510 extern int livebox_release_lb_pixmap(struct livebox *handler, int pixmap);
1511
1512 /*!
1513  * \brief Update the visible state of a livebox
1514  * \details N/A
1515  * \remarks N/A
1516  * \param[in] handler Handler of a livebox instance
1517  * \param[in] state Configure the current visible state of a livebox
1518  * \return int
1519  * \retval LB_STATUS_ERROR_INVALID Invalid argument
1520  * \retval LB_STATUS_ERROR_BUSY
1521  * \retval LB_STATUS_ERROR_PERMISSION
1522  * \retval LB_STATUS_ERROR_ALREADY
1523  * \retval LB_STATUS_ERROR_FAULT Unrecoverable error occurred
1524  * \retval LB_STATUS_SUCCESS Successfully done
1525  * \pre N/A
1526  * \post N/A
1527  * \see N/A
1528  */
1529 extern int livebox_set_visibility(struct livebox *handler, enum livebox_visible_state state);
1530
1531 /*!
1532  * \brief Current visible state of a livebox
1533  * \details N/A
1534  * \remarks N/A
1535  * \param[in] handler Handler of a livebox instance
1536  * \return livebox_visible_state
1537  * \retval LB_SHOW Livebox is showed. Default state
1538  * \retval LB_HIDE Livebox is hide, Update timer is not be freezed. but you cannot receive any updates events. you should refresh(reload) the content of a livebox when you make this show again
1539  * \retval LB_HIDE_WITH_PAUSE Livebix is hide, it will paused the update timer, but if a livebox update its contents, update event will come to you
1540  * \retval LB_VISIBLE_ERROR To enlarge the size of this enumeration type
1541  * \pre N/A
1542  * \post N/A
1543  * \see N/A
1544  */
1545 extern enum livebox_visible_state livebox_visibility(struct livebox *handler);
1546
1547 /*!
1548  * \brief Set the update mode of current livebox
1549  * \details N/A
1550  * \remarks N/A
1551  *        if you set 1 for active update mode, you should get buffer without updated event from provider.
1552  *        But is passive mode, you have to update content of a box when you get updated event.
1553  *        Default is Passive mode.
1554  * \param[in] handler Handler of a livebox instance
1555  * \param[in] active_update 1 means active update, 0 means passive update (default)
1556  * \param[in] cb Result callback function
1557  * \param[in] data Callback data
1558  * \return int
1559  * \retval LB_STATUS_ERROR_INVALID Invalid argument
1560  * \retval LB_STATUS_ERROR_BUSY
1561  * \retval LB_STATUS_ERROR_PERMISSION
1562  * \retval LB_STATUS_ERROR_ALREADY
1563  * \retval LB_STATUS_ERROR_FAULT Unrecoverable error occurred
1564  * \retval LB_STATUS_SUCCESS Successfully done
1565  * \pre N/A
1566  * \post N/A
1567  * \see ret_cb_t
1568  */
1569 extern int livebox_set_update_mode(struct livebox *handler, int active_update, ret_cb_t cb, void *data);
1570
1571 /*!
1572  * \brief Is this box in the active update mode?
1573  * \details N/A
1574  * \remarks N/A
1575  * \param[in] handler Handler of a livebox instance
1576  * \return int
1577  * \retval 0 if passive mode
1578  * \retval 1 if active mode or error code
1579  * \pre N/A
1580  * \post N/A
1581  * \see N/A
1582  */
1583 extern int livebox_is_active_update(struct livebox *handler);
1584
1585 /*!
1586  * \brief Sync manually
1587  * \details N/A
1588  * \remarks N/A
1589  * param[in] handler Handler of a livebox instance
1590  * \return void
1591  * \retval LB_STATUS_SUCCESS If success
1592  * \retval LB_STATUS_ERROR_INVALID Invalid handle
1593  * \pre N/A
1594  * \post N/A
1595  * \see livebox_set_manual_sync
1596  * \see livebox_manual_sync
1597  * \see livebox_sync_lb_fb
1598  */
1599 extern int livebox_sync_pd_fb(struct livebox *handler);
1600
1601 /*!
1602  * \brief Sync manually
1603  * \details N/A
1604  * \remarks N/A
1605  * \param[in] handler Handler of a livebox instance
1606  * \return void
1607  * \retval LB_STATUS_SUCCESS If success
1608  * \retval LB_STATUS_ERROR_INVALID Invalid handle
1609  * \pre N/A
1610  * \post N/A
1611  * \see livebox_set_manual_sync
1612  * \see livebox_manual_sync
1613  * \see livebox_sync_pd_fb
1614  */
1615 extern int livebox_sync_lb_fb(struct livebox *handler);
1616
1617 /*!
1618  * \brief Getting the alternative icon of given livebox instance.
1619  * \details If the box should be represented as a shortcut icon, this function will get the alternative icon.
1620  * \remarks N/A
1621  * \param[in] handler Handler of a livebox instance
1622  * \return const char *
1623  * \retval address Absolute path of an alternative icon file
1624  * \retval NULL Livebox has no alternative icon file
1625  * \pre N/A
1626  * \post N/A
1627  * \see livebox_alt_name
1628  */
1629 extern const char *livebox_alt_icon(struct livebox *handler);
1630
1631 /*!
1632  * \brief Getting the alternative name of given livebox instance.
1633  * \details If the box should be represented as a shortcut name, this function will get the alternative name.
1634  * \remarks N/A
1635  * \param[in] handler Handler of a livebox instance
1636  * \return const char *
1637  * \retval name Alternative name of a livebox
1638  * \retval NULL Livebox has no alternative name
1639  * \pre N/A
1640  * \post N/A
1641  * \see livebox_alt_icon
1642  */
1643 extern const char *livebox_alt_name(struct livebox *handler);
1644
1645 /*!
1646  * \brief Get the lock for frame buffer.
1647  * \details
1648  *   This function should be used to prevent from rendering to the frame buffer while reading it.
1649  *   And the locking area should be short and must be released ASAP
1650  *   Or the render thread will be hang'd.
1651  * \remarks
1652  * \param[in] handler Handler of a livebox instance
1653  * \param[in] is_pd 1 for PD or 0
1654  * \return int
1655  * \retval LB_STATUS_ERROR_FAULT Unrecoverable error occurred
1656  * \retval LB_STATUS_ERROR_INVALID Invalid argument
1657  * \retval LB_STATUS_SUCCESS Successfully done
1658  * \pre N/A
1659  * \post N/A
1660  * \see livebox_release_fb_lock
1661  */
1662 extern int livebox_acquire_fb_lock(struct livebox *handler, int is_pd);
1663
1664 /*!
1665  * \brief Release the lock of frame buffer
1666  * \details
1667  *   This function should be called ASAP after acquire a lock of FB.
1668  *   Or the render process will be blocked.
1669  * \remarks N/A
1670  * \param[in] handler Handler of a livebox instance
1671  * \param[in] is_pd 1 for PD or 0
1672  * \return int
1673  * \retval LB_STATUS_ERROR_FAULT Unrecoverable error occurred
1674  * \retval LB_STATUS_ERROR_INVALID Invalid argument
1675  * \retval LB_STATUS_SUCCESS Successfully done
1676  * \pre N/A
1677  * \post N/A
1678  * \see livebox_acquire_fb_lock
1679  */
1680 extern int livebox_release_fb_lock(struct livebox *handler, int is_pd);
1681
1682 /*!
1683  * \brief Set options for controlling livebox sub-system.
1684  * \details
1685  *   LB_OPTION_FRAME_DROP_FOR_RESIZE
1686  *     While resizing the box, viewer doesn't want to know the updated frames of old size content anymore,
1687  *     In that case, turn this on, the provider will not send the updated event to the viewer about old content.
1688  *     So the viewer can reduce its burden to update unnecessary frames
1689  *   LB_OPTION_MANUAL_SYNC
1690  *     If you don't want updates frame automatically,
1691  *     Only you want reload the frames by your hands,(manually)
1692  *     Turn it on.
1693  *     After turnned it on, you should sync it using
1694  *       livebox_sync_pd_fb
1695  *       livebox_sync_lb_pfb
1696  *   LB_OPTION_SHARED_CONTENT
1697  *     If this option is turnned on, even though you create a new livebox,
1698  *     If there are already added same instance has same content, the instance will not be created again
1699  *     Instead of creating a new instance, viewer will provides old instance with new handle.
1700  * \remarks N/A
1701  * \param[in] option option which will be affected by this call
1702  * \param[in] state new value for given option
1703  * \return int
1704  * \retval LB_STATUS_ERROR_INVALID Unknown option
1705  * \retval LB_STATUS_ERROR_FAULT Failed to change the state of option
1706  * \retval LB_STATUS_SUCCESS Successfully changed
1707  * \pre N/A
1708  * \post N/A
1709  * \see livebox_get_option
1710  * \see livebox_sync_pd_fb
1711  * \see livebox_sync_lb_fb
1712  */
1713 extern int livebox_set_option(enum livebox_option_type option, int state);
1714
1715 /*!
1716  * \brief Get options livebox sub-system
1717  * \details N/A
1718  * \remarks N/A
1719  * \param[in] option type of option
1720  * \return int
1721  * \retval LB_STATUS_ERROR_INVALID invalid option
1722  * \retval LB_STATUS_ERROR_FAULT Failed to get option
1723  * \retval >=0 Value of given option. must has to be >=0
1724  * \pre N/A
1725  * \post N/A
1726  * \see livebox_set_option
1727  */
1728 extern int livebox_option(enum livebox_option_type option);
1729
1730
1731 /*!
1732  * \brief Set a handler for launching an app for auto-launch feature
1733  * \details If a user clicks a box, and the box uses auto-launch option, the launcher_handler will be called.
1734  * \remarks N/A
1735  * \param[in] launch_handler Handler for launching an app manually
1736  * \param[in] data Callback data which will be given a data for launch_handler
1737  * \return int
1738  * \retval
1739  * \pre N/A
1740  * \post N/A
1741  * \see N/A
1742  */
1743 extern int livebox_set_auto_launch_handler(int (*launch_handler)(struct livebox *handler, const char *appid, void *data), void *data);
1744
1745 /*!
1746  * \}
1747  */
1748
1749 #ifdef __cplusplus
1750 }
1751 #endif
1752
1753 #endif