ADD_DEFINITIONS("-DLOCALEDIR=\"${LOCALEDIR}\"")
ADD_DEFINITIONS("-DEXEC_NAME=\"${PROJECT_NAME}\"")
-ADD_DEFINITIONS("-DMASTER_PKGNAME=\"org.tizen.data-provider-master\"")
+ADD_DEFINITIONS("-DMASTER_PKGNAME=\"data-provider-master\"")
ADD_DEFINITIONS("-DSLAVE_PKGNAME=\"org.tizen.data-provider-slave\"")
ADD_DEFINITIONS("-DSOCKET_FILE=\"/opt/usr/share/live_magazine/.live.socket\"")
Flora License
-Version 1.0, May, 2012
+Version 1.0, May, 2013
http://www.tizenopensource.org/license
/*
- * Copyright 2012 Samsung Electronics Co., Ltd
+ * Copyright 2013 Samsung Electronics Co., Ltd
*
* Licensed under the Flora License, Version 1.0 (the "License");
* you may not use this file except in compliance with the License.
/*
- * Copyright 2012 Samsung Electronics Co., Ltd
+ * Copyright 2013 Samsung Electronics Co., Ltd
*
* Licensed under the Flora License, Version 1.0 (the "License");
* you may not use this file except in compliance with the License.
#define PACKAGE "data-provider-slave"
#endif
-#define DATA_MASTER "org.tizen.data-provider-master"
+#define DATA_MASTER "data-provider-master"
#define DEFAULT_LIFE_TIMER 20
#define DEFAULT_LOAD_TIMER 20
/*
- * Copyright 2012 Samsung Electronics Co., Ltd
+ * Copyright 2013 Samsung Electronics Co., Ltd
*
* Licensed under the Flora License, Version 1.0 (the "License");
* you may not use this file except in compliance with the License.
/*
- * Copyright 2012 Samsung Electronics Co., Ltd
+ * Copyright 2013 Samsung Electronics Co., Ltd
*
* Licensed under the Flora License, Version 1.0 (the "License");
* you may not use this file except in compliance with the License.
/*
- * Copyright 2012 Samsung Electronics Co., Ltd
+ * Copyright 2013 Samsung Electronics Co., Ltd
*
* Licensed under the Flora License, Version 1.0 (the "License");
* you may not use this file except in compliance with the License.
/*
- * Copyright 2012 Samsung Electronics Co., Ltd
+ * Copyright 2013 Samsung Electronics Co., Ltd
*
* Licensed under the Flora License, Version 1.0 (the "License");
* you may not use this file except in compliance with the License.
/*
- * Copyright 2012 Samsung Electronics Co., Ltd
+ * Copyright 2013 Samsung Electronics Co., Ltd
*
* Licensed under the Flora License, Version 1.0 (the "License");
* you may not use this file except in compliance with the License.
/*
- * Copyright 2012 Samsung Electronics Co., Ltd
+ * Copyright 2013 Samsung Electronics Co., Ltd
*
* Licensed under the Flora License, Version 1.0 (the "License");
* you may not use this file except in compliance with the License.
/*
- * Copyright 2012 Samsung Electronics Co., Ltd
+ * Copyright 2013 Samsung Electronics Co., Ltd
*
* Licensed under the Flora License, Version 1.0 (the "License");
* you may not use this file except in compliance with the License.
/*
- * Copyright 2012 Samsung Electronics Co., Ltd
+ * Copyright 2013 Samsung Electronics Co., Ltd
*
* Licensed under the Flora License, Version 1.0 (the "License");
* you may not use this file except in compliance with the License.
org.tizen.data-provider-slave pkgmgr::db rw
e17 org.tizen.data-provider-slave w
org.tizen.app-tray org.tizen.data-provider-slave rx
+dbus org.tizen.data-provider-slave rwx
Name: org.tizen.data-provider-slave
Summary: Plugin type livebox service provider.
-Version: 0.10.0
+Version: 0.10.2
Release: 1
-Group: frameowrk/livebox
+Group: HomeTF/Livebox
License: Flora License
Source0: %{name}-%{version}.tar.gz
BuildRequires: cmake, gettext-tools, coreutils
%description
Plugin type liveboxes are managed by this.
Supporting the EFL.
+Supporting the In-house livebox only.
%prep
%setup -q
/*
- * Copyright 2012 Samsung Electronics Co., Ltd
+ * Copyright 2013 Samsung Electronics Co., Ltd
*
* Licensed under the Flora License, Version 1.0 (the "License");
* you may not use this file except in compliance with the License.
#include <sqlite3.h>
#include <provider.h>
+#include <livebox-errno.h>
#include "critical_log.h"
#include "conf.h"
if (ret == 0) {
if (arg->info.lb_create.width > 0 && arg->info.lb_create.height > 0) {
+ DbgPrint("Create size: %dx%d (created: %dx%d)\n", arg->info.lb_create.width, arg->info.lb_create.height, *width, *height);
if (*width != arg->info.lb_create.width || *height != arg->info.lb_create.height) {
int tmp;
tmp = lb_resize(arg->pkgname, arg->id, arg->info.lb_create.width, arg->info.lb_create.height);
- DbgPrint("Resize[%dx%d] returns: %d\n", arg->info.lb_create.width, arg->info.lb_create.height, tmp);
+ DbgPrint("lb_resize returns: %d\n", tmp);
}
}
arg->info.lb_create.out_is_pinned_up = (lb_is_pinned_up(arg->pkgname, arg->id) == 1);
+ } else {
+ ErrPrint("lb_create returns %d\n", ret);
}
return ret;
}
arg->info.lb_recreate.out_is_pinned_up = (lb_is_pinned_up(arg->pkgname, arg->id) == 1);
+ } else {
+ ErrPrint("lb_create returns %d\n", ret);
}
return ret;
{
DbgPrint("pkgname[%s] id[%s] state[%d]\n", arg->pkgname, arg->id, arg->info.pinup.state);
arg->info.pinup.content_info = lb_pinup(arg->pkgname, arg->id, arg->info.pinup.state);
- return arg->info.pinup.content_info ? 0 : -ENOTSUP;
+ return arg->info.pinup.content_info ? LB_STATUS_SUCCESS : LB_STATUS_ERROR_NOT_IMPLEMENTED;
}
static int method_update_content(struct event_arg *arg, void *data)
sqlite3_release_memory(SQLITE_FLUSH_MAX);
malloc_trim(0);
- return 0;
+ return LB_STATUS_SUCCESS;
}
static int method_resume(struct event_arg *arg, void *data)
lb_resume_all();
if (s_info.ping_timer)
ecore_timer_thaw(s_info.ping_timer);
- return 0;
+ return LB_STATUS_SUCCESS;
}
static Eina_Bool send_ping_cb(void *data)
}
elm_exit();
- return 0;
+ return LB_STATUS_SUCCESS;
}
static int method_connected(struct event_arg *arg, void *data)
ErrPrint("Failed to add a ping timer\n");
}
- return 0;
+ return LB_STATUS_SUCCESS;
}
static int method_pd_created(struct event_arg *arg, void *data)
ret = lb_open_pd(arg->pkgname);
DbgPrint("%s Open PD: %d\n", arg->pkgname, ret);
- return 0;
+ return LB_STATUS_SUCCESS;
}
static int method_pd_destroyed(struct event_arg *arg, void *data)
ret = lb_close_pd(arg->pkgname);
DbgPrint("%s Close PD: %d\n", arg->pkgname, ret);
- return 0;
+ return LB_STATUS_SUCCESS;
}
-static int method_pd_move(struct event_arg *arg, void *data)
+static int method_pd_moved(struct event_arg *arg, void *data)
{
int ret;
struct event_info info;
.connected = method_connected,
.pd_create = method_pd_created,
.pd_destroy = method_pd_destroyed,
- .pd_move = method_pd_move,
+ .pd_move = method_pd_moved,
.lb_pause = method_lb_pause,
.lb_resume = method_lb_resume,
.pd_access = NULL,
HAPI int client_fini(void)
{
(void)provider_fini();
- return 0;
+ return LB_STATUS_SUCCESS;
}
/* End of a file */
/*
- * Copyright 2012 Samsung Electronics Co., Ltd
+ * Copyright 2013 Samsung Electronics Co., Ltd
*
* Licensed under the Flora License, Version 1.0 (the "License");
* you may not use this file except in compliance with the License.
#include <dlog.h>
#include <Eina.h>
+#include <livebox-errno.h>
+
#include "conf.h"
#include "util.h"
#include "debug.h"
fp = fopen("/usr/share/data-provider-master/conf.ini", "rt");
if (!fp) {
ErrPrint("Error: %s\n", strerror(errno));
- return -EIO;
+ return LB_STATUS_ERROR_IO;
}
state = START;
} while (c != EOF);
fclose(fp);
- return 0;
+ return LB_STATUS_SUCCESS;
}
/* End of a file */
/*
- * Copyright 2012 Samsung Electronics Co., Ltd
+ * Copyright 2013 Samsung Electronics Co., Ltd
*
* Licensed under the Flora License, Version 1.0 (the "License");
* you may not use this file except in compliance with the License.
#include <dlog.h>
#include <Eina.h>
+#include <livebox-errno.h>
#include "util.h"
#include "conf.h"
struct timeval tv;
if (!s_info.fp)
- return -EIO;
+ return LB_STATUS_ERROR_IO;
gettimeofday(&tv, NULL);
fprintf(s_info.fp, "%d %lu.%lu [%s:%d] ", getpid(), tv.tv_sec, tv.tv_usec, util_basename((char *)func), line);
char *filename;
if (s_info.fp)
- return 0;
+ return LB_STATUS_SUCCESS;
s_info.filename = strdup(name);
if (!s_info.filename) {
ErrPrint("Failed to create a log file\n");
- return -ENOMEM;
+ return LB_STATUS_ERROR_MEMORY;
}
namelen = strlen(name) + strlen(SLAVE_LOG_PATH) + 20;
ErrPrint("Failed to create a log file\n");
free(s_info.filename);
s_info.filename = NULL;
- return -ENOMEM;
+ return LB_STATUS_ERROR_MEMORY;
}
snprintf(filename, namelen, "%s/%d_%s", SLAVE_LOG_PATH, s_info.file_id, name);
free(s_info.filename);
s_info.filename = NULL;
free(filename);
- return -EIO;
+ return LB_STATUS_ERROR_IO;
}
free(filename);
- return 0;
+ return LB_STATUS_SUCCESS;
}
s_info.fp = NULL;
}
- return 0;
+ return LB_STATUS_SUCCESS;
}
/*
- * Copyright 2012 Samsung Electronics Co., Ltd
+ * Copyright 2013 Samsung Electronics Co., Ltd
*
* Licensed under the Flora License, Version 1.0 (the "License");
* you may not use this file except in compliance with the License.
/*
- * Copyright 2012 Samsung Electronics Co., Ltd
+ * Copyright 2013 Samsung Electronics Co., Ltd
*
* Licensed under the Flora License, Version 1.0 (the "License");
* you may not use this file except in compliance with the License.
#include <dlog.h>
#include <provider.h>
#include <livebox.h>
+#include <livebox-errno.h>
#include "critical_log.h"
#include "debug.h"
s_info.pending_timer = ecore_timer_add(0.000001f, pended_cmd_consumer_cb, NULL);
if (!s_info.pending_timer) {
ErrPrint("Failed to add a new pended command consumer\n");
- return -EFAULT;
+ return LB_STATUS_ERROR_FAULT;
}
/*!
s_info.pd_open_pending_timer = ecore_timer_add(0.000001f, pd_open_pended_cmd_consumer_cb, NULL);
if (!s_info.pd_open_pending_timer) {
ErrPrint("Failed to add a new pended command consumer\n");
- return -EFAULT;
+ return LB_STATUS_ERROR_FAULT;
}
return 0;
if (pd_is_opened(item->inst->item->pkgname) == 1) {
if (eina_list_data_find(s_info.pd_open_pending_list, item) == item) {
DbgPrint("Already pended - %s\n", item->inst->item->pkgname);
- return -EEXIST;
+ return LB_STATUS_ERROR_EXIST;
}
if (activate_pd_open_pending_consumer() < 0)
- return -EFAULT;
+ return LB_STATUS_ERROR_FAULT;
s_info.pd_open_pending_list = eina_list_append(s_info.pd_open_pending_list, item);
} else {
if (eina_list_data_find(s_info.pending_list, item) == item) {
DbgPrint("Already pended - %s\n", item->inst->item->pkgname);
- return -EEXIST;
+ return LB_STATUS_ERROR_EXIST;
}
if (activate_pending_consumer() < 0)
- return -EFAULT;
+ return LB_STATUS_ERROR_FAULT;
s_info.pending_list = eina_list_append(s_info.pending_list, item);
}
int w;
int h;
double priority;
- char *content;
- char *title;
+ char *content = NULL;
+ char *title = NULL;
int ret;
if (over)
item = data;
ret = util_get_filesize(filename);
- if (ret <= 0)
- ErrPrint("Content is updated. but invalid. ret = %d\n", ret);
+ if (ret <= 0) {
+ ErrPrint("Content is updated. but invalid. ret = %d (Update is ignored)\n", ret);
+ return EXIT_SUCCESS; /*!< To keep the callback */
+ }
+
+ ret = so_get_output_info(item->inst, &w, &h, &priority, &content, &title);
+ if (ret < 0) {
+ ErrPrint("livebox_get_info returns %d\n", ret);
+ return EXIT_SUCCESS; /*!< To keep the callback */
+ }
- (void)so_get_output_info(item->inst, &w, &h, &priority, &content, &title);
provider_send_updated(item->inst->item->pkgname, item->inst->id,
item->inst->w, item->inst->h, item->inst->priority, content, title);
s_info.pd_open_pending_list = eina_list_remove_list(s_info.pd_open_pending_list, l);
if (!s_info.pd_open_pending_list)
deactivate_pd_open_pending_consumer();
- return 0;
+ return LB_STATUS_SUCCESS;
}
- return -ENOENT;
+ return LB_STATUS_ERROR_NOT_EXIST;
}
static inline int clear_from_pending_list(struct item *item)
s_info.pending_list = eina_list_remove_list(s_info.pending_list, l);
if (!s_info.pending_list)
deactivate_pending_consumer();
- return 0;
+ return LB_STATUS_SUCCESS;
}
- return -ENOENT;
+ return LB_STATUS_ERROR_NOT_EXIST;
}
static Eina_Bool update_timeout_cb(void *data)
return ECORE_CALLBACK_RENEW;
}
-static inline void update_monitor_del(struct item *item)
+static inline void update_monitor_del(const char *id, struct item *item)
{
char *tmp;
int len;
- update_monitor_del_update_cb(util_uri_to_path(item->inst->id), file_updated_cb);
+ update_monitor_del_update_cb(util_uri_to_path(id), file_updated_cb);
- len = strlen(util_uri_to_path(item->inst->id)) + strlen(".desc") + 1;
+ len = strlen(util_uri_to_path(id)) + strlen(".desc") + 1;
tmp = malloc(len);
if (!tmp) {
- ErrPrint("Heap: %s (%s.desc)\n", strerror(errno), util_uri_to_path(item->inst->id));
+ ErrPrint("Heap: %s (%s.desc)\n", strerror(errno), util_uri_to_path(id));
return;
}
- snprintf(tmp, len, "%s.desc", util_uri_to_path(item->inst->id));
+ snprintf(tmp, len, "%s.desc", util_uri_to_path(id));
update_monitor_del_update_cb(tmp, desc_updated_cb);
free(tmp);
}
-static inline int add_desc_update_monitor(struct item *item)
+static inline int add_desc_update_monitor(const char *id, struct item *item)
{
char *filename;
int len;
- len = strlen(util_uri_to_path(item->inst->id)) + strlen(".desc") + 1;
+ len = strlen(util_uri_to_path(id)) + strlen(".desc") + 1;
filename = malloc(len);
if (!filename) {
- ErrPrint("Heap: %s (%s.desc)\n", strerror(errno), util_uri_to_path(item->inst->id));
- return -ENOMEM;
+ ErrPrint("Heap: %s (%s.desc)\n", strerror(errno), util_uri_to_path(id));
+ return LB_STATUS_ERROR_MEMORY;
}
- snprintf(filename, len, "%s.desc", util_uri_to_path(item->inst->id));
+ snprintf(filename, len, "%s.desc", util_uri_to_path(id));
DbgPrint("Add DESC monitor: %s\n", filename);
return update_monitor_add_update_cb(filename, desc_updated_cb, item);
}
-static inline int add_file_update_monitor(struct item *item)
+static inline int add_file_update_monitor(const char *id, struct item *item)
{
char *filename;
- filename = strdup(util_uri_to_path(item->inst->id));
+ filename = strdup(util_uri_to_path(id));
if (!filename) {
- ErrPrint("Heap: %s (%s)\n", strerror(errno), item->inst->id);
- return -ENOMEM;
+ ErrPrint("Heap: %s (%s)\n", strerror(errno), id);
+ return LB_STATUS_ERROR_MEMORY;
}
return update_monitor_add_update_cb(filename, file_updated_cb, item);
}
-static inline int update_monitor_add(struct item *item)
+static inline int update_monitor_add(const char *id, struct item *item)
{
- add_file_update_monitor(item);
- add_desc_update_monitor(item);
- return 0;
+ /*!
+ * \NOTE
+ * item->inst is not available yet.
+ */
+ add_file_update_monitor(id, item);
+ add_desc_update_monitor(id, item);
+ return LB_STATUS_SUCCESS;
}
HAPI int lb_init(void)
{
- return 0;
+ return LB_STATUS_SUCCESS;
}
HAPI int lb_fini(void)
lb_destroy(item->inst->item->pkgname, item->inst->id);
}
- return 0;
+ return LB_STATUS_SUCCESS;
}
/*!
}
}
- return -ENOENT;
+ return LB_STATUS_ERROR_NOT_EXIST;
}
HAPI int lb_open_pd(const char *pkgname)
tmp = strdup(pkgname);
if (!tmp) {
ErrPrint("Heap: %s\n", strerror(errno));
- return -ENOMEM;
+ return LB_STATUS_ERROR_MEMORY;
}
if (!s_info.pd_list)
* Move them to pd_open_pending_timer
*/
migrate_to_pd_open_pending_list(pkgname);
- return 0;
+ return LB_STATUS_SUCCESS;
}
HAPI int lb_close_pd(const char *pkgname)
* to pending_list.
*/
migrate_to_pending_list(pkgname);
- return 0;
+ return LB_STATUS_SUCCESS;
}
- return -ENOENT;
+ return LB_STATUS_ERROR_NOT_EXIST;
}
HAPI int lb_create(const char *pkgname, const char *id, const char *content_info, int timeout, int has_livebox_script, double period, const char *cluster, const char *category, int *w, int *h, double *priority, int skip_need_to_create, const char *abi, char **out_content, char **out_title)
inst = so_find_instance(pkgname, id);
if (inst) {
DbgPrint("Instance is already exists [%s - %s] content[%s], cluster[%s], category[%s], abi[%s]\n", pkgname, id, content_info, cluster, category, abi);
- return 0;
+ return LB_STATUS_SUCCESS;
}
if (!skip_need_to_create) {
ret = so_create_needed(pkgname, cluster, category, abi);
if (ret != NEED_TO_CREATE)
- return -EPERM;
+ return LB_STATUS_ERROR_PERMISSION;
need_to_create = 1;
}
- item = malloc(sizeof(*item));
+ item = calloc(1, sizeof(*item));
if (!item) {
ErrPrint("Heap: %s (%s - %s, content[%s], cluster[%s], category[%s], abi[%s])\n", strerror(errno), pkgname, id, content_info, cluster, category, abi);
- return -ENOMEM;
+ return LB_STATUS_ERROR_MEMORY;
}
- item->monitor = NULL;
- item->monitor_cnt = 0;
- item->deleteme = 0;
- item->update_interval = 0.0f;
- item->heavy_updating = 0;
- item->is_paused = 0;
- item->sleep_at = 0.0f;
+ ret = update_monitor_add(id, item);
+ if (ret < 0) {
+ free(item);
+ return ret;
+ }
+ DbgPrint("Content: [%s]\n", content_info);
create_ret = so_create(pkgname, id, content_info, timeout, has_livebox_script, cluster, category, abi, &inst);
if (create_ret < 0) {
+ update_monitor_del(id, item);
free(item);
*w = 0;
item->timer = util_timer_add(period, updator_cb, item);
if (!item->timer) {
ErrPrint("Failed to add timer (%s - %s, content[%s], cluster[%s], category[%s], abi[%s]\n", pkgname, id, content_info, cluster, category, abi);
+ update_monitor_del(id, item);
so_destroy(inst);
free(item);
- return -EFAULT;
+ return LB_STATUS_ERROR_FAULT;
}
if (s_info.paused)
item->timer = NULL;
}
- ret = update_monitor_add(item);
- if (ret < 0) {
- so_destroy(inst);
- if (item->timer)
- ecore_timer_del(item->timer);
- free(item);
- return ret;
- }
-
s_info.item_list = eina_list_append(s_info.item_list, item);
if (create_ret & NEED_TO_SCHEDULE) {
}
if (create_ret & OUTPUT_UPDATED) {
- char *tmp_content;
- char *tmp_title;
-
update_monitor_cnt(item);
/*!
* \note
* even if it has no updates on the content, title,
* it will set them to NULL.
*/
- (void)so_get_output_info(inst, w, h, priority, &tmp_content, &tmp_title);
+ if (so_get_output_info(inst, w, h, priority, out_content, out_title) == LB_STATUS_SUCCESS) {
+ if (*out_content) {
+ char *tmp;
- /*!
- * \note
- * These two values will be released by the provider library.
- */
- if (tmp_content) {
- *out_content = strdup(tmp_content);
- if (!*out_content)
- ErrPrint("Heap: %s\n", strerror(errno));
- }
+ tmp = strdup(*out_content);
+ if (!tmp)
+ ErrPrint("Memory: %s\n", strerror(errno));
- if (tmp_title) {
- *out_title = strdup(tmp_title);
- if (!*out_title)
- ErrPrint("Heap: %s\n", strerror(errno));
+ *out_content = tmp;
+ }
+
+ if (*out_title) {
+ char *tmp;
+
+ tmp = strdup(*out_title);
+ if (!tmp)
+ ErrPrint("Memory: %s\n", strerror(errno));
+
+ *out_title = tmp;
+ }
}
}
inst = so_find_instance(pkgname, id);
if (!inst) {
ErrPrint("Instance %s - %s is not created\n", pkgname, id);
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
l = find_item(inst);
if (!l) {
ErrPrint("Instance is not found (%s - %s)\n", pkgname, id);
- return -ENOENT;
+ return LB_STATUS_ERROR_NOT_EXIST;
}
item = eina_list_data_get(l);
if (item->monitor)
item->deleteme = 1;
else
- update_monitor_del(item);
+ update_monitor_del(id, item);
}
if (!item->monitor) {
(void)so_destroy(inst);
}
- return 0;
+ return LB_STATUS_SUCCESS;
}
HAPI int lb_resize(const char *pkgname, const char *id, int w, int h)
inst = so_find_instance(pkgname, id);
if (!inst) {
ErrPrint("Instance %s - %s is not created (%dx%d)\n", pkgname, id, w, h);
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
l = find_item(inst);
if (!l) {
ErrPrint("Instance is not found (%s - %s, %dx%d)\n", pkgname, id, w, h);
- return -ENOENT;
+ return LB_STATUS_ERROR_NOT_EXIST;
}
item = eina_list_data_get(l);
if (ret & OUTPUT_UPDATED)
update_monitor_cnt(item);
- return 0;
+ return LB_STATUS_SUCCESS;
}
HAPI char *lb_pinup(const char *pkgname, const char *id, int pinup)
inst = so_find_instance(pkgname, id);
if (!inst) {
ErrPrint("Instance %s - %s is not found (period[%lf])\n", pkgname, id, period);
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
l = find_item(inst);
if (!l) {
ErrPrint("Instance is not found (%s - %s, period[%lf])\n", pkgname, id, period);
- return -ENOENT;
+ return LB_STATUS_ERROR_NOT_EXIST;
}
item = eina_list_data_get(l);
item->timer = util_timer_add(period, updator_cb, item);
if (!item->timer) {
ErrPrint("Failed to add timer (%s - %s)\n", pkgname, id);
- return -EFAULT;
+ return LB_STATUS_ERROR_FAULT;
}
if (s_info.paused)
}
}
- return 0;
+ return LB_STATUS_SUCCESS;
}
HAPI int lb_clicked(const char *pkgname, const char *id, const char *event, double timestamp, double x, double y)
inst = so_find_instance(pkgname, id);
if (!inst) {
ErrPrint("Instance %s - %s is not exists (event[%s])\n", pkgname, id, event);
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
l = find_item(inst);
if (!l) {
ErrPrint("Instance is not found (%s - %s, event[%s])\n", pkgname, id, event);
- return -ENOENT;
+ return LB_STATUS_ERROR_NOT_EXIST;
}
item = eina_list_data_get(l);
if (ret & OUTPUT_UPDATED)
update_monitor_cnt(item);
- return 0;
+ return LB_STATUS_SUCCESS;
}
HAPI int lb_script_event(const char *pkgname, const char *id, const char *emission, const char *source, struct event_info *event_info)
inst = so_find_instance(pkgname, id);
if (!inst) {
ErrPrint("Instance %s - %s is not exists (emission[%s], source[%s])\n", pkgname, id, emission, source);
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
l = find_item(inst);
if (!l) {
ErrPrint("Instance is not found (%s - %s, emissino[%s], source[%s])\n", pkgname, id, emission, source);
- return -ENOENT;
+ return LB_STATUS_ERROR_NOT_EXIST;
}
item = eina_list_data_get(l);
if (ret & OUTPUT_UPDATED)
update_monitor_cnt(item);
- return 0;
+ return LB_STATUS_SUCCESS;
}
HAPI int lb_is_pinned_up(const char *pkgname, const char *id)
inst = so_find_instance(pkgname, id);
if (!inst) {
ErrPrint("Instance %s - %s is not created\n", pkgname, id);
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
l = find_item(inst);
if (!l) {
ErrPrint("Instance is not found(%s - %s)\n", pkgname, id);
- return -ENOENT;
+ return LB_STATUS_ERROR_NOT_EXIST;
}
item = eina_list_data_get(l);
if (!item) {
ErrPrint("Invalid item(%s - %s)\n", pkgname, id);
- return -EFAULT;
+ return LB_STATUS_ERROR_FAULT;
}
/*!
* NOTE:
inst = so_find_instance(pkgname, id);
if (!inst) {
ErrPrint("Instance %s - %s is not created (cluster[%s], category[%s])\n", pkgname, id, cluster, category);
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
l = find_item(inst);
if (!l) {
ErrPrint("Instance is not found(%s - %s, cluster[%s], category[%s])\n", pkgname, id, cluster, category);
- return -ENOENT;
+ return LB_STATUS_ERROR_NOT_EXIST;
}
item = eina_list_data_get(l);
if (ret & OUTPUT_UPDATED)
update_monitor_cnt(item);
- return 0;
+ return LB_STATUS_SUCCESS;
}
static inline int lb_sys_event(struct instance *inst, struct item *item, int event)
if (ret & OUTPUT_UPDATED)
update_monitor_cnt(item);
- return 0;
+ return LB_STATUS_SUCCESS;
}
HAPI int lb_system_event(const char *pkgname, const char *id, int event)
inst = so_find_instance(pkgname, id);
if (!inst) {
ErrPrint("instance %s - %s is not created\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
l = find_item(inst);
if (!l) {
ErrPrint("Instance is not found(%s - %s)\n", pkgname, id);
- return -ENOENT;
+ return LB_STATUS_ERROR_NOT_EXIST;
}
item = eina_list_data_get(l);
inst = so_find_instance(pkgname, id);
if (!inst) {
ErrPrint("Instance %s - %s is not created\n", pkgname, id);
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
l = find_item(inst);
if (!l) {
ErrPrint("Instance is not found(%s - %s)\n", pkgname, id);
- return -ENOENT;
+ return LB_STATUS_ERROR_NOT_EXIST;
}
item = eina_list_data_get(l);
(void)append_pending_list(item);
- return 0;
+ return LB_STATUS_SUCCESS;
}
HAPI int lb_update_all(const char *pkgname, const char *cluster, const char *category)
}
}
- return 0;
+ return LB_STATUS_SUCCESS;
}
HAPI int lb_system_event_all(int event)
lb_sys_event(item->inst, item, event);
}
- return 0;
+ return LB_STATUS_SUCCESS;
}
HAPI void lb_pause_all(void)
inst = so_find_instance(pkgname, id);
if (!inst)
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
l = find_item(inst);
if (!l) {
ErrPrint("Instance is not found (%s - %s)\n", pkgname, id);
- return -ENOENT;
+ return LB_STATUS_ERROR_NOT_EXIST;
}
item = eina_list_data_get(l);
if (!item)
- return -EFAULT;
+ return LB_STATUS_ERROR_FAULT;
if (item->deleteme) {
DbgPrint("Instance %s will be deleted (%s)\n", item->inst->item->pkgname, item->inst->id);
- return -EBUSY;
+ return LB_STATUS_ERROR_BUSY;
}
item->is_paused = 1;
if (s_info.paused) {
DbgPrint("Already paused: %s\n", item->inst->id);
- return 0;
+ return LB_STATUS_SUCCESS;
}
if (item->timer)
lb_sys_event(inst, item, LB_SYS_EVENT_PAUSED);
- return 0;
+ return LB_STATUS_SUCCESS;
}
HAPI int lb_resume(const char *pkgname, const char *id)
inst = so_find_instance(pkgname, id);
if (!inst)
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
l = find_item(inst);
if (!l) {
ErrPrint("Instance is not found (%s - %s)\n", pkgname, id);
- return -ENOENT;
+ return LB_STATUS_ERROR_NOT_EXIST;
}
item = eina_list_data_get(l);
if (!item)
- return -EFAULT;
+ return LB_STATUS_ERROR_FAULT;
if (item->deleteme) {
DbgPrint("Instance %s will be deleted (%s)\n", item->inst->item->pkgname, item->inst->id);
- return -EBUSY;
+ return LB_STATUS_ERROR_BUSY;
}
item->is_paused = 0;
if (s_info.paused) {
DbgPrint("Instance %s is still paused\n", item->inst->id);
- return 0;
+ return LB_STATUS_SUCCESS;
}
if (item->timer)
timer_thaw(item);
lb_sys_event(inst, item, LB_SYS_EVENT_RESUMED);
- return 0;
+ return LB_STATUS_SUCCESS;
}
HAPI void lb_turn_secured_on(void)
/*
- * Copyright 2012 Samsung Electronics Co., Ltd
+ * Copyright 2013 Samsung Electronics Co., Ltd
*
* Licensed under the Flora License, Version 1.0 (the "License");
* you may not use this file except in compliance with the License.
/*
- * Copyright 2012 Samsung Electronics Co., Ltd
+ * Copyright 2013 Samsung Electronics Co., Ltd
*
* Licensed under the Flora License, Version 1.0 (the "License");
* you may not use this file except in compliance with the License.
#include <provider.h>
#include <heap-monitor.h>
#include <livebox-service.h>
+#include <livebox-errno.h>
#include "main.h"
#include "critical_log.h"
{
struct instance *inst;
- inst = malloc(sizeof(*inst));
+ inst = calloc(1, sizeof(*inst));
if (!inst) {
ErrPrint("Heap: %s\n", strerror(errno));
return NULL;
return NULL;
}
+ DbgPrint("Default content: [%s]\n", content);
if (content) {
inst->content = strdup(content);
if (!inst->content) {
free(inst);
return NULL;
}
- } else {
- inst->content = NULL;
}
if (cluster) {
free(inst);
return NULL;
}
- } else {
- inst->cluster = NULL;
}
if (category) {
free(inst);
return NULL;
}
- } else {
- inst->category = NULL;
}
- inst->w = 0;
- inst->h = 0;
- inst->priority = 0;
- inst->title = NULL;
-
return inst;
}
free(inst->content);
free(inst->title);
free(inst);
- return 0;
+ return LB_STATUS_SUCCESS;
}
static inline struct instance *find_instance(struct so_item *item, const char *id)
inst = find_instance(item, id);
if (inst) {
ErrPrint("Instance: %s - %s is already exists\n", pkgname, id);
- return -EEXIST;
+ return LB_STATUS_ERROR_EXIST;
}
} else {
if (!strcasecmp(abi, "c"))
else
item = new_adaptor(pkgname, abi);
if (!item)
- return -EFAULT;
+ return LB_STATUS_ERROR_FAULT;
}
inst = new_instance(id, content_info, cluster, category);
if (!item->inst_list)
delete_livebox(item);
- return -EFAULT;
+ return LB_STATUS_ERROR_FAULT;
}
item->inst_list = eina_list_append(item->inst_list, inst);
else if (item->livebox.create)
ret = item->livebox.create(util_uri_to_path(id), content_info, cluster, category);
else /*! \NOTE: This is not possible, but for the exceptional handling */
- ret = -ENOSYS;
+ ret = LB_STATUS_ERROR_NOT_IMPLEMENTED;
fault_unmark_call(pkgname, id, __func__, USE_ALARM);
item = inst->item;
if (!item)
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
fault_mark_call(item->pkgname, inst->id, __func__, USE_ALARM, DEFAULT_LIFE_TIMER);
else if (item->livebox.destroy)
ret = item->livebox.destroy(util_uri_to_path(inst->id));
else
- ret = -ENOSYS;
+ ret = LB_STATUS_ERROR_NOT_IMPLEMENTED;
fault_unmark_call(item->pkgname, inst->id, __func__, USE_ALARM);
item = inst->item;
if (!item)
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
fault_mark_call(item->pkgname, inst->id, __func__, USE_ALARM, DEFAULT_LIFE_TIMER);
if (item->adaptor.is_pinned_up)
else if (item->livebox.is_pinned_up)
ret = item->livebox.is_pinned_up(util_uri_to_path(inst->id));
else
- ret = -ENOSYS;
+ ret = LB_STATUS_ERROR_NOT_IMPLEMENTED;
fault_unmark_call(item->pkgname, inst->id, __func__, USE_ALARM);
return ret;
}
item = inst->item;
if (!item)
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
fault_mark_call(item->pkgname, inst->id, __func__, USE_ALARM, DEFAULT_LIFE_TIMER);
else if (item->livebox.is_updated)
ret = item->livebox.is_updated(util_uri_to_path(inst->id));
else
- ret = -ENOSYS;
+ ret = LB_STATUS_ERROR_NOT_IMPLEMENTED;
fault_unmark_call(item->pkgname, inst->id, __func__, USE_ALARM);
item = inst->item;
if (!item)
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
fault_mark_call(item->pkgname, inst->id, __func__, USE_ALARM, DEFAULT_LIFE_TIMER);
else if (item->livebox.need_to_destroy)
ret = item->livebox.need_to_destroy(util_uri_to_path(inst->id));
else
- ret = -ENOSYS;
+ ret = LB_STATUS_ERROR_NOT_IMPLEMENTED;
fault_unmark_call(item->pkgname, inst->id, __func__, USE_ALARM);
item = inst->item;
if (!item)
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
fault_mark_call(item->pkgname, inst->id, __func__, USE_ALARM, DEFAULT_LIFE_TIMER);
else if (item->livebox.update_content)
ret = item->livebox.update_content(util_uri_to_path(inst->id));
else
- ret = -ENOSYS;
+ ret = LB_STATUS_ERROR_NOT_IMPLEMENTED;
fault_unmark_call(item->pkgname, inst->id, __func__, USE_ALARM);
return ret;
item = inst->item;
if (!item)
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
fault_mark_call(item->pkgname, inst->id, __func__, USE_ALARM, DEFAULT_LIFE_TIMER);
else if (item->livebox.clicked)
ret = item->livebox.clicked(util_uri_to_path(inst->id), event, timestamp, x, y);
else
- ret = -ENOSYS;
+ ret = LB_STATUS_ERROR_NOT_IMPLEMENTED;
fault_unmark_call(item->pkgname, inst->id, __func__, USE_ALARM);
item = inst->item;
if (!item)
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
fault_mark_call(item->pkgname, inst->id, __func__, USE_ALARM, DEFAULT_LIFE_TIMER);
else if (item->livebox.script_event)
ret = item->livebox.script_event(util_uri_to_path(inst->id), emission, source, event_info);
else
- ret = -ENOSYS;
+ ret = LB_STATUS_ERROR_NOT_IMPLEMENTED;
fault_unmark_call(item->pkgname, inst->id, __func__, USE_ALARM);
item = inst->item;
if (!item)
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
type = livebox_service_size_type(w, h);
if (type == LB_SIZE_TYPE_UNKNOWN)
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
fault_mark_call(item->pkgname, inst->id, __func__, USE_ALARM, DEFAULT_LIFE_TIMER);
else if (item->livebox.resize)
ret = item->livebox.resize(util_uri_to_path(inst->id), type);
else
- ret = -ENOSYS;
+ ret = LB_STATUS_ERROR_NOT_IMPLEMENTED;
fault_unmark_call(item->pkgname, inst->id, __func__, USE_ALARM);
else
item = new_adaptor(pkgname, abi);
if (!item)
- return -EFAULT;
+ return LB_STATUS_ERROR_FAULT;
}
fault_mark_call(item->pkgname, __func__, __func__, USE_ALARM, DEFAULT_LIFE_TIMER);
else if (item->livebox.create_needed)
ret = item->livebox.create_needed(cluster, category);
else
- ret = -ENOSYS;
+ ret = LB_STATUS_ERROR_NOT_IMPLEMENTED;
fault_unmark_call(item->pkgname, __func__, __func__, USE_ALARM);
item = inst->item;
if (!item)
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
tmp_cluster = strdup(cluster);
if (!tmp_cluster)
- return -ENOMEM;
+ return LB_STATUS_ERROR_MEMORY;
tmp_category = strdup(category);
if (!tmp_category) {
free(tmp_cluster);
- return -ENOMEM;
+ return LB_STATUS_ERROR_MEMORY;
}
fault_mark_call(item->pkgname, inst->id, __func__, USE_ALARM, DEFAULT_LIFE_TIMER);
else if (item->livebox.change_group)
ret = item->livebox.change_group(util_uri_to_path(inst->id), cluster, category);
else
- ret = -ENOSYS;
+ ret = LB_STATUS_ERROR_NOT_IMPLEMENTED;
fault_unmark_call(item->pkgname, inst->id, __func__, USE_ALARM);
if (ret >= 0) {
item = inst->item;
if (!item)
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
*content = NULL;
*title = NULL;
else if (item->livebox.get_output_info)
ret = item->livebox.get_output_info(util_uri_to_path(inst->id), w, h, priority, content, title);
else
- ret = -ENOSYS;
+ ret = LB_STATUS_ERROR_NOT_IMPLEMENTED;
fault_unmark_call(item->pkgname, inst->id, __func__, USE_ALARM);
if (ret >= 0) {
item = inst->item;
if (!item)
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
fault_mark_call(item->pkgname, inst->id, __func__, USE_ALARM, DEFAULT_LIFE_TIMER);
if (item->adaptor.sys_event)
else if (item->livebox.sys_event)
ret = item->livebox.sys_event(util_uri_to_path(inst->id), event);
else
- ret = -ENOSYS;
+ ret = LB_STATUS_ERROR_NOT_IMPLEMENTED;
fault_unmark_call(item->pkgname, inst->id, __func__, USE_ALARM);
return ret;
/*
- * Copyright 2012 Samsung Electronics Co., Ltd
+ * Copyright 2013 Samsung Electronics Co., Ltd
*
* Licensed under the Flora License, Version 1.0 (the "License");
* you may not use this file except in compliance with the License.
#include <Eina.h>
#include <dlog.h>
+#include <livebox-errno.h>
#include "critical_log.h"
#include "update_monitor.h"
s_info.ifd = inotify_init();
if (s_info.ifd < 0) {
ErrPrint("Error: %s\n", strerror(errno));
- return -EIO;
+ return LB_STATUS_ERROR_IO;
}
if (access(IMAGE_PATH, R_OK | X_OK) != 0) {
ErrPrint("Image folder is not exists\n");
- return -EIO;
+ return LB_STATUS_ERROR_IO;
}
s_info.iwd = inotify_add_watch(s_info.ifd, IMAGE_PATH,
if (s_info.iwd < 0) {
ErrPrint("Error: %s\n", strerror(errno));
close(s_info.ifd);
- s_info.ifd = -EINVAL;
- return -EIO;
+ s_info.ifd = LB_STATUS_ERROR_INVALID;
+ return LB_STATUS_ERROR_IO;
}
s_info.handler = ecore_main_fd_handler_add(s_info.ifd,
s_info.iwd = -EINVAL;
close(s_info.ifd);
- s_info.ifd = -EINVAL;
- return -EFAULT;
+ s_info.ifd = LB_STATUS_ERROR_INVALID;
+ return LB_STATUS_ERROR_FAULT;
}
DbgPrint("Update monitor is successfully initialized\n");
- return 0;
+ return LB_STATUS_SUCCESS;
}
HAPI int update_monitor_fini(void)
if (inotify_rm_watch(s_info.ifd, s_info.iwd) < 0)
ErrPrint("inotify_rm_watch:%s", strerror(errno));
- s_info.iwd = -EINVAL;
+ s_info.iwd = LB_STATUS_ERROR_INVALID;
close(s_info.ifd);
- s_info.ifd = -EINVAL;
+ s_info.ifd = LB_STATUS_ERROR_INVALID;
}
- return 0;
+ return LB_STATUS_SUCCESS;
}
HAPI int update_monitor_add_update_cb(const char *filename,
item = calloc(1, sizeof(*item));
if (!item) {
ErrPrint("calloc:%s\n", strerror(errno));
- return -ENOMEM;
+ return LB_STATUS_ERROR_MEMORY;
}
item->filename = strdup(filename);
if (!item->filename) {
ErrPrint("Error: %s\n", strerror(errno));
free(item);
- return -ENOMEM;
+ return LB_STATUS_ERROR_MEMORY;
}
item->cb = cb;
item->data = data;
s_info.update_list = eina_list_append(s_info.update_list, item);
- return 0;
+ return LB_STATUS_SUCCESS;
}
HAPI int update_monitor_add_delete_cb(const char *filename,
item = calloc(1, sizeof(*item));
if (!item) {
ErrPrint("calloc:%s", strerror(errno));
- return -ENOMEM;
+ return LB_STATUS_ERROR_MEMORY;
}
item->filename = strdup(filename);
if (!item->filename) {
ErrPrint("Error: %s\n", strerror(errno));
free(item);
- return -ENOMEM;
+ return LB_STATUS_ERROR_MEMORY;
}
item->cb = cb;
item->data = data;
s_info.delete_list = eina_list_append(s_info.delete_list, item);
- return 0;
+ return LB_STATUS_SUCCESS;
}
HAPI void *update_monitor_del_update_cb(const char *filename,
/*
- * Copyright 2012 Samsung Electronics Co., Ltd
+ * Copyright 2013 Samsung Electronics Co., Ltd
*
* Licensed under the Flora License, Version 1.0 (the "License");
* you may not use this file except in compliance with the License.
#include <dlfcn.h>
#include <pthread.h>
-#include <dlog.h>
-#include <aul.h>
-
#include <Eina.h>
#include <Ecore.h>
+#include <dlog.h>
+#include <aul.h>
+#include <livebox-errno.h>
+
#include "critical_log.h"
#include "util.h"
#include "conf.h"
if (stat(filename, &buf) < 0) {
ErrPrint("error: %s\n", strerror(errno));
- return -EIO;
+ return LB_STATUS_ERROR_IO;
}
if (!S_ISREG(buf.st_mode)) {
ErrPrint("%s is not a file\n", filename);
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
return buf.st_size;