summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjk7744.park <jk7744.park@samsung.com>2015-02-01 13:07:23 +0900
committerjk7744.park <jk7744.park@samsung.com>2015-02-01 13:07:23 +0900
commit1a66c546f984e8280d9f210dcdff54461637561a (patch)
tree4a271a32ddbd329bdc91b33f40e535953a4d8adb
parent9f4e274e2589fe8fa69cd0c4f14936851dd694c6 (diff)
downloadlivebox-service-tizen_2.3.tar.gz
livebox-service-tizen_2.3.tar.bz2
livebox-service-tizen_2.3.zip
-rw-r--r--CMakeLists.txt95
-rw-r--r--TC/testcase/Makefile29
-rw-r--r--TC/testcase/tslist2
-rw-r--r--TC/testcase/utc_livebox_service.c815
-rw-r--r--doc/livebox-service_doc.h26
-rw-r--r--dynamicbox_service/CMakeLists.txt105
-rw-r--r--dynamicbox_service/LICENSE (renamed from LICENSE)0
-rw-r--r--dynamicbox_service/doc/dynamicbox_service_doc.h113
-rw-r--r--dynamicbox_service/dynamicbox_service.pc.in11
-rw-r--r--dynamicbox_service/include/debug.h (renamed from include/debug.h)9
-rw-r--r--dynamicbox_service/include/dlist.h (renamed from include/dlist.h)14
-rw-r--r--dynamicbox_service/include/dynamicbox_buffer.h203
-rw-r--r--dynamicbox_service/include/dynamicbox_cmd_list.h392
-rw-r--r--dynamicbox_service/include/dynamicbox_conf.h560
-rw-r--r--dynamicbox_service/include/dynamicbox_errno.h104
-rw-r--r--dynamicbox_service/include/dynamicbox_script.h91
-rw-r--r--dynamicbox_service/include/dynamicbox_service.h1119
-rw-r--r--dynamicbox_service/include/util.h (renamed from include/util.h)38
-rw-r--r--dynamicbox_service/src/dlist.c (renamed from src/dlist.c)0
-rw-r--r--dynamicbox_service/src/dynamicbox_conf.c1793
-rw-r--r--dynamicbox_service/src/dynamicbox_service.c (renamed from src/livebox-service.c)1866
-rw-r--r--dynamicbox_service/src/util.c (renamed from src/util.c)91
-rw-r--r--dynamicbox_service/src/util_wayland.c (renamed from src/util_wayland.c)17
-rw-r--r--dynamicbox_service/src/util_x11.c (renamed from src/util_x11.c)154
-rw-r--r--include/livebox-errno.h68
-rw-r--r--include/livebox-service.h833
-rw-r--r--livebox-service/CMakeLists.txt61
-rw-r--r--livebox-service/LICENSE206
-rw-r--r--livebox-service/include/livebox-errno.h70
-rw-r--r--livebox-service/include/livebox-service.h812
-rw-r--r--livebox-service/livebox-service.pc.in (renamed from livebox-service.pc.in)2
-rw-r--r--livebox-service/src/livebox-service.c234
-rw-r--r--packaging/libdynamicbox_service.manifest (renamed from packaging/liblivebox-service.manifest)0
-rw-r--r--packaging/libdynamicbox_service.spec131
-rw-r--r--packaging/liblivebox-service.spec94
-rw-r--r--packaging/liblivebox-service.spec.rej11
36 files changed, 7382 insertions, 2787 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5b983be..634945a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,95 +1,6 @@
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
-PROJECT(livebox-service C)
-SET(PREFIX ${CMAKE_INSTALL_PREFIX})
-SET(EXEC_PREFIX "\${prefix}")
-SET(PROJECT_NAME "${PROJECT_NAME}")
-SET(LIBDIR ${LIB_INSTALL_DIR})
-SET(INCLUDEDIR "\${prefix}/include/${PROJECT_NAME}")
-SET(VERSION_MAJOR 0)
-SET(VERSION "${VERSION_MAJOR}.0.1")
+ADD_SUBDIRECTORY(dynamicbox_service)
+ADD_SUBDIRECTORY(livebox-service)
-set(CMAKE_SKIP_BUILD_RPATH true)
-
-INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
-
-INCLUDE(FindPkgConfig)
-pkg_check_modules(pkgs REQUIRED
- dlog
- glib-2.0
- gio-2.0
- com-core
- sqlite3
- db-util
- pkgmgr
- pkgmgr-info
- vconf
- ail
- icu-uc
-)
-
-IF (X11_SUPPORT)
-pkg_check_modules(pkg_extra REQUIRED
- x11
-)
-ENDIF (X11_SUPPORT)
-
-IF (WAYLAND_SUPPORT)
-# Nothing provided yet.
-ENDIF (WAYLAND_SUPPORT)
-
-FOREACH(flag ${pkgs_CFLAGS})
- SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
-ENDFOREACH(flag)
-FOREACH(flag ${pkg_extra_CFLAGS})
- SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
-ENDFOREACH(flag)
-
-SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fvisibility=hidden -Wall -Werror -Winline -g")
-
-SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
-
-ADD_DEFINITIONS("-DPREFIX=\"${PREFIX}\"")
-ADD_DEFINITIONS("-DLOG_TAG=\"LIVEBOX_SERVICE\"")
-ADD_DEFINITIONS("-DNDEBUG")
-ADD_DEFINITIONS("-D_USE_ECORE_TIME_GET")
-ADD_DEFINITIONS("-DSERVICE_SOCKET=\"/opt/usr/share/live_magazine/.service.socket\"")
-ADD_DEFINITIONS("-DRESOLUTION_FILE=\"/usr/share/data-provider-master/resolution.ini\"")
-ADD_DEFINITIONS("-DDB_FILE=\"/opt/dbspace/.livebox.db\"")
-
-SET(BUILD_SOURCE
- src/dlist.c
- src/livebox-service.c
- src/util.c
-)
-
-IF (X11_SUPPORT)
- ADD_DEFINITIONS("-DHAVE_X11")
- SET(BUILD_SOURCE
- ${BUILD_SOURCE}
- src/util_x11.c
- )
-ENDIF (X11_SUPPORT)
-
-IF (WAYLAND_SUPPORT)
- ADD_DEFINITIONS("-DHAVE_WAYLAND")
- SET(BUILD_SOURCE
- ${BUILD_SOURCE}
- src/util_wayland.c
- )
-ENDIF (WAYLAND_SUPPORT)
-
-ADD_LIBRARY(${PROJECT_NAME} SHARED ${BUILD_SOURCE})
-
-SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES SOVERSION ${VERSION_MAJOR})
-SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES VERSION ${VERSION})
-TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${pkgs_LDFLAGS} ${pkg_extra_LDFLAGS})
-
-CONFIGURE_FILE(${PROJECT_NAME}.pc.in ${PROJECT_NAME}.pc @ONLY)
-SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${PROJECT_NAME}.pc")
-
-INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${LIB_INSTALL_DIR})
-INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
-INSTALL(FILES ${CMAKE_SOURCE_DIR}/include/livebox-service.h DESTINATION include/${PROJECT_NAME})
-INSTALL(FILES ${CMAKE_SOURCE_DIR}/include/livebox-errno.h DESTINATION include/${PROJECT_NAME})
-INSTALL(FILES ${CMAKE_SOURCE_DIR}/LICENSE DESTINATION /usr/share/license RENAME "lib${PROJECT_NAME}")
+ADD_DEPENDENCIES(livebox-service dynamicbox_service)
diff --git a/TC/testcase/Makefile b/TC/testcase/Makefile
deleted file mode 100644
index 41dc491..0000000
--- a/TC/testcase/Makefile
+++ /dev/null
@@ -1,29 +0,0 @@
-include ../config
-
-CC ?= gcc
-
-C_FILES = $(shell ls *.c)
-
-PKGS = $(PKG_NAME)
-PKGS += glib-2.0
-PKGS += dlog
-LDFLAGS = `pkg-config --libs $(PKGS)`
-LDFLAGS += $(TET_ROOT)/lib/tet3/tcm_s.o
-LDFLAGS += -L$(TET_ROOT)/lib/tet3 -ltcm_s
-LDFLAGS += -L$(TET_ROOT)/lib/tet3 -lapi_s
-
-CFLAGS = -I. `pkg-config --cflags $(PKGS)`
-CFLAGS += -I$(TET_ROOT)/inc/tet3
-CFLAGS += -Wall
-CFLAGS += -DTIZEN_ENGINEER_MODE
-CFLAGS += -DTIZEN_DEBUG_ENABLE
-
-TCS := $(shell ls -1 *.c | cut -d. -f1)
-
-all: $(TCS)
-
-%: %.c
- $(CC) -o $@ $< $(CFLAGS) $(LDFLAGS)
-
-clean:
- rm -f $(TCS)
diff --git a/TC/testcase/tslist b/TC/testcase/tslist
deleted file mode 100644
index 6537934..0000000
--- a/TC/testcase/tslist
+++ /dev/null
@@ -1,2 +0,0 @@
-/testcase/utc_livebox_service
-
diff --git a/TC/testcase/utc_livebox_service.c b/TC/testcase/utc_livebox_service.c
deleted file mode 100644
index acded8c..0000000
--- a/TC/testcase/utc_livebox_service.c
+++ /dev/null
@@ -1,815 +0,0 @@
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the License);
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an AS IS BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#define LOG_TAG "LIVEBOX_SERVICE_TC"
-
-#include <tet_api.h>
-#include <stdlib.h>
-
-#include <dlog.h>
-#include <livebox-service.h>
-#include <livebox-errno.h>
-
-#define MUSIC_APP "org.tizen.music-player"
-#define MUSIC_LIVEBOX MUSIC_APP ".livebox"
-#define MUSIC_EASYBOX "org.tizen.music-player.easymode.livebox"
-#define TWITTER_APP "org.tizen.twitter"
-#define TWITTER_FIRENDS_LIVEBOX "org.tizen.twitter.dbox.friends"
-#define TWITTER_TWEET_LIVEBOX "org.tizen.twitter.dbox.tweet"
-
-static struct info {
- struct pkglist_handle *handle;
-} s_info = {
- .handle = NULL,
-};
-
-enum {
- POSITIVE_TC_IDX = 0x01,
- NEGATIVE_TC_IDX,
-};
-
-static void startup(void)
-{
- /* start of TC */
- tet_printf("\n TC start");
- (void)livebox_service_init();
-}
-
-
-static void cleanup(void)
-{
- /* end of TC */
- tet_printf("\n TC end");
- (void)livebox_service_fini();
-}
-
-void (*tet_startup)(void) = startup;
-void (*tet_cleanup)(void) = cleanup;
-
-static void utc_livebox_service_get_size_n(void)
-{
- LOGD("");
- int ret;
- int w;
- int h;
-
- ret = livebox_service_get_size(LB_SIZE_TYPE_UNKNOWN, &w, &h);
- dts_check_eq("livebox_service_get_size", ret, LB_STATUS_ERROR_INVALID, "invalid size should returns LB_STATUS_ERROR_INVALID\n");
-}
-
-static void utc_livebox_service_get_size_p(void)
-{
- LOGD("");
- int ret;
- int w;
- int h;
- ret = livebox_service_get_size(LB_SIZE_TYPE_1x1, &w, &h);
- dts_check_eq("livebox_service_get_size", ret, LB_STATUS_SUCCESS, "valid size should returns LB_STATUS_SUCCES\n");
-}
-
-static void utc_livebox_service_size_type_n(void)
-{
- LOGD("");
- int ret;
- ret = livebox_service_size_type(1, 1);
- dts_check_eq("livebox_service_size_type", ret, LB_SIZE_TYPE_UNKNOWN, "invalid size should returns LB_SIZE_TYPE_UNKNOWN\n");
-}
-
-static void utc_livebox_service_size_type_p(void)
-{
- LOGD("");
- int ret;
- int w;
- int h;
- int old;
-
- old = livebox_service_get_size(LB_SIZE_TYPE_1x1, &w, &h);
-
- ret = livebox_service_size_type(w, h);
- dts_check_eq("livebox_service_size_type", ret, LB_SIZE_TYPE_1x1, "LB_SIZE_TYPE_1x1 should returns\n");
-}
-
-static void utc_livebox_service_mouse_event_n(void)
-{
- LOGD("");
- int ret;
- ret = livebox_service_mouse_event(NULL);
- dts_check_eq("livebox_service_mouse_event", ret, 0, "Invalid package name returns 0\n");
-}
-
-static void utc_livebox_service_mouse_event_p(void)
-{
- LOGD("");
- int ret;
- ret = livebox_service_mouse_event(MUSIC_EASYBOX);
- dts_check_eq("livebox_service_mouse_event", ret, 1, "music player returns 1\n");
-}
-
-static void utc_livebox_service_touch_effect_n(void)
-{
- LOGD("");
- int ret;
- ret = livebox_service_touch_effect(NULL, LB_SIZE_TYPE_1x1);
- dts_check_eq("livebox_service_touch_effect", ret, 1, "Default touch effect is 1\n");
-}
-
-static void utc_livebox_service_touch_effect_p(void)
-{
- LOGD("");
- int ret;
- ret = livebox_service_touch_effect(MUSIC_LIVEBOX, LB_SIZE_TYPE_1x1);
- dts_check_eq("livebox_service_touch_effect", ret, 1, "Default touch effect is 1\n");
-}
-
-static void utc_livebox_service_need_frame_n(void)
-{
- LOGD("");
- int ret;
- ret = livebox_service_need_frame(NULL, LB_SIZE_TYPE_1x1);
- dts_check_eq("livebox_service_need_frame", ret, 0, "Default need_frame is 0\n");
-}
-
-static void utc_livebox_service_need_frame_p(void)
-{
- LOGD("");
- int ret;
- ret = livebox_service_need_frame(MUSIC_LIVEBOX, LB_SIZE_TYPE_1x1);
- dts_check_eq("livebox_service_need_frame", ret, 0, "Default need_frame is 0\n");
-}
-
-static void utc_livebox_service_trigger_update_n(void)
-{
- LOGD("");
- int ret;
- ret = livebox_service_trigger_update(NULL, NULL, NULL, NULL, 0);
- dts_check_eq("livebox_service_trigger_update", ret, LB_STATUS_ERROR_INVALID, "Invalid livebox\n");
-}
-
-static void utc_livebox_service_trigger_update_p(void)
-{
- LOGD("");
- int ret;
- ret = livebox_service_trigger_update(MUSIC_LIVEBOX, NULL, NULL, NULL, 0);
- dts_check_eq("livebox_service_trigger_update", ret, LB_STATUS_SUCCESS, "Invalid livebox\n");
-}
-
-static void utc_livebox_service_trigger_update_with_content_n(void)
-{
- LOGD("");
- int ret;
- ret = livebox_service_trigger_update_with_content(NULL, NULL, NULL, NULL, NULL, 0);
- dts_check_eq("livebox_service_trigger_update_with_content", ret, LB_STATUS_ERROR_INVALID, "Invalid livebox\n");
-}
-
-static void utc_livebox_service_trigger_update_with_content_p(void)
-{
- LOGD("");
- int ret;
- ret = livebox_service_trigger_update_with_content(MUSIC_LIVEBOX, NULL, NULL, NULL, NULL, 0);
- dts_check_eq("livebox_service_trigger_update_with_content", ret, LB_STATUS_ERROR_INVALID, "Invalid livebox\n");
-}
-
-static void utc_livebox_service_change_period_n(void)
-{
- LOGD("");
- int ret;
-
- ret = livebox_service_change_period(NULL, NULL, 0.0f);
- dts_check_eq("livebox_service_change_period", ret, LB_STATUS_ERROR_INVALID, "Invalid livebox\n");
-}
-
-static void utc_livebox_service_change_period_p(void)
-{
- LOGD("");
- int ret;
-
- /*!
- * \note
- * Unable to know the ID of livebox instances from this TC
- * So we cannot test it for positive cases
- */
- ret = livebox_service_change_period(MUSIC_LIVEBOX, NULL, 1.0f);
- dts_check_eq("livebox_service_change_period", ret, LB_STATUS_ERROR_INVALID, "Invalid livebox\n");
-}
-
-static int get_pkglist_cb(const char *pkgid, const char *lbid, int is_prime, void *data)
-{
- return 0;
-}
-
-static void utc_livebox_service_get_pkglist_n(void)
-{
- LOGD("");
- int ret;
- ret = livebox_service_get_pkglist(NULL, NULL);
- dts_check_eq("livebox_service_get_pkglist", ret, LB_STATUS_ERROR_INVALID, "Invalid callback\n");
-}
-
-static void utc_livebox_service_get_pkglist_p(void)
-{
- LOGD("");
- int ret;
- ret = livebox_service_get_pkglist(get_pkglist_cb, NULL);
- dts_check_ge("livebox_service_get_pkglist", ret, 0, "Valid callback\n");
-}
-
-static void utc_livebox_service_get_applist_n(void)
-{
- LOGD("");
- int ret;
- ret = livebox_service_get_applist(NULL, NULL, NULL);
- dts_check_eq("livebox_service_get_applist", ret, LB_STATUS_ERROR_INVALID, "LB_STATUS_ERROR_INVALID\n");
-}
-
-static void app_list_cb(const char *lbid, const char *appid, void *data)
-{
-}
-
-static void utc_livebox_service_get_applist_p(void)
-{
- LOGD("");
- int ret;
-
- // Getting the UI-App list
- ret = livebox_service_get_applist(MUSIC_LIVEBOX, app_list_cb, NULL);
- dts_check_eq("livebox_service_get_applist", ret, LB_STATUS_SUCCESS, "LB_STATUS_ERROR_INVALID\n");
-}
-
-static void utc_livebox_service_mainappid_n(void)
-{
- LOGD("");
- const char *appid;
- appid = livebox_service_mainappid(NULL);
- dts_check_eq("livebox_service_mainappid", appid, NULL, "\"NULL\" should be returned\n");
-}
-
-static void utc_livebox_service_mainappid_p(void)
-{
- LOGD("");
- const char *appid;
- appid = livebox_service_mainappid(MUSIC_LIVEBOX);
- dts_check_str_eq("livebox_service_mainappid", appid, MUSIC_APP, "\""MUSIC_APP"\" should be returned\n");
-}
-
-static int list_cb(const char *lbid, int is_prime, void *data)
-{
- return 0;
-}
-
-static void utc_livebox_service_get_pkglist_by_pkgid_n(void)
-{
- LOGD("");
- int ret;
- ret = livebox_service_get_pkglist_by_pkgid(NULL, list_cb, NULL);
- dts_check_eq("livebox_service_get_pkglist_by_pkgid", ret, LB_STATUS_ERROR_INVALID, "INVALID should be returned");
-}
-
-static void utc_livebox_service_get_pkglist_by_pkgid_p(void)
-{
- LOGD("");
- int ret;
- ret = livebox_service_get_pkglist_by_pkgid(MUSIC_APP, list_cb, NULL);
- dts_check_ge("livebox_service_get_pkglist_by_pkgid", ret, 0, "greater than or equal to 0");
-}
-
-static void utc_livebox_service_pkgname_n(void)
-{
- LOGD("");
- char *pkgname;
- pkgname = livebox_service_pkgname(NULL);
- dts_check_eq("livebox_service_pkgname", pkgname, NULL, "lbid is not exists");
-}
-
-static void utc_livebox_service_pkgname_p(void)
-{
- LOGD("");
- char *pkgname;
- pkgname = livebox_service_pkgname(MUSIC_APP);
- dts_check_str_eq("livebox_service_pkgname", pkgname, MUSIC_LIVEBOX, "livebox music-player");
- free(pkgname);
-}
-
-static void utc_livebox_service_is_primary_n(void)
-{
- LOGD("");
- int ret;
- ret = livebox_service_is_primary(NULL);
- dts_check_str_eq("livebox_service_is_primary", ret, 0, "\"NULL\" is not primary(0)\n");
-}
-
-static void utc_livebox_service_is_primary_p(void)
-{
- LOGD("");
- int ret;
- ret = livebox_service_is_primary(MUSIC_LIVEBOX);
- dts_check_str_eq("livebox_service_is_primary", ret, 1, "\""MUSIC_LIVEBOX"\" is primary(1)\n");
-}
-
-static void utc_livebox_service_provider_name_n(void)
-{
- LOGD("");
- char *provider;
- provider = livebox_service_provider_name(NULL);
- dts_check_eq("livebox_service_provider_name", provider, NULL, "returns NULL");
-}
-
-static void utc_livebox_service_provider_name_p(void)
-{
- LOGD("");
- char *provider;
- provider = livebox_service_provider_name(MUSIC_LIVEBOX);
- dts_check_str_eq("livebox_service_provider_name", provider, MUSIC_LIVEBOX, "inhouse livebox");
- free(provider);
-}
-
-static void utc_livebox_service_setup_appid_n(void)
-{
- LOGD("");
- char *setup;
- setup = livebox_service_setup_appid(NULL);
- dts_check_eq("livebox_service_setup_appid", setup, NULL, "setup is NULL");
-}
-
-static void utc_livebox_service_setup_appid_p(void)
-{
- LOGD("");
- char *setup;
- setup = livebox_service_setup_appid(TWITTER_FIRENDS_LIVEBOX);
- dts_check_eq("livebox_service_setup_appid", setup, TWITTER_APP, "setup app");
- free(setup);
-}
-
-static void utc_livebox_service_appid_n(void)
-{
- LOGD("");
- char *appid;
- appid = livebox_service_appid(NULL);
- dts_check_eq("livebox_service_appid", appid, NULL, "appid is NULL");
-}
-
-static void utc_livebox_service_appid_p(void)
-{
- LOGD("");
- char *appid;
- appid = livebox_service_appid(MUSIC_LIVEBOX);
- dts_check_str_eq("livebox_service_appid", appid, MUSIC_APP, "appid is org.tizen.music-player");
- free(appid);
-}
-
-static void utc_livebox_service_i18n_name_n(void)
-{
- LOGD("");
- char *name;
- name = livebox_service_i18n_name(NULL, NULL);
- dts_check_eq("livebox_service_i18n_name", name, NULL, "name is NULL");
-}
-
-static void utc_livebox_service_i18n_name_p(void)
-{
- LOGD("");
- char *name;
- name = livebox_service_i18n_name(MUSIC_LIVEBOX, NULL);
- dts_check_ne("livebox_service_i18n_name", name, NULL, "name is not NULL");
- free(name);
-}
-
-static void utc_livebox_service_privew_n(void)
-{
- LOGD("");
- char *preview;
- preview = livebox_service_preview(MUSIC_LIVEBOX, LB_SIZE_TYPE_1x1);
- dts_check_eq("livebox_service_preview", preview, NULL, "preview is NULL");
- free(preview);
-}
-
-static void utc_livebox_service_preview_p(void)
-{
- LOGD("");
- char *preview;
- preview = livebox_service_preview(MUSIC_LIVEBOX, LB_SIZE_TYPE_1x1);
- dts_check_ne("livebox_service_preview", preview, NULL, "preview is not NULL");
- free(preview);
-}
-
-static void utc_livebox_service_content_n(void)
-{
- LOGD("");
- char *content;
- content = livebox_service_content(NULL);
- dts_check_eq("livebox_service_content", content, NULL, "content is NULL");
-}
-
-static void utc_livebox_service_content_p(void)
-{
- LOGD("");
- char *content;
- content = livebox_service_content(TWITTER_TWEET_LIVEBOX);
- dts_check_ne("livebox_service_content", content, NULL, "content is not NULL");
- free(content);
-}
-
-static void utc_livebox_service_i18n_icon_p(void)
-{
- LOGD("");
- char *icon;
-
- icon = livebox_service_i18n_icon(NULL, NULL);
- dts_check_eq("livebox_service_i18n_icon", icon, NULL, "icon is NULL");
-}
-
-static void utc_livebox_service_i18n_icon_n(void)
-{
- LOGD("");
- char *icon;
-
- icon = livebox_service_i18n_icon(MUSIC_LIVEBOX, NULL);
- dts_check_ne("livebox_service_i18n_icon", icon, NULL, "icon is not NULL");
- free(icon);
-}
-
-static void utc_livebox_service_libexec_p(void)
-{
- LOGD("");
- char *libexec;
- libexec = livebox_service_libexec(NULL);
- dts_check_eq("livebox_service_libexec", libexec, NULL, "libexec is NULL");
-}
-
-static void utc_livebox_service_libexec_n(void)
-{
- LOGD("");
- char *libexec;
- libexec = livebox_service_libexec(MUSIC_LIVEBOX);
- dts_check_ne("livebox_service_libexec", libexec, NULL, "libexec is not NULL");
- free(libexec);
-}
-
-static void utc_livebox_service_nodisplay_p(void)
-{
- LOGD("");
- int ret;
- ret = livebox_service_nodisplay(NULL);
- dts_check_eq("livebox_service_nodisplay", ret, 0, "nodisplay is false");
-}
-
-static void utc_livebox_service_nodisplay_n(void)
-{
- LOGD("");
- int ret;
- ret = livebox_service_nodisplay(MUSIC_LIVEBOX);
- dts_check_eq("livebox_service_nodisplay", ret, 0, "nodisplay is false");
-}
-
-static void utc_livebox_service_abi_p(void)
-{
- LOGD("");
- char *abi;
- abi = livebox_service_abi(NULL);
- dts_check_eq("livebox_service_abi", abi, NULL, "abi is NULL");
-}
-
-static void utc_livebox_service_abi_n(void)
-{
- LOGD("");
- char *abi;
- abi = livebox_service_abi(MUSIC_LIVEBOX);
- dts_check_ne("livebox_service_abi", abi, NULL, "abi is not NULL");
- free(abi);
-}
-
-static void utc_livebox_service_is_enabled_n(void)
-{
- LOGD("");
- /*!
- * static int livebox_service_is_enabled(const char *lbid);
- * - Not implemented
- */
- dts_pass("livebox_service_is_enabled", "negative - true");
-}
-
-static void utc_livebox_service_is_enabled_p(void)
-{
- LOGD("");
- /*!
- * static int livebox_service_is_enabled(const char *lbid);
- * - Not implemented
- */
- dts_pass("livebox_service_is_enabled", "positive - true");
-}
-
-static void utc_livebox_service_lb_script_path_n(void)
-{
- LOGD("");
- char *lb_path;
- lb_path = livebox_service_lb_script_path(NULL);
- dts_check_eq("livebox_service_lb_script_path", lb_path, NULL, "lb_path is NULL");
-}
-
-static void utc_livebox_service_lb_script_path_p(void)
-{
- LOGD("");
- char *lb_path;
- lb_path = livebox_service_lb_script_path(MUSIC_LIVEBOX);
- dts_check_ne("livebox_service_lb_script_path", lb_path, NULL, "lb_path is NULL");
- free(lb_path);
-}
-
-static void utc_livebox_service_lb_script_group_n(void)
-{
- LOGD("");
- char *lb_group;
- lb_group = livebox_service_lb_script_group(NULL);
- dts_check_ne("livebox_service_lb_script_group", lb_group, NULL, "lb_group is NULL");
-}
-
-static void utc_livebox_service_lb_script_group_p(void)
-{
- LOGD("");
- char *lb_group;
- lb_group = livebox_service_lb_script_group(MUSIC_LIVEBOX);
- dts_check_ne("livebox_service_lb_script_group", lb_group, NULL, "lb_group is NULL");
- free(lb_group);
-}
-
-static void utc_livebox_service_pd_script_path_n(void)
-{
- LOGD("");
- char *pd_script;
- pd_script = livebox_service_pd_script_path(NULL);
- dts_check_eq("livebox_service_pd_script_path", pd_script, NULL, "pd_script is NULL");
-}
-
-static void utc_livebox_service_pd_script_path_p(void)
-{
- LOGD("");
- char *pd_script;
- pd_script = livebox_service_pd_script_path(MUSIC_LIVEBOX);
- dts_check_ne("livebox_service_pd_script_path", pd_script, NULL, "pd_script is NULL");
- free(pd_script);
-}
-
-static void utc_livebox_service_pd_script_group_p(void)
-{
- LOGD("");
- char *pd_group;
- pd_group = livebox_service_pd_script_group(MUSIC_LIVEBOX);
- dts_check_ne("livebox_service_pd_script_group", pd_group, NULL, "pd_script is NULL");
-}
-
-static void utc_livebox_service_pd_script_group_n(void)
-{
- LOGD("");
- char *pd_group;
- pd_group = livebox_service_pd_script_group(MUSIC_LIVEBOX);
- dts_check_eq("livebox_service_pd_script_group", pd_group, NULL, "pd_script is NULL");
- free(pd_group);
-}
-
-static void utc_livebox_service_get_supported_sizes_n(void)
-{
- LOGD("");
- int cnt = NR_OF_SIZE_LIST;
- int w[NR_OF_SIZE_LIST];
- int h[NR_OF_SIZE_LIST];
- int ret;
-
- ret = livebox_service_get_supported_sizes(NULL, &cnt, w, h);
- dts_check_eq("livebox_service_get_supported_sizes", ret, LB_STATUS_ERROR_INVALID, "supported sizes is 0");
-}
-
-static void utc_livebox_service_get_supported_sizes_p(void)
-{
- LOGD("");
- int cnt = NR_OF_SIZE_LIST;
- int w[NR_OF_SIZE_LIST];
- int h[NR_OF_SIZE_LIST];
- int ret;
-
- ret = livebox_service_get_supported_sizes(MUSIC_LIVEBOX, &cnt, w, h);
- dts_check_eq("livebox_service_get_supported_sizes", ret, 0, "supported sizes is 0");
-}
-
-static void utc_livebox_service_get_supported_size_types_n(void)
-{
- LOGD("");
- int cnt = NR_OF_SIZE_LIST;
- int sizes[NR_OF_SIZE_LIST];
- int ret;
-
- ret = livebox_service_get_supported_size_types(NULL, &cnt, sizes);
- dts_check_eq("livebox_service_get_supported_sizes", ret, LB_STATUS_ERROR_INVALID, "supported sizes is 0");
-}
-
-static void utc_livebox_service_get_supported_size_types_p(void)
-{
- LOGD("");
- int cnt = NR_OF_SIZE_LIST;
- int sizes[NR_OF_SIZE_LIST];
- int ret;
-
- ret = livebox_service_get_supported_size_types(MUSIC_LIVEBOX, &cnt, sizes);
- dts_check_eq("livebox_service_get_supported_sizes", ret, LB_STATUS_SUCCESS, "supported sizes is 0");
-}
-
-static int category_cb(const char *cluster, const char *category, void *data)
-{
- return 0;
-}
-
-static void utc_livebox_service_enumerate_category_list_n(void)
-{
- LOGD("");
- int ret;
- ret = livebox_service_enumerate_category_list(NULL, NULL, NULL);
- dts_check_eq("livebox_service_enumerate_category_list", ret, LB_STATUS_ERROR_INVALID, "invalid argument");
-}
-
-static void utc_livebox_service_enumerate_category_list_p(void)
-{
- LOGD("");
- int ret;
- ret = livebox_service_enumerate_category_list("default", category_cb, NULL);
- dts_check_eq("livebox_service_enumerate_category_list", ret, LB_STATUS_ERROR_INVALID, "invalid argument");
-}
-
-static void utc_livebox_service_enumerate_cluster_list_n(void)
-{
- LOGD("");
- int ret;
- ret = livebox_service_enumerate_cluster_list(NULL, NULL);
- dts_check_eq("livebox_service_enumerate_cluster_list", ret, LB_STATUS_ERROR_INVALID, "invalid argument");
-}
-
-static int cluster_cb(const char *cluster, void *data)
-{
- return 0;
-}
-
-static void utc_livebox_service_enumerate_cluster_list_p(void)
-{
- LOGD("");
- int ret;
- ret = livebox_service_enumerate_cluster_list(cluster_cb, NULL);
- dts_check_ge("livebox_service_enumerate_cluster_list", ret, 0, "invalid argument");
-}
-
-static void utc_livebox_service_pkglist_create_n(void)
-{
- LOGD("");
- /*!
- * \note
- * Unable to test negative case for livebox_service_pkglist_create function
- */
- dts_pass("livebox_service_pkglist_create", "negative test");
-}
-
-static void utc_livebox_service_pkglist_create_p(void)
-{
- LOGD("");
- s_info.handle = livebox_service_pkglist_create(NULL, NULL);
- dts_check_ne("livebox_service_pkglist_create", s_info.handle, NULL, "Success");
-}
-
-static void utc_livebox_service_get_pkglist_item_n(void)
-{
- LOGD("");
- char *lbid;
- char *pkgname;
- int prime;
- int ret;
-
- ret = livebox_service_get_pkglist_item(NULL, &lbid, &pkgname, &prime);
- dts_check_eq("livebox_service_get_pkglist_item", ret, LB_STATUS_ERROR_INVALID, "Invalid");
-}
-
-static void utc_livebox_service_get_pkglist_item_p(void)
-{
- LOGD("");
- char *lbid;
- char *pkgname;
- int prime;
- int ret;
-
- if (!s_info.handle) {
- dts_pass("livebox_service_get_pkglist_item", "handle is not valid");
- return;
- }
-
- ret = livebox_service_get_pkglist_item(s_info.handle, &lbid, &pkgname, &prime);
- dts_check_eq("livebox_service_get_pkglist_item", ret, LB_STATUS_SUCCESS, "Success");
-}
-
-static void utc_livebox_service_pkglist_destroy_n(void)
-{
- LOGD("");
- int ret;
-
- ret = livebox_service_pkglist_destroy(NULL);
- dts_check_eq("livebox_service_pkglist_destroy", ret, LB_STATUS_ERROR_INVALID, "Invalid");
-}
-
-static void utc_livebox_service_pkglist_destroy_p(void)
-{
- LOGD("");
- int ret;
-
- if (!s_info.handle) {
- dts_pass("livebox_service_pkglist_destroy", "false");
- return;
- }
-
- ret = livebox_service_pkglist_destroy(s_info.handle);
- dts_check_eq("livebox_service_pkglist_destroy", ret, LB_STATUS_ERROR_INVALID, "Invalid");
- s_info.handle = NULL;
-}
-
-struct tet_testlist tet_testlist[] = {
- { utc_livebox_service_get_size_n, NEGATIVE_TC_IDX },
- { utc_livebox_service_get_size_p, POSITIVE_TC_IDX },
- { utc_livebox_service_size_type_n, NEGATIVE_TC_IDX },
- { utc_livebox_service_size_type_p, POSITIVE_TC_IDX },
- { utc_livebox_service_mouse_event_n, NEGATIVE_TC_IDX },
- { utc_livebox_service_mouse_event_p, POSITIVE_TC_IDX },
- { utc_livebox_service_touch_effect_n, NEGATIVE_TC_IDX },
- { utc_livebox_service_touch_effect_p, POSITIVE_TC_IDX },
- { utc_livebox_service_need_frame_n, NEGATIVE_TC_IDX },
- { utc_livebox_service_need_frame_p, POSITIVE_TC_IDX },
- { utc_livebox_service_trigger_update_n, NEGATIVE_TC_IDX },
- { utc_livebox_service_trigger_update_p, POSITIVE_TC_IDX },
- { utc_livebox_service_trigger_update_with_content_n, NEGATIVE_TC_IDX },
- { utc_livebox_service_trigger_update_with_content_p, POSITIVE_TC_IDX },
- { utc_livebox_service_change_period_n, NEGATIVE_TC_IDX },
- { utc_livebox_service_change_period_p, POSITIVE_TC_IDX },
- { utc_livebox_service_get_pkglist_n, NEGATIVE_TC_IDX },
- { utc_livebox_service_get_pkglist_p, POSITIVE_TC_IDX },
- { utc_livebox_service_get_applist_n, NEGATIVE_TC_IDX },
- { utc_livebox_service_get_applist_p, POSITIVE_TC_IDX },
- { utc_livebox_service_mainappid_n, NEGATIVE_TC_IDX },
- { utc_livebox_service_mainappid_p, POSITIVE_TC_IDX },
- { utc_livebox_service_get_pkglist_by_pkgid_n, NEGATIVE_TC_IDX },
- { utc_livebox_service_get_pkglist_by_pkgid_p, POSITIVE_TC_IDX },
- { utc_livebox_service_pkgname_n, NEGATIVE_TC_IDX },
- { utc_livebox_service_pkgname_p, POSITIVE_TC_IDX },
- { utc_livebox_service_is_primary_n, NEGATIVE_TC_IDX },
- { utc_livebox_service_is_primary_p, POSITIVE_TC_IDX },
- { utc_livebox_service_provider_name_n, NEGATIVE_TC_IDX },
- { utc_livebox_service_provider_name_p, POSITIVE_TC_IDX },
- { utc_livebox_service_setup_appid_n, NEGATIVE_TC_IDX },
- { utc_livebox_service_setup_appid_p, POSITIVE_TC_IDX },
- { utc_livebox_service_appid_n, NEGATIVE_TC_IDX },
- { utc_livebox_service_appid_p, POSITIVE_TC_IDX },
- { utc_livebox_service_i18n_name_n, NEGATIVE_TC_IDX },
- { utc_livebox_service_i18n_name_p, POSITIVE_TC_IDX },
- { utc_livebox_service_privew_n, NEGATIVE_TC_IDX },
- { utc_livebox_service_preview_p, POSITIVE_TC_IDX },
- { utc_livebox_service_content_n, NEGATIVE_TC_IDX },
- { utc_livebox_service_content_p, POSITIVE_TC_IDX },
- { utc_livebox_service_content_n, NEGATIVE_TC_IDX },
- { utc_livebox_service_i18n_icon_p, POSITIVE_TC_IDX },
- { utc_livebox_service_i18n_icon_n, NEGATIVE_TC_IDX },
- { utc_livebox_service_libexec_p, POSITIVE_TC_IDX },
- { utc_livebox_service_libexec_n, NEGATIVE_TC_IDX },
- { utc_livebox_service_nodisplay_p, POSITIVE_TC_IDX },
- { utc_livebox_service_nodisplay_n, NEGATIVE_TC_IDX },
- { utc_livebox_service_abi_p, POSITIVE_TC_IDX },
- { utc_livebox_service_abi_n, NEGATIVE_TC_IDX },
- { utc_livebox_service_is_enabled_n, NEGATIVE_TC_IDX },
- { utc_livebox_service_is_enabled_p, POSITIVE_TC_IDX },
- { utc_livebox_service_lb_script_path_n, NEGATIVE_TC_IDX },
- { utc_livebox_service_lb_script_path_p, POSITIVE_TC_IDX },
- { utc_livebox_service_lb_script_group_n, NEGATIVE_TC_IDX },
- { utc_livebox_service_lb_script_group_p, POSITIVE_TC_IDX },
- { utc_livebox_service_pd_script_path_n, NEGATIVE_TC_IDX },
- { utc_livebox_service_pd_script_path_p, POSITIVE_TC_IDX },
- { utc_livebox_service_pd_script_group_p, POSITIVE_TC_IDX },
- { utc_livebox_service_pd_script_group_n, NEGATIVE_TC_IDX },
- { utc_livebox_service_get_supported_sizes_n, NEGATIVE_TC_IDX },
- { utc_livebox_service_get_supported_sizes_p, POSITIVE_TC_IDX },
- { utc_livebox_service_get_supported_size_types_n, NEGATIVE_TC_IDX },
- { utc_livebox_service_get_supported_size_types_p, POSITIVE_TC_IDX },
- { utc_livebox_service_enumerate_category_list_n, NEGATIVE_TC_IDX },
- { utc_livebox_service_enumerate_category_list_p, POSITIVE_TC_IDX },
- { utc_livebox_service_enumerate_cluster_list_n, NEGATIVE_TC_IDX },
- { utc_livebox_service_enumerate_cluster_list_p, POSITIVE_TC_IDX },
- { utc_livebox_service_pkglist_create_n, NEGATIVE_TC_IDX },
- { utc_livebox_service_pkglist_create_p, POSITIVE_TC_IDX },
- { utc_livebox_service_get_pkglist_item_n, NEGATIVE_TC_IDX },
- { utc_livebox_service_get_pkglist_item_p, POSITIVE_TC_IDX },
- { utc_livebox_service_pkglist_destroy_n, NEGATIVE_TC_IDX },
- { utc_livebox_service_pkglist_destroy_p, POSITIVE_TC_IDX },
- { NULL, 0 },
-};
-
diff --git a/doc/livebox-service_doc.h b/doc/livebox-service_doc.h
deleted file mode 100644
index 64ac08a..0000000
--- a/doc/livebox-service_doc.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Copyright 2013 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://floralicense.org/license/
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*!
- * \ingroup CAPI_LIVEBOX_FRAMEWORK
- * \defgroup CAPI_LIVEBOX_SERVICE_MODULE Livebox Service
- * \brief Access the livebox manifest data.
- * \section CAPI_LIVEBOX_SERVICE_MODULE_HEADER Required Header
- * \#include <livebox-service.h>
- * \section CAPI_LIVEBOX_SERVICE_MOUDLE_OVERVIEW Overview
- * \brief
- * Livebox Service API supporting various kinds of DB access operations.
- */
diff --git a/dynamicbox_service/CMakeLists.txt b/dynamicbox_service/CMakeLists.txt
new file mode 100644
index 0000000..24309e6
--- /dev/null
+++ b/dynamicbox_service/CMakeLists.txt
@@ -0,0 +1,105 @@
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+PROJECT(dynamicbox_service C)
+
+SET(PREFIX ${CMAKE_INSTALL_PREFIX})
+SET(EXEC_PREFIX "\${prefix}")
+SET(PROJECT_NAME "${PROJECT_NAME}")
+SET(LIBDIR ${LIB_INSTALL_DIR})
+SET(INCLUDEDIR "\${prefix}/include/${PROJECT_NAME}")
+SET(VERSION_MAJOR 1)
+SET(VERSION "${VERSION_MAJOR}.0.0")
+
+set(CMAKE_SKIP_BUILD_RPATH true)
+
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include)
+
+INCLUDE(FindPkgConfig)
+pkg_check_modules(pkgs REQUIRED
+ dlog
+ glib-2.0
+ gio-2.0
+ com-core
+ sqlite3
+ db-util
+ pkgmgr
+ pkgmgr-info
+ vconf
+ ail
+ icu-uc
+)
+
+IF (X11_SUPPORT)
+pkg_check_modules(pkg_extra REQUIRED
+ x11
+)
+ENDIF (X11_SUPPORT)
+
+IF (WAYLAND_SUPPORT)
+# Nothing provided yet.
+ENDIF (WAYLAND_SUPPORT)
+
+FOREACH(flag ${pkgs_CFLAGS})
+ SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
+ENDFOREACH(flag)
+FOREACH(flag ${pkg_extra_CFLAGS})
+ SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
+ENDFOREACH(flag)
+
+SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fvisibility=hidden -Wall -Werror -Winline -g")
+
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
+
+ADD_DEFINITIONS("-DPREFIX=\"${PREFIX}\"")
+ADD_DEFINITIONS("-DLOG_TAG=\"DYNAMICBOX_SERVICE\"")
+ADD_DEFINITIONS("-DNDEBUG")
+ADD_DEFINITIONS("-D_USE_ECORE_TIME_GET")
+ADD_DEFINITIONS("-DSERVICE_SOCKET=\"/opt/usr/share/live_magazine/.service.socket\"")
+ADD_DEFINITIONS("-DRESOLUTION_FILE=\"/usr/share/data-provider-master/resolution.ini\"")
+ADD_DEFINITIONS("-DDB_FILE=\"/opt/dbspace/.dynamicbox.db\"")
+ADD_DEFINITIONS("-DDEFAULT_MASTER_CONF=\"/usr/share/data-provider-master/conf.ini\"")
+
+SET(BUILD_SOURCE
+ src/dlist.c
+ src/dynamicbox_service.c
+ src/util.c
+ src/dynamicbox_conf.c
+)
+
+IF (X11_SUPPORT)
+ ADD_DEFINITIONS("-DHAVE_X11")
+ SET(BUILD_SOURCE
+ ${BUILD_SOURCE}
+ src/util_x11.c
+ )
+ENDIF (X11_SUPPORT)
+
+IF (WAYLAND_SUPPORT)
+ ADD_DEFINITIONS("-DHAVE_WAYLAND")
+ SET(BUILD_SOURCE
+ ${BUILD_SOURCE}
+ src/util_wayland.c
+ )
+ENDIF (WAYLAND_SUPPORT)
+
+ADD_LIBRARY(${PROJECT_NAME} SHARED ${BUILD_SOURCE})
+
+SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES SOVERSION ${VERSION_MAJOR})
+SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES VERSION ${VERSION})
+TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${pkgs_LDFLAGS} ${pkg_extra_LDFLAGS})
+
+INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${LIB_INSTALL_DIR})
+INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
+
+CONFIGURE_FILE(${PROJECT_NAME}.pc.in ${PROJECT_NAME}.pc @ONLY)
+SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${PROJECT_NAME}.pc")
+
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/dynamicbox_service.h DESTINATION include/${PROJECT_NAME})
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/dynamicbox_errno.h DESTINATION include/${PROJECT_NAME})
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/dynamicbox_cmd_list.h DESTINATION include/${PROJECT_NAME})
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/dynamicbox_buffer.h DESTINATION include/${PROJECT_NAME})
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/dynamicbox_script.h DESTINATION include/${PROJECT_NAME})
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/dynamicbox_conf.h DESTINATION include/${PROJECT_NAME})
+
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/LICENSE DESTINATION /usr/share/license RENAME "lib${PROJECT_NAME}")
+
+# End of a file
diff --git a/LICENSE b/dynamicbox_service/LICENSE
index 571fe79..571fe79 100644
--- a/LICENSE
+++ b/dynamicbox_service/LICENSE
diff --git a/dynamicbox_service/doc/dynamicbox_service_doc.h b/dynamicbox_service/doc/dynamicbox_service_doc.h
new file mode 100644
index 0000000..0d2b7e1
--- /dev/null
+++ b/dynamicbox_service/doc/dynamicbox_service_doc.h
@@ -0,0 +1,113 @@
+/*
+ * Copyright 2013 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __DYNAMICBOX_SERVICE_DOC_H__
+#define __DYNAMICBOX_SERVICE_DOC_H__
+
+/**
+ * @defgroup DYNAMICBOX_SERVICE_MODULE Dynamic Box
+ * @brief To get the information of installed Dynamic Boxes
+ * @ingroup CAPI_DYNAMICBOX_FRAMEWORK
+ * @section DYNAMICBOX_SERVICE_MODULE_HEADER Required Header
+ * \#include <dynamicbox_service.h>
+ * \#include <dynamicbox_errno.h>
+ * @section DYNAMICBOX_SERVICE_MODULE_OVERVIEW Overview
+<H1>1. Dynamic Box Service API</H1>
+Tizen supports various kinds of API set for retrieving information of Dynamic Boxes.
+Every Dynamic Boxes are installed via package manager utilities.
+The information of installed Dynamic Boxes are stored in the system DB.
+
+In some cases, application developer needs to send update request to its Dynamic Box.
+To make it possible, this module providers such kinds of API set.
+
+Those APIs are for communicating with master service provider called data-provider-master.
+When it receives request from applications, it will find the proper service provider called data-provider-slave or application Dynamic Box Provider.
+If master finds proper service provider, it will forward the requests to them.
+Then each Dynamic Box application can get update request.
+
+<H2>1.1 APIs for retrieving information of Dynamic Boxes</H2>
+
+To get the information for installed dynamic boxes.
+
+<H2>1.2 APIs for communicating with running Dynamic Box instances</H2>
+
+To trigger the update event or send the updated content string to the dynamic box.
+
+<H1>2. Size of Dynamic Box</H1>
+
+Dynamic Box has predefined size types.
+
+<TABLE>
+<TH>
+<TD>Size Type</TD><TD>Size in pixels</TD><TD>Supported profile</TD>
+</TH>
+<TR>
+<TD>DBOX_SIZE_TYPE_1x1</TD><TD> - </TD><TD>Mobile, Wearable - Mandatory size</TD>
+</TR>
+<TR>
+<TD>DBOX_SIZE_TYPE_2x1</TD><TD> - </TD><TD>Mobile</TD>
+</TR>
+<TR>
+<TD>DBOX_SIZE_TYPE_2x2</TD><TD> - </TD><TD>Mobile, Wearable</TD>
+</TR>
+<TR>
+<TD>DBOX_SIZE_TYPE_4x1</TD><TD> - </TD><TD>Mobile - Extension</TD>
+</TR>
+<TR>
+<TD>DBOX_SIZE_TYPE_4x2</TD><TD> - </TD><TD>Mobile - Since 2.3</TD>
+</TR>
+<TR>
+<TD>DBOX_SIZE_TYPE_4x3</TD><TD> - </TD><TD>Mobile - Extension</TD>
+</TR>
+<TR>
+<TD>DBOX_SIZE_TYPE_4x4</TD><TD> - </TD><TD>Mobile, Kiran - Since 2.3</TD>
+</TR>
+<TR>
+<TD>DBOX_SIZE_TYPE_4x5</TD><TD> - </TD><TD>Mobile - Extension</TD>
+</TR>
+<TR>
+<TD>DBOX_SIZE_TYPE_4x6</TD><TD> - </TD><TD>Mobile - Extension</TD>
+</TR>
+</TABLE>
+
+Dynamic Box also handles Easy Mode.
+For the easy mode, there are different size types.
+Called DBOX_SIZE_TYPE_EASY_NxM
+
+<TABLE>
+<TH>
+<TD>Size Type</TD><TD>Size in pixels</TD><TD>Supported profile</TD>
+</TH>
+<TR>
+<TD>DBOX_SIZE_TYPE_EASY_1x1</TD><TD> - </TD><TD>Mobile</TD>
+</TR>
+<TR>
+<TD>DBOX_SIZE_TYPE_EASY_3x1</TD><TD> - </TD><TD>Mobile</TD>
+</TR>
+<TR>
+<TD>DBOX_SIZE_TYPE_EASY_3x3</TD><TD> - </TD><TD>Mobile</TD>
+</TR>
+</TABLE>
+
+However the easy mode is not officially supported.
+So you will not be able to create your Dynamic Boxes using easy mode size types.
+If you are developing the homescreen(or application which is related with dynamic boxes),
+You should care these types too.
+
+ *
+ */
+
+#endif
diff --git a/dynamicbox_service/dynamicbox_service.pc.in b/dynamicbox_service/dynamicbox_service.pc.in
new file mode 100644
index 0000000..fafb41d
--- /dev/null
+++ b/dynamicbox_service/dynamicbox_service.pc.in
@@ -0,0 +1,11 @@
+prefix=@PREFIX@
+exec_prefix=@EXEC_PREFIX@
+libdir=@LIBDIR@
+includedir=@INCLUDEDIR@
+
+Name: dynamicbox_service
+Description: Dynamicbox service library
+Version: @VERSION@
+Libs: -L${libdir} -ldynamicbox_service
+Cflags: -I${includedir}
+cppflags: -I${includedir}
diff --git a/include/debug.h b/dynamicbox_service/include/debug.h
index dff04de..02fecf2 100644
--- a/include/debug.h
+++ b/dynamicbox_service/include/debug.h
@@ -17,15 +17,15 @@
#if !defined(FLOG)
#if defined(SECURE_LOGD)
-#define DbgPrint(format, arg...) SECURE_LOGD(format, ##arg)
+#define DbgPrint(format, arg...) SECURE_LOGD(format, ##arg)
#else
-#define DbgPrint(format, arg...) LOGD(format, ##arg)
+#define DbgPrint(format, arg...) LOGD(format, ##arg)
#endif
#if defined(SECURE_LOGD)
-#define ErrPrint(format, arg...) SECURE_LOGE(format, ##arg)
+#define ErrPrint(format, arg...) SECURE_LOGE(format, ##arg)
#else
-#define ErrPrint(format, arg...) LOGE(format, ##arg)
+#define ErrPrint(format, arg...) LOGE(format, ##arg)
#endif
#else
@@ -35,4 +35,5 @@ extern FILE *__file_log_fp;
#define ErrPrint(format, arg...) do { fprintf(__file_log_fp, "[ERR] [%s/%s:%d] " format, util_basename(__FILE__), __func__, __LINE__, ##arg); fflush(__file_log_fp); } while (0)
#endif
+#define EAPI __attribute__((visibility("default")))
/* End of a file */
diff --git a/include/dlist.h b/dynamicbox_service/include/dlist.h
index cd1a421..3f19827 100644
--- a/include/dlist.h
+++ b/dynamicbox_service/include/dlist.h
@@ -15,18 +15,18 @@
*/
#define dlist_remove_data(list, data) do { \
- struct dlist *l; \
- l = dlist_find_data(list, data); \
- list = dlist_remove(list, l); \
+ struct dlist *l; \
+ l = dlist_find_data(list, data); \
+ list = dlist_remove(list, l); \
} while (0)
#define dlist_foreach(list, l, data) \
- for ((l) = (list); (l) && ((data) = dlist_data(l)); (l) = dlist_next(l))
+ for ((l) = (list); (l) && ((data) = dlist_data(l)); (l) = dlist_next(l))
#define dlist_foreach_safe(list, l, n, data) \
- for ((l) = (list), (n) = dlist_next(l); \
- (l) && ((data) = dlist_data(l)); \
- (l) = (n), (n) = dlist_next(l))
+ for ((l) = (list), (n) = dlist_next(l); \
+ (l) && ((data) = dlist_data(l)); \
+ (l) = (n), (n) = dlist_next(l))
struct dlist;
diff --git a/dynamicbox_service/include/dynamicbox_buffer.h b/dynamicbox_service/include/dynamicbox_buffer.h
new file mode 100644
index 0000000..e0fbd24
--- /dev/null
+++ b/dynamicbox_service/include/dynamicbox_buffer.h
@@ -0,0 +1,203 @@
+/*
+ * Copyright 2013 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __DYNAMICBOX_BUFFER_H
+#define __DYNAMICBOX_BUFFER_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @file dynamicbox_buffer.h
+ * @brief This file describe the buffer ADT and event definitions
+ */
+
+/**
+ * @addtogroup CAPI_DYNAMICBOX_SERVICE_MODULE
+ * @{
+ */
+
+/**
+ * @internal
+ * @brief Buffer type of dynamicbox
+ */
+typedef enum dynamicbox_fb_type { /*!< Must have to be sync with libprovider, liblivebox-viewer */
+ DBOX_FB_TYPE_FILE,
+ DBOX_FB_TYPE_SHM,
+ DBOX_FB_TYPE_PIXMAP,
+ DBOX_FB_TYPE_ERROR
+} dynamicbox_fb_type_e;
+
+/**
+ * @internal
+ * @brief ADT for Dynamicbox Buffer
+ * @since_tizen 2.3
+ */
+typedef struct dynamicbox_fb { /*!< Must has to be sync with slave & provider */
+ enum dynamicbox_fb_state {
+ DBOX_FB_STATE_CREATED = 0x00beef00,
+ DBOX_FB_STATE_DESTROYED = 0x00dead00
+ } state;
+ dynamicbox_fb_type_e type;
+ int refcnt;
+ void *info;
+ char data[];
+} *dynamicbox_fb_t;
+
+/**
+ * @internal
+ * @brief This enumeration value has to be sync'd with the libdynamicbox interface. (only for inhouse dynamicbox)
+ * @since_tizen 2.3
+ */
+typedef enum dynamicbox_target_type {
+ DBOX_TYPE_DBOX, /**< Dynamicbox */
+ DBOX_TYPE_GBAR, /**< Glance Bar */
+ DBOX_TYPE_ERROR /**< Error */
+} dynamicbox_target_type_e;
+
+/**
+ * @internal
+ * @brief Dynamic Box Frame Buffer Info
+ * @since_tizen 2.3
+ */
+struct fb_info {
+ char *id;
+ int w;
+ int h;
+ int bufsz;
+ void *buffer;
+
+ int pixels;
+ int handle;
+
+ void *gem;
+};
+
+/**
+ * @internal
+ * @brief Locking type - Read/Write
+ * @since_tizen 2.3
+ */
+typedef enum dynamicbox_lock_type {
+ DBOX_LOCK_READ = 0x01,
+ DBOX_LOCK_WRITE = 0x02,
+} dynamicbox_lock_type_e;
+
+/**
+ * @internal
+ * @brief Locking info
+ * @since_tizen 2.3
+ */
+typedef struct dynamicbox_lock_info {
+ char *filename;
+ int fd;
+ dynamicbox_lock_type_e type;
+} *dynamicbox_lock_info_t;
+
+
+/**
+ * @internal
+ * @brief Dynamic Box Buffer structure
+ * @since_tizen 2.3
+ */
+typedef struct dynamicbox_buffer {
+ enum {
+ BUFFER_INITIALIZED = 0x0b0e0e0f,
+ BUFFER_CREATED = 0x00beef00,
+ BUFFER_DESTROYED = 0x00dead00,
+ } state;
+
+ dynamicbox_target_type_e type;
+
+ union {
+ int fd; /* File handle(descriptor) */
+ int id; /* SHM handle(id) */
+ } handle;
+
+ char *pkgname;
+ char *id;
+ int width;
+ int height;
+ int pixel_size;
+ int auto_align;
+ int frame_skip; /**< To skip the first few frames to prevent from unexpected buffer clear */
+
+ struct fb_info *fb;
+
+ int (*handler)(struct dynamicbox_buffer *info, struct dynamicbox_buffer_event_data *event_info, void *data);
+ void *data;
+
+ void *user_data;
+
+ unsigned int *extra_buffer;
+
+ dynamicbox_lock_info_t lock_info;
+} *dynamicbox_buffer_h;
+
+/**
+ * @internal
+ * @brief Create a lock instance
+ * @param[in] uri Instance URI
+ * @param[in] type dynamicbox_target_type_e, DBOX or GBAR
+ * @param[in] option Read or Write
+ * @return dynamicbox_lock_info_t
+ * @retval NULL if it fails to create a lock, proper error code will be set on last_status
+ * @retval info Lock information handler
+ * @see dynamicbox_service_destroy_lock()
+ * @see dynamicbox_service_acquire_lock()
+ * @see dynamicbox_service_release_lock()
+ */
+extern dynamicbox_lock_info_t dynamicbox_service_create_lock(const char *uri, dynamicbox_target_type_e type, dynamicbox_lock_type_e option);
+
+/**
+ * @internal
+ * @brief Destroy a lock instance
+ * @param[in] info Lock information handler
+ * @return status
+ * @retval #DBOX_STATUS_ERROR_INVALID_PARAMETER invalid paramter
+ * @retval #DBOX_STATUS_ERROR_IO_ERROR Failed to manage the lock file
+ * @retval #DBOX_STATUS_ERROR_NONE Successfully destroyed
+ */
+extern int dynamicbox_service_destroy_lock(dynamicbox_lock_info_t info);
+
+/**
+ * @internal
+ * @brief Acquire a lock instance
+ * @param[in] info Lock information handler
+ * @return status
+ * @retval #DBOX_STATUS_ERROR_INVALID_PARAMETER invalid paramter
+ * @retval #DBOX_STATUS_ERROR_NONE Successfully destroyed
+ */
+extern int dynamicbox_service_acquire_lock(dynamicbox_lock_info_t info);
+
+/**
+ * @internal
+ * @brief Acquire a lock instance
+ * @param[in] info Lock information handler
+ * @return status
+ * @retval #DBOX_STATUS_ERROR_INVALID_PARAMETER invalid paramter
+ * @retval #DBOX_STATUS_ERROR_NONE Successfully destroyed
+ */
+extern int dynamicbox_service_release_lock(dynamicbox_lock_info_t info);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
+/* End of a file */
diff --git a/dynamicbox_service/include/dynamicbox_cmd_list.h b/dynamicbox_service/include/dynamicbox_cmd_list.h
new file mode 100644
index 0000000..edcf304
--- /dev/null
+++ b/dynamicbox_service/include/dynamicbox_cmd_list.h
@@ -0,0 +1,392 @@
+/*
+ * Copyright 2013 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __DYNAMICBOX_CMD_LIST_H
+#define __DYNAMICBOX_CMD_LIST_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @file dynamicbox_cmd_list.h
+ * @brief This file declares the list of command Id that are used for communicating with provider & viewer
+ * Max length of CMD is 24 (PACKET_MAX_CMD from packet.h)
+ */
+
+/**
+ * @addtogroup CAPI_DYNAMICBOX_SERVICE_MODULE
+ * @{
+ */
+
+/**
+ * @internal
+ * @brief Command list for
+ * Provider to Master,
+ * or Master to Viewer
+ */
+#define CMD_UPDATED 0x00000001 /**< DBOX Updated */
+#define CMD_DBOX_UPDATED 0x00000001 /**< Alias of CMD_UPDATED */
+#define CMD_DESC_UPDATED 0x00000101 /**< GBAR Updated */
+#define CMD_GBAR_UPDATED 0x00000101 /**< Alias of CMD_DESC_UPDATED */
+#define CMD_EXTRA_UPDATED 0x00000201
+#define CMD_EXTRA_INFO 0x00000301 /**< Extra information is updated */
+#define CMD_DELETED 0x00000401 /**< DBox is deleted */
+#define CMD_FAULTED 0x00000501 /**< DBox is faulted */
+#define CMD_FAULT_PACKAGE 0x00000501 /**< Faulted package */
+#define CMD_SCROLL 0x00000601
+#define CMD_DBOX_UPDATE_BEGIN 0x00000701
+#define CMD_DBOX_UPDATE_END 0x00000801
+#define CMD_GBAR_UPDATE_BEGIN 0x00000901
+#define CMD_GBAR_UPDATE_END 0x00000A01
+#define CMD_ACCESS_STATUS 0x00000B01
+#define CMD_KEY_STATUS 0x00000C01
+#define CMD_CLOSE_GBAR 0x00000D01
+
+#define CMD_STR_UPDATED "updated"
+#define CMD_STR_DBOX_UPDATED "dbox_updated"
+#define CMD_STR_DESC_UPDATED "desc_updated"
+#define CMD_STR_GBAR_UPDATED "gbar_updated"
+#define CMD_STR_EXTRA_UPDATED "extra_updated"
+#define CMD_STR_EXTRA_INFO "extra_info"
+#define CMD_STR_DELETED "deleted"
+#define CMD_STR_FAULTED "faulted"
+#define CMD_STR_FAULT_PACKAGE "fault_package"
+#define CMD_STR_SCROLL "scroll"
+#define CMD_STR_DBOX_UPDATE_BEGIN "dbox_update_begin"
+#define CMD_STR_DBOX_UPDATE_END "dbox_update_end"
+#define CMD_STR_GBAR_UPDATE_BEGIN "gbar_update_begin"
+#define CMD_STR_GBAR_UPDATE_END "gbar_update_end"
+#define CMD_STR_ACCESS_STATUS "access_status"
+#define CMD_STR_KEY_STATUS "key_status"
+#define CMD_STR_CLOSE_GBAR "close_gbar"
+
+/**
+ * @internal
+ * @brief Command list for
+ * Provder to Master.
+ */
+#define CMD_CALL 0x00000E01
+#define CMD_RET 0x00000F01
+#define CMD_ACQUIRE_BUFFER 0x00001001
+#define CMD_RESIZE_BUFFER 0x00001101
+#define CMD_RELEASE_BUFFER 0x00001201
+#define CMD_HELLO 0x00001301
+#define CMD_PING 0x00001401
+#define CMD_CTRL 0x00001501
+#define CMD_ACQUIRE_XBUFFER 0x00001601 // eXtra Buffer
+#define CMD_RELEASE_XBUFFER 0x00001701 // eXtra Buffer
+
+#define CMD_STR_CALL "call"
+#define CMD_STR_RET "ret"
+#define CMD_STR_ACQUIRE_BUFFER "acquire_buffer"
+#define CMD_STR_RESIZE_BUFFER "resize_buffer"
+#define CMD_STR_RELEASE_BUFFER "release_buffer"
+#define CMD_STR_HELLO "hello"
+#define CMD_STR_PING "ping"
+#define CMD_STR_CTRL "ctrl"
+#define CMD_STR_ACQUIRE_XBUFFER "acquire_xbuffer"
+#define CMD_STR_RELEASE_XBUFFER "release_xbuffer"
+
+
+/**
+ * @internal
+ * @brief Master to Viewer
+ */
+#define CMD_GBAR_CREATED 0x00000E01
+#define CMD_GBAR_DESTROYED 0x00000F01
+#define CMD_CREATED 0x00001001
+#define CMD_GROUP_CHANGED 0x00001101
+#define CMD_PERIOD_CHANGED 0x00001201
+#define CMD_SIZE_CHANGED 0x00001301
+#define CMD_RESULT_PINUP 0x00001401 /**< To Viewer */
+#define CMD_RESULT_UPDATE_MODE 0x00001501 /**< To Viewer */
+#define CMD_DBOX_CREATE_XBUF 0x00001601
+#define CMD_GBAR_CREATE_XBUF 0x00001701
+#define CMD_DBOX_DESTROY_XBUF 0x00001801
+#define CMD_GBAR_DESTROY_XBUF 0x00001901
+#define CMD_UPDATE_ID 0x00001A01
+
+#define CMD_STR_GBAR_CREATED "gbar_created"
+#define CMD_STR_GBAR_DESTROYED "gbar_destroyed"
+#define CMD_STR_CREATED "created"
+#define CMD_STR_GROUP_CHANGED "group_changed"
+#define CMD_STR_PERIOD_CHANGED "period_changed"
+#define CMD_STR_SIZE_CHANGED "size_changed"
+#define CMD_STR_RESULT_PINUP "pinup"
+#define CMD_STR_RESULT_UPDATE_MODE "update_mode"
+#define CMD_STR_DBOX_CREATE_XBUF "dbox_create_xbuf"
+#define CMD_STR_GBAR_CREATE_XBUF "gbar_create_xbuf"
+#define CMD_STR_DBOX_DESTROY_XBUF "dbox_destroy_xbuf"
+#define CMD_STR_GBAR_DESTROY_XBUF "gbar_destroy_xbuf"
+#define CMD_STR_UPDATE_ID "update_id"
+
+/**
+ * @internal
+ * @brief Following list should be started after the common list of client_cmd_list
+ * Master to Provider
+ */
+#define CMD_GBAR_SHOW 0x00003B01
+#define CMD_GBAR_HIDE 0x00003C01
+#define CMD_DBOX_PAUSE 0x00003D01
+#define CMD_DBOX_RESUME 0x00003E01
+#define CMD_SCRIPT 0x00003F01
+#define CMD_RENEW 0x00004001
+#define CMD_PINUP 0x00004101
+#define CMD_UPDATE_CONTENT 0x00004201
+#define CMD_PAUSE 0x00004301
+#define CMD_RESUME 0x00004401
+#define CMD_DISCONNECT 0x00004501
+#define CMD_VIEWER_CONNECTED 0x00004601
+#define CMD_VIEWER_DISCONNECTED 0x00004701
+
+#define CMD_STR_GBAR_SHOW "gbar_show"
+#define CMD_STR_GBAR_HIDE "gbar_hide"
+#define CMD_STR_DBOX_PAUSE "dbox_pause"
+#define CMD_STR_DBOX_RESUME "dbox_resume"
+#define CMD_STR_SCRIPT "script"
+#define CMD_STR_RENEW "renew"
+#define CMD_STR_PINUP "pinup"
+#define CMD_STR_UPDATE_CONTENT "update_content"
+#define CMD_STR_PAUSE "pause"
+#define CMD_STR_RESUME "resume"
+#define CMD_STR_DISCONNECT "disconnect"
+#define CMD_STR_VIEWER_CONNECTED "v_connected"
+#define CMD_STR_VIEWER_DISCONNECTED "v_disconnected"
+
+/**
+ * @brief liveinfo to master
+ */
+#define CMD_INFO_HELLO 0x00000001
+#define CMD_INFO_SLAVE_LIST 0x00000101
+#define CMD_INFO_PKG_LIST 0x00000201
+#define CMD_INFO_INST_LIST 0x00000301
+#define CMD_INFO_SLAVE_CTRL 0x00000401
+#define CMD_INFO_PKG_CTRL 0x00000501
+#define CMD_INFO_MASTER_CTRL 0x00000601
+
+#define CMD_STR_INFO_HELLO "liveinfo_hello"
+#define CMD_STR_INFO_SLAVE_LIST "slave_list"
+#define CMD_STR_INFO_PKG_LIST "pkg_list"
+#define CMD_STR_INFO_INST_LIST "inst_list"
+#define CMD_STR_INFO_SLAVE_CTRL "slave_ctrl"
+#define CMD_STR_INFO_PKG_CTRL "pkg_ctrl"
+#define CMD_STR_INFO_MASTER_CTRL "master_ctrl"
+
+/**
+ * @internal
+ * @brief Viewer to maser
+ * or Master to provider
+ */
+#define CMD_GBAR_MOUSE_MOVE 0x00000001
+#define CMD_DBOX_MOUSE_MOVE 0x00000101
+#define CMD_GBAR_MOUSE_DOWN 0x00000201
+#define CMD_GBAR_MOUSE_UP 0x00000301
+#define CMD_DBOX_MOUSE_DOWN 0x00000401
+#define CMD_DBOX_MOUSE_UP 0x00000501
+#define CMD_GBAR_MOUSE_ENTER 0x00000601
+#define CMD_GBAR_MOUSE_LEAVE 0x00000701
+#define CMD_DBOX_MOUSE_ENTER 0x00000801
+#define CMD_DBOX_MOUSE_LEAVE 0x00000901
+#define CMD_DBOX_MOUSE_ON_SCROLL 0x00000A01
+#define CMD_DBOX_MOUSE_OFF_SCROLL 0x00000B01
+#define CMD_GBAR_MOUSE_ON_SCROLL 0x00000C01
+#define CMD_GBAR_MOUSE_OFF_SCROLL 0x00000D01
+#define CMD_DBOX_MOUSE_ON_HOLD 0x00000E01
+#define CMD_DBOX_MOUSE_OFF_HOLD 0x00000F01
+#define CMD_GBAR_MOUSE_ON_HOLD 0x00001001
+#define CMD_GBAR_MOUSE_OFF_HOLD 0x00001101
+#define CMD_CLICKED 0x00001201
+#define CMD_TEXT_SIGNAL 0x00001301
+#define CMD_DELETE 0x00001401
+#define CMD_RESIZE 0x00001501
+#define CMD_NEW 0x00001601
+#define CMD_SET_PERIOD 0x00001701
+#define CMD_CHANGE_GROUP 0x00001801
+#define CMD_GBAR_MOVE 0x00001901
+#define CMD_GBAR_ACCESS_HL 0x00001A01
+#define CMD_GBAR_ACCESS_ACTIVATE 0x00001B01
+#define CMD_GBAR_ACCESS_ACTION 0x00001C01
+#define CMD_GBAR_ACCESS_SCROLL 0x00001D01
+#define CMD_GBAR_ACCESS_VALUE_CHANGE 0x00001E01
+#define CMD_GBAR_ACCESS_MOUSE 0x00001F01
+#define CMD_GBAR_ACCESS_BACK 0x00002001
+#define CMD_GBAR_ACCESS_OVER 0x00002101
+#define CMD_GBAR_ACCESS_READ 0x00002201
+#define CMD_GBAR_ACCESS_ENABLE 0x00002301
+#define CMD_DBOX_ACCESS_HL 0x00002401
+#define CMD_DBOX_ACCESS_ACTIVATE 0x00002501
+#define CMD_DBOX_ACCESS_ACTION 0x00002601
+#define CMD_DBOX_ACCESS_SCROLL 0x00002701
+#define CMD_DBOX_ACCESS_VALUE_CHANGE 0x00002801
+#define CMD_DBOX_ACCESS_MOUSE 0x00002901
+#define CMD_DBOX_ACCESS_BACK 0x00002A01
+#define CMD_DBOX_ACCESS_OVER 0x00002B01
+#define CMD_DBOX_ACCESS_READ 0x00002C01
+#define CMD_DBOX_ACCESS_ENABLE 0x00002D01
+#define CMD_DBOX_KEY_DOWN 0x00002E01
+#define CMD_DBOX_KEY_UP 0x00002F01
+#define CMD_DBOX_KEY_FOCUS_IN 0x00003001
+#define CMD_DBOX_KEY_FOCUS_OUT 0x00003101
+#define CMD_GBAR_KEY_DOWN 0x00003201
+#define CMD_GBAR_KEY_UP 0x00003301
+#define CMD_GBAR_KEY_FOCUS_IN 0x00003401
+#define CMD_GBAR_KEY_FOCUS_OUT 0x00003501
+#define CMD_UPDATE_MODE 0x00003601
+#define CMD_DBOX_MOUSE_SET 0x00003701
+#define CMD_DBOX_MOUSE_UNSET 0x00003801
+#define CMD_GBAR_MOUSE_SET 0x00003901
+#define CMD_GBAR_MOUSE_UNSET 0x00003A01
+
+#define CMD_STR_GBAR_MOUSE_MOVE "gbar_mouse_move"
+#define CMD_STR_DBOX_MOUSE_MOVE "dbox_mouse_move"
+#define CMD_STR_GBAR_MOUSE_DOWN "gbar_mouse_down"
+#define CMD_STR_GBAR_MOUSE_UP "gbar_mouse_up"
+#define CMD_STR_DBOX_MOUSE_DOWN "dbox_mouse_down"
+#define CMD_STR_DBOX_MOUSE_UP "dbox_mouse_up"
+#define CMD_STR_GBAR_MOUSE_ENTER "gbar_mouse_enter"
+#define CMD_STR_GBAR_MOUSE_LEAVE "gbar_mouse_leave"
+#define CMD_STR_DBOX_MOUSE_ENTER "dbox_mouse_enter"
+#define CMD_STR_DBOX_MOUSE_LEAVE "dbox_mouse_leave"
+#define CMD_STR_DBOX_MOUSE_ON_SCROLL "dbox_mouse_on_scroll"
+#define CMD_STR_DBOX_MOUSE_OFF_SCROLL "dbox_mouse_off_scroll"
+#define CMD_STR_GBAR_MOUSE_ON_SCROLL "gbar_mouse_on_scroll"
+#define CMD_STR_GBAR_MOUSE_OFF_SCROLL "gbar_mouse_off_scroll"
+#define CMD_STR_DBOX_MOUSE_ON_HOLD "dbox_mouse_on_hold"
+#define CMD_STR_DBOX_MOUSE_OFF_HOLD "dbox_mouse_off_hold"
+#define CMD_STR_GBAR_MOUSE_ON_HOLD "gbar_mouse_on_hold"
+#define CMD_STR_GBAR_MOUSE_OFF_HOLD "gbar_mouse_off_hold"
+#define CMD_STR_CLICKED "clicked"
+#define CMD_STR_TEXT_SIGNAL "text_signal"
+#define CMD_STR_DELETE "delete"
+#define CMD_STR_RESIZE "resize"
+#define CMD_STR_NEW "new"
+#define CMD_STR_SET_PERIOD "set_period"
+#define CMD_STR_CHANGE_GROUP "change_group"
+#define CMD_STR_GBAR_MOVE "gbar_move"
+#define CMD_STR_GBAR_ACCESS_HL "gbar_acc_hl"
+#define CMD_STR_GBAR_ACCESS_ACTIVATE "gbar_acc_activate"
+#define CMD_STR_GBAR_ACCESS_ACTION "gbar_acc_action"
+#define CMD_STR_GBAR_ACCESS_SCROLL "gbar_acc_scroll"
+#define CMD_STR_GBAR_ACCESS_VALUE_CHANGE "gbar_acc_val_change"
+#define CMD_STR_GBAR_ACCESS_MOUSE "gbar_acc_mouse"
+#define CMD_STR_GBAR_ACCESS_BACK "gbar_acc_back"
+#define CMD_STR_GBAR_ACCESS_OVER "gbar_acc_over"
+#define CMD_STR_GBAR_ACCESS_READ "gbar_acc_read"
+#define CMD_STR_GBAR_ACCESS_ENABLE "gbar_acc_enable"
+#define CMD_STR_DBOX_ACCESS_HL "dbox_acc_hl"
+#define CMD_STR_DBOX_ACCESS_ACTIVATE "dbox_acc_activate"
+#define CMD_STR_DBOX_ACCESS_ACTION "dbox_acc_action"
+#define CMD_STR_DBOX_ACCESS_SCROLL "dbox_acc_scroll"
+#define CMD_STR_DBOX_ACCESS_VALUE_CHANGE "dbox_acc_val_change"
+#define CMD_STR_DBOX_ACCESS_MOUSE "dbox_acc_mouse"
+#define CMD_STR_DBOX_ACCESS_BACK "dbox_acc_back"
+#define CMD_STR_DBOX_ACCESS_OVER "dbox_acc_over"
+#define CMD_STR_DBOX_ACCESS_READ "dbox_acc_read"
+#define CMD_STR_DBOX_ACCESS_ENABLE "dbox_acc_enable"
+#define CMD_STR_DBOX_KEY_DOWN "dbox_key_down"
+#define CMD_STR_DBOX_KEY_UP "dbox_key_up"
+#define CMD_STR_DBOX_KEY_FOCUS_IN "dbox_key_focus_in"
+#define CMD_STR_DBOX_KEY_FOCUS_OUT "dbox_key_focus_out"
+#define CMD_STR_GBAR_KEY_DOWN "gbar_key_down"
+#define CMD_STR_GBAR_KEY_UP "gbar_key_up"
+#define CMD_STR_GBAR_KEY_FOCUS_IN "gbar_key_focus_in"
+#define CMD_STR_GBAR_KEY_FOCUS_OUT "gbar_key_focus_out"
+#define CMD_STR_UPDATE_MODE "update_mode"
+#define CMD_STR_DBOX_MOUSE_SET "dbox_mouse_set"
+#define CMD_STR_DBOX_MOUSE_UNSET "dbox_mouse_unset"
+#define CMD_STR_GBAR_MOUSE_SET "gbar_mouse_set"
+#define CMD_STR_GBAR_MOUSE_UNSET "gbar_mouse_unset"
+
+/**
+ * @internal
+ * @brief viewer to master
+ */
+#define CMD_CHANGE_VISIBILITY 0x00003B01
+#define CMD_DBOX_ACQUIRE_PIXMAP 0x00003C01
+#define CMD_DBOX_RELEASE_PIXMAP 0x00003D01
+#define CMD_GBAR_ACQUIRE_PIXMAP 0x00003E01
+#define CMD_GBAR_RELEASE_PIXMAP 0x00003F01
+#define CMD_ACQUIRE 0x00004001
+#define CMD_RELEASE 0x00004101
+#define CMD_PINUP_CHANGED 0x00004201
+#define CMD_CREATE_GBAR 0x00004301
+#define CMD_DESTROY_GBAR 0x00004401
+#define CMD_ACTIVATE_PACKAGE 0x00004501
+#define CMD_SUBSCRIBE 0x00004601
+#define CMD_UNSUBSCRIBE 0x00004701
+#define CMD_DELETE_CLUSTER 0x00004801
+#define CMD_DELETE_CATEGORY 0x00004901
+#define CMD_REFRESH_GROUP 0x00004A01
+#define CMD_UPDATE 0x00004B01
+#define CMD_DBOX_KEY_SET 0x00004C01
+#define CMD_DBOX_KEY_UNSET 0x00004D01
+#define CMD_GBAR_KEY_SET 0x00004E01
+#define CMD_GBAR_KEY_UNSET 0x00004F01
+#define CMD_CLIENT_PAUSED 0x00005001
+#define CMD_CLIENT_RESUMED 0x00005101
+#define CMD_DBOX_ACQUIRE_XPIXMAP 0x00005201
+#define CMD_GBAR_ACQUIRE_XPIXMAP 0x00005301
+#define CMD_SUBSCRIBE_CATEGORY 0x00005401
+#define CMD_UNSUBSCRIBE_CATEGORY 0x00005501
+
+#define CMD_STR_CHANGE_VISIBILITY "change,visibility"
+#define CMD_STR_DBOX_ACQUIRE_PIXMAP "dbox_acquire_pixmap"
+#define CMD_STR_DBOX_RELEASE_PIXMAP "dbox_release_pixmap"
+#define CMD_STR_GBAR_ACQUIRE_PIXMAP "gbar_acquire_pixmap"
+#define CMD_STR_GBAR_RELEASE_PIXMAP "gbar_release_pixmap"
+#define CMD_STR_ACQUIRE "acquire"
+#define CMD_STR_RELEASE "release"
+#define CMD_STR_PINUP_CHANGED "pinup_changed"
+#define CMD_STR_CREATE_GBAR "create_gbar"
+#define CMD_STR_DESTROY_GBAR "destroy_gbar"
+#define CMD_STR_ACTIVATE_PACKAGE "activate_package"
+#define CMD_STR_SUBSCRIBE "subscribe" /* pid, cluster, sub-cluster */
+#define CMD_STR_UNSUBSCRIBE "unsubscribe" /* pid, cluster, sub-cluster */
+#define CMD_STR_DELETE_CLUSTER "delete_cluster"
+#define CMD_STR_DELETE_CATEGORY "delete_category"
+#define CMD_STR_REFRESH_GROUP "refresh_group"
+#define CMD_STR_UPDATE "update"
+#define CMD_STR_DBOX_KEY_SET "dbox_key_set"
+#define CMD_STR_DBOX_KEY_UNSET "dbox_key_unset"
+#define CMD_STR_GBAR_KEY_SET "gbar_key_set"
+#define CMD_STR_GBAR_KEY_UNSET "gbar_key_unset"
+#define CMD_STR_CLIENT_PAUSED "client_paused"
+#define CMD_STR_CLIENT_RESUMED "client_resumed"
+#define CMD_STR_DBOX_ACQUIRE_XPIXMAP "dbox_acquire_xpixmap"
+#define CMD_STR_GBAR_ACQUIRE_XPIXMAP "gbar_acquire_xpixmap"
+#define CMD_STR_SUBSCRIBE_CATEGORY "subscribe,category"
+#define CMD_STR_UNSUBSCRIBE_CATEGORY "unsubscribe,category"
+
+/**
+ * @internal
+ * @brief Service API to Master
+ */
+#define CMD_SERVICE_UPDATE 0x00000001
+#define CMD_SERVICE_CHANGE_PERIOD 0x00000101
+#define CMD_SERVICE_INST_CNT 0x00000201
+
+#define CMD_STR_SERVICE_UPDATE "service_update"
+#define CMD_STR_SERVICE_CHANGE_PERIOD "service_change_period"
+#define CMD_STR_SERVICE_INST_CNT "service_inst_cnt"
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
+/* End of a file */
diff --git a/dynamicbox_service/include/dynamicbox_conf.h b/dynamicbox_service/include/dynamicbox_conf.h
new file mode 100644
index 0000000..1d824aa
--- /dev/null
+++ b/dynamicbox_service/include/dynamicbox_conf.h
@@ -0,0 +1,560 @@
+/*
+ * Copyright 2013 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __DYNAMICBOX_SERVICE_CONF_H
+#define __DYNAMICBOX_SERVICE_CONF_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @internal
+ * @brief Load a configuration file to the memory
+ * @since_tizen 2.3
+ * @return int
+ * @retval #DBOX_STATUS_ERROR_NONE Successfully loaded
+ * @retval #DBOX_STATUS_ERROR_IO_ERROR Failed to access the configuration file
+ * @see dynamicbox_conf_reset()
+ */
+extern int dynamicbox_conf_load(void);
+
+/**
+ * @internal
+ * @brief Reset configuration data to its default values
+ * @since_tizen 2.3
+ * @return void
+ * @see dynamicbox_conf_init()
+ */
+extern void dynamicbox_conf_reset(void);
+
+/**
+ * @internal
+ * @brief setup the configuration data using default values
+ * @since_tizen 2.3
+ * @return void
+ * @see dynamicbox_conf_reset()
+ */
+extern void dynamicbox_conf_init(void);
+
+/**
+ * @internal
+ * @brief Get the flag of configuration loaded status
+ * @since_tizen 2.3
+ * @return int 1 if it is loaded or 0
+ * @see dynamicbox_conf_load()
+ */
+extern const int const dynamicbox_conf_is_loaded(void);
+
+/**
+ * @internal
+ * @brief configuration value getter
+ * @detail If your service provider intended to check the window stack directly,
+ * Refer this flag, if this returns 1, you should monitor the window stack
+ * to send the pause/resume event and it should be managed manually.
+ * @remarks this is just a recommendation to implement service provider,
+ * so the service provider's behaviour is depeneds on its implementation.
+ * @since_tizen 2.3
+ * @return int 1 if the xmonitor should be enabled or 0
+ */
+extern const int const dynamicbox_conf_use_xmonitor(void);
+
+/**
+ * @internal
+ * @brief configuration value getter for emergency disk mount information
+ * @detail if the system has not enough space to operate itself, the master provider allocate memory for
+ * its temporary storage. to save some files.
+ * @remarks this is only used for master service provider.
+ * all other service provider should not need to know this configuration value.
+ * but this API support to get current configuration.
+ * @since_tizen 2.3
+ * @return const char * const
+ * @retval string emergency disk mount information includes options
+ * @retval @c NULL if there is no configuration information
+ */
+extern const char * const dynamicbox_conf_emergency_disk(void);
+
+/**
+ * @internal
+ * @brief if the master service provider should need to check the lcd status to pause/resume the service providers,
+ * this function will returns 1, or 0.
+ * @since_tizen 2.3
+ * @return int
+ * @retval 1 need to care the lcd status by master service provider
+ * @retval 0 do not care it even if the lcd is off/on, do not send any pause/resume event to the service providers.
+ */
+extern const int const dynamicbox_conf_check_lcd(void);
+
+/**
+ * @internal
+ * @brief select the option whether use the event time of each event data from device or not.
+ * if this returns 1, the master service provider should keep its timestamp of each event data,
+ * or use the logical timestamp that is get by service provider.
+ * @since_tizen 2.3
+ * @return int
+ * @retval 1 use the timestamp of event data
+ * @retval 0 use the system timestamp instead of event data of device
+ */
+extern const int const dynamicbox_conf_use_event_time(void);
+
+/**
+ * @internal
+ * @brief Get the configuration value for AUTO Alignment of canvas buffer.
+ * @details
+ * If the UIFW does not support the STRIDE information for rendering frame,
+ * This function will returns 1, then the dynamicbox will automatically aligning the buffer.
+ * @since_tizen 2.3
+ * @return status of auto alignment.
+ * @retval 1 Content will be automatically aligned by dynamicbox.
+ * @retval 0 Content will be aligned by UIFW, using stride information.
+ */
+extern const int const dynamicbox_conf_auto_align(void);
+
+/**
+ * @internal
+ * @brief this returns formatted string that represents service list to be enabled
+ * format is "[service name1],[service name2],..."\n
+ * Candidate services are\n
+ * [dynamicbox]\n
+ * [badge]\n
+ * [notification]\n
+ * [utility]\n
+ * [shortcut]\n
+ * @since_tizen 2.3
+ * @return string
+ * @retval NULL if there is no defined list. you should treat this as a default service list
+ */
+extern const char * const dynamicbox_conf_services(void);
+
+/**
+ * @internal
+ * @brief Get the configuration value of "use_sw_backend"
+ * if this returns 1, the provider should not use the Graphics buffer.
+ * @since_tizen 2.3
+ * @return int
+ * @retval 1 true Use the S/W buffer such as heap instead of graphics buffer
+ * @retval 0 false You can choose S/W buffer or Graphics buffer
+ * @see dynamicbox_conf_provider_method()
+ */
+extern const int const dynamicbox_conf_use_sw_backend(void);
+
+/**
+ * @internal
+ * @brief Content sharing method for buffer type dbox (or gbar)
+ * it could be "pixmap", "shm", "file"
+ * in case of pixmap, the master service provider will try to allocate a resource from graphics sub system (ex, Xorg)
+ * in case of shm, it will try to allocate shared memory.
+ * in case of file, it will create a dummy file to write and read frame data from/to it.
+ * @since_tizen 2.3
+ * @return const char * const
+ * @retval "pixmap" use the pixmap
+ * @retval "shm" use the shared memory
+ * @retval "file" use a file
+ */
+extern const char * const dynamicbox_conf_provider_method(void);
+
+/**
+ * @internal
+ * @brief if a debug mode is enabled, master will not launch the service provider directly.
+ * instead of it, the master will permanently waiting the launch of service provider.
+ * so the developer should launch the service provider with correct bundle data.
+ * and it should send the "hello" message to the master provider
+ * @since_tizen 2.3
+ * @return int
+ * @retval 1 master will turn on the debug mode
+ * @retval 0 master will turn off the debug mode
+ */
+extern const int const dynamicbox_conf_debug_mode(void);
+
+/**
+ * @internal
+ * @brief If the overwrite content is enabled, the provider will not prepare to prevent from output file overwriting.
+ * To do it, the provider will renaming the output file right after it is created.
+ * @since_tizen 2.3
+ * @return int bool
+ * @retval 1 Overwrite content
+ * @retval 0 Prevent from overwriting content
+ */
+extern const int const dynamicbox_conf_overwrite_content(void);
+
+/**
+ * @internal
+ */
+extern const int const dynamicbox_conf_com_core_thread(void);
+
+/**
+ * @internal
+ */
+extern const unsigned int const dynamicbox_conf_base_width(void);
+
+/**
+ * @internal
+ */
+extern const unsigned int const dynamicbox_conf_base_height(void);
+
+/**
+ * @internal
+ */
+extern const double const dynamicbox_conf_minimum_period(void);
+
+/**
+ * @internal
+ */
+extern const int const dynamicbox_conf_default_pixels(void);
+
+/**
+ * @internal
+ */
+extern const char * const dynamicbox_conf_default_script(void);
+
+/**
+ * @internal
+ */
+extern const char * const dynamicbox_conf_default_abi(void);
+
+/**
+ * @internal
+ */
+extern const char * const dynamicbox_conf_default_gbar_group(void);
+
+/**
+ * @internal
+ */
+extern const double const dynamicbox_conf_default_period(void);
+
+/**
+ * @internal
+ */
+extern const double const dynamicbox_conf_default_packet_time(void);
+
+/**
+ * @internal
+ */
+extern const char * const dynamicbox_conf_default_content(void);
+
+/**
+ * @internal
+ */
+extern const char * const dynamicbox_conf_default_title(void);
+
+/**
+ * @internal
+ */
+extern const unsigned long const dynamicbox_conf_minimum_space(void);
+
+/**
+ * @internal
+ */
+extern const char * const dynamicbox_conf_replace_tag(void);
+
+/**
+ * @internal
+ */
+extern const double const dynamicbox_conf_slave_ttl(void);
+
+/**
+ * @internal
+ */
+extern const double const dynamicbox_conf_slave_activate_time(void);
+
+/**
+ * @internal
+ */
+extern const double const dynamicbox_conf_slave_relaunch_time(void);
+
+/**
+ * @internal
+ */
+extern const int const dynamicbox_conf_slave_relaunch_count(void);
+
+/**
+ * @internal
+ */
+extern const int const dynamicbox_conf_max_log_line(void);
+
+/**
+ * @internal
+ */
+extern const int const dynamicbox_conf_max_log_file(void);
+
+/**
+ * @internal
+ */
+extern const unsigned long const dynamicbox_conf_sqlite_flush_max(void);
+
+/**
+ * @internal
+ */
+extern const char * const dynamicbox_conf_db_path(void);
+
+/**
+ * @internal
+ */
+extern const char * const dynamicbox_conf_reader_path(void);
+
+/**
+ * @internal
+ */
+extern const char * const dynamicbox_conf_always_path(void);
+
+/**
+ * @internal
+ */
+extern const char * const dynamicbox_conf_log_path(void);
+
+/**
+ * @internal
+ */
+extern const char * const dynamicbox_conf_script_path(void);
+
+/**
+ * @internal
+ */
+extern const char * const dynamicbox_conf_script_port(void);
+
+/**
+ * @internal
+ */
+extern const char * const dynamicbox_conf_share_path(void);
+
+/**
+ * @internal
+ */
+extern const char * const dynamicbox_conf_input_path(void);
+
+/**
+ * @internal
+ */
+extern const char * const dynamicbox_conf_root_path(void);
+
+/**
+ * @internal
+ */
+extern const char * const dynamicbox_conf_path(void);
+
+/**
+ * @internal
+ */
+extern const double const dynamicbox_conf_ping_time(void);
+
+/**
+ * @internal
+ */
+extern const int const dynamicbox_conf_slave_max_load(void);
+
+/**
+ * @internal
+ * @brief Get the configuration value for premultiplied alpha.
+ * @details
+ * If the system uses the premultiplied alpha for content,
+ * This function will returns 1.
+ * @since_tizen 2.3
+ * @remarks This function only works with the inhouse provider.
+ * @return status of premultiplied alpha.
+ * @retval 1 Content rendered with premultiplied alpha.
+ * @retval 0 Content doesn't rendered with premultiplied alpha.
+ */
+extern const int const dynamicbox_conf_premultiplied_alpha(void);
+
+/**
+ * @internal
+ */
+extern const double const dynamicbox_conf_gbar_request_timeout(void);
+
+/**
+ * @internal
+ */
+extern const double const dynamicbox_conf_scale_width_factor(void);
+
+/**
+ * @internal
+ */
+extern const double const dynamicbox_conf_scale_height_factor(void);
+
+/**
+ * @internal
+ */
+extern const char * const dynamicbox_conf_launch_key_name(void);
+
+/**
+ * @internal
+ */
+extern const char * const dynamicbox_conf_launch_key_secured(void);
+
+/**
+ * @internal
+ */
+extern const char * const dynamicbox_conf_launch_key_abi(void);
+
+/**
+ * @internal
+ */
+extern const char * const dynamicbox_conf_launch_key_hw_acceleration(void);
+
+/**
+ * @internal
+ */
+extern const char * const dynamicbox_conf_empty_content(void);
+
+/**
+ * @internal
+ */
+extern const char * const dynamicbox_conf_empty_title(void);
+
+/**
+ * @internal
+ */
+extern const int const dynamicbox_conf_extra_buffer_count(void);
+
+/**
+ * @internal
+ */
+extern const int const dynamicbox_conf_use_gettimeofday(void);
+
+/**
+ * @internal
+ */
+extern const int const dynamicbox_conf_slave_event_boost_off(void);
+
+/**
+ * @internal
+ */
+extern const int const dynamicbox_conf_slave_event_boost_on(void);
+
+/**
+ * @internal
+ */
+extern const double const dynamicbox_conf_event_filter(void);
+
+/**
+ * @internal
+ */
+extern const int const dynamicbox_conf_slave_limit_to_ttl(void);
+
+/**
+ * @internal
+ */
+extern const int const dynamicbox_conf_frame_skip(void);
+
+/**
+ * @internal
+ */
+extern const int const dynamicbox_conf_slave_auto_cache_flush(void);
+
+#define DYNAMICBOX_CONF_BASE_W dynamicbox_conf_base_width()
+#define DYNAMICBOX_CONF_BASE_H dynamicbox_conf_base_height()
+
+#define DYNAMICBOX_CONF_EMERGENCY_DISK dynamicbox_conf_emergency_disk()
+#define DYNAMICBOX_CONF_SCALE_WIDTH_FACTOR dynamicbox_conf_scale_width_factor()
+#define DYNAMICBOX_CONF_SCALE_HEIGHT_FACTOR dynamicbox_conf_scale_height_factor()
+
+#define DYNAMICBOX_CONF_USE_SW_BACKEND dynamicbox_conf_use_sw_backend()
+#define DYNAMICBOX_CONF_PROVIDER_METHOD dynamicbox_conf_provider_method()
+#define DYNAMICBOX_CONF_DEBUG_MODE dynamicbox_conf_debug_mode()
+#define DYNAMICBOX_CONF_OVERWRITE_CONTENT dynamicbox_conf_overwrite_content()
+#define DYNAMICBOX_CONF_COM_CORE_THREAD dynamicbox_conf_com_core_thread()
+
+#define DYNAMICBOX_CONF_MINIMUM_PERIOD dynamicbox_conf_minimum_period()
+
+#define DYNAMICBOX_CONF_DEFAULT_SCRIPT dynamicbox_conf_default_script()
+#define DYNAMICBOX_CONF_DEFAULT_ABI dynamicbox_conf_default_abi()
+#define DYNAMICBOX_CONF_DEFAULT_GBAR_GROUP dynamicbox_conf_default_gbar_group()
+#define DYNAMICBOX_CONF_DEFAULT_PERIOD dynamicbox_conf_default_period()
+#define DYNAMICBOX_CONF_DEFAULT_PIXELS dynamicbox_conf_default_pixels()
+#define DYNAMICBOX_CONF_PRIORITY_NO_CHANGE -1.0f
+
+#define DYNAMICBOX_CONF_BUNDLE_SLAVE_NAME dynamicbox_conf_launch_key_name()
+#define DYNAMICBOX_CONF_BUNDLE_SLAVE_SECURED dynamicbox_conf_launch_key_secured()
+#define DYNAMICBOX_CONF_BUNDLE_SLAVE_ABI dynamicbox_conf_launch_key_abi()
+#define DYNAMICBOX_CONF_BUNDLE_SLAVE_HW_ACCELERATION dynamicbox_conf_launch_key_hw_acceleration()
+#define DYNAMICBOX_CONF_PACKET_TIME dynamicbox_conf_default_packet_time()
+#define DYNAMICBOX_CONF_CONTENT_NO_CHANGE dynamicbox_conf_empty_content()
+#define DYNAMICBOX_CONF_TITLE_NO_CHANGE dynamicbox_conf_empty_title()
+#define DYNAMICBOX_CONF_DEFAULT_TITLE dynamicbox_conf_default_title()
+#define DYNAMICBOX_CONF_DEFAULT_CONTENT dynamicbox_conf_default_content()
+#define DYNAMICBOX_CONF_MINIMUM_SPACE dynamicbox_conf_minimum_space()
+
+#define DYNAMICBOX_CONF_IMAGE_PATH dynamicbox_conf_share_path()
+#define DYNAMICBOX_CONF_SCRIPT_PATH dynamicbox_conf_script_path()
+#define DYNAMICBOX_CONF_SCRIPT_PORT_PATH dynamicbox_conf_script_port()
+#define DYNAMICBOX_CONF_CONF_PATH dynamicbox_conf_path()
+#define DYNAMICBOX_CONF_ROOT_PATH dynamicbox_conf_root_path()
+#define DYNAMICBOX_CONF_LOG_PATH dynamicbox_conf_log_path()
+#define DYNAMICBOX_CONF_READER_PATH dynamicbox_conf_reader_path()
+#define DYNAMICBOX_CONF_ALWAYS_PATH dynamicbox_conf_always_path()
+#define DYNAMICBOX_CONF_INPUT_PATH dynamicbox_conf_input_path()
+
+#define DYNAMICBOX_CONF_REPLACE_TAG_APPID dynamicbox_conf_replace_tag()
+#define DYNAMICBOX_CONF_SLAVE_TTL dynamicbox_conf_slave_ttl()
+#define DYNAMICBOX_CONF_SLAVE_ACTIVATE_TIME dynamicbox_conf_slave_activate_time()
+#define DYNAMICBOX_CONF_SLAVE_RELAUNCH_TIME dynamicbox_conf_slave_relaunch_time()
+#define DYNAMICBOX_CONF_SLAVE_RELAUNCH_COUNT dynamicbox_conf_slave_relaunch_count()
+
+#define DYNAMICBOX_CONF_MAX_LOG_LINE dynamicbox_conf_max_log_line()
+#define DYNAMICBOX_CONF_MAX_LOG_FILE dynamicbox_conf_max_log_file()
+
+#define DYNAMICBOX_CONF_SQLITE_FLUSH_MAX dynamicbox_conf_sqlite_flush_max()
+#define DYNAMICBOX_CONF_DBFILE dynamicbox_conf_db_path()
+
+#define DYNAMICBOX_CONF_GBAR_REQUEST_TIMEOUT dynamicbox_conf_gbar_request_timeout()
+
+#define DYNAMICBOX_CONF_SLAVE_MAX_LOAD dynamicbox_conf_slave_max_load()
+#define DYNAMICBOX_CONF_DEFAULT_PING_TIME dynamicbox_conf_ping_time()
+#define DYNAMICBOX_CONF_PREMULTIPLIED_COLOR dynamicbox_conf_premultiplied_alpha()
+#define DYNAMICBOX_CONF_SERVICES dynamicbox_conf_services()
+#define DYNAMICBOX_CONF_EXTRA_BUFFER_COUNT dynamicbox_conf_extra_buffer_count()
+
+#define DYNAMICBOX_CONF_SERVICE_DYNAMICBOX "[dynamicbox]"
+#define DYNAMICBOX_CONF_SERVICE_NOTIFICATION "[notification]"
+#define DYNAMICBOX_CONF_SERVICE_BADGE "[badge]"
+#define DYNAMICBOX_CONF_SERVICE_SHORTCUT "[shortcut]"
+#define DYNAMICBOX_CONF_SERVICE_UTILITY "[utility]"
+#define DYNAMICBOX_CONF_SERVICE_FILE "[file]"
+
+#define DYNAMICBOX_CONF_PAUSED_FILE "/tmp/.live.paused"
+
+#define DYNAMICBOX_CONF_USE_XMONITOR dynamicbox_conf_use_xmonitor()
+#define DYNAMICBOX_CONF_AUTO_ALIGN dynamicbox_conf_auto_align()
+#define DYNAMICBOX_CONF_USE_EVENT_TIME dynamicbox_conf_use_event_time()
+#define DYNAMICBOX_CONF_CHECK_LCD dynamicbox_conf_check_lcd()
+
+#define DYNAMICBOX_CONF_USE_GETTIMEOFDAY dynamicbox_conf_use_gettimeofday()
+
+#define DYNAMICBOX_CONF_DELAY_TIME 0.0000001f
+#define DYNAMICBOX_CONF_DEFAULT_CLUSTER "user,created"
+#define DYNAMICBOX_CONF_MINIMUM_REACTIVATION_TIME 10
+
+#define DYNAMICBOX_CONF_SLAVE_EVENT_BOOST_ON dynamicbox_conf_slave_event_boost_on()
+#define DYNAMICBOX_CONF_SLAVE_EVENT_BOOST_OFF dynamicbox_conf_slave_event_boost_off()
+#define DYNAMICBOX_CONF_EVENT_FILTER dynamicbox_conf_event_filter()
+#define DYNAMICBOX_CONF_SLAVE_LIMIT_TO_TTL dynamicbox_conf_slave_limit_to_ttl()
+#define DYNAMICBOX_CONF_FRAME_SKIP dynamicbox_conf_frame_skip()
+#define DYNAMICBOX_CONF_SLAVE_AUTO_CACHE_FLUSH dynamicbox_conf_slave_auto_cache_flush()
+
+#if !defined(VCONFKEY_MASTER_STARTED)
+#define VCONFKEY_MASTER_STARTED "memory/data-provider-master/started"
+#endif
+
+#if !defined(VCONFKEY_MASTER_RESTART_COUNT)
+#define VCONFKEY_MASTER_RESTART_COUNT "memory/private/data-provider-master/restart_count"
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* End of a file */
diff --git a/dynamicbox_service/include/dynamicbox_errno.h b/dynamicbox_service/include/dynamicbox_errno.h
new file mode 100644
index 0000000..6633ef3
--- /dev/null
+++ b/dynamicbox_service/include/dynamicbox_errno.h
@@ -0,0 +1,104 @@
+/*
+ * Copyright 2013 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __DYNAMICBOX_ERRNO_H
+#define __DYNAMICBOX_ERRNO_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @file dynamicbox_errno.h
+ * @brief This file declares API of libdynamicbox-service library
+ */
+
+/**
+ * @addtogroup CAPI_DYNAMICBOX_SERVICE_MODULE
+ * @{
+ */
+
+/**
+ * @brief Enumeration for the result status of dynamicbox operation.
+ * @since_tizen 2.3
+ */
+typedef enum dynamicbox_status {
+ DBOX_STATUS_ERROR_NONE = 0x00000000, /**< Operation is successfully completed */
+ DBOX_STATUS_ERROR = 0x80000000, /**< This will be OR'd with other specific error value */
+ DBOX_STATUS_ERROR_INVALID_PARAMETER = DBOX_STATUS_ERROR | 0x0001, /**< Invalid request */
+ DBOX_STATUS_ERROR_FAULT = DBOX_STATUS_ERROR | 0x0002, /**< Fault - Unable to recover from the error */
+ DBOX_STATUS_ERROR_OUT_OF_MEMORY = DBOX_STATUS_ERROR | 0x0004, /**< Memory is not enough to do this operation */
+ DBOX_STATUS_ERROR_EXIST = DBOX_STATUS_ERROR | 0x0008, /**< Already exists */
+ DBOX_STATUS_ERROR_BUSY = DBOX_STATUS_ERROR | 0x0010, /**< Busy so the operation is not started(accepted), try again */
+ DBOX_STATUS_ERROR_PERMISSION_DENIED = DBOX_STATUS_ERROR | 0x0020, /**< Permission error */
+ DBOX_STATUS_ERROR_ALREADY = DBOX_STATUS_ERROR | 0x0040, /**< Operation is already started */
+ DBOX_STATUS_ERROR_CANCEL = DBOX_STATUS_ERROR | 0x0080, /**< Operation is canceled */
+ DBOX_STATUS_ERROR_IO_ERROR = DBOX_STATUS_ERROR | 0x0100, /**< I/O Error */
+ DBOX_STATUS_ERROR_NOT_EXIST = DBOX_STATUS_ERROR | 0x0200, /**< Not exists */
+ DBOX_STATUS_ERROR_TIMEOUT = DBOX_STATUS_ERROR | 0x0400, /**< Timeout */
+ DBOX_STATUS_ERROR_NOT_IMPLEMENTED = DBOX_STATUS_ERROR | 0x0800, /**< Operation is not implemented */
+ DBOX_STATUS_ERROR_NO_SPACE = DBOX_STATUS_ERROR | 0x1000, /**< No space to operate */
+ DBOX_STATUS_ERROR_DISABLED = DBOX_STATUS_ERROR | 0x2000 /**< Disabled */
+} dynamicbox_status_e;
+
+/**
+ * @brief Definition for macro function to check whether given code value indicates error or not.
+ * @since_tizen 2.3
+ */
+#define DBOX_STATUS_IS_ERROR(s) (!!((s) & DBOX_STATUS_ERROR))
+
+/**
+ * @internal
+ * @brief Set the status for the last operation
+ * @param[in] status dynamicbox_status_e status
+ * @since_tizen 2.3
+ * @return void
+ * @see dynamicbox_last_status()
+ */
+extern void dynamicbox_set_last_status(dynamicbox_status_e status);
+
+/**
+ * @brief Get the last error status
+ * @since_tizen 2.3
+ * @return int dynamicbox error status
+ * @retval #DBOX_STATUS_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #DBOX_STATUS_ERROR_NONE successfully operated
+ * @retval #DBOX_STATUS_ERROR_OUT_OF_MEMORY Memory is not enough
+ * @retval #DBOX_STATUS_ERROR_ALREADY Already exists or operated
+ * @retval #DBOX_STATUS_ERROR_BUSY Too busy to handles request, try it again
+ * @retval #DBOX_STATUS_ERROR_FAULT Fault - Unable to recover from the error
+ * @retval #DBOX_STATUS_ERROR_EXIST Already exists
+ * @retval #DBOX_STATUS_ERROR_PERMISSION_DENIED Permission error
+ * @retval #DBOX_STATUS_ERROR_CANCEL Operation is canceled
+ * @retval #DBOX_STATUS_ERROR_IO_ERROR I/O Error
+ * @retval #DBOX_STATUS_ERROR_NOT_EXIST Not exists
+ * @retval #DBOX_STATUS_ERROR_TIMEOUT Timeout
+ * @retval #DBOX_STATUS_ERROR_NOT_IMPLEMENTED Operation is not implemented
+ * @retval #DBOX_STATUS_ERROR_NO_SPACE No space to operate
+ * @retval #DBOX_STATUS_ERROR_DISABLED Disabled
+ */
+extern dynamicbox_status_e dynamicbox_last_status(void);
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* End of a file */
diff --git a/dynamicbox_service/include/dynamicbox_script.h b/dynamicbox_service/include/dynamicbox_script.h
new file mode 100644
index 0000000..86f1ac2
--- /dev/null
+++ b/dynamicbox_service/include/dynamicbox_script.h
@@ -0,0 +1,91 @@
+/*
+ * Copyright 2013 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __DYNAMICBOX_SCRIPT_H
+#define __DYNAMICBOX_SCRIPT_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @file dynamicbox_buffer.h
+ * @brief This file describe the buffer ADT and event definitions
+ */
+
+/**
+ * @addtogroup CAPI_DYNAMICBOX_SERVICE_MODULE
+ * @{
+ */
+
+/**
+ * @internal
+ * @brief Enumeration for script event of dynamicbox.
+ * @details
+ * This enumeration values will be used for script plugin of data-provider-master.
+ * Master will send down these accessibility events to the script plugin.
+ * @since_tizen 2.3
+ */
+typedef enum dynamicbox_script_event {
+ DBOX_SCRIPT_ACCESS_EVENT = 0x01000000, /**< Mask value */
+ DBOX_SCRIPT_MOUSE_EVENT = 0x02000000, /**< Mask value */
+ DBOX_SCRIPT_KEY_EVENT = 0x04000000, /**< Mask value */
+
+ DBOX_SCRIPT_ACCESS_HIGHLIGHT = DBOX_SCRIPT_ACCESS_EVENT | 0x00000001, /**< Highlight */
+ DBOX_SCRIPT_ACCESS_HIGHLIGHT_NEXT = DBOX_SCRIPT_ACCESS_EVENT | 0x00000002, /**< Move Highlight focus to the next object */
+ DBOX_SCRIPT_ACCESS_HIGHLIGHT_PREV = DBOX_SCRIPT_ACCESS_EVENT | 0x00000004, /**< Move Highlight focus to the prev object */
+ DBOX_SCRIPT_ACCESS_ACTIVATE = DBOX_SCRIPT_ACCESS_EVENT | 0x00000008, /**< Activate the highlighted object */
+ DBOX_SCRIPT_ACCESS_ACTION = DBOX_SCRIPT_ACCESS_EVENT | 0x00000010, /**< Do specified action for the highlighted object */
+ DBOX_SCRIPT_ACCESS_SCROLL = DBOX_SCRIPT_ACCESS_EVENT | 0x00000020, /**< Scroll operation */
+ DBOX_SCRIPT_ACCESS_UNHIGHLIGHT = DBOX_SCRIPT_ACCESS_EVENT | 0x00000040, /**< Remove highlight */
+ DBOX_SCRIPT_ACCESS_VALUE_CHANGE = DBOX_SCRIPT_ACCESS_EVENT | 0x00000080, /* TODO: deprecate this */
+ DBOX_SCRIPT_ACCESS_MOUSE = DBOX_SCRIPT_ACCESS_EVENT | 0x00000100, /* give mouse event to highlight object */
+ DBOX_SCRIPT_ACCESS_BACK = DBOX_SCRIPT_ACCESS_EVENT | 0x00000200, /* go back to a previous view ex: pop naviframe item */
+ DBOX_SCRIPT_ACCESS_OVER = DBOX_SCRIPT_ACCESS_EVENT | 0x00000400, /* mouse over an object */
+ DBOX_SCRIPT_ACCESS_READ = DBOX_SCRIPT_ACCESS_EVENT | 0x00000800, /* highlight an object */
+ DBOX_SCRIPT_ACCESS_ENABLE = DBOX_SCRIPT_ACCESS_EVENT | 0x00001000, /* enable highlight and read ability */
+ DBOX_SCRIPT_ACCESS_DISABLE = DBOX_SCRIPT_ACCESS_EVENT | 0x00002000, /* disable highlight and read ability */
+
+ DBOX_SCRIPT_MOUSE_DOWN = DBOX_SCRIPT_MOUSE_EVENT | 0x00001000, /**< Mouse down */
+ DBOX_SCRIPT_MOUSE_MOVE = DBOX_SCRIPT_MOUSE_EVENT | 0x00002000, /**< Mouse move */
+ DBOX_SCRIPT_MOUSE_UP = DBOX_SCRIPT_MOUSE_EVENT | 0x00004000, /**< Mouse up */
+ DBOX_SCRIPT_MOUSE_IN = DBOX_SCRIPT_MOUSE_EVENT | 0x00008000, /**< Mouse in */
+ DBOX_SCRIPT_MOUSE_OUT = DBOX_SCRIPT_MOUSE_EVENT | 0x00010000, /**< Mouse out */
+
+ DBOX_SCRIPT_MOUSE_ON_SCROLL = DBOX_SCRIPT_MOUSE_EVENT | 0x00020000, /**< If the box in in scroller and it is scrolled */
+ DBOX_SCRIPT_MOUSE_OFF_SCROLL = DBOX_SCRIPT_MOUSE_EVENT | 0x00040000, /**< If the box is in scroller but the scroll is stopped */
+ DBOX_SCRIPT_MOUSE_ON_HOLD = DBOX_SCRIPT_MOUSE_EVENT | 0x00080000, /**< Even though the box gets mouse_up event, the click event will not be generated */
+ DBOX_SCRIPT_MOUSE_OFF_HOLD = DBOX_SCRIPT_MOUSE_EVENT | 0x00100000, /**< Generate the click event if the mouse_up event occurred as normal */
+
+ DBOX_SCRIPT_KEY_DOWN = DBOX_SCRIPT_KEY_EVENT | 0x00020000, /**< Key pressed */
+ DBOX_SCRIPT_KEY_UP = DBOX_SCRIPT_KEY_EVENT | 0x00040000, /**< Key released */
+ DBOX_SCRIPT_KEY_FOCUS_IN = DBOX_SCRIPT_KEY_EVENT | 0x00080000, /**< Key focus in */
+ DBOX_SCRIPT_KEY_FOCUS_OUT = DBOX_SCRIPT_KEY_EVENT | 0x00100000, /**< Key focus out */
+} dynamicbox_script_event_e;
+
+/**
+ * @brief definition of event info structure
+ * @since_tizen 2.3
+ */
+typedef struct dynamicbox_event_info *dynamicbox_event_info_t;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
+/* End of a file */
diff --git a/dynamicbox_service/include/dynamicbox_service.h b/dynamicbox_service/include/dynamicbox_service.h
new file mode 100644
index 0000000..6bb65f3
--- /dev/null
+++ b/dynamicbox_service/include/dynamicbox_service.h
@@ -0,0 +1,1119 @@
+/*
+ * Copyright 2013 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __DYNAMICBOX_SERVICE_H
+#define __DYNAMICBOX_SERVICE_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @file dynamic-service.h
+ * @brief This file declares API of libdynamic-service library
+ * @since_tizen 2.3
+ */
+
+/**
+ * @addtogroup CAPI_DYNAMICBOX_SERVICE_MODULE
+ * @{
+ */
+
+/**
+ * @brief Index of buffer
+ * @since_tizen 2.3
+ */
+#define DBOX_PRIMARY_BUFFER -1
+#define DBOX_UNKNOWN_BUFFER -2
+
+/**
+ * @brief Definition for maximum number of supported dynamicbox size type.
+ * @since_tizen 2.3
+ */
+#define DBOX_NR_OF_SIZE_LIST 13
+
+#define DBOX_CH_IDX(a, idx) (((char *)(a))[(idx)])
+#define DBOX_IS_INHOUSE(abi) ((DBOX_CH_IDX(abi, 0) == 'c' || DBOX_CH_IDX(abi, 0) == 'C') && (DBOX_CH_IDX(abi, 1) == '\0' || ((DBOX_CH_IDX(abi, 1) == 'p' || DBOX_CH_IDX(abi, 1) == 'P') && (DBOX_CH_IDX(abi, 2) == 'p' || DBOX_CH_IDX(abi, 2) == 'P') && DBOX_CH_IDX(abi, 3) == '\0')))
+
+/**
+ * @brief Enumeration for list of supporting dynamicbox size types.
+ * @since_tizen 2.3
+ */
+typedef enum dynamicbox_size_type {
+ DBOX_SIZE_TYPE_1x1 = 0x0001, /**< 175x175 based on 720x1280 resolution */
+ DBOX_SIZE_TYPE_2x1 = 0x0002, /**< 354x175 based on 720x1280 resolution */
+ DBOX_SIZE_TYPE_2x2 = 0x0004, /**< 354x354 based on 720x1280 resolution */
+ DBOX_SIZE_TYPE_4x1 = 0x0008, /**< 712x175 based on 720x1280 resolution */
+ DBOX_SIZE_TYPE_4x2 = 0x0010, /**< 712x354 based on 720x1280 resolution */
+ DBOX_SIZE_TYPE_4x3 = 0x0020, /**< 712x533 based on 720x1280 resolution */
+ DBOX_SIZE_TYPE_4x4 = 0x0040, /**< 712x712 based on 720x1280 resolution */
+ DBOX_SIZE_TYPE_4x5 = 0x0080, /**< 712x891 based on 720x1280 resolution */
+ DBOX_SIZE_TYPE_4x6 = 0x0100, /**< 712x1070 based on 720x1280 resolution */
+ DBOX_SIZE_TYPE_EASY_1x1 = 0x1000, /**< 224x215 based on 720x1280 resolution */
+ DBOX_SIZE_TYPE_EASY_3x1 = 0x2000, /**< 680x215 based on 720x1280 resolution */
+ DBOX_SIZE_TYPE_EASY_3x3 = 0x4000, /**< 680x653 based on 720x1280 resolution */
+ DBOX_SIZE_TYPE_0x0 = 0x0800, /**< 720x1280 based on 720x1280 resolution */
+ DBOX_SIZE_TYPE_UNKNOWN = 0xFFFF /**< Error */
+} dynamicbox_size_type_e;
+
+/**
+ * @internal
+ * @brief Enumeration for result of accessibility event processing.
+ * @details Reference the libprovider & libdynamicbox-viewer.
+ * @since_tizen 2.3
+ */
+typedef enum dynamicbox_access_status {
+ DBOX_ACCESS_STATUS_ERROR = 0x80000000, /**< Mask value */
+ DBOX_ACCESS_STATUS_DONE = 0x00000000, /**< Successfully finished */
+ DBOX_ACCESS_STATUS_FIRST, /**< Reach to the first item */
+ DBOX_ACCESS_STATUS_LAST, /**< Reach to the last item */
+ DBOX_ACCESS_STATUS_READ /**< TTS is done */
+} dynamicbox_access_status_e;
+
+/**
+ * @internal
+ * @brief Key event handling result status.
+ * @since_tizen 2.3
+ */
+typedef enum dynamicbox_key_status {
+ DBOX_KEY_STATUS_ERROR = 0x80000000, /**< Key operation is failed */
+ DBOX_KEY_STATUS_DONE = 0x00000000, /**< Key operation is successfully done */
+ DBOX_KEY_STATUS_FIRST, /**< Focusable object item reaches to the first in it */
+ DBOX_KEY_STATUS_LAST, /**< Focusable object item reaches to the last in it */
+} dynamicbox_key_status_e;
+
+/**
+ * @brief Delete type for dynamicbox delete operation.
+ * @since_tizen 2.3
+ */
+typedef enum dynamicbox_delete_type {
+ DBOX_DELETE_PERMANENTLY = 0x01, /**< The dynamicbox is removed from the homescreen temporary */
+ DBOX_DELETE_TEMPORARY = 0x02, /**< The dynamicbox is removed from the homescreen by user permanently */
+ DBOX_DELETE_INVALID = 0xff, /**< Unknown event type */
+} dynamicbox_delete_type_e;
+
+/**
+ * @brief Request type for closing Glance Bar
+ * @since_tizen 2.3
+ */
+typedef enum dynamicbox_gbar_close_type {
+ DBOX_CLOSE_GBAR_NORMAL = 0x00, /**< Glance Bar is closed normally */
+ DBOX_CLOSE_GBAR_TIMEOUT = 0x01, /**< Glance Bar is closed because of timeout, there is no response */
+ DBOX_CLOSE_GBAR_FAULT = 0x02, /**< Glance Bar is closed because of unrecoverable error */
+ DBOX_CLOSE_GBAR_INVALID = 0xff, /**< Unknown event type */
+} dynamicbox_gbar_close_type_e;
+
+/**
+ * @internal
+ * @brief Type of dynamicbox content sharing method
+ * @since_tizen 2.3
+ */
+typedef enum dynamicbox_dbox_type {
+ DBOX_TYPE_NONE = 0x0, /**< Undefined */
+ DBOX_TYPE_SCRIPT, /**< Script base */
+ DBOX_TYPE_FILE, /**< File base */
+ DBOX_TYPE_TEXT, /**< Text base */
+ DBOX_TYPE_BUFFER, /**< Buffer base */
+ DBOX_TYPE_UIFW /**< UIFW supported type */
+} dynamicbox_dbox_type_e;
+
+/**
+ * @internal
+ * @brief Type of glance bar content sharing method
+ * @since_tizen 2.3
+ */
+typedef enum dynamicbox_gbar_type {
+ GBAR_TYPE_NONE = 0x0, /**< Undefined */
+ GBAR_TYPE_SCRIPT, /**< Script base */
+ GBAR_TYPE_TEXT, /**< Text base */
+ GBAR_TYPE_BUFFER, /**< Buffer base */
+ GBAR_TYPE_UIFW /**< UIFW supported type */
+} dynamicbox_gbar_type_e;
+
+/**
+ * @brief Destroy type of dynamicbox instance
+ * @since_tizen 2.3
+ */
+typedef enum dynamicbox_destroy_type {
+ DBOX_DESTROY_TYPE_DEFAULT = 0x00, /**< Deleted */
+ DBOX_DESTROY_TYPE_UPGRADE = 0x01, /**< Deleted for upgrading */
+ DBOX_DESTROY_TYPE_UNINSTALL = 0x02, /**< Deleted by uninstalling */
+ DBOX_DESTROY_TYPE_TERMINATE = 0x03, /**< Deleted for reboot device */
+ DBOX_DESTROY_TYPE_FAULT = 0x04, /**< Deleted by system-fault */
+ DBOX_DESTROY_TYPE_TEMPORARY = 0x05, /**< Temporarly deleted, will be created again */
+ DBOX_DESTROY_TYPE_UNKNOWN = 0x06 /**< Undefined reason */
+} dynamicbox_destroy_type_e; /**< Delete type */
+
+/**
+ * @brief
+ * Text signal & Content event uses this data structure.
+ * @since_tizen 2.3
+ */
+typedef struct dynamicbox_event_info {
+ struct _pointer {
+ double x; /**< X value of current mouse(touch) position */
+ double y; /**< Y value of current mouse(touch) position */
+ int down; /**< Is it pressed(1) or not(0) */
+ } pointer;
+
+ struct _part {
+ double sx; /**< Pressed object's left top X */
+ double sy; /**< Pressed object's left top Y */
+ double ex; /**< Pressed object's right bottom X */
+ double ey; /**< Pressed object's right bottom Y */
+ } part;
+} *dynamicbox_event_info_t;
+
+/**
+ * @brief Dynamicbox Buffer Handler
+ * @since_tizen 2.3
+ */
+typedef struct dynamicbox_buffer *dynamicbox_buffer_h;
+
+/**
+ * @brief Dynamicbox Buffer Event information
+ * @since_tizen 2.3
+ */
+typedef struct dynamicbox_buffer_event_data *dynamicbox_buffer_event_data_t;
+
+/**
+ * @brief Dynamicbox Buffer Handler
+ * @since_tizen 2.3
+ */
+typedef struct dynamicbox_buffer *dynamicbox_buffer_h;
+
+/**
+ * @internal
+ * @brief This enumeration values should be sync'd with libdynamicbox interface. (only for inhouse dynamicbox)
+ * @since_tizen 2.3
+ */
+typedef enum dynamicbox_buffer_event {
+ DBOX_BUFFER_EVENT_ENTER, /**< get the focus */
+ DBOX_BUFFER_EVENT_LEAVE, /**< lost the focus */
+ DBOX_BUFFER_EVENT_DOWN, /**< Touch down */
+ DBOX_BUFFER_EVENT_MOVE, /**< Touch move */
+ DBOX_BUFFER_EVENT_UP, /**< Touch up */
+
+ DBOX_BUFFER_EVENT_KEY_DOWN, /**< Key pressed */
+ DBOX_BUFFER_EVENT_KEY_UP, /**< Key release */
+ DBOX_BUFFER_EVENT_KEY_FOCUS_IN, /**< Focus in */
+ DBOX_BUFFER_EVENT_KEY_FOCUS_OUT, /**< Focus out */
+
+ DBOX_BUFFER_EVENT_ACCESS_HIGHLIGHT, /**< Accessibility Highlight event */
+ DBOX_BUFFER_EVENT_ACCESS_HIGHLIGHT_NEXT, /**< Accessibility Highlight Next event */
+ DBOX_BUFFER_EVENT_ACCESS_HIGHLIGHT_PREV, /**< Accessibility Highlight Prev event */
+ DBOX_BUFFER_EVENT_ACCESS_ACTIVATE, /**< Accessibility Activate event */
+ DBOX_BUFFER_EVENT_ACCESS_ACTION_UP, /**< Accessibility Action Up event */
+ DBOX_BUFFER_EVENT_ACCESS_ACTION_DOWN, /**< Accessibility Action Down event */
+ DBOX_BUFFER_EVENT_ACCESS_SCROLL_UP, /**< Accessibility Scroll Mouse Up event */
+ DBOX_BUFFER_EVENT_ACCESS_SCROLL_MOVE, /**< Accessibility Scroll Mouse Move event */
+ DBOX_BUFFER_EVENT_ACCESS_SCROLL_DOWN, /**< Accessibility Scroll Mouse Down event */
+ DBOX_BUFFER_EVENT_ACCESS_UNHIGHLIGHT, /**< Accessibility Unhighlight event */
+
+ DBOX_BUFFER_EVENT_ON_HOLD, /**< To prevent from generating mouse clicked event */
+ DBOX_BUFFER_EVENT_OFF_HOLD, /**< Disable the mouse hold event */
+ DBOX_BUFFER_EVENT_ON_SCROLL, /**< Enable the scroll flag */
+ DBOX_BUFFER_EVENT_OFF_SCROLL, /**< Disable the scroll flag */
+
+ DBOX_BUFFER_EVENT_ACCESS_VALUE_CHANGE, /**< */
+ DBOX_BUFFER_EVENT_ACCESS_MOUSE, /**< give mouse event to highlight object */
+ DBOX_BUFFER_EVENT_ACCESS_BACK, /**< go back to a previous view ex: pop naviframe item */
+ DBOX_BUFFER_EVENT_ACCESS_OVER, /**< mouse over an object */
+ DBOX_BUFFER_EVENT_ACCESS_READ, /**< highlight an object */
+ DBOX_BUFFER_EVENT_ACCESS_ENABLE, /**< enable highlight and read ability */
+ DBOX_BUFFER_EVENT_ACCESS_DISABLE /**< disable highlight and read ability */
+} dynamicbox_buffer_event_e;
+
+/**
+ * @internal
+ * @brief Dynamic Box Buffer Event Data
+ * @since_tizen 2.3
+ */
+typedef struct dynamicbox_buffer_event_data {
+ dynamicbox_buffer_event_e type; /**< Event type */
+ double timestamp; /**< Timestamp */
+
+ union input_data {
+ struct mouse {
+ int x; /**< Touch X coordinate */
+ int y; /**< Touch Y coordinate */
+ } pointer;
+
+ struct access {
+ int x; /**< Accessibility event X coordinate */
+ int y; /**< Accessibility event Y coordinate */
+ unsigned int mouse_type; /**< 0: down, 1: move, 2: up | 0: cur, 1: next, 2: prev, 3: off */
+ unsigned int action_type; /**< reserved for protocol */
+ unsigned int action_by; /**< reserved for protocol */
+ int cycle; /**< reserved for protocol */
+ } access;
+
+ unsigned int keycode; /**< Key code value */
+ } info;
+} *dynamicbox_buffer_event_data_t;
+
+/**
+ * @internal
+ * @brief Package list handle.
+ * @since_tizen 2.3
+ */
+typedef struct dynamicbox_pkglist_handle *dynamicbox_pkglist_h;
+
+/**
+ * @brief Gets the pixel size of given size type.
+ * @details
+ * Size types would be\n
+ * #DBOX_SIZE_TYPE_1x1\n
+ * #DBOX_SIZE_TYPE_2x1\n
+ * #DBOX_SIZE_TYPE_2x2\n
+ * #DBOX_SIZE_TYPE_4x1\n
+ * #DBOX_SIZE_TYPE_4x2\n
+ * #DBOX_SIZE_TYPE_4x3\n
+ * #DBOX_SIZE_TYPE_4x4\n
+ * #DBOX_SIZE_TYPE_4x5\n
+ * #DBOX_SIZE_TYPE_4x6\n
+ * #DBOX_SIZE_TYPE_0x0\n
+ * #DBOX_SIZE_TYPE_EASY_1x1\n
+ * #DBOX_SIZE_TYPE_EASY_3x1\n
+ * #DBOX_SIZE_TYPE_EASY_3x3.
+ * @since_tizen 2.3
+ * @param[in] type Size type
+ * @param[out] width Pixel size width
+ * @param[out] height Pixel size height
+ * @feature http://developer.samsung.com/tizen/feature/samsung_extension
+ * @feature http://developer.samsung.com/tizen/feature/in_house/shell.appwidget
+ * @return int type
+ * @retval #DBOX_STATUS_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #DBOX_STATUS_ERROR_NONE Successfully done
+ * @see dynamicbox_size_type()
+ * @see dynamicbox_service_size_type()
+ */
+extern int dynamicbox_service_get_size(dynamicbox_size_type_e type, int *width, int *height);
+
+/**
+ * @brief Gets the size type for given pixel size.
+ * @details
+ * Returnable size types are\n
+ * #DBOX_SIZE_TYPE_1x1\n
+ * #DBOX_SIZE_TYPE_2x1\n
+ * #DBOX_SIZE_TYPE_2x2\n
+ * #DBOX_SIZE_TYPE_4x1\n
+ * #DBOX_SIZE_TYPE_4x2\n
+ * #DBOX_SIZE_TYPE_4x3\n
+ * #DBOX_SIZE_TYPE_4x4\n
+ * #DBOX_SIZE_TYPE_4x5\n
+ * #DBOX_SIZE_TYPE_4x6\n
+ * #DBOX_SIZE_TYPE_0x0\n
+ * #DBOX_SIZE_TYPE_EASY_1x1\n
+ * #DBOX_SIZE_TYPE_EASY_3x1\n
+ * #DBOX_SIZE_TYPE_EASY_3x3\n
+ * or\n
+ * #DBOX_SIZE_TYPE_UNKNOWN for error.
+ * @since_tizen 2.3
+ * @param[in] width Pixel size width
+ * @param[in] height Pixel size height
+ * @feature http://developer.samsung.com/tizen/feature/samsung_extension
+ * @feature http://developer.samsung.com/tizen/feature/in_house/shell.appwidget
+ * @return int type
+ * @retval #DBOX_SIZE_TYPE_[EASY_]WxH Size type of given pixel size
+ * @retval #DBOX_SIZE_TYPE_UNKNOWN If the given pixel size is not valid, dynamicbox_last_status() will returns reason of failure.
+ * @see dynamicbox_size_type()
+ * @see dynamicbox_service_get_size()
+ */
+extern dynamicbox_size_type_e dynamicbox_service_size_type(int width, int height);
+
+/**
+ * @internal
+ * @brief Supports the mouse event of dynamicbox content.
+ * @details This function will returns true/false, but even if this fails to access database to retrieve information,
+ * This will returns 0. in that case, you can check it using dynamicbox_last_status() function.
+ * If there is an error, it will returns proper error code.
+ * @since_tizen 2.3
+ * @param[in] dboxid Dynamicbox AppId
+ * @privlevel public
+ * @privilege %http://developer.samsung.com/tizen/privilege/dynamicbox.viewer
+ * @feature http://developer.samsung.com/tizen/feature/samsung_extension
+ * @feature http://developer.samsung.com/tizen/feature/in_house/shell.appwidget
+ * @return int type
+ * @retval 1 If the box requires mouse event, A viewer must has to feed the mouse event to the box instance
+ * @retval 0 If the box doesn't requires mouse event, In this case, you can check whether it is error or not using dynamicbox_last_status() function.
+ * @see dynamicbox_service_touch_effect()
+ * @see dynamicbox_service_need_frame()
+ * @see dynamicbox_last_status()
+ */
+extern int dynamicbox_service_mouse_event(const char *dboxid, int size_type);
+
+/**
+ * @internal
+ * @brief Requires touch effect.
+ * @details If this API returns true(1), the viewer should make touch effect when a user click the dynamicbox.
+ * This function returns 1 even if it fails to retrieve information from Database.
+ * So if you need validate the information whether it is correct or not, you can use dynamicbox_last_status() function.
+ * Even if this function returns 1, It is recommended to check last status of this function call.
+ * @since_tizen 2.3
+ * @param[in] dboxid Dynamicbox AppId
+ * @param[in] size_type Size type
+ * @privlevel public
+ * @privilege %http://developer.samsung.com/tizen/privilege/dynamicbox.viewer
+ * @feature http://developer.samsung.com/tizen/feature/samsung_extension
+ * @feature http://developer.samsung.com/tizen/feature/in_house/shell.appwidget
+ * @return int type
+ * @retval 1 If the box requires touch effect, A viewer should make the touch effect, but it is just recomendation.
+ * @retval 0 If the box doesn't requires touch effect, the box will make touch effect itself
+ * @see dynamicbox_service_mouse_event()
+ * @see dynamicbox_service_need_frame()
+ * @see dynamicbox_last_status()
+ */
+extern int dynamicbox_service_touch_effect(const char *dboxid, int size_type);
+
+/**
+ * @internal
+ * @brief Requires decoration frame.
+ * @details If this API returns true(1), the viewer should make decoration border on the dynamicbox content.
+ * If this function returns 0, you can validate it using dynamicbox_last_status() function.
+ * If something goes wrong, so this fails to retrieve information, you can check reason why it fails to get it
+ * using dynamicbox_last_status() function.
+ * @since_tizen 2.3
+ * @param[in] dboxid Dynamicbox AppId
+ * @param[in] size_type Size type
+ * @privlevel public
+ * @privilege %http://developer.samsung.com/tizen/privilege/dynamicbox.viewer
+ * @feature http://developer.samsung.com/tizen/feature/samsung_extension
+ * @feature http://developer.samsung.com/tizen/feature/in_house/shell.appwidget
+ * @return int type
+ * @retval 1 If the box requires frame for decorating its contents
+ * @retval 0 If the box doesn't requires frame
+ * @see dynamicbox_service_mouse_event()
+ * @see dynamicbox_service_touch_effect()
+ * @see dynamicbox_last_status()
+ */
+extern int dynamicbox_service_need_frame(const char *dboxid, int size_type);
+
+/**
+ * @brief Triggers the update event for given dynamicbox instance.
+ * @since_tizen 2.3
+ * @param[in] dboxid Dynamicbox AppId
+ * @param[in] instance_id Set @c NULL if you don't know what the Id is. Then every instance of given pkgname will be triggered its update event
+ * @param[in] cluster Cluster name. Default @c NULL
+ * @param[in] category Category name, Default @c NULL
+ * @param[in] content New content information, Default @c NULL
+ * @param[in] force 1 if you want to update your dynamicbox even if the provider is paused or 0. 0 is default
+ * @privlevel public
+ * @privilege %http://developer.samsung.com/tizen/privilege/dynamicbox.provider
+ * @feature http://developer.samsung.com/tizen/feature/samsung_extension
+ * @feature http://developer.samsung.com/tizen/feature/in_house/shell.appwidget
+ * @return int type
+ * @retval #DBOX_STATUS_ERROR_INVALID_PARAMETER Invalid argument
+ * @retval #DBOX_STATUS_ERROR_CANCEL Provider is paused, so this update request is canceld.(ignored), if you want to make update forcely, use force=1
+ * @retval #DBOX_STATUS_ERROR_MEMORY Memory is not enough to make request
+ * @retval #DBOX_STATUS_ERROR_FAULT Failed to create a request packet
+ * @retval #DBOX_STATUS_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #DBOX_STATUS_ERROR_NONE Successfully requested
+ * @see dynamicbox_service_trigger_update()
+ */
+extern int dynamicbox_service_trigger_update(const char *dboxid, const char *instance_id, const char *cluster, const char *category, const char *content, int force);
+
+/**
+ * @brief Changes the update period of given dynamicbox instance.
+ * @since_tizen 2.3
+ * @param[in] dboxid Dynamicbox AppId
+ * @param[in] instance_id Dynamicbox instance id
+ * @param[in] period New update period in sec
+ * @privlevel public
+ * @privilege %http://developer.samsung.com/tizen/privilege/dynamicbox.provider
+ * @feature http://developer.samsung.com/tizen/feature/samsung_extension
+ * @feature http://developer.samsung.com/tizen/feature/in_house/shell.appwidget
+ * @return int type
+ * @retval #DBOX_STATUS_ERROR_NONE Successfully changed(requested)
+ * @retval #DBOX_STATUS_ERROR_INVALID_PARAMETER Invalid argument
+ * @retval #DBOX_STATUS_ERROR_FAULT Failed to create a request packet
+ * @retval #DBOX_STATUS_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #DBOX_STATUS_ERROR_MEMORY Not enough memory
+ */
+extern int dynamicbox_service_change_period(const char *dboxid, const char *instance_id, double period);
+
+/**
+ * @internal
+ * @brief Gets synchronous package list.
+ * @details
+ * callback (appid, dboxid, is_prime)\n
+ * pkgid == Package ID (pkgname)\n
+ * dboxid = Dynamicbox AppId\n
+ * is_prime = 1 if the dynamicbox is default one for associated application package\n
+ * If the callback returns negative value, the list crawling will be stopped.
+ * @since_tizen 2.3
+ * @param[in] cb Callback function
+ * @param[in] data Callback data
+ * @privlevel public
+ * @privilege %http://developer.samsung.com/tizen/privilege/dynamicbox.viewer
+ * @feature http://developer.samsung.com/tizen/feature/samsung_extension
+ * @feature http://developer.samsung.com/tizen/feature/in_house/shell.appwidget
+ * @return int type
+ * @retval #DBOX_STATUS_ERROR_IO_ERROR Failed to access DB
+ * @retval #DBOX_STATUS_ERROR_INVALID_PARAMETER Invalid argument
+ * @retval #DBOX_STATUS_ERROR_PERMISSION_DENIED Permission denied
+ * @retval count Count of dynamicbox packages
+ * @see dynamicbox_service_get_pkglist_by_pkgid()
+ */
+extern int dynamicbox_service_get_pkglist(int (*cb)(const char *pkgid, const char *dboxid, int is_prime, void *data), void *data);
+
+/**
+ * @internal
+ * @brief Gets synchronous uiapp list.
+ * @details
+ * Callback (appid, data)\n
+ * This function will retrieve all UI Apps in a package which has given dynamicbox appid(dboxid).\n
+ * If you need to get all ui-app list, using a dynamicbox appid, this function is able to help you.
+ * @since_tizen 2.3
+ * @param[in] dboxid Dynamicbox App Id
+ * @param[in] cb Callback function
+ * @param[in] data Callback Data
+ * @privlevel public
+ * @privilege %http://developer.samsung.com/tizen/privilege/dynamicbox.viewer
+ * @feature http://developer.samsung.com/tizen/feature/samsung_extension
+ * @feature http://developer.samsung.com/tizen/feature/in_house/shell.appwidget
+ * @return int type
+ * @retval #DBOX_STATUS_ERROR_NONE Status success
+ * @retval #DBOX_STATUS_ERROR_INVALID_PARAMETER Invalid argument
+ * @retval #DBOX_STATUS_ERROR_IO_ERROR Failed to access DB
+ * @retval #DBOX_STATUS_ERROR_MEMORY Memory error
+ * @retval #DBOX_STATUS_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #DBOX_STATUS_ERROR_FAULT Unrecoverable error occurred
+ */
+extern int dynamicbox_service_get_applist(const char *dboxid, void (*cb)(const char *dboxid, const char *appid, void *data), void *data);
+
+/**
+ * @internal
+ * @brief Gets the MAIN application Id of given dynamicbox package Id.
+ * @since_tizen 2.3
+ * @param[in] dboxid Dynamicbox Package Id
+ * @privlevel public
+ * @privilege %http://developer.samsung.com/tizen/privilege/dynamicbox.viewer
+ * @feature http://developer.samsung.com/tizen/feature/samsung_extension
+ * @feature http://developer.samsung.com/tizen/feature/in_house/shell.appwidget
+ * @return char * type
+ * @retval @c NULL If it fails to get main application Id (UI-APPID), dynamicbox_last_status() will returns reason of failure.
+ * @retval appid Main application Id
+ * @see dynamicbox_last_status()
+ */
+extern char *dynamicbox_service_mainappid(const char *dboxid);
+
+/**
+ * @internal
+ * @brief Gets synchronous package list.
+ * @details
+ * callback (dboxid, is_prime)\n
+ * dboxid == Dynamicbox AppId\n
+ * is_prime = 1 if the dynamicbox is default one for selected package\n
+ * If the callback returns negative value, the list crawling will be stopped.
+ * @since_tizen 2.3
+ * @param[in] pkgid Package Id (Not the UI App Id)
+ * @param[in] cb Callback function
+ * @param[in] data Callback data
+ * @privlevel public
+ * @privilege %http://developer.samsung.com/tizen/privilege/dynamicbox.viewer
+ * @feature http://developer.samsung.com/tizen/feature/samsung_extension
+ * @feature http://developer.samsung.com/tizen/feature/in_house/shell.appwidget
+ * @return int type
+ * @retval int Count of dynamicbox packages
+ * @retval #DBOX_STATUS_ERROR_INVALID_PARAMETER Invalid argument
+ * @retval #DBOX_STATUS_ERROR_IO_ERROR Failed to access DB
+ * @retval #DBOX_STATUS_ERROR_PERMISSION_DENIED Permission denied
+ * @see dynamicbox_service_get_pkglist()
+ */
+extern int dynamicbox_service_get_pkglist_by_pkgid(const char *pkgid, int (*cb)(const char *dboxid, int is_prime, void *data), void *data);
+
+/**
+ * @internal
+ * @brief Gets synchronous package list.
+ * @details
+ * callback (dboxid)\n
+ * dboxid == Dynamicbox AppId\n
+ * If the callback returns negative value, the list crawling will be stopped
+ * @since_tizen 2.3
+ * @param[in] category Name of category
+ * @param[in] cb Callback function
+ * @param[in] data Callback data
+ * @privlevel public
+ * @privilege %http://developer.samsung.com/tizen/privilege/dynamicbox.viewer
+ * @feature http://developer.samsung.com/tizen/feature/samsung_extension
+ * @feature http://developer.samsung.com/tizen/feature/in_house/shell.appwidget
+ * @return int count
+ * @retval Count of dynamicbox packages
+ * @retval #DBOX_STATUS_ERROR_INVALID_PARAMETER Invalid argument
+ * @retval #DBOX_STATUS_ERROR_IO_ERROR Failed to access DB
+ * @retval #DBOX_STATUS_ERROR_PERMISSION_DENIED Permission denied
+ * @see dynamicbox_service_get_pkglist_by_pkgid()
+ */
+extern int dynamicbox_service_get_pkglist_by_category(const char *category, int (*cb)(const char *dboxid, void *data), void *data);
+
+/**
+ * @internal
+ * @brief Gets the id of a primary dynamicbox using given (dbox or package or UI app) Id. If a given id is a dynamicbox id, check its existence. and if it is package or ui-app id, then find the primary dynamicbox in its package.
+ * @since_tizen 2.3
+ * @param[in] id Dynamic Box Id or Package Id or UI App Id
+ * @privlevel public
+ * @privilege %http://developer.samsung.com/tizen/privilege/dynamicbox.viewer
+ * @feature http://developer.samsung.com/tizen/feature/samsung_extension
+ * @feature http://developer.samsung.com/tizen/feature/in_house/shell.appwidget
+ * @return char * type
+ * @retval @c NULL Failed to get primary dboxid, dynamicbox_last_status() will returns reason of failure.
+ * @retval dboxid Primary dynamicbox Id. which is allocated in the heap
+ * @pre Must be released returned string by manually.
+ * @see dynamicbox_service_package_id()
+ */
+extern char *dynamicbox_service_dbox_id(const char *id);
+
+/**
+ * @internal
+ * @brief Checks the primary flag of given dynamicbox Id.
+ * @since_tizen 2.3
+ * @param[in] dboxid Dynamicbox Id
+ * @privlevel public
+ * @privilege %http://developer.samsung.com/tizen/privilege/dynamicbox.viewer
+ * @feature http://developer.samsung.com/tizen/feature/samsung_extension
+ * @feature http://developer.samsung.com/tizen/feature/in_house/shell.appwidget
+ * @return int type
+ * @retval 0 If is not a primary, dynamicbox_last_status() will returns reason of failure if it fails.
+ * @retval 1 If it is a primary dynamicbox
+ */
+extern int dynamicbox_service_is_primary(const char *dboxid);
+
+/**
+ * @internal
+ * @brief Get the category using given dboxid.
+ * @since_tizen 2.3
+ * @param[in] dboxid Dynamicbox AppId
+ * @privlevel public
+ * @privilege %http://developer.samsung.com/tizen/privilege/dynamicbox.viewer
+ * @feature http://developer.samsung.com/tizen/feature/samsung_extension
+ * @feature http://developer.samsung.com/tizen/feature/in_house/shell.appwidget
+ * @return char *
+ * @retval @c NULL Failed to get primary dboxid, dynamicbox_last_status() will returns reason of failure if it fails.
+ * @retval category Category string which is allocated in the heap.
+ * @pre Must be released returned string by manually
+ * @post N/A
+ * @see dynamicbox_service_dbox_id()
+ */
+extern char *dynamicbox_service_category(const char *dboxid);
+
+/**
+ * @internal
+ * @brief Gets the name of a dynamicbox (provider name == dynamicbox appid), you have to release the return value after use it.
+ * @details
+ * Dynamicbox has provider process for each dynamicbox instances.\n
+ * To get the provider's package name, you can use this API.\n
+ * If the given dboxid is inhouse dynamicbox, the return string will be the same with given argument but it is allocated in the heap.
+ * @since_tizen 2.3
+ * @param[in] dboxid Dynamicbox Id
+ * @feature http://developer.samsung.com/tizen/feature/samsung_extension
+ * @feature http://developer.samsung.com/tizen/feature/in_house/shell.appwidget
+ * @return char * type
+ * @retval @c NULL Failed to get provider name, dynamicbox_last_status() will returns reason of failure if it fails.
+ * @retval dboxid Dynamicbox AppId which is allocated on the heap
+ * @post Returned string must be free'd manually.
+ */
+extern char *dynamicbox_service_provider_name(const char *dboxid);
+
+/**
+ * @internal
+ * @brief Gets the appId of setup app which is specified by given dynamicbox Id's manifest.
+ * @details
+ * This setup app should be launched before adding the dynamicbox to get the content_info.\n
+ * This function should be called before add a dynamicbox.\n
+ * To determine the content information string.
+ * @since_tizen 2.3
+ * @param[in] dboxid Dynamicbox Id
+ * @privlevel public
+ * @privilege %http://developer.samsung.com/tizen/privilege/dynamicbox.viewer
+ * @feature http://developer.samsung.com/tizen/feature/samsung_extension
+ * @feature http://developer.samsung.com/tizen/feature/in_house/shell.appwidget
+ * @return char * type
+ * @retval @c NULL There is no setup application or error occurred, you can check it using dynamicbox_last_status()
+ * @retval appid AppId if exists or @c NULL
+ * @post Returned string must be free'd manually.
+ * @see dynamicbox_last_status()
+ */
+extern char *dynamicbox_service_setup_appid(const char *dboxid);
+
+/**
+ * @internal
+ * @brief Gets the Package Id (Not the UI App Id) of given dynamicbox, &lt;manifest package="AAA"&gt; tag.
+ * @since_tizen 2.3
+ * @param[in] dboxid Dynamicbox AppId
+ * @privlevel public
+ * @privilege %http://developer.samsung.com/tizen/privilege/dynamicbox.viewer
+ * @feature http://developer.samsung.com/tizen/feature/samsung_extension
+ * @feature http://developer.samsung.com/tizen/feature/in_house/shell.appwidget
+ * @return char * type
+ * @retval appid String which is allocated in the heap
+ * @retval @c NULL Invalid appid, dynamicbox_last_status() will returns reason of failure if it fails.
+ * @post Returned string must be free'd manually.
+ * @see dynamicbox_service_dbox_id()
+ */
+extern char *dynamicbox_service_package_id(const char *dboxid);
+
+/**
+ * @internal
+ * @brief Gives Internationalized name of dynamicbox package.
+ * @since_tizen 2.3
+ * @param[in] dboxid Dynamicbox AppId
+ * @param[in] lang Locale(en-us, ko-kr, ...), if it is @c NULL, function will use the system locale automatically
+ * @privlevel public
+ * @privilege %http://developer.samsung.com/tizen/privilege/dynamicbox.viewer
+ * @feature http://developer.samsung.com/tizen/feature/samsung_extension
+ * @feature http://developer.samsung.com/tizen/feature/in_house/shell.appwidget
+ * @return char * type
+ * @retval name If it fails to get name
+ * @retval @c NULL Allocated heap address, dynamicbox_last_status() will returns reason of failure if it fails.
+ * @post Returned string must be free'd by manually.
+ * @see dynamicbox_service_i18n_icon()
+ * @see dynamicbox_service_preview()
+ */
+extern char *dynamicbox_service_i18n_name(const char *dboxid, const char *lang);
+
+/**
+ * @internal
+ * @brief Gets the preview image path of given size type.
+ * @details This function will returns i18nized preview image path.
+ * @since_tizen 2.3
+ * @param[in] dboxid Dynamicbox AppId
+ * @param[in] size_type Dynamicbox size type
+ * @privlevel public
+ * @privilege %http://developer.samsung.com/tizen/privilege/dynamicbox.viewer
+ * @feature http://developer.samsung.com/tizen/feature/samsung_extension
+ * @feature http://developer.samsung.com/tizen/feature/in_house/shell.appwidget
+ * @return char * type
+ * @retval path Preview image path
+ * @retval @c NULL There is no preview image file, dynamicbox_last_status() will returns reason of failure if it fails.
+ * @post Returned string must be free'd manually.
+ * @see dynamicbox_service_i18n_icon()
+ * @see dynamicbox_service_i18n_name()
+ */
+extern char *dynamicbox_service_preview(const char *dboxid, int size_type);
+
+/**
+ * @internal
+ * @brief Gets the default content string of the given dynamicbox.
+ * @details
+ * If the user defines the default content string in the manifest file (.xml),\n
+ * this API will return it.
+ * @since_tizen 2.3
+ * @param[in] dboxid Dynamicbox AppId
+ * @privlevel public
+ * @privilege %http://developer.samsung.com/tizen/privilege/dynamicbox.viewer
+ * @feature http://developer.samsung.com/tizen/feature/samsung_extension
+ * @feature http://developer.samsung.com/tizen/feature/in_house/shell.appwidget
+ * @return char * type
+ * @retval content Content string
+ * @retval @c NULL There is no specified content string, or dynamicbox_last_status() will returns reason of failure if it fails.
+ * @pre Manifest has the default content string. &lt;content&gt;Default content string&lt;content&gt; tag.
+ * @post Returned string must be free'd manually.
+ */
+extern char *dynamicbox_service_content(const char *dboxid);
+
+/**
+ * @internal
+ * @brief Gives Internationalized icon path of given dynamicbox package.
+ * @details The user should free the returned string with free().
+ * @since_tizen 2.3
+ * @param[in] dboxid Dynamicbox AppId (It must has to be a dynamicbox package ID. not the UI-APP and the PACKAGE)
+ * @param[in] lang Locale(en-us, ko-kr, ...), if it is @c NULL, function will use the system locale automatically
+ * @privlevel public
+ * @privilege %http://developer.samsung.com/tizen/privilege/dynamicbox.viewer
+ * @feature http://developer.samsung.com/tizen/feature/samsung_extension
+ * @feature http://developer.samsung.com/tizen/feature/in_house/shell.appwidget
+ * @return char * type
+ * @retval name Allocated heap address
+ * @retval @c NULL Fails to get path of an icon, dynamicbox_last_status() will returns reason of failure if it fails.
+ * @post Returned string must be free'd manually.
+ * @see dynamicbox_service_i18n_name()
+ * @see dynamicbox_service_preview()
+ */
+extern char *dynamicbox_service_i18n_icon(const char *pkgid, const char *lang);
+
+/**
+ * @internal
+ * @brief Gets the "nodisplay" value.
+ * @since_tizen 2.3
+ * @param[in] dboxid Dynamicbox AppId
+ * @privlevel public
+ * @privilege %http://developer.samsung.com/tizen/privilege/dynamicbox.viewer
+ * @feature http://developer.samsung.com/tizen/feature/samsung_extension
+ * @feature http://developer.samsung.com/tizen/feature/in_house/shell.appwidget
+ * @return int type
+ * @retval 1 The box should not be listed by the dynamicbox list app
+ * @retval 0 Box should be listed, dynamicbox_last_status() will returns reason of failure if it fails.
+ * @pre Dynamicbox tag includes "nodisplay" attribute.
+ */
+extern int dynamicbox_service_nodisplay(const char *dboxid);
+
+/**
+ * @internal
+ * @brief Gets the "ABI" of given package.
+ * @since_tizen 2.3
+ * @param[in] dboxid Dynamicbox AppId
+ * @privlevel public
+ * @privilege %http://developer.samsung.com/tizen/privilege/dynamicbox.viewer
+ * @feature http://developer.samsung.com/tizen/feature/samsung_extension
+ * @feature http://developer.samsung.com/tizen/feature/in_house/shell.appwidget
+ * @return char * type
+ * @retval abi String which is allocated in the heap
+ * @retval @c NULL Failed to get ABI of given dynamicbox, dynamicbox_last_status() will returns reason of failure if it fails.
+ * @post Returned string must be free'd manually.
+ */
+extern char *dynamicbox_service_abi(const char *dboxid);
+
+/**
+ * @internal
+ * @brief Checks the status of the dynamicbox.
+ * @details Currently this API is not implemented. It just returns 1 all the time.
+ * @since_tizen 2.3
+ * @remarks This API is not implemented. It will always return 1.
+ * @param[in] dboxid Dynamicbox AppId
+ * @privlevel public
+ * @privilege %http://developer.samsung.com/tizen/privilege/dynamicbox.viewer
+ * @feature http://developer.samsung.com/tizen/feature/samsung_extension
+ * @feature http://developer.samsung.com/tizen/feature/in_house/shell.appwidget
+ * @return int type
+ * @retval 1 Enabled
+ * @retval 0 Disabled
+ */
+extern int dynamicbox_service_is_enabled(const char *dboxid);
+
+/**
+ * @internal
+ * @brief Gets the script file of dynamicbox.
+ * @since_tizen 2.3
+ * @param[in] dboxid Dynamicbox AppId
+ * @privlevel public
+ * @privilege %http://developer.samsung.com/tizen/privilege/dynamicbox.viewer
+ * @feature http://developer.samsung.com/tizen/feature/samsung_extension
+ * @feature http://developer.samsung.com/tizen/feature/in_house/shell.appwidget
+ * @return char * type
+ * @retval string Script file path
+ * @retval @c NULL Not specified script file, dynamicbox_last_status() will returns reason of failure if it fails.
+ * @pre Dynamicbox should be developed as script type.
+ * @post Return'd string must be free'd manually.
+ * @see dynamicbox_service_dbox_script_group()
+ */
+extern char *dynamicbox_service_dbox_script_path(const char *dboxid);
+
+/**
+ * @internal
+ * @brief Gets the script group of dynamicbox.
+ * @since_tizen 2.3
+ * @param[in] dboxid Dynamicbox AppId
+ * @privlevel public
+ * @privilege %http://developer.samsung.com/tizen/privilege/dynamicbox.viewer
+ * @feature http://developer.samsung.com/tizen/feature/samsung_extension
+ * @feature http://developer.samsung.com/tizen/feature/in_house/shell.appwidget
+ * @return char * type
+ * @retval Group Name of dynamicbox
+ * @retval @c NULL If there is no group defined, or dynamicbox_last_status() will returns reason of failure if it fails.
+ * @pre Dynamicbox should be developed as script type.
+ * @post Return'd string must be free'd manually.
+ * @see dynamicbox_service_dbox_script_path()
+ */
+extern char *dynamicbox_service_dbox_script_group(const char *dboxid);
+
+/**
+ * @internal
+ * @brief Gets the script file path of given dynamicbox package.
+ * @since_tizen 2.3
+ * @param[in] dboxid Dynamicbox AppId
+ * @privlevel public
+ * @privilege %http://developer.samsung.com/tizen/privilege/dynamicbox.viewer
+ * @feature http://developer.samsung.com/tizen/feature/samsung_extension
+ * @feature http://developer.samsung.com/tizen/feature/in_house/shell.appwidget
+ * @return char * type
+ * @retval string Script file path
+ * @retval @c NULL No specified script file for Glance Bar layout, or dynamicbox_last_status() will returns reason of failure if it fails.
+ * @post Returned string must be free'd manually.
+ * @see dynamicbox_service_gbar_script_group()
+ */
+extern char *dynamicbox_service_gbar_script_path(const char *dboxid);
+
+/**
+ * @internal
+ * @brief Gets the group name for script file to load it.
+ * @since_tizen 2.3
+ * @param[in] dboxid Dynamicbox AppId
+ * @privlevel public
+ * @privilege %http://developer.samsung.com/tizen/privilege/dynamicbox.viewer
+ * @feature http://developer.samsung.com/tizen/feature/samsung_extension
+ * @feature http://developer.samsung.com/tizen/feature/in_house/shell.appwidget
+ * @return char * type
+ * @retval string Script group name
+ * @retval @c NULL No script path, or dynamicbox_last_status() will returns reason of failure if it fails.
+ * @post Returned string must be free'd manually.
+ * @see dynamicbox_service_gbar_script_path()
+ */
+extern char *dynamicbox_service_gbar_script_group(const char *dboxid);
+
+/**
+ * @internal
+ * @brief Gets the supported size list.
+ * @since_tizen 2.3
+ * @param[in] dboxid Dynamicbox AppId
+ * @param[in] cnt Count of array w and h
+ * @param[in] w Width array
+ * @param[in] h Height array
+ * @param[out] cnt Count of array w and h
+ * @param[out] w Width array
+ * @param[out] h Height array
+ * @privlevel public
+ * @privilege %http://developer.samsung.com/tizen/privilege/dynamicbox.viewer
+ * @feature http://developer.samsung.com/tizen/feature/samsung_extension
+ * @feature http://developer.samsung.com/tizen/feature/in_house/shell.appwidget
+ * @return int type
+ * @retval #DBOX_STATUS_ERROR_NONE If succeed to get supported size list
+ * @retval #DBOX_STATUS_ERROR_IO_ERROR Failed to access DB
+ * @retval #DBOX_STATUS_ERROR_INVALID_PARAMETER Invalid argument
+ * @retval #DBOX_STATUS_ERROR_PERMISSION_DENIED Permission denied
+ * @see dynamicbox_service_get_supported_size_types()
+ */
+extern int dynamicbox_service_get_supported_sizes(const char *dboxid, int *cnt, int *w, int *h);
+
+/**
+ * @internal
+ * @brief Gets the supported size list of given pkgid.
+ * @since_tizen 2.3
+ * @param[in] dboxid Dynamicbox AppId
+ * @param[in] cnt Size of types array
+ * @param[out] cnt Result count of types array
+ * @param[out] types Array of types
+ * @privlevel public
+ * @privilege %http://developer.samsung.com/tizen/privilege/dynamicbox.viewer
+ * @feature http://developer.samsung.com/tizen/feature/samsung_extension
+ * @feature http://developer.samsung.com/tizen/feature/in_house/shell.appwidget
+ * @return int type
+ * @retval #DBOX_STATUS_ERROR_INVALID_PARAMETER Invalid argument
+ * @retval #DBOX_STATUS_ERROR_IO_ERROR Failed to access DB
+ * @retval #DBOX_STATUS_ERROR_NONE Successfully done
+ * @retval #DBOX_STATUS_ERROR_PERMISSION_DENIED Permission denied
+ * @see dynamicbox_service_get_supported_sizes()
+ */
+extern int dynamicbox_service_get_supported_size_types(const char *dboxid, int *cnt, int *types);
+
+/**
+ * @internal
+ * @brief Gets the category list of given cluster.
+ * @since_tizen 2.3
+ * @param[in] cluster Cluster name
+ * @param[in] cb Callback function
+ * @param[in] data Callback data
+ * @privlevel public
+ * @privilege %http://developer.samsung.com/tizen/privilege/dynamicbox.viewer
+ * @feature http://developer.samsung.com/tizen/feature/samsung_extension
+ * @feature http://developer.samsung.com/tizen/feature/in_house/shell.appwidget
+ * @return int type
+ * @retval #DBOX_STATUS_ERROR_NONE Successfully done
+ * @retval #DBOX_STATUS_ERROR_IO_ERROR Failed to access DB
+ * @retval #DBOX_STATUS_ERROR_INVALID_PARAMETER Invalid argument
+ * @retval #DBOX_STATUS_ERROR_PERMISSION_DENIED Permission denied
+ * @see dynamicbox_service_enumerate_cluster_list()
+ */
+extern int dynamicbox_service_enumerate_category_list(const char *cluster, int (*cb)(const char *cluster, const char *category, void *data), void *data);
+
+/**
+ * @internal
+ * @brief Gets the cluster list.
+ * @since_tizen 2.3
+ * @param[in] cb Callback function for retrieving the cluster list
+ * @param[in] data Callback data
+ * @privlevel public
+ * @privilege %http://developer.samsung.com/tizen/privilege/dynamicbox.viewer
+ * @feature http://developer.samsung.com/tizen/feature/samsung_extension
+ * @feature http://developer.samsung.com/tizen/feature/in_house/shell.appwidget
+ * @return int type
+ * @retval #DBOX_STATUS_ERROR_INVALID_PARAMETER Invalid argument
+ * @retval #DBOX_STATUS_ERROR_IO_ERROR Failed to access DB
+ * @retval #DBOX_STATUS_ERROR_PERMISSION_DENIED Permission denied
+ * @retval count Count of category items
+ * @see dynamicbox_service_enumerate_category_list()
+ */
+extern int dynamicbox_service_enumerate_cluster_list(int (*cb)(const char *cluster, void *data), void *data);
+
+/**
+ * @internal
+ * @brief Initializes the Dynamicbox service API.
+ * @details Open the DB file.\n
+ * You don't need to call this if you are using dynamicbox service API shortly.\n
+ * But if you are using dynamicbox service API while whole life of your S/W,
+ * using this, initate the dynamicbox service is more benefical to you.\n
+ * This API will prepare the DB operation, if you don't initiate the dynamicbox service,
+ * every API which are related with DB operation will open DB and close it before return from it.
+ * @since_tizen 2.3
+ * @privlevel public
+ * @privilege %http://developer.samsung.com/tizen/privilege/dynamicbox.viewer
+ * @feature http://developer.samsung.com/tizen/feature/samsung_extension
+ * @feature http://developer.samsung.com/tizen/feature/in_house/shell.appwidget
+ * @return int type
+ * @retval #DBOX_STATUS_ERROR_NONE Succeed to initialize
+ * @retval #DBOX_STATUS_ERROR_IO_ERROR Failed to access a DB
+ * @retval #DBOX_STATUS_ERROR_PERMISSION_DENIED Permission denied
+ * @see dynamicbox_service_fini()
+ */
+extern int dynamicbox_service_init(void);
+
+/**
+ * @internal
+ * @brief Finalizes the dynamicbox service API.
+ * @since_tizen 2.3
+ * @privlevel public
+ * @privilege %http://developer.samsung.com/tizen/privilege/dynamicbox.viewer
+ * @feature http://developer.samsung.com/tizen/feature/samsung_extension
+ * @feature http://developer.samsung.com/tizen/feature/in_house/shell.appwidget
+ * @return int type
+ * @retval #DBOX_STATUS_ERROR_NONE Succeed to finalize
+ * @retval #DBOX_STATUS_ERROR_IO_ERROR Failed to close the DB (access failed to DB)
+ * @retval #DBOX_STATUS_ERROR_PERMISSION_DENIED Permission denied
+ * @pre Dynamicbox_service_init.
+ * @see dynamicbox_service_init()
+ */
+extern int dynamicbox_service_fini(void);
+
+/**
+ * @internal
+ * @brief Creates a handle for getting the package list.
+ * @details
+ * If you want get the record one by one from DB, use this.\n
+ * This function will create a iterator.\n
+ * Then you can get the records one by one, but there is no backward iterator.\n
+ * You can only get a forward iterator.\n
+ * After calling this function the iterator will be moved to the next record automatically.
+ * @since_tizen 2.3
+ * @remarks
+ * If you call this function again using created pkglist handle, it will be reset.
+ * So you can get records from the first one again.
+ * @param[in] dboxid Dynamicbox AppId
+ * @param[in] handle @c NULL if you call this first, or it will be reset
+ * @privlevel public
+ * @privilege %http://developer.samsung.com/tizen/privilege/dynamicbox.viewer
+ * @feature http://developer.samsung.com/tizen/feature/samsung_extension
+ * @feature http://developer.samsung.com/tizen/feature/in_house/shell.appwidget
+ * @return handle
+ * @retval @c NULL If it fails, dynamicbox_last_status() will returns reason of failure if it fails.
+ * @retval handle If it successfully create the package list iterator
+ * @see dynamicbox_service_pkglist_destroy()
+ */
+extern dynamicbox_pkglist_h dynamicbox_service_pkglist_create(const char *dboxid, dynamicbox_pkglist_h handle);
+
+/**
+ * @internal
+ * @brief Gets the dboxid & package name & is_prime flag.
+ * @since_tizen 2.3
+ * @param[in] handle Handle which is created by dynamicbox_service_pkglist_create() function
+ * @param[out] dboxid Dynamicbox Id
+ * @param[out] pkgname Package Id which includes dynamicboxes
+ * @param[out] is_prime If the returned dboxid is primary, this will be 1 or 0
+ * @privlevel public
+ * @privilege %http://developer.samsung.com/tizen/privilege/dynamicbox.viewer
+ * @feature http://developer.samsung.com/tizen/feature/samsung_extension
+ * @feature http://developer.samsung.com/tizen/feature/in_house/shell.appwidget
+ * @return int type
+ * @retval #DBOX_STATUS_ERROR_NONE Successfully get the record
+ * @retval #DBOX_STATUS_ERROR_INVALID_PARAMETER Invalid argument
+ * @retval #DBOX_STATUS_ERROR_NOT_EXIST Reach to the end of result set. you can rewind the iterator call dynamicbox_service_pkglist_create() again with current handle
+ * @retval #DBOX_STATUS_ERROR_MEMORY Not enough memory
+ * @post You must release the dboxid, pkgname manually.
+ * @see dynamicbox_service_pkglist_create()
+ * @see dynamicbox_service_pkglist_destroy()
+ */
+extern int dynamicbox_service_get_pkglist_item(dynamicbox_pkglist_h handle, char **dboxid, char **pkgname, int *is_prime);
+
+/**
+ * @internal
+ * @brief Destroys the iterator of pkglist.
+ * @since_tizen 2.3
+ * @param[in] handle Package list handle
+ * @privlevel public
+ * @privilege %http://developer.samsung.com/tizen/privilege/dynamicbox.viewer
+ * @feature http://developer.samsung.com/tizen/feature/samsung_extension
+ * @feature http://developer.samsung.com/tizen/feature/in_house/shell.appwidget
+ * @return int type
+ * @retval #DBOX_STATUS_ERROR_INVALID_PARAMETER Invalid handle
+ * @retval #DBOX_STATUS_ERROR_NONE Successfully destroyed
+ * @pre Handle must be created by dynamicbox_service_pkglist_create().
+ * @post You have not to use the handle again after destroy it.
+ * @see dynamicbox_service_pkglist_create()
+ */
+extern int dynamicbox_service_pkglist_destroy(dynamicbox_pkglist_h handle);
+
+/**
+ * @internal
+ * @brief Getting the activated instance count.
+ * @since_tizen 2.3
+ * @param[in] dboxid Dynamicbox Id, if you want to get whole instnaces list, use NULL.
+ * @param[in] cluster Cluster name if you don't know what this is, use NULL.
+ * @param[in] category Sub-cluster(category) name if you don't know what this is, use NULL.
+ * @privlevel public
+ * @privilege %http://developer.samsung.com/tizen/privilege/dynamicbox.viewer
+ * @feature http://developer.samsung.com/tizen/feature/samsung_extension
+ * @feature http://developer.samsung.com/tizen/feature/in_house/shell.appwidget
+ * @return count of instances
+ * @retval #DBOX_STATUS_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #DBOX_STATUS_ERROR_FAULT Unrecorvarable error occurred
+ * @retval count Positive value including ZERO, Count of activated instances on viewers
+ */
+extern int dynamicbox_service_get_instance_count(const char *dboxid, const char *cluster, const char *category);
+
+/**
+ * @internal
+ * @brief Gets the path of the plug-in module.
+ * @since_tizen 2.3
+ * @param[in] dboxid Dynamicbox AppId
+ * @privlevel public
+ * @privilege %http://developer.samsung.com/tizen/privilege/dynamicbox.viewer
+ * @feature http://developer.samsung.com/tizen/feature/samsung_extension
+ * @feature http://developer.samsung.com/tizen/feature/in_house/shell.appwidget
+ * @return char * type
+ * @retval path String which is allocated on the heap
+ * @retval @c NULL No libexec attribute, or dynamicbox_last_status() will returns reason of failure if it fails.
+ * @post Returned string must be free'd manually.
+ */
+extern char *dynamicbox_service_libexec(const char *dboxid);
+
+/**
+ * @internal
+ * @brief Find the lbid using its libexec
+ * @details only if the dynamicbox should use the "libexec" attribute in its "<dynamicbox>" tag
+ * @since_tizen 2.3
+ * @remarks Only usable for inhouse dynamicboxes
+ * @param[in] libexec so filename
+ * @privlevel public
+ * @privilege %http://developer.samsung.com/tizen/privilege/dynamicbox.viewer
+ * @feature http://developer.samsung.com/tizen/feature/samsung_extension
+ * @feature http://developer.samsung.com/tizen/feature/in_house/shell.appwidget
+ * @return char *
+ * @retval @c NULL if it fails to get pkgname, dynamicbox_last_status() will returns reason of failure.
+ * @retval address heap address of pkgname
+ * @post return'd string should be released by "free()"
+ */
+extern char *dynamicbox_service_dbox_id_by_libexec(const char *libexec);
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
+/* End of a file */
diff --git a/include/util.h b/dynamicbox_service/include/util.h
index 2d85dc1..c38612a 100644
--- a/include/util.h
+++ b/dynamicbox_service/include/util.h
@@ -15,25 +15,26 @@
*/
struct supported_size_list {
- int w;
- int h;
+ int w;
+ int h;
};
struct service_info {
- sqlite3 *handle;
- const char *dbfile;
- const char *conf_file;
- int init_count;
+ sqlite3 *handle;
+ const char *dbfile;
+ const char *conf_file;
+ int init_count;
- const char *iso3lang;
- char country[ULOC_COUNTRY_CAPACITY];
- char *syslang;
- int country_len;
+ const char *iso3lang;
+ char country[ULOC_COUNTRY_CAPACITY];
+ char *syslang;
+ int country_len;
- int base_w;
- int base_h;
+ int base_w;
+ int base_h;
- int base_parse;
+ int base_parse;
+ dynamicbox_status_e last_status;
};
extern double util_timestamp(void);
@@ -41,14 +42,13 @@ extern const char *util_basename(const char *name);
extern unsigned long util_free_space(const char *path);
extern char *util_replace_string(const char *src, const char *pattern, const char *replace);
extern const char *util_uri_to_path(const char *uri);
-extern int util_validate_livebox_package(const char *pkgname);
-extern char *util_conf_get_libexec(const char *pkgname);
-extern char *util_id_to_uri(const char *id); /* For FILENAME id */
+extern char *util_id_to_uri(const char *id); /* For FILENAME id */
extern int util_update_resolution(struct service_info *info, struct supported_size_list *SIZE_LIST);
+extern int util_screen_size_get(unsigned int *width, unsigned int *height);
-#define SCHEMA_FILE "file://"
-#define SCHEMA_PIXMAP "pixmap://"
-#define SCHEMA_SHM "shm://"
+#define SCHEMA_FILE "file://"
+#define SCHEMA_PIXMAP "pixmap://"
+#define SCHEMA_SHM "shm://"
#define MAX_COLUMN 80
diff --git a/src/dlist.c b/dynamicbox_service/src/dlist.c
index 3ae571b..3ae571b 100644
--- a/src/dlist.c
+++ b/dynamicbox_service/src/dlist.c
diff --git a/dynamicbox_service/src/dynamicbox_conf.c b/dynamicbox_service/src/dynamicbox_conf.c
new file mode 100644
index 0000000..970e787
--- /dev/null
+++ b/dynamicbox_service/src/dynamicbox_conf.c
@@ -0,0 +1,1793 @@
+/*
+ * Copyright 2013 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <stdio.h>
+#include <ctype.h>
+#include <errno.h>
+#include <string.h>
+#include <stdlib.h>
+#include <unistd.h> // access
+#include <sqlite3.h>
+#include <fcntl.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+
+#include <dlog.h>
+#include <dynamicbox_errno.h>
+#include <unicode/uloc.h>
+
+#include "dynamicbox_conf.h"
+#include "util.h"
+#include "debug.h"
+
+#define BASE_SHARE_DIR "/opt/usr/share/live_magazine/"
+#define DEFAULT_INPUT_NODE "/dev/input/event2"
+#define DEV_PATH "/dev/input/"
+#define PROC_INPUT_DEVICES "/proc/bus/input/devices"
+#define MAX_LINE_BUFFER 256
+#define NODE_PREFIX "event"
+
+#define CR 13
+#define LF 10
+
+#define MAX_ABI 256
+#define MAX_PKGNAME 512
+
+static const char *CONF_DEFAULT_SERVICES = "[dynamicbox],[shortcut],[notification],[badge],[utility],[file]";
+static const char *CONF_DEFAULT_EMERGENCY_DISK = "source=tmpfs;type=tmpfs;option=size=6M";
+static const char *CONF_DEFAULT_PATH_CONF = "/opt/usr/live/%s/etc/%s.conf";
+static const char *CONF_DEFAULT_PATH_IMAGE = BASE_SHARE_DIR;
+static const char *CONF_DEFAULT_PATH_LOG = BASE_SHARE_DIR"log";
+static const char *CONF_DEFAULT_PATH_READER = BASE_SHARE_DIR"reader";
+static const char *CONF_DEFAULT_PATH_ALWAYS = BASE_SHARE_DIR"always";
+static const char *CONF_DEFAULT_PATH_SCRIPT = "/opt/usr/live/%s/res/script/%s.edj";
+static const char *CONF_DEFAULT_PATH_ROOT = "/opt/usr/live/";
+static const char *CONF_DEFAULT_PATH_SCRIPT_PORT = "/usr/share/data-provider-master/plugin-script/";
+static const char *CONF_DEFAULT_PATH_DB = "/opt/dbspace/.dynamicbox.db";
+static const char *CONF_DEFAULT_PATH_INPUT = DEFAULT_INPUT_NODE;
+static const char *CONF_DEFAULT_SCRIPT_TYPE = "edje";
+static const char *CONF_DEFAULT_ABI = "c";
+static const char *CONF_DEFAULT_GBAR_GROUP = "disclosure";
+static const char *CONF_DEFAULT_LAUNCH_BUNDLE_NAME = "name";
+static const char *CONF_DEFAULT_LAUNCH_BUNDLE_SECURED = "secured";
+static const char *CONF_DEFAULT_LAUNCH_BUNDLE_ABI = "abi";
+static const char *CONF_DEFAULT_LAUNCH_BUNDLE_HW_ACCELERATION = "hw-acceleration";
+static const char *CONF_DEFAULT_CONTENT = "default";
+static const char *CONF_DEFAULT_TITLE = "";
+static const char *CONF_DEFAULT_EMPTY_CONTENT = "";
+static const char *CONF_DEFAULT_EMPTY_TITLE = "";
+static const char *CONF_DEFAULT_REPLACE_TAG = "/APPID/";
+static const char *CONF_DEFAULT_PROVIDER_METHOD = "pixmap";
+static const int CONF_DEFAULT_WIDTH = 0;
+static const int CONF_DEFAULT_HEIGHT = 0;
+static const int CONF_DEFAULT_BASE_WIDTH = 720;
+static const int CONF_DEFAULT_BASE_HEIGHT = 1280;
+static const double CONF_DEFAULT_MINIMUM_PERIOD = 1.0f;
+static const double CONF_DEFAULT_PERIOD = -1.0f;
+static const double CONF_DEFAULT_PACKET_TIME = 0.0001f;
+static const unsigned long CONF_DEFAULT_MINIMUM_SPACE = 5242880;
+static const double CONF_DEFAULT_SLAVE_TTL = 30.0f;
+static const double CONF_DEFAULT_SLAVE_ACTIVATE_TIME = 30.0f;
+static const double CONF_DEFAULT_SLAVE_RELAUNCH_TIME = 3.0f;
+static const int CONF_DEFAULT_SLAVE_RELAUNCH_COUNT = 3;
+static const int CONF_DEFAULT_MAX_LOG_LINE = 1000;
+static const int CONF_DEFAULT_MAX_LOG_FILE = 3;
+static const int CONF_DEFAULT_SQLITE_FLUSH_MAX = 1048576;
+static const double CONF_DEFAULT_PING_TIME = 240.0f;
+static const int CONF_DEFAULT_SLAVE_MAX_LOAD = 30;
+static const int CONF_DEFAULT_USE_SW_BACKEND = 0;
+static const int CONF_DEFAULT_DEBUG_MODE = 0;
+static const int CONF_DEFAULT_OVERWRITE_CONTENT = 0;
+static const int CONF_DEFAULT_COM_CORE_THREAD = 1;
+static const int CONF_DEFAULT_USE_XMONITOR = 0;
+static const int CONF_DEFAULT_PREMULTIPLIED = 1;
+static const double CONF_DEFAULT_SCALE_WIDTH_FACTOR = 1.0f;
+static const double CONF_DEFAULT_SCALE_HEIGHT_FACTOR = 1.0f;
+static const double CONF_DEFAULT_GBAR_REQUEST_TIMEOUT = 5.0f;
+static const int CONF_DEFAULT_PIXELS = sizeof(int);
+static const int CONF_DEFAULT_AUTO_ALIGN = 1;
+static const int CONF_DEFAULT_USE_EVENT_TIME = 1;
+static const int CONF_DEFAULT_CHECK_LCD = 1;
+static const int CONF_DEFAULT_EXTRA_BUFFER_COUNT = 1;
+static const int CONF_DEFAULT_USE_GETTIMEOFDAY = 0;
+static const int CONF_DEFAULT_SLAVE_EVENT_BOOST_ON = 0;
+static const int CONF_DEFAULT_SLAVE_EVENT_BOOST_OFF = 0;
+static const double CONF_DEFAULT_EVENT_FILTER = 0.5f;
+static const int CONF_DEFAULT_SLAVE_LIMIT_TO_TTL = 0;
+static const int CONF_DEFAULT_SLAVE_AUTO_CACHE_FLUSH = 0;
+
+#define CONF_PATH_FORMAT "/usr/share/data-provider-master/%dx%d/conf.ini"
+
+int errno;
+
+struct dynamicbox_conf {
+ unsigned int width;
+ unsigned int height;
+
+ unsigned int base_width;
+ unsigned int base_height;
+ double minimum_period;
+
+ struct {
+ char *script;
+ char *abi;
+ char *gbar_group;
+ double period;
+ int pixels;
+ } default_conf;
+
+ struct {
+ char *name;
+ char *secured;
+ char *abi;
+ char *hw_acceleration;
+ } launch_key;
+
+ double default_packet_time;
+
+ char *empty_content;
+ char *empty_title;
+
+ char *default_content;
+ char *default_title;
+
+ unsigned long minimum_space;
+
+ char *replace_tag;
+
+ double slave_ttl;
+ double slave_activate_time;
+ double slave_relaunch_time;
+ int slave_relaunch_count;
+
+ int max_log_line;
+ int max_log_file;
+
+ unsigned long sqlite_flush_max;
+
+ struct {
+ char *conf;
+ char *image;
+ char *script;
+ char *root;
+ char *script_port;
+ char *slave_log;
+ char *reader;
+ char *always;
+ char *db;
+ char *input;
+ } path;
+
+ int max_size_type;
+
+ int slave_max_load;
+
+ double ping_time;
+
+ char *vconf_sys_cluster;
+ int max_pended_ctx_events;
+
+ int use_sw_backend;
+ char *provider_method;
+ int debug_mode;
+ int overwrite_content;
+ int com_core_thread;
+ int use_xmonitor;
+ int premultiplied;
+
+ double scale_width_factor;
+ double scale_height_factor;
+
+ double gbar_request_timeout;
+
+ char *emergency_disk;
+ char *services;
+ int auto_align;
+ int use_event_time;
+ int check_lcd;
+ int extra_buffer_count;
+ int use_gettimeofday;
+ int slave_event_boost_on;
+ int slave_event_boost_off;
+ double event_filter;
+ int slave_limit_to_ttl;
+ int frame_skip;
+ int slave_auto_cache_flush;
+};
+
+static struct dynamicbox_conf s_conf;
+
+static struct info {
+ int conf_loaded;
+} s_info = {
+ .conf_loaded = 0,
+};
+
+static void slave_auto_cache_flush_handler(char *buffer)
+{
+ s_conf.slave_auto_cache_flush = !strcasecmp(buffer, "true");
+}
+
+static void frame_skip_handler(char *buffer)
+{
+ if (sscanf(buffer, "%d", &s_conf.frame_skip) != 1) {
+ ErrPrint("Unable to get frame skip: %d\n", s_conf.frame_skip);
+ }
+}
+
+static void slave_limit_to_ttl_handler(char *buffer)
+{
+ s_conf.slave_limit_to_ttl = !strcasecmp(buffer, "true");
+}
+
+static void event_filter_handler(char *buffer)
+{
+ if (sscanf(buffer, "%lf", &s_conf.event_filter) != 1) {
+ ErrPrint("Unable to get event filter: %lf\n", s_conf.event_filter);
+ }
+}
+
+static void slave_event_boost_on_handler(char *buffer)
+{
+ if (sscanf(buffer, "%d", &s_conf.slave_event_boost_on) != 1) {
+ ErrPrint("Unable to get boost on: %d\n", s_conf.slave_event_boost_on);
+ }
+}
+
+static void slave_event_boost_off_handler(char *buffer)
+{
+ if (sscanf(buffer, "%d", &s_conf.slave_event_boost_off) != 1) {
+ ErrPrint("Unable to get boost on: %d\n", s_conf.slave_event_boost_off);
+ }
+}
+
+static void extra_buffer_count_handler(char *buffer)
+{
+ if (sscanf(buffer, "%d", &s_conf.extra_buffer_count) != 1) {
+ ErrPrint("Extra buffer count is not valid: [%s], remained %d\n", buffer, s_conf.extra_buffer_count);
+ }
+}
+
+static void use_xmonitor(char *buffer)
+{
+ s_conf.use_xmonitor = !strcasecmp(buffer, "true");
+}
+
+static void emergency_disk_handler(char *buffer)
+{
+ s_conf.emergency_disk = strdup(buffer);
+ if (!s_conf.emergency_disk) {
+ ErrPrint("Heap: %s\n", strerror(errno));
+ }
+}
+
+static void check_lcd_handler(char *buffer)
+{
+ s_conf.check_lcd = !strcasecmp(buffer, "true");
+}
+
+static void use_gettimeofday_handler(char *buffer)
+{
+ s_conf.use_gettimeofday = !strcasecmp(buffer, "true");
+}
+
+static void use_event_time_handler(char *buffer)
+{
+ s_conf.use_event_time = !strcasecmp(buffer, "true");
+}
+
+static void auto_align_handler(char *buffer)
+{
+ s_conf.auto_align = !strcasecmp(buffer, "true");
+}
+
+static void services_handler(char *buffer)
+{
+ s_conf.services = strdup(buffer);
+ if (!s_conf.services) {
+ ErrPrint("Heap: %s\n", strerror(errno));
+ }
+}
+
+static void use_sw_backend_handler(char *buffer)
+{
+ s_conf.use_sw_backend = !strcasecmp(buffer, "true");
+}
+
+static void provider_method_handler(char *buffer)
+{
+ s_conf.provider_method = strdup(buffer);
+ if (!s_conf.provider_method) {
+ ErrPrint("Heap: %s\n", strerror(errno));
+ }
+}
+
+static void debug_mode_handler(char *buffer)
+{
+ s_conf.debug_mode = !strcasecmp(buffer, "true");
+}
+
+static void overwrite_content_handler(char *buffer)
+{
+ s_conf.overwrite_content = !strcasecmp(buffer, "true");
+}
+
+static void com_core_thread_handler(char *buffer)
+{
+ s_conf.com_core_thread = !strcasecmp(buffer, "true");
+}
+
+static void base_width_handler(char *buffer)
+{
+ if (sscanf(buffer, "%d", &s_conf.base_width) != 1) {
+ if (!strncasecmp(buffer, "screen", strlen("screen"))) {
+ s_conf.base_width = s_conf.width;
+ DbgPrint("Base width: %u (screen)\n", s_conf.base_width);
+ } else {
+ ErrPrint("Failed to parse the base_width\n");
+ }
+ }
+}
+
+static void base_height_handler(char *buffer)
+{
+ if (sscanf(buffer, "%d", &s_conf.base_height) != 1) {
+ if (!strncasecmp(buffer, "screen", strlen("screen"))) {
+ s_conf.base_height = s_conf.height;
+ DbgPrint("Base height: %u (screen)\n", s_conf.base_height);
+ } else {
+ ErrPrint("Failed to parse the base_height\n");
+ }
+ }
+}
+
+static void minimum_period_handler(char *buffer)
+{
+ if (sscanf(buffer, "%lf", &s_conf.minimum_period) != 1) {
+ ErrPrint("Failed to parse the minimum_period\n");
+ }
+ DbgPrint("Minimum period: %lf\n", s_conf.minimum_period);
+}
+
+static void pixels_handler(char *buffer)
+{
+ if (sscanf(buffer, "%d", &s_conf.default_conf.pixels) != 1) {
+ ErrPrint("Failed to parse the minimum_period\n");
+ }
+ DbgPrint("Default pixels: %lf\n", s_conf.default_conf.pixels);
+}
+
+static void script_handler(char *buffer)
+{
+ s_conf.default_conf.script = strdup(buffer);
+ if (!s_conf.default_conf.script) {
+ ErrPrint("Heap: %s\n", strerror(errno));
+ }
+}
+
+static void default_abi_handler(char *buffer)
+{
+ s_conf.default_conf.abi = strdup(buffer);
+ if (!s_conf.default_conf.abi) {
+ ErrPrint("Heap: %s\n", strerror(errno));
+ }
+}
+
+static void default_group_handler(char *buffer)
+{
+ s_conf.default_conf.gbar_group = strdup(buffer);
+ if (!s_conf.default_conf.gbar_group) {
+ ErrPrint("Heap: %s\n", strerror(errno));
+ }
+}
+
+static void default_period_handler(char *buffer)
+{
+ if (sscanf(buffer, "%lf", &s_conf.default_conf.period) != 1) {
+ ErrPrint("Failed to parse the default_period\n");
+ }
+ DbgPrint("Default Period: %lf\n", s_conf.default_conf.period);
+}
+
+static void default_packet_time_handler(char *buffer)
+{
+ if (sscanf(buffer, "%lf", &s_conf.default_packet_time) != 1) {
+ ErrPrint("Failed to parse the default_packet_time\n");
+ }
+ DbgPrint("Default packet time: %lf\n", s_conf.default_packet_time);
+}
+
+static void default_content_handler(char *buffer)
+{
+ s_conf.default_content = strdup(buffer);
+ if (!s_conf.default_content) {
+ ErrPrint("Heap: %s\n", strerror(errno));
+ }
+}
+
+static void default_title_handler(char *buffer)
+{
+ s_conf.default_title = strdup(buffer);
+ if (!s_conf.default_title) {
+ ErrPrint("Heap: %s\n", strerror(errno));
+ }
+}
+
+static void minimum_space_handler(char *buffer)
+{
+ if (sscanf(buffer, "%lu", &s_conf.minimum_space) != 1) {
+ ErrPrint("Failed to parse the minimum_space\n");
+ }
+}
+
+static void replace_tag_handler(char *buffer)
+{
+ s_conf.replace_tag = strdup(buffer);
+ if (!s_conf.replace_tag) {
+ ErrPrint("Heap: %s\n", strerror(errno));
+ }
+}
+
+static void slave_ttl_handler(char *buffer)
+{
+ if (sscanf(buffer, "%lf", &s_conf.slave_ttl) != 1) {
+ ErrPrint("Failed to parse the slave_ttl\n");
+ }
+ DbgPrint("Slave TTL: %lf\n", s_conf.slave_ttl);
+}
+
+static void slave_activate_time_handler(char *buffer)
+{
+ if (sscanf(buffer, "%lf", &s_conf.slave_activate_time) != 1) {
+ ErrPrint("Failed to parse the slave_activate_time\n");
+ }
+ DbgPrint("Slave activate time: %lf\n", s_conf.slave_activate_time);
+}
+
+static void slave_relaunch_time_handler(char *buffer)
+{
+ if (sscanf(buffer, "%lf", &s_conf.slave_relaunch_time) != 1) {
+ ErrPrint("Failed to parse the slave_activate_time\n");
+ }
+ DbgPrint("Slave relaunch time: %lf\n", s_conf.slave_relaunch_time);
+}
+
+static void slave_relaunch_count_handler(char *buffer)
+{
+ if (sscanf(buffer, "%d", &s_conf.slave_relaunch_count) != 1) {
+ ErrPrint("Failed to parse the max_log_line\n");
+ }
+}
+
+static void max_log_line_handler(char *buffer)
+{
+ if (sscanf(buffer, "%d", &s_conf.max_log_line) != 1) {
+ ErrPrint("Failed to parse the max_log_line\n");
+ }
+}
+
+static void max_log_file_handler(char *buffer)
+{
+ if (sscanf(buffer, "%d", &s_conf.max_log_file) != 1) {
+ ErrPrint("Failed to parse the max_log_file\n");
+ }
+}
+
+static void sqlite_flush_max_handler(char *buffer)
+{
+ if (sscanf(buffer, "%lu", &s_conf.sqlite_flush_max) != 1) {
+ ErrPrint("Failed to parse the sqlite_flush_max\n");
+ }
+}
+
+static void db_path_handler(char *buffer)
+{
+ s_conf.path.db = strdup(buffer);
+ if (!s_conf.path.db) {
+ ErrPrint("Heap: %s\n", strerror(errno));
+ }
+}
+
+static void reader_path_handler(char *buffer)
+{
+ s_conf.path.reader = strdup(buffer);
+ if (!s_conf.path.reader) {
+ ErrPrint("Heap: %s\n", strerror(errno));
+ }
+}
+
+static void always_path_handler(char *buffer)
+{
+ s_conf.path.always = strdup(buffer);
+ if (!s_conf.path.always) {
+ ErrPrint("Heap: %s\n", strerror(errno));
+ }
+}
+
+static void log_path_handler(char *buffer)
+{
+ s_conf.path.slave_log = strdup(buffer);
+ if (!s_conf.path.slave_log) {
+ ErrPrint("Heap: %s\n", strerror(errno));
+ }
+}
+
+static void script_port_path_handler(char *buffer)
+{
+ s_conf.path.script_port = strdup(buffer);
+ if (!s_conf.path.script_port) {
+ ErrPrint("Heap: %s\n", strerror(errno));
+ }
+}
+
+static void share_path_handler(char *buffer)
+{
+ s_conf.path.image = strdup(buffer);
+ if (!s_conf.path.image) {
+ ErrPrint("Heap: %s\n", strerror(errno));
+ }
+}
+
+static char *parse_handler(const char *buffer)
+{
+ const char *node_prefix = NODE_PREFIX;
+ int idx = 0;
+ const char *ptr;
+ int node_idx = 0;
+ char *node = NULL;
+
+ ptr = buffer;
+ while (*ptr) {
+ if (ptr[idx] == node_prefix[idx]) {
+ idx++;
+ } else if (idx > 0 && node_prefix[idx] == '\0') {
+ if (sscanf(ptr + idx, "%d", &node_idx) == 1) {
+ int node_len;
+ node_len = idx + strlen(DEV_PATH) + 10;
+ /* Gotcha */
+ node = malloc(node_len);
+ if (node) {
+ int len;
+
+ len = snprintf(node, node_len - 1, DEV_PATH "%s%d", node_prefix, node_idx);
+ if (len < 0) {
+ ErrPrint("snprintf: %s\n", strerror(errno));
+ free(node);
+ node = NULL;
+ } else {
+ node[len] = '\0';
+ DbgPrint("NODE FOUND: %s\n", node);
+ }
+ } else {
+ ErrPrint("malloc: %s\n", strerror(errno));
+ }
+
+ break;
+ } else {
+ DbgPrint("Invalid format: [%s] / [%s]\n", ptr, ptr + idx);
+ ptr++;
+ idx = 0;
+ }
+ } else {
+ ptr++;
+ idx = 0;
+ }
+ }
+
+ return node;
+}
+
+static char *find_input_device(const char *name)
+{
+ int fd;
+ char *node = NULL;
+ char ch;
+ int row;
+ int col;
+ int idx;
+ enum state {
+ STATE_BEGIN,
+ STATE_ID,
+ STATE_NAME,
+ STATE_PHYSICAL,
+ STATE_SYSFS,
+ STATE_UNIQ,
+ STATE_HANDLER,
+ STATE_BITMAPS,
+ STATE_ERROR,
+ } state;
+ char name_buffer[MAX_LINE_BUFFER] = { 0, };
+ char handler_buffer[MAX_LINE_BUFFER] = { 0, };
+
+ fd = open(PROC_INPUT_DEVICES, O_RDONLY);
+ if (fd < 0) {
+ ErrPrint("open: %s\n", strerror(errno));
+ return NULL;
+ }
+
+ state = STATE_BEGIN;
+ row = 1;
+ col = 1;
+ idx = -1;
+ while (state != STATE_ERROR && node == NULL && read(fd, &ch, sizeof(ch)) == sizeof(ch)) {
+ if (ch == LF) {
+ row++;
+ col = 1;
+
+ switch (state) {
+ case STATE_NAME:
+ state = STATE_BEGIN;
+ if (idx > 0) {
+ /* Remove last double-quotes */
+ if (name_buffer[idx - 1] == '"') {
+ idx--;
+ }
+ name_buffer[idx] = '\0';
+ idx = -1;
+ DbgPrint("Name: [%s]\n", name_buffer);
+ }
+ break;
+ case STATE_HANDLER:
+ state = STATE_BEGIN;
+ if (idx > 0) {
+ handler_buffer[idx] = '\0';
+ idx = -1;
+ DbgPrint("Handler: [%s]\n", handler_buffer);
+ }
+ break;
+ case STATE_BEGIN:
+ DbgPrint("name: [%s], name_buffer[%s]\n", name, name_buffer);
+ if (!strcasecmp(name, name_buffer)) {
+ node = parse_handler(handler_buffer);
+ }
+ break;
+ default:
+ /* Ignore other attributes */
+ state = STATE_BEGIN;
+ idx = -1;
+ break;
+ }
+
+ continue;
+ }
+
+ col++;
+ switch (state) {
+ case STATE_BEGIN:
+ switch (ch) {
+ case 'I':
+ state = STATE_ID;
+ break;
+ case 'N':
+ state = STATE_NAME;
+ break;
+ case 'P':
+ state = STATE_PHYSICAL;
+ break;
+ case 'S':
+ state = STATE_SYSFS;
+ break;
+ case 'U':
+ state = STATE_UNIQ;
+ break;
+ case 'H':
+ state = STATE_HANDLER;
+ break;
+ case 'B':
+ state = STATE_BITMAPS;
+ break;
+ default:
+ state = STATE_ERROR;
+ break;
+ }
+ break;
+ case STATE_NAME:
+ if (ch == '=') {
+ idx = 0;
+ } else if (idx == MAX_LINE_BUFFER - 1) {
+ ErrPrint("Out of buffer\n");
+ } else if (idx == 0 && ch == '"') {
+ /* Ignore the first quotes */
+ } else if (idx >= 0) {
+ name_buffer[idx++] = ch;
+ }
+ break;
+ case STATE_HANDLER:
+ if (ch == '=') {
+ idx = 0;
+ } else if (idx == MAX_LINE_BUFFER - 1) {
+ ErrPrint("Out of buffer\n");
+ } else if (idx >= 0) {
+ handler_buffer[idx++] = ch;
+ }
+ break;
+ case STATE_ID:
+ case STATE_PHYSICAL:
+ case STATE_SYSFS:
+ case STATE_UNIQ:
+ case STATE_BITMAPS:
+ /* Ignore other attributes */
+ break;
+ default:
+ break;
+ }
+ }
+
+ if (state == STATE_ERROR) {
+ ErrPrint("Invalid state: ROW[%d] COL[%d]\n", row, col);
+ }
+
+ if (close(fd) < 0) {
+ ErrPrint("close: %s\n", strerror(errno));
+ }
+
+ return node;
+}
+
+static void input_path_handler(char *buffer)
+{
+ if (buffer[0] == '/') {
+ DbgPrint("Specifying the input device\n");
+ s_conf.path.input = strdup(buffer);
+ if (!s_conf.path.input) {
+ ErrPrint("Heap: %s\n", strerror(errno));
+ }
+ } else {
+ DbgPrint("Find the input device\n");
+ s_conf.path.input = find_input_device(buffer);
+ if (s_conf.path.input == NULL) {
+ ErrPrint("Fallback to raw string\n");
+ s_conf.path.input = strdup(buffer);
+ if (!s_conf.path.input) {
+ ErrPrint("Heap: %s\n", strerror(errno));
+ }
+ }
+ }
+}
+
+static void ping_time_handler(char *buffer)
+{
+ if (sscanf(buffer, "%lf", &s_conf.ping_time) != 1) {
+ ErrPrint("Failed to parse the ping_time\n");
+ }
+ DbgPrint("Default ping time: %lf\n", s_conf.ping_time);
+}
+
+static void slave_max_loader(char *buffer)
+{
+ if (sscanf(buffer, "%d", &s_conf.slave_max_load) != 1) {
+ ErrPrint("Failed to parse the slave_max_load\n");
+ }
+}
+
+static void premultiplied_handler(char *buffer)
+{
+ if (sscanf(buffer, "%d", &s_conf.premultiplied) != 1) {
+ ErrPrint("Failed to parse the premultiplied color\n");
+ }
+
+ DbgPrint("Premultiplied: %d\n", s_conf.premultiplied);
+}
+
+static void gbar_request_timeout_handler(char *buffer)
+{
+ if (sscanf(buffer, "%lf", &s_conf.gbar_request_timeout) != 1) {
+ ErrPrint("Failed to parse the request_timeout\n");
+ }
+ DbgPrint("Default GBAR request timeout: %lf\n", s_conf.gbar_request_timeout);
+}
+
+EAPI void dynamicbox_conf_init(void)
+{
+ if (s_info.conf_loaded) {
+ DbgPrint("Already initialized.\n");
+ return;
+ }
+
+ s_conf.width = CONF_DEFAULT_WIDTH;
+ s_conf.height = CONF_DEFAULT_HEIGHT;
+ s_conf.base_width = CONF_DEFAULT_BASE_WIDTH;
+ s_conf.base_height = CONF_DEFAULT_BASE_HEIGHT;
+ s_conf.minimum_period = CONF_DEFAULT_MINIMUM_PERIOD;
+ s_conf.default_conf.period = CONF_DEFAULT_PERIOD;
+ s_conf.default_conf.pixels = CONF_DEFAULT_PIXELS;
+ s_conf.minimum_space = CONF_DEFAULT_MINIMUM_SPACE;
+ s_conf.default_packet_time = CONF_DEFAULT_PACKET_TIME;
+ s_conf.slave_ttl = CONF_DEFAULT_SLAVE_TTL;
+ s_conf.slave_activate_time = CONF_DEFAULT_SLAVE_ACTIVATE_TIME;
+ s_conf.slave_relaunch_time = CONF_DEFAULT_SLAVE_RELAUNCH_TIME;
+ s_conf.slave_relaunch_count = CONF_DEFAULT_SLAVE_RELAUNCH_COUNT;
+ s_conf.max_log_line = CONF_DEFAULT_MAX_LOG_LINE;
+ s_conf.max_log_file = CONF_DEFAULT_MAX_LOG_FILE;
+ s_conf.sqlite_flush_max = CONF_DEFAULT_SQLITE_FLUSH_MAX;
+ s_conf.ping_time = CONF_DEFAULT_PING_TIME;
+ s_conf.slave_max_load = CONF_DEFAULT_SLAVE_MAX_LOAD;
+ s_conf.use_sw_backend = CONF_DEFAULT_USE_SW_BACKEND;
+ s_conf.debug_mode = CONF_DEFAULT_DEBUG_MODE;
+ s_conf.overwrite_content = CONF_DEFAULT_OVERWRITE_CONTENT;
+ s_conf.com_core_thread = CONF_DEFAULT_COM_CORE_THREAD;
+ s_conf.use_xmonitor = CONF_DEFAULT_USE_XMONITOR;
+ s_conf.scale_width_factor = CONF_DEFAULT_SCALE_WIDTH_FACTOR;
+ s_conf.scale_height_factor = CONF_DEFAULT_SCALE_HEIGHT_FACTOR;
+ s_conf.gbar_request_timeout = CONF_DEFAULT_GBAR_REQUEST_TIMEOUT;
+ s_conf.premultiplied = CONF_DEFAULT_PREMULTIPLIED;
+ s_conf.default_conf.script = (char *)CONF_DEFAULT_SCRIPT_TYPE;
+ s_conf.default_conf.abi = (char *)CONF_DEFAULT_ABI;
+ s_conf.default_conf.gbar_group = (char *)CONF_DEFAULT_GBAR_GROUP;
+ s_conf.launch_key.name = (char *)CONF_DEFAULT_LAUNCH_BUNDLE_NAME;
+ s_conf.launch_key.secured = (char *)CONF_DEFAULT_LAUNCH_BUNDLE_SECURED;
+ s_conf.launch_key.abi = (char *)CONF_DEFAULT_LAUNCH_BUNDLE_ABI;
+ s_conf.launch_key.hw_acceleration = (char *)CONF_DEFAULT_LAUNCH_BUNDLE_HW_ACCELERATION;
+ s_conf.empty_content = (char *)CONF_DEFAULT_EMPTY_CONTENT;
+ s_conf.empty_title = (char *)CONF_DEFAULT_EMPTY_TITLE;
+ s_conf.default_content = (char *)CONF_DEFAULT_CONTENT;
+ s_conf.default_title = (char *)CONF_DEFAULT_TITLE;
+ s_conf.replace_tag = (char *)CONF_DEFAULT_REPLACE_TAG;
+ s_conf.path.conf = (char *)CONF_DEFAULT_PATH_CONF;
+ s_conf.path.image = (char *)CONF_DEFAULT_PATH_IMAGE;
+ s_conf.path.slave_log = (char *)CONF_DEFAULT_PATH_LOG;
+ s_conf.path.reader = (char *)CONF_DEFAULT_PATH_READER;
+ s_conf.path.always = (char *)CONF_DEFAULT_PATH_ALWAYS;
+ s_conf.path.script = (char *)CONF_DEFAULT_PATH_SCRIPT;
+ s_conf.path.root = (char *)CONF_DEFAULT_PATH_ROOT;
+ s_conf.path.script_port = (char *)CONF_DEFAULT_PATH_SCRIPT_PORT;
+ s_conf.path.db = (char *)CONF_DEFAULT_PATH_DB;
+ s_conf.path.input = (char *)CONF_DEFAULT_PATH_INPUT;
+ s_conf.provider_method = (char *)CONF_DEFAULT_PROVIDER_METHOD;
+ s_conf.emergency_disk = (char *)CONF_DEFAULT_EMERGENCY_DISK;
+ s_conf.services = (char *)CONF_DEFAULT_SERVICES;
+ s_conf.auto_align = CONF_DEFAULT_AUTO_ALIGN;
+ s_conf.use_event_time = CONF_DEFAULT_USE_EVENT_TIME;
+ s_conf.check_lcd = CONF_DEFAULT_CHECK_LCD;
+ s_conf.extra_buffer_count = CONF_DEFAULT_EXTRA_BUFFER_COUNT;
+ s_conf.use_gettimeofday = CONF_DEFAULT_USE_GETTIMEOFDAY;
+ s_conf.slave_event_boost_on = CONF_DEFAULT_SLAVE_EVENT_BOOST_ON;
+ s_conf.slave_event_boost_off = CONF_DEFAULT_SLAVE_EVENT_BOOST_OFF;
+ s_conf.event_filter = CONF_DEFAULT_EVENT_FILTER;
+ s_conf.slave_limit_to_ttl = CONF_DEFAULT_SLAVE_LIMIT_TO_TTL;
+ s_conf.slave_auto_cache_flush = CONF_DEFAULT_SLAVE_AUTO_CACHE_FLUSH;
+}
+
+/*
+ * Find proper configuration and install(link) it to conf path.
+ */
+static char *conf_path(void)
+{
+ char *path;
+ int length;
+
+ length = strlen(CONF_PATH_FORMAT) + 12; // 12 == RESERVED SPACE
+ path = calloc(1, length);
+ if (!path) {
+ ErrPrint("calloc: %s\n", strerror(errno));
+ return NULL;
+ }
+
+ snprintf(path, length, CONF_PATH_FORMAT, s_conf.width, s_conf.height);
+ DbgPrint("Selected conf file: %s\n", path);
+ if (access(path, F_OK) != 0) {
+ ErrPrint("Fallback to default, access: %s\n", strerror(errno));
+ strncpy(path, DEFAULT_MASTER_CONF, length);
+ if (access(path, F_OK) != 0) {
+ ErrPrint("Serious error - there is no conf file, use default setting: %s\n", strerror(errno));
+ free(path);
+ path = NULL;
+ }
+ }
+
+ return path;
+}
+
+EAPI int dynamicbox_conf_load(void)
+{
+ char *conf_file;
+ FILE *fp;
+ int c;
+ enum state {
+ START,
+ SPACE,
+ TOKEN,
+ VALUE,
+ ERROR,
+ COMMENT,
+ END
+ } state;
+ int ch_idx;
+ int token_idx;
+ int buffer_idx;
+ int quote;
+ int linelen;
+ char buffer[256];
+ static const struct token_parser {
+ const char *name;
+ void (*handler)(char *buffer);
+ } token_handler[] = {
+ {
+ .name = "base_width",
+ .handler = base_width_handler,
+ },
+ {
+ .name = "base_height",
+ .handler = base_height_handler,
+ },
+ {
+ .name = "minimum_period",
+ .handler = minimum_period_handler,
+ },
+ {
+ .name = "script",
+ .handler = script_handler,
+ },
+ {
+ .name = "pixels",
+ .handler = pixels_handler,
+ },
+ {
+ .name = "default_abi",
+ .handler = default_abi_handler,
+ },
+ {
+ .name = "default_group",
+ .handler = default_group_handler,
+ },
+ {
+ .name = "default_period",
+ .handler = default_period_handler,
+ },
+ {
+ .name = "default_packet_time",
+ .handler = default_packet_time_handler,
+ },
+ {
+ .name = "default_content",
+ .handler = default_content_handler,
+ },
+ {
+ .name = "default_title",
+ .handler = default_title_handler,
+ },
+ {
+ .name = "minimum_space",
+ .handler = minimum_space_handler,
+ },
+ {
+ .name = "replace_tag",
+ .handler = replace_tag_handler,
+ },
+ {
+ .name = "slave_ttl",
+ .handler = slave_ttl_handler,
+ },
+ {
+ .name = "slave_activate_time",
+ .handler = slave_activate_time_handler,
+ },
+ {
+ .name = "slave_relaunch_time",
+ .handler = slave_relaunch_time_handler,
+ },
+ {
+ .name = "slave_relaunch_count",
+ .handler = slave_relaunch_count_handler,
+ },
+ {
+ .name = "max_log_line",
+ .handler = max_log_line_handler,
+ },
+ {
+ .name = "max_log_file",
+ .handler = max_log_file_handler,
+ },
+ {
+ .name = "sqilte_flush_max",
+ .handler = sqlite_flush_max_handler,
+ },
+ {
+ .name = "db_path",
+ .handler = db_path_handler,
+ },
+ {
+ .name = "log_path",
+ .handler = log_path_handler,
+ },
+ {
+ .name = "reader_path",
+ .handler = reader_path_handler,
+ },
+ {
+ .name = "always_path",
+ .handler = always_path_handler,
+ },
+ {
+ .name = "share_path",
+ .handler = share_path_handler,
+ },
+ {
+ .name = "script_port_path",
+ .handler = script_port_path_handler,
+ },
+ {
+ .name = "ping_interval",
+ .handler = ping_time_handler,
+ },
+ {
+ .name = "slave_max_load",
+ .handler = slave_max_loader,
+ },
+ {
+ .name = "use_sw_backend",
+ .handler = use_sw_backend_handler,
+ },
+ {
+ .name = "emergency_disk",
+ .handler = emergency_disk_handler,
+ },
+ {
+ .name = "services",
+ .handler = services_handler,
+ },
+ {
+ .name = "auto_align",
+ .handler = auto_align_handler,
+ },
+ {
+ .name = "use_event_time",
+ .handler = use_event_time_handler,
+ },
+ {
+ .name = "use_gettimeofday",
+ .handler = use_gettimeofday_handler,
+ },
+ {
+ .name = "check_lcd",
+ .handler = check_lcd_handler,
+ },
+ {
+ .name = "use_xmonitor",
+ .handler = use_xmonitor,
+ },
+ {
+ .name = "provider_method",
+ .handler = provider_method_handler,
+ },
+ {
+ .name = "debug_mode",
+ .handler = debug_mode_handler,
+ },
+ {
+ .name = "overwrite_content",
+ .handler = overwrite_content_handler,
+ },
+ {
+ .name = "com_core_thread",
+ .handler = com_core_thread_handler,
+ },
+ {
+ .name = "input",
+ .handler = input_path_handler,
+ },
+ {
+ .name = "gbar_request_timeout",
+ .handler = gbar_request_timeout_handler,
+ },
+ {
+ .name = "premultiplied",
+ .handler = premultiplied_handler,
+ },
+ {
+ .name = "extra_buffer_count",
+ .handler = extra_buffer_count_handler,
+ },
+ {
+ .name = "slave_event_boost_on",
+ .handler = slave_event_boost_on_handler,
+ },
+ {
+ .name = "slave_event_boost_off",
+ .handler = slave_event_boost_off_handler,
+ },
+ {
+ .name = "event_filter",
+ .handler = event_filter_handler,
+ },
+ {
+ .name = "slave_limit_to_ttl",
+ .handler = slave_limit_to_ttl_handler,
+ },
+ {
+ .name = "frame_skip",
+ .handler = frame_skip_handler,
+ },
+ {
+ .name = "slave_auto_cache_flush",
+ .handler = slave_auto_cache_flush_handler,
+ },
+ {
+ .name = NULL,
+ .handler = NULL,
+ },
+ };
+
+ if (s_info.conf_loaded) {
+ ErrPrint("Already loaded\n");
+ return DBOX_STATUS_ERROR_ALREADY;
+ }
+
+ util_screen_size_get(&s_conf.width, &s_conf.height);
+
+ conf_file = conf_path();
+ if (!conf_file) {
+ return DBOX_STATUS_ERROR_IO_ERROR;
+ }
+
+ fp = fopen(conf_file, "rt");
+ free(conf_file);
+ if (!fp) {
+ ErrPrint("Error: %s\n", strerror(errno));
+ return DBOX_STATUS_ERROR_IO_ERROR;
+ }
+
+ state = START;
+ ch_idx = 0;
+ token_idx = -1;
+ buffer_idx = 0;
+ quote = 0;
+ linelen = 0;
+ do {
+ c = getc(fp);
+ if ((c == EOF) && (state == VALUE)) {
+ DbgPrint("[%s:%d] VALUE state EOF\n", __func__, __LINE__);
+ state = END;
+ }
+
+ switch (state) {
+ case COMMENT:
+ if (c == CR || c == LF || c == EOF) {
+ buffer[buffer_idx] = '\0';
+
+ state = START;
+ token_idx = -1;
+ ch_idx = 0;
+ buffer_idx = 0;
+ linelen = -1; /* Will be ZERO by follwing increment code */
+ quote = 0;
+ } else {
+ buffer[buffer_idx++] = c;
+ if (buffer_idx == (sizeof(buffer) - 1)) {
+ buffer[buffer_idx] = '\0';
+ buffer_idx = 0;
+ }
+ }
+ break;
+ case START:
+ if (linelen == 0 && c == '#') {
+ state = COMMENT;
+ } else if (isspace(c)) {
+ /* Ignore empty space */
+ } else {
+ state = TOKEN;
+ ungetc(c, fp);
+ }
+ break;
+ case SPACE:
+ if (c == '=') {
+ state = VALUE;
+ } else if (!isspace(c)) {
+ state = ERROR;
+ }
+ break;
+ case VALUE:
+ if (c == '"') {
+ if (quote == 1) {
+ buffer[buffer_idx] = '\0';
+ state = END;
+ } else if (buffer_idx != 0) {
+ buffer[buffer_idx++] = c;
+ if (buffer_idx >= sizeof(buffer)) {
+ state = ERROR;
+ }
+ } else {
+ quote = 1;
+ }
+ } else if (isspace(c)) {
+ if (buffer_idx == 0) {
+ /* Ignore */
+ } else if (quote == 1) {
+ buffer[buffer_idx++] = c;
+ if (buffer_idx >= sizeof(buffer)) {
+ state = ERROR;
+ }
+ } else {
+ buffer[buffer_idx] = '\0';
+ ungetc(c, fp);
+ state = END;
+ }
+ } else {
+ buffer[buffer_idx++] = c;
+ if (buffer_idx >= sizeof(buffer)) {
+ state = ERROR;
+ }
+ }
+ break;
+ case TOKEN:
+ if (c == '=') {
+ if (token_idx < 0) {
+ state = ERROR;
+ } else {
+ state = VALUE;
+ }
+ } else if (isspace(c)) {
+ if (token_idx < 0) {
+ break;
+ }
+
+ if (token_handler[token_idx].name[ch_idx] != '\0') {
+ state = ERROR;
+ } else {
+ state = SPACE;
+ }
+ } else {
+ if (token_idx < 0) {
+ /* Now start to find a token! */
+ token_idx = 0;
+ }
+
+ if (token_handler[token_idx].name[ch_idx] == c) {
+ ch_idx++;
+ } else {
+ ungetc(c, fp);
+ while (ch_idx-- > 0)
+ ungetc(token_handler[token_idx].name[ch_idx], fp);
+
+ token_idx++;
+
+ if (token_handler[token_idx].name == NULL) {
+ state = ERROR;
+ } else {
+ ch_idx = 0;
+ }
+ }
+ }
+ break;
+ case ERROR:
+ if (c == CR || c == LF || c == EOF) {
+ state = START;
+ token_idx = -1;
+ buffer_idx = 0;
+ ch_idx = 0;
+ linelen = -1;
+ quote = 0;
+ }
+ break;
+ case END:
+ if (c == LF || c == CR || c == EOF) {
+ state = START;
+
+ if (token_idx >= 0 && token_handler[token_idx].handler) {
+ buffer[buffer_idx] = '\0';
+ token_handler[token_idx].handler(buffer);
+ }
+
+ token_idx = -1;
+ ch_idx = 0;
+ buffer_idx = 0;
+ linelen = -1;
+ quote = 0;
+ /* Finish */
+ } else if (isspace(c)) {
+ /* ignore */
+ } else {
+ state = ERROR;
+ }
+ break;
+ default:
+ /* ?? */
+ break;
+ }
+
+ linelen++;
+ } while (c != EOF);
+
+ if (fclose(fp) != 0) {
+ ErrPrint("fclose: %s\n", strerror(errno));
+ }
+
+ s_conf.scale_width_factor = (double)s_conf.width / (double)DYNAMICBOX_CONF_BASE_W;
+ s_conf.scale_height_factor = (double)s_conf.height / (double)DYNAMICBOX_CONF_BASE_H;
+ s_info.conf_loaded = 1;
+
+ return DBOX_STATUS_ERROR_NONE;
+}
+
+EAPI void dynamicbox_conf_reset(void)
+{
+ s_conf.width = CONF_DEFAULT_WIDTH;
+ s_conf.height = CONF_DEFAULT_HEIGHT;
+ s_conf.base_width = CONF_DEFAULT_BASE_WIDTH;
+ s_conf.base_height = CONF_DEFAULT_BASE_HEIGHT;
+ s_conf.minimum_period = CONF_DEFAULT_MINIMUM_PERIOD;
+ s_conf.default_conf.period = CONF_DEFAULT_PERIOD;
+ s_conf.minimum_space = CONF_DEFAULT_MINIMUM_SPACE;
+ s_conf.default_packet_time = CONF_DEFAULT_PACKET_TIME;
+ s_conf.slave_ttl = CONF_DEFAULT_SLAVE_TTL;
+ s_conf.slave_activate_time = CONF_DEFAULT_SLAVE_ACTIVATE_TIME;
+ s_conf.slave_relaunch_time = CONF_DEFAULT_SLAVE_RELAUNCH_TIME;
+ s_conf.slave_relaunch_count = CONF_DEFAULT_SLAVE_RELAUNCH_COUNT;
+ s_conf.max_log_line = CONF_DEFAULT_MAX_LOG_LINE;
+ s_conf.max_log_file = CONF_DEFAULT_MAX_LOG_FILE;
+ s_conf.sqlite_flush_max = CONF_DEFAULT_SQLITE_FLUSH_MAX;
+ s_conf.ping_time = CONF_DEFAULT_PING_TIME;
+ s_conf.slave_max_load = CONF_DEFAULT_SLAVE_MAX_LOAD;
+ s_conf.use_sw_backend = CONF_DEFAULT_USE_SW_BACKEND;
+ s_conf.debug_mode = CONF_DEFAULT_DEBUG_MODE;
+ s_conf.overwrite_content = CONF_DEFAULT_OVERWRITE_CONTENT;
+ s_conf.com_core_thread = CONF_DEFAULT_COM_CORE_THREAD;
+ s_conf.use_xmonitor = CONF_DEFAULT_USE_XMONITOR;
+ s_conf.scale_width_factor = CONF_DEFAULT_SCALE_WIDTH_FACTOR;
+ s_conf.scale_height_factor = CONF_DEFAULT_SCALE_HEIGHT_FACTOR;
+ s_conf.gbar_request_timeout = CONF_DEFAULT_GBAR_REQUEST_TIMEOUT;
+ s_conf.premultiplied = CONF_DEFAULT_PREMULTIPLIED;
+ s_conf.default_conf.pixels = CONF_DEFAULT_PIXELS;
+ s_conf.auto_align = CONF_DEFAULT_AUTO_ALIGN;
+ s_conf.use_event_time = CONF_DEFAULT_USE_EVENT_TIME;
+ s_conf.check_lcd = CONF_DEFAULT_CHECK_LCD;
+ s_conf.extra_buffer_count = CONF_DEFAULT_EXTRA_BUFFER_COUNT;
+ s_conf.use_gettimeofday = CONF_DEFAULT_USE_GETTIMEOFDAY;
+ s_conf.slave_event_boost_on = CONF_DEFAULT_SLAVE_EVENT_BOOST_ON;
+ s_conf.slave_event_boost_off = CONF_DEFAULT_SLAVE_EVENT_BOOST_OFF;
+ s_conf.event_filter = CONF_DEFAULT_EVENT_FILTER;
+ s_conf.slave_limit_to_ttl = CONF_DEFAULT_SLAVE_LIMIT_TO_TTL;
+ s_conf.slave_auto_cache_flush = CONF_DEFAULT_SLAVE_AUTO_CACHE_FLUSH;
+
+ if (s_conf.default_conf.script != CONF_DEFAULT_SCRIPT_TYPE) {
+ free(s_conf.default_conf.script);
+ s_conf.default_conf.script = (char *)CONF_DEFAULT_SCRIPT_TYPE;
+ }
+
+ if (s_conf.default_conf.abi != CONF_DEFAULT_ABI) {
+ free(s_conf.default_conf.abi);
+ s_conf.default_conf.abi = (char *)CONF_DEFAULT_ABI;
+ }
+
+ if (s_conf.default_conf.gbar_group != CONF_DEFAULT_GBAR_GROUP) {
+ free(s_conf.default_conf.gbar_group);
+ s_conf.default_conf.gbar_group = (char *)CONF_DEFAULT_GBAR_GROUP;
+ }
+
+ if (s_conf.launch_key.name != CONF_DEFAULT_LAUNCH_BUNDLE_NAME) {
+ free(s_conf.launch_key.name);
+ s_conf.launch_key.name = (char *)CONF_DEFAULT_LAUNCH_BUNDLE_NAME;
+ }
+
+ if (s_conf.launch_key.secured != CONF_DEFAULT_LAUNCH_BUNDLE_SECURED) {
+ free(s_conf.launch_key.secured);
+ s_conf.launch_key.secured = (char *)CONF_DEFAULT_LAUNCH_BUNDLE_SECURED;
+ }
+
+ if (s_conf.launch_key.abi != CONF_DEFAULT_LAUNCH_BUNDLE_ABI) {
+ free(s_conf.launch_key.abi);
+ s_conf.launch_key.abi = (char *)CONF_DEFAULT_LAUNCH_BUNDLE_ABI;
+ }
+
+ if (s_conf.launch_key.hw_acceleration != CONF_DEFAULT_LAUNCH_BUNDLE_HW_ACCELERATION) {
+ free(s_conf.launch_key.hw_acceleration);
+ s_conf.launch_key.hw_acceleration = (char *)CONF_DEFAULT_LAUNCH_BUNDLE_HW_ACCELERATION;
+ }
+
+ if (s_conf.empty_content != CONF_DEFAULT_EMPTY_CONTENT) {
+ free(s_conf.empty_content);
+ s_conf.empty_content = (char *)CONF_DEFAULT_EMPTY_CONTENT;
+ }
+
+ if (s_conf.empty_title != CONF_DEFAULT_EMPTY_TITLE) {
+ free(s_conf.empty_title);
+ s_conf.empty_title = (char *)CONF_DEFAULT_EMPTY_TITLE;
+ }
+
+ if (s_conf.default_content != CONF_DEFAULT_CONTENT) {
+ free(s_conf.default_content);
+ s_conf.default_content = (char *)CONF_DEFAULT_CONTENT;
+ }
+
+ if (s_conf.default_title != CONF_DEFAULT_TITLE) {
+ free(s_conf.default_title);
+ s_conf.default_title = (char *)CONF_DEFAULT_TITLE;
+ }
+
+ if (s_conf.replace_tag != CONF_DEFAULT_REPLACE_TAG) {
+ free(s_conf.replace_tag);
+ s_conf.replace_tag = (char *)CONF_DEFAULT_REPLACE_TAG;
+ }
+
+ if (s_conf.path.conf != CONF_DEFAULT_PATH_CONF) {
+ free(s_conf.path.conf);
+ s_conf.path.conf = (char *)CONF_DEFAULT_PATH_CONF;
+ }
+
+ if (s_conf.path.image != CONF_DEFAULT_PATH_IMAGE) {
+ free(s_conf.path.image);
+ s_conf.path.image = (char *)CONF_DEFAULT_PATH_IMAGE;
+ }
+
+ if (s_conf.path.slave_log != CONF_DEFAULT_PATH_LOG) {
+ free(s_conf.path.slave_log);
+ s_conf.path.slave_log = (char *)CONF_DEFAULT_PATH_LOG;
+ }
+
+ if (s_conf.path.reader != CONF_DEFAULT_PATH_READER) {
+ free(s_conf.path.reader);
+ s_conf.path.reader = (char *)CONF_DEFAULT_PATH_READER;
+ }
+
+ if (s_conf.path.always != CONF_DEFAULT_PATH_ALWAYS) {
+ free(s_conf.path.always);
+ s_conf.path.always = (char *)CONF_DEFAULT_PATH_ALWAYS;
+ }
+
+ if (s_conf.path.script != CONF_DEFAULT_PATH_SCRIPT) {
+ free(s_conf.path.script);
+ s_conf.path.script = (char *)CONF_DEFAULT_PATH_SCRIPT;
+ }
+
+ if (s_conf.path.root != CONF_DEFAULT_PATH_ROOT) {
+ free(s_conf.path.root);
+ s_conf.path.root = (char *)CONF_DEFAULT_PATH_ROOT;
+ }
+
+ if (s_conf.path.script_port != CONF_DEFAULT_PATH_SCRIPT_PORT) {
+ free(s_conf.path.script_port);
+ s_conf.path.script_port = (char *)CONF_DEFAULT_PATH_SCRIPT_PORT;
+ }
+
+ if (s_conf.path.db != CONF_DEFAULT_PATH_DB) {
+ free(s_conf.path.db);
+ s_conf.path.db = (char *)CONF_DEFAULT_PATH_DB;
+ }
+
+ if (s_conf.path.input != CONF_DEFAULT_PATH_INPUT) {
+ free(s_conf.path.input);
+ s_conf.path.input = (char *)CONF_DEFAULT_PATH_INPUT;
+ }
+
+ if (s_conf.provider_method != CONF_DEFAULT_PROVIDER_METHOD) {
+ free(s_conf.provider_method);
+ s_conf.provider_method = (char *)CONF_DEFAULT_PROVIDER_METHOD;
+ }
+
+ if (s_conf.emergency_disk != CONF_DEFAULT_EMERGENCY_DISK) {
+ free(s_conf.emergency_disk);
+ s_conf.emergency_disk = (char *)CONF_DEFAULT_EMERGENCY_DISK;
+ }
+
+ if (s_conf.services != CONF_DEFAULT_SERVICES) {
+ free(s_conf.services);
+ s_conf.services = (char *)CONF_DEFAULT_SERVICES;
+ }
+
+ s_info.conf_loaded = 0;
+}
+
+EAPI const int const dynamicbox_conf_extra_buffer_count(void)
+{
+ return s_conf.extra_buffer_count;
+}
+
+EAPI const int const dynamicbox_conf_use_xmonitor(void)
+{
+ return s_conf.use_xmonitor;
+}
+
+EAPI const char * const dynamicbox_conf_emergency_disk(void)
+{
+ return s_conf.emergency_disk;
+}
+
+EAPI const int const dynamicbox_conf_check_lcd(void)
+{
+ return s_conf.check_lcd;
+}
+
+EAPI const int const dynamicbox_conf_use_event_time(void)
+{
+ return s_conf.use_event_time;
+}
+
+EAPI const int const dynamicbox_conf_auto_align(void)
+{
+ return s_conf.auto_align;
+}
+
+EAPI const char * const dynamicbox_conf_services(void)
+{
+ return s_conf.services;
+}
+
+EAPI const int const dynamicbox_conf_use_sw_backend(void)
+{
+ return s_conf.use_sw_backend;
+}
+
+EAPI const char * const dynamicbox_conf_provider_method(void)
+{
+ return s_conf.provider_method;
+}
+
+EAPI const int const dynamicbox_conf_debug_mode(void)
+{
+ return s_conf.debug_mode;
+}
+
+EAPI const int const dynamicbox_conf_overwrite_content(void)
+{
+ return s_conf.overwrite_content;
+}
+
+EAPI const int const dynamicbox_conf_com_core_thread(void)
+{
+ return s_conf.com_core_thread;
+}
+
+EAPI const unsigned int const dynamicbox_conf_base_width(void)
+{
+ return s_conf.base_width;
+}
+
+EAPI const unsigned int const dynamicbox_conf_base_height(void)
+{
+ return s_conf.base_height;
+}
+
+EAPI const double const dynamicbox_conf_minimum_period(void)
+{
+ return s_conf.minimum_period;
+}
+
+EAPI const int const dynamicbox_conf_default_pixels(void)
+{
+ return s_conf.default_conf.pixels;
+}
+
+EAPI const char * const dynamicbox_conf_default_script(void)
+{
+ return s_conf.default_conf.script;
+}
+
+EAPI const char * const dynamicbox_conf_default_abi(void)
+{
+ return s_conf.default_conf.abi;
+}
+
+EAPI const char * const dynamicbox_conf_default_gbar_group(void)
+{
+ return s_conf.default_conf.gbar_group;
+}
+
+EAPI const double const dynamicbox_conf_default_period(void)
+{
+ return s_conf.default_conf.period;
+}
+
+EAPI const double const dynamicbox_conf_default_packet_time(void)
+{
+ return s_conf.default_packet_time;
+}
+
+EAPI const char * const dynamicbox_conf_default_content(void)
+{
+ return s_conf.default_content;
+}
+
+EAPI const char * const dynamicbox_conf_default_title(void)
+{
+ return s_conf.default_title;
+}
+
+EAPI const unsigned long const dynamicbox_conf_minimum_space(void)
+{
+ return s_conf.minimum_space;
+}
+
+EAPI const char * const dynamicbox_conf_replace_tag(void)
+{
+ return s_conf.replace_tag;
+}
+
+EAPI const double const dynamicbox_conf_slave_ttl(void)
+{
+ return s_conf.slave_ttl;
+}
+
+EAPI const double const dynamicbox_conf_slave_activate_time(void)
+{
+ return s_conf.slave_activate_time;
+}
+
+EAPI const double const dynamicbox_conf_slave_relaunch_time(void)
+{
+ return s_conf.slave_relaunch_time;
+}
+
+EAPI const int const dynamicbox_conf_slave_relaunch_count(void)
+{
+ return s_conf.slave_relaunch_count;
+}
+
+EAPI const int const dynamicbox_conf_max_log_line(void)
+{
+ return s_conf.max_log_line;
+}
+
+EAPI const int const dynamicbox_conf_max_log_file(void)
+{
+ return s_conf.max_log_file;
+}
+
+EAPI const unsigned long const dynamicbox_conf_sqlite_flush_max(void)
+{
+ return s_conf.sqlite_flush_max;
+}
+
+EAPI const char * const dynamicbox_conf_db_path(void)
+{
+ return s_conf.path.db;
+}
+
+EAPI const char * const dynamicbox_conf_reader_path(void)
+{
+ return s_conf.path.reader;
+}
+
+EAPI const char * const dynamicbox_conf_always_path(void)
+{
+ return s_conf.path.always;
+}
+
+EAPI const char * const dynamicbox_conf_log_path(void)
+{
+ return s_conf.path.slave_log;
+}
+
+EAPI const char * const dynamicbox_conf_script_port(void)
+{
+ return s_conf.path.script_port;
+}
+
+EAPI const char * const dynamicbox_conf_script_path(void)
+{
+ return s_conf.path.script;
+}
+
+EAPI const char * const dynamicbox_conf_share_path(void)
+{
+ return s_conf.path.image;
+}
+
+EAPI const char * const dynamicbox_conf_input_path(void)
+{
+ return s_conf.path.input;
+}
+
+EAPI const double const dynamicbox_conf_ping_time(void)
+{
+ return s_conf.ping_time;
+}
+
+EAPI const int const dynamicbox_conf_slave_max_load(void)
+{
+ return s_conf.slave_max_load;
+}
+
+EAPI const int const dynamicbox_conf_premultiplied_alpha(void)
+{
+ return s_conf.premultiplied;
+}
+
+EAPI const double const dynamicbox_conf_gbar_request_timeout(void)
+{
+ return s_conf.gbar_request_timeout;
+}
+
+EAPI const double const dynamicbox_conf_scale_width_factor(void)
+{
+ return s_conf.scale_width_factor;
+}
+
+EAPI const double const dynamicbox_conf_scale_height_factor(void)
+{
+ return s_conf.scale_height_factor;
+}
+
+EAPI const char * const dynamicbox_conf_launch_key_name(void)
+{
+ return s_conf.launch_key.name;
+}
+
+EAPI const char * const dynamicbox_conf_launch_key_secured(void)
+{
+ return s_conf.launch_key.secured;
+}
+
+EAPI const char * const dynamicbox_conf_launch_key_abi(void)
+{
+ return s_conf.launch_key.abi;
+}
+
+EAPI const char * const dynamicbox_conf_launch_key_hw_acceleration(void)
+{
+ return s_conf.launch_key.hw_acceleration;
+}
+
+EAPI const char * const dynamicbox_conf_empty_content(void)
+{
+ return s_conf.empty_content;
+}
+
+EAPI const char * const dynamicbox_conf_empty_title(void)
+{
+ return s_conf.empty_title;
+}
+
+EAPI const char * const dynamicbox_conf_path(void)
+{
+ return s_conf.path.conf;
+}
+
+EAPI const char * const dynamicbox_conf_root_path(void)
+{
+ return s_conf.path.root;
+}
+
+EAPI const int const dynamicbox_conf_is_loaded(void)
+{
+ return s_info.conf_loaded;
+}
+
+EAPI const int const dynamicbox_conf_use_gettimeofday(void)
+{
+ return s_conf.use_gettimeofday;
+}
+
+EAPI const int const dynamicbox_conf_slave_event_boost_on(void)
+{
+ return s_conf.slave_event_boost_on;
+}
+
+EAPI const int const dynamicbox_conf_slave_event_boost_off(void)
+{
+ return s_conf.slave_event_boost_off;
+}
+
+EAPI const double const dynamicbox_conf_event_filter(void)
+{
+ return s_conf.event_filter;
+}
+
+EAPI const int const dynamicbox_conf_slave_limit_to_ttl(void)
+{
+ return s_conf.slave_limit_to_ttl;
+}
+
+EAPI const int const dynamicbox_conf_frame_skip(void)
+{
+ return s_conf.frame_skip;
+}
+
+EAPI const int const dynamicbox_conf_slave_auto_cache_flush(void)
+{
+ return s_conf.slave_auto_cache_flush;
+}
+
+/* End of a file */
diff --git a/src/livebox-service.c b/dynamicbox_service/src/dynamicbox_service.c
index 720a330..afcf055 100644
--- a/src/livebox-service.c
+++ b/dynamicbox_service/src/dynamicbox_service.c
@@ -23,6 +23,7 @@
#include <unistd.h>
#include <sqlite3.h>
#include <ctype.h>
+#include <fcntl.h>
#include <com-core_packet.h>
#include <packet.h>
@@ -35,17 +36,24 @@
#include <ail.h>
#include <unicode/uloc.h>
+#include "dynamicbox_errno.h"
#include "dlist.h"
#include "util.h"
#include "debug.h"
-#include "livebox-service.h"
-#include "livebox-errno.h"
+#include "dynamicbox_service.h"
+#include "dynamicbox_cmd_list.h"
+#include "dynamicbox_buffer.h"
-#define SAMSUNG_PREFIX "com.samsung."
-#define EAPI __attribute__((visibility("default")))
+#define DBOX_ID_PREFIX "org.tizen."
#define DEFAULT_TIMEOUT 2.0
-static struct supported_size_list SIZE_LIST[NR_OF_SIZE_LIST] = {
+/* "/shared/res/" */
+#define RESOURCE_PATH "/"
+
+/* "/shared/libexec/" */
+#define LIBEXEC_PATH "/"
+
+static struct supported_size_list SIZE_LIST[DBOX_NR_OF_SIZE_LIST] = {
{ 175, 175 }, /*!< 1x1 */
{ 354, 175 }, /*!< 2x1 */
{ 354, 354 }, /*!< 2x2 */
@@ -61,9 +69,9 @@ static struct supported_size_list SIZE_LIST[NR_OF_SIZE_LIST] = {
{ 720, 1280 }, /*!< 0x0 */
};
-struct pkglist_handle {
+struct dynamicbox_pkglist_handle {
enum pkglist_type {
- PKGLIST_TYPE_LB_LIST = 0x00beef00,
+ PKGLIST_TYPE_DBOX_LIST = 0x00beef00,
PKGLIST_TYPE_UNKNOWN = 0x00dead00
} type;
sqlite3 *handle;
@@ -72,8 +80,8 @@ struct pkglist_handle {
static struct service_info s_info = {
.handle = NULL,
- .dbfile = DB_FILE,
- .conf_file = RESOLUTION_FILE,
+ .dbfile = DB_FILE,
+ .conf_file = NULL,
.init_count = 0,
.iso3lang = NULL,
@@ -85,6 +93,14 @@ static struct service_info s_info = {
.base_h = 1280,
.base_parse = 0,
+
+ .last_status = DBOX_STATUS_ERROR_NONE,
+};
+
+struct pkgmgr_cbdata {
+ const char *dboxid;
+ void (*cb)(const char *dboxid, const char *appid, void *data);
+ void *cbdata;
};
static sqlite3 *open_db(void)
@@ -96,6 +112,15 @@ static sqlite3 *open_db(void)
ret = db_util_open_with_options(s_info.dbfile, &handle, SQLITE_OPEN_READONLY, NULL);
if (ret != SQLITE_OK) {
+ switch (ret) {
+ case SQLITE_PERM:
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_PERMISSION_DENIED);
+ break;
+ default:
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_IO_ERROR);
+ break;
+ }
+
ErrPrint("Failed to open a DB\n");
return NULL;
}
@@ -113,52 +138,52 @@ static inline __attribute__((always_inline)) void close_db(sqlite3 *handle)
}
}
-static int convert_size_from_type(enum livebox_size_type type, int *width, int *height)
+static int convert_size_from_type(dynamicbox_size_type_e type, int *width, int *height)
{
int idx;
switch (type) {
- case LB_SIZE_TYPE_1x1: /*!< 175x175 */
+ case DBOX_SIZE_TYPE_1x1: /*!< 175x175 */
idx = 0;
break;
- case LB_SIZE_TYPE_2x1: /*!< 354x175 */
+ case DBOX_SIZE_TYPE_2x1: /*!< 354x175 */
idx = 1;
break;
- case LB_SIZE_TYPE_2x2: /*!< 354x354 */
+ case DBOX_SIZE_TYPE_2x2: /*!< 354x354 */
idx = 2;
break;
- case LB_SIZE_TYPE_4x1: /*!< 712x175 */
+ case DBOX_SIZE_TYPE_4x1: /*!< 712x175 */
idx = 3;
break;
- case LB_SIZE_TYPE_4x2: /*!< 712x354 */
+ case DBOX_SIZE_TYPE_4x2: /*!< 712x354 */
idx = 4;
break;
- case LB_SIZE_TYPE_4x3: /*!< 712x533 */
+ case DBOX_SIZE_TYPE_4x3: /*!< 712x533 */
idx = 5;
break;
- case LB_SIZE_TYPE_4x4: /*!< 712x712 */
+ case DBOX_SIZE_TYPE_4x4: /*!< 712x712 */
idx = 6;
break;
- case LB_SIZE_TYPE_4x5: /*!< 712x891 */
+ case DBOX_SIZE_TYPE_4x5: /*!< 712x891 */
idx = 7;
break;
- case LB_SIZE_TYPE_4x6: /*!< 712x1070 */
+ case DBOX_SIZE_TYPE_4x6: /*!< 712x1070 */
idx = 8;
break;
- case LB_SIZE_TYPE_EASY_1x1: /*< 224x215 */
+ case DBOX_SIZE_TYPE_EASY_1x1: /*< 224x215 */
idx = 9;
break;
- case LB_SIZE_TYPE_EASY_3x1: /*!< 680x215 */
+ case DBOX_SIZE_TYPE_EASY_3x1: /*!< 680x215 */
idx = 10;
break;
- case LB_SIZE_TYPE_EASY_3x3: /*!< 680x653 */
+ case DBOX_SIZE_TYPE_EASY_3x3: /*!< 680x653 */
idx = 11;
break;
- case LB_SIZE_TYPE_0x0: /*!< 720x1280 */
+ case DBOX_SIZE_TYPE_0x0: /*!< 720x1280 */
idx = 12;
break;
default:
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (util_update_resolution(&s_info, SIZE_LIST) < 0) {
@@ -167,31 +192,355 @@ static int convert_size_from_type(enum livebox_size_type type, int *width, int *
*width = SIZE_LIST[idx].w;
*height = SIZE_LIST[idx].h;
- return LB_STATUS_SUCCESS;
+ return DBOX_STATUS_ERROR_NONE;
+}
+
+static int pkgmgr_cb(const pkgmgrinfo_appinfo_h handle, void *user_data)
+{
+ struct pkgmgr_cbdata *cbdata = (struct pkgmgr_cbdata *)user_data;
+ char *appid;
+ int ret;
+
+ ret = pkgmgrinfo_appinfo_get_appid(handle, &appid);
+ if (ret < 0) {
+ ErrPrint("Unable to get appid\n");
+ } else {
+ cbdata->cb(cbdata->dboxid, appid, cbdata->cbdata);
+ }
+
+ return 0;
+}
+
+static inline char *pkgmgr_get_mainapp(const char *pkgid)
+{
+ pkgmgrinfo_pkginfo_h handle;
+ char *ret = NULL;
+
+ if (pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle) != PMINFO_R_OK) {
+ ErrPrint("Unable to get mainapp: %s\n", pkgid);
+ return NULL;
+ }
+
+ if (pkgmgrinfo_pkginfo_get_mainappid(handle, &ret) == PMINFO_R_OK) {
+ ret = strdup(ret);
+ } else {
+ ErrPrint("Failed to get mainappid\n");
+ ret = NULL; /* I cannot believe the pkgmgrinfo_pkginfo_get_mainappid. it maybe able to touch my "ret" even though it fails */
+
+ }
+
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ return ret;
}
-EAPI int livebox_service_change_period(const char *pkgname, const char *id, double period)
+static inline int pkgmgr_get_applist(const char *pkgid, const char *dboxid, void (*cb)(const char *dboxid, const char *appid, void *data), void *data)
+{
+ struct pkgmgr_cbdata cbdata;
+ pkgmgrinfo_pkginfo_h handle;
+ int ret;
+
+ ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
+ if (ret < 0) {
+ ErrPrint("Unable to get pkginfo: %s\n", pkgid);
+ return ret;
+ }
+
+ cbdata.dboxid = dboxid;
+ cbdata.cb = cb;
+ cbdata.cbdata = data;
+
+ ret = pkgmgrinfo_appinfo_get_list(handle, PM_UI_APP, pkgmgr_cb, &cbdata);
+ if (ret < 0) {
+ ErrPrint("Failed to get applist\n");
+ }
+
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ return ret;
+}
+
+static char *cur_locale(void)
+{
+ char *language;
+ language = vconf_get_str(VCONFKEY_LANGSET);
+ if (language) {
+ char *ptr;
+
+ ptr = language;
+ while (*ptr) {
+ if (*ptr == '.') {
+ *ptr = '\0';
+ break;
+ }
+
+ if (*ptr == '_') {
+ *ptr = '-';
+ }
+
+ ptr++;
+ }
+ } else {
+ language = strdup("en-us");
+ if (!language) {
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_OUT_OF_MEMORY);
+ ErrPrint("Heap: %s\n", strerror(errno));
+ }
+ }
+
+ return language;
+}
+
+static char *get_default_name(const char *pkgid)
+{
+ sqlite3_stmt *stmt;
+ sqlite3 *handle;
+ char *name = NULL;
+ int ret;
+
+ handle = open_db();
+ if (!handle) {
+ return NULL;
+ }
+
+ ret = sqlite3_prepare_v2(handle, "SELECT name FROM client WHERE pkgid = ?", -1, &stmt, NULL);
+ if (ret != SQLITE_OK) {
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_FAULT);
+ ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
+ close_db(handle);
+ return NULL;
+ }
+
+ ret = sqlite3_bind_text(stmt, 1, pkgid, -1, SQLITE_TRANSIENT);
+ if (ret != SQLITE_OK) {
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_FAULT);
+ ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
+ goto out;
+ }
+
+ ret = sqlite3_step(stmt);
+ if (ret == SQLITE_ROW) {
+ const char *tmp;
+
+ tmp = (const char *)sqlite3_column_text(stmt, 0);
+ if (tmp && strlen(tmp)) {
+ name = strdup(tmp);
+ if (!name) {
+ ErrPrint("Heap: %s\n", strerror(errno));
+ }
+ }
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_NONE);
+ } else {
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_NOT_EXIST);
+ }
+
+out:
+ sqlite3_reset(stmt);
+ sqlite3_finalize(stmt);
+ close_db(handle);
+ return name;
+}
+
+static char *get_default_icon(const char *pkgid)
+{
+ sqlite3_stmt *stmt;
+ sqlite3 *handle;
+ char *icon = NULL;
+ int ret;
+
+ handle = open_db();
+ if (!handle) {
+ return NULL;
+ }
+
+ ret = sqlite3_prepare_v2(handle, "SELECT icon FROM client WHERE pkgid = ?", -1, &stmt, NULL);
+ if (ret != SQLITE_OK) {
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_FAULT);
+ ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
+ close_db(handle);
+ return NULL;
+ }
+
+ ret = sqlite3_bind_text(stmt, 1, pkgid, -1, SQLITE_TRANSIENT);
+ if (ret != SQLITE_OK) {
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_FAULT);
+ ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
+ goto out;
+ }
+
+ ret = sqlite3_step(stmt);
+ if (ret == SQLITE_ROW) {
+ const char *tmp;
+
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_NONE);
+ tmp = (const char *)sqlite3_column_text(stmt, 0);
+ if (tmp && strlen(tmp)) {
+ icon = strdup(tmp);
+ if (!icon) {
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_OUT_OF_MEMORY);
+ ErrPrint("Heap: %s\n", strerror(errno));
+ }
+ }
+ } else if (ret == SQLITE_DONE) {
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_NOT_EXIST);
+ } else {
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_FAULT);
+ }
+
+out:
+ sqlite3_reset(stmt);
+ sqlite3_finalize(stmt);
+ close_db(handle);
+ return icon;
+}
+
+static char *get_dbox_pkgname_by_appid(const char *appid)
+{
+ sqlite3_stmt *stmt;
+ char *pkgid;
+ char *tmp;
+ sqlite3 *handle;
+ int ret;
+
+ if (!appid) {
+ return NULL;
+ }
+
+ pkgid = NULL;
+ handle = open_db();
+ if (!handle) {
+ return NULL;
+ }
+
+ ret = sqlite3_prepare_v2(handle, "SELECT pkgid FROM pkgmap WHERE (appid = ? AND prime = 1) OR (uiapp = ? AND prime = 1) OR pkgid = ?", -1, &stmt, NULL);
+ if (ret != SQLITE_OK) {
+ ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_FAULT);
+ close_db(handle);
+ return NULL;
+ }
+
+ ret = sqlite3_bind_text(stmt, 1, appid, -1, SQLITE_TRANSIENT);
+ if (ret != SQLITE_OK) {
+ ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_FAULT);
+ goto out;
+ }
+
+ ret = sqlite3_bind_text(stmt, 2, appid, -1, SQLITE_TRANSIENT);
+ if (ret != SQLITE_OK) {
+ ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_FAULT);
+ goto out;
+ }
+
+ ret = sqlite3_bind_text(stmt, 3, appid, -1, SQLITE_TRANSIENT);
+ if (ret != SQLITE_OK) {
+ ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_FAULT);
+ goto out;
+ }
+
+ if (sqlite3_step(stmt) != SQLITE_ROW) {
+ ErrPrint("Error: %s (has no record? - %s)\n", sqlite3_errmsg(handle), appid);
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_NOT_EXIST);
+ goto out;
+ }
+
+ tmp = (char *)sqlite3_column_text(stmt, 0);
+ if (tmp && strlen(tmp)) {
+ pkgid = strdup(tmp);
+ if (!pkgid) {
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_OUT_OF_MEMORY);
+ ErrPrint("Heap: %s\n", strerror(errno));
+ } else {
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_NONE);
+ }
+ } else {
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_NONE);
+ }
+
+out:
+ sqlite3_reset(stmt);
+ sqlite3_finalize(stmt);
+ close_db(handle);
+ return pkgid;
+}
+
+static inline int update_lang_info(void)
+{
+ char *syslang;
+ UErrorCode err;
+
+ syslang = vconf_get_str(VCONFKEY_LANGSET);
+ if (!syslang) {
+ ErrPrint("Failed to get vconf-lang\n");
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_FAULT);
+ return -EFAULT;
+ }
+
+ if (s_info.syslang && !strcmp(s_info.syslang, syslang)) {
+ DbgPrint("Syslang is not changed: %s\n", syslang);
+ free(syslang);
+ return 0;
+ }
+
+ free(s_info.syslang);
+ s_info.syslang = syslang;
+
+ err = U_ZERO_ERROR;
+ uloc_setDefault((const char *)s_info.syslang, &err);
+ if (!U_SUCCESS(err)) {
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_FAULT);
+ ErrPrint("Failed to set default lang: %s\n", u_errorName(err));
+ free(s_info.syslang);
+ s_info.syslang = NULL;
+ return -EFAULT;
+ }
+
+ s_info.iso3lang = uloc_getISO3Language(uloc_getDefault());
+ if (!s_info.iso3lang || !strlen(s_info.iso3lang)) {
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_FAULT);
+ ErrPrint("Failed to get iso3lang\n");
+ free(s_info.syslang);
+ s_info.syslang = NULL;
+ return -EFAULT;
+ }
+
+ err = U_ZERO_ERROR;
+ s_info.country_len = uloc_getCountry(uloc_getDefault(), s_info.country, ULOC_COUNTRY_CAPACITY, &err);
+ if (!U_SUCCESS(err) || s_info.country_len <= 0) {
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_FAULT);
+ ErrPrint("Failed to get locale: %s, %s, %d (%s)\n", u_errorName(err), s_info.iso3lang, s_info.country_len, s_info.country);
+ free(s_info.syslang);
+ s_info.syslang = NULL;
+ return -EFAULT;
+ }
+
+ return 0;
+}
+
+EAPI int dynamicbox_service_change_period(const char *pkgname, const char *id, double period)
{
struct packet *packet;
struct packet *result;
+ unsigned int cmd = CMD_SERVICE_CHANGE_PERIOD;
char *uri;
int ret;
if (!pkgname || !id || period < 0.0f) {
ErrPrint("Invalid argument\n");
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
uri = util_id_to_uri(id);
if (!uri) {
- return LB_STATUS_ERROR_MEMORY;
+ return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
}
- packet = packet_create("service_change_period", "ssd", pkgname, uri, period);
+ packet = packet_create((const char *)&cmd, "ssd", pkgname, uri, period);
free(uri);
if (!packet) {
ErrPrint("Failed to create a packet for period changing\n");
- return LB_STATUS_ERROR_FAULT;
+ return DBOX_STATUS_ERROR_FAULT;
}
result = com_core_packet_oneshot_send(SERVICE_SOCKET, packet, DEFAULT_TIMEOUT);
@@ -200,38 +549,73 @@ EAPI int livebox_service_change_period(const char *pkgname, const char *id, doub
if (result) {
if (packet_get(result, "i", &ret) != 1) {
ErrPrint("Failed to parse a result packet\n");
- ret = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
packet_unref(result);
} else {
ErrPrint("Failed to get result packet\n");
- ret = LB_STATUS_ERROR_FAULT;
+ ret = DBOX_STATUS_ERROR_FAULT;
}
return ret;
}
-EAPI int livebox_service_trigger_update_with_content(const char *pkgname, const char *id, const char *cluster, const char *category, const char *content, int force)
+EAPI int dynamicbox_service_get_instance_count(const char *pkgname, const char *cluster, const char *category)
{
struct packet *packet;
struct packet *result;
+ unsigned int cmd = CMD_SERVICE_INST_CNT;
+ int ret;
+
+ if (!pkgname) {
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ }
+
+ packet = packet_create((const char *)&cmd, "sssd", pkgname, cluster, category, util_timestamp());
+ if (!packet) {
+ ErrPrint("Failed to create a packet for period changing\n");
+ return DBOX_STATUS_ERROR_FAULT;
+ }
+
+ result = com_core_packet_oneshot_send(SERVICE_SOCKET, packet, DEFAULT_TIMEOUT);
+ packet_unref(packet);
+
+ if (result) {
+ if (packet_get(result, "i", &ret) != 1) {
+ ErrPrint("Failed to parse a result packet\n");
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ }
+ packet_unref(result);
+ } else {
+ ErrPrint("Failed to get result packet\n");
+ ret = DBOX_STATUS_ERROR_FAULT;
+ }
+
+ return ret;
+}
+
+EAPI int dynamicbox_service_trigger_update(const char *pkgname, const char *id, const char *cluster, const char *category, const char *content, int force)
+{
+ struct packet *packet;
+ struct packet *result;
+ unsigned int cmd = CMD_SERVICE_UPDATE;
char *uri;
int ret;
if (!pkgname) {
ErrPrint("Invalid argument\n");
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (!force && access("/tmp/.live.paused", R_OK) == 0) {
DbgPrint("Provider is paused\n");
- return LB_STATUS_ERROR_CANCEL;
+ return DBOX_STATUS_ERROR_CANCEL;
}
if (id) {
uri = util_id_to_uri(id);
if (!uri) {
- return LB_STATUS_ERROR_MEMORY;
+ return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
}
} else {
uri = NULL;
@@ -245,7 +629,7 @@ EAPI int livebox_service_trigger_update_with_content(const char *pkgname, const
category = "default";
}
- packet = packet_create("service_update", "sssssi", pkgname, uri, cluster, category, content, force);
+ packet = packet_create((const char *)&cmd, "sssssi", pkgname, uri, cluster, category, content, force);
/*!
* \note
* "free" function accepts NULL
@@ -253,7 +637,7 @@ EAPI int livebox_service_trigger_update_with_content(const char *pkgname, const
free(uri);
if (!packet) {
ErrPrint("Failed to create a packet for service_update\n");
- return LB_STATUS_ERROR_FAULT;
+ return DBOX_STATUS_ERROR_FAULT;
}
result = com_core_packet_oneshot_send(SERVICE_SOCKET, packet, DEFAULT_TIMEOUT);
@@ -262,38 +646,32 @@ EAPI int livebox_service_trigger_update_with_content(const char *pkgname, const
if (result) {
if (packet_get(result, "i", &ret) != 1) {
ErrPrint("Failed to parse a result packet\n");
- ret = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
packet_unref(result);
} else {
ErrPrint("Failed to get result packet\n");
- ret = LB_STATUS_ERROR_FAULT;
+ ret = DBOX_STATUS_ERROR_FAULT;
}
return ret;
}
-EAPI int livebox_service_trigger_update(const char *pkgname, const char *id, const char *cluster, const char *category, int force)
-{
- return livebox_service_trigger_update_with_content(pkgname, id, cluster, category, NULL, force);
-}
-
-/*!
- * pkgid == Package Id (not the livebox id)
- */
-EAPI struct pkglist_handle *livebox_service_pkglist_create(const char *pkgid, struct pkglist_handle *handle)
+EAPI dynamicbox_pkglist_h dynamicbox_service_pkglist_create(const char *pkgid, dynamicbox_pkglist_h handle)
{
int ret;
if (handle) {
- if (handle->type != PKGLIST_TYPE_LB_LIST) {
+ if (handle->type != PKGLIST_TYPE_DBOX_LIST) {
ErrPrint("Invalid handle\n");
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
return NULL;
}
if (pkgid) {
ErrPrint("pkgid should be NULL\n");
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
return NULL;
}
@@ -303,11 +681,12 @@ EAPI struct pkglist_handle *livebox_service_pkglist_create(const char *pkgid, st
handle = calloc(1, sizeof(*handle));
if (!handle) {
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_OUT_OF_MEMORY);
ErrPrint("Heap: %s\n", strerror(errno));
return NULL;
}
- handle->type = PKGLIST_TYPE_LB_LIST;
+ handle->type = PKGLIST_TYPE_DBOX_LIST;
handle->handle = open_db();
if (!handle->handle) {
@@ -318,6 +697,7 @@ EAPI struct pkglist_handle *livebox_service_pkglist_create(const char *pkgid, st
if (!pkgid) {
ret = sqlite3_prepare_v2(handle->handle, "SELECT appid, pkgid, prime FROM pkgmap", -1, &handle->stmt, NULL);
if (ret != SQLITE_OK) {
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_FAULT);
ErrPrint("Error: %s\n", sqlite3_errmsg(handle->handle));
close_db(handle->handle);
free(handle);
@@ -326,6 +706,7 @@ EAPI struct pkglist_handle *livebox_service_pkglist_create(const char *pkgid, st
} else {
ret = sqlite3_prepare_v2(handle->handle, "SELECT appid, pkgid, prime FROM pkgmap WHERE appid = ?", -1, &handle->stmt, NULL);
if (ret != SQLITE_OK) {
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_FAULT);
ErrPrint("Error: %s\n", sqlite3_errmsg(handle->handle));
close_db(handle->handle);
free(handle);
@@ -334,6 +715,7 @@ EAPI struct pkglist_handle *livebox_service_pkglist_create(const char *pkgid, st
ret = sqlite3_bind_text(handle->stmt, 1, pkgid, -1, SQLITE_TRANSIENT);
if (ret != SQLITE_OK) {
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_FAULT);
ErrPrint("Error: %s\n", sqlite3_errmsg(handle->handle));
sqlite3_finalize(handle->stmt);
close_db(handle->handle);
@@ -345,18 +727,18 @@ EAPI struct pkglist_handle *livebox_service_pkglist_create(const char *pkgid, st
return handle;
}
-EAPI int livebox_service_get_pkglist_item(struct pkglist_handle *handle, char **appid, char **pkgname, int *is_prime)
+EAPI int dynamicbox_service_get_pkglist_item(dynamicbox_pkglist_h handle, char **appid, char **pkgname, int *is_prime)
{
const char *tmp;
char *_appid = NULL;
char *_pkgname = NULL;
- if (!handle || handle->type != PKGLIST_TYPE_LB_LIST) {
- return LB_STATUS_ERROR_INVALID;
+ if (!handle || handle->type != PKGLIST_TYPE_DBOX_LIST) {
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (sqlite3_step(handle->stmt) != SQLITE_ROW) {
- return LB_STATUS_ERROR_NOT_EXIST;
+ return DBOX_STATUS_ERROR_NOT_EXIST;
}
if (appid) {
@@ -365,7 +747,7 @@ EAPI int livebox_service_get_pkglist_item(struct pkglist_handle *handle, char **
_appid = strdup(tmp);
if (!_appid) {
ErrPrint("Heap: %s\n", strerror(errno));
- return LB_STATUS_ERROR_MEMORY;
+ return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
}
}
}
@@ -377,7 +759,7 @@ EAPI int livebox_service_get_pkglist_item(struct pkglist_handle *handle, char **
if (!_pkgname) {
ErrPrint("Heap: %s\n", strerror(errno));
free(_appid);
- return LB_STATUS_ERROR_MEMORY;
+ return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
}
}
}
@@ -394,13 +776,13 @@ EAPI int livebox_service_get_pkglist_item(struct pkglist_handle *handle, char **
*pkgname = _pkgname;
}
- return LB_STATUS_SUCCESS;
+ return DBOX_STATUS_ERROR_NONE;
}
-EAPI int livebox_service_pkglist_destroy(struct pkglist_handle *handle)
+EAPI int dynamicbox_service_pkglist_destroy(dynamicbox_pkglist_h handle)
{
- if (!handle || handle->type != PKGLIST_TYPE_LB_LIST) {
- return LB_STATUS_ERROR_INVALID;
+ if (!handle || handle->type != PKGLIST_TYPE_DBOX_LIST) {
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
handle->type = PKGLIST_TYPE_UNKNOWN;
@@ -408,10 +790,10 @@ EAPI int livebox_service_pkglist_destroy(struct pkglist_handle *handle)
sqlite3_finalize(handle->stmt);
close_db(handle->handle);
free(handle);
- return LB_STATUS_SUCCESS;
+ return DBOX_STATUS_ERROR_NONE;
}
-EAPI int livebox_service_get_pkglist(int (*cb)(const char *appid, const char *pkgname, int is_prime, void *data), void *data)
+EAPI int dynamicbox_service_get_pkglist(int (*cb)(const char *appid, const char *pkgname, int is_prime, void *data), void *data)
{
int ret;
sqlite3_stmt *stmt;
@@ -421,18 +803,18 @@ EAPI int livebox_service_get_pkglist(int (*cb)(const char *appid, const char *pk
sqlite3 *handle;
if (!cb) {
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
handle = open_db();
if (!handle) {
- return LB_STATUS_ERROR_IO;
+ return DBOX_STATUS_ERROR_IO_ERROR;
}
ret = sqlite3_prepare_v2(handle, "SELECT appid, pkgid, prime FROM pkgmap", -1, &stmt, NULL);
if (ret != SQLITE_OK) {
ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
- ret = LB_STATUS_ERROR_IO;
+ ret = DBOX_STATUS_ERROR_IO_ERROR;
goto out;
}
@@ -468,27 +850,27 @@ out:
return ret;
}
-EAPI int livebox_service_get_pkglist_by_pkgid(const char *pkgid, int (*cb)(const char *lbid, int is_prime, void *data), void *data)
+EAPI int dynamicbox_service_get_pkglist_by_pkgid(const char *pkgid, int (*cb)(const char *dboxid, int is_prime, void *data), void *data)
{
int ret;
sqlite3_stmt *stmt;
- const char *lbid;
+ const char *dboxid;
int is_prime;
sqlite3 *handle;
if (!cb || !pkgid) {
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
handle = open_db();
if (!handle) {
- return LB_STATUS_ERROR_IO;
+ return DBOX_STATUS_ERROR_IO_ERROR;
}
ret = sqlite3_prepare_v2(handle, "SELECT pkgid, prime FROM pkgmap WHERE appid = ?", -1, &stmt, NULL);
if (ret != SQLITE_OK) {
ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
- ret = LB_STATUS_ERROR_IO;
+ ret = DBOX_STATUS_ERROR_IO_ERROR;
goto out;
}
@@ -497,15 +879,15 @@ EAPI int livebox_service_get_pkglist_by_pkgid(const char *pkgid, int (*cb)(const
ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
sqlite3_reset(stmt);
sqlite3_finalize(stmt);
- ret = LB_STATUS_ERROR_IO;
+ ret = DBOX_STATUS_ERROR_IO_ERROR;
goto out;
}
ret = 0;
while (sqlite3_step(stmt) == SQLITE_ROW) {
- lbid = (const char *)sqlite3_column_text(stmt, 0);
- if (!lbid || !strlen(lbid)) {
- ErrPrint("LBID is not valid\n");
+ dboxid = (const char *)sqlite3_column_text(stmt, 0);
+ if (!dboxid || !strlen(dboxid)) {
+ ErrPrint("DBOXID is not valid\n");
continue;
}
@@ -513,7 +895,7 @@ EAPI int livebox_service_get_pkglist_by_pkgid(const char *pkgid, int (*cb)(const
ret++;
- if (cb(lbid, is_prime, data) < 0) {
+ if (cb(dboxid, is_prime, data) < 0) {
DbgPrint("Callback stopped package crawling\n");
break;
}
@@ -527,26 +909,26 @@ out:
return ret;
}
-EAPI int livebox_service_get_pkglist_by_category(const char *category, int (*cb)(const char *lbid, void *data), void *data)
+EAPI int dynamicbox_service_get_pkglist_by_category(const char *category, int (*cb)(const char *dboxid, void *data), void *data)
{
int ret;
sqlite3_stmt *stmt;
- const char *lbid;
+ const char *dboxid;
sqlite3 *handle;
if (!cb || !category) {
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
handle = open_db();
if (!handle) {
- return LB_STATUS_ERROR_IO;
+ return DBOX_STATUS_ERROR_IO_ERROR;
}
ret = sqlite3_prepare_v2(handle, "SELECT pkgid FROM pkgmap WHERE category = ?", -1, &stmt, NULL);
if (ret != SQLITE_OK) {
ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
- ret = LB_STATUS_ERROR_IO;
+ ret = DBOX_STATUS_ERROR_IO_ERROR;
goto out;
}
@@ -555,21 +937,21 @@ EAPI int livebox_service_get_pkglist_by_category(const char *category, int (*cb)
ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
sqlite3_reset(stmt);
sqlite3_finalize(stmt);
- ret = LB_STATUS_ERROR_IO;
+ ret = DBOX_STATUS_ERROR_IO_ERROR;
goto out;
}
ret = 0;
while (sqlite3_step(stmt) == SQLITE_ROW) {
- lbid = (const char *)sqlite3_column_text(stmt, 0);
- if (!lbid || !strlen(lbid)) {
- ErrPrint("LBID is not valid\n");
+ dboxid = (const char *)sqlite3_column_text(stmt, 0);
+ if (!dboxid || !strlen(dboxid)) {
+ ErrPrint("DBOXID is not valid\n");
continue;
}
ret++;
- if (cb(lbid, data) < 0) {
+ if (cb(dboxid, data) < 0) {
DbgPrint("Callback stopped package crawling\n");
break;
}
@@ -583,76 +965,7 @@ out:
return ret;
}
-struct pkgmgr_cbdata {
- const char *lbid;
- void (*cb)(const char *lbid, const char *appid, void *data);
- void *cbdata;
-};
-
-static int pkgmgr_cb(const pkgmgrinfo_appinfo_h handle, void *user_data)
-{
- struct pkgmgr_cbdata *cbdata = (struct pkgmgr_cbdata *)user_data;
- char *appid;
- int ret;
-
- ret = pkgmgrinfo_appinfo_get_appid(handle, &appid);
- if (ret < 0) {
- ErrPrint("Unable to get appid\n");
- } else {
- cbdata->cb(cbdata->lbid, appid, cbdata->cbdata);
- }
-
- return 0;
-}
-
-static inline char *pkgmgr_get_mainapp(const char *pkgid)
-{
- pkgmgrinfo_pkginfo_h handle;
- char *ret = NULL;
-
- if (pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle) != PMINFO_R_OK) {
- ErrPrint("Unable to get mainapp: %s\n", pkgid);
- return NULL;
- }
-
- if (pkgmgrinfo_pkginfo_get_mainappid(handle, &ret) == PMINFO_R_OK) {
- ret = strdup(ret);
- } else {
- ErrPrint("Failed to get mainappid\n");
- ret = NULL; /* I cannot believe the pkgmgrinfo_pkginfo_get_mainappid. it maybe able to touch my "ret" even though it fails */
-
- }
-
- pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
- return ret;
-}
-
-static inline int pkgmgr_get_applist(const char *pkgid, const char *lbid, void (*cb)(const char *lbid, const char *appid, void *data), void *data)
-{
- struct pkgmgr_cbdata cbdata;
- pkgmgrinfo_pkginfo_h handle;
- int ret;
-
- ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
- if (ret < 0) {
- ErrPrint("Unable to get pkginfo: %s\n", pkgid);
- return ret;
- }
-
- cbdata.lbid = lbid;
- cbdata.cb = cb;
- cbdata.cbdata = data;
-
- ret = pkgmgrinfo_appinfo_get_list(handle, PM_UI_APP, pkgmgr_cb, &cbdata);
- if (ret < 0) {
- ErrPrint("Failed to get applist\n");
- }
-
- pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
- return ret;
-}
-
-EAPI int livebox_service_get_applist(const char *lbid, void (*cb)(const char *lbid, const char *appid, void *data), void *data)
+EAPI int dynamicbox_service_get_applist(const char *dboxid, void (*cb)(const char *dboxid, const char *appid, void *data), void *data)
{
sqlite3_stmt *stmt;
const char *tmp;
@@ -660,38 +973,38 @@ EAPI int livebox_service_get_applist(const char *lbid, void (*cb)(const char *lb
sqlite3 *handle;
int ret;
- if (!lbid || !cb) {
- return LB_STATUS_ERROR_INVALID;
+ if (!dboxid || !cb) {
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
handle = open_db();
if (!handle) {
- return LB_STATUS_ERROR_IO;
+ return DBOX_STATUS_ERROR_IO_ERROR;
}
ret = sqlite3_prepare_v2(handle, "SELECT appid FROM pkgmap WHERE (pkgid = ?) or (appid = ?)", -1, &stmt, NULL);
if (ret != SQLITE_OK) {
ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
- ret = LB_STATUS_ERROR_IO;
+ ret = DBOX_STATUS_ERROR_IO_ERROR;
goto out;
}
- ret = sqlite3_bind_text(stmt, 1, lbid, -1, SQLITE_TRANSIENT);
+ ret = sqlite3_bind_text(stmt, 1, dboxid, -1, SQLITE_TRANSIENT);
if (ret != SQLITE_OK) {
ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
- ret = LB_STATUS_ERROR_IO;
+ ret = DBOX_STATUS_ERROR_IO_ERROR;
goto out;
}
- ret = sqlite3_bind_text(stmt, 2, lbid, -1, SQLITE_TRANSIENT);
+ ret = sqlite3_bind_text(stmt, 2, dboxid, -1, SQLITE_TRANSIENT);
if (ret != SQLITE_OK) {
ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
- ret = LB_STATUS_ERROR_IO;
+ ret = DBOX_STATUS_ERROR_IO_ERROR;
goto out;
}
if (sqlite3_step(stmt) != SQLITE_ROW) {
- ret = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
sqlite3_reset(stmt);
sqlite3_finalize(stmt);
goto out;
@@ -699,8 +1012,8 @@ EAPI int livebox_service_get_applist(const char *lbid, void (*cb)(const char *lb
tmp = (const char *)sqlite3_column_text(stmt, 0);
if (!tmp || !strlen(tmp)) {
- ErrPrint("Invalid package name (%s)\n", lbid);
- ret = LB_STATUS_ERROR_INVALID;
+ ErrPrint("Invalid package name (%s)\n", dboxid);
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
sqlite3_reset(stmt);
sqlite3_finalize(stmt);
goto out;
@@ -709,7 +1022,7 @@ EAPI int livebox_service_get_applist(const char *lbid, void (*cb)(const char *lb
pkgid = strdup(tmp);
if (!pkgid) {
ErrPrint("Error: %s\n", strerror(errno));
- ret = LB_STATUS_ERROR_MEMORY;
+ ret = DBOX_STATUS_ERROR_OUT_OF_MEMORY;
sqlite3_reset(stmt);
sqlite3_finalize(stmt);
goto out;
@@ -718,19 +1031,19 @@ EAPI int livebox_service_get_applist(const char *lbid, void (*cb)(const char *lb
sqlite3_reset(stmt);
sqlite3_finalize(stmt);
- ret = pkgmgr_get_applist(pkgid, lbid, cb, data);
+ ret = pkgmgr_get_applist(pkgid, dboxid, cb, data);
free(pkgid);
switch (ret) {
case PMINFO_R_EINVAL:
- ret = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
break;
case PMINFO_R_OK:
- ret = LB_STATUS_SUCCESS;
+ ret = DBOX_STATUS_ERROR_NONE;
break;
case PMINFO_R_ERROR:
default:
- ret = LB_STATUS_ERROR_FAULT;
+ ret = DBOX_STATUS_ERROR_FAULT;
break;
}
@@ -739,7 +1052,7 @@ out:
return ret;
}
-EAPI char *livebox_service_mainappid(const char *lbid)
+EAPI char *dynamicbox_service_mainappid(const char *dboxid)
{
sqlite3_stmt *stmt;
const char *tmp;
@@ -747,7 +1060,7 @@ EAPI char *livebox_service_mainappid(const char *lbid)
sqlite3 *handle;
char *ret = NULL;
- if (!lbid) {
+ if (!dboxid) {
return NULL;
}
@@ -761,12 +1074,12 @@ EAPI char *livebox_service_mainappid(const char *lbid)
goto out;
}
- if (sqlite3_bind_text(stmt, 1, lbid, -1, SQLITE_TRANSIENT) != SQLITE_OK) {
+ if (sqlite3_bind_text(stmt, 1, dboxid, -1, SQLITE_TRANSIENT) != SQLITE_OK) {
ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
goto out;
}
- if (sqlite3_bind_text(stmt, 2, lbid, -1, SQLITE_TRANSIENT) != SQLITE_OK) {
+ if (sqlite3_bind_text(stmt, 2, dboxid, -1, SQLITE_TRANSIENT) != SQLITE_OK) {
ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
goto out;
}
@@ -779,7 +1092,7 @@ EAPI char *livebox_service_mainappid(const char *lbid)
tmp = (const char *)sqlite3_column_text(stmt, 0);
if (!tmp || !strlen(tmp)) {
- ErrPrint("Invalid package name (%s)\n", lbid);
+ ErrPrint("Invalid package name (%s)\n", dboxid);
sqlite3_reset(stmt);
sqlite3_finalize(stmt);
goto out;
@@ -807,7 +1120,7 @@ out:
return ret;
}
-EAPI int livebox_service_get_supported_size_types(const char *pkgid, int *cnt, int *types)
+EAPI int dynamicbox_service_get_supported_size_types(const char *pkgid, int *cnt, int *types)
{
sqlite3_stmt *stmt;
sqlite3 *handle;
@@ -815,18 +1128,18 @@ EAPI int livebox_service_get_supported_size_types(const char *pkgid, int *cnt, i
int ret;
if (!types || !cnt || !pkgid) {
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
handle = open_db();
if (!handle) {
- return LB_STATUS_ERROR_IO;
+ return DBOX_STATUS_ERROR_IO_ERROR;
}
ret = sqlite3_prepare_v2(handle, "SELECT size_type FROM box_size WHERE pkgid = ? ORDER BY size_type ASC", -1, &stmt, NULL);
if (ret != SQLITE_OK) {
ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
- ret = LB_STATUS_ERROR_IO;
+ ret = DBOX_STATUS_ERROR_IO_ERROR;
goto out;
}
@@ -835,12 +1148,12 @@ EAPI int livebox_service_get_supported_size_types(const char *pkgid, int *cnt, i
ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
sqlite3_reset(stmt);
sqlite3_finalize(stmt);
- ret = LB_STATUS_ERROR_IO;
+ ret = DBOX_STATUS_ERROR_IO_ERROR;
goto out;
}
- if (*cnt > NR_OF_SIZE_LIST) {
- *cnt = NR_OF_SIZE_LIST;
+ if (*cnt > DBOX_NR_OF_SIZE_LIST) {
+ *cnt = DBOX_NR_OF_SIZE_LIST;
}
ret = 0;
@@ -853,133 +1166,13 @@ EAPI int livebox_service_get_supported_size_types(const char *pkgid, int *cnt, i
*cnt = ret;
sqlite3_reset(stmt);
sqlite3_finalize(stmt);
- ret = LB_STATUS_SUCCESS;
+ ret = DBOX_STATUS_ERROR_NONE;
out:
close_db(handle);
return ret;
}
-static char *cur_locale(void)
-{
- char *language;
- language = vconf_get_str(VCONFKEY_LANGSET);
- if (language) {
- char *ptr;
-
- ptr = language;
- while (*ptr) {
- if (*ptr == '.') {
- *ptr = '\0';
- break;
- }
-
- if (*ptr == '_') {
- *ptr = '-';
- }
-
- ptr++;
- }
- } else {
- language = strdup("en-us");
- if (!language) {
- ErrPrint("Heap: %s\n", strerror(errno));
- }
- }
-
- return language;
-}
-
-static char *get_default_name(const char *pkgid)
-{
- sqlite3_stmt *stmt;
- sqlite3 *handle;
- char *name = NULL;
- int ret;
-
- handle = open_db();
- if (!handle) {
- return NULL;
- }
-
- ret = sqlite3_prepare_v2(handle, "SELECT name FROM client WHERE pkgid = ?", -1, &stmt, NULL);
- if (ret != SQLITE_OK) {
- ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
- close_db(handle);
- return NULL;
- }
-
- ret = sqlite3_bind_text(stmt, 1, pkgid, -1, SQLITE_TRANSIENT);
- if (ret != SQLITE_OK) {
- ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
- goto out;
- }
-
- ret = sqlite3_step(stmt);
- if (ret == SQLITE_ROW) {
- const char *tmp;
-
- tmp = (const char *)sqlite3_column_text(stmt, 0);
- if (tmp && strlen(tmp)) {
- name = strdup(tmp);
- if (!name) {
- ErrPrint("Heap: %s\n", strerror(errno));
- }
- }
- }
-
-out:
- sqlite3_reset(stmt);
- sqlite3_finalize(stmt);
- close_db(handle);
- return name;
-}
-
-static char *get_default_icon(const char *pkgid)
-{
- sqlite3_stmt *stmt;
- sqlite3 *handle;
- char *icon = NULL;
- int ret;
-
- handle = open_db();
- if (!handle) {
- return NULL;
- }
-
- ret = sqlite3_prepare_v2(handle, "SELECT icon FROM client WHERE pkgid = ?", -1, &stmt, NULL);
- if (ret != SQLITE_OK) {
- ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
- close_db(handle);
- return NULL;
- }
-
- ret = sqlite3_bind_text(stmt, 1, pkgid, -1, SQLITE_TRANSIENT);
- if (ret != SQLITE_OK) {
- ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
- goto out;
- }
-
- ret = sqlite3_step(stmt);
- if (ret == SQLITE_ROW) {
- const char *tmp;
-
- tmp = (const char *)sqlite3_column_text(stmt, 0);
- if (tmp && strlen(tmp)) {
- icon = strdup(tmp);
- if (!icon) {
- ErrPrint("Heap: %s\n", strerror(errno));
- }
- }
- }
-
-out:
- sqlite3_reset(stmt);
- sqlite3_finalize(stmt);
- close_db(handle);
- return icon;
-}
-
-EAPI char *livebox_service_content(const char *pkgid)
+EAPI char *dynamicbox_service_content(const char *pkgid)
{
sqlite3_stmt *stmt;
sqlite3 *handle;
@@ -988,11 +1181,13 @@ EAPI char *livebox_service_content(const char *pkgid)
handle = open_db();
if (!handle) {
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
return NULL;
}
ret = sqlite3_prepare_v2(handle, "SELECT content FROM client WHERE pkgid = ?", -1, &stmt, NULL);
if (ret != SQLITE_OK) {
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_FAULT);
ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
close_db(handle);
return NULL;
@@ -1000,6 +1195,7 @@ EAPI char *livebox_service_content(const char *pkgid)
ret = sqlite3_bind_text(stmt, 1, pkgid, -1, SQLITE_TRANSIENT);
if (ret != SQLITE_OK) {
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_FAULT);
ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
goto out;
}
@@ -1012,9 +1208,16 @@ EAPI char *livebox_service_content(const char *pkgid)
if (tmp && strlen(tmp)) {
content = strdup(tmp);
if (!content) {
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_OUT_OF_MEMORY);
ErrPrint("Heap: %s\n", strerror(errno));
}
+ } else {
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_NONE);
}
+ } else if (ret == SQLITE_DONE) {
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_NOT_EXIST);
+ } else {
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_FAULT);
}
out:
@@ -1024,14 +1227,15 @@ out:
return content;
}
-EAPI char *livebox_service_setup_appid(const char *lbid)
+EAPI char *dynamicbox_service_setup_appid(const char *dboxid)
{
sqlite3_stmt *stmt;
sqlite3 *handle;
int ret;
char *appid;
- if (!lbid) {
+ if (!dboxid) {
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
return NULL;
}
@@ -1042,14 +1246,16 @@ EAPI char *livebox_service_setup_appid(const char *lbid)
ret = sqlite3_prepare_v2(handle, "SELECT setup FROM client WHERE pkgid = ?", -1, &stmt, NULL);
if (ret != SQLITE_OK) {
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_FAULT);
ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
close_db(handle);
return NULL;
}
appid = NULL;
- ret = sqlite3_bind_text(stmt, 1, lbid, -1, SQLITE_TRANSIENT);
+ ret = sqlite3_bind_text(stmt, 1, dboxid, -1, SQLITE_TRANSIENT);
if (ret != SQLITE_OK) {
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_FAULT);
ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
goto out;
}
@@ -1058,6 +1264,8 @@ EAPI char *livebox_service_setup_appid(const char *lbid)
if (ret == SQLITE_ROW) {
const char *tmp;
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_NONE);
+
tmp = (const char *)sqlite3_column_text(stmt, 0);
if (!tmp || !strlen(tmp)) {
goto out;
@@ -1065,8 +1273,11 @@ EAPI char *livebox_service_setup_appid(const char *lbid)
appid = strdup(tmp);
if (!appid) {
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_OUT_OF_MEMORY);
ErrPrint("Error: %s\n", strerror(errno));
}
+ } else {
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_NOT_EXIST);
}
out:
@@ -1076,13 +1287,14 @@ out:
return appid;
}
-EAPI int livebox_service_nodisplay(const char *pkgid)
+EAPI int dynamicbox_service_nodisplay(const char *pkgid)
{
sqlite3_stmt *stmt;
sqlite3 *handle;
int ret;
if (!pkgid) {
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
return 0;
}
@@ -1093,6 +1305,7 @@ EAPI int livebox_service_nodisplay(const char *pkgid)
ret = sqlite3_prepare_v2(handle, "SELECT nodisplay FROM client WHERE pkgid = ?", -1, &stmt, NULL);
if (ret != SQLITE_OK) {
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_FAULT);
ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
close_db(handle);
return 0;
@@ -1100,6 +1313,7 @@ EAPI int livebox_service_nodisplay(const char *pkgid)
ret = sqlite3_bind_text(stmt, 1, pkgid, -1, SQLITE_TRANSIENT);
if (ret != SQLITE_OK) {
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_FAULT);
ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
ret = 0;
goto out;
@@ -1107,8 +1321,10 @@ EAPI int livebox_service_nodisplay(const char *pkgid)
ret = sqlite3_step(stmt);
if (ret == SQLITE_ROW) {
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_NONE);
ret = !!sqlite3_column_int(stmt, 0);
} else {
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_NOT_EXIST);
ret = 0;
}
@@ -1119,72 +1335,9 @@ out:
return ret;
}
-static char *get_lb_pkgname_by_appid(const char *appid)
-{
- sqlite3_stmt *stmt;
- char *pkgid;
- char *tmp;
- sqlite3 *handle;
- int ret;
-
- if (!appid) {
- return NULL;
- }
-
- pkgid = NULL;
- handle = open_db();
- if (!handle) {
- return NULL;
- }
-
- ret = sqlite3_prepare_v2(handle, "SELECT pkgid FROM pkgmap WHERE (appid = ? AND prime = 1) OR (uiapp = ? AND prime = 1) OR pkgid = ?", -1, &stmt, NULL);
- if (ret != SQLITE_OK) {
- ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
- close_db(handle);
- return NULL;
- }
-
- ret = sqlite3_bind_text(stmt, 1, appid, -1, SQLITE_TRANSIENT);
- if (ret != SQLITE_OK) {
- ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
- goto out;
- }
-
- ret = sqlite3_bind_text(stmt, 2, appid, -1, SQLITE_TRANSIENT);
- if (ret != SQLITE_OK) {
- ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
- goto out;
- }
-
- ret = sqlite3_bind_text(stmt, 3, appid, -1, SQLITE_TRANSIENT);
- if (ret != SQLITE_OK) {
- ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
- goto out;
- }
-
- if (sqlite3_step(stmt) != SQLITE_ROW) {
- ErrPrint("Error: %s (has no record? - %s)\n", sqlite3_errmsg(handle), appid);
- goto out;
- }
-
- tmp = (char *)sqlite3_column_text(stmt, 0);
- if (tmp && strlen(tmp)) {
- pkgid = strdup(tmp);
- if (!pkgid) {
- ErrPrint("Heap: %s\n", strerror(errno));
- }
- }
-
-out:
- sqlite3_reset(stmt);
- sqlite3_finalize(stmt);
- close_db(handle);
- return pkgid;
-}
-
-EAPI int livebox_service_need_frame(const char *pkgid, int size_type)
+EAPI int dynamicbox_service_need_frame(const char *pkgid, int size_type)
{
- char *lbid;
+ char *dboxid;
sqlite3_stmt *stmt;
sqlite3 *handle;
int ret;
@@ -1197,6 +1350,7 @@ EAPI int livebox_service_need_frame(const char *pkgid, int size_type)
ret = sqlite3_prepare_v2(handle, "SELECT need_frame FROM box_size WHERE pkgid = ? AND size_type = ?", -1, &stmt, NULL);
if (ret != SQLITE_OK) {
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_FAULT);
ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
close_db(handle);
return 0;
@@ -1204,16 +1358,17 @@ EAPI int livebox_service_need_frame(const char *pkgid, int size_type)
/*!
*/
- lbid = livebox_service_pkgname(pkgid);
- if (!lbid) {
+ dboxid = dynamicbox_service_dbox_id(pkgid);
+ if (!dboxid) {
ErrPrint("Invalid appid (%s)\n", pkgid);
ret = 0;
goto out;
}
- ret = sqlite3_bind_text(stmt, 1, lbid, -1, SQLITE_TRANSIENT);
- free(lbid);
+ ret = sqlite3_bind_text(stmt, 1, dboxid, -1, SQLITE_TRANSIENT);
+ free(dboxid);
if (ret != SQLITE_OK) {
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_FAULT);
ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
ret = 0;
goto out;
@@ -1221,6 +1376,7 @@ EAPI int livebox_service_need_frame(const char *pkgid, int size_type)
ret = sqlite3_bind_int(stmt, 2, size_type);
if (ret != SQLITE_OK) {
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_FAULT);
ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
ret = 0;
goto out;
@@ -1232,6 +1388,7 @@ EAPI int livebox_service_need_frame(const char *pkgid, int size_type)
} else {
ret = 0;
ErrPrint("There is no such result\n");
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_NOT_EXIST);
}
out:
sqlite3_reset(stmt);
@@ -1240,9 +1397,9 @@ out:
return ret;
}
-EAPI int livebox_service_touch_effect(const char *pkgid, int size_type)
+EAPI int dynamicbox_service_touch_effect(const char *pkgid, int size_type)
{
- char *lbid;
+ char *dboxid;
sqlite3_stmt *stmt;
sqlite3 *handle;
int ret;
@@ -1256,26 +1413,28 @@ EAPI int livebox_service_touch_effect(const char *pkgid, int size_type)
ret = sqlite3_prepare_v2(handle, "SELECT touch_effect FROM box_size WHERE pkgid = ? AND size_type = ?", -1, &stmt, NULL);
if (ret != SQLITE_OK) {
ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_FAULT);
close_db(handle);
return 1;
}
- /*!
- * \note
+ /**
+ * @note
* This function will validate the "pkgid"
* call the exported API in the exported API is not recomended
* but... I used.
*/
- lbid = livebox_service_pkgname(pkgid);
- if (!lbid) {
+ dboxid = dynamicbox_service_dbox_id(pkgid);
+ if (!dboxid) {
ErrPrint("Invalid appid (%s)\n", pkgid);
ret = 1;
goto out;
}
- ret = sqlite3_bind_text(stmt, 1, lbid, -1, SQLITE_TRANSIENT);
- free(lbid);
+ ret = sqlite3_bind_text(stmt, 1, dboxid, -1, SQLITE_TRANSIENT);
+ free(dboxid);
if (ret != SQLITE_OK) {
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_FAULT);
ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
ret = 1;
goto out;
@@ -1283,6 +1442,7 @@ EAPI int livebox_service_touch_effect(const char *pkgid, int size_type)
ret = sqlite3_bind_int(stmt, 2, size_type);
if (ret != SQLITE_OK) {
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_FAULT);
ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
ret = 1;
goto out;
@@ -1292,8 +1452,9 @@ EAPI int livebox_service_touch_effect(const char *pkgid, int size_type)
if (ret == SQLITE_ROW) {
ret = !!sqlite3_column_int(stmt, 0);
} else {
- ret = 1; /*!< Default true: In this case the DB is corrupted. */
+ ret = 1; /**< Default true: In this case the DB is corrupted. */
ErrPrint("There is no result\n");
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_NOT_EXIST);
}
out:
@@ -1303,11 +1464,11 @@ out:
return ret;
}
-EAPI int livebox_service_mouse_event(const char *pkgid, int size_type)
+EAPI int dynamicbox_service_mouse_event(const char *pkgid, int size_type)
{
sqlite3_stmt *stmt;
sqlite3 *handle;
- char *lbid;
+ char *dboxid;
int ret;
handle = open_db();
@@ -1318,20 +1479,22 @@ EAPI int livebox_service_mouse_event(const char *pkgid, int size_type)
ret = sqlite3_prepare_v2(handle, "SELECT mouse_event FROM box_size WHERE pkgid = ? AND size_type = ?", -1, &stmt, NULL);
if (ret != SQLITE_OK) {
ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_FAULT);
close_db(handle);
return 0;
}
- lbid = livebox_service_pkgname(pkgid);
- if (!lbid) {
- ErrPrint("Failed to get lbid: %s\n", pkgid);
+ dboxid = dynamicbox_service_dbox_id(pkgid);
+ if (!dboxid) {
+ ErrPrint("Failed to get dboxid: %s\n", pkgid);
ret = 0;
goto out;
}
- ret = sqlite3_bind_text(stmt, 1, lbid, -1, SQLITE_TRANSIENT);
- free(lbid);
+ ret = sqlite3_bind_text(stmt, 1, dboxid, -1, SQLITE_TRANSIENT);
+ free(dboxid);
if (ret != SQLITE_OK) {
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_FAULT);
ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
ret = 0;
goto out;
@@ -1339,6 +1502,7 @@ EAPI int livebox_service_mouse_event(const char *pkgid, int size_type)
ret = sqlite3_bind_int(stmt, 2, size_type);
if (ret != SQLITE_OK) {
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_FAULT);
ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
ret = 0;
goto out;
@@ -1347,9 +1511,11 @@ EAPI int livebox_service_mouse_event(const char *pkgid, int size_type)
ret = sqlite3_step(stmt);
if (ret == SQLITE_ROW) {
ret = !!sqlite3_column_int(stmt, 0);
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_NONE);
} else {
- ret = 0; /*!< Default is false, In this case the DB is corrupted */
+ ret = 0; /**< Default is false, In this case the DB is corrupted */
ErrPrint("There is no result.\n");
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_NOT_EXIST);
}
out:
@@ -1359,74 +1525,121 @@ out:
return ret;
}
-static inline int update_lang_info(void)
+static char *convert_to_abspath(const char *appid, const char *tmp, const char *mid_path, int *tmp_len)
{
- char *syslang;
- UErrorCode err;
+ pkgmgrinfo_pkginfo_h handle;
+ const char *path;
+ int abspath_len;
+ char *abspath = NULL;
+ int ret;
- syslang = vconf_get_str(VCONFKEY_LANGSET);
- if (!syslang) {
- ErrPrint("Failed to get vconf-lang\n");
- return -EFAULT;
+ if (!tmp || tmp[0] == '/' || !appid) {
+ return NULL;
}
- if (s_info.syslang && !strcmp(s_info.syslang, syslang)) {
- DbgPrint("Syslang is not changed: %s\n", syslang);
- free(syslang);
- return 0;
+ ret = pkgmgrinfo_pkginfo_get_pkginfo(appid, &handle);
+ if (ret != PMINFO_R_OK) {
+ ErrPrint("Unable to get package info for %s\n", appid);
+ return NULL;
}
- free(s_info.syslang);
- s_info.syslang = syslang;
+ ret = pkgmgrinfo_pkginfo_get_root_path(handle, (char **)&path);
+ if (ret != PMINFO_R_OK) {
+ ErrPrint("Unable to get path for %s\n", appid);
+ goto out;
+ }
- err = U_ZERO_ERROR;
- uloc_setDefault((const char *)s_info.syslang, &err);
- if (!U_SUCCESS(err)) {
- ErrPrint("Failed to set default lang: %s\n", u_errorName(err));
- free(s_info.syslang);
- s_info.syslang = NULL;
- return -EFAULT;
+ abspath_len = strlen(tmp) + strlen(path) + strlen(mid_path) + 1;
+ abspath = malloc(abspath_len);
+ if (!abspath) {
+ ErrPrint("malloc: %s\n", strerror(errno));
+ goto out;
}
- s_info.iso3lang = uloc_getISO3Language(uloc_getDefault());
- if (!s_info.iso3lang || !strlen(s_info.iso3lang)) {
- ErrPrint("Failed to get iso3lang\n");
- free(s_info.syslang);
- s_info.syslang = NULL;
- return -EFAULT;
+ if (snprintf(abspath, abspath_len, "%s%s%s", path, mid_path, tmp) < 0) {
+ ErrPrint("snprintf: %s\n", strerror(errno));
+ free(abspath);
+ abspath = NULL;
+ goto out;
}
- err = U_ZERO_ERROR;
- s_info.country_len = uloc_getCountry(uloc_getDefault(), s_info.country, ULOC_COUNTRY_CAPACITY, &err);
- if (!U_SUCCESS(err) || s_info.country_len <= 0) {
- ErrPrint("Failed to get locale: %s, %s, %d (%s)\n", u_errorName(err), s_info.iso3lang, s_info.country_len, s_info.country);
- free(s_info.syslang);
- s_info.syslang = NULL;
- return -EFAULT;
+ if (tmp_len) {
+ *tmp_len = abspath_len;
}
- return 0;
+ DbgPrint("Converted path: %s (%d)\n", abspath, abspath_len);
+out:
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ return abspath;
}
-EAPI char *livebox_service_preview(const char *pkgid, int size_type)
+static char *get_appid(sqlite3 *handle, const char *pkgid)
+{
+ sqlite3_stmt *stmt;
+ int ret;
+ char *appid = NULL;
+
+ ret = sqlite3_prepare_v2(handle, "SELECT appid FROM pkgmap WHERE pkgid = ?", -1, &stmt, NULL);
+ if (ret != SQLITE_OK) {
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_FAULT);
+ ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
+ return NULL;
+ }
+
+ ret = sqlite3_bind_text(stmt, 1, pkgid, -1, SQLITE_TRANSIENT);
+ if (ret != SQLITE_OK) {
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_FAULT);
+ ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
+ goto out;
+ }
+
+ ret = sqlite3_step(stmt);
+ if (ret == SQLITE_ROW) {
+ const char *tmp;
+
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_NONE);
+ tmp = (const char *)sqlite3_column_text(stmt, 0);
+ if (tmp && strlen(tmp)) {
+ appid = strdup(tmp);
+ if (!appid) {
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_OUT_OF_MEMORY);
+ }
+ }
+ } else if (ret == SQLITE_DONE) {
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_NOT_EXIST);
+ } else {
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_FAULT);
+ }
+
+out:
+ sqlite3_reset(stmt);
+ sqlite3_finalize(stmt);
+ return appid;
+}
+
+EAPI char *dynamicbox_service_preview(const char *pkgid, int size_type)
{
sqlite3_stmt *stmt;
sqlite3 *handle;
int ret;
char *preview = NULL;
const char *tmp;
+ char *appid;
int tmp_len;
int buf_len;
register int i;
int printed;
+ char *abspath;
handle = open_db();
if (!handle) {
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
return NULL;
}
ret = sqlite3_prepare_v2(handle, "SELECT preview FROM box_size WHERE pkgid = ? AND size_type = ?", -1, &stmt, NULL);
if (ret != SQLITE_OK) {
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_FAULT);
ErrPrint("Error: %s, %s\n", sqlite3_errmsg(handle), pkgid);
close_db(handle);
return NULL;
@@ -1434,18 +1647,25 @@ EAPI char *livebox_service_preview(const char *pkgid, int size_type)
ret = sqlite3_bind_text(stmt, 1, pkgid, -1, SQLITE_TRANSIENT);
if (ret != SQLITE_OK) {
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_FAULT);
ErrPrint("Error: %s, %s\n", sqlite3_errmsg(handle), pkgid);
goto out;
}
ret = sqlite3_bind_int(stmt, 2, size_type);
if (ret != SQLITE_OK) {
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_FAULT);
ErrPrint("Error: %s, %s\n", sqlite3_errmsg(handle), pkgid);
goto out;
}
ret = sqlite3_step(stmt);
if (ret != SQLITE_ROW) {
+ if (ret == SQLITE_DONE) {
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_NOT_EXIST);
+ } else {
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_FAULT);
+ }
ErrPrint("Error: %s, %s\n", sqlite3_errmsg(handle), pkgid);
goto out;
}
@@ -1456,8 +1676,20 @@ EAPI char *livebox_service_preview(const char *pkgid, int size_type)
goto out;
}
+ appid = get_appid(handle, pkgid);
+ abspath = convert_to_abspath(appid, tmp, RESOURCE_PATH, &tmp_len);
+ free(appid);
+ if (!abspath) {
+ abspath = strdup(tmp);
+ if (!abspath) {
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_OUT_OF_MEMORY);
+ ErrPrint("strdup: %s\n", strerror(errno));
+ goto out;
+ }
+ }
+
if (update_lang_info() != 0) {
- preview = strdup(tmp);
+ preview = abspath;
if (!preview) {
ErrPrint("Heap: %s\n", strerror(errno));
}
@@ -1467,15 +1699,17 @@ EAPI char *livebox_service_preview(const char *pkgid, int size_type)
buf_len = tmp_len + strlen(s_info.iso3lang) + s_info.country_len + 3; /* '/' '-' '/' */
preview = malloc(buf_len + 1);
if (!preview) {
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_OUT_OF_MEMORY);
ErrPrint("Heap: %s\n", strerror(errno));
+ free(abspath);
goto out;
}
- for (i = tmp_len; i >= 0 && tmp[i] != '/'; i--);
+ for (i = tmp_len; i >= 0 && abspath[i] != '/'; i--);
i++; /* Skip '/' */
- strncpy(preview, tmp, i);
- printed = snprintf(preview + i, buf_len - i, "%s-%s/%s", s_info.iso3lang, s_info.country, tmp + i);
+ strncpy(preview, abspath, i);
+ printed = snprintf(preview + i, buf_len - i, "%s-%s/%s", s_info.iso3lang, s_info.country, abspath + i);
if (preview[i + printed] != '\0') {
ErrPrint("Path is truncated\n");
preview[i + printed] = '\0';
@@ -1485,10 +1719,9 @@ EAPI char *livebox_service_preview(const char *pkgid, int size_type)
DbgPrint("Access failed: %s, %s\n", preview, strerror(errno));
free(preview);
- preview = strdup(tmp);
- if (!preview) {
- ErrPrint("Heap: %s\n", strerror(errno));
- }
+ preview = abspath;
+ } else {
+ free(abspath);
}
out:
@@ -1498,21 +1731,25 @@ out:
return preview;
}
-EAPI char *livebox_service_i18n_icon(const char *pkgid, const char *lang)
+EAPI char *dynamicbox_service_i18n_icon(const char *pkgid, const char *lang)
{
sqlite3_stmt *stmt;
sqlite3 *handle;
char *language;
char *icon = NULL;
+ char *appid;
int ret;
+ char *ret_icon;
if (!pkgid) {
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
return NULL;
}
if (lang) {
language = strdup(lang);
if (!language) {
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_OUT_OF_MEMORY);
ErrPrint("Heap: %s\n", strerror(errno));
return NULL;
}
@@ -1531,6 +1768,7 @@ EAPI char *livebox_service_i18n_icon(const char *pkgid, const char *lang)
ret = sqlite3_prepare_v2(handle, "SELECT icon FROM i18n WHERE pkgid = ? AND lang = ?", -1, &stmt, NULL);
if (ret != SQLITE_OK) {
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_FAULT);
ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
close_db(handle);
free(language);
@@ -1539,12 +1777,14 @@ EAPI char *livebox_service_i18n_icon(const char *pkgid, const char *lang)
ret = sqlite3_bind_text(stmt, 1, pkgid, -1, SQLITE_TRANSIENT);
if (ret != SQLITE_OK) {
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_FAULT);
ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
goto out;
}
ret = sqlite3_bind_text(stmt, 2, language, -1, SQLITE_TRANSIENT);
if (ret != SQLITE_OK) {
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_FAULT);
ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
goto out;
}
@@ -1558,6 +1798,7 @@ EAPI char *livebox_service_i18n_icon(const char *pkgid, const char *lang)
} else {
icon = strdup(tmp);
if (!icon) {
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_OUT_OF_MEMORY);
ErrPrint("Heap: %s\n", strerror(errno));
}
}
@@ -1565,6 +1806,14 @@ EAPI char *livebox_service_i18n_icon(const char *pkgid, const char *lang)
icon = get_default_icon(pkgid);
}
+ appid = get_appid(handle, pkgid);
+ ret_icon = convert_to_abspath(appid, icon, RESOURCE_PATH, NULL);
+ free(appid);
+ if (ret_icon) {
+ free(icon);
+ icon = ret_icon;
+ }
+
out:
sqlite3_reset(stmt);
sqlite3_finalize(stmt);
@@ -1573,7 +1822,7 @@ out:
return icon;
}
-EAPI char *livebox_service_i18n_name(const char *pkgid, const char *lang)
+EAPI char *dynamicbox_service_i18n_name(const char *pkgid, const char *lang)
{
sqlite3_stmt *stmt;
sqlite3 *handle;
@@ -1582,12 +1831,14 @@ EAPI char *livebox_service_i18n_name(const char *pkgid, const char *lang)
int ret;
if (!pkgid) {
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
return NULL;
}
if (lang) {
language = strdup(lang);
if (!language) {
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_OUT_OF_MEMORY);
ErrPrint("Error: %s\n", strerror(errno));
return NULL;
}
@@ -1606,6 +1857,7 @@ EAPI char *livebox_service_i18n_name(const char *pkgid, const char *lang)
ret = sqlite3_prepare_v2(handle, "SELECT name FROM i18n WHERE pkgid = ? AND lang = ?", -1, &stmt, NULL);
if (ret != SQLITE_OK) {
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_FAULT);
ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
close_db(handle);
free(language);
@@ -1614,12 +1866,14 @@ EAPI char *livebox_service_i18n_name(const char *pkgid, const char *lang)
ret = sqlite3_bind_text(stmt, 1, pkgid, -1, SQLITE_TRANSIENT);
if (ret != SQLITE_OK) {
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_FAULT);
ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
goto out;
}
ret = sqlite3_bind_text(stmt, 2, language, -1, SQLITE_TRANSIENT);
if (ret != SQLITE_OK) {
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_FAULT);
ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
goto out;
}
@@ -1633,6 +1887,7 @@ EAPI char *livebox_service_i18n_name(const char *pkgid, const char *lang)
} else {
name = strdup(tmp);
if (!name) {
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_OUT_OF_MEMORY);
ErrPrint("Heap: %s\n", strerror(errno));
}
}
@@ -1648,7 +1903,7 @@ out:
return name;
}
-EAPI int livebox_service_get_supported_sizes(const char *pkgid, int *cnt, int *w, int *h)
+EAPI int dynamicbox_service_get_supported_sizes(const char *pkgid, int *cnt, int *w, int *h)
{
sqlite3_stmt *stmt;
sqlite3 *handle;
@@ -1656,18 +1911,18 @@ EAPI int livebox_service_get_supported_sizes(const char *pkgid, int *cnt, int *w
int ret;
if (!w || !h || !cnt || !pkgid) {
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
handle = open_db();
if (!handle) {
- return LB_STATUS_ERROR_IO;
+ return DBOX_STATUS_ERROR_IO_ERROR;
}
ret = sqlite3_prepare_v2(handle, "SELECT size_type FROM box_size WHERE pkgid = ? ORDER BY size_type ASC", -1, &stmt, NULL);
if (ret != SQLITE_OK) {
ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
- ret = LB_STATUS_ERROR_IO;
+ ret = DBOX_STATUS_ERROR_IO_ERROR;
goto out;
}
@@ -1676,18 +1931,18 @@ EAPI int livebox_service_get_supported_sizes(const char *pkgid, int *cnt, int *w
ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
sqlite3_reset(stmt);
sqlite3_finalize(stmt);
- ret = LB_STATUS_ERROR_IO;
+ ret = DBOX_STATUS_ERROR_IO_ERROR;
goto out;
}
- if (*cnt > NR_OF_SIZE_LIST) {
- *cnt = NR_OF_SIZE_LIST;
+ if (*cnt > DBOX_NR_OF_SIZE_LIST) {
+ *cnt = DBOX_NR_OF_SIZE_LIST;
}
ret = 0;
while (sqlite3_step(stmt) == SQLITE_ROW && ret < *cnt) {
size = sqlite3_column_int(stmt, 0);
- ret += (convert_size_from_type(size, w + ret, h + ret) == 0);
+ ret += (convert_size_from_type((dynamicbox_size_type_e)size, w + ret, h + ret) == 0);
}
*cnt = ret;
@@ -1699,7 +1954,7 @@ out:
return ret;
}
-EAPI char *livebox_service_abi(const char *lbid)
+EAPI char *dynamicbox_service_abi(const char *dboxid)
{
sqlite3_stmt *stmt;
sqlite3 *handle;
@@ -1707,8 +1962,9 @@ EAPI char *livebox_service_abi(const char *lbid)
char *abi;
char *tmp;
- if (!lbid) {
+ if (!dboxid) {
ErrPrint("Invalid argument\n");
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
return NULL;
}
@@ -1720,12 +1976,14 @@ EAPI char *livebox_service_abi(const char *lbid)
ret = sqlite3_prepare_v2(handle, "SELECT abi FROM provider WHERE pkgid = ?", -1, &stmt, NULL);
if (ret != SQLITE_OK) {
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_FAULT);
ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
goto out;
}
- ret = sqlite3_bind_text(stmt, 1, lbid, -1, SQLITE_TRANSIENT);
+ ret = sqlite3_bind_text(stmt, 1, dboxid, -1, SQLITE_TRANSIENT);
if (ret != SQLITE_OK) {
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_FAULT);
ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
sqlite3_finalize(stmt);
goto out;
@@ -1733,6 +1991,12 @@ EAPI char *livebox_service_abi(const char *lbid)
ret = sqlite3_step(stmt);
if (ret != SQLITE_ROW) {
+ if (ret == SQLITE_DONE) {
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_NOT_EXIST);
+ } else {
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_FAULT);
+ }
+
ErrPrint("Error: %s (%d)\n", sqlite3_errmsg(handle), ret);
sqlite3_reset(stmt);
sqlite3_finalize(stmt);
@@ -1741,6 +2005,7 @@ EAPI char *livebox_service_abi(const char *lbid)
tmp = (char *)sqlite3_column_text(stmt, 0);
if (!tmp || !strlen(tmp)) {
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_NOT_EXIST);
ErrPrint("Invalid abi: %s\n", sqlite3_errmsg(handle));
sqlite3_reset(stmt);
sqlite3_finalize(stmt);
@@ -1749,6 +2014,7 @@ EAPI char *livebox_service_abi(const char *lbid)
abi = strdup(tmp);
if (!abi) {
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_OUT_OF_MEMORY);
ErrPrint("strdup: %s\n", strerror(errno));
sqlite3_reset(stmt);
sqlite3_finalize(stmt);
@@ -1757,6 +2023,7 @@ EAPI char *livebox_service_abi(const char *lbid)
DbgPrint("abi: %s\n", abi);
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_NONE);
sqlite3_reset(stmt);
sqlite3_finalize(stmt);
out:
@@ -1764,7 +2031,7 @@ out:
return abi;
}
-EAPI char *livebox_service_pkgname_by_libexec(const char *libexec)
+EAPI char *dynamicbox_service_dbox_id_by_libexec(const char *libexec)
{
sqlite3_stmt *stmt;
sqlite3 *handle;
@@ -1776,6 +2043,7 @@ EAPI char *livebox_service_pkgname_by_libexec(const char *libexec)
if (!libexec) {
ErrPrint("Invalid argument\n");
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
return NULL;
}
@@ -1789,6 +2057,7 @@ EAPI char *livebox_service_pkgname_by_libexec(const char *libexec)
_libexec = malloc(len);
if (!_libexec) {
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_OUT_OF_MEMORY);
ErrPrint("Heap: %s\n", strerror(errno));
close_db(handle);
return NULL;
@@ -1798,24 +2067,33 @@ EAPI char *livebox_service_pkgname_by_libexec(const char *libexec)
ret = sqlite3_prepare_v2(handle, "SELECT pkgid FROM provider WHERE libexec like ?", -1, &stmt, NULL);
if (ret != SQLITE_OK) {
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_FAULT);
ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
goto out;
}
ret = sqlite3_bind_text(stmt, 1, _libexec, -1, SQLITE_TRANSIENT);
if (ret != SQLITE_OK) {
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_FAULT);
ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
sqlite3_finalize(stmt);
goto out;
}
- if (sqlite3_step(stmt) != SQLITE_ROW) {
+ ret = sqlite3_step(stmt);
+ if (ret != SQLITE_ROW) {
+ if (ret == SQLITE_DONE) {
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_NOT_EXIST);
+ } else {
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_FAULT);
+ }
ErrPrint("No records (%s) for (%s)\n", sqlite3_errmsg(handle), libexec);
sqlite3_reset(stmt);
sqlite3_finalize(stmt);
goto out;
}
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_NONE);
tmp = (char *)sqlite3_column_text(stmt, 0);
if (!tmp || !strlen(tmp)) {
ErrPrint("Invalid pkgid: %s\n", sqlite3_errmsg(handle));
@@ -1826,6 +2104,7 @@ EAPI char *livebox_service_pkgname_by_libexec(const char *libexec)
pkgid = strdup(tmp);
if (!pkgid) {
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_OUT_OF_MEMORY);
ErrPrint("Heap: %s\n", strerror(errno));
}
@@ -1839,7 +2118,7 @@ out:
return pkgid;
}
-EAPI char *livebox_service_libexec(const char *pkgid)
+EAPI char *dynamicbox_service_libexec(const char *pkgid)
{
sqlite3_stmt *stmt;
sqlite3 *handle;
@@ -1850,6 +2129,7 @@ EAPI char *livebox_service_libexec(const char *pkgid)
if (!pkgid) {
ErrPrint("Invalid argument\n");
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
return NULL;
}
@@ -1861,12 +2141,14 @@ EAPI char *livebox_service_libexec(const char *pkgid)
ret = sqlite3_prepare_v2(handle, "SELECT pkgmap.appid, provider.libexec FROM pkgmap, provider WHERE pkgmap.pkgid = ? AND provider.pkgid = ?", -1, &stmt, NULL);
if (ret != SQLITE_OK) {
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_FAULT);
ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
goto out;
}
ret = sqlite3_bind_text(stmt, 1, pkgid, -1, SQLITE_TRANSIENT);
if (ret != SQLITE_OK) {
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_FAULT);
ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
sqlite3_finalize(stmt);
goto out;
@@ -1874,21 +2156,27 @@ EAPI char *livebox_service_libexec(const char *pkgid)
ret = sqlite3_bind_text(stmt, 2, pkgid, -1, SQLITE_TRANSIENT);
if (ret != SQLITE_OK) {
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_FAULT);
ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
sqlite3_finalize(stmt);
goto out;
}
- if (sqlite3_step(stmt) != SQLITE_ROW) {
+ ret = sqlite3_step(stmt);
+ if (ret != SQLITE_ROW) {
+ if (ret == SQLITE_DONE) {
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_NOT_EXIST);
+ } else {
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_FAULT);
+ }
+
ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
sqlite3_reset(stmt);
sqlite3_finalize(stmt);
-
- libexec = util_conf_get_libexec(pkgid);
- DbgPrint("Fallback to conf checker: %s\n", libexec);
goto out;
}
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_NONE);
appid = (char *)sqlite3_column_text(stmt, 0);
if (!appid || !strlen(appid)) {
ErrPrint("Invalid appid: %s\n", sqlite3_errmsg(handle));
@@ -1905,12 +2193,13 @@ EAPI char *livebox_service_libexec(const char *pkgid)
goto out;
}
- libexec = strdup(path);
+ libexec = convert_to_abspath(appid, path, LIBEXEC_PATH, NULL);
if (!libexec) {
- ErrPrint("Heap: %s\n", strerror(errno));
- sqlite3_reset(stmt);
- sqlite3_finalize(stmt);
- goto out;
+ libexec = strdup(path);
+ if (!libexec) {
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_OUT_OF_MEMORY);
+ ErrPrint("Heap: %s\n", strerror(errno));
+ }
}
DbgPrint("libexec: %s\n", libexec);
@@ -1922,78 +2211,201 @@ out:
return libexec;
}
-EAPI char *livebox_service_pkgname(const char *appid)
+EAPI char *dynamicbox_service_dbox_id(const char *appid)
{
- char *lb_pkgname;
- pkgmgr_appinfo_h handle;
+ char *dbox_pkgname;
+ pkgmgrinfo_appinfo_h handle;
int ret;
char *new_appid;
if (!appid) {
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
return NULL;
}
- lb_pkgname = get_lb_pkgname_by_appid(appid);
- if (lb_pkgname) {
- return lb_pkgname;
+ dbox_pkgname = get_dbox_pkgname_by_appid(appid);
+ if (dbox_pkgname) {
+ return dbox_pkgname;
}
/*!
* \note
* Try to get the package id using given appid
*/
- ret = pkgmgr_appinfo_get_appinfo(appid, &handle);
+ ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
if (ret != PKGMGR_R_OK) {
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_FAULT);
ErrPrint("Failed to get appinfo\n");
return NULL;
}
- ret = pkgmgr_appinfo_get_pkgname(handle, &new_appid);
+ ret = pkgmgrinfo_appinfo_get_pkgid(handle, &new_appid);
if (ret != PKGMGR_R_OK) {
- pkgmgr_appinfo_destroy_appinfo(handle);
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_FAULT);
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
ErrPrint("Failed to get pkgname for (%s)\n", appid);
return NULL;
}
- lb_pkgname = get_lb_pkgname_by_appid(new_appid);
- pkgmgr_appinfo_destroy_appinfo(handle);
+ dbox_pkgname = get_dbox_pkgname_by_appid(new_appid);
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+
+ if (!dbox_pkgname) {
+ dbox_pkgname = strdup(appid);
+ if (!dbox_pkgname) {
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_OUT_OF_MEMORY);
+ }
+ }
+
+ return dbox_pkgname;
+}
+
+EAPI char *dynamicbox_service_package_id(const char *pkgname)
+{
+ sqlite3_stmt *stmt;
+ char *appid;
+ char *tmp;
+ sqlite3 *handle;
+ int is_prime __attribute__((__unused__));
+ int ret;
+
+ if (!pkgname) {
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
+ return NULL;
+ }
+
+ appid = NULL;
+ handle = open_db();
+ if (!handle) {
+ return NULL;
+ }
+
+ ret = sqlite3_prepare_v2(handle, "SELECT appid, prime FROM pkgmap WHERE pkgid = ? OR appid = ?", -1, &stmt, NULL);
+ if (ret != SQLITE_OK) {
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_FAULT);
+ ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
+ goto out;
+ }
+
+ ret = sqlite3_bind_text(stmt, 1, pkgname, -1, SQLITE_TRANSIENT);
+ if (ret != SQLITE_OK) {
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_FAULT);
+ ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
+ sqlite3_reset(stmt);
+ sqlite3_finalize(stmt);
+ goto out;
+ }
+
+ ret = sqlite3_bind_text(stmt, 2, pkgname, -1, SQLITE_TRANSIENT);
+ if (ret != SQLITE_OK) {
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_FAULT);
+ ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
+ sqlite3_reset(stmt);
+ sqlite3_finalize(stmt);
+ goto out;
+ }
+
+ ret = sqlite3_step(stmt);
+ if (ret != SQLITE_ROW) {
+ pkgmgrinfo_appinfo_h pkg_handle;
+ char *new_appid;
- if (!lb_pkgname && util_validate_livebox_package(appid) == 0) {
- return strdup(appid);
+ if (ret == SQLITE_DONE) {
+ ErrPrint("No records: %s\n", sqlite3_errmsg(handle));
+ } else {
+ ErrPrint("Failed to get record: %s\n", sqlite3_errmsg(handle));
+ }
+ sqlite3_reset(stmt);
+ sqlite3_finalize(stmt);
+
+ ret = pkgmgrinfo_appinfo_get_appinfo(pkgname, &pkg_handle);
+ if (ret != PKGMGR_R_OK) {
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_FAULT);
+ ErrPrint("Failed to get appinfo: %s\n", pkgname);
+ goto out;
+ }
+
+ ret = pkgmgrinfo_appinfo_get_pkgid(pkg_handle, &new_appid);
+ if (ret != PKGMGR_R_OK) {
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_FAULT);
+ ErrPrint("Failed to get pkgname for (%s)\n", appid);
+ pkgmgrinfo_appinfo_destroy_appinfo(pkg_handle);
+ goto out;
+ }
+
+ appid = strdup(new_appid);
+ if (!appid) {
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_OUT_OF_MEMORY);
+ ErrPrint("Heap: %s\n", strerror(errno));
+ }
+
+ pkgmgrinfo_appinfo_destroy_appinfo(pkg_handle);
+ goto out;
+ }
+
+ tmp = (char *)sqlite3_column_text(stmt, 0);
+ if (!tmp || !strlen(tmp)) {
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_NONE);
+ ErrPrint("APPID is NIL\n");
+ sqlite3_reset(stmt);
+ sqlite3_finalize(stmt);
+ goto out;
+ }
+
+ appid = strdup(tmp);
+ if (!appid) {
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_OUT_OF_MEMORY);
+ ErrPrint("Heap: %s\n", strerror(errno));
+ sqlite3_reset(stmt);
+ sqlite3_finalize(stmt);
+ goto out;
}
- return lb_pkgname;
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_NONE);
+ is_prime = sqlite3_column_int(stmt, 1);
+
+ sqlite3_reset(stmt);
+ sqlite3_finalize(stmt);
+out:
+ close_db(handle);
+ return appid;
}
-EAPI char *livebox_service_provider_name(const char *lbid)
+EAPI char *dynamicbox_service_provider_name(const char *dboxid)
{
char *ret;
int stage = 0;
int seq = 0;
int idx = 0;
- char *str = SAMSUNG_PREFIX;
+ char *str = DBOX_ID_PREFIX;
- if (!lbid) {
+ if (!dboxid) {
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
return NULL;
}
- while (str[idx] && lbid[idx] && lbid[idx] == str[idx]) {
+ while (str[idx] && dboxid[idx] && dboxid[idx] == str[idx]) {
idx++;
- if (seq < 2 && lbid[idx] == '.') {
+ if (seq < 2 && dboxid[idx] == '.') {
stage = idx;
seq++;
}
}
- if (!str[idx] && lbid[idx]) {
+ if (!str[idx] && dboxid[idx]) {
+ ret = strdup(dboxid);
/* Inhouse */
- return strdup(lbid);
+ if (!ret) {
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_OUT_OF_MEMORY);
+ }
+ return ret;
} else if (seq < 2) {
while (seq < 2) {
- if (lbid[idx] == '.') {
+ if (dboxid[idx] == '.') {
seq++;
- } else if (!lbid[idx]) {
- ErrPrint("Invalid lbid: %s\n", lbid);
+ } else if (!dboxid[idx]) {
+ ErrPrint("Invalid dboxid: %s\n", dboxid);
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
return NULL;
}
@@ -2005,50 +2417,53 @@ EAPI char *livebox_service_provider_name(const char *lbid)
stage++;
}
- ret = strdup(lbid + stage);
+ ret = strdup(dboxid + stage);
if (!ret) {
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_OUT_OF_MEMORY);
ErrPrint("Error: %s\n", strerror(errno));
return NULL;
}
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_NONE);
return ret;
}
-EAPI int livebox_service_is_enabled(const char *lbid)
+EAPI int dynamicbox_service_is_enabled(const char *dboxid)
{
return 1;
/*
- ail_appinfo_h ai;
- char *pkgname;
- bool enabled;
- int ret;
-
- pkgname = livebox_service_appid(lbid);
- if (!pkgname)
- return 0;
-
- ret = ail_get_appinfo(pkgname, &ai);
- if (ret != AIL_ERROR_OK) {
- free(pkgname);
- return 0;
- }
-
- if (ail_appinfo_get_bool(ai, AIL_PROP_X_SLP_ENABLED_BOOL, &enabled) != AIL_ERROR_OK)
- enabled = false;
-
- ail_destroy_appinfo(ai);
- free(pkgname);
- return enabled == true;
- */
+ ail_appinfo_h ai;
+ char *pkgname;
+ bool enabled;
+ int ret;
+
+ pkgname = dynamicbox_service_package_id(dboxid);
+ if (!pkgname)
+ return 0;
+
+ ret = ail_get_appinfo(pkgname, &ai);
+ if (ret != AIL_ERROR_OK) {
+ free(pkgname);
+ return 0;
+ }
+
+ if (ail_appinfo_get_bool(ai, AIL_PROP_X_SLP_ENABLED_BOOL, &enabled) != AIL_ERROR_OK)
+ enabled = false;
+
+ ail_destroy_appinfo(ai);
+ free(pkgname);
+ return enabled == true;
+ */
}
-EAPI int livebox_service_is_primary(const char *lbid)
+EAPI int dynamicbox_service_is_primary(const char *dboxid)
{
sqlite3_stmt *stmt;
sqlite3 *handle;
int ret = 0;
- if (!lbid) {
+ if (!dboxid) {
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
return 0;
}
@@ -2059,24 +2474,32 @@ EAPI int livebox_service_is_primary(const char *lbid)
ret = sqlite3_prepare_v2(handle, "SELECT prime FROM pkgmap WHERE pkgid = ?", -1, &stmt, NULL);
if (ret != SQLITE_OK) {
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_FAULT);
ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
close_db(handle);
return 0;
}
- ret = sqlite3_bind_text(stmt, 1, lbid, -1, SQLITE_TRANSIENT);
+ ret = sqlite3_bind_text(stmt, 1, dboxid, -1, SQLITE_TRANSIENT);
if (ret != SQLITE_OK) {
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_FAULT);
ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
goto out;
}
ret = sqlite3_step(stmt);
if (ret != SQLITE_ROW) {
+ if (ret == SQLITE_DONE) {
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_NOT_EXIST);
+ } else {
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_FAULT);
+ }
ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
goto out;
}
ret = sqlite3_column_int(stmt, 0);
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_NONE);
out:
sqlite3_reset(stmt);
@@ -2085,7 +2508,7 @@ out:
return ret;
}
-EAPI char *livebox_service_category(const char *lbid)
+EAPI char *dynamicbox_service_category(const char *dboxid)
{
sqlite3_stmt *stmt;
char *category = NULL;
@@ -2093,7 +2516,8 @@ EAPI char *livebox_service_category(const char *lbid)
sqlite3 *handle;
int ret;
- if (!lbid) {
+ if (!dboxid) {
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
return NULL;
}
@@ -2105,20 +2529,23 @@ EAPI char *livebox_service_category(const char *lbid)
ret = sqlite3_prepare_v2(handle, "SELECT category FROM pkgmap WHERE pkgid = ? OR appid = ?", -1, &stmt, NULL);
if (ret != SQLITE_OK) {
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_FAULT);
ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
goto out;
}
- ret = sqlite3_bind_text(stmt, 1, lbid, -1, SQLITE_TRANSIENT);
+ ret = sqlite3_bind_text(stmt, 1, dboxid, -1, SQLITE_TRANSIENT);
if (ret != SQLITE_OK) {
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_FAULT);
ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
sqlite3_reset(stmt);
sqlite3_finalize(stmt);
goto out;
}
- ret = sqlite3_bind_text(stmt, 2, lbid, -1, SQLITE_TRANSIENT);
+ ret = sqlite3_bind_text(stmt, 2, dboxid, -1, SQLITE_TRANSIENT);
if (ret != SQLITE_OK) {
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_FAULT);
ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
sqlite3_reset(stmt);
sqlite3_finalize(stmt);
@@ -2127,12 +2554,19 @@ EAPI char *livebox_service_category(const char *lbid)
ret = sqlite3_step(stmt);
if (ret != SQLITE_ROW) {
- ErrPrint("Has no record?: %s\n", sqlite3_errmsg(handle));
+ if (ret == SQLITE_DONE) {
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_NOT_EXIST);
+ ErrPrint("Has no record?: %s\n", sqlite3_errmsg(handle));
+ } else {
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_FAULT);
+ ErrPrint("Failed to retrieve record set: %s\n", sqlite3_errmsg(handle));
+ }
sqlite3_reset(stmt);
sqlite3_finalize(stmt);
goto out;
}
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_NONE);
tmp = (char *)sqlite3_column_text(stmt, 0);
if (!tmp || !strlen(tmp)) {
ErrPrint("APPID is NIL\n");
@@ -2143,6 +2577,7 @@ EAPI char *livebox_service_category(const char *lbid)
category = strdup(tmp);
if (!category) {
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_OUT_OF_MEMORY);
ErrPrint("Heap: %s\n", strerror(errno));
sqlite3_reset(stmt);
sqlite3_finalize(stmt);
@@ -2156,113 +2591,17 @@ out:
return category;
}
-EAPI char *livebox_service_appid(const char *pkgname)
-{
- sqlite3_stmt *stmt;
- char *appid;
- char *tmp;
- sqlite3 *handle;
- int is_prime __attribute__((__unused__));
- int ret;
-
- if (!pkgname) {
- return NULL;
- }
-
- appid = NULL;
- handle = open_db();
- if (!handle) {
- return NULL;
- }
-
- ret = sqlite3_prepare_v2(handle, "SELECT appid, prime FROM pkgmap WHERE pkgid = ? OR appid = ?", -1, &stmt, NULL);
- if (ret != SQLITE_OK) {
- ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
- goto out;
- }
-
- ret = sqlite3_bind_text(stmt, 1, pkgname, -1, SQLITE_TRANSIENT);
- if (ret != SQLITE_OK) {
- ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
- sqlite3_reset(stmt);
- sqlite3_finalize(stmt);
- goto out;
- }
-
- ret = sqlite3_bind_text(stmt, 2, pkgname, -1, SQLITE_TRANSIENT);
- if (ret != SQLITE_OK) {
- ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
- sqlite3_reset(stmt);
- sqlite3_finalize(stmt);
- goto out;
- }
-
- ret = sqlite3_step(stmt);
- if (ret != SQLITE_ROW) {
- pkgmgr_appinfo_h pkg_handle;
- char *new_appid;
-
- ErrPrint("Has no record?: %s\n", sqlite3_errmsg(handle));
- sqlite3_reset(stmt);
- sqlite3_finalize(stmt);
-
- ret = pkgmgr_appinfo_get_appinfo(pkgname, &pkg_handle);
- if (ret != PKGMGR_R_OK) {
- ErrPrint("Failed to get appinfo: %s\n", pkgname);
- goto out;
- }
-
- ret = pkgmgr_appinfo_get_pkgname(pkg_handle, &new_appid);
- if (ret != PKGMGR_R_OK) {
- ErrPrint("Failed to get pkgname for (%s)\n", appid);
- pkgmgr_appinfo_destroy_appinfo(pkg_handle);
- goto out;
- }
-
- appid = strdup(new_appid);
- if (!appid) {
- ErrPrint("Heap: %s\n", strerror(errno));
- }
-
- pkgmgr_appinfo_destroy_appinfo(pkg_handle);
- goto out;
- }
-
- tmp = (char *)sqlite3_column_text(stmt, 0);
- if (!tmp || !strlen(tmp)) {
- ErrPrint("APPID is NIL\n");
- sqlite3_reset(stmt);
- sqlite3_finalize(stmt);
- goto out;
- }
-
- appid = strdup(tmp);
- if (!appid) {
- ErrPrint("Heap: %s\n", strerror(errno));
- sqlite3_reset(stmt);
- sqlite3_finalize(stmt);
- goto out;
- }
-
- is_prime = sqlite3_column_int(stmt, 1);
-
- sqlite3_reset(stmt);
- sqlite3_finalize(stmt);
-out:
- close_db(handle);
- return appid;
-}
-
-EAPI char *livebox_service_lb_script_path(const char *pkgid)
+EAPI char *dynamicbox_service_dbox_script_path(const char *pkgid)
{
sqlite3_stmt *stmt;
sqlite3 *handle;
int ret;
char *path;
char *appid;
- char *lb_src;
+ char *dbox_src;
if (!pkgid) {
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
return NULL;
}
@@ -2274,12 +2613,14 @@ EAPI char *livebox_service_lb_script_path(const char *pkgid)
ret = sqlite3_prepare_v2(handle, "SELECT pkgmap.appid, provider.box_src FROM provider, pkgmap WHERE pkgmap.pkgid = ? AND provider.pkgid = ?", -1, &stmt, NULL);
if (ret != SQLITE_OK) {
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_FAULT);
ErrPrint("Error: %s, pkgid(%s), ret(%d)\n", sqlite3_errmsg(handle), pkgid, ret);
goto out;
}
ret = sqlite3_bind_text(stmt, 1, pkgid, -1, SQLITE_TRANSIENT);
if (ret != SQLITE_OK) {
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_FAULT);
ErrPrint("Error: %s, pkgid(%s), ret(%d)\n", sqlite3_errmsg(handle), pkgid, ret);
sqlite3_finalize(stmt);
goto out;
@@ -2287,6 +2628,7 @@ EAPI char *livebox_service_lb_script_path(const char *pkgid)
ret = sqlite3_bind_text(stmt, 2, pkgid, -1, SQLITE_TRANSIENT);
if (ret != SQLITE_OK) {
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_FAULT);
ErrPrint("Error: %s, pkgid(%s), ret(%d)\n", sqlite3_errmsg(handle), pkgid, ret);
sqlite3_finalize(stmt);
goto out;
@@ -2294,6 +2636,11 @@ EAPI char *livebox_service_lb_script_path(const char *pkgid)
ret = sqlite3_step(stmt);
if (ret != SQLITE_ROW) {
+ if (ret == SQLITE_DONE) {
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_NOT_EXIST);
+ } else {
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_FAULT);
+ }
ErrPrint("Error: %s, pkgid(%s), ret(%d)\n", sqlite3_errmsg(handle), pkgid, ret);
sqlite3_reset(stmt);
sqlite3_finalize(stmt);
@@ -2302,29 +2649,31 @@ EAPI char *livebox_service_lb_script_path(const char *pkgid)
appid = (char *)sqlite3_column_text(stmt, 0);
if (!appid || !strlen(appid)) {
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_NONE);
ErrPrint("Invalid appid : %s, pkgid(%s)\n", sqlite3_errmsg(handle), pkgid);
sqlite3_reset(stmt);
sqlite3_finalize(stmt);
goto out;
}
- lb_src = (char *)sqlite3_column_text(stmt, 1);
- if (!lb_src || !strlen(lb_src)) {
- ErrPrint("No records for lb src : %s, pkgid(%s), appid(%s)\n", sqlite3_errmsg(handle), pkgid, appid);
+ dbox_src = (char *)sqlite3_column_text(stmt, 1);
+ if (!dbox_src || !strlen(dbox_src)) {
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_NONE);
+ ErrPrint("No records for dbox src : %s, pkgid(%s), appid(%s)\n", sqlite3_errmsg(handle), pkgid, appid);
sqlite3_reset(stmt);
sqlite3_finalize(stmt);
goto out;
}
- path = strdup(lb_src);
+ path = convert_to_abspath(appid, dbox_src, RESOURCE_PATH, NULL);
if (!path) {
- ErrPrint("Heap: %s\n", strerror(errno));
- sqlite3_reset(stmt);
- sqlite3_finalize(stmt);
- goto out;
+ path = strdup(dbox_src);
+ if (!path) {
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_OUT_OF_MEMORY);
+ }
}
- DbgPrint("LB Src: %s\n", path);
+ DbgPrint("DBOX Src: %s\n", path);
sqlite3_reset(stmt);
sqlite3_finalize(stmt);
out:
@@ -2332,7 +2681,7 @@ out:
return path;
}
-EAPI char *livebox_service_lb_script_group(const char *pkgid)
+EAPI char *dynamicbox_service_dbox_script_group(const char *pkgid)
{
sqlite3_stmt *stmt;
sqlite3 *handle;
@@ -2341,6 +2690,7 @@ EAPI char *livebox_service_lb_script_group(const char *pkgid)
char *tmp;
if (!pkgid) {
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
return NULL;
}
@@ -2352,12 +2702,14 @@ EAPI char *livebox_service_lb_script_group(const char *pkgid)
ret = sqlite3_prepare_v2(handle, "SELECT box_group FROM provider WHERE pkgid = ?", -1, &stmt, NULL);
if (ret != SQLITE_OK) {
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_FAULT);
ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
goto out;
}
ret = sqlite3_bind_text(stmt, 1, pkgid, -1, SQLITE_TRANSIENT);
if (ret != SQLITE_OK) {
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_FAULT);
ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
sqlite3_finalize(stmt);
goto out;
@@ -2365,16 +2717,23 @@ EAPI char *livebox_service_lb_script_group(const char *pkgid)
ret = sqlite3_step(stmt);
if (ret != SQLITE_ROW) {
+ if (ret == SQLITE_DONE) {
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_NOT_EXIST);
+ } else {
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_FAULT);
+ }
ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
sqlite3_reset(stmt);
sqlite3_finalize(stmt);
goto out;
}
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_NONE);
tmp = (char *)sqlite3_column_text(stmt, 0);
if (tmp && strlen(tmp)) {
group = strdup(tmp);
if (!group) {
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_OUT_OF_MEMORY);
ErrPrint("Heap: %s\n", strerror(errno));
}
}
@@ -2386,16 +2745,17 @@ out:
return group;
}
-EAPI char *livebox_service_pd_script_path(const char *pkgid)
+EAPI char *dynamicbox_service_gbar_script_path(const char *pkgid)
{
sqlite3_stmt *stmt;
sqlite3 *handle;
int ret;
char *path;
- char *pd_src;
+ char *gbar_src;
const char *appid;
if (!pkgid) {
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
return NULL;
}
@@ -2407,12 +2767,14 @@ EAPI char *livebox_service_pd_script_path(const char *pkgid)
ret = sqlite3_prepare_v2(handle, "SELECT pkgmap.appid, provider.pd_src FROM provider, pkgmap WHERE provider.pkgid = ? AND pkgmap.pkgid = ?", -1, &stmt, NULL);
if (ret != SQLITE_OK) {
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_FAULT);
ErrPrint("Error: %s pkgid(%s) ret(%d)\n", sqlite3_errmsg(handle), pkgid, ret);
goto out;
}
ret = sqlite3_bind_text(stmt, 1, pkgid, -1, SQLITE_TRANSIENT);
if (ret != SQLITE_OK) {
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_FAULT);
ErrPrint("Error: %s pkgid(%s) ret(%d)\n", sqlite3_errmsg(handle), pkgid, ret);
sqlite3_finalize(stmt);
goto out;
@@ -2420,6 +2782,7 @@ EAPI char *livebox_service_pd_script_path(const char *pkgid)
ret = sqlite3_bind_text(stmt, 2, pkgid, -1, SQLITE_TRANSIENT);
if (ret != SQLITE_OK) {
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_FAULT);
ErrPrint("Error: %s pkgid(%s) ret(%d)\n", sqlite3_errmsg(handle), pkgid, ret);
sqlite3_finalize(stmt);
goto out;
@@ -2427,12 +2790,19 @@ EAPI char *livebox_service_pd_script_path(const char *pkgid)
ret = sqlite3_step(stmt);
if (ret != SQLITE_ROW) {
+ if (ret == SQLITE_DONE) {
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_NOT_EXIST);
+ } else {
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_FAULT);
+ }
ErrPrint("Error: %s pkgid(%s) ret(%d)\n", sqlite3_errmsg(handle), pkgid, ret);
sqlite3_reset(stmt);
sqlite3_finalize(stmt);
goto out;
}
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_NONE);
+
appid = (char *)sqlite3_column_text(stmt, 0);
if (!appid || !strlen(appid)) {
ErrPrint("Error: %s pkgid(%s)\n", sqlite3_errmsg(handle), pkgid);
@@ -2441,23 +2811,24 @@ EAPI char *livebox_service_pd_script_path(const char *pkgid)
goto out;
}
- pd_src = (char *)sqlite3_column_text(stmt, 1);
- if (!pd_src || !strlen(pd_src)) {
+ gbar_src = (char *)sqlite3_column_text(stmt, 1);
+ if (!gbar_src || !strlen(gbar_src)) {
ErrPrint("Error: %s pkgid(%s) appid(%s)\n", sqlite3_errmsg(handle), pkgid, appid);
sqlite3_reset(stmt);
sqlite3_finalize(stmt);
goto out;
}
- path = strdup(pd_src);
+ path = convert_to_abspath(appid, gbar_src, RESOURCE_PATH, NULL);
if (!path) {
- ErrPrint("Heap: %s\n", strerror(errno));
- sqlite3_reset(stmt);
- sqlite3_finalize(stmt);
- goto out;
+ path = strdup(gbar_src);
+ if (!path) {
+ ErrPrint("Heap: %s\n", strerror(errno));
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_OUT_OF_MEMORY);
+ }
}
- DbgPrint("PD Src: %s\n", path);
+ DbgPrint("GBAR Src: %s\n", path);
sqlite3_reset(stmt);
sqlite3_finalize(stmt);
out:
@@ -2465,7 +2836,7 @@ out:
return path;
}
-EAPI char *livebox_service_pd_script_group(const char *pkgid)
+EAPI char *dynamicbox_service_gbar_script_group(const char *pkgid)
{
sqlite3_stmt *stmt;
sqlite3 *handle;
@@ -2474,6 +2845,7 @@ EAPI char *livebox_service_pd_script_group(const char *pkgid)
char *tmp;
if (!pkgid) {
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
return NULL;
}
@@ -2485,12 +2857,14 @@ EAPI char *livebox_service_pd_script_group(const char *pkgid)
ret = sqlite3_prepare_v2(handle, "SELECT pd_group FROM provider WHERE pkgid = ?", -1, &stmt, NULL);
if (ret != SQLITE_OK) {
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_FAULT);
ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
goto out;
}
ret = sqlite3_bind_text(stmt, 1, pkgid, -1, SQLITE_TRANSIENT);
if (ret != SQLITE_OK) {
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_FAULT);
ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
sqlite3_finalize(stmt);
goto out;
@@ -2498,17 +2872,20 @@ EAPI char *livebox_service_pd_script_group(const char *pkgid)
ret = sqlite3_step(stmt);
if (ret != SQLITE_ROW) {
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_FAULT);
ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
sqlite3_reset(stmt);
sqlite3_finalize(stmt);
goto out;
}
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_NONE);
tmp = (char *)sqlite3_column_text(stmt, 0);
if (tmp && strlen(tmp)) {
group = strdup(tmp);
if (!group) {
ErrPrint("Heap: %s\n", strerror(errno));
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_OUT_OF_MEMORY);
}
}
sqlite3_reset(stmt);
@@ -2518,7 +2895,7 @@ out:
return group;
}
-EAPI int livebox_service_enumerate_cluster_list(int (*cb)(const char *cluster, void *data), void *data)
+EAPI int dynamicbox_service_enumerate_cluster_list(int (*cb)(const char *cluster, void *data), void *data)
{
sqlite3_stmt *stmt;
sqlite3 *handle;
@@ -2527,19 +2904,19 @@ EAPI int livebox_service_enumerate_cluster_list(int (*cb)(const char *cluster, v
int ret;
if (!cb) {
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
handle = open_db();
if (!handle) {
- return LB_STATUS_ERROR_IO;
+ return DBOX_STATUS_ERROR_IO_ERROR;
}
cnt = 0;
ret = sqlite3_prepare_v2(handle, "SELECT DISTINCT cluster FROM groupinfo", -1, &stmt, NULL);
if (ret != SQLITE_OK) {
ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
- cnt = LB_STATUS_ERROR_IO;
+ cnt = DBOX_STATUS_ERROR_IO_ERROR;
goto out;
}
@@ -2563,7 +2940,7 @@ out:
return cnt;
}
-EAPI int livebox_service_enumerate_category_list(const char *cluster, int (*cb)(const char *cluster, const char *category, void *data), void *data)
+EAPI int dynamicbox_service_enumerate_category_list(const char *cluster, int (*cb)(const char *cluster, const char *category, void *data), void *data)
{
sqlite3_stmt *stmt;
sqlite3 *handle;
@@ -2572,18 +2949,18 @@ EAPI int livebox_service_enumerate_category_list(const char *cluster, int (*cb)(
int ret;
if (!cluster || !cb) {
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
handle = open_db();
if (!handle) {
- return LB_STATUS_ERROR_IO;
+ return DBOX_STATUS_ERROR_IO_ERROR;
}
ret = sqlite3_prepare_v2(handle, "SELECT DISTINCT category FROM groupinfo WHERE cluster = ?", -1, &stmt, NULL);
if (ret != SQLITE_OK) {
ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
- cnt = LB_STATUS_ERROR_IO;
+ cnt = DBOX_STATUS_ERROR_IO_ERROR;
goto out;
}
@@ -2608,42 +2985,42 @@ out:
return cnt;
}
-EAPI int livebox_service_init(void)
+EAPI int dynamicbox_service_init(void)
{
if (s_info.handle) {
DbgPrint("Already initialized\n");
s_info.init_count++;
- return 0;
+ return DBOX_STATUS_ERROR_NONE;
}
s_info.handle = open_db();
if (s_info.handle) {
s_info.init_count++;
- return 0;
+ return DBOX_STATUS_ERROR_NONE;
}
- return LB_STATUS_ERROR_IO;
+ return DBOX_STATUS_ERROR_IO_ERROR;
}
-EAPI int livebox_service_fini(void)
+EAPI int dynamicbox_service_fini(void)
{
if (!s_info.handle || s_info.init_count <= 0) {
ErrPrint("Service is not initialized\n");
- return LB_STATUS_ERROR_IO;
+ return DBOX_STATUS_ERROR_IO_ERROR;
}
s_info.init_count--;
if (s_info.init_count > 0) {
DbgPrint("Init count %d\n", s_info.init_count);
- return 0;
+ return DBOX_STATUS_ERROR_NONE;
}
db_util_close(s_info.handle);
s_info.handle = NULL;
- return 0;
+ return DBOX_STATUS_ERROR_NONE;
}
-EAPI int livebox_service_get_size(int type, int *width, int *height)
+EAPI int dynamicbox_service_get_size(dynamicbox_size_type_e type, int *width, int *height)
{
int _width;
int _height;
@@ -2659,7 +3036,7 @@ EAPI int livebox_service_get_size(int type, int *width, int *height)
return convert_size_from_type(type, width, height);
}
-EAPI int livebox_service_size_type(int width, int height)
+EAPI dynamicbox_size_type_e dynamicbox_service_size_type(int width, int height)
{
int idx;
@@ -2667,7 +3044,7 @@ EAPI int livebox_service_size_type(int width, int height)
ErrPrint("Failed to update the size list\n");
}
- for (idx = 0; idx < NR_OF_SIZE_LIST; idx++) {
+ for (idx = 0; idx < DBOX_NR_OF_SIZE_LIST; idx++) {
if (SIZE_LIST[idx].w == width && SIZE_LIST[idx].h == height) {
break;
}
@@ -2675,36 +3052,179 @@ EAPI int livebox_service_size_type(int width, int height)
switch (idx) {
case 0:
- return LB_SIZE_TYPE_1x1;
+ return DBOX_SIZE_TYPE_1x1;
case 1:
- return LB_SIZE_TYPE_2x1;
+ return DBOX_SIZE_TYPE_2x1;
case 2:
- return LB_SIZE_TYPE_2x2;
+ return DBOX_SIZE_TYPE_2x2;
case 3:
- return LB_SIZE_TYPE_4x1;
+ return DBOX_SIZE_TYPE_4x1;
case 4:
- return LB_SIZE_TYPE_4x2;
+ return DBOX_SIZE_TYPE_4x2;
case 5:
- return LB_SIZE_TYPE_4x3;
+ return DBOX_SIZE_TYPE_4x3;
case 6:
- return LB_SIZE_TYPE_4x4;
+ return DBOX_SIZE_TYPE_4x4;
case 7:
- return LB_SIZE_TYPE_4x5;
+ return DBOX_SIZE_TYPE_4x5;
case 8:
- return LB_SIZE_TYPE_4x6;
+ return DBOX_SIZE_TYPE_4x6;
case 9:
- return LB_SIZE_TYPE_EASY_1x1;
+ return DBOX_SIZE_TYPE_EASY_1x1;
case 10:
- return LB_SIZE_TYPE_EASY_3x1;
+ return DBOX_SIZE_TYPE_EASY_3x1;
case 11:
- return LB_SIZE_TYPE_EASY_3x3;
+ return DBOX_SIZE_TYPE_EASY_3x3;
case 12:
- return LB_SIZE_TYPE_0x0;
+ return DBOX_SIZE_TYPE_0x0;
default:
break;
}
- return LB_SIZE_TYPE_UNKNOWN;
+ return DBOX_SIZE_TYPE_UNKNOWN;
+}
+
+EAPI void dynamicbox_set_last_status(dynamicbox_status_e status)
+{
+ s_info.last_status = status;
+}
+
+EAPI dynamicbox_status_e dynamicbox_last_status(void)
+{
+ return s_info.last_status;
+}
+
+EAPI dynamicbox_lock_info_t dynamicbox_service_create_lock(const char *uri, dynamicbox_target_type_e type, dynamicbox_lock_type_e option)
+{
+ dynamicbox_lock_info_t info;
+ int len;
+ int flags;
+
+ info = malloc(sizeof(*info));
+ if (!info) {
+ ErrPrint("malloc: %s\n", strerror(errno));
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_OUT_OF_MEMORY);
+ return NULL;
+ }
+
+ len = strlen(uri);
+ info->filename = malloc(len + 20);
+ if (!info->filename) {
+ ErrPrint("malloc: %s\n", strerror(errno));
+ free(info);
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_OUT_OF_MEMORY);
+ return NULL;
+ }
+
+ len = snprintf(info->filename, len + 20, "%s.%s.lck", util_uri_to_path(uri), type == DBOX_TYPE_GBAR ? "gbar" : "dbox");
+ if (len < 0) {
+ ErrPrint("snprintf: %s\n", strerror(errno));
+ free(info->filename);
+ free(info);
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_FAULT);
+ return NULL;
+ }
+
+ if (option == DBOX_LOCK_WRITE) {
+ flags = O_WRONLY | O_CREAT;
+ } else if (option == DBOX_LOCK_READ) {
+ flags = O_RDONLY;
+ } else {
+ ErrPrint("Invalid paramter\n");
+ free(info->filename);
+ free(info);
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_INVALID_PARAMETER);
+ return NULL;
+ }
+
+ info->type = option;
+
+ info->fd = open(info->filename, flags, 0644);
+ if (info->fd < 0) {
+ ErrPrint("open: %s\n", strerror(errno));
+ free(info->filename);
+ free(info);
+ dynamicbox_set_last_status(DBOX_STATUS_ERROR_IO_ERROR);
+ return NULL;
+ }
+
+ return info;
+}
+
+EAPI int dynamicbox_service_destroy_lock(dynamicbox_lock_info_t info)
+{
+ if (!info || !info->filename || info->fd < 0) {
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ }
+
+ if (close(info->fd) < 0) {
+ ErrPrint("close: %s\n", strerror(errno));
+ return DBOX_STATUS_ERROR_IO_ERROR;
+ }
+
+ if (unlink(info->filename) < 0) {
+ ErrPrint("unlink: %s\n", strerror(errno));
+ }
+
+ free(info->filename);
+ free(info);
+ return DBOX_STATUS_ERROR_NONE;
+}
+
+EAPI int dynamicbox_service_acquire_lock(dynamicbox_lock_info_t info)
+{
+ struct flock flock;
+ int ret;
+
+ if (!info || info->fd < 0) {
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ }
+
+ if (info->type == DBOX_LOCK_WRITE) {
+ flock.l_type = F_WRLCK;
+ } else if (info->type == DBOX_LOCK_READ) {
+ flock.l_type = F_RDLCK;
+ }
+ flock.l_whence = SEEK_SET;
+ flock.l_start = 0;
+ flock.l_len = 0;
+ flock.l_pid = getpid();
+
+ do {
+ ret = fcntl(info->fd, F_SETLKW, &flock);
+ if (ret < 0) {
+ ret = errno;
+ ErrPrint("fcntl: %s\n", strerror(errno));
+ }
+ } while (ret == EINTR);
+
+ return DBOX_STATUS_ERROR_NONE;
+}
+
+EAPI int dynamicbox_service_release_lock(dynamicbox_lock_info_t info)
+{
+ struct flock flock;
+ int ret;
+
+ if (info->fd < 0) {
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ }
+
+ flock.l_type = F_UNLCK;
+ flock.l_whence = SEEK_SET;
+ flock.l_start = 0;
+ flock.l_len = 0;
+ flock.l_pid = getpid();
+
+ do {
+ ret = fcntl(info->fd, F_SETLKW, &flock);
+ if (ret < 0) {
+ ret = errno;
+ ErrPrint("fcntl: %s\n", strerror(errno));
+ }
+ } while (ret == EINTR);
+
+ return DBOX_STATUS_ERROR_NONE;
}
/* End of a file */
diff --git a/src/util.c b/dynamicbox_service/src/util.c
index aa92360..0585405 100644
--- a/src/util.c
+++ b/dynamicbox_service/src/util.c
@@ -28,9 +28,9 @@
#include <dlog.h>
+#include "dynamicbox_errno.h"
#include "util.h"
#include "debug.h"
-#include "livebox-errno.h"
int errno;
#if defined(_USE_ECORE_TIME_GET)
@@ -41,78 +41,6 @@ static struct info {
};
#endif
-static char *check_native_livebox(const char *pkgname)
-{
- int len;
- char *path;
-
- len = strlen(pkgname) * 2;
- len += strlen("/opt/usr/live/%s/libexec/liblive-%s.so");
-
- path = malloc(len + 1);
- if (!path) {
- ErrPrint("Heap: %s\n", strerror(errno));
- return NULL;
- }
-
- snprintf(path, len, "/opt/usr/live/%s/libexec/liblive-%s.so", pkgname, pkgname);
- if (access(path, F_OK | R_OK) != 0) {
- ErrPrint("%s is not a valid package (%s)\n", pkgname, strerror(errno));
- free(path);
- return NULL;
- }
-
- return path;
-}
-
-static char *check_web_livebox(const char *pkgname)
-{
- int len;
- char *path;
-
- len = strlen(pkgname) * 2;
- len += strlen("/opt/usr/apps/%s/res/wgt/livebox/index.html");
-
- path = malloc(len + 1);
- if (!path) {
- ErrPrint("Heap: %s\n", strerror(errno));
- return NULL;
- }
-
- snprintf(path, len, "/opt/usr/apps/%s/res/wgt/livebox/index.html", pkgname);
- if (access(path, F_OK | R_OK) != 0) {
- ErrPrint("%s is not a valid package (%s)\n", pkgname, strerror(errno));
- free(path);
- return NULL;
- }
-
- return path;
-}
-
-int util_validate_livebox_package(const char *pkgname)
-{
- char *path;
-
- if (!pkgname) {
- ErrPrint("Invalid argument\n");
- return LB_STATUS_ERROR_INVALID;
- }
-
- path = check_native_livebox(pkgname);
- if (path) {
- free(path);
- return 0;
- }
-
- path = check_web_livebox(pkgname);
- if (path) {
- free(path);
- return 0;
- }
-
- return LB_STATUS_ERROR_INVALID;
-}
-
double util_timestamp(void)
{
#if defined(_USE_ECORE_TIME_GET)
@@ -325,23 +253,6 @@ const char *util_uri_to_path(const char *uri)
return uri + len;
}
-char *util_conf_get_libexec(const char *pkgname)
-{
- char *path;
-
- if (!pkgname) {
- ErrPrint("Invalid argument\n");
- return NULL;
- }
-
- path = check_native_livebox(pkgname);
- if (!path) {
- path = check_web_livebox(pkgname);
- }
-
- return path;
-}
-
char *util_id_to_uri(const char *id)
{
char *uri;
diff --git a/src/util_wayland.c b/dynamicbox_service/src/util_wayland.c
index 3788ed1..6444d22 100644
--- a/src/util_wayland.c
+++ b/dynamicbox_service/src/util_wayland.c
@@ -7,9 +7,9 @@
#include <sqlite3.h>
#include <unicode/uloc.h>
-#include "livebox-errno.h"
+#include "dynamicbox_errno.h"
#include "util.h"
-#include "livebox-service.h"
+#include "dynamicbox_service.h"
#include "debug.h"
int errno;
@@ -79,7 +79,7 @@ static inline int update_from_file(struct service_info *info, struct supported_s
fp = fopen(info->conf_file, "r");
if (!fp) {
ErrPrint("Open failed: %s\n", strerror(errno));
- return LB_STATUS_ERROR_IO;
+ return DBOX_STATUS_ERROR_IO_ERROR;
}
updated = 0;
@@ -205,7 +205,7 @@ static inline int update_from_file(struct service_info *info, struct supported_s
ErrPrint("fclose: %s\n", strerror(errno));
}
- return NR_OF_SIZE_LIST - updated;
+ return DBOX_NR_OF_SIZE_LIST - updated;
}
int util_update_resolution(struct service_info *info, struct supported_size_list *SIZE_LIST)
@@ -218,7 +218,7 @@ int util_update_resolution(struct service_info *info, struct supported_size_list
static int res_resolved = 0;
if (res_resolved) {
- return LB_STATUS_SUCCESS;
+ return DBOX_STATUS_ERROR_NONE;
}
if (update_from_file(info, SIZE_LIST) == 0) {
@@ -226,7 +226,12 @@ int util_update_resolution(struct service_info *info, struct supported_size_list
}
res_resolved = 1;
- return LB_STATUS_SUCCESS;
+ return DBOX_STATUS_ERROR_NONE;
+}
+
+int util_screen_size_get(unsigned int *width, unsigned int *height)
+{
+ return DBOX_STATUS_ERROR_NONE;
}
/* End of a file */
diff --git a/src/util_x11.c b/dynamicbox_service/src/util_x11.c
index 2ec2380..e3efe4d 100644
--- a/src/util_x11.c
+++ b/dynamicbox_service/src/util_x11.c
@@ -1,6 +1,8 @@
#include <stdio.h>
#include <ctype.h>
#include <errno.h>
+#include <unistd.h> // access
+#include <stdlib.h> // free
#include <X11/X.h>
#include <X11/Xlib.h>
@@ -10,13 +12,25 @@
#include <sqlite3.h>
#include <unicode/uloc.h>
-#include "livebox-errno.h"
+#include "dynamicbox_errno.h"
#include "util.h"
-#include "livebox-service.h"
+#include "dynamicbox_service.h"
#include "debug.h"
+#define CONF_PATH_FORMAT "/usr/share/data-provider-master/%dx%d/resolution.ini"
+
int errno;
+static struct {
+ unsigned int w;
+ unsigned int h;
+ int res_resolved;
+} s_info = {
+ .w = 0,
+ .h = 0,
+ .res_resolved = 0,
+};
+
static int update_info(struct supported_size_list *SIZE_LIST, int width_type, int height_type, int width, int height)
{
int idx;
@@ -82,7 +96,7 @@ static inline int update_from_file(struct service_info *info, struct supported_s
fp = fopen(info->conf_file, "r");
if (!fp) {
ErrPrint("Open failed: %s\n", strerror(errno));
- return LB_STATUS_ERROR_IO;
+ return DBOX_STATUS_ERROR_IO_ERROR;
}
updated = 0;
@@ -164,9 +178,17 @@ static inline int update_from_file(struct service_info *info, struct supported_s
status = EOL;
if (sscanf(buffer, "%dx%d", &width, &height) != 2) {
- ErrPrint("Invalid syntax: [%s]\n", buffer);
- status = ERROR;
- } else if (ch == EOF) {
+ if (!strncasecmp(buffer, "screen", strlen("screen"))) {
+ width = s_info.w;
+ height = s_info.h;
+ DbgPrint("Select screen size: %dx%d\n", width, height);
+ } else {
+ ErrPrint("Invalid syntax: [%s]\n", buffer);
+ status = ERROR;
+ }
+ }
+
+ if (status != ERROR && ch == EOF) {
if (info->base_parse) {
info->base_w = width;
info->base_h = height;
@@ -183,7 +205,7 @@ static inline int update_from_file(struct service_info *info, struct supported_s
updated += update_info(SIZE_LIST, width_type, height_type, width, height);
} else {
info->base_w = width;
- info->base_h = height;
+ info->base_h = height;
}
status = START;
ungetc(ch, fp);
@@ -208,50 +230,126 @@ static inline int update_from_file(struct service_info *info, struct supported_s
ErrPrint("fclose: %s\n", strerror(errno));
}
- return NR_OF_SIZE_LIST - updated;
+ return DBOX_NR_OF_SIZE_LIST - updated;
}
-int util_update_resolution(struct service_info *info, struct supported_size_list *SIZE_LIST)
+/*
+ * Find proper configuration and install(link) it to conf path.
+ */
+static char *conf_path(void)
+{
+ char *path;
+ int length;
+
+ length = strlen(CONF_PATH_FORMAT) + 12; // 12 == RESERVED SPACE
+ path = calloc(1, length);
+ if (!path) {
+ ErrPrint("calloc: %s\n", strerror(errno));
+ return NULL;
+ }
+
+ if (s_info.w == 0 || s_info.h == 0) {
+ /* Try to update resolution first if it is not initialized */
+ util_screen_size_get(NULL, NULL);
+ }
+
+ snprintf(path, length, CONF_PATH_FORMAT, s_info.w, s_info.h);
+ DbgPrint("Selected conf file: %s\n", path);
+ if (access(path, F_OK) != 0) {
+ ErrPrint("Fallback to default, access: %s\n", strerror(errno));
+ strncpy(path, RESOLUTION_FILE, length);
+ if (access(path, F_OK) != 0) {
+ ErrPrint("Serious error - there is no conf file, use default setting: %s\n", strerror(errno));
+ free(path);
+ path = NULL;
+ }
+ }
+
+ return path;
+}
+
+int util_screen_size_get(unsigned int *width, unsigned int *height)
{
Display *disp;
Window root;
Window dummy;
- int x, y;
- unsigned int width;
- unsigned int height;
unsigned int border;
unsigned int depth;
- register int i;
- static int res_resolved = 0;
+ int x;
+ int y;
+ int ret;
+ unsigned int _width;
+ unsigned int _height;
- if (res_resolved) {
- return LB_STATUS_SUCCESS;
+ if (!width) {
+ width = &_width;
+ }
+
+ if (!height) {
+ height = &_height;
+ }
+
+ if (s_info.w != 0 && s_info.h != 0) {
+ DbgPrint("Already prepared (%dx%d)\n", s_info.w, s_info.h);
+ goto out;
}
disp = XOpenDisplay(NULL);
if (!disp) {
ErrPrint("Failed to open a display\n");
- return LB_STATUS_ERROR_FAULT;
+ return DBOX_STATUS_ERROR_FAULT;
}
root = XDefaultRootWindow(disp);
- if (!XGetGeometry(disp, root, &dummy, &x, &y, &width, &height, &border, &depth)) {
- XCloseDisplay(disp);
- return LB_STATUS_ERROR_FAULT;
+ ret = XGetGeometry(disp, root, &dummy, &x, &y, &s_info.w, &s_info.h, &border, &depth);
+ XCloseDisplay(disp);
+ if (!ret) {
+ ErrPrint("Failed to get geometry\n");
+ return DBOX_STATUS_ERROR_FAULT;
}
- if (update_from_file(info, SIZE_LIST) == 0) {
- DbgPrint("Resolution info is all updated by file\n");
+out:
+ *width = s_info.w;
+ *height = s_info.h;
+ return DBOX_STATUS_ERROR_NONE;
+}
+
+int util_update_resolution(struct service_info *info, struct supported_size_list *SIZE_LIST)
+{
+ if (s_info.res_resolved) {
+ return DBOX_STATUS_ERROR_NONE;
}
- for (i = 0; i < NR_OF_SIZE_LIST; i++) {
- SIZE_LIST[i].w = (unsigned int)((double)SIZE_LIST[i].w * (double)width / (double)info->base_w);
- SIZE_LIST[i].h = (unsigned int)((double)SIZE_LIST[i].h * (double)width / (double)info->base_w);
+ if (!info->conf_file) {
+ info->conf_file = conf_path();
}
- XCloseDisplay(disp);
- res_resolved = 1;
- return LB_STATUS_SUCCESS;
+ if (info->conf_file) {
+ register int i;
+ unsigned int width;
+ unsigned int height;
+
+ i = util_screen_size_get(&width, &height);
+ if (i != DBOX_STATUS_ERROR_NONE) {
+ return i;
+ }
+
+ if (update_from_file(info, SIZE_LIST) == 0) {
+ DbgPrint("Resolution info is all updated by file\n");
+ }
+
+ if (width != info->base_w) {
+ for (i = 0; i < DBOX_NR_OF_SIZE_LIST; i++) {
+ SIZE_LIST[i].w = (unsigned int)((double)SIZE_LIST[i].w * (double)width / (double)info->base_w);
+ SIZE_LIST[i].h = (unsigned int)((double)SIZE_LIST[i].h * (double)width / (double)info->base_w);
+ }
+ }
+ } else {
+ DbgPrint("Conf file is not loaded\n");
+ }
+
+ s_info.res_resolved = 1;
+ return DBOX_STATUS_ERROR_NONE;
}
/* End of a file */
diff --git a/include/livebox-errno.h b/include/livebox-errno.h
deleted file mode 100644
index 1b4983b..0000000
--- a/include/livebox-errno.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright 2013 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://floralicense.org/license/
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef __LIVEBOX_ERRNO_H
-#define __LIVEBOX_ERRNO_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*!
- * \addtogroup CAPI_LIVEBOX_SERVICE_MODULE
- * \{
- */
-
-/*!
- * \brief
- * Definitions for the result status of livebox operation.
- */
-enum livebox_status {
- LB_STATUS_SUCCESS = 0x00000000, /*!< Operation is successfully completed */
- LB_STATUS_ERROR = 0x80000000, /*!< This will be OR'd with other specific error value */
- LB_STATUS_ERROR_INVALID = LB_STATUS_ERROR | 0x0001, /*!< Invalid request */
- LB_STATUS_ERROR_FAULT = LB_STATUS_ERROR | 0x0002, /*!< Fault - Unable to recover from the error */
- LB_STATUS_ERROR_MEMORY = LB_STATUS_ERROR | 0x0004, /*!< Memory is not enough to do this operation */
- LB_STATUS_ERROR_EXIST = LB_STATUS_ERROR | 0x0008, /*!< Already exists */
- LB_STATUS_ERROR_BUSY = LB_STATUS_ERROR | 0x0010, /*!< Busy so the operation is not started(accepted), try again */
- LB_STATUS_ERROR_PERMISSION = LB_STATUS_ERROR | 0x0020, /*!< Permission error */
- LB_STATUS_ERROR_ALREADY = LB_STATUS_ERROR | 0x0040, /*!< Operation is already started */
- LB_STATUS_ERROR_CANCEL = LB_STATUS_ERROR | 0x0080, /*!< Operation is canceled */
- LB_STATUS_ERROR_IO = LB_STATUS_ERROR | 0x0100, /*!< I/O Error */
- LB_STATUS_ERROR_NOT_EXIST = LB_STATUS_ERROR | 0x0200, /*!< Not exists */
- LB_STATUS_ERROR_TIMEOUT = LB_STATUS_ERROR | 0x0400, /*!< Timeout */
- LB_STATUS_ERROR_NOT_IMPLEMENTED = LB_STATUS_ERROR | 0x0800, /*!< Operation is not implemented */
- LB_STATUS_ERROR_NO_SPACE = LB_STATUS_ERROR | 0x1000, /*!< No space to operate */
- LB_STATUS_ERROR_DISABLED = LB_STATUS_ERROR | 0x2000 /*!< Disabled */
-};
-
-/*!
- * \brief Check whether given code value indicates error or not.
- * \param[in] s
- * \return 1 or 0
- */
-#define LB_STATUS_IS_ERROR(s) (!!((s) & LB_STATUS_ERROR))
-
-/*!
- * \}
- */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-/* End of a file */
diff --git a/include/livebox-service.h b/include/livebox-service.h
deleted file mode 100644
index aecc0c0..0000000
--- a/include/livebox-service.h
+++ /dev/null
@@ -1,833 +0,0 @@
-/*
- * Copyright 2013 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://floralicense.org/license/
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef __LIVEBOX_SERVICE_H
-#define __LIVEBOX_SERVICE_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*!
- * \addtogroup CAPI_LIVEBOX_SERVICE_MODULE
- * \{
- */
-
-/*!
- * \brief
- * Maximum number of supported livebox size type
- */
-#define NR_OF_SIZE_LIST 13
-
-#define CH_IDX(a, idx) (((char *)(a))[(idx)])
-#define IS_INHOUSE_LIVEBOX(abi) ((CH_IDX(abi, 0) == 'c' || CH_IDX(abi, 0) == 'C') && (CH_IDX(abi, 1) == '\0' || ((CH_IDX(abi, 1) == 'p' || CH_IDX(abi, 1) == 'P') && (CH_IDX(abi, 2) == 'p' || CH_IDX(abi, 2) == 'P') && CH_IDX(abi, 3) == '\0')))
-
-/*!
- * \brief
- * List of supporting livebox size types
- */
-enum livebox_size_type {
- LB_SIZE_TYPE_1x1 = 0x0001, /*!< 175x175 */
- LB_SIZE_TYPE_2x1 = 0x0002, /*!< 354x175 */
- LB_SIZE_TYPE_2x2 = 0x0004, /*!< 354x354 */
- LB_SIZE_TYPE_4x1 = 0x0008, /*!< 712x175 */
- LB_SIZE_TYPE_4x2 = 0x0010, /*!< 712x354 */
- LB_SIZE_TYPE_4x3 = 0x0020, /*!< 712x533 */
- LB_SIZE_TYPE_4x4 = 0x0040, /*!< 712x712 */
- LB_SIZE_TYPE_4x5 = 0x0080, /*!< 712x891 */
- LB_SIZE_TYPE_4x6 = 0x0100, /*!< 712x1070 */
- LB_SIZE_TYPE_EASY_1x1 = 0x1000, /*!< 224x215 */
- LB_SIZE_TYPE_EASY_3x1 = 0x2000, /*!< 680x215 */
- LB_SIZE_TYPE_EASY_3x3 = 0x4000, /*!< 680x653 */
- LB_SIZE_TYPE_0x0 = 0x0800, /*!< 720x1280 */
- LB_SIZE_TYPE_UNKNOWN = 0xFFFF /*!< Error */
-};
-
-/*!
- * \brief
- * Script event of livebox
- * This enumeration value will be used for script plugin of data-provider-master.
- * master will send down these accessibility events to the script plugin.
- */
-enum livebox_script_event {
- LB_SCRIPT_ACCESS_EVENT = 0x01000000, /*!< Mask value */
- LB_SCRIPT_MOUSE_EVENT = 0x02000000, /*!< Mask value */
- LB_SCRIPT_KEY_EVENT = 0x04000000, /*!< Mask value */
-
- LB_SCRIPT_ACCESS_HIGHLIGHT = LB_SCRIPT_ACCESS_EVENT | 0x00000001, /*!< Highlight */
- LB_SCRIPT_ACCESS_HIGHLIGHT_NEXT = LB_SCRIPT_ACCESS_EVENT | 0x00000002, /*!< Move Highlight focus to the next object */
- LB_SCRIPT_ACCESS_HIGHLIGHT_PREV = LB_SCRIPT_ACCESS_EVENT | 0x00000004, /*!< Move Highlight focus to the prev object */
- LB_SCRIPT_ACCESS_ACTIVATE = LB_SCRIPT_ACCESS_EVENT | 0x00000008, /*!< Activate the highlighted object */
- LB_SCRIPT_ACCESS_ACTION = LB_SCRIPT_ACCESS_EVENT | 0x00000010, /*!< Do specified action for the highlighted object */
- LB_SCRIPT_ACCESS_SCROLL = LB_SCRIPT_ACCESS_EVENT | 0x00000020, /*!< Scroll operation */
- LB_SCRIPT_ACCESS_UNHIGHLIGHT = LB_SCRIPT_ACCESS_EVENT | 0x00000040, /*!< Remove highlight */
-
- LB_SCRIPT_MOUSE_DOWN = LB_SCRIPT_MOUSE_EVENT | 0x00001000, /*!< Mouse down */
- LB_SCRIPT_MOUSE_MOVE = LB_SCRIPT_MOUSE_EVENT | 0x00002000, /*!< Mouse move */
- LB_SCRIPT_MOUSE_UP = LB_SCRIPT_MOUSE_EVENT | 0x00004000, /*!< Mouse up */
- LB_SCRIPT_MOUSE_IN = LB_SCRIPT_MOUSE_EVENT | 0x00008000, /*!< Mouse in */
- LB_SCRIPT_MOUSE_OUT = LB_SCRIPT_MOUSE_EVENT | 0x00010000, /*!< Mouse out */
-
- LB_SCRIPT_MOUSE_ON_SCROLL = LB_SCRIPT_MOUSE_EVENT | 0x00020000,
- LB_SCRIPT_MOUSE_OFF_SCROLL = LB_SCRIPT_MOUSE_EVENT | 0x00040000,
- LB_SCRIPT_MOUSE_ON_HOLD = LB_SCRIPT_MOUSE_EVENT | 0x00080000, /*!< To cancel the clicked event */
- LB_SCRIPT_MOUSE_OFF_HOLD = LB_SCRIPT_MOUSE_EVENT | 0x00100000,
-
- LB_SCRIPT_KEY_DOWN = LB_SCRIPT_KEY_EVENT | 0x00020000, /*!< Key pressed */
- LB_SCRIPT_KEY_UP = LB_SCRIPT_KEY_EVENT | 0x00040000, /*!< Key released */
- LB_SCRIPT_KEY_FOCUS_IN = LB_SCRIPT_KEY_EVENT | 0x00080000, /*!< Key focus in */
- LB_SCRIPT_KEY_FOCUS_OUT = LB_SCRIPT_KEY_EVENT | 0x00100000, /*!< Key focus out */
-};
-
-/*!
- * \brief Result of Accessibility event processing
- * Reference the libprovider & liblivebox-viewer
- */
-enum livebox_access_status {
- LB_ACCESS_STATUS_ERROR = 0x80000000, /*!< Mask value */
- LB_ACCESS_STATUS_DONE = 0x00000000, /*!< Successfully finished */
- LB_ACCESS_STATUS_FIRST, /*!< Reach to the first item */
- LB_ACCESS_STATUS_LAST, /*!< Reach to the last item */
- LB_ACCESS_STATUS_READ /*!< TTS is done */
-};
-
-enum livebox_key_status {
- LB_KEY_STATUS_ERROR = 0x80000000, /*!< Key operation is failed */
- LB_KEY_STATUS_DONE = 0x00000000, /*!< Key operation is successfully done */
- LB_KEY_STATUS_FIRST, /*!< Focusable object item reaches to the first in it */
- LB_KEY_STATUS_LAST, /*!< Focusable object item reaches to the last in it */
-};
-
-enum livebox_delete_type {
- LB_DELETE_PERMANENTLY = 0x01, /*!< The livebox is removed from the homescreen temporary */
- LB_DELETE_TEMPORARY = 0x02, /*!< The livebox is removed from the homescreen by user permanently */
- LB_DELETE_INVALID = 0xff,
-};
-
-enum livebox_pd_close_type {
- LB_CLOSE_PD_NORMAL = 0x00,
- LB_CLOSE_PD_TIMEOUT = 0x01,
- LB_CLOSE_PD_FAULT = 0x02,
- LB_CLOSE_PD_INVALID = 0xff,
-};
-
-/*!
- * \brief
- * Handle of Package List
- */
-struct pkglist_handle;
-
-/*!
- * \brief Get the pixel size of given size type.
- * \details
- * Size types can be (defined in liblivebox-service pakcage, include livebox-service.h)
- * LB_SIZE_TYPE_1x1
- * LB_SIZE_TYPE_2x1
- * LB_SIZE_TYPE_2x2
- * LB_SIZE_TYPE_4x1
- * LB_SIZE_TYPE_4x2
- * LB_SIZE_TYPE_4x3
- * LB_SIZE_TYPE_4x4
- * LB_SIZE_TYPE_4x5
- * LB_SIZE_TYPE_4x6
- * LB_SIZE_TYPE_0x0
- * LB_SIZE_TYPE_EASY_1x1
- * LB_SIZE_TYPE_EASY_3x1
- * LB_SIZE_TYPE_EASY_3x3
- * \remarks N/A
- * \param[in] type Size type
- * \param[out] width Pixel size width
- * \param[out] height Pixel size height
- * \return int
- * \retval LB_STATUS_SUCCESS Successfully done
- * \pre N/A
- * \post N/A
- * \see livebox_size_type
- * \see livebox_service_size_type
- */
-extern int livebox_service_get_size(int type, int *width, int *height);
-
-/*!
- * \brief Get the size type for given pixel size.
- * \details
- * Returnable size types are (defined in liblivebox-service pakcage, include livebox-service.h)
- * LB_SIZE_TYPE_1x1
- * LB_SIZE_TYPE_2x1
- * LB_SIZE_TYPE_2x2
- * LB_SIZE_TYPE_4x1
- * LB_SIZE_TYPE_4x2
- * LB_SIZE_TYPE_4x3
- * LB_SIZE_TYPE_4x4
- * LB_SIZE_TYPE_4x5
- * LB_SIZE_TYPE_4x6
- * LB_SIZE_TYPE_0x0
- * LB_SIZE_TYPE_EASY_1x1
- * LB_SIZE_TYPE_EASY_3x1
- * LB_SIZE_TYPE_EASY_3x3
- * or
- * LB_SIZE_TYPE_UNKNOWN for error
- * \remarks N/A
- * \param[in] width Pixel size width
- * \param[in] height Pixel size height
- * \return int
- * \retval LB_SIZE_TYPE_[EASY_]WxH Size type of given pixel size.
- * \retval LB_SIZE_TYPE_UNKNOWN if the given pixel size is not valid.
- * \pre N/A
- * \post N/A
- * \see livebox_size_type
- * \see livebox_service_get_size
- */
-extern int livebox_service_size_type(int width, int height);
-
-/*!
- * \brief Is this livebox support the mouse event of livebox content?
- * \details N/A
- * \remarks N/A
- * \param[in] pkgid Livebox's appid
- * \param[in] size_type Size of livebox to get its mouse_event option
- * \return int
- * \retval 1 if the box requires mouse event
- * \retval 0 if the box doesn't requires mouse event
- * \pre N/A
- * \post N/A
- * \see livebox_service_touch_effect
- * \see livebox_service_need_frame
- */
-extern int livebox_service_mouse_event(const char *pkgid, int size_type);
-
-/*!
- * \brief Is this livebox requires touch effect?
- * If this API returns true(1), the viewer should make touch effect when a user click the livebox.
- * \param[in] pkgid Livebox's appid
- * \param[in] size_type
- * \return int
- * \retval 1 if the box requires touch effect
- * \retval 0 if the box doesn't requires touch effect, the box will make touch effect itself
- * \pre N/A
- * \post N/A
- * \see livebox_service_mouse_event
- * \see livebox_service_need_frame
- */
-extern int livebox_service_touch_effect(const char *pkgid, int size_type);
-
-/*!
- * \brief Is this livebox requires decoration frame?
- * If this API returns true(1), the viewer should make decoration border on the livebox content.
- * \details N/A
- * \remarks N/A
- * \param[in] pkgid Livebox's appid
- * \param[in] size_type
- * \return int
- * \retval 1 If the box requires frame for decorating its contents
- * \retval 0 If the box doesn't requires frame
- * \see livebox_service_mouse_event
- * \see livebox_service_touch_effect
- */
-extern int livebox_service_need_frame(const char *pkgid, int size_type);
-
-/*!
- * \brief Trigger the update event for given livebox instance
- * \details N/A
- * \remarks N/A
- * \param[in] pkgname Livebox package name
- * \param[in] id Set NULL if you don't know what the Id is. Then every instance of given pkgname will be triggered its update event.
- * \param[in] cluster Cluster name. Default NULL
- * \param[in] category Category name, Default NULL
- * \param[in] force 1 if you want to update your livebox even if the provider is paused or 0. 0 is default
- * \return int
- * \retval LB_STATUS_ERROR_INVALID Invalid argument
- * \retval LB_STATUS_ERROR_CANCEL Provider is paused, so this update request is canceld.(ignored), if you want to make update forcely, use force=1
- * \retval LB_STATUS_ERROR_MEMORY Memory is not enough to make request
- * \retval LB_STATUS_ERROR_FAULT Failed to create a request packet
- * \retval LB_STATUS_SUCCESS Successfully requested
- * \see N/A
- */
-extern int livebox_service_trigger_update(const char *pkgname, const char *id, const char *cluster, const char *category, int force);
-
-/*!
- * \brief Trigger the update event for given livebox instance
- * \details N/A
- * \remarks N/A
- * \param[in] pkgname Livebox package name
- * \param[in] id Set NULL if you don't know what the Id is. Then every instance of given pkgname will be triggered its update event.
- * \param[in] cluster Cluster name. Default NULL
- * \param[in] category Category name, Default NULL
- * \param[in] content New content information, Default NULL
- * \param[in] force 1 if you want to update your livebox even if the provider is paused or 0. 0 is default
- * \return int
- * \retval LB_STATUS_ERROR_INVALID Invalid argument
- * \retval LB_STATUS_ERROR_CANCEL Provider is paused, so this update request is canceld.(ignored), if you want to make update forcely, use force=1
- * \retval LB_STATUS_ERROR_MEMORY Memory is not enough to make request
- * \retval LB_STATUS_ERROR_FAULT Failed to create a request packet
- * \retval LB_STATUS_SUCCESS Successfully requested
- * \see livebox_service_trigger_update
- */
-extern int livebox_service_trigger_update_with_content(const char *pkgname, const char *id, const char *cluster, const char *category, const char *content, int force);
-
-/*!
- * \brief Change the update period of given livebox instance
- * \details N/A
- * \remarks N/A
- * \param[in] pkgname Livebox package name
- * \param[in] id Livebox instance id
- * \param[in] period New update period in sec
- * \return int
- * \retval LB_STATUS_SUCCESS Successfully changed(requested)
- * \retval LB_STATUS_ERROR_INVALID Invalid argument
- * \retval LB_STATUS_ERROR_FAULT Failed to create a request packet
- * \retval LB_STATUS_ERROR_MEMORY Not enough memory
- * \see N/A
- */
-extern int livebox_service_change_period(const char *pkgname, const char *id, double period);
-
-/*!
- * \brief Synchronous package list getter
- * \details
- * callback (appid, lbid, is_prime)
- * appid == Application Package ID (pkgname)
- * lbid = Livebox Package ID
- * is_prime = 1 if the livebox is default one for associated application package
- * If the callback returns negative value, the list crawling will be stopped
- * \remarks N/A
- * \param[in] cb Callback function
- * \param[in] data Callback data
- * \return int
- * \retval LB_STATUS_ERROR_IO Failed to access DB
- * \retval LB_STATUS_ERROR_INVALID Invalid argument
- * \retval count count of livebox packages
- * \pre N/A
- * \post N/A
- * \see livebox_service_get_pkglist_by_pkgid
- */
-extern int livebox_service_get_pkglist(int (*cb)(const char *pkgid, const char *lbid, int is_prime, void *data), void *data);
-
-/*!
- * \brief Synchronous uiapp list getter.
- * \details
- * callback (appid, data)
- * This function will retrieve all UI Apps in a package which has given livebox appid(lbid).
- * If you need to get all ui-app list, using a livebox appid, this function is able to help you.
- * \remarks N/A
- * \param[in] lbid Livebox App Id
- * \param[in] cb Callback function
- * \param[in] data Callback Data
- * \return int
- * \retval LB_STATUS_SUCCESS
- * \retval LB_STATUS_ERROR_INVALID Invalid argument
- * \retval LB_STATUS_ERROR_IO Failed to access DB
- * \retval LB_STATUS_ERROR_MEMORY
- * \retval LB_STATUS_ERROR_FAULT
- * \pre N/A
- * \post N/A
- * \see N/A
- */
-extern int livebox_service_get_applist(const char *lbid, void (*cb)(const char *lbid, const char *appid, void *data), void *data);
-
-/*!
- * \brief Get the MAIN application Id of given livebox package Id.
- * \details N/A
- * \remarks N/A
- * \param[in] lbid Livebox Package Id
- * \return char *
- * \retval NULL if it fails to get main application Id (UI-APPID)
- * \retval appid Main application Id
- * \pre N/A
- * \post N/A
- */
-extern char *livebox_service_mainappid(const char *lbid);
-
-/*!
- * \brief Synchronous package list getter
- * \details
- * callback (lbid, is_prime)
- * lbid == Livebox Package Id
- * is_prime = 1 if the livebox is default one for selected package
- * If the callback returns negative value, the list crawling will be stopped
- * \remarks N/A
- * \param[in] pkgid Package Id (Not the UI App Id)
- * \param[in] cb Callback function
- * \param[in] data Callback data
- * \return int
- * \retval Count of livebox packages
- * \retval LB_STATUS_ERROR_INVALID Invalid argument
- * \retval LB_STATUS_ERROR_IO Failed to access DB
- * \see livebox_service_get_pkglist
- */
-extern int livebox_service_get_pkglist_by_pkgid(const char *pkgid, int (*cb)(const char *lbid, int is_prime, void *data), void *data);
-
-/*!
- * \brief Synchronous package list getter
- * \details
- * callback (lbid)
- * lbid == Livebox Package Id
- * If the callback returns negative value, the list crawling will be stopped
- * \remarks N/A
- * \param[in] category Package Id (Not the UI App Id)
- * \param[in] cb Callback function
- * \param[in] data Callback data
- * \return int
- * \retval Count of livebox packages
- * \retval LB_STATUS_ERROR_INVALID Invalid argument
- * \retval LB_STATUS_ERROR_IO Failed to access DB
- * \see livebox_service_get_pkglist_by_pkgid
- */
-extern int livebox_service_get_pkglist_by_category(const char *category, int (*cb)(const char *lbid, void *data), void *data);
-
-/*!
- * \brief Get the lbid of a primary livebox using given lbid or pkgid or UI appid.
- * \details N/A
- * \remarks N/A
- * \param[in] id Livebox Id or Package Id
- * \return char *
- * \retval NULL Failed to get primary lbid
- * \retval lbid Primary livebox Id. which is allocated in the heap
- * \pre Must be released returned string by manually
- * \post N/A
- * \see livebox_service_appid
- */
-extern char *livebox_service_pkgname(const char *id);
-
-/*!
- * \brief Check the pirmary flag of given livebox Id.
- * \details N/A
- * \param[in] lbid Livebox Id
- * \return int
- * \retval 0 if is not a primary
- * \retval 1 if it is a primary livebox
- * \pre N/A
- * \post N/A
- * \see N/A
- */
-extern int livebox_service_is_primary(const char *lbid);
-
-/*!
- * \brief Get the category using given lbid.
- * \details N/A
- * \remarks N/A
- * \param[in] id Livebox Id
- * \return char *
- * \retval NULL Failed to get primary lbid
- * \retval category Category string which is allocated in the heap.
- * \pre Must be released returned string by manually
- * \post N/A
- * \see livebox_service_pkgname
- */
-extern char *livebox_service_category(const char *lbid);
-
-/*!
- * \brief Get the name of a livebox (provider name == livebox appid), you have to release the return value after use it
- * \details
- * OSP livebox has provider process for each livebox instances.
- * To get the provider's package name, you can use this API.
- * If the given lbid is inhouse livebox, the return string will be the same with given argument but it is allocated in the heap.
- * So you have to free it if you don't need it anymore.
- * \param[in] lbid Livebox Id
- * \return char *
- * \retval NULL failed to get provider name
- * \retval lbid Livebox AppId which is allocated on the heap
- * \pre N/A
- * \post Return'd string must be free'd manually
- * \see N/A
- */
-extern char *livebox_service_provider_name(const char *lbid);
-
-/*!
- * \brief Get the appId of setup app which is specified by given livebox Id's manifest.
- * This setup app should be launched before add the livebox to get the content_info
- * \details
- * This function should be called before add a livebox.
- * To determine the content information string.
- * \remarks N/A
- * \param[in] lbid Livebox Id
- * \return char *
- * \retval NULL there is no setup application
- * \retval appid AppId if exists or NULL
- * \pre N/A
- * \post return'd string must be free'd manually
- * \see N/A
- */
-extern char *livebox_service_setup_appid(const char *lbid);
-
-/*!
- * \brief Get the Package Id (Not the UI App Id) of given livebox, &lt;manifest package="AAA"&gt;
- * \details N/A
- * \remarks N/A
- * \param[in] lbid Livebox AppId
- * \return char *
- * \retval appid String which is allocated in the heap
- * \retval NULL invalid appid
- * \pre N/A
- * \post return'd string must be free'd manually
- * \see livebox_service_pkgname
- */
-extern char *livebox_service_appid(const char *lbid);
-
-/*!
- * \brief Internationalized name of given livebox package.
- * \details N/A
- * \remarks N/A
- * \param[in] pkgid App ID of a livebox. (It must has to be a livebox package ID. not the UI-APP and the PACKAGE.
- * \param[in] lang locale(en-us, ko-kr, ...), if it is NULL, function will use the system locale automatically
- * \return char *
- * \retval name if it fails to get name
- * \retval NULL, or allocated heap address.
- * \pre N/A
- * \post Return'd string must be free'd by manually
- * \see livebox_service_i18n_icon
- * \see livebox_service_preview
- */
-extern char *livebox_service_i18n_name(const char *pkgid, const char *lang);
-
-/*!
- * \brief Get the preview image path of given size type.
- * This function will returns i18nized preview image path.
- * \details N/A
- * \remarks N/A
- * \param[in] pkgid livebox ID. NOT the UI-APP ID and PACKAGE ID
- * \param[in] size_type Livebox size type.
- * \return char *
- * \retval path preview image path
- * \retval NULL if there is no preview image file
- * \pre N/A
- * \post Return'd string must be free'd manually
- * \see livebox_service_i18n_icon
- * \see livebox_service_i18n_name
- */
-extern char *livebox_service_preview(const char *pkgid, int size_type);
-
-/*!
- * \brief Get the default content string of the given livebox
- * \details
- * If a user defins default content string in the manifest file (.xml)
- * This API will returns it.
- * \remarks N/A
- * \param[in] pkgid Livebox ID. Not the UI-APP ID and PACKAGE ID
- * \return char *
- * \retval content content string
- * \retval NULL there is no specified content string
- * \pre manifest has the default content string. &lt;content&gt;Default content string&lt;content&gt;
- * \post return'd string must be free'd manually
- * \see N/A
- */
-extern char *livebox_service_content(const char *pkgid);
-
-/*!
- * \brief Internationalized icon path of given livebox package.
- * USER must has to do "free" after using the returned string.
- * \details N/A
- * \remarks N/A
- * \param[in] pkgid App ID of a livebox. (It must has to be a livebox package ID. not the UI-APP and the PACKAGE.
- * \param[in] lang locale(en-us, ko-kr, ...), if it is NULL, function will use the system locale automatically
- * \return char *
- * \retval name allocated heap address.
- * \retval NULL if it fails to get path of an icon
- * \pre N/A
- * \post return'd string must be free'd manually
- * \see livebox_service_i18n_name
- * \see livebox_service_preview
- */
-extern char *livebox_service_i18n_icon(const char *pkgid, const char *lang);
-
-/*!
- * \brief Get the path of the plug-in module
- * \details N/A
- * \remarks N/A
- * \param[in] lbid Package name of a livebox
- * \return char *
- * \retval path String which is allocated on the heap
- * \retval NULL if there is no libexec attribute
- * \pre N/A
- * \post return'd string must be free'd manually
- * \see N/A
- */
-extern char *livebox_service_libexec(const char *lbid);
-
-/*!
- * \brief Get the "nodisplay" value
- * \details N/A
- * \remarks N/A
- * \param[in] pkgid Livebox package id.
- * \return int
- * \retval 1 if the box should not be listed by the livebox list app
- * \retval 0 box should be listed
- * \pre livebox tag includes "nodisplay" attribute.
- * \post N/A
- * \see N/A
- */
-extern int livebox_service_nodisplay(const char *pkgid);
-
-/*!
- * \brief Get the "ABI" of given package
- * \details N/A
- * \remarks N/A
- * \param[in] lbid Livebox package id.
- * \return char *
- * \retval abi String which is allocated in the heap
- * \retval NULL if failed to get ABI of given livebox.
- * \pre N/A
- * \post return'd string must be free'd manually
- * \see N/A
- */
-extern char *livebox_service_abi(const char *lbid);
-
-/*!
- * \brief Check the status of the livebox
- * Currently this API is not implemented. just returns 1 all the time.
- * \details N/A
- * \remarks This API is not implemented. it will always returns 1
- * \param[in] lbid Livebox Id
- * \return int
- * \retval 1 enabled
- * \retval 0 disabled
- * \pre N/A
- * \post N/A
- * \see N/A
- */
-extern int livebox_service_is_enabled(const char *lbid);
-
-/*!
- * \brief Get the script file of livebox.
- * \details N/A
- * \remarks N/A
- * \param[in] lbid Livebox Package Id
- * \return char *
- * \retval string script file path
- * \retval NULL if there is not specified script file
- * \pre livebox should be developed as script type
- * \post Return'd string must be free'd manually
- * \see livebox_service_lb_script_group
- */
-extern char *livebox_service_lb_script_path(const char *lbid);
-
-/*!
- * \brief Get the script group of livebox
- * \details N/A
- * \remarks N/A
- * \param[in] lbid Livebox Package Id
- * \return char *
- * \retval Group name of livebox
- * \retval NULL if there is no group defined
- * \pre livebox should be developed as script type
- * \post return'd string must be free'd manually
- * \see livebox_service_lb_script_path
- */
-extern char *livebox_service_lb_script_group(const char *lbid);
-
-/*!
- * \brief Get the script file path of given livebox package.
- * \details N/A
- * \remarks N/A
- * \param[in] lbid Livebox Package Id
- * \return char *
- * \retval string script file path.
- * \retval NULL if there is no specified script file for PD layout
- * \pre N/A
- * \post Return'd string must be free'd manually
- * \see livebox_service_pd_script_group
- */
-extern char *livebox_service_pd_script_path(const char *lbid);
-
-/*!
- * \brief Get the group name for script file to load it.
- * \details N/A
- * \remarks N/A
- * \param[in] lbid Livebox package Id
- * \return char *
- * \retval string script group name
- * \retval NULL if there is no script path
- * \pre N/A
- * \post return'd string must be free'd manually
- * \see livebox_service_pd_script_path
- */
-extern char *livebox_service_pd_script_group(const char *lbid);
-
-/*!
- * \brief Get the supported size list.
- * \details N/A
- * \remarks N/A
- * \param[in] pkgid Livebox Package Id
- * \param[in] cnt Count of array w and h
- * \param[in] w Width array
- * \param[in] h Height array
- * \param[out] cnt Count of array w and h
- * \param[out] w Width array
- * \param[out] h Height array
- * \return int
- * \retval LB_STATUS_SUCCESS if succeed to get supported size list
- * \retval LB_STATUS_ERROR_IO Failed to access DB
- * \retval LB_STATUS_ERROR_INVALID Invalid argument
- * \pre N/A
- * \post N/A
- * \see livebox_service_get_supported_size_types
- */
-extern int livebox_service_get_supported_sizes(const char *pkgid, int *cnt, int *w, int *h);
-
-/*!
- * \brief Get the supported size list of given pkgid
- * \param[in] pkgid Package Name of livebox
- * \param[in] cnt size of types array
- * \param[out] cnt result count of types array
- * \param[out] types array of types
- * \return int
- * \retval LB_STATUS_ERROR_INVALID Invalid argument
- * \retval LB_STATUS_ERROR_IO Failed to access DB
- * \retval LB_STATUS_SUCCESS Successfully done
- * \pre N/A
- * \post N/A
- * \see livebox_service_get_supported_sizes
- */
-extern int livebox_service_get_supported_size_types(const char *pkgid, int *cnt, int *types);
-
-/*!
- * \brief Get the category list of given cluster
- * \details N/A
- * \remarks N/A
- * \param[in] cluster Cluster name
- * \param[in] cb Callback function
- * \param[in] data Callback data
- * \return int
- * \retval LB_STATUS_SUCCESS Successfully done
- * \retval LB_STATUS_ERROR_IO Failed to access DB
- * \retval LB_STATUS_ERROR_INVALID Invalid argument
- * \pre N/A
- * \post N/A
- * \see livebox_service_enumerate_cluster_list
- */
-extern int livebox_service_enumerate_category_list(const char *cluster, int (*cb)(const char *cluster, const char *category, void *data), void *data);
-
-/*!
- * \brief Get the cluster list
- * \details N/A
- * \remarks N/A
- * \param[in] cb Callback function for retrieving the cluster list
- * \param[in] data Callback data
- * \return int
- * \retval LB_STATUS_ERROR_INVALID Invalid argument
- * \retval LB_STATUS_ERROR_IO Failed to access DB
- * \retval count of category items
- * \pre N/A
- * \post N/A
- * \see livebox_service_enumerate_category_list
- */
-extern int livebox_service_enumerate_cluster_list(int (*cb)(const char *cluster, void *data), void *data);
-
-/*!
- * \brief Initialize the Livebox service API
- * \details Open the DB file.
- * You don't need to call this if you are using livebox service API shortly.
- * but if you are using livebox service API while whole life of your S/W,
- * using this, initate the livebox service is more benefical to you.
- * This API will prepare the DB operation, if you don't initiate the livebox service,
- * every API which are related with DB operation will open DB and close it before return from it.
- * \remarks N/A
- * \return int
- * \retval LB_STATUS_SUCCESS if succeed to initialize
- * \retval LB_STATUS_ERROR_IO Failed to access a DB
- * \pre N/A
- * \post N/A
- * \see livebox_service_fini
- */
-extern int livebox_service_init(void);
-
-/*!
- * \brief Finalize the livebox service API
- * \details N/A
- * \remarks N/A
- * \return int
- * \retval LB_STATUS_SUCCESS if succeed to finalize
- * \retval LB_STATUS_ERROR_IO Failed to close the DB (access failed to DB)
- * \pre livebox_service_init
- * \post N/A
- * \see livebox_service_init
- */
-extern int livebox_service_fini(void);
-
-/*!
- * \brief Create a handle for getting the package list.
- * \details
- * If you want get the record one by one from DB, use this.
- * This function will create a iterator.
- * Then you can get the record one by one, but there is no backward iterator.
- * Only you can get forward iterator.
- * After call this function the iterator will be moved to next record automatically.
- * \remarks
- * If you call this function again using created pkglist handle, it will be reset'd
- * so you can get record from first one again.
- * \param[in] pkgid Livebox Package Id
- * \param[in] handle NULL if you call this first. or it will be reseted.
- * \return handle
- * \retval NULL if it fails
- * \retval handle if it successfully create the package list iterator
- * \see livebox_service_pkglist_destroy
- */
-extern struct pkglist_handle *livebox_service_pkglist_create(const char *pkgid, struct pkglist_handle *handle);
-
-/*!
- * \brief Get the lbid & package name & is_prime flag.
- * \param[in] handle Handle which is created by livebox_service_pkglist_create function
- * \param[out] lbid Livebox Id
- * \param[out] pkgname Package Id that includes lbid
- * \param[out] is_prime if the returned lbid is primary, this will be 1 or 0
- * \return int
- * \retval LB_STATUS_SUCCESS Successfully get the record
- * \retval LB_STATUS_ERROR_INVALID Invalid argument
- * \retval LB_STATUS_ERROR_NOT_EXIST reach to the end of result set. you can rewind the iterator call livebox_service_pkglist_create again with current handle.
- * \retval LB_STATUS_ERROR_MEMORY Not enough memory
- * \pre N/A
- * \post you must release the lbid, pkgname manually
- * \see livebox_service_pkglist_create
- * \see livebox_service_pkglist_destroy
- */
-extern int livebox_service_get_pkglist_item(struct pkglist_handle *handle, char **lbid, char **pkgname, int *is_prime);
-
-/*!
- * \brief Destroy the iterator of pkglist
- * \details N/A
- * \remarks N/A
- * \param[in] handle Package list handle
- * \return int
- * \retval LB_STATUS_ERROR_INVALID Invalid handle
- * \retval LB_STATUS_SUCCESS Successfully destroyed
- * \pre handle must be created by livebox_service_pkglist_create
- * \post you have not to use the handle again after destroy it.
- * \see livebox_service_pkglist_create
- */
-extern int livebox_service_pkglist_destroy(struct pkglist_handle *handle);
-
-/*!
- * \brief Find the pkgname by its libexec
- * \details only if the livebox should use the "libexec" attribute in its "<livebox>" tag
- * \remars Only usable for inhouse liveboxes
- * \param[in] libexec so filename
- * \return char *
- * \retval NULL if it fails to get pkgname
- * \retval address heap address of pkgname
- * \pre N/A
- * \post return'd string should be released via "free"
- */
-extern char *livebox_service_pkgname_by_libexec(const char *libexec);
-
-/*!
- * \}
- */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-
-/* End of a file */
diff --git a/livebox-service/CMakeLists.txt b/livebox-service/CMakeLists.txt
new file mode 100644
index 0000000..88bf26b
--- /dev/null
+++ b/livebox-service/CMakeLists.txt
@@ -0,0 +1,61 @@
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+PROJECT(livebox-service C)
+
+SET(PREFIX ${CMAKE_INSTALL_PREFIX})
+SET(EXEC_PREFIX "\${prefix}")
+SET(PROJECT_NAME "${PROJECT_NAME}")
+SET(LIBDIR ${LIB_INSTALL_DIR})
+SET(INCLUDEDIR "\${prefix}/include/${PROJECT_NAME}")
+SET(VERSION_MAJOR 1)
+SET(VERSION "${VERSION_MAJOR}.0.0")
+
+set(CMAKE_SKIP_BUILD_RPATH true)
+
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include)
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../dynamicbox_service/include)
+
+INCLUDE(FindPkgConfig)
+pkg_check_modules(old_pkgs REQUIRED
+ dlog
+ glib-2.0
+ gio-2.0
+ com-core
+ sqlite3
+ db-util
+ pkgmgr
+ pkgmgr-info
+ vconf
+ ail
+ icu-uc
+)
+
+FOREACH(flag ${old_pkgs_CFLAGS})
+ SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
+ENDFOREACH(flag)
+
+SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fvisibility=hidden -Wall -Werror -Winline -g")
+
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
+
+SET(BUILD_SOURCE
+ src/livebox-service.c
+)
+
+ADD_LIBRARY(${PROJECT_NAME} SHARED ${BUILD_SOURCE})
+
+SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES SOVERSION ${VERSION_MAJOR})
+SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES VERSION ${VERSION})
+TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${old_pkgs_LDFLAGS} "dynamicbox_service")
+
+CONFIGURE_FILE(${PROJECT_NAME}.pc.in ${PROJECT_NAME}.pc @ONLY)
+SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${PROJECT_NAME}.pc")
+
+INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${LIB_INSTALL_DIR})
+INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/livebox-service.h DESTINATION include/${PROJECT_NAME})
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/livebox-errno.h DESTINATION include/${PROJECT_NAME})
+
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/LICENSE DESTINATION /usr/share/license RENAME "lib${PROJECT_NAME}")
+
+# End of a file
+
diff --git a/livebox-service/LICENSE b/livebox-service/LICENSE
new file mode 100644
index 0000000..571fe79
--- /dev/null
+++ b/livebox-service/LICENSE
@@ -0,0 +1,206 @@
+Flora License
+
+Version 1.1, April, 2013
+
+http://floralicense.org/license/
+
+TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+1. Definitions.
+
+"License" shall mean the terms and conditions for use, reproduction,
+and distribution as defined by Sections 1 through 9 of this document.
+
+"Licensor" shall mean the copyright owner or entity authorized by
+the copyright owner that is granting the License.
+
+"Legal Entity" shall mean the union of the acting entity and
+all other entities that control, are controlled by, or are
+under common control with that entity. For the purposes of
+this definition, "control" means (i) the power, direct or indirect,
+to cause the direction or management of such entity,
+whether by contract or otherwise, or (ii) ownership of fifty percent (50%)
+or more of the outstanding shares, or (iii) beneficial ownership of
+such entity.
+
+"You" (or "Your") shall mean an individual or Legal Entity
+exercising permissions granted by this License.
+
+"Source" form shall mean the preferred form for making modifications,
+including but not limited to software source code, documentation source,
+and configuration files.
+
+"Object" form shall mean any form resulting from mechanical
+transformation or translation of a Source form, including but
+not limited to compiled object code, generated documentation,
+and conversions to other media types.
+
+"Work" shall mean the work of authorship, whether in Source or Object form,
+made available under the License, as indicated by a copyright notice
+that is included in or attached to the work (an example is provided
+in the Appendix below).
+
+"Derivative Works" shall mean any work, whether in Source or Object form,
+that is based on (or derived from) the Work and for which the editorial
+revisions, annotations, elaborations, or other modifications represent,
+as a whole, an original work of authorship. For the purposes of this License,
+Derivative Works shall not include works that remain separable from,
+or merely link (or bind by name) to the interfaces of, the Work and
+Derivative Works thereof.
+
+"Contribution" shall mean any work of authorship, including the original
+version of the Work and any modifications or additions to that Work or
+Derivative Works thereof, that is intentionally submitted to Licensor
+for inclusion in the Work by the copyright owner or by an individual or
+Legal Entity authorized to submit on behalf of the copyright owner.
+For the purposes of this definition, "submitted" means any form of
+electronic, verbal, or written communication sent to the Licensor or
+its representatives, including but not limited to communication on
+electronic mailing lists, source code control systems, and issue
+tracking systems that are managed by, or on behalf of, the Licensor
+for the purpose of discussing and improving the Work, but excluding
+communication that is conspicuously marked or otherwise designated
+in writing by the copyright owner as "Not a Contribution."
+
+"Contributor" shall mean Licensor and any individual or Legal Entity
+on behalf of whom a Contribution has been received by Licensor and
+subsequently incorporated within the Work.
+
+"Tizen Certified Platform" shall mean a software platform that complies
+with the standards set forth in the Tizen Compliance Specification
+and passes the Tizen Compliance Tests as defined from time to time
+by the Tizen Technical Steering Group and certified by the Tizen
+Association or its designated agent.
+
+2. Grant of Copyright License. Subject to the terms and conditions of
+this License, each Contributor hereby grants to You a perpetual,
+worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+copyright license to reproduce, prepare Derivative Works of,
+publicly display, publicly perform, sublicense, and distribute the
+Work and such Derivative Works in Source or Object form.
+
+3. Grant of Patent License. Subject to the terms and conditions of
+this License, each Contributor hereby grants to You a perpetual,
+worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+(except as stated in this section) patent license to make, have made,
+use, offer to sell, sell, import, and otherwise transfer the Work
+solely as incorporated into a Tizen Certified Platform, where such
+license applies only to those patent claims licensable by such
+Contributor that are necessarily infringed by their Contribution(s)
+alone or by combination of their Contribution(s) with the Work solely
+as incorporated into a Tizen Certified Platform to which such
+Contribution(s) was submitted. If You institute patent litigation
+against any entity (including a cross-claim or counterclaim
+in a lawsuit) alleging that the Work or a Contribution incorporated
+within the Work constitutes direct or contributory patent infringement,
+then any patent licenses granted to You under this License for that
+Work shall terminate as of the date such litigation is filed.
+
+4. Redistribution. You may reproduce and distribute copies of the
+Work or Derivative Works thereof pursuant to the copyright license
+above, in any medium, with or without modifications, and in Source or
+Object form, provided that You meet the following conditions:
+
+ 1. You must give any other recipients of the Work or Derivative Works
+ a copy of this License; and
+ 2. You must cause any modified files to carry prominent notices stating
+ that You changed the files; and
+ 3. You must retain, in the Source form of any Derivative Works that
+ You distribute, all copyright, patent, trademark, and attribution
+ notices from the Source form of the Work, excluding those notices
+ that do not pertain to any part of the Derivative Works; and
+ 4. If the Work includes a "NOTICE" text file as part of its distribution,
+ then any Derivative Works that You distribute must include a readable
+ copy of the attribution notices contained within such NOTICE file,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works, in at least one of the following places:
+ within a NOTICE text file distributed as part of the Derivative Works;
+ within the Source form or documentation, if provided along with the
+ Derivative Works; or, within a display generated by the Derivative Works,
+ if and wherever such third-party notices normally appear.
+ The contents of the NOTICE file are for informational purposes only
+ and do not modify the License. You may add Your own attribution notices
+ within Derivative Works that You distribute, alongside or as an addendum
+ to the NOTICE text from the Work, provided that such additional attribution
+ notices cannot be construed as modifying the License. You may add Your own
+ copyright statement to Your modifications and may provide additional or
+ different license terms and conditions for use, reproduction, or
+ distribution of Your modifications, or for any such Derivative Works
+ as a whole, provided Your use, reproduction, and distribution of
+ the Work otherwise complies with the conditions stated in this License
+ and your own copyright statement or terms and conditions do not conflict
+ the conditions stated in the License including section 3.
+
+5. Submission of Contributions. Unless You explicitly state otherwise,
+any Contribution intentionally submitted for inclusion in the Work
+by You to the Licensor shall be under the terms and conditions of
+this License, without any additional terms or conditions.
+Notwithstanding the above, nothing herein shall supersede or modify
+the terms of any separate license agreement you may have executed
+with Licensor regarding such Contributions.
+
+6. Trademarks. This License does not grant permission to use the trade
+names, trademarks, service marks, or product names of the Licensor,
+except as required for reasonable and customary use in describing the
+origin of the Work and reproducing the content of the NOTICE file.
+
+7. Disclaimer of Warranty. Unless required by applicable law or
+agreed to in writing, Licensor provides the Work (and each
+Contributor provides its Contributions) on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+implied, including, without limitation, any warranties or conditions
+of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+PARTICULAR PURPOSE. You are solely responsible for determining the
+appropriateness of using or redistributing the Work and assume any
+risks associated with Your exercise of permissions under this License.
+
+8. Limitation of Liability. In no event and under no legal theory,
+whether in tort (including negligence), contract, or otherwise,
+unless required by applicable law (such as deliberate and grossly
+negligent acts) or agreed to in writing, shall any Contributor be
+liable to You for damages, including any direct, indirect, special,
+incidental, or consequential damages of any character arising as a
+result of this License or out of the use or inability to use the
+Work (including but not limited to damages for loss of goodwill,
+work stoppage, computer failure or malfunction, or any and all
+other commercial damages or losses), even if such Contributor
+has been advised of the possibility of such damages.
+
+9. Accepting Warranty or Additional Liability. While redistributing
+the Work or Derivative Works thereof, You may choose to offer,
+and charge a fee for, acceptance of support, warranty, indemnity,
+or other liability obligations and/or rights consistent with this
+License. However, in accepting such obligations, You may act only
+on Your own behalf and on Your sole responsibility, not on behalf
+of any other Contributor, and only if You agree to indemnify,
+defend, and hold each Contributor harmless for any liability
+incurred by, or claims asserted against, such Contributor by reason
+of your accepting any such warranty or additional liability.
+
+END OF TERMS AND CONDITIONS
+
+APPENDIX: How to apply the Flora License to your work
+
+To apply the Flora License to your work, attach the following
+boilerplate notice, with the fields enclosed by brackets "[]"
+replaced with your own identifying information. (Don't include
+the brackets!) The text should be enclosed in the appropriate
+comment syntax for the file format. We also recommend that a
+file or class name and description of purpose be included on the
+same "printed page" as the copyright notice for easier
+identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Flora License, Version 1.1 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://floralicense.org/license/
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
diff --git a/livebox-service/include/livebox-errno.h b/livebox-service/include/livebox-errno.h
new file mode 100644
index 0000000..c0c6234
--- /dev/null
+++ b/livebox-service/include/livebox-errno.h
@@ -0,0 +1,70 @@
+/*
+ * Copyright 2013 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __LIVEBOX_ERRNO_H
+#define __LIVEBOX_ERRNO_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @file livebox-errno.h
+ * @brief This file declares API of liblivebox-service library
+ */
+
+/**
+ * @addtogroup CAPI_LIVEBOX_SERVICE_MODULE
+ * @{
+ */
+
+/**
+ * @brief Enumeration for the result status of livebox operation.
+ */
+enum livebox_status {
+ LB_STATUS_SUCCESS = 0x00000000, /**< Operation is successfully completed */
+ LB_STATUS_ERROR = 0x80000000, /**< This will be OR'd with other specific error value */
+ LB_STATUS_ERROR_INVALID = LB_STATUS_ERROR | 0x0001, /**< Invalid request */
+ LB_STATUS_ERROR_FAULT = LB_STATUS_ERROR | 0x0002, /**< Fault - Unable to recover from the error */
+ LB_STATUS_ERROR_MEMORY = LB_STATUS_ERROR | 0x0004, /**< Memory is not enough to do this operation */
+ LB_STATUS_ERROR_EXIST = LB_STATUS_ERROR | 0x0008, /**< Already exists */
+ LB_STATUS_ERROR_BUSY = LB_STATUS_ERROR | 0x0010, /**< Busy so the operation is not started(accepted), try again */
+ LB_STATUS_ERROR_PERMISSION = LB_STATUS_ERROR | 0x0020, /**< Permission error */
+ LB_STATUS_ERROR_ALREADY = LB_STATUS_ERROR | 0x0040, /**< Operation is already started */
+ LB_STATUS_ERROR_CANCEL = LB_STATUS_ERROR | 0x0080, /**< Operation is canceled */
+ LB_STATUS_ERROR_IO = LB_STATUS_ERROR | 0x0100, /**< I/O Error */
+ LB_STATUS_ERROR_NOT_EXIST = LB_STATUS_ERROR | 0x0200, /**< Not exists */
+ LB_STATUS_ERROR_TIMEOUT = LB_STATUS_ERROR | 0x0400, /**< Timeout */
+ LB_STATUS_ERROR_NOT_IMPLEMENTED = LB_STATUS_ERROR | 0x0800, /**< Operation is not implemented */
+ LB_STATUS_ERROR_NO_SPACE = LB_STATUS_ERROR | 0x1000, /**< No space to operate */
+ LB_STATUS_ERROR_DISABLED = LB_STATUS_ERROR | 0x2000 /**< Disabled */
+};
+
+/**
+ * @brief Definition for macro function to check whether given code value indicates error or not.
+ */
+#define LB_STATUS_IS_ERROR(s) (!!((s) & LB_STATUS_ERROR))
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* End of a file */
diff --git a/livebox-service/include/livebox-service.h b/livebox-service/include/livebox-service.h
new file mode 100644
index 0000000..279b6ef
--- /dev/null
+++ b/livebox-service/include/livebox-service.h
@@ -0,0 +1,812 @@
+/*
+ * Copyright 2013 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __LIVEBOX_SERVICE_H
+#define __LIVEBOX_SERVICE_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @file livebox-service.h
+ * @brief This file declares API of liblivebox-service library
+ */
+
+/**
+ * @addtogroup CAPI_LIVEBOX_SERVICE_MODULE
+ * @{
+ */
+
+/**
+ * @brief Definition for maximum number of supported livebox size type.
+ */
+#define NR_OF_SIZE_LIST 13
+
+#define CH_IDX(a, idx) (((char *)(a))[(idx)])
+#define IS_INHOUSE_LIVEBOX(abi) ((CH_IDX(abi, 0) == 'c' || CH_IDX(abi, 0) == 'C') && (CH_IDX(abi, 1) == '\0' || ((CH_IDX(abi, 1) == 'p' || CH_IDX(abi, 1) == 'P') && (CH_IDX(abi, 2) == 'p' || CH_IDX(abi, 2) == 'P') && CH_IDX(abi, 3) == '\0')))
+
+/**
+ * @brief Enumeration for list of supporting livebox size types.
+ */
+enum livebox_size_type {
+ LB_SIZE_TYPE_1x1 = 0x0001, /**< 175x175 based on 720x1280 resolution */
+ LB_SIZE_TYPE_2x1 = 0x0002, /**< 354x175 based on 720x1280 resolution */
+ LB_SIZE_TYPE_2x2 = 0x0004, /**< 354x354 based on 720x1280 resolution */
+ LB_SIZE_TYPE_4x1 = 0x0008, /**< 712x175 based on 720x1280 resolution */
+ LB_SIZE_TYPE_4x2 = 0x0010, /**< 712x354 based on 720x1280 resolution */
+ LB_SIZE_TYPE_4x3 = 0x0020, /**< 712x533 based on 720x1280 resolution */
+ LB_SIZE_TYPE_4x4 = 0x0040, /**< 712x712 based on 720x1280 resolution */
+ LB_SIZE_TYPE_4x5 = 0x0080, /**< 712x891 based on 720x1280 resolution */
+ LB_SIZE_TYPE_4x6 = 0x0100, /**< 712x1070 based on 720x1280 resolution */
+ LB_SIZE_TYPE_EASY_1x1 = 0x1000, /**< 224x215 based on 720x1280 resolution */
+ LB_SIZE_TYPE_EASY_3x1 = 0x2000, /**< 680x215 based on 720x1280 resolution */
+ LB_SIZE_TYPE_EASY_3x3 = 0x4000, /**< 680x653 based on 720x1280 resolution */
+ LB_SIZE_TYPE_0x0 = 0x0800, /**< 720x1280 based on 720x1280 resolution */
+ LB_SIZE_TYPE_UNKNOWN = 0xFFFF /**< Error */
+};
+
+/**
+ * @brief Enumeration for script event of livebox.
+ * @details
+ * This enumeration values will be used for script plugin of data-provider-master.
+ * Master will send down these accessibility events to the script plugin.
+ */
+enum livebox_script_event {
+ LB_SCRIPT_ACCESS_EVENT = 0x01000000, /**< Mask value */
+ LB_SCRIPT_MOUSE_EVENT = 0x02000000, /**< Mask value */
+ LB_SCRIPT_KEY_EVENT = 0x04000000, /**< Mask value */
+
+ LB_SCRIPT_ACCESS_HIGHLIGHT = LB_SCRIPT_ACCESS_EVENT | 0x00000001, /**< Highlight */
+ LB_SCRIPT_ACCESS_HIGHLIGHT_NEXT = LB_SCRIPT_ACCESS_EVENT | 0x00000002, /**< Move Highlight focus to the next object */
+ LB_SCRIPT_ACCESS_HIGHLIGHT_PREV = LB_SCRIPT_ACCESS_EVENT | 0x00000004, /**< Move Highlight focus to the prev object */
+ LB_SCRIPT_ACCESS_ACTIVATE = LB_SCRIPT_ACCESS_EVENT | 0x00000008, /**< Activate the highlighted object */
+ LB_SCRIPT_ACCESS_ACTION = LB_SCRIPT_ACCESS_EVENT | 0x00000010, /**< Do specified action for the highlighted object */
+ LB_SCRIPT_ACCESS_SCROLL = LB_SCRIPT_ACCESS_EVENT | 0x00000020, /**< Scroll operation */
+ LB_SCRIPT_ACCESS_UNHIGHLIGHT = LB_SCRIPT_ACCESS_EVENT | 0x00000040, /**< Remove highlight */
+ LB_SCRIPT_ACCESS_VALUE_CHANGE = LB_SCRIPT_ACCESS_EVENT | 0x00000080, /* TODO: deprecate this */
+ LB_SCRIPT_ACCESS_MOUSE = LB_SCRIPT_ACCESS_EVENT | 0x00000100, /* give mouse event to highlight object */
+ LB_SCRIPT_ACCESS_BACK = LB_SCRIPT_ACCESS_EVENT | 0x00000200, /* go back to a previous view ex: pop naviframe item */
+ LB_SCRIPT_ACCESS_OVER = LB_SCRIPT_ACCESS_EVENT | 0x00000400, /* mouse over an object */
+ LB_SCRIPT_ACCESS_READ = LB_SCRIPT_ACCESS_EVENT | 0x00000800, /* highlight an object */
+ LB_SCRIPT_ACCESS_ENABLE = LB_SCRIPT_ACCESS_EVENT | 0x00001000, /* enable highlight and read ability */
+ LB_SCRIPT_ACCESS_DISABLE = LB_SCRIPT_ACCESS_EVENT | 0x00002000, /* disable highlight and read ability */
+
+ LB_SCRIPT_MOUSE_DOWN = LB_SCRIPT_MOUSE_EVENT | 0x00001000, /**< Mouse down */
+ LB_SCRIPT_MOUSE_MOVE = LB_SCRIPT_MOUSE_EVENT | 0x00002000, /**< Mouse move */
+ LB_SCRIPT_MOUSE_UP = LB_SCRIPT_MOUSE_EVENT | 0x00004000, /**< Mouse up */
+ LB_SCRIPT_MOUSE_IN = LB_SCRIPT_MOUSE_EVENT | 0x00008000, /**< Mouse in */
+ LB_SCRIPT_MOUSE_OUT = LB_SCRIPT_MOUSE_EVENT | 0x00010000, /**< Mouse out */
+
+ LB_SCRIPT_MOUSE_ON_SCROLL = LB_SCRIPT_MOUSE_EVENT | 0x00020000, /**< If the box in in scroller and it is scrolled */
+ LB_SCRIPT_MOUSE_OFF_SCROLL = LB_SCRIPT_MOUSE_EVENT | 0x00040000, /**< If the box is in scroller but the scroll is stopped */
+ LB_SCRIPT_MOUSE_ON_HOLD = LB_SCRIPT_MOUSE_EVENT | 0x00080000, /**< Even though the box gets mouse_up event, the click event will not be generated */
+ LB_SCRIPT_MOUSE_OFF_HOLD = LB_SCRIPT_MOUSE_EVENT | 0x00100000, /**< Generate the click event if the mouse_up event occurred as normal */
+
+ LB_SCRIPT_KEY_DOWN = LB_SCRIPT_KEY_EVENT | 0x00020000, /**< Key pressed */
+ LB_SCRIPT_KEY_UP = LB_SCRIPT_KEY_EVENT | 0x00040000, /**< Key released */
+ LB_SCRIPT_KEY_FOCUS_IN = LB_SCRIPT_KEY_EVENT | 0x00080000, /**< Key focus in */
+ LB_SCRIPT_KEY_FOCUS_OUT = LB_SCRIPT_KEY_EVENT | 0x00100000, /**< Key focus out */
+};
+
+/**
+ * @brief Enumeration for result of accessibility event processing.
+ * @details Reference the libprovider & liblivebox-viewer.
+ */
+enum livebox_access_status {
+ LB_ACCESS_STATUS_ERROR = 0x80000000, /**< Mask value */
+ LB_ACCESS_STATUS_DONE = 0x00000000, /**< Successfully finished */
+ LB_ACCESS_STATUS_FIRST, /**< Reach to the first item */
+ LB_ACCESS_STATUS_LAST, /**< Reach to the last item */
+ LB_ACCESS_STATUS_READ /**< TTS is done */
+};
+
+enum livebox_key_status {
+ LB_KEY_STATUS_ERROR = 0x80000000, /**< Key operation is failed */
+ LB_KEY_STATUS_DONE = 0x00000000, /**< Key operation is successfully done */
+ LB_KEY_STATUS_FIRST, /**< Focusable object item reaches to the first in it */
+ LB_KEY_STATUS_LAST, /**< Focusable object item reaches to the last in it */
+};
+
+enum livebox_delete_type {
+ LB_DELETE_PERMANENTLY = 0x01, /**< The livebox is removed from the homescreen temporary */
+ LB_DELETE_TEMPORARY = 0x02, /**< The livebox is removed from the homescreen by user permanently */
+ LB_DELETE_INVALID = 0xff, /**< Unknown event type */
+};
+
+enum livebox_pd_close_type {
+ LB_CLOSE_PD_NORMAL = 0x00, /**< PD is closed normally */
+ LB_CLOSE_PD_TIMEOUT = 0x01, /**< PD is closed because of timeout, there is no response */
+ LB_CLOSE_PD_FAULT = 0x02, /**< PD is closed because of unrecoverable error */
+ LB_CLOSE_PD_INVALID = 0xff, /**< Unknown event type */
+};
+
+/**
+ * @brief Package list handle.
+ */
+struct pkglist_handle;
+
+/**
+ * @brief Gets the pixel size of given size type.
+ * @details
+ * Size types would be\n
+ * #LB_SIZE_TYPE_1x1\n
+ * #LB_SIZE_TYPE_2x1\n
+ * #LB_SIZE_TYPE_2x2\n
+ * #LB_SIZE_TYPE_4x1\n
+ * #LB_SIZE_TYPE_4x2\n
+ * #LB_SIZE_TYPE_4x3\n
+ * #LB_SIZE_TYPE_4x4\n
+ * #LB_SIZE_TYPE_4x5\n
+ * #LB_SIZE_TYPE_4x6\n
+ * #LB_SIZE_TYPE_0x0\n
+ * #LB_SIZE_TYPE_EASY_1x1\n
+ * #LB_SIZE_TYPE_EASY_3x1\n
+ * #LB_SIZE_TYPE_EASY_3x3.
+ * @param[in] type Size type
+ * @param[out] width Pixel size width
+ * @param[out] height Pixel size height
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/core/dynamicbox.info
+ * @return int type
+ * @retval #LB_STATUS_SUCCESS Successfully done
+ * @see livebox_size_type()
+ * @see livebox_service_size_type()
+ */
+extern int livebox_service_get_size(int type, int *width, int *height);
+
+/**
+ * @brief Gets the size type for given pixel size.
+ * @details
+ * Returnable size types are\n
+ * #LB_SIZE_TYPE_1x1\n
+ * #LB_SIZE_TYPE_2x1\n
+ * #LB_SIZE_TYPE_2x2\n
+ * #LB_SIZE_TYPE_4x1\n
+ * #LB_SIZE_TYPE_4x2\n
+ * #LB_SIZE_TYPE_4x3\n
+ * #LB_SIZE_TYPE_4x4\n
+ * #LB_SIZE_TYPE_4x5\n
+ * #LB_SIZE_TYPE_4x6\n
+ * #LB_SIZE_TYPE_0x0\n
+ * #LB_SIZE_TYPE_EASY_1x1\n
+ * #LB_SIZE_TYPE_EASY_3x1\n
+ * #LB_SIZE_TYPE_EASY_3x3\n
+ * or\n
+ * #LB_SIZE_TYPE_UNKNOWN for error.
+ * @param[in] width Pixel size width
+ * @param[in] height Pixel size height
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/core/dynamicbox.info
+ * @return int type
+ * @retval #LB_SIZE_TYPE_[EASY_]WxH Size type of given pixel size
+ * @retval #LB_SIZE_TYPE_UNKNOWN If the given pixel size is not valid
+ * @see livebox_size_type()
+ * @see livebox_service_get_size()
+ */
+extern int livebox_service_size_type(int width, int height);
+
+/**
+ * @brief Supports the mouse event of livebox content.
+ * @param[in] lbid Livebox AppId
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/core/dynamicbox.info
+ * @return int type
+ * @retval 1 If the box requires mouse event, A viewer must has to feed the mouse event to the box instance
+ * @retval 0 If the box doesn't requires mouse event
+ * @see livebox_service_touch_effect()
+ * @see livebox_service_need_frame()
+ */
+extern int livebox_service_mouse_event(const char *lbid, int size_type);
+
+/**
+ * @brief Requires touch effect.
+ * @details If this API returns true(1), the viewer should make touch effect when a user click the livebox.
+ * @param[in] lbid Livebox AppId
+ * @param[in] size_type Size type
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/core/dynamicbox.info
+ * @return int type
+ * @retval 1 If the box requires touch effect, A viewer should make the touch effect, but it is just recomendation.
+ * @retval 0 If the box doesn't requires touch effect, the box will make touch effect itself
+ * @see livebox_service_mouse_event()
+ * @see livebox_service_need_frame()
+ */
+extern int livebox_service_touch_effect(const char *lbid, int size_type);
+
+/**
+ * @brief Requires decoration frame.
+ * @details If this API returns true(1), the viewer should make decoration border on the livebox content.
+ * @param[in] lbid Livebox AppId
+ * @param[in] size_type Size type
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/core/dynamicbox.info
+ * @return int type
+ * @retval 1 If the box requires frame for decorating its contents
+ * @retval 0 If the box doesn't requires frame
+ * @see livebox_service_mouse_event()
+ * @see livebox_service_touch_effect()
+ */
+extern int livebox_service_need_frame(const char *lbid, int size_type);
+
+/**
+ * @brief Triggers the update event for given livebox instance.
+ * @param[in] lbid Livebox AppId
+ * @param[in] instance_id Set @c NULL if you don't know what the Id is. Then every instance of given pkgname will be triggered its update event
+ * @param[in] cluster Cluster name. Default @c NULL
+ * @param[in] category Category name, Default @c NULL
+ * @param[in] force 1 if you want to update your livebox even if the provider is paused or 0. 0 is default
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/core/dynamicbox.service
+ * @return int type
+ * @retval #LB_STATUS_ERROR_INVALID Invalid argument
+ * @retval #LB_STATUS_ERROR_CANCEL Provider is paused, so this update request is canceld.(ignored), if you want to make update forcely, use force=1
+ * @retval #LB_STATUS_ERROR_MEMORY Memory is not enough to make request
+ * @retval #LB_STATUS_ERROR_FAULT Failed to create a request packet
+ * @retval #LB_STATUS_SUCCESS Successfully requested
+ */
+extern int livebox_service_trigger_update(const char *lbid, const char *instance_id, const char *cluster, const char *category, int force);
+
+/**
+ * @brief Triggers the update event for given livebox instance.
+ * @param[in] lbid Livebox AppId
+ * @param[in] instance_id Set @c NULL if you don't know what the Id is. Then every instance of given pkgname will be triggered its update event
+ * @param[in] cluster Cluster name. Default @c NULL
+ * @param[in] category Category name, Default @c NULL
+ * @param[in] content New content information, Default @c NULL
+ * @param[in] force 1 if you want to update your livebox even if the provider is paused or 0. 0 is default
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/core/dynamicbox.service
+ * @return int type
+ * @retval #LB_STATUS_ERROR_INVALID Invalid argument
+ * @retval #LB_STATUS_ERROR_CANCEL Provider is paused, so this update request is canceld.(ignored), if you want to make update forcely, use force=1
+ * @retval #LB_STATUS_ERROR_MEMORY Memory is not enough to make request
+ * @retval #LB_STATUS_ERROR_FAULT Failed to create a request packet
+ * @retval #LB_STATUS_SUCCESS Successfully requested
+ * @see livebox_service_trigger_update()
+ */
+extern int livebox_service_trigger_update_with_content(const char *lbid, const char *instance_id, const char *cluster, const char *category, const char *content, int force);
+
+/**
+ * @brief Changes the update period of given livebox instance.
+ * @param[in] lbid Livebox AppId
+ * @param[in] instance_id Livebox instance id
+ * @param[in] period New update period in sec
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/core/dynamicbox.service
+ * @return int type
+ * @retval #LB_STATUS_SUCCESS Successfully changed(requested)
+ * @retval #LB_STATUS_ERROR_INVALID Invalid argument
+ * @retval #LB_STATUS_ERROR_FAULT Failed to create a request packet
+ * @retval #LB_STATUS_ERROR_MEMORY Not enough memory
+ */
+extern int livebox_service_change_period(const char *lbid, const char *instance_id, double period);
+
+/**
+ * @brief Gets synchronous package list.
+ * @details
+ * callback (appid, lbid, is_prime)\n
+ * pkgid == Package ID (pkgname)\n
+ * lbid = Livebox AppId\n
+ * is_prime = 1 if the livebox is default one for associated application package\n
+ * If the callback returns negative value, the list crawling will be stopped.
+ * @param[in] cb Callback function
+ * @param[in] data Callback data
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/core/dynamicbox.info
+ * @return int type
+ * @retval #LB_STATUS_ERROR_IO Failed to access DB
+ * @retval #LB_STATUS_ERROR_INVALID Invalid argument
+ * @retval count Count of livebox packages
+ * @see livebox_service_get_pkglist_by_pkgid()
+ */
+extern int livebox_service_get_pkglist(int (*cb)(const char *pkgid, const char *lbid, int is_prime, void *data), void *data);
+
+/**
+ * @brief Gets synchronous uiapp list.
+ * @details
+ * Callback (appid, data)\n
+ * This function will retrieve all UI Apps in a package which has given livebox appid(lbid).\n
+ * If you need to get all ui-app list, using a livebox appid, this function is able to help you.
+ * @param[in] lbid Livebox App Id
+ * @param[in] cb Callback function
+ * @param[in] data Callback Data
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/core/dynamicbox.info
+ * @return int type
+ * @retval #LB_STATUS_SUCCESS Status success
+ * @retval #LB_STATUS_ERROR_INVALID Invalid argument
+ * @retval #LB_STATUS_ERROR_IO Failed to access DB
+ * @retval #LB_STATUS_ERROR_MEMORY Memory error
+ * @retval #LB_STATUS_ERROR_FAULT
+ */
+extern int livebox_service_get_applist(const char *lbid, void (*cb)(const char *lbid, const char *appid, void *data), void *data);
+
+/**
+ * @brief Gets the MAIN application Id of given livebox package Id.
+ * @param[in] lbid Livebox Package Id
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/core/dynamicbox.info
+ * @return char * type
+ * @retval @c NULL If it fails to get main application Id (UI-APPID)
+ * @retval appid Main application Id
+ */
+extern char *livebox_service_mainappid(const char *lbid);
+
+/**
+ * @brief Gets synchronous package list.
+ * @details
+ * callback (lbid, is_prime)\n
+ * lbid == Livebox AppId\n
+ * is_prime = 1 if the livebox is default one for selected package\n
+ * If the callback returns negative value, the list crawling will be stopped.
+ * @param[in] pkgid Package Id (Not the UI App Id)
+ * @param[in] cb Callback function
+ * @param[in] data Callback data
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/core/dynamicbox.info
+ * @return int type
+ * @retval int Count of livebox packages
+ * @retval #LB_STATUS_ERROR_INVALID Invalid argument
+ * @retval #LB_STATUS_ERROR_IO Failed to access DB
+ * @see livebox_service_get_pkglist()
+ */
+extern int livebox_service_get_pkglist_by_pkgid(const char *pkgid, int (*cb)(const char *lbid, int is_prime, void *data), void *data);
+
+/**
+ * @brief Gets synchronous package list.
+ * @details
+ * callback (lbid)\n
+ * lbid == Livebox AppId\n
+ * If the callback returns negative value, the list crawling will be stopped
+ * @param[in] category Name of category
+ * @param[in] cb Callback function
+ * @param[in] data Callback data
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/core/dynamicbox.info
+ * @return int count
+ * @retval Count of livebox packages
+ * @retval #LB_STATUS_ERROR_INVALID Invalid argument
+ * @retval #LB_STATUS_ERROR_IO Failed to access DB
+ * @see livebox_service_get_pkglist_by_pkgid()
+ */
+extern int livebox_service_get_pkglist_by_category(const char *category, int (*cb)(const char *lbid, void *data), void *data);
+
+/**
+ * @brief Gets the lbid of a primary livebox using given lbid or pkgid or UI appid.
+ * @param[in] id Livebox Id or Package Id
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/core/dynamicbox.info
+ * @return char * type
+ * @retval @c NULL Failed to get primary lbid
+ * @retval lbid Primary livebox Id. which is allocated in the heap
+ * @pre Must be released returned string by manually.
+ * @see livebox_service_appid()
+ */
+extern char *livebox_service_pkgname(const char *lbid);
+
+/**
+ * @brief Checks the primary flag of given livebox Id.
+ * @param[in] lbid Livebox Id
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/core/dynamicbox.info
+ * @return int type
+ * @retval 0 If is not a primary
+ * @retval 1 If it is a primary livebox
+ */
+extern int livebox_service_is_primary(const char *lbid);
+
+/**
+ * @brief Get the category using given lbid.
+ * @param[in] lbid Livebox AppId
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/core/dynamicbox.info
+ * @return char *
+ * @retval @c NULL Failed to get primary lbid
+ * @retval category Category string which is allocated in the heap.
+ * @pre Must be released returned string by manually
+ * @post N/A
+ * @see livebox_service_pkgname()
+ */
+extern char *livebox_service_category(const char *lbid);
+
+/**
+ * @brief Gets the name of a livebox (provider name == livebox appid), you have to release the return value after use it.
+ * @details
+ * OSP livebox has provider process for each livebox instances.\n
+ * To get the provider's package name, you can use this API.\n
+ * If the given lbid is inhouse livebox, the return string will be the same with given argument but it is allocated in the heap.\n
+ * So you have to free it if you don't need it anymore.
+ * @param[in] lbid Livebox Id
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/core/dynamicbox.info
+ * @return char * type
+ * @retval @c NULL Failed to get provider name
+ * @retval lbid Livebox AppId which is allocated on the heap
+ * @post Returned string must be free'd manually.
+ */
+extern char *livebox_service_provider_name(const char *lbid);
+
+/**
+ * @brief Gets the appId of setup app which is specified by given livebox Id's manifest.
+ * @details This setup app should be launched before adding the livebox to get the content_info.
+ * @details
+ * This function should be called before add a livebox.
+ * To determine the content information string.
+ * @param[in] lbid Livebox Id
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/core/dynamicbox.info
+ * @return char * type
+ * @retval @c NULL There is no setup application
+ * @retval appid AppId if exists or @c NULL
+ * @post Returned string must be free'd manually.
+ */
+extern char *livebox_service_setup_appid(const char *lbid);
+
+/**
+ * @brief Gets the Package Id (Not the UI App Id) of given livebox, &lt;manifest package="AAA"&gt; tag.
+ * @param[in] lbid Livebox AppId
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/core/dynamicbox.info
+ * @return char * type
+ * @retval appid String which is allocated in the heap
+ * @retval @c NULL Invalid appid
+ * @post Returned string must be free'd manually.
+ * @see livebox_service_pkgname()
+ */
+extern char *livebox_service_appid(const char *lbid);
+
+/**
+ * @brief Gives Internationalized name of livebox package.
+ * @param[in] lbid Livebox AppId
+ * @param[in] lang Locale(en-us, ko-kr, ...), if it is @c NULL, function will use the system locale automatically
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/core/dynamicbox.info
+ * @return char * type
+ * @retval name If it fails to get name
+ * @retval @c NULL Allocated heap address
+ * @post Returned string must be free'd by manually.
+ * @see livebox_service_i18n_icon()
+ * @see livebox_service_preview()
+ */
+extern char *livebox_service_i18n_name(const char *lbid, const char *lang);
+
+/**
+ * @brief Gets the preview image path of given size type.
+ * @details This function will returns i18nized preview image path.
+ * @param[in] lbid Livebox AppId
+ * @param[in] size_type Livebox size type
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/core/dynamicbox.info
+ * @return char * type
+ * @retval path Preview image path
+ * @retval @c NULL There is no preview image file
+ * @post Returned string must be free'd manually.
+ * @see livebox_service_i18n_icon()
+ * @see livebox_service_i18n_name()
+ */
+extern char *livebox_service_preview(const char *lbid, int size_type);
+
+/**
+ * @brief Gets the default content string of the given livebox.
+ * @details
+ * If the user defines the default content string in the manifest file (.xml),
+ * this API will return it.
+ * @param[in] lbid Livebox AppId
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/core/dynamicbox.info
+ * @return char * type
+ * @retval content Content string
+ * @retval @c NULL There is no specified content string
+ * @pre Manifest has the default content string. &lt;content&gt;Default content string&lt;content&gt; tag.
+ * @post Returned string must be free'd manually.
+ */
+extern char *livebox_service_content(const char *lbid);
+
+/**
+ * @brief Gives Internationalized icon path of given livebox package.
+ * @details The user should free the returned string with free().
+ * @param[in] lbid Livebox AppId (It must has to be a livebox package ID. not the UI-APP and the PACKAGE)
+ * @param[in] lang Locale(en-us, ko-kr, ...), if it is @c NULL, function will use the system locale automatically
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/core/dynamicbox.info
+ * @return char * type
+ * @retval name Allocated heap address
+ * @retval @c NULL Fails to get path of an icon
+ * @post Returned string must be free'd manually.
+ * @see livebox_service_i18n_name()
+ * @see livebox_service_preview()
+ */
+extern char *livebox_service_i18n_icon(const char *pkgid, const char *lang);
+
+/**
+ * @brief Gets the "nodisplay" value.
+ * @param[in] lbid Livebox AppId
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/core/dynamicbox.info
+ * @return int type
+ * @retval 1 The box should not be listed by the livebox list app
+ * @retval 0 Box should be listed
+ * @pre Livebox tag includes "nodisplay" attribute.
+ */
+extern int livebox_service_nodisplay(const char *lbid);
+
+/**
+ * @brief Gets the "ABI" of given package.
+ * @param[in] lbid Livebox AppId
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/core/dynamicbox.info
+ * @return char * type
+ * @retval abi String which is allocated in the heap
+ * @retval @c NULL Failed to get ABI of given livebox
+ * @post Returned string must be free'd manually.
+ */
+extern char *livebox_service_abi(const char *lbid);
+
+/**
+ * @brief Checks the status of the livebox.
+ * @details Currently this API is not implemented. It just returns 1 all the time.
+ * @remarks This API is not implemented. It will always return 1.
+ * @param[in] lbid Livebox AppId
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/core/dynamicbox.info
+ * @return int type
+ * @retval 1 Enabled
+ * @retval 0 Disabled
+ */
+extern int livebox_service_is_enabled(const char *lbid);
+
+/**
+ * @brief Gets the script file of livebox.
+ * @param[in] lbid Livebox AppId
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/core/dynamicbox.info
+ * @return char * type
+ * @retval string Script file path
+ * @retval @c NULL Not specified script file
+ * @pre Livebox should be developed as script type.
+ * @post Return'd string must be free'd manually.
+ * @see livebox_service_lb_script_group()
+ */
+extern char *livebox_service_lb_script_path(const char *lbid);
+
+/**
+ * @brief Gets the script group of livebox.
+ * @param[in] lbid Livebox AppId
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/core/dynamicbox.info
+ * @return char * type
+ * @retval Group Name of livebox
+ * @retval @c NULL If there is no group defined
+ * @pre Livebox should be developed as script type.
+ * @post Return'd string must be free'd manually.
+ * @see livebox_service_lb_script_path()
+ */
+extern char *livebox_service_lb_script_group(const char *lbid);
+
+/**
+ * @brief Gets the script file path of given livebox package.
+ * @param[in] lbid Livebox AppId
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/core/dynamicbox.info
+ * @return char * type
+ * @retval string Script file path
+ * @retval @c NULL No specified script file for PD layout
+ * @post Returned string must be free'd manually.
+ * @see livebox_service_pd_script_group()
+ */
+extern char *livebox_service_pd_script_path(const char *lbid);
+
+/**
+ * @brief Gets the group name for script file to load it.
+ * @param[in] lbid Livebox AppId
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/core/dynamicbox.info
+ * @return char * type
+ * @retval string Script group name
+ * @retval @c NULL No script path
+ * @post Returned string must be free'd manually.
+ * @see livebox_service_pd_script_path()
+ */
+extern char *livebox_service_pd_script_group(const char *lbid);
+
+/**
+ * @brief Gets the supported size list.
+ * @param[in] lbid Livebox AppId
+ * @param[in] cnt Count of array w and h
+ * @param[in] w Width array
+ * @param[in] h Height array
+ * @param[out] cnt Count of array w and h
+ * @param[out] w Width array
+ * @param[out] h Height array
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/core/dynamicbox.info
+ * @return int type
+ * @retval #LB_STATUS_SUCCESS If succeed to get supported size list
+ * @retval #LB_STATUS_ERROR_IO Failed to access DB
+ * @retval #LB_STATUS_ERROR_INVALID Invalid argument
+ * @see livebox_service_get_supported_size_types()
+ */
+extern int livebox_service_get_supported_sizes(const char *lbid, int *cnt, int *w, int *h);
+
+/**
+ * @brief Gets the supported size list of given pkgid.
+ * @param[in] lbid Livebox AppId
+ * @param[in] cnt Size of types array
+ * @param[out] cnt Result count of types array
+ * @param[out] types Array of types
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/core/dynamicbox.info
+ * @return int type
+ * @retval #LB_STATUS_ERROR_INVALID Invalid argument
+ * @retval #LB_STATUS_ERROR_IO Failed to access DB
+ * @retval #LB_STATUS_SUCCESS Successfully done
+ * @see livebox_service_get_supported_sizes()
+ */
+extern int livebox_service_get_supported_size_types(const char *lbid, int *cnt, int *types);
+
+/**
+ * @brief Gets the category list of given cluster.
+ * @param[in] cluster Cluster name
+ * @param[in] cb Callback function
+ * @param[in] data Callback data
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/core/dynamicbox.info
+ * @return int type
+ * @retval #LB_STATUS_SUCCESS Successfully done
+ * @retval #LB_STATUS_ERROR_IO Failed to access DB
+ * @retval #LB_STATUS_ERROR_INVALID Invalid argument
+ * @see livebox_service_enumerate_cluster_list()
+ */
+extern int livebox_service_enumerate_category_list(const char *cluster, int (*cb)(const char *cluster, const char *category, void *data), void *data);
+
+/**
+ * @brief Gets the cluster list.
+ * @param[in] cb Callback function for retrieving the cluster list
+ * @param[in] data Callback data
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/core/dynamicbox.info
+ * @return int type
+ * @retval #LB_STATUS_ERROR_INVALID Invalid argument
+ * @retval #LB_STATUS_ERROR_IO Failed to access DB
+ * @retval count Count of category items
+ * @see livebox_service_enumerate_category_list()
+ */
+extern int livebox_service_enumerate_cluster_list(int (*cb)(const char *cluster, void *data), void *data);
+
+/**
+ * @brief Initializes the Livebox service API.
+ * @details Open the DB file.\n
+ * You don't need to call this if you are using livebox service API shortly.\n
+ * But if you are using livebox service API while whole life of your S/W,
+ * using this, initate the livebox service is more benefical to you.\n
+ * This API will prepare the DB operation, if you don't initiate the livebox service,
+ * every API which are related with DB operation will open DB and close it before return from it.
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/core/dynamicbox.info
+ * @return int type
+ * @retval #LB_STATUS_SUCCESS Succeed to initialize
+ * @retval #LB_STATUS_ERROR_IO Failed to access a DB
+ * @see livebox_service_fini()
+ */
+extern int livebox_service_init(void);
+
+/**
+ * @brief Finalizes the livebox service API.
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/core/dynamicbox.info
+ * @return int type
+ * @retval #LB_STATUS_SUCCESS Succeed to finalize
+ * @retval #LB_STATUS_ERROR_IO Failed to close the DB (access failed to DB)
+ * @pre Livebox_service_init.
+ * @see livebox_service_init()
+ */
+extern int livebox_service_fini(void);
+
+/**
+ * @brief Creates a handle for getting the package list.
+ * @details
+ * If you want get the record one by one from DB, use this.\n
+ * This function will create a iterator.\n
+ * Then you can get the records one by one, but there is no backward iterator.\n
+ * You can only get a forward iterator.\n
+ * After calling this function the iterator will be moved to the next record automatically.
+ * @remarks
+ * If you call this function again using created pkglist handle, it will be reset.
+ * So you can get records from the first one again.
+ * @param[in] lbid Livebox AppId
+ * @param[in] handle @c NULL if you call this first, or it will be reset
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/core/dynamicbox.info
+ * @return handle
+ * @retval @c NULL If it fails
+ * @retval handle If it successfully create the package list iterator
+ * @see livebox_service_pkglist_destroy()
+ */
+extern struct pkglist_handle *livebox_service_pkglist_create(const char *lbid, struct pkglist_handle *handle);
+
+/**
+ * @brief Gets the lbid & package name & is_prime flag.
+ * @param[in] handle Handle which is created by livebox_service_pkglist_create() function
+ * @param[out] lbid Livebox Id
+ * @param[out] pkgname Package Id which includes liveboxes
+ * @param[out] is_prime If the returned lbid is primary, this will be 1 or 0
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/core/dynamicbox.info
+ * @return int type
+ * @retval #LB_STATUS_SUCCESS Successfully get the record
+ * @retval #LB_STATUS_ERROR_INVALID Invalid argument
+ * @retval #LB_STATUS_ERROR_NOT_EXIST Reach to the end of result set. you can rewind the iterator call livebox_service_pkglist_create() again with current handle
+ * @retval #LB_STATUS_ERROR_MEMORY Not enough memory
+ * @post You must release the lbid, pkgname manually.
+ * @see livebox_service_pkglist_create()
+ * @see livebox_service_pkglist_destroy()
+ */
+extern int livebox_service_get_pkglist_item(struct pkglist_handle *handle, char **lbid, char **pkgname, int *is_prime);
+
+/**
+ * @brief Destroys the iterator of pkglist.
+ * @param[in] handle Package list handle
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/core/dynamicbox.info
+ * @return int type
+ * @retval #LB_STATUS_ERROR_INVALID Invalid handle
+ * @retval #LB_STATUS_SUCCESS Successfully destroyed
+ * @pre Handle must be created by livebox_service_pkglist_create().
+ * @post You have not to use the handle again after destroy it.
+ * @see livebox_service_pkglist_create()
+ */
+extern int livebox_service_pkglist_destroy(struct pkglist_handle *handle);
+
+/**
+ * @brief Getting the activated instance count.
+ * @param[in] lbid Livebox Id, if you want to get whole instnaces list, use NULL.
+ * @param[in] cluster Cluster name if you don't know what this is, use NULL.
+ * @param[in] category Sub-cluster(category) name if you don't know what this is, use NULL.
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/core/dynamicbox.service
+ * @return count of instances
+ * @retval #LB_STATUS_ERROR_INVALID Invalid parameter
+ * @retval #LB_STATUS_ERROR_FAULT Unrecorvarable error occurred
+ * @retval count Positive value including ZERO, Count of activated instances on viewers
+ */
+extern int livebox_service_get_instance_count(const char *lbid, const char *cluster, const char *category);
+
+/**
+ * @brief Getting the max count of creatable instances.
+ * @param[in] lbid Livebox Id
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/core/dynamicbox.info
+ * @return int count of boxes
+ * @retval 0 Instance count is not limited
+ * @retval >0 Instance count is limited to >0
+ * @retval #LB_STATUS_ERROR_INVALID invalid parameter
+ * @retval #LB_STATUS_ERROR_IO Unable to access DB
+ * @see livebox_service_get_instance_count()
+ */
+extern int livebox_service_max_instance_count(const char *lbid);
+
+/*@
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
+/* End of a file */
diff --git a/livebox-service.pc.in b/livebox-service/livebox-service.pc.in
index c0abee8..8e0699b 100644
--- a/livebox-service.pc.in
+++ b/livebox-service/livebox-service.pc.in
@@ -6,6 +6,6 @@ includedir=@INCLUDEDIR@
Name: livebox-service
Description: livebox service library
Version: @VERSION@
-Libs: -L${libdir} -llivebox-service
+Libs: -L${libdir} -llivebox-service -ldynamicbox_service
Cflags: -I${includedir}
cppflags: -I${includedir}
diff --git a/livebox-service/src/livebox-service.c b/livebox-service/src/livebox-service.c
new file mode 100644
index 0000000..f3e5b3a
--- /dev/null
+++ b/livebox-service/src/livebox-service.c
@@ -0,0 +1,234 @@
+#include <stdio.h>
+
+#include <sqlite3.h>
+
+#include "livebox-service.h"
+#include "livebox-errno.h"
+
+#define EAPI __attribute__((visibility("default")))
+
+struct pkglist_handle {
+ enum pkglist_type {
+ PKGLIST_TYPE_LB_LIST = 0x00beef00,
+ PKGLIST_TYPE_UNKNOWN = 0x00dead00
+ } type;
+ sqlite3 *handle;
+ sqlite3_stmt *stmt;
+};
+
+EAPI int livebox_service_get_size(int type, int *width, int *height)
+{
+ return LB_STATUS_ERROR_NOT_IMPLEMENTED;
+}
+
+EAPI int livebox_service_size_type(int width, int height)
+{
+ return LB_STATUS_ERROR_NOT_IMPLEMENTED;
+}
+
+EAPI int livebox_service_mouse_event(const char *lbid, int size_type)
+{
+ return LB_STATUS_ERROR_NOT_IMPLEMENTED;
+}
+
+EAPI int livebox_service_touch_effect(const char *lbid, int size_type)
+{
+ return LB_STATUS_ERROR_NOT_IMPLEMENTED;
+}
+
+EAPI int livebox_service_need_frame(const char *lbid, int size_type)
+{
+ return LB_STATUS_ERROR_NOT_IMPLEMENTED;
+}
+
+EAPI int livebox_service_trigger_update(const char *lbid, const char *instance_id, const char *cluster, const char *category, int force)
+{
+ return LB_STATUS_ERROR_NOT_IMPLEMENTED;
+}
+
+EAPI int livebox_service_trigger_update_with_content(const char *lbid, const char *instance_id, const char *cluster, const char *category, const char *content, int force)
+{
+ return LB_STATUS_ERROR_NOT_IMPLEMENTED;
+}
+
+EAPI int livebox_service_change_period(const char *lbid, const char *instance_id, double period)
+{
+ return LB_STATUS_ERROR_NOT_IMPLEMENTED;
+}
+
+EAPI int livebox_service_get_pkglist(int (*cb)(const char *pkgid, const char *lbid, int is_prime, void *data), void *data)
+{
+ return LB_STATUS_ERROR_NOT_IMPLEMENTED;
+}
+
+EAPI int livebox_service_get_applist(const char *lbid, void (*cb)(const char *lbid, const char *appid, void *data), void *data)
+{
+ return LB_STATUS_ERROR_NOT_IMPLEMENTED;
+}
+
+EAPI char *livebox_service_mainappid(const char *lbid)
+{
+ return NULL;
+}
+
+EAPI int livebox_service_get_pkglist_by_pkgid(const char *pkgid, int (*cb)(const char *lbid, int is_prime, void *data), void *data)
+{
+ return LB_STATUS_ERROR_NOT_IMPLEMENTED;
+}
+
+EAPI int livebox_service_get_pkglist_by_category(const char *category, int (*cb)(const char *lbid, void *data), void *data)
+{
+ return LB_STATUS_ERROR_NOT_IMPLEMENTED;
+}
+
+EAPI char *livebox_service_pkgname(const char *lbid)
+{
+ return NULL;
+}
+
+EAPI int livebox_service_is_primary(const char *lbid)
+{
+ return LB_STATUS_ERROR_NOT_IMPLEMENTED;
+}
+
+EAPI char *livebox_service_category(const char *lbid)
+{
+ return NULL;
+}
+
+EAPI char *livebox_service_provider_name(const char *lbid)
+{
+ return NULL;
+}
+
+EAPI char *livebox_service_setup_appid(const char *lbid)
+{
+ return NULL;
+}
+
+EAPI char *livebox_service_appid(const char *lbid)
+{
+ return NULL;
+}
+
+EAPI char *livebox_service_i18n_name(const char *lbid, const char *lang)
+{
+ return NULL;
+}
+
+EAPI char *livebox_service_preview(const char *lbid, int size_type)
+{
+ return NULL;
+}
+
+EAPI char *livebox_service_content(const char *lbid)
+{
+ return NULL;
+}
+
+EAPI char *livebox_service_i18n_icon(const char *pkgid, const char *lang)
+{
+ return NULL;
+}
+
+EAPI int livebox_service_nodisplay(const char *lbid)
+{
+ return LB_STATUS_ERROR_NOT_IMPLEMENTED;
+}
+
+EAPI char *livebox_service_abi(const char *lbid)
+{
+ return NULL;
+}
+
+EAPI int livebox_service_is_enabled(const char *lbid)
+{
+ return LB_STATUS_ERROR_NOT_IMPLEMENTED;
+}
+
+EAPI char *livebox_service_lb_script_path(const char *lbid)
+{
+ return NULL;
+}
+
+EAPI char *livebox_service_lb_script_group(const char *lbid)
+{
+ return NULL;
+}
+
+EAPI char *livebox_service_pd_script_path(const char *lbid)
+{
+ return NULL;
+}
+
+EAPI char *livebox_service_pd_script_group(const char *lbid)
+{
+ return NULL;
+}
+
+EAPI int livebox_service_get_supported_sizes(const char *lbid, int *cnt, int *w, int *h)
+{
+ return LB_STATUS_ERROR_NOT_IMPLEMENTED;
+}
+
+EAPI int livebox_service_get_supported_size_types(const char *lbid, int *cnt, int *types)
+{
+ return LB_STATUS_ERROR_NOT_IMPLEMENTED;
+}
+
+EAPI int livebox_service_enumerate_category_list(const char *cluster, int (*cb)(const char *cluster, const char *category, void *data), void *data)
+{
+ return LB_STATUS_ERROR_NOT_IMPLEMENTED;
+}
+
+EAPI int livebox_service_enumerate_cluster_list(int (*cb)(const char *cluster, void *data), void *data)
+{
+ return LB_STATUS_ERROR_NOT_IMPLEMENTED;
+}
+
+EAPI int livebox_service_init(void)
+{
+ return LB_STATUS_ERROR_NOT_IMPLEMENTED;
+}
+
+EAPI int livebox_service_fini(void)
+{
+ return LB_STATUS_ERROR_NOT_IMPLEMENTED;
+}
+
+EAPI struct pkglist_handle *livebox_service_pkglist_create(const char *lbid, struct pkglist_handle *handle)
+{
+ return NULL;
+}
+
+EAPI int livebox_service_get_pkglist_item(struct pkglist_handle *handle, char **lbid, char **pkgname, int *is_prime)
+{
+ return LB_STATUS_ERROR_NOT_IMPLEMENTED;
+}
+
+EAPI int livebox_service_pkglist_destroy(struct pkglist_handle *handle)
+{
+ return LB_STATUS_ERROR_NOT_IMPLEMENTED;
+}
+
+EAPI int livebox_service_get_instance_count(const char *lbid, const char *cluster, const char *category)
+{
+ return LB_STATUS_ERROR_NOT_IMPLEMENTED;
+}
+
+EAPI int livebox_service_max_instance_count(const char *lbid)
+{
+ return LB_STATUS_ERROR_NOT_IMPLEMENTED;
+}
+
+EAPI char *livebox_service_libexec(const char *lbid)
+{
+ return NULL;
+}
+
+EAPI char *livebox_service_pkgname_by_libexec(const char *libexec)
+{
+ return NULL;
+}
+
+/* End of a file */
diff --git a/packaging/liblivebox-service.manifest b/packaging/libdynamicbox_service.manifest
index a76fdba..a76fdba 100644
--- a/packaging/liblivebox-service.manifest
+++ b/packaging/libdynamicbox_service.manifest
diff --git a/packaging/libdynamicbox_service.spec b/packaging/libdynamicbox_service.spec
new file mode 100644
index 0000000..f35049f
--- /dev/null
+++ b/packaging/libdynamicbox_service.spec
@@ -0,0 +1,131 @@
+%bcond_with wayland
+
+Name: libdynamicbox_service
+Summary: Service API for gathering installed dynamicbox information
+Version: 1.0.0
+Release: 1
+Group: HomeTF/DynamicBox
+License: Flora
+Source0: %{name}-%{version}.tar.gz
+Source1001: %{name}.manifest
+BuildRequires: cmake, gettext-tools, coreutils
+BuildRequires: pkgconfig(dlog)
+BuildRequires: pkgconfig(glib-2.0)
+BuildRequires: pkgconfig(gio-2.0)
+BuildRequires: pkgconfig(com-core)
+BuildRequires: pkgconfig(sqlite3)
+BuildRequires: pkgconfig(db-util)
+BuildRequires: pkgconfig(pkgmgr)
+BuildRequires: pkgconfig(pkgmgr-info)
+BuildRequires: pkgconfig(vconf)
+BuildRequires: pkgconfig(ail)
+BuildRequires: pkgconfig(icu-uc)
+BuildRequires: model-build-features
+
+%if %{with wayland}
+# Nothing provides
+%else
+BuildRequires: pkgconfig(x11)
+%endif
+
+%if "%{model_build_feature_livebox}" == "0"
+ExclusiveArch:
+%endif
+
+%description
+Service API for gathering information of installed dynamicboxes
+
+%package devel
+Summary: Files for dynamicbox service
+Group: Development/Libraries
+Requires: %{name} = %{version}-%{release}
+
+%description devel
+Gathering the installed dynamicbox information.
+
+%prep
+%setup -q
+cp %{SOURCE1001} .
+
+%build
+%if 0%{?sec_build_binary_debug_enable}
+export CFLAGS="$CFLAGS -DTIZEN_DEBUG_ENABLE"
+export CXXFLAGS="$CXXFLAGS -DTIZEN_DEBUG_ENABLE"
+export FFLAGS="$FFLAGS -DTIZEN_DEBUG_ENABLE"
+%endif
+
+%if 0%{?tizen_build_binary_release_type_eng}
+export CFLAGS="${CFLAGS} -DTIZEN_ENGINEER_MODE"
+export CXXFLAGS="${CXXFLAGS} -DTIZEN_ENGINEER_MODE"
+export FFLAGS="${FFLAGS} -DTIZEN_ENGINEER_MODE"
+%endif
+
+%if %{with wayland}
+export WAYLAND_SUPPORT=On
+export X11_SUPPORT=Off
+%else
+export WAYLAND_SUPPORT=Off
+export X11_SUPPORT=On
+%endif
+
+%cmake . -DWAYLAND_SUPPORT=${WAYLAND_SUPPORT} -DX11_SUPPORT=${X11_SUPPORT}
+make %{?jobs:-j%jobs}
+
+%install
+rm -rf %{buildroot}
+%make_install
+mkdir -p %{buildroot}/%{_datarootdir}/license
+
+%post -n %{name} -p /sbin/ldconfig
+%postun -n %{name} -p /sbin/ldconfig
+
+%files -n %{name}
+%manifest %{name}.manifest
+%defattr(-,root,root,-)
+%{_libdir}/libdynamicbox_service.so*
+%{_datarootdir}/license/libdynamicbox_service
+
+%files devel
+%manifest %{name}.manifest
+%defattr(-,root,root,-)
+%{_includedir}/dynamicbox_service/dynamicbox_service.h
+%{_includedir}/dynamicbox_service/dynamicbox_errno.h
+%{_includedir}/dynamicbox_service/dynamicbox_cmd_list.h
+%{_includedir}/dynamicbox_service/dynamicbox_buffer.h
+%{_includedir}/dynamicbox_service/dynamicbox_script.h
+%{_includedir}/dynamicbox_service/dynamicbox_conf.h
+%{_libdir}/pkgconfig/dynamicbox_service.pc
+
+#################################################
+# liblivebox-service (for old version)
+%package -n liblivebox-service
+Summary: Library for developing the dynamicbox app provider (old version)
+Group: HomeTF/Dynamicbox
+License: Flora
+Requires: %{name}
+
+%description -n liblivebox-service
+Provider APIs to develop the dynamicbox provider applications. (old version)
+
+%package -n liblivebox-service-devel
+Summary: Header & package configuration files to support development of the dynamicbox provider applications. (old version)
+Group: Development/Libraries
+Requires: liblivebox-service
+
+%description -n liblivebox-service-devel
+Dynamicbox provider application development library (dev) (old version)
+
+%files -n liblivebox-service
+%manifest %{name}.manifest
+%defattr(-,root,root,-)
+%{_libdir}/liblivebox-service.so*
+%{_datarootdir}/license/liblivebox-service
+
+%files -n liblivebox-service-devel
+%manifest %{name}.manifest
+%defattr(-,root,root,-)
+%{_includedir}/livebox-service/livebox-service.h
+%{_includedir}/livebox-service/livebox-errno.h
+%{_libdir}/pkgconfig/livebox-service.pc
+
+# End of a file
diff --git a/packaging/liblivebox-service.spec b/packaging/liblivebox-service.spec
deleted file mode 100644
index 580e3b0..0000000
--- a/packaging/liblivebox-service.spec
+++ /dev/null
@@ -1,94 +0,0 @@
-%bcond_with wayland
-
-Name: liblivebox-service
-Summary: Service API for gathering installed livebox information
-Version: 0.11.0
-Release: 1
-Group: HomeTF/Livebox
-License: Flora
-Source0: %{name}-%{version}.tar.gz
-Source1001: %{name}.manifest
-BuildRequires: cmake, gettext-tools, coreutils
-BuildRequires: pkgconfig(dlog)
-BuildRequires: pkgconfig(glib-2.0)
-BuildRequires: pkgconfig(gio-2.0)
-BuildRequires: pkgconfig(com-core)
-BuildRequires: pkgconfig(sqlite3)
-BuildRequires: pkgconfig(db-util)
-BuildRequires: pkgconfig(pkgmgr)
-BuildRequires: pkgconfig(pkgmgr-info)
-BuildRequires: pkgconfig(vconf)
-BuildRequires: pkgconfig(ail)
-BuildRequires: pkgconfig(icu-uc)
-
-%if %{with wayland}
-# Nothing provides
-%else
-BuildRequires: pkgconfig(x11)
-%endif
-
-%if "%{sec_product_feature_livebox}" == "0"
-ExclusiveArch:
-%endif
-
-%description
-Service API for gathering information of installed liveboxes
-
-%package devel
-Summary: Files for livebox service
-Group: Development/Libraries
-Requires: %{name} = %{version}-%{release}
-
-%description devel
-Gathering the installed livebox information.
-
-%prep
-%setup -q
-cp %{SOURCE1001} .
-
-%build
-%if 0%{?sec_build_binary_debug_enable}
-export CFLAGS="$CFLAGS -DTIZEN_DEBUG_ENABLE"
-export CXXFLAGS="$CXXFLAGS -DTIZEN_DEBUG_ENABLE"
-export FFLAGS="$FFLAGS -DTIZEN_DEBUG_ENABLE"
-%endif
-
-%if 0%{?tizen_build_binary_release_type_eng}
-export CFLAGS="${CFLAGS} -DTIZEN_ENGINEER_MODE"
-export CXXFLAGS="${CXXFLAGS} -DTIZEN_ENGINEER_MODE"
-export FFLAGS="${FFLAGS} -DTIZEN_ENGINEER_MODE"
-%endif
-
-%if %{with wayland}
-export WAYLAND_SUPPORT=On
-export X11_SUPPORT=Off
-%else
-export WAYLAND_SUPPORT=Off
-export X11_SUPPORT=On
-%endif
-
-%cmake . -DWAYLAND_SUPPORT=${WAYLAND_SUPPORT} -DX11_SUPPORT=${X11_SUPPORT}
-make %{?jobs:-j%jobs}
-
-%install
-rm -rf %{buildroot}
-%make_install
-mkdir -p %{buildroot}/%{_datarootdir}/license
-
-%post -n liblivebox-service -p /sbin/ldconfig
-%postun -n liblivebox-service -p /sbin/ldconfig
-
-%files -n liblivebox-service
-%manifest %{name}.manifest
-%defattr(-,root,root,-)
-%{_libdir}/*.so*
-%{_datarootdir}/license/*
-
-%files devel
-%manifest %{name}.manifest
-%defattr(-,root,root,-)
-%{_includedir}/livebox-service/livebox-service.h
-%{_includedir}/livebox-service/livebox-errno.h
-%{_libdir}/pkgconfig/*.pc
-
-# End of a file
diff --git a/packaging/liblivebox-service.spec.rej b/packaging/liblivebox-service.spec.rej
new file mode 100644
index 0000000..f12fc99
--- /dev/null
+++ b/packaging/liblivebox-service.spec.rej
@@ -0,0 +1,11 @@
+--- packaging/liblivebox-service.spec
++++ packaging/liblivebox-service.spec
+@@ -2,7 +2,7 @@
+
+ Name: liblivebox-service
+ Summary: Service API for gathering installed livebox information
+-Version: 0.11.4
++Version: 0.12.0
+ Release: 1
+ Group: HomeTF/Livebox
+ License: Flora