+++ /dev/null
-/*
- * 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 __WIDGET_SERVICE_CONF_H
-#define __WIDGET_SERVICE_CONF_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * @internal
- * @brief Load a configuration file to the memory
- * @since_tizen 2.3.1
- * @return 0 on success, otherwise a negative error value
- * @retval #WIDGET_ERROR_NONE Successfully loaded
- * @retval #WIDGET_ERROR_IO_ERROR Failed to access the configuration file
- * @see widget_conf_reset()
- */
-extern int widget_conf_load(void);
-
-/**
- * @internal
- * @brief Reset configuration data to its default values
- * @since_tizen 2.3.1
- * @see widget_conf_init()
- */
-extern void widget_conf_reset(void);
-
-/**
- * @internal
- * @brief setup the configuration data using default values
- * @since_tizen 2.3.1
- * @see widget_conf_reset()
- */
-extern void widget_conf_init(void);
-
-/**
- * @internal
- * @brief Get the flag of configuration loaded status
- * @since_tizen 2.3.1
- * @return int 1 if it is loaded or 0
- * @see widget_conf_load()
- */
-extern const int const widget_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.1
- * @return int 1 if the xmonitor should be enabled or 0
- */
-extern const int const widget_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.1
- * @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 widget_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.1
- * @return 0 on success, otherwise a negative error value
- * @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 widget_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.1
- * @return 0 on success, otherwise a negative error value
- * @retval 1 use the timestamp of event data
- * @retval 0 use the system timestamp instead of event data of device
- */
-extern const int const widget_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 widget will automatically aligning the buffer.
- * @since_tizen 2.3.1
- * @return status of auto alignment.
- * @retval 1 Content will be automatically aligned by widget.
- * @retval 0 Content will be aligned by UIFW, using stride information.
- */
-extern const int const widget_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
- * [widget]\n
- * [badge]\n
- * [notification]\n
- * [utility]\n
- * [shortcut]\n
- * @since_tizen 2.3.1
- * @return string
- * @retval NULL if there is no defined list. you should treat this as a default service list
- */
-extern const char * const widget_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.1
- * @return 0 on success, otherwise a negative error value
- * @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 widget_conf_provider_method()
- */
-extern const int const widget_conf_use_sw_backend(void);
-
-/**
- * @internal
- * @brief Content sharing method for buffer type widget (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.1
- * @return const char * const
- * @retval "pixmap" use the pixmap
- * @retval "shm" use the shared memory
- * @retval "file" use a file
- */
-extern const char * const widget_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.1
- * @return 0 on success, otherwise a negative error value
- * @retval 1 master will turn on the debug mode
- * @retval 0 master will turn off the debug mode
- */
-extern const int const widget_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.1
- * @return int bool
- * @retval 1 Overwrite content
- * @retval 0 Prevent from overwriting content
- */
-extern const int const widget_conf_overwrite_content(void);
-
-/**
- * @internal
- */
-extern const int const widget_conf_com_core_thread(void);
-
-/**
- * @internal
- */
-extern const unsigned int const widget_conf_base_width(void);
-
-/**
- * @internal
- */
-extern const unsigned int const widget_conf_base_height(void);
-
-/**
- * @internal
- */
-extern const double const widget_conf_minimum_period(void);
-
-/**
- * @internal
- */
-extern const int const widget_conf_default_pixels(void);
-
-/**
- * @internal
- */
-extern const char * const widget_conf_default_script(void);
-
-/**
- * @internal
- */
-extern const char * const widget_conf_default_abi(void);
-
-/**
- * @internal
- */
-extern const char * const widget_conf_default_gbar_group(void);
-
-/**
- * @internal
- */
-extern const double const widget_conf_default_period(void);
-
-/**
- * @internal
- */
-extern const double const widget_conf_default_packet_time(void);
-
-/**
- * @internal
- */
-extern const char * const widget_conf_default_content(void);
-
-/**
- * @internal
- */
-extern const char * const widget_conf_default_title(void);
-
-/**
- * @internal
- */
-extern const unsigned long const widget_conf_minimum_space(void);
-
-/**
- * @internal
- */
-extern const char * const widget_conf_replace_tag(void);
-
-/**
- * @internal
- */
-extern const double const widget_conf_slave_ttl(void);
-
-/**
- * @internal
- */
-extern const double const widget_conf_slave_activate_time(void);
-
-extern const double const widget_conf_slave_terminate_time(void);
-
-/**
- * @internal
- */
-extern const double const widget_conf_slave_relaunch_time(void);
-
-/**
- * @internal
- */
-extern const int const widget_conf_slave_relaunch_count(void);
-
-/**
- * @internal
- */
-extern const int const widget_conf_max_log_line(void);
-
-/**
- * @internal
- */
-extern const int const widget_conf_max_log_file(void);
-
-/**
- * @internal
- */
-extern const unsigned long const widget_conf_sqlite_flush_max(void);
-
-/**
- * @internal
- */
-extern const char * const widget_conf_db_path(void);
-
-/**
- * @internal
- */
-extern const char * const widget_conf_reader_path(void);
-
-/**
- * @internal
- */
-extern const char * const widget_conf_always_path(void);
-
-/**
- * @internal
- */
-extern const char * const widget_conf_log_path(void);
-
-/**
- * @internal
- */
-extern const char * const widget_conf_script_path(void);
-
-/**
- * @internal
- */
-extern const char * const widget_conf_script_port(void);
-
-/**
- * @internal
- */
-extern const char * const widget_conf_share_path(void);
-
-/**
- * @internal
- */
-extern const char * const widget_conf_input_path(void);
-
-/**
- * @internal
- */
-extern const char * const widget_conf_root_path(void);
-
-/**
- * @internal
- */
-extern const char * const widget_conf_path(void);
-
-/**
- * @internal
- */
-extern const double const widget_conf_ping_time(void);
-
-/**
- * @internal
- */
-extern const int const widget_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.1
- * @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 widget_conf_premultiplied_alpha(void);
-
-/**
- * @internal
- */
-extern const double const widget_conf_gbar_request_timeout(void);
-
-/**
- * @internal
- */
-extern const double const widget_conf_scale_width_factor(void);
-
-/**
- * @internal
- */
-extern const double const widget_conf_scale_height_factor(void);
-
-/**
- * @internal
- */
-extern const char * const widget_conf_launch_key_name(void);
-
-/**
- * @internal
- */
-extern const char * const widget_conf_launch_key_secured(void);
-
-/**
- * @internal
- */
-extern const char * const widget_conf_launch_key_abi(void);
-
-/**
- * @internal
- */
-extern const char * const widget_conf_launch_key_hw_acceleration(void);
-
-/**
- * @internal
- */
-extern const char * const widget_conf_launch_key_auto_align(void);
-
-/**
- * @internal
- */
-extern const char * const widget_conf_empty_content(void);
-
-/**
- * @internal
- */
-extern const char * const widget_conf_empty_title(void);
-
-/**
- * @internal
- */
-extern const int const widget_conf_extra_buffer_count(void);
-
-/**
- * @internal
- */
-extern const int const widget_conf_use_gettimeofday(void);
-
-/**
- * @internal
- */
-extern const int const widget_conf_slave_event_boost_off(void);
-
-/**
- * @internal
- */
-extern const int const widget_conf_slave_event_boost_on(void);
-
-/**
- * @internal
- */
-extern const double const widget_conf_event_filter(void);
-
-/**
- * @internal
- */
-extern const int const widget_conf_slave_limit_to_ttl(void);
-
-/**
- * @internal
- */
-extern const int const widget_conf_frame_skip(void);
-
-/**
- * @internal
- */
-extern const int const widget_conf_slave_auto_cache_flush(void);
-
-/**
- * @internal
- */
-extern const char * const widget_conf_category_list(void);
-
-extern const char * const widget_conf_sdk_viewer(void);
-
-/**
- * @internal
- */
-extern const int const widget_conf_force_to_terminate(void);
-
-extern const double const widget_conf_fault_detect_in_time(void);
-extern const int const widget_conf_fault_detect_count(void);
-extern const int const widget_conf_reactivate_on_pause(void);
-extern const char * const widget_conf_app_abi(void);
-extern const double const widget_conf_visibility_change_delay(void);
-extern const int const widget_conf_click_region(void);
-extern void widget_conf_set_search_input_node(int flag);
-extern const int const widget_conf_update_on_pause(void);
-extern const int const widget_conf_enable_resource_lock(void);
-extern const char * const widget_conf_ee_key_for_update(void);
-
-typedef struct widget_conf_parser_table {
- const char *name;
- void (*handler)(char *buffer);
-} widget_conf_parser_table_t;
-
-/**
- * @internal
- */
-extern int widget_conf_parser(const char *conf_file, const widget_conf_parser_table_t *token_handler);
-
-#define WIDGET_CONF_BASE_W widget_conf_base_width()
-#define WIDGET_CONF_BASE_H widget_conf_base_height()
-
-#define WIDGET_CONF_EMERGENCY_DISK widget_conf_emergency_disk()
-#define WIDGET_CONF_SCALE_WIDTH_FACTOR widget_conf_scale_width_factor()
-#define WIDGET_CONF_SCALE_HEIGHT_FACTOR widget_conf_scale_height_factor()
-
-#define WIDGET_CONF_USE_SW_BACKEND widget_conf_use_sw_backend()
-#define WIDGET_CONF_PROVIDER_METHOD widget_conf_provider_method()
-#define WIDGET_CONF_DEBUG_MODE widget_conf_debug_mode()
-#define WIDGET_CONF_OVERWRITE_CONTENT widget_conf_overwrite_content()
-#define WIDGET_CONF_COM_CORE_THREAD widget_conf_com_core_thread()
-
-#define WIDGET_CONF_MINIMUM_PERIOD widget_conf_minimum_period()
-
-#define WIDGET_CONF_DEFAULT_SCRIPT widget_conf_default_script()
-#define WIDGET_CONF_DEFAULT_ABI widget_conf_default_abi()
-#define WIDGET_CONF_DEFAULT_GBAR_GROUP widget_conf_default_gbar_group()
-#define WIDGET_CONF_DEFAULT_PERIOD widget_conf_default_period()
-#define WIDGET_CONF_DEFAULT_PIXELS widget_conf_default_pixels()
-#define WIDGET_CONF_PRIORITY_NO_CHANGE -1.0f
-
-#define WIDGET_CONF_BUNDLE_SLAVE_NAME widget_conf_launch_key_name()
-#define WIDGET_CONF_BUNDLE_SLAVE_SECURED widget_conf_launch_key_secured()
-#define WIDGET_CONF_BUNDLE_SLAVE_ABI widget_conf_launch_key_abi()
-#define WIDGET_CONF_BUNDLE_SLAVE_HW_ACCELERATION widget_conf_launch_key_hw_acceleration()
-#define WIDGET_CONF_BUNDLE_SLAVE_AUTO_ALIGN widget_conf_launch_key_auto_align()
-#define WIDGET_CONF_PACKET_TIME widget_conf_default_packet_time()
-#define WIDGET_CONF_CONTENT_NO_CHANGE widget_conf_empty_content()
-#define WIDGET_CONF_TITLE_NO_CHANGE widget_conf_empty_title()
-#define WIDGET_CONF_DEFAULT_TITLE widget_conf_default_title()
-#define WIDGET_CONF_DEFAULT_CONTENT widget_conf_default_content()
-#define WIDGET_CONF_MINIMUM_SPACE widget_conf_minimum_space()
-
-#define WIDGET_CONF_IMAGE_PATH widget_conf_share_path()
-#define WIDGET_CONF_SCRIPT_PATH widget_conf_script_path()
-#define WIDGET_CONF_SCRIPT_PORT_PATH widget_conf_script_port()
-#define WIDGET_CONF_CONF_PATH widget_conf_path()
-#define WIDGET_CONF_ROOT_PATH widget_conf_root_path()
-#define WIDGET_CONF_LOG_PATH widget_conf_log_path()
-#define WIDGET_CONF_READER_PATH widget_conf_reader_path()
-#define WIDGET_CONF_ALWAYS_PATH widget_conf_always_path()
-#define WIDGET_CONF_INPUT_PATH widget_conf_input_path()
-
-#define WIDGET_CONF_REPLACE_TAG_APPID widget_conf_replace_tag()
-#define WIDGET_CONF_SLAVE_TTL widget_conf_slave_ttl()
-#define WIDGET_CONF_SLAVE_ACTIVATE_TIME widget_conf_slave_activate_time()
-#define WIDGET_CONF_SLAVE_RELAUNCH_TIME widget_conf_slave_relaunch_time()
-#define WIDGET_CONF_SLAVE_RELAUNCH_COUNT widget_conf_slave_relaunch_count()
-#define WIDGET_CONF_SLAVE_TERMINATE_TIME widget_conf_slave_terminate_time()
-
-#define WIDGET_CONF_MAX_LOG_LINE widget_conf_max_log_line()
-#define WIDGET_CONF_MAX_LOG_FILE widget_conf_max_log_file()
-#define WIDGET_CONF_CATEGORY_LIST widget_conf_category_list()
-
-#define WIDGET_CONF_SQLITE_FLUSH_MAX widget_conf_sqlite_flush_max()
-#define WIDGET_CONF_DBFILE widget_conf_db_path()
-
-#define WIDGET_CONF_GBAR_REQUEST_TIMEOUT widget_conf_gbar_request_timeout()
-
-#define WIDGET_CONF_SLAVE_MAX_LOAD widget_conf_slave_max_load()
-#define WIDGET_CONF_DEFAULT_PING_TIME widget_conf_ping_time()
-#define WIDGET_CONF_PREMULTIPLIED_COLOR widget_conf_premultiplied_alpha()
-#define WIDGET_CONF_SERVICES widget_conf_services()
-#define WIDGET_CONF_EXTRA_BUFFER_COUNT widget_conf_extra_buffer_count()
-
-#define WIDGET_CONF_SERVICE_WIDGET "[widget]"
-#define WIDGET_CONF_SERVICE_NOTIFICATION "[notification]"
-#define WIDGET_CONF_SERVICE_BADGE "[badge]"
-#define WIDGET_CONF_SERVICE_SHORTCUT "[shortcut]"
-#define WIDGET_CONF_SERVICE_UTILITY "[utility]"
-#define WIDGET_CONF_SERVICE_FILE "[file]"
-
-#define WIDGET_CONF_PAUSED_FILE "/tmp/.live.paused"
-
-#define WIDGET_CONF_USE_XMONITOR widget_conf_use_xmonitor()
-#define WIDGET_CONF_AUTO_ALIGN widget_conf_auto_align()
-#define WIDGET_CONF_USE_EVENT_TIME widget_conf_use_event_time()
-#define WIDGET_CONF_CHECK_LCD widget_conf_check_lcd()
-
-#define WIDGET_CONF_USE_GETTIMEOFDAY widget_conf_use_gettimeofday()
-
-#define WIDGET_CONF_DELAY_TIME 0.0000001f
-#define WIDGET_CONF_DEFAULT_CLUSTER "user,created"
-#define WIDGET_CONF_MINIMUM_REACTIVATION_TIME 10
-
-#define WIDGET_CONF_SLAVE_EVENT_BOOST_ON widget_conf_slave_event_boost_on()
-#define WIDGET_CONF_SLAVE_EVENT_BOOST_OFF widget_conf_slave_event_boost_off()
-#define WIDGET_CONF_EVENT_FILTER widget_conf_event_filter()
-#define WIDGET_CONF_SLAVE_LIMIT_TO_TTL widget_conf_slave_limit_to_ttl()
-#define WIDGET_CONF_FRAME_SKIP widget_conf_frame_skip()
-#define WIDGET_CONF_SLAVE_AUTO_CACHE_FLUSH widget_conf_slave_auto_cache_flush()
-#define WIDGET_CONF_FAULT_DETECT_COUNT widget_conf_fault_detect_count()
-#define WIDGET_CONF_FAULT_DETECT_IN_TIME widget_conf_fault_detect_in_time()
-#define WIDGET_CONF_REACTIVATE_ON_PAUSE widget_conf_reactivate_on_pause()
-#define WIDGET_CONF_APP_ABI widget_conf_app_abi()
-#define WIDGET_CONF_VISIBILITY_CHANGE_DELAY widget_conf_visibility_change_delay()
-#define WIDGET_CONF_CLICK_REGION widget_conf_click_region()
-#define WIDGET_CONF_SDK_VIEWER widget_conf_sdk_viewer()
-#define WIDGET_CONF_FORCE_TO_TERMINATE widget_conf_force_to_terminate()
-#define WIDGET_CONF_UPDATE_ON_PAUSE widget_conf_update_on_pause()
-#define WIDGET_CONF_ENABLE_RESOURCE_LOCK widget_conf_enable_resource_lock()
-#define WIDGET_CONF_EE_KEY_FOR_UPDATE widget_conf_ee_key_for_update()
-
-#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 */
+++ /dev/null
-/*
- * 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 <dirent.h>
-#include <sys/ioctl.h>
-#include <linux/input.h>
-
-#include <dlog.h>
-#include <widget_errno.h>
-#include <unicode/uloc.h>
-#include <system_info.h>
-
-#include "debug.h"
-#include "widget_conf.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 = "[widget],[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/.widget.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";
-
-/**
- * @note
- * conf parser will not try to get LAUNCH_KEYs from conf.ini
- * There is no parser for these values.
- * For the future works, just leave these at here.
- */
-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_LAUNCH_BUNDLE_AUTO_ALIGN = "auto-align";
-
-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 char *CONF_DEFAULT_CATEGORY_LIST = "http://tizen.org/category/wearable_clock";
-static const char *CONF_DEFAULT_APP_ABI = "app";
-static const char *CONF_DEFAULT_SDK_VIEWER = "org.tizen.widget_viewer_sdk";
-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_TERMINATE_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;
-static const int CONF_DEFAULT_REACTIVATE_ON_PAUSE = 1;
-static const double CONF_DEFAULT_FAULT_DETECT_IN_TIME = 0.0f;
-static const int CONF_DEFAULT_FAULT_DETECT_COUNT = 0;
-static const double CONF_DEFAULT_VISIBILITY_CHANGE_DELAY = 0.0f;
-static const int CONF_DEFAULT_CLICK_REGION = 22;
-static const int CONF_DEFAULT_FORCE_TO_TERMINATE = 0;
-static const int CONF_DEFAULT_UPDATE_ON_PAUSE = 0;
-static const int CONF_DEFAULT_ENABLE_RESOURCE_LOCK = 0;
-static const int CONF_DEFAULT_FRAME_SKIP = 0;
-static const char *CONF_DEFAULT_EE_KEY_FOR_UPDATE = NULL;
-
-#define CONF_PATH_FORMAT "/usr/share/data-provider-master/%dx%d/conf.ini"
-
-#if !defined(EVIOCGNAME)
- #define EVIOCGNAME(len) _IOC(_IOC_READ, 'E', 0x06, len)
-#endif
-
-int errno;
-
-struct widget_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;
- char *auto_align;
- } 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_terminate_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;
-
- char *provider_method;
- int premultiplied;
-
- double scale_width_factor;
- double scale_height_factor;
-
- double gbar_request_timeout;
-
- char *emergency_disk;
- char *services;
- int extra_buffer_count;
- int slave_event_boost_on;
- int slave_event_boost_off;
- double event_filter;
- int frame_skip;
- char *category_list;
- double fault_detect_in_time;
- int fault_detect_count;
- char *app_abi;
- double visibility_change_delay;
-
- int click_region;
- char *sdk_viewer;
- char *ee_key_for_update;
-
- union _conf_flags {
- struct _conf_flag_bitfields {
- unsigned int enable_resource_lock:1;
- unsigned int update_on_pause:1;
- unsigned int force_to_terminate:1;
- unsigned int reactivate_on_pause:1;
- unsigned int slave_auto_cache_flush:1;
- unsigned int slave_limit_to_ttl:1;
- unsigned int use_gettimeofday:1;
- unsigned int check_lcd:1;
- unsigned int use_event_time:1;
- unsigned int auto_align:1;
- unsigned int use_xmonitor:1;
- unsigned int com_core_thread:1;
- unsigned int overwrite_content:1;
- unsigned int debug_mode:1;
- unsigned int use_sw_backend:1;
-
- unsigned int reserved:17;
- } field;
- unsigned int flags;
- } flags;
-};
-
-static struct widget_conf s_conf;
-
-static struct info {
- int conf_loaded;
- int search_input_node;
-} s_info = {
- .conf_loaded = 0,
- .search_input_node = 0,
-};
-
-/* LCOV_EXCL_START */
-static void visibility_change_delay_handler(char *buffer)
-{
- if (sscanf(buffer, "%lf", &s_conf.visibility_change_delay) != 1) {
- ErrPrint("Unable to parse the visibility change delay [%s]\n", buffer);
- s_conf.visibility_change_delay = 0.0f;
- }
-}
-
-static void app_abi_handler(char *buffer)
-{
- s_conf.app_abi = strdup(buffer);
- if (!s_conf.app_abi)
- ErrPrint("strdup: %d\n", errno);
-}
-
-static void sdk_viewer_handler(char *buffer)
-{
- s_conf.sdk_viewer = strdup(buffer);
- if (!s_conf.sdk_viewer)
- ErrPrint("strdup: %d\n", errno);
-}
-
-static void ee_key_for_update_handler(char *buffer)
-{
- s_conf.ee_key_for_update = strdup(buffer);
- if (!s_conf.ee_key_for_update)
- ErrPrint("strdup: %d\n", errno);
-}
-
-static void detect_fault_handler(char *buffer)
-{
- if (sscanf(buffer, "%d,%lf", &s_conf.fault_detect_count, &s_conf.fault_detect_in_time) != 2) {
- ErrPrint("Unable to parse the detect_fault [%s]\n", buffer);
- s_conf.fault_detect_count = CONF_DEFAULT_FAULT_DETECT_COUNT;
- s_conf.fault_detect_in_time = CONF_DEFAULT_FAULT_DETECT_IN_TIME;
- }
-}
-
-static void reactivate_on_pause_handler(char *buffer)
-{
- s_conf.flags.field.reactivate_on_pause = !strcasecmp(buffer, "true");
-}
-
-static void category_list_handler(char *buffer)
-{
- s_conf.category_list = strdup(buffer);
- if (!s_conf.category_list) {
- ErrPrint("strdup: %d\n", errno);
- s_conf.category_list = (char *)CONF_DEFAULT_CATEGORY_LIST;
- }
-}
-
-static void slave_auto_cache_flush_handler(char *buffer)
-{
- s_conf.flags.field.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.flags.field.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_handler(char *buffer)
-{
- s_conf.flags.field.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: %d\n", errno);
-}
-
-static void check_lcd_handler(char *buffer)
-{
- s_conf.flags.field.check_lcd = !strcasecmp(buffer, "true");
-}
-
-static void use_gettimeofday_handler(char *buffer)
-{
- s_conf.flags.field.use_gettimeofday = !strcasecmp(buffer, "true");
-}
-
-static void use_event_time_handler(char *buffer)
-{
- s_conf.flags.field.use_event_time = !strcasecmp(buffer, "true");
-}
-
-static void auto_align_handler(char *buffer)
-{
- s_conf.flags.field.auto_align = !strcasecmp(buffer, "true");
-}
-
-static void services_handler(char *buffer)
-{
- s_conf.services = strdup(buffer);
- if (!s_conf.services)
- ErrPrint("Heap: %d\n", errno);
-}
-
-static void use_sw_backend_handler(char *buffer)
-{
- s_conf.flags.field.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: %d\n", errno);
-}
-
-static void debug_mode_handler(char *buffer)
-{
- s_conf.flags.field.debug_mode = !strcasecmp(buffer, "true");
-}
-
-static void overwrite_content_handler(char *buffer)
-{
- s_conf.flags.field.overwrite_content = !strcasecmp(buffer, "true");
-}
-
-static void com_core_thread_handler(char *buffer)
-{
- s_conf.flags.field.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: %d\n", errno);
-}
-
-static void default_abi_handler(char *buffer)
-{
- s_conf.default_conf.abi = strdup(buffer);
- if (!s_conf.default_conf.abi)
- ErrPrint("Heap: %d\n", 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: %d\n", 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: %d\n", errno);
-}
-
-static void default_title_handler(char *buffer)
-{
- s_conf.default_title = strdup(buffer);
- if (!s_conf.default_title)
- ErrPrint("Heap: %d\n", 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: %d\n", 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_terminate_time_handler(char *buffer)
-{
- if (sscanf(buffer, "%lf", &s_conf.slave_terminate_time) != 1)
- ErrPrint("Failed to parse the slave_terminate_time\n");
-
- DbgPrint("Slave terminate time: %lf\n", s_conf.slave_terminate_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_relaunch_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: %d\n", errno);
-}
-
-static void reader_path_handler(char *buffer)
-{
- s_conf.path.reader = strdup(buffer);
- if (!s_conf.path.reader)
- ErrPrint("Heap: %d\n", errno);
-}
-
-static void always_path_handler(char *buffer)
-{
- s_conf.path.always = strdup(buffer);
- if (!s_conf.path.always)
- ErrPrint("Heap: %d\n", errno);
-}
-
-static void log_path_handler(char *buffer)
-{
- s_conf.path.slave_log = strdup(buffer);
- if (!s_conf.path.slave_log)
- ErrPrint("Heap: %d\n", errno);
-}
-
-static void script_port_path_handler(char *buffer)
-{
- s_conf.path.script_port = strdup(buffer);
- if (!s_conf.path.script_port)
- ErrPrint("Heap: %d\n", errno);
-}
-
-static void share_path_handler(char *buffer)
-{
- s_conf.path.image = strdup(buffer);
- if (!s_conf.path.image)
- ErrPrint("Heap: %d\n", errno);
-}
-
-static void click_region_handler(char *buffer)
-{
- if (sscanf(buffer, "%d", &s_conf.click_region) != 1)
- ErrPrint("Failed to parse the click_region\n");
-}
-
-static void force_to_terminate_handler(char *buffer)
-{
- s_conf.flags.field.force_to_terminate = !strcasecmp(buffer, "true");
-}
-
-static void update_on_pause_handler(char *buffer)
-{
- s_conf.flags.field.update_on_pause = !strcasecmp(buffer, "true");
-}
-
-static void enable_resource_lock_handler(char *buffer)
-{
- s_conf.flags.field.enable_resource_lock = !strcasecmp(buffer, "true");
-}
-
-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: %d\n", errno);
- free(node);
- node = NULL;
- } else {
- node[len] = '\0';
- DbgPrint("NODE FOUND: %s\n", node);
- }
- } else {
- ErrPrint("malloc: %d\n", 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_by_path(const char *name)
-{
- DIR *dir;
- struct dirent entry;
- struct dirent *result;
- char path[PATH_MAX];
- char *ptr;
- int len;
- int fd;
- char dev_name[PATH_MAX];
- char *return_path = NULL;
- int ret;
-
- dir = opendir(DEV_PATH);
- if (!dir) {
- ErrPrint("opendir: %d\n", errno);
- return NULL;
- }
-
- strncpy(path, DEV_PATH, sizeof(path) - 1);
- len = strlen(DEV_PATH);
- ptr = path + len;
- len = PATH_MAX - len - 1;
-
- while ((readdir_r(dir, &entry, &result) == 0) && (result != NULL)) {
- if (result->d_name[0] == '.' &&
- (result->d_name[1] == '\0'
- || (result->d_name[1] == '.' && result->d_name[2] == '\0'))) {
- continue;
- }
-
- strncpy(ptr, result->d_name, len);
- ptr[len] = '\0';
-
- fd = open(path, O_RDONLY);
- if (fd < 0) {
- ErrPrint("open[%s]: %d\n", path, errno);
- continue;
- }
-
- ret = ioctl(fd, EVIOCGNAME(sizeof(dev_name) - 1), &dev_name);
- if (ret < 0)
- ErrPrint("ioctl: %d\n", errno);
-
- if (close(fd) < 0)
- ErrPrint("close: %d\n", errno);
-
- if (ret == strlen(name) + 1 && !strcasecmp(name, dev_name)) {
- return_path = strdup(path);
- if (!return_path)
- ErrPrint("strdup: %d\n", errno);
-
- DbgPrint("Found node: [%s]\n", return_path);
- break;
- }
- }
-
- if (closedir(dir) < 0)
- ErrPrint("closedir: %d\n", errno);
-
- return return_path;
-}
-
-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: %d\n", 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: %d\n", errno);
-
- return node;
-}
-
-static void input_path_handler(char *buffer)
-{
- if (buffer[0] == '/' || !s_info.search_input_node) {
- DbgPrint("Specifying the input device [%d]\n", s_info.search_input_node);
- s_conf.path.input = strdup(buffer);
- if (!s_conf.path.input)
- ErrPrint("Heap: %d\n", errno);
- } else {
- DbgPrint("Find the input device (%s)\n", buffer);
- s_conf.path.input = find_input_device_by_path(buffer);
- if (s_conf.path.input == NULL) {
- ErrPrint("Fallback to find node by path\n");
- s_conf.path.input = find_input_device(buffer);
- if (!s_conf.path.input) {
- ErrPrint("Fallback to raw string\n");
- s_conf.path.input = strdup(buffer);
- if (!s_conf.path.input)
- ErrPrint("Heap: %d\n", 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 widget_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_terminate_time = CONF_DEFAULT_SLAVE_TERMINATE_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.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.launch_key.auto_align = (char *)CONF_DEFAULT_LAUNCH_BUNDLE_AUTO_ALIGN;
- 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.category_list = (char *)CONF_DEFAULT_CATEGORY_LIST;
- s_conf.extra_buffer_count = CONF_DEFAULT_EXTRA_BUFFER_COUNT;
- 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.fault_detect_count = CONF_DEFAULT_FAULT_DETECT_COUNT;
- s_conf.fault_detect_in_time = CONF_DEFAULT_FAULT_DETECT_IN_TIME;
- s_conf.app_abi = (char *)CONF_DEFAULT_APP_ABI;
- s_conf.visibility_change_delay = CONF_DEFAULT_VISIBILITY_CHANGE_DELAY;
- s_conf.click_region = CONF_DEFAULT_CLICK_REGION;
- s_conf.sdk_viewer = (char *)CONF_DEFAULT_SDK_VIEWER;
- s_conf.ee_key_for_update = (char *)CONF_DEFAULT_EE_KEY_FOR_UPDATE;
- s_conf.frame_skip = CONF_DEFAULT_FRAME_SKIP;
-
- s_conf.flags.field.reactivate_on_pause = CONF_DEFAULT_REACTIVATE_ON_PAUSE;
- s_conf.flags.field.auto_align = CONF_DEFAULT_AUTO_ALIGN;
- s_conf.flags.field.use_sw_backend = CONF_DEFAULT_USE_SW_BACKEND;
- s_conf.flags.field.debug_mode = CONF_DEFAULT_DEBUG_MODE;
- s_conf.flags.field.overwrite_content = CONF_DEFAULT_OVERWRITE_CONTENT;
- s_conf.flags.field.com_core_thread = CONF_DEFAULT_COM_CORE_THREAD;
- s_conf.flags.field.use_xmonitor = CONF_DEFAULT_USE_XMONITOR;
- s_conf.flags.field.use_event_time = CONF_DEFAULT_USE_EVENT_TIME;
- s_conf.flags.field.check_lcd = CONF_DEFAULT_CHECK_LCD;
- s_conf.flags.field.use_gettimeofday = CONF_DEFAULT_USE_GETTIMEOFDAY;
- s_conf.flags.field.slave_limit_to_ttl = CONF_DEFAULT_SLAVE_LIMIT_TO_TTL;
- s_conf.flags.field.slave_auto_cache_flush = CONF_DEFAULT_SLAVE_AUTO_CACHE_FLUSH;
- s_conf.flags.field.force_to_terminate = CONF_DEFAULT_FORCE_TO_TERMINATE;
- s_conf.flags.field.update_on_pause = CONF_DEFAULT_UPDATE_ON_PAUSE;
- s_conf.flags.field.enable_resource_lock = CONF_DEFAULT_ENABLE_RESOURCE_LOCK;
-}
-
-/*
- * 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: %d\n", 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: %d\n", errno);
- strncpy(path, DEFAULT_MASTER_CONF, length);
- if (access(path, F_OK) != 0) {
- ErrPrint("Serious error - there is no conf file, use default setting: %d\n", errno);
- free(path);
- path = NULL;
- }
- }
-
- return path;
-}
-
-EAPI void widget_conf_set_search_input_node(int flag)
-{
- s_info.search_input_node = !!flag;
-}
-
-EAPI int widget_conf_parser(const char *conf_file, const widget_conf_parser_table_t *token_handler)
-{
- 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];
-
- fp = fopen(conf_file, "rt");
- if (!fp) {
- ErrPrint("Error: %d\n", errno);
- return WIDGET_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: %d\n", errno);
-
- return WIDGET_ERROR_NONE;
-}
-
-EAPI int widget_conf_load(void)
-{
- char *conf_file;
- int ret;
- static const widget_conf_parser_table_t 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_terminate_time",
- .handler = slave_terminate_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_handler,
- },
- {
- .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 = "category_list",
- .handler = category_list_handler,
- },
- {
- .name = "detect_fault",
- .handler = detect_fault_handler,
- },
- {
- .name = "reactivate_on_pause",
- .handler = reactivate_on_pause_handler,
- },
- {
- .name = "app_abi",
- .handler = app_abi_handler,
- },
- {
- .name = "sdk_viewer",
- .handler = sdk_viewer_handler,
- },
- {
- .name = "ee_key_for_update",
- .handler = ee_key_for_update_handler,
- },
- {
- .name = "visibility_change_delay",
- .handler = visibility_change_delay_handler,
- },
- {
- .name = "click_region",
- .handler = click_region_handler,
- },
- {
- .name = "force_to_terminate",
- .handler = force_to_terminate_handler,
- },
- {
- .name = "update_on_pause",
- .handler = update_on_pause_handler,
- },
- {
- .name = "enable_resource_lock",
- .handler = enable_resource_lock_handler,
- },
- {
- .name = NULL,
- .handler = NULL,
- },
- };
-
- if (s_info.conf_loaded) {
- ErrPrint("Already loaded\n");
- return WIDGET_ERROR_ALREADY_EXIST;
- }
-
-
- /* util_screen_size_get(&s_conf.width, &s_conf.height); */
-
-
- conf_file = conf_path();
- if (!conf_file)
- return WIDGET_ERROR_IO_ERROR;
-
- ret = widget_conf_parser(conf_file, token_handler);
- free(conf_file);
-
- s_conf.scale_width_factor = (double)s_conf.width / (double)WIDGET_CONF_BASE_W;
- s_conf.scale_height_factor = (double)s_conf.height / (double)WIDGET_CONF_BASE_H;
- s_info.conf_loaded = 1;
-
- return ret;
-}
-
-EAPI void widget_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_terminate_time = CONF_DEFAULT_SLAVE_TERMINATE_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.flags.field.use_sw_backend = CONF_DEFAULT_USE_SW_BACKEND;
- s_conf.flags.field.debug_mode = CONF_DEFAULT_DEBUG_MODE;
- s_conf.flags.field.overwrite_content = CONF_DEFAULT_OVERWRITE_CONTENT;
- s_conf.flags.field.com_core_thread = CONF_DEFAULT_COM_CORE_THREAD;
- s_conf.flags.field.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.flags.field.auto_align = CONF_DEFAULT_AUTO_ALIGN;
- s_conf.flags.field.use_event_time = CONF_DEFAULT_USE_EVENT_TIME;
- s_conf.flags.field.check_lcd = CONF_DEFAULT_CHECK_LCD;
- s_conf.extra_buffer_count = CONF_DEFAULT_EXTRA_BUFFER_COUNT;
- s_conf.flags.field.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.flags.field.slave_limit_to_ttl = CONF_DEFAULT_SLAVE_LIMIT_TO_TTL;
- s_conf.flags.field.slave_auto_cache_flush = CONF_DEFAULT_SLAVE_AUTO_CACHE_FLUSH;
- s_conf.fault_detect_count = CONF_DEFAULT_FAULT_DETECT_COUNT;
- s_conf.fault_detect_in_time = CONF_DEFAULT_FAULT_DETECT_IN_TIME;
- s_conf.flags.field.reactivate_on_pause = CONF_DEFAULT_REACTIVATE_ON_PAUSE;
- s_conf.frame_skip = CONF_DEFAULT_FRAME_SKIP;
-
- if (s_conf.sdk_viewer != CONF_DEFAULT_SDK_VIEWER) {
- free(s_conf.sdk_viewer);
- s_conf.sdk_viewer = (char *)CONF_DEFAULT_SDK_VIEWER;
- }
-
- if (s_conf.ee_key_for_update != CONF_DEFAULT_EE_KEY_FOR_UPDATE) {
- free(s_conf.ee_key_for_update);
- s_conf.ee_key_for_update = (char *)CONF_DEFAULT_EE_KEY_FOR_UPDATE;
- }
-
- if (s_conf.app_abi != CONF_DEFAULT_APP_ABI) {
- free(s_conf.app_abi);
- s_conf.app_abi = (char *)CONF_DEFAULT_APP_ABI;
- }
-
- if (s_conf.category_list != CONF_DEFAULT_CATEGORY_LIST) {
- free(s_conf.category_list);
- s_conf.category_list = (char *)CONF_DEFAULT_CATEGORY_LIST;
- }
-
- 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.launch_key.auto_align != CONF_DEFAULT_LAUNCH_BUNDLE_AUTO_ALIGN) {
- free(s_conf.launch_key.auto_align);
- s_conf.launch_key.auto_align = (char *)CONF_DEFAULT_LAUNCH_BUNDLE_AUTO_ALIGN;
- }
-
- 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_conf.click_region = CONF_DEFAULT_CLICK_REGION;
- s_conf.flags.field.force_to_terminate = CONF_DEFAULT_FORCE_TO_TERMINATE;
- s_conf.flags.field.update_on_pause = CONF_DEFAULT_UPDATE_ON_PAUSE;
- s_conf.flags.field.enable_resource_lock = CONF_DEFAULT_ENABLE_RESOURCE_LOCK;
-
- s_info.conf_loaded = 0;
-}
-
-EAPI const int const widget_conf_extra_buffer_count(void)
-{
- return s_conf.extra_buffer_count;
-}
-
-EAPI const int const widget_conf_use_xmonitor(void)
-{
- return s_conf.flags.field.use_xmonitor;
-}
-
-EAPI const char * const widget_conf_emergency_disk(void)
-{
- return s_conf.emergency_disk;
-}
-
-EAPI const int const widget_conf_check_lcd(void)
-{
- return s_conf.flags.field.check_lcd;
-}
-
-EAPI const int const widget_conf_use_event_time(void)
-{
- return s_conf.flags.field.use_event_time;
-}
-
-EAPI const int const widget_conf_auto_align(void)
-{
- return s_conf.flags.field.auto_align;
-}
-
-EAPI const char * const widget_conf_services(void)
-{
- return s_conf.services;
-}
-
-EAPI const int const widget_conf_use_sw_backend(void)
-{
- return s_conf.flags.field.use_sw_backend;
-}
-
-EAPI const char * const widget_conf_provider_method(void)
-{
- return s_conf.provider_method;
-}
-
-EAPI const int const widget_conf_debug_mode(void)
-{
- return s_conf.flags.field.debug_mode;
-}
-
-EAPI const int const widget_conf_overwrite_content(void)
-{
- return s_conf.flags.field.overwrite_content;
-}
-
-EAPI const int const widget_conf_com_core_thread(void)
-{
- return s_conf.flags.field.com_core_thread;
-}
-
-EAPI const unsigned int const widget_conf_base_width(void)
-{
- return s_conf.base_width;
-}
-
-EAPI const unsigned int const widget_conf_base_height(void)
-{
- return s_conf.base_height;
-}
-
-EAPI const double const widget_conf_minimum_period(void)
-{
- return s_conf.minimum_period;
-}
-
-EAPI const int const widget_conf_default_pixels(void)
-{
- return s_conf.default_conf.pixels;
-}
-
-EAPI const char * const widget_conf_default_script(void)
-{
- return s_conf.default_conf.script;
-}
-
-EAPI const char * const widget_conf_default_abi(void)
-{
- return s_conf.default_conf.abi;
-}
-
-EAPI const char * const widget_conf_default_gbar_group(void)
-{
- return s_conf.default_conf.gbar_group;
-}
-
-EAPI const double const widget_conf_default_period(void)
-{
- return s_conf.default_conf.period;
-}
-
-EAPI const double const widget_conf_default_packet_time(void)
-{
- return s_conf.default_packet_time;
-}
-
-EAPI const char * const widget_conf_default_content(void)
-{
- return s_conf.default_content;
-}
-
-EAPI const char * const widget_conf_default_title(void)
-{
- return s_conf.default_title;
-}
-
-EAPI const unsigned long const widget_conf_minimum_space(void)
-{
- return s_conf.minimum_space;
-}
-
-EAPI const char * const widget_conf_replace_tag(void)
-{
- return s_conf.replace_tag;
-}
-
-EAPI const double const widget_conf_slave_ttl(void)
-{
- return s_conf.slave_ttl;
-}
-
-EAPI const double const widget_conf_slave_activate_time(void)
-{
- return s_conf.slave_activate_time;
-}
-
-EAPI const double const widget_conf_slave_terminate_time(void)
-{
- return s_conf.slave_terminate_time;
-}
-
-EAPI const double const widget_conf_slave_relaunch_time(void)
-{
- return s_conf.slave_relaunch_time;
-}
-
-EAPI const int const widget_conf_slave_relaunch_count(void)
-{
- return s_conf.slave_relaunch_count;
-}
-
-EAPI const int const widget_conf_max_log_line(void)
-{
- return s_conf.max_log_line;
-}
-
-EAPI const int const widget_conf_max_log_file(void)
-{
- return s_conf.max_log_file;
-}
-
-EAPI const unsigned long const widget_conf_sqlite_flush_max(void)
-{
- return s_conf.sqlite_flush_max;
-}
-
-EAPI const char * const widget_conf_db_path(void)
-{
- return s_conf.path.db;
-}
-
-EAPI const char * const widget_conf_reader_path(void)
-{
- return s_conf.path.reader;
-}
-
-EAPI const char * const widget_conf_always_path(void)
-{
- return s_conf.path.always;
-}
-
-EAPI const char * const widget_conf_log_path(void)
-{
- return s_conf.path.slave_log;
-}
-
-EAPI const char * const widget_conf_script_port(void)
-{
- return s_conf.path.script_port;
-}
-
-EAPI const char * const widget_conf_script_path(void)
-{
- return s_conf.path.script;
-}
-
-EAPI const char * const widget_conf_share_path(void)
-{
- return s_conf.path.image;
-}
-
-EAPI const char * const widget_conf_input_path(void)
-{
- return s_conf.path.input;
-}
-
-EAPI const double const widget_conf_ping_time(void)
-{
- return s_conf.ping_time;
-}
-
-EAPI const int const widget_conf_slave_max_load(void)
-{
- return s_conf.slave_max_load;
-}
-
-EAPI const int const widget_conf_premultiplied_alpha(void)
-{
- return s_conf.premultiplied;
-}
-
-EAPI const double const widget_conf_gbar_request_timeout(void)
-{
- return s_conf.gbar_request_timeout;
-}
-
-EAPI const double const widget_conf_scale_width_factor(void)
-{
- return s_conf.scale_width_factor;
-}
-
-EAPI const double const widget_conf_scale_height_factor(void)
-{
- return s_conf.scale_height_factor;
-}
-
-EAPI const char * const widget_conf_launch_key_name(void)
-{
- return s_conf.launch_key.name;
-}
-
-EAPI const char * const widget_conf_launch_key_auto_align(void)
-{
- return s_conf.launch_key.auto_align;
-}
-
-EAPI const char * const widget_conf_launch_key_secured(void)
-{
- return s_conf.launch_key.secured;
-}
-
-EAPI const char * const widget_conf_launch_key_abi(void)
-{
- return s_conf.launch_key.abi;
-}
-
-EAPI const char * const widget_conf_launch_key_hw_acceleration(void)
-{
- return s_conf.launch_key.hw_acceleration;
-}
-
-EAPI const char * const widget_conf_empty_content(void)
-{
- return s_conf.empty_content;
-}
-
-EAPI const char * const widget_conf_empty_title(void)
-{
- return s_conf.empty_title;
-}
-
-EAPI const char * const widget_conf_path(void)
-{
- return s_conf.path.conf;
-}
-
-EAPI const char * const widget_conf_root_path(void)
-{
- return s_conf.path.root;
-}
-
-EAPI const int const widget_conf_is_loaded(void)
-{
- return s_info.conf_loaded;
-}
-
-EAPI const int const widget_conf_use_gettimeofday(void)
-{
- return s_conf.flags.field.use_gettimeofday;
-}
-
-EAPI const int const widget_conf_slave_event_boost_on(void)
-{
- return s_conf.slave_event_boost_on;
-}
-
-EAPI const int const widget_conf_slave_event_boost_off(void)
-{
- return s_conf.slave_event_boost_off;
-}
-
-EAPI const double const widget_conf_event_filter(void)
-{
- return s_conf.event_filter;
-}
-
-EAPI const int const widget_conf_slave_limit_to_ttl(void)
-{
- return s_conf.flags.field.slave_limit_to_ttl;
-}
-
-EAPI const int const widget_conf_frame_skip(void)
-{
- return s_conf.frame_skip;
-}
-
-EAPI const int const widget_conf_slave_auto_cache_flush(void)
-{
- return s_conf.flags.field.slave_auto_cache_flush;
-}
-
-EAPI const char * const widget_conf_category_list(void)
-{
- return s_conf.category_list;
-}
-
-EAPI const double const widget_conf_fault_detect_in_time(void)
-{
- return s_conf.fault_detect_in_time;
-}
-
-EAPI const int const widget_conf_fault_detect_count(void)
-{
- return s_conf.fault_detect_count;
-}
-
-EAPI const int const widget_conf_reactivate_on_pause(void)
-{
- return s_conf.flags.field.reactivate_on_pause;
-}
-
-EAPI const char * const widget_conf_app_abi(void)
-{
- return s_conf.app_abi;
-}
-
-EAPI const double const widget_conf_visibility_change_delay(void)
-{
- return s_conf.visibility_change_delay;
-}
-
-EAPI const int const widget_conf_click_region(void)
-{
- return s_conf.click_region;
-}
-
-EAPI const char * const widget_conf_sdk_viewer(void)
-{
- return s_conf.sdk_viewer;
-}
-
-EAPI const char * const widget_conf_ee_key_for_update(void)
-{
- return s_conf.ee_key_for_update;
-}
-
-EAPI const int const widget_conf_force_to_terminate(void)
-{
- return s_conf.flags.field.force_to_terminate;
-}
-
-EAPI const int const widget_conf_update_on_pause(void)
-{
- return s_conf.flags.field.update_on_pause;
-}
-
-EAPI const int const widget_conf_enable_resource_lock(void)
-{
- return s_conf.flags.field.enable_resource_lock;
-}
-/* LCOV_EXCL_STOP */
-
-/* End of a file */