Handling the extra buffer updated event
authorSung-jae Park <nicesj.park@samsung.com>
Tue, 28 Oct 2014 08:39:05 +0000 (17:39 +0900)
committerSung-jae Park <nicesj.park@samsung.com>
Tue, 28 Oct 2014 08:39:05 +0000 (17:39 +0900)
[model] Redwood,Kiran,B3(Wearable)
[binary_type] AP
[customer] Docomo/Orange/ATT/Open
[issue#] N/A
[problem]
[cause]
[solution]
[team] HomeTF
[request]
[horizontal_expansion]

Change-Id: I537ff895167e586e5f28478b10cc39936717df88

include/instance.h
src/instance.c
src/server.c

index 25e0d3f..781b7a8 100644 (file)
@@ -219,6 +219,7 @@ extern int instance_gbar_update_end(struct inst_info *inst);
 extern void instance_gbar_updated(const char *pkgname, const char *id, const char *descfile, int x, int y, int w, int h);
 extern void instance_dbox_updated_by_instance(struct inst_info *inst, const char *safe_file, int x, int y, int w, int h);
 extern void instance_gbar_updated_by_instance(struct inst_info *inst, const char *descfile, int x, int y, int w, int h);
+extern void instance_extra_updated_by_instance(struct inst_info *inst, int is_gbar, int idx, int x, int y, int w, int h);
 extern void instance_extra_info_updated_by_instance(struct inst_info *inst);
 
 /*!
index 4ba4851..803c9b5 100644 (file)
@@ -1934,6 +1934,51 @@ HAPI void instance_extra_info_updated_by_instance(struct inst_info *inst)
        (void)CLIENT_SEND_EVENT(inst, packet);
 }
 
+HAPI void instance_extra_updated_by_instance(struct inst_info *inst, int is_gbar, int idx, int x, int y, int w, int h)
+{
+       struct packet *packet;
+       enum dynamicbox_dbox_type dbox_type;
+       unsigned int cmd = CMD_EXTRA_UPDATED;
+
+       if (idx < 0 || idx > DYNAMICBOX_CONF_EXTRA_BUFFER_COUNT) {
+           ErrPrint("Invalid index\n");
+           return;
+       }
+
+       if (is_gbar == 0) {
+           if (!inst->dbox.extra_buffer || inst->dbox.extra_buffer[idx] == 0u) {
+               ErrPrint("Invalid extra buffer\n");
+               return;
+           }
+       } else {
+           if (!inst->gbar.extra_buffer || inst->gbar.extra_buffer[idx] == 0u) {
+               ErrPrint("Invalid extra buffer\n");
+               return;
+           }
+       }
+
+       if (inst->client && inst->visible != DBOX_SHOW) {
+               if (inst->visible == DBOX_HIDE) {
+                       DbgPrint("Ignore update event %s(HIDE)\n", inst->id);
+                       return;
+               }
+       }
+
+       dbox_type = package_dbox_type(inst->info);
+       if (dbox_type != DBOX_TYPE_BUFFER) {
+               ErrPrint("Unsupported type\n");
+               return;
+       }
+
+       packet = packet_create_noack((const char *)&cmd, "ssiiiiii", package_name(inst->info), inst->id, is_gbar, idx, x, y, w, h);
+       if (!packet) {
+               ErrPrint("Failed to create param (%s - %s)\n", package_name(inst->info), inst->id);
+               return;
+       }
+
+       (void)CLIENT_SEND_EVENT(inst, packet);
+}
+
 HAPI void instance_dbox_updated_by_instance(struct inst_info *inst, const char *safe_file, int x, int y, int w, int h)
 {
        struct packet *packet;
index e4df988..11166ab 100644 (file)
@@ -6815,6 +6815,47 @@ out:
        return NULL;
 }
 
+static struct packet *slave_extra_updated(pid_t pid, int handle, const struct packet *packet)
+{
+       struct slave_node *slave;
+       const char *pkgname;
+       const char *id;
+       int idx;
+       int x;
+       int y;
+       int w;
+       int h;
+       int ret;
+       int is_gbar;
+       struct inst_info *inst;
+
+       slave = slave_find_by_pid(pid);
+       if (!slave) {
+               ErrPrint("Slave %d is not exists\n", pid);
+               goto out;
+       }
+
+       ret = packet_get(packet, "ssiiiiii", &pkgname, &id, &is_gbar, &idx, &x, &y, &w, &h);
+       if (ret != 8) {
+               ErrPrint("Parameter is not matched\n");
+               goto out;
+       }
+
+       ret = validate_request(pkgname, id, &inst, NULL);
+       if (ret != DBOX_STATUS_ERROR_NONE) {
+               goto out;
+       }
+
+       if (instance_state(inst) == INST_DESTROYED) {
+               ErrPrint("Package[%s] instance is already destroyed\n", pkgname);
+               goto out;
+       }
+
+       (void)instance_extra_updated_by_instance(inst, is_gbar, idx, x, y, w, h);
+out:
+       return NULL;
+}
+
 static struct packet *slave_desc_updated(pid_t pid, int handle, const struct packet *packet) /* slave_name, pkgname, filename, decsfile, ret */
 {
        struct slave_node *slave;
@@ -8514,6 +8555,10 @@ static struct method s_slave_table[] = {
                .handler = slave_desc_updated, /* slave_name, pkgname, filename, decsfile, ret */
        },
        {
+               .cmd = CMD_STR_EXTRA_UPDATED,
+               .handler = slave_extra_updated,
+       },
+       {
                .cmd = CMD_STR_EXTRA_INFO,
                .handler = slave_extra_info, /* slave_name, pkgname, filename, priority, content_info, title, icon, name */
        },