#include "master_rpc.h"
#include "conf.h"
#include "critical_log.h"
+#include "livebox-errno.h"
static inline void make_connection(void);
ret = packet_get(packet, "iisss", &ret, &pinup, &pkgname, &id, &content);
if (ret != 5) {
ErrPrint("Invalid argument\n");
- ret = -EINVAL;
goto out;
}
handler = lb_find_livebox(pkgname, id);
if (!handler) {
- ret = -ENOENT;
+ ErrPrint("Instance (%s) is not exists\n", id);
goto out;
}
handler->is_pinned_up = pinup;
} else {
ErrPrint("Heap: %s\n", strerror(errno));
- ret = -ENOMEM;
+ ret = LB_STATUS_ERROR_MEMORY;
}
}
handler->pinup_cb = NULL; /*!< Reset pinup cb */
handler->pinup_cbdata = NULL;
- } else {
+ } else if (ret == 0) {
lb_invoke_event_handler(handler, LB_EVENT_PINUP_CHANGED);
}
- ret = 0;
out:
return NULL;
}
handler->deleted_cbdata = NULL;
}
- DbgPrint("Call the created cb with -ECANCELED\n");
- handler->created_cb(handler, -ECANCELED, handler->created_cbdata);
+ DbgPrint("Call the created cb with LB_STATUS_ERROR_CANCEL\n");
+ handler->created_cb(handler, LB_STATUS_ERROR_CANCEL, handler->created_cbdata);
handler->created_cb = NULL;
handler->created_cbdata = NULL;
} else if (handler->id) {
if (handler->deleted_cb) {
DbgPrint("Call the deleted cb\n");
- handler->deleted_cb(handler, 0, handler->deleted_cbdata);
+ handler->deleted_cb(handler, LB_STATUS_SUCCESS, handler->deleted_cbdata);
handler->deleted_cb = NULL;
handler->deleted_cbdata = NULL;
&priority, &content, &title);
if (ret != 8) {
ErrPrint("Invalid argument\n");
- ret = -EINVAL;
goto out;
}
handler = lb_find_livebox(pkgname, id);
if (!handler) {
- ret = -ENOENT;
+ ErrPrint("instance(%s) is not exists\n", id);
goto out;
}
* Don't try to notice anything with this, Just ignore all events
* Beacuse the user doesn't wants know about this anymore
*/
- ret = -EPERM;
+ DbgPrint("(%s) is not exists, but updated\n", id);
goto out;
}
if (lb_text_lb(handler)) {
lb_set_size(handler, lb_w, lb_h);
- ret = parse_desc(handler, livebox_filename(handler), 0);
+ (void)parse_desc(handler, livebox_filename(handler), 0);
/*!
* \note
* DESC parser will call the "text event callback".
+ * Don't need to call global event callback in this case.
*/
goto out;
} else if (lb_get_lb_fb(handler)) {
lb_set_lb_fb(handler, fbfile);
ret = fb_sync(lb_get_lb_fb(handler));
if (ret < 0)
- ErrPrint("Failed to do sync FB (%s - %s)\n", pkgname, util_basename(util_uri_to_path(id)));
+ ErrPrint("Failed to do sync FB (%s - %s) (%d)\n", pkgname, util_basename(util_uri_to_path(id)), ret);
} else {
lb_set_size(handler, lb_w, lb_h);
ret = 0;
handler = lb_find_livebox(pkgname, id);
if (!handler) {
- ret = -ENOENT;
+ ErrPrint("Instance(%s) is not exists\n", id);
goto out;
}
if (handler->state != CREATE) {
- ret = -EPERM;
+ ErrPrint("Instance(%s) is not created\n", id);
goto out;
}
} else {
(void)lb_set_pd_fb(handler, buf_id);
ret = fb_sync(lb_get_pd_fb(handler));
- if (ret < 0) {
- ErrPrint("Failed to do sync FB (%s - %s)\n",
- pkgname,
- util_basename(util_uri_to_path(id)));
- }
+ if (ret < 0)
+ ErrPrint("Failed to do sync FB (%s - %s)\n", pkgname, util_basename(util_uri_to_path(id)));
}
handler->is_pd_created = (status == 0);
lb_invoke_event_handler(handler, LB_EVENT_PD_CREATED);
}
- ret = 0;
out:
return NULL;
}
handler = lb_find_livebox(pkgname, id);
if (!handler) {
- ret = -ENOENT;
+ ErrPrint("Instance(%s) is not exists\n", id);
goto out;
}
if (handler->state != CREATE) {
- ret = -EPERM;
+ ErrPrint("Instance(%s) is not created\n", id);
goto out;
}
lb_invoke_event_handler(handler, LB_EVENT_PD_DESTROYED);
}
- ret = 0;
out:
return NULL;
}
&pd_w, &pd_h);
if (ret != 6) {
ErrPrint("Invalid argument\n");
- ret = -EINVAL;
goto out;
}
handler = lb_find_livebox(pkgname, id);
if (!handler) {
- ret = -ENOENT;
+ ErrPrint("Instance(%s) is not exists\n", id);
goto out;
}
* So don't try to notice anything about this anymore.
* Just ignore all events.
*/
- ret = -EPERM;
+ ErrPrint("Instance(%s) is not created\n", id);
goto out;
}
lb_set_pdsize(handler, pd_w, pd_h);
if (lb_text_pd(handler)) {
- ret = parse_desc(handler, descfile, 1);
+ (void)parse_desc(handler, descfile, 1);
} else {
(void)lb_set_pd_fb(handler, fbfile);
ret = fb_sync(lb_get_pd_fb(handler));
- if (ret < 0) {
- ErrPrint("Failed to do sync FB (%s - %s)\n",
- pkgname,
- util_basename(util_uri_to_path(id)));
- goto out;
- }
-
- lb_invoke_event_handler(handler, LB_EVENT_PD_UPDATED);
- ret = 0;
+ if (ret < 0)
+ ErrPrint("Failed to do sync FB (%s - %s)\n", pkgname, util_basename(util_uri_to_path(id)));
+ else
+ lb_invoke_event_handler(handler, LB_EVENT_PD_UPDATED);
}
out:
if (!packet) {
ErrPrint("Invalid packet\n");
- ret = -EINVAL;
goto out;
}
ret = packet_get(packet, "ssiiii", &pkgname, &id, &is_pd, &w, &h, &status);
if (ret != 6) {
ErrPrint("Invalid argument\n");
- ret = -EINVAL;
goto out;
}
handler = lb_find_livebox(pkgname, id);
if (!handler) {
- ErrPrint("Livebox(%s - %s) is not found\n", pkgname, id);
- ret = -ENOENT;
+ ErrPrint("Livebox(%s) is not found\n", id);
goto out;
}
if (handler->state != CREATE) {
- ErrPrint("Hander is not created yet\n");
- ret = -EPERM;
+ ErrPrint("Livebox(%s) is not created yet\n", id);
goto out;
}
lb_set_pdsize(handler, w, h);
lb_invoke_event_handler(handler, LB_EVENT_PD_SIZE_CHANGED);
} else {
- ErrPrint("This is not possible. PD Size is changed but the return value is not ZERO\n");
+ ErrPrint("This is not possible. PD Size is changed but the return value is not ZERO (%d)\n", status);
}
} else {
if (status == 0) {
* Update it too.
*/
if (lb_get_lb_fb(handler))
- lb_set_lb_fb(handler, id);
+ (void)lb_set_lb_fb(handler, id);
/*!
* \NOTE
ret = packet_get(packet, "idss", &status, &period, &pkgname, &id);
if (ret != 4) {
ErrPrint("Invalid argument\n");
- ret = -EINVAL;
goto out;
}
handler = lb_find_livebox(pkgname, id);
if (!handler) {
- ErrPrint("Livebox(%s - %s) is not found\n", pkgname, id);
- ret = -ENOENT;
+ ErrPrint("Livebox(%s) is not found\n", id);
goto out;
}
if (handler->state != CREATE) {
- ret = -EPERM;
+ ErrPrint("Livebox(%s) is not created\n", id);
goto out;
}
handler->period_changed_cb = NULL;
handler->period_cbdata = NULL;
- } else {
+ } else if (status == 0) {
lb_invoke_event_handler(handler, LB_EVENT_PERIOD_CHANGED);
}
- ret = 0;
-
out:
return NULL;
}
ret = packet_get(packet, "ssiss", &pkgname, &id, &status, &cluster, &category);
if (ret != 5) {
ErrPrint("Invalid argument\n");
- ret = -EINVAL;
goto out;
}
handler = lb_find_livebox(pkgname, id);
if (!handler) {
- ret = -ENOENT;
+ ErrPrint("Livebox(%s) is not exists\n", id);
goto out;
}
* Do no access this handler,
* You cannot believe this handler anymore.
*/
- ret = -EPERM;
+ ErrPrint("Livebox(%s) is not created\n", id);
goto out;
}
DbgPrint("Group is changed? [%s] / [%s] (%d)\n", cluster, category, status);
if (status == 0)
- lb_set_group(handler, cluster, category);
+ (void)lb_set_group(handler, cluster, category);
if (handler->group_changed_cb) {
handler->group_changed_cb(handler, status, handler->group_cbdata);
handler->group_changed_cb = NULL;
handler->group_cbdata = NULL;
- } else {
+ } else if (status == 0) {
lb_invoke_event_handler(handler, LB_EVENT_GROUP_CHANGED);
}
- ret = 0;
-
out:
return NULL;
}
&lb_type, &pd_type, &period, &title, &is_pinned_up);
if (ret != 22) {
ErrPrint("Invalid argument\n");
- ret = -EINVAL;
+ ret = LB_STATUS_ERROR_INVALID;
goto out;
}
handler = lb_new_livebox(pkgname, id, timestamp);
if (!handler) {
ErrPrint("Failed to create a new livebox\n");
- ret = -EFAULT;
+ ret = LB_STATUS_ERROR_FAULT;
goto out;
}
* This is not possible!!!
*/
ErrPrint("Invalid handler\n");
- ret = -EINVAL;
+ ret = LB_STATUS_ERROR_INVALID;
goto out;
}
content, cluster, category,
lb_fname, pd_fname);
- ret = -EALREADY;
+ ret = LB_STATUS_ERROR_ALREADY;
goto out;
}
* Do not clear this to use this from the deleted event callback.
* if this value is not cleared when the deleted event callback check it,
* it means that the created function is not called yet.
- * Then the call the deleted event callback with -ECANCELED errno.
+ * Then the call the deleted event callback with LB_STATUS_ERROR_CANCEL errno.
*/
}
#include "master_rpc.h"
#include "client.h"
#include "critical_log.h"
+#include "livebox-errno.h"
#define EAPI __attribute__((visibility("default")))
#define MINIMUM_EVENT s_info.event_filter
destroy_cb_info(info);
if (!result) {
- ret = -EFAULT;
+ ret = LB_STATUS_ERROR_FAULT;
} else if (packet_get(result, "i", &ret) != 1) {
ErrPrint("Invalid argument\n");
- ret = -EINVAL;
+ ret = LB_STATUS_ERROR_INVALID;
}
/*!
destroy_cb_info(info);
if (!result) {
- ret = -EFAULT;
+ ret = LB_STATUS_ERROR_FAULT;
} else if (packet_get(result, "i", &ret) != 1) {
ErrPrint("Invalid argument\n");
- ret = -EINVAL;
+ ret = LB_STATUS_ERROR_INVALID;
}
if (cb)
destroy_cb_info(info);
if (!result) {
- ret = -EFAULT;
+ ret = LB_STATUS_ERROR_FAULT;
} else if (packet_get(result, "i", &ret) != 1) {
ErrPrint("Invalid argument\n");
- ret = -EINVAL;
+ ret = LB_STATUS_ERROR_INVALID;
}
if (ret == 0) { /*!< Group information is successfully changed */
destroy_cb_info(info);
if (!result) {
- ret = -EFAULT;
+ ret = LB_STATUS_ERROR_FAULT;
} else if (packet_get(result, "i", &ret) != 1) {
ErrPrint("Invalid argument\n");
- ret = -EINVAL;
+ ret = LB_STATUS_ERROR_INVALID;
}
if (ret == 0) {
if (!result) {
ErrPrint("Connection lost?\n");
- ret = -EFAULT;
+ ret = LB_STATUS_ERROR_FAULT;
} else if (packet_get(result, "i", &ret) != 1) {
ErrPrint("Invalid argument\n");
- ret = -EINVAL;
+ ret = LB_STATUS_ERROR_INVALID;
}
if (ret == 0) {
destroy_cb_info(info);
if (!result) {
- ret = -EFAULT;
+ ret = LB_STATUS_ERROR_FAULT;
} else if (packet_get(result, "i", &ret) != 1) {
- ret = -EINVAL;
+ ret = LB_STATUS_ERROR_INVALID;
}
if (ret >= 0) {
destroy_cb_info(data);
if (!result) {
- ret = -EFAULT;
+ ret = LB_STATUS_ERROR_FAULT;
} else if (packet_get(result, "i", &ret) != 1) {
- ret = -EINVAL;
+ ret = LB_STATUS_ERROR_INVALID;
}
if (ret == 0) {
destroy_cb_info(info);
if (!result) {
- ret = -EFAULT;
+ ret = LB_STATUS_ERROR_FAULT;
} else if (packet_get(result, "is", &ret, &pkgname) != 2) {
- ret = -EINVAL;
+ ret = LB_STATUS_ERROR_INVALID;
}
if (cb)
if (!result) {
DbgPrint("Result is NIL (may connection lost)\n");
- ret = -EFAULT;
+ ret = LB_STATUS_ERROR_FAULT;
} else if (packet_get(result, "i", &ret) != 1) {
DbgPrint("Invalid parameter\n");
- ret = -EINVAL;
+ ret = LB_STATUS_ERROR_INVALID;
}
if (ret == 0) {
destroy_cb_info(info);
if (!result) {
- ret = -EFAULT;
+ ret = LB_STATUS_ERROR_FAULT;
} else if (packet_get(result, "i", &ret) != 1) {
- ret = -EINVAL;
+ ret = LB_STATUS_ERROR_INVALID;
}
DbgPrint("Delete category returns: %d\n", ret);
destroy_cb_info(info);
if (!result)
- ret = -EFAULT;
+ ret = LB_STATUS_ERROR_FAULT;
else if (packet_get(result, "i", &ret) != 1)
- ret = -EINVAL;
+ ret = LB_STATUS_ERROR_INVALID;
DbgPrint("Delete category returns: %d\n", ret);
destroy_cb_info(info);
if (!result)
- ret = -EFAULT;
+ ret = LB_STATUS_ERROR_FAULT;
else if (packet_get(result, "i", &ret) != 1)
- ret = -EINVAL;
+ ret = LB_STATUS_ERROR_INVALID;
if (ret == 0) {
handler->pinup_cb = cb;
packet = packet_create_noack(event, "ssdii", handler->pkgname, handler->id, timestamp, x, y);
if (!packet) {
ErrPrint("Failed to build param\n");
- return -EFAULT;
+ return LB_STATUS_ERROR_FAULT;
}
DbgPrint("Send: %dx%d\n", x, y);
if (s_info.init_count > 0) {
s_info.init_count++;
- return 0;
+ return LB_STATUS_SUCCESS;
}
env = getenv("PROVIDER_DISABLE_PREVENT_OVERWRITE");
if (env && !strcasecmp(env, "true"))
client_init();
s_info.init_count++;
- return 0;
+ return LB_STATUS_SUCCESS;
}
EAPI int livebox_fini(void)
{
if (s_info.init_count <= 0) {
DbgPrint("Didn't initialized\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
s_info.init_count--;
if (s_info.init_count > 0) {
DbgPrint("init count : %d\n", s_info.init_count);
- return 0;
+ return LB_STATUS_SUCCESS;
}
client_fini();
fb_fini();
livebox_service_fini();
critical_log_fini();
- return 0;
+ return LB_STATUS_SUCCESS;
}
static inline char *lb_pkgname(const char *pkgname)
if (!handler || handler->state != CREATE || !handler->id) {
ErrPrint("Handler is not valid\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
if (handler->period_changed_cb) {
ErrPrint("Previous request for changing period is not finished\n");
- return -EBUSY;
+ return LB_STATUS_ERROR_BUSY;
}
if (!handler->is_user) {
ErrPrint("CA Livebox is not able to change the period\n");
- return -EPERM;
+ return LB_STATUS_ERROR_PERMISSION;
}
if (handler->lb.period == period) {
DbgPrint("No changes\n");
- return -EALREADY;
+ return LB_STATUS_ERROR_ALREADY;
}
packet = packet_create("set_period", "ssd", handler->pkgname, handler->id, period);
if (!packet) {
ErrPrint("Failed to build a packet %s\n", handler->pkgname);
- return -EFAULT;
+ return LB_STATUS_ERROR_FAULT;
}
if (!cb)
{
if (!handler) {
ErrPrint("Handler is NIL\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
if (handler->state != CREATE) {
ErrPrint("Handler is already deleted\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
handler->state = DELETE;
*/
if (cb)
cb(handler, 0, data);
- return 0;
+ return LB_STATUS_SUCCESS;
}
if (!cb)
struct fault_info *info;
if (!cb)
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
info = malloc(sizeof(*info));
if (!info) {
CRITICAL_LOG("Heap: %s\n", strerror(errno));
- return -ENOMEM;
+ return LB_STATUS_ERROR_MEMORY;
}
info->handler = cb;
info->user_data = data;
s_info.fault_list = dlist_append(s_info.fault_list, info);
- return 0;
+ return LB_STATUS_SUCCESS;
}
EAPI void *livebox_unset_fault_handler(int (*cb)(enum livebox_fault_type, const char *, const char *, const char *, void *))
if (!cb) {
ErrPrint("Invalid argument cb is nil\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
info = malloc(sizeof(*info));
if (!info) {
CRITICAL_LOG("Heap: %s\n", strerror(errno));
- return -ENOMEM;
+ return LB_STATUS_ERROR_MEMORY;
}
info->handler = cb;
info->user_data = data;
s_info.event_list = dlist_append(s_info.event_list, info);
- return 0;
+ return LB_STATUS_SUCCESS;
}
EAPI void *livebox_unset_event_handler(int (*cb)(struct livebox *, enum livebox_event_type, void *))
if (!handler) {
ErrPrint("Handler is NIL\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
if (handler->state != CREATE || !handler->id) {
ErrPrint("Handler is not valid\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
if (handler->size_changed_cb) {
ErrPrint("Previous resize request is not finished yet\n");
- return -EBUSY;
+ return LB_STATUS_ERROR_BUSY;
}
if (!handler->is_user) {
ErrPrint("CA Livebox is not able to be resized\n");
- return -EPERM;
+ return LB_STATUS_ERROR_PERMISSION;
}
if (livebox_service_get_size(type, &w, &h) != 0) {
ErrPrint("Invalid size type\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
if (handler->lb.width == w && handler->lb.height == h) {
DbgPrint("No changes\n");
- return -EALREADY;
+ return LB_STATUS_ERROR_ALREADY;;
}
packet = packet_create("resize", "ssii", handler->pkgname, handler->id, w, h);
if (!packet) {
ErrPrint("Failed to build param\n");
- return -EFAULT;
+ return LB_STATUS_ERROR_FAULT;
}
if (!cb)
if (!handler) {
ErrPrint("Handler is NIL\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
if (handler->state != CREATE || !handler->id) {
ErrPrint("Handler is not valid\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
if (handler->lb.auto_launch)
packet = packet_create_noack("clicked", "sssddd", handler->pkgname, handler->id, "clicked", timestamp, x, y);
if (!packet) {
ErrPrint("Failed to build param\n");
- return -EFAULT;
+ return LB_STATUS_ERROR_FAULT;
}
ret = master_rpc_request_only(handler, packet);
+ DbgPrint("Click request: %d\n", ret);
if (!handler->lb.mouse_event && (handler->lb.type == _LB_TYPE_BUFFER || handler->lb.type == _LB_TYPE_SCRIPT)) {
int ret; /* Shadow variable */
{
if (!handler) {
ErrPrint("Handler is NIL\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
if (handler->state != CREATE || !handler->id) {
ErrPrint("Handler is not valid\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
return !!handler->pd.data.fb;
{
if (!handler) {
ErrPrint("Handler is NIL\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
if (!handler->pd.data.fb || handler->state != CREATE || !handler->id) {
ErrPrint("Handler is not valid\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
return handler->is_pd_created;
if (!handler) {
ErrPrint("Handler is NIL\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
if (!handler->pd.data.fb || handler->state != CREATE || !handler->id) {
ErrPrint("Handler is not valid\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
if (handler->is_pd_created == 1) {
DbgPrint("PD already created\n");
- return 0;
+ return LB_STATUS_SUCCESS;
}
packet = packet_create("create_pd", "ssdd", handler->pkgname, handler->id, x, y);
if (!packet) {
ErrPrint("Failed to build param\n");
- return -EFAULT;
+ return LB_STATUS_ERROR_FAULT;
}
if (!cb)
if (!handler) {
ErrPrint("Handler is NIL\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
if (!handler->pd.data.fb || handler->state != CREATE || !handler->id) {
ErrPrint("Handler is not valid\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
if (!handler->is_pd_created) {
DbgPrint("PD is not created\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
packet = packet_create_noack("pd_move", "ssdd", handler->pkgname, handler->id, x, y);
if (!packet) {
ErrPrint("Failed to build param\n");
- return -EFAULT;
+ return LB_STATUS_ERROR_FAULT;
}
return master_rpc_request_only(handler, packet);
struct packet *packet;
if (!pkgname)
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
packet = packet_create("activate_package", "s", pkgname);
if (!packet) {
ErrPrint("Failed to build a param\n");
- return -EFAULT;
+ return LB_STATUS_ERROR_FAULT;
}
return master_rpc_async_request(NULL, packet, 0, activated_cb, create_cb_info(cb, data));
if (!handler) {
ErrPrint("Handler is NIL\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
if (!handler->pd.data.fb || handler->state != CREATE || !handler->id) {
ErrPrint("Handler is not valid\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
if (!handler->is_pd_created) {
ErrPrint("PD is not created\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
packet = packet_create("destroy_pd", "ss", handler->pkgname, handler->id);
if (!packet) {
ErrPrint("Failed to build a param\n");
- return -EFAULT;
+ return LB_STATUS_ERROR_FAULT;
}
if (!cb)
if (!handler) {
ErrPrint("Handler is NIL\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
if (handler->state != CREATE || !handler->id) {
ErrPrint("Handler is not valid\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
if (type & CONTENT_EVENT_PD_MASK) {
if (!handler->is_pd_created) {
ErrPrint("PD is not created\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
if (type & CONTENT_EVENT_MOUSE_MASK) {
if (!handler->pd.data.fb) {
ErrPrint("Handler is not valid\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
if (type & CONTENT_EVENT_MOUSE_MOVE) {
if (fabs(x - handler->pd.x) < MINIMUM_EVENT && fabs(y - handler->pd.y) < MINIMUM_EVENT)
- return -EBUSY;
+ return LB_STATUS_ERROR_BUSY;
} else if (type & CONTENT_EVENT_MOUSE_SET) {
flag = 0;
}
if (type & CONTENT_EVENT_MOUSE_MASK) {
if (!handler->lb.mouse_event) {
ErrPrint("Box is not support the mouse event\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
if (!handler->lb.data.fb) {
ErrPrint("Handler is not valid\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
if (type & CONTENT_EVENT_MOUSE_MOVE) {
if (fabs(x - handler->lb.x) < MINIMUM_EVENT && fabs(y - handler->lb.y) < MINIMUM_EVENT)
- return -EBUSY;
+ return LB_STATUS_ERROR_BUSY;
} else if (type & CONTENT_EVENT_MOUSE_SET) {
flag = 0;
}
break;
default:
ErrPrint("Invalid event type\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
return send_mouse_event(handler, cmd, x * w, y * h);
if (!handler) {
ErrPrint("Handler is NIL\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
if (handler->state != CREATE || !handler->id) {
ErrPrint("Handler is not valid\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
if (!w)
*h = handler->pd.height;
}
- return 0;
+ return LB_STATUS_SUCCESS;
}
EAPI int livebox_size(struct livebox *handler)
if (!handler) {
ErrPrint("Handler is NIL\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
if (handler->state != CREATE || !handler->id) {
ErrPrint("Handler is not valid\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
w = handler->lb.width;
if (!handler) {
ErrPrint("Handler is NIL\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
if (!cluster || !category || handler->state != CREATE || !handler->id) {
ErrPrint("Invalid argument\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
if (handler->group_changed_cb) {
ErrPrint("Previous group changing request is not finished yet\n");
- return -EBUSY;
+ return LB_STATUS_ERROR_BUSY;
}
if (!handler->is_user) {
ErrPrint("CA Livebox is not able to change the group\n");
- return -EPERM;
+ return LB_STATUS_ERROR_PERMISSION;
}
if (!strcmp(handler->cluster, cluster) && !strcmp(handler->category, category)) {
DbgPrint("No changes\n");
- return -EALREADY;
+ return LB_STATUS_ERROR_ALREADY;
}
packet = packet_create("change_group", "ssss", handler->pkgname, handler->id, cluster, category);
if (!packet) {
ErrPrint("Failed to build a param\n");
- return -EFAULT;
+ return LB_STATUS_ERROR_FAULT;
}
if (!cb)
{
if (!handler) {
ErrPrint("Handler is NIL\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
if (!cluster || !category || handler->state != CREATE || !handler->id) {
ErrPrint("Invalid argument\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
*cluster = handler->cluster;
*category = handler->category;
- return 0;
+ return LB_STATUS_SUCCESS;
}
EAPI int livebox_get_supported_sizes(struct livebox *handler, int *cnt, int *size_list)
if (!handler || !size_list) {
ErrPrint("Invalid argument, handler(%p), size_list(%p)\n", handler, size_list);
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
if (!cnt || handler->state != CREATE || !handler->id) {
ErrPrint("Handler is not valid\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
for (j = i = 0; i < NR_OF_SIZE_LIST; i++) {
}
*cnt = j;
- return 0;
+ return LB_STATUS_SUCCESS;
}
EAPI const char *livebox_pkgname(struct livebox *handler)
packet = packet_create("delete_cluster", "s", cluster);
if (!packet) {
ErrPrint("Failed to build a param\n");
- return -EFAULT;
+ return LB_STATUS_ERROR_FAULT;
}
return master_rpc_async_request(NULL, packet, 0, delete_cluster_cb, create_cb_info(cb, data));
packet = packet_create("delete_category", "ss", cluster, category);
if (!packet) {
ErrPrint("Failed to build a param\n");
- return -EFAULT;
+ return LB_STATUS_ERROR_FAULT;
}
return master_rpc_async_request(NULL, packet, 0, delete_category_cb, create_cb_info(cb, data));
{
if (!handler) {
ErrPrint("Handler is NIL\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
if (handler->state != CREATE) {
ErrPrint("Handler is not valid\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
memcpy(&handler->pd.data.ops, ops, sizeof(*ops));
- return 0;
+ return LB_STATUS_SUCCESS;
}
EAPI int livebox_set_text_handler(struct livebox *handler, struct livebox_script_operators *ops)
{
if (!handler) {
ErrPrint("Handler is NIL\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
if (handler->state != CREATE) {
ErrPrint("Handler is not valid\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
memcpy(&handler->lb.data.ops, ops, sizeof(*ops));
- return 0;
+ return LB_STATUS_SUCCESS;
}
EAPI int livebox_acquire_lb_pixmap(struct livebox *handler, ret_cb_t cb, void *data)
if (!handler) {
ErrPrint("Handler is NIL\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
if (handler->state != CREATE || !handler->id) {
ErrPrint("Invalid handle\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
if (handler->lb.type != _LB_TYPE_SCRIPT && handler->lb.type != _LB_TYPE_BUFFER) {
ErrPrint("Handler is not valid type\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
id = fb_id(handler->lb.data.fb);
if (!id || strncasecmp(id, SCHEMA_PIXMAP, strlen(SCHEMA_PIXMAP)))
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
packet = packet_create("lb_acquire_pixmap", "ss", handler->pkgname, handler->id);
if (!packet) {
ErrPrint("Failed to build a param\n");
- return -EFAULT;
+ return LB_STATUS_ERROR_FAULT;
}
return master_rpc_async_request(handler, packet, 0, pixmap_acquired_cb, create_cb_info(cb, data));
if (!handler) {
ErrPrint("Handler is NIL\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
if (handler->state != CREATE || !handler->id) {
ErrPrint("Invalid handle\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
if (handler->lb.type != _LB_TYPE_SCRIPT && handler->lb.type != _LB_TYPE_BUFFER) {
ErrPrint("Handler is not valid type\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
packet = packet_create_noack("lb_release_pixmap", "ssi", handler->pkgname, handler->id, pixmap);
if (!packet) {
ErrPrint("Failed to build a param\n");
- return -EFAULT;
+ return LB_STATUS_ERROR_INVALID;
}
return master_rpc_request_only(handler, packet);
if (!handler) {
ErrPrint("Handler is NIL\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
if (handler->state != CREATE || !handler->id) {
ErrPrint("Invalid handle\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
if (handler->pd.type != _PD_TYPE_SCRIPT && handler->pd.type != _PD_TYPE_BUFFER) {
ErrPrint("Handler is not valid type\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
id = fb_id(handler->pd.data.fb);
if (!id || strncasecmp(id, SCHEMA_PIXMAP, strlen(SCHEMA_PIXMAP)))
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
packet = packet_create("pd_acquire_pixmap", "ss", handler->pkgname, handler->id);
if (!packet) {
ErrPrint("Failed to build a param\n");
- return -EFAULT;
+ return LB_STATUS_ERROR_FAULT;
}
return master_rpc_async_request(handler, packet, 0, pixmap_acquired_cb, create_cb_info(cb, data));
if (!handler) {
ErrPrint("Handler is NIL\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
if (handler->state != CREATE || !handler->id) {
ErrPrint("Invalid handle\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
if (handler->pd.type != _PD_TYPE_SCRIPT && handler->pd.type != _PD_TYPE_BUFFER) {
ErrPrint("Handler is not valid type\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
packet = packet_create_noack("pd_release_pixmap", "ssi", handler->pkgname, handler->id, pixmap);
if (!packet) {
ErrPrint("Failed to build a param\n");
- return -EFAULT;
+ return LB_STATUS_ERROR_FAULT;
}
return master_rpc_request_only(handler, packet);
{
if (!handler) {
ErrPrint("Handler is NIL\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
if (handler->state != CREATE || !handler->id) {
ErrPrint("Handler is not valid\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
return fb_size(handler->pd.data.fb);
{
if (!handler) {
ErrPrint("Handler is NIL\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
if (handler->state != CREATE || !handler->id) {
ErrPrint("Handler is not valid\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
return fb_size(handler->lb.data.fb);
{
if (!handler) {
ErrPrint("Handler is NIL\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
if (handler->state != CREATE) {
ErrPrint("Handler is invalid\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
return handler->is_user;
if (!handler) {
ErrPrint("Handler is NIL\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
if (handler->state != CREATE || !handler->id) {
ErrPrint("Handler is not valid\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
if (handler->pinup_cb) {
ErrPrint("Previous pinup request is not finished\n");
- return -EBUSY;
+ return LB_STATUS_ERROR_BUSY;
}
if (handler->is_pinned_up == flag) {
DbgPrint("No changes\n");
- return -EALREADY;
+ return LB_STATUS_ERROR_ALREADY;
}
packet = packet_create("pinup_changed", "ssi", handler->pkgname, handler->id, flag);
if (!packet) {
ErrPrint("Failed to build a param\n");
- return -EFAULT;
+ return LB_STATUS_ERROR_FAULT;
}
if (!cb)
{
if (!handler) {
ErrPrint("Handler is NIL\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
if (handler->state != CREATE || !handler->id)
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
return handler->is_pinned_up;
}
{
if (!handler) {
ErrPrint("Handler is NIL\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
if (handler->state != CREATE || !handler->id)
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
return handler->lb.pinup_supported;
}
{
if (!handler) {
ErrPrint("Handler is NIL\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
if (handler->state != CREATE)
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
handler->data = data;
- return 0;
+ return LB_STATUS_SUCCESS;
}
EAPI void *livebox_get_data(struct livebox *handler)
if (!handler) {
ErrPrint("Handler is NIL\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
if ((handler->lb.type != _LB_TYPE_TEXT && handler->pd.type != _PD_TYPE_TEXT) || handler->state != CREATE || !handler->id) {
ErrPrint("Handler is not valid\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
if (!emission)
handler->pkgname, handler->id, emission, source, sx, sy, ex, ey);
if (!packet) {
ErrPrint("Failed to build a param\n");
- return -EFAULT;
+ return LB_STATUS_ERROR_FAULT;
}
return master_rpc_async_request(handler, packet, 0, text_signal_cb, create_cb_info(cb, data));
packet = packet_create_noack("subscribe", "ss", cluster ? cluster : "", category ? category : "");
if (!packet) {
ErrPrint("Failed to create a packet\n");
- return -EFAULT;
+ return LB_STATUS_ERROR_FAULT;
}
return master_rpc_request_only(NULL, packet);
packet = packet_create_noack("unsubscribe", "ss", cluster ? cluster : "", category ? category : "");
if (!packet) {
ErrPrint("Failed to create a packet\n");
- return -EFAULT;
+ return LB_STATUS_ERROR_FAULT;
}
return master_rpc_request_only(NULL, packet);
if (!handler) {
ErrPrint("Hnalder is NIL\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
if (handler->state != CREATE || !handler->id)
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
packet = packet_create_noack("update", "ss", handler->pkgname, handler->id);
if (!packet) {
ErrPrint("Failed to create a packet\n");
- return -EFAULT;
+ return LB_STATUS_ERROR_FAULT;
}
return master_rpc_request_only(handler, packet);
if (!cluster || !category) {
ErrPrint("Invalid argument\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
packet = packet_create_noack("refresh_group", "ss", cluster, category);
if (!packet) {
ErrPrint("Failed to create a packet\n");
- return -EFAULT;
+ return LB_STATUS_ERROR_FAULT;
}
return master_rpc_request_only(NULL, packet);
if (!handler) {
ErrPrint("Handler is NIL\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
if (handler->state != CREATE || !handler->id)
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
if (!handler->is_user) {
/* System cluster livebox cannot be changed its visible states */
if (state == LB_HIDE_WITH_PAUSE) {
ErrPrint("CA Livebox is not able to change the visibility\n");
- return -EPERM;
+ return LB_STATUS_ERROR_PERMISSION;
}
}
DbgPrint("Change the visibility %d <> %d, %s\n", handler->visible, state, handler->id);
if (handler->visible == state)
- return 0;
+ return LB_STATUS_ERROR_ALREADY;
packet = packet_create_noack("change,visibility", "ssi", handler->pkgname, handler->id, (int)state);
if (!packet) {
ErrPrint("Failed to create a packet\n");
- return -EFAULT;
+ return LB_STATUS_ERROR_FAULT;
}
ret = master_rpc_request_only(handler, packet);
pc = strdup(cluster);
if (!pc) {
CRITICAL_LOG("Heap: %s (cluster: %s)\n", strerror(errno), cluster);
- return -ENOMEM;
+ return LB_STATUS_ERROR_MEMORY;
}
}
if (!ps) {
CRITICAL_LOG("Heap: %s (category: %s)\n", strerror(errno), category);
free(pc);
- return -ENOMEM;
+ return LB_STATUS_ERROR_MEMORY;
}
}
handler->cluster = pc;
handler->category = ps;
- return 0;
+ return LB_STATUS_SUCCESS;
}
void lb_set_size(struct livebox *handler, int w, int h)
lb_unref(handler);
}
- return 0;
+ return LB_STATUS_SUCCESS;
}
int lb_set_content(struct livebox *handler, const char *content)
handler->content = strdup(content);
if (!handler->content) {
CRITICAL_LOG("Heap: %s (content: %s)\n", strerror(errno), content);
- return -ENOMEM;
+ return LB_STATUS_ERROR_MEMORY;
}
}
- return 0;
+ return LB_STATUS_SUCCESS;
}
int lb_set_title(struct livebox *handler, const char *title)
handler->title = strdup(title);
if (!handler->title) {
CRITICAL_LOG("Heap: %s (title: %s)\n", strerror(errno), title);
- return -ENOMEM;
+ return LB_STATUS_ERROR_MEMORY;
}
}
- return 0;
+ return LB_STATUS_SUCCESS;
}
void lb_set_size_list(struct livebox *handler, int size_list)
struct fb_info *fb;
if (!handler)
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
fb = handler->lb.data.fb;
if (fb && !strcmp(fb_id(fb), filename)) /*!< BUFFER is not changed, */
- return 0;
+ return LB_STATUS_SUCCESS;
handler->lb.data.fb = NULL;
if (!filename || filename[0] == '\0') {
if (fb)
fb_destroy(fb);
- return 0;
+ return LB_STATUS_SUCCESS;
}
handler->lb.data.fb = fb_create(filename, handler->lb.width, handler->lb.height);
ErrPrint("Faield to create a FB\n");
if (fb)
fb_destroy(fb);
- return -EFAULT;
+ return LB_STATUS_ERROR_FAULT;
}
if (fb)
fb_destroy(fb);
- return 0;
+ return LB_STATUS_SUCCESS;
}
int lb_set_pd_fb(struct livebox *handler, const char *filename)
struct fb_info *fb;
if (!handler)
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
fb = handler->pd.data.fb;
if (fb && !strcmp(fb_id(fb), filename)) {
/* BUFFER is not changed, just update the content */
- return -EEXIST;
+ return LB_STATUS_ERROR_EXIST;
}
handler->pd.data.fb = NULL;
if (!filename || filename[0] == '\0') {
if (fb)
fb_destroy(fb);
- return 0;
+ return LB_STATUS_SUCCESS;
}
handler->pd.data.fb = fb_create(filename, handler->pd.width, handler->pd.height);
ErrPrint("Failed to create a FB\n");
if (fb)
fb_destroy(fb);
- return -EFAULT;
+ return LB_STATUS_ERROR_FAULT;
}
if (fb)
fb_destroy(fb);
- return 0;
+ return LB_STATUS_SUCCESS;
}
struct fb_info *lb_get_lb_fb(struct livebox *handler)
if (!cb && !!data) {
ErrPrint("Invalid argument\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
if (handler->deleted_cb) {
ErrPrint("Already in-progress\n");
- return -EINPROGRESS;
+ return LB_STATUS_ERROR_BUSY;
}
packet = packet_create("delete", "ss", handler->pkgname, handler->id);
if (!packet) {
ErrPrint("Failed to build a param\n");
if (cb)
- cb(handler, -EFAULT, data);
+ cb(handler, LB_STATUS_ERROR_FAULT, data);
- return -EFAULT;
+ return LB_STATUS_ERROR_FAULT;
}
if (!cb)
packet = packet_create_noack("client_paused", "d", util_timestamp());
if (!packet) {
ErrPrint("Failed to create a pause packet\n");
- return -EFAULT;
+ return LB_STATUS_ERROR_FAULT;
}
return master_rpc_request_only(NULL, packet);
packet = packet_create_noack("client_resumed", "d", util_timestamp());
if (!packet) {
ErrPrint("Failed to create a resume packet\n");
- return -EFAULT;
+ return LB_STATUS_ERROR_FAULT;
}
return master_rpc_request_only(NULL, packet);