Fix the path-conflict (Add on-hold/on-scroll event path) 79/20179/1
authorSung-jae Park <nicesj.park@samsung.com>
Tue, 29 Apr 2014 07:08:48 +0000 (16:08 +0900)
committerSung-jae Park <nicesj.park@samsung.com>
Tue, 29 Apr 2014 07:08:48 +0000 (16:08 +0900)
Change-Id: I01f5af0bdad51b7910cc3d043902ae7e62d5f46a

packaging/data-provider-master.spec
src/server.c

index a074a49..5374053 100644 (file)
@@ -2,7 +2,7 @@
 
 Name: data-provider-master
 Summary: Master service provider for liveboxes
-Version: 0.41.1
+Version: 0.41.2
 Release: 1
 Group: HomeTF/Livebox
 License: Flora
index d86f3ce..7af6a2c 100644 (file)
@@ -2067,6 +2067,446 @@ out:
        return NULL;
 }
 
+static struct packet *client_lb_mouse_on_scroll(pid_t pid, int handle, const struct packet *packet)
+{
+       struct client_node *client;
+       const char *pkgname;
+       const char *id;
+       int ret;
+       double timestamp;
+       int x;
+       int y;
+       struct inst_info *inst;
+       const struct pkg_info *pkg;
+
+       client = client_find_by_rpc_handle(handle);
+       if (!client) {
+               ErrPrint("Client %d is not exists\n", pid);
+               ret = LB_STATUS_ERROR_NOT_EXIST;
+               goto out;
+       }
+
+       ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y);
+       if (ret != 5) {
+               ErrPrint("Parameter is not matched\n");
+               ret = LB_STATUS_ERROR_INVALID;
+               goto out;
+       }
+
+       ret = validate_request(pkgname, id, &inst, &pkg);
+       if (ret != LB_STATUS_SUCCESS) {
+               goto out;
+       }
+
+       if (package_lb_type(pkg) == LB_TYPE_BUFFER) {
+               ret = forward_lb_event_packet(pkg, inst, packet);
+       } else if (package_lb_type(pkg) == LB_TYPE_SCRIPT) {
+               struct script_info *script;
+
+               script = instance_lb_script(inst);
+               if (!script) {
+                       ret = LB_STATUS_ERROR_FAULT;
+                       goto out;
+               }
+
+               script_handler_update_pointer(script, x, y, -1);
+               script_handler_feed_event(script, LB_SCRIPT_MOUSE_ON_SCROLL, timestamp);
+               ret = 0;
+       } else {
+               ErrPrint("Unsupported package\n");
+               ret = LB_STATUS_ERROR_INVALID;
+       }
+
+out:
+       /*! \note No reply packet */
+       return NULL;
+}
+
+static struct packet *client_lb_mouse_off_scroll(pid_t pid, int handle, const struct packet *packet)
+{
+       struct client_node *client;
+       const char *pkgname;
+       const char *id;
+       int ret;
+       double timestamp;
+       int x;
+       int y;
+       struct inst_info *inst;
+       const struct pkg_info *pkg;
+
+       client = client_find_by_rpc_handle(handle);
+       if (!client) {
+               ErrPrint("Client %d is not exists\n", pid);
+               ret = LB_STATUS_ERROR_NOT_EXIST;
+               goto out;
+       }
+
+       ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y);
+       if (ret != 5) {
+               ErrPrint("Parameter is not matched\n");
+               ret = LB_STATUS_ERROR_INVALID;
+               goto out;
+       }
+
+       ret = validate_request(pkgname, id, &inst, &pkg);
+       if (ret != LB_STATUS_SUCCESS) {
+               goto out;
+       }
+
+       if (package_lb_type(pkg) == LB_TYPE_BUFFER) {
+               ret = forward_lb_event_packet(pkg, inst, packet);
+       } else if (package_lb_type(pkg) == LB_TYPE_SCRIPT) {
+               struct script_info *script;
+
+               script = instance_lb_script(inst);
+               if (!script) {
+                       ret = LB_STATUS_ERROR_FAULT;
+                       goto out;
+               }
+
+               script_handler_update_pointer(script, x, y, -1);
+               script_handler_feed_event(script, LB_SCRIPT_MOUSE_OFF_SCROLL, timestamp);
+               ret = 0;
+       } else {
+               ErrPrint("Unsupported package\n");
+               ret = LB_STATUS_ERROR_INVALID;
+       }
+
+out:
+       /*! \note No reply packet */
+       return NULL;
+}
+
+static struct packet *client_lb_mouse_on_hold(pid_t pid, int handle, const struct packet *packet)
+{
+       struct client_node *client;
+       const char *pkgname;
+       const char *id;
+       int ret;
+       double timestamp;
+       int x;
+       int y;
+       struct inst_info *inst;
+       const struct pkg_info *pkg;
+
+       client = client_find_by_rpc_handle(handle);
+       if (!client) {
+               ErrPrint("Client %d is not exists\n", pid);
+               ret = LB_STATUS_ERROR_NOT_EXIST;
+               goto out;
+       }
+
+       ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y);
+       if (ret != 5) {
+               ErrPrint("Parameter is not matched\n");
+               ret = LB_STATUS_ERROR_INVALID;
+               goto out;
+       }
+
+       ret = validate_request(pkgname, id, &inst, &pkg);
+       if (ret != LB_STATUS_SUCCESS) {
+               goto out;
+       }
+
+       if (package_lb_type(pkg) == LB_TYPE_BUFFER) {
+               ret = forward_lb_event_packet(pkg, inst, packet);
+       } else if (package_lb_type(pkg) == LB_TYPE_SCRIPT) {
+               struct script_info *script;
+
+               script = instance_lb_script(inst);
+               if (!script) {
+                       ret = LB_STATUS_ERROR_FAULT;
+                       goto out;
+               }
+
+               script_handler_update_pointer(script, x, y, -1);
+               script_handler_feed_event(script, LB_SCRIPT_MOUSE_ON_HOLD, timestamp);
+               ret = 0;
+       } else {
+               ErrPrint("Unsupported package\n");
+               ret = LB_STATUS_ERROR_INVALID;
+       }
+
+out:
+       /*! \note No reply packet */
+       return NULL;
+}
+
+static struct packet *client_lb_mouse_off_hold(pid_t pid, int handle, const struct packet *packet)
+{
+       struct client_node *client;
+       const char *pkgname;
+       const char *id;
+       int ret;
+       double timestamp;
+       int x;
+       int y;
+       struct inst_info *inst;
+       const struct pkg_info *pkg;
+
+       client = client_find_by_rpc_handle(handle);
+       if (!client) {
+               ErrPrint("Client %d is not exists\n", pid);
+               ret = LB_STATUS_ERROR_NOT_EXIST;
+               goto out;
+       }
+
+       ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y);
+       if (ret != 5) {
+               ErrPrint("Parameter is not matched\n");
+               ret = LB_STATUS_ERROR_INVALID;
+               goto out;
+       }
+
+       ret = validate_request(pkgname, id, &inst, &pkg);
+       if (ret != LB_STATUS_SUCCESS) {
+               goto out;
+       }
+
+       if (package_lb_type(pkg) == LB_TYPE_BUFFER) {
+               ret = forward_lb_event_packet(pkg, inst, packet);
+       } else if (package_lb_type(pkg) == LB_TYPE_SCRIPT) {
+               struct script_info *script;
+
+               script = instance_lb_script(inst);
+               if (!script) {
+                       ret = LB_STATUS_ERROR_FAULT;
+                       goto out;
+               }
+
+               script_handler_update_pointer(script, x, y, -1);
+               script_handler_feed_event(script, LB_SCRIPT_MOUSE_OFF_HOLD, timestamp);
+               ret = 0;
+       } else {
+               ErrPrint("Unsupported package\n");
+               ret = LB_STATUS_ERROR_INVALID;
+       }
+
+out:
+       /*! \note No reply packet */
+       return NULL;
+}
+
+static struct packet *client_pd_mouse_on_scroll(pid_t pid, int handle, const struct packet *packet)
+{
+       struct client_node *client;
+       const char *pkgname;
+       const char *id;
+       int ret;
+       double timestamp;
+       int x;
+       int y;
+       struct inst_info *inst;
+       const struct pkg_info *pkg;
+
+       client = client_find_by_rpc_handle(handle);
+       if (!client) {
+               ErrPrint("Client %d is not exists\n", pid);
+               ret = LB_STATUS_ERROR_NOT_EXIST;
+               goto out;
+       }
+
+       ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y);
+       if (ret != 5) {
+               ErrPrint("Parameter is not matched\n");
+               ret = LB_STATUS_ERROR_INVALID;
+               goto out;
+       }
+
+       ret = validate_request(pkgname, id, &inst, &pkg);
+       if (ret != LB_STATUS_SUCCESS) {
+               goto out;
+       }
+
+       if (package_pd_type(pkg) == PD_TYPE_BUFFER) {
+               ret = forward_pd_event_packet(pkg, inst, packet);
+       } else if (package_pd_type(pkg) == PD_TYPE_SCRIPT) {
+               struct script_info *script;
+
+               script = instance_pd_script(inst);
+               if (!script) {
+                       ret = LB_STATUS_ERROR_FAULT;
+                       goto out;
+               }
+
+               script_handler_update_pointer(script, x, y, -1);
+               script_handler_feed_event(script, LB_SCRIPT_MOUSE_ON_SCROLL, timestamp);
+               ret = 0;
+       } else {
+               ErrPrint("Unsupported package\n");
+               ret = LB_STATUS_ERROR_INVALID;
+       }
+
+out:
+       /*! \note No reply packet */
+       return NULL;
+}
+
+static struct packet *client_pd_mouse_off_scroll(pid_t pid, int handle, const struct packet *packet)
+{
+       struct client_node *client;
+       const char *pkgname;
+       const char *id;
+       int ret;
+       double timestamp;
+       int x;
+       int y;
+       struct inst_info *inst;
+       const struct pkg_info *pkg;
+
+       client = client_find_by_rpc_handle(handle);
+       if (!client) {
+               ErrPrint("Client %d is not exists\n", pid);
+               ret = LB_STATUS_ERROR_NOT_EXIST;
+               goto out;
+       }
+
+       ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y);
+       if (ret != 5) {
+               ErrPrint("Parameter is not matched\n");
+               ret = LB_STATUS_ERROR_INVALID;
+               goto out;
+       }
+
+       ret = validate_request(pkgname, id, &inst, &pkg);
+       if (ret != LB_STATUS_SUCCESS) {
+               goto out;
+       }
+
+       if (package_pd_type(pkg) == PD_TYPE_BUFFER) {
+               ret = forward_pd_event_packet(pkg, inst, packet);
+       } else if (package_pd_type(pkg) == PD_TYPE_SCRIPT) {
+               struct script_info *script;
+
+               script = instance_pd_script(inst);
+               if (!script) {
+                       ret = LB_STATUS_ERROR_FAULT;
+                       goto out;
+               }
+
+               script_handler_update_pointer(script, x, y, -1);
+               script_handler_feed_event(script, LB_SCRIPT_MOUSE_OFF_SCROLL, timestamp);
+               ret = 0;
+       } else {
+               ErrPrint("Unsupported package\n");
+               ret = LB_STATUS_ERROR_INVALID;
+       }
+
+out:
+       /*! \note No reply packet */
+       return NULL;
+}
+
+static struct packet *client_pd_mouse_on_hold(pid_t pid, int handle, const struct packet *packet)
+{
+       struct client_node *client;
+       const char *pkgname;
+       const char *id;
+       int ret;
+       double timestamp;
+       int x;
+       int y;
+       struct inst_info *inst;
+       const struct pkg_info *pkg;
+
+       client = client_find_by_rpc_handle(handle);
+       if (!client) {
+               ErrPrint("Client %d is not exists\n", pid);
+               ret = LB_STATUS_ERROR_NOT_EXIST;
+               goto out;
+       }
+
+       ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y);
+       if (ret != 5) {
+               ErrPrint("Parameter is not matched\n");
+               ret = LB_STATUS_ERROR_INVALID;
+               goto out;
+       }
+
+       ret = validate_request(pkgname, id, &inst, &pkg);
+       if (ret != LB_STATUS_SUCCESS) {
+               goto out;
+       }
+
+       if (package_pd_type(pkg) == PD_TYPE_BUFFER) {
+               ret = forward_pd_event_packet(pkg, inst, packet);
+       } else if (package_pd_type(pkg) == PD_TYPE_SCRIPT) {
+               struct script_info *script;
+
+               script = instance_pd_script(inst);
+               if (!script) {
+                       ret = LB_STATUS_ERROR_FAULT;
+                       goto out;
+               }
+
+               script_handler_update_pointer(script, x, y, -1);
+               script_handler_feed_event(script, LB_SCRIPT_MOUSE_ON_HOLD, timestamp);
+               ret = 0;
+       } else {
+               ErrPrint("Unsupported package\n");
+               ret = LB_STATUS_ERROR_INVALID;
+       }
+
+out:
+       /*! \note No reply packet */
+       return NULL;
+}
+
+static struct packet *client_pd_mouse_off_hold(pid_t pid, int handle, const struct packet *packet)
+{
+       struct client_node *client;
+       const char *pkgname;
+       const char *id;
+       int ret;
+       double timestamp;
+       int x;
+       int y;
+       struct inst_info *inst;
+       const struct pkg_info *pkg;
+
+       client = client_find_by_rpc_handle(handle);
+       if (!client) {
+               ErrPrint("Client %d is not exists\n", pid);
+               ret = LB_STATUS_ERROR_NOT_EXIST;
+               goto out;
+       }
+
+       ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y);
+       if (ret != 5) {
+               ErrPrint("Parameter is not matched\n");
+               ret = LB_STATUS_ERROR_INVALID;
+               goto out;
+       }
+
+       ret = validate_request(pkgname, id, &inst, &pkg);
+       if (ret != LB_STATUS_SUCCESS) {
+               goto out;
+       }
+
+       if (package_pd_type(pkg) == PD_TYPE_BUFFER) {
+               ret = forward_pd_event_packet(pkg, inst, packet);
+       } else if (package_pd_type(pkg) == PD_TYPE_SCRIPT) {
+               struct script_info *script;
+
+               script = instance_pd_script(inst);
+               if (!script) {
+                       ret = LB_STATUS_ERROR_FAULT;
+                       goto out;
+               }
+
+               script_handler_update_pointer(script, x, y, -1);
+               script_handler_feed_event(script, LB_SCRIPT_MOUSE_OFF_HOLD, timestamp);
+               ret = 0;
+       } else {
+               ErrPrint("Unsupported package\n");
+               ret = LB_STATUS_ERROR_INVALID;
+       }
+
+out:
+       /*! \note No reply packet */
+       return NULL;
+}
+
 static struct packet *client_pd_mouse_unset(pid_t pid, int handle, const struct packet *packet)
 {
        struct client_node *client;
@@ -7616,6 +8056,38 @@ static struct method s_client_table[] = {
                .handler = client_pd_mouse_unset,
        },
        {
+               .cmd = "lb_mouse_on_scroll",
+               .handler = client_lb_mouse_on_scroll,
+       },
+       {
+               .cmd = "lb_mouse_off_scroll",
+               .handler = client_lb_mouse_off_scroll,
+       },
+       {
+               .cmd = "pd_mouse_on_scroll",
+               .handler = client_pd_mouse_on_scroll,
+       },
+       {
+               .cmd = "pd_mouse_off_scroll",
+               .handler = client_pd_mouse_off_scroll,
+       },
+       {
+               .cmd = "lb_mouse_on_hold",
+               .handler = client_lb_mouse_on_hold,
+       },
+       {
+               .cmd = "lb_mouse_off_hold",
+               .handler = client_lb_mouse_off_hold,
+       },
+       {
+               .cmd = "pd_mouse_on_hold",
+               .handler = client_pd_mouse_on_hold,
+       },
+       {
+               .cmd = "pd_mouse_off_hold",
+               .handler = client_pd_mouse_off_hold,
+       },
+       {
                .cmd = "change,visibility",
                .handler = client_change_visibility,
        },