tizen 2.3 release
[apps/livebox/livebox-viewer.git] / livebox-viewer / src / livebox.c
1 #include <stdio.h>
2
3 #include <livebox-service.h>
4 #include <livebox-errno.h>
5
6 #include "livebox.h"
7
8 #define EAPI __attribute__((visibility("default")))
9
10 enum lb_type { /*!< Must have to be sync with data-provider-master */
11         _LB_TYPE_NONE = 0x0,
12         _LB_TYPE_SCRIPT,
13         _LB_TYPE_FILE,
14         _LB_TYPE_TEXT,
15         _LB_TYPE_BUFFER,
16         _LB_TYPE_ELEMENTARY
17 };
18
19 enum pd_type { /*!< Must have to be sync with data-provider-master */
20         _PD_TYPE_NONE = 0x0,
21         _PD_TYPE_SCRIPT,
22         _PD_TYPE_TEXT,
23         _PD_TYPE_BUFFER,
24         _PD_TYPE_ELEMENTARY
25 };
26
27 enum livebox_state {
28         CREATE = 0xBEEFbeef,
29         DELETE = 0xDEADdead, /* Delete only for this client */
30         DESTROYED = 0x00DEAD00
31 };
32
33 struct livebox_common {
34         enum livebox_state state;
35
36         struct dlist *livebox_list;
37         int refcnt;
38
39         char *cluster;
40         char *category;
41
42         char *pkgname;
43         char *id;
44
45         char *content;
46         char *title;
47         char *filename;
48
49         double timestamp;
50
51         struct alt_info {
52                 char *icon;
53                 char *name;
54         } alt;
55
56         enum livebox_delete_type delete_type;
57
58         int is_user;
59         int is_pd_created;
60         int is_pinned_up;
61         int is_active_update;
62         enum livebox_visible_state visible;
63
64         struct {
65                 enum lb_type type;
66                 struct fb_info *fb;
67
68                 int size_list;
69
70                 int width;
71                 int height;
72                 double priority;
73
74                 char *auto_launch;
75                 double period;
76                 int pinup_supported;
77                 int mouse_event;
78
79                 /* For the filtering event */
80                 double x;
81                 double y;
82                 char *lock;
83                 int lock_fd;
84         } lb;
85
86         struct {
87                 enum pd_type type;
88                 struct fb_info *fb;
89
90                 int width;
91                 int height;
92
93                 int default_width;
94                 int default_height;
95
96                 /* For the filtering event */
97                 double x;
98                 double y;
99                 char *lock;
100                 int lock_fd;
101         } pd;
102
103         int nr_of_sizes;
104
105         struct requested_flag {
106                 unsigned int created:1;
107                 unsigned int deleted:1;
108                 unsigned int pinup:1;
109                 unsigned int group_changed:1;
110                 unsigned int period_changed:1;
111                 unsigned int size_changed:1;
112                 unsigned int pd_created:1;
113                 unsigned int pd_destroyed:1;
114                 unsigned int update_mode:1;
115                 unsigned int access_event:1;
116                 unsigned int key_event:1;
117
118                 /*!
119                  * \note
120                  * Reserved
121                  */
122                 unsigned int reserved:21;
123         } request;
124 };
125
126 struct job_item {
127         struct livebox *handle;
128         ret_cb_t cb;
129         int ret;
130         void *data;
131 };
132
133 struct livebox {
134         enum livebox_state state;
135
136         int refcnt;
137         int paused_updating;
138
139         enum livebox_visible_state visible;
140         struct livebox_common *common;
141
142         void *data;
143
144         struct callback_table {
145                 struct livebox_script_operators lb_ops;
146                 struct livebox_script_operators pd_ops;
147
148                 struct created {
149                         ret_cb_t cb;
150                         void *data;
151                 } created;
152
153                 struct deleted {
154                         ret_cb_t cb;
155                         void *data;
156                 } deleted;
157
158                 struct pinup {
159                         ret_cb_t cb;
160                         void *data;
161                 } pinup;
162
163                 struct group_changed {
164                         ret_cb_t cb;
165                         void *data;
166                 } group_changed;
167
168                 struct period_changed {
169                         ret_cb_t cb;
170                         void *data;
171                 } period_changed;
172
173                 struct size_changed {
174                         ret_cb_t cb;
175                         void *data;
176                 } size_changed;
177
178                 struct pd_created {
179                         ret_cb_t cb;
180                         void *data;
181                 } pd_created;
182
183                 struct pd_destroyed {
184                         ret_cb_t cb;
185                         void *data;
186                 } pd_destroyed;
187
188                 struct update_mode {
189                         ret_cb_t cb;
190                         void *data;
191                 } update_mode;
192
193                 struct access_event {
194                         ret_cb_t cb;
195                         void *data;
196                 } access_event;
197
198                 struct key_event {
199                         ret_cb_t cb;
200                         void *data;
201                 } key_event;
202         } cbs;
203 };
204
205 EAPI int livebox_init(void *disp)
206 {
207     return LB_STATUS_ERROR_NOT_IMPLEMENTED;
208 }
209
210 EAPI int livebox_init_with_options(void *disp, int prevent_overwrite, double event_filter, int use_thread)
211 {
212     return LB_STATUS_ERROR_NOT_IMPLEMENTED;
213 }
214
215 EAPI int livebox_fini(void)
216 {
217     return LB_STATUS_ERROR_NOT_IMPLEMENTED;
218 }
219
220 EAPI int livebox_client_paused(void)
221 {
222     return LB_STATUS_ERROR_NOT_IMPLEMENTED;
223 }
224
225 EAPI int livebox_client_resumed(void)
226 {
227     return LB_STATUS_ERROR_NOT_IMPLEMENTED;
228 }
229
230 EAPI struct livebox *livebox_add(const char *pkgname, const char *content, const char *cluster, const char *category, double period, int type, ret_cb_t cb, void *data)
231 {
232     return NULL;
233 }
234
235 EAPI int livebox_del(struct livebox *handler, int type, ret_cb_t cb, void *data)
236 {
237     return LB_STATUS_ERROR_NOT_IMPLEMENTED;
238 }
239
240 EAPI int livebox_set_event_handler(int (*cb)(struct livebox *handler, enum livebox_event_type event, void *data), void *data)
241 {
242     return LB_STATUS_ERROR_NOT_IMPLEMENTED;
243 }
244
245 EAPI void *livebox_unset_event_handler(int (*cb)(struct livebox *handler, enum livebox_event_type event, void *data))
246 {
247     return NULL;
248 }
249
250 EAPI int livebox_set_fault_handler(int (*cb)(enum livebox_fault_type, const char *, const char *, const char *, void *), void *data)
251 {
252     return LB_STATUS_ERROR_NOT_IMPLEMENTED;
253 }
254
255 EAPI void *livebox_unset_fault_handler(int (*cb)(enum livebox_fault_type, const char *, const char *, const char *, void *))
256 {
257     return NULL;
258 }
259
260 EAPI int livebox_activate(const char *pkgname, ret_cb_t cb, void *data)
261 {
262     return LB_STATUS_ERROR_NOT_IMPLEMENTED;
263 }
264
265 EAPI int livebox_resize(struct livebox *handler, int type, ret_cb_t cb, void *data)
266 {
267     return LB_STATUS_ERROR_NOT_IMPLEMENTED;
268 }
269
270 EAPI int livebox_click(struct livebox *handler, double x, double y)
271 {
272     return LB_STATUS_ERROR_NOT_IMPLEMENTED;
273 }
274
275 EAPI int livebox_set_group(struct livebox *handler, const char *cluster, const char *category, ret_cb_t cb, void *data)
276 {
277     return LB_STATUS_ERROR_NOT_IMPLEMENTED;
278 }
279
280 EAPI int livebox_get_group(struct livebox *handler, const char **cluster, const char **category)
281 {
282     return LB_STATUS_ERROR_NOT_IMPLEMENTED;
283 }
284
285 EAPI double livebox_period(struct livebox *handler)
286 {
287     return 0.0f;
288 }
289
290 EAPI int livebox_set_period(struct livebox *handler, double period, ret_cb_t cb, void *data)
291 {
292     return LB_STATUS_ERROR_NOT_IMPLEMENTED;
293 }
294
295 EAPI enum livebox_lb_type livebox_lb_type(struct livebox *handler)
296 {
297     return LB_TYPE_INVALID;
298 }
299
300 EAPI int livebox_is_user(struct livebox *handler)
301 {
302     return LB_STATUS_ERROR_NOT_IMPLEMENTED;
303 }
304
305 EAPI const char *livebox_content(struct livebox *handler)
306 {
307     return NULL;
308 }
309
310 EAPI const char *livebox_category_title(struct livebox *handler)
311 {
312     return NULL;
313 }
314
315 EAPI const char *livebox_filename(struct livebox *handler)
316 {
317     return NULL;
318 }
319
320 EAPI const char *livebox_pkgname(struct livebox *handler)
321 {
322     return NULL;
323 }
324
325 EAPI double livebox_priority(struct livebox *handler)
326 {
327     return 0.0f;
328 }
329
330 EAPI void *livebox_acquire_fb(struct livebox *handler)
331 {
332     return NULL;
333 }
334
335 EAPI int livebox_release_fb(void *buffer)
336 {
337     return LB_STATUS_ERROR_NOT_IMPLEMENTED;
338 }
339
340 EAPI int livebox_fb_refcnt(void *buffer)
341 {
342     return LB_STATUS_ERROR_NOT_IMPLEMENTED;
343 }
344
345 EAPI void *livebox_acquire_pdfb(struct livebox *handler)
346 {
347     return NULL;
348 }
349
350 EAPI int livebox_release_pdfb(void *buffer)
351 {
352     return LB_STATUS_ERROR_NOT_IMPLEMENTED;
353 }
354
355 EAPI int livebox_pdfb_refcnt(void *buffer)
356 {
357     return LB_STATUS_ERROR_NOT_IMPLEMENTED;
358 }
359
360 EAPI int livebox_size(struct livebox *handler)
361 {
362     return LB_STATUS_ERROR_NOT_IMPLEMENTED;
363 }
364
365 EAPI int livebox_get_pdsize(struct livebox *handler, int *w, int *h)
366 {
367     return LB_STATUS_ERROR_NOT_IMPLEMENTED;
368 }
369
370 EAPI int livebox_get_supported_sizes(struct livebox *handler, int *cnt, int *size_list)
371 {
372     return LB_STATUS_ERROR_NOT_IMPLEMENTED;
373 }
374
375 EAPI int livebox_lbfb_bufsz(struct livebox *handler)
376 {
377     return LB_STATUS_ERROR_NOT_IMPLEMENTED;
378 }
379
380 EAPI int livebox_pdfb_bufsz(struct livebox *handler)
381 {
382     return LB_STATUS_ERROR_NOT_IMPLEMENTED;
383 }
384
385 EAPI int livebox_mouse_event(struct livebox *handler, enum content_event_type type, double x, double y)
386 {
387     return LB_STATUS_ERROR_NOT_IMPLEMENTED;
388 }
389
390 EAPI int livebox_access_event(struct livebox *handler, enum access_event_type type, double x, double y, ret_cb_t cb, void *data)
391 {
392     return LB_STATUS_ERROR_NOT_IMPLEMENTED;
393 }
394
395 EAPI int livebox_key_event(struct livebox *handler, enum content_event_type type, unsigned int keycode, ret_cb_t cb, void *data)
396 {
397     return LB_STATUS_ERROR_NOT_IMPLEMENTED;
398 }
399
400 EAPI int livebox_set_pinup(struct livebox *handler, int flag, ret_cb_t cb, void *data)
401 {
402     return LB_STATUS_ERROR_NOT_IMPLEMENTED;
403 }
404
405 EAPI int livebox_is_pinned_up(struct livebox *handler)
406 {
407     return LB_STATUS_ERROR_NOT_IMPLEMENTED;
408 }
409
410 EAPI int livebox_has_pinup(struct livebox *handler)
411 {
412     return LB_STATUS_ERROR_NOT_IMPLEMENTED;
413 }
414
415 EAPI int livebox_has_pd(struct livebox *handler)
416 {
417     return LB_STATUS_ERROR_NOT_IMPLEMENTED;
418 }
419
420 EAPI int livebox_create_pd(struct livebox *handler, ret_cb_t cb, void *data)
421 {
422     return LB_STATUS_ERROR_NOT_IMPLEMENTED;
423 }
424
425 EAPI int livebox_create_pd_with_position(struct livebox *handler, double x, double y, ret_cb_t cb, void *data)
426 {
427     return LB_STATUS_ERROR_NOT_IMPLEMENTED;
428 }
429
430 EAPI int livebox_move_pd(struct livebox *handler, double x, double y)
431 {
432     return LB_STATUS_ERROR_NOT_IMPLEMENTED;
433 }
434
435 EAPI int livebox_destroy_pd(struct livebox *handler, ret_cb_t cb, void *data)
436 {
437     return LB_STATUS_ERROR_NOT_IMPLEMENTED;
438 }
439
440 EAPI int livebox_pd_is_created(struct livebox *handler)
441 {
442     return LB_STATUS_ERROR_NOT_IMPLEMENTED;
443 }
444
445 EAPI enum livebox_pd_type livebox_pd_type(struct livebox *handler)
446 {
447     return PD_TYPE_INVALID;
448 }
449
450 EAPI int livebox_is_exists(const char *pkgname)
451 {
452     return LB_STATUS_ERROR_NOT_IMPLEMENTED;
453 }
454
455 EAPI int livebox_set_text_handler(struct livebox *handler, struct livebox_script_operators *ops)
456 {
457     return LB_STATUS_ERROR_NOT_IMPLEMENTED;
458 }
459
460 EAPI int livebox_set_pd_text_handler(struct livebox *handler, struct livebox_script_operators *ops)
461 {
462     return LB_STATUS_ERROR_NOT_IMPLEMENTED;
463 }
464
465 EAPI 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)
466 {
467     return LB_STATUS_ERROR_NOT_IMPLEMENTED;
468 }
469
470 EAPI int livebox_set_data(struct livebox *handler, void *data)
471 {
472     return LB_STATUS_ERROR_NOT_IMPLEMENTED;
473 }
474
475 EAPI void *livebox_get_data(struct livebox *handler)
476 {
477     return NULL;
478 }
479
480 EAPI int livebox_subscribe_group(const char *cluster, const char *category)
481 {
482     return LB_STATUS_ERROR_NOT_IMPLEMENTED;
483 }
484
485 EAPI int livebox_unsubscribe_group(const char *cluster, const char *category)
486 {
487     return LB_STATUS_ERROR_NOT_IMPLEMENTED;
488 }
489
490 EAPI int livebox_refresh_group(const char *cluster, const char *category, int force)
491 {
492     return LB_STATUS_ERROR_NOT_IMPLEMENTED;
493 }
494
495 EAPI int livebox_refresh(struct livebox *handler, int force)
496 {
497     return LB_STATUS_ERROR_NOT_IMPLEMENTED;
498 }
499
500 EAPI int livebox_lb_pixmap(const struct livebox *handler)
501 {
502     return LB_STATUS_ERROR_NOT_IMPLEMENTED;
503 }
504
505 EAPI int livebox_pd_pixmap(const struct livebox *handler)
506 {
507     return LB_STATUS_ERROR_NOT_IMPLEMENTED;
508 }
509
510 EAPI int livebox_acquire_pd_pixmap(struct livebox *handler, ret_cb_t cb, void *data)
511 {
512     return LB_STATUS_ERROR_NOT_IMPLEMENTED;
513 }
514
515 EAPI int livebox_release_pd_pixmap(struct livebox *handler, int pixmap)
516 {
517     return LB_STATUS_ERROR_NOT_IMPLEMENTED;
518 }
519
520 EAPI int livebox_acquire_lb_pixmap(struct livebox *handler, ret_cb_t cb, void *data)
521 {
522     return LB_STATUS_ERROR_NOT_IMPLEMENTED;
523 }
524
525 EAPI int livebox_release_lb_pixmap(struct livebox *handler, int pixmap)
526 {
527     return LB_STATUS_ERROR_NOT_IMPLEMENTED;
528 }
529
530 EAPI int livebox_set_visibility(struct livebox *handler, enum livebox_visible_state state)
531 {
532     return LB_STATUS_ERROR_NOT_IMPLEMENTED;
533 }
534
535 EAPI enum livebox_visible_state livebox_visibility(struct livebox *handler)
536 {
537     return LB_VISIBLE_ERROR;
538 }
539
540 EAPI int livebox_set_update_mode(struct livebox *handler, int active_update, ret_cb_t cb, void *data)
541 {
542     return LB_STATUS_ERROR_NOT_IMPLEMENTED;
543 }
544
545 EAPI int livebox_is_active_update(struct livebox *handler)
546 {
547     return LB_STATUS_ERROR_NOT_IMPLEMENTED;
548 }
549
550 EAPI int livebox_sync_pd_fb(struct livebox *handler)
551 {
552     return LB_STATUS_ERROR_NOT_IMPLEMENTED;
553 }
554
555 EAPI int livebox_sync_lb_fb(struct livebox *handler)
556 {
557     return LB_STATUS_ERROR_NOT_IMPLEMENTED;
558 }
559
560 EAPI const char *livebox_alt_icon(struct livebox *handler)
561 {
562     return NULL;
563 }
564
565 EAPI const char *livebox_alt_name(struct livebox *handler)
566 {
567     return NULL;
568 }
569
570 EAPI int livebox_acquire_fb_lock(struct livebox *handler, int is_pd)
571 {
572     return LB_STATUS_ERROR_NOT_IMPLEMENTED;
573 }
574
575 EAPI int livebox_release_fb_lock(struct livebox *handler, int is_pd)
576 {
577     return LB_STATUS_ERROR_NOT_IMPLEMENTED;
578 }
579
580 EAPI int livebox_set_option(enum livebox_option_type option, int state)
581 {
582     return LB_STATUS_ERROR_NOT_IMPLEMENTED;
583 }
584
585 EAPI int livebox_option(enum livebox_option_type option)
586 {
587     return LB_STATUS_ERROR_NOT_IMPLEMENTED;
588 }
589
590 EAPI int livebox_set_auto_launch_handler(int (*launch_handler)(struct livebox *handler, const char *appid, void *data), void *data)
591 {
592     return LB_STATUS_ERROR_NOT_IMPLEMENTED;
593 }
594
595 /* End of a file */