Apply various patches
authorSung-jae Park <nicesj.park@samsung.com>
Tue, 30 Apr 2013 12:49:39 +0000 (21:49 +0900)
committerSung-jae Park <nicesj.park@samsung.com>
Tue, 30 Apr 2013 12:49:39 +0000 (21:49 +0900)
Patch 3/3
    Update License

Patch 2/3
    Update accessibility event handler.

Patch 1/3
    Change the accessibility event handling codes.

    Now the accessibility events are also handles by provider_buffer event handler.
    Every accessibility events will be feed via buffer_event_handler.

    Change-Id: I685c795ef847c9a4611a3f000094b25e353efe1e

Change-Id: Ib46a40997c598232f0e56102f880b8161691e37c

14 files changed:
LICENSE
include/debug.h
include/dlist.h
include/fb.h
include/provider.h
include/provider_buffer.h
include/provider_buffer_internal.h
include/util.h
packaging/libprovider.spec
src/dlist.c
src/fb.c
src/provider.c
src/provider_buffer.c
src/util.c

diff --git a/LICENSE b/LICENSE
index fd90a36..571fe79 100644 (file)
--- a/LICENSE
+++ b/LICENSE
@@ -1,6 +1,6 @@
 Flora License
 
-Version 1.0, April, 2013
+Version 1.1, April, 2013
 
 http://floralicense.org/license/
 
@@ -119,17 +119,17 @@ Object form, provided that You meet the following conditions:
      Derivative Works; or, within a display generated by the Derivative Works,
      if and wherever such third-party notices normally appear.
      The contents of the NOTICE file are for informational purposes only
-     and do not modify the License.
-
-You may add Your own attribution notices within Derivative Works
-that You distribute, alongside or as an addendum to the NOTICE text
-from the Work, provided that such additional attribution notices
-cannot be construed as modifying the License. You may add Your own
-copyright statement to Your modifications and may provide additional or
-different license terms and conditions for use, reproduction, or
-distribution of Your modifications, or for any such Derivative Works
-as a whole, provided Your use, reproduction, and distribution of
-the Work otherwise complies with the conditions stated in this License.
+     and do not modify the License. You may add Your own attribution notices 
+     within Derivative Works that You distribute, alongside or as an addendum 
+     to the NOTICE text from the Work, provided that such additional attribution 
+     notices cannot be construed as modifying the License. You may add Your own
+     copyright statement to Your modifications and may provide additional or
+     different license terms and conditions for use, reproduction, or
+     distribution of Your modifications, or for any such Derivative Works
+     as a whole, provided Your use, reproduction, and distribution of
+     the Work otherwise complies with the conditions stated in this License
+     and your own copyright statement or terms and conditions do not conflict
+     the conditions stated in the License including section 3.
 
 5. Submission of Contributions. Unless You explicitly state otherwise,
 any Contribution intentionally submitted for inclusion in the Work
@@ -192,7 +192,7 @@ identification within third-party archives.
 
    Copyright [yyyy] [name of copyright owner]
 
-   Licensed under the Flora License, Version 1.0 (the "License");
+   Licensed under the Flora License, Version 1.1 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at
 
index 64b5ff0..dc79d19 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Copyright 2013  Samsung Electronics Co., Ltd
  *
- * Licensed under the Flora License, Version 1.0 (the "License");
+ * Licensed under the Flora License, Version 1.1 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
  *
index 99e8443..cd1a421 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Copyright 2013  Samsung Electronics Co., Ltd
  *
- * Licensed under the Flora License, Version 1.0 (the "License");
+ * Licensed under the Flora License, Version 1.1 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
  *
index d22fd90..adc3efa 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Copyright 2013  Samsung Electronics Co., Ltd
  *
- * Licensed under the Flora License, Version 1.0 (the "License");
+ * Licensed under the Flora License, Version 1.1 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
  *
index aa0437e..4f6b378 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Copyright 2013  Samsung Electronics Co., Ltd
  *
- * Licensed under the Flora License, Version 1.0 (the "License");
+ * Licensed under the Flora License, Version 1.1 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -39,22 +39,6 @@ struct event_info {
         } part;
 };
 
-enum access_event {
-       ACCESS_HIGHLIGHT,
-       ACCESS_HIGHLIGHT_NEXT,
-       ACCESS_HIGHLIGHT_PREV,
-       ACCESS_ACTIVATE,
-       ACCESS_VALUE_CHANGE,
-       ACCESS_SCROLL,
-       ACCESS_UNHIGHLIGHT,
-};
-
-enum access_mouse_state {
-       ACCESS_MOUSE_DOWN = 0,
-       ACCESS_MOUSE_MOVE = 1,
-       ACCESS_MOUSE_UP = 2,
-};
-
 struct event_arg {
        enum {
                EVENT_NEW, /*!< Master will send this to create a new livebox instance */
@@ -207,22 +191,6 @@ struct event_arg {
                } lb_resume;
 
                struct {
-                       /*!< Accessibility */
-                       enum access_event event;
-                       int x;
-                       int y;
-                       int mouse_state;
-               } lb_access;
-
-               struct {
-                       /*!< Accessibility */
-                       enum access_event event;
-                       int x;
-                       int y;
-                       int mouse_state;
-               } pd_access;
-
-               struct {
                        int active_update;
                } update_mode;
        } info;
@@ -261,13 +229,6 @@ struct event_handler {
        int (*pd_destroy)(struct event_arg *arg, void *data);
        int (*pd_move)(struct event_arg *arg, void *data);
 
-       /*!
-        * \note
-        * Accessibility functions
-        */
-       int (*lb_access)(struct event_arg *arg, void *data);
-       int (*pd_access)(struct event_arg *arg, void *data);
-
        int (*update_mode)(struct event_arg *arg, void *data);
 };
 
index 6b4a33c..8f76876 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Copyright 2013  Samsung Electronics Co., Ltd
  *
- * Licensed under the Flora License, Version 1.0 (the "License");
+ * Licensed under the Flora License, Version 1.1 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -44,6 +44,17 @@ enum buffer_event {
 
        BUFFER_EVENT_KEY_DOWN, /*!< */
        BUFFER_EVENT_KEY_UP, /*!< */
+
+       BUFFER_EVENT_HIGHLIGHT,
+       BUFFER_EVENT_HIGHLIGHT_NEXT,
+       BUFFER_EVENT_HIGHLIGHT_PREV,
+       BUFFER_EVENT_ACTIVATE,
+       BUFFER_EVENT_ACTION_UP,
+       BUFFER_EVENT_ACTION_DOWN,
+       BUFFER_EVENT_SCROLL_UP,
+       BUFFER_EVENT_SCROLL_MOVE,
+       BUFFER_EVENT_SCROLL_DOWN,
+       BUFFER_EVENT_UNHIGHLIGHT,
 };
 
 struct livebox_buffer;
@@ -203,6 +214,46 @@ extern void *provider_buffer_user_data(struct livebox_buffer *handle);
  */
 extern int provider_buffer_set_user_data(struct livebox_buffer *handle, void *data);
 
+extern struct packet *provider_buffer_pd_access_action_up(pid_t pid, int handle, const struct packet *packet);
+
+extern struct packet *provider_buffer_pd_access_action_down(pid_t pid, int handle, const struct packet *packet);
+
+extern struct packet *provider_buffer_pd_access_scroll_down(pid_t pid, int handle, const struct packet *packet);
+
+extern struct packet *provider_buffer_pd_access_scroll_move(pid_t pid, int handle, const struct packet *packet);
+
+extern struct packet *provider_buffer_pd_access_scroll_up(pid_t pid, int handle, const struct packet *packet);
+
+extern struct packet *provider_buffer_pd_access_unhighlight(pid_t pid, int handle, const struct packet *packet);
+
+extern struct packet *provider_buffer_pd_access_hl(pid_t pid, int handle, const struct packet *packet);
+
+extern struct packet *provider_buffer_pd_access_hl_prev(pid_t pid, int handle, const struct packet *packet);
+
+extern struct packet *provider_buffer_pd_access_hl_next(pid_t pid, int handle, const struct packet *packet);
+
+extern struct packet *provider_buffer_pd_access_activate(pid_t pid, int handle, const struct packet *packet);
+
+extern struct packet *provider_buffer_lb_access_unhighlight(pid_t pid, int handle, const struct packet *packet);
+
+extern struct packet *provider_buffer_lb_access_hl(pid_t pid, int handle, const struct packet *packet);
+
+extern struct packet *provider_buffer_lb_access_hl_prev(pid_t pid, int handle, const struct packet *packet);
+
+extern struct packet *provider_buffer_lb_access_hl_next(pid_t pid, int handle, const struct packet *packet);
+
+extern struct packet *provider_buffer_lb_access_action_up(pid_t pid, int handle, const struct packet *packet);
+
+extern struct packet *provider_buffer_lb_access_action_down(pid_t pid, int handle, const struct packet *packet);
+
+extern struct packet *provider_buffer_lb_access_scroll_down(pid_t pid, int handle, const struct packet *packet);
+
+extern struct packet *provider_buffer_lb_access_scroll_move(pid_t pid, int handle, const struct packet *packet);
+
+extern struct packet *provider_buffer_lb_access_scroll_up(pid_t pid, int handle, const struct packet *packet);
+
+extern struct packet *provider_buffer_lb_access_activate(pid_t pid, int handle, const struct packet *packet);
+
 #ifdef __cplusplus
 }
 #endif
index a364485..920d0f1 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Copyright 2013  Samsung Electronics Co., Ltd
  *
- * Licensed under the Flora License, Version 1.0 (the "License");
+ * Licensed under the Flora License, Version 1.1 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
  *
index 20a809e..d84474e 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Copyright 2013  Samsung Electronics Co., Ltd
  *
- * Licensed under the Flora License, Version 1.0 (the "License");
+ * Licensed under the Flora License, Version 1.1 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
  *
index 0863c2a..2b96897 100644 (file)
@@ -1,6 +1,6 @@
 Name: libprovider
 Summary: Library for developing the livebox service provider.
-Version: 0.8.2
+Version: 0.9.0
 Release: 1
 Group: HomeTF/Livebox
 License: Flora License
index cf2cb63..fa3082a 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Copyright 2013  Samsung Electronics Co., Ltd
  *
- * Licensed under the Flora License, Version 1.0 (the "License");
+ * Licensed under the Flora License, Version 1.1 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
  *
index 7936622..526cc8c 100644 (file)
--- a/src/fb.c
+++ b/src/fb.c
@@ -1,7 +1,7 @@
 /*
  * Copyright 2013  Samsung Electronics Co., Ltd
  *
- * Licensed under the Flora License, Version 1.0 (the "License");
+ * Licensed under the Flora License, Version 1.1 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
  *
index 83e0f38..e85c0fc 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Copyright 2013  Samsung Electronics Co., Ltd
  *
- * Licensed under the Flora License, Version 1.0 (the "License");
+ * Licensed under the Flora License, Version 1.1 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -589,453 +589,6 @@ out:
        return NULL;
 }
 
-struct packet *master_pd_access_value_change(pid_t pid, int handle, const struct packet *packet)
-{
-       struct event_arg arg;
-       double timestamp;
-       int ret;
-
-       ret = packet_get(packet, "ssdii", &arg.pkgname, &arg.id, &timestamp, &arg.info.pd_access.x, &arg.info.pd_access.y);
-       if (ret != 5) {
-               ErrPrint("Invalid packet\n");
-               goto out;
-       }
-
-       arg.type = EVENT_PD_ACCESS;
-       arg.info.pd_access.event = ACCESS_VALUE_CHANGE;
-       if (s_info.table.pd_access)
-               (void)s_info.table.pd_access(&arg, s_info.data);
-       else
-               (void)provider_send_access_status(arg.pkgname, arg.id, LB_ACCESS_STATUS_ERROR);
-
-out:
-       return NULL;
-}
-
-struct packet *master_pd_access_scroll_down(pid_t pid, int handle, const struct packet *packet)
-{
-       struct event_arg arg;
-       double timestamp;
-       int ret;
-
-       ret = packet_get(packet, "ssdii", &arg.pkgname, &arg.id, &timestamp, &arg.info.pd_access.x, &arg.info.pd_access.y);
-       if (ret != 5) {
-               ErrPrint("Invalid packet\n");
-               goto out;
-       }
-
-       arg.type = EVENT_PD_ACCESS;
-       arg.info.pd_access.event = ACCESS_SCROLL;
-       arg.info.pd_access.mouse_state = ACCESS_MOUSE_DOWN;
-       if (s_info.table.pd_access)
-               (void)s_info.table.pd_access(&arg, s_info.data);
-       else
-               (void)provider_send_access_status(arg.pkgname, arg.id, LB_ACCESS_STATUS_ERROR);
-
-out:
-       return NULL;
-}
-
-struct packet *master_pd_access_scroll_move(pid_t pid, int handle, const struct packet *packet)
-{
-       struct event_arg arg;
-       double timestamp;
-       int ret;
-
-       ret = packet_get(packet, "ssdii", &arg.pkgname, &arg.id, &timestamp, &arg.info.pd_access.x, &arg.info.pd_access.y);
-       if (ret != 5) {
-               ErrPrint("Invalid packet\n");
-               goto out;
-       }
-
-       arg.type = EVENT_PD_ACCESS;
-       arg.info.pd_access.event = ACCESS_SCROLL;
-       arg.info.pd_access.mouse_state = ACCESS_MOUSE_MOVE;
-       if (s_info.table.pd_access)
-               (void)s_info.table.pd_access(&arg, s_info.data);
-       else
-               (void)provider_send_access_status(arg.pkgname, arg.id, LB_ACCESS_STATUS_ERROR);
-
-out:
-       return NULL;
-}
-
-struct packet *master_pd_access_scroll_up(pid_t pid, int handle, const struct packet *packet)
-{
-       struct event_arg arg;
-       double timestamp;
-       int ret;
-
-       ret = packet_get(packet, "ssdii", &arg.pkgname, &arg.id, &timestamp, &arg.info.pd_access.x, &arg.info.pd_access.y);
-       if (ret != 5) {
-               ErrPrint("Invalid packet\n");
-               goto out;
-       }
-
-       arg.type = EVENT_PD_ACCESS;
-       arg.info.pd_access.event = ACCESS_SCROLL;
-       arg.info.pd_access.mouse_state = ACCESS_MOUSE_UP;
-       if (s_info.table.pd_access)
-               (void)s_info.table.pd_access(&arg, s_info.data);
-       else
-               (void)provider_send_access_status(arg.pkgname, arg.id, LB_ACCESS_STATUS_ERROR);
-
-out:
-       return NULL;
-}
-
-struct packet *master_pd_access_unhighlight(pid_t pid, int handle, const struct packet *packet)
-{
-       struct event_arg arg;
-       double timestamp;
-       int ret;
-
-       ret = packet_get(packet, "ssdii", &arg.pkgname, &arg.id, &timestamp, &arg.info.pd_access.x, &arg.info.pd_access.y);
-       if (ret != 5) {
-               ErrPrint("Invalid packet\n");
-               goto out;
-       }
-
-       arg.type = EVENT_PD_ACCESS;
-       arg.info.pd_access.event = ACCESS_UNHIGHLIGHT;
-       if (s_info.table.pd_access)
-               (void)s_info.table.pd_access(&arg, s_info.data);
-       else
-               (void)provider_send_access_status(arg.pkgname, arg.id, LB_ACCESS_STATUS_ERROR);
-
-out:
-       return NULL;
-}
-
-struct packet *master_pd_access_hl(pid_t pid, int handle, const struct packet *packet)
-{
-       struct event_arg arg;
-       double timestamp;
-       int ret;
-
-       ret = packet_get(packet, "ssdii", &arg.pkgname, &arg.id,
-                                        &timestamp,
-                                        &arg.info.pd_access.x, &arg.info.pd_access.y);
-       if (ret != 5) {
-               ErrPrint("Invalid packet\n");
-               goto out;
-       }
-
-       arg.type = EVENT_PD_ACCESS;
-       arg.info.pd_access.event = ACCESS_HIGHLIGHT;
-       if (s_info.table.pd_access)
-               (void)s_info.table.pd_access(&arg, s_info.data);
-       else
-               (void)provider_send_access_status(arg.pkgname, arg.id, LB_ACCESS_STATUS_ERROR);
-
-out:
-       return NULL;
-}
-
-struct packet *master_pd_access_hl_prev(pid_t pid, int handle, const struct packet *packet)
-{
-       struct event_arg arg;
-       double timestamp;
-       int ret;
-
-       ret = packet_get(packet, "ssdii", &arg.pkgname, &arg.id,
-                                        &timestamp,
-                                        &arg.info.pd_access.x, &arg.info.pd_access.y);
-       if (ret != 5) {
-               ErrPrint("Invalid packet\n");
-               goto out;
-       }
-
-       arg.type = EVENT_PD_ACCESS;
-       arg.info.pd_access.event = ACCESS_HIGHLIGHT_PREV;
-       if (s_info.table.pd_access)
-               (void)s_info.table.pd_access(&arg, s_info.data);
-       else
-               (void)provider_send_access_status(arg.pkgname, arg.id, LB_ACCESS_STATUS_ERROR);
-
-out:
-       return NULL;
-}
-
-struct packet *master_pd_access_hl_next(pid_t pid, int handle, const struct packet *packet)
-{
-       struct event_arg arg;
-       double timestamp;
-       int ret;
-
-       ret = packet_get(packet, "ssdii", &arg.pkgname, &arg.id,
-                                        &timestamp,
-                                        &arg.info.pd_access.x, &arg.info.pd_access.y);
-       if (ret != 5) {
-               ErrPrint("Invalid packet\n");
-               goto out;
-       }
-
-       arg.type = EVENT_PD_ACCESS;
-       arg.info.pd_access.event = ACCESS_HIGHLIGHT_NEXT;
-       if (s_info.table.pd_access)
-               (void)s_info.table.pd_access(&arg, s_info.data);
-       else
-               (void)provider_send_access_status(arg.pkgname, arg.id, LB_ACCESS_STATUS_ERROR);
-
-out:
-       return NULL;
-}
-
-struct packet *master_pd_access_activate(pid_t pid, int handle, const struct packet *packet)
-{
-       struct event_arg arg;
-       double timestamp;
-       int ret;
-
-       ret = packet_get(packet, "ssdii", &arg.pkgname, &arg.id,
-                                        &timestamp,
-                                        &arg.info.pd_access.x, &arg.info.pd_access.y);
-       if (ret != 5) {
-               ErrPrint("Invalid packet\n");
-               goto out;
-       }
-
-       arg.type = EVENT_PD_ACCESS;
-       arg.info.pd_access.event = ACCESS_ACTIVATE;
-       if (s_info.table.pd_access)
-               (void)s_info.table.pd_access(&arg, s_info.data);
-       else
-               (void)provider_send_access_status(arg.pkgname, arg.id, LB_ACCESS_STATUS_ERROR);
-
-out:
-       return NULL;
-}
-
-struct packet *master_lb_access_unhighlight(pid_t pid, int handle, const struct packet *packet)
-{
-       struct event_arg arg;
-       double timestamp;
-       int ret;
-
-       ret = packet_get(packet, "ssdii", &arg.pkgname, &arg.id,
-                                       &timestamp,
-                                       &arg.info.lb_access.x, &arg.info.lb_access.y);
-
-       if (ret != 5) {
-               ErrPrint("Invalid packet\n");
-               goto out;
-       }
-
-       arg.type = EVENT_LB_ACCESS;
-       arg.info.lb_access.event = ACCESS_UNHIGHLIGHT;
-       if (s_info.table.lb_access)
-               (void)s_info.table.lb_access(&arg, s_info.data);
-       else
-               (void)provider_send_access_status(arg.pkgname, arg.id, LB_ACCESS_STATUS_ERROR);
-
-out:
-       return NULL;
-}
-
-struct packet *master_lb_access_hl(pid_t pid, int handle, const struct packet *packet)
-{
-       struct event_arg arg;
-       double timestamp;
-       int ret;
-
-       ret = packet_get(packet, "ssdii", &arg.pkgname, &arg.id,
-                                        &timestamp,
-                                        &arg.info.lb_access.x, &arg.info.lb_access.y);
-       if (ret != 5) {
-               ErrPrint("Invalid packet\n");
-               goto out;
-       }
-
-       arg.type = EVENT_LB_ACCESS;
-       arg.info.lb_access.event = ACCESS_HIGHLIGHT;
-       if (s_info.table.lb_access)
-               (void)s_info.table.lb_access(&arg, s_info.data);
-       else
-               (void)provider_send_access_status(arg.pkgname, arg.id, LB_ACCESS_STATUS_ERROR);
-
-out:
-       return NULL;
-}
-
-struct packet *master_lb_access_hl_prev(pid_t pid, int handle, const struct packet *packet)
-{
-       struct event_arg arg;
-       double timestamp;
-       int ret;
-
-       ret = packet_get(packet, "ssdii", &arg.pkgname, &arg.id,
-                                        &timestamp,
-                                        &arg.info.lb_access.x, &arg.info.lb_access.y);
-       if (ret != 5) {
-               ErrPrint("Invalid packet\n");
-               goto out;
-       }
-
-       arg.type = EVENT_LB_ACCESS;
-       arg.info.lb_access.event = ACCESS_HIGHLIGHT_PREV;
-       if (s_info.table.lb_access)
-               (void)s_info.table.lb_access(&arg, s_info.data);
-       else
-               (void)provider_send_access_status(arg.pkgname, arg.id, LB_ACCESS_STATUS_ERROR);
-
-out:
-       return NULL;
-}
-
-struct packet *master_lb_access_hl_next(pid_t pid, int handle, const struct packet *packet)
-{
-       struct event_arg arg;
-       double timestamp;
-       int ret;
-
-       ret = packet_get(packet, "ssdii", &arg.pkgname, &arg.id,
-                                        &timestamp,
-                                        &arg.info.lb_access.x, &arg.info.lb_access.y);
-       if (ret != 5) {
-               ErrPrint("Invalid packet\n");
-               goto out;
-       }
-
-       arg.type = EVENT_LB_ACCESS;
-       arg.info.lb_access.event = ACCESS_HIGHLIGHT_NEXT;
-       if (s_info.table.lb_access)
-               (void)s_info.table.lb_access(&arg, s_info.data);
-       else
-               (void)provider_send_access_status(arg.pkgname, arg.id, LB_ACCESS_STATUS_ERROR);
-
-out:
-       return NULL;
-}
-
-struct packet *master_lb_access_value_change(pid_t pid, int handle, const struct packet *packet)
-{
-       struct event_arg arg;
-       double timestamp;
-       int ret;
-
-       ret = packet_get(packet, "ssdii", &arg.pkgname, &arg.id,
-                                        &timestamp,
-                                        &arg.info.lb_access.x, &arg.info.lb_access.y);
-       if (ret != 5) {
-               ErrPrint("Invalid packet\n");
-               goto out;
-       }
-
-       arg.type = EVENT_LB_ACCESS;
-       arg.info.lb_access.event = ACCESS_VALUE_CHANGE;
-       if (s_info.table.lb_access)
-               (void)s_info.table.lb_access(&arg, s_info.data);
-       else
-               (void)provider_send_access_status(arg.pkgname, arg.id, LB_ACCESS_STATUS_ERROR);
-
-out:
-       return NULL;
-}
-
-struct packet *master_lb_access_scroll_down(pid_t pid, int handle, const struct packet *packet)
-{
-       struct event_arg arg;
-       double timestamp;
-       int ret;
-
-       ret = packet_get(packet, "ssdii", &arg.pkgname, &arg.id,
-                                        &timestamp,
-                                        &arg.info.lb_access.x, &arg.info.lb_access.y);
-       if (ret != 5) {
-               ErrPrint("Invalid packet\n");
-               goto out;
-       }
-
-       arg.type = EVENT_LB_ACCESS;
-       arg.info.lb_access.event = ACCESS_SCROLL;
-       arg.info.lb_access.mouse_state = ACCESS_MOUSE_DOWN;
-       if (s_info.table.lb_access)
-               (void)s_info.table.lb_access(&arg, s_info.data);
-       else
-               (void)provider_send_access_status(arg.pkgname, arg.id, LB_ACCESS_STATUS_ERROR);
-
-out:
-       return NULL;
-}
-
-struct packet *master_lb_access_scroll_move(pid_t pid, int handle, const struct packet *packet)
-{
-       struct event_arg arg;
-       double timestamp;
-       int ret;
-
-       ret = packet_get(packet, "ssdii", &arg.pkgname, &arg.id,
-                                        &timestamp,
-                                        &arg.info.lb_access.x, &arg.info.lb_access.y);
-       if (ret != 5) {
-               ErrPrint("Invalid packet\n");
-               goto out;
-       }
-
-       arg.type = EVENT_LB_ACCESS;
-       arg.info.lb_access.event = ACCESS_SCROLL;
-       arg.info.lb_access.mouse_state = ACCESS_MOUSE_MOVE;
-       if (s_info.table.lb_access)
-               (void)s_info.table.lb_access(&arg, s_info.data);
-       else
-               (void)provider_send_access_status(arg.pkgname, arg.id, LB_ACCESS_STATUS_ERROR);
-
-out:
-       return NULL;
-}
-
-struct packet *master_lb_access_scroll_up(pid_t pid, int handle, const struct packet *packet)
-{
-       struct event_arg arg;
-       double timestamp;
-       int ret;
-
-       ret = packet_get(packet, "ssdii", &arg.pkgname, &arg.id,
-                                        &timestamp,
-                                        &arg.info.lb_access.x, &arg.info.lb_access.y);
-       if (ret != 5) {
-               ErrPrint("Invalid packet\n");
-               goto out;
-       }
-
-       arg.type = EVENT_LB_ACCESS;
-       arg.info.lb_access.event = ACCESS_SCROLL;
-       arg.info.lb_access.mouse_state = ACCESS_MOUSE_UP;
-       if (s_info.table.lb_access)
-               (void)s_info.table.lb_access(&arg, s_info.data);
-       else
-               (void)provider_send_access_status(arg.pkgname, arg.id, LB_ACCESS_STATUS_ERROR);
-
-out:
-       return NULL;
-}
-
-struct packet *master_lb_access_activate(pid_t pid, int handle, const struct packet *packet)
-{
-       struct event_arg arg;
-       double timestamp;
-       int ret;
-
-       ret = packet_get(packet, "ssdii", &arg.pkgname, &arg.id,
-                                        &timestamp,
-                                        &arg.info.lb_access.x, &arg.info.lb_access.y);
-       if (ret != 5) {
-               ErrPrint("Invalid packet\n");
-               goto out;
-       }
-
-       arg.type = EVENT_LB_ACCESS;
-       arg.info.lb_access.event = ACCESS_ACTIVATE;
-       if (s_info.table.lb_access)
-               (void)s_info.table.lb_access(&arg, s_info.data);
-       else
-               (void)provider_send_access_status(arg.pkgname, arg.id, LB_ACCESS_STATUS_ERROR);
-
-out:
-       return NULL;
-}
-
 static struct method s_table[] = {
        /*!< For the buffer type */
        {
@@ -1169,80 +722,88 @@ static struct method s_table[] = {
 
        {
                .cmd = "pd_access_hl",
-               .handler = master_pd_access_hl,
+               .handler = provider_buffer_pd_access_hl,
        },
        {
                .cmd = "pd_access_hl_prev",
-               .handler = master_pd_access_hl_prev,
+               .handler = provider_buffer_pd_access_hl_prev,
        },
        {
                .cmd = "pd_access_hl_next",
-               .handler = master_pd_access_hl_next,
+               .handler = provider_buffer_pd_access_hl_next,
        },
        {
                .cmd = "pd_access_activate",
-               .handler = master_pd_access_activate,
+               .handler = provider_buffer_pd_access_activate,
        },
        {
-               .cmd = "pd_access_value_change",
-               .handler = master_pd_access_value_change,
+               .cmd = "pd_access_action_up",
+               .handler = provider_buffer_pd_access_action_up,
+       },
+       {
+               .cmd = "pd_access_action_down",
+               .handler = provider_buffer_pd_access_action_down,
        },
        {
                .cmd = "pd_access_unhighlight",
-               .handler = master_pd_access_unhighlight,
+               .handler = provider_buffer_pd_access_unhighlight,
        },
        {
                .cmd = "pd_access_scroll_down",
-               .handler = master_pd_access_scroll_down,
+               .handler = provider_buffer_pd_access_scroll_down,
        },
        {
                .cmd = "pd_access_scroll_move",
-               .handler = master_pd_access_scroll_move,
+               .handler = provider_buffer_pd_access_scroll_move,
        },
        {
                .cmd = "pd_access_scroll_up",
-               .handler = master_pd_access_scroll_up,
+               .handler = provider_buffer_pd_access_scroll_up,
        },
 
        {
                .cmd = "lb_access_hl",
-               .handler = master_lb_access_hl,
+               .handler = provider_buffer_lb_access_hl,
        },
        {
                .cmd = "lb_access_hl_prev",
-               .handler = master_lb_access_hl_prev,
+               .handler = provider_buffer_lb_access_hl_prev,
        },
        {
                .cmd = "lb_access_hl_next",
-               .handler = master_lb_access_hl_next,
+               .handler = provider_buffer_lb_access_hl_next,
        },
        {
                .cmd = "lb_access_activate",
-               .handler = master_lb_access_activate,
+               .handler = provider_buffer_lb_access_activate,
        },
        {
-               .cmd = "lb_access_value_change",
-               .handler = master_lb_access_value_change,
+               .cmd = "lb_access_action_up",
+               .handler = provider_buffer_lb_access_action_up,
        },
        {
-               .cmd = "update_mode",
-               .handler = master_update_mode,
+               .cmd = "lb_access_action_down",
+               .handler = provider_buffer_lb_access_action_down,
        },
        {
                .cmd = "lb_access_unhighlight",
-               .handler = master_lb_access_unhighlight,
+               .handler = provider_buffer_lb_access_unhighlight,
        },
        {
                .cmd = "lb_access_scroll_down",
-               .handler = master_lb_access_scroll_down,
+               .handler = provider_buffer_lb_access_scroll_down,
        },
        {
                .cmd = "lb_access_scroll_move",
-               .handler = master_lb_access_scroll_move,
+               .handler = provider_buffer_lb_access_scroll_move,
        },
        {
                .cmd = "lb_access_scroll_up",
-               .handler = master_lb_access_scroll_up,
+               .handler = provider_buffer_lb_access_scroll_up,
+       },
+       {
+               .cmd = "update_mode",
+               .handler = master_update_mode,
        },
 
        {
index 2c08ae9..5bba320 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Copyright 2013  Samsung Electronics Co., Ltd
  *
- * Licensed under the Flora License, Version 1.0 (the "License");
+ * Licensed under the Flora License, Version 1.1 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -28,6 +28,7 @@
 
 #include <dlog.h>
 #include <livebox-errno.h>
+#include <livebox-service.h> /* LB_ACCESS_STATUS_ERROR */
 
 #include "dlist.h"
 #include "util.h"
@@ -992,4 +993,804 @@ out:
        return NULL;
 }
 
+struct packet *provider_buffer_pd_access_action_up(pid_t pid, int handle, const struct packet *packet)
+{
+       const char *pkgname;
+       const char *id;
+       double timestamp;
+       int ret;
+       int x;
+       int y;
+       struct livebox_buffer *info;
+
+       ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y);
+       if (ret != 5) {
+               ErrPrint("Invalid packet\n");
+               goto out;
+       }
+
+       info = provider_buffer_find_buffer(TYPE_PD, pkgname, id);
+       if (!info) {
+               ErrPrint("Failed to find a buffer [%s:%s]\n", pkgname, id);
+               goto out;
+       }
+
+       if (info->handler) {
+               int w;
+               int h;
+
+               if (provider_buffer_get_size(info, &w, &h, NULL) < 0)
+                       ErrPrint("Failed to get buffer size[%s:%s]\n", pkgname, id);
+
+               ret = info->handler(info, BUFFER_EVENT_ACTION_UP, timestamp, (double)x / (double)w, (double)y / (double)h, info->data);
+               if (ret < 0)
+                       (void)provider_send_access_status(pkgname, id, LB_ACCESS_STATUS_ERROR);
+               else
+                       (void)provider_send_access_status(pkgname, id, ret);
+       }
+
+out:
+       return NULL;
+}
+
+struct packet *provider_buffer_pd_access_action_down(pid_t pid, int handle, const struct packet *packet)
+{
+       const char *pkgname;
+       const char *id;
+       double timestamp;
+       int ret;
+       int x;
+       int y;
+       struct livebox_buffer *info;
+
+       ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y);
+       if (ret != 5) {
+               ErrPrint("Invalid packet\n");
+               goto out;
+       }
+
+       info = provider_buffer_find_buffer(TYPE_PD, pkgname, id);
+       if (!info) {
+               ErrPrint("Failed to find a buffer [%s:%s]\n", pkgname, id);
+               goto out;
+       }
+
+       if (info->handler) {
+               int w;
+               int h;
+
+               if (provider_buffer_get_size(info, &w, &h, NULL) < 0)
+                       ErrPrint("Failed to get buffer size[%s:%s]\n", pkgname, id);
+
+               ret = info->handler(info, BUFFER_EVENT_ACTION_DOWN, timestamp, (double)x / (double)w, (double)y / (double)h, info->data);
+               if (ret < 0)
+                       (void)provider_send_access_status(pkgname, id, LB_ACCESS_STATUS_ERROR);
+               else
+                       (void)provider_send_access_status(pkgname, id, ret);
+       }
+
+out:
+       return NULL;
+}
+
+struct packet *provider_buffer_pd_access_scroll_down(pid_t pid, int handle, const struct packet *packet)
+{
+       const char *pkgname;
+       const char *id;
+       double timestamp;
+       int ret;
+       int x;
+       int y;
+       struct livebox_buffer *info;
+
+       ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y);
+       if (ret != 5) {
+               ErrPrint("Invalid packet\n");
+               goto out;
+       }
+
+       info = provider_buffer_find_buffer(TYPE_PD, pkgname, id);
+       if (!info) {
+               ErrPrint("Failed to find a buffer [%s:%s]\n", pkgname, id);
+               goto out;
+       }
+
+       if (info->handler) {
+               int w;
+               int h;
+
+               if (provider_buffer_get_size(info, &w, &h, NULL) < 0)
+                       ErrPrint("Failed to get buffer size[%s:%s]\n", pkgname, id);
+
+               ret = info->handler(info, BUFFER_EVENT_SCROLL_DOWN, timestamp, (double)x / (double)w, (double)y / (double)h, info->data);
+               if (ret < 0)
+                       (void)provider_send_access_status(pkgname, id, LB_ACCESS_STATUS_ERROR);
+               else
+                       (void)provider_send_access_status(pkgname, id, ret);
+       }
+
+out:
+       return NULL;
+}
+
+struct packet *provider_buffer_pd_access_scroll_move(pid_t pid, int handle, const struct packet *packet)
+{
+       const char *pkgname;
+       const char *id;
+       double timestamp;
+       int ret;
+       int x;
+       int y;
+       struct livebox_buffer *info;
+
+       ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y);
+       if (ret != 5) {
+               ErrPrint("Invalid packet\n");
+               goto out;
+       }
+
+       info = provider_buffer_find_buffer(TYPE_PD, pkgname, id);
+       if (!info) {
+               ErrPrint("Failed to find a buffer [%s:%s]\n", pkgname, id);
+               goto out;
+       }
+
+       if (info->handler) {
+               int w;
+               int h;
+
+               if (provider_buffer_get_size(info, &w, &h, NULL) < 0)
+                       ErrPrint("Failed to get buffer size[%s:%s]\n", pkgname, id);
+
+               ret = info->handler(info, BUFFER_EVENT_SCROLL_MOVE, timestamp, (double)x / (double)w, (double)y / (double)h, info->data);
+               if (ret < 0)
+                       (void)provider_send_access_status(pkgname, id, LB_ACCESS_STATUS_ERROR);
+               else
+                       (void)provider_send_access_status(pkgname, id, ret);
+       }
+
+out:
+       return NULL;
+}
+
+struct packet *provider_buffer_pd_access_scroll_up(pid_t pid, int handle, const struct packet *packet)
+{
+       const char *pkgname;
+       const char *id;
+       double timestamp;
+       int ret;
+       int x;
+       int y;
+       struct livebox_buffer *info;
+
+       ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y);
+       if (ret != 5) {
+               ErrPrint("Invalid packet\n");
+               goto out;
+       }
+
+       info = provider_buffer_find_buffer(TYPE_PD, pkgname, id);
+       if (!info) {
+               ErrPrint("Failed to find a buffer [%s:%s]\n", pkgname, id);
+               goto out;
+       }
+
+       if (info->handler) {
+               int w;
+               int h;
+
+               if (provider_buffer_get_size(info, &w, &h, NULL) < 0)
+                       ErrPrint("Failed to get buffer size[%s:%s]\n", pkgname, id);
+
+               ret = info->handler(info, BUFFER_EVENT_SCROLL_UP, timestamp, (double)x / (double)w, (double)y / (double)h, info->data);
+               if (ret < 0)
+                       (void)provider_send_access_status(pkgname, id, LB_ACCESS_STATUS_ERROR);
+               else
+                       (void)provider_send_access_status(pkgname, id, ret);
+       }
+
+out:
+       return NULL;
+}
+
+struct packet *provider_buffer_pd_access_unhighlight(pid_t pid, int handle, const struct packet *packet)
+{
+       const char *pkgname;
+       const char *id;
+       double timestamp;
+       int ret;
+       int x;
+       int y;
+       struct livebox_buffer *info;
+
+       ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y);
+       if (ret != 5) {
+               ErrPrint("Invalid packet\n");
+               goto out;
+       }
+
+       info = provider_buffer_find_buffer(TYPE_PD, pkgname, id);
+       if (!info) {
+               ErrPrint("Failed to find a buffer [%s:%s]\n", pkgname, id);
+               goto out;
+       }
+
+       if (info->handler) {
+               int w;
+               int h;
+
+               if (provider_buffer_get_size(info, &w, &h, NULL) < 0)
+                       ErrPrint("Failed to get buffer size[%s:%s]\n", pkgname, id);
+
+               ret = info->handler(info, BUFFER_EVENT_UNHIGHLIGHT, timestamp, (double)x / (double)w, (double)y / (double)h, info->data);
+               if (ret < 0)
+                       (void)provider_send_access_status(pkgname, id, LB_ACCESS_STATUS_ERROR);
+               else
+                       (void)provider_send_access_status(pkgname, id, ret);
+       }
+
+out:
+       return NULL;
+}
+
+struct packet *provider_buffer_pd_access_hl(pid_t pid, int handle, const struct packet *packet)
+{
+       const char *pkgname;
+       const char *id;
+       double timestamp;
+       int ret;
+       int x;
+       int y;
+       struct livebox_buffer *info;
+
+       ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y);
+       if (ret != 5) {
+               ErrPrint("Invalid packet\n");
+               goto out;
+       }
+
+       info = provider_buffer_find_buffer(TYPE_PD, pkgname, id);
+       if (!info) {
+               ErrPrint("Failed to find a buffer [%s:%s]\n", pkgname, id);
+               goto out;
+       }
+
+       if (info->handler) {
+               int w;
+               int h;
+
+               if (provider_buffer_get_size(info, &w, &h, NULL) < 0)
+                       ErrPrint("Failed to get buffer size[%s:%s]\n", pkgname, id);
+
+               ret = info->handler(info, BUFFER_EVENT_HIGHLIGHT, timestamp, (double)x / (double)w, (double)y / (double)h, info->data);
+               if (ret < 0)
+                       (void)provider_send_access_status(pkgname, id, LB_ACCESS_STATUS_ERROR);
+               else
+                       (void)provider_send_access_status(pkgname, id, ret);
+       }
+
+out:
+       return NULL;
+}
+
+struct packet *provider_buffer_pd_access_hl_prev(pid_t pid, int handle, const struct packet *packet)
+{
+       const char *pkgname;
+       const char *id;
+       double timestamp;
+       int ret;
+       int x;
+       int y;
+       struct livebox_buffer *info;
+
+       ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y);
+       if (ret != 5) {
+               ErrPrint("Invalid packet\n");
+               goto out;
+       }
+
+       info = provider_buffer_find_buffer(TYPE_PD, pkgname, id);
+       if (!info) {
+               ErrPrint("Failed to find a buffer [%s:%s]\n", pkgname, id);
+               goto out;
+       }
+
+       if (info->handler) {
+               int w;
+               int h;
+
+               if (provider_buffer_get_size(info, &w, &h, NULL) < 0)
+                       ErrPrint("Failed to get buffer size[%s:%s]\n", pkgname, id);
+
+               ret = info->handler(info, BUFFER_EVENT_HIGHLIGHT_PREV, timestamp, (double)x / (double)w, (double)y / (double)h, info->data);
+               if (ret < 0)
+                       (void)provider_send_access_status(pkgname, id, LB_ACCESS_STATUS_ERROR);
+               else
+                       (void)provider_send_access_status(pkgname, id, ret);
+       }
+
+out:
+       return NULL;
+}
+
+struct packet *provider_buffer_pd_access_hl_next(pid_t pid, int handle, const struct packet *packet)
+{
+       const char *pkgname;
+       const char *id;
+       double timestamp;
+       int ret;
+       int x;
+       int y;
+       struct livebox_buffer *info;
+
+       ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y);
+       if (ret != 5) {
+               ErrPrint("Invalid packet\n");
+               goto out;
+       }
+
+       info = provider_buffer_find_buffer(TYPE_PD, pkgname, id);
+       if (!info) {
+               ErrPrint("Failed to find a buffer [%s:%s]\n", pkgname, id);
+               goto out;
+       }
+
+       if (info->handler) {
+               int w;
+               int h;
+
+               if (provider_buffer_get_size(info, &w, &h, NULL) < 0)
+                       ErrPrint("Failed to get buffer size[%s:%s]\n", pkgname, id);
+
+               ret = info->handler(info, BUFFER_EVENT_HIGHLIGHT_NEXT, timestamp, (double)x / (double)w, (double)y / (double)h, info->data);
+               if (ret < 0)
+                       (void)provider_send_access_status(pkgname, id, LB_ACCESS_STATUS_ERROR);
+               else
+                       (void)provider_send_access_status(pkgname, id, ret);
+       }
+
+out:
+       return NULL;
+}
+
+struct packet *provider_buffer_pd_access_activate(pid_t pid, int handle, const struct packet *packet)
+{
+       const char *pkgname;
+       const char *id;
+       double timestamp;
+       int ret;
+       int x;
+       int y;
+       struct livebox_buffer *info;
+
+       ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y);
+       if (ret != 5) {
+               ErrPrint("Invalid packet\n");
+               goto out;
+       }
+
+       info = provider_buffer_find_buffer(TYPE_PD, pkgname, id);
+       if (!info) {
+               ErrPrint("Failed to find a buffer [%s:%s]\n", pkgname, id);
+               goto out;
+       }
+
+       if (info->handler) {
+               int w;
+               int h;
+
+               if (provider_buffer_get_size(info, &w, &h, NULL) < 0)
+                       ErrPrint("Failed to get buffer size[%s:%s]\n", pkgname, id);
+
+               ret = info->handler(info, BUFFER_EVENT_ACTIVATE, timestamp, (double)x / (double)w, (double)y / (double)h, info->data);
+               if (ret < 0)
+                       (void)provider_send_access_status(pkgname, id, LB_ACCESS_STATUS_ERROR);
+               else
+                       (void)provider_send_access_status(pkgname, id, ret);
+       }
+
+out:
+       return NULL;
+}
+
+struct packet *provider_buffer_lb_access_unhighlight(pid_t pid, int handle, const struct packet *packet)
+{
+       const char *pkgname;
+       const char *id;
+       double timestamp;
+       int ret;
+       int x;
+       int y;
+       struct livebox_buffer *info;
+
+       ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y);
+       if (ret != 5) {
+               ErrPrint("Invalid packet\n");
+               goto out;
+       }
+
+       info = provider_buffer_find_buffer(TYPE_LB, pkgname, id);
+       if (!info) {
+               ErrPrint("Failed to find a buffer [%s:%s]\n", pkgname, id);
+               goto out;
+       }
+
+       if (info->handler) {
+               int w;
+               int h;
+
+               if (provider_buffer_get_size(info, &w, &h, NULL) < 0)
+                       ErrPrint("Failed to get buffer size[%s:%s]\n", pkgname, id);
+
+               ret = info->handler(info, BUFFER_EVENT_UNHIGHLIGHT, timestamp, (double)x / (double)w, (double)y / (double)h, info->data);
+               if (ret < 0)
+                       (void)provider_send_access_status(pkgname, id, LB_ACCESS_STATUS_ERROR);
+               else
+                       (void)provider_send_access_status(pkgname, id, ret);
+       }
+
+out:
+       return NULL;
+}
+
+struct packet *provider_buffer_lb_access_hl(pid_t pid, int handle, const struct packet *packet)
+{
+       const char *pkgname;
+       const char *id;
+       double timestamp;
+       int ret;
+       int x;
+       int y;
+       struct livebox_buffer *info;
+
+       ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y);
+       if (ret != 5) {
+               ErrPrint("Invalid packet\n");
+               goto out;
+       }
+
+       info = provider_buffer_find_buffer(TYPE_LB, pkgname, id);
+       if (!info) {
+               ErrPrint("Failed to find a buffer [%s:%s]\n", pkgname, id);
+               goto out;
+       }
+
+       if (info->handler) {
+               int w;
+               int h;
+
+               if (provider_buffer_get_size(info, &w, &h, NULL) < 0)
+                       ErrPrint("Failed to get buffer size[%s:%s]\n", pkgname, id);
+
+               ret = info->handler(info, BUFFER_EVENT_HIGHLIGHT, timestamp, (double)x / (double)w, (double)y / (double)h, info->data);
+               if (ret < 0)
+                       (void)provider_send_access_status(pkgname, id, LB_ACCESS_STATUS_ERROR);
+               else
+                       (void)provider_send_access_status(pkgname, id, ret);
+       }
+
+out:
+       return NULL;
+}
+
+struct packet *provider_buffer_lb_access_hl_prev(pid_t pid, int handle, const struct packet *packet)
+{
+       const char *pkgname;
+       const char *id;
+       double timestamp;
+       int ret;
+       int x;
+       int y;
+       struct livebox_buffer *info;
+
+       ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y);
+       if (ret != 5) {
+               ErrPrint("Invalid packet\n");
+               goto out;
+       }
+
+       info = provider_buffer_find_buffer(TYPE_LB, pkgname, id);
+       if (!info) {
+               ErrPrint("Failed to find a buffer [%s:%s]\n", pkgname, id);
+               goto out;
+       }
+
+       if (info->handler) {
+               int w;
+               int h;
+
+               if (provider_buffer_get_size(info, &w, &h, NULL) < 0)
+                       ErrPrint("Failed to get buffer size[%s:%s]\n", pkgname, id);
+
+               ret = info->handler(info, BUFFER_EVENT_HIGHLIGHT_PREV, timestamp, (double)x / (double)w, (double)y / (double)h, info->data);
+               if (ret < 0)
+                       (void)provider_send_access_status(pkgname, id, LB_ACCESS_STATUS_ERROR);
+               else
+                       (void)provider_send_access_status(pkgname, id, ret);
+       }
+
+out:
+       return NULL;
+}
+
+struct packet *provider_buffer_lb_access_hl_next(pid_t pid, int handle, const struct packet *packet)
+{
+       const char *pkgname;
+       const char *id;
+       double timestamp;
+       int ret;
+       int x;
+       int y;
+       struct livebox_buffer *info;
+
+       ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y);
+       if (ret != 5) {
+               ErrPrint("Invalid packet\n");
+               goto out;
+       }
+
+       info = provider_buffer_find_buffer(TYPE_LB, pkgname, id);
+       if (!info) {
+               ErrPrint("Failed to find a buffer [%s:%s]\n", pkgname, id);
+               goto out;
+       }
+
+       if (info->handler) {
+               int w;
+               int h;
+
+               if (provider_buffer_get_size(info, &w, &h, NULL) < 0)
+                       ErrPrint("Failed to get buffer size[%s:%s]\n", pkgname, id);
+
+               ret = info->handler(info, BUFFER_EVENT_HIGHLIGHT_NEXT, timestamp, (double)x / (double)w, (double)y / (double)h, info->data);
+               if (ret < 0)
+                       (void)provider_send_access_status(pkgname, id, LB_ACCESS_STATUS_ERROR);
+               else
+                       (void)provider_send_access_status(pkgname, id, ret);
+       }
+
+out:
+       return NULL;
+}
+
+struct packet *provider_buffer_lb_access_action_up(pid_t pid, int handle, const struct packet *packet)
+{
+       const char *pkgname;
+       const char *id;
+       double timestamp;
+       int ret;
+       int x;
+       int y;
+       struct livebox_buffer *info;
+
+       ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y);
+       if (ret != 5) {
+               ErrPrint("Invalid packet\n");
+               goto out;
+       }
+
+       info = provider_buffer_find_buffer(TYPE_LB, pkgname, id);
+       if (!info) {
+               ErrPrint("Failed to find a buffer [%s:%s]\n", pkgname, id);
+               goto out;
+       }
+
+       if (info->handler) {
+               int w;
+               int h;
+
+               if (provider_buffer_get_size(info, &w, &h, NULL) < 0)
+                       ErrPrint("Failed to get buffer size[%s:%s]\n", pkgname, id);
+
+               ret = info->handler(info, BUFFER_EVENT_ACTION_UP, timestamp, (double)x / (double)w, (double)y / (double)h, info->data);
+               if (ret < 0)
+                       (void)provider_send_access_status(pkgname, id, LB_ACCESS_STATUS_ERROR);
+               else
+                       (void)provider_send_access_status(pkgname, id, ret);
+       }
+
+out:
+       return NULL;
+}
+
+struct packet *provider_buffer_lb_access_action_down(pid_t pid, int handle, const struct packet *packet)
+{
+       const char *pkgname;
+       const char *id;
+       double timestamp;
+       int ret;
+       int x;
+       int y;
+       struct livebox_buffer *info;
+
+       ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y);
+       if (ret != 5) {
+               ErrPrint("Invalid packet\n");
+               goto out;
+       }
+
+       info = provider_buffer_find_buffer(TYPE_LB, pkgname, id);
+       if (!info) {
+               ErrPrint("Failed to find a buffer [%s:%s]\n", pkgname, id);
+               goto out;
+       }
+
+       if (info->handler) {
+               int w;
+               int h;
+
+               if (provider_buffer_get_size(info, &w, &h, NULL) < 0)
+                       ErrPrint("Failed to get buffer size[%s:%s]\n", pkgname, id);
+
+               ret = info->handler(info, BUFFER_EVENT_ACTION_DOWN, timestamp, (double)x / (double)w, (double)y / (double)h, info->data);
+               if (ret < 0)
+                       (void)provider_send_access_status(pkgname, id, LB_ACCESS_STATUS_ERROR);
+               else
+                       (void)provider_send_access_status(pkgname, id, ret);
+       }
+
+out:
+       return NULL;
+}
+
+struct packet *provider_buffer_lb_access_scroll_down(pid_t pid, int handle, const struct packet *packet)
+{
+       const char *pkgname;
+       const char *id;
+       double timestamp;
+       int ret;
+       int x;
+       int y;
+       struct livebox_buffer *info;
+
+       ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y);
+       if (ret != 5) {
+               ErrPrint("Invalid packet\n");
+               goto out;
+       }
+
+       info = provider_buffer_find_buffer(TYPE_LB, pkgname, id);
+       if (!info) {
+               ErrPrint("Failed to find a buffer [%s:%s]\n", pkgname, id);
+               goto out;
+       }
+
+       if (info->handler) {
+               int w;
+               int h;
+
+               if (provider_buffer_get_size(info, &w, &h, NULL) < 0)
+                       ErrPrint("Failed to get buffer size[%s:%s]\n", pkgname, id);
+
+               ret = info->handler(info, BUFFER_EVENT_SCROLL_DOWN, timestamp, (double)x / (double)w, (double)y / (double)h, info->data);
+               if (ret < 0)
+                       (void)provider_send_access_status(pkgname, id, LB_ACCESS_STATUS_ERROR);
+               else
+                       (void)provider_send_access_status(pkgname, id, ret);
+       }
+
+out:
+       return NULL;
+}
+
+struct packet *provider_buffer_lb_access_scroll_move(pid_t pid, int handle, const struct packet *packet)
+{
+       const char *pkgname;
+       const char *id;
+       double timestamp;
+       int ret;
+       int x;
+       int y;
+       struct livebox_buffer *info;
+
+       ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y);
+       if (ret != 5) {
+               ErrPrint("Invalid packet\n");
+               goto out;
+       }
+
+       info = provider_buffer_find_buffer(TYPE_LB, pkgname, id);
+       if (!info) {
+               ErrPrint("Failed to find a buffer [%s:%s]\n", pkgname, id);
+               goto out;
+       }
+
+       if (info->handler) {
+               int w;
+               int h;
+
+               if (provider_buffer_get_size(info, &w, &h, NULL) < 0)
+                       ErrPrint("Failed to get buffer size[%s:%s]\n", pkgname, id);
+
+               ret = info->handler(info, BUFFER_EVENT_SCROLL_MOVE, timestamp, (double)x / (double)w, (double)y / (double)h, info->data);
+               if (ret < 0)
+                       (void)provider_send_access_status(pkgname, id, LB_ACCESS_STATUS_ERROR);
+               else
+                       (void)provider_send_access_status(pkgname, id, ret);
+       }
+
+out:
+       return NULL;
+}
+
+struct packet *provider_buffer_lb_access_scroll_up(pid_t pid, int handle, const struct packet *packet)
+{
+       const char *pkgname;
+       const char *id;
+       double timestamp;
+       int ret;
+       int x;
+       int y;
+       struct livebox_buffer *info;
+
+       ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y);
+       if (ret != 5) {
+               ErrPrint("Invalid packet\n");
+               goto out;
+       }
+
+       info = provider_buffer_find_buffer(TYPE_LB, pkgname, id);
+       if (!info) {
+               ErrPrint("Failed to find a buffer [%s:%s]\n", pkgname, id);
+               goto out;
+       }
+
+       if (info->handler) {
+               int w;
+               int h;
+
+               if (provider_buffer_get_size(info, &w, &h, NULL) < 0)
+                       ErrPrint("Failed to get buffer size[%s:%s]\n", pkgname, id);
+
+               ret = info->handler(info, BUFFER_EVENT_SCROLL_UP, timestamp, (double)x / (double)w, (double)y / (double)h, info->data);
+               if (ret < 0)
+                       (void)provider_send_access_status(pkgname, id, LB_ACCESS_STATUS_ERROR);
+               else
+                       (void)provider_send_access_status(pkgname, id, ret);
+       }
+
+out:
+       return NULL;
+}
+
+struct packet *provider_buffer_lb_access_activate(pid_t pid, int handle, const struct packet *packet)
+{
+       const char *pkgname;
+       const char *id;
+       double timestamp;
+       int ret;
+       int x;
+       int y;
+       struct livebox_buffer *info;
+
+       ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y);
+       if (ret != 5) {
+               ErrPrint("Invalid packet\n");
+               goto out;
+       }
+
+       info = provider_buffer_find_buffer(TYPE_LB, pkgname, id);
+       if (!info) {
+               ErrPrint("Failed to find a buffer [%s:%s]\n", pkgname, id);
+               goto out;
+       }
+
+       if (info->handler) {
+               int w;
+               int h;
+
+               if (provider_buffer_get_size(info, &w, &h, NULL) < 0)
+                       ErrPrint("Failed to get buffer size[%s:%s]\n", pkgname, id);
+
+               ret = info->handler(info, BUFFER_EVENT_ACTIVATE, timestamp, (double)x / (double)w, (double)y / (double)h, info->data);
+               if (ret < 0)
+                       (void)provider_send_access_status(pkgname, id, LB_ACCESS_STATUS_ERROR);
+               else
+                       (void)provider_send_access_status(pkgname, id, ret);
+       }
+
+out:
+       return NULL;
+}
+
 /* End of a file */
index 0f9f9c7..2a77c44 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Copyright 2013  Samsung Electronics Co., Ltd
  *
- * Licensed under the Flora License, Version 1.0 (the "License");
+ * Licensed under the Flora License, Version 1.1 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
  *