remove API for external feature
authorNam KwanWoo <kw46.nam@samsung.com>
Wed, 26 Jun 2013 08:43:51 +0000 (17:43 +0900)
committerNam KwanWoo <kw46.nam@samsung.com>
Wed, 26 Jun 2013 08:43:51 +0000 (17:43 +0900)
Change-Id: I9097d836a791021580a81cab6aa36b424ff3dd6d

CMakeLists.txt
include/system_info.h
include/system_info_private.h
packaging/capi-system-info.spec
src/system_info.c
src/system_info_screen.c
src/system_info_vconf.c [deleted file]

index 7dfb9338fe513086df1cbb1fe33b6061fc7c4322..8c630e7e2343c6e7e9757dc7467bcf0b4854b6a8 100644 (file)
@@ -10,7 +10,7 @@ SET(PREFIX ${CMAKE_INSTALL_PREFIX})
 SET(INC_DIR include)
 INCLUDE_DIRECTORIES(${INC_DIR})
 
-SET(requires "dlog capi-base-common x11 xi xrandr xproto vconf iniparser libxml-2.0")
+SET(requires "dlog capi-base-common xi xrandr iniparser libxml-2.0")
 SET(pc_requires "capi-base-common")
 
 INCLUDE(FindPkgConfig)
index 6227be51413aa5d9b6985e63fd2830faa8f26c05..7b6133f46ee7f0ec091735373c4922c71904614c 100644 (file)
@@ -143,11 +143,6 @@ 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);
-
 /**
  * @brief   Gets the boolean value of the platform feature
  * @param[in] key The name of the platform feature to get
index 207e66ab431cd031bf873bd44720ab8ec5355328..2e7cc43f334cc2c2a9ec2ec7b41683b7fa619355 100644 (file)
@@ -35,8 +35,6 @@ extern "C"
 #define CONFIG_FILE_PATH "/etc/config/model-config.xml"
 #define MAXBUFSIZE 512
 
-#define EXTERNAL_VCONF_PREFIX "db/externals/"
-
 #define PLATFORM_TAG   "platform"
 #define CUSTOM_TAG     "custom"
 #define INTERNAL_TAG   "internal"
index e0ed85c4be1f15806540fd1dc62a71b7b67d2068..8e357bec5aa6306398f17de36b3e480b73f5d549 100644 (file)
@@ -4,16 +4,13 @@ Summary:      A System Information library in SLP C API
 Version:       0.2.0
 Release:       0
 Group:         System/Libraries
-License:       Apache License, Version 2.0 and IEFT RFC Collection
+License:       Apache License, Version 2.0
 Source0:       %{name}-%{version}.tar.gz
 BuildRequires: cmake
 BuildRequires: pkgconfig(dlog)
 BuildRequires: pkgconfig(capi-base-common)
-BuildRequires:  pkgconfig(vconf)
-BuildRequires:  pkgconfig(x11)
 BuildRequires:  pkgconfig(xi)
 BuildRequires: pkgconfig(xrandr)
-BuildRequires: pkgconfig(xproto)
 BuildRequires: pkgconfig(iniparser)
 BuildRequires:         pkgconfig(libxml-2.0)
 
index 31cea2a578da3f767a2d87784f150ceee891b650..8ce2a5c7bcc6b753cb04643ef0fda432f48a5497 100644 (file)
@@ -501,62 +501,6 @@ API 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);
 }
 
-API 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;
-}
-
-API 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;
-}
-
-API 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;
-}
-
-API 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;
-}
-
 API int system_info_get_platform_bool(const char *key, bool *value)
 {
        int ret;
index 707adc7cefba8f0c7356c16d0f6ea26250276d8e..786dc4b099cd19e023cfd8c3f7de997fc63de111 100644 (file)
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <math.h>
 
 #include <dlog.h>
 
-#include <X11/X.h>
 #include <X11/Xlib.h>
 #include <X11/extensions/Xrandr.h>
 
@@ -49,20 +47,13 @@ struct _progInfo {
        XRRScreenResources *res;
 };
 
-static int RCA_SUPPORTED;
-static int HDMI_SUPPORTED;
-static int SCREEN_DPI;
-static int BITS_PER_PIXEL;
-static int SCREEN_WIDTH;
-static int SCREEN_HEIGHT;
 static int PHYSICAL_SCREEN_WIDTH;
 static int PHYSICAL_SCREEN_HEIGHT;
 int system_info_screen_initialized;
 
 int system_info_screen_init()
 {
-       int i, n;
-       XPixmapFormatValues *pmf = NULL;
+       int i;
 
        memset(&g_pinfo, 0x0, sizeof(ProgInfo));
 
@@ -91,21 +82,6 @@ int system_info_screen_init()
                return -1;
        }
 
-       pmf = XListPixmapFormats(g_pinfo.dpy, &n);
-
-       if (!pmf) {
-               LOGE("XListPixmapFormats Failed");
-               XCloseDisplay(g_pinfo.dpy);
-               return -1;
-       }
-
-       for (i = 0; i < n; i++) {
-               if (BITS_PER_PIXEL < pmf[i].bits_per_pixel)
-                       BITS_PER_PIXEL = pmf[i].bits_per_pixel;
-       }
-       XFree(pmf);
-       pmf = NULL;
-
        for (i = 0; i < g_pinfo.res->noutput; i++) {
                XRROutputInfo *output_info = XRRGetOutputInfo(g_pinfo.dpy, g_pinfo.res, g_pinfo.res->outputs[i]);
                if (!output_info) {
@@ -121,69 +97,12 @@ int system_info_screen_init()
                        if (!crtc_info)
                                break;
 
-                       SCREEN_WIDTH = crtc_info->width;
-                       SCREEN_HEIGHT = crtc_info->height;
                        PHYSICAL_SCREEN_WIDTH = output_info->mm_width;
                        PHYSICAL_SCREEN_HEIGHT = output_info->mm_height;
 
                        XRRFreeCrtcInfo(crtc_info);
-               } else if (!strcmp(output_info->name, "HDMI1"))
-                       HDMI_SUPPORTED = true;
-               XRRFreeOutputInfo(output_info);
-       }
-
-       if (BITS_PER_PIXEL == 0) {
-               LOGE("BIT PER PIXEL is Zero");
-               XCloseDisplay(g_pinfo.dpy);
-               return -1;
-       }
-
-       if (!SCREEN_WIDTH)
-               SCREEN_WIDTH = DisplayWidth(g_pinfo.dpy, DefaultScreen(g_pinfo.dpy));
-
-       if (!SCREEN_WIDTH) {
-               LOGE("SCREEN WIDTH is Zero");
-               XCloseDisplay(g_pinfo.dpy);
-               return -1;
-       }
-
-       if (!SCREEN_HEIGHT)
-               SCREEN_HEIGHT = DisplayHeight(g_pinfo.dpy, DefaultScreen(g_pinfo.dpy));
-
-       if (!SCREEN_HEIGHT) {
-               LOGE("SCREEN HEIGHT is Zero");
-               XCloseDisplay(g_pinfo.dpy);
-               return -1;
-       }
-
-       if (system_info_get_system_info_model_type() == SYSTEM_INFO_MODEL_TYPE_EMULATOR) {
-               FILE *cmdline;
-               char *dpi;
-               char str[MAXBUFSIZE];
-
-               cmdline = fopen(CMDLINE_PATH, "r");
-               if (NULL == cmdline) {
-                       LOGE("cannot file open %s file!!!", CPU_INFO_FILE_PATH);
-                       XCloseDisplay(g_pinfo.dpy);
-                       return SYSTEM_INFO_ERROR_IO_ERROR;
-               } else {
-                       while (fgets(str, MAXBUFSIZE, cmdline)) {
-                               dpi = strstr(str, "dpi=");
-                               SCREEN_DPI = atoi(dpi+4) / 10;
-                               break;
-                       }
                }
-               fclose(cmdline);
-
-       } else {
-               double dp, di;
-
-               /* diagonal size(logical) by pixel */
-               dp = sqrt(SCREEN_WIDTH*SCREEN_WIDTH+SCREEN_HEIGHT*SCREEN_HEIGHT);
-               /* diagonal size(physical) by inch */
-               di = sqrt(PHYSICAL_SCREEN_WIDTH*PHYSICAL_SCREEN_WIDTH + PHYSICAL_SCREEN_HEIGHT*PHYSICAL_SCREEN_HEIGHT) / 10 / 2.54;
-               /* DPI = PPI */
-               SCREEN_DPI = round(dp/di);
+               XRRFreeOutputInfo(output_info);
        }
 
        XCloseDisplay(g_pinfo.dpy);
@@ -195,111 +114,40 @@ int system_info_screen_init()
 
 int system_info_get_screen_bits_per_pixel(system_info_key_e key, system_info_data_type_e data_type, void **value)
 {
-       int *bpp;
-       int ret_val;
-
-       bpp = (int *)value;
-
-       if (0 == system_info_screen_initialized) {
-               ret_val = system_info_screen_init();
-               if (ret_val)
-                       return ret_val;
-       }
-
-       *bpp = BITS_PER_PIXEL;
-
-       return SYSTEM_INFO_ERROR_NONE;
+       return system_info_get_platform_int("tizen.org/feature/screen.bpp", (int *)value);
 }
 
 int system_info_get_screen_width(system_info_key_e key, system_info_data_type_e data_type, void **value)
 {
-       int *width;
-       int ret_val;
-
-       width = (int *)value;
-
-       if (0 == system_info_screen_initialized) {
-               ret_val = system_info_screen_init();
-               if (ret_val)
-                       return ret_val;
-       }
-
-       *width = SCREEN_WIDTH;
-
-       return SYSTEM_INFO_ERROR_NONE;
+       return system_info_get_platform_int("tizen.org/feature/screen.width", (int *)value);
 }
 
 int system_info_get_screen_height(system_info_key_e key, system_info_data_type_e data_type, void **value)
 {
-       int *height;
-       int ret_val;
-
-       height = (int *)value;
-
-       if (0 == system_info_screen_initialized) {
-               ret_val = system_info_screen_init();
-               if (ret_val)
-                       return ret_val;
-       }
-
-       *height = SCREEN_HEIGHT;
-
-       return SYSTEM_INFO_ERROR_NONE;
+       return system_info_get_platform_int("tizen.org/feature/screen.height", (int *)value);
 }
 
 int system_info_get_screen_DPI(system_info_key_e key, system_info_data_type_e data_type, void **value)
 {
-       int *bpp;
-       int ret_val;
-
-       bpp = (int *)value;
-
-       if (0 == system_info_screen_initialized) {
-               ret_val = system_info_screen_init();
-               if (ret_val)
-                       return ret_val;
-       }
-
-       *bpp = SCREEN_DPI;
-
-       return SYSTEM_INFO_ERROR_NONE;
+       return system_info_get_platform_int("tizen.org/feature/screen.dpi", (int *)value);
 }
 
 int system_info_get_hdmi_supported(system_info_key_e key, system_info_data_type_e data_type, void **value)
 {
-       bool *supported;
-       int ret_val;
-
-       if (0 == system_info_screen_initialized) {
-               ret_val = system_info_screen_init();
-               if (ret_val)
-                       return ret_val;
-       }
-
-       supported = (bool *)value;
-
-       *supported = HDMI_SUPPORTED;
-
-       return SYSTEM_INFO_ERROR_NONE;
+       return system_info_get_platform_bool("tizen.org/feature/screen.output.hdmi", (bool *)value);
 }
 
 int system_info_get_rca_supported(system_info_key_e key, system_info_data_type_e data_type, void **value)
 {
-       bool *supported;
-
-       supported = (bool *)value;
-
-       *supported = RCA_SUPPORTED;
-
-       return SYSTEM_INFO_ERROR_NONE;
+       return system_info_get_platform_bool("tizen.org/feature/screen.output.rca", (bool *)value);
 }
 
 int system_info_get_physical_screen_height(system_info_key_e key, system_info_data_type_e data_type, void **value)
 {
-       int *bpp;
+       int *height;
        int ret_val;
 
-       bpp = (int *)value;
+       height = (int *)value;
 
        if (0 == system_info_screen_initialized) {
                ret_val = system_info_screen_init();
@@ -307,17 +155,17 @@ int system_info_get_physical_screen_height(system_info_key_e key, system_info_da
                        return ret_val;
        }
 
-       *bpp = PHYSICAL_SCREEN_HEIGHT;
+       *height = PHYSICAL_SCREEN_HEIGHT;
 
        return SYSTEM_INFO_ERROR_NONE;
 }
 
 int system_info_get_physical_screen_width(system_info_key_e key, system_info_data_type_e data_type, void **value)
 {
-       int *bpp;
+       int *width;
        int ret_val;
 
-       bpp = (int *)value;
+       width = (int *)value;
 
        if (0 == system_info_screen_initialized) {
                ret_val = system_info_screen_init();
@@ -325,7 +173,7 @@ int system_info_get_physical_screen_width(system_info_key_e key, system_info_dat
                        return ret_val;
        }
 
-       *bpp = PHYSICAL_SCREEN_WIDTH;
+       *width = PHYSICAL_SCREEN_WIDTH;
 
        return SYSTEM_INFO_ERROR_NONE;
 }
diff --git a/src/system_info_vconf.c b/src/system_info_vconf.c
deleted file mode 100644 (file)
index 264dabf..0000000
+++ /dev/null
@@ -1,60 +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.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include <vconf.h>
-#include <dlog.h>
-
-#include <system_info.h>
-#include <system_info_private.h>
-
-#ifdef LOG_TAG
-#undef LOG_TAG
-#endif
-
-#define LOG_TAG "CAPI_SYSTEM_INFO"
-
-int system_info_vconf_get_value_int(const char *vconf_key, int *value)
-{
-       return vconf_get_int(vconf_key, value);
-}
-
-int system_info_vconf_get_value_bool(const char *vconf_key, bool *value)
-{
-       return vconf_get_bool(vconf_key, (int *)value);
-}
-
-int system_info_vconf_get_value_double(const char *vconf_key, double *value)
-{
-       return vconf_get_dbl(vconf_key, value);
-}
-
-int system_info_vconf_get_value_string(const char *vconf_key, char **value)
-{
-       char *str_value = NULL;
-
-       str_value = vconf_get_str(vconf_key);
-
-       if (str_value != NULL) {
-               *value = str_value;
-               return 0;
-       } else {
-               return -1;
-       }
-}