Update accessibility.
Accessibility event is defined for script type livebox & pd.
Update touch_effect & need_frame.
These attributes should be described for each size type.
Update parser for getting accessibility text
TYPE="access"
is added.
"need_frame" attribute is added
For handling the frame decoration of boxes.
If a box set "true" for this need_frame attribute,
The viewer will draw the border for it.
Active/Passive update mode is added.
Add update_mode.
Active & Passive update mode.
These two words are used for viewer.
If a viewer wants to update the content of boxes without any updated events, it can use the active mode.
or it can update by the updated event.
passive mode is default.
So every viewer will get updated event then they should to update the content of boxes.
Change-Id: I928f5cdf1c99fa428a05e84f5605cdd60724a555
extern void instance_set_lb_info(struct inst_info *inst, int w, int h, double priority, const char *content, const char *title);
extern void instance_set_pd_info(struct inst_info *inst, int w, int h);
-extern void instance_pd_updated(const char *pkgname, const char *id, const char *descfile);
-extern void instance_lb_updated(const char *pkgname, const char *id);
-extern void instance_lb_updated_by_instance(struct inst_info *inst);
-extern void instance_pd_updated_by_instance(struct inst_info *inst, const char *descfile);
-
-extern int instance_client_pd_destroyed(struct inst_info *inst, int status);
-extern int instance_client_pd_created(struct inst_info *inst, int status);
-
extern int instance_set_pinup(struct inst_info *inst, int pinup);
extern int instance_resize(struct inst_info *inst, int w, int h);
extern int instance_hold_scroll(struct inst_info *inst, int seize);
extern int instance_change_group(struct inst_info *inst, const char *cluster, const char *category);
extern int instance_set_visible_state(struct inst_info *inst, enum livebox_visible_state state);
extern enum livebox_visible_state instance_visible_state(struct inst_info *inst);
+extern int instance_set_update_mode(struct inst_info *inst, int active_update);
+extern int instance_active_update(struct inst_info *inst);
/*!
* \note
extern int instance_freeze_updator(struct inst_info *inst);
extern int instance_thaw_updator(struct inst_info *inst);
+extern int instance_send_access_event(struct inst_info *inst, int status);
+
+extern int instance_lb_update_begin(struct inst_info *inst, double priority, const char *content, const char *title);
+extern int instance_lb_update_end(struct inst_info *inst);
+
+extern int instance_pd_update_begin(struct inst_info *inst);
+extern int instance_pd_update_end(struct inst_info *inst);
+
+extern void instance_pd_updated(const char *pkgname, const char *id, const char *descfile);
+extern void instance_lb_updated(const char *pkgname, const char *id);
+extern void instance_lb_updated_by_instance(struct inst_info *inst);
+extern void instance_pd_updated_by_instance(struct inst_info *inst, const char *descfile);
+
+extern int instance_client_pd_destroyed(struct inst_info *inst, int status);
+extern int instance_client_pd_created(struct inst_info *inst, int status);
+
+extern int instance_send_access_status(struct inst_info *inst, int status);
+extern int instance_forward_packet(struct inst_info *inst, struct packet *packet);
+
/*!
* Multiple viewer
*/
extern int script_handler_unload(struct script_info *info, int is_pd);
extern int script_handler_load(struct script_info *info, int is_pd);
extern int script_handler_is_loaded(struct script_info *info);
+extern int script_handler_feed_event(struct script_info *info, int event, double timestamp);
extern int script_init(void);
extern int script_fini(void);
Name: data-provider-master
Summary: Master service provider for liveboxes.
-Version: 0.20.0
+Version: 0.21.0
Release: 1
Group: HomeTF/Livebox
License: Flora License
<setup>org.tizen.nicesj</setup>
- <box type="image" mouse_event="false" touch_effect="true">
- <size preview="ABSPATH">1x1</size>
- <size preview="ABSPATH">2x1</size>
- <size>2x2</size>
+ <box type="image" mouse_event="false">
+ <size touch_effect="true" preview="ABSPATH">1x1</size>
+ <size touch_effect="true" preview="ABSPATH">2x1</size>
+ <size touch_effect="true" need_frame="true">2x2</size>
<size>4x1</size>
- <size>4x2</size>
- <size>4x3</size>
- <size>4x4</size>
+ <size need_frame="true">4x2</size>
+ <size touch_effect="false" need_frame="true">4x3</size>
+ <size touch_effect="false">4x4</size>
<!-- Easy home -->
<size>21x21</size>
*
*
* client
- * +-------+------+---------+-------------+---------+---------+-----------+-------+-------------+--------------+
- * | pkgid | Icon | Name | auto_launch | pd_size | content | nodisplay | setup | mouse_event | touch_effect |
- * +-------+------+---------+-------------+---------+---------+-----------+-------+-------------+--------------+
- * | - | - | - | - | - | - | - | - | - } - |
- * +-------+------+---------+-------------+---------+---------+-----------+-------+-------------+--------------+
- * CREATE TABLE client ( pkgid TEXT PRIMARY KEY NOT NULL, icon TEXT, name TEXT, auto_launch TEXT, pd_size TEXT, content TEXT DEFAULT "default", nodisplay INTEGER, setup TEXT, mouse_event INTEGER, touch_effect INTEGER, FOREIGN KEY(pkgid) REFERENCES pkgmap(pkgid) )
+ * +-------+------+---------+-------------+---------+---------+-----------+-------+-------------+
+ * | pkgid | Icon | Name | auto_launch | pd_size | content | nodisplay | setup | mouse_event |
+ * +-------+------+---------+-------------+---------+---------+-----------+-------+-------------+
+ * | - | - | - | - | - | - | - | - | - }
+ * +-------+------+---------+-------------+---------+---------+-----------+-------+-------------+
+ * CREATE TABLE client ( pkgid TEXT PRIMARY KEY NOT NULL, icon TEXT, name TEXT, auto_launch TEXT, pd_size TEXT, content TEXT DEFAULT "default", nodisplay INTEGER, setup TEXT, mouse_event, FOREIGN KEY(pkgid) REFERENCES pkgmap(pkgid) )
*
* = auto_launch = UI-APPID
* = pd_size = WIDTHxHEIGHT
*
*
* box_size
- * +-------+-----------+---------+
- * | pkgid | size_type | preview |
- * +-------+-----------+---------+
- * | - | - | - |
- * +-------+-----------+---------+
- * CREATE TABLE box_size ( pkgid TEXT NOT NULL, size_type INTEGER, preview TEXT, FOREIGN KEY(pkgid) REFERENCES pkgmap(pkgid) )
+ * +-------+-----------+---------+--------------+------------+
+ * | pkgid | size_type | preview | touch_effect | need_frame |
+ * +-------+-----------+---------+--------------+------------+
+ * | - | - | - | - | - |
+ * +-------+-----------+---------+--------------+------------+
+ * CREATE TABLE box_size ( pkgid TEXT NOT NULL, size_type INTEGER, preview TEXT, INTEGER, touch_effect INTEGER, need_frame INTEGER, FOREIGN KEY(pkgid) REFERENCES pkgmap(pkgid) )
*
* = box_size_list = { WIDTHxHEIGHT; WIDTHxHEIGHT; ... }
*
int primary; /* Is this primary livebox? */
int nodisplay;
int mouse_event; /* Mouse event processing option for livebox */
- int touch_effect; /* Touch effect of a livebox */
enum lb_type lb_type;
xmlChar *lb_src;
int size_list; /* 1x1, 2x1, 2x2, 4x1, 4x2, 4x3, 4x4 */
xmlChar *preview[11];
+ int touch_effect[11]; /* Touch effect of a livebox */
+ int need_frame[11]; /* Box needs frame which should be cared by viewer */
enum pd_type pd_type;
xmlChar *pd_src;
ddl = "CREATE TABLE client (" \
"pkgid TEXT PRIMARY KEY NOT NULL, icon TEXT, name TEXT, " \
- "auto_launch TEXT, pd_size TEXT, content TEXT DEFAULT 'default', nodisplay INTEGER, setup TEXT, mouse_event INTEGER, touch_effect INTEGER, FOREIGN KEY(pkgid) REFERENCES pkgmap(pkgid) ON DELETE CASCADE)";
+ "auto_launch TEXT, pd_size TEXT, content TEXT DEFAULT 'default', nodisplay INTEGER, setup TEXT, mouse_event INTEGER, FOREIGN KEY(pkgid) REFERENCES pkgmap(pkgid) ON DELETE CASCADE)";
if (sqlite3_exec(s_info.handle, ddl, NULL, NULL, &err) != SQLITE_OK) {
ErrPrint("Failed to execute the DDL (%s)\n", err);
return -EIO;
int ret;
sqlite3_stmt *stmt;
- dml = "INSERT INTO client ( pkgid, icon, name, auto_launch, pd_size, content, nodisplay, setup, mouse_event, touch_effect ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
+ dml = "INSERT INTO client ( pkgid, icon, name, auto_launch, pd_size, content, nodisplay, setup, mouse_event ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)";
ret = sqlite3_prepare_v2(s_info.handle, dml, -1, &stmt, NULL);
if (ret != SQLITE_OK) {
DbgPrint("Error: %s\n", sqlite3_errmsg(s_info.handle));
goto out;
}
- ret = sqlite3_bind_int(stmt, 10, livebox->touch_effect);
- if (ret != SQLITE_OK) {
- DbgPrint("Error: %s\n", sqlite3_errmsg(s_info.handle));
- ret = -EIO;
- goto out;
- }
-
ret = 0;
if (sqlite3_step(stmt) != SQLITE_DONE) {
DbgPrint("Error: %s\n", sqlite3_errmsg(s_info.handle));
char *err;
static const char *ddl;
- ddl = "CREATE TABLE box_size ( pkgid TEXT NOT NULL, size_type INTEGER, preview TEXT, " \
+ ddl = "CREATE TABLE box_size ( pkgid TEXT NOT NULL, size_type INTEGER, preview TEXT, touch_effect INTEGER, need_frame INTEGER, " \
"FOREIGN KEY(pkgid) REFERENCES pkgmap(pkgid) ON DELETE CASCADE)";
if (sqlite3_exec(s_info.handle, ddl, NULL, NULL, &err) != SQLITE_OK) {
ErrPrint("Failed to execute the DDL (%s)\n", err);
return 0;
}
-static inline int db_insert_box_size(const char *pkgid, int size_type, const char *preview)
+static inline int db_insert_box_size(const char *pkgid, int size_type, const char *preview, int touch_effect, int need_frame)
{
static const char *dml;
int ret;
sqlite3_stmt *stmt;
DbgPrint("box size: %s - %d (%s) is added\n", pkgid, size_type, preview);
- dml = "INSERT INTO box_size ( pkgid, size_type, preview ) VALUES (?, ?, ?)";
+ dml = "INSERT INTO box_size ( pkgid, size_type, preview, touch_effect, need_frame ) VALUES (?, ?, ?, ?, ?)";
ret = sqlite3_prepare_v2(s_info.handle, dml, -1, &stmt, NULL);
if (ret != SQLITE_OK) {
DbgPrint("Error: %s\n", sqlite3_errmsg(s_info.handle));
goto out;
}
+ ret = sqlite3_bind_int(stmt, 4, touch_effect);
+ if (ret != SQLITE_OK) {
+ DbgPrint("Error: %s\n", sqlite3_errmsg(s_info.handle));
+ ret = -EIO;
+ goto out;
+ }
+
+ ret = sqlite3_bind_int(stmt, 5, need_frame);
+ if (ret != SQLITE_OK) {
+ DbgPrint("Error: %s\n", sqlite3_errmsg(s_info.handle));
+ ret = -EIO;
+ goto out;
+ }
+
ret = 0;
if (sqlite3_step(stmt) != SQLITE_DONE) {
DbgPrint("Error: %s\n", sqlite3_errmsg(s_info.handle));
}
}
+static inline void update_size_info(struct livebox *livebox, int idx, xmlNodePtr node)
+{
+ if (xmlHasProp(node, (const xmlChar *)"preview")) {
+ livebox->preview[idx] = xmlGetProp(node, (const xmlChar *)"preview");
+ }
+
+ if (xmlHasProp(node, (const xmlChar *)"need_frame")) {
+ xmlChar *need_frame;
+
+ need_frame = xmlGetProp(node, (const xmlChar *)"need_frame");
+ if (need_frame) {
+ livebox->need_frame[idx] = !xmlStrcasecmp(need_frame, (const xmlChar *)"true");
+ xmlFree(need_frame);
+ } else {
+ livebox->need_frame[idx] = 0;
+ }
+ } else {
+ livebox->need_frame[idx] = 0;
+ }
+
+ if (xmlHasProp(node, (const xmlChar *)"touch_effect")) {
+ xmlChar *touch_effect;
+
+ touch_effect = xmlGetProp(node, (const xmlChar *)"touch_effect");
+ if (touch_effect) {
+ livebox->touch_effect[idx] = !xmlStrcasecmp(touch_effect, (const xmlChar *)"true");
+ xmlFree(touch_effect);
+ } else {
+ livebox->touch_effect[idx] = 1;
+ }
+ } else {
+ livebox->touch_effect[idx] = 1;
+ }
+}
+
static inline void update_box(struct livebox *livebox, xmlNodePtr node)
{
if (!xmlHasProp(node, (const xmlChar *)"type")) {
}
}
- if (!xmlHasProp(node, (const xmlChar *)"touch_effect")) {
- livebox->touch_effect = 1;
- } else {
- xmlChar *touch_effect;
- touch_effect = xmlGetProp(node, (const xmlChar *)"touch_effect");
- if (!touch_effect) {
- ErrPrint("touch_effect is NIL\n");
- livebox->touch_effect = 1;
- } else {
- livebox->touch_effect = !xmlStrcasecmp(touch_effect, (const xmlChar *)"true");
- xmlFree(touch_effect);
- }
- }
-
for (node = node->children; node; node = node->next) {
if (!xmlStrcasecmp(node->name, (const xmlChar *)"size")) {
xmlChar *size;
if (!xmlStrcasecmp(size, (const xmlChar *)"1x1")) {
if (is_easy) {
livebox->size_list |= LB_SIZE_TYPE_EASY_1x1;
- if (xmlHasProp(node, (const xmlChar *)"preview")) {
- livebox->preview[7] = xmlGetProp(node, (const xmlChar *)"preview");
- }
+ update_size_info(livebox, 7, node);
} else {
livebox->size_list |= LB_SIZE_TYPE_1x1;
- if (xmlHasProp(node, (const xmlChar *)"preview")) {
- livebox->preview[0] = xmlGetProp(node, (const xmlChar *)"preview");
- }
+ update_size_info(livebox, 0, node);
}
} else if (!xmlStrcasecmp(size, (const xmlChar *)"3x1")) {
if (is_easy) {
livebox->size_list |= LB_SIZE_TYPE_EASY_3x1;
- if (xmlHasProp(node, (const xmlChar *)"preview")) {
- livebox->preview[8] = xmlGetProp(node, (const xmlChar *)"preview");
- }
+ update_size_info(livebox, 8, node);
} else {
ErrPrint("Invalid size tag (%s)\n", size);
}
} else if (!xmlStrcasecmp(size, (const xmlChar *)"3x3")) {
if (is_easy) {
livebox->size_list |= LB_SIZE_TYPE_EASY_3x3;
- if (xmlHasProp(node, (const xmlChar *)"preview")) {
- livebox->preview[9] = xmlGetProp(node, (const xmlChar *)"preview");
- }
+ update_size_info(livebox, 9, node);
} else {
ErrPrint("Invalid size tag (%s)\n", size);
}
} else if (!xmlStrcasecmp(size, (const xmlChar *)"2x1")) {
livebox->size_list |= LB_SIZE_TYPE_2x1;
- if (xmlHasProp(node, (const xmlChar *)"preview")) {
- livebox->preview[1] = xmlGetProp(node, (const xmlChar *)"preview");
- }
+ update_size_info(livebox, 1, node);
} else if (!xmlStrcasecmp(size, (const xmlChar *)"2x2")) {
livebox->size_list |= LB_SIZE_TYPE_2x2;
- if (xmlHasProp(node, (const xmlChar *)"preview")) {
- livebox->preview[2] = xmlGetProp(node, (const xmlChar *)"preview");
- }
+ update_size_info(livebox, 2, node);
} else if (!xmlStrcasecmp(size, (const xmlChar *)"4x1")) {
livebox->size_list |= LB_SIZE_TYPE_4x1;
- if (xmlHasProp(node, (const xmlChar *)"preview")) {
- livebox->preview[3] = xmlGetProp(node, (const xmlChar *)"preview");
- }
+ update_size_info(livebox, 3, node);
} else if (!xmlStrcasecmp(size, (const xmlChar *)"4x2")) {
livebox->size_list |= LB_SIZE_TYPE_4x2;
- if (xmlHasProp(node, (const xmlChar *)"preview")) {
- livebox->preview[4] = xmlGetProp(node, (const xmlChar *)"preview");
- }
+ update_size_info(livebox, 4, node);
} else if (!xmlStrcasecmp(size, (const xmlChar *)"4x3")) {
livebox->size_list |= LB_SIZE_TYPE_4x3;
- if (xmlHasProp(node, (const xmlChar *)"preview")) {
- livebox->preview[5] = xmlGetProp(node, (const xmlChar *)"preview");
- }
+ update_size_info(livebox, 5, node);
} else if (!xmlStrcasecmp(size, (const xmlChar *)"4x4")) {
livebox->size_list |= LB_SIZE_TYPE_4x4;
- if (xmlHasProp(node, (const xmlChar *)"preview")) {
- livebox->preview[6] = xmlGetProp(node, (const xmlChar *)"preview");
- }
+ update_size_info(livebox, 6, node);
} else if (!xmlStrcasecmp(size, (const xmlChar *)"21x21")) {
livebox->size_list |= LB_SIZE_TYPE_EASY_1x1;
- if (xmlHasProp(node, (const xmlChar *)"preview")) {
- livebox->preview[7] = xmlGetProp(node, (const xmlChar *)"preview");
- }
+ update_size_info(livebox, 7, node);
} else if (!xmlStrcasecmp(size, (const xmlChar *)"23x21")) {
livebox->size_list |= LB_SIZE_TYPE_EASY_3x1;
- if (xmlHasProp(node, (const xmlChar *)"preview")) {
- livebox->preview[8] = xmlGetProp(node, (const xmlChar *)"preview");
- }
+ update_size_info(livebox, 8, node);
} else if (!xmlStrcasecmp(size, (const xmlChar *)"23x23")) {
livebox->size_list |= LB_SIZE_TYPE_EASY_3x3;
- if (xmlHasProp(node, (const xmlChar *)"preview")) {
- livebox->preview[9] = xmlGetProp(node, (const xmlChar *)"preview");
- }
+ update_size_info(livebox, 9, node);
} else if (!xmlStrcasecmp(size, (const xmlChar *)"0x0")) {
livebox->size_list |= LB_SIZE_TYPE_0x0;
- if (xmlHasProp(node, (const xmlChar *)"preview")) {
- livebox->preview[10] = xmlGetProp(node, (const xmlChar *)"preview");
- }
+ update_size_info(livebox, 10, node);
} else {
ErrPrint("Invalid size tag (%s)\n", size);
}
}
if (livebox->size_list & LB_SIZE_TYPE_1x1) {
- ret = db_insert_box_size((char *)livebox->pkgid, LB_SIZE_TYPE_1x1, (char *)livebox->preview[0]);
+ ret = db_insert_box_size((char *)livebox->pkgid, LB_SIZE_TYPE_1x1, (char *)livebox->preview[0], livebox->touch_effect[0], livebox->need_frame[0]);
if (ret < 0)
goto errout;
}
if (livebox->size_list & LB_SIZE_TYPE_2x1) {
- ret = db_insert_box_size((char *)livebox->pkgid, LB_SIZE_TYPE_2x1, (char *)livebox->preview[1]);
+ ret = db_insert_box_size((char *)livebox->pkgid, LB_SIZE_TYPE_2x1, (char *)livebox->preview[1], livebox->touch_effect[1], livebox->need_frame[1]);
if (ret < 0)
goto errout;
}
if (livebox->size_list & LB_SIZE_TYPE_2x2) {
- ret = db_insert_box_size((char *)livebox->pkgid, LB_SIZE_TYPE_2x2, (char *)livebox->preview[2]);
+ ret = db_insert_box_size((char *)livebox->pkgid, LB_SIZE_TYPE_2x2, (char *)livebox->preview[2], livebox->touch_effect[2], livebox->need_frame[2]);
if (ret < 0)
goto errout;
}
if (livebox->size_list & LB_SIZE_TYPE_4x1) {
- ret = db_insert_box_size((char *)livebox->pkgid, LB_SIZE_TYPE_4x1, (char *)livebox->preview[3]);
+ ret = db_insert_box_size((char *)livebox->pkgid, LB_SIZE_TYPE_4x1, (char *)livebox->preview[3], livebox->touch_effect[3], livebox->need_frame[3]);
if (ret < 0)
goto errout;
}
if (livebox->size_list & LB_SIZE_TYPE_4x2) {
- ret = db_insert_box_size((char *)livebox->pkgid, LB_SIZE_TYPE_4x2, (char *)livebox->preview[4]);
+ ret = db_insert_box_size((char *)livebox->pkgid, LB_SIZE_TYPE_4x2, (char *)livebox->preview[4], livebox->touch_effect[4], livebox->need_frame[4]);
if (ret < 0)
goto errout;
}
if (livebox->size_list & LB_SIZE_TYPE_4x3) {
- ret = db_insert_box_size((char *)livebox->pkgid, LB_SIZE_TYPE_4x3, (char *)livebox->preview[5]);
+ ret = db_insert_box_size((char *)livebox->pkgid, LB_SIZE_TYPE_4x3, (char *)livebox->preview[5], livebox->touch_effect[5], livebox->need_frame[5]);
if (ret < 0)
goto errout;
}
if (livebox->size_list & LB_SIZE_TYPE_4x4) {
- ret = db_insert_box_size((char *)livebox->pkgid, LB_SIZE_TYPE_4x4, (char *)livebox->preview[6]);
+ ret = db_insert_box_size((char *)livebox->pkgid, LB_SIZE_TYPE_4x4, (char *)livebox->preview[6], livebox->touch_effect[6], livebox->need_frame[6]);
if (ret < 0)
goto errout;
}
if (livebox->size_list & LB_SIZE_TYPE_EASY_1x1) {
- ret = db_insert_box_size((char *)livebox->pkgid, LB_SIZE_TYPE_EASY_1x1, (char *)livebox->preview[7]);
+ ret = db_insert_box_size((char *)livebox->pkgid, LB_SIZE_TYPE_EASY_1x1, (char *)livebox->preview[7], livebox->touch_effect[7], livebox->need_frame[7]);
if (ret < 0)
goto errout;
}
if (livebox->size_list & LB_SIZE_TYPE_EASY_3x1) {
- ret = db_insert_box_size((char *)livebox->pkgid, LB_SIZE_TYPE_EASY_3x1, (char *)livebox->preview[8]);
+ ret = db_insert_box_size((char *)livebox->pkgid, LB_SIZE_TYPE_EASY_3x1, (char *)livebox->preview[8], livebox->touch_effect[8], livebox->need_frame[8]);
if (ret < 0)
goto errout;
}
if (livebox->size_list & LB_SIZE_TYPE_EASY_3x3) {
- ret = db_insert_box_size((char *)livebox->pkgid, LB_SIZE_TYPE_EASY_3x3, (char *)livebox->preview[9]);
+ ret = db_insert_box_size((char *)livebox->pkgid, LB_SIZE_TYPE_EASY_3x3, (char *)livebox->preview[9], livebox->touch_effect[9], livebox->need_frame[9]);
if (ret < 0)
goto errout;
}
if (livebox->size_list & LB_SIZE_TYPE_0x0) {
- ret = db_insert_box_size((char *)livebox->pkgid, LB_SIZE_TYPE_0x0, (char *)livebox->preview[10]);
+ ret = db_insert_box_size((char *)livebox->pkgid, LB_SIZE_TYPE_0x0, (char *)livebox->preview[10], livebox->touch_effect[10], livebox->need_frame[10]);
if (ret < 0)
goto errout;
}
int h;
};
+struct update_mode_cbdata {
+ struct inst_info *inst;
+ int active_update;
+};
+
struct change_group_cbdata {
struct inst_info *inst;
char *cluster;
char *title;
int is_pinned_up;
double sleep_at;
- int scroll_locked;
+ int scroll_locked; /*!< Scroller which is in viewer is locked. */
+ int active_update; /*!< Viewer will reload the buffer by itself, so the provider doesn't need to send the updated event */
enum livebox_visible_state visible;
return ret;
}
+static inline void instance_send_update_mode_event(struct inst_info *inst, int active_mode, int status)
+{
+ struct packet *packet;
+ const char *pkgname;
+
+ if (!inst->info) {
+ ErrPrint("Instance info is not ready to use\n");
+ return;
+ }
+
+ pkgname = package_name(inst->info);
+
+ packet = packet_create_noack("update_mode", "ssii", pkgname, inst->id, status, active_mode);
+ if (packet)
+ CLIENT_SEND_EVENT(inst, packet);
+ else
+ ErrPrint("Failed to send update mode event\n");
+}
+
static inline void instance_send_resized_event(struct inst_info *inst, int is_pd, int w, int h, int status)
{
struct packet *packet;
ErrPrint("Failed to send size changed event\n");
}
+static void update_mode_cb(struct slave_node *slave, const struct packet *packet, void *data)
+{
+ struct update_mode_cbdata *cbdata = data;
+ int ret;
+
+ if (!packet) {
+ ErrPrint("Invalid packet\n");
+ instance_send_update_mode_event(cbdata->inst, cbdata->active_update, LB_STATUS_ERROR_FAULT);
+ instance_unref(cbdata->inst);
+ DbgFree(cbdata);
+ return;
+ }
+
+ if (packet_get(packet, "i", &ret) != 1) {
+ ErrPrint("Invalid parameters\n");
+ instance_send_update_mode_event(cbdata->inst, cbdata->active_update, LB_STATUS_ERROR_INVALID);
+ instance_unref(cbdata->inst);
+ DbgFree(cbdata);
+ return;
+ }
+
+ if (ret == LB_STATUS_SUCCESS)
+ cbdata->inst->active_update = cbdata->active_update;
+
+ instance_send_update_mode_event(cbdata->inst, cbdata->active_update, ret);
+
+ instance_unref(cbdata->inst);
+ DbgFree(cbdata);
+}
+
HAPI int instance_unicast_created_event(struct inst_info *inst, struct client_node *client)
{
struct packet *packet;
break;
}
- packet = packet_create("renew", "sssiidssiis",
+ packet = packet_create("renew", "sssiidssiisii",
package_name(inst->info),
inst->id,
inst->content,
inst->cluster,
inst->category,
inst->lb.width, inst->lb.height,
- package_abi(inst->info));
+ package_abi(inst->info),
+ inst->scroll_locked,
+ inst->active_update);
if (!packet) {
ErrPrint("Failed to build a packet for %s\n", package_name(inst->info));
return LB_STATUS_ERROR_FAULT;
return slave_rpc_async_request(package_slave(inst->info), package_name(inst->info), packet, activate_cb, instance_ref(inst), 1);
}
+HAPI int instance_lb_update_begin(struct inst_info *inst, double priority, const char *content, const char *title)
+{
+ struct packet *packet;
+ const char *fbfile;
+
+ if (!inst->active_update) {
+ ErrPrint("Invalid request [%s]\n", inst->id);
+ return LB_STATUS_ERROR_INVALID;
+ }
+
+ switch (package_lb_type(inst->info)) {
+ case LB_TYPE_BUFFER:
+ if (!inst->lb.canvas.buffer) {
+ ErrPrint("Buffer is null [%s]\n", inst->id);
+ return LB_STATUS_ERROR_INVALID;
+ }
+ fbfile = buffer_handler_id(inst->lb.canvas.buffer);
+ break;
+ case LB_TYPE_SCRIPT:
+ if (!inst->lb.canvas.script) {
+ ErrPrint("Script is null [%s]\n", inst->id);
+ return LB_STATUS_ERROR_INVALID;
+ }
+ fbfile = fb_id(script_handler_fb(inst->lb.canvas.script));
+ break;
+ default:
+ ErrPrint("Invalid request[%s]\n", inst->id);
+ return LB_STATUS_ERROR_INVALID;
+ }
+
+ packet = packet_create_noack("lb_update_begin", "ssdsss", package_name(inst->info), inst->id, priority, content, title, fbfile);
+ if (!packet) {
+ ErrPrint("Unable to create a packet\n");
+ return LB_STATUS_ERROR_FAULT;
+ }
+
+ return CLIENT_SEND_EVENT(inst, packet);
+}
+
+HAPI int instance_lb_update_end(struct inst_info *inst)
+{
+ struct packet *packet;
+
+ if (!inst->active_update) {
+ ErrPrint("Invalid request [%s]\n", inst->id);
+ return LB_STATUS_ERROR_INVALID;
+ }
+
+ switch (package_lb_type(inst->info)) {
+ case LB_TYPE_BUFFER:
+ if (!inst->lb.canvas.buffer) {
+ ErrPrint("Buffer is null [%s]\n", inst->id);
+ return LB_STATUS_ERROR_INVALID;
+ }
+ break;
+ case LB_TYPE_SCRIPT:
+ if (!inst->lb.canvas.script) {
+ ErrPrint("Script is null [%s]\n", inst->id);
+ return LB_STATUS_ERROR_INVALID;
+ }
+ break;
+ default:
+ ErrPrint("Invalid request[%s]\n", inst->id);
+ return LB_STATUS_ERROR_INVALID;
+ }
+
+ packet = packet_create_noack("lb_update_end", "ss", package_name(inst->info), inst->id);
+ if (!packet) {
+ ErrPrint("Unable to create a packet\n");
+ return LB_STATUS_ERROR_FAULT;
+ }
+
+ return CLIENT_SEND_EVENT(inst, packet);
+}
+
+HAPI int instance_pd_update_begin(struct inst_info *inst)
+{
+ struct packet *packet;
+ const char *fbfile;
+
+ if (!inst->active_update) {
+ ErrPrint("Invalid request [%s]\n", inst->id);
+ return LB_STATUS_ERROR_INVALID;
+ }
+
+ switch (package_pd_type(inst->info)) {
+ case PD_TYPE_BUFFER:
+ if (!inst->pd.canvas.buffer) {
+ ErrPrint("Buffer is null [%s]\n", inst->id);
+ return LB_STATUS_ERROR_INVALID;
+ }
+ fbfile = buffer_handler_id(inst->pd.canvas.buffer);
+ break;
+ case PD_TYPE_SCRIPT:
+ if (!inst->pd.canvas.script) {
+ ErrPrint("Script is null [%s]\n", inst->id);
+ return LB_STATUS_ERROR_INVALID;
+ }
+ fbfile = fb_id(script_handler_fb(inst->pd.canvas.script));
+ break;
+ default:
+ ErrPrint("Invalid request[%s]\n", inst->id);
+ return LB_STATUS_ERROR_INVALID;
+ }
+
+ packet = packet_create_noack("pd_update_begin", "sss", package_name(inst->info), inst->id, fbfile);
+ if (!packet) {
+ ErrPrint("Unable to create a packet\n");
+ return LB_STATUS_ERROR_FAULT;
+ }
+
+ return CLIENT_SEND_EVENT(inst, packet);
+}
+
+HAPI int instance_pd_update_end(struct inst_info *inst)
+{
+ struct packet *packet;
+
+ if (!inst->active_update) {
+ ErrPrint("Invalid request [%s]\n", inst->id);
+ return LB_STATUS_ERROR_INVALID;
+ }
+
+ switch (package_pd_type(inst->info)) {
+ case PD_TYPE_BUFFER:
+ if (!inst->pd.canvas.buffer) {
+ ErrPrint("Buffer is null [%s]\n", inst->id);
+ return LB_STATUS_ERROR_INVALID;
+ }
+ break;
+ case PD_TYPE_SCRIPT:
+ if (!inst->pd.canvas.script) {
+ ErrPrint("Script is null [%s]\n", inst->id);
+ return LB_STATUS_ERROR_INVALID;
+ }
+ break;
+ default:
+ ErrPrint("Invalid request[%s]\n", inst->id);
+ return LB_STATUS_ERROR_INVALID;
+ }
+
+ packet = packet_create_noack("pd_update_end", "ss", package_name(inst->info), inst->id);
+ if (!packet) {
+ ErrPrint("Unable to create a packet\n");
+ return LB_STATUS_ERROR_FAULT;
+ }
+
+ return CLIENT_SEND_EVENT(inst, packet);
+}
+
HAPI void instance_lb_updated(const char *pkgname, const char *id)
{
struct inst_info *inst;
struct packet *packet;
if (inst->scroll_locked == hold) {
- DbgPrint("There is changes for hold state: %d\n", hold);
+ DbgPrint("[HOLD] There is changes for hold state: %d\n", hold);
return LB_STATUS_ERROR_ALREADY;
}
packet = packet_create_noack("scroll", "ssi", package_name(inst->info), inst->id, hold);
if (!packet) {
- ErrPrint("Failed to build a packet\n");
+ ErrPrint("[HOLD] Failed to build a packet\n");
return LB_STATUS_ERROR_FAULT;
}
+ DbgPrint("[HOLD] (%s) %d\n", inst->id, hold);
inst->scroll_locked = hold;
return CLIENT_SEND_EVENT(inst, packet);
}
instance_pd_updated_by_instance(inst, descfile);
}
+HAPI int instance_set_update_mode(struct inst_info *inst, int active_update)
+{
+ struct packet *packet;
+ struct update_mode_cbdata *cbdata;
+
+ if (package_is_fault(inst->info)) {
+ DbgPrint("Fault package [%s]\n", package_name(inst->info));
+ return LB_STATUS_ERROR_FAULT;
+ }
+
+ if (inst->active_update == active_update) {
+ DbgPrint("Active update is not changed: %d\n", inst->active_update);
+ return LB_STATUS_ERROR_ALREADY;
+ }
+
+ cbdata = malloc(sizeof(*cbdata));
+ if (!cbdata) {
+ ErrPrint("Heap: %s\n", strerror(errno));
+ return LB_STATUS_ERROR_MEMORY;
+ }
+
+ cbdata->inst = instance_ref(inst);
+ cbdata->active_update = active_update;
+
+ /* NOTE: param is resued from here */
+ packet = packet_create("update_mode", "ssi", package_name(inst->info), inst->id, active_update);
+ if (!packet) {
+ ErrPrint("Failed to build a packet for %s\n", package_name(inst->info));
+ instance_unref(cbdata->inst);
+ free(cbdata);
+ return LB_STATUS_ERROR_FAULT;
+ }
+
+ return slave_rpc_async_request(package_slave(inst->info), package_name(inst->info), packet, update_mode_cb, cbdata, 0);
+}
+
+HAPI int instance_active_update(struct inst_info *inst)
+{
+ return inst->active_update;
+}
+
HAPI void instance_set_lb_info(struct inst_info *inst, int w, int h, double priority, const char *content, const char *title)
{
char *_content = NULL;
return ret;
}
+HAPI int instance_forward_packet(struct inst_info *inst, struct packet *packet)
+{
+ return CLIENT_SEND_EVENT(inst, packet);
+}
+
+HAPI int instance_send_access_status(struct inst_info *inst, int status)
+{
+ struct packet *packet;
+
+ packet = packet_create_noack("access_status", "ssi", package_name(inst->info), inst->id, status);
+ if (!packet) {
+ ErrPrint("Failed to build a packet\n");
+ return LB_STATUS_ERROR_FAULT;
+ }
+
+ return CLIENT_SEND_EVENT(inst, packet);
+}
+
HAPI void instance_slave_set_pd_pos(struct inst_info *inst, double x, double y)
{
inst->pd.x = x;
#define TYPE_SIGNAL "signal"
#define TYPE_INFO "info"
#define TYPE_DRAG "drag"
+#define TYPE_ACCESS "access"
+
#define INFO_SIZE "size"
#define INFO_CATEGORY "category"
#define ADDEND 256
int (*update_color)(void *handle, Evas *e, const char *id, const char *part, const char *rgba);
int (*update_text)(void *handle, Evas *e, const char *id, const char *part, const char *text);
int (*update_image)(void *handle, Evas *e, const char *id, const char *part, const char *path, const char *option);
+ int (*update_access)(void *handle, Evas *e, const char *id, const char *part, const char *text, const char *option);
int (*update_script)(void *handle, Evas *e, const char *src_id, const char *target_id, const char *part, const char *path, const char *option);
int (*update_signal)(void *handle, Evas *e, const char *id, const char *part, const char *signal);
int (*update_drag)(void *handle, Evas *e, const char *id, const char *part, double x, double y);
int (*update_size)(void *handle, Evas *e, const char *id, int w, int h);
int (*update_category)(void *handle, Evas *e, const char *id, const char *category);
+ int (*feed_event)(void *handle, Evas *e, int event_type, int x, int y, double timestamp);
void *(*create)(const char *file, const char *option);
int (*destroy)(void *handle);
return LB_STATUS_SUCCESS;
}
+static int update_access(struct inst_info *inst, struct block *block, int is_pd)
+{
+ struct script_info *info;
+ Evas *e;
+
+ if (!block || !block->part || !block->data) {
+ ErrPrint("Block or block->part or block->data is NIL\n");
+ return LB_STATUS_ERROR_INVALID;
+ }
+
+ info = is_pd ? instance_pd_script(inst) : instance_lb_script(inst);
+ if (!info) {
+ ErrPrint("info is NIL (%d, %s)\n", is_pd, instance_id(inst));
+ return LB_STATUS_ERROR_FAULT;
+ }
+
+ if (!info->port) {
+ ErrPrint("info->port is NIL\n");
+ return LB_STATUS_ERROR_INVALID;
+ }
+
+ e = script_handler_evas(info);
+ if (e)
+ info->port->update_access(info->port_data, e, block->id, block->part, block->data, block->option);
+ else
+ ErrPrint("Evas: (nil) id[%s] part[%s] data[%s]\n", block->id, block->part, block->data);
+ return LB_STATUS_SUCCESS;
+}
+
static int update_script_script(struct inst_info *inst, struct block *block, int is_pd)
{
struct script_info *info;
.handler = update_info,
},
{
+ .type = TYPE_ACCESS,
+ .handler = update_access,
+ },
+ {
.type = NULL,
.handler = NULL,
},
if (!item->update_image)
goto errout;
+ item->update_access = dlsym(item->handle, "script_update_access");
+ if (!item->update_access)
+ goto errout;
+
item->update_script = dlsym(item->handle, "script_update_script");
if (!item->update_script)
goto errout;
if (!item->fini)
goto errout;
+ item->feed_event = dlsym(item->handle, "script_feed_event");
+ if (!item->feed_event)
+ goto errout;
+
if (item->init() < 0) {
ErrPrint("Failed to initialize script engine\n");
goto errout;
return LB_STATUS_SUCCESS;
}
+HAPI int script_handler_feed_event(struct script_info *info, int event, double timestamp)
+{
+ Evas *e;
+
+ if (!info->port) {
+ ErrPrint("info->port is NIL\n");
+ return LB_STATUS_ERROR_INVALID;
+ }
+
+ e = script_handler_evas(info);
+ if (!e) {
+ ErrPrint("Evas is not exists\n");
+ return LB_STATUS_ERROR_FAULT;
+ }
+
+ return info->port->feed_event(info->port_data, e, event, info->x, info->y, timestamp);
+}
+
/* End of a file */
#include <packet.h>
#include <com-core_packet.h>
#include <livebox-errno.h>
+#include <livebox-service.h>
#include "conf.h"
#include "debug.h"
TYPE_ERROR,
};
+struct access_cbdata {
+ int status;
+ struct inst_info *inst;
+};
+
struct deleted_item {
struct client_node *client;
struct inst_info *inst;
};
+static Eina_Bool lazy_access_status_cb(void *data)
+{
+ struct access_cbdata *cbdata = data;
+
+ if (instance_unref(cbdata->inst))
+ instance_send_access_status(cbdata->inst, cbdata->status);
+ /*!
+ * If instance_unref returns NULL,
+ * The instance is destroyed. it means, we don't need to send event to the viewer
+ */
+ free(cbdata);
+ return ECORE_CALLBACK_CANCEL;
+}
+
static int event_lb_route_cb(enum event_state state, struct event_data *event_info, void *data)
{
struct inst_info *inst = data;
switch (state) {
case EVENT_STATE_ACTIVATE:
script_handler_update_pointer(script, event_info->x, event_info->y, 1);
- evas_event_feed_mouse_move(e, event_info->x, event_info->y, timestamp, NULL);
- evas_event_feed_mouse_down(e, 1, EVAS_BUTTON_NONE, timestamp + 0.01f, NULL);
+ script_handler_feed_event(script, LB_SCRIPT_MOUSE_DOWN, timestamp);
break;
case EVENT_STATE_ACTIVATED:
script_handler_update_pointer(script, event_info->x, event_info->y, -1);
- evas_event_feed_mouse_move(e, event_info->x, event_info->y, timestamp, NULL);
+ script_handler_feed_event(script, LB_SCRIPT_MOUSE_MOVE, timestamp);
break;
case EVENT_STATE_DEACTIVATE:
script_handler_update_pointer(script, event_info->x, event_info->y, 0);
- evas_event_feed_mouse_move(e, event_info->x, event_info->y, timestamp, NULL);
- evas_event_feed_mouse_up(e, 1, EVAS_BUTTON_NONE, timestamp + 0.1f, NULL);
+ script_handler_feed_event(script, LB_SCRIPT_MOUSE_UP, timestamp);
break;
default:
break;
switch (state) {
case EVENT_STATE_ACTIVATE:
script_handler_update_pointer(script, event_info->x, event_info->y, 1);
- evas_event_feed_mouse_move(e, event_info->x, event_info->y, timestamp, NULL);
- evas_event_feed_mouse_down(e, 1, EVAS_BUTTON_NONE, timestamp + 0.01f, NULL);
+ script_handler_feed_event(script, LB_SCRIPT_MOUSE_DOWN, timestamp);
break;
case EVENT_STATE_ACTIVATED:
script_handler_update_pointer(script, event_info->x, event_info->y, -1);
- evas_event_feed_mouse_move(e, event_info->x, event_info->y, timestamp, NULL);
+ script_handler_feed_event(script, LB_SCRIPT_MOUSE_MOVE, timestamp);
break;
case EVENT_STATE_DEACTIVATE:
script_handler_update_pointer(script, event_info->x, event_info->y, 0);
- evas_event_feed_mouse_move(e, event_info->x, event_info->y, timestamp, NULL);
- evas_event_feed_mouse_up(e, 1, EVAS_BUTTON_NONE, timestamp + 0.1f, NULL);
+ script_handler_feed_event(script, LB_SCRIPT_MOUSE_UP, timestamp);
break;
default:
break;
client = client_find_by_pid(pid);
if (!client) {
ErrPrint("Client %d is not exists\n", pid);
- ret = LB_STATUS_ERROR_NOT_EXIST;
goto out;
}
ret = packet_get(packet, "sssddd", &pkgname, &id, &event, ×tamp, &x, &y);
if (ret != 6) {
ErrPrint("Parameter is not matched\n");
- ret = LB_STATUS_ERROR_INVALID;
goto out;
}
*/
inst = package_find_instance_by_id(pkgname, id);
if (!inst)
- ret = LB_STATUS_ERROR_NOT_EXIST;
+ ErrPrint("Instance is not exists\n");
else if (package_is_fault(instance_package(inst)))
- ret = LB_STATUS_ERROR_FAULT;
+ ErrPrint("Fault package\n");
else
- ret = instance_clicked(inst, event, timestamp, x, y);
+ (void)instance_clicked(inst, event, timestamp, x, y);
out:
/*! \note No reply packet */
return NULL;
}
+static struct packet *client_update_mode(pid_t pid, int handle, const struct packet *packet)
+{
+ struct packet *result;
+ struct client_node *client;
+ int active_update;
+ const char *pkgname;
+ const char *id;
+ int ret;
+ struct inst_info *inst;
+
+ client = client_find_by_pid(pid);
+ if (!client) {
+ ErrPrint("Client %d is not exists\n", pid);
+ ret = LB_STATUS_ERROR_INVALID;
+ goto out;
+ }
+
+ ret = packet_get(packet, "ssi", &pkgname, &id, &active_update);
+ if (ret != 3) {
+ ErrPrint("Invalid argument\n");
+ ret = LB_STATUS_ERROR_INVALID;
+ goto out;
+ }
+
+ inst = package_find_instance_by_id(pkgname, id);
+ if (!inst) {
+ ErrPrint("Instance is not exists\n");
+ ret = LB_STATUS_ERROR_NOT_EXIST;
+ } else if (package_is_fault(instance_package(inst))) {
+ ErrPrint("Fault package\n");
+ ret = LB_STATUS_ERROR_FAULT;
+ } else {
+ /*!
+ * \note
+ * Send change update mode request to a slave
+ */
+ ret = instance_set_update_mode(inst, active_update);
+ }
+
+out:
+ result = packet_create_reply(packet, "i", ret);
+ if (!result)
+ ErrPrint("Failed to create a packet\n");
+
+ return result;
+}
+
/* pid, pkgname, filename, emission, source, s, sy, ex, ey, ret */
static struct packet *client_text_signal(pid_t pid, int handle, const struct packet *packet)
{
ErrPrint("Heap: %s\n", strerror(errno));
ret = LB_STATUS_ERROR_MEMORY;
} else {
- ret = 0;
/*!
* \NOTE:
* Send DELETED EVENT to the client.
instance_unref(inst);
DbgFree(item);
ret = LB_STATUS_ERROR_FAULT;
+ } else {
+ ret = LB_STATUS_SUCCESS;
}
}
} else {
}
script_handler_update_pointer(script, x, y, -1);
- evas_event_feed_mouse_in(e, timestamp, NULL);
+ script_handler_feed_event(script, LB_SCRIPT_MOUSE_IN, timestamp);
ret = 0;
} else {
ErrPrint("Unsupported package\n");
}
script_handler_update_pointer(script, x, y, -1);
- evas_event_feed_mouse_out(e, timestamp, NULL);
+ script_handler_feed_event(script, LB_SCRIPT_MOUSE_OUT, timestamp);
ret = 0;
} else {
ErrPrint("Unsupported package\n");
}
script_handler_update_pointer(script, x, y, 1);
- evas_event_feed_mouse_move(e, x, y, timestamp, NULL);
- evas_event_feed_mouse_down(e, 1, EVAS_BUTTON_NONE, timestamp + 0.01f, NULL);
+ script_handler_feed_event(script, LB_SCRIPT_MOUSE_DOWN, timestamp);
ret = 0;
} else {
ErrPrint("Unsupported package\n");
}
script_handler_update_pointer(script, x, y, 0);
- evas_event_feed_mouse_move(e, x, y, timestamp, NULL);
- evas_event_feed_mouse_up(e, 1, EVAS_BUTTON_NONE, timestamp + 0.1f, NULL);
+ script_handler_feed_event(script, LB_SCRIPT_MOUSE_UP, timestamp);
ret = 0;
} else {
ErrPrint("Unsupported package\n");
}
script_handler_update_pointer(script, x, y, -1);
- evas_event_feed_mouse_move(e, x, y, timestamp, NULL);
+ script_handler_feed_event(script, LB_SCRIPT_MOUSE_MOVE, timestamp);
ret = 0;
} else {
ErrPrint("Unsupported package\n");
}
script_handler_update_pointer(script, x, y, -1);
- evas_event_feed_mouse_move(e, x, y, timestamp, NULL);
+ script_handler_feed_event(script, LB_SCRIPT_MOUSE_MOVE, timestamp);
ret = 0;
} else {
ErrPrint("Unsupported package\n");
}
script_handler_update_pointer(script, x, y, -1);
- evas_event_feed_mouse_in(e, timestamp, NULL);
+ script_handler_feed_event(script, LB_SCRIPT_MOUSE_IN, timestamp);
ret = 0;
} else {
ErrPrint("Unsupported package\n");
}
script_handler_update_pointer(script, x, y, -1);
- evas_event_feed_mouse_out(e, timestamp, NULL);
+ script_handler_feed_event(script, LB_SCRIPT_MOUSE_OUT, timestamp);
ret = 0;
} else {
ErrPrint("Unsupported package\n");
}
script_handler_update_pointer(script, x, y, 1);
- evas_event_feed_mouse_move(e, x, y, timestamp, NULL);
- evas_event_feed_mouse_down(e, 1, EVAS_BUTTON_NONE, timestamp + 0.01f, NULL);
+ script_handler_feed_event(script, LB_SCRIPT_MOUSE_DOWN, timestamp);
ret = 0;
} else {
ErrPrint("Unsupported package\n");
}
script_handler_update_pointer(script, x, y, 0);
- evas_event_feed_mouse_move(e, x, y, timestamp, NULL);
- evas_event_feed_mouse_up(e, 1, EVAS_BUTTON_NONE, timestamp + 0.1f, NULL);
+ script_handler_feed_event(script, LB_SCRIPT_MOUSE_UP, timestamp);
ret = 0;
} else {
ErrPrint("Unsupported package\n");
static struct packet *client_pd_access_value_change(pid_t pid, int handle, const struct packet *packet)
{
+ struct packet *result;
struct client_node *client;
const char *pkgname;
const char *id;
}
script_handler_update_pointer(script, x, y, -1);
- /*!
- * \TODO: Push up the ACCESS_VALUE_CHANGE event
- */
- ret = 0;
+ ret = script_handler_feed_event(script, LB_SCRIPT_ACCESS_VALUE_CHANGE, timestamp);
+ if (ret >= 0) {
+ struct access_cbdata *cbdata;
+
+ cbdata = malloc(sizeof(*cbdata));
+ if (!cbdata) {
+ ret = LB_STATUS_ERROR_MEMORY;
+ } else {
+ cbdata->inst = instance_ref(inst);
+ cbdata->status = ret;
+
+ if (!ecore_timer_add(DELAY_TIME, lazy_access_status_cb, cbdata)) {
+ instance_unref(cbdata->inst);
+ free(cbdata);
+ ret = LB_STATUS_ERROR_FAULT;
+ } else {
+ ret = LB_STATUS_SUCCESS;
+ }
+ }
+ }
} else {
ErrPrint("Unsupported package\n");
ret = LB_STATUS_ERROR_INVALID;
}
out:
- /*! \note No reply packet */
- return NULL;
+ result = packet_create_reply(packet, "i", ret);
+ if (!result)
+ ErrPrint("Failed to create a reply packet\n");
+
+ return result;
}
static struct packet *client_pd_access_scroll(pid_t pid, int handle, const struct packet *packet)
{
+ struct packet *result;
struct client_node *client;
const char *pkgname;
const char *id;
}
script_handler_update_pointer(script, x, y, -1);
- /*!
- * \TODO: Push up the ACCESS_SCROLL event
- */
- ret = 0;
+ ret = script_handler_feed_event(script, LB_SCRIPT_ACCESS_SCROLL, timestamp);
+ if (ret >= 0) {
+ struct access_cbdata *cbdata;
+
+ cbdata = malloc(sizeof(*cbdata));
+ if (!cbdata) {
+ ret = LB_STATUS_ERROR_MEMORY;
+ } else {
+ cbdata->inst = instance_ref(inst);
+ cbdata->status = ret;
+
+ if (!ecore_timer_add(DELAY_TIME, lazy_access_status_cb, cbdata)) {
+ instance_unref(cbdata->inst);
+ free(cbdata);
+ ret = LB_STATUS_ERROR_FAULT;
+ } else {
+ ret = LB_STATUS_SUCCESS;
+ }
+ }
+ }
} else {
ErrPrint("Unsupported package\n");
ret = LB_STATUS_ERROR_INVALID;
}
out:
- /*! \note No reply packet */
- return NULL;
+ result = packet_create_reply(packet, "i", ret);
+ if (!result)
+ ErrPrint("Failed to create a reply packet\n");
+
+ return result;
}
static struct packet *client_pd_access_hl(pid_t pid, int handle, const struct packet *packet)
{
+ struct packet *result;
struct client_node *client;
const char *pkgname;
const char *id;
}
script_handler_update_pointer(script, x, y, -1);
- /*!
- * \TODO: Push up the ACCESS_HIGHLIGHT event
- */
- ret = 0;
+ ret = script_handler_feed_event(script, LB_SCRIPT_ACCESS_HIGHLIGHT, timestamp);
+ if (ret >= 0) {
+ struct access_cbdata *cbdata;
+
+ cbdata = malloc(sizeof(*cbdata));
+ if (!cbdata) {
+ ret = LB_STATUS_ERROR_MEMORY;
+ } else {
+ cbdata->inst = instance_ref(inst);
+ cbdata->status = ret;
+
+ if (!ecore_timer_add(DELAY_TIME, lazy_access_status_cb, cbdata)) {
+ instance_unref(cbdata->inst);
+ free(cbdata);
+ ret = LB_STATUS_ERROR_FAULT;
+ } else {
+ ret = LB_STATUS_SUCCESS;
+ }
+ }
+ }
} else {
ErrPrint("Unsupported package\n");
ret = LB_STATUS_ERROR_INVALID;
}
out:
- /*! \note No reply packet */
- return NULL;
+ result = packet_create_reply(packet, "i", ret);
+ if (!result)
+ ErrPrint("Failed to create a reply packet\n");
+
+ return result;
}
static struct packet *client_pd_access_hl_prev(pid_t pid, int handle, const struct packet *packet)
{
+ struct packet *result;
struct client_node *client;
const char *pkgname;
const char *id;
}
script_handler_update_pointer(script, x, y, -1);
- /*!
- * \TODO: Push up the ACCESS_HIGHLIGHT_PREV event
- */
- ret = 0;
+ ret = script_handler_feed_event(script, LB_SCRIPT_ACCESS_HIGHLIGHT_PREV, timestamp);
+ if (ret >= 0) {
+ struct access_cbdata *cbdata;
+
+ cbdata = malloc(sizeof(*cbdata));
+ if (!cbdata) {
+ ret = LB_STATUS_ERROR_MEMORY;
+ } else {
+ cbdata->inst = instance_ref(inst);
+ cbdata->status = ret;
+
+ if (!ecore_timer_add(DELAY_TIME, lazy_access_status_cb, cbdata)) {
+ instance_unref(cbdata->inst);
+ free(cbdata);
+ ret = LB_STATUS_ERROR_FAULT;
+ } else {
+ ret = LB_STATUS_SUCCESS;
+ }
+ }
+ }
} else {
ErrPrint("Unsupported package\n");
ret = LB_STATUS_ERROR_INVALID;
}
out:
- /*! \note No reply packet */
- return NULL;
+ result = packet_create_reply(packet, "i", ret);
+ if (!result)
+ ErrPrint("Failed to create a reply packet\n");
+
+ return result;
}
static struct packet *client_pd_access_hl_next(pid_t pid, int handle, const struct packet *packet)
{
+ struct packet *result;
struct client_node *client;
const char *pkgname;
const char *id;
}
script_handler_update_pointer(script, x, y, -1);
- /*!
- * \TODO: Push up the ACCESS_HIGHLIGHT_NEXT event
- */
- ret = 0;
+ ret = script_handler_feed_event(script, LB_SCRIPT_ACCESS_HIGHLIGHT_NEXT, timestamp);
+ if (ret >= 0) {
+ struct access_cbdata *cbdata;
+
+ cbdata = malloc(sizeof(*cbdata));
+ if (!cbdata) {
+ ret = LB_STATUS_ERROR_MEMORY;
+ } else {
+ cbdata->inst = instance_ref(inst);
+ cbdata->status = ret;
+
+ if (!ecore_timer_add(DELAY_TIME, lazy_access_status_cb, cbdata)) {
+ instance_unref(cbdata->inst);
+ free(cbdata);
+ ret = LB_STATUS_ERROR_FAULT;
+ } else {
+ ret = LB_STATUS_SUCCESS;
+ }
+ }
+ }
} else {
ErrPrint("Unsupported package\n");
ret = LB_STATUS_ERROR_INVALID;
}
out:
- /*! \note No reply packet */
- return NULL;
+ result = packet_create_reply(packet, "i", ret);
+ if (!result)
+ ErrPrint("Failed to create a reply packet\n");
+
+ return result;
}
static struct packet *client_pd_access_activate(pid_t pid, int handle, const struct packet *packet)
{
+ struct packet *result;
struct client_node *client;
const char *pkgname;
const char *id;
}
script_handler_update_pointer(script, x, y, -1);
- /*!
- * \TODO: Push up the ACCESS_ACTIVATE event
- */
- ret = 0;
+ ret = script_handler_feed_event(script, LB_SCRIPT_ACCESS_ACTIVATE, timestamp);
+ if (ret >= 0) {
+ struct access_cbdata *cbdata;
+
+ cbdata = malloc(sizeof(*cbdata));
+ if (!cbdata) {
+ ret = LB_STATUS_ERROR_MEMORY;
+ } else {
+ cbdata->inst = instance_ref(inst);
+ cbdata->status = ret;
+
+ if (!ecore_timer_add(DELAY_TIME, lazy_access_status_cb, cbdata)) {
+ instance_unref(cbdata->inst);
+ free(cbdata);
+ ret = LB_STATUS_ERROR_FAULT;
+ } else {
+ ret = LB_STATUS_SUCCESS;
+ }
+ }
+ }
} else {
ErrPrint("Unsupported package\n");
ret = LB_STATUS_ERROR_INVALID;
}
out:
- /*! \note No reply packet */
- return NULL;
+ result = packet_create_reply(packet, "i", ret);
+ if (!result)
+ ErrPrint("Failed to create a reply packet\n");
+
+ return result;
}
static struct packet *client_pd_key_down(pid_t pid, int handle, const struct packet *packet)
client = client_find_by_pid(pid);
if (!client) {
- ErrPrint("Client %d is paused - manually reported\n", pid);
- ret = LB_STATUS_ERROR_NOT_EXIST;
+ ErrPrint("Client %d is not exists\n", pid);
goto out;
}
ret = packet_get(packet, "d", ×tamp);
if (ret != 1) {
ErrPrint("Invalid parameter\n");
- ret = LB_STATUS_ERROR_INVALID;
goto out;
}
static struct packet *client_lb_access_hl(pid_t pid, int handle, const struct packet *packet)
{
+ struct packet *result;
struct client_node *client;
const char *pkgname;
const char *id;
}
script_handler_update_pointer(script, x, y, -1);
+ ret = script_handler_feed_event(script, LB_SCRIPT_ACCESS_HIGHLIGHT, timestamp);
+ if (ret >= 0) {
+ struct access_cbdata *cbdata;
- /*!
- * \TODO: Feed up this ACCESS_HIGHLIGHT event
- */
- ret = 0;
+ cbdata = malloc(sizeof(*cbdata));
+ if (!cbdata) {
+ ret = LB_STATUS_ERROR_MEMORY;
+ } else {
+ cbdata->inst = instance_ref(inst);
+ cbdata->status = ret;
+
+ if (!ecore_timer_add(DELAY_TIME, lazy_access_status_cb, cbdata)) {
+ instance_unref(cbdata->inst);
+ free(cbdata);
+ ret = LB_STATUS_ERROR_FAULT;
+ } else {
+ ret = LB_STATUS_SUCCESS;
+ }
+ }
+ }
} else {
ErrPrint("Unsupported package\n");
ret = LB_STATUS_ERROR_INVALID;
}
out:
- /*! \note No reply packet */
- return NULL;
+ result = packet_create_reply(packet, "i", ret);
+ if (!result)
+ ErrPrint("Failed to create a reply packet\n");
+
+ return result;
}
static struct packet *client_lb_access_hl_prev(pid_t pid, int handle, const struct packet *packet)
{
+ struct packet *result;
struct client_node *client;
const char *pkgname;
const char *id;
}
script_handler_update_pointer(script, x, y, -1);
+ ret = script_handler_feed_event(script, LB_SCRIPT_ACCESS_HIGHLIGHT_PREV, timestamp);
+ if (ret >= 0) {
+ struct access_cbdata *cbdata;
- /*!
- * \TODO: Feed up this ACCESS_HIGHLIGHT_PREV event
- */
- ret = 0;
+ cbdata = malloc(sizeof(*cbdata));
+ if (!cbdata) {
+ ret = LB_STATUS_ERROR_MEMORY;
+ } else {
+ cbdata->inst = instance_ref(inst);
+ cbdata->status = ret;
+
+ if (!ecore_timer_add(DELAY_TIME, lazy_access_status_cb, cbdata)) {
+ instance_unref(cbdata->inst);
+ free(cbdata);
+ ret = LB_STATUS_ERROR_FAULT;
+ } else {
+ ret = LB_STATUS_SUCCESS;
+ }
+ }
+ }
} else {
ErrPrint("Unsupported package\n");
ret = LB_STATUS_ERROR_INVALID;
}
out:
- /*! \note No reply packet */
- return NULL;
+ result = packet_create_reply(packet, "i", ret);
+ if (!result)
+ ErrPrint("Failed to create a reply packet\n");
+
+ return result;
}
static struct packet *client_lb_access_hl_next(pid_t pid, int handle, const struct packet *packet)
{
+ struct packet *result;
struct client_node *client;
const char *pkgname;
const char *id;
}
script_handler_update_pointer(script, x, y, -1);
+ ret = script_handler_feed_event(script, LB_SCRIPT_ACCESS_HIGHLIGHT_NEXT, timestamp);
+ if (ret >= 0) {
+ struct access_cbdata *cbdata;
- /*!
- * \TODO: Feed up this ACCESS_HIGHLIGHT_NEXT event
- */
- ret = 0;
+ cbdata = malloc(sizeof(*cbdata));
+ if (!cbdata) {
+ ret = LB_STATUS_ERROR_MEMORY;
+ } else {
+ cbdata->inst = instance_ref(inst);
+ cbdata->status = ret;
+
+ if (!ecore_timer_add(DELAY_TIME, lazy_access_status_cb, cbdata)) {
+ instance_unref(cbdata->inst);
+ free(cbdata);
+ ret = LB_STATUS_ERROR_FAULT;
+ } else {
+ ret = LB_STATUS_SUCCESS;
+ }
+ }
+ }
} else {
ErrPrint("Unsupported package\n");
ret = LB_STATUS_ERROR_INVALID;
}
out:
- /*! \note No reply packet */
- return NULL;
+ result = packet_create_reply(packet, "i", ret);
+ if (!result)
+ ErrPrint("Failed to create a reply packet\n");
+
+ return result;
}
static struct packet *client_lb_access_value_change(pid_t pid, int handle, const struct packet *packet)
{
+ struct packet *result;
struct client_node *client;
const char *pkgname;
const char *id;
goto out;
}
- // script_handler_update_pointer(script, x, y, -1);
+ script_handler_update_pointer(script, x, y, -1);
+ ret = script_handler_feed_event(script, LB_SCRIPT_ACCESS_VALUE_CHANGE, timestamp);
+ if (ret >= 0) {
+ struct access_cbdata *cbdata;
- /*!
- * \TODO: Feed up this VALUE_CHANGE event
- */
+ cbdata = malloc(sizeof(*cbdata));
+ if (!cbdata) {
+ ret = LB_STATUS_ERROR_MEMORY;
+ } else {
+ cbdata->inst = instance_ref(inst);
+ cbdata->status = ret;
+
+ if (!ecore_timer_add(DELAY_TIME, lazy_access_status_cb, cbdata)) {
+ instance_unref(cbdata->inst);
+ free(cbdata);
+ ret = LB_STATUS_ERROR_FAULT;
+ } else {
+ ret = LB_STATUS_SUCCESS;
+ }
+ }
+ }
} else {
ErrPrint("Unsupported package\n");
}
out:
- return NULL;
+ result = packet_create_reply(packet, "i", ret);
+ if (!result)
+ ErrPrint("Failed to create a reply packet\n");
+
+ return result;
}
static struct packet *client_lb_access_scroll(pid_t pid, int handle, const struct packet *packet)
{
+ struct packet *result;
struct client_node *client;
const char *pkgname;
const char *id;
}
script_handler_update_pointer(script, x, y, -1);
+ ret = script_handler_feed_event(script, LB_SCRIPT_ACCESS_SCROLL, timestamp);
+ if (ret >= 0) {
+ struct access_cbdata *cbdata;
- /*!
- * \TODO: Feed up this ACCESS_SCROLL event
- */
+ cbdata = malloc(sizeof(*cbdata));
+ if (!cbdata) {
+ ret = LB_STATUS_ERROR_MEMORY;
+ } else {
+ cbdata->inst = instance_ref(inst);
+ cbdata->status = ret;
+
+ if (!ecore_timer_add(DELAY_TIME, lazy_access_status_cb, cbdata)) {
+ instance_unref(cbdata->inst);
+ free(cbdata);
+ ret = LB_STATUS_ERROR_FAULT;
+ } else {
+ ret = LB_STATUS_SUCCESS;
+ }
+ }
+ }
} else {
ErrPrint("Unsupported package\n");
}
out:
- return NULL;
+ result = packet_create_reply(packet, "i", ret);
+ if (!result)
+ ErrPrint("Failed to create a reply packet\n");
+
+ return result;
}
static struct packet *client_lb_access_activate(pid_t pid, int handle, const struct packet *packet)
{
+ struct packet *result;
struct client_node *client;
const char *pkgname;
const char *id;
}
script_handler_update_pointer(script, x, y, -1);
+ ret = script_handler_feed_event(script, LB_SCRIPT_ACCESS_ACTIVATE, timestamp);
+ if (ret >= 0) {
+ struct access_cbdata *cbdata;
- /*!
- * \TODO: Feed up this ACCESS_ACTIVATE event
- */
+ cbdata = malloc(sizeof(*cbdata));
+ if (!cbdata) {
+ ret = LB_STATUS_ERROR_MEMORY;
+ } else {
+ cbdata->inst = instance_ref(inst);
+ cbdata->status = ret;
+
+ if (!ecore_timer_add(DELAY_TIME, lazy_access_status_cb, cbdata)) {
+ instance_unref(cbdata->inst);
+ free(cbdata);
+ ret = LB_STATUS_ERROR_FAULT;
+ } else {
+ ret = LB_STATUS_SUCCESS;
+ }
+ }
+ }
} else {
ErrPrint("Unsupported package\n");
}
out:
- /*! \note No reply packet */
- return NULL;
+ result = packet_create_reply(packet, "i", ret);
+ if (!result)
+ ErrPrint("Failed to create a reply packet\n");
+
+ return result;
}
static struct packet *client_lb_key_down(pid_t pid, int handle, const struct packet *packet)
static Eina_Bool lazy_pd_created_cb(void *data)
{
- int ret;
-
- ret = instance_client_pd_created(data, LB_STATUS_SUCCESS);
- DbgPrint("Send PD Create event (%d)\n", ret);
+ if (instance_unref(data)) {
+ int ret;
+ ret = instance_client_pd_created(data, LB_STATUS_SUCCESS);
+ DbgPrint("Send PD Create event (%d)\n", ret);
+ }
- instance_unref(data);
return ECORE_CALLBACK_CANCEL;
}
static Eina_Bool lazy_pd_destroyed_cb(void *data)
{
- DbgPrint("Send PD Destroy event\n");
- instance_client_pd_destroyed(data, LB_STATUS_SUCCESS);
+ if (instance_unref(data)) {
+ DbgPrint("Send PD Destroy event\n");
+ instance_client_pd_destroyed(data, LB_STATUS_SUCCESS);
+ }
- instance_unref(data);
return ECORE_CALLBACK_CANCEL;
}
* \note
* Send the destroyed PD event to the client
*/
- if (ret == 0) {
+ if (ret == LB_STATUS_SUCCESS) {
inst = instance_ref(inst);
- if (!ecore_timer_add(DELAY_TIME, lazy_pd_destroyed_cb, inst))
+ if (!ecore_timer_add(DELAY_TIME, lazy_pd_destroyed_cb, inst)) {
instance_unref(inst);
+ /*!
+ * How can we handle this?
+ */
+ ret = LB_STATUS_ERROR_FAULT;
+ }
}
} else {
ErrPrint("Invalid PD TYPE\n");
return NULL;
}
+static struct packet *slave_lb_update_begin(pid_t pid, int handle, const struct packet *packet)
+{
+ struct slave_node *slave;
+ struct inst_info *inst;
+ struct pkg_info *pkg;
+ const char *pkgname;
+ const char *id;
+ double priority;
+ const char *content;
+ const char *title;
+ int ret;
+
+ slave = slave_find_by_pid(pid);
+ if (!slave) {
+ ErrPrint("Slave %d is not exists\n", pid);
+ goto out;
+ }
+
+ ret = packet_get(packet, "ssdss", &pkgname, &id, &priority, &content, &title);
+ if (ret != 5) {
+ ErrPrint("Invalid parameters\n");
+ goto out;
+ }
+
+ inst = package_find_instance_by_id(pkgname, id);
+ if (!inst) {
+ ErrPrint("Instance(%s) is not exists\n", id);
+ goto out;
+ } else if (instance_state(inst) == INST_DESTROYED) {
+ ErrPrint("Instance(%s) is already destroyed\n", id);
+ goto out;
+ }
+
+ pkg = instance_package(inst);
+ if (!pkg) {
+ ErrPrint("Invalid instance\n");
+ } else if (package_is_fault(pkg)) {
+ ErrPrint("Faulted instance %s.\n", id);
+ } else if (package_lb_type(pkg) == LB_TYPE_BUFFER) {
+ ret = instance_lb_update_begin(inst, priority, content, title);
+ if (ret == LB_STATUS_SUCCESS)
+ slave_freeze_ttl(slave);
+ } else {
+ ErrPrint("Invalid request[%s]\n", id);
+ }
+
+out:
+ return NULL;
+}
+
+static struct packet *slave_lb_update_end(pid_t pid, int handle, const struct packet *packet)
+{
+ struct slave_node *slave;
+ struct inst_info *inst;
+ struct pkg_info *pkg;
+ const char *pkgname;
+ const char *id;
+ int ret;
+
+ slave = slave_find_by_pid(pid);
+ if (!slave) {
+ ErrPrint("Slave %d is not exists\n", pid);
+ goto out;
+ }
+
+ ret = packet_get(packet, "ss", &pkgname, &id);
+ if (ret != 2) {
+ ErrPrint("Invalid parameters\n");
+ goto out;
+ }
+
+ inst = package_find_instance_by_id(pkgname, id);
+ if (!inst) {
+ ErrPrint("Instance[%s] is not exists\n", id);
+ goto out;
+ } else if (instance_state(inst) == INST_DESTROYED) {
+ ErrPrint("Instance[%s] is already destroyed\n", id);
+ goto out;
+ }
+
+ pkg = instance_package(inst);
+ if (!pkg) {
+ ErrPrint("Invalid instance\n");
+ } else if (package_is_fault(pkg)) {
+ ErrPrint("Faulted instance %s\n", id);
+ } else if (package_lb_type(pkg) == LB_TYPE_BUFFER) {
+ ret = instance_lb_update_end(inst);
+ if (ret == LB_STATUS_SUCCESS)
+ slave_thaw_ttl(slave);
+ } else {
+ ErrPrint("Invalid request[%s]\n", id);
+ }
+
+out:
+ return NULL;
+}
+
+static struct packet *slave_pd_update_begin(pid_t pid, int handle, const struct packet *packet)
+{
+ struct slave_node *slave;
+ struct pkg_info *pkg;
+ struct inst_info *inst;
+ const char *pkgname;
+ const char *id;
+ int ret;
+
+ slave = slave_find_by_pid(pid);
+ if (!slave) {
+ ErrPrint("Slave %d is not exists\n", pid);
+ goto out;
+ }
+
+ ret = packet_get(packet, "ss", &pkgname, &id);
+ if (ret != 2) {
+ ErrPrint("Invalid parameters\n");
+ goto out;
+ }
+
+ inst = package_find_instance_by_id(pkgname, id);
+ if (!inst) {
+ ErrPrint("Instance[%s] is not exists\n", id);
+ goto out;
+ }
+
+ pkg = instance_package(inst);
+ if (!pkg) {
+ ErrPrint("Invalid package\n");
+ } else if (package_is_fault(pkg)) {
+ ErrPrint("Faulted instance %s\n", id);
+ } else if (instance_state(inst) == INST_DESTROYED) {
+ ErrPrint("Instance[%s] is already destroyed\n", id);
+ } else if (package_pd_type(pkg) == PD_TYPE_BUFFER) {
+ (void)instance_pd_update_begin(inst);
+ } else {
+ ErrPrint("Invalid request[%s]\n", id);
+ }
+
+out:
+ return NULL;
+}
+
+static struct packet *slave_access_status(pid_t pid, int handle, const struct packet *packet)
+{
+ struct slave_node *slave;
+ struct pkg_info *pkg;
+ struct inst_info *inst;
+ const char *pkgname;
+ const char *id;
+ int status;
+ int ret;
+
+ slave = slave_find_by_pid(pid);
+ if (!slave) {
+ ErrPrint("Slave %d is not exists\n", pid);
+ goto out;
+ }
+
+ ret = packet_get(packet, "ssi", &pkgname, &id, &status);
+ if (ret != 3) {
+ ErrPrint("Invalid parameters\n");
+ goto out;
+ }
+
+ inst = package_find_instance_by_id(pkgname, id);
+ if (!inst) {
+ ErrPrint("Instance[%s] is not exists\n", id);
+ goto out;
+ }
+
+ pkg = instance_package(inst);
+ if (!pkg) {
+ ErrPrint("Invalid package\n");
+ } else if (package_is_fault(pkg)) {
+ ErrPrint("Faulted instance %s\n", id);
+ } else if (instance_state(inst) == INST_DESTROYED) {
+ ErrPrint("Instance[%s] is already destroyed\n", id);
+ } else {
+ /*!
+ * \note
+ * Forward packet to client
+ */
+ (void)instance_forward_packet(inst, packet_ref((struct packet *)packet));
+ }
+
+out:
+ return NULL;
+}
+
+static struct packet *slave_pd_update_end(pid_t pid, int handle, const struct packet *packet)
+{
+ struct slave_node *slave;
+ struct pkg_info *pkg;
+ struct inst_info *inst;
+ const char *pkgname;
+ const char *id;
+ int ret;
+
+ slave = slave_find_by_pid(pid);
+ if (!slave) {
+ ErrPrint("Slave %d is not exists\n", pid);
+ goto out;
+ }
+
+ ret = packet_get(packet, "ss", &pkgname, &id);
+ if (ret != 2) {
+ ErrPrint("Invalid parameters\n");
+ goto out;
+ }
+
+ inst = package_find_instance_by_id(pkgname, id);
+ if (!inst) {
+ ErrPrint("Instance[%s] is not exists\n", id);
+ goto out;
+ }
+
+ pkg = instance_package(inst);
+ if (!pkg) {
+ ErrPrint("Invalid package\n");
+ } else if (package_is_fault(pkg)) {
+ ErrPrint("Faulted instance %s\n", id);
+ } else if (instance_state(inst) == INST_DESTROYED) {
+ ErrPrint("Instance[%s] is already destroyed\n", id);
+ } else if (package_pd_type(pkg) == PD_TYPE_BUFFER) {
+ (void)instance_pd_update_end(inst);
+ } else {
+ ErrPrint("Invalid request[%s]\n", id);
+ }
+
+out:
+ return NULL;
+}
+
static struct packet *slave_call(pid_t pid, int handle, const struct packet *packet) /* slave_name, pkgname, filename, function, ret */
{
struct slave_node *slave;
},
{
+ .cmd = "update_mode",
+ .handler = client_update_mode,
+ },
+
+ {
.cmd = NULL,
.handler = NULL,
},
.cmd = "scroll",
.handler = slave_hold_scroll, /* slave_name, pkgname, id, seize */
},
+
+ {
+ .cmd = "lb_update_begin",
+ .handler = slave_lb_update_begin,
+ },
+ {
+ .cmd = "lb_update_end",
+ .handler = slave_lb_update_end,
+ },
+ {
+ .cmd = "pd_update_begin",
+ .handler = slave_pd_update_begin,
+ },
+ {
+ .cmd = "pd_update_end",
+ .handler = slave_pd_update_end,
+ },
+
+ {
+ .cmd = "access_status",
+ .handler = slave_access_status,
+ },
+
{
.cmd = NULL,
.handler = NULL,
i = livebox_service_mouse_event(node_name(node));
printf("Mouse event: %s\n", i ? "enabled" : "disabled");
- i = livebox_service_touch_effect(node_name(node));
- printf("Touch effect: %s\n", i ? "enabled" : "disabled");
break;
case PROVIDER:
printf("Not supported yet\n");