From: Nam KwanWoo Date: Wed, 3 Apr 2013 08:25:52 +0000 (+0900) Subject: add new API for external feature X-Git-Tag: submit/tizen_2.1/20130424.230621~6 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=fadf453da337141f78c3636a873ee13f15a7f820;p=platform%2Fcore%2Fapi%2Fsystem-info.git add new API for external feature Change-Id: Idee6cdb093e9d823abcae8667a9e40f4faa34845 --- diff --git a/include/system_info.h b/include/system_info.h index dd155b2..9def527 100644 --- a/include/system_info.h +++ b/include/system_info.h @@ -147,6 +147,11 @@ int system_info_get_value_double(system_info_key_e key, double *value); */ int system_info_get_value_string(system_info_key_e key, char **value); +int system_info_get_external_bool(const char *key, bool *value); +int system_info_get_external_int(const char *key, int *value); +int system_info_get_external_double(const char *key, double *value); +int system_info_get_external_string(const char *key, char **value); + /** * @} */ diff --git a/include/system_info_private.h b/include/system_info_private.h index 5332bce..57f5d11 100644 --- a/include/system_info_private.h +++ b/include/system_info_private.h @@ -31,6 +31,8 @@ extern "C" #define XML_FILE_PATH "/etc/config/sys-info.xml" #define MAXBUFSIZE 512 +#define EXTERNAL_VCONF_PREFIX "db/externals/" + typedef enum { SYSTEM_INFO_DATA_TYPE_STRING, SYSTEM_INFO_DATA_TYPE_INT, diff --git a/packaging/capi-system-info.spec b/packaging/capi-system-info.spec index d8ba454..22d4f66 100644 --- a/packaging/capi-system-info.spec +++ b/packaging/capi-system-info.spec @@ -1,8 +1,8 @@ #sbs-git:slp/api/system-info capi-system-info 0.1.0 63d15bafa590ee9de869c8a8ade712e06828e5c3 Name: capi-system-info Summary: A System Information library in SLP C API -Version: 0.1.9 -Release: 1 +Version: 0.1.10 +Release: 0 Group: System/Libraries License: Apache License, Version 2.0 and IEFT RFC Collection Source0: %{name}-%{version}.tar.gz diff --git a/src/system_info.c b/src/system_info.c index ebb6ea7..bbf7973 100644 --- a/src/system_info.c +++ b/src/system_info.c @@ -550,3 +550,59 @@ int system_info_get_value_string(system_info_key_e key, char **value) { return system_info_get_value(key, SYSTEM_INFO_DATA_TYPE_STRING, (void **)value); } + +int system_info_get_external_bool(const char *key, bool *value) +{ + char vconfkey[MAXBUFSIZE] = {0,}; + + snprintf(vconfkey, strlen(EXTERNAL_VCONF_PREFIX)+strlen(key)+1, "%s%s", EXTERNAL_VCONF_PREFIX, key); + + if (system_info_vconf_get_value_bool(vconfkey, value)) { + LOGE("key : %s, failed get bool value", key); + return SYSTEM_INFO_ERROR_IO_ERROR; + } + + return SYSTEM_INFO_ERROR_NONE; +} + +int system_info_get_external_int(const char *key, int *value) +{ + char vconfkey[MAXBUFSIZE] = {0,}; + + snprintf(vconfkey, strlen(EXTERNAL_VCONF_PREFIX)+strlen(key)+1, "%s%s", EXTERNAL_VCONF_PREFIX, key); + + if (system_info_vconf_get_value_int(vconfkey, value)) { + LOGE("key : %s, failed get int value", key); + return SYSTEM_INFO_ERROR_IO_ERROR; + } + + return SYSTEM_INFO_ERROR_NONE; +} + +int system_info_get_external_double(const char *key, double *value) +{ + char vconfkey[MAXBUFSIZE] = {0,}; + + snprintf(vconfkey, strlen(EXTERNAL_VCONF_PREFIX)+strlen(key)+1, "%s%s", EXTERNAL_VCONF_PREFIX, key); + + if (system_info_vconf_get_value_double(vconfkey, value)) { + LOGE("key : %s, failed get double value", key); + return SYSTEM_INFO_ERROR_IO_ERROR; + } + + return SYSTEM_INFO_ERROR_NONE; +} + +int system_info_get_external_string(const char *key, char **value) +{ + char vconfkey[MAXBUFSIZE] = {0,}; + + snprintf(vconfkey, strlen(EXTERNAL_VCONF_PREFIX)+strlen(key)+1, "%s%s", EXTERNAL_VCONF_PREFIX, key); + + if (system_info_vconf_get_value_string(vconfkey, value)) { + LOGE("key : %s, failed get string value", key); + return SYSTEM_INFO_ERROR_IO_ERROR; + } + + return SYSTEM_INFO_ERROR_NONE; +}